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