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
,
55 from lib
.topolog
import logger
56 from lib
.topojson
import build_topo_from_json
, build_config_from_json
57 from lib
.ospf
import verify_ospf6_neighbor
, config_ospf6_interface
, clear_ospf
58 from ipaddress
import IPv4Address
62 # Reading the data from JSON File for topology creation
63 jsonFile
= "{}/ospfv3_authentication.json".format(CWD
)
65 with
open(jsonFile
, "r") as topoJson
:
66 topo
= json
.load(topoJson
)
68 assert False, "Could not read file {}".format(jsonFile
)
71 Please view in a fixed-width font such as Courier.
73 +R1 +------------+R2 |
82 +R0 +-------------+R3 |
86 1. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
87 using MD5 manual key configuration.
88 2. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
89 using HMAC-SHA-256 manual key configuration.
90 3. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
91 using MD5 keychain configuration.
92 4. OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
93 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 # get list of daemons needs to be started for this suite.
116 daemons
= topo_daemons(tgen
, topo
)
118 # Starting topology, create tmp files which are loaded to routers
119 # to start deamons and then start routers
120 start_topology(tgen
, daemons
)
122 # Creating configuration from JSON
123 build_config_from_json(tgen
, topo
)
125 # Don't run this test if we have any failure.
126 if tgen
.routers_have_failure():
127 pytest
.skip(tgen
.errors
)
129 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
)
130 assert ospf6_covergence
is True, "setup_module :Failed \n Error:" " {}".format(
134 logger
.info("Running setup_module() done")
137 def teardown_module(mod
):
139 Teardown the pytest environment.
143 logger
.info("Running teardown_module to delete topology")
147 # Stop toplogy and Remove tmp files
151 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
153 logger
.info("=" * 40)
156 # ##################################
157 # Test cases start here.
158 # ##################################
160 def test_ospf6_auth_trailer_tc1_md5(request
):
162 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
163 using MD5 manual key configuration.
166 tc_name
= request
.node
.name
167 write_test_header(tc_name
)
170 step("Bring up the base config.")
171 reset_config_on_routers(tgen
)
173 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
174 "connected to R2 with auth trailer"
190 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
191 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
193 step("Verify that the neighbour is not FULL between R1 and R2.")
194 # wait for dead time expiry.
197 ospf6_covergence
= verify_ospf6_neighbor(
198 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
200 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
201 tc_name
, ospf6_covergence
205 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
206 "connected to R1 with auth trailer"
222 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
223 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
226 "Verify that the neighbour is FULL between R1 and R2 "
227 "using show ipv6 ospf6 neighbor cmd."
231 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
232 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
233 tc_name
, ospf6_covergence
237 "Disable authentication on R2 "
254 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
255 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
257 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
258 # wait till the dead timer expiry
261 ospf6_covergence
= verify_ospf6_neighbor(
262 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
264 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
265 tc_name
, ospf6_covergence
268 step("Again On R2 enable ospf6 on interface with message-digest auth")
282 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
283 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
286 "Verify that the neighbour is FULL between R1 and R2 using"
287 " show ip ospf6 neighbor cmd."
291 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
292 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
293 tc_name
, ospf6_covergence
296 step("Shut no shut interface on R1")
298 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
299 shutdown_bringup_interface(tgen
, dut
, intf
, False)
303 "Verify that the neighbour is not FULL between R1 and R2 using "
304 "show ip ospf6 neighbor cmd."
306 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
307 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
308 tc_name
, ospf6_covergence
312 shutdown_bringup_interface(tgen
, dut
, intf
, True)
315 "Verify that the neighbour is FULL between R1 and R2 using "
316 "show ip ospf6 neighbor cmd."
320 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
321 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
322 tc_name
, ospf6_covergence
325 write_test_footer(tc_name
)
328 def test_ospf6_auth_trailer_tc2_sha256(request
):
330 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
331 using HMAC-SHA-256 manual key configuration.
334 tc_name
= request
.node
.name
335 write_test_header(tc_name
)
338 step("Bring up the base config.")
339 reset_config_on_routers(tgen
)
341 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
342 "connected to R2 with auth trailer"
350 "hash-algo": "hmac-sha-256",
358 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
359 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
361 step("Verify that the neighbour is not FULL between R1 and R2.")
362 # wait for dead time expiry.
365 ospf6_covergence
= verify_ospf6_neighbor(
366 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
368 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
369 tc_name
, ospf6_covergence
373 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
374 "connected to R1 with auth trailer"
382 "hash-algo": "hmac-sha-256",
390 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
391 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
394 "Verify that the neighbour is FULL between R1 and R2 "
395 "using show ipv6 ospf6 neighbor cmd."
399 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
400 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
401 tc_name
, ospf6_covergence
405 "Disable authentication on R2 "
413 "hash-algo": "hmac-sha-256",
422 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
423 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
425 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
426 # wait till the dead timer expiry
429 ospf6_covergence
= verify_ospf6_neighbor(
430 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
432 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
433 tc_name
, ospf6_covergence
436 step("Again On R2 enable ospf6 on interface with message-digest auth")
442 "hash-algo": "hmac-sha-256",
450 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
451 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
454 "Verify that the neighbour is FULL between R1 and R2 using"
455 " show ip ospf6 neighbor cmd."
459 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
460 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
461 tc_name
, ospf6_covergence
464 step("Shut no shut interface on R1")
466 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
467 shutdown_bringup_interface(tgen
, dut
, intf
, False)
471 "Verify that the neighbour is not FULL between R1 and R2 using "
472 "show ip ospf6 neighbor cmd."
474 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
475 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
476 tc_name
, ospf6_covergence
480 shutdown_bringup_interface(tgen
, dut
, intf
, True)
483 "Verify that the neighbour is FULL between R1 and R2 using "
484 "show ip ospf6 neighbor cmd."
488 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
489 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
490 tc_name
, ospf6_covergence
493 write_test_footer(tc_name
)
495 def test_ospf6_auth_trailer_tc3_keychain_md5(request
):
497 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
498 using MD5 keychain configuration.
501 tc_name
= request
.node
.name
502 write_test_header(tc_name
)
505 step("Bring up the base config.")
506 reset_config_on_routers(tgen
)
508 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
509 "connected to R2 with auth trailer"
512 router1
= tgen
.gears
["r1"]
513 router2
= tgen
.gears
["r2"]
516 """configure terminal
520 cryptographic-algorithm md5"""
524 """configure terminal
528 cryptographic-algorithm md5"""
542 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
543 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
545 step("Verify that the neighbour is not FULL between R1 and R2.")
546 # wait for dead time expiry.
549 ospf6_covergence
= verify_ospf6_neighbor(
550 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
552 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
553 tc_name
, ospf6_covergence
557 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
558 "connected to R1 with auth trailer"
572 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
573 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
576 "Verify that the neighbour is FULL between R1 and R2 "
577 "using show ipv6 ospf6 neighbor cmd."
581 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
582 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
583 tc_name
, ospf6_covergence
587 "Disable authentication on R2 "
602 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
603 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
605 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
606 # wait till the dead timer expiry
609 ospf6_covergence
= verify_ospf6_neighbor(
610 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
612 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
613 tc_name
, ospf6_covergence
616 step("Again On R2 enable ospf6 on interface with message-digest auth")
628 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
629 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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 step("Shut no shut interface on R1")
644 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
645 shutdown_bringup_interface(tgen
, dut
, intf
, False)
649 "Verify that the neighbour is not FULL between R1 and R2 using "
650 "show ip ospf6 neighbor cmd."
652 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
653 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
654 tc_name
, ospf6_covergence
658 shutdown_bringup_interface(tgen
, dut
, intf
, True)
661 "Verify that the neighbour is FULL between R1 and R2 using "
662 "show ip ospf6 neighbor cmd."
666 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
667 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
668 tc_name
, ospf6_covergence
671 write_test_footer(tc_name
)
673 def test_ospf6_auth_trailer_tc4_keychain_sha256(request
):
675 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
676 using HMAC-SHA-256 keychain configuration.
679 tc_name
= request
.node
.name
680 write_test_header(tc_name
)
683 step("Bring up the base config.")
684 reset_config_on_routers(tgen
)
686 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
687 "connected to R2 with auth trailer"
690 router1
= tgen
.gears
["r1"]
691 router2
= tgen
.gears
["r2"]
694 """configure terminal
698 cryptographic-algorithm hmac-sha-256"""
702 """configure terminal
706 cryptographic-algorithm hmac-sha-256"""
720 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
721 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
723 step("Verify that the neighbour is not FULL between R1 and R2.")
724 # wait for dead time expiry.
727 ospf6_covergence
= verify_ospf6_neighbor(
728 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
730 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
731 tc_name
, ospf6_covergence
735 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
736 "connected to R1 with auth trailer"
750 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
751 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
754 "Verify that the neighbour is FULL between R1 and R2 "
755 "using show ipv6 ospf6 neighbor cmd."
759 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
760 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
761 tc_name
, ospf6_covergence
765 "Disable authentication on R2 "
780 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
781 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
783 step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
784 # wait till the dead timer expiry
787 ospf6_covergence
= verify_ospf6_neighbor(
788 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=5
790 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
791 tc_name
, ospf6_covergence
794 step("Again On R2 enable ospf6 on interface with message-digest auth")
806 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
807 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
810 "Verify that the neighbour is FULL between R1 and R2 using"
811 " show ip ospf6 neighbor cmd."
815 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
816 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
817 tc_name
, ospf6_covergence
820 step("Shut no shut interface on R1")
822 intf
= topo
["routers"]["r1"]["links"]["r2"]["interface"]
823 shutdown_bringup_interface(tgen
, dut
, intf
, False)
827 "Verify that the neighbour is not FULL between R1 and R2 using "
828 "show ip ospf6 neighbor cmd."
830 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
, expected
=False)
831 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
832 tc_name
, ospf6_covergence
836 shutdown_bringup_interface(tgen
, dut
, intf
, True)
839 "Verify that the neighbour is FULL between R1 and R2 using "
840 "show ip ospf6 neighbor cmd."
844 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
845 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
846 tc_name
, ospf6_covergence
849 write_test_footer(tc_name
)
851 def test_ospf6_auth_trailer_tc5_md5_keymissmatch(request
):
853 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
854 using MD5 manual key configuration.
857 tc_name
= request
.node
.name
858 write_test_header(tc_name
)
861 step("Bring up the base config.")
862 reset_config_on_routers(tgen
)
864 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
865 "connected to R2 with auth trailer"
881 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
882 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
884 step("Verify that the neighbour is not FULL between R1 and R2.")
885 # wait for dead time expiry.
888 ospf6_covergence
= verify_ospf6_neighbor(
889 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
891 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
892 tc_name
, ospf6_covergence
896 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
897 "connected to R1 with auth trailer wrong key"
906 "key": "ospf6-missmatch",
913 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
914 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
917 "Verify that the neighbour is not FULL between R1 and R2 "
918 "using show ipv6 ospf6 neighbor cmd."
921 step("Verify that the neighbour is FULL between R1 and R2.")
922 # wait for dead time expiry.
925 ospf6_covergence
= verify_ospf6_neighbor(
926 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
928 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
929 tc_name
, ospf6_covergence
933 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
934 "connected to R1 with auth trailer correct key"
950 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
951 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
954 "Verify that the neighbour is FULL between R1 and R2 "
955 "using show ipv6 ospf6 neighbor cmd."
959 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
960 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
961 tc_name
, ospf6_covergence
964 write_test_footer(tc_name
)
966 def test_ospf6_auth_trailer_tc6_sha256_mismatch(request
):
968 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
969 using HMAC-SHA-256 manual key configuration.
972 tc_name
= request
.node
.name
973 write_test_header(tc_name
)
976 step("Bring up the base config.")
977 reset_config_on_routers(tgen
)
979 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
980 "connected to R2 with auth trailer"
988 "hash-algo": "hmac-sha-256",
996 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
997 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
999 step("Verify that the neighbour is not FULL between R1 and R2.")
1000 # wait for dead time expiry.
1003 ospf6_covergence
= verify_ospf6_neighbor(
1004 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1006 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1007 tc_name
, ospf6_covergence
1011 "Configure ospf6 with on R1 and R2, enable ospf6 on R2 interface "
1012 "connected to R1 with auth trailer wrong key"
1020 "hash-algo": "hmac-sha-256",
1021 "key": "ospf6-missmatch",
1028 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1029 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1031 step("Verify that the neighbour is not FULL between R1 and R2.")
1032 # wait for dead time expiry.
1035 ospf6_covergence
= verify_ospf6_neighbor(
1036 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1038 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1039 tc_name
, ospf6_covergence
1043 "Configure ospf6 with on R1 and R2, enable ospf6 on R2 interface "
1044 "connected to R1 with auth trailer wrong key"
1052 "hash-algo": "hmac-sha-256",
1060 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1061 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1064 "Verify that the neighbour is FULL between R1 and R2 "
1065 "using show ipv6 ospf6 neighbor cmd."
1069 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1070 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1071 tc_name
, ospf6_covergence
1074 write_test_footer(tc_name
)
1076 def test_ospf6_auth_trailer_tc7_keychain_md5_missmatch(request
):
1078 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
1079 using MD5 keychain configuration.
1082 tc_name
= request
.node
.name
1083 write_test_header(tc_name
)
1084 tgen
= get_topogen()
1086 step("Bring up the base config.")
1087 reset_config_on_routers(tgen
)
1089 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1090 "connected to R2 with auth trailer"
1093 router1
= tgen
.gears
["r1"]
1094 router2
= tgen
.gears
["r2"]
1097 """configure terminal
1101 cryptographic-algorithm md5"""
1105 """configure terminal
1109 cryptographic-algorithm md5"""
1113 """configure terminal
1114 key chain auth-missmatch
1116 key-string ospf6-missmatch
1117 cryptographic-algorithm md5"""
1131 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1132 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1134 step("Verify that the neighbour is not FULL between R1 and R2.")
1135 # wait for dead time expiry.
1138 ospf6_covergence
= verify_ospf6_neighbor(
1139 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1141 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1142 tc_name
, ospf6_covergence
1146 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1147 "connected to R1 with auth trailer with wrong keychain"
1155 "keychain": "auth-missmatch",
1161 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1162 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1164 step("Verify that the neighbour is not FULL between R1 and R2.")
1165 # wait for dead time expiry.
1168 ospf6_covergence
= verify_ospf6_neighbor(
1169 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1171 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1172 tc_name
, ospf6_covergence
1176 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1177 "connected to R1 with auth trailer with correct keychain"
1191 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1192 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1195 "Verify that the neighbour is FULL between R1 and R2 "
1196 "using show ipv6 ospf6 neighbor cmd."
1200 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1201 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1202 tc_name
, ospf6_covergence
1205 write_test_footer(tc_name
)
1207 def test_ospf6_auth_trailer_tc8_keychain_sha256_missmatch(request
):
1209 OSPFv3 Authentication Trailer - Verify ospfv3 authentication trailer
1210 using HMAC-SHA-256 keychain configuration.
1213 tc_name
= request
.node
.name
1214 write_test_header(tc_name
)
1215 tgen
= get_topogen()
1217 step("Bring up the base config.")
1218 reset_config_on_routers(tgen
)
1220 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1221 "connected to R2 with auth trailer"
1224 router1
= tgen
.gears
["r1"]
1225 router2
= tgen
.gears
["r2"]
1228 """configure terminal
1232 cryptographic-algorithm hmac-sha-256"""
1236 """configure terminal
1240 cryptographic-algorithm hmac-sha-256"""
1244 """configure terminal
1245 key chain auth-missmatch
1247 key-string ospf6-missmatch
1248 cryptographic-algorithm hmac-sha-256"""
1262 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1263 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1265 step("Verify that the neighbour is not FULL between R1 and R2.")
1266 # wait for dead time expiry.
1269 ospf6_covergence
= verify_ospf6_neighbor(
1270 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1272 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1273 tc_name
, ospf6_covergence
1277 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1278 "connected to R1 with auth trailer wrong keychain"
1286 "keychain": "auth-missmatch",
1292 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1293 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1295 step("Verify that the neighbour is not FULL between R1 and R2.")
1296 # wait for dead time expiry.
1299 ospf6_covergence
= verify_ospf6_neighbor(
1300 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1302 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1303 tc_name
, ospf6_covergence
1307 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1308 "connected to R1 with auth trailer correct keychain"
1322 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1323 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1326 "Verify that the neighbour is FULL between R1 and R2 "
1327 "using show ipv6 ospf6 neighbor cmd."
1331 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1332 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1333 tc_name
, ospf6_covergence
1336 write_test_footer(tc_name
)
1338 def test_ospf6_auth_trailer_tc9_keychain_not_configured(request
):
1340 OSPFv3 Neighborship without Authentication Trailer -
1341 Verify ospfv3 neighborship when no authentication trailer is configured.
1344 tc_name
= request
.node
.name
1345 write_test_header(tc_name
)
1346 tgen
= get_topogen()
1348 step("Bring up the base config.")
1349 reset_config_on_routers(tgen
)
1351 "Configure ospf6 between R1 and R2, enable ospf6 auth on R1 interface "
1352 "connected to R2 with auth trailer"
1355 router1
= tgen
.gears
["r1"]
1356 router2
= tgen
.gears
["r2"]
1369 result
= config_ospf6_interface(tgen
, topo
, r1_ospf6_auth
)
1370 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1372 step("Verify that the neighbour is not FULL between R1 and R2.")
1373 # wait for dead time expiry.
1376 ospf6_covergence
= verify_ospf6_neighbor(
1377 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1379 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1380 tc_name
, ospf6_covergence
1384 "Configure ospf6 between R1 and R2, enable ospf6 on R2 interface "
1385 "connected to R1 with auth trailer non existing keychain"
1399 result
= config_ospf6_interface(tgen
, topo
, r2_ospf6_auth
)
1400 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1402 step("Verify that the neighbour is not FULL between R1 and R2.")
1403 # wait for dead time expiry.
1406 ospf6_covergence
= verify_ospf6_neighbor(
1407 tgen
, topo
, dut
=dut
, expected
=False, retry_timeout
=3
1409 assert ospf6_covergence
is not True, "Testcase {} :Failed \n Error:" " {}".format(
1410 tc_name
, ospf6_covergence
1413 write_test_footer(tc_name
)
1415 def test_ospf6_auth_trailer_tc10_no_auth_trailer(request
):
1417 OSPFv3 Neighborship without Authentication Trailer -
1418 Verify ospfv3 neighborship when no authentication trailer is configured.
1421 tc_name
= request
.node
.name
1422 write_test_header(tc_name
)
1423 tgen
= get_topogen()
1425 step("Bring up the base config.")
1426 reset_config_on_routers(tgen
)
1428 router1
= tgen
.gears
["r1"]
1429 router2
= tgen
.gears
["r2"]
1432 "Verify that the neighbour is FULL between R1 and R2 "
1433 "using show ipv6 ospf6 neighbor cmd."
1437 ospf6_covergence
= verify_ospf6_neighbor(tgen
, topo
, dut
=dut
)
1438 assert ospf6_covergence
is True, "Testcase {} :Failed \n Error:" " {}".format(
1439 tc_name
, ospf6_covergence
1442 write_test_footer(tc_name
)
1444 if __name__
== "__main__":
1445 args
= ["-s"] + sys
.argv
[1:]
1446 sys
.exit(pytest
.main(args
))