diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-11-30 16:22:43 +0100 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-11-30 16:22:43 +0100 |
commit | 32655aa2127a29d1c97668c216f958df8df9fc15 (patch) | |
tree | 3bd103991c30262ac2e118182cfe15509d11701a /tests | |
parent | bgpd: Adjust received prefix count only when we validate the nexthop (diff) | |
download | frr-32655aa2127a29d1c97668c216f958df8df9fc15.tar.xz frr-32655aa2127a29d1c97668c216f958df8df9fc15.zip |
tests: Improve `bgp_maximum_prefix_invalid_update` test case
Drop `grep'ing` stuff, and check JSON data if notification was send or not.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py b/tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py index f402c4197..ee68ecd7b 100644 --- a/tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py +++ b/tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py @@ -87,34 +87,19 @@ def test_bgp_maximum_prefix_invalid(): r2 = tgen.gears["r2"] - def _bgp_converge(): + def _bgp_parsing_nlri(): output = json.loads(r2.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")) expected = { "192.168.255.1": { - "connectionsEstablished": 1, - "connectionsDropped": 1, + "lastNotificationReason": "Cease/Maximum Number of Prefixes Reached", + "lastResetDueTo": "BGP Notification send", } } return topotest.json_cmp(output, expected) - test_func = functools.partial(_bgp_converge) + test_func = functools.partial(_bgp_parsing_nlri) _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) - assert result is None, "Can't converge initially" - - def _bgp_parsing_nlri(): - cmd_max_exceeded = ( - 'grep "%MAXPFXEXCEED: No. of IPv4 Unicast prefix received" bgpd.log' - ) - cmdt_error_parsing_nlri = 'grep "Error parsing NLRI" bgpd.log' - output_max_exceeded = r2.run(cmd_max_exceeded) - output_error_parsing_nlri = r2.run(cmdt_error_parsing_nlri) - - if len(output_max_exceeded) > 0: - if len(output_error_parsing_nlri) > 0: - return False - return True - - assert _bgp_parsing_nlri() == True + assert result is None, "Didn't send NOTIFICATION when hitting maximum-prefix" if __name__ == "__main__": |