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