]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/ospfv3_basic_functionality/test_ospfv3_routemaps.py
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."""
30 # Save the Current Working Directory to find configuration files.
31 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
32 sys
.path
.append(os
.path
.join(CWD
, "../"))
33 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
35 # pylint: disable=C0413
36 # Import topogen and topotest helpers
37 from lib
.topogen
import Topogen
, get_topogen
39 # Import topoJson from lib, to create topology and initial configuration
40 from lib
.common_config
import (
44 reset_config_on_routers
,
52 from lib
.topolog
import logger
53 from lib
.topojson
import build_config_from_json
55 from lib
.ospf
import (
56 verify_ospf6_neighbor
,
62 pytestmark
= [pytest
.mark
.ospfd
, pytest
.mark
.staticd
]
77 "ipv6": ["2::1/128", "2::2/128", "2::3/128", "2::4/128", "2::5/128"],
80 routerids
= ["100.1.1.0", "100.1.1.1", "100.1.1.2", "100.1.1.3"]
84 Please view in a fixed-width font such as Courier.
86 +R1 +------------+R2 |
95 +R0 +-------------+R3 |
99 2. Verify OSPF route map support functionality when route map is not
100 configured at system level but configured in OSPF
101 4. Verify OSPF route map support functionality
102 when route map actions are toggled.
103 5. Verify OSPF route map support functionality with multiple sequence
104 numbers in a single route-map for different match/set clauses.
105 6. Verify OSPF route map support functionality when we add/remove route-maps
106 with multiple set clauses and without any match statement.(Set only)
107 7. Verify OSPF route map support functionality when we
108 add/remove route-maps with multiple match clauses and without
109 any set statement.(Match only)
110 8. Verify OSPF route map applied to ospf redistribution with ipv6 prefix list
114 def setup_module(mod
):
116 Sets up the pytest environment
120 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
121 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
122 logger
.info("=" * 40)
124 logger
.info("Running setup_module to create topology")
126 # This function initiates the topology build with Topogen...
127 json_file
= "{}/ospfv3_routemaps.json".format(CWD
)
128 tgen
= Topogen(json_file
, mod
.__name
__)
130 topo
= tgen
.json_topo
131 # ... and here it calls Mininet initialization functions.
133 # Starting topology, create tmp files which are loaded to routers
134 # to start daemons and then start routers
137 # Creating configuration from JSON
138 build_config_from_json(tgen
, topo
)
140 # Don't run this test if we have any failure.
141 if tgen
.routers_have_failure():
142 pytest
.skip(tgen
.errors
)
144 ospf_covergence
= verify_ospf6_neighbor(tgen
, topo
)
145 assert ospf_covergence
is True, "setup_module :Failed \n Error:" " {}".format(
149 logger
.info("Running setup_module() done")
152 def teardown_module(mod
):
154 Teardown the pytest environment.
159 logger
.info("Running teardown_module to delete topology")
163 # Stop toplogy and Remove tmp files
167 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
169 logger
.info("=" * 40)
172 # ##################################
173 # Test cases start here.
174 # ##################################
177 def test_ospfv3_routemaps_functionality_tc19_p0(request
):
179 OSPF Route map - Verify OSPF route map support functionality.
182 tc_name
= request
.node
.name
183 write_test_header(tc_name
)
186 step("Bring up the base config as per the topology")
187 reset_config_on_routers(tgen
)
189 step("Create static routes(10.0.20.1/32 and 10.0.20.2/32) in R0")
190 # Create Static routes
195 "network": NETWORK
["ipv6"][0],
202 result
= create_static_routes(tgen
, input_dict
)
203 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
205 ospf_red_r1
= {"r0": {"ospf6": {"redistribute": [{"redist_type": "static"}]}}}
206 result
= create_router_ospf(tgen
, topo
, ospf_red_r1
)
207 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
210 lsid
= NETWORK
["ipv6"][0].split("/")[0]
214 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
215 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
217 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
218 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
222 "ospf6": {"redistribute": [{"redist_type": "static", "del_action": True}]}
225 result
= create_router_ospf(tgen
, topo
, ospf_red_r1
)
226 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
229 "Create prefix-list in R0 to permit 10.0.20.1/32 prefix &" " deny 10.0.20.2/32"
232 # Create ip prefix list
240 "network": NETWORK
["ipv6"][0],
243 {"seqid": 11, "network": "any", "action": "deny"},
249 result
= create_prefix_lists(tgen
, pfx_list
)
250 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
252 step("verify that prefix-list is created in R0.")
253 result
= verify_prefix_lists(tgen
, pfx_list
)
256 ), "Testcase {} : Failed \n, prefix list creation failed. Error: {}".format(
267 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
273 result
= create_route_maps(tgen
, routemaps
)
274 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
277 "Configure route map rmap1 and redistribute static routes to"
278 " ospf using route map rmap1"
284 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
288 result
= create_router_ospf(tgen
, topo
, ospf_red_r1
)
289 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
290 step("Verify that route map is activated in OSPF.")
292 step("Verify that route 10.0.20.1 is allowed and 10.0.20.2 is denied.")
297 {"network": NETWORK
["ipv6"][0], "no_of_ip": 1, "next_hop": "Null0"}
301 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
302 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
304 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
305 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
308 lsid
= NETWORK
["ipv6"][1].split("/")[0]
311 step("Change prefix rules to permit 10.0.20.2 and deny 10.0.20.1")
312 # Create ip prefix list
320 "network": NETWORK
["ipv6"][1],
323 {"seqid": 11, "network": "any", "action": "deny"},
329 result
= create_prefix_lists(tgen
, pfx_list
)
330 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
332 step("Verify that route 10.0.20.2 is allowed and 10.0.20.1 is denied.")
337 {"network": NETWORK
["ipv6"][1], "no_of_ip": 1, "next_hop": "Null0"}
341 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
342 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
344 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
345 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
350 {"network": NETWORK
["ipv6"][0], "no_of_ip": 1, "next_hop": "Null0"}
354 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
357 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
362 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
366 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
370 step("Delete and reconfigure prefix list.")
371 # Create ip prefix list
379 "network": NETWORK
["ipv6"][1],
394 result
= create_prefix_lists(tgen
, pfx_list
)
395 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
397 result
= verify_prefix_lists(tgen
, pfx_list
)
398 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
403 {"network": NETWORK
["ipv6"][0], "no_of_ip": 5, "next_hop": "Null0"}
407 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
410 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
415 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
419 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
430 "network": NETWORK
["ipv6"][1],
433 {"seqid": 11, "network": "any", "action": "deny"},
439 result
= create_prefix_lists(tgen
, pfx_list
)
440 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
442 step("Verify that route 10.0.20.2 is allowed and 10.0.20.1 is denied.")
447 {"network": NETWORK
["ipv6"][1], "no_of_ip": 1, "next_hop": "Null0"}
451 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
452 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
454 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
455 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
460 {"network": NETWORK
["ipv6"][0], "no_of_ip": 1, "next_hop": "Null0"}
464 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
467 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
472 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
476 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
480 write_test_footer(tc_name
)
483 def test_ospfv3_routemaps_functionality_tc20_p0(request
):
485 OSPF route map support functionality.
487 Verify OSPF route map support functionality when route map is not
488 configured at system level but configured in OSPF
491 tc_name
= request
.node
.name
492 write_test_header(tc_name
)
495 step("Bring up the base config as per the topology")
497 reset_config_on_routers(tgen
)
499 step("Create static routes(10.0.20.1/32 and 10.0.20.2/32) in R0")
500 # Create Static routes
505 "network": NETWORK
["ipv6"][0],
512 result
= create_static_routes(tgen
, input_dict
)
513 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
515 step("Redistribute to ospf using route map ( non existent route map)")
519 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
523 result
= create_router_ospf(tgen
, topo
, ospf_red_r1
)
524 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
527 "Verify that routes are not allowed in OSPF even tough no "
528 "matching routing map is configured."
533 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
536 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
540 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
543 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
548 "configure the route map with the same name that is used "
549 "in the ospf with deny rule."
553 routemaps
= {"r0": {"route_maps": {"rmap_ipv6": [{"action": "deny"}]}}}
554 result
= create_route_maps(tgen
, routemaps
)
555 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
557 step("verify that now route map is activated & routes are denied in OSPF.")
560 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
563 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
568 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
572 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
577 routemaps
= {"r0": {"route_maps": {"rmap_ipv6": [{"action": "deny"}]}}}
578 result
= create_route_maps(tgen
, routemaps
)
579 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
581 step("verify that now route map is activated & routes are denied in OSPF.")
584 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
587 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
592 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
596 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
600 step("Delete the route map.")
603 "r0": {"route_maps": {"rmap_ipv6": [{"action": "deny", "delete": True}]}}
605 result
= create_route_maps(tgen
, routemaps
)
606 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
609 "Verify that routes are allowed in OSPF even tough "
610 "no matching routing map is configured."
614 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
617 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
622 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
626 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
630 write_test_footer(tc_name
)
633 def test_ospfv3_routemaps_functionality_tc25_p0(request
):
635 OSPF route map support functionality.
637 Verify OSPF route map support functionality
638 when route map actions are toggled.
641 tc_name
= request
.node
.name
642 write_test_header(tc_name
)
645 step("Bring up the base config as per the topology")
647 reset_config_on_routers(tgen
)
650 "Create static routes(10.0.20.1/32) in R1 and redistribute "
651 "to OSPF using route map."
654 # Create Static routes
659 "network": NETWORK
["ipv6"][0],
666 result
= create_static_routes(tgen
, input_dict
)
667 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
672 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
676 result
= create_router_ospf(tgen
, topo
, ospf_red_r0
)
677 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
678 step("Configure route map with permit rule")
680 routemaps
= {"r0": {"route_maps": {"rmap_ipv6": [{"action": "permit"}]}}}
681 result
= create_route_maps(tgen
, routemaps
)
682 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
684 step("Verify that route is advertised to R1.")
687 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
688 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
690 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
691 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
692 step("Configure route map with deny rule")
695 "r0": {"route_maps": {"rmap_ipv6": [{"seq_id": 10, "action": "deny"}]}}
697 result
= create_route_maps(tgen
, routemaps
)
698 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
700 # Api call verify whether OSPF is converged
701 ospf_covergence
= verify_ospf6_neighbor(tgen
, topo
)
702 assert ospf_covergence
is True, "setup_module :Failed \n Error:" " {}".format(
706 step("Verify that route is not advertised to R1.")
709 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
712 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
717 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
721 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
725 write_test_footer(tc_name
)
728 def test_ospfv3_routemaps_functionality_tc22_p0(request
):
730 OSPF Route map - Multiple sequence numbers.
732 Verify OSPF route map support functionality with multiple sequence
733 numbers in a single route-map for different match/set clauses.
736 tc_name
= request
.node
.name
737 write_test_header(tc_name
)
740 step("Bring up the base config as per the topology")
742 reset_config_on_routers(tgen
)
745 "Configure route map with seq number 10 to with ip prefix"
746 " permitting route 10.0.20.1/32 in R1"
749 "Configure route map with seq number 20 to with ip prefix"
750 " permitting route 10.0.20.2/32 in R1"
761 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
766 "match": {"ipv6": {"prefix_lists": "pf_list_2_ipv6"}},
772 result
= create_route_maps(tgen
, input_dict_3
)
773 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
775 # Create ip prefix list
781 {"seqid": 10, "network": NETWORK
["ipv6"][0], "action": "permit"}
787 result
= create_prefix_lists(tgen
, input_dict_2
)
788 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
790 # Create ip prefix list
796 {"seqid": 10, "network": NETWORK
["ipv6"][1], "action": "permit"}
802 result
= create_prefix_lists(tgen
, input_dict_2
)
803 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
805 step("Configure static routes 10.0.20.1/32 and 10.0.20.2 in R1")
806 # Create Static routes
811 "network": NETWORK
["ipv6"][0],
818 result
= create_static_routes(tgen
, input_dict
)
819 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
821 step("Configure redistribute static route with route map.")
825 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
829 result
= create_router_ospf(tgen
, topo
, ospf_red_r0
)
830 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
836 "network": NETWORK
["ipv6"][0],
843 result
= create_static_routes(tgen
, input_dict
)
844 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
846 step("Verify that both routes are learned in R1 and R2")
849 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
850 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
852 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
853 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
857 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
858 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
860 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
861 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
863 step("Change route map with seq number 20 to deny.")
872 "match": {"ipv6": {"prefix_lists": "pf_list_2_ipv6"}},
878 result
= create_route_maps(tgen
, input_dict_3
)
879 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
882 "Verify the route 10.0.20.2/32 is withdrawn and not present "
883 "in the routing table of R0 and R1."
887 "r0": {"static_routes": [{"network": NETWORK
["ipv6"][1], "next_hop": "Null0"}]}
892 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
895 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
900 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
904 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
910 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
913 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
918 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
922 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
926 write_test_footer(tc_name
)
929 def test_ospfv3_routemaps_functionality_tc23_p0(request
):
931 OSPF Route map - Multiple set clauses.
933 Verify OSPF route map support functionality when we add/remove route-maps
934 with multiple set clauses and without any match statement.(Set only)
937 tc_name
= request
.node
.name
938 write_test_header(tc_name
)
941 step("Bring up the base config as per the topology")
943 reset_config_on_routers(tgen
)
946 " Create static routes(10.0.20.1/32) in R1 and "
947 "redistribute to OSPF using route map."
949 # Create Static routes
954 "network": NETWORK
["ipv6"][0],
961 result
= create_static_routes(tgen
, input_dict
)
962 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
967 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
971 result
= create_router_ospf(tgen
, topo
, ospf_red_r0
)
972 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
974 step("Configure route map with set clause (set metric)")
980 {"action": "permit", "seq_id": 10, "set": {"metric": 123}}
985 result
= create_route_maps(tgen
, routemaps
)
986 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
988 step("Verify that configured metric is applied to ospf routes.")
992 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, metric
=123)
993 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
995 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, metric
=123)
996 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
998 step("un configure the set clause")
1007 "set": {"metric": 123, "delete": True},
1013 result
= create_route_maps(tgen
, routemaps
)
1014 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1016 step("Verify that metric falls back to original metric for ospf routes.")
1020 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, metric
=20)
1021 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1023 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, metric
=20)
1024 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1026 write_test_footer(tc_name
)
1029 def test_ospfv3_routemaps_functionality_tc24_p0(request
):
1031 OSPF Route map - Multiple set clauses.
1033 Verify OSPF route map support functionality when we
1034 add/remove route-maps with multiple match clauses and without
1035 any set statement.(Match only)
1038 tc_name
= request
.node
.name
1039 write_test_header(tc_name
)
1040 tgen
= get_topogen()
1042 step("Bring up the base config as per the topology")
1044 reset_config_on_routers(tgen
)
1047 "Create static routes(10.0.20.1/32) in R1 and redistribute to "
1048 "OSPF using route map."
1050 # Create Static routes
1055 "network": NETWORK
["ipv6"][0],
1057 "next_hop": "Null0",
1062 result
= create_static_routes(tgen
, input_dict
)
1063 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1068 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
1072 result
= create_router_ospf(tgen
, topo
, ospf_red_r0
)
1073 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1075 # Create ip prefix list
1081 {"seqid": 10, "network": "any", "action": "permit"}
1087 result
= create_prefix_lists(tgen
, pfx_list
)
1088 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1090 step("verify that prefix-list is created in R0.")
1091 result
= verify_prefix_lists(tgen
, pfx_list
)
1094 ), "Testcase {} : Failed \n Prefix list not " "present. Error: {}".format(
1105 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
1111 result
= create_route_maps(tgen
, routemaps
)
1112 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1114 step("Verify that metric falls back to original metric for ospf routes.")
1118 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
1119 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1121 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
1122 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1125 "Create static routes(10.0.20.1/32) in R1 and redistribute to "
1126 "OSPF using route map."
1128 # Create Static routes
1133 "network": NETWORK
["ipv6"][1],
1135 "next_hop": "Null0",
1141 result
= create_static_routes(tgen
, input_dict
)
1142 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1144 # Create ip prefix list
1150 {"seqid": 10, "network": "any", "action": "permit"}
1156 result
= create_prefix_lists(tgen
, pfx_list
)
1157 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1159 step("verify that prefix-list is created in R0.")
1160 result
= verify_prefix_lists(tgen
, pfx_list
)
1163 ), "Testcase {} : Failed \n Prefix list not " "present. Error: {}".format(
1171 "rmap_ipv6": [{"action": "permit", "match": {"ipv6": {"tag": "1000"}}}]
1175 result
= create_route_maps(tgen
, routemaps
)
1176 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1178 step("Verify that metric falls back to original metric for ospf routes.")
1182 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
1183 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1185 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
1186 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1188 step("Delete the match clause with tag in route map")
1196 "match": {"ipv6": {"tag": "1000", "delete": True}},
1202 result
= create_route_maps(tgen
, routemaps
)
1203 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1205 step("Verify that metric falls back to original metric for ospf routes.")
1209 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
1210 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1212 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
1213 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1215 step("Delete the match clause with metric in route map.")
1224 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
1230 result
= create_route_maps(tgen
, routemaps
)
1231 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1233 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
1234 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1236 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
1237 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1239 write_test_footer(tc_name
)
1242 if __name__
== "__main__":
1243 args
= ["-s"] + sys
.argv
[1:]
1244 sys
.exit(pytest
.main(args
))