ospfd: OSPF Segment Routing topostest update

Update OSPF Segment Routing topotest in conformity to ECMP
 - Add one more interface between r1 and r2 for ECMP
 - Anonymize Adjacency SID
 - Update expected json output

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
This commit is contained in:
Olivier Dugeon 2020-04-07 20:29:28 +02:00
parent b61264a8a3
commit 008bcff499
14 changed files with 357 additions and 166 deletions

View File

@ -15,11 +15,20 @@
"prefix":"10.0.255.2\/32", "prefix":"10.0.255.2\/32",
"sid":200, "sid":200,
"inputLabel":20200, "inputLabel":20200,
"outputLabel":"pop", "prefixRoute":[
{
"outputLabel":3,
"interface":"r1-eth0", "interface":"r1-eth0",
"nexthop":"10.0.0.2"
},
{
"outputLabel":3,
"interface":"r1-eth1",
"nexthop":"10.0.1.2" "nexthop":"10.0.1.2"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.4", "routerID":"10.0.255.4",
@ -36,32 +45,46 @@
"prefix":"10.0.255.4\/32", "prefix":"10.0.255.4\/32",
"sid":400, "sid":400,
"inputLabel":20400, "inputLabel":20400,
"outputLabel":"8400", "prefixRoute":[
{
"outputLabel":8400,
"interface":"r1-eth0", "interface":"r1-eth0",
"nexthop":"10.0.0.2"
},
{
"outputLabel":8400,
"interface":"r1-eth1",
"nexthop":"10.0.1.2" "nexthop":"10.0.1.2"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.3", "routerID":"10.0.255.3",
"srgbSize":10000, "srgbSize":10000,
"srgbLabel":10000, "srgbLabel":10000,
"algorithms":[ "algorithms":[
{
"0":"SPF"
}
], ],
"nodeMsd":8,
"extendedPrefix":[ "extendedPrefix":[
{ {
"prefix":"10.0.255.3\/32", "prefix":"10.0.255.3\/32",
"sid":300, "sid":300,
"inputLabel":20300, "inputLabel":20300,
"outputLabel":"8300", "prefixRoute":[
{
"outputLabel":8300,
"interface":"r1-eth0", "interface":"r1-eth0",
"nexthop":"10.0.0.2"
},
{
"outputLabel":8300,
"interface":"r1-eth1",
"nexthop":"10.0.1.2" "nexthop":"10.0.1.2"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.1", "routerID":"10.0.255.1",
@ -78,26 +101,46 @@
"prefix":"10.0.255.1\/32", "prefix":"10.0.255.1\/32",
"sid":100, "sid":100,
"inputLabel":20100, "inputLabel":20100,
"outputLabel":"pop", "prefixRoute":[
{
"outputLabel":3,
"interface":"lo", "interface":"lo",
"nexthop":"10.0.255.1" "nexthop":"10.0.255.1"
} }
]
}
], ],
"extendedLink":[ "extendedLink":[
{ {
"prefix":"10.0.1.1\/32", "prefix":"10.0.0.1\/32",
"sid":50001, "sid":"XX",
"inputLabel":50001, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r1-eth0", "interface":"r1-eth0",
"nexthop":"10.0.0.2"
},
{
"prefix":"10.0.0.1\/32",
"sid":"XX",
"inputLabel":"XX",
"outputLabel":3,
"interface":"r1-eth0",
"nexthop":"10.0.0.2"
},
{
"prefix":"10.0.1.1\/32",
"sid":"XX",
"inputLabel":"XX",
"outputLabel":3,
"interface":"r1-eth1",
"nexthop":"10.0.1.2" "nexthop":"10.0.1.2"
}, },
{ {
"prefix":"10.0.1.1\/32", "prefix":"10.0.1.1\/32",
"sid":50000, "sid":"XX",
"inputLabel":50000, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r1-eth0", "interface":"r1-eth1",
"nexthop":"10.0.1.2" "nexthop":"10.0.1.2"
} }
] ]

View File

@ -3,6 +3,11 @@ interface lo
ip ospf area 0.0.0.0 ip ospf area 0.0.0.0
! !
interface r1-eth0 interface r1-eth0
ip ospf network point-to-point
ip ospf area 0.0.0.0
!
interface r1-eth1
ip ospf network point-to-point
ip ospf area 0.0.0.0 ip ospf area 0.0.0.0
! !
router ospf router ospf

View File

@ -3,6 +3,9 @@ interface lo
ip address 10.0.255.1/32 ip address 10.0.255.1/32
! !
interface r1-eth0 interface r1-eth0
ip address 10.0.0.1/24
!
interface r1-eth1
ip address 10.0.1.1/24 ip address 10.0.1.1/24
! !
ip forwarding ip forwarding

View File

@ -7,8 +7,7 @@
"type":"SR (OSPF)", "type":"SR (OSPF)",
"outLabel":3, "outLabel":3,
"distance":150, "distance":150,
"installed":true, "installed":true
"nexthop":"10.0.255.1"
} }
] ]
}, },
@ -22,6 +21,13 @@
"distance":150, "distance":150,
"installed":true, "installed":true,
"nexthop":"10.0.1.2" "nexthop":"10.0.1.2"
},
{
"type":"SR (OSPF)",
"outLabel":3,
"distance":150,
"installed":true,
"nexthop":"10.0.0.2"
} }
] ]
}, },
@ -35,6 +41,13 @@
"distance":150, "distance":150,
"installed":true, "installed":true,
"nexthop":"10.0.1.2" "nexthop":"10.0.1.2"
},
{
"type":"SR (OSPF)",
"outLabel":8300,
"distance":150,
"installed":true,
"nexthop":"10.0.0.2"
} }
] ]
}, },
@ -48,11 +61,44 @@
"distance":150, "distance":150,
"installed":true, "installed":true,
"nexthop":"10.0.1.2" "nexthop":"10.0.1.2"
},
{
"type":"SR (OSPF)",
"outLabel":8400,
"distance":150,
"installed":true,
"nexthop":"10.0.0.2"
} }
] ]
}, },
"50000":{ "XX":{
"inLabel":50000, "inLabel":"XX",
"installed":true,
"nexthops":[
{
"type":"SR (OSPF)",
"outLabel":3,
"distance":150,
"installed":true,
"nexthop":"10.0.0.2"
}
]
},
"XX":{
"inLabel":"XX",
"installed":true,
"nexthops":[
{
"type":"SR (OSPF)",
"outLabel":3,
"distance":150,
"installed":true,
"nexthop":"10.0.0.2"
}
]
},
"XX":{
"inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -64,8 +110,8 @@
} }
] ]
}, },
"50001":{ "XX":{
"inLabel":50001, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {

View File

@ -15,59 +15,79 @@
"prefix":"10.0.255.2\/32", "prefix":"10.0.255.2\/32",
"sid":200, "sid":200,
"inputLabel":0, "inputLabel":0,
"outputLabel":"0", "prefixRoute":[
{
"outputLabel":0,
"interface":"lo", "interface":"lo",
"nexthop":"10.0.255.2" "nexthop":"10.0.255.2"
} }
]
}
], ],
"extendedLink":[ "extendedLink":[
{ {
"prefix":"10.0.4.2\/32", "prefix":"10.0.4.2\/32",
"sid":50001, "sid":"XX",
"inputLabel":50001, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r2-eth2", "interface":"r2-eth3",
"nexthop":"10.0.4.1" "nexthop":"10.0.4.1"
}, },
{ {
"prefix":"10.0.4.2\/32", "prefix":"10.0.4.2\/32",
"sid":50000, "sid":"XX",
"inputLabel":50000, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r2-eth2", "interface":"r2-eth3",
"nexthop":"10.0.4.1" "nexthop":"10.0.4.1"
}, },
{ {
"prefix":"10.0.3.2\/32", "prefix":"10.0.0.2\/32",
"sid":50003, "sid":"XX",
"inputLabel":50003, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r2-eth1", "interface":"r2-eth0",
"nexthop":"10.0.3.1" "nexthop":"10.0.0.1"
}, },
{ {
"prefix":"10.0.3.2\/32", "prefix":"10.0.0.2\/32",
"sid":50002, "sid":"XX",
"inputLabel":50002, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r2-eth1", "interface":"r2-eth0",
"nexthop":"10.0.3.1" "nexthop":"10.0.0.1"
}, },
{ {
"prefix":"10.0.1.2\/32", "prefix":"10.0.1.2\/32",
"sid":50005, "sid":"XX",
"inputLabel":50005, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r2-eth0", "interface":"r2-eth1",
"nexthop":"10.0.1.1" "nexthop":"10.0.1.1"
}, },
{ {
"prefix":"10.0.1.2\/32", "prefix":"10.0.1.2\/32",
"sid":50004, "sid":"XX",
"inputLabel":50004, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r2-eth0", "interface":"r2-eth1",
"nexthop":"10.0.1.1" "nexthop":"10.0.1.1"
},
{
"prefix":"10.0.3.2\/32",
"sid":"XX",
"inputLabel":"XX",
"outputLabel":3,
"interface":"r2-eth2",
"nexthop":"10.0.3.1"
},
{
"prefix":"10.0.3.2\/32",
"sid":"XX",
"inputLabel":"XX",
"outputLabel":3,
"interface":"r2-eth2",
"nexthop":"10.0.3.1"
} }
] ]
}, },
@ -76,63 +96,68 @@
"srgbSize":10000, "srgbSize":10000,
"srgbLabel":10000, "srgbLabel":10000,
"algorithms":[ "algorithms":[
{
"0":"SPF"
}
], ],
"nodeMsd":12,
"extendedPrefix":[ "extendedPrefix":[
{ {
"prefix":"10.0.255.4\/32", "prefix":"10.0.255.4\/32",
"sid":400, "sid":400,
"inputLabel":8400, "inputLabel":8400,
"outputLabel":"10400", "prefixRoute":[
"interface":"r2-eth2", {
"outputLabel":10400,
"interface":"r2-eth3",
"nexthop":"10.0.4.1" "nexthop":"10.0.4.1"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.3", "routerID":"10.0.255.3",
"srgbSize":10000, "srgbSize":10000,
"srgbLabel":10000, "srgbLabel":10000,
"algorithms":[ "algorithms":[
{
"0":"SPF"
}
], ],
"nodeMsd":8,
"extendedPrefix":[ "extendedPrefix":[
{ {
"prefix":"10.0.255.3\/32", "prefix":"10.0.255.3\/32",
"sid":300, "sid":300,
"inputLabel":8300, "inputLabel":8300,
"outputLabel":"pop", "prefixRoute":[
"interface":"r2-eth1", {
"outputLabel":3,
"interface":"r2-eth2",
"nexthop":"10.0.3.1" "nexthop":"10.0.3.1"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.1", "routerID":"10.0.255.1",
"srgbSize":10000, "srgbSize":10000,
"srgbLabel":20000, "srgbLabel":20000,
"algorithms":[ "algorithms":[
{
"0":"SPF"
}
], ],
"nodeMsd":16,
"extendedPrefix":[ "extendedPrefix":[
{ {
"prefix":"10.0.255.1\/32", "prefix":"10.0.255.1\/32",
"sid":100, "sid":100,
"inputLabel":8100, "inputLabel":8100,
"outputLabel":"20100", "prefixRoute":[
{
"outputLabel":20100,
"interface":"r2-eth0", "interface":"r2-eth0",
"nexthop":"10.0.0.1"
},
{
"outputLabel":20100,
"interface":"r2-eth1",
"nexthop":"10.0.1.1" "nexthop":"10.0.1.1"
} }
] ]
} }
] ]
} }
]
}

View File

@ -5,6 +5,7 @@ interface lo
ip ospf area 0.0.0.0 ip ospf area 0.0.0.0
! !
interface r2-eth0 interface r2-eth0
ip ospf network point-to-point
ip ospf area 0.0.0.0 ip ospf area 0.0.0.0
! !
interface r2-eth1 interface r2-eth1
@ -12,6 +13,9 @@ interface r2-eth1
ip ospf area 0.0.0.0 ip ospf area 0.0.0.0
! !
interface r2-eth2 interface r2-eth2
ip ospf area 0.0.0.0
!
interface r2-eth3
ip ospf network point-to-point ip ospf network point-to-point
ip ospf area 0.0.0.0 ip ospf area 0.0.0.0
! !

View File

@ -3,12 +3,15 @@ interface lo
ip address 10.0.255.2/32 ip address 10.0.255.2/32
! !
interface r2-eth0 interface r2-eth0
ip address 10.0.1.2/24 ip address 10.0.0.2/24
! !
interface r2-eth1 interface r2-eth1
ip address 10.0.3.2/24 ip address 10.0.1.2/24
! !
interface r2-eth2 interface r2-eth2
ip address 10.0.3.2/24
!
interface r2-eth3
ip address 10.0.4.2/24 ip address 10.0.4.2/24
! !
ip forwarding ip forwarding

View File

@ -9,6 +9,13 @@
"distance":150, "distance":150,
"installed":true, "installed":true,
"nexthop":"10.0.1.1" "nexthop":"10.0.1.1"
},
{
"type":"SR (OSPF)",
"outLabel":20100,
"distance":150,
"installed":true,
"nexthop":"10.0.0.1"
} }
] ]
}, },
@ -38,8 +45,8 @@
} }
] ]
}, },
"50000":{ "XX":{
"inLabel":50000, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -51,8 +58,8 @@
} }
] ]
}, },
"50001":{ "XX":{
"inLabel":50001, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -64,8 +71,8 @@
} }
] ]
}, },
"50002":{ "XX":{
"inLabel":50002, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -73,12 +80,12 @@
"outLabel":3, "outLabel":3,
"distance":150, "distance":150,
"installed":true, "installed":true,
"nexthop":"10.0.3.1" "nexthop":"10.0.0.1"
} }
] ]
}, },
"50003":{ "XX":{
"inLabel":50003, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -86,12 +93,12 @@
"outLabel":3, "outLabel":3,
"distance":150, "distance":150,
"installed":true, "installed":true,
"nexthop":"10.0.3.1" "nexthop":"10.0.0.1"
} }
] ]
}, },
"50004":{ "XX":{
"inLabel":50004, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -103,8 +110,8 @@
} }
] ]
}, },
"50005":{ "XX":{
"inLabel":50005, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -115,5 +122,31 @@
"nexthop":"10.0.1.1" "nexthop":"10.0.1.1"
} }
] ]
},
"XX":{
"inLabel":"XX",
"installed":true,
"nexthops":[
{
"type":"SR (OSPF)",
"outLabel":3,
"distance":150,
"installed":true,
"nexthop":"10.0.3.1"
}
]
},
"XX":{
"inLabel":"XX",
"installed":true,
"nexthops":[
{
"type":"SR (OSPF)",
"outLabel":3,
"distance":150,
"installed":true,
"nexthop":"10.0.3.1"
}
]
} }
} }

