diff options
author | Russ White <russ@riw.us> | 2022-07-05 15:37:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 15:37:41 +0200 |
commit | ede13e3b9c51982934db9c5191fa652d78ab2d0a (patch) | |
tree | cbbfdd3135128f5442aadb57eeca41f50e97f3a9 /tests | |
parent | Merge pull request #11527 from mobash-rasool/fixes (diff) | |
parent | topostest: bgp_conditional_advertisement cleanup (diff) | |
download | frr-ede13e3b9c51982934db9c5191fa652d78ab2d0a.tar.xz frr-ede13e3b9c51982934db9c5191fa652d78ab2d0a.zip |
Merge pull request #11517 from louis-6wind/advert-map
topostest: bgp_conditional_advertisement cleanup
Diffstat (limited to 'tests')
-rw-r--r-- | tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py | 679 |
1 files changed, 479 insertions, 200 deletions
diff --git a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py index 6153aee41..1097be3d7 100644 --- a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py +++ b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py @@ -197,11 +197,199 @@ def teardown_module(mod): logger.info("=" * 40) -def test_bgp_conditional_advertisement(): - """ - Test BGP conditional advertisement functionality. - """ +def all_routes_advertised(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": [{"protocol": "bgp"}], + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + +def all_routes_withdrawn(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": None, + "192.0.2.5/32": None, + "10.139.224.0/20": None, + "203.0.113.1/32": None, + } + return topotest.json_cmp(output, expected) + + +# BGP conditional advertisement with route-maps +# EXIST-MAP, ADV-MAP-1 and RMAP-1 +def exist_map_routes_present(router): + return all_routes_advertised(router) + + +def exist_map_routes_not_present(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": None, + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": None, + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + +def non_exist_map_routes_present(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": [{"protocol": "bgp"}], + "192.0.2.1/32": None, + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": None, + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + +def non_exist_map_routes_not_present(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + +def exist_map_no_condition_route_map(router): + return non_exist_map_routes_present(router) + + +def non_exist_map_no_condition_route_map(router): + return all_routes_advertised(router) + + +def exist_map_routes_present_rmap_filter(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": None, + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": None, + } + return topotest.json_cmp(output, expected) + + +def exist_map_routes_present_no_rmap_filter(router): + return all_routes_advertised(router) + + +def non_exist_map_routes_present_rmap_filter(router): + return all_routes_withdrawn(router) + + +def non_exist_map_routes_present_no_rmap_filter(router): + return non_exist_map_routes_present(router) + + +def exist_map_routes_not_present_rmap_filter(router): + return all_routes_withdrawn(router) + + +def exist_map_routes_not_present_no_rmap_filter(router): + return exist_map_routes_not_present(router) + + +def non_exist_map_routes_not_present_rmap_filter(router): + return exist_map_routes_present_rmap_filter(router) + + +def non_exist_map_routes_not_present_no_rmap_filter(router): + return non_exist_map_routes_not_present(router) + + +# BGP conditional advertisement with route-maps +# EXIST-MAP, ADV-MAP-2 and RMAP-2 +def exist_map_routes_not_present_rmap2_filter(router): + return all_routes_withdrawn(router) + + +def exist_map_routes_not_present_no_rmap2_filter(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": None, + } + return topotest.json_cmp(output, expected) + + +def non_exist_map_routes_not_present_rmap2_filter(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": None, + "192.0.2.5/32": None, + "10.139.224.0/20": None, + "203.0.113.1/32": [{"protocol": "bgp", "metric": 911}], + } + return topotest.json_cmp(output, expected) + +def non_exist_map_routes_not_present_no_rmap2_filter(router): + return non_exist_map_routes_not_present(router) + + +def exist_map_routes_present_rmap2_filter(router): + return non_exist_map_routes_not_present_rmap2_filter(router) + + +def exist_map_routes_present_no_rmap2_filter(router): + return all_routes_advertised(router) + + +def non_exist_map_routes_present_rmap2_filter(router): + return all_routes_withdrawn(router) + + +def non_exist_map_routes_present_no_rmap2_filter(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": [{"protocol": "bgp"}], + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": None, + } + return topotest.json_cmp(output, expected) + + +def exist_map_routes_present_rmap2_network(router): + return non_exist_map_routes_not_present_rmap2_filter(router) + + +def exist_map_routes_present_rmap2_no_network(router): + return all_routes_withdrawn(router) + + +def non_exist_map_routes_not_present_rmap2_network(router): + return non_exist_map_routes_not_present_rmap2_filter(router) + + +def non_exist_map_routes_not_present_rmap2_no_network(router): + return all_routes_withdrawn(router) + + +passed = "PASSED!!!" +failed = "FAILED!!!" + + +def test_bgp_conditional_advertisement_step1(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) @@ -210,172 +398,9 @@ def test_bgp_conditional_advertisement(): router2 = tgen.gears["r2"] router3 = tgen.gears["r3"] - passed = "PASSED!!!" - failed = "FAILED!!!" - - def _all_routes_advertised(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": [{"protocol": "bgp"}], - "192.0.2.1/32": [{"protocol": "bgp"}], - "192.0.2.5/32": [{"protocol": "bgp"}], - "10.139.224.0/20": [{"protocol": "bgp"}], - "203.0.113.1/32": [{"protocol": "bgp"}], - } - return topotest.json_cmp(output, expected) - - def _all_routes_withdrawn(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": None, - "192.0.2.1/32": None, - "192.0.2.5/32": None, - "10.139.224.0/20": None, - "203.0.113.1/32": None, - } - return topotest.json_cmp(output, expected) - - # BGP conditional advertisement with route-maps - # EXIST-MAP, ADV-MAP-1 and RMAP-1 - def _exist_map_routes_present(router): - return _all_routes_advertised(router) - - def _exist_map_routes_not_present(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": None, - "192.0.2.1/32": None, - "192.0.2.5/32": [{"protocol": "bgp"}], - "10.139.224.0/20": None, - "203.0.113.1/32": [{"protocol": "bgp"}], - } - return topotest.json_cmp(output, expected) - - def _non_exist_map_routes_present(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": [{"protocol": "bgp"}], - "192.0.2.1/32": None, - "192.0.2.5/32": [{"protocol": "bgp"}], - "10.139.224.0/20": None, - "203.0.113.1/32": [{"protocol": "bgp"}], - } - return topotest.json_cmp(output, expected) - - def _non_exist_map_routes_not_present(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": None, - "192.0.2.1/32": [{"protocol": "bgp"}], - "192.0.2.5/32": [{"protocol": "bgp"}], - "10.139.224.0/20": [{"protocol": "bgp"}], - "203.0.113.1/32": [{"protocol": "bgp"}], - } - return topotest.json_cmp(output, expected) - - def _exist_map_no_condition_route_map(router): - return _non_exist_map_routes_present(router) - - def _non_exist_map_no_condition_route_map(router): - return _all_routes_advertised(router) - - def _exist_map_routes_present_rmap_filter(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": None, - "192.0.2.1/32": [{"protocol": "bgp"}], - "192.0.2.5/32": None, - "10.139.224.0/20": [{"protocol": "bgp"}], - "203.0.113.1/32": None, - } - return topotest.json_cmp(output, expected) - - def _exist_map_routes_present_no_rmap_filter(router): - return _all_routes_advertised(router) - - def _non_exist_map_routes_present_rmap_filter(router): - return _all_routes_withdrawn(router) - - def _non_exist_map_routes_present_no_rmap_filter(router): - return _non_exist_map_routes_present(router) - - def _exist_map_routes_not_present_rmap_filter(router): - return _all_routes_withdrawn(router) - - def _exist_map_routes_not_present_no_rmap_filter(router): - return _exist_map_routes_not_present(router) - - def _non_exist_map_routes_not_present_rmap_filter(router): - return _exist_map_routes_present_rmap_filter(router) - - def _non_exist_map_routes_not_present_no_rmap_filter(router): - return _non_exist_map_routes_not_present(router) - - # BGP conditional advertisement with route-maps - # EXIST-MAP, ADV-MAP-2 and RMAP-2 - def _exist_map_routes_not_present_rmap2_filter(router): - return _all_routes_withdrawn(router) - - def _exist_map_routes_not_present_no_rmap2_filter(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": None, - "192.0.2.1/32": [{"protocol": "bgp"}], - "192.0.2.5/32": [{"protocol": "bgp"}], - "10.139.224.0/20": [{"protocol": "bgp"}], - "203.0.113.1/32": None, - } - return topotest.json_cmp(output, expected) - - def _non_exist_map_routes_not_present_rmap2_filter(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": None, - "192.0.2.1/32": None, - "192.0.2.5/32": None, - "10.139.224.0/20": None, - "203.0.113.1/32": [{"protocol": "bgp", "metric": 911}], - } - return topotest.json_cmp(output, expected) - - def _non_exist_map_routes_not_present_no_rmap2_filter(router): - return _non_exist_map_routes_not_present(router) - - def _exist_map_routes_present_rmap2_filter(router): - return _non_exist_map_routes_not_present_rmap2_filter(router) - - def _exist_map_routes_present_no_rmap2_filter(router): - return _all_routes_advertised(router) - - def _non_exist_map_routes_present_rmap2_filter(router): - return _all_routes_withdrawn(router) - - def _non_exist_map_routes_present_no_rmap2_filter(router): - output = json.loads(router.vtysh_cmd("show ip route json")) - expected = { - "0.0.0.0/0": [{"protocol": "bgp"}], - "192.0.2.1/32": [{"protocol": "bgp"}], - "192.0.2.5/32": [{"protocol": "bgp"}], - "10.139.224.0/20": [{"protocol": "bgp"}], - "203.0.113.1/32": None, - } - return topotest.json_cmp(output, expected) - - def _exist_map_routes_present_rmap2_network(router): - return _non_exist_map_routes_not_present_rmap2_filter(router) - - def _exist_map_routes_present_rmap2_no_network(router): - return _all_routes_withdrawn(router) - - def _non_exist_map_routes_not_present_rmap2_network(router): - return _non_exist_map_routes_not_present_rmap2_filter(router) - - def _non_exist_map_routes_not_present_rmap2_no_network(router): - return _all_routes_withdrawn(router) - # TC11: R3 BGP convergence, without advertise-map configuration. # All routes are advertised to R3. - test_func = functools.partial(_all_routes_advertised, router3) + test_func = functools.partial(all_routes_advertised, router3) success, result = topotest.run_and_expect(test_func, None, count=130, wait=1) msg = 'TC11: "router3" BGP convergence - ' @@ -383,6 +408,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step2(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC21: exist-map routes present in R2's BGP table. # advertise-map routes present in R2's BGP table are advertised to R3. router2.vtysh_cmd( @@ -394,7 +429,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_present, router3) + test_func = functools.partial(exist_map_routes_present, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = 'TC21: exist-map routes present in "router2" BGP table - ' @@ -402,6 +437,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step3(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC22: exist-map routes not present in R2's BGP table # advertise-map routes present in R2's BGP table are withdrawn from R3. router1.vtysh_cmd( @@ -413,7 +458,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_not_present, router3) + test_func = functools.partial(exist_map_routes_not_present, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = 'TC22: exist-map routes not present in "router2" BGP table - ' @@ -421,6 +466,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step4(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC31: non-exist-map routes not present in R2's BGP table # advertise-map routes present in R2's BGP table are advertised to R3. router2.vtysh_cmd( @@ -432,7 +487,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_non_exist_map_routes_not_present, router3) + test_func = functools.partial(non_exist_map_routes_not_present, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = 'TC31: non-exist-map routes not present in "router2" BGP table - ' @@ -440,6 +495,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step5(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC32: non-exist-map routes present in R2's BGP table # advertise-map routes present in R2's BGP table are withdrawn from R3. router1.vtysh_cmd( @@ -451,7 +516,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_non_exist_map_routes_present, router3) + test_func = functools.partial(non_exist_map_routes_present, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = 'TC32: non-exist-map routes present in "router2" BGP table - ' @@ -459,6 +524,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step6(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC41: non-exist-map route-map configuration removed in R2. # advertise-map routes present in R2's BGP table are advertised to R3. router2.vtysh_cmd( @@ -468,7 +543,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_non_exist_map_no_condition_route_map, router3) + test_func = functools.partial(non_exist_map_no_condition_route_map, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = 'TC41: non-exist-map route-map removed in "router2" - ' @@ -476,6 +551,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step7(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC42: exist-map route-map configuration removed in R2 # advertise-map routes present in R2's BGP table are withdrawn from R3. router2.vtysh_cmd( @@ -487,7 +572,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_no_condition_route_map, router3) + test_func = functools.partial(exist_map_no_condition_route_map, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = 'TC42: exist-map route-map removed in "router2" - ' @@ -495,6 +580,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step8(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC51: exist-map routes present in R2's BGP table, with route-map filter. # All routes are withdrawn from R3 except advertise-map routes. router2.vtysh_cmd( @@ -510,7 +605,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_present_rmap_filter, router3) + test_func = functools.partial(exist_map_routes_present_rmap_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC51: exist-map routes present with route-map filter - " @@ -518,6 +613,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step9(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC52: exist-map routes present in R2's BGP table, no route-map filter. # All routes are advertised to R3 including advertise-map routes. router2.vtysh_cmd( @@ -529,7 +634,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_present_no_rmap_filter, router3) + test_func = functools.partial(exist_map_routes_present_no_rmap_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC52: exist-map routes present, no route-map filter - " @@ -537,6 +642,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step10(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC53: non-exist-map routes present in R2's BGP table, with route-map filter. # All routes are withdrawn from R3 including advertise-map routes. router2.vtysh_cmd( @@ -549,7 +664,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_non_exist_map_routes_present_rmap_filter, router3) + test_func = functools.partial(non_exist_map_routes_present_rmap_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC53: non-exist-map routes present, with route-map filter - " @@ -557,6 +672,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step11(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC54: non-exist-map routes present in R2's BGP table, no route-map filter. # All routes are advertised to R3 except advertise-map routes. router2.vtysh_cmd( @@ -568,7 +693,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_non_exist_map_routes_present_no_rmap_filter, router3) + test_func = functools.partial(non_exist_map_routes_present_no_rmap_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC54: non-exist-map routes present, no route-map filter - " @@ -576,6 +701,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step12(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC61: exist-map routes not present in R2's BGP table, with route-map filter. # All routes are withdrawn from R3 including advertise-map routes. router1.vtysh_cmd( @@ -596,7 +731,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_not_present_rmap_filter, router3) + test_func = functools.partial(exist_map_routes_not_present_rmap_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC61: exist-map routes not present, route-map filter - " @@ -604,6 +739,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step13(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC62: exist-map routes not present in R2's BGP table, without route-map filter. # All routes are advertised to R3 except advertise-map routes. router2.vtysh_cmd( @@ -615,7 +760,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_not_present_no_rmap_filter, router3) + test_func = functools.partial(exist_map_routes_not_present_no_rmap_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC62: exist-map routes not present, no route-map filter - " @@ -623,6 +768,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step14(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC63: non-exist-map routes not present in R2's BGP table, with route-map filter. # All routes are withdrawn from R3 except advertise-map routes. router2.vtysh_cmd( @@ -635,9 +790,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial( - _non_exist_map_routes_not_present_rmap_filter, router3 - ) + test_func = functools.partial(non_exist_map_routes_not_present_rmap_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC63: non-exist-map routes not present, route-map filter - " @@ -645,6 +798,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step15(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC64: non-exist-map routes not present in R2's BGP table, without route-map filter. # All routes are advertised to R3 including advertise-map routes. router2.vtysh_cmd( @@ -657,7 +820,7 @@ def test_bgp_conditional_advertisement(): ) test_func = functools.partial( - _non_exist_map_routes_not_present_no_rmap_filter, router3 + non_exist_map_routes_not_present_no_rmap_filter, router3 ) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) @@ -666,6 +829,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step16(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC71: exist-map routes present in R2's BGP table, with route-map filter. # All routes are withdrawn from R3 except advertise-map routes. router1.vtysh_cmd( @@ -686,7 +859,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_present_rmap2_filter, router3) + test_func = functools.partial(exist_map_routes_present_rmap2_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC71: exist-map routes present, route-map filter - " @@ -694,6 +867,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step17(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC72: exist-map routes present in R2's BGP table, without route-map filter. # All routes are advertised to R3 including advertise-map routes. router2.vtysh_cmd( @@ -705,7 +888,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_present_no_rmap2_filter, router3) + test_func = functools.partial(exist_map_routes_present_no_rmap2_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC72: exist-map routes present, no route-map filter - " @@ -713,6 +896,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step18(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC73: non-exist-map routes present in R2's BGP table, with route-map filter. # All routes are advertised to R3 including advertise-map routes. router2.vtysh_cmd( @@ -725,7 +918,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_non_exist_map_routes_present_rmap2_filter, router3) + test_func = functools.partial(non_exist_map_routes_present_rmap2_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC73: non-exist-map routes present, route-map filter - " @@ -733,6 +926,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step19(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC74: non-exist-map routes present in R2's BGP table, without route-map filter. # All routes are advertised to R3 including advertise-map routes. router2.vtysh_cmd( @@ -744,9 +947,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial( - _non_exist_map_routes_present_no_rmap2_filter, router3 - ) + test_func = functools.partial(non_exist_map_routes_present_no_rmap2_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC74: non-exist-map routes present, no route-map filter - " @@ -754,6 +955,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step20(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC81: exist-map routes not present in R2's BGP table, with route-map filter. # All routes are withdrawn from R3 including advertise-map routes. router1.vtysh_cmd( @@ -774,7 +985,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_not_present_rmap2_filter, router3) + test_func = functools.partial(exist_map_routes_not_present_rmap2_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC81: exist-map routes not present, route-map filter - " @@ -782,6 +993,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step21(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC82: exist-map routes not present in R2's BGP table, without route-map filter. # All routes are advertised to R3 except advertise-map routes. router2.vtysh_cmd( @@ -793,9 +1014,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial( - _exist_map_routes_not_present_no_rmap2_filter, router3 - ) + test_func = functools.partial(exist_map_routes_not_present_no_rmap2_filter, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC82: exist-map routes not present, no route-map filter - " @@ -803,6 +1022,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step22(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC83: non-exist-map routes not present in R2's BGP table, with route-map filter. # All routes are advertised to R3 including advertise-map routes. router2.vtysh_cmd( @@ -816,7 +1045,7 @@ def test_bgp_conditional_advertisement(): ) test_func = functools.partial( - _non_exist_map_routes_not_present_rmap2_filter, router3 + non_exist_map_routes_not_present_rmap2_filter, router3 ) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) @@ -825,6 +1054,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step23(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC84: non-exist-map routes not present in R2's BGP table, without route-map filter. # All routes are advertised to R3 including advertise-map routes. router2.vtysh_cmd( @@ -837,7 +1076,7 @@ def test_bgp_conditional_advertisement(): ) test_func = functools.partial( - _non_exist_map_routes_not_present_no_rmap2_filter, router3 + non_exist_map_routes_not_present_no_rmap2_filter, router3 ) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) @@ -846,6 +1085,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step24(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC91: exist-map routes present in R2's BGP table, with route-map filter and network. # All routes are advertised to R3 including advertise-map routes. router1.vtysh_cmd( @@ -866,7 +1115,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_present_rmap2_network, router3) + test_func = functools.partial(exist_map_routes_present_rmap2_network, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC91: exist-map routes present, route-map filter and network - " @@ -874,6 +1123,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step25(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC92: exist-map routes present in R2's BGP table, with route-map filter and no network. # All routes are advertised to R3 except advertise-map routes. router2.vtysh_cmd( @@ -885,7 +1144,7 @@ def test_bgp_conditional_advertisement(): """ ) - test_func = functools.partial(_exist_map_routes_present_rmap2_no_network, router3) + test_func = functools.partial(exist_map_routes_present_rmap2_no_network, router3) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) msg = "TC92: exist-map routes present, route-map filter and no network - " @@ -893,6 +1152,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step26(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC93: non-exist-map routes not present in R2's BGP table, with route-map filter and network. # All routes are advertised to R3 including advertise-map routes. router1.vtysh_cmd( @@ -914,7 +1183,7 @@ def test_bgp_conditional_advertisement(): ) test_func = functools.partial( - _non_exist_map_routes_not_present_rmap2_network, router3 + non_exist_map_routes_not_present_rmap2_network, router3 ) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) @@ -923,6 +1192,16 @@ def test_bgp_conditional_advertisement(): logger.info(msg + passed) + +def test_bgp_conditional_advertisement_step27(): + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + # TC94: non-exist-map routes not present in R2's BGP table, with route-map filter and no network. # All routes are advertised to R3 except advertise-map routes. router2.vtysh_cmd( @@ -935,7 +1214,7 @@ def test_bgp_conditional_advertisement(): ) test_func = functools.partial( - _non_exist_map_routes_not_present_rmap2_no_network, router3 + non_exist_map_routes_not_present_rmap2_no_network, router3 ) success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) |