4 # Copyright (c) 2021 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation, Inc.
6 # ("NetDEF") in this file.
8 # Permission to use, copy, modify, and/or distribute this software
9 # for any purpose with or without fee is hereby granted, provided
10 # that the above copyright notice and this permission notice appear
13 # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
14 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
16 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
17 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 """OSPF Basic Functionality Automation."""
29 from time
import sleep
30 from copy
import deepcopy
32 from lib
.topotest
import frr_unicode
34 pytestmark
= pytest
.mark
.ospf6d
36 # Save the Current Working Directory to find configuration files.
37 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
38 sys
.path
.append(os
.path
.join(CWD
, "../"))
39 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
41 # pylint: disable=C0413
42 # Import topogen and topotest helpers
43 from lib
.topogen
import Topogen
, get_topogen
45 # Import topoJson from lib, to create topology and initial configuration
46 from lib
.common_config
import (
50 reset_config_on_routers
,
52 shutdown_bringup_interface
,
54 from lib
.topolog
import logger
55 from lib
.topojson
import build_topo_from_json
, build_config_from_json
56 from lib
.ospf
import verify_ospf6_neighbor
, config_ospf6_interface
, clear_ospf
57 from ipaddress
import IPv4Address
61 # Reading the data from JSON File for topology creation
62 jsonFile
= "{}/ospfv3_authentication.json".format(CWD
)
64 with
open(jsonFile
, "r") as topoJson
:
65 topo
= json
.load(topoJson
)
67 assert False, "Could not read file {}".format(jsonFile
)
70 Please view in a fixed-width font such as Courier.
72 +R1 +------------+R2 |
81 +R0 +-------------+R3 |
85 1. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
86 using MD5 manual key configuration.
87 2. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
88 using HMAC-SHA-256 manual key configuration.
89 3. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
90 using MD5 keychain configuration.
91 4. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
92 using HMAC-SHA-256 keychain configuration.
97 def setup_module(mod
):
99 Sets up the pytest environment
102 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
103 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
104 logger
.info("=" * 40)
106 logger
.info("Running setup_module to create topology")
108 # This function initiates the topology build with Topogen...
109 json_file
= "{}/ospfv3_single_area.json".format(CWD
)
110 tgen
= Topogen(json_file
, mod
.__name
__)
112 topo
= tgen
.json_topo
113 # ... and here it calls Mininet initialization functions.
115 # Starting topology, create tmp files which are loaded to routers
116 # to start daemons and then start routers
119 # Creating configuration from JSON
120 build_config_from_json(tgen
, topo
)
122 # Don't run this test if we have any failure.
123 if tgen
.routers_have_failure():
124 pytest
.skip(tgen
.errors
)
126 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
)
127 assert ospf6_covergence
is True, "setup_module :Failed \n Error:" " {}".format(
131 logger
.info("Running setup_module() done")
134 def teardown_module(mod
):
136 Teardown the pytest environment.
140 logger
.info("Running teardown_module to delete topology")
144 # Stop toplogy and Remove tmp files
148 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
150 logger
.info("=" * 40)
153 # ##################################
154 # Test cases start here.
155 # ##################################
158 def test_ospf6_auth_trailer_tc1_md5(request
):
160 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
161 using MD5 manual key configuration.
164 tc_name
= request
.node
.name
165 write_test_header(tc_name
)
168 step("Bring up the base config.")
169 reset_config_on_routers(tgen
)
171 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
172 "connected to R2 with auth trailer"
188 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
189 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
191 step("Verify that the neighbour is not FULL between R1 and R2.")
192 # wait for dead time expiry.
195 ospf6_covergence
= verify_ospf6_neighbor(
196 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
198 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
199 tc_name
, ospf6_covergence
203 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
204 "connected to R1 with auth trailer"
220 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
221 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
224 "Verify that the neighbour is FULL between R1 and R2 "
225 "using show ipv6 ospf6 neighbor cmd."
229 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
230 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
231 tc_name
, ospf6_covergence
234 step("Disable authentication on R2 ")
250 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
251 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
253 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
254 # wait till the dead timer expiry
257 ospf6_covergence
= verify_ospf6_neighbor(
258 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
260 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
261 tc_name
, ospf6_covergence
264 step("Again On R2 enable ospf6 on interface with message-digest auth")
278 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
279 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
282 "Verify that the neighbour is FULL between R1 and R2 using"
283 " show ip ospf6 neighbor cmd."
287 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
288 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
289 tc_name
, ospf6_covergence
292 step("Shut no shut interface on R1")
294 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
295 shutdown_bringup_interface(tgen
, dut
, intf
, False)
299 "Verify that the neighbour is not FULL between R1 and R2 using "
300 "show ip ospf6 neighbor cmd."
302 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
303 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
304 tc_name
, ospf6_covergence
308 shutdown_bringup_interface(tgen
, dut
, intf
, True)
311 "Verify that the neighbour is FULL between R1 and R2 using "
312 "show ip ospf6 neighbor cmd."
316 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
317 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
318 tc_name
, ospf6_covergence
321 write_test_footer(tc_name
)
324 def test_ospf6_auth_trailer_tc2_sha256(request
):
326 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
327 using HMAC-SHA-256 manual key configuration.
330 tc_name
= request
.node
.name
331 write_test_header(tc_name
)
334 step("Bring up the base config.")
335 reset_config_on_routers(tgen
)
337 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
338 "connected to R2 with auth trailer"
346 "hash-algo": "hmac-sha-256",
354 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
355 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
357 step("Verify that the neighbour is not FULL between R1 and R2.")
358 # wait for dead time expiry.
361 ospf6_covergence
= verify_ospf6_neighbor(
362 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
364 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
365 tc_name
, ospf6_covergence
369 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
370 "connected to R1 with auth trailer"
378 "hash-algo": "hmac-sha-256",
386 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
387 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
390 "Verify that the neighbour is FULL between R1 and R2 "
391 "using show ipv6 ospf6 neighbor cmd."
395 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
396 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
397 tc_name
, ospf6_covergence
400 step("Disable authentication on R2 ")
407 "hash-algo": "hmac-sha-256",
416 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
417 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
419 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
420 # wait till the dead timer expiry
423 ospf6_covergence
= verify_ospf6_neighbor(
424 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
426 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
427 tc_name
, ospf6_covergence
430 step("Again On R2 enable ospf6 on interface with message-digest auth")
436 "hash-algo": "hmac-sha-256",
444 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
445 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
448 "Verify that the neighbour is FULL between R1 and R2 using"
449 " show ip ospf6 neighbor cmd."
453 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
454 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
455 tc_name
, ospf6_covergence
458 step("Shut no shut interface on R1")
460 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
461 shutdown_bringup_interface(tgen
, dut
, intf
, False)
465 "Verify that the neighbour is not FULL between R1 and R2 using "
466 "show ip ospf6 neighbor cmd."
468 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
469 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
470 tc_name
, ospf6_covergence
474 shutdown_bringup_interface(tgen
, dut
, intf
, True)
477 "Verify that the neighbour is FULL between R1 and R2 using "
478 "show ip ospf6 neighbor cmd."
482 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
483 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
484 tc_name
, ospf6_covergence
487 write_test_footer(tc_name
)
490 def test_ospf6_auth_trailer_tc3_keychain_md5(request
):
492 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
493 using MD5 keychain configuration.
496 tc_name
= request
.node
.name
497 write_test_header(tc_name
)
500 step("Bring up the base config.")
501 reset_config_on_routers(tgen
)
503 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
504 "connected to R2 with auth trailer"
507 router1
= tgen
.gears
["r1"]
508 router2
= tgen
.gears
["r2"]
511 """configure terminal
515 cryptographic-algorithm md5"""
519 """configure terminal
523 cryptographic-algorithm md5"""
537 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
538 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
540 step("Verify that the neighbour is not FULL between R1 and R2.")
541 # wait for dead time expiry.
544 ospf6_covergence
= verify_ospf6_neighbor(
545 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
547 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
548 tc_name
, ospf6_covergence
552 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
553 "connected to R1 with auth trailer"
567 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
568 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
571 "Verify that the neighbour is FULL between R1 and R2 "
572 "using show ipv6 ospf6 neighbor cmd."
576 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
577 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
578 tc_name
, ospf6_covergence
581 step("Disable authentication on R2 ")
584 "r2": {"links": {"r1": {"ospf6": {"keychain": "auth", "del_action": True}}}}
586 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
587 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
589 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
590 # wait till the dead timer expiry
593 ospf6_covergence
= verify_ospf6_neighbor(
594 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
596 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
597 tc_name
, ospf6_covergence
600 step("Again On R2 enable ospf6 on interface with message-digest auth")
612 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
613 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
616 "Verify that the neighbour is FULL between R1 and R2 using"
617 " show ip ospf6 neighbor cmd."
621 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
622 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
623 tc_name
, ospf6_covergence
626 step("Shut no shut interface on R1")
628 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
629 shutdown_bringup_interface(tgen
, dut
, intf
, False)
633 "Verify that the neighbour is not FULL between R1 and R2 using "
634 "show ip ospf6 neighbor cmd."
636 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
637 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
638 tc_name
, ospf6_covergence
642 shutdown_bringup_interface(tgen
, dut
, intf
, True)
645 "Verify that the neighbour is FULL between R1 and R2 using "
646 "show ip ospf6 neighbor cmd."
650 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
651 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
652 tc_name
, ospf6_covergence
655 write_test_footer(tc_name
)
658 def test_ospf6_auth_trailer_tc4_keychain_sha256(request
):
660 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
661 using HMAC-SHA-256 keychain configuration.
664 tc_name
= request
.node
.name
665 write_test_header(tc_name
)
668 step("Bring up the base config.")
669 reset_config_on_routers(tgen
)
671 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
672 "connected to R2 with auth trailer"
675 router1
= tgen
.gears
["r1"]
676 router2
= tgen
.gears
["r2"]
679 """configure terminal
683 cryptographic-algorithm hmac-sha-256"""
687 """configure terminal
691 cryptographic-algorithm hmac-sha-256"""
705 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
706 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
708 step("Verify that the neighbour is not FULL between R1 and R2.")
709 # wait for dead time expiry.
712 ospf6_covergence
= verify_ospf6_neighbor(
713 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
715 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
716 tc_name
, ospf6_covergence
720 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
721 "connected to R1 with auth trailer"
735 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
736 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
739 "Verify that the neighbour is FULL between R1 and R2 "
740 "using show ipv6 ospf6 neighbor cmd."
744 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
745 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
746 tc_name
, ospf6_covergence
749 step("Disable authentication on R2 ")
752 "r2": {"links": {"r1": {"ospf6": {"keychain": "auth", "del_action": True}}}}
754 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
755 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
757 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
758 # wait till the dead timer expiry
761 ospf6_covergence
= verify_ospf6_neighbor(
762 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
764 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
765 tc_name
, ospf6_covergence
768 step("Again On R2 enable ospf6 on interface with message-digest auth")
780 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
781 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
784 "Verify that the neighbour is FULL between R1 and R2 using"
785 " show ip ospf6 neighbor cmd."
789 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
790 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
791 tc_name
, ospf6_covergence
794 step("Shut no shut interface on R1")
796 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
797 shutdown_bringup_interface(tgen
, dut
, intf
, False)
801 "Verify that the neighbour is not FULL between R1 and R2 using "
802 "show ip ospf6 neighbor cmd."
804 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
805 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
806 tc_name
, ospf6_covergence
810 shutdown_bringup_interface(tgen
, dut
, intf
, True)
813 "Verify that the neighbour is FULL between R1 and R2 using "
814 "show ip ospf6 neighbor cmd."
818 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
819 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
820 tc_name
, ospf6_covergence
823 write_test_footer(tc_name
)
826 def test_ospf6_auth_trailer_tc5_md5_keymissmatch(request
):
828 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
829 using MD5 manual key configuration.
832 tc_name
= request
.node
.name
833 write_test_header(tc_name
)
836 step("Bring up the base config.")
837 reset_config_on_routers(tgen
)
839 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
840 "connected to R2 with auth trailer"
856 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
857 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
859 step("Verify that the neighbour is not FULL between R1 and R2.")
860 # wait for dead time expiry.
863 ospf6_covergence
= verify_ospf6_neighbor(
864 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
866 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
867 tc_name
, ospf6_covergence
871 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
872 "connected to R1 with auth trailer wrong key"
881 "key": "ospf6-missmatch",
888 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
889 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
892 "Verify that the neighbour is not FULL between R1 and R2 "
893 "using show ipv6 ospf6 neighbor cmd."
896 step("Verify that the neighbour is FULL between R1 and R2.")
897 # wait for dead time expiry.
900 ospf6_covergence
= verify_ospf6_neighbor(
901 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
903 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
904 tc_name
, ospf6_covergence
908 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
909 "connected to R1 with auth trailer correct key"
925 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
926 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
929 "Verify that the neighbour is FULL between R1 and R2 "
930 "using show ipv6 ospf6 neighbor cmd."
934 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
935 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
936 tc_name
, ospf6_covergence
939 write_test_footer(tc_name
)
942 def test_ospf6_auth_trailer_tc6_sha256_mismatch(request
):
944 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
945 using HMAC-SHA-256 manual key configuration.
948 tc_name
= request
.node
.name
949 write_test_header(tc_name
)
952 step("Bring up the base config.")
953 reset_config_on_routers(tgen
)
955 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
956 "connected to R2 with auth trailer"
964 "hash-algo": "hmac-sha-256",
972 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
973 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
975 step("Verify that the neighbour is not FULL between R1 and R2.")
976 # wait for dead time expiry.
979 ospf6_covergence
= verify_ospf6_neighbor(
980 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
982 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
983 tc_name
, ospf6_covergence
987 "Configure ospf6 with on R1 and R2, enable ospf6 on R2 interface "
988 "connected to R1 with auth trailer wrong key"
996 "hash-algo": "hmac-sha-256",
997 "key": "ospf6-missmatch",
1004 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1005 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1007 step("Verify that the neighbour is not FULL between R1 and R2.")
1008 # wait for dead time expiry.
1011 ospf6_covergence
= verify_ospf6_neighbor(
1012 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1014 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1015 tc_name
, ospf6_covergence
1019 "Configure ospf6 with on R1 and R2, enable ospf6 on R2 interface "
1020 "connected to R1 with auth trailer wrong key"
1028 "hash-algo": "hmac-sha-256",
1036 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1037 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1040 "Verify that the neighbour is FULL between R1 and R2 "
1041 "using show ipv6 ospf6 neighbor cmd."
1045 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1046 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1047 tc_name
, ospf6_covergence
1050 write_test_footer(tc_name
)
1053 def test_ospf6_auth_trailer_tc7_keychain_md5_missmatch(request
):
1055 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
1056 using MD5 keychain configuration.
1059 tc_name
= request
.node
.name
1060 write_test_header(tc_name
)
1061 tgen
= get_topogen()
1063 step("Bring up the base config.")
1064 reset_config_on_routers(tgen
)
1066 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1067 "connected to R2 with auth trailer"
1070 router1
= tgen
.gears
["r1"]
1071 router2
= tgen
.gears
["r2"]
1074 """configure terminal
1078 cryptographic-algorithm md5"""
1082 """configure terminal
1086 cryptographic-algorithm md5"""
1090 """configure terminal
1091 key chain auth-missmatch
1093 key-string ospf6-missmatch
1094 cryptographic-algorithm md5"""
1108 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1109 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1111 step("Verify that the neighbour is not FULL between R1 and R2.")
1112 # wait for dead time expiry.
1115 ospf6_covergence
= verify_ospf6_neighbor(
1116 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1118 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1119 tc_name
, ospf6_covergence
1123 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1124 "connected to R1 with auth trailer with wrong keychain"
1132 "keychain": "auth-missmatch",
1138 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1139 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1141 step("Verify that the neighbour is not FULL between R1 and R2.")
1142 # wait for dead time expiry.
1145 ospf6_covergence
= verify_ospf6_neighbor(
1146 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1148 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1149 tc_name
, ospf6_covergence
1153 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1154 "connected to R1 with auth trailer with correct keychain"
1168 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1169 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1172 "Verify that the neighbour is FULL between R1 and R2 "
1173 "using show ipv6 ospf6 neighbor cmd."
1177 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1178 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1179 tc_name
, ospf6_covergence
1182 write_test_footer(tc_name
)
1185 def test_ospf6_auth_trailer_tc8_keychain_sha256_missmatch(request
):
1187 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
1188 using HMAC-SHA-256 keychain configuration.
1191 tc_name
= request
.node
.name
1192 write_test_header(tc_name
)
1193 tgen
= get_topogen()
1195 step("Bring up the base config.")
1196 reset_config_on_routers(tgen
)
1198 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1199 "connected to R2 with auth trailer"
1202 router1
= tgen
.gears
["r1"]
1203 router2
= tgen
.gears
["r2"]
1206 """configure terminal
1210 cryptographic-algorithm hmac-sha-256"""
1214 """configure terminal
1218 cryptographic-algorithm hmac-sha-256"""
1222 """configure terminal
1223 key chain auth-missmatch
1225 key-string ospf6-missmatch
1226 cryptographic-algorithm hmac-sha-256"""
1240 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1241 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1243 step("Verify that the neighbour is not FULL between R1 and R2.")
1244 # wait for dead time expiry.
1247 ospf6_covergence
= verify_ospf6_neighbor(
1248 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1250 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1251 tc_name
, ospf6_covergence
1255 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1256 "connected to R1 with auth trailer wrong keychain"
1264 "keychain": "auth-missmatch",
1270 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1271 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1273 step("Verify that the neighbour is not FULL between R1 and R2.")
1274 # wait for dead time expiry.
1277 ospf6_covergence
= verify_ospf6_neighbor(
1278 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1280 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1281 tc_name
, ospf6_covergence
1285 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1286 "connected to R1 with auth trailer correct keychain"
1300 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1301 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1304 "Verify that the neighbour is FULL between R1 and R2 "
1305 "using show ipv6 ospf6 neighbor cmd."
1309 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1310 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1311 tc_name
, ospf6_covergence
1314 write_test_footer(tc_name
)
1317 def test_ospf6_auth_trailer_tc9_keychain_not_configured(request
):
1319 OSPFv3 Neighborship without Authentication Trailer -
1320 Verify ospfv3 neighborship when no authentication trailer is configured.
1323 tc_name
= request
.node
.name
1324 write_test_header(tc_name
)
1325 tgen
= get_topogen()
1327 step("Bring up the base config.")
1328 reset_config_on_routers(tgen
)
1330 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1331 "connected to R2 with auth trailer"
1334 router1
= tgen
.gears
["r1"]
1335 router2
= tgen
.gears
["r2"]
1348 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1349 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1351 step("Verify that the neighbour is not FULL between R1 and R2.")
1352 # wait for dead time expiry.
1355 ospf6_covergence
= verify_ospf6_neighbor(
1356 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1358 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1359 tc_name
, ospf6_covergence
1363 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1364 "connected to R1 with auth trailer non existing keychain"
1378 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1379 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1381 step("Verify that the neighbour is not FULL between R1 and R2.")
1382 # wait for dead time expiry.
1385 ospf6_covergence
= verify_ospf6_neighbor(
1386 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1388 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1389 tc_name
, ospf6_covergence
1392 write_test_footer(tc_name
)
1395 def test_ospf6_auth_trailer_tc10_no_auth_trailer(request
):
1397 OSPFv3 Neighborship without Authentication Trailer -
1398 Verify ospfv3 neighborship when no authentication trailer is configured.
1401 tc_name
= request
.node
.name
1402 write_test_header(tc_name
)
1403 tgen
= get_topogen()
1405 step("Bring up the base config.")
1406 reset_config_on_routers(tgen
)
1408 router1
= tgen
.gears
["r1"]
1409 router2
= tgen
.gears
["r2"]
1412 "Verify that the neighbour is FULL between R1 and R2 "
1413 "using show ipv6 ospf6 neighbor cmd."
1417 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1418 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1419 tc_name
, ospf6_covergence
1422 write_test_footer(tc_name
)
1425 if __name__
== "__main__":
1426 args
= ["-s"] + sys
.argv
[1:]
1427 sys
.exit(pytest
.main(args
))