summaryrefslogtreecommitdiff
path: root/tests/topotests/static_srv6_sids/test_static_srv6_sids.py
diff options
context:
space:
mode:
authorCarmine Scarpitta <cscarpit@cisco.com>2025-02-03 12:56:41 +0100
committerCarmine Scarpitta <cscarpit@cisco.com>2025-02-03 23:02:11 +0100
commit4eed9ee0a72481bcfdab3026b1ef8d727ef0a2a7 (patch)
treeeaa4a964e895e066d3495fab63db12f04e07beb2 /tests/topotests/static_srv6_sids/test_static_srv6_sids.py
parentc809035cc46ad8953f2042b53c19a6ea3de367f8 (diff)
tests: Add test case to verify SID delete
Add a new test case that deletes a SID and verifies that only this SID has been removed from the RIB. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Diffstat (limited to 'tests/topotests/static_srv6_sids/test_static_srv6_sids.py')
-rwxr-xr-xtests/topotests/static_srv6_sids/test_static_srv6_sids.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/topotests/static_srv6_sids/test_static_srv6_sids.py b/tests/topotests/static_srv6_sids/test_static_srv6_sids.py
index 453a30af48..8c3236db46 100755
--- a/tests/topotests/static_srv6_sids/test_static_srv6_sids.py
+++ b/tests/topotests/static_srv6_sids/test_static_srv6_sids.py
@@ -78,6 +78,61 @@ def test_srv6_static_sids():
check_srv6_static_sids(router, "expected_srv6_sids.json")
+def test_srv6_static_sids_sid_delete():
+ """
+ Remove the static SID and verify it gets removed
+ """
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+ router = tgen.gears["r1"]
+
+ def _check_srv6_static_sids(router, expected_route_file):
+ logger.info("checking zebra srv6 static sids")
+ output = json.loads(router.vtysh_cmd("show ipv6 route static json"))
+ expected = open_json_file("{}/{}".format(CWD, expected_route_file))
+ return topotest.json_cmp(output, expected)
+
+ def check_srv6_static_sids(router, expected_file):
+ func = functools.partial(_check_srv6_static_sids, router, expected_file)
+ _, result = topotest.run_and_expect(func, None, count=15, wait=1)
+ assert result is None, "Failed"
+
+ router.vtysh_cmd(
+ """
+ configure terminal
+ segment-routing
+ srv6
+ static-sids
+ no sid fcbb:bbbb:1::/48
+ """
+ )
+
+ # FOR DEVELOPER:
+ # If you want to stop some specific line and start interactive shell,
+ # please use tgen.mininet_cli() to start it.
+
+ logger.info("Test for srv6 sids configuration")
+ check_srv6_static_sids(router, "expected_srv6_sids_sid_delete_1.json")
+
+ router.vtysh_cmd(
+ """
+ configure terminal
+ segment-routing
+ srv6
+ static-sids
+ no sid fcbb:bbbb:1:fe20::/64 locator MAIN behavior uDT6 vrf Vrf20
+ """
+ )
+
+ # FOR DEVELOPER:
+ # If you want to stop some specific line and start interactive shell,
+ # please use tgen.mininet_cli() to start it.
+
+ logger.info("Test for srv6 sids configuration")
+ check_srv6_static_sids(router, "expected_srv6_sids_sid_delete_2.json")
+
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))