View File

@ -15,11 +15,15 @@
"prefix":"10.0.255.2\/32", "prefix":"10.0.255.2\/32",
"sid":200, "sid":200,
"inputLabel":10200, "inputLabel":10200,
"outputLabel":"pop", "prefixRoute":[
{
"outputLabel":3,
"interface":"r3-eth0", "interface":"r3-eth0",
"nexthop":"10.0.3.2" "nexthop":"10.0.3.2"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.4", "routerID":"10.0.255.4",
@ -36,11 +40,15 @@
"prefix":"10.0.255.4\/32", "prefix":"10.0.255.4\/32",
"sid":400, "sid":400,
"inputLabel":10400, "inputLabel":10400,
"outputLabel":"8400", "prefixRoute":[
{
"outputLabel":8400,
"interface":"r3-eth0", "interface":"r3-eth0",
"nexthop":"10.0.3.2" "nexthop":"10.0.3.2"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.3", "routerID":"10.0.255.3",
@ -57,25 +65,29 @@
"prefix":"10.0.255.3\/32", "prefix":"10.0.255.3\/32",
"sid":300, "sid":300,
"inputLabel":0, "inputLabel":0,
"outputLabel":"0", "prefixRoute":[
{
"outputLabel":0,
"interface":"lo", "interface":"lo",
"nexthop":"10.0.255.3" "nexthop":"10.0.255.3"
} }
]
}
], ],
"extendedLink":[ "extendedLink":[
{ {
"prefix":"10.0.3.1\/32", "prefix":"10.0.3.1\/32",
"sid":50001, "sid":"XX",
"inputLabel":50001, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r3-eth0", "interface":"r3-eth0",
"nexthop":"10.0.3.2" "nexthop":"10.0.3.2"
}, },
{ {
"prefix":"10.0.3.1\/32", "prefix":"10.0.3.1\/32",
"sid":50000, "sid":"XX",
"inputLabel":50000, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r3-eth0", "interface":"r3-eth0",
"nexthop":"10.0.3.2" "nexthop":"10.0.3.2"
} }
@ -96,7 +108,9 @@
"prefix":"10.0.255.1\/32", "prefix":"10.0.255.1\/32",
"sid":100, "sid":100,
"inputLabel":10100, "inputLabel":10100,
"outputLabel":"8100", "prefixRoute":[
{
"outputLabel":8100,
"interface":"r3-eth0", "interface":"r3-eth0",
"nexthop":"10.0.3.2" "nexthop":"10.0.3.2"
} }
@ -104,3 +118,5 @@
} }
] ]
} }
]
}

