mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 13:46:45 +00:00
topotests: convert bgp_prefix_sid to exabgp 4
Convert bgp_prefix_sid to exabgp 4 Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
cfcad6fd99
commit
811ad11a7e
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
[exabgp.api]
|
[exabgp.api]
|
||||||
|
ack = false
|
||||||
encoder = text
|
encoder = text
|
||||||
highres = false
|
highres = false
|
||||||
respawn = false
|
respawn = false
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
group controller {
|
|
||||||
neighbor 10.0.0.1 {
|
neighbor 10.0.0.1 {
|
||||||
router-id 10.0.0.101;
|
router-id 10.0.0.101;
|
||||||
local-address 10.0.0.101;
|
local-address 10.0.0.101;
|
||||||
@ -100,4 +99,3 @@ group controller {
|
|||||||
route 3.0.0.3/32 next-hop 10.0.0.101 label [800003] attribute [0x28 0xc0 0x0100070000000000000303000800000c350000000a];
|
route 3.0.0.3/32 next-hop 10.0.0.101 label [800003] attribute [0x28 0xc0 0x0100070000000000000303000800000c350000000a];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
group controller {
|
|
||||||
|
|
||||||
process receive-routes {
|
process receive-routes {
|
||||||
run "/etc/exabgp/exa-receive.py --no-timestamp 2";
|
run /etc/exabgp/exa-receive.py --no-timestamp 2;
|
||||||
receive-routes;
|
|
||||||
encoder json;
|
encoder json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,5 +12,11 @@ group controller {
|
|||||||
family {
|
family {
|
||||||
ipv4 nlri-mpls;
|
ipv4 nlri-mpls;
|
||||||
}
|
}
|
||||||
|
api {
|
||||||
|
processes [ receive-routes ];
|
||||||
|
receive {
|
||||||
|
parsed;
|
||||||
|
update;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,12 +120,8 @@ def exabgp_get_update_prefix(filename, afi, nexthop, prefix):
|
|||||||
ret = ret.get(afi)
|
ret = ret.get(afi)
|
||||||
if ret is None:
|
if ret is None:
|
||||||
continue
|
continue
|
||||||
ret = ret.get(nexthop)
|
for nh in ret.get(nexthop, []):
|
||||||
if ret is None:
|
if nh.get("nlri") == prefix:
|
||||||
continue
|
|
||||||
ret = ret.get(prefix)
|
|
||||||
if ret is None:
|
|
||||||
continue
|
|
||||||
return output
|
return output
|
||||||
return "Not found"
|
return "Not found"
|
||||||
|
|
||||||
@ -135,33 +131,39 @@ def test_peer2_receive_prefix_sid_type1():
|
|||||||
peer2 = tgen.gears["peer2"]
|
peer2 = tgen.gears["peer2"]
|
||||||
logfile = "{}/{}-received.log".format(peer2.gearlogdir, peer2.name)
|
logfile = "{}/{}-received.log".format(peer2.gearlogdir, peer2.name)
|
||||||
|
|
||||||
def _check_type1_peer2(prefix, labelindex):
|
def _check_type1_peer2(prefix, label):
|
||||||
output = exabgp_get_update_prefix(
|
output = exabgp_get_update_prefix(
|
||||||
logfile, "ipv4 nlri-mpls", "10.0.0.101", prefix
|
logfile, "ipv4 nlri-mpls", "10.0.0.101", prefix
|
||||||
)
|
)
|
||||||
expected = {
|
expected = {
|
||||||
"type": "update",
|
"type": "update",
|
||||||
"neighbor": {
|
"neighbor": {
|
||||||
"ip": "10.0.0.1",
|
"address": {
|
||||||
|
"peer": "10.0.0.1",
|
||||||
|
},
|
||||||
"message": {
|
"message": {
|
||||||
"update": {
|
"update": {
|
||||||
"attribute": {
|
"announce": {
|
||||||
"attribute-0x28-0xE0": "0x010007000000{:08x}".format(
|
"ipv4 nlri-mpls": {
|
||||||
labelindex
|
"10.0.0.101": [
|
||||||
)
|
{
|
||||||
|
"nlri": prefix,
|
||||||
|
"label": [[label]],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"announce": {"ipv4 nlri-mpls": {"10.0.0.101": {}}},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return topotest.json_cmp(output, expected)
|
return topotest.json_cmp(output, expected)
|
||||||
|
|
||||||
test_func = functools.partial(_check_type1_peer2, "3.0.0.1/32", labelindex=1)
|
test_func = functools.partial(_check_type1_peer2, "3.0.0.1/32", label=8001)
|
||||||
success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
|
success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
|
||||||
assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2")
|
assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2")
|
||||||
|
|
||||||
test_func = functools.partial(_check_type1_peer2, "3.0.0.2/32", labelindex=2)
|
test_func = functools.partial(_check_type1_peer2, "3.0.0.2/32", label=8002)
|
||||||
success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
|
success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
|
||||||
assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2")
|
assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user