]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: add isis_sr_flex_algo_topo2 for flex-algo
authorHiroki Shirokura <hiroki.shirokura@linecorp.com>
Sun, 21 Nov 2021 10:07:32 +0000 (10:07 +0000)
committerLouis Scalbert <louis.scalbert@6wind.com>
Tue, 18 Apr 2023 09:33:15 +0000 (11:33 +0200)
Add a topotest with 9 flex-algo routers to check each router's MPLS
table.

Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
37 files changed:
tests/topotests/isis_sr_flex_algo_topo2/README.md [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/configure-te.sh [new file with mode: 0755]
tests/topotests/isis_sr_flex_algo_topo2/rt0/bgpd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt0/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt0/pathd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt0/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt0/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt1/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt1/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt1/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt2/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt2/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt2/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt3/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt3/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt3/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt4/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt4/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt4/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt5/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt5/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt5/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt6/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt6/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt6/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt7/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt7/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt7/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt8/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt8/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt8/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt9/bgpd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt9/isisd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt9/pathd.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt9/step1/route.json [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/rt9/zebra.conf [new file with mode: 0644]
tests/topotests/isis_sr_flex_algo_topo2/test_isis_sr_flex_algo_topo2.py [new file with mode: 0755]

diff --git a/tests/topotests/isis_sr_flex_algo_topo2/README.md b/tests/topotests/isis_sr_flex_algo_topo2/README.md
new file mode 100644 (file)
index 0000000..20282c4
--- /dev/null
@@ -0,0 +1,8 @@
+
+## test
+
+```
+fdk-enter rt9.pid iperf3 -s
+fdk-enter rt0.pid iperf3 -B 111.111.111.111 -c 222.222.222.222 -P20 -t 100000
+fdk-enter rt0.pid watch -n0.1 ip -s link show
+```
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/configure-te.sh b/tests/topotests/isis_sr_flex_algo_topo2/configure-te.sh
new file mode 100755 (executable)
index 0000000..527f05b
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+       echo "invalid command syntax" 1>&2
+       echo "Usage: $0 <0|128|129|130>" 1>&2
+       exit 1
+fi
+
+case "$1" in
+  0   ) echo ;;
+  128 ) echo ;;
+  129 ) echo ;;
+  130 ) echo ;;
+  *   )   echo "error" ; exit ;;
+esac
+
+R0=$(cat /tmp/topotests/isis_sr_flex_algo_topo2.test_isis_sr_flex_algo_topo2/rt0.pid)
+R9=$(cat /tmp/topotests/isis_sr_flex_algo_topo2.test_isis_sr_flex_algo_topo2/rt9.pid)
+
+set -x
+
+cat <<EOF | nsenter -a -t $R0 vtysh
+conf te
+segment-routing
+ traffic-eng
+  policy color 1 endpoint 9.9.9.9
+   name sid-algorithm
+   binding-sid 111
+   candidate-path preference 100 name sid-algorithm explicit segment-list sid-algorithm-$1
+  exit
+ exit
+exit
+EOF
+
+cat <<EOF | nsenter -a -t $R9 vtysh
+conf te
+segment-routing
+ traffic-eng
+  policy color 1 endpoint 10.10.10.10
+   name sid-algorithm
+   binding-sid 222
+   candidate-path preference 100 name sid-algorithm explicit segment-list sid-algorithm-$1
+  exit
+ exit
+exit
+EOF
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt0/bgpd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt0/bgpd.conf
new file mode 100644 (file)
index 0000000..3915bec
--- /dev/null
@@ -0,0 +1,17 @@
+!
+router bgp 1
+ bgp router-id 10.10.10.10
+ no bgp network import-check
+ neighbor 9.9.9.9 remote-as 1
+ neighbor 9.9.9.9 update-source 10.10.10.10
+ !
+ address-family ipv4 unicast
+  network 10.255.0.0/24
+  neighbor 9.9.9.9 next-hop-self
+  neighbor 9.9.9.9 route-map sr-te in
+ exit-address-family
+!
+route-map sr-te permit 10
+ set sr-te color 1
+exit
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt0/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt0/isisd.conf
new file mode 100644 (file)
index 0000000..cbf2550
--- /dev/null
@@ -0,0 +1,56 @@
+password 1
+hostname rt0
+log file isisd.log
+!
+!debug isis events
+!debug isis spf-events
+!debug isis route-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt1
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt5
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1000.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 128
+  dataplane sr-mpls
+  advertise-definition
+ !
+ flex-algo 129
+  dataplane sr-mpls
+  advertise-definition
+ !
+ flex-algo 130
+  dataplane sr-mpls
+  advertise-definition
+  affinity include-any blue
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 10.10.10.10/32 index 0
+ segment-routing prefix 10.10.10.10/32 algorithm 128 index 100
+ segment-routing prefix 10.10.10.10/32 algorithm 129 index 200
+ segment-routing prefix 10.10.10.10/32 algorithm 130 index 300
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt0/pathd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt0/pathd.conf
new file mode 100644 (file)
index 0000000..c51b4e0
--- /dev/null
@@ -0,0 +1,20 @@
+log file pathd.log
+!
+hostname rt0
+!
+segment-routing
+ traffic-eng
+  segment-list sid-algorithm-0
+   index 10 mpls label 20009
+  exit
+  segment-list sid-algorithm-128
+   index 10 mpls label 20109
+  exit
+  segment-list sid-algorithm-129
+   index 10 mpls label 20209
+  exit
+  segment-list sid-algorithm-130
+   index 10 mpls label 20309
+  exit
+ exit
+exit
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt0/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt0/step1/route.json
new file mode 100644 (file)
index 0000000..51a1c25
--- /dev/null
@@ -0,0 +1,438 @@
+{
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20101":{
+    "inLabel":20101,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20102":{
+    "inLabel":20102,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20102,
+        "outLabelStack":[
+          20102
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20103":{
+    "inLabel":20103,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20103,
+        "outLabelStack":[
+          20103
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20104":{
+    "inLabel":20104,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20104,
+        "outLabelStack":[
+          20104
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20109":{
+    "inLabel":20109,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20109,
+        "outLabelStack":[
+          20109
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20205":{
+    "inLabel":20205,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20206":{
+    "inLabel":20206,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20206,
+        "outLabelStack":[
+          20206
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20207":{
+    "inLabel":20207,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20207,
+        "outLabelStack":[
+          20207
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20208":{
+    "inLabel":20208,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20208,
+        "outLabelStack":[
+          20208
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20209":{
+    "inLabel":20209,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20209,
+        "outLabelStack":[
+          20209
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20301":{
+    "inLabel":20301,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20302":{
+    "inLabel":20302,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20302,
+        "outLabelStack":[
+          20302
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20303":{
+    "inLabel":20303,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20303,
+        "outLabelStack":[
+          20303
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  },
+  "20305":{
+    "inLabel":20305,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20306":{
+    "inLabel":20306,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20306,
+        "outLabelStack":[
+          20306
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20307":{
+    "inLabel":20307,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20307,
+        "outLabelStack":[
+          20307
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      }
+    ]
+  },
+  "20309":{
+    "inLabel":20309,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20309,
+        "outLabelStack":[
+          20309
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20309,
+        "outLabelStack":[
+          20309
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.1"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt0/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt0/zebra.conf
new file mode 100644 (file)
index 0000000..89837d4
--- /dev/null
@@ -0,0 +1,34 @@
+log file zebra.log
+!
+hostname rt0
+!
+!log stdout notifications
+!log monitor notifications
+!log commands
+!
+debug zebra packet
+debug zebra dplane
+debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 10.10.10.10/32
+!
+interface eth-rt1
+ ip address 10.1.0.10/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt5
+ ip address 10.5.0.10/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt1/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt1/isisd.conf
new file mode 100644 (file)
index 0000000..b6bba0c
--- /dev/null
@@ -0,0 +1,60 @@
+password 1
+hostname rt1
+log file isisd.log
+!
+!debug isis events
+!debug isis spf-events
+!debug isis route-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt0
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt2
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt4
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt5
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1001.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 128
+  dataplane sr-mpls
+ flex-algo 130
+  dataplane sr-mpls
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 1.1.1.1/32 index 1
+ segment-routing prefix 1.1.1.1/32 algorithm 128 index 101
+ segment-routing prefix 1.1.1.1/32 algorithm 129 index 201
+ segment-routing prefix 1.1.1.1/32 algorithm 130 index 301
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt1/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt1/step1/route.json
new file mode 100644 (file)
index 0000000..5006625
--- /dev/null
@@ -0,0 +1,428 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.10"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.4"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.15.0.5"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.15.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.15.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.15.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.4"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20100":{
+    "inLabel":20100,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.10"
+      }
+    ]
+  },
+  "20102":{
+    "inLabel":20102,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20103":{
+    "inLabel":20103,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20103,
+        "outLabelStack":[
+          20103
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20103,
+        "outLabelStack":[
+          20103
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20104":{
+    "inLabel":20104,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.4"
+      }
+    ]
+  },
+  "20109":{
+    "inLabel":20109,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20109,
+        "outLabelStack":[
+          20109
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20109,
+        "outLabelStack":[
+          20109
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20300":{
+    "inLabel":20300,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.10"
+      }
+    ]
+  },
+  "20302":{
+    "inLabel":20302,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20303":{
+    "inLabel":20303,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20303,
+        "outLabelStack":[
+          20303
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  },
+  "20305":{
+    "inLabel":20305,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20305,
+        "outLabelStack":[
+          20305
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.10"
+      }
+    ]
+  },
+  "20306":{
+    "inLabel":20306,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20306,
+        "outLabelStack":[
+          20306
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.10"
+      }
+    ]
+  },
+  "20307":{
+    "inLabel":20307,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20307,
+        "outLabelStack":[
+          20307
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20307,
+        "outLabelStack":[
+          20307
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.1.0.10"
+      }
+    ]
+  },
+  "20309":{
+    "inLabel":20309,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20309,
+        "outLabelStack":[
+          20309
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.2"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt1/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt1/zebra.conf
new file mode 100644 (file)
index 0000000..25a9629
--- /dev/null
@@ -0,0 +1,40 @@
+log file zebra.log
+!
+hostname rt1
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 1.1.1.1/32
+!
+interface eth-rt0
+ ip address 10.1.0.1/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt2
+ ip address 10.12.0.1/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt4
+ ip address 10.14.0.1/24
+!
+interface eth-rt5
+ ip address 10.15.0.1/24
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt2/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt2/isisd.conf
new file mode 100644 (file)
index 0000000..f051a68
--- /dev/null
@@ -0,0 +1,54 @@
+password 1
+hostname rt2
+log file isisd.log
+!
+!debug isis events
+!debug isis route-events
+!debug isis spf-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt1
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt3
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt6
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1002.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 128
+  dataplane sr-mpls
+ flex-algo 130
+  dataplane sr-mpls
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 2.2.2.2/32 index 2
+ segment-routing prefix 2.2.2.2/32 algorithm 128 index 102
+ segment-routing prefix 2.2.2.2/32 algorithm 129 index 202
+ segment-routing prefix 2.2.2.2/32 algorithm 130 index 302
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt2/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt2/step1/route.json
new file mode 100644 (file)
index 0000000..679b41d
--- /dev/null
@@ -0,0 +1,408 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.26.0.6"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.26.0.6"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.26.0.6"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.26.0.6"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      }
+    ]
+  },
+  "20100":{
+    "inLabel":20100,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20100,
+        "outLabelStack":[
+          20100
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20101":{
+    "inLabel":20101,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20103":{
+    "inLabel":20103,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      }
+    ]
+  },
+  "20104":{
+    "inLabel":20104,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20104,
+        "outLabelStack":[
+          20104
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20104,
+        "outLabelStack":[
+          20104
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20109":{
+    "inLabel":20109,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20109,
+        "outLabelStack":[
+          20109
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      }
+    ]
+  },
+  "20300":{
+    "inLabel":20300,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20300,
+        "outLabelStack":[
+          20300
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20301":{
+    "inLabel":20301,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20303":{
+    "inLabel":20303,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      }
+    ]
+  },
+  "20305":{
+    "inLabel":20305,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20305,
+        "outLabelStack":[
+          20305
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20306":{
+    "inLabel":20306,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20306,
+        "outLabelStack":[
+          20306
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20306,
+        "outLabelStack":[
+          20306
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.12.0.1"
+      }
+    ]
+  },
+  "20307":{
+    "inLabel":20307,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20307,
+        "outLabelStack":[
+          20307
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      }
+    ]
+  },
+  "20309":{
+    "inLabel":20309,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20309,
+        "outLabelStack":[
+          20309
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.3"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt2/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt2/zebra.conf
new file mode 100644 (file)
index 0000000..d739a73
--- /dev/null
@@ -0,0 +1,37 @@
+log file zebra.log
+!
+hostname rt2
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 2.2.2.2/32
+!
+interface eth-rt1
+ ip address 10.12.0.2/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt3
+ ip address 10.23.0.2/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt6
+ ip address 10.26.0.2/24
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt3/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt3/isisd.conf
new file mode 100644 (file)
index 0000000..644e656
--- /dev/null
@@ -0,0 +1,60 @@
+password 1
+hostname rt3
+log file isisd.log
+!
+!debug isis events
+!debug isis route-events
+!debug isis spf-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt2
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt4
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt7
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt9
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1003.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 128
+  dataplane sr-mpls
+ flex-algo 130
+  dataplane sr-mpls
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 3.3.3.3/32 index 3
+ segment-routing prefix 3.3.3.3/32 algorithm 128 index 103
+ segment-routing prefix 3.3.3.3/32 algorithm 129 index 203
+ segment-routing prefix 3.3.3.3/32 algorithm 130 index 303
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt3/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt3/step1/route.json
new file mode 100644 (file)
index 0000000..f930faa
--- /dev/null
@@ -0,0 +1,428 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.4"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.37.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.37.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.37.0.7"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.37.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.4"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.9"
+      }
+    ]
+  },
+  "20100":{
+    "inLabel":20100,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20100,
+        "outLabelStack":[
+          20100
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20100,
+        "outLabelStack":[
+          20100
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20101":{
+    "inLabel":20101,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20101,
+        "outLabelStack":[
+          20101
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.4"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20101,
+        "outLabelStack":[
+          20101
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20102":{
+    "inLabel":20102,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20104":{
+    "inLabel":20104,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.4"
+      }
+    ]
+  },
+  "20109":{
+    "inLabel":20109,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.9"
+      }
+    ]
+  },
+  "20300":{
+    "inLabel":20300,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20300,
+        "outLabelStack":[
+          20300
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20301":{
+    "inLabel":20301,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20301,
+        "outLabelStack":[
+          20301
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20302":{
+    "inLabel":20302,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20305":{
+    "inLabel":20305,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20305,
+        "outLabelStack":[
+          20305
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.9"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20305,
+        "outLabelStack":[
+          20305
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.23.0.2"
+      }
+    ]
+  },
+  "20306":{
+    "inLabel":20306,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20306,
+        "outLabelStack":[
+          20306
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.9"
+      }
+    ]
+  },
+  "20307":{
+    "inLabel":20307,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20307,
+        "outLabelStack":[
+          20307
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.9"
+      }
+    ]
+  },
+  "20309":{
+    "inLabel":20309,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.9"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt3/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt3/zebra.conf
new file mode 100644 (file)
index 0000000..5c3bed0
--- /dev/null
@@ -0,0 +1,40 @@
+log file zebra.log
+!
+hostname rt3
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 3.3.3.3/32
+!
+interface eth-rt2
+ ip address 10.23.0.3/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt4
+ ip address 10.34.0.3/24
+!
+interface eth-rt7
+ ip address 10.37.0.3/24
+!
+interface eth-rt9
+ ip address 10.39.0.3/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt4/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt4/isisd.conf
new file mode 100644 (file)
index 0000000..1ab200f
--- /dev/null
@@ -0,0 +1,52 @@
+password 1
+hostname rt4
+log file isisd.log
+!
+!debug isis events
+!debug isis spf-events
+!debug isis route-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt1
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt3
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt8
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1004.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 128
+  dataplane sr-mpls
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 4.4.4.4/32 index 4
+ segment-routing prefix 4.4.4.4/32 algorithm 128 index 104
+ segment-routing prefix 4.4.4.4/32 algorithm 129 index 204
+ segment-routing prefix 4.4.4.4/32 algorithm 130 index 304
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt4/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt4/step1/route.json
new file mode 100644 (file)
index 0000000..141e40d
--- /dev/null
@@ -0,0 +1,286 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.1"
+      }
+    ]
+  },
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.1"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.3"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.1"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.3"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.48.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.1"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.48.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.3"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.1"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.48.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.3"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.48.0.8"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.3"
+      }
+    ]
+  },
+  "20100":{
+    "inLabel":20100,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20100,
+        "outLabelStack":[
+          20100
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.1"
+      }
+    ]
+  },
+  "20101":{
+    "inLabel":20101,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.1"
+      }
+    ]
+  },
+  "20102":{
+    "inLabel":20102,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20102,
+        "outLabelStack":[
+          20102
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.3"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20102,
+        "outLabelStack":[
+          20102
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.14.0.1"
+      }
+    ]
+  },
+  "20103":{
+    "inLabel":20103,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.3"
+      }
+    ]
+  },
+  "20109":{
+    "inLabel":20109,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20109,
+        "outLabelStack":[
+          20109
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.34.0.3"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt4/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt4/zebra.conf
new file mode 100644 (file)
index 0000000..9c00013
--- /dev/null
@@ -0,0 +1,31 @@
+log file zebra.log
+!
+hostname rt4
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 4.4.4.4/32
+!
+interface eth-rt1
+ ip address 10.14.0.4/24
+!
+interface eth-rt3
+ ip address 10.34.0.4/24
+!
+interface eth-rt8
+ ip address 10.48.0.4/24
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt5/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt5/isisd.conf
new file mode 100644 (file)
index 0000000..54cc377
--- /dev/null
@@ -0,0 +1,60 @@
+password 1
+hostname rt5
+log file isisd.log
+!
+!debug isis events
+!debug isis spf-events
+!debug isis route-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt0
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt1
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt6
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt8
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1005.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 129
+  dataplane sr-mpls
+ flex-algo 130
+  dataplane sr-mpls
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 5.5.5.5/32 index 5
+ segment-routing prefix 5.5.5.5/32 algorithm 128 index 105
+ segment-routing prefix 5.5.5.5/32 algorithm 129 index 205
+ segment-routing prefix 5.5.5.5/32 algorithm 130 index 305
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt5/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt5/step1/route.json
new file mode 100644 (file)
index 0000000..82ebfc0
--- /dev/null
@@ -0,0 +1,428 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.10"
+      }
+    ]
+  },
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.15.0.1"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.15.0.1"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.15.0.1"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.15.0.1"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20007,
+        "outLabelStack":[
+          20007
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.8"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  },
+  "20200":{
+    "inLabel":20200,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.10"
+      }
+    ]
+  },
+  "20206":{
+    "inLabel":20206,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  },
+  "20207":{
+    "inLabel":20207,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20207,
+        "outLabelStack":[
+          20207
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20207,
+        "outLabelStack":[
+          20207
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  },
+  "20208":{
+    "inLabel":20208,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.8"
+      }
+    ]
+  },
+  "20209":{
+    "inLabel":20209,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20209,
+        "outLabelStack":[
+          20209
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20209,
+        "outLabelStack":[
+          20209
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  },
+  "20300":{
+    "inLabel":20300,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.10"
+      }
+    ]
+  },
+  "20301":{
+    "inLabel":20301,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20301,
+        "outLabelStack":[
+          20301
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.10"
+      }
+    ]
+  },
+  "20302":{
+    "inLabel":20302,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20302,
+        "outLabelStack":[
+          20302
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.10"
+      }
+    ]
+  },
+  "20303":{
+    "inLabel":20303,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20303,
+        "outLabelStack":[
+          20303
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20303,
+        "outLabelStack":[
+          20303
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.5.0.10"
+      }
+    ]
+  },
+  "20306":{
+    "inLabel":20306,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  },
+  "20307":{
+    "inLabel":20307,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20307,
+        "outLabelStack":[
+          20307
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  },
+  "20309":{
+    "inLabel":20309,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20309,
+        "outLabelStack":[
+          20309
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.6"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt5/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt5/zebra.conf
new file mode 100644 (file)
index 0000000..61c599d
--- /dev/null
@@ -0,0 +1,40 @@
+log file zebra.log
+!
+hostname rt5
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 5.5.5.5/32
+!
+interface eth-rt0
+ ip address 10.5.0.5/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt1
+ ip address 10.15.0.5/24
+!
+interface eth-rt6
+ ip address 10.56.0.5/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt8
+ ip address 10.58.0.5/24
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt6/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt6/isisd.conf
new file mode 100644 (file)
index 0000000..fc8660c
--- /dev/null
@@ -0,0 +1,54 @@
+password 1
+hostname rt6
+log file isisd.log
+!
+!debug isis events
+!debug isis spf-events
+!debug isis route-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt2
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt5
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt7
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1006.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 129
+  dataplane sr-mpls
+ flex-algo 130
+  dataplane sr-mpls
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 6.6.6.6/32 index 6
+ segment-routing prefix 6.6.6.6/32 algorithm 128 index 106
+ segment-routing prefix 6.6.6.6/32 algorithm 129 index 206
+ segment-routing prefix 6.6.6.6/32 algorithm 130 index 306
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt6/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt6/step1/route.json
new file mode 100644 (file)
index 0000000..2cc7277
--- /dev/null
@@ -0,0 +1,408 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.26.0.2"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.26.0.2"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.26.0.2"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.26.0.2"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      }
+    ]
+  },
+  "20200":{
+    "inLabel":20200,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20200,
+        "outLabelStack":[
+          20200
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20205":{
+    "inLabel":20205,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20207":{
+    "inLabel":20207,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      }
+    ]
+  },
+  "20208":{
+    "inLabel":20208,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20208,
+        "outLabelStack":[
+          20208
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20208,
+        "outLabelStack":[
+          20208
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20209":{
+    "inLabel":20209,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20209,
+        "outLabelStack":[
+          20209
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      }
+    ]
+  },
+  "20300":{
+    "inLabel":20300,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20300,
+        "outLabelStack":[
+          20300
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20301":{
+    "inLabel":20301,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20301,
+        "outLabelStack":[
+          20301
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20302":{
+    "inLabel":20302,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20302,
+        "outLabelStack":[
+          20302
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20302,
+        "outLabelStack":[
+          20302
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20303":{
+    "inLabel":20303,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20303,
+        "outLabelStack":[
+          20303
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      }
+    ]
+  },
+  "20305":{
+    "inLabel":20305,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.56.0.5"
+      }
+    ]
+  },
+  "20307":{
+    "inLabel":20307,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      }
+    ]
+  },
+  "20309":{
+    "inLabel":20309,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20309,
+        "outLabelStack":[
+          20309
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.7"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt6/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt6/zebra.conf
new file mode 100644 (file)
index 0000000..b63401e
--- /dev/null
@@ -0,0 +1,37 @@
+log file zebra.log
+!
+hostname rt6
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 6.6.6.6/32
+!
+interface eth-rt2
+ ip address 10.26.0.6/24
+!
+interface eth-rt5
+ ip address 10.56.0.6/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt7
+ ip address 10.67.0.6/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt7/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt7/isisd.conf
new file mode 100644 (file)
index 0000000..10dc981
--- /dev/null
@@ -0,0 +1,60 @@
+password 1
+hostname rt7
+log file isisd.log
+!
+!debug isis events
+!debug isis spf-events
+!debug isis route-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt3
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt6
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt8
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt9
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1007.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 129
+  dataplane sr-mpls
+ flex-algo 130
+  dataplane sr-mpls
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 7.7.7.7/32 index 7
+ segment-routing prefix 7.7.7.7/32 algorithm 128 index 107
+ segment-routing prefix 7.7.7.7/32 algorithm 129 index 207
+ segment-routing prefix 7.7.7.7/32 algorithm 130 index 307
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt7/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt7/step1/route.json
new file mode 100644 (file)
index 0000000..aeaa604
--- /dev/null
@@ -0,0 +1,428 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.37.0.3"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.37.0.3"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.37.0.3"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.37.0.3"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.8"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.9"
+      }
+    ]
+  },
+  "20200":{
+    "inLabel":20200,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20200,
+        "outLabelStack":[
+          20200
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20200,
+        "outLabelStack":[
+          20200
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20205":{
+    "inLabel":20205,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20205,
+        "outLabelStack":[
+          20205
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.8"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20205,
+        "outLabelStack":[
+          20205
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20206":{
+    "inLabel":20206,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20208":{
+    "inLabel":20208,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.8"
+      }
+    ]
+  },
+  "20209":{
+    "inLabel":20209,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.9"
+      }
+    ]
+  },
+  "20300":{
+    "inLabel":20300,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20300,
+        "outLabelStack":[
+          20300
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20301":{
+    "inLabel":20301,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20301,
+        "outLabelStack":[
+          20301
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.9"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20301,
+        "outLabelStack":[
+          20301
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20302":{
+    "inLabel":20302,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20302,
+        "outLabelStack":[
+          20302
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.9"
+      }
+    ]
+  },
+  "20303":{
+    "inLabel":20303,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20303,
+        "outLabelStack":[
+          20303
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.9"
+      }
+    ]
+  },
+  "20305":{
+    "inLabel":20305,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20305,
+        "outLabelStack":[
+          20305
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20306":{
+    "inLabel":20306,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.67.0.6"
+      }
+    ]
+  },
+  "20309":{
+    "inLabel":20309,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.9"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt7/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt7/zebra.conf
new file mode 100644 (file)
index 0000000..b5a28c7
--- /dev/null
@@ -0,0 +1,40 @@
+log file zebra.log
+!
+hostname rt7
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 7.7.7.7/32
+!
+interface eth-rt3
+ ip address 10.37.0.7/24
+!
+interface eth-rt6
+ ip address 10.67.0.7/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt8
+ ip address 10.78.0.7/24
+!
+interface eth-rt9
+ ip address 10.79.0.7/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt8/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt8/isisd.conf
new file mode 100644 (file)
index 0000000..4ca45a8
--- /dev/null
@@ -0,0 +1,50 @@
+password 1
+hostname rt8
+log file isisd.log
+!
+!debug isis events
+!debug isis spf-events
+!debug isis route-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt4
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt5
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt7
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1008.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 129
+  dataplane sr-mpls
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 8.8.8.8/32 index 8
+ segment-routing prefix 8.8.8.8/32 algorithm 128 index 108
+ segment-routing prefix 8.8.8.8/32 algorithm 129 index 208
+ segment-routing prefix 8.8.8.8/32 algorithm 130 index 308
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt8/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt8/step1/route.json
new file mode 100644 (file)
index 0000000..27470b7
--- /dev/null
@@ -0,0 +1,286 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.5"
+      }
+    ]
+  },
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.48.0.4"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.5"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.48.0.4"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20003,
+        "outLabelStack":[
+          20003
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.48.0.4"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.48.0.4"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.5"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.5"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.7"
+      }
+    ]
+  },
+  "20009":{
+    "inLabel":20009,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20009,
+        "outLabelStack":[
+          20009
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.7"
+      }
+    ]
+  },
+  "20200":{
+    "inLabel":20200,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20200,
+        "outLabelStack":[
+          20200
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.5"
+      }
+    ]
+  },
+  "20205":{
+    "inLabel":20205,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.5"
+      }
+    ]
+  },
+  "20206":{
+    "inLabel":20206,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20206,
+        "outLabelStack":[
+          20206
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20206,
+        "outLabelStack":[
+          20206
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.58.0.5"
+      }
+    ]
+  },
+  "20207":{
+    "inLabel":20207,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.7"
+      }
+    ]
+  },
+  "20209":{
+    "inLabel":20209,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20209,
+        "outLabelStack":[
+          20209
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.78.0.7"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt8/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt8/zebra.conf
new file mode 100644 (file)
index 0000000..dd63f8c
--- /dev/null
@@ -0,0 +1,29 @@
+log file zebra.log
+!
+hostname rt8
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+interface lo
+ ip address 8.8.8.8/32
+!
+interface eth-rt4
+ ip address 10.48.0.8/24
+!
+interface eth-rt5
+ ip address 10.58.0.8/24
+!
+interface eth-rt7
+ ip address 10.78.0.8/24
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt9/bgpd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt9/bgpd.conf
new file mode 100644 (file)
index 0000000..386d811
--- /dev/null
@@ -0,0 +1,17 @@
+!
+router bgp 1
+ bgp router-id 9.9.9.9
+ no bgp network import-check
+ neighbor 10.10.10.10 remote-as 1
+ neighbor 10.10.10.10 update-source 9.9.9.9
+ !
+ address-family ipv4 unicast
+  network 10.255.9.0/24
+  neighbor 10.10.10.10 next-hop-self
+  neighbor 10.10.10.10 route-map sr-te in
+ exit-address-family
+!
+route-map sr-te permit 10
+ set sr-te color 1
+exit
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt9/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt9/isisd.conf
new file mode 100644 (file)
index 0000000..89eab27
--- /dev/null
@@ -0,0 +1,56 @@
+password 1
+hostname rt9
+log file isisd.log
+!
+!debug isis events
+!debug isis spf-events
+!debug isis route-events
+!debug isis sr-events
+!debug isis lsp-gen
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface eth-rt3
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+interface eth-rt7
+ ip router isis 1
+ isis hello-multiplier 3
+ isis network point-to-point
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 49.0000.0000.0000.1009.00
+ is-type level-1
+ topology ipv6-unicast
+ mpls-te on
+ !
+ flex-algo 128
+  dataplane sr-mpls
+  advertise-definition
+ !
+ flex-algo 129
+  dataplane sr-mpls
+  advertise-definition
+ !
+ flex-algo 130
+  dataplane sr-mpls
+  advertise-definition
+  affinity include-any blue
+ !
+ segment-routing on
+ segment-routing global-block 20000 23999
+ segment-routing node-msd 8
+ segment-routing prefix 9.9.9.9/32 index 9
+ segment-routing prefix 9.9.9.9/32 algorithm 128 index 109
+ segment-routing prefix 9.9.9.9/32 algorithm 129 index 209
+ segment-routing prefix 9.9.9.9/32 algorithm 130 index 309
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt9/pathd.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt9/pathd.conf
new file mode 100644 (file)
index 0000000..3f9a8d9
--- /dev/null
@@ -0,0 +1,20 @@
+log file pathd.log
+!
+hostname rt9
+!
+segment-routing
+ traffic-eng
+  segment-list sid-algorithm-0
+   index 10 mpls label 20000
+  exit
+  segment-list sid-algorithm-128
+   index 10 mpls label 20100
+  exit
+  segment-list sid-algorithm-129
+   index 10 mpls label 20200
+  exit
+  segment-list sid-algorithm-130
+   index 10 mpls label 20300
+  exit
+ exit
+exit
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt9/step1/route.json b/tests/topotests/isis_sr_flex_algo_topo2/rt9/step1/route.json
new file mode 100644 (file)
index 0000000..e98680c
--- /dev/null
@@ -0,0 +1,438 @@
+{
+  "20000":{
+    "inLabel":20000,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20000,
+        "outLabelStack":[
+          20000
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20001":{
+    "inLabel":20001,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20001,
+        "outLabelStack":[
+          20001
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20002":{
+    "inLabel":20002,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20002,
+        "outLabelStack":[
+          20002
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20003":{
+    "inLabel":20003,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20004":{
+    "inLabel":20004,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20004,
+        "outLabelStack":[
+          20004
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20005":{
+    "inLabel":20005,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20005,
+        "outLabelStack":[
+          20005
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20006":{
+    "inLabel":20006,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20006,
+        "outLabelStack":[
+          20006
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20007":{
+    "inLabel":20007,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20008":{
+    "inLabel":20008,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20008,
+        "outLabelStack":[
+          20008
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20100":{
+    "inLabel":20100,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20100,
+        "outLabelStack":[
+          20100
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20101":{
+    "inLabel":20101,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20101,
+        "outLabelStack":[
+          20101
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20102":{
+    "inLabel":20102,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20102,
+        "outLabelStack":[
+          20102
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20103":{
+    "inLabel":20103,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20104":{
+    "inLabel":20104,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20104,
+        "outLabelStack":[
+          20104
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20200":{
+    "inLabel":20200,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20200,
+        "outLabelStack":[
+          20200
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20205":{
+    "inLabel":20205,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20205,
+        "outLabelStack":[
+          20205
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20206":{
+    "inLabel":20206,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20206,
+        "outLabelStack":[
+          20206
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20207":{
+    "inLabel":20207,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20208":{
+    "inLabel":20208,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20208,
+        "outLabelStack":[
+          20208
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20300":{
+    "inLabel":20300,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20300,
+        "outLabelStack":[
+          20300
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      },
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20300,
+        "outLabelStack":[
+          20300
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20301":{
+    "inLabel":20301,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20301,
+        "outLabelStack":[
+          20301
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20302":{
+    "inLabel":20302,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20302,
+        "outLabelStack":[
+          20302
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20303":{
+    "inLabel":20303,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.39.0.3"
+      }
+    ]
+  },
+  "20305":{
+    "inLabel":20305,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20305,
+        "outLabelStack":[
+          20305
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20306":{
+    "inLabel":20306,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":20306,
+        "outLabelStack":[
+          20306
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  },
+  "20307":{
+    "inLabel":20307,
+    "installed":true,
+    "nexthops":[
+      {
+        "type":"SR (IS-IS)",
+        "outLabel":3,
+        "outLabelStack":[
+          3
+        ],
+        "distance":150,
+        "installed":true,
+        "nexthop":"10.79.0.7"
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/rt9/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo2/rt9/zebra.conf
new file mode 100644 (file)
index 0000000..378a196
--- /dev/null
@@ -0,0 +1,34 @@
+log file zebra.log
+!
+hostname rt9
+!
+log stdout notifications
+log monitor notifications
+log commands
+!
+!debug zebra packet
+!debug zebra dplane
+!debug zebra kernel
+!
+affinity-map blue bit-position 0
+!
+interface lo
+ ip address 9.9.9.9/32
+!
+interface eth-rt3
+ ip address 10.39.0.9/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+interface eth-rt7
+ ip address 10.79.0.9/24
+ link-params
+  affinity blue
+ exit-link-params
+!
+ip forwarding
+ipv6 forwarding
+!
+line vty
+!
diff --git a/tests/topotests/isis_sr_flex_algo_topo2/test_isis_sr_flex_algo_topo2.py b/tests/topotests/isis_sr_flex_algo_topo2/test_isis_sr_flex_algo_topo2.py
new file mode 100755 (executable)
index 0000000..6a5f81d
--- /dev/null
@@ -0,0 +1,187 @@
+#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
+
+#
+# Part of NetDEF Topology Tests
+#
+# Copyright 2021 by LINE Corporation, Hiroki Shirokura <hiroki.shirokura@linecorp.com>
+# Copyright 2023 6WIND S.A.
+
+"""
+test_isis_sr_flex_algo_topo2.py:
+
+[+] Flex-Algos 128
+[+] Flex-Algos 129
+[+] Flex-Algos 130 include-any blue
+
+            +--------+                  +--------+
+            |        |                  |        |
+            |  RT1   |------------------|  RT2   |
+            |        |                  |        |
+            +--------+                  +--------+
+           /     |    \\                     |    \\
+          /      |     \\                    |     \\
++--------+       |      \\                   |      \\
+|        |       |       +--------+          |       +--------+
+|  RT0   |       |       |        |          |       |        |
+|        |       |       |  RT4   |------------------|  RT3   |
++--------+       |       |        |          |       |        |
+          \\     |       +--------+          |       +--------+
+           \\    |           |               |            |    \\
+            +--------+       |          +--------+        |     \\
+            |        |       |          |        |        |      +--------+
+            |  RT5   |-------|----------|  RT6   |        |      |        |
+            |        |       |          |        |        |      |  RT9   |
+            +--------+       |          +--------+        |      |        |
+                      \\     |                    \\      |      +--------+
+                       \\    |                     \\     |     /
+                        \\   |                      \\    |    /
+                         +--------+                  +--------+
+                         |        |                  |        |
+                         |  RT8   |------------------|  RT7   |
+                         |        |                  |        |
+                         +--------+                  +--------+
+"""
+
+import os
+import sys
+import pytest
+import json
+import time
+from functools import partial
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+
+
+pytestmark = [pytest.mark.isisd]
+
+
+def build_topo(tgen):
+    "Build function"
+
+    routers = []
+    for i in range(0, 10):
+        rt = tgen.add_router("rt{}".format(i))
+        rt.run("sysctl -w net.ipv4.fib_multipath_hash_policy=1")
+
+    def connect_routers(tgen, left_idx, right_idx):
+        left = "rt{}".format(left_idx)
+        right = "rt{}".format(right_idx)
+        switch = tgen.add_switch("s-{}-{}".format(left, right))
+        switch.add_link(tgen.gears[left], nodeif="eth-{}".format(right))
+        switch.add_link(tgen.gears[right], nodeif="eth-{}".format(left))
+        l_addr = "52:54:00:{}:{}:{}".format(left_idx, right_idx, left_idx)
+        tgen.gears[left].run("ip link set eth-{} down".format(right))
+        tgen.gears[left].run("ip link set eth-{} address {}".format(right, l_addr))
+        tgen.gears[left].run("ip link set eth-{} up".format(right))
+        tgen.gears[left].run("sysctl -w net.mpls.conf.eth-{}.input=1".format(right))
+        r_addr = "52:54:00:{}:{}:{}".format(left_idx, right_idx, right_idx)
+        tgen.gears[right].run("ip link set eth-{} down".format(left))
+        tgen.gears[right].run("ip link set eth-{} address {}".format(left, r_addr))
+        tgen.gears[right].run("ip link set eth-{} up".format(left))
+        tgen.gears[right].run("sysctl -w net.mpls.conf.eth-{}.input=1".format(left))
+
+    connect_routers(tgen, 0, 1)
+    connect_routers(tgen, 0, 5)
+    connect_routers(tgen, 1, 2)
+    connect_routers(tgen, 1, 4)
+    connect_routers(tgen, 1, 5)
+    connect_routers(tgen, 2, 3)
+    connect_routers(tgen, 2, 6)
+    connect_routers(tgen, 3, 4)
+    connect_routers(tgen, 3, 7)
+    connect_routers(tgen, 3, 9)
+    connect_routers(tgen, 4, 8)
+    connect_routers(tgen, 5, 6)
+    connect_routers(tgen, 5, 8)
+    connect_routers(tgen, 6, 7)
+    connect_routers(tgen, 7, 8)
+    connect_routers(tgen, 7, 9)
+
+
+def setup_module(mod):
+    "Sets up the pytest environment"
+    tgen = Topogen(build_topo, mod.__name__)
+    frrdir = tgen.config.get(tgen.CONFIG_SECTION, "frrdir")
+    if not os.path.isfile(os.path.join(frrdir, "pathd")):
+        pytest.skip("pathd daemon wasn't built")
+    tgen.start_topology()
+    router_list = tgen.routers()
+
+    # For all registered routers, load the zebra configuration file
+    for rname, router in router_list.items():
+        router.load_config( TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)))
+        router.load_config( TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname)))
+        if rname in ["rt0", "rt9"]:
+            router.load_config( TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)))
+            router.load_config( TopoRouter.RD_PATH, os.path.join(CWD, "{}/pathd.conf".format(rname)))
+            router.run("ip link add dum0 type dummy")
+            router.run("ip link set dum0 up")
+            if rname == "rt0":
+                router.run("ip addr add 10.255.0.1/24 dev dum0")
+            elif rname == "rt9":
+                router.run("ip addr add 10.255.9.1/24 dev dum0")
+    tgen.start_router()
+
+
+def teardown_module(mod):
+    "Teardown the pytest environment"
+    tgen = get_topogen()
+    tgen.stop_topology()
+
+
+def setup_testcase(msg):
+    logger.info(msg)
+    tgen = get_topogen()
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+    return tgen
+
+def open_json_file(filename):
+    try:
+        with open(filename, "r") as f:
+            return json.load(f)
+    except IOError:
+        assert False, "Could not read file {}".format(filename)
+
+
+def check_rib(name, cmd, expected_file):
+    def _check(name, cmd, expected_file):
+        logger.info("polling")
+        tgen = get_topogen()
+        router = tgen.gears[name]
+        output = json.loads(router.vtysh_cmd(cmd))
+        expected = open_json_file("{}/{}".format(CWD, expected_file))
+        return topotest.json_cmp(output, expected)
+
+    logger.info("[+] check {} \"{}\" {}".format(name, cmd, expected_file))
+    tgen = get_topogen()
+    func = partial(_check, name, cmd, expected_file)
+    success, result = topotest.run_and_expect(func, None, count=120, wait=0.5)
+    assert result is None, "Failed"
+
+
+def test_rib():
+    check_rib("rt0", "show mpls table json", "rt0/step1/route.json")
+    check_rib("rt1", "show mpls table json", "rt1/step1/route.json")
+    check_rib("rt2", "show mpls table json", "rt2/step1/route.json")
+    check_rib("rt3", "show mpls table json", "rt3/step1/route.json")
+    check_rib("rt4", "show mpls table json", "rt4/step1/route.json")
+    check_rib("rt5", "show mpls table json", "rt5/step1/route.json")
+    check_rib("rt6", "show mpls table json", "rt6/step1/route.json")
+    check_rib("rt7", "show mpls table json", "rt7/step1/route.json")
+    check_rib("rt8", "show mpls table json", "rt8/step1/route.json")
+    check_rib("rt9", "show mpls table json", "rt9/step1/route.json")
+
+
+if __name__ == "__main__":
+    args = ["-s"] + sys.argv[1:]
+    sys.exit(pytest.main(args))