Merge pull request #6546 from opensourcerouting/topofixes-2

topotests: stabilize ospf-sr
This commit is contained in:
Mark Stapp 2020-06-10 07:57:31 -04:00 committed by GitHub
commit bdabd4b958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 47 deletions

View File

@ -1,5 +1,5 @@
{ [
"20100":{ {
"inLabel":20100, "inLabel":20100,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -11,7 +11,7 @@
} }
] ]
}, },
"20200":{ {
"inLabel":20200, "inLabel":20200,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -31,7 +31,7 @@
} }
] ]
}, },
"20300":{ {
"inLabel":20300, "inLabel":20300,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -51,7 +51,7 @@
} }
] ]
}, },
"20400":{ {
"inLabel":20400, "inLabel":20400,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -71,7 +71,7 @@
} }
] ]
}, },
"label-1":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -84,7 +84,7 @@
} }
] ]
}, },
"label-2":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -97,7 +97,7 @@
} }
] ]
}, },
"label-3":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -110,7 +110,7 @@
} }
] ]
}, },
"label-4":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -123,4 +123,4 @@
} }
] ]
} }
} ]

View File

@ -1,5 +1,5 @@
{ [
"8100":{ {
"inLabel":8100, "inLabel":8100,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -19,7 +19,7 @@
} }
] ]
}, },
"8300":{ {
"inLabel":8300, "inLabel":8300,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -32,7 +32,7 @@
} }
] ]
}, },
"8400":{ {
"inLabel":8400, "inLabel":8400,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -45,7 +45,7 @@
} }
] ]
}, },
"label-1":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -58,7 +58,7 @@
} }
] ]
}, },
"label-2":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -71,7 +71,7 @@
} }
] ]
}, },
"label-3":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -84,7 +84,7 @@
} }
] ]
}, },
"label-4":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -97,7 +97,7 @@
} }
] ]
}, },
"label-5":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -110,7 +110,7 @@
} }
] ]
}, },
"label-6":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -123,7 +123,7 @@
} }
] ]
}, },
"label-7":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -136,7 +136,7 @@
} }
] ]
}, },
"label-8":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -149,4 +149,4 @@
} }
] ]
} }
} ]

View File

@ -1,5 +1,5 @@
{ [
"10100":{ {
"inLabel":10100, "inLabel":10100,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -12,7 +12,7 @@
} }
] ]
}, },
"10200":{ {
"inLabel":10200, "inLabel":10200,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -25,7 +25,7 @@
} }
] ]
}, },
"10400":{ {
"inLabel":10400, "inLabel":10400,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -38,7 +38,7 @@
} }
] ]
}, },
"label-1":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -51,7 +51,7 @@
} }
] ]
}, },
"label-2":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -64,4 +64,4 @@
} }
] ]
} }
} ]

View File

@ -1,5 +1,5 @@
{ [
"10100":{ {
"inLabel":10100, "inLabel":10100,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -12,7 +12,7 @@
} }
] ]
}, },
"10200":{ {
"inLabel":10200, "inLabel":10200,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -25,7 +25,7 @@
} }
] ]
}, },
"10300":{ {
"inLabel":10300, "inLabel":10300,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -38,7 +38,7 @@
} }
] ]
}, },
"10400":{ {
"inLabel":10400, "inLabel":10400,
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -50,7 +50,7 @@
} }
] ]
}, },
"label-1":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -63,7 +63,7 @@
} }
] ]
}, },
"label-2":{ {
"inLabel":"*", "inLabel":"*",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
@ -76,4 +76,4 @@
} }
] ]
} }
} ]

View File

@ -151,18 +151,31 @@ def test_ospf_kernel_route():
logger.info("--- test OSPF Segment Routing MPLS tables ---") logger.info("--- test OSPF Segment Routing MPLS tables ---")
def show_mpls_table_json_cmp(rt, expected): def show_mpls_table_json_cmp(rt, expected):
"Removes random label and use `label-X` instead." """
text = rt.vtysh_cmd('show mpls table json') Reformat MPLS table output to use a list of labels instead of dict.
# Substitue random labels with fixed label value. Original:
for label in range(1, 10): {
text = re.sub(r'"5000[0-9]"', '"label-{}"'.format(label), text, "X": {
count=1) inLabel: "X",
# ...
}
}
print '\n{}\n'.format(text) List format:
[
{
inLabel: "X",
}
]
"""
out = rt.vtysh_cmd('show mpls table json', isjson=True)
output = json.loads(text) outlist = []
return topotest.json_cmp(output, expected) for key in out.keys():
outlist.append(out[key])
return topotest.json_cmp(outlist, expected)
for rnum in range(1, 5): for rnum in range(1, 5):
router = "r{}".format(rnum) router = "r{}".format(rnum)