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

View File

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

View File

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

View File

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

View File

@ -151,18 +151,31 @@ def test_ospf_kernel_route():
logger.info("--- test OSPF Segment Routing MPLS tables ---")
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.
for label in range(1, 10):
text = re.sub(r'"5000[0-9]"', '"label-{}"'.format(label), text,
count=1)
Original:
{
"X": {
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)
return topotest.json_cmp(output, expected)
outlist = []
for key in out.keys():
outlist.append(out[key])
return topotest.json_cmp(outlist, expected)
for rnum in range(1, 5):
router = "r{}".format(rnum)