topotests: update test cases about srv6 locator deletion

Before this PR, in case of get locator chunk zapi from
zclient, zebra precreated a down state locator and set
the chunk ownership. After this PR, this is no longer
done, and chunks are no longer automatically generated.

In this commit, we will make a test update to check the
corresponding detailed behavior.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
This commit is contained in:
Hiroki Shirokura 2021-08-25 03:24:19 +00:00
parent d79ff732cd
commit e08c56634c
7 changed files with 43 additions and 32 deletions

View File

@ -1,6 +1,2 @@
[ [
{
"name": "loc3",
"chunks": []
}
] ]

View File

@ -1,8 +1,2 @@
[ [
{
"name": "loc3",
"chunks": [
"2001:db8:3:3::/64"
]
}
] ]

View File

@ -0,0 +1,2 @@
[
]

View File

@ -23,11 +23,13 @@
] ]
}, },
{ {
"name":"loc3", "name": "loc3",
"statusUp":false, "prefix": "2001:db8:3:3::/64",
"chunks":[ "statusUp": true,
"chunks": [
{ {
"proto":"sharp" "prefix": "2001:db8:3:3::/64",
"proto": "system"
} }
] ]
} }

View File

@ -1,16 +1,5 @@
{ {
"locators":[ "locators":[
{
"name": "loc1",
"prefix": "2001:db8:1:1::/64",
"statusUp": true,
"chunks": [
{
"prefix": "2001:db8:1:1::/64",
"proto": "system"
}
]
},
{ {
"name": "loc2", "name": "loc2",
"prefix": "2001:db8:2:2::/64", "prefix": "2001:db8:2:2::/64",
@ -29,7 +18,7 @@
"chunks":[ "chunks":[
{ {
"prefix": "2001:db8:3:3::/64", "prefix": "2001:db8:3:3::/64",
"proto": "sharp" "proto": "system"
} }
] ]
} }

View File

@ -0,0 +1,5 @@
{
"locators":[
]
}

View File

@ -102,6 +102,10 @@ def test_srv6():
success, result = topotest.run_and_expect(func, None, count=5, wait=0.5) success, result = topotest.run_and_expect(func, None, count=5, wait=0.5)
assert result is None, "Failed" assert result is None, "Failed"
# FOR DEVELOPER:
# If you want to stop some specific line and start interactive shell,
# please use tgen.mininet_cli() to start it.
logger.info("Test1 for Locator Configuration") logger.info("Test1 for Locator Configuration")
check_srv6_locator(router, "expected_locators1.json") check_srv6_locator(router, "expected_locators1.json")
check_sharpd_chunk(router, "expected_chunks1.json") check_sharpd_chunk(router, "expected_chunks1.json")
@ -116,12 +120,7 @@ def test_srv6():
check_srv6_locator(router, "expected_locators3.json") check_srv6_locator(router, "expected_locators3.json")
check_sharpd_chunk(router, "expected_chunks3.json") check_sharpd_chunk(router, "expected_chunks3.json")
logger.info("Test4 get chunk for non-exist locator by zclient") logger.info("Test4 additional locator loc3")
router.vtysh_cmd("sharp srv6-manager get-locator-chunk loc3")
check_srv6_locator(router, "expected_locators4.json")
check_sharpd_chunk(router, "expected_chunks4.json")
logger.info("Test5 Test for Zclient. after locator loc3 was configured")
router.vtysh_cmd( router.vtysh_cmd(
""" """
configure terminal configure terminal
@ -132,9 +131,33 @@ def test_srv6():
prefix 2001:db8:3:3::/64 prefix 2001:db8:3:3::/64
""" """
) )
check_srv6_locator(router, "expected_locators4.json")
check_sharpd_chunk(router, "expected_chunks4.json")
logger.info("Test5 delete locator and chunk is released automatically")
router.vtysh_cmd(
"""
configure terminal
segment-routing
srv6
locators
no locator loc1
"""
)
check_srv6_locator(router, "expected_locators5.json") check_srv6_locator(router, "expected_locators5.json")
check_sharpd_chunk(router, "expected_chunks5.json") check_sharpd_chunk(router, "expected_chunks5.json")
logger.info("Test6 delete srv6 all configuration")
router.vtysh_cmd(
"""
configure terminal
segment-routing
no srv6
"""
)
check_srv6_locator(router, "expected_locators6.json")
check_sharpd_chunk(router, "expected_chunks6.json")
if __name__ == "__main__": if __name__ == "__main__":
args = ["-s"] + sys.argv[1:] args = ["-s"] + sys.argv[1:]