Merge pull request #8441 from mjstapp/fix_topo_pylint1

This commit is contained in:
David Lamparter 2021-05-09 19:48:33 +02:00 committed by GitHub
commit 83f5d2581a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1131 additions and 747 deletions

View File

@ -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,16 +135,14 @@ 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 +154,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 +168,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 +182,7 @@ def populate_nh():
"ipv6": topo["routers"]["r1"]["links"]["r2-link1"]["ipv6"].split("/")[0],
},
}
return NEXT_HOP_IP
return next_hop_ip
#####################################################
@ -199,7 +205,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 +219,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 +239,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 +274,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 +290,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,12 +306,13 @@ 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"
" missing in RIB".format(tc_name)
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 +321,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 +340,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 +357,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,15 +367,19 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Configure the static route with nexthop N2")
input_dict_4 = {
@ -376,7 +387,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 +406,15 @@ 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"
" missing in RIB".format(tc_name)
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,15 +424,21 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
result = verify_rib(
tgen,
@ -431,27 +449,35 @@ 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"
" still present in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
dut = "r2"
step("No shut the nexthop interface N1")
@ -461,13 +487,14 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Shut nexthop interface N2")
intf = topo["routers"]["r2"]["links"]["r1-link1"]["interface"]
@ -478,7 +505,7 @@ 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["nh2"][addr_type]
nh = next_hop_ip["nh2"][addr_type]
result = verify_rib(
tgen,
@ -489,28 +516,36 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
step("No shut nexthop interface N2")
dut = "r2"
@ -520,24 +555,29 @@ 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"
" missing in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -553,19 +593,26 @@ 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"
" missing in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
write_test_footer(tc_name)
@ -583,7 +630,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 +639,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,33 +672,34 @@ 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"
"missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name)
rte2_nh2 = {
"r2": {
"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,8 +712,9 @@ 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"
"not active in RIB".format(tc_name)
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.")
step("Explicit route is added in R3 for R2 nexthop rechability")
@ -673,11 +722,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 +761,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 +784,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,26 +803,28 @@ 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"
"missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name)
rte2_nh2 = {
"r2": {
"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"
"not active in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
step("Configure the static route with nexthop N1")
rte1_nh1 = {
@ -781,7 +832,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 +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,
"delete": True,
}
@ -816,7 +867,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,15 +877,19 @@ 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"
" still present in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Configure the static route with nexthop N2")
rte2_nh2 = {
@ -842,7 +897,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 +917,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,15 +927,19 @@ 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"
" still present in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("No shut the nexthop interface N1")
shutdown_bringup_interface(tgen, dut, intf, True)
@ -889,13 +948,14 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Shut nexthop interface N2")
intf = topo["routers"]["r2"]["links"]["r1-link1"]["interface"]
@ -906,7 +966,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,15 +977,19 @@ 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"
" still present in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("No shut nexthop interface N2")
shutdown_bringup_interface(tgen, dut, intf, True)
@ -939,33 +1003,34 @@ 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"
"missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name)
rte2_nh2 = {
"r2": {
"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,8 +1043,9 @@ 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"
"not active in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
dut = "r3"
protocol = "bgp"
@ -994,8 +1060,9 @@ 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"
"not active in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
dut = "r2"
step("Reload the FRR router")
@ -1013,39 +1080,41 @@ 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"
"missing in RIB".format(tc_name)
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"
"missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name)
rte2_nh2 = {
"r2": {
"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,14 +1127,16 @@ 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"
"not active in RIB".format(tc_name)
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"
"not active in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
result = verify_rib(
tgen,
@ -1077,8 +1148,9 @@ 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"
"not active in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
write_test_footer(tc_name)
@ -1148,14 +1220,20 @@ 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"
" still present in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
step(
"Configure 2 links/interfaces between R1 and R3 , keep one"
@ -1206,15 +1284,19 @@ 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"
" missing in BGP RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1249,15 +1331,19 @@ 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"
" missing in BGP RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name)
write_test_footer(tc_name)

View File

@ -314,8 +314,9 @@ 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"
" missing in RIB".format(tc_name)
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:
@ -338,8 +339,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step(
"Remove the static route configured with nexthop N1 to N8, one"
@ -384,8 +386,11 @@ 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"
" still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -410,8 +415,11 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed\nError: Routes are" " missing in RIB".format(
tc_name
)
protocol = "static"
step("Random shut of the nexthop interfaces")
@ -455,8 +463,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Remove random static route with all the nexthop")
dut = "r2"
@ -493,8 +502,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
for addr_type in ADDR_TYPES:
input_dict_4 = {
@ -546,8 +556,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Remove the redistribute static knob")
for addr_type in ADDR_TYPES:
@ -580,8 +591,11 @@ 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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
tc_name
)
write_test_footer(tc_name)
@ -661,8 +675,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
@ -679,8 +694,9 @@ 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 "
" are missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
step(
"Remove the static route configured with nexthop N1 to N8, one"
@ -723,8 +739,11 @@ 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"
" still present in RIB".format(tc_name)
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,8 +789,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type])
@ -787,8 +807,9 @@ 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 "
" are missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
@ -815,8 +836,11 @@ 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"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -826,8 +850,9 @@ 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"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
dut = "r2"
protocol = "static"
@ -955,8 +980,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
@ -971,8 +997,9 @@ 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 "
" are missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
step(
"Remove the static route configured with nexthop N1 to N8, one"
@ -1015,8 +1042,11 @@ 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"
" still present in RIB".format(tc_name)
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,8 +1092,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type])
@ -1077,8 +1108,9 @@ 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 "
" are missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
@ -1105,8 +1137,11 @@ 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"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1116,8 +1151,9 @@ 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"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
dut = "r2"
protocol = "static"
@ -1230,8 +1266,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Verify that highest AD nexthop are inactive")
nh = []
@ -1249,8 +1286,9 @@ 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 "
" are missing in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1312,8 +1350,11 @@ 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"
" still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1355,8 +1396,10 @@ 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 "
"lowest AD is missing in RIB".format(tc_name)
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")
randnum = random.randint(0, 7)
@ -1383,8 +1426,11 @@ 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"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1394,8 +1440,9 @@ 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"
"Error: Routes are missing in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1434,8 +1481,10 @@ 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 "
" is still present in RIB".format(tc_name)
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")
for nhp in range(1, 9):
@ -1460,8 +1509,10 @@ 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 "
" is still present in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route "
" is still present in RIB".format(tc_name)
)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -1577,8 +1628,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Verify that highest AD nexthop are inactive")
nh = []
@ -1594,8 +1646,9 @@ def test_static_route_delete_p0_tc11_ebgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are missing in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1647,8 +1700,11 @@ 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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
tc_name
)
for addr_type in ADDR_TYPES:
for nhp in range(1, 9):
@ -1715,8 +1771,12 @@ def test_static_route_delete_p0_tc11_ebgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still active in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still active in RIB".format(
tc_name
)
write_test_footer(tc_name)

View File

@ -297,8 +297,9 @@ 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"
" missing in RIB".format(tc_name)
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:
input_dict_2 = {
@ -351,8 +352,11 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still present in RIB".format(tc_name)
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,8 +383,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
@ -407,8 +412,11 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \n"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -418,8 +426,9 @@ 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"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -429,8 +438,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
write_test_footer(tc_name)
@ -509,8 +519,10 @@ 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 "
" lowest AD is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
" lowest AD is missing in RIB".format(tc_name)
)
nh = []
for nhp in range(2, 9):
@ -525,8 +537,10 @@ 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 "
" with high AD are active in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -569,8 +583,10 @@ 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 "
" lowest AD is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
" lowest AD is missing in RIB".format(tc_name)
)
step(
"Remove the static route configured with nexthop N1 to N8, one"
@ -613,8 +629,11 @@ 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"
" still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -655,8 +674,10 @@ 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 "
" lowest AD is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
" lowest AD is missing in RIB".format(tc_name)
)
nh = []
for nhp in range(2, 9):
@ -671,8 +692,10 @@ 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 "
" with high AD are active in RIB".format(tc_name)
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")
randnum = random.randint(0, 7)
@ -699,8 +722,11 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \n"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -710,8 +736,9 @@ 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"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -740,8 +767,10 @@ 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 "
" lowest AD is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
" lowest AD is missing in RIB".format(tc_name)
)
nh = []
for nhp in range(2, 9):
@ -756,8 +785,10 @@ 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 "
" with high AD are active in RIB".format(tc_name)
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,18 +849,25 @@ 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"
" missing in RIB of R2".format(tc_name)
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"
" still present in BGP RIB of R2".format(tc_name)
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"
" still present in RIB of R2".format(tc_name)
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,8 +927,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
input_dict_nh = {
"r1": {
@ -902,8 +941,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Nexthop is" " missing in RIB".format(tc_name)
step(
"Shut / no shut IPv4 and IPv6 static next hop interface from"
@ -925,8 +965,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
shutdown_bringup_interface(tgen, dut, intf, True)
@ -970,8 +1011,11 @@ 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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes" " still present in RIB".format(
tc_name
)
write_test_footer(tc_name)
@ -1034,8 +1078,9 @@ 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"
" missing in RIB".format(tc_name)
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,8 +1161,10 @@ 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 "
"tag 4002 is still present in RIB".format(tc_name)
assert result is not True, (
"Testcase {} : Failed \nError: Route with "
"tag 4002 is still present in RIB".format(tc_name)
)
dut = "r2"
input_dict_1 = {
@ -1125,8 +1172,10 @@ 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 "
"tag 4001 is missing in RIB".format(tc_name)
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")
# Create route map
@ -1164,8 +1213,10 @@ 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 "
"tag 4002 is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
"tag 4002 is missing in RIB".format(tc_name)
)
input_dict_1 = {
"r2": {"static_routes": [{"network": NETWORK[addr_type], "tag": 4001}]}
@ -1173,8 +1224,10 @@ 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,8 +1266,9 @@ 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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("shut/no shut of tag1 and tag2 nexthop")

View File

@ -109,7 +109,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 +135,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 +172,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 +199,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,8 +240,11 @@ 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 {} : "
"Failed \n BGP nbrs must be down. Error: {}".format(tc_name, bgp_convergence)
assert (
bgp_convergence is not True
), "Testcase {} : " "Failed \n BGP nbrs must be down. Error: {}".format(
tc_name, bgp_convergence
)
step(
"Configure 4 IPv4 and 4 IPv6 nbrs with macthing password "
@ -337,8 +339,9 @@ 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"
" Error: {}".format(tc_name, result)
assert result is not True, "Testcase {} : Failed \n" " Error: {}".format(
tc_name, result
)
step("Redistribute all the routes (connected, static)")
input_dict_2_r1 = {
@ -588,8 +591,10 @@ 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 "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
assert result4 is not True, (
"Testcase {} : Failed , VM1 route is "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
)
step(
"VM4 and VM6 IPV4 and IPv6 address are present in local and "
@ -964,8 +969,10 @@ 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 "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
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")
dut = "r2"
@ -976,8 +983,10 @@ 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 "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
assert result4 is True, (
"Testcase {} : Failed , VM1 route is "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
)
dut = "r3"
protocol = "bgp"

View File

@ -242,8 +242,9 @@ def test_static_route_2nh_p0_tc_1_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Configure IBGP IPv4 peering between R2 and R3 router.")
step("Configure redistribute static in BGP on R2 router")
@ -296,15 +297,19 @@ def test_static_route_2nh_p0_tc_1_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
tc_name
)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Configure the static route with nexthop N1")
@ -359,15 +364,19 @@ def test_static_route_2nh_p0_tc_1_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
tc_name
)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Configure the static route with nexthop N2")
input_dict_4 = {
@ -398,8 +407,9 @@ def test_static_route_2nh_p0_tc_1_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
nh = NEXT_HOP_IP["nh1"][addr_type]
result = verify_rib(
@ -411,15 +421,21 @@ def test_static_route_2nh_p0_tc_1_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
result = verify_rib(
tgen,
@ -430,27 +446,35 @@ def test_static_route_2nh_p0_tc_1_ibgp(request):
next_hop=nh,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Route is"
" still present in RIB".format(tc_name)
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]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
assert result is True, "Testcase {} : Failed \nError: Routes is"
" missing in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
dut = "r2"
step("No shut the nexthop interface N1")
@ -465,8 +489,9 @@ def test_static_route_2nh_p0_tc_1_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Shut nexthop interface N2")
intf = topo["routers"]["r2"]["links"]["r1-link1"]["interface"]
@ -488,8 +513,11 @@ def test_static_route_2nh_p0_tc_1_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
tc_name
)
nh = [NEXT_HOP_IP["nh1"][addr_type]]
dut = "r2"
@ -497,19 +525,24 @@ def test_static_route_2nh_p0_tc_1_ibgp(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"
" missing in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
step("No shut nexthop interface N2")
dut = "r2"
@ -524,19 +557,24 @@ def test_static_route_2nh_p0_tc_1_ibgp(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"
" missing in RIB".format(tc_name)
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"
" missing in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -552,19 +590,26 @@ def test_static_route_2nh_p0_tc_1_ibgp(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"
" missing in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
tc_name
)
write_test_footer(tc_name)
@ -636,8 +681,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
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"
"missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name)
rte2_nh2 = {
"r2": {
@ -663,8 +709,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
"not active in RIB".format(tc_name)
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.")
step("Explicit route is added in R3 for R2 nexthop rechability")
@ -753,8 +800,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
"missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name)
rte2_nh2 = {
"r2": {
@ -771,8 +819,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
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"
"not active in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
step("Configure the static route with nexthop N1")
rte1_nh1 = {
@ -825,15 +874,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
tc_name
)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Configure the static route with nexthop N2")
rte2_nh2 = {
@ -871,15 +924,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
tc_name
)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("No shut the nexthop interface N1")
shutdown_bringup_interface(tgen, dut, intf, True)
@ -893,8 +950,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("Shut nexthop interface N2")
intf = topo["routers"]["r2"]["links"]["r1-link1"]["interface"]
@ -916,15 +974,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
tc_name
)
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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name)
step("No shut nexthop interface N2")
shutdown_bringup_interface(tgen, dut, intf, True)
@ -950,8 +1012,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
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"
"missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name)
rte2_nh2 = {
"r2": {
@ -977,8 +1040,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
"not active in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
dut = "r3"
protocol = "bgp"
@ -993,8 +1057,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
"not active in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
dut = "r2"
step("Reload the FRR router")
@ -1024,14 +1089,16 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
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"
"missing in RIB".format(tc_name)
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"
"missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name)
rte2_nh2 = {
"r2": {
@ -1057,14 +1124,16 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
"not active in RIB".format(tc_name)
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"
"not active in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
result = verify_rib(
tgen,
@ -1076,8 +1145,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes is"
"not active in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name)
write_test_footer(tc_name)

View File

@ -318,8 +318,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
next_hop=nh_all[addr_type],
protocol=protocol,
)
assert result is True, "Testcase {} : Failed \nError: Routes are"
" missing in RIB".format(tc_name)
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:
@ -342,8 +343,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step(
"Remove the static route configured with nexthop N1 to N8, one"
@ -388,8 +390,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed\nError: Routes is"
" still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -414,8 +419,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed\nError: Routes are" " missing in RIB".format(
tc_name
)
protocol = "static"
step("Random shut of the nexthop interfaces")
@ -423,7 +431,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
# Shutdown interface
dut = "r2"
step(
" interface which is about to be shut no shut between r1 and r2 is " "%s",
" interface which is about to be shut no shut between r1 and r2 is %s",
topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"],
)
intf = topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"]
@ -459,8 +467,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
next_hop=nh_all[addr_type],
protocol=protocol,
)
assert result is True, "Testcase {} : Failed \nError: Routes are"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Remove random static route with all the nexthop")
dut = "r2"
@ -497,8 +506,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
for addr_type in ADDR_TYPES:
input_dict_4 = {
@ -550,8 +560,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
next_hop=nh_all[addr_type],
protocol=protocol,
)
assert result is True, "Testcase {} : Failed \nError: Routes are"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Remove the redistribute static knob")
for addr_type in ADDR_TYPES:
@ -584,8 +595,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
tc_name
)
write_test_footer(tc_name)
@ -665,8 +679,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
@ -683,8 +698,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
wait=2,
attempts=3,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
step(
"Remove the static route configured with nexthop N1 to N8, one"
@ -727,8 +743,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still present in RIB".format(tc_name)
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")
@ -774,8 +793,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type])
@ -791,8 +811,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
wait=2,
attempts=3,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
@ -819,8 +840,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \n"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -830,8 +854,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
assert result is True, "Testcase {} : Failed \n"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
protocol = "bgp"
# this is next hop reachability route in r3 as we are using ibgp
@ -856,8 +881,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
for addr_type in ADDR_TYPES:
input_dict_4 = {"r2": {"static_routes": [{"network": PREFIX1[addr_type]}]}}
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert result is True, "Testcase {} : Failed \n"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
protocol = "static"
dut = "r2"
@ -866,7 +892,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {}: Failed \n " "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {}: Failed \n Error: Routes are missing in RIB".format(tc_name)
protocol = "bgp"
dut = "r3"
@ -875,7 +901,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {}: Failed \n " "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {}: Failed \n Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -888,7 +914,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \nError: Routes are still present in RIB".format(
tc_name
)
@ -912,7 +938,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \nError: Routes are still present in RIB".format(
tc_name
)
@ -923,7 +949,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \nError: Routes are still present in RIB".format(
tc_name
)
@ -964,8 +990,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" strill present in RIB of R3".format(tc_name)
assert result is not True, (
"Testcase {} : Failed \nError: Routes are"
" strill present in RIB of R3".format(tc_name)
)
write_test_footer(tc_name)
@ -1060,8 +1088,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
@ -1076,8 +1105,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
step(
"Remove the static route configured with nexthop N1 to N8, one"
@ -1120,8 +1150,11 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still present in RIB".format(tc_name)
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")
@ -1167,8 +1200,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type])
@ -1182,8 +1216,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are missing in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
@ -1210,8 +1245,11 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \n"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1221,8 +1259,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
assert result is True, "Testcase {} : Failed \n"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
dut = "r2"
protocol = "bgp"
@ -1249,8 +1288,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
for addr_type in ADDR_TYPES:
input_dict_4 = {"r2": {"static_routes": [{"network": PREFIX1[addr_type]}]}}
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert result is True, "Testcase {} : Failed \n"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
protocol = "static"
dut = "r2"
@ -1259,7 +1299,7 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {}: Failed \n " "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {}: Failed \n Error: Routes are missing in RIB".format(tc_name)
protocol = "bgp"
dut = "r3"
@ -1268,7 +1308,7 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {}: Failed \n " "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {}: Failed \n Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -1281,7 +1321,7 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \n Error: Routes are still present in RIB".format(
tc_name
)
@ -1305,7 +1345,7 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \n Error: Routes are still present in RIB".format(
tc_name
)
@ -1316,7 +1356,7 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \n Error: Routes are still present in RIB".format(
tc_name
)
@ -1357,8 +1397,10 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still present in RIB of R3".format(tc_name)
assert result is not True, (
"Testcase {} : Failed \nError: Routes are"
" still present in RIB of R3".format(tc_name)
)
write_test_footer(tc_name)
@ -1453,8 +1495,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Verify that highest AD nexthop are inactive")
nh = []
@ -1472,8 +1515,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
wait=2,
attempts=3,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are missing in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1535,8 +1579,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1578,8 +1625,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(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 "
"lowest AD is missing in RIB".format(tc_name)
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")
randnum = random.randint(0, 7)
@ -1606,8 +1655,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \n"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1617,8 +1669,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
assert result is True, "Testcase {} : Failed \n"
"Error: Routes are missing in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1657,8 +1710,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Route "
" is still present in RIB".format(tc_name)
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")
for nhp in range(1, 9):
@ -1683,8 +1738,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(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 "
" is still present in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route "
" is still present in RIB".format(tc_name)
)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -1704,9 +1761,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Route " " is missing in RIB".format(
tc_name
)
), "Testcase {} : Failed \nError: Route is missing in RIB".format(tc_name)
step("Remove the redistribute static knob")
for addr_type in ADDR_TYPES:
@ -1750,8 +1805,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
tc_name
)
write_test_footer(tc_name)
@ -1845,8 +1903,9 @@ def test_static_route_delete_p0_tc11_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Verify that highest AD nexthop are inactive")
nh = []
@ -1862,8 +1921,9 @@ def test_static_route_delete_p0_tc11_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are missing in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -1915,8 +1975,11 @@ def test_static_route_delete_p0_tc11_ibgp(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"
" still present in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
tc_name
)
for addr_type in ADDR_TYPES:
for nhp in range(1, 9):
@ -1983,8 +2046,12 @@ def test_static_route_delete_p0_tc11_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still active in RIB".format(tc_name)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still active in RIB".format(
tc_name
)
write_test_footer(tc_name)

View File

@ -298,8 +298,9 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(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"
" missing in RIB".format(tc_name)
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:
input_dict_2 = {
@ -352,8 +353,11 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still present in RIB".format(tc_name)
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")
@ -380,8 +384,9 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
@ -408,8 +413,11 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \n"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -419,8 +427,9 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
assert result is True, "Testcase {} : Failed \n"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -430,8 +439,9 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(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"
" missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
write_test_footer(tc_name)
@ -510,8 +520,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(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 "
" lowest AD is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
" lowest AD is missing in RIB".format(tc_name)
)
nh = []
for nhp in range(2, 9):
@ -526,8 +538,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" with high AD are active in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -570,8 +584,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(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 "
" lowest AD is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
" lowest AD is missing in RIB".format(tc_name)
)
step(
"Remove the static route configured with nexthop N1 to N8, one"
@ -614,8 +630,11 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -656,8 +675,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(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 "
" lowest AD is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
" lowest AD is missing in RIB".format(tc_name)
)
nh = []
for nhp in range(2, 9):
@ -672,8 +693,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" with high AD are active in RIB".format(tc_name)
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")
randnum = random.randint(0, 7)
@ -700,8 +723,11 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \n"
"Error: Routes are still present in RIB".format(tc_name)
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")
for addr_type in ADDR_TYPES:
@ -711,8 +737,9 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request):
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
assert result is True, "Testcase {} : Failed \n"
"Error: Routes are missing in RIB".format(tc_name)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
@ -741,8 +768,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(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 "
" lowest AD is missing in RIB".format(tc_name)
assert result is True, (
"Testcase {} : Failed \nError: Route with "
" lowest AD is missing in RIB".format(tc_name)
)
nh = []
for nhp in range(2, 9):
@ -757,8 +786,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request):
fib=True,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" with high AD are active in RIB".format(tc_name)
assert result is not True, (
"Testcase {} : Failed \nError: Routes "
" with high AD are active in RIB".format(tc_name)
)
step("Remove the redistribute static knob")
@ -796,8 +827,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request):
protocol=protocol,
expected=False,
)
assert result is not True, "Testcase {} : Failed \nError: Routes are"
" strill present in RIB of R3".format(tc_name)
assert result is not True, (
"Testcase {} : Failed \nError: Routes are"
" still present in RIB of R3".format(tc_name)
)
write_test_footer(tc_name)
@ -858,18 +891,25 @@ def test_bgp_local_nexthop_p1_tc14_ibgp(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"
" missing in RIB of R2".format(tc_name)
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"
" still present in BGP RIB of R2".format(tc_name)
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"
" still present in RIB of R2".format(tc_name)
assert result is not True, (
"Testcase {} : Failed \nError: Routes is"
" still present in RIB of R2".format(tc_name)
)
write_test_footer(tc_name)

View File

@ -239,8 +239,11 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(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 {} : "
"Failed \n BGP nbrs must be down. Error: {}".format(tc_name, bgp_convergence)
assert (
bgp_convergence is not True
), "Testcase {} : " "Failed \n BGP nbrs must be down. Error: {}".format(
tc_name, bgp_convergence
)
step(
"Configure 4 IPv4 and 4 IPv6 nbrs with macthing password "
@ -335,8 +338,9 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(request):
"show ip prefix list"
)
result = verify_prefix_lists(tgen, input_dict_2)
assert result is not True, "Testcase {} : Failed \n"
" Error: {}".format(tc_name, result)
assert result is not True, "Testcase {} : Failed \n" " Error: {}".format(
tc_name, result
)
step("Redistribute all the routes (connected, static)")
input_dict_2_r1 = {
@ -586,8 +590,10 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(request):
result4 = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
)
assert result4 is not True, "Testcase {} : Failed , VM1 route is "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
assert result4 is not True, (
"Testcase {} : Failed , VM1 route is "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
)
step(
"VM4 and VM6 IPV4 and IPv6 address are present in local and "
@ -962,8 +968,10 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(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 "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
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")
dut = "r2"
@ -974,8 +982,10 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(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 "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
assert result4 is True, (
"Testcase {} : Failed , VM1 route is "
"not filtered out via prefix list. \n Error: {}".format(tc_name, result4)
)
dut = "r3"
protocol = "bgp"