summaryrefslogtreecommitdiffstats
path: root/tests/topotests/bgp_dynamic_capability
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/bgp_dynamic_capability')
-rw-r--r--tests/topotests/bgp_dynamic_capability/r1/frr.conf1
-rw-r--r--tests/topotests/bgp_dynamic_capability/r2/frr.conf1
-rw-r--r--tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_addpath.py164
-rw-r--r--tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_fqdn.py4
-rw-r--r--tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_graceful_restart.py4
-rw-r--r--tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_orf.py4
-rw-r--r--tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_role.py4
-rw-r--r--tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_software_version.py4
8 files changed, 136 insertions, 50 deletions
diff --git a/tests/topotests/bgp_dynamic_capability/r1/frr.conf b/tests/topotests/bgp_dynamic_capability/r1/frr.conf
index aa5c3db..c959462 100644
--- a/tests/topotests/bgp_dynamic_capability/r1/frr.conf
+++ b/tests/topotests/bgp_dynamic_capability/r1/frr.conf
@@ -15,6 +15,7 @@ router bgp 65001
!
address-family ipv4 unicast
neighbor 192.168.1.2 addpath-tx-all-paths
+ neighbor 192.168.1.2 addpath-rx-paths-limit 10
exit-address-family
!
ip prefix-list r2 seq 5 permit 10.10.10.10/32
diff --git a/tests/topotests/bgp_dynamic_capability/r2/frr.conf b/tests/topotests/bgp_dynamic_capability/r2/frr.conf
index 7f25665..3cc1f1f 100644
--- a/tests/topotests/bgp_dynamic_capability/r2/frr.conf
+++ b/tests/topotests/bgp_dynamic_capability/r2/frr.conf
@@ -16,6 +16,7 @@ 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
+ neighbor 192.168.1.1 addpath-rx-paths-limit 20
!
address-family ipv4 unicast
redistribute connected
diff --git a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_addpath.py b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_addpath.py
index 5202f51..4d7d46c 100644
--- a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_addpath.py
+++ b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_addpath.py
@@ -6,7 +6,11 @@
#
"""
-Test if Addpath capability is adjusted dynamically.
+Test if Addpath/Paths-Limit capabilities are adjusted dynamically.
+T1: Enable Addpath/Paths-Limit capabilities and check if they are exchanged dynamically
+T2: Disable paths limit and check if it's exchanged dynamically
+T3: Disable Addpath capability RX and check if it's exchanged dynamically
+T4: Disable Addpath capability and check if it's exchanged dynamically
"""
import os
@@ -16,7 +20,7 @@ import json
import pytest
import functools
-pytestmark = pytest.mark.bgpd
+pytestmark = [pytest.mark.bgpd]
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
@@ -24,9 +28,6 @@ sys.path.append(os.path.join(CWD, "../"))
# pylint: disable=C0413
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
-from lib.common_config import step
-
-pytestmark = [pytest.mark.bgpd]
def setup_module(mod):
@@ -47,7 +48,7 @@ def teardown_module(mod):
tgen.stop_topology()
-def test_bgp_dynamic_capability_addpath():
+def test_bgp_addpath_paths_limit():
tgen = get_topogen()
if tgen.routers_have_failure():
@@ -56,7 +57,7 @@ def test_bgp_dynamic_capability_addpath():
r1 = tgen.gears["r1"]
r2 = tgen.gears["r2"]
- def _bgp_converge():
+ def _converge():
output = json.loads(r1.vtysh_cmd("show bgp neighbor json"))
expected = {
"192.168.1.2": {
@@ -65,8 +66,19 @@ def test_bgp_dynamic_capability_addpath():
"dynamic": "advertisedAndReceived",
"addPath": {
"ipv4Unicast": {
+ "txAdvertisedAndReceived": False,
"txAdvertised": True,
+ "txReceived": False,
"rxAdvertisedAndReceived": True,
+ "rxAdvertised": True,
+ "rxReceived": True,
+ }
+ },
+ "pathsLimit": {
+ "ipv4Unicast": {
+ "advertisedAndReceived": True,
+ "advertisedPathsLimit": 10,
+ "receivedPathsLimit": 20,
}
},
},
@@ -80,26 +92,26 @@ def test_bgp_dynamic_capability_addpath():
return topotest.json_cmp(output, expected)
test_func = functools.partial(
- _bgp_converge,
+ _converge,
)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, "Can't converge"
- step("Enable Addpath 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.
+ ####
+ # T1: Enable Addpath/Paths-Limit capabilities and check if they are exchanged dynamically
+ ####
r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats")
r2.vtysh_cmd(
"""
configure terminal
- router bgp
- address-family ipv4 unicast
- neighbor 192.168.1.1 addpath-tx-all-paths
+ router bgp
+ address-family ipv4 unicast
+ neighbor 192.168.1.1 addpath-tx-all-paths
+ neighbor 192.168.1.1 addpath-rx-paths-limit 21
"""
)
- def _bgp_check_if_addpath_rx_tx_and_session_not_reset():
+ def _enable_addpath_paths_limit():
output = json.loads(r1.vtysh_cmd("show bgp neighbor json"))
expected = {
"192.168.1.2": {
@@ -109,7 +121,18 @@ def test_bgp_dynamic_capability_addpath():
"addPath": {
"ipv4Unicast": {
"txAdvertisedAndReceived": True,
+ "txAdvertised": True,
+ "txReceived": True,
"rxAdvertisedAndReceived": True,
+ "rxAdvertised": True,
+ "rxReceived": True,
+ }
+ },
+ "pathsLimit": {
+ "ipv4Unicast": {
+ "advertisedAndReceived": True,
+ "advertisedPathsLimit": 10,
+ "receivedPathsLimit": 21,
}
},
},
@@ -120,23 +143,76 @@ def test_bgp_dynamic_capability_addpath():
},
"messageStats": {
"notificationsRecv": 0,
- "capabilityRecv": 1,
+ "notificationsSent": 0,
+ "capabilityRecv": 2,
},
}
}
return topotest.json_cmp(output, expected)
test_func = functools.partial(
- _bgp_check_if_addpath_rx_tx_and_session_not_reset,
+ _enable_addpath_paths_limit,
)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
- assert result is None, "Session was reset after enabling Addpath capability"
+ assert (
+ result is None
+ ), "Something went wrong when enabling Addpath/Paths-Limit capabilities"
- step("Disable Addpath capability RX and check if it's exchanged dynamically")
+ ###
+ # T2: Disable paths limit and check if it's exchanged dynamically
+ ###
+ r2.vtysh_cmd(
+ """
+ configure terminal
+ router bgp
+ address-family ipv4 unicast
+ no neighbor 192.168.1.1 addpath-rx-paths-limit
+ """
+ )
- # Clear message stats to check if we receive a notification or not after we
- # disable addpath-rx.
- r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats")
+ def _disable_paths_limit():
+ output = json.loads(r1.vtysh_cmd("show bgp neighbor json"))
+ expected = {
+ "192.168.1.2": {
+ "bgpState": "Established",
+ "neighborCapabilities": {
+ "dynamic": "advertisedAndReceived",
+ "addPath": {
+ "ipv4Unicast": {
+ "txAdvertisedAndReceived": True,
+ "txAdvertised": True,
+ "txReceived": True,
+ "rxAdvertisedAndReceived": True,
+ "rxAdvertised": True,
+ "rxReceived": True,
+ }
+ },
+ "pathsLimit": {
+ "ipv4Unicast": {
+ "advertisedAndReceived": True,
+ "advertisedPathsLimit": 10,
+ "receivedPathsLimit": 0,
+ }
+ },
+ },
+ "messageStats": {
+ "notificationsRecv": 0,
+ "notificationsSent": 0,
+ "capabilityRecv": 3,
+ },
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(
+ _disable_paths_limit,
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assert result is None, "Something went wrong after disabling paths limit"
+
+ ###
+ # T3: Disable Addpath capability RX and check if it's exchanged dynamically
+ ###
r2.vtysh_cmd(
"""
configure terminal
@@ -146,7 +222,7 @@ def test_bgp_dynamic_capability_addpath():
"""
)
- def _bgp_check_if_addpath_tx_and_session_not_reset():
+ def _disable_addpath_rx():
output = json.loads(r1.vtysh_cmd("show bgp neighbor json"))
expected = {
"192.168.1.2": {
@@ -156,27 +232,39 @@ def test_bgp_dynamic_capability_addpath():
"addPath": {
"ipv4Unicast": {
"txAdvertisedAndReceived": True,
+ "txAdvertised": True,
+ "txReceived": True,
+ "rxAdvertisedAndReceived": False,
"rxAdvertised": True,
+ "rxReceived": False,
+ }
+ },
+ "pathsLimit": {
+ "ipv4Unicast": {
+ "advertisedAndReceived": True,
+ "advertisedPathsLimit": 10,
+ "receivedPathsLimit": 0,
}
},
},
"messageStats": {
"notificationsRecv": 0,
- "capabilityRecv": 1,
+ "notificationsSent": 0,
+ "capabilityRecv": 4,
},
}
}
return topotest.json_cmp(output, expected)
test_func = functools.partial(
- _bgp_check_if_addpath_tx_and_session_not_reset,
+ _disable_addpath_rx,
)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
- assert result is None, "Session was reset after disabling Addpath RX flags"
+ assert result is None, "Something went wrong after disabling Addpath RX flags"
- # Clear message stats to check if we receive a notification or not after we
- # disable Addpath capability.
- r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats")
+ ###
+ # T4: Disable Addpath capability and check if it's exchanged dynamically
+ ###
r1.vtysh_cmd(
"""
configure terminal
@@ -186,7 +274,7 @@ def test_bgp_dynamic_capability_addpath():
"""
)
- def _bgp_check_if_addpath_capability_is_absent():
+ def _disable_addpath():
output = json.loads(r1.vtysh_cmd("show bgp neighbor json"))
expected = {
"192.168.1.2": {
@@ -195,24 +283,30 @@ def test_bgp_dynamic_capability_addpath():
"dynamic": "advertisedAndReceived",
"addPath": {
"ipv4Unicast": {
- "txAdvertisedAndReceived": None,
- "txAdvertised": None,
+ "txAdvertisedAndReceived": False,
+ "txAdvertised": False,
+ "txReceived": True,
+ "rxAdvertisedAndReceived": False,
"rxAdvertised": True,
+ "rxReceived": False,
}
},
},
"messageStats": {
"notificationsRecv": 0,
+ "notificationsSent": 0,
+ "capabilitySent": 1,
+ "capabilityRecv": 4,
},
}
}
return topotest.json_cmp(output, expected)
test_func = functools.partial(
- _bgp_check_if_addpath_capability_is_absent,
+ _disable_addpath,
)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
- assert result is None, "Failed to disable Addpath capability"
+ assert result is None, "Something went wrong when disabling Addpath capability"
if __name__ == "__main__":
diff --git a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_fqdn.py b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_fqdn.py
index 338886d..26fae17 100644
--- a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_fqdn.py
+++ b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_fqdn.py
@@ -16,7 +16,7 @@ import json
import pytest
import functools
-pytestmark = pytest.mark.bgpd
+pytestmark = [pytest.mark.bgpd]
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
@@ -26,8 +26,6 @@ from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step
-pytestmark = [pytest.mark.bgpd]
-
def setup_module(mod):
topodef = {"s1": ("r1", "r2")}
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 4644ef3..d67bfea 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
@@ -18,7 +18,7 @@ import json
import pytest
import functools
-pytestmark = pytest.mark.bgpd
+pytestmark = [pytest.mark.bgpd]
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
@@ -28,8 +28,6 @@ from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step
-pytestmark = [pytest.mark.bgpd]
-
def setup_module(mod):
topodef = {"s1": ("r1", "r2")}
diff --git a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_orf.py b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_orf.py
index ba95bd1..9e1f26f 100644
--- a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_orf.py
+++ b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_orf.py
@@ -16,7 +16,7 @@ import json
import pytest
import functools
-pytestmark = pytest.mark.bgpd
+pytestmark = [pytest.mark.bgpd]
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
@@ -26,8 +26,6 @@ from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step
-pytestmark = [pytest.mark.bgpd]
-
def setup_module(mod):
topodef = {"s1": ("r1", "r2")}
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 aa9ad5f..f6c1e25 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
@@ -16,7 +16,7 @@ import json
import pytest
import functools
-pytestmark = pytest.mark.bgpd
+pytestmark = [pytest.mark.bgpd]
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
@@ -26,8 +26,6 @@ from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step
-pytestmark = [pytest.mark.bgpd]
-
def setup_module(mod):
topodef = {"s1": ("r1", "r2")}
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 737e694..128283b 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
@@ -16,7 +16,7 @@ import json
import pytest
import functools
-pytestmark = pytest.mark.bgpd
+pytestmark = [pytest.mark.bgpd]
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
@@ -26,8 +26,6 @@ from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step
-pytestmark = [pytest.mark.bgpd]
-
def setup_module(mod):
topodef = {"s1": ("r1", "r2")}