From cd68ea344792aa730cb89ae52b388360e3235f07 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 14 Jun 2024 10:18:15 +0200 Subject: [PATCH] topotests: isis_topo1, use 'show isis topology json' command Add the json support from ISIS vty command. Signed-off-by: Philippe Guibert --- .../topotests/isis_topo1/r1/r1_topology.json | 188 ++++----- .../topotests/isis_topo1/r2/r2_topology.json | 188 ++++----- .../topotests/isis_topo1/r3/r3_topology.json | 386 +++++++++--------- .../topotests/isis_topo1/r4/r4_topology.json | 386 +++++++++--------- .../topotests/isis_topo1/r5/r5_topology.json | 306 +++++++------- tests/topotests/isis_topo1/test_isis_topo1.py | 57 +-- 6 files changed, 731 insertions(+), 780 deletions(-) diff --git a/tests/topotests/isis_topo1/r1/r1_topology.json b/tests/topotests/isis_topo1/r1/r1_topology.json index 337d6bf5ef..d52346df6f 100644 --- a/tests/topotests/isis_topo1/r1/r1_topology.json +++ b/tests/topotests/isis_topo1/r1/r1_topology.json @@ -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" + } + ] } - ] } - } -} +] diff --git a/tests/topotests/isis_topo1/r2/r2_topology.json b/tests/topotests/isis_topo1/r2/r2_topology.json index de90fb5a32..d0a1f90fd0 100644 --- a/tests/topotests/isis_topo1/r2/r2_topology.json +++ b/tests/topotests/isis_topo1/r2/r2_topology.json @@ -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" + } + ] } - ] } - } -} +] diff --git a/tests/topotests/isis_topo1/r3/r3_topology.json b/tests/topotests/isis_topo1/r3/r3_topology.json index 2d36f9b427..9265e62786 100644 --- a/tests/topotests/isis_topo1/r3/r3_topology.json +++ b/tests/topotests/isis_topo1/r3/r3_topology.json @@ -1,194 +1,196 @@ -{ - "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" + } + ] } - ] } - } -} +] diff --git a/tests/topotests/isis_topo1/r4/r4_topology.json b/tests/topotests/isis_topo1/r4/r4_topology.json index e7d7841912..240c7588fc 100644 --- a/tests/topotests/isis_topo1/r4/r4_topology.json +++ b/tests/topotests/isis_topo1/r4/r4_topology.json @@ -1,194 +1,196 @@ -{ - "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" + } + ] } - ] } - } -} +] diff --git a/tests/topotests/isis_topo1/r5/r5_topology.json b/tests/topotests/isis_topo1/r5/r5_topology.json index 3d887b7cea..37da1a08e3 100644 --- a/tests/topotests/isis_topo1/r5/r5_topology.json +++ b/tests/topotests/isis_topo1/r5/r5_topology.json @@ -1,156 +1,154 @@ -{ - "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": [] } - } -} +] diff --git a/tests/topotests/isis_topo1/test_isis_topo1.py b/tests/topotests/isis_topo1/test_isis_topo1.py index cea284963d..8b6fb98612 100644 --- a/tests/topotests/isis_topo1/test_isis_topo1.py +++ b/tests/topotests/isis_topo1/test_isis_topo1.py @@ -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 -- 2.39.5