]> git.puffer.fish Git - matthieu/frr.git/commitdiff
topotests: isis_topo1, use 'show isis topology json' command
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 14 Jun 2024 08:18:15 +0000 (10:18 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 21 Jun 2024 13:40:23 +0000 (15:40 +0200)
Add the json support from ISIS vty command.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
tests/topotests/isis_topo1/r1/r1_topology.json
tests/topotests/isis_topo1/r2/r2_topology.json
tests/topotests/isis_topo1/r3/r3_topology.json
tests/topotests/isis_topo1/r4/r4_topology.json
tests/topotests/isis_topo1/r5/r5_topology.json
tests/topotests/isis_topo1/test_isis_topo1.py

index 337d6bf5ef08ab5b6f6aa51240b6e259e6759af1..d52346df6f7a455d6848e92ffe8a94bd787d1a17 100644 (file)
@@ -1,96 +1,98 @@
-{
-  "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"
+[
+    {
+        "area": "1",
+        "algorithm": 0,
+        "level-1":  {
+            "ipv4-paths": [
+                {
+                    "Vertex": "r1"
+                }
+            ],
+            "ipv6-paths": [
+                {
+                    "Vertex": "r1"
+                }
+            ]
         },
-        {
-          "metric": "10",
-          "interface": "r1-eth0",
-          "next-hop": "r3",
-          "parent": "r3(4)",
-          "type": "IP6 internal",
-          "vertex": "2001:db8:f::3/128"
+        "level-2": {
+            "ipv4-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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"
+                }
+            ]
         }
-      ]
     }
-  }
-}
+]
index de90fb5a32d07ba8a083534a66225cd350a30660..d0a1f90fd081d4ff35434cff9aadbbfb9b983937 100644 (file)
@@ -1,96 +1,98 @@
-{
-  "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"
+[
+    {
+        "area": "1",
+        "algorithm": 0,
+        "level-1":  {
+            "ipv4-paths": [
+                {
+                    "Vertex": "r2"
+                }
+            ],
+            "ipv6-paths": [
+                {
+                    "Vertex": "r2"
+                }
+            ]
         },
-        {
-          "metric": "10",
-          "interface": "r2-eth0",
-          "next-hop": "r4",
-          "parent": "r4(4)",
-          "type": "IP6 internal",
-          "vertex": "2001:db8:f::4/128"
+        "level-2": {
+            "ipv4-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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"
+                }
+            ]
         }
-      ]
     }
-  }
-}
+]
index 2d36f9b427aa0b845a671a89a0025feeb20dcc18..9265e62786cf14cf3cc9c4830bed82adac296d60 100644 (file)
-{
-  "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"
+[
+    {
+        "area": "1",
+        "algorithm": 0,
+        "level-1":  {
+            "ipv4-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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"
+                }
+            ]
         }
-      ]
     }
-  }
-}
+]
index e7d78419127be0dde4362e8e7261aef135213e3f..240c7588fc1911f23477a08caa1665f5058edae2 100644 (file)
-{
-  "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"
+[
+    {
+        "area": "1",
+        "algorithm": 0,
+        "level-1":  {
+            "ipv4-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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"
+                }
+            ]
         }
-      ]
     }
-  }
-}
+]
index 3d887b7cea69e6196641584a444a24e4c5118841..37da1a08e3835f393fdc279944f8871f282d266e 100644 (file)
-{
-  "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"
+[
+    {
+        "area": "1",
+        "algorithm": 0,
+        "level-1":  {
+            "ipv4-paths": [
+                {
+                    "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-paths": [
+                {
+                    "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"
+                }
+            ]
         }
-      ],
-      "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": []
     }
-  }
-}
+]
index cea284963d1ed2b1415f0b12ad0dec5aa01658b1..8b6fb98612a132cc40fca45ce9b397a5c5cee9da 100644 (file)
@@ -120,19 +120,13 @@ def test_isis_convergence():
         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)
+            actual = json.loads(router.vtysh_cmd("show isis topology json"))
             return topotest.json_cmp(actual, expected)
 
         test_func = functools.partial(compare_isis_topology, router, expected)
@@ -845,52 +839,3 @@ def parse_topology(lines, level):
             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