mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 17:18:56 +00:00
tests: Adding bgp tests for prefix-lists
Signed-off-by: Ashish Pant <ashish12pant@gmail.com> Adds mulitple test scenarios for prefix-lists in bgp. Verfication API for prefix-lits Also adds description for bgp-basic test suite
This commit is contained in:
parent
cb6b1d9058
commit
81e3d6095f
@ -30,6 +30,13 @@ Test steps
|
|||||||
- Bring up topology
|
- Bring up topology
|
||||||
- Verify for bgp to converge
|
- Verify for bgp to converge
|
||||||
- Modify/Delete and verify router-id
|
- Modify/Delete and verify router-id
|
||||||
|
- Modify and verify bgp timers
|
||||||
|
- Create and verify static routes
|
||||||
|
- Modify and verify admin distance for existing static routes
|
||||||
|
- Test advertise network using network command
|
||||||
|
- Verify clear bgp
|
||||||
|
- Test bgp convergence with loopback interface
|
||||||
|
- Test advertise network using network command
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
0
tests/topotests/bgp-prefix-list-topo1/__init__.py
Normal file
0
tests/topotests/bgp-prefix-list-topo1/__init__.py
Normal file
123
tests/topotests/bgp-prefix-list-topo1/prefix_lists.json
Normal file
123
tests/topotests/bgp-prefix-list-topo1/prefix_lists.json
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
{
|
||||||
|
"address_types": ["ipv4"],
|
||||||
|
"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", "add_static_route":"yes"},
|
||||||
|
"r2":{"ipv4":"auto", "ipv6":"auto"},
|
||||||
|
"r3":{"ipv4":"auto", "ipv6":"auto"}
|
||||||
|
},
|
||||||
|
"bgp":{
|
||||||
|
"local_as":"100",
|
||||||
|
"address_family": {
|
||||||
|
"ipv4": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r2": {
|
||||||
|
"dest_link": {
|
||||||
|
"r1": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"dest_link": {
|
||||||
|
"r1": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2":{
|
||||||
|
"links":{
|
||||||
|
"lo": {"ipv4": "auto", "ipv6": "auto", "type": "loopback", "add_static_route":"yes"},
|
||||||
|
"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": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3":{
|
||||||
|
"links":{
|
||||||
|
"lo": {"ipv4": "auto", "ipv6": "auto", "type": "loopback", "add_static_route":"yes"},
|
||||||
|
"r1":{"ipv4":"auto", "ipv6":"auto"},
|
||||||
|
"r2":{"ipv4":"auto", "ipv6":"auto"},
|
||||||
|
"r4":{"ipv4":"auto", "ipv6":"auto"}
|
||||||
|
},
|
||||||
|
"bgp":{
|
||||||
|
"local_as":"100",
|
||||||
|
"address_family": {
|
||||||
|
"ipv4": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r1": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r4": {
|
||||||
|
"dest_link": {
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r4":{
|
||||||
|
"links":{
|
||||||
|
"lo": {"ipv4": "auto", "ipv6": "auto", "type": "loopback", "add_static_route":"yes"},
|
||||||
|
"r3":{"ipv4":"auto", "ipv6":"auto"}
|
||||||
|
},
|
||||||
|
"bgp":{
|
||||||
|
"local_as":"200",
|
||||||
|
"address_family": {
|
||||||
|
"ipv4": {
|
||||||
|
"unicast": {
|
||||||
|
"neighbor": {
|
||||||
|
"r3": {
|
||||||
|
"dest_link": {
|
||||||
|
"r4": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1450
tests/topotests/bgp-prefix-list-topo1/test_prefix_lists.py
Executable file
1450
tests/topotests/bgp-prefix-list-topo1/test_prefix_lists.py
Executable file
File diff suppressed because it is too large
Load Diff
@ -1346,3 +1346,57 @@ def verify_admin_distance_for_static_routes(tgen, input_dict):
|
|||||||
|
|
||||||
logger.info("Exiting lib API: verify_admin_distance_for_static_routes()")
|
logger.info("Exiting lib API: verify_admin_distance_for_static_routes()")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def verify_prefix_lists(tgen, input_dict):
|
||||||
|
"""
|
||||||
|
Running "show ip prefix-list" command and verifying given prefix-list
|
||||||
|
is present in router.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
* `tgen` : topogen object
|
||||||
|
* `input_dict`: data to verify prefix lists
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
# To verify pf_list_1 is present in router r1
|
||||||
|
input_dict = {
|
||||||
|
"r1": {
|
||||||
|
"prefix_lists": ["pf_list_1"]
|
||||||
|
}}
|
||||||
|
result = verify_prefix_lists("ipv4", input_dict, tgen)
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
errormsg(str) or True
|
||||||
|
"""
|
||||||
|
|
||||||
|
logger.info("Entering lib API: verify_prefix_lists()")
|
||||||
|
|
||||||
|
for router in input_dict.keys():
|
||||||
|
if router not in tgen.routers():
|
||||||
|
continue
|
||||||
|
|
||||||
|
rnode = tgen.routers()[router]
|
||||||
|
|
||||||
|
# Show ip prefix list
|
||||||
|
show_prefix_list = rnode.vtysh_cmd("show ip prefix-list")
|
||||||
|
|
||||||
|
# Verify Prefix list is deleted
|
||||||
|
prefix_lists_addr = input_dict[router]["prefix_lists"]
|
||||||
|
for addr_type in prefix_lists_addr:
|
||||||
|
if not check_address_types(addr_type):
|
||||||
|
continue
|
||||||
|
|
||||||
|
for prefix_list in prefix_lists_addr[addr_type].keys():
|
||||||
|
if prefix_list in show_prefix_list:
|
||||||
|
errormsg = ("Prefix list {} is not deleted from router"
|
||||||
|
" {}".format(prefix_list, router))
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
logger.info("Prefix list %s is/are deleted successfully"
|
||||||
|
" from router %s", prefix_list, router)
|
||||||
|
|
||||||
|
logger.info("Exiting lib API: verify_prefix_lissts()")
|
||||||
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user