1. BGP timers are modified to reduce the run time.
2. Static sleeps are removed from the scripts.
Signed-off-by: naveen <nguggarigoud@vmware.com>
write_test_footer(tc_name)
-
+@pytest.mark.parametrize("ecmp_num", ["8", "16", "32"])
@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
-def test_ecmp_after_clear_bgp(request, test_type):
+def test_ecmp_after_clear_bgp(request, ecmp_num, test_type):
""" Verify BGP table and RIB in DUT after clear BGP routes and neighbors"""
tc_name = request.node.name
addr_type,
dut,
input_dict_1,
- next_hop=NEXT_HOPS[addr_type],
+ next_hop=NEXT_HOPS[addr_type][:int(ecmp_num)],
protocol=protocol,
)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
addr_type,
dut,
input_dict_1,
- next_hop=NEXT_HOPS[addr_type],
+ next_hop=NEXT_HOPS[addr_type][:int(ecmp_num)],
protocol=protocol,
)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
write_test_footer(tc_name)
-
+@pytest.mark.parametrize("ecmp_num", ["8", "16", "32"])
@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
-def test_ecmp_after_clear_bgp(request, test_type):
+def test_ecmp_after_clear_bgp(request, ecmp_num, test_type):
""" Verify BGP table and RIB in DUT after clear BGP routes and neighbors"""
tc_name = request.node.name
addr_type,
dut,
input_dict_1,
- next_hop=NEXT_HOPS[addr_type],
+ next_hop=NEXT_HOPS[addr_type][:int(ecmp_num)],
protocol=protocol,
)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
addr_type,
dut,
input_dict_1,
- next_hop=NEXT_HOPS[addr_type],
+ next_hop=NEXT_HOPS[addr_type][:int(ecmp_num)],
protocol=protocol,
)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
"neighbor": {
"r3": {
"dest_link": {
- "r2": {}
+ "r2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r3": {
"dest_link": {
- "r2": {}
+ "r2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3": {}
+ "r3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3": {}
+ "r3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r3": {
"dest_link": {
- "r2-link0": {},
- "r2-link1": {},
- "r2-link2": {},
- "r2-link3": {},
- "r2-link4": {},
- "r2-link5": {},
- "r2-link6": {},
- "r2-link7": {}
+ "r2-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link5": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link6": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link7": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
},
"neighbor": {
"r3": {
"dest_link": {
- "r2-link0": {},
- "r2-link1": {},
- "r2-link2": {},
- "r2-link3": {},
- "r2-link4": {},
- "r2-link5": {},
- "r2-link6": {},
- "r2-link7": {}
+ "r2-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link5": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link6": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link7": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
},
"neighbor": {
"r2": {
"dest_link": {
- "r3-link0": {},
- "r3-link1": {},
- "r3-link2": {},
- "r3-link3": {},
- "r3-link4": {},
- "r3-link5": {},
- "r3-link6": {},
- "r3-link7": {}
+ "r3-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link5": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link6": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link7": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3-link0": {},
- "r3-link1": {},
- "r3-link2": {},
- "r3-link3": {},
- "r3-link4": {},
- "r3-link5": {},
- "r3-link6": {},
- "r3-link7": {}
+ "r3-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link5": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link6": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link7": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r3": {
"dest_link": {
- "r2-link0": {}
+ "r2-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r3": {
"dest_link": {
- "r2-link0": {}
+ "r2-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3-link0": {}
+ "r3-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3-link0": {}
+ "r3-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
import os
import pytest
import ipaddr
-from time import sleep
# Save the Current Working Directory to find configuration files.
CWD = os.path.dirname(os.path.realpath(__file__))
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
dut = "r2"
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
step(
intf = topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"]
shutdown_bringup_interface(tgen, dut, intf, False)
- sleep(5)
+
step("Random no shut of the nexthop interfaces")
# Bringup interface
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
step(
intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)]["interface"]
shutdown_bringup_interface(tgen, dut, intf, False)
- sleep(200)
+ # sleep for twice the holddowntimer so that bgp deletes the neighbors.
+ sleep(8)
step("verify bgp convergence as all interface are shut")
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
for addr_type in ADDR_TYPES:
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
for addr_type in ADDR_TYPES:
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
step("After reloading, verify that routes are still present in R2.")
"interface"
]
shutdown_bringup_interface(tgen, dut, intf, False)
- sleep(180)
+ # sleep for twice the holddowntimer so that bgp deletes the neighbors.
+ sleep(8)
step("verify bgp convergence as all interface are shut")
bgp_convergence = verify_bgp_convergence(tgen, topo)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are still present in RIB after BGP nbr is down".format(tc_name)
- sleep(5)
+
dut = "r2"
for intfr in range(0, 8):
intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)][
]
shutdown_bringup_interface(tgen, dut, intf, True)
- sleep(5)
+
dut = "r3"
for intfr in range(0, 8):
intf = topo["routers"]["r3"]["links"]["r2-link{}".format(intfr)][
import os
import pytest
import ipaddr
-from time import sleep
from copy import deepcopy
import random
from re import search as re_search
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
start_router(tgen, "r2")
result = verify_rib(
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
start_router(tgen, "r2")
step(
import pytest
import ipaddr
import ipaddress
-from time import sleep
from copy import deepcopy
# Save the Current Working Directory to find configuration files.
"neighbor": {
"r3": {
"dest_link": {
- "r2": {}
+ "r2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r3": {
"dest_link": {
- "r2": {}
+ "r2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3": {}
+ "r3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3": {}
+ "r3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"unicast": {
"neighbor": {
"r3": {
+
+
"dest_link": {
- "r2-link0": {},
- "r2-link1": {},
- "r2-link2": {},
- "r2-link3": {},
- "r2-link4": {},
- "r2-link5": {},
- "r2-link6": {},
- "r2-link7": {}
+ "r2-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link5": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link6": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link7": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
},
"unicast": {
"neighbor": {
"r3": {
+
+
"dest_link": {
- "r2-link0": {},
- "r2-link1": {},
- "r2-link2": {},
- "r2-link3": {},
- "r2-link4": {},
- "r2-link5": {},
- "r2-link6": {},
- "r2-link7": {}
+ "r2-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link5": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link6": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r2-link7": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
},
"unicast": {
"neighbor": {
"r2": {
+
+
"dest_link": {
- "r3-link0": {},
- "r3-link1": {},
- "r3-link2": {},
- "r3-link3": {},
- "r3-link4": {},
- "r3-link5": {},
- "r3-link6": {},
- "r3-link7": {}
+ "r3-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link5": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link6": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link7": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"unicast": {
"neighbor": {
"r2": {
+
+
"dest_link": {
- "r3-link0": {},
- "r3-link1": {},
- "r3-link2": {},
- "r3-link3": {},
- "r3-link4": {},
- "r3-link5": {},
- "r3-link6": {},
- "r3-link7": {}
+ "r3-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link5": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link6": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ },
+ "r3-link7": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r3": {
"dest_link": {
- "r2-link0": {}
+ "r2-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r3": {
"dest_link": {
- "r2-link0": {}
+ "r2-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3-link0": {}
+ "r3-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
"neighbor": {
"r2": {
"dest_link": {
- "r3-link0": {}
+ "r3-link0": {
+ "keepalivetimer": 1,
+ "holddowntimer": 4
+ }
}
}
}
import os
import pytest
import ipaddr
-from time import sleep
from copy import deepcopy
# Save the Current Working Directory to find configuration files.
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
dut = "r2"
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
step(
write_test_footer(tc_name)
-"""
-def test_same_rte_from_bgp_static_P0_tc5(request):
-
- #Verify RIB status when same route advertise via BGP and static
- #route
-
-
- tc_name = request.node.name
- write_test_header(tc_name)
- tgen = get_topogen()
- # Don't run this test if we have any failure.
- if tgen.routers_have_failure():
- pytest.skip(tgen.errors)
-
- NEXT_HOP_IP = populate_nh()
- step('Configure iBGP IPv4 peering between R2 and R3 router.')
- reset_config_on_routers(tgen)
- step(
- 'Configure IPv4 static route (10.1.1.1/24) in R2 with next hop'
- 'N1 (28.1.1.2 ) and N2 (29.1.1.2) , Static route next-hop present'
- 'on R1')
-
- for addr_type in ADDR_TYPES:
- input_dict_4 = {
- "r2": {
- "static_routes": [
- {
- "network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP['nh1'][addr_type]
- },
- {
- "network": NETWORK[addr_type],
- "next_hop": NEXT_HOP_IP['nh2'][addr_type]
- }
- ]
- }
- }
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result)
-
- step('Configure redistribute static in BGP.')
- for addr_type in ADDR_TYPES:
- input_dict_2 = {
- "r2": {
- "bgp": {
- "address_family": {
- addr_type: {
- "unicast": {
- "redistribute": [{
- "redist_type": "static"
- }]
- }
- }
- }
- }
- }
- }
- result = create_router_bgp(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result)
- 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)
-
- 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)
-
- step(
- 'Configure 2 links/interfaces between R1 and R3 , keep one'
- 'interface in shut (active) state and other interface in no shut'
- '(inactive) state')
- dut = 'r3'
- intf = topo['routers']['r3']['links']['r1-link0']['interface']
- shutdown_bringup_interface(tgen, dut, intf, False)
-
- step(
- 'Configure same static route (10.1.1.1/24) in R3 with inactive'
- 'nexthop interface')
-
- step(
- 'Configure same static route 10.1.1.1/24) again in R3 with'
- 'active nexthop interface')
- for addr_type in ADDR_TYPES:
- input_dict_4 = {
- "r3": {
- "static_routes": [
- {
- "network": NETWORK[addr_type],
- "next_hop": topo['routers']['r1']['links']['r3-link0'][
- addr_type]
- },
- {
- "network": NETWORK[addr_type],
- "next_hop": topo['routers']['r1']['links']['r3-link1'][
- addr_type]
- }
- ]
- }
- }
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result)
-
- step(
- "Verify when static route configure with inactive nexthop , "
- "verify BGP received route is active in the RIB and FIB")
- 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)
-
- 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)
-
- step('Remove the redistribute static knob from R2 router')
- for addr_type in ADDR_TYPES:
- input_dict_2 = {
- "r2": {
- "bgp": {
- "address_family": {
- addr_type: {
- "unicast": {
- "redistribute": [{
- "redist_type": "static",
- "delete": True
- }]
- }
- }
- }
- }
- }
- }
- result = create_router_bgp(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result)
-
- step(
- "After removing /adding the redistribute static knob , "
- "BGP received route is deleted and added in RIB of R3 ")
- dut = 'r3'
- result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
- " still present in RIB".format(tc_name)
-
- protocol = 'bgp'
- result = verify_rib(
- tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True)
- assert result is not True, "Testcase {} : Failed \nError: Route is"
- " still present in RIB".format(tc_name)
-
- step('Configure the redistribute static knob again on R2 router')
- for addr_type in ADDR_TYPES:
- input_dict_2 = {
- "r2": {
- "bgp": {
- "address_family": {
- addr_type: {
- "unicast": {
- "redistribute": [{
- "redist_type": "static",
- }]
- }
- }
- }
- }
- }
- }
- result = create_router_bgp(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result)
- 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)
-
- 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)
-
- step(
- 'Remove the static route on R3 configured with active'
- 'interface')
- for addr_type in ADDR_TYPES:
- input_dict_4 = {
- "r3": {
- "static_routes": [
- {
- "network": NETWORK[addr_type],
- "next_hop": topo['routers']['r1']['links']['r3-link0'][
- addr_type],
- "delete": True
- },
- {
- "network": NETWORK[addr_type],
- "next_hop": topo['routers']['r1']['links']['r3-link1'][
- addr_type],
- "delete": True
- }
- ]
- }
- }
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result)
- step(
- "After removing the static route with active nexthop verify "
- "BGP received route is became active in RIB and FIB")
- 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)
-
- 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)
-
- write_test_footer(tc_name)
-"""
-
-
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))
intf = topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"]
shutdown_bringup_interface(tgen, dut, intf, False)
- sleep(5)
+
step("Random no shut of the nexthop interfaces")
# Bringup interface
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
step(
intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)]["interface"]
shutdown_bringup_interface(tgen, dut, intf, False)
- sleep(200)
+ # sleep for twice the holddowntimer so that bgp deletes the neighbors.
+ sleep(8)
step("verify bgp convergence as all interface are shut")
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
for addr_type in ADDR_TYPES:
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
for addr_type in ADDR_TYPES:
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
step("After reloading, verify that routes are still present in R2.")
"interface"
]
shutdown_bringup_interface(tgen, dut, intf, False)
- sleep(180)
+ # sleep for twice the holddowntimer so that bgp deletes the neighbors.
+ sleep(8)
step("verify bgp convergence as all interface are shut")
bgp_convergence = verify_bgp_convergence(tgen, topo)
assert result is not True, "Testcase {} : Failed \nError: Routes "
" are still present in RIB after BGP nbr is down".format(tc_name)
- sleep(5)
+
dut = "r2"
for intfr in range(0, 8):
intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)][
]
shutdown_bringup_interface(tgen, dut, intf, True)
- sleep(5)
+
dut = "r3"
for intfr in range(0, 8):
intf = topo["routers"]["r3"]["links"]["r2-link{}".format(intfr)][
import os
import pytest
import ipaddr
-from time import sleep
from copy import deepcopy
import random
from re import search as re_search
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
result = verify_rib(
step("Reload the FRR router")
# stop/start -> restart FRR router and verify
stop_router(tgen, "r2")
- sleep(5)
+
start_router(tgen, "r2")
step(
- Verify static route are blocked from route-map and prefix-list
applied in BGP nbrs
-- Verify Static route when FRR connected to 2 TOR
"""
import sys
import pytest
import ipaddr
import ipaddress
-from time import sleep
from copy import deepcopy
# Save the Current Working Directory to find configuration files.
# Import topogen and topotest helpers
from mininet.topo import Topo
from lib.topogen import Topogen, get_topogen
-from time import sleep
from lib.common_config import (
start_topology,
write_test_header,
write_test_footer,
reset_config_on_routers,
- verify_kernel_ping,
verify_rib,
create_static_routes,
check_address_types,
write_test_footer(tc_name)
-def test_static_routes_tor_p0_tc5_ibgp(request):
- """Verify Static route when FRR connected to 2 TOR."""
- tc_name = request.node.name
- write_test_header(tc_name)
- tgen = get_topogen()
- # Don't run this test if we have any failure.
- if tgen.routers_have_failure():
- pytest.skip(tgen.errors)
- step("Configure link between FRR to FRR1 & FRR2 as shown in the topology.")
- step("Attach 2 VMs (vm1 & vm2) to FRR, vm3 to FRR1 ,vm4 to FRR2.")
- step("Configure Ipv4 and ipv6 addresses on all the interfaces.")
-
- reset_config_on_routers(tgen)
-
- def_nw = {"ipv4": "0.0.0.0/0", "ipv6": "0::0/0"}
- step(
- "Configure the static route (ipv4 & ipv6) on FRR to vm3 and vm4 "
- "with next hop as FRR1 and FRR2 respectively."
- )
- for addr_type in ADDR_TYPES:
- # Enable static routes
- for vm in ["vm1", "vm2", "vm3", "vm6"]:
- input_dict_4 = {
- vm: {
- "static_routes": [
- {
- "network": def_nw[addr_type],
- "next_hop": topo["routers"]["r2"]["links"][vm][
- addr_type
- ].split("/")[0],
- }
- ]
- }
- }
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result
- )
-
- input_dict_4 = {
- "vm4": {
- "static_routes": [
- {
- "network": def_nw[addr_type],
- "next_hop": topo["routers"]["r1"]["links"]["vm4"][
- addr_type
- ].split("/")[0],
- }
- ]
- }
- }
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result
- )
-
- input_dict_4 = {
- "vm5": {
- "static_routes": [
- {
- "network": def_nw[addr_type],
- "next_hop": topo["routers"]["r3"]["links"]["vm5"][
- addr_type
- ].split("/")[0],
- }
- ]
- }
- }
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result
- )
-
- input_dict_4 = {
- "r1": {
- "static_routes": [
- {
- "network": topo["routers"]["vm1"]["links"]["r2"][
- addr_type
- ].split("/")[0]
- + "/16",
- "next_hop": topo["routers"]["r2"]["links"]["r1-link0"][
- addr_type
- ].split("/")[0],
- },
- {
- "network": topo["routers"]["vm2"]["links"]["r2"][
- addr_type
- ].split("/")[0]
- + "/16",
- "next_hop": topo["routers"]["r2"]["links"]["r1-link0"][
- addr_type
- ].split("/")[0],
- },
- ]
- }
- }
-
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result
- )
-
- # Enable static routes
- input_dict_4 = {
- "r3": {
- "static_routes": [
- {
- "network": topo["routers"]["vm3"]["links"]["r2"][
- addr_type
- ].split("/")[0]
- + "/16",
- "next_hop": topo["routers"]["r2"]["links"]["r3-link0"][
- addr_type
- ].split("/")[0],
- },
- {
- "network": topo["routers"]["vm6"]["links"]["r2"][
- addr_type
- ].split("/")[0]
- + "/16",
- "next_hop": topo["routers"]["r2"]["links"]["r3-link0"][
- addr_type
- ].split("/")[0],
- },
- ]
- }
- }
-
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result
- )
-
- # Enable static routes
- input_dict_4 = {
- "r2": {
- "static_routes": [
- {
- "network": topo["routers"]["vm4"]["links"]["r1"][
- addr_type
- ].split("/")[0]
- + "/16",
- "next_hop": topo["routers"]["r1"]["links"]["r2-link0"][
- addr_type
- ].split("/")[0],
- },
- {
- "network": topo["routers"]["vm5"]["links"]["r3"][
- addr_type
- ].split("/")[0]
- + "/16",
- "next_hop": topo["routers"]["r3"]["links"]["r2-link0"][
- addr_type
- ].split("/")[0],
- },
- {
- "network": topo["routers"]["vm4"]["links"]["r1"][addr_type],
- "next_hop": topo["routers"]["r1"]["links"]["r2-link0"][
- addr_type
- ].split("/")[0],
- },
- {
- "network": topo["routers"]["vm5"]["links"]["r3"][addr_type],
- "next_hop": topo["routers"]["r3"]["links"]["r2-link0"][
- addr_type
- ].split("/")[0],
- },
- {
- "network": topo["routers"]["r1"]["links"]["vm4"][addr_type],
- "next_hop": topo["routers"]["r1"]["links"]["r2-link0"][
- addr_type
- ].split("/")[0],
- },
- {
- "network": topo["routers"]["r3"]["links"]["vm5"][addr_type],
- "next_hop": topo["routers"]["r3"]["links"]["r2-link0"][
- addr_type
- ].split("/")[0],
- },
- ]
- }
- }
-
- logger.info("Configure static routes")
- result = create_static_routes(tgen, input_dict_4)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result
- )
- sleep(10)
- step(
- "Ping from all the vms for both ipv4 and ipv6 address. "
- "All the ping should pass."
- )
-
- step("ping from vm4 to vm1 vm2")
- vm4tovm1 = topo["routers"]["vm1"]["links"]["r2"][addr_type].split("/")[0]
- result = verify_kernel_ping(tgen, "vm4", vm4tovm1, count=1, addrtype=addr_type)
- assert result is True, "Testcase {}:Failed \n Error: {}".format(tc_name, result)
-
- vm4tovm2 = topo["routers"]["vm2"]["links"]["r2"][addr_type].split("/")[0]
- result = verify_kernel_ping(tgen, "vm4", vm4tovm2, count=1, addrtype=addr_type)
- assert result is True, "Testcase {}:Failed \n Error: {}".format(tc_name, result)
-
- step("ping from vm5 to vm3 vm6")
- vm5tovm3 = topo["routers"]["vm3"]["links"]["r2"][addr_type].split("/")[0]
- result = verify_kernel_ping(tgen, "vm5", vm5tovm3, count=1, addrtype=addr_type)
- assert result is True, "Testcase {}:Failed \n Error: {}".format(tc_name, result)
-
- vm5tovm6 = topo["routers"]["vm6"]["links"]["r2"][addr_type].split("/")[0]
- result = verify_kernel_ping(tgen, "vm5", vm5tovm6, count=1, addrtype=addr_type)
- assert result is True, "Testcase {}:Failed \n Error: {}".format(tc_name, result)
-
- write_test_footer(tc_name)
-
-
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))