2 # SPDX-License-Identifier: ISC
5 # Copyright (c) 2021 by VMware, Inc. ("VMware")
6 # Used Copyright (c) 2018 by Network Device Education Foundation, Inc.
7 # ("NetDEF") in this file.
11 """OSPF Basic Functionality Automation."""
16 from time
import sleep
17 from copy
import deepcopy
19 from lib
.topotest
import frr_unicode
21 pytestmark
= pytest
.mark
.ospf6d
23 # Save the Current Working Directory to find configuration files.
24 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
25 sys
.path
.append(os
.path
.join(CWD
, "../"))
26 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
28 # pylint: disable=C0413
29 # Import topogen and topotest helpers
30 from lib
.topogen
import Topogen
, get_topogen
32 # Import topoJson from lib, to create topology and initial configuration
33 from lib
.common_config
import (
37 reset_config_on_routers
,
39 shutdown_bringup_interface
,
41 from lib
.topolog
import logger
42 from lib
.topojson
import build_topo_from_json
, build_config_from_json
43 from lib
.ospf
import verify_ospf6_neighbor
, config_ospf6_interface
, clear_ospf
44 from ipaddress
import IPv4Address
48 # Reading the data from JSON File for topology creation
49 jsonFile
= "{}/ospfv3_authentication.json".format(CWD
)
51 with
open(jsonFile
, "r") as topoJson
:
52 topo
= json
.load(topoJson
)
54 assert False, "Could not read file {}".format(jsonFile
)
57 Please view in a fixed-width font such as Courier.
59 +R1 +------------+R2 |
68 +R0 +-------------+R3 |
72 1. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
73 using MD5 manual key configuration.
74 2. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
75 using HMAC-SHA-256 manual key configuration.
76 3. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
77 using MD5 keychain configuration.
78 4. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
79 using HMAC-SHA-256 keychain configuration.
84 def setup_module(mod
):
86 Sets up the pytest environment
89 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
90 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
93 logger
.info("Running setup_module to create topology")
95 # This function initiates the topology build with Topogen...
96 json_file
= "{}/ospfv3_single_area.json".format(CWD
)
97 tgen
= Topogen(json_file
, mod
.__name
__)
100 # ... and here it calls Mininet initialization functions.
102 # Starting topology, create tmp files which are loaded to routers
103 # to start daemons and then start routers
106 # Creating configuration from JSON
107 build_config_from_json(tgen
, topo
)
109 # Don't run this test if we have any failure.
110 if tgen
.routers_have_failure():
111 pytest
.skip(tgen
.errors
)
113 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
)
114 assert ospf6_covergence
is True, "setup_module :Failed \n Error:" " {}".format(
118 logger
.info("Running setup_module() done")
121 def teardown_module(mod
):
123 Teardown the pytest environment.
127 logger
.info("Running teardown_module to delete topology")
131 # Stop toplogy and Remove tmp files
135 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
137 logger
.info("=" * 40)
140 # ##################################
141 # Test cases start here.
142 # ##################################
145 def test_ospf6_auth_trailer_tc1_md5(request
):
147 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
148 using MD5 manual key configuration.
151 tc_name
= request
.node
.name
152 write_test_header(tc_name
)
155 step("Bring up the base config.")
156 reset_config_on_routers(tgen
)
158 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
159 "connected to R2 with auth trailer"
175 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
176 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
178 step("Verify that the neighbour is not FULL between R1 and R2.")
179 # wait for dead time expiry.
182 ospf6_covergence
= verify_ospf6_neighbor(
183 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
185 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
186 tc_name
, ospf6_covergence
190 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
191 "connected to R1 with auth trailer"
207 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
208 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
211 "Verify that the neighbour is FULL between R1 and R2 "
212 "using show ipv6 ospf6 neighbor cmd."
216 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
217 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
218 tc_name
, ospf6_covergence
221 step("Disable authentication on R2 ")
237 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
238 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
240 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
241 # wait till the dead timer expiry
244 ospf6_covergence
= verify_ospf6_neighbor(
245 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
247 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
248 tc_name
, ospf6_covergence
251 step("Again On R2 enable ospf6 on interface with message-digest auth")
265 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
266 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
269 "Verify that the neighbour is FULL between R1 and R2 using"
270 " show ip ospf6 neighbor cmd."
274 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
275 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
276 tc_name
, ospf6_covergence
279 step("Shut no shut interface on R1")
281 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
282 shutdown_bringup_interface(tgen
, dut
, intf
, False)
286 "Verify that the neighbour is not FULL between R1 and R2 using "
287 "show ip ospf6 neighbor cmd."
289 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
290 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
291 tc_name
, ospf6_covergence
295 shutdown_bringup_interface(tgen
, dut
, intf
, True)
298 "Verify that the neighbour is FULL between R1 and R2 using "
299 "show ip ospf6 neighbor cmd."
303 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
304 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
305 tc_name
, ospf6_covergence
308 write_test_footer(tc_name
)
311 def test_ospf6_auth_trailer_tc2_sha256(request
):
313 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
314 using HMAC-SHA-256 manual key configuration.
317 tc_name
= request
.node
.name
318 write_test_header(tc_name
)
321 step("Bring up the base config.")
322 reset_config_on_routers(tgen
)
324 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
325 "connected to R2 with auth trailer"
333 "hash-algo": "hmac-sha-256",
341 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
342 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
344 step("Verify that the neighbour is not FULL between R1 and R2.")
345 # wait for dead time expiry.
348 ospf6_covergence
= verify_ospf6_neighbor(
349 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
351 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
352 tc_name
, ospf6_covergence
356 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
357 "connected to R1 with auth trailer"
365 "hash-algo": "hmac-sha-256",
373 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
374 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
377 "Verify that the neighbour is FULL between R1 and R2 "
378 "using show ipv6 ospf6 neighbor cmd."
382 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
383 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
384 tc_name
, ospf6_covergence
387 step("Disable authentication on R2 ")
394 "hash-algo": "hmac-sha-256",
403 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
404 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
406 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
407 # wait till the dead timer expiry
410 ospf6_covergence
= verify_ospf6_neighbor(
411 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
413 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
414 tc_name
, ospf6_covergence
417 step("Again On R2 enable ospf6 on interface with message-digest auth")
423 "hash-algo": "hmac-sha-256",
431 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
432 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
435 "Verify that the neighbour is FULL between R1 and R2 using"
436 " show ip ospf6 neighbor cmd."
440 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
441 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
442 tc_name
, ospf6_covergence
445 step("Shut no shut interface on R1")
447 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
448 shutdown_bringup_interface(tgen
, dut
, intf
, False)
452 "Verify that the neighbour is not FULL between R1 and R2 using "
453 "show ip ospf6 neighbor cmd."
455 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
456 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
457 tc_name
, ospf6_covergence
461 shutdown_bringup_interface(tgen
, dut
, intf
, True)
464 "Verify that the neighbour is FULL between R1 and R2 using "
465 "show ip ospf6 neighbor cmd."
469 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
470 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
471 tc_name
, ospf6_covergence
474 write_test_footer(tc_name
)
477 def test_ospf6_auth_trailer_tc3_keychain_md5(request
):
479 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
480 using MD5 keychain configuration.
483 tc_name
= request
.node
.name
484 write_test_header(tc_name
)
487 step("Bring up the base config.")
488 reset_config_on_routers(tgen
)
490 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
491 "connected to R2 with auth trailer"
494 router1
= tgen
.gears
["r1"]
495 router2
= tgen
.gears
["r2"]
498 """configure terminal
502 cryptographic-algorithm md5"""
506 """configure terminal
510 cryptographic-algorithm md5"""
524 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
525 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
527 step("Verify that the neighbour is not FULL between R1 and R2.")
528 # wait for dead time expiry.
531 ospf6_covergence
= verify_ospf6_neighbor(
532 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
534 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
535 tc_name
, ospf6_covergence
539 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
540 "connected to R1 with auth trailer"
554 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
555 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
558 "Verify that the neighbour is FULL between R1 and R2 "
559 "using show ipv6 ospf6 neighbor cmd."
563 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
564 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
565 tc_name
, ospf6_covergence
568 step("Disable authentication on R2 ")
571 "r2": {"links": {"r1": {"ospf6": {"keychain": "auth", "del_action": True}}}}
573 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
574 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
576 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
577 # wait till the dead timer expiry
580 ospf6_covergence
= verify_ospf6_neighbor(
581 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
583 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
584 tc_name
, ospf6_covergence
587 step("Again On R2 enable ospf6 on interface with message-digest auth")
599 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
600 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
603 "Verify that the neighbour is FULL between R1 and R2 using"
604 " show ip ospf6 neighbor cmd."
608 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
609 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
610 tc_name
, ospf6_covergence
613 step("Shut no shut interface on R1")
615 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
616 shutdown_bringup_interface(tgen
, dut
, intf
, False)
620 "Verify that the neighbour is not FULL between R1 and R2 using "
621 "show ip ospf6 neighbor cmd."
623 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
624 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
625 tc_name
, ospf6_covergence
629 shutdown_bringup_interface(tgen
, dut
, intf
, True)
632 "Verify that the neighbour is FULL between R1 and R2 using "
633 "show ip ospf6 neighbor cmd."
637 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
638 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
639 tc_name
, ospf6_covergence
642 write_test_footer(tc_name
)
645 def test_ospf6_auth_trailer_tc4_keychain_sha256(request
):
647 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
648 using HMAC-SHA-256 keychain configuration.
651 tc_name
= request
.node
.name
652 write_test_header(tc_name
)
655 step("Bring up the base config.")
656 reset_config_on_routers(tgen
)
658 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
659 "connected to R2 with auth trailer"
662 router1
= tgen
.gears
["r1"]
663 router2
= tgen
.gears
["r2"]
666 """configure terminal
670 cryptographic-algorithm hmac-sha-256"""
674 """configure terminal
678 cryptographic-algorithm hmac-sha-256"""
692 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
693 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
695 step("Verify that the neighbour is not FULL between R1 and R2.")
696 # wait for dead time expiry.
699 ospf6_covergence
= verify_ospf6_neighbor(
700 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
702 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
703 tc_name
, ospf6_covergence
707 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
708 "connected to R1 with auth trailer"
722 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
723 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
726 "Verify that the neighbour is FULL between R1 and R2 "
727 "using show ipv6 ospf6 neighbor cmd."
731 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
732 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
733 tc_name
, ospf6_covergence
736 step("Disable authentication on R2 ")
739 "r2": {"links": {"r1": {"ospf6": {"keychain": "auth", "del_action": True}}}}
741 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
742 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
744 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
745 # wait till the dead timer expiry
748 ospf6_covergence
= verify_ospf6_neighbor(
749 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
751 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
752 tc_name
, ospf6_covergence
755 step("Again On R2 enable ospf6 on interface with message-digest auth")
767 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
768 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
771 "Verify that the neighbour is FULL between R1 and R2 using"
772 " show ip ospf6 neighbor cmd."
776 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
777 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
778 tc_name
, ospf6_covergence
781 step("Shut no shut interface on R1")
783 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
784 shutdown_bringup_interface(tgen
, dut
, intf
, False)
788 "Verify that the neighbour is not FULL between R1 and R2 using "
789 "show ip ospf6 neighbor cmd."
791 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
792 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
793 tc_name
, ospf6_covergence
797 shutdown_bringup_interface(tgen
, dut
, intf
, True)
800 "Verify that the neighbour is FULL between R1 and R2 using "
801 "show ip ospf6 neighbor cmd."
805 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
806 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
807 tc_name
, ospf6_covergence
810 write_test_footer(tc_name
)
813 def test_ospf6_auth_trailer_tc5_md5_keymissmatch(request
):
815 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
816 using MD5 manual key configuration.
819 tc_name
= request
.node
.name
820 write_test_header(tc_name
)
823 step("Bring up the base config.")
824 reset_config_on_routers(tgen
)
826 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
827 "connected to R2 with auth trailer"
843 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
844 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
846 step("Verify that the neighbour is not FULL between R1 and R2.")
847 # wait for dead time expiry.
850 ospf6_covergence
= verify_ospf6_neighbor(
851 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
853 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
854 tc_name
, ospf6_covergence
858 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
859 "connected to R1 with auth trailer wrong key"
868 "key": "ospf6-missmatch",
875 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
876 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
879 "Verify that the neighbour is not FULL between R1 and R2 "
880 "using show ipv6 ospf6 neighbor cmd."
883 step("Verify that the neighbour is FULL between R1 and R2.")
884 # wait for dead time expiry.
887 ospf6_covergence
= verify_ospf6_neighbor(
888 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
890 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
891 tc_name
, ospf6_covergence
895 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
896 "connected to R1 with auth trailer correct key"
912 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
913 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
916 "Verify that the neighbour is FULL between R1 and R2 "
917 "using show ipv6 ospf6 neighbor cmd."
921 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
922 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
923 tc_name
, ospf6_covergence
926 write_test_footer(tc_name
)
929 def test_ospf6_auth_trailer_tc6_sha256_mismatch(request
):
931 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
932 using HMAC-SHA-256 manual key configuration.
935 tc_name
= request
.node
.name
936 write_test_header(tc_name
)
939 step("Bring up the base config.")
940 reset_config_on_routers(tgen
)
942 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
943 "connected to R2 with auth trailer"
951 "hash-algo": "hmac-sha-256",
959 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
960 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
962 step("Verify that the neighbour is not FULL between R1 and R2.")
963 # wait for dead time expiry.
966 ospf6_covergence
= verify_ospf6_neighbor(
967 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
969 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
970 tc_name
, ospf6_covergence
974 "Configure ospf6 with on R1 and R2, enable ospf6 on R2 interface "
975 "connected to R1 with auth trailer wrong key"
983 "hash-algo": "hmac-sha-256",
984 "key": "ospf6-missmatch",
991 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
992 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
994 step("Verify that the neighbour is not FULL between R1 and R2.")
995 # wait for dead time expiry.
998 ospf6_covergence
= verify_ospf6_neighbor(
999 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1001 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1002 tc_name
, ospf6_covergence
1006 "Configure ospf6 with on R1 and R2, enable ospf6 on R2 interface "
1007 "connected to R1 with auth trailer wrong key"
1015 "hash-algo": "hmac-sha-256",
1023 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1024 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1027 "Verify that the neighbour is FULL between R1 and R2 "
1028 "using show ipv6 ospf6 neighbor cmd."
1032 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1033 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1034 tc_name
, ospf6_covergence
1037 write_test_footer(tc_name
)
1040 def test_ospf6_auth_trailer_tc7_keychain_md5_missmatch(request
):
1042 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
1043 using MD5 keychain configuration.
1046 tc_name
= request
.node
.name
1047 write_test_header(tc_name
)
1048 tgen
= get_topogen()
1050 step("Bring up the base config.")
1051 reset_config_on_routers(tgen
)
1053 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1054 "connected to R2 with auth trailer"
1057 router1
= tgen
.gears
["r1"]
1058 router2
= tgen
.gears
["r2"]
1061 """configure terminal
1065 cryptographic-algorithm md5"""
1069 """configure terminal
1073 cryptographic-algorithm md5"""
1077 """configure terminal
1078 key chain auth-missmatch
1080 key-string ospf6-missmatch
1081 cryptographic-algorithm md5"""
1095 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1096 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1098 step("Verify that the neighbour is not FULL between R1 and R2.")
1099 # wait for dead time expiry.
1102 ospf6_covergence
= verify_ospf6_neighbor(
1103 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1105 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1106 tc_name
, ospf6_covergence
1110 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1111 "connected to R1 with auth trailer with wrong keychain"
1119 "keychain": "auth-missmatch",
1125 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1126 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1128 step("Verify that the neighbour is not FULL between R1 and R2.")
1129 # wait for dead time expiry.
1132 ospf6_covergence
= verify_ospf6_neighbor(
1133 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1135 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1136 tc_name
, ospf6_covergence
1140 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1141 "connected to R1 with auth trailer with correct keychain"
1155 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1156 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1159 "Verify that the neighbour is FULL between R1 and R2 "
1160 "using show ipv6 ospf6 neighbor cmd."
1164 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1165 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1166 tc_name
, ospf6_covergence
1169 write_test_footer(tc_name
)
1172 def test_ospf6_auth_trailer_tc8_keychain_sha256_missmatch(request
):
1174 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
1175 using HMAC-SHA-256 keychain configuration.
1178 tc_name
= request
.node
.name
1179 write_test_header(tc_name
)
1180 tgen
= get_topogen()
1182 step("Bring up the base config.")
1183 reset_config_on_routers(tgen
)
1185 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1186 "connected to R2 with auth trailer"
1189 router1
= tgen
.gears
["r1"]
1190 router2
= tgen
.gears
["r2"]
1193 """configure terminal
1197 cryptographic-algorithm hmac-sha-256"""
1201 """configure terminal
1205 cryptographic-algorithm hmac-sha-256"""
1209 """configure terminal
1210 key chain auth-missmatch
1212 key-string ospf6-missmatch
1213 cryptographic-algorithm hmac-sha-256"""
1227 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1228 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1230 step("Verify that the neighbour is not FULL between R1 and R2.")
1231 # wait for dead time expiry.
1234 ospf6_covergence
= verify_ospf6_neighbor(
1235 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1237 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1238 tc_name
, ospf6_covergence
1242 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1243 "connected to R1 with auth trailer wrong keychain"
1251 "keychain": "auth-missmatch",
1257 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1258 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1260 step("Verify that the neighbour is not FULL between R1 and R2.")
1261 # wait for dead time expiry.
1264 ospf6_covergence
= verify_ospf6_neighbor(
1265 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1267 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1268 tc_name
, ospf6_covergence
1272 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1273 "connected to R1 with auth trailer correct keychain"
1287 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1288 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1291 "Verify that the neighbour is FULL between R1 and R2 "
1292 "using show ipv6 ospf6 neighbor cmd."
1296 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1297 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1298 tc_name
, ospf6_covergence
1301 write_test_footer(tc_name
)
1304 def test_ospf6_auth_trailer_tc9_keychain_not_configured(request
):
1306 OSPFv3 Neighborship without Authentication Trailer -
1307 Verify ospfv3 neighborship when no authentication trailer is configured.
1310 tc_name
= request
.node
.name
1311 write_test_header(tc_name
)
1312 tgen
= get_topogen()
1314 step("Bring up the base config.")
1315 reset_config_on_routers(tgen
)
1317 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1318 "connected to R2 with auth trailer"
1321 router1
= tgen
.gears
["r1"]
1322 router2
= tgen
.gears
["r2"]
1335 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1336 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1338 step("Verify that the neighbour is not FULL between R1 and R2.")
1339 # wait for dead time expiry.
1342 ospf6_covergence
= verify_ospf6_neighbor(
1343 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1345 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1346 tc_name
, ospf6_covergence
1350 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1351 "connected to R1 with auth trailer non existing keychain"
1365 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1366 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1368 step("Verify that the neighbour is not FULL between R1 and R2.")
1369 # wait for dead time expiry.
1372 ospf6_covergence
= verify_ospf6_neighbor(
1373 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1375 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1376 tc_name
, ospf6_covergence
1379 write_test_footer(tc_name
)
1382 def test_ospf6_auth_trailer_tc10_no_auth_trailer(request
):
1384 OSPFv3 Neighborship without Authentication Trailer -
1385 Verify ospfv3 neighborship when no authentication trailer is configured.
1388 tc_name
= request
.node
.name
1389 write_test_header(tc_name
)
1390 tgen
= get_topogen()
1392 step("Bring up the base config.")
1393 reset_config_on_routers(tgen
)
1395 router1
= tgen
.gears
["r1"]
1396 router2
= tgen
.gears
["r2"]
1399 "Verify that the neighbour is FULL between R1 and R2 "
1400 "using show ipv6 ospf6 neighbor cmd."
1404 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1405 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1406 tc_name
, ospf6_covergence
1409 write_test_footer(tc_name
)
1412 if __name__
== "__main__":
1413 args
= ["-s"] + sys
.argv
[1:]
1414 sys
.exit(pytest
.main(args
))