mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-14 13:57:25 +00:00
tests: bgp_vpnv4_route_leak_basic add del static prefix
In bgp_vpnv4_route_leak_basic, remove and add back the static prefix 172.16.3.0/24 on VRF DONNA. Before the previous fixes, the 172.16.3.0/24 prefix re-appeared when it was added back in the VPN table but it was marked as invalid. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
1e826d5d0c
commit
fcae7a401d
@ -1,3 +1,7 @@
|
||||
vrf DONNA
|
||||
ip route 172.16.3.0/24 10.0.0.254
|
||||
exit-vrf
|
||||
!
|
||||
int dummy0
|
||||
ip address 10.0.4.1/24
|
||||
no shut
|
||||
@ -46,6 +50,7 @@ router bgp 99 vrf DONNA
|
||||
no bgp ebgp-requires-policy
|
||||
address-family ipv4 unicast
|
||||
redistribute connected
|
||||
network 172.16.3.0/24
|
||||
label vpn export 101
|
||||
rd vpn export 10.0.4.1:1
|
||||
rt vpn export 10.0.4.1:101
|
||||
|
@ -112,6 +112,24 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.3.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "IGP",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "DONNA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.101.0/24": [
|
||||
{
|
||||
"valid": null,
|
||||
|
@ -0,0 +1,103 @@
|
||||
{
|
||||
"routerId": "10.0.4.1",
|
||||
"localAS": 99,
|
||||
"routes": {
|
||||
"routeDistinguishers": {
|
||||
"10.0.4.1:1": {
|
||||
"10.0.0.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "incomplete",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "DONNA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"10.0.1.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "incomplete",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "EVA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"10.0.2.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "incomplete",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "DONNA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"10.0.3.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "incomplete",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "EVA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"10.0.4.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "incomplete",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "default",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.3.0/24": null,
|
||||
"172.16.101.0/24": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,24 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.3.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "IGP",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "DONNA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.101.0/24": null
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,24 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.3.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "IGP",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "DONNA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.101.0/24": null
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,24 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.3.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "IGP",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "DONNA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"172.16.101.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
|
@ -136,6 +136,19 @@ def test_vrf_route_leak_donna():
|
||||
],
|
||||
},
|
||||
],
|
||||
"172.16.3.0/24": [
|
||||
{
|
||||
"protocol": "static",
|
||||
"selected": True,
|
||||
"nexthops": [
|
||||
{
|
||||
"fib": True,
|
||||
"interfaceName": "dummy1",
|
||||
"active": True,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
"172.16.101.0/24": None,
|
||||
}
|
||||
|
||||
@ -195,6 +208,20 @@ def test_vrf_route_leak_eva():
|
||||
"protocol": "connected",
|
||||
}
|
||||
],
|
||||
"172.16.3.0/24": [
|
||||
{
|
||||
"protocol": "bgp",
|
||||
"selected": True,
|
||||
"nexthops": [
|
||||
{
|
||||
"fib": True,
|
||||
"interfaceName": "DONNA",
|
||||
"vrf": "DONNA",
|
||||
"active": True,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
"172.16.101.0/24": None,
|
||||
}
|
||||
|
||||
@ -249,6 +276,20 @@ def test_vrf_route_leak_default():
|
||||
"protocol": "connected",
|
||||
}
|
||||
],
|
||||
"172.16.3.0/24": [
|
||||
{
|
||||
"protocol": "bgp",
|
||||
"selected": True,
|
||||
"nexthops": [
|
||||
{
|
||||
"fib": True,
|
||||
"interfaceName": "DONNA",
|
||||
"vrf": "DONNA",
|
||||
"active": True,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
test_func = partial(topotest.router_json_cmp, r1, "show ip route json", expect)
|
||||
@ -495,6 +536,93 @@ def test_vrf_route_leak_donna_delete_vrf_zita():
|
||||
assert result, "BGP IPv4 VPN table check failed:\n{}".format(diff)
|
||||
|
||||
|
||||
def test_vrf_route_leak_default_delete_prefix():
|
||||
logger.info(
|
||||
"Remove BGP static prefix 172.16.3.0/24 from VRF DONNA and ensure that the route is deleted on default"
|
||||
)
|
||||
tgen = get_topogen()
|
||||
# Don't run this test if we have any failure.
|
||||
if tgen.routers_have_failure():
|
||||
pytest.skip(tgen.errors)
|
||||
|
||||
r1 = tgen.gears["r1"]
|
||||
r1.vtysh_cmd(
|
||||
"""
|
||||
configure
|
||||
router bgp 99 vrf DONNA
|
||||
address-family ipv4 unicast
|
||||
no network 172.16.3.0/24
|
||||
"""
|
||||
)
|
||||
|
||||
# Test default VRF.
|
||||
expect = {
|
||||
"172.16.3.0/24": None,
|
||||
}
|
||||
|
||||
test_func = partial(topotest.router_json_cmp, r1, "show ip route json", expect)
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP VRF default check failed:\n{}".format(diff)
|
||||
|
||||
# check BGP IPv4 VPN table
|
||||
json_file = "{}/{}/show_bgp_ipv4_vpn_del_donna_prefix.json".format(CWD, r1.name)
|
||||
expect = json.loads(open(json_file).read())
|
||||
|
||||
test_func = partial(topotest.router_json_cmp, r1, "show bgp ipv4 vpn json", expect)
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP IPv4 VPN table check failed:\n{}".format(diff)
|
||||
|
||||
|
||||
def test_vrf_route_leak_default_prefix_back():
|
||||
logger.info(
|
||||
"Set back BGP static prefix 172.16.3.0/24 to VRF DONNA and ensure that the route is set on default"
|
||||
)
|
||||
tgen = get_topogen()
|
||||
# Don't run this test if we have any failure.
|
||||
if tgen.routers_have_failure():
|
||||
pytest.skip(tgen.errors)
|
||||
|
||||
r1 = tgen.gears["r1"]
|
||||
r1.vtysh_cmd(
|
||||
"""
|
||||
configure
|
||||
router bgp 99 vrf DONNA
|
||||
address-family ipv4 unicast
|
||||
network 172.16.3.0/24
|
||||
"""
|
||||
)
|
||||
|
||||
# Test default VRF.
|
||||
expect = {
|
||||
"172.16.3.0/24": [
|
||||
{
|
||||
"protocol": "bgp",
|
||||
"selected": True,
|
||||
"nexthops": [
|
||||
{
|
||||
"fib": True,
|
||||
"interfaceName": "DONNA",
|
||||
"vrf": "DONNA",
|
||||
"active": True,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
test_func = partial(topotest.router_json_cmp, r1, "show ip route json", expect)
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP VRF default check failed:\n{}".format(diff)
|
||||
|
||||
# check BGP IPv4 VPN table
|
||||
json_file = "{}/{}/show_bgp_ipv4_vpn_init.json".format(CWD, r1.name)
|
||||
expect = json.loads(open(json_file).read())
|
||||
|
||||
test_func = partial(topotest.router_json_cmp, r1, "show bgp ipv4 vpn json", expect)
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP IPv4 VPN table check failed:\n{}".format(diff)
|
||||
|
||||
|
||||
def test_memory_leak():
|
||||
"Run the memory leak test and report results."
|
||||
tgen = get_topogen()
|
||||
|
Loading…
Reference in New Issue
Block a user