mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
topotests: bgp_bmp, add vpn tests
Test vpn prefixes sending to BMP Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
8d3546f669
commit
55586065c8
@ -9,6 +9,14 @@ router bgp 65501
|
||||
bmp connect 192.0.2.10 port 1789 min-retry 100 max-retry 10000
|
||||
exit
|
||||
!
|
||||
address-family ipv4 vpn
|
||||
neighbor 192.168.0.2 activate
|
||||
neighbor 192.168.0.2 soft-reconfiguration inbound
|
||||
exit-address-family
|
||||
address-family ipv6 vpn
|
||||
neighbor 192:168::2 activate
|
||||
neighbor 192:168::2 soft-reconfiguration inbound
|
||||
exit-address-family
|
||||
address-family ipv4 unicast
|
||||
neighbor 192.168.0.2 activate
|
||||
neighbor 192.168.0.2 soft-reconfiguration inbound
|
||||
@ -20,3 +28,21 @@ router bgp 65501
|
||||
neighbor 192:168::2 soft-reconfiguration inbound
|
||||
exit-address-family
|
||||
!
|
||||
router bgp 65502 vrf vrf1
|
||||
bgp router_id 192.168.0.1
|
||||
bgp log-neighbor-changes
|
||||
address-family ipv4 unicast
|
||||
label vpn export 101
|
||||
rd vpn export 444:1
|
||||
rt vpn both 52:100
|
||||
export vpn
|
||||
import vpn
|
||||
exit-address-family
|
||||
address-family ipv6 unicast
|
||||
label vpn export 103
|
||||
rd vpn export 555:1
|
||||
rt vpn both 54:200
|
||||
export vpn
|
||||
import vpn
|
||||
exit-address-family
|
||||
exit
|
||||
|
@ -11,9 +11,36 @@ router bgp 65502
|
||||
no neighbor 192:168::1 activate
|
||||
redistribute connected
|
||||
exit-address-family
|
||||
!
|
||||
address-family ipv4 vpn
|
||||
neighbor 192.168.0.1 activate
|
||||
exit-address-family
|
||||
!
|
||||
address-family ipv6 vpn
|
||||
neighbor 192:168::1 activate
|
||||
exit-address-family
|
||||
!
|
||||
address-family ipv6 unicast
|
||||
neighbor 192:168::1 activate
|
||||
redistribute connected
|
||||
exit-address-family
|
||||
!
|
||||
router bgp 65502 vrf vrf1
|
||||
bgp router-id 192.168.0.2
|
||||
bgp log-neighbor-changes
|
||||
no bgp network import-check
|
||||
address-family ipv4 unicast
|
||||
label vpn export 102
|
||||
rd vpn export 444:2
|
||||
rt vpn both 52:100
|
||||
export vpn
|
||||
import vpn
|
||||
exit-address-family
|
||||
address-family ipv6 unicast
|
||||
label vpn export 105
|
||||
rd vpn export 555:2
|
||||
rt vpn both 54:200
|
||||
export vpn
|
||||
import vpn
|
||||
exit-address-family
|
||||
exit
|
||||
|
@ -174,7 +174,7 @@ def configure_prefixes(tgen, node, asn, safi, prefixes, vrf=None, update=True):
|
||||
Configure the bgp prefixes.
|
||||
"""
|
||||
withdraw = "no " if not update else ""
|
||||
vrf = " vrf {}" if vrf else ""
|
||||
vrf = " vrf {}".format(vrf) if vrf else ""
|
||||
for p in prefixes:
|
||||
ip = ip_network(p)
|
||||
cmd = [
|
||||
@ -216,6 +216,34 @@ def unicast_prefixes(policy):
|
||||
assert success, "Checking the withdrawed prefixes has been failed !."
|
||||
|
||||
|
||||
def vpn_prefixes(policy):
|
||||
"""
|
||||
Setup the BMP monitor policy, Add and withdraw ipv4/v6 prefixes.
|
||||
Check if the previous actions are logged in the BMP server with the right
|
||||
message type and the right policy.
|
||||
"""
|
||||
tgen = get_topogen()
|
||||
set_bmp_policy(tgen, "r1", 65501, "bmp1", "vpn", policy)
|
||||
|
||||
prefixes = ["172.31.10.1/32", "2001::2222/128"]
|
||||
# add prefixes
|
||||
configure_prefixes(tgen, "r2", 65502, "unicast", prefixes, vrf="vrf1")
|
||||
|
||||
logger.info("checking for updated prefixes")
|
||||
# check
|
||||
test_func = partial(check_for_prefixes, prefixes, "update", policy)
|
||||
success, _ = topotest.run_and_expect(test_func, True, wait=0.5)
|
||||
assert success, "Checking the updated prefixes has been failed !."
|
||||
|
||||
# withdraw prefixes
|
||||
configure_prefixes(tgen, "r2", 65502, "unicast", prefixes, vrf="vrf1", update=False)
|
||||
logger.info("checking for withdrawed prefixes")
|
||||
# check
|
||||
test_func = partial(check_for_prefixes, prefixes, "withdraw", policy)
|
||||
success, _ = topotest.run_and_expect(test_func, True, wait=0.5)
|
||||
assert success, "Checking the withdrawed prefixes has been failed !."
|
||||
|
||||
|
||||
def test_bmp_server_logging():
|
||||
"""
|
||||
Assert the logging of the bmp server.
|
||||
@ -244,6 +272,16 @@ def test_bmp_bgp_unicast():
|
||||
unicast_prefixes(LOC_RIB)
|
||||
|
||||
|
||||
def test_bmp_bgp_vpn():
|
||||
# check for the prefixes in the BMP server logging file
|
||||
logger.info("***** VPN prefixes pre-policy logging *****")
|
||||
vpn_prefixes(PRE_POLICY)
|
||||
logger.info("***** VPN prefixes post-policy logging *****")
|
||||
vpn_prefixes(POST_POLICY)
|
||||
logger.info("***** VPN prefixes loc-rib logging *****")
|
||||
vpn_prefixes(LOC_RIB)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = ["-s"] + sys.argv[1:]
|
||||
sys.exit(pytest.main(args))
|
||||
|
Loading…
Reference in New Issue
Block a user