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
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"}
# Building topology from json file
build_topo_from_json(tgen, topo)
+ def dumdum(self):
+ """ Dummy """
+ print("%s", self.name)
+
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)
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")
* `mod`: module name
"""
- logger.info("Running teardown_module to delete topology")
+ logger.info("Running teardown_module to delete topology: %s", mod)
tgen = get_topogen()
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],
"ipv6": topo["routers"]["r1"]["links"]["r2-link1"]["ipv6"].split("/")[0],
},
}
- return NEXT_HOP_IP
+ return next_hop_ip
#####################################################
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"
"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],
},
]
}
"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(
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"delete": True,
}
]
"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,
tc_name
)
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Configure the static route with nexthop N1")
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
}
]
}
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"delete": True,
}
]
"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,
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is"\
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Configure the static route with nexthop N2")
"static_routes": [
{
"network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
}
]
}
step("Only one the nexthops should be active in RIB.")
- nh = NEXT_HOP_IP["nh2"][addr_type]
+ nh = next_hop_ip["nh2"][addr_type]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
- nh = NEXT_HOP_IP["nh1"][addr_type]
+ nh = next_hop_ip["nh1"][addr_type]
result = verify_rib(
tgen,
addr_type,
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
result = verify_rib(
next_hop=nh,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
dut = "r2"
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
dut = "r2"
"after shut of nexthop N1 , route become active "
"with nexthop N2 and vice versa."
)
- nh = [NEXT_HOP_IP["nh1"][addr_type], NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type], next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Shut nexthop interface N2")
shutdown_bringup_interface(tgen, dut, intf, False)
step(
- " after shut of nexthop N1 , route become active with "
+ " after shut of nexthop N1 , route become active with " \
"nexthop N2 and vice versa."
)
- nh = NEXT_HOP_IP["nh2"][addr_type]
+ nh = next_hop_ip["nh2"][addr_type]
result = verify_rib(
tgen,
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
step("No shut nexthop interface N2")
"after shut of nexthop N1 , route become active "
"with nexthop N2 and vice versa."
)
- nh = [NEXT_HOP_IP["nh1"][addr_type], NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type], next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
step("Reload the FRR router")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
+ assert result is not True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
write_test_footer(tc_name)
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"
)
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,
},
]
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
}
]
}
}
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
rte2_nh2 = {
"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(
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
step("Configure IBGP IPv4 peering between R2 and R3 router.")
"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],
},
]
"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,
}
"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(
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
rte2_nh2 = {
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh2"][addr_type],
+ "next_hop": next_hop_ip["nh2"][addr_type],
"admin_distance": 20,
}
]
}
}
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte2_nh2, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
step("Configure the static route with nexthop N1")
"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,
}
]
"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,
}
"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,
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Configure the static route with nexthop N2")
"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,
}
]
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,
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh2"][addr_type]]
+ nh = [next_hop_ip["nh2"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte2_nh2, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("No shut the nexthop interface N1")
"after shut of nexthop N1 , route become active "
"with nexthop N2 and vice versa."
)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("Shut nexthop interface N2")
" 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,
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB".format(tc_name)
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
step("No shut nexthop interface N2")
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
}
]
}
}
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
rte2_nh2 = {
"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(
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
dut = "r3"
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
dut = "r2"
"static_routes": [
{
"network": NETWORK2[addr_type],
- "next_hop": NEXT_HOP_IP["nh1"][addr_type],
+ "next_hop": next_hop_ip["nh1"][addr_type],
"admin_distance": 10,
}
]
}
}
- nh = [NEXT_HOP_IP["nh1"][addr_type]]
+ nh = [next_hop_ip["nh1"][addr_type]]
dut = "r2"
protocol = "static"
result = verify_rib(
tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
dut = "r3"
protocol = "bgp"
result = verify_bgp_rib(tgen, addr_type, dut, rte1_nh1, next_hop=nh)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"missing in RIB".format(tc_name)
rte2_nh2 = {
"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(
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
dut = "r3"
protocol = "bgp"
result = verify_bgp_rib(tgen, addr_type, dut, rte2_nh2, next_hop=nh)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
result = verify_rib(
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
"not active in RIB".format(tc_name)
write_test_footer(tc_name)
step("Verify on R3 , route receive on R3 BGP table ")
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
step("Verify route installed in the RIB and FIB of R3")
protocol = "bgp"
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" still present in RIB".format(tc_name)
step(
)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in BGP RIB".format(tc_name)
protocol = "bgp"
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
step("Remove the static route on R3 configured with active" "interface")
)
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in BGP RIB".format(tc_name)
protocol = "bgp"
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route is"
+ assert result is True, "Testcase {} : Failed \nError: Route is" \
" missing in RIB".format(tc_name)
write_test_footer(tc_name)
next_hop=nh_all[addr_type],
protocol=protocol,
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
dut = "r3"
protocol = "bgp"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step(
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed\nError: Routes is"
+ assert result is not True, "Testcase {} : Failed\nError: Routes is" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by one")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed\nError: Routes are"
+ assert result is True, "Testcase {} : Failed\nError: Routes are" \
" missing in RIB".format(tc_name)
protocol = "static"
next_hop=nh_all[addr_type],
protocol=protocol,
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Remove random static route with all the nexthop")
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
for addr_type in ADDR_TYPES:
next_hop=nh_all[addr_type],
protocol=protocol,
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Remove the redistribute static knob")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
write_test_footer(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
nh = []
wait=2,
attempts=3,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step(
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by one")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
wait=2,
attempts=3,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
dut = "r2"
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
nh = []
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step(
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by one")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
dut = "r2"
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Verify that highest AD nexthop are inactive")
wait=2,
attempts=3,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by one")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
"lowest AD is missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
step("Remove random static route with all the nexthop")
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Route "
+ assert result is not True, "Testcase {} : Failed \nError: Route " \
" is still present in RIB".format(tc_name)
step("Reconfigure the deleted routes and verify they are installed")
protocol = "static"
nh = NEXT_HOP_IP["nh1"][addr_type]
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
- assert result is True, "Testcase {} : Failed \nError: Route "
+ assert result is True, "Testcase {} : Failed \nError: Route " \
" is still present in RIB".format(tc_name)
step("Reload the FRR router")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Verify that highest AD nexthop are inactive")
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" are missing in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
for addr_type in ADDR_TYPES:
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still active in RIB".format(tc_name)
+
write_test_footer(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
for addr_type in ADDR_TYPES:
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by" "one")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
write_test_footer(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
" lowest AD is missing in RIB".format(tc_name)
nh = []
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" with high AD are active in RIB".format(tc_name)
step("Configure redistribute static in BGP on R2 router")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
" lowest AD is missing in RIB".format(tc_name)
step(
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes are"
+ assert result is not True, "Testcase {} : Failed \nError: Routes are" \
" still present in RIB".format(tc_name)
step("Configure the static route with nexthop N1 to N8, one by" "one")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
" lowest AD is missing in RIB".format(tc_name)
nh = []
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" with high AD are active in RIB".format(tc_name)
step("Random shut of the nexthop interfaces")
protocol=protocol,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \n"
+ assert result is not True, "Testcase {} : Failed \n" \
"Error: Routes are still present in RIB".format(tc_name)
step("Random no shut of the nexthop interfaces")
result = verify_rib(
tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \n"
+ assert result is True, "Testcase {} : Failed \n" \
"Error: Routes are missing in RIB".format(tc_name)
step("Reload the FRR router")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
" lowest AD is missing in RIB".format(tc_name)
nh = []
fib=True,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes "
+ assert result is not True, "Testcase {} : Failed \nError: Routes " \
" with high AD are active in RIB".format(tc_name)
write_test_footer(tc_name)
step("Verify R2 BGP table has IPv4 route")
dut = "r2"
result = verify_rib(tgen, addr_type, dut, input_dict_4)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB of R2".format(tc_name)
step(" Verify route did not install in the R3 BGP table, RIB/FIB")
dut = "r3"
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4, expected=False)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in BGP RIB of R2".format(tc_name)
result = verify_rib(tgen, addr_type, dut, input_dict_4, expected=False)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" still present in RIB of R2".format(tc_name)
write_test_footer(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, next_hop=nh
)
- assert result is True, "Testcase {} : Failed \nError: Routes is"
+ assert result is True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
input_dict_nh = {
}
}
result = verify_ip_nht(tgen, input_dict_nh)
- assert result is True, "Testcase {} : Failed \nError: Nexthop is"
+ assert result is True, "Testcase {} : Failed \nError: Nexthop is" \
" missing in RIB".format(tc_name)
step(
next_hop=nh,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes is"
+ assert result is not True, "Testcase {} : Failed \nError: Routes is" \
" missing in RIB".format(tc_name)
shutdown_bringup_interface(tgen, dut, intf, True)
next_hop=nh,
expected=False,
)
- assert result is not True, "Testcase {} : Failed \nError: Routes"
+ assert result is not True, "Testcase {} : Failed \nError: Routes" \
" still present in RIB".format(tc_name)
write_test_footer(tc_name)
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("Configure route-map on R2 with allow tag1 and deny tag2")
result = verify_rib(
tgen, addr_type, dut, input_dict_0, protocol=protocol, expected=False
)
- assert result is not True, "Testcase {} : Failed \nError: Route with "
+ assert result is not True, "Testcase {} : Failed \nError: Route with " \
"tag 4002 is still present in RIB".format(tc_name)
dut = "r2"
}
result = verify_rib(tgen, addr_type, dut, input_dict_0, protocol=protocol)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
"tag 4001 is missing in RIB".format(tc_name)
step("Modify the route-map to allow tag2 and deny tag1")
}
result = verify_rib(tgen, addr_type, dut, input_dict_0, protocol=protocol)
- assert result is True, "Testcase {} : Failed \nError: Route with "
+ assert result is True, "Testcase {} : Failed \nError: Route with " \
"tag 4002 is missing in RIB".format(tc_name)
input_dict_1 = {
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")
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True
)
- assert result is True, "Testcase {} : Failed \nError: Routes are"
+ assert result is True, "Testcase {} : Failed \nError: Routes are" \
" missing in RIB".format(tc_name)
step("shut/no shut of tag1 and tag2 nexthop")