From: Kuldeep Kashyap Date: Wed, 1 Apr 2020 05:30:38 +0000 (+0000) Subject: tests: Added new tests to bgp-basic-functionality-topo1 X-Git-Tag: frr-7.5.1~569^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=afee014eda2989806d1c581940d4d11252a7a14a;p=mirror_frr.git tests: Added new tests to bgp-basic-functionality-topo1 1. Added 2 new test cases to bgp-basic-functionality-topo1 2. Enhanced 2 tests to run for both static routes and network advvertise command Signed-off-by: Kuldeep Kashyap --- diff --git a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py index 1b2faa601..3441d6873 100755 --- a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py +++ b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py @@ -243,7 +243,7 @@ def test_BGP_config_with_invalid_ASN_p2(request): global BGP_CONVERGENCE if BGP_CONVERGENCE != True: - pytest.skip('skipped because of BGP Convergence failure') + pytest.skip("skipped because of BGP Convergence failure") # test case name tc_name = request.node.name @@ -251,26 +251,10 @@ def test_BGP_config_with_invalid_ASN_p2(request): # Api call to modify AS number input_dict = { - "r1": { - "bgp":{ - "local_as": 0, - } - }, - "r2": { - "bgp":{ - "local_as": 0, - } - }, - "r3": { - "bgp":{ - "local_as": 0, - } - }, - "r4": { - "bgp":{ - "local_as": 64000, - } - } + "r1": {"bgp": {"local_as": 0,}}, + "r2": {"bgp": {"local_as": 0,}}, + "r3": {"bgp": {"local_as": 0,}}, + "r4": {"bgp": {"local_as": 64000,}}, } result = modify_as_number(tgen, topo, input_dict) try: @@ -291,7 +275,7 @@ def test_BGP_config_with_2byteAS_and_4byteAS_number_p1(request): global BGP_CONVERGENCE if BGP_CONVERGENCE != True: - pytest.skip('skipped because of BGP Convergence failure') + pytest.skip("skipped because of BGP Convergence failure") # test case name tc_name = request.node.name @@ -299,42 +283,23 @@ def test_BGP_config_with_2byteAS_and_4byteAS_number_p1(request): # Api call to modify AS number input_dict = { - "r1": { - "bgp":{ - "local_as": 131079 - } - }, - "r2": { - "bgp":{ - "local_as": 131079 - } - }, - "r3": { - "bgp":{ - "local_as": 131079 - } - }, - "r4": { - "bgp":{ - "local_as": 111 - } - } + "r1": {"bgp": {"local_as": 131079}}, + "r2": {"bgp": {"local_as": 131079}}, + "r3": {"bgp": {"local_as": 131079}}, + "r4": {"bgp": {"local_as": 111}}, } result = modify_as_number(tgen, topo, input_dict) if result != True: - assert False, "Testcase " + tc_name + " :Failed \n Error: {}".\ - format(result) + assert False, "Testcase " + tc_name + " :Failed \n Error: {}".format(result) result = verify_as_numbers(tgen, topo, input_dict) if result != True: - assert False, "Testcase " + tc_name + " :Failed \n Error: {}".\ - format(result) + assert False, "Testcase " + tc_name + " :Failed \n Error: {}".format(result) # Api call verify whether BGP is converged result = verify_bgp_convergence(tgen, topo) if result != True: - assert False, "Testcase " + tc_name + " :Failed \n Error: {}".\ - format(result) + assert False, "Testcase " + tc_name + " :Failed \n Error: {}".format(result) write_test_footer(tc_name) diff --git a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py index 90fd1484d..89b15c46d 100755 --- a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py +++ b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py @@ -56,15 +56,6 @@ from lib.topogen import Topogen, get_topogen # Import topoJson from lib, to create topology and initial configuration from lib.common_config import ( - start_topology, write_test_header, - write_test_footer, reset_config_on_routers, - verify_rib, create_static_routes, - create_route_maps, check_address_types, step, -) -from lib.topolog import logger -from lib.bgp import ( - verify_bgp_convergence, create_router_bgp, - clear_bgp_and_verify, verify_bgp_rib start_topology, write_test_header, write_test_footer, @@ -177,6 +168,7 @@ def teardown_module(mod): # ##################################################### + def test_bgp_allowas_in_p0(request): """ Verify that routes coming from same AS are accepted only when diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index 2483930d1..5ee59070c 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -1198,7 +1198,7 @@ def create_route_maps(tgen, input_dict, build=False): ipv6_data = set_data.setdefault("ipv6", {}) local_preference = set_data.setdefault("locPrf", None) metric = set_data.setdefault("metric", None) - as_path = set_data.setdefault("aspath", {}) + as_path = set_data.setdefault("path", {}) weight = set_data.setdefault("weight", None) community = set_data.setdefault("community", {}) large_community = set_data.setdefault("large_community", {})