]> git.puffer.fish Git - mirror/frr.git/commitdiff
isis-topo1: test ISIS route installation
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 13 Dec 2017 21:56:30 +0000 (19:56 -0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:13 +0000 (20:22 -0500)
Check the 'show ip route json' output for installed ISIS routes.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
tests/topotests/isis-topo1/r1/r1_route.json [new file with mode: 0644]
tests/topotests/isis-topo1/r2/r2_route.json [new file with mode: 0644]
tests/topotests/isis-topo1/r3/r3_route.json [new file with mode: 0644]
tests/topotests/isis-topo1/r4/r4_route.json [new file with mode: 0644]
tests/topotests/isis-topo1/r5/r5_route.json [new file with mode: 0644]
tests/topotests/isis-topo1/test_isis_topo1.py

diff --git a/tests/topotests/isis-topo1/r1/r1_route.json b/tests/topotests/isis-topo1/r1/r1_route.json
new file mode 100644 (file)
index 0000000..6f5041e
--- /dev/null
@@ -0,0 +1,86 @@
+{
+  "10.0.10.0/24": [
+    {
+      "distance": 115,
+      "metric": 10,
+      "nexthops": [
+        {
+          "active": true,
+          "afi": "ipv4",
+          "fib": true,
+          "interfaceIndex": 2,
+          "interfaceName": "r1-eth0",
+          "ip": "10.0.20.1"
+        }
+      ],
+      "prefix": "10.0.10.0/24",
+      "protocol": "isis",
+      "selected": true
+    }
+  ],
+  "10.0.20.0/24": [
+    {
+      "distance": 115,
+      "metric": 10,
+      "nexthops": [
+        {
+          "afi": "ipv4",
+          "interfaceIndex": 2,
+          "interfaceName": "r1-eth0",
+          "ip": "10.0.20.1"
+        }
+      ],
+      "prefix": "10.0.20.0/24",
+      "protocol": "isis"
+    },
+    {
+      "nexthops": [
+        {
+          "active": true,
+          "directlyConnected": true,
+          "fib": true,
+          "interfaceIndex": 2,
+          "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,
+          "interfaceIndex": 1,
+          "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,
+          "interfaceIndex": 2,
+          "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/r2/r2_route.json b/tests/topotests/isis-topo1/r2/r2_route.json
new file mode 100644 (file)
index 0000000..3b14f16
--- /dev/null
@@ -0,0 +1,86 @@
+{
+  "10.0.11.0/24": [
+    {
+      "distance": 115,
+      "metric": 10,
+      "nexthops": [
+        {
+          "active": true,
+          "afi": "ipv4",
+          "fib": true,
+          "interfaceIndex": 2,
+          "interfaceName": "r2-eth0",
+          "ip": "10.0.21.1"
+        }
+      ],
+      "prefix": "10.0.11.0/24",
+      "protocol": "isis",
+      "selected": true
+    }
+  ],
+  "10.0.21.0/24": [
+    {
+      "distance": 115,
+      "metric": 10,
+      "nexthops": [
+        {
+          "afi": "ipv4",
+          "interfaceIndex": 2,
+          "interfaceName": "r2-eth0",
+          "ip": "10.0.21.1"
+        }
+      ],
+      "prefix": "10.0.21.0/24",
+      "protocol": "isis"
+    },
+    {
+      "nexthops": [
+        {
+          "active": true,
+          "directlyConnected": true,
+          "fib": true,
+          "interfaceIndex": 2,
+          "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,
+          "interfaceIndex": 1,
+          "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,
+          "interfaceIndex": 2,
+          "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/r3/r3_route.json b/tests/topotests/isis-topo1/r3/r3_route.json
new file mode 100644 (file)
index 0000000..d688e63
--- /dev/null
@@ -0,0 +1,173 @@
+{
+  "10.0.10.0/24": [
+    {
+      "distance": 115,
+      "metric": 10,
+      "nexthops": [
+        {
+          "afi": "ipv4",
+          "interfaceIndex": 3,
+          "interfaceName": "r3-eth1",
+          "ip": "10.0.10.1"
+        }
+      ],
+      "prefix": "10.0.10.0/24",
+      "protocol": "isis"
+    },
+    {
+      "nexthops": [
+        {
+          "active": true,
+          "directlyConnected": true,
+          "fib": true,
+          "interfaceIndex": 3,
+          "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,
+          "interfaceIndex": 3,
+          "interfaceName": "r3-eth1",
+          "ip": "10.0.10.1"
+        }
+      ],
+      "prefix": "10.0.11.0/24",
+      "protocol": "isis",
+      "selected": true
+    }
+  ],
+  "10.0.20.0/24": [
+    {
+      "distance": 115,
+      "metric": 10,
+      "nexthops": [
+        {
+          "afi": "ipv4",
+          "interfaceIndex": 2,
+          "interfaceName": "r3-eth0",
+          "ip": "10.0.20.2"
+        }
+      ],
+      "prefix": "10.0.20.0/24",
+      "protocol": "isis"
+    },
+    {
+      "nexthops": [
+        {
+          "active": true,
+          "directlyConnected": true,
+          "fib": true,
+          "interfaceIndex": 2,
+          "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,
+          "interfaceIndex": 3,
+          "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,
+          "interfaceIndex": 2,
+          "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,
+          "interfaceIndex": 1,
+          "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,
+          "interfaceIndex": 3,
+          "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,
+          "interfaceIndex": 3,
+          "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/r4/r4_route.json b/tests/topotests/isis-topo1/r4/r4_route.json
new file mode 100644 (file)
index 0000000..282565a
--- /dev/null
@@ -0,0 +1,83 @@
+{
+  "10.0.11.0/24": [
+    {
+      "nexthops": [
+        {
+          "active": true,
+          "directlyConnected": true,
+          "fib": true,
+          "interfaceIndex": 3,
+          "interfaceName": "r4-eth1"
+        }
+      ],
+      "prefix": "10.0.11.0/24",
+      "protocol": "connected",
+      "selected": true
+    }
+  ],
+  "10.0.21.0/24": [
+    {
+      "distance": 115,
+      "metric": 10,
+      "nexthops": [
+        {
+          "afi": "ipv4",
+          "interfaceIndex": 2,
+          "interfaceName": "r4-eth0",
+          "ip": "10.0.21.2"
+        }
+      ],
+      "prefix": "10.0.21.0/24",
+      "protocol": "isis"
+    },
+    {
+      "nexthops": [
+        {
+          "active": true,
+          "directlyConnected": true,
+          "fib": true,
+          "interfaceIndex": 2,
+          "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,
+          "interfaceIndex": 2,
+          "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,
+          "interfaceIndex": 1,
+          "interfaceName": "lo"
+        }
+      ],
+      "prefix": "10.254.0.4/32",
+      "protocol": "connected",
+      "selected": true
+    }
+  ]
+}
diff --git a/tests/topotests/isis-topo1/r5/r5_route.json b/tests/topotests/isis-topo1/r5/r5_route.json
new file mode 100644 (file)
index 0000000..5bdde09
--- /dev/null
@@ -0,0 +1,154 @@
+{
+  "10.0.10.0/24": [
+    {
+      "distance": 115,
+      "metric": 10,
+      "nexthops": [
+        {
+          "afi": "ipv4",
+          "interfaceIndex": 2,
+          "interfaceName": "r5-eth0",
+          "ip": "10.0.10.2"
+        }
+      ],
+      "prefix": "10.0.10.0/24",
+      "protocol": "isis"
+    },
+    {
+      "nexthops": [
+        {
+          "active": true,
+          "directlyConnected": true,
+          "fib": true,
+          "interfaceIndex": 2,
+          "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",
+          "interfaceIndex": 3,
+          "interfaceName": "r5-eth1",
+          "ip": "10.0.11.2"
+        }
+      ],
+      "prefix": "10.0.11.0/24",
+      "protocol": "isis"
+    },
+    {
+      "nexthops": [
+        {
+          "active": true,
+          "directlyConnected": true,
+          "fib": true,
+          "interfaceIndex": 3,
+          "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,
+          "interfaceIndex": 2,
+          "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,
+          "interfaceIndex": 3,
+          "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,
+          "interfaceIndex": 2,
+          "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,
+          "interfaceIndex": 3,
+          "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,
+          "interfaceIndex": 1,
+          "interfaceName": "lo"
+        }
+      ],
+      "prefix": "10.254.0.5/32",
+      "protocol": "connected",
+      "selected": true
+    }
+  ]
+}
index 1da2204225090975f636c70e7d0c2ba641c04903..1b03a8b26fd2928c0d5de1d5a65517b93215ed00 100644 (file)
@@ -133,6 +133,24 @@ def test_isis_convergence():
         assert topotest.json_cmp(actual, expected) is None, assertmsg
 
 
+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().iteritems():
+        filename = '{0}/{1}/{1}_route.json'.format(CWD, rname)
+        expected = json.loads(open(filename, 'r').read())
+        actual = router.vtysh_cmd('show ip route json', isjson=True)
+        assertmsg = "Router '{}' 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()