summaryrefslogtreecommitdiffstats
path: root/tests/topotests/isis_topo1
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/topotests/isis_topo1/__init__.py0
-rw-r--r--tests/topotests/isis_topo1/r1/isisd.conf17
-rw-r--r--tests/topotests/isis_topo1/r1/r1_route.json68
-rw-r--r--tests/topotests/isis_topo1/r1/r1_route6.json66
-rw-r--r--tests/topotests/isis_topo1/r1/r1_route6_linux.json14
-rw-r--r--tests/topotests/isis_topo1/r1/r1_route_linux.json14
-rw-r--r--tests/topotests/isis_topo1/r1/r1_topology.json96
-rw-r--r--tests/topotests/isis_topo1/r1/zebra.conf9
-rw-r--r--tests/topotests/isis_topo1/r2/isisd.conf17
-rw-r--r--tests/topotests/isis_topo1/r2/r2_route.json68
-rw-r--r--tests/topotests/isis_topo1/r2/r2_route6.json66
-rw-r--r--tests/topotests/isis_topo1/r2/r2_route6_linux.json14
-rw-r--r--tests/topotests/isis_topo1/r2/r2_route_linux.json14
-rw-r--r--tests/topotests/isis_topo1/r2/r2_topology.json96
-rw-r--r--tests/topotests/isis_topo1/r2/zebra.conf9
-rw-r--r--tests/topotests/isis_topo1/r3/isisd.conf24
-rw-r--r--tests/topotests/isis_topo1/r3/r3_route.json150
-rw-r--r--tests/topotests/isis_topo1/r3/r3_route6.json132
-rw-r--r--tests/topotests/isis_topo1/r3/r3_route6_linux.json32
-rw-r--r--tests/topotests/isis_topo1/r3/r3_route_linux.json32
-rw-r--r--tests/topotests/isis_topo1/r3/r3_topology.json194
-rw-r--r--tests/topotests/isis_topo1/r3/zebra.conf13
-rw-r--r--tests/topotests/isis_topo1/r4/isisd.conf24
-rw-r--r--tests/topotests/isis_topo1/r4/r4_route.json65
-rw-r--r--tests/topotests/isis_topo1/r4/r4_route6.json131
-rw-r--r--tests/topotests/isis_topo1/r4/r4_route6_linux.json32
-rw-r--r--tests/topotests/isis_topo1/r4/r4_route_linux.json32
-rw-r--r--tests/topotests/isis_topo1/r4/r4_topology.json194
-rw-r--r--tests/topotests/isis_topo1/r4/zebra.conf13
-rw-r--r--tests/topotests/isis_topo1/r5/isisd.conf23
-rw-r--r--tests/topotests/isis_topo1/r5/r5_route.json145
-rw-r--r--tests/topotests/isis_topo1/r5/r5_route6.json115
-rw-r--r--tests/topotests/isis_topo1/r5/r5_route6_linux.json26
-rw-r--r--tests/topotests/isis_topo1/r5/r5_route_linux.json26
-rw-r--r--tests/topotests/isis_topo1/r5/r5_topology.json156
-rw-r--r--tests/topotests/isis_topo1/r5/zebra.conf13
-rw-r--r--tests/topotests/isis_topo1/test_isis_topo1.dot100
-rw-r--r--tests/topotests/isis_topo1/test_isis_topo1.jpgbin0 -> 74340 bytes
-rw-r--r--tests/topotests/isis_topo1/test_isis_topo1.py497
-rw-r--r--tests/topotests/isis_topo1_vrf/__init__.py0
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r1/isisd.conf16
-rw-r--r--tests/topotests/isis_topo1_vrf/r1/r1_route.json37
-rw-r--r--tests/topotests/isis_topo1_vrf/r1/r1_route6.json36
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r1/r1_route6_linux.json14
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r1/r1_route_linux.json13
-rw-r--r--tests/topotests/isis_topo1_vrf/r1/r1_topology.json80
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r1/zebra.conf9
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r2/isisd.conf16
-rw-r--r--tests/topotests/isis_topo1_vrf/r2/r2_route.json37
-rw-r--r--tests/topotests/isis_topo1_vrf/r2/r2_route6.json36
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r2/r2_route6_linux.json14
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r2/r2_route_linux.json13
-rw-r--r--tests/topotests/isis_topo1_vrf/r2/r2_topology.json80
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r2/zebra.conf9
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r3/isisd.conf23
-rw-r--r--tests/topotests/isis_topo1_vrf/r3/r3_route.json86
-rw-r--r--tests/topotests/isis_topo1_vrf/r3/r3_route6.json70
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r3/r3_route6_linux.json26
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r3/r3_route_linux.json24
-rw-r--r--tests/topotests/isis_topo1_vrf/r3/r3_topology.json132
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r3/zebra.conf13
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r4/isisd.conf26
-rw-r--r--tests/topotests/isis_topo1_vrf/r4/r4_route.json81
-rw-r--r--tests/topotests/isis_topo1_vrf/r4/r4_route6.json70
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r4/r4_route6_linux.json26
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r4/r4_route_linux.json24
-rw-r--r--tests/topotests/isis_topo1_vrf/r4/r4_topology.json132
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r4/zebra.conf13
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r5/isisd.conf22
-rw-r--r--tests/topotests/isis_topo1_vrf/r5/r5_route.json94
-rw-r--r--tests/topotests/isis_topo1_vrf/r5/r5_route6.json70
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r5/r5_route6_linux.json26
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r5/r5_route_linux.json24
-rw-r--r--tests/topotests/isis_topo1_vrf/r5/r5_topology.json124
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r5/zebra.conf13
-rwxr-xr-xtests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.dot100
-rwxr-xr-xtests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.jpgbin0 -> 74340 bytes
-rw-r--r--tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py441
78 files changed, 4807 insertions, 0 deletions
diff --git a/tests/topotests/isis_topo1/__init__.py b/tests/topotests/isis_topo1/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/topotests/isis_topo1/__init__.py
diff --git a/tests/topotests/isis_topo1/r1/isisd.conf b/tests/topotests/isis_topo1/r1/isisd.conf
new file mode 100644
index 0000000..9c1bfff
--- /dev/null
+++ b/tests/topotests/isis_topo1/r1/isisd.conf
@@ -0,0 +1,17 @@
+hostname r1
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r1-eth0
+ ip router isis 1
+ isis hello-interval 2
+ ipv6 router isis 1
+ isis circuit-type level-2-only
+!
+router isis 1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0000.00
+ metric-style wide
+ redistribute ipv4 connected level-2
+ redistribute ipv6 connected level-2
+!
diff --git a/tests/topotests/isis_topo1/r1/r1_route.json b/tests/topotests/isis_topo1/r1/r1_route.json
new file mode 100644
index 0000000..f94233a
--- /dev/null
+++ b/tests/topotests/isis_topo1/r1/r1_route.json
@@ -0,0 +1,68 @@
+{
+ "10.0.10.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r1-eth0",
+ "ip": "10.0.20.1"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.0.20.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r1-eth0"
+ }
+ ],
+ "prefix": "10.0.20.0/24",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.254.0.1/32": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "10.254.0.1/32",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.254.0.3/32": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r1-eth0",
+ "ip": "10.0.20.1"
+ }
+ ],
+ "prefix": "10.254.0.3/32",
+ "protocol": "isis",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r1/r1_route6.json b/tests/topotests/isis_topo1/r1/r1_route6.json
new file mode 100644
index 0000000..bd09839
--- /dev/null
+++ b/tests/topotests/isis_topo1/r1/r1_route6.json
@@ -0,0 +1,66 @@
+{
+ "2001:db8:1:1::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r1-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:1::/64",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:2:1::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r1-eth0"
+ }
+ ],
+ "prefix": "2001:db8:2:1::/64",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::1/128": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "2001:db8:f::1/128",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::3/128": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r1-eth0"
+ }
+ ],
+ "prefix": "2001:db8:f::3/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r1/r1_route6_linux.json b/tests/topotests/isis_topo1/r1/r1_route6_linux.json
new file mode 100644
index 0000000..139747c
--- /dev/null
+++ b/tests/topotests/isis_topo1/r1/r1_route6_linux.json
@@ -0,0 +1,14 @@
+{
+ "2001:db8:2:1::/64": {
+ "dev": "r1-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::3": {
+ "dev": "r1-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r1/r1_route_linux.json b/tests/topotests/isis_topo1/r1/r1_route_linux.json
new file mode 100644
index 0000000..6420dec
--- /dev/null
+++ b/tests/topotests/isis_topo1/r1/r1_route_linux.json
@@ -0,0 +1,14 @@
+{
+ "10.0.10.0/24": {
+ "dev": "r1-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.20.1"
+ },
+ "10.254.0.3": {
+ "dev": "r1-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.20.1"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r1/r1_topology.json b/tests/topotests/isis_topo1/r1/r1_topology.json
new file mode 100644
index 0000000..337d6bf
--- /dev/null
+++ b/tests/topotests/isis_topo1/r1/r1_topology.json
@@ -0,0 +1,96 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r1"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r1"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [
+ {
+ "vertex": "r1"
+ },
+ {
+ "metric": "0",
+ "parent": "r1(4)",
+ "type": "IP internal",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r1(4)",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.3/32"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r1"
+ },
+ {
+ "metric": "0",
+ "parent": "r1(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:1::/64"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r1(4)",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "metric": "10",
+ "interface": "r1-eth0",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:1::/64"
+ },
+ {
+ "metric": "10",
+ "interface": "r1-eth0",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::3/128"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1/r1/zebra.conf b/tests/topotests/isis_topo1/r1/zebra.conf
new file mode 100644
index 0000000..23cf625
--- /dev/null
+++ b/tests/topotests/isis_topo1/r1/zebra.conf
@@ -0,0 +1,9 @@
+hostname r1
+interface r1-eth0
+ ip address 10.0.20.2/24
+ ipv6 address 2001:db8:1:1::2/64
+!
+interface lo
+ ip address 10.254.0.1/32
+ ipv6 address 2001:db8:F::1/128
+!
diff --git a/tests/topotests/isis_topo1/r2/isisd.conf b/tests/topotests/isis_topo1/r2/isisd.conf
new file mode 100644
index 0000000..e8b5789
--- /dev/null
+++ b/tests/topotests/isis_topo1/r2/isisd.conf
@@ -0,0 +1,17 @@
+hostname r2
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r2-eth0
+ ip router isis 1
+ isis hello-interval 2
+ ipv6 router isis 1
+ isis circuit-type level-2-only
+!
+router isis 1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0001.00
+ metric-style wide
+ redistribute ipv4 connected level-2
+ redistribute ipv6 connected level-2
+!
diff --git a/tests/topotests/isis_topo1/r2/r2_route.json b/tests/topotests/isis_topo1/r2/r2_route.json
new file mode 100644
index 0000000..aab651e
--- /dev/null
+++ b/tests/topotests/isis_topo1/r2/r2_route.json
@@ -0,0 +1,68 @@
+{
+ "10.0.11.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r2-eth0",
+ "ip": "10.0.21.1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.0.21.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r2-eth0"
+ }
+ ],
+ "prefix": "10.0.21.0/24",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.254.0.2/32": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "10.254.0.2/32",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.254.0.4/32": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r2-eth0",
+ "ip": "10.0.21.1"
+ }
+ ],
+ "prefix": "10.254.0.4/32",
+ "protocol": "isis",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r2/r2_route6.json b/tests/topotests/isis_topo1/r2/r2_route6.json
new file mode 100644
index 0000000..78c31b3
--- /dev/null
+++ b/tests/topotests/isis_topo1/r2/r2_route6.json
@@ -0,0 +1,66 @@
+{
+ "2001:db8:1:2::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r2-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:2::/64",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:2:2::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r2-eth0"
+ }
+ ],
+ "prefix": "2001:db8:2:2::/64",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::2/128": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "2001:db8:f::2/128",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::4/128": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r2-eth0"
+ }
+ ],
+ "prefix": "2001:db8:f::4/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r2/r2_route6_linux.json b/tests/topotests/isis_topo1/r2/r2_route6_linux.json
new file mode 100644
index 0000000..5068861
--- /dev/null
+++ b/tests/topotests/isis_topo1/r2/r2_route6_linux.json
@@ -0,0 +1,14 @@
+{
+ "2001:db8:2:2::/64": {
+ "dev": "r2-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::4": {
+ "dev": "r2-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r2/r2_route_linux.json b/tests/topotests/isis_topo1/r2/r2_route_linux.json
new file mode 100644
index 0000000..dd3035a
--- /dev/null
+++ b/tests/topotests/isis_topo1/r2/r2_route_linux.json
@@ -0,0 +1,14 @@
+{
+ "10.0.11.0/24": {
+ "dev": "r2-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.21.1"
+ },
+ "10.254.0.4": {
+ "dev": "r2-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.21.1"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r2/r2_topology.json b/tests/topotests/isis_topo1/r2/r2_topology.json
new file mode 100644
index 0000000..de90fb5
--- /dev/null
+++ b/tests/topotests/isis_topo1/r2/r2_topology.json
@@ -0,0 +1,96 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r2"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r2"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [
+ {
+ "vertex": "r2"
+ },
+ {
+ "metric": "0",
+ "parent": "r2(4)",
+ "type": "IP internal",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r2(4)",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.4/32"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r2"
+ },
+ {
+ "metric": "0",
+ "parent": "r2(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:2::/64"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r2(4)",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "metric": "10",
+ "interface": "r2-eth0",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:2::/64"
+ },
+ {
+ "metric": "10",
+ "interface": "r2-eth0",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::4/128"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1/r2/zebra.conf b/tests/topotests/isis_topo1/r2/zebra.conf
new file mode 100644
index 0000000..cf6f8f6
--- /dev/null
+++ b/tests/topotests/isis_topo1/r2/zebra.conf
@@ -0,0 +1,9 @@
+hostname r2
+interface r2-eth0
+ ip address 10.0.21.2/24
+ ipv6 address 2001:db8:1:2::2/64
+!
+interface lo
+ ip address 10.254.0.2/32
+ ipv6 address 2001:db8:F::2/128
+!
diff --git a/tests/topotests/isis_topo1/r3/isisd.conf b/tests/topotests/isis_topo1/r3/isisd.conf
new file mode 100644
index 0000000..47bfc53
--- /dev/null
+++ b/tests/topotests/isis_topo1/r3/isisd.conf
@@ -0,0 +1,24 @@
+hostname r3
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r3-eth0
+ ip router isis 1
+ isis hello-interval 2
+ ipv6 router isis 1
+ isis circuit-type level-2-only
+!
+interface r3-eth1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0002.00
+ metric-style wide
+ redistribute ipv4 connected level-1
+ redistribute ipv4 connected level-2
+ redistribute ipv6 connected level-1
+ redistribute ipv6 connected level-2
+!
diff --git a/tests/topotests/isis_topo1/r3/r3_route.json b/tests/topotests/isis_topo1/r3/r3_route.json
new file mode 100644
index 0000000..61d05e8
--- /dev/null
+++ b/tests/topotests/isis_topo1/r3/r3_route.json
@@ -0,0 +1,150 @@
+{
+ "10.0.10.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "afi": "ipv4",
+ "interfaceName": "r3-eth1",
+ "ip": "10.0.10.1"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "isis"
+ },
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.0.11.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r3-eth1",
+ "ip": "10.0.10.1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.0.20.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r3-eth0"
+ }
+ ],
+ "prefix": "10.0.20.0/24",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.0.21.0/24": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r3-eth1",
+ "ip": "10.0.10.1"
+ }
+ ],
+ "prefix": "10.0.21.0/24",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.254.0.1/32": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r3-eth0",
+ "ip": "10.0.20.2"
+ }
+ ],
+ "prefix": "10.254.0.1/32",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.254.0.3/32": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "10.254.0.3/32",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.254.0.4/32": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r3-eth1",
+ "ip": "10.0.10.1"
+ }
+ ],
+ "prefix": "10.254.0.4/32",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.254.0.5/32": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r3-eth1",
+ "ip": "10.0.10.1"
+ }
+ ],
+ "prefix": "10.254.0.5/32",
+ "protocol": "isis",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r3/r3_route6.json b/tests/topotests/isis_topo1/r3/r3_route6.json
new file mode 100644
index 0000000..4104024
--- /dev/null
+++ b/tests/topotests/isis_topo1/r3/r3_route6.json
@@ -0,0 +1,132 @@
+{
+ "2001:db8:1:1::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r3-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:1::/64",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:1:2::/64": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "2001:db8:1:2::/64",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:2:1::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:1::/64",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:2:2::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:2::/64",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::1/128": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r3-eth0"
+ }
+ ],
+ "prefix": "2001:db8:f::1/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::3/128": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "2001:db8:f::3/128",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::4/128": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "2001:db8:f::4/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::5/128": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "2001:db8:f::5/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r3/r3_route6_linux.json b/tests/topotests/isis_topo1/r3/r3_route6_linux.json
new file mode 100644
index 0000000..78993ff
--- /dev/null
+++ b/tests/topotests/isis_topo1/r3/r3_route6_linux.json
@@ -0,0 +1,32 @@
+{
+ "2001:db8:1:2::/64": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:2:2::/64": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::1": {
+ "dev": "r3-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::4": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::5": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r3/r3_route_linux.json b/tests/topotests/isis_topo1/r3/r3_route_linux.json
new file mode 100644
index 0000000..04a2418
--- /dev/null
+++ b/tests/topotests/isis_topo1/r3/r3_route_linux.json
@@ -0,0 +1,32 @@
+{
+ "10.0.11.0/24": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.1"
+ },
+ "10.0.21.0/24": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.1"
+ },
+ "10.254.0.1": {
+ "dev": "r3-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.20.2"
+ },
+ "10.254.0.4": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.1"
+ },
+ "10.254.0.5": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.1"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r3/r3_topology.json b/tests/topotests/isis_topo1/r3/r3_topology.json
new file mode 100644
index 0000000..2d36f9b
--- /dev/null
+++ b/tests/topotests/isis_topo1/r3/r3_topology.json
@@ -0,0 +1,194 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r3"
+ },
+ {
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP internal",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "TE-IS",
+ "vertex": "r5"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.5/32"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.4/32"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r3"
+ },
+ {
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:1::/64"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "TE-IS",
+ "vertex": "r5"
+ },
+ {
+ "metric": "10",
+ "interface": "r3-eth1",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:2::/64"
+ },
+ {
+ "metric": "10",
+ "interface": "r3-eth1",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::5/128"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "metric": "20",
+ "interface": "r3-eth1",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:2::/64"
+ },
+ {
+ "metric": "20",
+ "interface": "r3-eth1",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::4/128"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [
+ {
+ "vertex": "r3"
+ },
+ {
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP internal",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r1",
+ "parent": "r3(4)",
+ "type": "TE-IS",
+ "vertex": "r1"
+ },
+ {
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r1",
+ "parent": "r1(4)",
+ "type": "IP TE",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r1",
+ "parent": "r1(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.1/32"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r3"
+ },
+ {
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:1::/64"
+ },
+ {
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r1",
+ "parent": "r3(4)",
+ "type": "TE-IS",
+ "vertex": "r1"
+ },
+ {
+ "metric": "10",
+ "interface": "r3-eth0",
+ "next-hop": "r1",
+ "parent": "r1(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::1/128"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1/r3/zebra.conf b/tests/topotests/isis_topo1/r3/zebra.conf
new file mode 100644
index 0000000..1e4c0d7
--- /dev/null
+++ b/tests/topotests/isis_topo1/r3/zebra.conf
@@ -0,0 +1,13 @@
+hostname r3
+interface r3-eth0
+ ip address 10.0.20.1/24
+ ipv6 address 2001:db8:1:1::1/64
+!
+interface r3-eth1
+ ip address 10.0.10.2/24
+ ipv6 address 2001:db8:2:1::2/64
+!
+interface lo
+ ip address 10.254.0.3/32
+ ipv6 address 2001:db8:F::3/128
+!
diff --git a/tests/topotests/isis_topo1/r4/isisd.conf b/tests/topotests/isis_topo1/r4/isisd.conf
new file mode 100644
index 0000000..50c876d
--- /dev/null
+++ b/tests/topotests/isis_topo1/r4/isisd.conf
@@ -0,0 +1,24 @@
+hostname r4
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r4-eth0
+ ip router isis 1
+ isis hello-interval 2
+ ipv6 router isis 1
+ isis circuit-type level-2-only
+!
+interface r4-eth1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0004.00
+ metric-style wide
+ redistribute ipv4 connected level-1
+ redistribute ipv4 connected level-2
+ redistribute ipv6 connected level-1
+ redistribute ipv6 connected level-2
+!
diff --git a/tests/topotests/isis_topo1/r4/r4_route.json b/tests/topotests/isis_topo1/r4/r4_route.json
new file mode 100644
index 0000000..79361af
--- /dev/null
+++ b/tests/topotests/isis_topo1/r4/r4_route.json
@@ -0,0 +1,65 @@
+{
+ "10.0.11.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.0.21.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r4-eth0"
+ }
+ ],
+ "prefix": "10.0.21.0/24",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.254.0.2/32": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r4-eth0",
+ "ip": "10.0.21.2"
+ }
+ ],
+ "prefix": "10.254.0.2/32",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.254.0.4/32": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "10.254.0.4/32",
+ "protocol": "connected",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r4/r4_route6.json b/tests/topotests/isis_topo1/r4/r4_route6.json
new file mode 100644
index 0000000..c0ace9a
--- /dev/null
+++ b/tests/topotests/isis_topo1/r4/r4_route6.json
@@ -0,0 +1,131 @@
+{
+ "2001:db8:1:1::/64": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "2001:db8:1:1::/64",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:1:2::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r4-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:2::/64",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:2:1::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:1::/64",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:2:2::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:2::/64",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::2/128": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r4-eth0"
+ }
+ ],
+ "prefix": "2001:db8:f::2/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::3/128": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "2001:db8:f::3/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::4/128": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "2001:db8:f::4/128",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::5/128": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "2001:db8:f::5/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ]}
diff --git a/tests/topotests/isis_topo1/r4/r4_route6_linux.json b/tests/topotests/isis_topo1/r4/r4_route6_linux.json
new file mode 100644
index 0000000..32ea366
--- /dev/null
+++ b/tests/topotests/isis_topo1/r4/r4_route6_linux.json
@@ -0,0 +1,32 @@
+{
+ "2001:db8:1:1::/64": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:2:1::/64": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::2": {
+ "dev": "r4-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::3": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::5": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r4/r4_route_linux.json b/tests/topotests/isis_topo1/r4/r4_route_linux.json
new file mode 100644
index 0000000..5d6553f
--- /dev/null
+++ b/tests/topotests/isis_topo1/r4/r4_route_linux.json
@@ -0,0 +1,32 @@
+{
+ "10.0.10.0/24": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.1"
+ },
+ "10.0.20.0/24": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.1"
+ },
+ "10.254.0.2": {
+ "dev": "r4-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.21.2"
+ },
+ "10.254.0.3": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.1"
+ },
+ "10.254.0.5": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.1"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r4/r4_topology.json b/tests/topotests/isis_topo1/r4/r4_topology.json
new file mode 100644
index 0000000..e7d7841
--- /dev/null
+++ b/tests/topotests/isis_topo1/r4/r4_topology.json
@@ -0,0 +1,194 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r4"
+ },
+ {
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP internal",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "TE-IS",
+ "vertex": "r5"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.5/32"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.3/32"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r4"
+ },
+ {
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:2::/64"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "TE-IS",
+ "vertex": "r5"
+ },
+ {
+ "metric": "10",
+ "interface": "r4-eth1",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:1::/64"
+ },
+ {
+ "metric": "10",
+ "interface": "r4-eth1",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::5/128"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "metric": "20",
+ "interface": "r4-eth1",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:1::/64"
+ },
+ {
+ "metric": "20",
+ "interface": "r4-eth1",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::3/128"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [
+ {
+ "vertex": "r4"
+ },
+ {
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP internal",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r4(4)",
+ "type": "TE-IS",
+ "vertex": "r2"
+ },
+ {
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r2(4)",
+ "type": "IP TE",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r2(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.2/32"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r4"
+ },
+ {
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:2::/64"
+ },
+ {
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r4(4)",
+ "type": "TE-IS",
+ "vertex": "r2"
+ },
+ {
+ "metric": "10",
+ "interface": "r4-eth0",
+ "next-hop": "r2",
+ "parent": "r2(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::2/128"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1/r4/zebra.conf b/tests/topotests/isis_topo1/r4/zebra.conf
new file mode 100644
index 0000000..5ca9a3d
--- /dev/null
+++ b/tests/topotests/isis_topo1/r4/zebra.conf
@@ -0,0 +1,13 @@
+hostname r4
+interface r4-eth0
+ ip address 10.0.21.1/24
+ ipv6 address 2001:db8:1:2::1/64
+!
+interface r4-eth1
+ ip address 10.0.11.2/24
+ ipv6 address 2001:db8:2:2::2/64
+!
+interface lo
+ ip address 10.254.0.4/32
+ ipv6 address 2001:db8:F::4/128
+!
diff --git a/tests/topotests/isis_topo1/r5/isisd.conf b/tests/topotests/isis_topo1/r5/isisd.conf
new file mode 100644
index 0000000..e0e9200
--- /dev/null
+++ b/tests/topotests/isis_topo1/r5/isisd.conf
@@ -0,0 +1,23 @@
+hostname r5
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r5-eth0
+ ip router isis 1
+ isis hello-interval 2
+ ipv6 router isis 1
+ isis circuit-type level-1
+!
+interface r5-eth1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-1
+!
+router isis 1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0005.00
+ metric-style wide
+ is-type level-1
+ redistribute ipv4 connected level-1
+ redistribute ipv6 connected level-1
+!
diff --git a/tests/topotests/isis_topo1/r5/r5_route.json b/tests/topotests/isis_topo1/r5/r5_route.json
new file mode 100644
index 0000000..cca844b
--- /dev/null
+++ b/tests/topotests/isis_topo1/r5/r5_route.json
@@ -0,0 +1,145 @@
+{
+ "10.0.10.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "afi": "ipv4",
+ "interfaceName": "r5-eth0",
+ "ip": "10.0.10.2"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "isis"
+ },
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r5-eth0"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.0.11.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "afi": "ipv4",
+ "interfaceName": "r5-eth1",
+ "ip": "10.0.11.2"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "isis"
+ },
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r5-eth1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "10.0.20.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r5-eth0",
+ "ip": "10.0.10.2"
+ }
+ ],
+ "prefix": "10.0.20.0/24",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.0.21.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r5-eth1",
+ "ip": "10.0.11.2"
+ }
+ ],
+ "prefix": "10.0.21.0/24",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.254.0.3/32": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r5-eth0",
+ "ip": "10.0.10.2"
+ }
+ ],
+ "prefix": "10.254.0.3/32",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.254.0.4/32": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r5-eth1",
+ "ip": "10.0.11.2"
+ }
+ ],
+ "prefix": "10.254.0.4/32",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "10.254.0.5/32": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "10.254.0.5/32",
+ "protocol": "connected",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r5/r5_route6.json b/tests/topotests/isis_topo1/r5/r5_route6.json
new file mode 100644
index 0000000..b946876
--- /dev/null
+++ b/tests/topotests/isis_topo1/r5/r5_route6.json
@@ -0,0 +1,115 @@
+{
+ "2001:db8:2:1::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r5-eth0"
+ }
+ ],
+ "prefix": "2001:db8:2:1::/64",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:2:2::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r5-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:2::/64",
+ "protocol": "connected",
+ "selected": true
+ }
+ ],
+ "2001:db8:1:1::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r5-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:1::/64",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:1:2::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r5-eth1"
+ }
+ ],
+ "prefix": "2001:db8:1:2::/64",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::3/128": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r5-eth0"
+ }
+ ],
+ "prefix": "2001:db8:f::3/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::4/128": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r5-eth1"
+ }
+ ],
+ "prefix": "2001:db8:f::4/128",
+ "protocol": "isis",
+ "selected": true
+ }
+ ],
+ "2001:db8:f::5/128": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "lo"
+ }
+ ],
+ "prefix": "2001:db8:f::5/128",
+ "protocol": "connected",
+ "selected": true
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1/r5/r5_route6_linux.json b/tests/topotests/isis_topo1/r5/r5_route6_linux.json
new file mode 100644
index 0000000..a7343b5
--- /dev/null
+++ b/tests/topotests/isis_topo1/r5/r5_route6_linux.json
@@ -0,0 +1,26 @@
+{
+ "2001:db8:2:1::/64": {
+ "dev": "r5-eth0",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ },
+ "2001:db8:2:2::/64": {
+ "dev": "r5-eth1",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ },
+ "2001:db8:f::3": {
+ "dev": "r5-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:f::4": {
+ "dev": "r5-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r5/r5_route_linux.json b/tests/topotests/isis_topo1/r5/r5_route_linux.json
new file mode 100644
index 0000000..b809896
--- /dev/null
+++ b/tests/topotests/isis_topo1/r5/r5_route_linux.json
@@ -0,0 +1,26 @@
+{
+ "10.0.20.0/24": {
+ "dev": "r5-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.2"
+ },
+ "10.0.21.0/24": {
+ "dev": "r5-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.2"
+ },
+ "10.254.0.3": {
+ "dev": "r5-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.2"
+ },
+ "10.254.0.4": {
+ "dev": "r5-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.2"
+ }
+}
diff --git a/tests/topotests/isis_topo1/r5/r5_topology.json b/tests/topotests/isis_topo1/r5/r5_topology.json
new file mode 100644
index 0000000..3d887b7
--- /dev/null
+++ b/tests/topotests/isis_topo1/r5/r5_topology.json
@@ -0,0 +1,156 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r5"
+ },
+ {
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP internal",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP internal",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r5(4)",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r5(4)",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.3/32"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.254.0.4/32"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r5"
+ },
+ {
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:1::/64"
+ },
+ {
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:2::/64"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r5(4)",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r5(4)",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "metric": "10",
+ "interface": "r5-eth0",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:1::/64"
+ },
+ {
+ "metric": "10",
+ "interface": "r5-eth0",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::3/128"
+ },
+ {
+ "metric": "10",
+ "interface": "r5-eth1",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:2::/64"
+ },
+ {
+ "metric": "10",
+ "interface": "r5-eth1",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:f::4/128"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [],
+ "ipv6": []
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1/r5/zebra.conf b/tests/topotests/isis_topo1/r5/zebra.conf
new file mode 100644
index 0000000..48fed69
--- /dev/null
+++ b/tests/topotests/isis_topo1/r5/zebra.conf
@@ -0,0 +1,13 @@
+hostname r5
+interface r5-eth0
+ ip address 10.0.10.1/24
+ ipv6 address 2001:db8:2:1::1/64
+!
+interface r5-eth1
+ ip address 10.0.11.1/24
+ ipv6 address 2001:db8:2:2::1/64
+!
+interface lo
+ ip address 10.254.0.5/32
+ ipv6 address 2001:db8:F::5/128
+!
diff --git a/tests/topotests/isis_topo1/test_isis_topo1.dot b/tests/topotests/isis_topo1/test_isis_topo1.dot
new file mode 100644
index 0000000..01f9ba7
--- /dev/null
+++ b/tests/topotests/isis_topo1/test_isis_topo1.dot
@@ -0,0 +1,100 @@
+## Color coding:
+#########################
+## Main FRR: #f08080 red
+## Switches: #d0e0d0 gray
+## RIP: #19e3d9 Cyan
+## RIPng: #fcb314 dark yellow
+## OSPFv2: #32b835 Green
+## OSPFv3: #19e3d9 Cyan
+## ISIS IPv4 #fcb314 dark yellow
+## ISIS IPv6 #9a81ec purple
+## BGP IPv4 #eee3d3 beige
+## BGP IPv6 #fdff00 yellow
+##### Colors (see http://www.color-hex.com/)
+
+graph template {
+ label="isis topo1";
+
+ # Routers
+ r1 [
+ shape=doubleoctagon,
+ label="r1\n10.254.0.1\n2001:DB8:F::1",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r2 [
+ shape=doubleoctagon
+ label="r2\n10.254.0.2\n2001:DB8:F::2",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r3 [
+ shape=doubleoctagon
+ label="r3\n10.254.0.3\n2001:DB8:F::3",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r4 [
+ shape=doubleoctagon
+ label="r4\n10.254.0.4\n2001:DB8:F::4",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r5 [
+ shape=doubleoctagon
+ label="r5\n10.254.0.5\n2001:DB8:F::5",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+
+ # Switches
+ sw1 [
+ shape=oval,
+ label="sw1\n10.0.20.0/24\n2001:DB8:1:1::/64",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ sw2 [
+ shape=oval,
+ label="sw2\n10.0.21.0/24\n2001:DB8:1:2::/64",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ sw3 [
+ shape=oval,
+ label="sw3\n10.0.10.0/24\n2001:DB8:2:1::/64",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ sw4 [
+ shape=oval,
+ label="sw4\n10.0.11.0/24\n2001:DB8:2:2::/64",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+
+ # Connections
+ subgraph cluster0 {
+ label="level 2";
+
+ r1 -- sw1 [label="eth0\n.2"];
+ r2 -- sw2 [label="eth0\n.2"];
+ }
+
+ subgraph cluster1 {
+ label="level 1/2";
+
+ r3 -- sw1 [label="eth0\n.1"];
+ r3 -- sw3 [label="eth1\n.2"];
+
+ r4 -- sw4 [label="eth1\n.2"];
+ r4 -- sw2 [label="eth0\n.1"];
+ }
+
+ subgraph cluster2 {
+ label="level 1";
+
+ r5 -- sw3 [label="eth0\n.1"];
+ r5 -- sw4 [label="eth1\n.1"];
+ }
+}
diff --git a/tests/topotests/isis_topo1/test_isis_topo1.jpg b/tests/topotests/isis_topo1/test_isis_topo1.jpg
new file mode 100644
index 0000000..4ad730f
--- /dev/null
+++ b/tests/topotests/isis_topo1/test_isis_topo1.jpg
Binary files differ
diff --git a/tests/topotests/isis_topo1/test_isis_topo1.py b/tests/topotests/isis_topo1/test_isis_topo1.py
new file mode 100644
index 0000000..0147223
--- /dev/null
+++ b/tests/topotests/isis_topo1/test_isis_topo1.py
@@ -0,0 +1,497 @@
+#!/usr/bin/env python
+
+#
+# test_isis_topo1.py
+# Part of NetDEF Topology Tests
+#
+# Copyright (c) 2017 by
+# Network Device Education Foundation, Inc. ("NetDEF")
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+test_isis_topo1.py: Test ISIS topology.
+"""
+
+import functools
+import json
+import os
+import re
+import sys
+import pytest
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+
+# pylint: disable=C0413
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+
+
+pytestmark = [pytest.mark.isisd]
+
+VERTEX_TYPE_LIST = [
+ "pseudo_IS",
+ "pseudo_TE-IS",
+ "IS",
+ "TE-IS",
+ "ES",
+ "IP internal",
+ "IP external",
+ "IP TE",
+ "IP6 internal",
+ "IP6 external",
+ "UNKNOWN",
+]
+
+
+def build_topo(tgen):
+ "Build function"
+
+ # Add ISIS routers:
+ # r1 r2
+ # | sw1 | sw2
+ # r3 r4
+ # | |
+ # sw3 sw4
+ # \ /
+ # r5
+ for routern in range(1, 6):
+ tgen.add_router("r{}".format(routern))
+
+ # r1 <- sw1 -> r3
+ sw = tgen.add_switch("sw1")
+ sw.add_link(tgen.gears["r1"])
+ sw.add_link(tgen.gears["r3"])
+
+ # r2 <- sw2 -> r4
+ sw = tgen.add_switch("sw2")
+ sw.add_link(tgen.gears["r2"])
+ sw.add_link(tgen.gears["r4"])
+
+ # r3 <- sw3 -> r5
+ sw = tgen.add_switch("sw3")
+ sw.add_link(tgen.gears["r3"])
+ sw.add_link(tgen.gears["r5"])
+
+ # r4 <- sw4 -> r5
+ sw = tgen.add_switch("sw4")
+ sw.add_link(tgen.gears["r4"])
+ sw.add_link(tgen.gears["r5"])
+
+
+def setup_module(mod):
+ "Sets up the pytest environment"
+ tgen = Topogen(build_topo, mod.__name__)
+ tgen.start_topology()
+
+ # For all registered routers, load the zebra configuration file
+ for rname, router in tgen.routers().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))
+ )
+
+ # After loading the configurations, this function loads configured daemons.
+ tgen.start_router()
+
+
+def teardown_module(mod):
+ "Teardown the pytest environment"
+ tgen = get_topogen()
+
+ # This function tears down the whole topology.
+ tgen.stop_topology()
+
+
+def test_isis_convergence():
+ "Wait for the protocol to converge before starting to test"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("waiting for ISIS protocol to converge")
+ # Code to generate the json files.
+ # for rname, router in tgen.routers().items():
+ # open('/tmp/{}_topology.json'.format(rname), 'w').write(
+ # json.dumps(show_isis_topology(router), indent=2, sort_keys=True)
+ # )
+
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_topology.json".format(CWD, rname)
+ expected = json.loads(open(filename).read())
+
+ def compare_isis_topology(router, expected):
+ "Helper function to test ISIS topology convergence."
+ actual = show_isis_topology(router)
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(compare_isis_topology, router, expected)
+ (result, diff) = topotest.run_and_expect(test_func, None, wait=0.5, count=120)
+ assert result, "ISIS did not converge on {}:\n{}".format(rname, diff)
+
+
+def test_isis_route_installation():
+ "Check whether all expected routes are present"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Checking routers for installed ISIS routes")
+
+ # Check for routes in 'show ip route json'
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_route.json".format(CWD, rname)
+ expected = json.loads(open(filename, "r").read())
+
+ def compare_isis_installed_routes(router, expected):
+ "Helper function to test ISIS routes installed in rib."
+ actual = router.vtysh_cmd("show ip route json", isjson=True)
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(compare_isis_installed_routes, router, expected)
+ (result, diff) = topotest.run_and_expect(test_func, None, wait=1, count=10)
+ assertmsg = "Router '{}' routes mismatch".format(rname)
+ assert result, assertmsg
+
+
+def test_isis_linux_route_installation():
+ "Check whether all expected routes are present and installed in the OS"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Checking routers for installed ISIS routes in OS")
+
+ # Check for routes in `ip route`
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_route_linux.json".format(CWD, rname)
+ expected = json.loads(open(filename, "r").read())
+ actual = topotest.ip4_route(router)
+ assertmsg = "Router '{}' OS routes mismatch".format(rname)
+ assert topotest.json_cmp(actual, expected) is None, assertmsg
+
+
+def test_isis_route6_installation():
+ "Check whether all expected routes are present"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Checking routers for installed ISIS IPv6 routes")
+
+ # Check for routes in 'show ip route json'
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_route6.json".format(CWD, rname)
+ expected = json.loads(open(filename, "r").read())
+
+ def compare_isis_v6_installed_routes(router, expected):
+ "Helper function to test ISIS v6 routes installed in rib."
+ actual = router.vtysh_cmd("show ipv6 route json", isjson=True)
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(
+ compare_isis_v6_installed_routes, router, expected
+ )
+ (result, diff) = topotest.run_and_expect(test_func, None, wait=1, count=10)
+ assertmsg = "Router '{}' routes mismatch".format(rname)
+ assert result, assertmsg
+
+
+def test_isis_linux_route6_installation():
+ "Check whether all expected routes are present and installed in the OS"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Checking routers for installed ISIS IPv6 routes in OS")
+
+ # Check for routes in `ip route`
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_route6_linux.json".format(CWD, rname)
+ expected = json.loads(open(filename, "r").read())
+ actual = topotest.ip6_route(router)
+ assertmsg = "Router '{}' OS routes mismatch".format(rname)
+ assert topotest.json_cmp(actual, expected) is None, assertmsg
+
+
+def test_isis_summary_json():
+ "Check json struct in show isis summary json"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Checking 'show isis summary json'")
+ for rname, router in tgen.routers().items():
+ logger.info("Checking router %s", rname)
+ json_output = tgen.gears[rname].vtysh_cmd("show isis summary json", isjson=True)
+ assertmsg = "Test isis summary json failed in '{}' data '{}'".format(rname, json_output)
+ assert json_output['vrf'] == "default", assertmsg
+ assert json_output['areas'][0]['area'] == "1", assertmsg
+ assert json_output['areas'][0]['levels'][0]['id'] != '3', assertmsg
+
+
+def test_isis_interface_json():
+ "Check json struct in show isis interface json"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Checking 'show isis interface json'")
+ for rname, router in tgen.routers().items():
+ logger.info("Checking router %s", rname)
+ json_output = tgen.gears[rname].vtysh_cmd("show isis interface json", isjson=True)
+ assertmsg = "Test isis interface json failed in '{}' data '{}'".format(rname, json_output)
+ assert json_output['areas'][0]['circuits'][0]['interface']['name'] == rname+"-eth0", assertmsg
+
+ for rname, router in tgen.routers().items():
+ logger.info("Checking router %s", rname)
+ json_output = tgen.gears[rname].vtysh_cmd("show isis interface detail json", isjson=True)
+ assertmsg = "Test isis interface json failed in '{}' data '{}'".format(rname, json_output)
+ assert json_output['areas'][0]['circuits'][0]['interface']['name'] == rname+"-eth0", assertmsg
+
+
+def test_isis_neighbor_json():
+ "Check json struct in show isis neighbor json"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ #tgen.mininet_cli()
+ logger.info("Checking 'show isis neighbor json'")
+ for rname, router in tgen.routers().items():
+ logger.info("Checking router %s", rname)
+ json_output = tgen.gears[rname].vtysh_cmd("show isis neighbor json", isjson=True)
+ assertmsg = "Test isis neighbor json failed in '{}' data '{}'".format(rname, json_output)
+ assert json_output['areas'][0]['circuits'][0]['interface'] == rname+"-eth0", assertmsg
+
+ for rname, router in tgen.routers().items():
+ logger.info("Checking router %s", rname)
+ json_output = tgen.gears[rname].vtysh_cmd("show isis neighbor detail json", isjson=True)
+ assertmsg = "Test isis neighbor json failed in '{}' data '{}'".format(rname, json_output)
+ assert json_output['areas'][0]['circuits'][0]['interface']['name'] == rname+"-eth0", assertmsg
+
+
+def test_isis_database_json():
+ "Check json struct in show isis database json"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ #tgen.mininet_cli()
+ logger.info("Checking 'show isis database json'")
+ for rname, router in tgen.routers().items():
+ logger.info("Checking router %s", rname)
+ json_output = tgen.gears[rname].vtysh_cmd("show isis database json", isjson=True)
+ assertmsg = "Test isis database json failed in '{}' data '{}'".format(rname, json_output)
+ assert json_output['areas'][0]['area']['name'] == "1", assertmsg
+ assert json_output['areas'][0]['levels'][0]['id'] != '3', assertmsg
+
+ for rname, router in tgen.routers().items():
+ logger.info("Checking router %s", rname)
+ json_output = tgen.gears[rname].vtysh_cmd("show isis database detail json", isjson=True)
+ assertmsg = "Test isis database json failed in '{}' data '{}'".format(rname, json_output)
+ assert json_output['areas'][0]['area']['name'] == "1", assertmsg
+ assert json_output['areas'][0]['levels'][0]['id'] != '3', assertmsg
+
+
+def test_memory_leak():
+ "Run the memory leak test and report results."
+ tgen = get_topogen()
+ if not tgen.is_memleak_enabled():
+ pytest.skip("Memory leak test/report is disabled")
+
+ tgen.report_memory_leaks()
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
+
+
+#
+# Auxiliary functions
+#
+
+
+def dict_merge(dct, merge_dct):
+ """
+ Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
+ updating only top-level keys, dict_merge recurses down into dicts nested
+ to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
+ ``dct``.
+ :param dct: dict onto which the merge is executed
+ :param merge_dct: dct merged into dct
+ :return: None
+
+ Source:
+ https://gist.github.com/angstwad/bf22d1822c38a92ec0a9
+ """
+ for k, v in merge_dct.items():
+ if k in dct and isinstance(dct[k], dict) and topotest.is_mapping(merge_dct[k]):
+ dict_merge(dct[k], merge_dct[k])
+ else:
+ dct[k] = merge_dct[k]
+
+
+def parse_topology(lines, level):
+ """
+ Parse the output of 'show isis topology level-X' into a Python dict.
+ """
+ areas = {}
+ area = None
+ ipv = None
+ vertex_type_regex = "|".join(VERTEX_TYPE_LIST)
+
+ for line in lines:
+ area_match = re.match(r"Area (.+):", line)
+ if area_match:
+ area = area_match.group(1)
+ if area not in areas:
+ areas[area] = {level: {"ipv4": [], "ipv6": []}}
+ ipv = None
+ continue
+ elif area is None:
+ continue
+
+ if re.match(r"IS\-IS paths to level-. routers that speak IPv6", line):
+ ipv = "ipv6"
+ continue
+ if re.match(r"IS\-IS paths to level-. routers that speak IP", line):
+ ipv = "ipv4"
+ continue
+
+ item_match = re.match(
+ r"([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+)", line
+ )
+ if (
+ item_match is not None
+ and item_match.group(1) == "Vertex"
+ and item_match.group(2) == "Type"
+ and item_match.group(3) == "Metric"
+ and item_match.group(4) == "Next-Hop"
+ and item_match.group(5) == "Interface"
+ and item_match.group(6) == "Parent"
+ ):
+ # Skip header
+ continue
+
+ item_match = re.match(
+ r"([^\s]+) ({}) ([0]|([1-9][0-9]*)) ([^\s]+) ([^\s]+) ([^\s]+)".format(
+ vertex_type_regex
+ ),
+ line,
+ )
+ if item_match is not None:
+ areas[area][level][ipv].append(
+ {
+ "vertex": item_match.group(1),
+ "type": item_match.group(2),
+ "metric": item_match.group(3),
+ "next-hop": item_match.group(5),
+ "interface": item_match.group(6),
+ "parent": item_match.group(7),
+ }
+ )
+ continue
+
+ item_match = re.match(
+ r"([^\s]+) ({}) ([0]|([1-9][0-9]*)) ([^\s]+)".format(vertex_type_regex),
+ line,
+ )
+
+ if item_match is not None:
+ areas[area][level][ipv].append(
+ {
+ "vertex": item_match.group(1),
+ "type": item_match.group(2),
+ "metric": item_match.group(3),
+ "parent": item_match.group(5),
+ }
+ )
+ continue
+
+ item_match = re.match(r"([^\s]+)", line)
+ if item_match is not None:
+ areas[area][level][ipv].append({"vertex": item_match.group(1)})
+ continue
+
+ return areas
+
+
+def show_isis_topology(router):
+ """
+ Get the ISIS topology in a dictionary format.
+
+ Sample:
+ {
+ 'area-name': {
+ 'level-1': [
+ {
+ 'vertex': 'r1'
+ }
+ ],
+ 'level-2': [
+ {
+ 'vertex': '10.0.0.1/24',
+ 'type': 'IP',
+ 'parent': '0',
+ 'metric': 'internal'
+ }
+ ]
+ },
+ 'area-name-2': {
+ 'level-2': [
+ {
+ "interface": "rX-ethY",
+ "metric": "Z",
+ "next-hop": "rA",
+ "parent": "rC(B)",
+ "type": "TE-IS",
+ "vertex": "rD"
+ }
+ ]
+ }
+ }
+ """
+ l1out = topotest.normalize_text(
+ router.vtysh_cmd("show isis topology level-1")
+ ).splitlines()
+ l2out = topotest.normalize_text(
+ router.vtysh_cmd("show isis topology level-2")
+ ).splitlines()
+
+ l1 = parse_topology(l1out, "level-1")
+ l2 = parse_topology(l2out, "level-2")
+
+ dict_merge(l1, l2)
+ return l1
diff --git a/tests/topotests/isis_topo1_vrf/__init__.py b/tests/topotests/isis_topo1_vrf/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/__init__.py
diff --git a/tests/topotests/isis_topo1_vrf/r1/isisd.conf b/tests/topotests/isis_topo1_vrf/r1/isisd.conf
new file mode 100755
index 0000000..4dd6815
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r1/isisd.conf
@@ -0,0 +1,16 @@
+hostname r1
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r1-eth0 vrf r1-cust1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-2-only
+!
+router isis 1 vrf r1-cust1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0000.00
+ metric-style wide
+ redistribute ipv4 connected level-2
+ redistribute ipv6 connected level-2
+!
diff --git a/tests/topotests/isis_topo1_vrf/r1/r1_route.json b/tests/topotests/isis_topo1_vrf/r1/r1_route.json
new file mode 100644
index 0000000..8359baa
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r1/r1_route.json
@@ -0,0 +1,37 @@
+{
+ "10.0.10.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r1-eth0",
+ "ip": "10.0.20.1"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r1-cust1"
+ }
+ ],
+ "10.0.20.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r1-eth0"
+ }
+ ],
+ "prefix": "10.0.20.0/24",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r1-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r1/r1_route6.json b/tests/topotests/isis_topo1_vrf/r1/r1_route6.json
new file mode 100644
index 0000000..7496126
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r1/r1_route6.json
@@ -0,0 +1,36 @@
+{
+ "2001:db8:1:1::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r1-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:1::/64",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r1-cust1"
+ }
+ ],
+ "2001:db8:2:1::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r1-eth0"
+ }
+ ],
+ "prefix": "2001:db8:2:1::/64",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r1-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r1/r1_route6_linux.json b/tests/topotests/isis_topo1_vrf/r1/r1_route6_linux.json
new file mode 100755
index 0000000..d1ace40
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r1/r1_route6_linux.json
@@ -0,0 +1,14 @@
+{
+ "2001:db8:1:1::/64": {
+ "dev": "r1-eth0",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ },
+ "2001:db8:2:1::/64": {
+ "dev": "r1-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r1/r1_route_linux.json b/tests/topotests/isis_topo1_vrf/r1/r1_route_linux.json
new file mode 100755
index 0000000..6af2229
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r1/r1_route_linux.json
@@ -0,0 +1,13 @@
+{
+ "10.0.10.0/24": {
+ "dev": "r1-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.20.1"
+ },
+ "10.0.20.0/24": {
+ "dev": "r1-eth0",
+ "proto": "kernel",
+ "scope": "link"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r1/r1_topology.json b/tests/topotests/isis_topo1_vrf/r1/r1_topology.json
new file mode 100644
index 0000000..666fa52
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r1/r1_topology.json
@@ -0,0 +1,80 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r1"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r1"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [
+ {
+ "vertex": "r1"
+ },
+ {
+ "metric": "0",
+ "parent": "r1(4)",
+ "type": "IP internal",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r1(4)",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.10.0/24"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r1"
+ },
+ {
+ "metric": "0",
+ "parent": "r1(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:1::/64"
+ },
+ {
+ "interface": "r1-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r1(4)",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "metric": "10",
+ "interface": "r1-eth0",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:1::/64"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r1/zebra.conf b/tests/topotests/isis_topo1_vrf/r1/zebra.conf
new file mode 100755
index 0000000..fa1c02e
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r1/zebra.conf
@@ -0,0 +1,9 @@
+hostname r1
+interface r1-eth0 vrf r1-cust1
+ ip address 10.0.20.2/24
+ ipv6 address 2001:db8:1:1::2/64
+!
+interface lo
+ ip address 10.254.0.1/32
+ ipv6 address 2001:db8:F::1/128
+!
diff --git a/tests/topotests/isis_topo1_vrf/r2/isisd.conf b/tests/topotests/isis_topo1_vrf/r2/isisd.conf
new file mode 100755
index 0000000..955bb54
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r2/isisd.conf
@@ -0,0 +1,16 @@
+hostname r2
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r2-eth0 vrf r2-cust1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-2-only
+!
+router isis 1 vrf r2-cust1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0001.00
+ metric-style wide
+ redistribute ipv4 connected level-2
+ redistribute ipv6 connected level-2
+!
diff --git a/tests/topotests/isis_topo1_vrf/r2/r2_route.json b/tests/topotests/isis_topo1_vrf/r2/r2_route.json
new file mode 100644
index 0000000..e2eee11
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r2/r2_route.json
@@ -0,0 +1,37 @@
+{
+ "10.0.11.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r2-eth0",
+ "ip": "10.0.21.1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r2-cust1"
+ }
+ ],
+ "10.0.21.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r2-eth0"
+ }
+ ],
+ "prefix": "10.0.21.0/24",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r2-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r2/r2_route6.json b/tests/topotests/isis_topo1_vrf/r2/r2_route6.json
new file mode 100644
index 0000000..21b953d
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r2/r2_route6.json
@@ -0,0 +1,36 @@
+{
+ "2001:db8:1:2::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r2-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:2::/64",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r2-cust1"
+ }
+ ],
+ "2001:db8:2:2::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r2-eth0"
+ }
+ ],
+ "prefix": "2001:db8:2:2::/64",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r2-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r2/r2_route6_linux.json b/tests/topotests/isis_topo1_vrf/r2/r2_route6_linux.json
new file mode 100755
index 0000000..27423e1
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r2/r2_route6_linux.json
@@ -0,0 +1,14 @@
+{
+ "2001:db8:1:2::/64": {
+ "dev": "r2-eth0",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ },
+ "2001:db8:2:2::/64": {
+ "dev": "r2-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r2/r2_route_linux.json b/tests/topotests/isis_topo1_vrf/r2/r2_route_linux.json
new file mode 100755
index 0000000..744b078
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r2/r2_route_linux.json
@@ -0,0 +1,13 @@
+{
+ "10.0.11.0/24": {
+ "dev": "r2-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.21.1"
+ },
+ "10.0.21.0/24": {
+ "dev": "r2-eth0",
+ "proto": "kernel",
+ "scope": "link"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r2/r2_topology.json b/tests/topotests/isis_topo1_vrf/r2/r2_topology.json
new file mode 100644
index 0000000..c26ad1e
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r2/r2_topology.json
@@ -0,0 +1,80 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r2"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r2"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [
+ {
+ "vertex": "r2"
+ },
+ {
+ "metric": "0",
+ "parent": "r2(4)",
+ "type": "IP internal",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r2(4)",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.11.0/24"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r2"
+ },
+ {
+ "metric": "0",
+ "parent": "r2(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:2::/64"
+ },
+ {
+ "interface": "r2-eth0",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r2(4)",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "metric": "10",
+ "interface": "r2-eth0",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:2::/64"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r2/zebra.conf b/tests/topotests/isis_topo1_vrf/r2/zebra.conf
new file mode 100755
index 0000000..a62af17
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r2/zebra.conf
@@ -0,0 +1,9 @@
+hostname r2
+interface r2-eth0 vrf r2-cust1
+ ip address 10.0.21.2/24
+ ipv6 address 2001:db8:1:2::2/64
+!
+interface lo
+ ip address 10.254.0.2/32
+ ipv6 address 2001:db8:F::2/128
+!
diff --git a/tests/topotests/isis_topo1_vrf/r3/isisd.conf b/tests/topotests/isis_topo1_vrf/r3/isisd.conf
new file mode 100755
index 0000000..d127b3a
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r3/isisd.conf
@@ -0,0 +1,23 @@
+hostname r3
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r3-eth0 vrf r3-cust1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-2-only
+!
+interface r3-eth1 vrf r3-cust1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-1
+!
+router isis 1 vrf r3-cust1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0002.00
+ metric-style wide
+ redistribute ipv4 connected level-1
+ redistribute ipv4 connected level-2
+ redistribute ipv6 connected level-1
+ redistribute ipv6 connected level-2
+!
diff --git a/tests/topotests/isis_topo1_vrf/r3/r3_route.json b/tests/topotests/isis_topo1_vrf/r3/r3_route.json
new file mode 100644
index 0000000..33ad90c
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r3/r3_route.json
@@ -0,0 +1,86 @@
+{
+ "10.0.10.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "afi": "ipv4",
+ "interfaceName": "r3-eth1",
+ "ip": "10.0.10.1"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "isis",
+ "vrfName": "r3-cust1"
+ },
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r3-cust1"
+ }
+ ],
+ "10.0.11.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r3-eth1",
+ "ip": "10.0.10.1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r3-cust1"
+ }
+ ],
+ "10.0.20.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r3-eth0"
+ }
+ ],
+ "prefix": "10.0.20.0/24",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r3-cust1"
+ }
+ ],
+ "10.0.21.0/24": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r3-eth1",
+ "ip": "10.0.10.1"
+ }
+ ],
+ "prefix": "10.0.21.0/24",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r3-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r3/r3_route6.json b/tests/topotests/isis_topo1_vrf/r3/r3_route6.json
new file mode 100644
index 0000000..519fe49
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r3/r3_route6.json
@@ -0,0 +1,70 @@
+{
+ "2001:db8:1:1::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r3-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:1::/64",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r3-cust1"
+ }
+ ],
+ "2001:db8:1:2::/64": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "2001:db8:1:2::/64",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r3-cust1"
+ }
+ ],
+ "2001:db8:2:1::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:1::/64",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r3-cust1"
+ }
+ ],
+ "2001:db8:2:2::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r3-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:2::/64",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r3-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r3/r3_route6_linux.json b/tests/topotests/isis_topo1_vrf/r3/r3_route6_linux.json
new file mode 100755
index 0000000..bc527d2
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r3/r3_route6_linux.json
@@ -0,0 +1,26 @@
+{
+ "2001:db8:1:1::/64": {
+ "dev": "r3-eth0",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ },
+ "2001:db8:1:2::/64": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:2:1::/64": {
+ "dev": "r3-eth1",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ },
+ "2001:db8:2:2::/64": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r3/r3_route_linux.json b/tests/topotests/isis_topo1_vrf/r3/r3_route_linux.json
new file mode 100755
index 0000000..515d376
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r3/r3_route_linux.json
@@ -0,0 +1,24 @@
+{
+ "10.0.10.0/24": {
+ "dev": "r3-eth1",
+ "proto": "kernel",
+ "scope": "link"
+ },
+ "10.0.11.0/24": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.1"
+ },
+ "10.0.20.0/24": {
+ "dev": "r3-eth0",
+ "proto": "kernel",
+ "scope": "link"
+ },
+ "10.0.21.0/24": {
+ "dev": "r3-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.1"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r3/r3_topology.json b/tests/topotests/isis_topo1_vrf/r3/r3_topology.json
new file mode 100644
index 0000000..044a6c0
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r3/r3_topology.json
@@ -0,0 +1,132 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r3"
+ },
+ {
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP internal",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "TE-IS",
+ "vertex": "r5"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.21.0/24"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r3"
+ },
+ {
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:1::/64"
+ },
+ {
+ "interface": "r3-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "TE-IS",
+ "vertex": "r5"
+ },
+ {
+ "metric": "10",
+ "interface": "r3-eth1",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:2::/64"
+ },
+ {
+ "metric": "20",
+ "interface": "r3-eth1",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:2::/64"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [
+ {
+ "vertex": "r3"
+ },
+ {
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP internal",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r1",
+ "parent": "r3(4)",
+ "type": "TE-IS",
+ "vertex": "r1"
+ },
+ {
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r1",
+ "parent": "r1(4)",
+ "type": "IP TE",
+ "vertex": "10.0.20.0/24"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r3"
+ },
+ {
+ "metric": "0",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:1::/64"
+ },
+ {
+ "interface": "r3-eth0",
+ "metric": "10",
+ "next-hop": "r1",
+ "parent": "r3(4)",
+ "type": "TE-IS",
+ "vertex": "r1"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r3/zebra.conf b/tests/topotests/isis_topo1_vrf/r3/zebra.conf
new file mode 100755
index 0000000..ac0b810
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r3/zebra.conf
@@ -0,0 +1,13 @@
+hostname r3
+interface r3-eth0 vrf r3-cust1
+ ip address 10.0.20.1/24
+ ipv6 address 2001:db8:1:1::1/64
+!
+interface r3-eth1 vrf r3-cust1
+ ip address 10.0.10.2/24
+ ipv6 address 2001:db8:2:1::2/64
+!
+interface lo
+ ip address 10.254.0.3/32
+ ipv6 address 2001:db8:F::3/128
+!
diff --git a/tests/topotests/isis_topo1_vrf/r4/isisd.conf b/tests/topotests/isis_topo1_vrf/r4/isisd.conf
new file mode 100755
index 0000000..fd11b2c
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r4/isisd.conf
@@ -0,0 +1,26 @@
+hostname r4
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+! debug isis lsp-gen
+! debug isis lsp-sched
+
+interface r4-eth0 vrf r4-cust1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-2-only
+!
+interface r4-eth1 vrf r4-cust1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-1
+!
+router isis 1 vrf r4-cust1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0004.00
+ metric-style wide
+ redistribute ipv4 connected level-1
+ redistribute ipv4 connected level-2
+ redistribute ipv6 connected level-1
+ redistribute ipv6 connected level-2
+!
diff --git a/tests/topotests/isis_topo1_vrf/r4/r4_route.json b/tests/topotests/isis_topo1_vrf/r4/r4_route.json
new file mode 100644
index 0000000..6fb3bd9
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r4/r4_route.json
@@ -0,0 +1,81 @@
+{
+ "10.0.10.0/24": [
+ {
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r4-eth1",
+ "ip": "10.0.11.1"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r4-cust1"
+ }
+ ],
+ "10.0.11.0/24": [
+ {
+ "nexthops": [
+ {
+ "afi": "ipv4",
+ "interfaceName": "r4-eth1",
+ "ip": "10.0.11.1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "isis",
+ "vrfName": "r4-cust1"
+ },
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r4-cust1"
+ }
+ ],
+ "10.0.20.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r4-eth1",
+ "ip": "10.0.11.1"
+ }
+ ],
+ "prefix": "10.0.20.0/24",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r4-cust1"
+ }
+ ],
+ "10.0.21.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r4-eth0"
+ }
+ ],
+ "prefix": "10.0.21.0/24",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r4-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r4/r4_route6.json b/tests/topotests/isis_topo1_vrf/r4/r4_route6.json
new file mode 100644
index 0000000..702a83f
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r4/r4_route6.json
@@ -0,0 +1,70 @@
+{
+ "2001:db8:1:1::/64": [
+ {
+ "distance": 115,
+ "metric": 20,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "2001:db8:1:1::/64",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r4-cust1"
+ }
+ ],
+ "2001:db8:1:2::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r4-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:2::/64",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r4-cust1"
+ }
+ ],
+ "2001:db8:2:1::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:1::/64",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r4-cust1"
+ }
+ ],
+ "2001:db8:2:2::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r4-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:2::/64",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r4-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r4/r4_route6_linux.json b/tests/topotests/isis_topo1_vrf/r4/r4_route6_linux.json
new file mode 100755
index 0000000..b1cd5b9
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r4/r4_route6_linux.json
@@ -0,0 +1,26 @@
+{
+ "2001:db8:1:1::/64": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:1:2::/64": {
+ "dev": "r4-eth0",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ },
+ "2001:db8:2:1::/64": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:2:2::/64": {
+ "dev": "r4-eth1",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r4/r4_route_linux.json b/tests/topotests/isis_topo1_vrf/r4/r4_route_linux.json
new file mode 100755
index 0000000..3198b85
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r4/r4_route_linux.json
@@ -0,0 +1,24 @@
+{
+ "10.0.10.0/24": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.1"
+ },
+ "10.0.11.0/24": {
+ "dev": "r4-eth1",
+ "proto": "kernel",
+ "scope": "link"
+ },
+ "10.0.20.0/24": {
+ "dev": "r4-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.1"
+ },
+ "10.0.21.0/24": {
+ "dev": "r4-eth0",
+ "proto": "kernel",
+ "scope": "link"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r4/r4_topology.json b/tests/topotests/isis_topo1_vrf/r4/r4_topology.json
new file mode 100644
index 0000000..d40008a
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r4/r4_topology.json
@@ -0,0 +1,132 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r4"
+ },
+ {
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP internal",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "TE-IS",
+ "vertex": "r5"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP TE",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "20",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.20.0/24"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r4"
+ },
+ {
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:2::/64"
+ },
+ {
+ "interface": "r4-eth1",
+ "metric": "10",
+ "next-hop": "r5",
+ "parent": "r4(4)",
+ "type": "TE-IS",
+ "vertex": "r5"
+ },
+ {
+ "metric": "10",
+ "interface": "r4-eth1",
+ "next-hop": "r5",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:1::/64"
+ },
+ {
+ "metric": "20",
+ "interface": "r4-eth1",
+ "next-hop": "r5",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:1::/64"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [
+ {
+ "vertex": "r4"
+ },
+ {
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP internal",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r4(4)",
+ "type": "TE-IS",
+ "vertex": "r2"
+ },
+ {
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r2(4)",
+ "type": "IP TE",
+ "vertex": "10.0.21.0/24"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r4"
+ },
+ {
+ "metric": "0",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:2::/64"
+ },
+ {
+ "interface": "r4-eth0",
+ "metric": "10",
+ "next-hop": "r2",
+ "parent": "r4(4)",
+ "type": "TE-IS",
+ "vertex": "r2"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r4/zebra.conf b/tests/topotests/isis_topo1_vrf/r4/zebra.conf
new file mode 100755
index 0000000..9c8941f
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r4/zebra.conf
@@ -0,0 +1,13 @@
+hostname r4
+interface r4-eth0 vrf r4-cust1
+ ip address 10.0.21.1/24
+ ipv6 address 2001:db8:1:2::1/64
+!
+interface r4-eth1 vrf r4-cust1
+ ip address 10.0.11.2/24
+ ipv6 address 2001:db8:2:2::2/64
+!
+interface lo
+ ip address 10.254.0.4/32
+ ipv6 address 2001:db8:F::4/128
+!
diff --git a/tests/topotests/isis_topo1_vrf/r5/isisd.conf b/tests/topotests/isis_topo1_vrf/r5/isisd.conf
new file mode 100755
index 0000000..6777637
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r5/isisd.conf
@@ -0,0 +1,22 @@
+hostname r5
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+interface r5-eth0 vrf r5-cust1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-1
+!
+interface r5-eth1 vrf r5-cust1
+ ip router isis 1
+ ipv6 router isis 1
+ isis circuit-type level-1
+!
+router isis 1 vrf r5-cust1
+ lsp-gen-interval 2
+ net 10.0000.0000.0000.0000.0000.0000.0000.0000.0005.00
+ metric-style wide
+ is-type level-1
+ redistribute ipv4 connected level-1
+ redistribute ipv6 connected level-1
+!
diff --git a/tests/topotests/isis_topo1_vrf/r5/r5_route.json b/tests/topotests/isis_topo1_vrf/r5/r5_route.json
new file mode 100644
index 0000000..a254b6f
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r5/r5_route.json
@@ -0,0 +1,94 @@
+{
+ "10.0.10.0/24": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "afi": "ipv4",
+ "interfaceName": "r5-eth0",
+ "ip": "10.0.10.2"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "isis",
+ "vrfName": "r5-cust1"
+ },
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r5-eth0"
+ }
+ ],
+ "prefix": "10.0.10.0/24",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r5-cust1"
+ }
+ ],
+ "10.0.11.0/24": [
+ {
+ "nexthops": [
+ {
+ "afi": "ipv4",
+ "interfaceName": "r5-eth1",
+ "ip": "10.0.11.2"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "isis",
+ "vrfName": "r5-cust1"
+ },
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r5-eth1"
+ }
+ ],
+ "prefix": "10.0.11.0/24",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r5-cust1"
+ }
+ ],
+ "10.0.20.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r5-eth0",
+ "ip": "10.0.10.2"
+ }
+ ],
+ "prefix": "10.0.20.0/24",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r5-cust1"
+ }
+ ],
+ "10.0.21.0/24": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv4",
+ "fib": true,
+ "interfaceName": "r5-eth1",
+ "ip": "10.0.11.2"
+ }
+ ],
+ "prefix": "10.0.21.0/24",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r5-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r5/r5_route6.json b/tests/topotests/isis_topo1_vrf/r5/r5_route6.json
new file mode 100644
index 0000000..06fc78f
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r5/r5_route6.json
@@ -0,0 +1,70 @@
+{
+ "2001:db8:1:1::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r5-eth0"
+ }
+ ],
+ "prefix": "2001:db8:1:1::/64",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r5-cust1"
+ }
+ ],
+ "2001:db8:1:2::/64": [
+ {
+ "distance": 115,
+ "metric": 10,
+ "nexthops": [
+ {
+ "active": true,
+ "afi": "ipv6",
+ "fib": true,
+ "interfaceName": "r5-eth1"
+ }
+ ],
+ "prefix": "2001:db8:1:2::/64",
+ "protocol": "isis",
+ "selected": true,
+ "vrfName": "r5-cust1"
+ }
+ ],
+ "2001:db8:2:1::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r5-eth0"
+ }
+ ],
+ "prefix": "2001:db8:2:1::/64",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r5-cust1"
+ }
+ ],
+ "2001:db8:2:2::/64": [
+ {
+ "nexthops": [
+ {
+ "active": true,
+ "directlyConnected": true,
+ "fib": true,
+ "interfaceName": "r5-eth1"
+ }
+ ],
+ "prefix": "2001:db8:2:2::/64",
+ "protocol": "connected",
+ "selected": true,
+ "vrfName": "r5-cust1"
+ }
+ ]
+}
diff --git a/tests/topotests/isis_topo1_vrf/r5/r5_route6_linux.json b/tests/topotests/isis_topo1_vrf/r5/r5_route6_linux.json
new file mode 100755
index 0000000..3db3c93
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r5/r5_route6_linux.json
@@ -0,0 +1,26 @@
+{
+ "2001:db8:1:1::/64": {
+ "dev": "r5-eth0",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:1:2::/64": {
+ "dev": "r5-eth1",
+ "metric": "20",
+ "pref": "medium",
+ "proto": "187"
+ },
+ "2001:db8:2:1::/64": {
+ "dev": "r5-eth0",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ },
+ "2001:db8:2:2::/64": {
+ "dev": "r5-eth1",
+ "metric": "256",
+ "pref": "medium",
+ "proto": "kernel"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r5/r5_route_linux.json b/tests/topotests/isis_topo1_vrf/r5/r5_route_linux.json
new file mode 100755
index 0000000..6a38ba8
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r5/r5_route_linux.json
@@ -0,0 +1,24 @@
+{
+ "10.0.10.0/24": {
+ "dev": "r5-eth0",
+ "proto": "kernel",
+ "scope": "link"
+ },
+ "10.0.11.0/24": {
+ "dev": "r5-eth1",
+ "proto": "kernel",
+ "scope": "link"
+ },
+ "10.0.20.0/24": {
+ "dev": "r5-eth0",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.10.2"
+ },
+ "10.0.21.0/24": {
+ "dev": "r5-eth1",
+ "metric": "20",
+ "proto": "187",
+ "via": "10.0.11.2"
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r5/r5_topology.json b/tests/topotests/isis_topo1_vrf/r5/r5_topology.json
new file mode 100644
index 0000000..2a088ca
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r5/r5_topology.json
@@ -0,0 +1,124 @@
+{
+ "1": {
+ "level-1": {
+ "ipv4": [
+ {
+ "vertex": "r5"
+ },
+ {
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP internal",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP internal",
+ "vertex": "10.0.11.0/24"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r5(4)",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r5(4)",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.20.0/24"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP TE",
+ "vertex": "10.0.10.0/24"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.21.0/24"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP TE",
+ "vertex": "10.0.11.0/24"
+ }
+ ],
+ "ipv6": [
+ {
+ "vertex": "r5"
+ },
+ {
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:1::/64"
+ },
+ {
+ "metric": "0",
+ "parent": "r5(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:2:2::/64"
+ },
+ {
+ "interface": "r5-eth0",
+ "metric": "10",
+ "next-hop": "r3",
+ "parent": "r5(4)",
+ "type": "TE-IS",
+ "vertex": "r3"
+ },
+ {
+ "interface": "r5-eth1",
+ "metric": "10",
+ "next-hop": "r4",
+ "parent": "r5(4)",
+ "type": "TE-IS",
+ "vertex": "r4"
+ },
+ {
+ "metric": "10",
+ "interface": "r5-eth0",
+ "next-hop": "r3",
+ "parent": "r3(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:1::/64"
+ },
+ {
+ "metric": "10",
+ "interface": "r5-eth1",
+ "next-hop": "r4",
+ "parent": "r4(4)",
+ "type": "IP6 internal",
+ "vertex": "2001:db8:1:2::/64"
+ }
+ ]
+ },
+ "level-2": {
+ "ipv4": [],
+ "ipv6": []
+ }
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/r5/zebra.conf b/tests/topotests/isis_topo1_vrf/r5/zebra.conf
new file mode 100755
index 0000000..c6bc630
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/r5/zebra.conf
@@ -0,0 +1,13 @@
+hostname r5
+interface r5-eth0 vrf r5-cust1
+ ip address 10.0.10.1/24
+ ipv6 address 2001:db8:2:1::1/64
+!
+interface r5-eth1 vrf r5-cust1
+ ip address 10.0.11.1/24
+ ipv6 address 2001:db8:2:2::1/64
+!
+interface lo
+ ip address 10.254.0.5/32
+ ipv6 address 2001:db8:F::5/128
+!
diff --git a/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.dot b/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.dot
new file mode 100755
index 0000000..01f9ba7
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.dot
@@ -0,0 +1,100 @@
+## Color coding:
+#########################
+## Main FRR: #f08080 red
+## Switches: #d0e0d0 gray
+## RIP: #19e3d9 Cyan
+## RIPng: #fcb314 dark yellow
+## OSPFv2: #32b835 Green
+## OSPFv3: #19e3d9 Cyan
+## ISIS IPv4 #fcb314 dark yellow
+## ISIS IPv6 #9a81ec purple
+## BGP IPv4 #eee3d3 beige
+## BGP IPv6 #fdff00 yellow
+##### Colors (see http://www.color-hex.com/)
+
+graph template {
+ label="isis topo1";
+
+ # Routers
+ r1 [
+ shape=doubleoctagon,
+ label="r1\n10.254.0.1\n2001:DB8:F::1",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r2 [
+ shape=doubleoctagon
+ label="r2\n10.254.0.2\n2001:DB8:F::2",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r3 [
+ shape=doubleoctagon
+ label="r3\n10.254.0.3\n2001:DB8:F::3",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r4 [
+ shape=doubleoctagon
+ label="r4\n10.254.0.4\n2001:DB8:F::4",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r5 [
+ shape=doubleoctagon
+ label="r5\n10.254.0.5\n2001:DB8:F::5",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+
+ # Switches
+ sw1 [
+ shape=oval,
+ label="sw1\n10.0.20.0/24\n2001:DB8:1:1::/64",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ sw2 [
+ shape=oval,
+ label="sw2\n10.0.21.0/24\n2001:DB8:1:2::/64",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ sw3 [
+ shape=oval,
+ label="sw3\n10.0.10.0/24\n2001:DB8:2:1::/64",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ sw4 [
+ shape=oval,
+ label="sw4\n10.0.11.0/24\n2001:DB8:2:2::/64",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+
+ # Connections
+ subgraph cluster0 {
+ label="level 2";
+
+ r1 -- sw1 [label="eth0\n.2"];
+ r2 -- sw2 [label="eth0\n.2"];
+ }
+
+ subgraph cluster1 {
+ label="level 1/2";
+
+ r3 -- sw1 [label="eth0\n.1"];
+ r3 -- sw3 [label="eth1\n.2"];
+
+ r4 -- sw4 [label="eth1\n.2"];
+ r4 -- sw2 [label="eth0\n.1"];
+ }
+
+ subgraph cluster2 {
+ label="level 1";
+
+ r5 -- sw3 [label="eth0\n.1"];
+ r5 -- sw4 [label="eth1\n.1"];
+ }
+}
diff --git a/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.jpg b/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.jpg
new file mode 100755
index 0000000..4ad730f
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.jpg
Binary files differ
diff --git a/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py b/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py
new file mode 100644
index 0000000..ff9ad61
--- /dev/null
+++ b/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py
@@ -0,0 +1,441 @@
+#!/usr/bin/env python
+
+#
+# Copyright (c) 2020 by Niral Networks, Inc. ("Niral Networks")
+# Used Copyright (c) 2018 by Network Device Education Foundation,
+# Inc. ("NetDEF") in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+test_isis_topo1_vrf.py: Test ISIS vrf topology.
+"""
+
+import functools
+import json
+import os
+import re
+import sys
+import pytest
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+
+# pylint: disable=C0413
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+from lib.topotest import iproute2_is_vrf_capable
+from lib.common_config import required_linux_kernel_version
+
+
+pytestmark = [pytest.mark.isisd]
+
+VERTEX_TYPE_LIST = [
+ "pseudo_IS",
+ "pseudo_TE-IS",
+ "IS",
+ "TE-IS",
+ "ES",
+ "IP internal",
+ "IP external",
+ "IP TE",
+ "IP6 internal",
+ "IP6 external",
+ "UNKNOWN",
+]
+
+
+def build_topo(tgen):
+ "Build function"
+
+ # Add ISIS routers:
+ # r1 r2
+ # | sw1 | sw2
+ # r3 r4
+ # | |
+ # sw3 sw4
+ # \ /
+ # r5
+ for routern in range(1, 6):
+ tgen.add_router("r{}".format(routern))
+
+ # r1 <- sw1 -> r3
+ sw = tgen.add_switch("sw1")
+ sw.add_link(tgen.gears["r1"])
+ sw.add_link(tgen.gears["r3"])
+
+ # r2 <- sw2 -> r4
+ sw = tgen.add_switch("sw2")
+ sw.add_link(tgen.gears["r2"])
+ sw.add_link(tgen.gears["r4"])
+
+ # r3 <- sw3 -> r5
+ sw = tgen.add_switch("sw3")
+ sw.add_link(tgen.gears["r3"])
+ sw.add_link(tgen.gears["r5"])
+
+ # r4 <- sw4 -> r5
+ sw = tgen.add_switch("sw4")
+ sw.add_link(tgen.gears["r4"])
+ sw.add_link(tgen.gears["r5"])
+
+
+def setup_module(mod):
+ "Sets up the pytest environment"
+ tgen = Topogen(build_topo, mod.__name__)
+ tgen.start_topology()
+
+ logger.info("Testing with VRF Lite support")
+
+ cmds = [
+ "ip link add {0}-cust1 type vrf table 1001",
+ "ip link add loop1 type dummy",
+ "ip link set {0}-eth0 master {0}-cust1",
+ ]
+
+ eth1_cmds = ["ip link set {0}-eth1 master {0}-cust1"]
+
+ # For all registered routers, load the zebra configuration file
+ for rname, router in tgen.routers().items():
+ # create VRF rx-cust1 and link rx-eth0 to rx-cust1
+ for cmd in cmds:
+ output = tgen.net[rname].cmd(cmd.format(rname))
+
+ # If router has an rX-eth1, link that to vrf also
+ if "{}-eth1".format(rname) in router.links.keys():
+ for cmd in eth1_cmds:
+ output = output + tgen.net[rname].cmd(cmd.format(rname))
+
+ for rname, router in tgen.routers().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))
+ )
+ # After loading the configurations, this function loads configured daemons.
+ tgen.start_router()
+
+
+def teardown_module(mod):
+ "Teardown the pytest environment"
+ tgen = get_topogen()
+ # move back rx-eth0 to default VRF
+ # delete rx-vrf
+ tgen.stop_topology()
+
+
+def test_isis_convergence():
+ "Wait for the protocol to converge before starting to test"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("waiting for ISIS protocol to converge")
+
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_topology.json".format(CWD, rname)
+ expected = json.loads(open(filename).read())
+
+ def compare_isis_topology(router, expected):
+ "Helper function to test ISIS vrf topology convergence."
+ actual = show_isis_topology(router)
+
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(compare_isis_topology, router, expected)
+ (result, diff) = topotest.run_and_expect(test_func, None, wait=0.5, count=120)
+ assert result, "ISIS did not converge on {}:\n{}".format(rname, diff)
+
+
+def test_isis_route_installation():
+ "Check whether all expected routes are present"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Checking routers for installed ISIS vrf routes")
+ # Check for routes in 'show ip route vrf {}-cust1 json'
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_route.json".format(CWD, rname)
+ expected = json.loads(open(filename, "r").read())
+
+ def compare_routing_table(router, expected):
+ "Helper function to ensure zebra rib convergence"
+
+ actual = router.vtysh_cmd(
+ "show ip route vrf {0}-cust1 json".format(rname), isjson=True
+ )
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(compare_routing_table, router, expected)
+ (result, diff) = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ assertmsg = "Router '{}' routes mismatch diff: {}".format(rname, diff)
+ assert result, assertmsg
+
+
+def test_isis_linux_route_installation():
+ "Check whether all expected routes are present and installed in the OS"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.15")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ # iproute2 needs to support VRFs for this suite to run.
+ if not iproute2_is_vrf_capable():
+ pytest.skip("Installed iproute2 version does not support VRFs")
+
+ logger.info("Checking routers for installed ISIS vrf routes in OS")
+ # Check for routes in `ip route show vrf {}-cust1`
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_route_linux.json".format(CWD, rname)
+ expected = json.loads(open(filename, "r").read())
+ actual = topotest.ip4_vrf_route(router)
+ assertmsg = "Router '{}' OS routes mismatch".format(rname)
+ assert topotest.json_cmp(actual, expected) is None, assertmsg
+
+
+def test_isis_route6_installation():
+ "Check whether all expected routes are present"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Checking routers for installed ISIS vrf IPv6 routes")
+ # Check for routes in 'show ipv6 route vrf {}-cust1 json'
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_route6.json".format(CWD, rname)
+ expected = json.loads(open(filename, "r").read())
+
+ def compare_routing_table(router, expected):
+ "Helper function to ensure zebra rib convergence"
+ actual = router.vtysh_cmd(
+ "show ipv6 route vrf {}-cust1 json".format(rname), isjson=True
+ )
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(compare_routing_table, router, expected)
+ (result, diff) = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ assertmsg = "Router '{}' routes mismatch diff: ".format(rname, diff)
+ assert result, assertmsg
+
+
+def test_isis_linux_route6_installation():
+ "Check whether all expected routes are present and installed in the OS"
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.15")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ # iproute2 needs to support VRFs for this suite to run.
+ if not iproute2_is_vrf_capable():
+ pytest.skip("Installed iproute2 version does not support VRFs")
+
+ logger.info("Checking routers for installed ISIS vrf IPv6 routes in OS")
+ # Check for routes in `ip -6 route show vrf {}-cust1`
+ for rname, router in tgen.routers().items():
+ filename = "{0}/{1}/{1}_route6_linux.json".format(CWD, rname)
+ expected = json.loads(open(filename, "r").read())
+ actual = topotest.ip6_vrf_route(router)
+ assertmsg = "Router '{}' OS routes mismatch".format(rname)
+ assert topotest.json_cmp(actual, expected) is None, assertmsg
+
+
+def test_memory_leak():
+ "Run the memory leak test and report results."
+ tgen = get_topogen()
+ if not tgen.is_memleak_enabled():
+ pytest.skip("Memory leak test/report is disabled")
+
+ tgen.report_memory_leaks()
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
+
+
+#
+# Auxiliary functions
+#
+
+
+def dict_merge(dct, merge_dct):
+ """
+ Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
+ updating only top-level keys, dict_merge recurses down into dicts nested
+ to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
+ ``dct``.
+ :param dct: dict onto which the merge is executed
+ :param merge_dct: dct merged into dct
+ :return: None
+
+ Source:
+ https://gist.github.com/angstwad/bf22d1822c38a92ec0a9
+ """
+ for k, v in merge_dct.items():
+ if k in dct and isinstance(dct[k], dict) and topotest.is_mapping(merge_dct[k]):
+ dict_merge(dct[k], merge_dct[k])
+ else:
+ dct[k] = merge_dct[k]
+
+
+def parse_topology(lines, level):
+ """
+ Parse the output of 'show isis topology level-X' into a Python dict.
+ """
+ areas = {}
+ area = None
+ ipv = None
+ vertex_type_regex = "|".join(VERTEX_TYPE_LIST)
+
+ for line in lines:
+ area_match = re.match(r"Area (.+):", line)
+ if area_match:
+ area = area_match.group(1)
+ if area not in areas:
+ areas[area] = {level: {"ipv4": [], "ipv6": []}}
+ ipv = None
+ continue
+ elif area is None:
+ continue
+
+ if re.match(r"IS\-IS paths to level-. routers that speak IPv6", line):
+ ipv = "ipv6"
+ continue
+ if re.match(r"IS\-IS paths to level-. routers that speak IP", line):
+ ipv = "ipv4"
+ continue
+
+ item_match = re.match(
+ r"([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+) ([^\s]+)", line
+ )
+ if (
+ item_match is not None
+ and item_match.group(1) == "Vertex"
+ and item_match.group(2) == "Type"
+ and item_match.group(3) == "Metric"
+ and item_match.group(4) == "Next-Hop"
+ and item_match.group(5) == "Interface"
+ and item_match.group(6) == "Parent"
+ ):
+ # Skip header
+ continue
+
+ item_match = re.match(
+ r"([^\s]+) ({}) ([0]|([1-9][0-9]*)) ([^\s]+) ([^\s]+) ([^\s]+)".format(
+ vertex_type_regex
+ ),
+ line,
+ )
+ if item_match is not None:
+ areas[area][level][ipv].append(
+ {
+ "vertex": item_match.group(1),
+ "type": item_match.group(2),
+ "metric": item_match.group(3),
+ "next-hop": item_match.group(5),
+ "interface": item_match.group(6),
+ "parent": item_match.group(7),
+ }
+ )
+ continue
+
+ item_match = re.match(
+ r"([^\s]+) ({}) ([0]|([1-9][0-9]*)) ([^\s]+)".format(vertex_type_regex),
+ line,
+ )
+
+ if item_match is not None:
+ areas[area][level][ipv].append(
+ {
+ "vertex": item_match.group(1),
+ "type": item_match.group(2),
+ "metric": item_match.group(3),
+ "parent": item_match.group(5),
+ }
+ )
+ continue
+
+ item_match = re.match(r"([^\s]+)", line)
+ if item_match is not None:
+ areas[area][level][ipv].append({"vertex": item_match.group(1)})
+ continue
+
+ return areas
+
+
+def show_isis_topology(router):
+ """
+ Get the ISIS vrf topology in a dictionary format.
+
+ Sample:
+ {
+ 'area-name': {
+ 'level-1': [
+ {
+ 'vertex': 'r1'
+ }
+ ],
+ 'level-2': [
+ {
+ 'vertex': '10.0.0.1/24',
+ 'type': 'IP',
+ 'parent': '0',
+ 'metric': 'internal'
+ }
+ ]
+ },
+ 'area-name-2': {
+ 'level-2': [
+ {
+ "interface": "rX-ethY",
+ "metric": "Z",
+ "next-hop": "rA",
+ "parent": "rC(B)",
+ "type": "TE-IS",
+ "vertex": "rD"
+ }
+ ]
+ }
+ }
+ """
+ l1out = topotest.normalize_text(
+ router.vtysh_cmd("show isis vrf {}-cust1 topology level-1".format(router.name))
+ ).splitlines()
+ l2out = topotest.normalize_text(
+ router.vtysh_cmd("show isis vrf {}-cust1 topology level-2".format(router.name))
+ ).splitlines()
+
+ l1 = parse_topology(l1out, "level-1")
+ l2 = parse_topology(l2out, "level-2")
+
+ dict_merge(l1, l2)
+ return l1