mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 15:23:39 +00:00
Merge pull request #17542 from opensourcerouting/fix/peer-group_remote_as_regression
bgpd: Fix remote-as with peer-group
This commit is contained in:
commit
e9c9db0122
@ -2859,6 +2859,7 @@ struct peer_group *peer_group_get(struct bgp *bgp, const char *name)
|
|||||||
group->conf->host = XSTRDUP(MTYPE_BGP_PEER_HOST, name);
|
group->conf->host = XSTRDUP(MTYPE_BGP_PEER_HOST, name);
|
||||||
group->conf->group = group;
|
group->conf->group = group;
|
||||||
group->conf->as = 0;
|
group->conf->as = 0;
|
||||||
|
group->conf->as_type = AS_UNSPECIFIED;
|
||||||
group->conf->ttl = BGP_DEFAULT_TTL;
|
group->conf->ttl = BGP_DEFAULT_TTL;
|
||||||
group->conf->gtsm_hops = BGP_GTSM_HOPS_DISABLED;
|
group->conf->gtsm_hops = BGP_GTSM_HOPS_DISABLED;
|
||||||
group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
|
group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV;
|
||||||
|
@ -5,6 +5,9 @@ interface r1-eth0
|
|||||||
interface r1-eth1
|
interface r1-eth1
|
||||||
ip address 192.168.251.1/30
|
ip address 192.168.251.1/30
|
||||||
!
|
!
|
||||||
|
interface r1-eth2
|
||||||
|
ip address 192.168.252.1/30
|
||||||
|
!
|
||||||
ip forwarding
|
ip forwarding
|
||||||
!
|
!
|
||||||
router bgp 65001
|
router bgp 65001
|
||||||
@ -17,5 +20,9 @@ router bgp 65001
|
|||||||
neighbor PG1 remote-as external
|
neighbor PG1 remote-as external
|
||||||
neighbor PG1 timers 3 20
|
neighbor PG1 timers 3 20
|
||||||
neighbor PG1 graceful-restart-disable
|
neighbor PG1 graceful-restart-disable
|
||||||
|
neighbor PG2 peer-group
|
||||||
|
neighbor PG2 local-as 65554 no-prepend replace-as
|
||||||
neighbor 192.168.251.2 peer-group PG1
|
neighbor 192.168.251.2 peer-group PG1
|
||||||
|
neighbor 192.168.252.2 remote-as 65004
|
||||||
|
neighbor 192.168.252.2 peer-group PG2
|
||||||
!
|
!
|
||||||
|
7
tests/topotests/bgp_peer_group/r4/frr.conf
Normal file
7
tests/topotests/bgp_peer_group/r4/frr.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
!
|
||||||
|
interface r4-eth0
|
||||||
|
ip address 192.168.252.2/30
|
||||||
|
!
|
||||||
|
router bgp 65004
|
||||||
|
neighbor 192.168.252.1 remote-as external
|
||||||
|
!
|
@ -30,7 +30,7 @@ pytestmark = [pytest.mark.bgpd]
|
|||||||
|
|
||||||
|
|
||||||
def build_topo(tgen):
|
def build_topo(tgen):
|
||||||
for routern in range(1, 4):
|
for routern in range(1, 5):
|
||||||
tgen.add_router("r{}".format(routern))
|
tgen.add_router("r{}".format(routern))
|
||||||
|
|
||||||
switch = tgen.add_switch("s1")
|
switch = tgen.add_switch("s1")
|
||||||
@ -42,6 +42,10 @@ def build_topo(tgen):
|
|||||||
switch.add_link(tgen.gears["r1"])
|
switch.add_link(tgen.gears["r1"])
|
||||||
switch.add_link(tgen.gears["r2"])
|
switch.add_link(tgen.gears["r2"])
|
||||||
|
|
||||||
|
switch = tgen.add_switch("s3")
|
||||||
|
switch.add_link(tgen.gears["r1"])
|
||||||
|
switch.add_link(tgen.gears["r4"])
|
||||||
|
|
||||||
|
|
||||||
def setup_module(mod):
|
def setup_module(mod):
|
||||||
tgen = Topogen(build_topo, mod.__name__)
|
tgen = Topogen(build_topo, mod.__name__)
|
||||||
@ -84,6 +88,11 @@ def test_bgp_peer_group():
|
|||||||
"bgpState": "Established",
|
"bgpState": "Established",
|
||||||
"neighborCapabilities": {"gracefulRestart": "received"},
|
"neighborCapabilities": {"gracefulRestart": "received"},
|
||||||
},
|
},
|
||||||
|
"192.168.252.2": {
|
||||||
|
"peerGroup": "PG2",
|
||||||
|
"bgpState": "Established",
|
||||||
|
"neighborCapabilities": {"gracefulRestart": "advertisedAndReceived"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return topotest.json_cmp(output, expected)
|
return topotest.json_cmp(output, expected)
|
||||||
|
|
||||||
@ -110,6 +119,24 @@ def test_bgp_peer_group():
|
|||||||
assert result is None, "Failed checking advertised routes from r3"
|
assert result is None, "Failed checking advertised routes from r3"
|
||||||
|
|
||||||
|
|
||||||
|
def test_show_running_remote_as_peer_group():
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
output = (
|
||||||
|
tgen.gears["r1"]
|
||||||
|
.cmd(
|
||||||
|
'vtysh -c "show running bgpd" | grep "^ neighbor 192.168.252.2 remote-as 65004"'
|
||||||
|
)
|
||||||
|
.rstrip()
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
output == " neighbor 192.168.252.2 remote-as 65004"
|
||||||
|
), "192.168.252.2 remote-as is flushed"
|
||||||
|
|
||||||
|
|
||||||
def test_bgp_peer_group_remote_as_del_readd():
|
def test_bgp_peer_group_remote_as_del_readd():
|
||||||
tgen = get_topogen()
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user