mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-26 07:03:59 +00:00
Merge pull request #17874 from pguibert6WIND/bgp_unnumbered_interface_json
Bgp unnumbered interface json
This commit is contained in:
commit
00eb5cccad
@ -9915,6 +9915,9 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
|
|||||||
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
|
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
|
||||||
|| (path->peer->conf_if)) {
|
|| (path->peer->conf_if)) {
|
||||||
json_nexthop_ll = json_object_new_object();
|
json_nexthop_ll = json_object_new_object();
|
||||||
|
if (path->peer->conf_if)
|
||||||
|
json_object_string_add(json_nexthop_ll, "interface",
|
||||||
|
path->peer->conf_if);
|
||||||
json_object_string_addf(
|
json_object_string_addf(
|
||||||
json_nexthop_ll, "ip", "%pI6",
|
json_nexthop_ll, "ip", "%pI6",
|
||||||
&attr->mp_nexthop_local);
|
&attr->mp_nexthop_local);
|
||||||
|
35
tests/topotests/bgp_ipv6_rtadv/r1/bgp_ipv4_routes.json
Normal file
35
tests/topotests/bgp_ipv6_rtadv/r1/bgp_ipv4_routes.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"vrfId": 0,
|
||||||
|
"vrfName": "default",
|
||||||
|
"routerId": "10.254.254.1",
|
||||||
|
"defaultLocPrf": 100,
|
||||||
|
"localAS": 101,
|
||||||
|
"routes": {
|
||||||
|
"10.254.254.2/32": [{
|
||||||
|
"valid": true,
|
||||||
|
"bestpath": true,
|
||||||
|
"selectionReason":"First path received",
|
||||||
|
"pathFrom":"external",
|
||||||
|
"prefix":"10.254.254.2",
|
||||||
|
"prefixLen":32,
|
||||||
|
"network":"10.254.254.2/32",
|
||||||
|
"metric":0,
|
||||||
|
"weight":0,
|
||||||
|
"path":"102",
|
||||||
|
"origin":"incomplete",
|
||||||
|
"nexthops":[{
|
||||||
|
"ip":"2001:db8:1::2",
|
||||||
|
"hostname":"r2",
|
||||||
|
"afi":"ipv6",
|
||||||
|
"scope":"global"
|
||||||
|
},{
|
||||||
|
"interface":"r1-eth0",
|
||||||
|
"hostname":"r2",
|
||||||
|
"afi":"ipv6",
|
||||||
|
"scope":"link-local",
|
||||||
|
"used":true
|
||||||
|
}]}]
|
||||||
|
},
|
||||||
|
"totalRoutes": 2,
|
||||||
|
"totalPaths": 2
|
||||||
|
}
|
35
tests/topotests/bgp_ipv6_rtadv/r1/bgp_ipv6_routes.json
Normal file
35
tests/topotests/bgp_ipv6_rtadv/r1/bgp_ipv6_routes.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"vrfId": 0,
|
||||||
|
"vrfName": "default",
|
||||||
|
"routerId": "10.254.254.1",
|
||||||
|
"defaultLocPrf": 100,
|
||||||
|
"localAS": 101,
|
||||||
|
"routes": {
|
||||||
|
"2001:db8:1::/64": [{
|
||||||
|
"valid":true,
|
||||||
|
"bestpath":true,
|
||||||
|
"selectionReason":"First path received",
|
||||||
|
"pathFrom":"external",
|
||||||
|
"prefix":"2001:db8:1::",
|
||||||
|
"prefixLen":64,
|
||||||
|
"network":"2001:db8:1::/64",
|
||||||
|
"metric":0,
|
||||||
|
"weight":0,
|
||||||
|
"path":"102",
|
||||||
|
"origin":"incomplete",
|
||||||
|
"nexthops":[{
|
||||||
|
"ip":"2001:db8:1::2",
|
||||||
|
"hostname":"r2",
|
||||||
|
"afi":"ipv6",
|
||||||
|
"scope":"global"
|
||||||
|
},{
|
||||||
|
"interface":"r1-eth0",
|
||||||
|
"hostname":"r2",
|
||||||
|
"afi":"ipv6",
|
||||||
|
"scope":"link-local",
|
||||||
|
"used":true
|
||||||
|
}]}]
|
||||||
|
},
|
||||||
|
"totalRoutes": 1,
|
||||||
|
"totalPaths": 1
|
||||||
|
}
|
@ -74,6 +74,45 @@ def teardown_module(_mod):
|
|||||||
|
|
||||||
|
|
||||||
def test_protocols_convergence():
|
def test_protocols_convergence():
|
||||||
|
"""
|
||||||
|
Assert that BGP protocol has converged
|
||||||
|
by checking the incoming BGP updates have been received.
|
||||||
|
"""
|
||||||
|
tgen = get_topogen()
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
# Check BGP IPv4 routing table.
|
||||||
|
logger.info("Checking BGP IPv4 routes for convergence")
|
||||||
|
router = tgen.gears["r1"]
|
||||||
|
|
||||||
|
json_file = "{}/{}/bgp_ipv4_routes.json".format(CWD, router.name)
|
||||||
|
expected = json.loads(open(json_file).read())
|
||||||
|
test_func = partial(
|
||||||
|
topotest.router_json_cmp,
|
||||||
|
router,
|
||||||
|
"show bgp ipv4 json",
|
||||||
|
expected,
|
||||||
|
)
|
||||||
|
_, result = topotest.run_and_expect(test_func, None, count=160, wait=0.5)
|
||||||
|
assertmsg = '"{}" JSON output mismatches'.format(router.name)
|
||||||
|
assert result is None, assertmsg
|
||||||
|
|
||||||
|
# Check BGP IPv6 routing table.
|
||||||
|
json_file = "{}/{}/bgp_ipv6_routes.json".format(CWD, router.name)
|
||||||
|
expected = json.loads(open(json_file).read())
|
||||||
|
test_func = partial(
|
||||||
|
topotest.router_json_cmp,
|
||||||
|
router,
|
||||||
|
"show bgp ipv6 json",
|
||||||
|
expected,
|
||||||
|
)
|
||||||
|
_, result = topotest.run_and_expect(test_func, None, count=160, wait=0.5)
|
||||||
|
assertmsg = '"{}" JSON output mismatches'.format(router.name)
|
||||||
|
assert result is None, assertmsg
|
||||||
|
|
||||||
|
|
||||||
|
def test_route_convergence():
|
||||||
"""
|
"""
|
||||||
Assert that all protocols have converged
|
Assert that all protocols have converged
|
||||||
statuses as they depend on it.
|
statuses as they depend on it.
|
||||||
|
Loading…
Reference in New Issue
Block a user