4 # Copyright (c) 2022 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation, Inc.
6 # ("NetDEF") in this file.
8 # Permission to use, copy, modify, and/or distribute this software
9 # for any purpose with or without fee is hereby granted, provided
10 # that the above copyright notice and this permission notice appear
13 # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
14 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
16 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
17 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 """OSPF Basic Functionality Automation."""
29 from time
import sleep
31 # Save the Current Working Directory to find configuration files.
32 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
33 sys
.path
.append(os
.path
.join(CWD
, "../"))
34 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
36 pytestmark
= [pytest
.mark
.ospfd
, pytest
.mark
.staticd
]
40 # pylint: disable=C0413
41 # Import topogen and topotest helpers
42 from lib
.topolog
import logger
43 from lib
.topojson
import build_config_from_json
45 # Import topoJson from lib, to create topology and initial configuration
46 from lib
.common_config
import (
50 reset_config_on_routers
,
54 shutdown_bringup_interface
,
59 reset_config_on_routers
,
62 shutdown_bringup_interface
,
67 reset_config_on_routers
,
76 from lib
.topolog
import logger
77 from lib
.topogen
import Topogen
, get_topogen
79 from lib
.topojson
import build_config_from_json
80 from lib
.ospf
import (
101 Please view in a fixed-width font such as Courier.
103 +R1 +------------+R2 |
112 +R0 +-------------+R3 |
116 1. Verify OSPF Flood reduction functionality with ospf enabled on process level.
117 2. Verify OSPF Flood reduction functionality with ospf enabled on area level.
118 3. Verify OSPF Flood reduction functionality between different area's.
119 4. Verify OSPF Flood reduction functionality with ospf enabled on process level with default lsa refresh timer.
120 5. Chaos - Verify OSPF TTL GTSM and flood reduction functionality in chaos scenarios.
124 def setup_module(mod
):
126 Sets up the pytest environment
131 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
132 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
133 logger
.info("=" * 40)
135 logger
.info("Running setup_module to create topology")
137 # This function initiates the topology build with Topogen...
138 json_file
= "{}/ospf_flood_reduction.json".format(CWD
)
139 tgen
= Topogen(json_file
, mod
.__name
__)
141 topo
= tgen
.json_topo
142 # ... and here it calls Mininet initialization functions.
144 # get list of daemons needs to be started for this suite.
145 daemons
= topo_daemons(tgen
)
147 # Starting topology, create tmp files which are loaded to routers
148 # to start daemons and then start routers
151 # Creating configuration from JSON
152 build_config_from_json(tgen
, topo
)
154 # Don't run this test if we have any failure.
155 if tgen
.routers_have_failure():
156 pytest
.skip(tgen
.errors
)
157 # Api call verify whether OSPF is converged
158 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
159 assert ospf_covergence
is True, "setup_module :Failed \n Error:" " {}".format(
163 logger
.info("Running setup_module() done")
166 def teardown_module(mod
):
168 Teardown the pytest environment.
173 logger
.info("Running teardown_module to delete topology")
177 # Stop toplogy and Remove tmp files
181 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
183 logger
.info("=" * 40)
187 def red_static(dut
, config
=True):
188 """Local def for Redstribute static routes inside ospf."""
192 ospf_red
= {dut
: {"ospf": {"redistribute": [{"redist_type": "static"}]}}}
197 "redistribute": [{"redist_type": "static", "del_action": True}]
201 result
= create_router_ospf(tgen
, topo
, ospf_red
)
202 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
205 # ##################################
206 # Test cases start here.
207 # ##################################
208 def test_ospf_flood_red_tc1_p0(request
):
209 """Verify OSPF Flood reduction functionality with ospf enabled on process level."""
210 tc_name
= request
.node
.name
211 write_test_header(tc_name
)
214 # Don't run this test if we have any failure.
215 if tgen
.routers_have_failure():
216 check_router_status(tgen
)
220 step("Bring up the base config as per the topology")
221 reset_config_on_routers(tgen
)
223 step("Base config should be up, verify using OSPF convergence on all the routers")
225 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
226 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
234 "network": NETWORK
["ipv4"][0],
241 result
= create_static_routes(tgen
, input_dict
)
242 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
244 step("Enable flood reduction in process level on R0")
245 ospf_flood
= {"r0": {"ospf": {"flood-reduction": True}}}
246 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
247 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
249 step("Verify that ospf lsa's are set with dc bit 1.")
252 "routerId": "100.1.1.0",
255 "routerLinkStates": [
257 "lsaId": "100.1.1.0",
258 "options": "*|-|DC|-|-|-|E|-",
264 result
= verify_ospf_database(
265 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
267 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
269 step("Configure the custom refresh timer")
270 ospf_flood
= {"r0": {"ospf": {"lsa-refresh": 120}}}
271 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
272 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
274 step("Enable flood. reduction in all the routers of the topology.")
275 for rtr
in topo
["routers"].keys():
276 ospf_flood
= {rtr
: {"ospf": {"lsa-refresh": 120, "flood-reduction": True}}}
277 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
278 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
280 for rtr
in topo
["routers"]:
281 clear_ospf(tgen
, rtr
)
283 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
284 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
288 step("Verify that ospf lsa's are set with dc bit 1.")
289 for rtr
in topo
["routers"]:
291 lsid
= "{}".format(topo
["routers"][rtr
]["ospf"]["router_id"])
296 "routerLinkStates": [
299 "options": "*|-|DC|-|-|-|E|-",
305 result
= verify_ospf_database(
306 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
=lsid
308 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
312 step("Wait for 120 secs and verify that LSA's are not refreshed. ")
316 "routerId": "100.1.1.0",
319 "routerLinkStates": [
320 {"lsaId": "100.1.1.0", "lsaAge": "get"},
327 result1
= get_ospf_database(
328 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
330 # this wait is put so that we wait for 5secs to check if lsa is refreshed.
332 result2
= get_ospf_database(
333 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
336 assert (result1
== result2
) is True, "Testcase {} : Failed \n Error: {}".format(
340 step("Disable flood reduction in R0.")
342 "r0": {"ospf": {"flood-reduction": True, "del_flood_reduction": True}}
344 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
345 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
347 clear_ospf(tgen
, "r0")
349 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
350 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
354 step("Verify that ospf lea's are not set with dc bit 1.")
357 "routerId": "100.1.1.0",
360 "routerLinkStates": [
362 "lsaId": "100.1.1.0",
363 "options": "*|-|DC|-|-|-|E|-",
369 result
= verify_ospf_database(
370 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0", expected
=False
372 assert result
is not True, (
373 "Testcase {} : Failed \n "
374 "Expected: OSPF LSA should not be set with DC bit in {} \n "
375 "Found: {}".format(tc_name
, dut
, result
)
377 step("Wait for 120 secs and verify that LSA's are not refreshed. ")
381 "routerId": "100.1.1.0",
384 "routerLinkStates": [
385 {"lsaId": "100.1.1.0", "lsaAge": "get"},
392 result1
= get_ospf_database(
393 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
396 result2
= get_ospf_database(
397 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
400 if result2
is not result1
:
402 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
405 "Enable flood reduction on each router with 10 secs delay of between each router."
407 for rtr
in topo
["routers"].keys():
408 ospf_flood
= {rtr
: {"ospf": {"lsa-refresh": 120, "flood-reduction": True}}}
410 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
411 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
413 for rtr
in topo
["routers"]:
414 clear_ospf(tgen
, rtr
)
416 step("Verify that LSA's are not refreshed. Do not age bit should be set to 1.")
419 "routerId": "100.1.1.0",
422 "routerLinkStates": [
424 "lsaId": "100.1.1.0",
425 "options": "*|-|DC|-|-|-|E|-",
431 result
= verify_ospf_database(
432 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
434 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
437 "Verify OSPF neighborship when OSPF flood reduction is configured and ospf process is restarted"
440 step("Kill OSPFd daemon on R0.")
441 kill_router_daemons(tgen
, "r0", ["ospfd"])
442 start_router_daemons(tgen
, "r0", ["ospfd"])
444 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
445 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
449 step("Verify that LSA's are not refreshed. Do not age bit should be set to 1.")
452 "routerId": "100.1.1.0",
455 "routerLinkStates": [
457 "lsaId": "100.1.1.0",
458 "options": "*|-|DC|-|-|-|E|-",
464 result
= verify_ospf_database(
465 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
467 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
469 write_test_footer(tc_name
)
472 def test_ospf_flood_red_tc2_p0(request
):
473 """Verify OSPF Flood reduction functionality with ospf enabled on area level."""
474 tc_name
= request
.node
.name
475 write_test_header(tc_name
)
478 # Don't run this test if we have any failure.
479 if tgen
.routers_have_failure():
480 check_router_status(tgen
)
484 step("Bring up the base config as per the topology")
485 reset_config_on_routers(tgen
)
487 step("Base config should be up, verify using OSPF convergence on all the routers")
489 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
490 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
498 "network": NETWORK
["ipv4"][0],
505 result
= create_static_routes(tgen
, input_dict
)
506 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
508 step("Enable flood reduction in area level on R0 in area 0")
510 "r0": {"ospf": {"area": [{"id": "0.0.0.0", "flood-reduction": True}]}}
512 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
513 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
515 step("Verify that ospf lsa's are set with dc bit 1.")
518 "routerId": "100.1.1.0",
521 "routerLinkStates": [
523 "lsaId": "100.1.1.0",
524 "options": "*|-|DC|-|-|-|E|-",
530 result
= verify_ospf_database(
531 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
533 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
535 step("Configure the custom refresh timer")
536 ospf_flood
= {"r0": {"ospf": {"lsa-refresh": 120}}}
537 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
538 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
540 step("Enable flood. reduction in all the routers of the topology.")
541 for rtr
in topo
["routers"].keys():
543 rtr
: {"ospf": {"area": [{"id": "0.0.0.0", "flood-reduction": True}]}}
545 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
546 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
548 for rtr
in topo
["routers"]:
549 clear_ospf(tgen
, rtr
)
551 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
552 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
556 step("Verify that ospf lsa's are set with dc bit 1.")
557 for rtr
in topo
["routers"]:
559 lsid
= "{}".format(topo
["routers"][rtr
]["ospf"]["router_id"])
564 "routerLinkStates": [
567 "options": "*|-|DC|-|-|-|E|-",
573 result
= verify_ospf_database(
574 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
=lsid
576 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
578 step("Wait for 120 secs and verify that LSA's are not refreshed. ")
582 "routerId": "100.1.1.0",
585 "routerLinkStates": [
586 {"lsaId": "100.1.1.0", "lsaAge": "get"},
593 result1
= get_ospf_database(
594 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
597 result2
= get_ospf_database(
598 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
601 assert (result1
== result2
) is True, "Testcase {} : Failed \n Error: {}".format(
605 step("Disable flood reduction in R0.")
609 "area": [{"id": "0.0.0.0", "flood-reduction": True, "delete": True}]
613 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
614 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
616 clear_ospf(tgen
, "r0")
618 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
619 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
623 step("Verify that ospf lea's are not set with dc bit 1.")
626 "routerId": "100.1.1.0",
629 "routerLinkStates": [
631 "lsaId": "100.1.1.0",
632 "options": "*|-|DC|-|-|-|E|-",
638 result
= verify_ospf_database(
639 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0", expected
=False
641 assert result
is not True, (
642 "Testcase {} : Failed \n "
643 "Expected: OSPF LSA should not be set with DC bit in {} \n "
644 "Found: {}".format(tc_name
, dut
, result
)
646 step("Wait for 120 secs and verify that LSA's are not refreshed. ")
650 "routerId": "100.1.1.0",
653 "routerLinkStates": [
654 {"lsaId": "100.1.1.0", "lsaAge": "get"},
661 result1
= get_ospf_database(
662 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
665 result2
= get_ospf_database(
666 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
669 if result2
is not result1
:
671 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
674 "Enable flood reduction on each router with 10 secs delay of between each router."
676 for rtr
in topo
["routers"].keys():
678 rtr
: {"ospf": {"area": [{"id": "0.0.0.0", "flood-reduction": True}]}}
681 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
682 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
684 for rtr
in topo
["routers"]:
685 clear_ospf(tgen
, rtr
)
687 step("Verify that LSA's are not refreshed. Do not age bit should be set to 1.")
690 "routerId": "100.1.1.0",
693 "routerLinkStates": [
695 "lsaId": "100.1.1.0",
696 "options": "*|-|DC|-|-|-|E|-",
702 result
= verify_ospf_database(
703 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
705 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
707 write_test_footer(tc_name
)
710 def test_ospf_flood_red_tc3_p0(request
):
711 """Verify OSPF Flood reduction functionality between different area's"""
712 tc_name
= request
.node
.name
713 write_test_header(tc_name
)
716 # Don't run this test if we have any failure.
717 if tgen
.routers_have_failure():
718 check_router_status(tgen
)
722 step("Bring up the base config as per the topology")
723 reset_config_on_routers(tgen
)
725 step("Base config should be up, verify using OSPF convergence on all the routers")
727 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
728 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
736 "network": NETWORK
["ipv4"][0],
743 result
= create_static_routes(tgen
, input_dict
)
744 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
746 step("Enable flood reduction in area level on R0 in area 0")
748 "r0": {"ospf": {"area": [{"id": "0.0.0.0", "flood-reduction": True}]}}
750 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
751 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
753 step("Verify that ospf lsa's are set with dc bit 1.")
756 "routerId": "100.1.1.0",
759 "routerLinkStates": [
761 "lsaId": "100.1.1.0",
762 "options": "*|-|DC|-|-|-|E|-",
768 result
= verify_ospf_database(
769 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
771 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
773 step("Configure the custom refresh timer")
774 ospf_flood
= {"r0": {"ospf": {"lsa-refresh": 120}}}
775 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
776 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
779 "Enable flood. reduction in all the routers of the topology in area 0. Redistribute static route in area 0 R1 and area1 in R2."
781 for rtr
in topo
["routers"].keys():
783 rtr
: {"ospf": {"area": [{"id": "0.0.0.0", "flood-reduction": True}]}}
785 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
786 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
790 for rtr
in topo
["routers"]:
791 clear_ospf(tgen
, rtr
)
793 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
794 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
798 step("Verify that ospf lsa's are set with dc bit 1.")
799 for rtr
in topo
["routers"]:
801 lsid
= "{}".format(topo
["routers"][rtr
]["ospf"]["router_id"])
806 "routerLinkStates": [
809 "options": "*|-|DC|-|-|-|E|-",
815 result
= verify_ospf_database(
816 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
=lsid
818 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
820 step("Wait for 120 secs and verify that LSA's are not refreshed. ")
824 "routerId": "100.1.1.0",
827 "routerLinkStates": [
828 {"lsaId": "100.1.1.0", "lsaAge": "get"},
835 result1
= get_ospf_database(
836 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
839 result2
= get_ospf_database(
840 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
843 assert (result1
== result2
) is True, "Testcase {} : Failed \n Error: {}".format(
847 step("Enable flood reduction in area 1.")
850 "r0": {"ospf": {"area": [{"id": "0.0.0.0", "flood-reduction": True}]}}
852 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
853 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
859 {"id": "0.0.0.0", "flood-reduction": True},
860 {"id": "0.0.0.1", "flood-reduction": True},
865 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
866 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
872 {"id": "0.0.0.0", "flood-reduction": True},
873 {"id": "0.0.0.1", "flood-reduction": True},
874 {"id": "0.0.0.2", "flood-reduction": True},
879 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
880 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
886 {"id": "0.0.0.0", "flood-reduction": True},
887 {"id": "0.0.0.2", "flood-reduction": True},
892 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
893 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
895 for rtr
in topo
["routers"]:
896 clear_ospf(tgen
, rtr
)
898 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
899 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
903 step("Verify that ospf lea's are set with dc bit 1.")
906 "routerId": "100.1.1.1",
909 "routerLinkStates": [
911 "lsaId": "100.1.1.1",
912 "options": "*|-|DC|-|-|-|E|-",
918 result
= verify_ospf_database(
919 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.1"
921 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
923 step("Wait for 120 secs and verify that LSA's are not refreshed. ")
927 "routerId": "100.1.1.1",
930 "routerLinkStates": [
931 {"lsaId": "100.1.1.1", "lsaAge": "get"},
938 result1
= get_ospf_database(
939 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.1"
942 result2
= get_ospf_database(
943 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.1"
946 if result2
is result1
:
948 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
950 step("Disable flood reduction in R0.")
955 "area": [{"id": "0.0.0.0", "flood-reduction": True, "delete": True}]
959 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
960 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
966 {"id": "0.0.0.0", "flood-reduction": True, "delete": True},
967 {"id": "0.0.0.1", "flood-reduction": True, "delete": True},
972 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
973 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
979 {"id": "0.0.0.0", "flood-reduction": True, "delete": True},
980 {"id": "0.0.0.1", "flood-reduction": True, "delete": True},
981 {"id": "0.0.0.2", "flood-reduction": True, "delete": True},
986 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
987 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
993 {"id": "0.0.0.0", "flood-reduction": True, "delete": True},
994 {"id": "0.0.0.2", "flood-reduction": True, "delete": True},
999 result
= create_router_ospf(tgen
, topo
, ospf_flood
)
1000 assert result
is True, "Testcase : Failed \n Error: {}".format(result
)
1002 clear_ospf(tgen
, "r0")
1004 ospf_covergence
= verify_ospf_neighbor(tgen
, topo
)
1005 assert ospf_covergence
is True, "Testcase :Failed \n Error:" " {}".format(
1009 step("Verify that ospf lea's are not set with dc bit 1.")
1012 "routerId": "100.1.1.0",
1015 "routerLinkStates": [
1017 "lsaId": "100.1.1.0",
1018 "options": "*|-|DC|-|-|-|E|-",
1024 result
= verify_ospf_database(
1025 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0", expected
=False
1028 assert result
is not True, (
1029 "Testcase {} : Failed \n "
1030 "Expected: OSPF LSA should not be set with DC bit in {} \n "
1031 "Found: {}".format(tc_name
, dut
, result
)
1034 step("Wait for 120 secs and verify that LSA's are not refreshed. ")
1038 "routerId": "100.1.1.0",
1041 "routerLinkStates": [
1042 {"lsaId": "100.1.1.0", "lsaAge": "get"},
1049 result1
= get_ospf_database(
1050 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
1053 result2
= get_ospf_database(
1054 tgen
, topo
, dut
, input_dict_db
, lsatype
="router", rid
="100.1.1.0"
1057 if result2
is not result1
:
1059 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
1061 write_test_footer(tc_name
)
1064 if __name__
== "__main__":
1065 args
= ["-s"] + sys
.argv
[1:]
1066 sys
.exit(pytest
.main(args
))