]> git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py
tests: Adding database information in ospfv3 testcase
[mirror_frr.git] / tests / topotests / ospfv3_basic_functionality / test_ospfv3_asbr_summary_topo1.py
1 #!/usr/bin/python
2
3 #
4 # Copyright (c) 2021 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation, Inc.
6 # ("NetDEF") in this file.
7 #
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
11 # in all copies.
12 #
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
20 # OF THIS SOFTWARE.
21 #
22
23
24 """OSPF Summarisation Functionality Automation."""
25 import os
26 import sys
27 import time
28 import pytest
29
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/"))
34
35 # pylint: disable=C0413
36 # Import topogen and topotest helpers
37 from lib.topogen import Topogen, get_topogen
38 import ipaddress
39 from time import sleep
40
41 # Import topoJson from lib, to create topology and initial configuration
42 from lib.common_config import (
43 start_topology,
44 write_test_header,
45 kill_router_daemons,
46 write_test_footer,
47 reset_config_on_routers,
48 stop_router,
49 start_router,
50 verify_rib,
51 create_static_routes,
52 step,
53 start_router_daemons,
54 create_route_maps,
55 shutdown_bringup_interface,
56 create_prefix_lists,
57 create_route_maps,
58 topo_daemons,
59 create_interfaces_cfg,
60 )
61 from lib.topolog import logger
62 from lib.topojson import build_config_from_json
63 from lib.ospf import (
64 verify_ospf6_neighbor,
65 clear_ospf,
66 verify_ospf6_rib,
67 create_router_ospf,
68 verify_ospf_summary,
69 )
70
71
72 # Global variables
73 topo = None
74
75 NETWORK = {
76 "ipv4": [
77 "11.0.20.1/32",
78 "11.0.20.2/32",
79 "11.0.20.3/32",
80 "11.0.20.4/32",
81 "11.0.20.5/32",
82 ],
83 "ipv6": [
84 "2011:0:20::1/128",
85 "2011:0:20::2/128",
86 "2011:0:20::3/128",
87 "2011:0:20::4/128",
88 "2011:0:20::5/128",
89 ],
90 }
91 NETWORK_11 = {
92 "ipv4": ["11.0.20.6/32", "11.0.20.7/32"],
93 "ipv6": ["2011:0:20::6/128", "2011:0:20::7/128"],
94 }
95
96 NETWORK2 = {
97 "ipv4": [
98 "12.0.20.1/32",
99 "12.0.20.2/32",
100 "12.0.20.3/32",
101 "12.0.20.4/32",
102 "12.0.20.5/32",
103 ],
104 "ipv6": [
105 "2012:0:20::1/128",
106 "2012:0:20::2/128",
107 "2012:0:20::3/128",
108 "2012:0:20::4/128",
109 "2012:0:20::5/128",
110 ],
111 }
112 SUMMARY = {
113 "ipv4": ["11.0.0.0/8", "12.0.0.0/8", "11.0.0.0/24"],
114 "ipv6": ["2011::/32", "2012::/32", "2011::/64", "2011::/24"],
115 }
116 """
117 TOPOOLOGY =
118 Please view in a fixed-width font such as Courier.
119 +---+ A0 +---+
120 +R1 +------------+R2 |
121 +-+-+- +--++
122 | -- -- |
123 | -- A0 -- |
124 A0| ---- |
125 | ---- | A0
126 | -- -- |
127 | -- -- |
128 +-+-+- +-+-+
129 +R0 +-------------+R3 |
130 +---+ A0 +---+
131
132 TESTCASES =
133 1. OSPF summarisation functionality.
134 2. OSPF summarisation with advertise and no advertise option
135 3. OSPF summarisation with route map modification of metric type.
136 4. OSPF CLI Show verify ospf ASBR summary config and show commands behaviours.
137 5. OSPF summarisation Chaos.
138 """
139
140
141 def setup_module(mod):
142 """
143 Sets up the pytest environment
144
145 * `mod`: module name
146 """
147 testsuite_run_time = time.asctime(time.localtime(time.time()))
148 logger.info("Testsuite start time: {}".format(testsuite_run_time))
149 logger.info("=" * 40)
150
151 logger.info("Running setup_module to create topology")
152
153 # This function initiates the topology build with Topogen...
154 json_file = "{}/ospfv3_asbr_summary_topo1.json".format(CWD)
155 tgen = Topogen(json_file, mod.__name__)
156 global topo
157 topo = tgen.json_topo
158 # ... and here it calls Mininet initialization functions.
159
160 # get list of daemons needs to be started for this suite.
161 daemons = topo_daemons(tgen, topo)
162
163 # Starting topology, create tmp files which are loaded to routers
164 # to start deamons and then start routers
165 start_topology(tgen, daemons)
166
167 # Creating configuration from JSON
168 build_config_from_json(tgen, topo)
169
170 # Don't run this test if we have any failure.
171 if tgen.routers_have_failure():
172 pytest.skip(tgen.errors)
173 # Api call verify whether OSPF is converged
174 ospf_covergence = verify_ospf6_neighbor(tgen, topo)
175 assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format(
176 ospf_covergence
177 )
178
179 logger.info("Running setup_module() done")
180
181
182 def teardown_module(mod):
183 """
184 Teardown the pytest environment.
185
186 * `mod`: module name
187 """
188
189 logger.info("Running teardown_module to delete topology")
190
191 tgen = get_topogen()
192
193 # Stop toplogy and Remove tmp files
194 tgen.stop_topology()
195
196 logger.info(
197 "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
198 )
199 logger.info("=" * 40)
200
201
202 def red_static(dut, config=True):
203 """
204 Local 'def' for Redstribute static routes inside ospf.
205
206 Parameters
207 ----------
208 * `dut` : DUT on which configs have to be made.
209 * `config` : True or False, True by default for configure, set False for
210 unconfiguration.
211 """
212 global topo
213 tgen = get_topogen()
214 if config:
215 ospf_red = {dut: {"ospf6": {"redistribute": [{"redist_type": "static"}]}}}
216 else:
217 ospf_red = {
218 dut: {
219 "ospf6": {"redistribute": [{"redist_type": "static", "delete": True}]}
220 }
221 }
222 result = create_router_ospf(tgen, topo, ospf_red)
223 assert result is True, "Testcase : Failed \n Error: {}".format(result)
224
225
226 def red_connected(dut, config=True):
227 """
228 Local 'def' for Redstribute connected routes inside ospf
229
230 Parameters
231 ----------
232 * `dut` : DUT on which configs have to be made.
233 * `config` : True or False, True by default for configure, set False for
234 unconfiguration.
235 """
236 global topo
237 tgen = get_topogen()
238 if config:
239 ospf_red = {dut: {"ospf6": {"redistribute": [{"redist_type": "connected"}]}}}
240 else:
241 ospf_red = {
242 dut: {
243 "ospf6": {
244 "redistribute": [{"redist_type": "connected", "delete": True}]
245 }
246 }
247 }
248 result = create_router_ospf(tgen, topo, ospf_red)
249 assert result is True, "Testcase: Failed \n Error: {}".format(result)
250
251
252 # ##################################
253 # Test cases start here.
254 # ##################################
255
256
257 def test_ospfv3_type5_summary_tc42_p0(request):
258 """OSPF summarisation functionality."""
259 tc_name = request.node.name
260 write_test_header(tc_name)
261 tgen = get_topogen()
262
263 # Don't run this test if we have any failure.
264 if tgen.routers_have_failure():
265 pytest.skip(tgen.errors)
266
267 global topo
268 step("Bring up the base config as per the topology")
269 reset_config_on_routers(tgen)
270
271 protocol = "ospf"
272
273 step(
274 "Configure 5 static routes from the same network on R0"
275 "5 static routes from different networks and redistribute in R0"
276 )
277 input_dict_static_rtes = {
278 "r0": {
279 "static_routes": [
280 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
281 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
282 ]
283 }
284 }
285 result = create_static_routes(tgen, input_dict_static_rtes)
286 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
287
288 dut = "r0"
289 red_static(dut)
290
291 step("Verify that routes are learnt on R1.")
292 dut = "r1"
293
294 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
295 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
296 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
297 assert (
298 result is True
299 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
300
301 step(
302 "Configure External Route summary in R0 to summarise 5"
303 " routes to one route. with aggregate timer as 6 sec"
304 )
305
306 ospf_summ_r1 = {
307 "r0": {
308 "ospf6": {
309 "summary-address": [
310 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
311 ],
312 "aggr_timer": 6,
313 }
314 }
315 }
316 result = create_router_ospf(tgen, topo, ospf_summ_r1)
317 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
318
319 step(
320 "Verify that external routes are summarised to configured summary "
321 "address on R0 after 5 secs of delay timer expiry and only one "
322 "route is sent to R1."
323 )
324 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
325 dut = "r1"
326
327 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
328 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
329
330 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
331 assert (
332 result is True
333 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
334
335 step("Verify that show ip ospf summary should show the summaries.")
336 input_dict = {
337 SUMMARY["ipv6"][0]: {
338 "Summary address": SUMMARY["ipv6"][0],
339 "Metric-type": "E2",
340 "Metric": 20,
341 "Tag": 0,
342 "External route count": 5,
343 }
344 }
345 dut = "r0"
346 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
347 assert (
348 result is True
349 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
350
351 step("Verify that originally advertised routes are withdraw from there" " peer.")
352 input_dict = {
353 "r0": {"static_routes": [{"network": NETWORK["ipv6"], "next_hop": "blackhole"}]}
354 }
355 dut = "r1"
356 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
357 assert (
358 result is not True
359 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
360 tc_name, result
361 )
362
363 result = verify_rib(
364 tgen, "ipv6", dut, input_dict, protocol=protocol, expected=False
365 )
366 assert (
367 result is not True
368 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
369
370 step("Delete the configured summary")
371 ospf_summ_r1 = {
372 "r0": {
373 "ospf6": {
374 "summary-address": [
375 {
376 "prefix": SUMMARY["ipv6"][0].split("/")[0],
377 "mask": "32",
378 "del_aggr_timer": True,
379 "delete": True,
380 }
381 ]
382 }
383 }
384 }
385 result = create_router_ospf(tgen, topo, ospf_summ_r1)
386 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
387
388 step("Verify that summary lsa is withdrawn from R1 and deleted from R0.")
389 dut = "r1"
390 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
391 assert (
392 result is not True
393 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
394 tc_name, result
395 )
396
397 result = verify_rib(
398 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
399 )
400 assert (
401 result is not True
402 ), "Testcase {} : Failed" "Error: Summary Route still present in RIB".format(
403 tc_name
404 )
405
406 step("show ip ospf summary should not have any summary address.")
407 input_dict = {
408 SUMMARY["ipv6"][0]: {
409 "Summary address": SUMMARY["ipv6"][0],
410 "Metric-type": "E2",
411 "Metric": 20,
412 "Tag": 0,
413 "External route count": 5,
414 }
415 }
416 dut = "r0"
417 result = verify_ospf_summary(
418 tgen, topo, dut, input_dict, ospf="ospf6", expected=False
419 )
420 assert (
421 result is not True
422 ), "Testcase {} : Failed" "Error: Summary still present in DB".format(tc_name)
423
424 dut = "r1"
425 step("All 5 routes are advertised after deletion of configured summary.")
426
427 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
428 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
429
430 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
431 assert (
432 result is True
433 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
434
435 step("configure the summary again and delete static routes .")
436 ospf_summ_r1 = {
437 "r0": {
438 "ospf6": {
439 "summary-address": [
440 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
441 ]
442 }
443 }
444 }
445 result = create_router_ospf(tgen, topo, ospf_summ_r1)
446 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
447
448 input_dict = {
449 SUMMARY["ipv6"][0]: {
450 "Summary address": SUMMARY["ipv6"][0],
451 "Metric-type": "E2",
452 "Metric": 20,
453 "Tag": 0,
454 "External route count": 5,
455 }
456 }
457 dut = "r0"
458 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
459 assert (
460 result is True
461 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
462
463 input_dict = {
464 "r0": {
465 "static_routes": [
466 {"network": NETWORK["ipv6"], "next_hop": "blackhole", "delete": True}
467 ]
468 }
469 }
470 result = create_static_routes(tgen, input_dict)
471 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
472
473 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
474 step("Verify that summary route is withdrawn from R1.")
475
476 dut = "r1"
477 result = verify_ospf6_rib(tgen, dut, input_dict_summary, expected=False)
478 assert (
479 result is not True
480 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
481 tc_name, result
482 )
483
484 result = verify_rib(
485 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
486 )
487 assert (
488 result is not True
489 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
490
491 step("Add back static routes.")
492 input_dict_static_rtes = {
493 "r0": {"static_routes": [{"network": NETWORK["ipv6"], "next_hop": "blackhole"}]}
494 }
495 result = create_static_routes(tgen, input_dict_static_rtes)
496 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
497
498 step(
499 "Verify that external routes are summarised to configured summary"
500 " address on R0 and only one route is sent to R1."
501 )
502 dut = "r1"
503
504 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes, expected=False)
505 assert (
506 result is not True
507 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
508 tc_name, result
509 )
510
511 result = verify_rib(
512 tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol, expected=False
513 )
514 assert (
515 result is not True
516 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
517
518 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
519 dut = "r1"
520
521 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
522 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
523
524 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
525 assert (
526 result is True
527 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
528
529 step("Verify that show ip ospf summary should show configure summaries.")
530
531 input_dict = {
532 SUMMARY["ipv6"][0]: {
533 "Summary address": SUMMARY["ipv6"][0],
534 "Metric-type": "E2",
535 "Metric": 20,
536 "Tag": 0,
537 "External route count": 5,
538 }
539 }
540 dut = "r0"
541 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
542 assert (
543 result is True
544 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
545
546 step("Configure new static route which is matching configured summary.")
547 input_dict_static_rtes = {
548 "r0": {
549 "static_routes": [{"network": NETWORK_11["ipv6"], "next_hop": "blackhole"}]
550 }
551 }
552 result = create_static_routes(tgen, input_dict_static_rtes)
553 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
554
555 # step("verify that summary lsa is not refreshed.")
556 # show ip ospf database command is not working, waiting for DEV fix.
557
558 step("Delete one of the static route.")
559 input_dict_static_rtes = {
560 "r0": {
561 "static_routes": [
562 {"network": NETWORK_11["ipv6"], "next_hop": "blackhole", "delete": True}
563 ]
564 }
565 }
566 result = create_static_routes(tgen, input_dict_static_rtes)
567 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
568
569 # step("verify that summary lsa is not refreshed.")
570 # show ip ospf database command is not working, waiting for DEV fix.
571
572 # step("Verify that deleted static route is removed from ospf LSDB.")
573 # show ip ospf database command is not working, waiting for DEV fix.
574
575 step(
576 "Configure redistribute connected and configure ospf external"
577 " summary address to summarise the connected routes."
578 )
579
580 dut = "r0"
581 red_connected(dut)
582 clear_ospf(tgen, dut, ospf="ospf6")
583
584 ip = topo["routers"]["r0"]["links"]["r3"]["ipv6"]
585
586 ip_net = str(ipaddress.ip_interface(u"{}".format(ip)).network)
587 ospf_summ_r1 = {
588 "r0": {
589 "ospf6": {
590 "summary-address": [{"prefix": ip_net.split("/")[0], "mask": "8"}]
591 }
592 }
593 }
594 result = create_router_ospf(tgen, topo, ospf_summ_r1)
595 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
596
597 step(
598 "Verify that external routes are summarised to configured "
599 "summary address on R0 and only one route is sent to R1."
600 )
601
602 input_dict_summary = {"r0": {"static_routes": [{"network": "fd00::/64"}]}}
603 dut = "r1"
604 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
605 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
606
607 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
608 assert (
609 result is True
610 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
611
612 step("Shut one of the interface")
613 intf = topo["routers"]["r0"]["links"]["r3-link0"]["interface"]
614 shutdown_bringup_interface(tgen, dut, intf, False)
615
616 # step("verify that summary lsa is not refreshed.")
617 # show ip ospf database command is not working, waiting for DEV fix.
618
619 # step("Verify that deleted connected route is removed from ospf LSDB.")
620 # show ip ospf database command is not working, waiting for DEV fix.
621
622 step("Un do shut the interface")
623 shutdown_bringup_interface(tgen, dut, intf, True)
624
625 # step("verify that summary lsa is not refreshed.")
626 # show ip ospf database command is not working, waiting for DEV fix.
627
628 # step("Verify that deleted connected route is removed from ospf LSDB.")
629 # show ip ospf database command is not working, waiting for DEV fix.
630
631 step("Delete OSPF process.")
632 ospf_del = {"r0": {"ospf6": {"delete": True}}}
633 result = create_router_ospf(tgen, topo, ospf_del)
634 assert result is True, "Testcase : Failed \n Error: {}".format(result)
635
636 step("Reconfigure ospf process with summary")
637 reset_config_on_routers(tgen)
638
639 input_dict_static_rtes = {
640 "r0": {
641 "static_routes": [
642 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
643 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
644 ]
645 }
646 }
647 result = create_static_routes(tgen, input_dict_static_rtes)
648 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
649
650 dut = "r0"
651 red_static(dut)
652 red_connected(dut)
653 ospf_summ_r1 = {
654 "r0": {
655 "ospf6": {
656 "summary-address": [
657 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
658 ]
659 }
660 }
661 }
662 result = create_router_ospf(tgen, topo, ospf_summ_r1)
663 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
664 step(
665 "Verify that external routes are summarised to configured summary "
666 "address on R0 and only one route is sent to R1."
667 )
668
669 input_dict = {
670 SUMMARY["ipv6"][0]: {
671 "Summary address": SUMMARY["ipv6"][0],
672 "Metric-type": "E2",
673 "Metric": 20,
674 "Tag": 0,
675 "External route count": 5,
676 }
677 }
678 dut = "r0"
679 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
680 assert (
681 result is True
682 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
683
684 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
685
686 dut = "r1"
687 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
688 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
689
690 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
691 assert (
692 result is True
693 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
694
695 ospf_summ_r1 = {
696 "r0": {
697 "ospf6": {
698 "summary-address": [
699 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
700 ]
701 }
702 }
703 }
704 result = create_router_ospf(tgen, topo, ospf_summ_r1)
705 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
706
707 # step("verify that summary lsa is not refreshed.")
708 # show ip ospf database command is not working, waiting for DEV fix.
709
710 step("Delete the redistribute command in ospf.")
711 dut = "r0"
712 red_connected(dut, config=False)
713 red_static(dut, config=False)
714
715 step("Verify that summary route is withdrawn from the peer.")
716
717 dut = "r1"
718 result = verify_ospf6_rib(tgen, dut, input_dict_summary, expected=False)
719 assert (
720 result is not True
721 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
722 tc_name, result
723 )
724
725 result = verify_rib(
726 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
727 )
728 assert (
729 result is not True
730 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
731
732 ospf_summ_r1 = {
733 "r0": {
734 "ospf6": {
735 "summary-address": [
736 {
737 "prefix": SUMMARY["ipv6"][0].split("/")[0],
738 "mask": "32",
739 "metric": "1234",
740 }
741 ]
742 }
743 }
744 }
745 result = create_router_ospf(tgen, topo, ospf_summ_r1)
746 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
747
748 write_test_footer(tc_name)
749
750
751 def test_ospfv3_type5_summary_tc43_p0(request):
752 """OSPF summarisation with metric type 2."""
753 tc_name = request.node.name
754 write_test_header(tc_name)
755 tgen = get_topogen()
756
757 # Don't run this test if we have any failure.
758 if tgen.routers_have_failure():
759 pytest.skip(tgen.errors)
760
761 global topo
762 step("Bring up the base config as per the topology")
763 reset_config_on_routers(tgen)
764
765 protocol = "ospf"
766
767 step(
768 "Configure 5 static routes from the same network on R0"
769 "5 static routes from different networks and redistribute in R0"
770 )
771 input_dict_static_rtes = {
772 "r0": {
773 "static_routes": [
774 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
775 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
776 ]
777 }
778 }
779 result = create_static_routes(tgen, input_dict_static_rtes)
780 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
781
782 dut = "r0"
783 red_static(dut)
784
785 step("Verify that routes are learnt on R1.")
786 dut = "r1"
787
788 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
789 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
790 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
791 assert (
792 result is True
793 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
794
795 step(
796 "Configure External Route summary in R0 to summarise 5" " routes to one route."
797 )
798 ospf_summ_r1 = {
799 "r0": {
800 "ospf6": {
801 "summary-address": [
802 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
803 ]
804 }
805 }
806 }
807 result = create_router_ospf(tgen, topo, ospf_summ_r1)
808 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
809 step(
810 "Verify that external routes are summarised to configured summary "
811 "address on R0 after 5 secs of delay timer expiry and only one "
812 "route is sent to R1."
813 )
814 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
815 dut = "r1"
816
817 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
818 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
819
820 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
821 assert (
822 result is True
823 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
824
825 step("Verify that show ip ospf summary should show the summaries.")
826 input_dict = {
827 SUMMARY["ipv6"][0]: {
828 "Summary address": SUMMARY["ipv6"][0],
829 "Metric-type": "E2",
830 "Metric": 20,
831 "Tag": 0,
832 "External route count": 5,
833 }
834 }
835 dut = "r0"
836 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
837 assert (
838 result is True
839 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
840
841 step("Change the summary address mask to lower match (ex - 16 to 8)")
842 ospf_summ_r1 = {
843 "r0": {
844 "ospf6": {
845 "summary-address": [
846 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "16"},
847 {
848 "prefix": SUMMARY["ipv6"][0].split("/")[0],
849 "mask": "32",
850 "delete": True,
851 },
852 ]
853 }
854 }
855 }
856 result = create_router_ospf(tgen, topo, ospf_summ_r1)
857 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
858
859 sleep(5)
860
861 input_dict = {
862 "2011::/16": {
863 "Summary address": "2011::/16",
864 "Metric-type": "E2",
865 "Metric": 20,
866 "Tag": 0,
867 "External route count": 5,
868 }
869 }
870 dut = "r0"
871 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
872 assert (
873 result is True
874 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
875
876 step(
877 "Verify that external routes(static / connected) are summarised"
878 " to configured summary address with newly configured mask."
879 )
880
881 input_dict_summary = {"r0": {"static_routes": [{"network": "2011::0/16"}]}}
882 dut = "r1"
883
884 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
885 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
886
887 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
888 assert (
889 result is True
890 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
891
892 step("Change the summary address mask to higher match (ex - 8 to 24)")
893 ospf_summ_r1 = {
894 "r0": {
895 "ospf6": {
896 "summary-address": [
897 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
898 ]
899 }
900 }
901 }
902 result = create_router_ospf(tgen, topo, ospf_summ_r1)
903 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
904
905 input_dict = {
906 "2011::/32": {
907 "Summary address": "2011::/32",
908 "Metric-type": "E2",
909 "Metric": 20,
910 "Tag": 0,
911 "External route count": 0,
912 }
913 }
914 dut = "r0"
915 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
916 assert (
917 result is True
918 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
919
920 step(
921 "Verify that external routes(static / connected) are summarised"
922 " to configured summary address with newly configured mask."
923 )
924 step("Configure 2 summary address with different mask of same network.")
925 step(
926 "Verify that external routes(static / connected) are summarised "
927 "to configured summary address with highest match."
928 )
929
930 input_dict_summary = {"r0": {"static_routes": [{"network": "2011::0/32"}]}}
931 dut = "r1"
932
933 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
934 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
935
936 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
937 assert (
938 result is True
939 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
940
941 step(" Un configure one of the summary address.")
942 ospf_summ_r1 = {
943 "r0": {
944 "ospf6": {
945 "summary-address": [
946 {
947 "prefix": SUMMARY["ipv6"][0].split("/")[0],
948 "mask": "32",
949 "delete": True,
950 }
951 ]
952 }
953 }
954 }
955 result = create_router_ospf(tgen, topo, ospf_summ_r1)
956 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
957
958 sleep(5)
959
960 step(
961 "Verify that external routes(static / connected) are summarised"
962 " to configured summary address with newly configured mask."
963 )
964
965 input_dict_summary = {"r0": {"static_routes": [{"network": "2011::0/16"}]}}
966 dut = "r1"
967
968 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
969 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
970
971 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
972 assert (
973 result is True
974 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
975
976 ospf_summ_r1 = {
977 "r0": {
978 "ospf6": {
979 "summary-address": [
980 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "16"}
981 ]
982 }
983 }
984 }
985 result = create_router_ospf(tgen, topo, ospf_summ_r1)
986 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
987
988 step(
989 "Verify that external routes(static / connected) are summarised "
990 "to configured summary address with highest match."
991 )
992 input_dict_summary = {"r0": {"static_routes": [{"network": "2011::0/16"}]}}
993 dut = "r1"
994
995 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
996 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
997
998 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
999 assert (
1000 result is True
1001 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1002
1003 write_test_footer(tc_name)
1004
1005
1006 def ospfv3_type5_summary_tc45_p0(request):
1007 """OSPF summarisation with Tag option"""
1008 tc_name = request.node.name
1009 write_test_header(tc_name)
1010 tgen = get_topogen()
1011
1012 # Don't run this test if we have any failure.
1013 if tgen.routers_have_failure():
1014 pytest.skip(tgen.errors)
1015
1016 global topo
1017 step("Bring up the base config as per the topology")
1018 step("Configure OSPF on all the routers of the topology.")
1019 reset_config_on_routers(tgen)
1020
1021 protocol = "ospf"
1022
1023 step(
1024 "Configure 5 static routes from the same network on R0"
1025 "5 static routes from different networks and redistribute in R0"
1026 )
1027 input_dict_static_rtes = {
1028 "r0": {
1029 "static_routes": [
1030 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
1031 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
1032 ]
1033 }
1034 }
1035 result = create_static_routes(tgen, input_dict_static_rtes)
1036 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1037
1038 dut = "r0"
1039 red_static(dut)
1040
1041 step("Verify that routes are learnt on R1.")
1042 dut = "r1"
1043
1044 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
1045 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1046 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
1047 assert (
1048 result is True
1049 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1050
1051 step(
1052 "Configure External Route summary in R0 to summarise 5" " routes to one route."
1053 )
1054 ospf_summ_r1 = {
1055 "r0": {
1056 "ospf6": {
1057 "summary-address": [
1058 {
1059 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1060 "mask": "32",
1061 "tag": "1234",
1062 }
1063 ]
1064 }
1065 }
1066 }
1067 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1068 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1069
1070 step(
1071 "Verify that external routes are summarised to configured summary"
1072 " address on R0 and only one route is sent to R1 with configured tag."
1073 )
1074 input_dict_summary = {
1075 "r0": {"static_routes": [{"network": SUMMARY["ipv6"][0], "tag": "1234"}]}
1076 }
1077 dut = "r1"
1078
1079 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
1080 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1081
1082 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
1083 assert (
1084 result is True
1085 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1086
1087 step("Verify that show ip ospf summary should show the summaries with tag.")
1088 input_dict = {
1089 SUMMARY["ipv6"][0]: {
1090 "Summary address": SUMMARY["ipv6"][0],
1091 "Metric-type": "E2",
1092 "Metric": 20,
1093 "Tag": 1234,
1094 "External route count": 5,
1095 }
1096 }
1097 dut = "r0"
1098 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
1099 assert (
1100 result is True
1101 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
1102
1103 step("Delete the configured summary")
1104 ospf_summ_r1 = {
1105 "r0": {
1106 "ospf6": {
1107 "summary-address": [
1108 {
1109 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1110 "mask": "32",
1111 "tag": "1234",
1112 "delete": True,
1113 }
1114 ]
1115 }
1116 }
1117 }
1118 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1119 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1120
1121 step("Verify that summary lsa is withdrawn from R1 and deleted from R0.")
1122 dut = "r1"
1123 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
1124 assert (
1125 result is not True
1126 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
1127 tc_name, result
1128 )
1129
1130 result = verify_rib(
1131 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
1132 )
1133 assert (
1134 result is not True
1135 ), "Testcase {} : Failed" "Error: Summary Route still present in RIB".format(
1136 tc_name
1137 )
1138
1139 step("show ip ospf summary should not have any summary address.")
1140 input_dict = {
1141 SUMMARY["ipv6"][0]: {
1142 "Summary address": SUMMARY["ipv6"][0],
1143 "Metric-type": "E2",
1144 "Metric": 20,
1145 "Tag": 1234,
1146 "External route count": 5,
1147 }
1148 }
1149 dut = "r0"
1150 result = verify_ospf_summary(
1151 tgen, topo, dut, input_dict, ospf="ospf6", expected=False
1152 )
1153 assert (
1154 result is not True
1155 ), "Testcase {} : Failed" "Error: Summary still present in DB".format(tc_name)
1156
1157 step("Configure Min tag value")
1158 ospf_summ_r1 = {
1159 "r0": {
1160 "ospf6": {
1161 "summary-address": [
1162 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32", "tag": 1}
1163 ]
1164 }
1165 }
1166 }
1167 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1168 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1169 input_dict_summary = {
1170 "r0": {"static_routes": [{"network": SUMMARY["ipv6"][0], "tag": "1"}]}
1171 }
1172 dut = "r1"
1173
1174 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
1175 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1176
1177 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
1178 assert (
1179 result is True
1180 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1181
1182 step("Verify that show ip ospf summary should show the summaries with tag.")
1183 input_dict = {
1184 SUMMARY["ipv6"][0]: {
1185 "Summary address": SUMMARY["ipv6"][0],
1186 "Metric-type": "E2",
1187 "Metric": 20,
1188 "Tag": 1,
1189 "External route count": 5,
1190 }
1191 }
1192 dut = "r0"
1193 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
1194 assert (
1195 result is True
1196 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
1197
1198 step("Configure Max Tag Value")
1199 ospf_summ_r1 = {
1200 "r0": {
1201 "ospf6": {
1202 "summary-address": [
1203 {
1204 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1205 "mask": "32",
1206 "tag": 4294967295,
1207 }
1208 ]
1209 }
1210 }
1211 }
1212 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1213 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1214
1215 input_dict_summary = {
1216 "r0": {"static_routes": [{"network": SUMMARY["ipv6"][0], "tag": "4294967295"}]}
1217 }
1218 dut = "r1"
1219
1220 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
1221 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1222
1223 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
1224 assert (
1225 result is True
1226 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1227
1228 step(
1229 "Verify that boundary values tags are used for summary route"
1230 " using show ip ospf route command."
1231 )
1232 input_dict = {
1233 SUMMARY["ipv6"][0]: {
1234 "Summary address": SUMMARY["ipv6"][0],
1235 "Metric-type": "E2",
1236 "Metric": 20,
1237 "Tag": 4294967295,
1238 "External route count": 5,
1239 }
1240 }
1241 dut = "r0"
1242 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
1243 assert (
1244 result is True
1245 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
1246
1247 step("configure new static route with different tag.")
1248 input_dict_static_rtes_11 = {
1249 "r0": {
1250 "static_routes": [
1251 {"network": NETWORK_11["ipv6"], "next_hop": "blackhole", "tag": "88888"}
1252 ]
1253 }
1254 }
1255 result = create_static_routes(tgen, input_dict_static_rtes_11)
1256 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1257
1258 step("New tag has not been used by summary address.")
1259
1260 input_dict_summary = {
1261 "r0": {"static_routes": [{"network": SUMMARY["ipv6"][0], "tag": "88888"}]}
1262 }
1263 dut = "r1"
1264
1265 result = verify_ospf6_rib(
1266 tgen, dut, input_dict_summary, tag="88888", expected=False
1267 )
1268 assert (
1269 result is not True
1270 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
1271 tc_name, result
1272 )
1273
1274 result = verify_rib(
1275 tgen,
1276 "ipv6",
1277 dut,
1278 input_dict_summary,
1279 protocol=protocol,
1280 tag="88888",
1281 expected=False,
1282 )
1283 assert (
1284 result is not True
1285 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
1286
1287 step(
1288 "Verify that boundary values tags are used for summary route"
1289 " using show ip ospf route command."
1290 )
1291 input_dict = {
1292 SUMMARY["ipv6"][0]: {
1293 "Summary address": SUMMARY["ipv6"][0],
1294 "Metric-type": "E2",
1295 "Metric": 20,
1296 "Tag": 88888,
1297 "External route count": 5,
1298 }
1299 }
1300 dut = "r0"
1301 result = verify_ospf_summary(
1302 tgen, topo, dut, input_dict, ospf="ospf6", expected=False
1303 )
1304 assert (
1305 result is not True
1306 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
1307
1308 step("Delete the configured summary address")
1309 ospf_summ_r1 = {
1310 "r0": {
1311 "ospf6": {
1312 "summary-address": [
1313 {
1314 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1315 "mask": "32",
1316 "tag": 4294967295,
1317 "delete": True,
1318 }
1319 ]
1320 }
1321 }
1322 }
1323 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1324 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1325
1326 step(
1327 "Verify that 6 routes are advertised to neighbour with 5 routes"
1328 " without any tag, 1 route with tag."
1329 )
1330
1331 dut = "r1"
1332 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
1333 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1334 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
1335 assert (
1336 result is True
1337 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1338
1339 step("Verify that summary address is flushed from neighbor.")
1340
1341 dut = "r1"
1342 result = verify_ospf6_rib(tgen, dut, input_dict_summary, expected=False)
1343 assert (
1344 result is not True
1345 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
1346 tc_name, result
1347 )
1348
1349 result = verify_rib(
1350 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
1351 )
1352 assert (
1353 result is not True
1354 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
1355
1356 step("Configure summary first & then configure matching static route.")
1357
1358 input_dict_static_rtes = {
1359 "r0": {
1360 "static_routes": [
1361 {"network": NETWORK["ipv6"], "next_hop": "blackhole", "delete": True},
1362 {"network": NETWORK2["ipv6"], "next_hop": "blackhole", "delete": True},
1363 ]
1364 }
1365 }
1366 result = create_static_routes(tgen, input_dict_static_rtes)
1367 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1368
1369 ospf_summ_r1 = {
1370 "r0": {
1371 "ospf6": {
1372 "summary-address": [
1373 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
1374 ]
1375 }
1376 }
1377 }
1378 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1379 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1380
1381 input_dict_static_rtes = {
1382 "r0": {
1383 "static_routes": [
1384 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
1385 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
1386 ]
1387 }
1388 }
1389 result = create_static_routes(tgen, input_dict_static_rtes)
1390 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1391
1392 step("Repeat steps 1 to 10 of summarisation in non Back bone area.")
1393 reset_config_on_routers(tgen)
1394
1395 step("Change the area id on the interface on R0")
1396 input_dict = {
1397 "r0": {
1398 "links": {
1399 "r1": {
1400 "interface": topo["routers"]["r0"]["links"]["r1"]["interface"],
1401 "ospf6": {"area": "0.0.0.0"},
1402 "delete": True,
1403 }
1404 }
1405 }
1406 }
1407
1408 result = create_interfaces_cfg(tgen, input_dict)
1409 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1410
1411 input_dict = {
1412 "r0": {
1413 "links": {
1414 "r1": {
1415 "interface": topo["routers"]["r0"]["links"]["r1"]["interface"],
1416 "ospf6": {"area": "0.0.0.1"},
1417 }
1418 }
1419 }
1420 }
1421
1422 result = create_interfaces_cfg(tgen, input_dict)
1423 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1424
1425 step("Change the area id on the interface ")
1426 input_dict = {
1427 "r1": {
1428 "links": {
1429 "r0": {
1430 "interface": topo["routers"]["r1"]["links"]["r0"]["interface"],
1431 "ospf6": {"area": "0.0.0.0"},
1432 "delete": True,
1433 }
1434 }
1435 }
1436 }
1437
1438 result = create_interfaces_cfg(tgen, input_dict)
1439 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1440
1441 input_dict = {
1442 "r1": {
1443 "links": {
1444 "r0": {
1445 "interface": topo["routers"]["r1"]["links"]["r0"]["interface"],
1446 "ospf6": {"area": "0.0.0.1"},
1447 }
1448 }
1449 }
1450 }
1451
1452 result = create_interfaces_cfg(tgen, input_dict)
1453 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1454
1455 ospf_covergence = verify_ospf6_neighbor(tgen, topo)
1456 assert ospf_covergence is True, "Testcase {} :Failed \n Error: {}".format(
1457 tc_name, ospf_covergence
1458 )
1459
1460 step(
1461 "Configure 5 static routes from the same network on R0"
1462 "5 static routes from different networks and redistribute in R0"
1463 )
1464 input_dict_static_rtes = {
1465 "r0": {
1466 "static_routes": [
1467 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
1468 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
1469 ]
1470 }
1471 }
1472 result = create_static_routes(tgen, input_dict_static_rtes)
1473 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1474
1475 dut = "r0"
1476 red_static(dut)
1477
1478 step("Verify that routes are learnt on R1.")
1479 dut = "r1"
1480
1481 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
1482 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1483 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
1484 assert (
1485 result is True
1486 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1487
1488 step(
1489 "Configure External Route summary in R0 to summarise 5" " routes to one route."
1490 )
1491 ospf_summ_r1 = {
1492 "r0": {
1493 "ospf6": {
1494 "summary-address": [
1495 {
1496 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1497 "mask": "32",
1498 "tag": "1234",
1499 }
1500 ]
1501 }
1502 }
1503 }
1504 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1505 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1506
1507 step(
1508 "Verify that external routes are summarised to configured summary"
1509 " address on R0 and only one route is sent to R1 with configured tag."
1510 )
1511 input_dict_summary = {
1512 "r0": {"static_routes": [{"network": SUMMARY["ipv6"][0], "tag": "1234"}]}
1513 }
1514 dut = "r1"
1515
1516 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
1517 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1518
1519 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
1520 assert (
1521 result is True
1522 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1523
1524 step("Verify that show ip ospf summary should show the summaries with tag.")
1525 input_dict = {
1526 SUMMARY["ipv6"][0]: {
1527 "Summary address": SUMMARY["ipv6"][0],
1528 "Metric-type": "E2",
1529 "Metric": 20,
1530 "Tag": 1234,
1531 "External route count": 5,
1532 }
1533 }
1534 dut = "r0"
1535 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
1536 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1537
1538 step("Delete the configured summary")
1539 ospf_summ_r1 = {
1540 "r0": {
1541 "ospf6": {
1542 "summary-address": [
1543 {
1544 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1545 "mask": "32",
1546 "delete": True,
1547 }
1548 ]
1549 }
1550 }
1551 }
1552 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1553 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1554
1555 step("Verify that summary lsa is withdrawn from R1 and deleted from R0.")
1556 dut = "r1"
1557 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
1558 assert (
1559 result is not True
1560 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
1561 tc_name, result
1562 )
1563
1564 result = verify_rib(
1565 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
1566 )
1567 assert (
1568 result is not True
1569 ), "Testcase {} : Failed" "Error: Summary Route still present in RIB".format(
1570 tc_name
1571 )
1572
1573 step("show ip ospf summary should not have any summary address.")
1574 input_dict = {
1575 SUMMARY["ipv6"][0]: {
1576 "Summary address": SUMMARY["ipv6"][0],
1577 "Metric-type": "E2",
1578 "Metric": 20,
1579 "Tag": 1234,
1580 "External route count": 5,
1581 }
1582 }
1583 dut = "r0"
1584 result = verify_ospf_summary(
1585 tgen, topo, dut, input_dict, ospf="ospf6", expected=False
1586 )
1587 assert (
1588 result is not True
1589 ), "Testcase {} : Failed" "Error: Summary still present in DB".format(tc_name)
1590
1591 step("Configure Min tag value")
1592 ospf_summ_r1 = {
1593 "r0": {
1594 "ospf6": {
1595 "summary-address": [
1596 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32", "tag": 1}
1597 ]
1598 }
1599 }
1600 }
1601 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1602 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1603 input_dict_summary = {
1604 "r0": {"static_routes": [{"network": SUMMARY["ipv6"][0], "tag": "1"}]}
1605 }
1606 dut = "r1"
1607
1608 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
1609 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1610
1611 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
1612 assert (
1613 result is True
1614 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1615
1616 step("Verify that show ip ospf summary should show the summaries with tag.")
1617 input_dict = {
1618 SUMMARY["ipv6"][0]: {
1619 "Summary address": SUMMARY["ipv6"][0],
1620 "Metric-type": "E2",
1621 "Metric": 20,
1622 "Tag": 1,
1623 "External route count": 5,
1624 }
1625 }
1626 dut = "r0"
1627 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
1628 assert (
1629 result is True
1630 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
1631
1632 step("Configure Max Tag Value")
1633 ospf_summ_r1 = {
1634 "r0": {
1635 "ospf6": {
1636 "summary-address": [
1637 {
1638 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1639 "mask": "32",
1640 "tag": 4294967295,
1641 }
1642 ]
1643 }
1644 }
1645 }
1646 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1647 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1648
1649 input_dict_summary = {
1650 "r0": {"static_routes": [{"network": SUMMARY["ipv6"][0], "tag": "4294967295"}]}
1651 }
1652 dut = "r1"
1653
1654 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
1655 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1656
1657 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
1658 assert (
1659 result is True
1660 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1661
1662 step(
1663 "Verify that boundary values tags are used for summary route"
1664 " using show ip ospf route command."
1665 )
1666 input_dict = {
1667 SUMMARY["ipv6"][0]: {
1668 "Summary address": SUMMARY["ipv6"][0],
1669 "Metric-type": "E2",
1670 "Metric": 20,
1671 "Tag": 4294967295,
1672 "External route count": 5,
1673 }
1674 }
1675 dut = "r0"
1676 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
1677 assert (
1678 result is True
1679 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
1680
1681 step("configure new static route with different tag.")
1682 input_dict_static_rtes_11 = {
1683 "r0": {
1684 "static_routes": [
1685 {"network": NETWORK_11["ipv6"], "next_hop": "blackhole", "tag": "88888"}
1686 ]
1687 }
1688 }
1689 result = create_static_routes(tgen, input_dict_static_rtes_11)
1690 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1691
1692 step("New tag has not been used by summary address.")
1693
1694 input_dict_summary = {
1695 "r0": {"static_routes": [{"network": SUMMARY["ipv6"][0], "tag": "88888"}]}
1696 }
1697 dut = "r1"
1698
1699 result = verify_ospf6_rib(
1700 tgen, dut, input_dict_summary, tag="88888", expected=False
1701 )
1702 assert (
1703 result is not True
1704 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
1705 tc_name, result
1706 )
1707
1708 result = verify_rib(
1709 tgen,
1710 "ipv6",
1711 dut,
1712 input_dict_summary,
1713 protocol=protocol,
1714 tag="88888",
1715 expected=False,
1716 )
1717 assert (
1718 result is not True
1719 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
1720
1721 step(
1722 "Verify that boundary values tags are used for summary route"
1723 " using show ip ospf route command."
1724 )
1725 input_dict = {
1726 SUMMARY["ipv6"][0]: {
1727 "Summary address": SUMMARY["ipv6"][0],
1728 "Metric-type": "E2",
1729 "Metric": 20,
1730 "Tag": 88888,
1731 "External route count": 5,
1732 }
1733 }
1734 dut = "r0"
1735 result = verify_ospf_summary(
1736 tgen, topo, dut, input_dict, ospf="ospf6", expected=False
1737 )
1738 assert (
1739 result is not True
1740 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
1741
1742 step("Delete the configured summary address")
1743 ospf_summ_r1 = {
1744 "r0": {
1745 "ospf6": {
1746 "summary-address": [
1747 {
1748 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1749 "mask": "32",
1750 "tag": 4294967295,
1751 "delete": True,
1752 }
1753 ]
1754 }
1755 }
1756 }
1757 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1758 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1759
1760 step(
1761 "Verify that 6 routes are advertised to neighbour with 5 routes"
1762 " without any tag, 1 route with tag."
1763 )
1764
1765 dut = "r1"
1766 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
1767 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1768 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
1769 assert (
1770 result is True
1771 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1772
1773 step("Verify that summary address is flushed from neighbor.")
1774
1775 dut = "r1"
1776 result = verify_ospf6_rib(tgen, dut, input_dict_summary, expected=False)
1777 assert (
1778 result is not True
1779 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
1780 tc_name, result
1781 )
1782
1783 result = verify_rib(
1784 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
1785 )
1786 assert (
1787 result is not True
1788 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
1789
1790 step("Configure summary first & then configure matching static route.")
1791
1792 input_dict_static_rtes = {
1793 "r0": {
1794 "static_routes": [
1795 {"network": NETWORK["ipv6"], "next_hop": "blackhole", "delete": True},
1796 {"network": NETWORK2["ipv6"], "next_hop": "blackhole", "delete": True},
1797 ]
1798 }
1799 }
1800 result = create_static_routes(tgen, input_dict_static_rtes)
1801 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1802
1803 ospf_summ_r1 = {
1804 "r0": {
1805 "ospf6": {
1806 "summary-address": [
1807 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
1808 ]
1809 }
1810 }
1811 }
1812 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1813 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1814
1815 input_dict_static_rtes = {
1816 "r0": {
1817 "static_routes": [
1818 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
1819 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
1820 ]
1821 }
1822 }
1823 result = create_static_routes(tgen, input_dict_static_rtes)
1824 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1825
1826 write_test_footer(tc_name)
1827
1828
1829 def test_ospfv3_type5_summary_tc46_p0(request):
1830 """OSPF summarisation with advertise and no advertise option"""
1831 tc_name = request.node.name
1832 write_test_header(tc_name)
1833 tgen = get_topogen()
1834
1835 # Don't run this test if we have any failure.
1836 if tgen.routers_have_failure():
1837 pytest.skip(tgen.errors)
1838
1839 global topo
1840 step("Bring up the base config as per the topology")
1841 step("Configure OSPF on all the routers of the topology.")
1842 reset_config_on_routers(tgen)
1843
1844 protocol = "ospf"
1845
1846 step(
1847 "Configure 5 static routes from the same network on R0"
1848 "5 static routes from different networks and redistribute in R0"
1849 )
1850 input_dict_static_rtes = {
1851 "r0": {
1852 "static_routes": [
1853 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
1854 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
1855 ]
1856 }
1857 }
1858 result = create_static_routes(tgen, input_dict_static_rtes)
1859 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1860
1861 dut = "r0"
1862 red_static(dut)
1863
1864 step("Verify that routes are learnt on R1.")
1865 dut = "r1"
1866
1867 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
1868 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1869 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
1870 assert (
1871 result is True
1872 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
1873
1874 step(
1875 "Configure External Route summary in R0 to summarise 5"
1876 " routes to one route with no advertise option."
1877 )
1878 ospf_summ_r1 = {
1879 "r0": {
1880 "ospf6": {
1881 "summary-address": [
1882 {
1883 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1884 "mask": "32",
1885 "advertise": False,
1886 }
1887 ]
1888 }
1889 }
1890 }
1891 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1892 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1893
1894 step(
1895 "Verify that external routes are summarised to configured summary"
1896 " address on R0 and summary route is not advertised to neighbor as"
1897 " no advertise is configured.."
1898 )
1899
1900 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
1901 dut = "r1"
1902
1903 result = verify_ospf6_rib(tgen, dut, input_dict_summary, expected=False)
1904 assert (
1905 result is not True
1906 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
1907 tc_name, result
1908 )
1909
1910 result = verify_rib(
1911 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
1912 )
1913 assert (
1914 result is not True
1915 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
1916
1917 step("Verify that show ip ospf summary should show the " "configured summaries.")
1918 input_dict = {
1919 SUMMARY["ipv6"][0]: {
1920 "Summary address": SUMMARY["ipv6"][0],
1921 "External route count": 5,
1922 }
1923 }
1924 dut = "r0"
1925 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
1926 assert (
1927 result is True
1928 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
1929
1930 step("Delete the configured summary")
1931 ospf_summ_r1 = {
1932 "r0": {
1933 "ospf6": {
1934 "summary-address": [
1935 {
1936 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1937 "mask": "32",
1938 "delete": True,
1939 }
1940 ]
1941 }
1942 }
1943 }
1944 result = create_router_ospf(tgen, topo, ospf_summ_r1)
1945 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
1946
1947 step("Summary has 5 sec delay timer, sleep 5 secs...")
1948 sleep(5)
1949
1950 step("Verify that summary lsa is withdrawn from R1 and deleted from R0.")
1951 dut = "r1"
1952 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
1953 assert (
1954 result is not True
1955 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
1956 tc_name, result
1957 )
1958
1959 result = verify_rib(
1960 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
1961 )
1962 assert (
1963 result is not True
1964 ), "Testcase {} : Failed" "Error: Summary Route still present in RIB".format(
1965 tc_name
1966 )
1967
1968 step("show ip ospf summary should not have any summary address.")
1969 input_dict = {
1970 SUMMARY["ipv6"][0]: {
1971 "Summary address": SUMMARY["ipv6"][0],
1972 "Metric-type": "E2",
1973 "Metric": 20,
1974 "Tag": 1234,
1975 "External route count": 5,
1976 }
1977 }
1978 dut = "r0"
1979 result = verify_ospf_summary(
1980 tgen, topo, dut, input_dict, ospf="ospf6", expected=False
1981 )
1982 assert (
1983 result is not True
1984 ), "Testcase {} : Failed" "Error: Summary still present in DB".format(tc_name)
1985
1986 step("Reconfigure summary with no advertise.")
1987 ospf_summ_r1 = {
1988 "r0": {
1989 "ospf6": {
1990 "summary-address": [
1991 {
1992 "prefix": SUMMARY["ipv6"][0].split("/")[0],
1993 "mask": "32",
1994 "advertise": False,
1995 }
1996 ]
1997 }
1998 }
1999 }
2000 result = create_router_ospf(tgen, topo, ospf_summ_r1)
2001 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2002
2003 step(
2004 "Verify that external routes are summarised to configured summary"
2005 " address on R0 and summary route is not advertised to neighbor as"
2006 " no advertise is configured.."
2007 )
2008
2009 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
2010 dut = "r1"
2011
2012 result = verify_ospf6_rib(tgen, dut, input_dict_summary, expected=False)
2013 assert (
2014 result is not True
2015 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
2016 tc_name, result
2017 )
2018
2019 result = verify_rib(
2020 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
2021 )
2022 assert (
2023 result is not True
2024 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
2025
2026 step("Verify that show ip ospf summary should show the " "configured summaries.")
2027 input_dict = {
2028 SUMMARY["ipv6"][0]: {
2029 "Summary address": SUMMARY["ipv6"][0],
2030 "External route count": 5,
2031 }
2032 }
2033 dut = "r0"
2034 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2035 assert (
2036 result is True
2037 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2038
2039 step(
2040 "Change summary address from no advertise to advertise "
2041 "(summary-address 10.0.0.0 255.255.0.0)"
2042 )
2043
2044 ospf_summ_r1 = {
2045 "r0": {
2046 "ospf6": {
2047 "summary-address": [
2048 {
2049 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2050 "mask": "32",
2051 "advertise": False,
2052 }
2053 ]
2054 }
2055 }
2056 }
2057 result = create_router_ospf(tgen, topo, ospf_summ_r1)
2058 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2059
2060 ospf_summ_r1 = {
2061 "r0": {
2062 "ospf6": {
2063 "summary-address": [
2064 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
2065 ]
2066 }
2067 }
2068 }
2069 result = create_router_ospf(tgen, topo, ospf_summ_r1)
2070 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2071
2072 step(
2073 "Verify that external routes are summarised to configured summary "
2074 "address on R0 after 5 secs of delay timer expiry and only one "
2075 "route is sent to R1."
2076 )
2077 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
2078 dut = "r1"
2079
2080 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
2081 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2082
2083 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
2084 assert (
2085 result is True
2086 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
2087
2088 step("Verify that show ip ospf summary should show the summaries.")
2089 input_dict = {
2090 SUMMARY["ipv6"][0]: {
2091 "Summary address": SUMMARY["ipv6"][0],
2092 "Metric-type": "E2",
2093 "Metric": 20,
2094 "Tag": 0,
2095 "External route count": 5,
2096 }
2097 }
2098 dut = "r0"
2099 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2100 assert (
2101 result is True
2102 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2103
2104 step("Verify that originally advertised routes are withdraw from there" " peer.")
2105 input_dict = {
2106 "r0": {"static_routes": [{"network": NETWORK["ipv6"], "next_hop": "blackhole"}]}
2107 }
2108 dut = "r1"
2109 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
2110 assert (
2111 result is not True
2112 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
2113 tc_name, result
2114 )
2115
2116 output = tgen.gears["r0"].vtysh_cmd(
2117 "show ipv6 ospf6 database as-external json", isjson=True
2118 )
2119
2120 output = tgen.gears["r1"].vtysh_cmd(
2121 "show ipv6 ospf6 database as-external json", isjson=True
2122 )
2123
2124 result = verify_rib(
2125 tgen, "ipv6", dut, input_dict, protocol=protocol, expected=False
2126 )
2127 assert (
2128 result is not True
2129 ), "Testcase {} : Failed" "Error: Routes is present in RIB".format(tc_name)
2130
2131 write_test_footer(tc_name)
2132
2133
2134 def test_ospfv3_type5_summary_tc48_p0(request):
2135 """OSPF summarisation with route map modification of metric type."""
2136 tc_name = request.node.name
2137 write_test_header(tc_name)
2138 tgen = get_topogen()
2139
2140 # Don't run this test if we have any failure.
2141 if tgen.routers_have_failure():
2142 pytest.skip(tgen.errors)
2143
2144 global topo
2145 step("Bring up the base config as per the topology")
2146 reset_config_on_routers(tgen)
2147
2148 protocol = "ospf"
2149
2150 step(
2151 "Configure 5 static routes from the same network on R0"
2152 "5 static routes from different networks and redistribute in R0"
2153 )
2154 input_dict_static_rtes = {
2155 "r0": {
2156 "static_routes": [
2157 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
2158 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
2159 ]
2160 }
2161 }
2162 result = create_static_routes(tgen, input_dict_static_rtes)
2163 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2164
2165 dut = "r0"
2166 red_static(dut)
2167
2168 step("Verify that routes are learnt on R1.")
2169 dut = "r1"
2170
2171 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
2172 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2173 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
2174 assert (
2175 result is True
2176 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
2177
2178 step(
2179 "Configure External Route summary in R0 to summarise 5" " routes to one route."
2180 )
2181
2182 ospf_summ_r1 = {
2183 "r0": {
2184 "ospf6": {
2185 "summary-address": [
2186 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
2187 ]
2188 }
2189 }
2190 }
2191 result = create_router_ospf(tgen, topo, ospf_summ_r1)
2192 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2193
2194 step(
2195 "Verify that external routes are summarised to configured summary "
2196 "address on R0 after 5 secs of delay timer expiry and only one "
2197 "route is sent to R1."
2198 )
2199 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
2200 dut = "r1"
2201
2202 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
2203 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2204
2205 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
2206 assert (
2207 result is True
2208 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
2209
2210 step("Verify that show ip ospf summary should show the summaries.")
2211 input_dict = {
2212 SUMMARY["ipv6"][0]: {
2213 "Summary address": SUMMARY["ipv6"][0],
2214 "Metric-type": "E2",
2215 "Metric": 20,
2216 "Tag": 0,
2217 "External route count": 5,
2218 }
2219 }
2220 dut = "r0"
2221 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2222 assert (
2223 result is True
2224 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2225
2226 step("Verify that originally advertised routes are withdraw from there" " peer.")
2227 input_dict = {
2228 "r0": {"static_routes": [{"network": NETWORK["ipv6"], "next_hop": "blackhole"}]}
2229 }
2230 dut = "r1"
2231 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
2232 assert (
2233 result is not True
2234 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
2235 tc_name, result
2236 )
2237
2238 result = verify_rib(
2239 tgen, "ipv6", dut, input_dict, protocol=protocol, expected=False
2240 )
2241 assert (
2242 result is not True
2243 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
2244
2245 step(
2246 "Configure route map and & rule to permit configured summary address,"
2247 " redistribute static & connected routes with the route map."
2248 )
2249 step("Configure prefixlist to permit the static routes, add to route map.")
2250 # Create ip prefix list
2251 pfx_list = {
2252 "r0": {
2253 "prefix_lists": {
2254 "ipv6": {
2255 "pf_list_1_ipv6": [
2256 {"seqid": 10, "network": "any", "action": "permit"}
2257 ]
2258 }
2259 }
2260 }
2261 }
2262 result = create_prefix_lists(tgen, pfx_list)
2263 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2264
2265 routemaps = {
2266 "r0": {
2267 "route_maps": {
2268 "rmap_ipv6": [
2269 {
2270 "action": "permit",
2271 "seq_id": "1",
2272 "match": {"ipv6": {"prefix_lists": "pf_list_1_ipv6"}},
2273 }
2274 ]
2275 }
2276 }
2277 }
2278 result = create_route_maps(tgen, routemaps)
2279 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2280
2281 ospf_red_r1 = {
2282 "r0": {
2283 "ospf6": {
2284 "redistribute": [{"redist_type": "static", "route_map": "rmap_ipv6"}]
2285 }
2286 }
2287 }
2288 result = create_router_ospf(tgen, topo, ospf_red_r1)
2289 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2290
2291 step(
2292 "Verify that external routes are summarised to configured"
2293 "summary address on R0 and only one route is sent to R1. Verify that "
2294 "show ip ospf summary should show the configure summaries."
2295 )
2296
2297 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
2298 dut = "r1"
2299
2300 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
2301 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2302
2303 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
2304 assert (
2305 result is True
2306 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
2307
2308 input_dict = {
2309 SUMMARY["ipv6"][0]: {
2310 "Summary address": SUMMARY["ipv6"][0],
2311 "Metric-type": "E2",
2312 "Metric": 20,
2313 "Tag": 0,
2314 "External route count": 5,
2315 }
2316 }
2317 dut = "r0"
2318 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2319 assert (
2320 result is True
2321 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2322
2323 step("Configure metric type as 1 in route map.")
2324
2325 routemaps = {
2326 "r0": {
2327 "route_maps": {
2328 "rmap_ipv6": [
2329 {
2330 "seq_id": "1",
2331 "action": "permit",
2332 "set": {"metric-type": "type-1"},
2333 }
2334 ]
2335 }
2336 }
2337 }
2338 result = create_route_maps(tgen, routemaps)
2339 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2340
2341 step(
2342 "Verify that external routes(static / connected) are summarised"
2343 " to configured summary address with metric type 2."
2344 )
2345 input_dict = {
2346 SUMMARY["ipv6"][0]: {
2347 "Summary address": SUMMARY["ipv6"][0],
2348 "Metric-type": "E2",
2349 "Metric": 20,
2350 "Tag": 0,
2351 "External route count": 5,
2352 }
2353 }
2354 dut = "r0"
2355 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2356 assert (
2357 result is True
2358 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2359
2360 step("Un configure metric type from route map.")
2361
2362 routemaps = {
2363 "r0": {
2364 "route_maps": {
2365 "rmap_ipv6": [
2366 {
2367 "action": "permit",
2368 "seq_id": "1",
2369 "set": {"metric-type": "type-1", "delete": True},
2370 }
2371 ]
2372 }
2373 }
2374 }
2375 result = create_route_maps(tgen, routemaps)
2376 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2377
2378 step(
2379 "Verify that external routes(static / connected) are summarised"
2380 " to configured summary address with metric type 2."
2381 )
2382 input_dict = {
2383 SUMMARY["ipv6"][0]: {
2384 "Summary address": SUMMARY["ipv6"][0],
2385 "Metric-type": "E2",
2386 "Metric": 20,
2387 "Tag": 0,
2388 "External route count": 5,
2389 }
2390 }
2391 dut = "r0"
2392 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2393 assert (
2394 result is True
2395 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2396
2397 step("Change rule from permit to deny in prefix list.")
2398 pfx_list = {
2399 "r0": {
2400 "prefix_lists": {
2401 "ipv6": {
2402 "pf_list_1_ipv6": [
2403 {"seqid": 10, "network": "any", "action": "deny"}
2404 ]
2405 }
2406 }
2407 }
2408 }
2409 result = create_prefix_lists(tgen, pfx_list)
2410 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2411
2412 step(
2413 "Verify that previously originated summary lsa "
2414 "is withdrawn from the neighbor."
2415 )
2416 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
2417 dut = "r1"
2418
2419 step("summary route has delay of 5 secs, wait for 5 secs")
2420
2421 sleep(5)
2422
2423 result = verify_ospf6_rib(tgen, dut, input_dict_summary, expected=False)
2424 assert (
2425 result is not True
2426 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
2427 tc_name, result
2428 )
2429
2430 result = verify_rib(
2431 tgen, "ipv6", dut, input_dict_summary, protocol=protocol, expected=False
2432 )
2433 assert (
2434 result is not True
2435 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
2436
2437 write_test_footer(tc_name)
2438
2439
2440 def test_ospfv3_type5_summary_tc51_p2(request):
2441 """OSPF CLI Show.
2442
2443 verify ospf ASBR summary config and show commands behaviours.
2444 """
2445 tc_name = request.node.name
2446 write_test_header(tc_name)
2447 tgen = get_topogen()
2448
2449 # Don't run this test if we have any failure.
2450 if tgen.routers_have_failure():
2451 pytest.skip(tgen.errors)
2452
2453 global topo
2454 step("Bring up the base config as per the topology")
2455 reset_config_on_routers(tgen)
2456
2457 step("Configure all the supported OSPF ASBR summary commands on DUT.")
2458 ospf_summ_r1 = {
2459 "r0": {
2460 "ospf6": {
2461 "summary-address": [
2462 {
2463 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2464 "mask": "32",
2465 "tag": 4294967295,
2466 },
2467 {
2468 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2469 "mask": "16",
2470 "advertise": True,
2471 },
2472 {
2473 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2474 "mask": "24",
2475 "advertise": False,
2476 },
2477 {
2478 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2479 "mask": "24",
2480 "advertise": False,
2481 },
2482 ]
2483 }
2484 }
2485 }
2486 result = create_router_ospf(tgen, topo, ospf_summ_r1)
2487 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2488
2489 step("Configure and re configure all the commands 10 times in a loop.")
2490
2491 for itrate in range(0, 10):
2492 ospf_summ_r1 = {
2493 "r0": {
2494 "ospf6": {
2495 "summary-address": [
2496 {
2497 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2498 "mask": "8",
2499 "tag": 4294967295,
2500 },
2501 {
2502 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2503 "mask": "16",
2504 "advertise": True,
2505 },
2506 {
2507 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2508 "mask": "24",
2509 "advertise": False,
2510 },
2511 {
2512 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2513 "mask": "24",
2514 "advertise": False,
2515 },
2516 ]
2517 }
2518 }
2519 }
2520 result = create_router_ospf(tgen, topo, ospf_summ_r1)
2521 assert result is True, "Testcase {} : Failed \n Error: {}".format(
2522 tc_name, result
2523 )
2524
2525 ospf_summ_r1 = {
2526 "r0": {
2527 "ospf6": {
2528 "summary-address": [
2529 {
2530 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2531 "mask": "8",
2532 "tag": 4294967295,
2533 "delete": True,
2534 },
2535 {
2536 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2537 "mask": "16",
2538 "advertise": True,
2539 "delete": True,
2540 },
2541 {
2542 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2543 "mask": "24",
2544 "advertise": False,
2545 "delete": True,
2546 },
2547 {
2548 "prefix": SUMMARY["ipv6"][0].split("/")[0],
2549 "mask": "24",
2550 "advertise": False,
2551 "delete": True,
2552 },
2553 ]
2554 }
2555 }
2556 }
2557 result = create_router_ospf(tgen, topo, ospf_summ_r1)
2558 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2559
2560 step("Verify the show commands")
2561
2562 input_dict = {
2563 SUMMARY["ipv6"][3]: {
2564 "Summary address": SUMMARY["ipv6"][3],
2565 "Metric-type": "E2",
2566 "Metric": 20,
2567 "Tag": 0,
2568 "External route count": 0,
2569 }
2570 }
2571 dut = "r0"
2572 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2573 assert (
2574 result is True
2575 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2576
2577 write_test_footer(tc_name)
2578
2579
2580 def test_ospfv3_type5_summary_tc49_p2(request):
2581 """OSPF summarisation Chaos."""
2582 tc_name = request.node.name
2583 write_test_header(tc_name)
2584 tgen = get_topogen()
2585
2586 # Don't run this test if we have any failure.
2587 if tgen.routers_have_failure():
2588 pytest.skip(tgen.errors)
2589
2590 global topo
2591 step("Bring up the base config as per the topology")
2592 reset_config_on_routers(tgen)
2593
2594 protocol = "ospf"
2595
2596 step(
2597 "Configure 5 static routes from the same network on R0"
2598 "5 static routes from different networks and redistribute in R0"
2599 )
2600 input_dict_static_rtes = {
2601 "r0": {
2602 "static_routes": [
2603 {"network": NETWORK["ipv6"], "next_hop": "blackhole"},
2604 {"network": NETWORK2["ipv6"], "next_hop": "blackhole"},
2605 ]
2606 }
2607 }
2608 result = create_static_routes(tgen, input_dict_static_rtes)
2609 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2610
2611 dut = "r0"
2612 red_static(dut)
2613
2614 step("Verify that routes are learnt on R1.")
2615 dut = "r1"
2616
2617 result = verify_ospf6_rib(tgen, dut, input_dict_static_rtes)
2618 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2619 result = verify_rib(tgen, "ipv6", dut, input_dict_static_rtes, protocol=protocol)
2620 assert (
2621 result is True
2622 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
2623
2624 step(
2625 "Configure External Route summary in R0 to summarise 5" " routes to one route."
2626 )
2627
2628 ospf_summ_r1 = {
2629 "r0": {
2630 "ospf6": {
2631 "summary-address": [
2632 {"prefix": SUMMARY["ipv6"][0].split("/")[0], "mask": "32"}
2633 ]
2634 }
2635 }
2636 }
2637 result = create_router_ospf(tgen, topo, ospf_summ_r1)
2638 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2639
2640 step(
2641 "Verify that external routes are summarised to configured summary "
2642 "address on R0 after 5 secs of delay timer expiry and only one "
2643 "route is sent to R1."
2644 )
2645 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
2646 dut = "r1"
2647
2648 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
2649 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2650
2651 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
2652 assert (
2653 result is True
2654 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
2655
2656 step("Verify that show ip ospf summary should show the summaries.")
2657 input_dict = {
2658 SUMMARY["ipv6"][0]: {
2659 "Summary address": SUMMARY["ipv6"][0],
2660 "Metric-type": "E2",
2661 "Metric": 20,
2662 "Tag": 0,
2663 "External route count": 5,
2664 }
2665 }
2666 dut = "r0"
2667 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2668 assert (
2669 result is True
2670 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2671
2672 step("Verify that originally advertised routes are withdraw from there" " peer.")
2673 input_dict = {
2674 "r0": {"static_routes": [{"network": NETWORK["ipv6"], "next_hop": "blackhole"}]}
2675 }
2676 dut = "r1"
2677 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
2678 assert (
2679 result is not True
2680 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
2681 tc_name, result
2682 )
2683
2684 result = verify_rib(
2685 tgen, "ipv6", dut, input_dict, protocol=protocol, expected=False
2686 )
2687 assert (
2688 result is not True
2689 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
2690
2691 step("Reload the FRR router")
2692 # stop/start -> restart FRR router and verify
2693 stop_router(tgen, "r0")
2694 start_router(tgen, "r0")
2695
2696 step(
2697 "Verify that external routes are summarised to configured summary "
2698 "address on R0 after 5 secs of delay timer expiry and only one "
2699 "route is sent to R1."
2700 )
2701 input_dict_summary = {"r0": {"static_routes": [{"network": SUMMARY["ipv6"][0]}]}}
2702 dut = "r1"
2703
2704 result = verify_ospf6_rib(tgen, dut, input_dict_summary)
2705 assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
2706
2707 result = verify_rib(tgen, "ipv6", dut, input_dict_summary, protocol=protocol)
2708 assert (
2709 result is True
2710 ), "Testcase {} : Failed" "Error: Routes is missing in RIB".format(tc_name)
2711
2712 step("Verify that show ip ospf summary should show the summaries.")
2713 input_dict = {
2714 SUMMARY["ipv6"][0]: {
2715 "Summary address": SUMMARY["ipv6"][0],
2716 "Metric-type": "E2",
2717 "Metric": 20,
2718 "Tag": 0,
2719 "External route count": 5,
2720 }
2721 }
2722 dut = "r0"
2723 result = verify_ospf_summary(tgen, topo, dut, input_dict, ospf="ospf6")
2724 assert (
2725 result is True
2726 ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
2727
2728 step("Verify that originally advertised routes are withdraw from there" " peer.")
2729 input_dict = {
2730 "r0": {"static_routes": [{"network": NETWORK["ipv6"], "next_hop": "blackhole"}]}
2731 }
2732 dut = "r1"
2733 result = verify_ospf6_rib(tgen, dut, input_dict, expected=False)
2734 assert (
2735 result is not True
2736 ), "Testcase {} : Failed \n Error: " "Routes still present in OSPF RIB {}".format(
2737 tc_name, result
2738 )
2739
2740 result = verify_rib(
2741 tgen, "ipv6", dut, input_dict, protocol=protocol, expected=False
2742 )
2743 assert (
2744 result is not True
2745 ), "Testcase {} : Failed" "Error: Routes still present in RIB".format(tc_name)
2746
2747 write_test_footer(tc_name)
2748
2749
2750 if __name__ == "__main__":
2751 args = ["-s"] + sys.argv[1:]
2752 sys.exit(pytest.main(args))