tests: Applied black formatting

Applied black formatting to suites,
which were missing.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
This commit is contained in:
Kuldeep Kashyap 2022-10-11 12:17:54 +05:30
parent d63c7094e4
commit 84ab38367d
4 changed files with 244 additions and 244 deletions

View File

@ -56,15 +56,20 @@ from lib.bgp import (
verify_graceful_restart_timers, verify_graceful_restart_timers,
verify_bgp_convergence_from_running_config, verify_bgp_convergence_from_running_config,
) )
# Import common_config to use commomnly used APIs # Import common_config to use commomnly used APIs
from lib.common_config import (create_common_configuration, from lib.common_config import (
InvalidCLIError, retry, create_common_configuration,
generate_ips, FRRCFG_FILE, InvalidCLIError,
find_interface_with_greater_ip, retry,
check_address_types, generate_ips,
validate_ip_address, FRRCFG_FILE,
run_frr_cmd, find_interface_with_greater_ip,
get_frr_ipv6_linklocal) check_address_types,
validate_ip_address,
run_frr_cmd,
get_frr_ipv6_linklocal,
)
from lib.common_config import ( from lib.common_config import (
write_test_header, write_test_header,
@ -108,8 +113,7 @@ NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"}
PREFERRED_NEXT_HOP = "link_local" PREFERRED_NEXT_HOP = "link_local"
def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
dut, peer):
""" """
result = configure_gr_followed_by_clear(tgen, topo, dut) result = configure_gr_followed_by_clear(tgen, topo, dut)
assert result is True, \ assert result is True, \
@ -118,8 +122,7 @@ def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,
""" """
result = create_router_bgp(tgen, topo, input_dict) result = create_router_bgp(tgen, topo, input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format( assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
tc_name, result)
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
clear_bgp(tgen, addr_type, dut) clear_bgp(tgen, addr_type, dut)
@ -131,6 +134,7 @@ def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,
return True return True
def verify_stale_routes_list(tgen, addr_type, dut, input_dict): def verify_stale_routes_list(tgen, addr_type, dut, input_dict):
""" """
This API is use verify Stale routes on refering the network with next hop value This API is use verify Stale routes on refering the network with next hop value
@ -175,8 +179,8 @@ def verify_stale_routes_list(tgen, addr_type, dut, input_dict):
command = "show bgp" command = "show bgp"
# Static routes # Static routes
sleep(2) sleep(2)
logger.info('Checking router {} BGP RIB:'.format(dut)) logger.info("Checking router {} BGP RIB:".format(dut))
if 'static_routes' in input_dict[routerInput]: if "static_routes" in input_dict[routerInput]:
static_routes = input_dict[routerInput]["static_routes"] static_routes = input_dict[routerInput]["static_routes"]
for static_route in static_routes: for static_route in static_routes:
found_routes = [] found_routes = []
@ -185,30 +189,27 @@ def verify_stale_routes_list(tgen, addr_type, dut, input_dict):
nh_found = False nh_found = False
vrf = static_route.setdefault("vrf", None) vrf = static_route.setdefault("vrf", None)
community = static_route.setdefault("community", None) community = static_route.setdefault("community", None)
largeCommunity = \ largeCommunity = static_route.setdefault("largeCommunity", None)
static_route.setdefault("largeCommunity", None)
if vrf: if vrf:
cmd = "{} vrf {} {}".\ cmd = "{} vrf {} {}".format(command, vrf, addr_type)
format(command, vrf, addr_type)
if community: if community:
cmd = "{} community {}".\ cmd = "{} community {}".format(cmd, community)
format(cmd, community)
if largeCommunity: if largeCommunity:
cmd = "{} large-community {}".\ cmd = "{} large-community {}".format(cmd, largeCommunity)
format(cmd, largeCommunity)
else: else:
cmd = "{} {}".\ cmd = "{} {}".format(command, addr_type)
format(command, addr_type)
cmd = "{} json".format(cmd) cmd = "{} json".format(cmd)
rib_routes_json = run_frr_cmd(rnode, cmd, isjson=True) rib_routes_json = run_frr_cmd(rnode, cmd, isjson=True)
# Verifying output dictionary rib_routes_json is not empty # Verifying output dictionary rib_routes_json is not empty
if bool(rib_routes_json) == False: if bool(rib_routes_json) == False:
errormsg = "[DUT: {}]: No route found in rib of router". \ errormsg = "[DUT: {}]: No route found in rib of router".format(
format(router) router
)
return errormsg return errormsg
elif "warning" in rib_routes_json: elif "warning" in rib_routes_json:
errormsg = "[DUT: {}]: {}". \ errormsg = "[DUT: {}]: {}".format(
format(router, rib_routes_json["warning"]) router, rib_routes_json["warning"]
)
return errormsg return errormsg
network = static_route["network"] network = static_route["network"]
if "no_of_ip" in static_route: if "no_of_ip" in static_route:
@ -227,15 +228,18 @@ def verify_stale_routes_list(tgen, addr_type, dut, input_dict):
st_found = True st_found = True
found_routes.append(st_rt) found_routes.append(st_rt)
for mnh in range(0, len(rib_routes_json[ for mnh in range(0, len(rib_routes_json["routes"][st_rt])):
'routes'][st_rt])): found_hops.append(
found_hops.append([rib_r[ [
"ip"] for rib_r in rib_routes_json[ rib_r["ip"]
'routes'][st_rt][ for rib_r in rib_routes_json["routes"][st_rt][
mnh]["nexthops"]]) mnh
]["nexthops"]
]
)
return found_hops return found_hops
else: else:
return 'error msg - no hops found' return "error msg - no hops found"
def setup_module(mod): def setup_module(mod):
@ -302,6 +306,8 @@ def teardown_module(mod):
"Testsuite end time: {}".format(time.asctime(time.localtime(time.time()))) "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
) )
logger.info("=" * 40) logger.info("=" * 40)
################################################################################ ################################################################################
# #
# TEST CASES # TEST CASES
@ -318,175 +324,160 @@ def test_bgp_gr_stale_routes(request):
step("Creating 5 static Routes in Router R3 with NULL0 as Next hop") step("Creating 5 static Routes in Router R3 with NULL0 as Next hop")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
input_dict_1 = { input_dict_1 = {
"r3": { "r3": {
"static_routes": [{ "static_routes": [
"network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], {
"next_hop": NEXT_HOP_IP[addr_type] "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]],
}, "next_hop": NEXT_HOP_IP[addr_type],
{ },
"network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], {
"next_hop": NEXT_HOP_IP[addr_type] "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]],
}, "next_hop": NEXT_HOP_IP[addr_type],
{ },
"network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], {
"next_hop": NEXT_HOP_IP[addr_type] "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]],
}, "next_hop": NEXT_HOP_IP[addr_type],
{ },
"network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], {
"next_hop": NEXT_HOP_IP[addr_type] "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]],
}, "next_hop": NEXT_HOP_IP[addr_type],
{ },
"network": [NETWORK5_1[addr_type]] + [NETWORK5_2[addr_type]], {
"next_hop": NEXT_HOP_IP[addr_type] "network": [NETWORK5_1[addr_type]] + [NETWORK5_2[addr_type]],
}] "next_hop": NEXT_HOP_IP[addr_type],
},
]
} }
} }
result = create_static_routes(tgen, input_dict_1) result = create_static_routes(tgen, input_dict_1)
assert result is True, 'Testcase {} : Failed \n Error: {}'.format( assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result) tc_name, result
)
step("verifying Created Route at R3 in VRF default") step("verifying Created Route at R3 in VRF default")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
dut = 'r3' dut = "r3"
input_dict_1= {'r3': topo['routers']['r3']} input_dict_1 = {"r3": topo["routers"]["r3"]}
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
assert result is True, \ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
"Testcase {} :Failed \n Error {}". \ # done
format(tc_name, result)
#done
step("verifying Created Route at R2 in VRF default") step("verifying Created Route at R2 in VRF default")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
dut = 'r2' dut = "r2"
input_dict_1= {'r2': topo['routers']['r2']} input_dict_1 = {"r2": topo["routers"]["r2"]}
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
assert result is True, \ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
"Testcase {} :Failed \n Error {}". \
format(tc_name, result)
step("importing vrf RED on R2 under Address Family") step("importing vrf RED on R2 under Address Family")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
input_import_vrf={ input_import_vrf = {
"r2": { "r2": {
"bgp": [ "bgp": [
{ {
"local_as": 200, "local_as": 200,
"vrf": "RED", "vrf": "RED",
"address_family": {addr_type: {"unicast": {"import": {"vrf": "default"}}}}, "address_family": {
addr_type: {"unicast": {"import": {"vrf": "default"}}}
},
} }
] ]
} }
} }
result = create_router_bgp(tgen, topo,input_import_vrf) result = create_router_bgp(tgen, topo, input_import_vrf)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) assert result is True, "Testcase {} : Failed \n Error: {}".format(
#done tc_name, result
)
# done
step("verifying static Routes at R2 in VRF RED") step("verifying static Routes at R2 in VRF RED")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
dut = 'r2' dut = "r2"
input_dict_1= {'r2': topo['routers']['r2']} input_dict_1 = {"r2": topo["routers"]["r2"]}
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
assert result is True, \ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
"Testcase {} :Failed \n Error {}". \
format(tc_name, result)
step("verifying static Routes at R1 in VRF RED") step("verifying static Routes at R1 in VRF RED")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
dut = 'r1' dut = "r1"
input_dict_1= {'r1': topo['routers']['r1']} input_dict_1 = {"r1": topo["routers"]["r1"]}
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
assert result is True, \ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
"Testcase {} :Failed \n Error {}". \
format(tc_name, result)
step("Configuring Graceful restart at R2 and R3 ") step("Configuring Graceful restart at R2 and R3 ")
input_dict = { input_dict = {
"r2": { "r2": {
"bgp": { "bgp": {
"local_as": "200", "local_as": "200",
"graceful-restart": { "graceful-restart": {
"graceful-restart": True, "graceful-restart": True,
} },
} }
}, },
"r3": { "r3": {
"bgp": { "bgp": {"local_as": "300", "graceful-restart": {"graceful-restart": True}}
"local_as": "300", },
"graceful-restart": {
"graceful-restart": True
}
}
}
} }
configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,dut='r2', peer='r3') configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r2", peer="r3")
step("verify Graceful restart at R2") step("verify Graceful restart at R2")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_graceful_restart(tgen, topo, addr_type, input_dict, result = verify_graceful_restart(
dut='r2', peer='r3') tgen, topo, addr_type, input_dict, dut="r2", peer="r3"
assert result is True, \ )
"Testcase {} :Failed \n Error {}". \ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
format(tc_name, result)
step("verify Graceful restart at R3") step("verify Graceful restart at R3")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_graceful_restart(tgen, topo, addr_type, input_dict, result = verify_graceful_restart(
dut='r3', peer='r2') tgen, topo, addr_type, input_dict, dut="r3", peer="r2"
assert result is True, \ )
"Testcase {} :Failed \n Error {}". \ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
format(tc_name, result)
step("Configuring Graceful-restart-disable at R3") step("Configuring Graceful-restart-disable at R3")
input_dict = { input_dict = {
"r2": { "r2": {
"bgp": { "bgp": {
"local_as": "200", "local_as": "200",
"graceful-restart": { "graceful-restart": {
"graceful-restart": False, "graceful-restart": False,
} },
} }
}, },
"r3": { "r3": {
"bgp": { "bgp": {"local_as": "300", "graceful-restart": {"graceful-restart": False}}
"local_as": "300", },
"graceful-restart": {
"graceful-restart": False
}
}
}
} }
configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,dut='r3', peer='r2') configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r3", peer="r2")
step("Verify Graceful-restart-disable at R3") step("Verify Graceful-restart-disable at R3")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_graceful_restart(tgen, topo, addr_type, input_dict, result = verify_graceful_restart(
dut='r3', peer='r2') tgen, topo, addr_type, input_dict, dut="r3", peer="r2"
assert result is True, \ )
"Testcase {} :Failed \n Error {}". \ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
format(tc_name, result)
for iteration in range(5): for iteration in range(5):
step("graceful-restart-disable:True at R3") step("graceful-restart-disable:True at R3")
input_dict = { input_dict = {
"r3": { "r3": {
"bgp": { "bgp": {
"graceful-restart": { "graceful-restart": {
"graceful-restart-disable": True, "graceful-restart-disable": True,
}
} }
} }
}
} }
configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, configure_gr_followed_by_clear(
dut='r3', peer='r2') tgen, topo, input_dict, tc_name, dut="r3", peer="r2"
)
step("Verifying Routes at R2 on enabling GRD") step("Verifying Routes at R2 on enabling GRD")
dut = 'r2' dut = "r2"
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
input_dict_1= {'r2': topo['routers']['r2']} input_dict_1 = {"r2": topo["routers"]["r2"]}
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) assert result is True, "Testcase {} :Failed \n Error {}".format(
tc_name, result
)
step("Verify stale Routes in Router R2 enabling GRD") step("Verify stale Routes in Router R2 enabling GRD")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
@ -495,39 +486,45 @@ def test_bgp_gr_stale_routes(request):
verify_nh_for_static_rtes = { verify_nh_for_static_rtes = {
"r3": { "r3": {
"static_routes": [ "static_routes": [
{ {
"network": [NETWORK1_1[addr_type]], "network": [NETWORK1_1[addr_type]],
"no_of_ip": 2, "no_of_ip": 2,
"vrf": "RED" "vrf": "RED",
} }
] ]
} }
} }
bgp_rib_next_hops = verify_stale_routes_list( bgp_rib_next_hops = verify_stale_routes_list(
tgen, addr_type, dut, verify_nh_for_static_rtes) tgen, addr_type, dut, verify_nh_for_static_rtes
assert (len(bgp_rib_next_hops)== 1) is True, "Testcase {} : Failed \n Error: {}".format( )
tc_name, bgp_rib_next_hops,expected=True) assert (
len(bgp_rib_next_hops) == 1
) is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, bgp_rib_next_hops, expected=True
)
step("graceful-restart-disable:False at R3") step("graceful-restart-disable:False at R3")
input_dict = { input_dict = {
"r3": { "r3": {
"bgp": { "bgp": {
"graceful-restart": { "graceful-restart": {
"graceful-restart-disable": False, "graceful-restart-disable": False,
}
} }
} }
}
} }
configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, configure_gr_followed_by_clear(
dut='r3', peer='r2') tgen, topo, input_dict, tc_name, dut="r3", peer="r2"
)
step("Verifying Routes at R2 on disabling GRD") step("Verifying Routes at R2 on disabling GRD")
dut = 'r2' dut = "r2"
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
input_dict_1= {'r2': topo['routers']['r2']} input_dict_1 = {"r2": topo["routers"]["r2"]}
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) assert result is True, "Testcase {} :Failed \n Error {}".format(
tc_name, result
)
step("Verify stale Routes in Router R2 on disabling GRD") step("Verify stale Routes in Router R2 on disabling GRD")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
@ -536,19 +533,22 @@ def test_bgp_gr_stale_routes(request):
verify_nh_for_static_rtes = { verify_nh_for_static_rtes = {
"r3": { "r3": {
"static_routes": [ "static_routes": [
{ {
"network": [NETWORK1_1[addr_type]], "network": [NETWORK1_1[addr_type]],
"no_of_ip": 2, "no_of_ip": 2,
"vrf": "RED" "vrf": "RED",
} }
] ]
} }
} }
bgp_rib_next_hops = verify_stale_routes_list(tgen, addr_type, dut, verify_nh_for_static_rtes) bgp_rib_next_hops = verify_stale_routes_list(
tgen, addr_type, dut, verify_nh_for_static_rtes
)
stale_route_status=len(bgp_rib_next_hops)== 1 stale_route_status = len(bgp_rib_next_hops) == 1
assert stale_route_status is True, "Testcase {} : Failed \n Error: {}".format( assert (
tc_name, stale_route_status,expected=True) stale_route_status is True
), "Testcase {} : Failed \n Error: {}".format(
tc_name, stale_route_status, expected=True
)
write_test_footer(tc_name) write_test_footer(tc_name)

