summaryrefslogtreecommitdiff
path: root/tests/topotests/static_routing_with_ebgp
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2021-04-09 12:34:18 -0400
committerMark Stapp <mjs@voltanet.io>2021-04-13 11:45:55 -0400
commitaa59a7090a17f63656d267da669f2c6496e27411 (patch)
treefeca519df3b8f93b6493b4d1ce047516776b1dd9 /tests/topotests/static_routing_with_ebgp
parent914faab594cf04d7ac4e82a63cdf77c621b9259f (diff)
tests: fix pylint errors in static_routing_with_ebgp tests
Fix pylint errors; also enable the test in 'topo4', which has never run. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'tests/topotests/static_routing_with_ebgp')
-rw-r--r--tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py234
-rw-r--r--tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py69
-rw-r--r--tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py60
-rw-r--r--tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py20
4 files changed, 195 insertions, 188 deletions
diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py
index a4cc8e8e7a..99a04d26de 100644
--- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py
+++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py
@@ -40,10 +40,11 @@ import platform
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
sys.path.append(os.path.join(CWD, "../lib/"))
+
# pylint: disable=C0413
# Import topogen and topotest helpers
-from mininet.topo import Topo
from lib.topogen import Topogen, get_topogen
+from mininet.topo import Topo
from lib.topotest import version_cmp
# Import topoJson from lib, to create topology and initial configuration
@@ -68,15 +69,14 @@ from lib.topojson import build_topo_from_json, build_config_from_json
pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
# Reading the data from JSON File for topology creation
-jsonFile = "{}/static_routes_topo1_ebgp.json".format(CWD)
+JSONFILE = "{}/static_routes_topo1_ebgp.json".format(CWD)
try:
- with open(jsonFile, "r") as topoJson:
+ with open(JSONFILE, "r") as topoJson:
topo = json.load(topoJson)
except IOError:
- assert False, "Could not read file {}".format(jsonFile)
+ assert False, "Could not read file {}".format(JSONFILE)
# Global variables
-BGP_CONVERGENCE = False
ADDR_TYPES = check_address_types()
NETWORK = {"ipv4": ["11.0.20.1/32", "11.0.20.2/32"], "ipv6": ["2::1/128", "2::2/128"]}
NETWORK2 = {"ipv4": "11.0.20.1/32", "ipv6": "2::1/128"}
@@ -98,6 +98,10 @@ class CreateTopo(Topo):
# Building topology from json file
build_topo_from_json(tgen, topo)
+ def dumdum(self):
+ """ Dummy """
+ print("%s", self.name)
+
def setup_module(mod):
"""
@@ -105,7 +109,7 @@ def setup_module(mod):
* `mod`: module name
"""
- global topo
+
testsuite_run_time = time.asctime(time.localtime(time.time()))
logger.info("Testsuite start time: {}".format(testsuite_run_time))
logger.info("=" * 40)
@@ -131,15 +135,15 @@ def setup_module(mod):
pytest.skip(error_msg)
# Checking BGP convergence
- global BGP_CONVERGENCE
- global ADDR_TYPES
+
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
+
# Api call verify whether BGP is converged
- BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
- assert BGP_CONVERGENCE is True, "setup_module :Failed \n Error: {}".format(
- BGP_CONVERGENCE
+ converged = verify_bgp_convergence(tgen, topo)
+ assert converged is True, "setup_module :Failed \n Error: {}".format(
+ converged
)
logger.info("Running setup_module() done")
@@ -152,7 +156,7 @@ def teardown_module(mod):
* `mod`: module name
"""
- logger.info("Running teardown_module to delete topology")
+ logger.info("Running teardown_module to delete topology: %s", mod)
tgen = get_topogen()
@@ -166,7 +170,11 @@ def teardown_module(mod):
def populate_nh():
- NEXT_HOP_IP = {
+ """
+ Populate nexthops.
+ """
+
+ next_hop_ip = {
"nh1": {
"ipv4": topo["routers"]["r1"]["links"]["r2-link0"]["ipv4"].split("/")[0],
"ipv6": topo["routers"]["r1"]["links"]["r2-link0"]["ipv6"].split("/")[0],
@@ -176,7 +184,7 @@ def populate_nh():
"ipv6": topo["routers"]["r1"]["links"]["r2-link1"]["ipv6"].split("/")[0],
},
}
- return NEXT_HOP_IP
+ return next_hop_ip
#####################################################
@@ -199,7 +207,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
pytest.skip(tgen.errors)
reset_config_on_routers(tgen)
- NEXT_HOP_IP = populate_nh()
+ next_hop_ip = populate_nh()
step(
"Configure IPv4 static route (10.1.1.1) in R2 with next hop N1"
@@ -213,11 +221,11 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
},
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
},
]
}
@@ -233,7 +241,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"On R2, static route installed in RIB using show ip route"
" with 2 ECMP next hop "
)
- nh = [NEXT_HOP_IP["nh1"][addr_type], NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type], next_hop_ip["nh2"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
@@ -268,7 +276,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"delete": True,
}
]
@@ -284,7 +292,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"On R2, after removing the static route with N1 , "
"route become active with nexthop N2 and vice versa."
)
- nh = NEXT_HOP_IP["nh1"][addr_type]
+ nh = next_hop_ip["nh1"][addr_type]
result = verify_rib(
tgen,
addr_type,
@@ -300,11 +308,11 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
tc_name
)
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Configure the static route with nexthop N1")
@@ -314,7 +322,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
}
]
}
@@ -333,7 +341,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"delete": True,
}
]
@@ -350,7 +358,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"On R2, after removing the static route with N2 , "
"route become active with nexthop N1 and vice versa."
)
- nh = NEXT_HOP_IP["nh2"][addr_type]
+ nh = next_hop_ip["nh2"][addr_type]
result = verify_rib(
tgen,
addr_type,
@@ -360,14 +368,14 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is"\
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Configure the static route with nexthop N2")
@@ -376,7 +384,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
}
]
}
@@ -395,14 +403,14 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
step("Only one the nexthops should be active in RIB.")
- nh = NEXT_HOP_IP["nh2"][addr_type]
+ nh = next_hop_ip["nh2"][addr_type]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
- nh = NEXT_HOP_IP["nh1"][addr_type]
+ nh = next_hop_ip["nh1"][addr_type]
result = verify_rib(
tgen,
addr_type,
@@ -412,14 +420,14 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
result = verify_rib(
@@ -431,26 +439,26 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
next_hop=nh,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
dut = "r2"
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
dut = "r2"
@@ -461,12 +469,12 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"after shut of nexthop N1 , route become active "
"with nexthop N2 and vice versa."
)
- nh = [NEXT_HOP_IP["nh1"][addr_type], NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type], next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Shut nexthop interface N2")
@@ -475,10 +483,10 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
shutdown_bringup_interface(tgen, dut, intf, False)
step(
- " after shut of nexthop N1 , route become active with "
+ " after shut of nexthop N1 , route become active with " \
"nexthop N2 and vice versa."
)
- nh = NEXT_HOP_IP["nh2"][addr_type]
+ nh = next_hop_ip["nh2"][addr_type]
result = verify_rib(
tgen,
@@ -489,27 +497,27 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
step("No shut nexthop interface N2")
@@ -520,23 +528,23 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
"after shut of nexthop N1 , route become active "
"with nexthop N2 and vice versa."
)
- nh = [NEXT_HOP_IP["nh1"][addr_type], NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type], next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
step("Reload the FRR router")
@@ -553,18 +561,18 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
write_test_footer(tc_name)
@@ -583,7 +591,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
pytest.skip(tgen.errors)
reset_config_on_routers(tgen)
- NEXT_HOP_IP = populate_nh()
+
step(
"Configure IPv4 static route (10.1.1.1) in R2 with next hop N1"
"(28.1.1.2 ) AD 10 and N2 (29.1.1.2) AD 20 , Static route next-hop"
@@ -592,19 +600,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
)
reset_config_on_routers(tgen)
- NEXT_HOP_IP = populate_nh()
+ next_hop_ip = populate_nh()
for addr_type in ADDR_TYPES:
input_dict_4 = {
"r2": {
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
},
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"admin_distance": 20,
},
]
@@ -625,19 +633,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
}
]
}
}
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
rte2_nh2 = {
@@ -645,13 +653,13 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"admin_distance": 20,
}
]
}
}
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
@@ -664,7 +672,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
step("Configure IBGP IPv4 peering between R2 and R3 router.")
@@ -673,11 +681,11 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"r3": {
"static_routes": [
{
- "network": NEXT_HOP_IP["nh1"][addr_type] + "/32",
+ "network": next_hop_ip["nh1"][addr_type] + "/32",
"next_hop": topo["routers"]["r2"]["links"]["r3"][addr_type],
},
{
- "network": NEXT_HOP_IP["nh2"][addr_type] + "/32",
+ "network": next_hop_ip["nh2"][addr_type] + "/32",
"next_hop": topo["routers"]["r2"]["links"]["r3"][addr_type],
},
]
@@ -712,7 +720,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
"delete": True,
}
@@ -735,13 +743,13 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
}
]
}
}
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
@@ -754,7 +762,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
rte2_nh2 = {
@@ -762,17 +770,17 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"admin_distance": 20,
}
]
}
}
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte2_nh2, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
step("Configure the static route with nexthop N1")
@@ -781,7 +789,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
}
]
@@ -799,7 +807,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"admin_distance": 20,
"delete": True,
}
@@ -816,7 +824,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"On R2, after removing the static route with N2 , "
"route become active with nexthop N1 and vice versa."
)
- nh = NEXT_HOP_IP["nh2"][addr_type]
+ nh = next_hop_ip["nh2"][addr_type]
result = verify_rib(
tgen,
addr_type,
@@ -826,14 +834,14 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Configure the static route with nexthop N2")
@@ -842,7 +850,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"admin_distance": 20,
}
]
@@ -862,7 +870,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
step("after shut of nexthop N1 , route become active with nexthop N2")
- nh = NEXT_HOP_IP["nh1"][addr_type]
+ nh = next_hop_ip["nh1"][addr_type]
result = verify_rib(
tgen,
addr_type,
@@ -872,14 +880,14 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte2_nh2, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("No shut the nexthop interface N1")
@@ -889,12 +897,12 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"after shut of nexthop N1 , route become active "
"with nexthop N2 and vice versa."
)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Shut nexthop interface N2")
@@ -906,7 +914,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
" after shut of nexthop N1 , route become active with "
"nexthop N2 and vice versa."
)
- nh = NEXT_HOP_IP["nh2"][addr_type]
+ nh = next_hop_ip["nh2"][addr_type]
result = verify_rib(
tgen,
@@ -917,14 +925,14 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("No shut nexthop interface N2")
@@ -939,19 +947,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
}
]
}
}
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
rte2_nh2 = {
@@ -959,13 +967,13 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"admin_distance": 20,
}
]
}
}
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
@@ -978,7 +986,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
dut = "r3"
@@ -994,7 +1002,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
dut = "r2"
@@ -1013,25 +1021,25 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
}
]
}
}
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
dut = "r3"
protocol = "bgp"
result = verify_bgp_rib(tgen, addr_type, dut, rte1_nh1, next_hop=nh)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
rte2_nh2 = {
@@ -1039,13 +1047,13 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"admin_distance": 20,
}
]
}
}
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
@@ -1058,13 +1066,13 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
dut = "r3"
protocol = "bgp"
result = verify_bgp_rib(tgen, addr_type, dut, rte2_nh2, next_hop=nh)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
result = verify_rib(
@@ -1077,7 +1085,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
write_test_footer(tc_name)
@@ -1148,13 +1156,13 @@ def test_same_rte_from_bgp_static_p0_tc5_ebgp(request):
step("Verify on R3 , route receive on R3 BGP table ")
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
step("Verify route installed in the RIB and FIB of R3")
protocol = "bgp"
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
step(
@@ -1206,14 +1214,14 @@ def test_same_rte_from_bgp_static_p0_tc5_ebgp(request):
)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in BGP RIB".format(tc_name)
protocol = "bgp"
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
step("Remove the static route on R3 configured with active" "interface")
@@ -1249,14 +1257,14 @@ def test_same_rte_from_bgp_static_p0_tc5_ebgp(request):
)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in BGP RIB".format(tc_name)
protocol = "bgp"
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
write_test_footer(tc_name)
diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py
index 6649915dec..72a6eb9871 100644
--- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py
+++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py
@@ -314,7 +314,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
next_hop=nh_all[addr_type],
protocol=protocol,
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
@@ -338,7 +338,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
dut = "r3"
protocol = "bgp"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step(
@@ -384,7 +384,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed\nError: Routes is"
+ assert result is not True, "Testcase {} : Failed\nError: Routes is" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by one")
@@ -410,7 +410,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed\nError: Routes are"
+ assert result is True, "Testcase {} : Failed\nError: Routes are" \
" missing in RIB".format(tc_name)
protocol = "static"
@@ -455,7 +455,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
next_hop=nh_all[addr_type],
protocol=protocol,
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Remove random static route with all the nexthop")
@@ -493,7 +493,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
for addr_type in ADDR_TYPES:
@@ -546,7 +546,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
next_hop=nh_all[addr_type],
protocol=protocol,
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Remove the redistribute static knob")
@@ -580,7 +580,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
write_test_footer(tc_name)
@@ -661,7 +661,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
nh = []
@@ -679,7 +679,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
wait=2,
attempts=3,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step(
@@ -723,7 +723,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by one")
@@ -770,7 +770,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
@@ -787,7 +787,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
wait=2,
attempts=3,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
@@ -815,7 +815,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
@@ -826,7 +826,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
dut = "r2"
@@ -955,7 +955,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
nh = []
@@ -971,7 +971,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step(
@@ -1015,7 +1015,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by one")
@@ -1062,7 +1062,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
@@ -1077,7 +1077,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
@@ -1105,7 +1105,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
@@ -1116,7 +1116,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
dut = "r2"
@@ -1230,7 +1230,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Verify that highest AD nexthop are inactive")
@@ -1249,7 +1249,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
wait=2,
attempts=3,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
@@ -1312,7 +1312,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by one")
@@ -1355,7 +1355,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
"lowest AD is missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
@@ -1383,7 +1383,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
@@ -1394,7 +1394,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
step("Remove random static route with all the nexthop")
@@ -1434,7 +1434,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Route "
+ assert result is not True, "Testcase {} : Failed \nError: Route " \
" is still present in RIB".format(tc_name)
step("Reconfigure the deleted routes and verify they are installed")
@@ -1460,7 +1460,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
protocol = "static"
nh = NEXT_HOP_IP["nh1"][addr_type]
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
- assert result is True, "Testcase {} : Failed \nError: Route "
+ assert result is True, "Testcase {} : Failed \nError: Route " \
" is still present in RIB".format(tc_name)
step("Reload the FRR router")
@@ -1577,7 +1577,7 @@ def test_static_route_delete_p0_tc11_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Verify that highest AD nexthop are inactive")
@@ -1594,7 +1594,7 @@ def test_static_route_delete_p0_tc11_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
@@ -1647,7 +1647,7 @@ def test_static_route_delete_p0_tc11_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
for addr_type in ADDR_TYPES:
@@ -1715,8 +1715,9 @@ def test_static_route_delete_p0_tc11_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still active in RIB".format(tc_name)
+
write_test_footer(tc_name)
diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py
index 175a1123d7..6aaa2c0209 100644
--- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py
+++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py
@@ -297,7 +297,7 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
for addr_type in ADDR_TYPES:
@@ -351,7 +351,7 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by" "one")
@@ -379,7 +379,7 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
@@ -407,7 +407,7 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
@@ -418,7 +418,7 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
@@ -429,7 +429,7 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
write_test_footer(tc_name)
@@ -509,7 +509,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
" lowest AD is missing in RIB".format(tc_name)
nh = []
@@ -525,7 +525,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" with high AD are active in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
@@ -569,7 +569,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
" lowest AD is missing in RIB".format(tc_name)
step(
@@ -613,7 +613,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by" "one")
@@ -655,7 +655,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
" lowest AD is missing in RIB".format(tc_name)
nh = []
@@ -671,7 +671,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" with high AD are active in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
@@ -699,7 +699,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
@@ -710,7 +710,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
@@ -740,7 +740,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
" lowest AD is missing in RIB".format(tc_name)
nh = []
@@ -756,7 +756,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" with high AD are active in RIB".format(tc_name)
write_test_footer(tc_name)
@@ -818,17 +818,17 @@ def test_bgp_local_nexthop_p1_tc14_ebgp(request):
step("Verify R2 BGP table has IPv4 route")
dut = "r2"
result = verify_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB of R2".format(tc_name)
step(" Verify route did not install in the R3 BGP table, RIB/FIB")
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4, expected=False)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in BGP RIB of R2".format(tc_name)
result = verify_rib(tgen, addr_type, dut, input_dict_4, expected=False)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB of R2".format(tc_name)
write_test_footer(tc_name)
@@ -889,7 +889,7 @@ def test_frr_intf_name_as_gw_gap_tc4_ebgp_p0(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, next_hop=nh
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
input_dict_nh = {
@@ -902,7 +902,7 @@ def test_frr_intf_name_as_gw_gap_tc4_ebgp_p0(request):
}
}
result = verify_ip_nht(tgen, input_dict_nh)
- assert result is True, "Testcase {} : Failed \nError: Nexthop is"
+ assert result is True, "Testcase {} : Failed \nError: Nexthop is" \
" missing in RIB".format(tc_name)
step(
@@ -925,7 +925,7 @@ def test_frr_intf_name_as_gw_gap_tc4_ebgp_p0(request):
next_hop=nh,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
shutdown_bringup_interface(tgen, dut, intf, True)
@@ -970,7 +970,7 @@ def test_frr_intf_name_as_gw_gap_tc4_ebgp_p0(request):
next_hop=nh,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes"
+ assert result is not True, "Testcase {} : Failed \nError: Routes" \
" still present in RIB".format(tc_name)
write_test_footer(tc_name)
@@ -1034,7 +1034,7 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Configure route-map on R2 with allow tag1 and deny tag2")
@@ -1116,7 +1116,7 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_0, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route with "
+ assert result is not True, "Testcase {} : Failed \nError: Route with " \
"tag 4002 is still present in RIB".format(tc_name)
dut = "r2"
@@ -1125,7 +1125,7 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request):
}
result = verify_rib(tgen, addr_type, dut, input_dict_0, protocol=protocol)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
"tag 4001 is missing in RIB".format(tc_name)
step("Modify the route-map to allow tag2 and deny tag1")
@@ -1164,7 +1164,7 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request):
}
result = verify_rib(tgen, addr_type, dut, input_dict_0, protocol=protocol)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
"tag 4002 is missing in RIB".format(tc_name)
input_dict_1 = {
@@ -1173,8 +1173,8 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_1, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route with "
- "tag 4001 is still present in RIB".format(tc_name, result)
+ assert result is not True, "Testcase {} : Failed \nError: Route with " \
+ "tag 4001 is still present in RIB".format(tc_name)
step("Configure one static route with 2 ECMP nexthop N1 and N2")
step("For N1 configure tag 1 and for N2 configure tag 2")
@@ -1213,7 +1213,7 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("shut/no shut of tag1 and tag2 nexthop")
diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py
index 5d4950a70e..9a597484d9 100644
--- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py
+++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py
@@ -88,7 +88,6 @@ NEXT_HOP_IP = {}
pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
-
class CreateTopo(Topo):
"""
Test CreateTopo - topology 1.
@@ -109,7 +108,7 @@ def setup_module(mod):
Set up the pytest environment.
* `mod`: module name
"""
- global topo
+
testsuite_run_time = time.asctime(time.localtime(time.time()))
logger.info("Testsuite start time: {}".format(testsuite_run_time))
logger.info("=" * 40)
@@ -135,8 +134,7 @@ def setup_module(mod):
pytest.skip(error_msg)
# Checking BGP convergence
- global BGP_CONVERGENCE
- global ADDR_TYPES
+
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
@@ -173,7 +171,7 @@ def teardown_module(mod):
# Tests starting
#
#####################################################
-def static_routes_rmap_pfxlist_p0_tc7_ebgp(request):
+def test_static_routes_rmap_pfxlist_p0_tc7_ebgp(request):
"""
Verify static route are blocked from route-map & prefix-list applied in BGP
nbrs
@@ -200,7 +198,7 @@ def static_routes_rmap_pfxlist_p0_tc7_ebgp(request):
)
for addr_type in ADDR_TYPES:
- # Api call to modfiy BGP timerse
+ # Api call to modify BGP timers
input_dict = {
"r2": {
"bgp": {
@@ -241,7 +239,7 @@ def static_routes_rmap_pfxlist_p0_tc7_ebgp(request):
step(" All BGP nbrs are down as authentication is mismatch on both" " the sides")
bgp_convergence = verify_bgp_convergence(tgen, topo, expected=False)
- assert bgp_convergence is not True, "Testcase {} : "
+ assert bgp_convergence is not True, "Testcase {} : " \
"Failed \n BGP nbrs must be down. Error: {}".format(tc_name, bgp_convergence)
step(
@@ -337,7 +335,7 @@ def static_routes_rmap_pfxlist_p0_tc7_ebgp(request):
"show ip prefix list"
)
result = verify_prefix_lists(tgen, input_dict_2)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
" Error: {}".format(tc_name, result)
step("Redistribute all the routes (connected, static)")
@@ -588,7 +586,7 @@ def static_routes_rmap_pfxlist_p0_tc7_ebgp(request):
result4 = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
)
- assert result4 is not True, "Testcase {} : Failed , VM1 route is "
+ assert result4 is not True, "Testcase {} : Failed , VM1 route is " \
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
step(
@@ -964,7 +962,7 @@ def static_routes_rmap_pfxlist_p0_tc7_ebgp(request):
)
input_dict = {"r1": {"static_routes": [{"network": ntwk_r2_vm1}]}}
result4 = verify_rib(tgen, addr_type, dut, input_dict)
- assert result4 is True, "Testcase {} : Failed , VM1 route is "
+ assert result4 is True, "Testcase {} : Failed , VM1 route is " \
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
step("vm4 should be present in FRR2")
@@ -976,7 +974,7 @@ def static_routes_rmap_pfxlist_p0_tc7_ebgp(request):
)
input_dict = {"r1": {"static_routes": [{"network": ntwk_r2_vm1}]}}
result4 = verify_rib(tgen, addr_type, dut, input_dict)
- assert result4 is True, "Testcase {} : Failed , VM1 route is "
+ assert result4 is True, "Testcase {} : Failed , VM1 route is " \
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
dut = "r3"