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