mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 11:18:52 +00:00
Merge pull request #13769 from opensourcerouting/fix/bgp_peer-group_show_advertised
bgpd: Allow using peer-group for listing advertised-routes, etc.
This commit is contained in:
commit
c57667022c
@ -8317,6 +8317,7 @@ struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp,
|
|||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
union sockunion su;
|
union sockunion su;
|
||||||
|
struct peer_group *group;
|
||||||
|
|
||||||
/* Get peer sockunion. */
|
/* Get peer sockunion. */
|
||||||
ret = str2sockunion(ip_str, &su);
|
ret = str2sockunion(ip_str, &su);
|
||||||
@ -8325,6 +8326,11 @@ struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp,
|
|||||||
if (!peer) {
|
if (!peer) {
|
||||||
peer = peer_lookup_by_hostname(bgp, ip_str);
|
peer = peer_lookup_by_hostname(bgp, ip_str);
|
||||||
|
|
||||||
|
if (!peer) {
|
||||||
|
group = peer_group_lookup(bgp, ip_str);
|
||||||
|
peer = listnode_head(group->peer);
|
||||||
|
}
|
||||||
|
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
if (use_json) {
|
if (use_json) {
|
||||||
json_object *json_no = NULL;
|
json_object *json_no = NULL;
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
!
|
!
|
||||||
router bgp 65003
|
router bgp 65003
|
||||||
neighbor PG peer-group
|
no bgp ebgp-requires-policy
|
||||||
neighbor PG remote-as external
|
neighbor PG peer-group
|
||||||
neighbor PG timers 3 10
|
neighbor PG remote-as external
|
||||||
neighbor 192.168.255.1 peer-group PG
|
neighbor PG timers 3 10
|
||||||
|
neighbor 192.168.255.1 peer-group PG
|
||||||
|
address-family ipv4 unicast
|
||||||
|
redistribute connected
|
||||||
|
exit-address-family
|
||||||
!
|
!
|
||||||
|
@ -74,9 +74,26 @@ def test_bgp_peer_group():
|
|||||||
return topotest.json_cmp(output, expected)
|
return topotest.json_cmp(output, expected)
|
||||||
|
|
||||||
test_func = functools.partial(_bgp_peer_group_configured)
|
test_func = functools.partial(_bgp_peer_group_configured)
|
||||||
success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||||
|
assert result is None, "Failed bgp convergence in r1"
|
||||||
|
|
||||||
assert result is None, 'Failed bgp convergence in "{}"'.format(tgen.gears["r1"])
|
def _bgp_peer_group_check_advertised_routes():
|
||||||
|
output = json.loads(
|
||||||
|
tgen.gears["r3"].vtysh_cmd("show ip bgp neighbor PG advertised-routes json")
|
||||||
|
)
|
||||||
|
expected = {
|
||||||
|
"advertisedRoutes": {
|
||||||
|
"192.168.255.0/24": {
|
||||||
|
"valid": True,
|
||||||
|
"best": True,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return topotest.json_cmp(output, expected)
|
||||||
|
|
||||||
|
test_func = functools.partial(_bgp_peer_group_check_advertised_routes)
|
||||||
|
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
|
||||||
|
assert result is None, "Failed checking advertised routes from r3"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user