From fa5783bbabfbaebedd534eb20b599ec78458178c Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 22 Sep 2023 15:50:27 +0300 Subject: [PATCH] tests: Check notification/capability received message stats instead of reset/established Signed-off-by: Donatas Abraitis --- .../bgp_dynamic_capability/r2/frr.conf | 7 +++++++ ...bgp_dynamic_capability_graceful_restart.py | 20 +++++++++++++------ .../test_bgp_dynamic_capability_role.py | 11 ++++++---- ...bgp_dynamic_capability_software_version.py | 11 ++++++---- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/tests/topotests/bgp_dynamic_capability/r2/frr.conf b/tests/topotests/bgp_dynamic_capability/r2/frr.conf index 2bef9177d7..16b83a5c58 100644 --- a/tests/topotests/bgp_dynamic_capability/r2/frr.conf +++ b/tests/topotests/bgp_dynamic_capability/r2/frr.conf @@ -1,6 +1,9 @@ ! !debug bgp neighbor ! +int lo + ip address 10.10.10.10/32 +! int r2-eth0 ip address 192.168.1.2/24 ! @@ -12,4 +15,8 @@ router bgp 65002 neighbor 192.168.1.1 timers 1 3 neighbor 192.168.1.1 timers connect 1 neighbor 192.168.1.1 capability dynamic + ! + address-family ipv4 unicast + redistribute connected + exit-address-family ! diff --git a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py index c6c5bb17f2..db1eb2723b 100644 --- a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py +++ b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py @@ -80,8 +80,6 @@ def test_bgp_dynamic_capability_graceful_restart(): } }, }, - "connectionsEstablished": 1, - "connectionsDropped": 0, } } return topotest.json_cmp(output, expected) @@ -96,6 +94,9 @@ def test_bgp_dynamic_capability_graceful_restart(): "Change Graceful-Restart restart-time, LLGR stale-time and check if they changed dynamically" ) + # Clear message stats to check if we receive a notification or not after we + # change the settings fo LLGR. + r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats") r2.vtysh_cmd( """ configure terminal @@ -127,8 +128,10 @@ def test_bgp_dynamic_capability_graceful_restart(): } }, }, - "connectionsEstablished": 1, - "connectionsDropped": 0, + "messageStats": { + "notificationsRecv": 0, + "capabilityRecv": 2, + }, } } return topotest.json_cmp(output, expected) @@ -145,6 +148,9 @@ def test_bgp_dynamic_capability_graceful_restart(): "Disable Graceful-Restart notification support, and check if it's changed dynamically" ) + # Clear message stats to check if we receive a notification or not after we + # change the settings fo LLGR. + r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats") r2.vtysh_cmd( """ configure terminal @@ -175,8 +181,10 @@ def test_bgp_dynamic_capability_graceful_restart(): } }, }, - "connectionsEstablished": 1, - "connectionsDropped": 0, + "messageStats": { + "notificationsRecv": 0, + "capabilityRecv": 1, + }, } } return topotest.json_cmp(output, expected) diff --git a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_role.py b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_role.py index 9d14388d56..da45110e39 100644 --- a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_role.py +++ b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_role.py @@ -66,8 +66,6 @@ def test_bgp_dynamic_capability_role(): "neighborCapabilities": { "dynamic": "advertisedAndReceived", }, - "connectionsEstablished": 1, - "connectionsDropped": 0, } } return topotest.json_cmp(output, expected) @@ -80,6 +78,9 @@ def test_bgp_dynamic_capability_role(): step("Set local-role and check if it's exchanged dynamically") + # Clear message stats to check if we receive a notification or not after we + # change the settings fo LLGR. + r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats") r1.vtysh_cmd( """ configure terminal @@ -107,8 +108,10 @@ def test_bgp_dynamic_capability_role(): "dynamic": "advertisedAndReceived", "role": "advertisedAndReceived", }, - "connectionsEstablished": 1, - "connectionsDropped": 0, + "messageStats": { + "notificationsRecv": 0, + "capabilityRecv": 1, + }, } } return topotest.json_cmp(output, expected) diff --git a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_software_version.py b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_software_version.py index 6e2fa51443..d1069a876b 100644 --- a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_software_version.py +++ b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_software_version.py @@ -68,8 +68,6 @@ def test_bgp_dynamic_capability_software_version(): "receivedSoftwareVersion": None, }, }, - "connectionsEstablished": 1, - "connectionsDropped": 0, } } return topotest.json_cmp(output, expected) @@ -82,6 +80,9 @@ def test_bgp_dynamic_capability_software_version(): step("Enable software version capability and check if it's exchanged dynamically") + # Clear message stats to check if we receive a notification or not after we + # change the settings fo LLGR. + r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats") r1.vtysh_cmd( """ configure terminal @@ -128,8 +129,10 @@ def test_bgp_dynamic_capability_software_version(): "receivedSoftwareVersion": rcv, }, }, - "connectionsEstablished": 1, - "connectionsDropped": 0, + "messageStats": { + "notificationsRecv": 0, + "capabilityRecv": 1, + }, } } return topotest.json_cmp(output, expected)