diff options
| author | Carmine Scarpitta <cscarpit@cisco.com> | 2025-02-26 16:08:17 +0100 |
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2025-03-03 07:25:31 +0000 |
| commit | 0fdd31f819bee9118af51f60a361abb6ee95c02f (patch) | |
| tree | 66e852d4b32b585295164eb758777c64ff5e3988 | |
| parent | f0cb5511b109b4ec2604247adcf25816528ee48d (diff) | |
tests: Add test case to verify `no srv6` command
Add a test case to verify that staticd removes all SIDs when the
`no srv6` command is executed.
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit 58373a61d559036990b875bbf0afdc9e92174975)
| -rw-r--r-- | tests/topotests/static_srv6_sids/expected_srv6_sids_srv6_disable.json | 1 | ||||
| -rwxr-xr-x | tests/topotests/static_srv6_sids/test_static_srv6_sids.py | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/topotests/static_srv6_sids/expected_srv6_sids_srv6_disable.json b/tests/topotests/static_srv6_sids/expected_srv6_sids_srv6_disable.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/tests/topotests/static_srv6_sids/expected_srv6_sids_srv6_disable.json @@ -0,0 +1 @@ +{}
\ No newline at end of file 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 4bed5bf788..7b93e03dd4 100755 --- a/tests/topotests/static_srv6_sids/test_static_srv6_sids.py +++ b/tests/topotests/static_srv6_sids/test_static_srv6_sids.py @@ -251,6 +251,42 @@ def test_srv6_static_sids_sid_readd_all(): check_srv6_static_sids(router, "expected_srv6_sids.json") +def test_srv6_static_sids_srv6_disable(): + """ + Disable SRv6 + """ + 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, exact=True) + + 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 + no srv6 + """ + ) + + # 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_srv6_disable.json") + + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) |
