Merge pull request #9920 from donaldsharp/zebra_seg6local_race

tests: zebra_seg6local has a race condition
This commit is contained in:
Martin Winter 2021-10-30 01:36:35 +02:00 committed by GitHub
commit cd206022b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 26 deletions

View File

@ -2,7 +2,7 @@
{ {
"in": { "in": {
"dest": "1::1", "dest": "1::1",
"nh": "2001::1", "nh": "2001::2",
"sid": "a::" "sid": "a::"
}, },
"out":[{ "out":[{

View File

@ -79,11 +79,7 @@ def test_zebra_seg6local_routes():
logger.info("Test for seg6local route install via ZAPI was start.") logger.info("Test for seg6local route install via ZAPI was start.")
r1 = tgen.gears["r1"] r1 = tgen.gears["r1"]
def check(router, dest, nh, sid, expected): def check(router, dest, expected):
router.vtysh_cmd(
"sharp install seg6-routes {} "
"nexthop-seg6 {} encap {} 1".format(dest, nh, sid)
)
output = json.loads(router.vtysh_cmd("show ipv6 route {} json".format(dest))) output = json.loads(router.vtysh_cmd("show ipv6 route {} json".format(dest)))
output = output.get("{}/128".format(dest)) output = output.get("{}/128".format(dest))
if output is None: if output is None:
@ -92,19 +88,17 @@ def test_zebra_seg6local_routes():
manifests = open_json_file(os.path.join(CWD, "{}/routes.json".format("r1"))) manifests = open_json_file(os.path.join(CWD, "{}/routes.json".format("r1")))
for manifest in manifests: for manifest in manifests:
logger.info( dest = manifest["in"]["dest"]
"CHECK {} {} {}".format( nh = manifest["in"]["nh"]
manifest["in"]["dest"], manifest["in"]["nh"], manifest["in"]["sid"] sid = manifest["in"]["sid"]
r1.vtysh_cmd(
"sharp install seg6-routes {} nexthop-seg6 {} encap {} 1".format(
dest, nh, sid
) )
) )
test_func = partial( logger.info("CHECK {} {} {}".format(dest, nh, sid))
check, test_func = partial(check, r1, dest, manifest["out"])
r1,
manifest["in"]["dest"],
manifest["in"]["nh"],
manifest["in"]["sid"],
manifest["out"],
)
success, result = topotest.run_and_expect(test_func, None, count=5, wait=1) success, result = topotest.run_and_expect(test_func, None, count=5, wait=1)
assert result is None, "Failed" assert result is None, "Failed"

View File

@ -79,11 +79,7 @@ def test_zebra_seg6local_routes():
logger.info("Test for seg6local route install via ZAPI was start.") logger.info("Test for seg6local route install via ZAPI was start.")
r1 = tgen.gears["r1"] r1 = tgen.gears["r1"]
def check(router, dest, context, expected): def check(router, dest, expected):
router.vtysh_cmd(
"sharp install seg6local-routes {} "
"nexthop-seg6local dum0 {} 1".format(dest, context)
)
output = json.loads(router.vtysh_cmd("show ipv6 route {} json".format(dest))) output = json.loads(router.vtysh_cmd("show ipv6 route {} json".format(dest)))
output = output.get("{}/128".format(dest)) output = output.get("{}/128".format(dest))
if output is None: if output is None:
@ -92,14 +88,20 @@ def test_zebra_seg6local_routes():
manifests = open_json_file(os.path.join(CWD, "{}/routes.json".format("r1"))) manifests = open_json_file(os.path.join(CWD, "{}/routes.json".format("r1")))
for manifest in manifests: for manifest in manifests:
logger.info( dest = manifest["in"]["dest"]
"CHECK {} {}".format(manifest["in"]["dest"], manifest["in"]["context"]) context = manifest["in"]["context"]
logger.info("CHECK {} {}".format(dest, context))
r1.vtysh_cmd(
"sharp install seg6local-routes {} nexthop-seg6local dum0 {} 1".format(
dest, context
)
) )
test_func = partial( test_func = partial(
check, check,
r1, r1,
manifest["in"]["dest"], dest,
manifest["in"]["context"],
manifest["out"], manifest["out"],
) )
success, result = topotest.run_and_expect(test_func, None, count=5, wait=1) success, result = topotest.run_and_expect(test_func, None, count=5, wait=1)