From 008bcff499bd8d9f5b968c9a90d1c46b951af275 Mon Sep 17 00:00:00 2001 From: Olivier Dugeon Date: Tue, 7 Apr 2020 20:29:28 +0200 Subject: [PATCH] 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 --- .../topotests/ospf-sr-topo1/r1/ospf_srdb.json | 91 ++++++++---- tests/topotests/ospf-sr-topo1/r1/ospfd.conf | 5 + tests/topotests/ospf-sr-topo1/r1/zebra.conf | 3 + .../ospf-sr-topo1/r1/zebra_mpls.json | 58 +++++++- .../topotests/ospf-sr-topo1/r2/ospf_srdb.json | 129 +++++++++++------- tests/topotests/ospf-sr-topo1/r2/ospfd.conf | 4 + tests/topotests/ospf-sr-topo1/r2/zebra.conf | 7 +- .../ospf-sr-topo1/r2/zebra_mpls.json | 61 +++++++-- .../topotests/ospf-sr-topo1/r3/ospf_srdb.json | 52 ++++--- tests/topotests/ospf-sr-topo1/r3/ospfd.conf | 1 - .../ospf-sr-topo1/r3/zebra_mpls.json | 8 +- .../topotests/ospf-sr-topo1/r4/ospf_srdb.json | 63 +++++---- .../ospf-sr-topo1/r4/zebra_mpls.json | 11 +- .../ospf-sr-topo1/test_ospf_sr_topo1.py | 30 ++-- 14 files changed, 357 insertions(+), 166 deletions(-) diff --git a/tests/topotests/ospf-sr-topo1/r1/ospf_srdb.json b/tests/topotests/ospf-sr-topo1/r1/ospf_srdb.json index 4ffca6f940..652978aff8 100644 --- a/tests/topotests/ospf-sr-topo1/r1/ospf_srdb.json +++ b/tests/topotests/ospf-sr-topo1/r1/ospf_srdb.json @@ -15,9 +15,18 @@ "prefix":"10.0.255.2\/32", "sid":200, "inputLabel":20200, - "outputLabel":"pop", - "interface":"r1-eth0", - "nexthop":"10.0.1.2" + "prefixRoute":[ + { + "outputLabel":3, + "interface":"r1-eth0", + "nexthop":"10.0.0.2" + }, + { + "outputLabel":3, + "interface":"r1-eth1", + "nexthop":"10.0.1.2" + } + ] } ] }, @@ -36,9 +45,18 @@ "prefix":"10.0.255.4\/32", "sid":400, "inputLabel":20400, - "outputLabel":"8400", - "interface":"r1-eth0", - "nexthop":"10.0.1.2" + "prefixRoute":[ + { + "outputLabel":8400, + "interface":"r1-eth0", + "nexthop":"10.0.0.2" + }, + { + "outputLabel":8400, + "interface":"r1-eth1", + "nexthop":"10.0.1.2" + } + ] } ] }, @@ -47,19 +65,24 @@ "srgbSize":10000, "srgbLabel":10000, "algorithms":[ - { - "0":"SPF" - } ], - "nodeMsd":8, "extendedPrefix":[ { "prefix":"10.0.255.3\/32", "sid":300, "inputLabel":20300, - "outputLabel":"8300", - "interface":"r1-eth0", - "nexthop":"10.0.1.2" + "prefixRoute":[ + { + "outputLabel":8300, + "interface":"r1-eth0", + "nexthop":"10.0.0.2" + }, + { + "outputLabel":8300, + "interface":"r1-eth1", + "nexthop":"10.0.1.2" + } + ] } ] }, @@ -78,26 +101,46 @@ "prefix":"10.0.255.1\/32", "sid":100, "inputLabel":20100, - "outputLabel":"pop", - "interface":"lo", - "nexthop":"10.0.255.1" + "prefixRoute":[ + { + "outputLabel":3, + "interface":"lo", + "nexthop":"10.0.255.1" + } + ] } ], "extendedLink":[ { - "prefix":"10.0.1.1\/32", - "sid":50001, - "inputLabel":50001, - "outputLabel":"pop", + "prefix":"10.0.0.1\/32", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, + "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" }, { "prefix":"10.0.1.1\/32", - "sid":50000, - "inputLabel":50000, - "outputLabel":"pop", - "interface":"r1-eth0", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, + "interface":"r1-eth1", "nexthop":"10.0.1.2" } ] diff --git a/tests/topotests/ospf-sr-topo1/r1/ospfd.conf b/tests/topotests/ospf-sr-topo1/r1/ospfd.conf index e8593d1a1a..292d4e6367 100644 --- a/tests/topotests/ospf-sr-topo1/r1/ospfd.conf +++ b/tests/topotests/ospf-sr-topo1/r1/ospfd.conf @@ -3,6 +3,11 @@ interface lo ip ospf area 0.0.0.0 ! 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 ! router ospf diff --git a/tests/topotests/ospf-sr-topo1/r1/zebra.conf b/tests/topotests/ospf-sr-topo1/r1/zebra.conf index f1fcc7dd3b..faf71db25c 100644 --- a/tests/topotests/ospf-sr-topo1/r1/zebra.conf +++ b/tests/topotests/ospf-sr-topo1/r1/zebra.conf @@ -3,6 +3,9 @@ interface lo ip address 10.0.255.1/32 ! interface r1-eth0 + ip address 10.0.0.1/24 +! +interface r1-eth1 ip address 10.0.1.1/24 ! ip forwarding diff --git a/tests/topotests/ospf-sr-topo1/r1/zebra_mpls.json b/tests/topotests/ospf-sr-topo1/r1/zebra_mpls.json index 6b1fe76b6e..88ba28da42 100644 --- a/tests/topotests/ospf-sr-topo1/r1/zebra_mpls.json +++ b/tests/topotests/ospf-sr-topo1/r1/zebra_mpls.json @@ -7,8 +7,7 @@ "type":"SR (OSPF)", "outLabel":3, "distance":150, - "installed":true, - "nexthop":"10.0.255.1" + "installed":true } ] }, @@ -22,6 +21,13 @@ "distance":150, "installed":true, "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, "installed":true, "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, "installed":true, "nexthop":"10.0.1.2" + }, + { + "type":"SR (OSPF)", + "outLabel":8400, + "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, + "nexthops":[ + { + "type":"SR (OSPF)", + "outLabel":3, + "distance":150, + "installed":true, + "nexthop":"10.0.0.2" } ] }, - "50000":{ - "inLabel":50000, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -64,8 +110,8 @@ } ] }, - "50001":{ - "inLabel":50001, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { diff --git a/tests/topotests/ospf-sr-topo1/r2/ospf_srdb.json b/tests/topotests/ospf-sr-topo1/r2/ospf_srdb.json index 2548299cc7..13437c9cf5 100644 --- a/tests/topotests/ospf-sr-topo1/r2/ospf_srdb.json +++ b/tests/topotests/ospf-sr-topo1/r2/ospf_srdb.json @@ -15,59 +15,79 @@ "prefix":"10.0.255.2\/32", "sid":200, "inputLabel":0, - "outputLabel":"0", - "interface":"lo", - "nexthop":"10.0.255.2" + "prefixRoute":[ + { + "outputLabel":0, + "interface":"lo", + "nexthop":"10.0.255.2" + } + ] } ], "extendedLink":[ { "prefix":"10.0.4.2\/32", - "sid":50001, - "inputLabel":50001, - "outputLabel":"pop", - "interface":"r2-eth2", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, + "interface":"r2-eth3", "nexthop":"10.0.4.1" }, { "prefix":"10.0.4.2\/32", - "sid":50000, - "inputLabel":50000, - "outputLabel":"pop", - "interface":"r2-eth2", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, + "interface":"r2-eth3", "nexthop":"10.0.4.1" }, { - "prefix":"10.0.3.2\/32", - "sid":50003, - "inputLabel":50003, - "outputLabel":"pop", - "interface":"r2-eth1", - "nexthop":"10.0.3.1" + "prefix":"10.0.0.2\/32", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, + "interface":"r2-eth0", + "nexthop":"10.0.0.1" }, { - "prefix":"10.0.3.2\/32", - "sid":50002, - "inputLabel":50002, - "outputLabel":"pop", - "interface":"r2-eth1", - "nexthop":"10.0.3.1" + "prefix":"10.0.0.2\/32", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, + "interface":"r2-eth0", + "nexthop":"10.0.0.1" }, { "prefix":"10.0.1.2\/32", - "sid":50005, - "inputLabel":50005, - "outputLabel":"pop", - "interface":"r2-eth0", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, + "interface":"r2-eth1", "nexthop":"10.0.1.1" }, { "prefix":"10.0.1.2\/32", - "sid":50004, - "inputLabel":50004, - "outputLabel":"pop", - "interface":"r2-eth0", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, + "interface":"r2-eth1", "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,19 +96,19 @@ "srgbSize":10000, "srgbLabel":10000, "algorithms":[ - { - "0":"SPF" - } ], - "nodeMsd":12, "extendedPrefix":[ { "prefix":"10.0.255.4\/32", "sid":400, "inputLabel":8400, - "outputLabel":"10400", - "interface":"r2-eth2", - "nexthop":"10.0.4.1" + "prefixRoute":[ + { + "outputLabel":10400, + "interface":"r2-eth3", + "nexthop":"10.0.4.1" + } + ] } ] }, @@ -97,19 +117,19 @@ "srgbSize":10000, "srgbLabel":10000, "algorithms":[ - { - "0":"SPF" - } ], - "nodeMsd":8, "extendedPrefix":[ { "prefix":"10.0.255.3\/32", "sid":300, "inputLabel":8300, - "outputLabel":"pop", - "interface":"r2-eth1", - "nexthop":"10.0.3.1" + "prefixRoute":[ + { + "outputLabel":3, + "interface":"r2-eth2", + "nexthop":"10.0.3.1" + } + ] } ] }, @@ -118,19 +138,24 @@ "srgbSize":10000, "srgbLabel":20000, "algorithms":[ - { - "0":"SPF" - } ], - "nodeMsd":16, "extendedPrefix":[ { "prefix":"10.0.255.1\/32", "sid":100, "inputLabel":8100, - "outputLabel":"20100", - "interface":"r2-eth0", - "nexthop":"10.0.1.1" + "prefixRoute":[ + { + "outputLabel":20100, + "interface":"r2-eth0", + "nexthop":"10.0.0.1" + }, + { + "outputLabel":20100, + "interface":"r2-eth1", + "nexthop":"10.0.1.1" + } + ] } ] } diff --git a/tests/topotests/ospf-sr-topo1/r2/ospfd.conf b/tests/topotests/ospf-sr-topo1/r2/ospfd.conf index 4d6146aaa7..b8c7b999e8 100644 --- a/tests/topotests/ospf-sr-topo1/r2/ospfd.conf +++ b/tests/topotests/ospf-sr-topo1/r2/ospfd.conf @@ -5,6 +5,7 @@ interface lo ip ospf area 0.0.0.0 ! interface r2-eth0 + ip ospf network point-to-point ip ospf area 0.0.0.0 ! interface r2-eth1 @@ -12,6 +13,9 @@ interface r2-eth1 ip ospf area 0.0.0.0 ! interface r2-eth2 + ip ospf area 0.0.0.0 +! +interface r2-eth3 ip ospf network point-to-point ip ospf area 0.0.0.0 ! diff --git a/tests/topotests/ospf-sr-topo1/r2/zebra.conf b/tests/topotests/ospf-sr-topo1/r2/zebra.conf index f89548d8c5..ba1d833f50 100644 --- a/tests/topotests/ospf-sr-topo1/r2/zebra.conf +++ b/tests/topotests/ospf-sr-topo1/r2/zebra.conf @@ -3,12 +3,15 @@ interface lo ip address 10.0.255.2/32 ! interface r2-eth0 - ip address 10.0.1.2/24 + ip address 10.0.0.2/24 ! interface r2-eth1 - ip address 10.0.3.2/24 + ip address 10.0.1.2/24 ! interface r2-eth2 + ip address 10.0.3.2/24 +! +interface r2-eth3 ip address 10.0.4.2/24 ! ip forwarding diff --git a/tests/topotests/ospf-sr-topo1/r2/zebra_mpls.json b/tests/topotests/ospf-sr-topo1/r2/zebra_mpls.json index 79965d280a..2931b7dc34 100644 --- a/tests/topotests/ospf-sr-topo1/r2/zebra_mpls.json +++ b/tests/topotests/ospf-sr-topo1/r2/zebra_mpls.json @@ -9,6 +9,13 @@ "distance":150, "installed":true, "nexthop":"10.0.1.1" + }, + { + "type":"SR (OSPF)", + "outLabel":20100, + "distance":150, + "installed":true, + "nexthop":"10.0.0.1" } ] }, @@ -38,8 +45,8 @@ } ] }, - "50000":{ - "inLabel":50000, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -51,8 +58,8 @@ } ] }, - "50001":{ - "inLabel":50001, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -64,8 +71,8 @@ } ] }, - "50002":{ - "inLabel":50002, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -73,12 +80,12 @@ "outLabel":3, "distance":150, "installed":true, - "nexthop":"10.0.3.1" + "nexthop":"10.0.0.1" } ] }, - "50003":{ - "inLabel":50003, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -86,12 +93,12 @@ "outLabel":3, "distance":150, "installed":true, - "nexthop":"10.0.3.1" + "nexthop":"10.0.0.1" } ] }, - "50004":{ - "inLabel":50004, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -103,8 +110,8 @@ } ] }, - "50005":{ - "inLabel":50005, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -115,5 +122,31 @@ "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" + } + ] } } diff --git a/tests/topotests/ospf-sr-topo1/r3/ospf_srdb.json b/tests/topotests/ospf-sr-topo1/r3/ospf_srdb.json index 4b618cc7ad..d070aafb1e 100644 --- a/tests/topotests/ospf-sr-topo1/r3/ospf_srdb.json +++ b/tests/topotests/ospf-sr-topo1/r3/ospf_srdb.json @@ -15,9 +15,13 @@ "prefix":"10.0.255.2\/32", "sid":200, "inputLabel":10200, - "outputLabel":"pop", - "interface":"r3-eth0", - "nexthop":"10.0.3.2" + "prefixRoute":[ + { + "outputLabel":3, + "interface":"r3-eth0", + "nexthop":"10.0.3.2" + } + ] } ] }, @@ -36,9 +40,13 @@ "prefix":"10.0.255.4\/32", "sid":400, "inputLabel":10400, - "outputLabel":"8400", - "interface":"r3-eth0", - "nexthop":"10.0.3.2" + "prefixRoute":[ + { + "outputLabel":8400, + "interface":"r3-eth0", + "nexthop":"10.0.3.2" + } + ] } ] }, @@ -57,25 +65,29 @@ "prefix":"10.0.255.3\/32", "sid":300, "inputLabel":0, - "outputLabel":"0", - "interface":"lo", - "nexthop":"10.0.255.3" + "prefixRoute":[ + { + "outputLabel":0, + "interface":"lo", + "nexthop":"10.0.255.3" + } + ] } ], "extendedLink":[ { "prefix":"10.0.3.1\/32", - "sid":50001, - "inputLabel":50001, - "outputLabel":"pop", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, "interface":"r3-eth0", "nexthop":"10.0.3.2" }, { "prefix":"10.0.3.1\/32", - "sid":50000, - "inputLabel":50000, - "outputLabel":"pop", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, "interface":"r3-eth0", "nexthop":"10.0.3.2" } @@ -96,9 +108,13 @@ "prefix":"10.0.255.1\/32", "sid":100, "inputLabel":10100, - "outputLabel":"8100", - "interface":"r3-eth0", - "nexthop":"10.0.3.2" + "prefixRoute":[ + { + "outputLabel":8100, + "interface":"r3-eth0", + "nexthop":"10.0.3.2" + } + ] } ] } diff --git a/tests/topotests/ospf-sr-topo1/r3/ospfd.conf b/tests/topotests/ospf-sr-topo1/r3/ospfd.conf index 5aaa14fac4..cf274bed2e 100644 --- a/tests/topotests/ospf-sr-topo1/r3/ospfd.conf +++ b/tests/topotests/ospf-sr-topo1/r3/ospfd.conf @@ -3,7 +3,6 @@ interface lo ip ospf area 0.0.0.0 ! interface r3-eth0 - ip ospf network point-to-point ip ospf area 0.0.0.0 ! ! diff --git a/tests/topotests/ospf-sr-topo1/r3/zebra_mpls.json b/tests/topotests/ospf-sr-topo1/r3/zebra_mpls.json index ceb2f7a0e5..c9264d8a42 100644 --- a/tests/topotests/ospf-sr-topo1/r3/zebra_mpls.json +++ b/tests/topotests/ospf-sr-topo1/r3/zebra_mpls.json @@ -38,8 +38,8 @@ } ] }, - "50000":{ - "inLabel":50000, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -51,8 +51,8 @@ } ] }, - "50001":{ - "inLabel":50001, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { diff --git a/tests/topotests/ospf-sr-topo1/r4/ospf_srdb.json b/tests/topotests/ospf-sr-topo1/r4/ospf_srdb.json index 098e87dc25..17c0ea276e 100644 --- a/tests/topotests/ospf-sr-topo1/r4/ospf_srdb.json +++ b/tests/topotests/ospf-sr-topo1/r4/ospf_srdb.json @@ -6,18 +6,19 @@ "srgbSize":20000, "srgbLabel":8000, "algorithms":[ - { - "0":"SPF" - } ], "extendedPrefix":[ { "prefix":"10.0.255.2\/32", "sid":200, "inputLabel":10200, - "outputLabel":"pop", - "interface":"r4-eth0", - "nexthop":"10.0.4.2" + "prefixRoute":[ + { + "outputLabel":3, + "interface":"r4-eth0", + "nexthop":"10.0.4.2" + } + ] } ] }, @@ -36,25 +37,29 @@ "prefix":"10.0.255.4\/32", "sid":400, "inputLabel":10400, - "outputLabel":"pop", - "interface":"lo", - "nexthop":"10.0.255.4" + "prefixRoute":[ + { + "outputLabel":3, + "interface":"lo", + "nexthop":"10.0.255.4" + } + ] } ], "extendedLink":[ { "prefix":"10.0.4.1\/32", - "sid":50001, - "inputLabel":50001, - "outputLabel":"pop", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, "interface":"r4-eth0", "nexthop":"10.0.4.2" }, { "prefix":"10.0.4.1\/32", - "sid":50000, - "inputLabel":50000, - "outputLabel":"pop", + "sid":"XX", + "inputLabel":"XX", + "outputLabel":3, "interface":"r4-eth0", "nexthop":"10.0.4.2" } @@ -65,19 +70,19 @@ "srgbSize":10000, "srgbLabel":10000, "algorithms":[ - { - "0":"SPF" - } ], - "nodeMsd":8, "extendedPrefix":[ { "prefix":"10.0.255.3\/32", "sid":300, "inputLabel":10300, - "outputLabel":"8300", - "interface":"r4-eth0", - "nexthop":"10.0.4.2" + "prefixRoute":[ + { + "outputLabel":8300, + "interface":"r4-eth0", + "nexthop":"10.0.4.2" + } + ] } ] }, @@ -86,19 +91,19 @@ "srgbSize":10000, "srgbLabel":20000, "algorithms":[ - { - "0":"SPF" - } ], - "nodeMsd":16, "extendedPrefix":[ { "prefix":"10.0.255.1\/32", "sid":100, "inputLabel":10100, - "outputLabel":"8100", - "interface":"r4-eth0", - "nexthop":"10.0.4.2" + "prefixRoute":[ + { + "outputLabel":8100, + "interface":"r4-eth0", + "nexthop":"10.0.4.2" + } + ] } ] } diff --git a/tests/topotests/ospf-sr-topo1/r4/zebra_mpls.json b/tests/topotests/ospf-sr-topo1/r4/zebra_mpls.json index d7f54b224d..3a829fa858 100644 --- a/tests/topotests/ospf-sr-topo1/r4/zebra_mpls.json +++ b/tests/topotests/ospf-sr-topo1/r4/zebra_mpls.json @@ -46,13 +46,12 @@ "type":"SR (OSPF)", "outLabel":3, "distance":150, - "installed":true, - "nexthop":"10.0.255.4" + "installed":true } ] }, - "50000":{ - "inLabel":50000, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { @@ -64,8 +63,8 @@ } ] }, - "50001":{ - "inLabel":50001, + "XX":{ + "inLabel":"XX", "installed":true, "nexthops":[ { diff --git a/tests/topotests/ospf-sr-topo1/test_ospf_sr_topo1.py b/tests/topotests/ospf-sr-topo1/test_ospf_sr_topo1.py index 92cebfe0b6..114de5861b 100755 --- a/tests/topotests/ospf-sr-topo1/test_ospf_sr_topo1.py +++ b/tests/topotests/ospf-sr-topo1/test_ospf_sr_topo1.py @@ -27,6 +27,7 @@ test_ospf_sr_topo1.py: Test the FRR OSPF routing daemon with Segment Routing. """ import os +import re import sys from functools import partial @@ -62,20 +63,23 @@ class OspfSrTopo(Topo): for routern in range(1, 5): tgen.add_router("r{}".format(routern)) - # Interconect router 1 and 2 - switch = tgen.add_switch("s1") - switch.add_link(tgen.gears["r1"]) - switch.add_link(tgen.gears["r2"]) + # Interconect router 1 and 2 with 2 links + switch = tgen.add_switch('s1') + switch.add_link(tgen.gears['r1']) + 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 - switch = tgen.add_switch("s2") - switch.add_link(tgen.gears["r3"]) - switch.add_link(tgen.gears["r2"]) + switch = tgen.add_switch('s3') + switch.add_link(tgen.gears['r3']) + switch.add_link(tgen.gears['r2']) # Interconect router 4 and 2 - switch = tgen.add_switch("s3") - switch.add_link(tgen.gears["r4"]) - switch.add_link(tgen.gears["r2"]) + switch = tgen.add_switch('s4') + switch.add_link(tgen.gears['r4']) + switch.add_link(tgen.gears['r2']) def setup_module(mod): @@ -130,6 +134,9 @@ def compare_ospf_srdb(rname, expected): """ tgen = get_topogen() 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( current, expected, title1="Current output", title2="Expected output" ) @@ -142,6 +149,9 @@ def compare_mpls_table(rname, expected): """ tgen = get_topogen() 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( current, expected, title1="Current output", title2="Expected output" ) -- 2.39.5