]> git.proxmox.com Git - mirror_frr.git/commitdiff
tests: Added new tests to bgp-basic-functionality-topo1
authorKuldeep Kashyap <kashyapk@vmware.com>
Wed, 1 Apr 2020 05:30:38 +0000 (05:30 +0000)
committerKuldeep Kashyap <kashyapk@vmware.com>
Thu, 9 Apr 2020 09:23:59 +0000 (09:23 +0000)
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 <kashyapk@vmware.com>
tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py
tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py
tests/topotests/lib/common_config.py

index 1b2faa601a8514e7ca9e6eadbdd777f383c82b0b..3441d68731d6188e4393669b7a73fdff479d715f 100755 (executable)
@@ -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)
 
index 90fd1484d9ed8b26307bc95e455a1e68348667b5..89b15c46d37df061370d60f9a18a2aa40630f6b4 100755 (executable)
@@ -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
index 2483930d18133d0b65be42874c8912fc85f2119d..5ee59070cc4ad7f0d2faed40f60a8b5ffd876c20 100644 (file)
@@ -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", {})