mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 18:42:23 +00:00
tests: Adding new test suite bgp_as_allow_in
1. Added 5 test cases to verify BGP AS-allow-in behavior in FRR 2. Enhanced framework to support BGP AS-allow-in config(lib/bgp.py) 3. Added API in bgp.py to verify BGP RIB table(lib/bgp.py) Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
This commit is contained in:
parent
63ffd0ea20
commit
9d450273df
266
tests/topotests/bgp_as_allow_in/bgp_as_allow_in.json
Normal file
266
tests/topotests/bgp_as_allow_in/bgp_as_allow_in.json
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
{
|
||||||
|
"address_types": [
|
||||||
|
"ipv4",
|
||||||
|
"ipv6"
|
||||||
|
],
|
||||||
|
"ipv4base": "10.0.0.0",
|
||||||
|
"ipv4mask": 30,
|
||||||
|
"ipv6base": "fd00::",
|
||||||
|
"ipv6mask": 64,
|
||||||
|
"link_ip_start": {
|
||||||
|
"ipv4": "10.0.0.0",
|
||||||
|
"v4mask": 30,
|
||||||
|
"ipv6": "fd00::",
|
||||||
|
"v6mask": 64
|
||||||
|
},
|
||||||
|
"lo_prefix": {
|
||||||
|
"ipv4": "1.0.",
|
||||||
|
"v4mask": 32,
|
||||||
|
"ipv6": "2001:db8:f::",
|
||||||
|
"v6mask": 128
|
||||||
|
},
|
||||||
|
"routers": {
|
||||||
|
"r1": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bgp": {
|
||||||
|
"local_as": "200",
|
||||||
|
"address_family": {
|
||||||
|
"ipv4": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r2": {
|
||||||
|
"dest_link": {
|
||||||
|
"r1": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r2": {
|
||||||
|
"dest_link": {
|
||||||
|
"r1": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r1": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto"
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bgp": {
|
||||||
|
"local_as": "100",
|
||||||
|
"address_family": {
|
||||||
|
"ipv4": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r1": {
|
||||||
|
"dest_link": {
|
||||||
|
"r2": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"dest_link": {
|
||||||
|
"r2": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r1": {
|
||||||
|
"dest_link": {
|
||||||
|
"r2": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"dest_link": {
|
||||||
|
"r2": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto"
|
||||||
|
},
|
||||||
|
"r4": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto"
|
||||||
|
},
|
||||||
|
"r5": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bgp": {
|
||||||
|
"local_as": "200",
|
||||||
|
"address_family": {
|
||||||
|
"ipv4": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r5": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r4": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r5": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r4": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r4": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bgp": {
|
||||||
|
"local_as": "200",
|
||||||
|
"address_family": {
|
||||||
|
"ipv4": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r3": {
|
||||||
|
"dest_link": {
|
||||||
|
"r4": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r3": {
|
||||||
|
"dest_link": {
|
||||||
|
"r4": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r5": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"ipv4": "auto",
|
||||||
|
"ipv6": "auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bgp": {
|
||||||
|
"local_as": "500",
|
||||||
|
"address_family": {
|
||||||
|
"ipv4": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r3": {
|
||||||
|
"dest_link": {
|
||||||
|
"r5": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r3": {
|
||||||
|
"dest_link": {
|
||||||
|
"r5": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1008
tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py
Executable file
1008
tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py
Executable file
File diff suppressed because it is too large
Load Diff
@ -27,16 +27,14 @@ from lib import topotest
|
|||||||
from lib.topolog import logger
|
from lib.topolog import logger
|
||||||
|
|
||||||
# Import common_config to use commomnly used APIs
|
# Import common_config to use commomnly used APIs
|
||||||
from lib.common_config import (
|
from lib.common_config import (create_common_configuration,
|
||||||
create_common_configuration,
|
InvalidCLIError,
|
||||||
InvalidCLIError,
|
load_config_to_router,
|
||||||
load_config_to_router,
|
check_address_types,
|
||||||
check_address_types,
|
generate_ips,
|
||||||
generate_ips,
|
validate_ip_address,
|
||||||
find_interface_with_greater_ip,
|
find_interface_with_greater_ip,
|
||||||
run_frr_cmd,
|
run_frr_cmd, retry)
|
||||||
retry,
|
|
||||||
)
|
|
||||||
|
|
||||||
BGP_CONVERGENCE_TIMEOUT = 10
|
BGP_CONVERGENCE_TIMEOUT = 10
|
||||||
|
|
||||||
@ -82,6 +80,9 @@ def create_router_bgp(tgen, topo, input_dict=None, build=False):
|
|||||||
"holddowntimer": 180,
|
"holddowntimer": 180,
|
||||||
"dest_link": {
|
"dest_link": {
|
||||||
"r4": {
|
"r4": {
|
||||||
|
"allowas-in": {
|
||||||
|
"number_occurences":2
|
||||||
|
},
|
||||||
"prefix_lists": [
|
"prefix_lists": [
|
||||||
{
|
{
|
||||||
"name": "pf_list_1",
|
"name": "pf_list_1",
|
||||||
@ -469,6 +470,7 @@ def __create_bgp_unicast_address_family(
|
|||||||
prefix_lists = peer.setdefault("prefix_lists", {})
|
prefix_lists = peer.setdefault("prefix_lists", {})
|
||||||
route_maps = peer.setdefault("route_maps", {})
|
route_maps = peer.setdefault("route_maps", {})
|
||||||
no_send_community = peer.setdefault("no_send_community", None)
|
no_send_community = peer.setdefault("no_send_community", None)
|
||||||
|
allowas_in = peer.setdefault("allowas-in", None)
|
||||||
|
|
||||||
# next-hop-self
|
# next-hop-self
|
||||||
if next_hop_self:
|
if next_hop_self:
|
||||||
@ -483,6 +485,15 @@ def __create_bgp_unicast_address_family(
|
|||||||
"no {} send-community {}".format(neigh_cxt, no_send_community)
|
"no {} send-community {}".format(neigh_cxt, no_send_community)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if "allowas_in" in peer:
|
||||||
|
allow_as_in = peer["allowas_in"]
|
||||||
|
config_data.append("{} allowas-in {}".format(neigh_cxt,
|
||||||
|
allow_as_in))
|
||||||
|
|
||||||
|
if "no_allowas_in" in peer:
|
||||||
|
allow_as_in = peer["no_allowas_in"]
|
||||||
|
config_data.append("no {} allowas-in {}".format(neigh_cxt,
|
||||||
|
allow_as_in))
|
||||||
if prefix_lists:
|
if prefix_lists:
|
||||||
for prefix_list in prefix_lists:
|
for prefix_list in prefix_lists:
|
||||||
name = prefix_list.setdefault("name", {})
|
name = prefix_list.setdefault("name", {})
|
||||||
@ -517,6 +528,19 @@ def __create_bgp_unicast_address_family(
|
|||||||
cmd = "no {}".format(cmd)
|
cmd = "no {}".format(cmd)
|
||||||
config_data.append(cmd)
|
config_data.append(cmd)
|
||||||
|
|
||||||
|
if allowas_in:
|
||||||
|
number_occurences = allowas_in.\
|
||||||
|
setdefault("number_occurences", {})
|
||||||
|
del_action = allowas_in.setdefault("delete", False)
|
||||||
|
|
||||||
|
cmd = "{} allowas-in {}".format(neigh_cxt,
|
||||||
|
number_occurences)
|
||||||
|
|
||||||
|
if del_action:
|
||||||
|
cmd = "no {}".format(cmd)
|
||||||
|
|
||||||
|
config_data.append(cmd)
|
||||||
|
|
||||||
return config_data
|
return config_data
|
||||||
|
|
||||||
|
|
||||||
@ -929,7 +953,6 @@ def clear_bgp_and_verify(tgen, topo, router):
|
|||||||
)
|
)
|
||||||
return errormsg
|
return errormsg
|
||||||
|
|
||||||
logger.info(peer_uptime_before_clear_bgp)
|
|
||||||
# Clearing BGP
|
# Clearing BGP
|
||||||
logger.info("Clearing BGP neighborship for router %s..", router)
|
logger.info("Clearing BGP neighborship for router %s..", router)
|
||||||
for addr_type in bgp_addr_type.keys():
|
for addr_type in bgp_addr_type.keys():
|
||||||
@ -1679,3 +1702,234 @@ def verify_best_path_as_per_admin_distance(
|
|||||||
|
|
||||||
logger.info("Exiting lib API: verify_best_path_as_per_admin_distance()")
|
logger.info("Exiting lib API: verify_best_path_as_per_admin_distance()")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2)
|
||||||
|
def verify_bgp_rib(tgen, addr_type, dut, input_dict, next_hop=None, aspath=None):
|
||||||
|
"""
|
||||||
|
This API is to verify whether bgp rib has any
|
||||||
|
matching route for a nexthop.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
* `tgen`: topogen object
|
||||||
|
* `dut`: input dut router name
|
||||||
|
* `addr_type` : ip type ipv4/ipv6
|
||||||
|
* `input_dict` : input dict, has details of static routes
|
||||||
|
* `next_hop`[optional]: next_hop which needs to be verified,
|
||||||
|
default = static
|
||||||
|
* 'aspath'[optional]: aspath which needs to be verified
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
dut = 'r1'
|
||||||
|
next_hop = "192.168.1.10"
|
||||||
|
input_dict = topo['routers']
|
||||||
|
aspath = "100 200 300"
|
||||||
|
result = verify_bgp_rib(tgen, addr_type, dut, tgen, input_dict,
|
||||||
|
next_hop, aspath)
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
errormsg(str) or True
|
||||||
|
"""
|
||||||
|
|
||||||
|
logger.debug("Entering lib API: verify_bgp_rib()")
|
||||||
|
|
||||||
|
router_list = tgen.routers()
|
||||||
|
additional_nexthops_in_required_nhs = []
|
||||||
|
list1 = []
|
||||||
|
list2 = []
|
||||||
|
for routerInput in input_dict.keys():
|
||||||
|
for router, rnode in router_list.iteritems():
|
||||||
|
if router != dut:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Verifying RIB routes
|
||||||
|
command = "show bgp"
|
||||||
|
|
||||||
|
# Static routes
|
||||||
|
sleep(2)
|
||||||
|
logger.info('Checking router {} BGP RIB:'.format(dut))
|
||||||
|
|
||||||
|
if 'static_routes' in input_dict[routerInput]:
|
||||||
|
static_routes = input_dict[routerInput]["static_routes"]
|
||||||
|
|
||||||
|
for static_route in static_routes:
|
||||||
|
found_routes = []
|
||||||
|
missing_routes = []
|
||||||
|
st_found = False
|
||||||
|
nh_found = False
|
||||||
|
vrf = static_route.setdefault("vrf", None)
|
||||||
|
if vrf:
|
||||||
|
cmd = "{} vrf {} {}".\
|
||||||
|
format(command, vrf, addr_type)
|
||||||
|
|
||||||
|
else:
|
||||||
|
cmd = "{} {}".\
|
||||||
|
format(command, addr_type)
|
||||||
|
|
||||||
|
cmd = "{} json".format(cmd)
|
||||||
|
|
||||||
|
rib_routes_json = run_frr_cmd(rnode, cmd, isjson=True)
|
||||||
|
|
||||||
|
# Verifying output dictionary rib_routes_json is not empty
|
||||||
|
if bool(rib_routes_json) == False:
|
||||||
|
errormsg = "No route found in rib of router {}..". \
|
||||||
|
format(router)
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
network = static_route["network"]
|
||||||
|
|
||||||
|
if "no_of_ip" in static_route:
|
||||||
|
no_of_ip = static_route["no_of_ip"]
|
||||||
|
else:
|
||||||
|
no_of_ip = 1
|
||||||
|
|
||||||
|
# Generating IPs for verification
|
||||||
|
ip_list = generate_ips(network, no_of_ip)
|
||||||
|
|
||||||
|
for st_rt in ip_list:
|
||||||
|
st_rt = str(ipaddr.IPNetwork(unicode(st_rt)))
|
||||||
|
|
||||||
|
_addr_type = validate_ip_address(st_rt)
|
||||||
|
if _addr_type != addr_type:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if st_rt in rib_routes_json["routes"]:
|
||||||
|
st_found = True
|
||||||
|
found_routes.append(st_rt)
|
||||||
|
|
||||||
|
if next_hop:
|
||||||
|
if not isinstance(next_hop, list):
|
||||||
|
next_hop = [next_hop]
|
||||||
|
list1 = next_hop
|
||||||
|
found_hops = [rib_r["ip"] for rib_r in
|
||||||
|
rib_routes_json["routes"][
|
||||||
|
st_rt][0]["nexthops"]]
|
||||||
|
list2 = found_hops
|
||||||
|
missing_list_of_nexthops = \
|
||||||
|
set(list2).difference(list1)
|
||||||
|
additional_nexthops_in_required_nhs = \
|
||||||
|
set(list1).difference(list2)
|
||||||
|
|
||||||
|
if list2:
|
||||||
|
if additional_nexthops_in_required_nhs:
|
||||||
|
logger.info("Missing nexthop %s for route"\
|
||||||
|
" %s in RIB of router %s\n", \
|
||||||
|
additional_nexthops_in_required_nhs, \
|
||||||
|
st_rt, dut)
|
||||||
|
errormsg=("Nexthop {} is Missing for "\
|
||||||
|
"route {} in RIB of router {}\n".format(
|
||||||
|
additional_nexthops_in_required_nhs,
|
||||||
|
st_rt, dut))
|
||||||
|
return errormsg
|
||||||
|
else:
|
||||||
|
nh_found = True
|
||||||
|
if aspath:
|
||||||
|
found_paths = rib_routes_json["routes"][
|
||||||
|
st_rt][0]["path"]
|
||||||
|
if aspath == found_paths:
|
||||||
|
aspath_found = True
|
||||||
|
logger.info("Found AS path {} for route" \
|
||||||
|
" {} in RIB of router "\
|
||||||
|
"{}\n".format(aspath, st_rt, dut))
|
||||||
|
else:
|
||||||
|
errormsg=("AS Path {} is missing for route"\
|
||||||
|
"for route {} in RIB of router {}\n"\
|
||||||
|
.format(aspath, st_rt, dut))
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
else:
|
||||||
|
missing_routes.append(st_rt)
|
||||||
|
|
||||||
|
if nh_found:
|
||||||
|
logger.info("Found next_hop {} for all bgp"
|
||||||
|
" routes in RIB of"
|
||||||
|
" router {}\n".format(next_hop, \
|
||||||
|
router))
|
||||||
|
|
||||||
|
if len(missing_routes) > 0:
|
||||||
|
errormsg = ("Missing route in RIB of router {}, "
|
||||||
|
"routes: {}\n".format(dut, missing_routes))
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
if found_routes:
|
||||||
|
logger.info("Verified routes in router {} BGP RIB, "
|
||||||
|
"found routes are: {} \n".\
|
||||||
|
format(dut, found_routes))
|
||||||
|
continue
|
||||||
|
|
||||||
|
if "bgp" not in input_dict[routerInput]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Advertise networks
|
||||||
|
bgp_data_list = input_dict[routerInput]["bgp"]
|
||||||
|
|
||||||
|
if type(bgp_data_list) is not list:
|
||||||
|
bgp_data_list = [bgp_data_list]
|
||||||
|
|
||||||
|
for bgp_data in bgp_data_list:
|
||||||
|
vrf_id = bgp_data.setdefault("vrf", None)
|
||||||
|
if vrf_id:
|
||||||
|
cmd = "{} vrf {} {}".\
|
||||||
|
format(command, vrf_id, addr_type)
|
||||||
|
else:
|
||||||
|
cmd = "{} {}".\
|
||||||
|
format(command, addr_type)
|
||||||
|
|
||||||
|
cmd = "{} json".format(cmd)
|
||||||
|
|
||||||
|
rib_routes_json = run_frr_cmd(rnode, cmd, isjson=True)
|
||||||
|
|
||||||
|
# Verifying output dictionary rib_routes_json is not empty
|
||||||
|
if bool(rib_routes_json) == False:
|
||||||
|
errormsg = "No route found in rib of router {}..". \
|
||||||
|
format(router)
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
bgp_net_advertise = bgp_data["address_family"][addr_type]["unicast"]
|
||||||
|
advertise_network = \
|
||||||
|
bgp_net_advertise.setdefault("advertise_networks", [])
|
||||||
|
|
||||||
|
for advertise_network_dict in advertise_network:
|
||||||
|
found_routes = []
|
||||||
|
missing_routes = []
|
||||||
|
found = False
|
||||||
|
|
||||||
|
network = advertise_network_dict['network']
|
||||||
|
|
||||||
|
if 'no_of_network' in advertise_network_dict:
|
||||||
|
no_of_network = advertise_network_dict[
|
||||||
|
'no_of_network']
|
||||||
|
else:
|
||||||
|
no_of_network = 1
|
||||||
|
|
||||||
|
# Generating IPs for verification
|
||||||
|
ip_list = generate_ips(network, no_of_network)
|
||||||
|
|
||||||
|
for st_rt in ip_list:
|
||||||
|
st_rt = str(ipaddr.IPNetwork(unicode(st_rt)))
|
||||||
|
|
||||||
|
_addr_type = validate_ip_address(st_rt)
|
||||||
|
if _addr_type != addr_type:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if st_rt in rib_routes_json["routes"]:
|
||||||
|
found = True
|
||||||
|
found_routes.append(st_rt)
|
||||||
|
else:
|
||||||
|
found = False
|
||||||
|
missing_routes.append(st_rt)
|
||||||
|
|
||||||
|
if len(missing_routes) > 0:
|
||||||
|
errormsg = ("Missing route in BGP RIB of router {},"
|
||||||
|
" are: {}\n".format(dut, missing_routes))
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
if found_routes:
|
||||||
|
logger.info("Verified routes in router {} BGP RIB, found "
|
||||||
|
"routes are: {}\n".format(dut, found_routes))
|
||||||
|
|
||||||
|
logger.debug("Exiting lib API: verify_bgp_rib()")
|
||||||
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user