]>
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
,
53 from lib
.topolog
import logger
54 from lib
.topojson
import build_config_from_json
56 from lib
.ospf
import (
57 verify_ospf6_neighbor
,
63 pytestmark
= [pytest
.mark
.ospfd
, pytest
.mark
.staticd
]
78 "ipv6": ["2::1/128", "2::2/128", "2::3/128", "2::4/128", "2::5/128"],
81 routerids
= ["100.1.1.0", "100.1.1.1", "100.1.1.2", "100.1.1.3"]
85 Please view in a fixed-width font such as Courier.
87 +R1 +------------+R2 |
96 +R0 +-------------+R3 |
100 2. Verify OSPF route map support functionality when route map is not
101 configured at system level but configured in OSPF
102 4. Verify OSPF route map support functionality
103 when route map actions are toggled.
104 5. Verify OSPF route map support functionality with multiple sequence
105 numbers in a single route-map for different match/set clauses.
106 6. Verify OSPF route map support functionality when we add/remove route-maps
107 with multiple set clauses and without any match statement.(Set only)
108 7. Verify OSPF route map support functionality when we
109 add/remove route-maps with multiple match clauses and without
110 any set statement.(Match only)
111 8. Verify OSPF route map applied to ospf redistribution with ipv6 prefix list
115 def setup_module(mod
):
117 Sets up the pytest environment
121 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
122 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
123 logger
.info("=" * 40)
125 logger
.info("Running setup_module to create topology")
127 # This function initiates the topology build with Topogen...
128 json_file
= "{}/ospfv3_routemaps.json".format(CWD
)
129 tgen
= Topogen(json_file
, mod
.__name
__)
131 topo
= tgen
.json_topo
132 # ... and here it calls Mininet initialization functions.
134 # get list of daemons needs to be started for this suite.
135 daemons
= topo_daemons(tgen
, topo
)
137 # Starting topology, create tmp files which are loaded to routers
138 # to start daemons and then start routers
139 start_topology(tgen
, daemons
)
141 # Creating configuration from JSON
142 build_config_from_json(tgen
, topo
)
144 # Don't run this test if we have any failure.
145 if tgen
.routers_have_failure():
146 pytest
.skip(tgen
.errors
)
148 ospf_covergence
= verify_ospf6_neighbor(tgen
, topo
)
149 assert ospf_covergence
is True, "setup_module :Failed \n Error:" " {}".format(
153 logger
.info("Running setup_module() done")
156 def teardown_module(mod
):
158 Teardown the pytest environment.
163 logger
.info("Running teardown_module to delete topology")
167 # Stop toplogy and Remove tmp files
171 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
173 logger
.info("=" * 40)
176 # ##################################
177 # Test cases start here.
178 # ##################################
181 def test_ospfv3_routemaps_functionality_tc19_p0(request
):
183 OSPF Route map - Verify OSPF route map support functionality.
186 tc_name
= request
.node
.name
187 write_test_header(tc_name
)
190 step("Bring up the base config as per the topology")
191 reset_config_on_routers(tgen
)
193 step("Create static routes(10.0.20.1/32 and 10.0.20.2/32) in R0")
194 # Create Static routes
199 "network": NETWORK
["ipv6"][0],
206 result
= create_static_routes(tgen
, input_dict
)
207 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
209 ospf_red_r1
= {"r0": {"ospf6": {"redistribute": [{"redist_type": "static"}]}}}
210 result
= create_router_ospf(tgen
, topo
, ospf_red_r1
)
211 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
214 lsid
= NETWORK
["ipv6"][0].split("/")[0]
218 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
219 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
221 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
222 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
226 "ospf6": {"redistribute": [{"redist_type": "static", "del_action": True}]}
229 result
= create_router_ospf(tgen
, topo
, ospf_red_r1
)
230 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
233 "Create prefix-list in R0 to permit 10.0.20.1/32 prefix &" " deny 10.0.20.2/32"
236 # Create ip prefix list
244 "network": NETWORK
["ipv6"][0],
247 {"seqid": 11, "network": "any", "action": "deny"},
253 result
= create_prefix_lists(tgen
, pfx_list
)
254 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
256 step("verify that prefix-list is created in R0.")
257 result
= verify_prefix_lists(tgen
, pfx_list
)
260 ), "Testcase {} : Failed \n, prefix list creation failed. Error: {}".format(
271 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
277 result
= create_route_maps(tgen
, routemaps
)
278 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
281 "Configure route map rmap1 and redistribute static routes to"
282 " ospf using route map rmap1"
288 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
292 result
= create_router_ospf(tgen
, topo
, ospf_red_r1
)
293 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
294 step("Verify that route map is activated in OSPF.")
296 step("Verify that route 10.0.20.1 is allowed and 10.0.20.2 is denied.")
301 {"network": NETWORK
["ipv6"][0], "no_of_ip": 1, "next_hop": "Null0"}
305 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
306 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
308 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
309 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
312 lsid
= NETWORK
["ipv6"][1].split("/")[0]
315 step("Change prefix rules to permit 10.0.20.2 and deny 10.0.20.1")
316 # Create ip prefix list
324 "network": NETWORK
["ipv6"][1],
327 {"seqid": 11, "network": "any", "action": "deny"},
333 result
= create_prefix_lists(tgen
, pfx_list
)
334 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
336 step("Verify that route 10.0.20.2 is allowed and 10.0.20.1 is denied.")
341 {"network": NETWORK
["ipv6"][1], "no_of_ip": 1, "next_hop": "Null0"}
345 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
346 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
348 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
349 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
354 {"network": NETWORK
["ipv6"][0], "no_of_ip": 1, "next_hop": "Null0"}
358 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
361 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
366 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
370 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
374 step("Delete and reconfigure prefix list.")
375 # Create ip prefix list
383 "network": NETWORK
["ipv6"][1],
398 result
= create_prefix_lists(tgen
, pfx_list
)
399 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
401 result
= verify_prefix_lists(tgen
, pfx_list
)
402 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
407 {"network": NETWORK
["ipv6"][0], "no_of_ip": 5, "next_hop": "Null0"}
411 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
414 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
419 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
423 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
434 "network": NETWORK
["ipv6"][1],
437 {"seqid": 11, "network": "any", "action": "deny"},
443 result
= create_prefix_lists(tgen
, pfx_list
)
444 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
446 step("Verify that route 10.0.20.2 is allowed and 10.0.20.1 is denied.")
451 {"network": NETWORK
["ipv6"][1], "no_of_ip": 1, "next_hop": "Null0"}
455 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
456 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
458 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
459 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
464 {"network": NETWORK
["ipv6"][0], "no_of_ip": 1, "next_hop": "Null0"}
468 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
471 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
476 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
480 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
484 write_test_footer(tc_name
)
487 def test_ospfv3_routemaps_functionality_tc20_p0(request
):
489 OSPF route map support functionality.
491 Verify OSPF route map support functionality when route map is not
492 configured at system level but configured in OSPF
495 tc_name
= request
.node
.name
496 write_test_header(tc_name
)
499 step("Bring up the base config as per the topology")
501 reset_config_on_routers(tgen
)
503 step("Create static routes(10.0.20.1/32 and 10.0.20.2/32) in R0")
504 # Create Static routes
509 "network": NETWORK
["ipv6"][0],
516 result
= create_static_routes(tgen
, input_dict
)
517 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
519 step("Redistribute to ospf using route map ( non existent route map)")
523 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
527 result
= create_router_ospf(tgen
, topo
, ospf_red_r1
)
528 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
531 "Verify that routes are not allowed in OSPF even tough no "
532 "matching routing map is configured."
537 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
540 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
544 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
547 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
552 "configure the route map with the same name that is used "
553 "in the ospf with deny rule."
557 routemaps
= {"r0": {"route_maps": {"rmap_ipv6": [{"action": "deny"}]}}}
558 result
= create_route_maps(tgen
, routemaps
)
559 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
561 step("verify that now route map is activated & routes are denied in OSPF.")
564 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
567 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
572 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
576 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
581 routemaps
= {"r0": {"route_maps": {"rmap_ipv6": [{"action": "deny"}]}}}
582 result
= create_route_maps(tgen
, routemaps
)
583 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
585 step("verify that now route map is activated & routes are denied in OSPF.")
588 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
591 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
596 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
600 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
604 step("Delete the route map.")
607 "r0": {"route_maps": {"rmap_ipv6": [{"action": "deny", "delete": True}]}}
609 result
= create_route_maps(tgen
, routemaps
)
610 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
613 "Verify that routes are allowed in OSPF even tough "
614 "no matching routing map is configured."
618 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
621 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
626 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
630 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
634 write_test_footer(tc_name
)
637 def test_ospfv3_routemaps_functionality_tc25_p0(request
):
639 OSPF route map support functionality.
641 Verify OSPF route map support functionality
642 when route map actions are toggled.
645 tc_name
= request
.node
.name
646 write_test_header(tc_name
)
649 step("Bring up the base config as per the topology")
651 reset_config_on_routers(tgen
)
654 "Create static routes(10.0.20.1/32) in R1 and redistribute "
655 "to OSPF using route map."
658 # Create Static routes
663 "network": NETWORK
["ipv6"][0],
670 result
= create_static_routes(tgen
, input_dict
)
671 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
676 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
680 result
= create_router_ospf(tgen
, topo
, ospf_red_r0
)
681 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
682 step("Configure route map with permit rule")
684 routemaps
= {"r0": {"route_maps": {"rmap_ipv6": [{"action": "permit"}]}}}
685 result
= create_route_maps(tgen
, routemaps
)
686 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
688 step("Verify that route is advertised to R1.")
691 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
692 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
694 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
695 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
696 step("Configure route map with deny rule")
699 "r0": {"route_maps": {"rmap_ipv6": [{"seq_id": 10, "action": "deny"}]}}
701 result
= create_route_maps(tgen
, routemaps
)
702 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
704 # Api call verify whether OSPF is converged
705 ospf_covergence
= verify_ospf6_neighbor(tgen
, topo
)
706 assert ospf_covergence
is True, "setup_module :Failed \n Error:" " {}".format(
710 step("Verify that route is not advertised to R1.")
713 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
716 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
721 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
725 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
729 write_test_footer(tc_name
)
732 def test_ospfv3_routemaps_functionality_tc22_p0(request
):
734 OSPF Route map - Multiple sequence numbers.
736 Verify OSPF route map support functionality with multiple sequence
737 numbers in a single route-map for different match/set clauses.
740 tc_name
= request
.node
.name
741 write_test_header(tc_name
)
744 step("Bring up the base config as per the topology")
746 reset_config_on_routers(tgen
)
749 "Configure route map with seq number 10 to with ip prefix"
750 " permitting route 10.0.20.1/32 in R1"
753 "Configure route map with seq number 20 to with ip prefix"
754 " permitting route 10.0.20.2/32 in R1"
765 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
770 "match": {"ipv6": {"prefix_lists": "pf_list_2_ipv6"}},
776 result
= create_route_maps(tgen
, input_dict_3
)
777 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
779 # Create ip prefix list
785 {"seqid": 10, "network": NETWORK
["ipv6"][0], "action": "permit"}
791 result
= create_prefix_lists(tgen
, input_dict_2
)
792 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
794 # Create ip prefix list
800 {"seqid": 10, "network": NETWORK
["ipv6"][1], "action": "permit"}
806 result
= create_prefix_lists(tgen
, input_dict_2
)
807 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
809 step("Configure static routes 10.0.20.1/32 and 10.0.20.2 in R1")
810 # Create Static routes
815 "network": NETWORK
["ipv6"][0],
822 result
= create_static_routes(tgen
, input_dict
)
823 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
825 step("Configure redistribute static route with route map.")
829 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
833 result
= create_router_ospf(tgen
, topo
, ospf_red_r0
)
834 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
840 "network": NETWORK
["ipv6"][0],
847 result
= create_static_routes(tgen
, input_dict
)
848 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
850 step("Verify that both routes are learned in R1 and R2")
853 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
854 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
856 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
857 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
861 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
862 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
864 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
865 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
867 step("Change route map with seq number 20 to deny.")
876 "match": {"ipv6": {"prefix_lists": "pf_list_2_ipv6"}},
882 result
= create_route_maps(tgen
, input_dict_3
)
883 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
886 "Verify the route 10.0.20.2/32 is withdrawn and not present "
887 "in the routing table of R0 and R1."
891 "r0": {"static_routes": [{"network": NETWORK
["ipv6"][1], "next_hop": "Null0"}]}
896 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
899 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
904 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
908 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
914 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, expected
=False)
917 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
922 tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, expected
=False
926 ), "Testcase {} : Failed \n Route found in the RIB, Error: {}".format(
930 write_test_footer(tc_name
)
933 def test_ospfv3_routemaps_functionality_tc23_p0(request
):
935 OSPF Route map - Multiple set clauses.
937 Verify OSPF route map support functionality when we add/remove route-maps
938 with multiple set clauses and without any match statement.(Set only)
941 tc_name
= request
.node
.name
942 write_test_header(tc_name
)
945 step("Bring up the base config as per the topology")
947 reset_config_on_routers(tgen
)
950 " Create static routes(10.0.20.1/32) in R1 and "
951 "redistribute to OSPF using route map."
953 # Create Static routes
958 "network": NETWORK
["ipv6"][0],
965 result
= create_static_routes(tgen
, input_dict
)
966 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
971 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
975 result
= create_router_ospf(tgen
, topo
, ospf_red_r0
)
976 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
978 step("Configure route map with set clause (set metric)")
984 {"action": "permit", "seq_id": 10, "set": {"metric": 123}}
989 result
= create_route_maps(tgen
, routemaps
)
990 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
992 step("Verify that configured metric is applied to ospf routes.")
996 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, metric
=123)
997 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
999 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, metric
=123)
1000 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1002 step("un configure the set clause")
1011 "set": {"metric": 123, "delete": True},
1017 result
= create_route_maps(tgen
, routemaps
)
1018 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1020 step("Verify that metric falls back to original metric for ospf routes.")
1024 result
= verify_ospf6_rib(tgen
, dut
, input_dict
, metric
=20)
1025 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1027 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
, metric
=20)
1028 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1030 write_test_footer(tc_name
)
1033 def test_ospfv3_routemaps_functionality_tc24_p0(request
):
1035 OSPF Route map - Multiple set clauses.
1037 Verify OSPF route map support functionality when we
1038 add/remove route-maps with multiple match clauses and without
1039 any set statement.(Match only)
1042 tc_name
= request
.node
.name
1043 write_test_header(tc_name
)
1044 tgen
= get_topogen()
1046 step("Bring up the base config as per the topology")
1048 reset_config_on_routers(tgen
)
1051 "Create static routes(10.0.20.1/32) in R1 and redistribute to "
1052 "OSPF using route map."
1054 # Create Static routes
1059 "network": NETWORK
["ipv6"][0],
1061 "next_hop": "Null0",
1066 result
= create_static_routes(tgen
, input_dict
)
1067 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1072 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
1076 result
= create_router_ospf(tgen
, topo
, ospf_red_r0
)
1077 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1079 # Create ip prefix list
1085 {"seqid": 10, "network": "any", "action": "permit"}
1091 result
= create_prefix_lists(tgen
, pfx_list
)
1092 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1094 step("verify that prefix-list is created in R0.")
1095 result
= verify_prefix_lists(tgen
, pfx_list
)
1098 ), "Testcase {} : Failed \n Prefix list not " "present. Error: {}".format(
1109 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
1115 result
= create_route_maps(tgen
, routemaps
)
1116 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1118 step("Verify that metric falls back to original metric for ospf routes.")
1122 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
1123 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1125 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
1126 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1129 "Create static routes(10.0.20.1/32) in R1 and redistribute to "
1130 "OSPF using route map."
1132 # Create Static routes
1137 "network": NETWORK
["ipv6"][1],
1139 "next_hop": "Null0",
1145 result
= create_static_routes(tgen
, input_dict
)
1146 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1148 # Create ip prefix list
1154 {"seqid": 10, "network": "any", "action": "permit"}
1160 result
= create_prefix_lists(tgen
, pfx_list
)
1161 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1163 step("verify that prefix-list is created in R0.")
1164 result
= verify_prefix_lists(tgen
, pfx_list
)
1167 ), "Testcase {} : Failed \n Prefix list not " "present. Error: {}".format(
1175 "rmap_ipv6": [{"action": "permit", "match": {"ipv6": {"tag": "1000"}}}]
1179 result
= create_route_maps(tgen
, routemaps
)
1180 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1182 step("Verify that metric falls back to original metric for ospf routes.")
1186 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
1187 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1189 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
1190 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1192 step("Delete the match clause with tag in route map")
1200 "match": {"ipv6": {"tag": "1000", "delete": True}},
1206 result
= create_route_maps(tgen
, routemaps
)
1207 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1209 step("Verify that metric falls back to original metric for ospf routes.")
1213 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
1214 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1216 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
1217 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1219 step("Delete the match clause with metric in route map.")
1228 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
1234 result
= create_route_maps(tgen
, routemaps
)
1235 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1237 result
= verify_ospf6_rib(tgen
, dut
, input_dict
)
1238 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1240 result
= verify_rib(tgen
, "ipv6", dut
, input_dict
, protocol
=protocol
)
1241 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1243 write_test_footer(tc_name
)
1246 if __name__
== "__main__":
1247 args
= ["-s"] + sys
.argv
[1:]
1248 sys
.exit(pytest
.main(args
))