mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 08:32:12 +00:00
tests: check bgp vpn table in bgp_vpnv4_route_leak_basic
Check bgp vpn table in bgp_vpnv4_route_leak_basic Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
5b22c79c3d
commit
1e826d5d0c
@ -28,6 +28,9 @@ ip router-id 10.0.4.1
|
||||
!
|
||||
router bgp 99
|
||||
no bgp ebgp-requires-policy
|
||||
! 10.0.4.254 peer session will not be established
|
||||
! it is there just to activate the ipv4 vpn table
|
||||
neighbor 10.0.4.254 remote-as external
|
||||
address-family ipv4 unicast
|
||||
redistribute connected
|
||||
rd vpn export 10.0.4.1:1
|
||||
@ -36,6 +39,8 @@ router bgp 99
|
||||
export vpn
|
||||
import vpn
|
||||
!
|
||||
address-family ipv4 vpn
|
||||
neighbor 10.0.4.254 activate
|
||||
!
|
||||
router bgp 99 vrf DONNA
|
||||
no bgp ebgp-requires-policy
|
||||
|
@ -0,0 +1,137 @@
|
||||
{
|
||||
"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": [
|
||||
{
|
||||
"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,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "IGP",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "ZITA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,102 @@
|
||||
{
|
||||
"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": null,
|
||||
"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": null,
|
||||
"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.101.0/24": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,102 @@
|
||||
{
|
||||
"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.101.0/24": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,119 @@
|
||||
{
|
||||
"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.101.0/24": [
|
||||
{
|
||||
"valid": true,
|
||||
"pathFrom": "external",
|
||||
"path": "",
|
||||
"origin": "IGP",
|
||||
"announceNexthopSelf": true,
|
||||
"nhVrfName": "ZITA",
|
||||
"nexthops": [
|
||||
{
|
||||
"ip": "0.0.0.0",
|
||||
"hostname": "r1",
|
||||
"afi": "ipv4",
|
||||
"used": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
Test basic VPNv4 route leaking
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from functools import partial
|
||||
@ -60,6 +61,22 @@ def teardown_module(mod):
|
||||
tgen.stop_topology()
|
||||
|
||||
|
||||
def test_bgp_convergence():
|
||||
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"]
|
||||
|
||||
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_vrf_route_leak_donna():
|
||||
logger.info("Ensure that routes are leaked back and forth")
|
||||
tgen = get_topogen()
|
||||
@ -297,6 +314,14 @@ interface EVA
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP VRF DONNA check failed:\n{}".format(diff)
|
||||
|
||||
# check BGP IPv4 VPN table
|
||||
json_file = "{}/{}/show_bgp_ipv4_vpn_eva_down.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_donna_after_eva_up():
|
||||
logger.info("Ensure that route states change after EVA interface goes up")
|
||||
@ -352,6 +377,14 @@ interface EVA
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP VRF DONNA 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_vrf_route_leak_donna_add_vrf_zita():
|
||||
logger.info("Add VRF ZITA and ensure that the route from VRF ZITA is updated")
|
||||
@ -374,6 +407,14 @@ def test_vrf_route_leak_donna_add_vrf_zita():
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP VRF DONNA check failed:\n{}".format(diff)
|
||||
|
||||
# check BGP IPv4 VPN table
|
||||
json_file = "{}/{}/show_bgp_ipv4_vpn_add_zita.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_donna_set_zita_up():
|
||||
logger.info("Set VRF ZITA up and ensure that the route from VRF ZITA is updated")
|
||||
@ -415,6 +456,14 @@ interface ZITA
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP VRF DONNA check failed:\n{}".format(diff)
|
||||
|
||||
# check BGP IPv4 VPN table
|
||||
json_file = "{}/{}/show_bgp_ipv4_vpn_zita_up.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_donna_delete_vrf_zita():
|
||||
logger.info("Delete VRF ZITA and ensure that the route from VRF ZITA is deleted")
|
||||
@ -437,6 +486,14 @@ def test_vrf_route_leak_donna_delete_vrf_zita():
|
||||
result, diff = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||
assert result, "BGP VRF DONNA 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."
|
||||
|
Loading…
Reference in New Issue
Block a user