From: ckishimo Date: Fri, 8 Jan 2021 09:25:49 +0000 (+0100) Subject: tests: add new def for redistribution in ospf X-Git-Tag: base_7.6~43^2~4 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=881fa68f057acd52905ca7c917e65f9b895290fa;p=mirror%2Ffrr.git tests: add new def for redistribution in ospf Signed-off-by: ckishimo --- diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py index 5ef6b9b0be..7569629a9c 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py @@ -216,6 +216,19 @@ def red_connected(dut, config=True): assert result is True, "Testcase: Failed \n Error: {}".format(result) +def redistribute(dut, route_type, **kwargs): + """Local def for redstribution of routes inside ospf.""" + global topo + tgen = get_topogen() + + ospf_red = {dut: {"ospf": {"redistribute": [{"redist_type": route_type}]}}} + for k, v in kwargs.items(): + ospf_red[dut]["ospf"]["redistribute"][0][k] = v + + result = create_router_ospf(tgen, topo, ospf_red) + assert result is True, "Testcase : Failed \n Error: {}".format(result) + + # ################################## # Test cases start here. # ################################## diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py index 967bc44879..f56a884998 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py @@ -223,6 +223,19 @@ def red_connected(dut, config=True): assert result is True, "Testcase: Failed \n Error: {}".format(result) +def redistribute(dut, route_type, **kwargs): + """Local def for redstribution of routes inside ospf.""" + global topo + tgen = get_topogen() + + ospf_red = {dut: {"ospf": {"redistribute": [{"redist_type": route_type}]}}} + for k, v in kwargs.items(): + ospf_red[dut]["ospf"]["redistribute"][0][k] = v + + result = create_router_ospf(tgen, topo, ospf_red) + assert result is True, "Testcase : Failed \n Error: {}".format(result) + + # ################################## # Test cases start here. # ################################## diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py index 0f1115f815..d611c0539f 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py @@ -219,6 +219,19 @@ def red_connected(dut, config=True): assert result is True, "Testcase: Failed \n Error: {}".format(result) +def redistribute(dut, route_type, **kwargs): + """Local def for redstribution of routes inside ospf.""" + global topo + tgen = get_topogen() + + ospf_red = {dut: {"ospf": {"redistribute": [{"redist_type": route_type}]}}} + for k, v in kwargs.items(): + ospf_red[dut]["ospf"]["redistribute"][0][k] = v + + result = create_router_ospf(tgen, topo, ospf_red) + assert result is True, "Testcase : Failed \n Error: {}".format(result) + + # ################################## # Test cases start here. # ################################## diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py index 82a34d046c..44eaf81437 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py @@ -213,6 +213,19 @@ def red_connected(dut, config=True): assert result is True, "Testcase: Failed \n Error: {}".format(result) +def redistribute(dut, route_type, **kwargs): + """Local def for redstribution of routes inside ospf.""" + global topo + tgen = get_topogen() + + ospf_red = {dut: {"ospf": {"redistribute": [{"redist_type": route_type}]}}} + for k, v in kwargs.items(): + ospf_red[dut]["ospf"]["redistribute"][0][k] = v + + result = create_router_ospf(tgen, topo, ospf_red) + assert result is True, "Testcase : Failed \n Error: {}".format(result) + + # ################################## # Test cases start here. # ################################## diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py index 88667a6ac8..907f4383d6 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py @@ -193,6 +193,19 @@ def teardown_module(mod): logger.info("=" * 40) +def redistribute(dut, route_type, **kwargs): + """Local def for redstribution of routes inside ospf.""" + global topo + tgen = get_topogen() + + ospf_red = {dut: {"ospf": {"redistribute": [{"redist_type": route_type}]}}} + for k, v in kwargs.items(): + ospf_red[dut]["ospf"]["redistribute"][0][k] = v + + result = create_router_ospf(tgen, topo, ospf_red) + assert result is True, "Testcase : Failed \n Error: {}".format(result) + + # ################################## # Test cases start here. # ################################## diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py index 434d7f8ef5..ecd7798340 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py @@ -219,6 +219,19 @@ def red_connected(dut, config=True): assert result is True, "Testcase: Failed \n Error: {}".format(result) +def redistribute(dut, route_type, **kwargs): + """Local def for redstribution of routes inside ospf.""" + global topo + tgen = get_topogen() + + ospf_red = {dut: {"ospf": {"redistribute": [{"redist_type": route_type}]}}} + for k, v in kwargs.items(): + ospf_red[dut]["ospf"]["redistribute"][0][k] = v + + result = create_router_ospf(tgen, topo, ospf_red) + assert result is True, "Testcase : Failed \n Error: {}".format(result) + + # ################################## # Test cases start here. # ##################################