View File

@ -346,11 +346,11 @@ def test_ip_prefix_lists_out_permit(request):
result = verify_rib( result = verify_rib(
tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -447,11 +447,11 @@ def test_ip_prefix_lists_in_deny_and_permit_any(request):
result = verify_rib( result = verify_rib(
tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} BGP RIB \n " "Expected: Routes should not be present in {} BGP RIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -649,11 +649,11 @@ def test_ip_prefix_lists_out_deny_and_permit_any(request):
result = verify_rib( result = verify_rib(
tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} BGP RIB \n " "Expected: Routes should not be present in {} BGP RIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -786,11 +786,11 @@ def test_modify_prefix_lists_in_permit_to_deny(request):
result = verify_rib( result = verify_rib(
tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} BGP RIB \n " "Expected: Routes should not be present in {} BGP RIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -892,11 +892,11 @@ def test_modify_prefix_lists_in_deny_to_permit(request):
result = verify_rib( result = verify_rib(
tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} BGP RIB \n " "Expected: Routes should not be present in {} BGP RIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
# Modify ip prefix list # Modify ip prefix list
input_dict_1 = { input_dict_1 = {
@ -1063,11 +1063,11 @@ def test_modify_prefix_lists_out_permit_to_deny(request):
result = verify_rib( result = verify_rib(
tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} BGP RIB \n " "Expected: Routes should not be present in {} BGP RIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -1171,11 +1171,11 @@ def test_modify_prefix_lists_out_deny_to_permit(request):
result = verify_rib( result = verify_rib(
tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} BGP RIB \n " "Expected: Routes should not be present in {} BGP RIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
# Modify ip prefix list # Modify ip prefix list
input_dict_1 = { input_dict_1 = {
@ -1340,11 +1340,11 @@ def test_ip_prefix_lists_implicit_deny(request):
result = verify_rib( result = verify_rib(
tgen, "ipv4", dut, input_dict_1, protocol=protocol, expected=False tgen, "ipv4", dut, input_dict_1, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} BGP RIB \n " "Expected: Routes should not be present in {} BGP RIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)

View File

@ -444,11 +444,11 @@ def test_route_map_inbound_outbound_same_neighbor_p0(request):
result = verify_rib( result = verify_rib(
tgen, adt, dut, input_dict_2, protocol=protocol, expected=False tgen, adt, dut, input_dict_2, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} BGP RIB \n " "Expected: Routes should not be present in {} BGP RIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
# Verifying RIB routes # Verifying RIB routes
dut = "r4" dut = "r4"
@ -466,11 +466,11 @@ def test_route_map_inbound_outbound_same_neighbor_p0(request):
result = verify_rib( result = verify_rib(
tgen, adt, dut, input_dict, protocol=protocol, expected=False tgen, adt, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -664,11 +664,11 @@ def test_route_map_with_action_values_combination_of_prefix_action_p0(
result = verify_rib( result = verify_rib(
tgen, adt, dut, input_dict_2, protocol=protocol, expected=False tgen, adt, dut, input_dict_2, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
else: else:
result = verify_rib(tgen, adt, dut, input_dict_2, protocol=protocol) result = verify_rib(tgen, adt, dut, input_dict_2, protocol=protocol)
assert result is True, "Testcase {} : Failed \n Error: {}".format( assert result is True, "Testcase {} : Failed \n Error: {}".format(

View File

@ -1022,11 +1022,11 @@ def test_modify_prefix_list_referenced_by_rmap_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
# Verifying RIB routes # Verifying RIB routes
dut = "r4" dut = "r4"
@ -1035,11 +1035,11 @@ def test_modify_prefix_list_referenced_by_rmap_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -1292,11 +1292,11 @@ def test_remove_prefix_list_referenced_by_rmap_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
# Verifying RIB routes # Verifying RIB routes
dut = "r4" dut = "r4"
@ -1305,11 +1305,11 @@ def test_remove_prefix_list_referenced_by_rmap_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -2136,11 +2136,11 @@ def test_add_remove_rmap_to_specific_neighbor_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
# Remove applied rmap from neighbor # Remove applied rmap from neighbor
input_dict_4 = { input_dict_4 = {
@ -2549,11 +2549,11 @@ def test_rmap_without_match_and_set_clause_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
# Uncomment next line for debugging # Uncomment next line for debugging
@ -2796,11 +2796,11 @@ def test_set_localpref_weight_to_ebgp_and_med_to_ibgp_peers_p0():
input_dict_3_addr_type[addr_type], input_dict_3_addr_type[addr_type],
expected=False, expected=False,
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: BGP attributes should not be set in {} FIB \n " "Expected: BGP attributes should not be set in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
# Verifying RIB routes # Verifying RIB routes
dut = "r5" dut = "r5"
@ -2829,11 +2829,11 @@ def test_set_localpref_weight_to_ebgp_and_med_to_ibgp_peers_p0():
input_dict_3_addr_type[addr_type], input_dict_3_addr_type[addr_type],
expected=False, expected=False,
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: BGP attributes should not be set in {} FIB \n " "Expected: BGP attributes should not be set in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -3637,11 +3637,11 @@ def test_create_rmap_match_prefix_list_to_deny_in_and_outbound_prefixes_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
# Verifying RIB routes # Verifying RIB routes
dut = "r4" dut = "r4"
@ -3650,11 +3650,11 @@ def test_create_rmap_match_prefix_list_to_deny_in_and_outbound_prefixes_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -3954,11 +3954,11 @@ def test_create_rmap_to_match_tag_deny_outbound_prefixes_p0():
result = verify_rib( result = verify_rib(
tgen, addr_type, dut, input_dict, protocol=protocol, expected=False tgen, addr_type, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, ("Testcase {} : Failed \n " assert result is not True, (
"Testcase {} : Failed \n "
"Expected: Routes should not be present in {} FIB \n " "Expected: Routes should not be present in {} FIB \n "
"Found: {}".format( "Found: {}".format(tc_name, dut, result)
tc_name, dut, result )
))
write_test_footer(tc_name) write_test_footer(tc_name)