View File

@ -3,7 +3,6 @@ interface lo
ip ospf area 0.0.0.0 ip ospf area 0.0.0.0
! !
interface r3-eth0 interface r3-eth0
ip ospf network point-to-point
ip ospf area 0.0.0.0 ip ospf area 0.0.0.0
! !
! !

View File

@ -38,8 +38,8 @@
} }
] ]
}, },
"50000":{ "XX":{
"inLabel":50000, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -51,8 +51,8 @@
} }
] ]
}, },
"50001":{ "XX":{
"inLabel":50001, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {

View File

@ -6,20 +6,21 @@
"srgbSize":20000, "srgbSize":20000,
"srgbLabel":8000, "srgbLabel":8000,
"algorithms":[ "algorithms":[
{
"0":"SPF"
}
], ],
"extendedPrefix":[ "extendedPrefix":[
{ {
"prefix":"10.0.255.2\/32", "prefix":"10.0.255.2\/32",
"sid":200, "sid":200,
"inputLabel":10200, "inputLabel":10200,
"outputLabel":"pop", "prefixRoute":[
{
"outputLabel":3,
"interface":"r4-eth0", "interface":"r4-eth0",
"nexthop":"10.0.4.2" "nexthop":"10.0.4.2"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.4", "routerID":"10.0.255.4",
@ -36,25 +37,29 @@
"prefix":"10.0.255.4\/32", "prefix":"10.0.255.4\/32",
"sid":400, "sid":400,
"inputLabel":10400, "inputLabel":10400,
"outputLabel":"pop", "prefixRoute":[
{
"outputLabel":3,
"interface":"lo", "interface":"lo",
"nexthop":"10.0.255.4" "nexthop":"10.0.255.4"
} }
]
}
], ],
"extendedLink":[ "extendedLink":[
{ {
"prefix":"10.0.4.1\/32", "prefix":"10.0.4.1\/32",
"sid":50001, "sid":"XX",
"inputLabel":50001, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r4-eth0", "interface":"r4-eth0",
"nexthop":"10.0.4.2" "nexthop":"10.0.4.2"
}, },
{ {
"prefix":"10.0.4.1\/32", "prefix":"10.0.4.1\/32",
"sid":50000, "sid":"XX",
"inputLabel":50000, "inputLabel":"XX",
"outputLabel":"pop", "outputLabel":3,
"interface":"r4-eth0", "interface":"r4-eth0",
"nexthop":"10.0.4.2" "nexthop":"10.0.4.2"
} }
@ -65,38 +70,36 @@
"srgbSize":10000, "srgbSize":10000,
"srgbLabel":10000, "srgbLabel":10000,
"algorithms":[ "algorithms":[
{
"0":"SPF"
}
], ],
"nodeMsd":8,
"extendedPrefix":[ "extendedPrefix":[
{ {
"prefix":"10.0.255.3\/32", "prefix":"10.0.255.3\/32",
"sid":300, "sid":300,
"inputLabel":10300, "inputLabel":10300,
"outputLabel":"8300", "prefixRoute":[
{
"outputLabel":8300,
"interface":"r4-eth0", "interface":"r4-eth0",
"nexthop":"10.0.4.2" "nexthop":"10.0.4.2"
} }
] ]
}
]
}, },
{ {
"routerID":"10.0.255.1", "routerID":"10.0.255.1",
"srgbSize":10000, "srgbSize":10000,
"srgbLabel":20000, "srgbLabel":20000,
"algorithms":[ "algorithms":[
{
"0":"SPF"
}
], ],
"nodeMsd":16,
"extendedPrefix":[ "extendedPrefix":[
{ {
"prefix":"10.0.255.1\/32", "prefix":"10.0.255.1\/32",
"sid":100, "sid":100,
"inputLabel":10100, "inputLabel":10100,
"outputLabel":"8100", "prefixRoute":[
{
"outputLabel":8100,
"interface":"r4-eth0", "interface":"r4-eth0",
"nexthop":"10.0.4.2" "nexthop":"10.0.4.2"
} }
@ -104,3 +107,5 @@
} }
] ]
} }
]
}

View File

@ -46,13 +46,12 @@
"type":"SR (OSPF)", "type":"SR (OSPF)",
"outLabel":3, "outLabel":3,
"distance":150, "distance":150,
"installed":true, "installed":true
"nexthop":"10.0.255.4"
} }
] ]
}, },
"50000":{ "XX":{
"inLabel":50000, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {
@ -64,8 +63,8 @@
} }
] ]
}, },
"50001":{ "XX":{
"inLabel":50001, "inLabel":"XX",
"installed":true, "installed":true,
"nexthops":[ "nexthops":[
{ {

View File

@ -27,6 +27,7 @@ test_ospf_sr_topo1.py: Test the FRR OSPF routing daemon with Segment Routing.
""" """
import os import os
import re
import sys import sys
from functools import partial from functools import partial
@ -62,20 +63,23 @@ class OspfSrTopo(Topo):
for routern in range(1, 5): for routern in range(1, 5):
tgen.add_router("r{}".format(routern)) tgen.add_router("r{}".format(routern))
# Interconect router 1 and 2 # Interconect router 1 and 2 with 2 links
switch = tgen.add_switch("s1") switch = tgen.add_switch('s1')
switch.add_link(tgen.gears["r1"]) switch.add_link(tgen.gears['r1'])
switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears['r2'])
switch = tgen.add_switch('s2')
switch.add_link(tgen.gears['r1'])
switch.add_link(tgen.gears['r2'])
# Interconect router 3 and 2 # Interconect router 3 and 2
switch = tgen.add_switch("s2") switch = tgen.add_switch('s3')
switch.add_link(tgen.gears["r3"]) switch.add_link(tgen.gears['r3'])
switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears['r2'])
# Interconect router 4 and 2 # Interconect router 4 and 2
switch = tgen.add_switch("s3") switch = tgen.add_switch('s4')
switch.add_link(tgen.gears["r4"]) switch.add_link(tgen.gears['r4'])
switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears['r2'])
def setup_module(mod): def setup_module(mod):
@ -130,6 +134,9 @@ def compare_ospf_srdb(rname, expected):
""" """
tgen = get_topogen() tgen = get_topogen()
current = tgen.gears[rname].vtysh_cmd("show ip ospf database segment-routing json") current = tgen.gears[rname].vtysh_cmd("show ip ospf database segment-routing json")
# Filter Adjacency SID allocation
current = re.sub(r'"sid":5000[0-9],', '"sid":"XX",', current)
current = re.sub(r'"inputLabel":5000[0-9],', '"inputLabel":"XX",', current)
return topotest.difflines( return topotest.difflines(
current, expected, title1="Current output", title2="Expected output" current, expected, title1="Current output", title2="Expected output"
) )
@ -142,6 +149,9 @@ def compare_mpls_table(rname, expected):
""" """
tgen = get_topogen() tgen = get_topogen()
current = tgen.gears[rname].vtysh_cmd("show mpls table json") current = tgen.gears[rname].vtysh_cmd("show mpls table json")
# Filter Adjacency SID allocation
current = re.sub(r'"5000[0-9]":', '"XX":', current)
current = re.sub(r'"inLabel":5000[0-9],', '"inLabel":"XX",', current)
return topotest.difflines( return topotest.difflines(
current, expected, title1="Current output", title2="Expected output" current, expected, title1="Current output", title2="Expected output"
) )