mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-26 03:07:51 +00:00
topotests: bgp_evpn_rt5, add test for advertise route-map service
Use the advertise route-map command, and check that it filters out correctly the undesirable prefixes. Reversely, check that undoing that route-map recovers all prefixes. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
fe272d3508
commit
b8b7a615ac
191
tests/topotests/bgp_evpn_rt5/r1/bgp_l2vpn_evpn_routes_all.json
Normal file
191
tests/topotests/bgp_evpn_rt5/r1/bgp_l2vpn_evpn_routes_all.json
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
{
|
||||||
|
"bgpLocalRouterId":"192.168.100.21",
|
||||||
|
"defaultLocPrf":100,
|
||||||
|
"localAS":65000,
|
||||||
|
"192.168.101.41:2":{
|
||||||
|
"rd":"192.168.101.41:2",
|
||||||
|
"[5]:[0]:[32]:[192.168.101.41]":{
|
||||||
|
"prefix":"[5]:[0]:[32]:[192.168.101.41]",
|
||||||
|
"prefixLen":352,
|
||||||
|
"paths":[
|
||||||
|
{
|
||||||
|
"valid":true,
|
||||||
|
"bestpath":true,
|
||||||
|
"selectionReason":"First path received",
|
||||||
|
"pathFrom":"internal",
|
||||||
|
"routeType":5,
|
||||||
|
"ethTag":0,
|
||||||
|
"ipLen":32,
|
||||||
|
"ip":"192.168.101.41",
|
||||||
|
"metric":0,
|
||||||
|
"locPrf":100,
|
||||||
|
"weight":0,
|
||||||
|
"peerId":"192.168.100.41",
|
||||||
|
"path":"",
|
||||||
|
"origin":"IGP",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"ip":"192.168.100.41",
|
||||||
|
"hostname":"r2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"used":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"[5]:[0]:[32]:[192.168.102.41]":{
|
||||||
|
"prefix":"[5]:[0]:[32]:[192.168.102.41]",
|
||||||
|
"prefixLen":352,
|
||||||
|
"paths":[
|
||||||
|
{
|
||||||
|
"valid":true,
|
||||||
|
"bestpath":true,
|
||||||
|
"selectionReason":"First path received",
|
||||||
|
"pathFrom":"internal",
|
||||||
|
"routeType":5,
|
||||||
|
"ethTag":0,
|
||||||
|
"ipLen":32,
|
||||||
|
"ip":"192.168.102.41",
|
||||||
|
"metric":0,
|
||||||
|
"locPrf":100,
|
||||||
|
"weight":0,
|
||||||
|
"peerId":"192.168.100.41",
|
||||||
|
"path":"",
|
||||||
|
"origin":"IGP",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"ip":"192.168.100.41",
|
||||||
|
"hostname":"r2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"used":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"[5]:[0]:[128]:[fd00::2]":{
|
||||||
|
"prefix":"[5]:[0]:[128]:[fd00::2]",
|
||||||
|
"prefixLen":352,
|
||||||
|
"paths":[
|
||||||
|
{
|
||||||
|
"valid":true,
|
||||||
|
"bestpath":true,
|
||||||
|
"selectionReason":"First path received",
|
||||||
|
"pathFrom":"internal",
|
||||||
|
"routeType":5,
|
||||||
|
"ethTag":0,
|
||||||
|
"ipLen":128,
|
||||||
|
"ip":"fd00::2",
|
||||||
|
"metric":0,
|
||||||
|
"locPrf":100,
|
||||||
|
"weight":0,
|
||||||
|
"peerId":"192.168.100.41",
|
||||||
|
"path":"",
|
||||||
|
"origin":"IGP",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"ip":"192.168.100.41",
|
||||||
|
"hostname":"r2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"used":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"[5]:[0]:[128]:[fd00::3]":{
|
||||||
|
"prefix":"[5]:[0]:[128]:[fd00::3]",
|
||||||
|
"prefixLen":352,
|
||||||
|
"paths":[
|
||||||
|
{
|
||||||
|
"valid":true,
|
||||||
|
"bestpath":true,
|
||||||
|
"selectionReason":"First path received",
|
||||||
|
"pathFrom":"internal",
|
||||||
|
"routeType":5,
|
||||||
|
"ethTag":0,
|
||||||
|
"ipLen":128,
|
||||||
|
"ip":"fd00::3",
|
||||||
|
"metric":0,
|
||||||
|
"locPrf":100,
|
||||||
|
"weight":0,
|
||||||
|
"peerId":"192.168.100.41",
|
||||||
|
"path":"",
|
||||||
|
"origin":"IGP",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"ip":"192.168.100.41",
|
||||||
|
"hostname":"r2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"used":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"192.168.102.21:2":{
|
||||||
|
"rd":"192.168.102.21:2",
|
||||||
|
"[5]:[0]:[32]:[192.168.102.21]":{
|
||||||
|
"prefix":"[5]:[0]:[32]:[192.168.102.21]",
|
||||||
|
"prefixLen":352,
|
||||||
|
"paths":[
|
||||||
|
{
|
||||||
|
"valid":true,
|
||||||
|
"bestpath":true,
|
||||||
|
"selectionReason":"First path received",
|
||||||
|
"pathFrom":"external",
|
||||||
|
"routeType":5,
|
||||||
|
"ethTag":0,
|
||||||
|
"ipLen":32,
|
||||||
|
"ip":"192.168.102.21",
|
||||||
|
"metric":0,
|
||||||
|
"weight":32768,
|
||||||
|
"peerId":"(unspec)",
|
||||||
|
"path":"",
|
||||||
|
"origin":"IGP",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"ip":"192.168.100.21",
|
||||||
|
"hostname":"r1",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"used":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"[5]:[0]:[128]:[fd00::1]":{
|
||||||
|
"prefix":"[5]:[0]:[128]:[fd00::1]",
|
||||||
|
"prefixLen":352,
|
||||||
|
"paths":[
|
||||||
|
{
|
||||||
|
"valid":true,
|
||||||
|
"bestpath":true,
|
||||||
|
"selectionReason":"First path received",
|
||||||
|
"pathFrom":"external",
|
||||||
|
"routeType":5,
|
||||||
|
"ethTag":0,
|
||||||
|
"ipLen":128,
|
||||||
|
"ip":"fd00::1",
|
||||||
|
"metric":0,
|
||||||
|
"weight":32768,
|
||||||
|
"peerId":"(unspec)",
|
||||||
|
"path":"",
|
||||||
|
"origin":"IGP",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"ip":"192.168.100.21",
|
||||||
|
"hostname":"r1",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"used":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"numPrefix":6,
|
||||||
|
"totalPrefix":6
|
||||||
|
}
|
@ -20,12 +20,30 @@ router bgp 65000 vrf r2-vrf-101
|
|||||||
no bgp network import-check
|
no bgp network import-check
|
||||||
address-family ipv4 unicast
|
address-family ipv4 unicast
|
||||||
network 192.168.101.41/32
|
network 192.168.101.41/32
|
||||||
|
network 192.168.102.41/32
|
||||||
exit-address-family
|
exit-address-family
|
||||||
address-family ipv6 unicast
|
address-family ipv6 unicast
|
||||||
network fd00::2/128
|
network fd00::2/128
|
||||||
|
network fd00::3/128
|
||||||
exit-address-family
|
exit-address-family
|
||||||
address-family l2vpn evpn
|
address-family l2vpn evpn
|
||||||
advertise ipv4 unicast
|
advertise ipv4 unicast route-map rmap4
|
||||||
advertise ipv6 unicast
|
advertise ipv6 unicast route-map rmap6
|
||||||
exit-address-family
|
exit-address-family
|
||||||
!
|
!
|
||||||
|
access-list acl4_1 seq 10 permit 192.168.101.41/32
|
||||||
|
access-list acl4_2 seq 10 permit 192.168.102.41/32
|
||||||
|
ipv6 access-list acl6_1 seq 10 permit fd00::2/128
|
||||||
|
ipv6 access-list acl6_2 seq 10 permit fd00::3/128
|
||||||
|
route-map rmap4 permit 1
|
||||||
|
match ip address acl4_1
|
||||||
|
exit
|
||||||
|
route-map rmap4 deny 2
|
||||||
|
match ip address acl4_2
|
||||||
|
exit
|
||||||
|
route-map rmap6 permit 1
|
||||||
|
match ipv6 address acl6_1
|
||||||
|
exit
|
||||||
|
route-map rmap6 deny 2
|
||||||
|
match ipv6 address acl6_2
|
||||||
|
exit
|
||||||
|
@ -347,6 +347,40 @@ def test_evpn_ping():
|
|||||||
_test_evpn_ping_router(tgen.gears["r1"])
|
_test_evpn_ping_router(tgen.gears["r1"])
|
||||||
|
|
||||||
|
|
||||||
|
def test_evpn_disable_routemap():
|
||||||
|
"""
|
||||||
|
Check the removal of a route-map on R2. More EVPN Prefixes are expected
|
||||||
|
"""
|
||||||
|
tgen = get_topogen()
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
tgen.gears["r2"].vtysh_cmd(
|
||||||
|
"""
|
||||||
|
configure terminal\n
|
||||||
|
router bgp 65000 vrf r2-vrf-101\n
|
||||||
|
address-family l2vpn evpn\n
|
||||||
|
advertise ipv4 unicast\n
|
||||||
|
advertise ipv6 unicast\n
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
router = tgen.gears["r1"]
|
||||||
|
json_file = "{}/{}/bgp_l2vpn_evpn_routes_all.json".format(CWD, router.name)
|
||||||
|
if not os.path.isfile(json_file):
|
||||||
|
assert 0, "bgp_l2vpn_evpn_routes.json file not found"
|
||||||
|
|
||||||
|
expected = json.loads(open(json_file).read())
|
||||||
|
test_func = partial(
|
||||||
|
topotest.router_json_cmp,
|
||||||
|
router,
|
||||||
|
"show bgp l2vpn evpn json",
|
||||||
|
expected,
|
||||||
|
)
|
||||||
|
_, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
|
||||||
|
assertmsg = '"{}" JSON output mismatches'.format(router.name)
|
||||||
|
assert result is None, assertmsg
|
||||||
|
|
||||||
|
|
||||||
def test_evpn_remove_ip():
|
def test_evpn_remove_ip():
|
||||||
"""
|
"""
|
||||||
Check the removal of an EVPN route is correctly handled
|
Check the removal of an EVPN route is correctly handled
|
||||||
@ -360,6 +394,7 @@ def test_evpn_remove_ip():
|
|||||||
"raw_config": [
|
"raw_config": [
|
||||||
"router bgp 65000 vrf r2-vrf-101",
|
"router bgp 65000 vrf r2-vrf-101",
|
||||||
"address-family ipv6 unicast",
|
"address-family ipv6 unicast",
|
||||||
|
"no network fd00::3/128",
|
||||||
"no network fd00::2/128",
|
"no network fd00::2/128",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user