Merge pull request #9055 from ton31337/fix/show_pfxsnt_even_when_default_route_originated

bgpd: Reflect changes to pfxSnt when using default-originate
This commit is contained in:
Donald Sharp 2021-07-15 15:54:01 -04:00 committed by GitHub
commit 0f8de6a8d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 14 deletions

View File

@ -1158,6 +1158,7 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
(void)bpacket_queue_add(SUBGRP_PKTQ(subgrp), s, &vecarr);
subgroup_trigger_write(subgrp);
subgrp->scount++;
}
void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)
@ -1250,6 +1251,7 @@ void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)
(void)bpacket_queue_add(SUBGRP_PKTQ(subgrp), s, NULL);
subgroup_trigger_write(subgrp);
subgrp->scount--;
}
static void

View File

@ -2,7 +2,4 @@ router bgp 65001
no bgp ebgp-requires-policy
neighbor 192.168.255.1 remote-as 65000
neighbor 192.168.255.1 timers 3 10
address-family ipv4 unicast
redistribute connected
exit-address-family
!

View File

@ -79,10 +79,10 @@ def test_bgp_default_originate_route_map():
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
router = tgen.gears["r2"]
def _bgp_converge(router):
output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json"))
def _bgp_check_if_received():
output = json.loads(
tgen.gears["r2"].vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")
)
expected = {
"192.168.255.1": {
"bgpState": "Established",
@ -91,22 +91,27 @@ def test_bgp_default_originate_route_map():
}
return topotest.json_cmp(output, expected)
def _bgp_check_if_originated():
output = json.loads(tgen.gears["r1"].vtysh_cmd("show ip bgp summary json"))
expected = {"ipv4Unicast": {"peers": {"192.168.255.2": {"pfxSnt": 1}}}}
return topotest.json_cmp(output, expected)
def _bgp_default_route_is_valid(router):
output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json"))
expected = {"paths": [{"valid": True}]}
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
test_func = functools.partial(_bgp_check_if_received)
success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "No 0.0.0.0/0 at r2 from r1"
assert result is None, 'Failed to see bgp convergence in "{}"'.format(router)
test_func = functools.partial(_bgp_default_route_is_valid, router)
test_func = functools.partial(_bgp_check_if_originated)
success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "No 0.0.0.0/0 from r1 to r2"
assert (
result is None
), 'Failed to see applied metric for default route in "{}"'.format(router)
test_func = functools.partial(_bgp_default_route_is_valid, tgen.gears["r2"])
success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "Failed to see 0.0.0.0/0 in r2"
if __name__ == "__main__":