From 2b68f9019941c78b67a05f010d2171925a769fbe Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 16 Aug 2017 18:57:59 -0400 Subject: [PATCH 1/4] Allow topotests to work with eigrp and nhrp Signed-off-by: Donald Sharp --- lib/topotest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/topotest.py b/lib/topotest.py index 7872e7087a1c..f4ebc8429adc 100644 --- a/lib/topotest.py +++ b/lib/topotest.py @@ -364,7 +364,7 @@ def __init__(self, name, **params): self.routertype = 'frr' self.daemons = {'zebra': 0, 'ripd': 0, 'ripngd': 0, 'ospfd': 0, 'ospf6d': 0, 'isisd': 0, 'bgpd': 0, 'pimd': 0, - 'ldpd': 0} + 'ldpd': 0, 'eigrpd': 0, 'nhrpd': 0} def _config_frr(self, **params): "Configure FRR binaries" From 0f997eb449030bd9974f414a972c2dad9375ac3d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 16 Aug 2017 19:10:52 -0400 Subject: [PATCH 2/4] Add a basic EIGRP topology. Nothing fancy here, just add 3 routers in a row attempt to let eigrp come up and start a mininet xterm to debug, since eigrp doesn't work yet. Signed-off-by: Donald Sharp --- eigrp-topo1/r1/eigrpd.conf | 8 + eigrp-topo1/r1/show_ip_eigrp.ref | 10 + eigrp-topo1/r1/show_ip_route.ref | 3 + eigrp-topo1/r1/zebra.conf | 19 ++ eigrp-topo1/r2/eigrpd.conf | 7 + eigrp-topo1/r2/show_ip_route.ref | 2 + eigrp-topo1/r2/zebra.conf | 21 ++ eigrp-topo1/r3/eigrpd.conf | 6 + eigrp-topo1/r3/show_ip_route.ref | 1 + eigrp-topo1/r3/zebra.conf | 22 ++ eigrp-topo1/test_eigrp_topo1.dot | 62 ++++++ eigrp-topo1/test_eigrp_topo1.py | 372 +++++++++++++++++++++++++++++++ 12 files changed, 533 insertions(+) create mode 100644 eigrp-topo1/r1/eigrpd.conf create mode 100644 eigrp-topo1/r1/show_ip_eigrp.ref create mode 100644 eigrp-topo1/r1/show_ip_route.ref create mode 100644 eigrp-topo1/r1/zebra.conf create mode 100644 eigrp-topo1/r2/eigrpd.conf create mode 100644 eigrp-topo1/r2/show_ip_route.ref create mode 100644 eigrp-topo1/r2/zebra.conf create mode 100644 eigrp-topo1/r3/eigrpd.conf create mode 100644 eigrp-topo1/r3/show_ip_route.ref create mode 100644 eigrp-topo1/r3/zebra.conf create mode 100644 eigrp-topo1/test_eigrp_topo1.dot create mode 100755 eigrp-topo1/test_eigrp_topo1.py diff --git a/eigrp-topo1/r1/eigrpd.conf b/eigrp-topo1/r1/eigrpd.conf new file mode 100644 index 000000000000..6fd361afa6cc --- /dev/null +++ b/eigrp-topo1/r1/eigrpd.conf @@ -0,0 +1,8 @@ +log file /tmp/r1-eigrpd.log +! +router eigrp 1 + network 193.1.1.0/26 +! +line vty +! + diff --git a/eigrp-topo1/r1/show_ip_eigrp.ref b/eigrp-topo1/r1/show_ip_eigrp.ref new file mode 100644 index 000000000000..561560f23067 --- /dev/null +++ b/eigrp-topo1/r1/show_ip_eigrp.ref @@ -0,0 +1,10 @@ +Codes: R - RIP, C - connected, S - Static, O - OSPF, B - BGP +Sub-codes: + (n) - normal, (s) - static, (d) - default, (r) - redistribute, + (i) - interface + + Network Next Hop Metric From Tag Time +R(n) 192.168.2.0/24 193.1.1.2 3 193.1.1.2 0 XX:XX +R(n) 192.168.3.0/24 193.1.1.2 3 193.1.1.2 0 XX:XX +C(i) 193.1.1.0/26 0.0.0.0 1 self 0 +R(n) 193.1.2.0/24 193.1.1.2 2 193.1.1.2 0 XX:XX diff --git a/eigrp-topo1/r1/show_ip_route.ref b/eigrp-topo1/r1/show_ip_route.ref new file mode 100644 index 000000000000..62d71f0ab635 --- /dev/null +++ b/eigrp-topo1/r1/show_ip_route.ref @@ -0,0 +1,3 @@ +R>* 192.168.2.0/24 [120/3] via 193.1.1.2, r1-eth1 +R>* 192.168.3.0/24 [120/3] via 193.1.1.2, r1-eth1 +R>* 193.1.2.0/24 [120/2] via 193.1.1.2, r1-eth1 diff --git a/eigrp-topo1/r1/zebra.conf b/eigrp-topo1/r1/zebra.conf new file mode 100644 index 000000000000..4dc46c2c8bf6 --- /dev/null +++ b/eigrp-topo1/r1/zebra.conf @@ -0,0 +1,19 @@ +log file /tmp/r1-zebra.log +! +hostname r1 +! +interface r1-eth0 + ip address 192.168.1.1/24 +! +interface r1-eth1 + description to sw2 - RIPv2 interface + ip address 193.1.1.1/26 + no link-detect +! +ip forwarding +ipv6 forwarding +! +! +line vty +! + diff --git a/eigrp-topo1/r2/eigrpd.conf b/eigrp-topo1/r2/eigrpd.conf new file mode 100644 index 000000000000..3713b3d57841 --- /dev/null +++ b/eigrp-topo1/r2/eigrpd.conf @@ -0,0 +1,7 @@ +log file /tmp/r2-eigrpd.log +! +! +router eigrp 1 + network 193.1.1.0/26 + network 193.1.2.0/24 + diff --git a/eigrp-topo1/r2/show_ip_route.ref b/eigrp-topo1/r2/show_ip_route.ref new file mode 100644 index 000000000000..4b34939aa51f --- /dev/null +++ b/eigrp-topo1/r2/show_ip_route.ref @@ -0,0 +1,2 @@ +R>* 192.168.2.0/24 [120/2] via 193.1.2.2, r2-eth1 +R>* 192.168.3.0/24 [120/2] via 193.1.2.2, r2-eth1 diff --git a/eigrp-topo1/r2/zebra.conf b/eigrp-topo1/r2/zebra.conf new file mode 100644 index 000000000000..74f7bfec0617 --- /dev/null +++ b/eigrp-topo1/r2/zebra.conf @@ -0,0 +1,21 @@ +log file /tmp/r2-zebra.log +! +hostname r2 +! +interface r2-eth0 + description to sw2 - RIPv2 interface + ip address 193.1.1.2/26 + no link-detect +! +interface r2-eth1 + description to sw3 - RIPv1 interface + ip address 193.1.2.1/24 + no link-detect +! +ip forwarding +ipv6 forwarding +! +! +line vty +! + diff --git a/eigrp-topo1/r3/eigrpd.conf b/eigrp-topo1/r3/eigrpd.conf new file mode 100644 index 000000000000..10f939fa5bd4 --- /dev/null +++ b/eigrp-topo1/r3/eigrpd.conf @@ -0,0 +1,6 @@ +log file /tmp/r3-eigrpd.log +! +! +router eigrp 1 + network 193.1.2.0/24 + diff --git a/eigrp-topo1/r3/show_ip_route.ref b/eigrp-topo1/r3/show_ip_route.ref new file mode 100644 index 000000000000..835e1229c866 --- /dev/null +++ b/eigrp-topo1/r3/show_ip_route.ref @@ -0,0 +1 @@ +R>* 193.1.1.0/26 [120/2] via 193.1.2.1, r3-eth1 diff --git a/eigrp-topo1/r3/zebra.conf b/eigrp-topo1/r3/zebra.conf new file mode 100644 index 000000000000..1c79b36b3e2c --- /dev/null +++ b/eigrp-topo1/r3/zebra.conf @@ -0,0 +1,22 @@ +log file /tmp/r3-zebra.log +! +hostname r3 +! +interface r3-eth0 + description to sw4 - Stub interface + ip address 192.168.3.1/24 + no link-detect +! +interface r3-eth1 + description to sw3 - RIPv2 interface + ip address 193.1.2.2/24 + no link-detect +! +ip route 192.168.2.0/24 192.168.3.10 +! +ip forwarding +ipv6 forwarding +! +! +line vty +! diff --git a/eigrp-topo1/test_eigrp_topo1.dot b/eigrp-topo1/test_eigrp_topo1.dot new file mode 100644 index 000000000000..ca3a0fe5b9fc --- /dev/null +++ b/eigrp-topo1/test_eigrp_topo1.dot @@ -0,0 +1,62 @@ +## GraphViz file for test_eigrp_topo1 +## +## Color coding: +######################### +## Main FRR: #f08080 red +## Switches: #d0e0d0 gray +## RIP: #19e3d9 Cyan +## RIPng: #fcb314 dark yellow +## EIGRP: #696969 +## 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 test_eigrp_topo1 { + overlap=false; + constraint=false; + + // title + labelloc="t"; + label="Test Topologoy EIGRP Topo1"; + + ###################### + # Routers + ###################### + + # Main FRR Router with all protocols + R1 [shape=doubleoctagon, label="R1 FRR\nMain Router", fillcolor="#f08080", style=filled]; + + # EIGRP Routers + R2 [shape=doubleoctagon, label="R2 FRR\nEIGRP Router", fillcolor="#19e3d9", style=filled]; + R3 [shape=doubleoctagon, label="R3 FRR\nEIGRP Router", fillcolor="#19e3d9", style=filled]; + + ###################### + # Network Lists + ###################### + + SW1_R1_stub [label="SW1\n192.168.1.0/24", fillcolor="#d0e0d0", style=filled]; + + # EIGRP Networks + SW2_R1_R2 [label="SW2\nEIGRPv2\n193.1.1.0/26", fillcolor="#d0e0d0", style=filled]; + SW3_R2_R3 [label="SW3\nEIGRPv1\n193.1.2.0/24", fillcolor="#d0e0d0", style=filled]; + SW4_R3 [label="SW4\n192.168.3.0/24", fillcolor="#d0e0d0", style=filled]; + Net_R3_remote [label="Static Net\n192.168.2.0/24"]; + + ###################### + # Network Connections + ###################### + R1 -- SW1_R1_stub [label = "eth0\n.1\n::1"]; + + # EIGRP Network + R1 -- SW2_R1_R2 [label = "eth1\n.1"]; + SW2_R1_R2 -- R2 [label = "eth0\n.2"]; + R2 -- SW3_R2_R3 [label = "eth1\n.1"]; + SW3_R2_R3 -- R3 [label = "eth1\n.2"]; + R3 -- SW4_R3 [label = "eth0\n.1"]; + SW4_R3 -- Net_R3_remote [label = ".10"]; + +} diff --git a/eigrp-topo1/test_eigrp_topo1.py b/eigrp-topo1/test_eigrp_topo1.py new file mode 100755 index 000000000000..c73a40156d35 --- /dev/null +++ b/eigrp-topo1/test_eigrp_topo1.py @@ -0,0 +1,372 @@ +#!/usr/bin/env python + +# +# test_eigrp_topo1.py +# +# Copyright (c) 2017 by +# Cumulus Networks, Inc. +# Donald Sharp +# +# 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_eigrp_topo1.py: Testing EIGRP + +""" + +import os +import re +import sys +import difflib +import pytest +from time import sleep + +from mininet.topo import Topo +from mininet.net import Mininet +from mininet.node import Node, OVSSwitch, Host +from mininet.log import setLogLevel, info +from mininet.cli import CLI +from mininet.link import Intf + +from functools import partial + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from lib import topotest + +fatal_error = "" + + +##################################################### +## +## Network Topology Definition +## +##################################################### + +class NetworkTopo(Topo): + "EIGRP Topology 1" + + def build(self, **_opts): + + # Setup Routers + router = {} + # + # Setup Main Router + router[1] = topotest.addRouter(self, 'r1') + # + # Setup EIGRP Routers + for i in range(2, 4): + router[i] = topotest.addRouter(self, 'r%s' % i) + # + # Setup Switches + switch = {} + # + # On main router + # First switch is for a dummy interface (for local network) + switch[1] = self.addSwitch('sw1', cls=topotest.LegacySwitch) + self.addLink(switch[1], router[1], intfName2='r1-eth0') + # + # Switches for EIGRP + # switch 2 switch is for connection to EIGRP router + switch[2] = self.addSwitch('sw2', cls=topotest.LegacySwitch) + self.addLink(switch[2], router[1], intfName2='r1-eth1') + self.addLink(switch[2], router[2], intfName2='r2-eth0') + # switch 3 is between EIGRP routers + switch[3] = self.addSwitch('sw3', cls=topotest.LegacySwitch) + self.addLink(switch[3], router[2], intfName2='r2-eth1') + self.addLink(switch[3], router[3], intfName2='r3-eth1') + # switch 4 is stub on remote EIGRP router + switch[4] = self.addSwitch('sw4', cls=topotest.LegacySwitch) + self.addLink(switch[4], router[3], intfName2='r3-eth0') + + + +##################################################### +## +## Tests starting +## +##################################################### + +def setup_module(module): + global topo, net + + print("\n\n** %s: Setup Topology" % module.__name__) + print("******************************************\n") + + print("Cleanup old Mininet runs") + os.system('sudo mn -c > /dev/null 2>&1') + + thisDir = os.path.dirname(os.path.realpath(__file__)) + topo = NetworkTopo() + + net = Mininet(controller=None, topo=topo) + net.start() + + # Starting Routers + # + for i in range(1, 4): + net['r%s' % i].loadConf('zebra', '%s/r%s/zebra.conf' % (thisDir, i)) + net['r%s' % i].loadConf('eigrpd', '%s/r%s/eigrpd.conf' % (thisDir, i)) + net['r%s' % i].startRouter() + + # For debugging after starting Quagga/FRR daemons, uncomment the next line + CLI(net) + + +def teardown_module(module): + global net + + print("\n\n** %s: Shutdown Topology" % module.__name__) + print("******************************************\n") + + # End - Shutdown network + net.stop() + + +def test_router_running(): + global fatal_error + global net + + # Skip if previous fatal error condition is raised + if (fatal_error != ""): + pytest.skip(fatal_error) + + print("\n\n** Check if FRR/Quagga is running on each Router node") + print("******************************************\n") + sleep(5) + + # Make sure that all daemons are running + for i in range(1, 4): + fatal_error = net['r%s' % i].checkRouterRunning() + assert fatal_error == "", fatal_error + + # For debugging after starting FRR/Quagga daemons, uncomment the next line + # CLI(net) + + +def test_converge_protocols(): + global fatal_error + global net + + # Skip if previous fatal error condition is raised + if (fatal_error != ""): + pytest.skip(fatal_error) + + thisDir = os.path.dirname(os.path.realpath(__file__)) + + print("\n\n** Waiting for protocols convergence") + print("******************************************\n") + + # Not really implemented yet - just sleep 60 secs for now + sleep(60) + + # Make sure that all daemons are still running + for i in range(1, 4): + fatal_error = net['r%s' % i].checkRouterRunning() + assert fatal_error == "", fatal_error + + # For debugging after starting FRR/Quagga daemons, uncomment the next line + # CLI(net) + + +def test_eigrp_status(): + global fatal_error + global net + + # Skip if previous fatal error condition is raised + if (fatal_error != ""): + pytest.skip(fatal_error) + + thisDir = os.path.dirname(os.path.realpath(__file__)) + + # Verify EIGRP Status + print("\n\n** Verifing EIGRP status") + print("******************************************\n") + failures = 0 + for i in range(1, 4): + refTableFile = '%s/r%s/eigrp_status.ref' % (thisDir, i) + if os.path.isfile(refTableFile): + # Read expected result from file + expected = open(refTableFile).read().rstrip() + # Fix newlines (make them all the same) + expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + + # Actual output from router + actual = net['r%s' % i].cmd('vtysh -c "show ip eigrp topo" 2> /dev/null').rstrip() + # Drop time in next due + actual = re.sub(r"in [0-9]+ seconds", "in XX seconds", actual) + # Drop time in last update + actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual) + # Fix newlines (make them all the same) + actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + + # Generate Diff + diff = ''.join(difflib.context_diff(actual, expected, + fromfile="actual IP EIGRP status", + tofile="expected IP EIGRP status")) + + # Empty string if it matches, otherwise diff contains unified diff + if diff: + sys.stderr.write('r%s failed IP EIGRP status check:\n%s\n' % (i, diff)) + failures += 1 + else: + print("r%s ok" % i) + + assert failures == 0, "IP EIGRP status failed for router r%s:\n%s" % (i, diff) + + # Make sure that all daemons are still running + for i in range(1, 4): + fatal_error = net['r%s' % i].checkRouterRunning() + assert fatal_error == "", fatal_error + + # For debugging after starting FRR/Quagga daemons, uncomment the next line + # CLI(net) + + +def test_eigrp_routes(): + global fatal_error + global net + + # Skip if previous fatal error condition is raised + if (fatal_error != ""): + pytest.skip(fatal_error) + + thisDir = os.path.dirname(os.path.realpath(__file__)) + + # Verify EIGRP Status + print("\n\n** Verifing EIGRP routes") + print("******************************************\n") + failures = 0 + for i in range(1, 4): + refTableFile = '%s/r%s/show_ip_eigrp.ref' % (thisDir, i) + if os.path.isfile(refTableFile): + # Read expected result from file + expected = open(refTableFile).read().rstrip() + # Fix newlines (make them all the same) + expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + + # Actual output from router + actual = net['r%s' % i].cmd('vtysh -c "show ip eigrp" 2> /dev/null').rstrip() + # Drop Time + actual = re.sub(r"[0-9][0-9]:[0-5][0-9]", "XX:XX", actual) + # Fix newlines (make them all the same) + actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + + # Generate Diff + diff = ''.join(difflib.context_diff(actual, expected, + fromfile="actual SHOW IP EIGRP", + tofile="expected SHOW IP EIGRP")) + + # Empty string if it matches, otherwise diff contains unified diff + if diff: + sys.stderr.write('r%s failed SHOW IP EIGRP check:\n%s\n' % (i, diff)) + failures += 1 + else: + print("r%s ok" % i) + + assert failures == 0, "SHOW IP EIGRP failed for router r%s:\n%s" % (i, diff) + + # Make sure that all daemons are still running + for i in range(1, 4): + fatal_error = net['r%s' % i].checkRouterRunning() + assert fatal_error == "", fatal_error + + # For debugging after starting FRR/Quagga daemons, uncomment the next line + # CLI(net) + + +def test_zebra_ipv4_routingTable(): + global fatal_error + global net + + # Skip if previous fatal error condition is raised + if (fatal_error != ""): + pytest.skip(fatal_error) + + thisDir = os.path.dirname(os.path.realpath(__file__)) + + # Verify OSPFv3 Routing Table + print("\n\n** Verifing Zebra IPv4 Routing Table") + print("******************************************\n") + failures = 0 + for i in range(1, 4): + refTableFile = '%s/r%s/show_ip_route.ref' % (thisDir, i) + if os.path.isfile(refTableFile): + # Read expected result from file + expected = open(refTableFile).read().rstrip() + # Fix newlines (make them all the same) + expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + + # Actual output from router + actual = net['r%s' % i].cmd('vtysh -c "show ip route" 2> /dev/null | grep "^R"').rstrip() + # Drop timers on end of line (older Quagga Versions) + actual = re.sub(r", [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", "", actual) + # Fix newlines (make them all the same) + actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + + # Generate Diff + diff = ''.join(difflib.context_diff(actual, expected, + fromfile="actual Zebra IPv4 routing table", + tofile="expected Zebra IPv4 routing table")) + + # Empty string if it matches, otherwise diff contains unified diff + if diff: + sys.stderr.write('r%s failed Zebra IPv4 Routing Table Check:\n%s\n' % (i, diff)) + failures += 1 + else: + print("r%s ok" % i) + + assert failures == 0, "Zebra IPv4 Routing Table verification failed for router r%s:\n%s" % (i, diff) + + # Make sure that all daemons are still running + for i in range(1, 4): + fatal_error = net['r%s' % i].checkRouterRunning() + assert fatal_error == "", fatal_error + + # For debugging after starting FRR/Quagga daemons, uncomment the next line + # CLI(net) + + +def test_shutdown_check_stderr(): + global fatal_error + global net + + # Skip if previous fatal error condition is raised + if (fatal_error != ""): + pytest.skip(fatal_error) + + if os.environ.get('TOPOTESTS_CHECK_STDERR') is None: + pytest.skip('Skipping test for Stderr output and memory leaks') + + thisDir = os.path.dirname(os.path.realpath(__file__)) + + print("\n\n** Verifing unexpected STDERR output from daemons") + print("******************************************\n") + + net['r1'].stopRouter() + + log = net['r1'].getStdErr('eigrpd') + print("\nEIGRPd StdErr Log:\n" + log) + log = net['r1'].getStdErr('zebra') + print("\nZebra StdErr Log:\n" + log) + + +if __name__ == '__main__': + + setLogLevel('info') + # To suppress tracebacks, either use the following pytest call or add "--tb=no" to cli + # retval = pytest.main(["-s", "--tb=no"]) + retval = pytest.main(["-s"]) + sys.exit(retval) From de5e5b180455d0d5351614a07e01d8489d40d0e5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 16 Aug 2017 19:22:22 -0400 Subject: [PATCH 3/4] Exclude eigrp test from running normally yet Signed-off-by: Donald Sharp --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 9dbe3834c243..1857c2237cfe 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ # Skip pytests example directory [pytest] -norecursedirs = .git example-test +norecursedirs = .git example-test eigrp-topo1 [topogen] # Default configuration values From 5e590c4e3c11e5be662e5118d932d933db1092c9 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 18 Aug 2017 15:37:24 -0400 Subject: [PATCH 4/4] Basic EIGRP topo test working Signed-off-by: Donald Sharp --- eigrp-topo1/r1/show_ip_eigrp.ref | 18 ++++----- eigrp-topo1/r1/show_ip_route.ref | 12 ++++-- eigrp-topo1/r2/show_ip_route.ref | 11 +++++- eigrp-topo1/r3/show_ip_route.ref | 11 +++++- eigrp-topo1/test_eigrp_topo1.py | 64 ++------------------------------ 5 files changed, 41 insertions(+), 75 deletions(-) diff --git a/eigrp-topo1/r1/show_ip_eigrp.ref b/eigrp-topo1/r1/show_ip_eigrp.ref index 561560f23067..190a570df162 100644 --- a/eigrp-topo1/r1/show_ip_eigrp.ref +++ b/eigrp-topo1/r1/show_ip_eigrp.ref @@ -1,10 +1,10 @@ -Codes: R - RIP, C - connected, S - Static, O - OSPF, B - BGP -Sub-codes: - (n) - normal, (s) - static, (d) - default, (r) - redistribute, - (i) - interface - Network Next Hop Metric From Tag Time -R(n) 192.168.2.0/24 193.1.1.2 3 193.1.1.2 0 XX:XX -R(n) 192.168.3.0/24 193.1.1.2 3 193.1.1.2 0 XX:XX -C(i) 193.1.1.0/26 0.0.0.0 1 self 0 -R(n) 193.1.2.0/24 193.1.1.2 2 193.1.1.2 0 XX:XX +EIGRP Topology Table for AS(1)/ID(193.1.1.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply + r - reply Status, s - sia Status + +P 193.1.1.0/26, 1 successors, FD is 28160, serno: 0 + via Connected, r1-eth1 +P 193.1.2.0/24, 1 successors, FD is 30720, serno: 0 + via 193.1.1.2 (30720/28160), r1-eth1 diff --git a/eigrp-topo1/r1/show_ip_route.ref b/eigrp-topo1/r1/show_ip_route.ref index 62d71f0ab635..2e81211667b9 100644 --- a/eigrp-topo1/r1/show_ip_route.ref +++ b/eigrp-topo1/r1/show_ip_route.ref @@ -1,3 +1,9 @@ -R>* 192.168.2.0/24 [120/3] via 193.1.1.2, r1-eth1 -R>* 192.168.3.0/24 [120/3] via 193.1.1.2, r1-eth1 -R>* 193.1.2.0/24 [120/2] via 193.1.1.2, r1-eth1 +Codes: K - kernel route, C - connected, S - static, R - RIP, + O - OSPF, I - IS-IS, B - BGP, P - PIM, E - EIGRP, N - NHRP, + T - Table, v - VNC, V - VNC-Direct, A - Babel, + > - selected route, * - FIB route + +C>* 192.168.1.0/24 is directly connected, r1-eth0 +E 193.1.1.0/26 [0/0] is directly connected, r1-eth1 +C>* 193.1.1.0/26 is directly connected, r1-eth1 +E>* 193.1.2.0/24 [0/0] via 193.1.1.2, r1-eth1 diff --git a/eigrp-topo1/r2/show_ip_route.ref b/eigrp-topo1/r2/show_ip_route.ref index 4b34939aa51f..c82247fb1e4c 100644 --- a/eigrp-topo1/r2/show_ip_route.ref +++ b/eigrp-topo1/r2/show_ip_route.ref @@ -1,2 +1,9 @@ -R>* 192.168.2.0/24 [120/2] via 193.1.2.2, r2-eth1 -R>* 192.168.3.0/24 [120/2] via 193.1.2.2, r2-eth1 +Codes: K - kernel route, C - connected, S - static, R - RIP, + O - OSPF, I - IS-IS, B - BGP, P - PIM, E - EIGRP, N - NHRP, + T - Table, v - VNC, V - VNC-Direct, A - Babel, + > - selected route, * - FIB route + +E 193.1.1.0/26 [0/0] is directly connected, r2-eth0 +C>* 193.1.1.0/26 is directly connected, r2-eth0 +E 193.1.2.0/24 [0/0] is directly connected, r2-eth1 +C>* 193.1.2.0/24 is directly connected, r2-eth1 diff --git a/eigrp-topo1/r3/show_ip_route.ref b/eigrp-topo1/r3/show_ip_route.ref index 835e1229c866..ce1fcf71369c 100644 --- a/eigrp-topo1/r3/show_ip_route.ref +++ b/eigrp-topo1/r3/show_ip_route.ref @@ -1 +1,10 @@ -R>* 193.1.1.0/26 [120/2] via 193.1.2.1, r3-eth1 +Codes: K - kernel route, C - connected, S - static, R - RIP, + O - OSPF, I - IS-IS, B - BGP, P - PIM, E - EIGRP, N - NHRP, + T - Table, v - VNC, V - VNC-Direct, A - Babel, + > - selected route, * - FIB route + +S>* 192.168.2.0/24 [1/0] via 192.168.3.10, r3-eth0 +C>* 192.168.3.0/24 is directly connected, r3-eth0 +E>* 193.1.1.0/26 [0/0] via 193.1.2.1, r3-eth1 +E 193.1.2.0/24 [0/0] is directly connected, r3-eth1 +C>* 193.1.2.0/24 is directly connected, r3-eth1 diff --git a/eigrp-topo1/test_eigrp_topo1.py b/eigrp-topo1/test_eigrp_topo1.py index c73a40156d35..02dcf23ffc84 100755 --- a/eigrp-topo1/test_eigrp_topo1.py +++ b/eigrp-topo1/test_eigrp_topo1.py @@ -122,7 +122,7 @@ def setup_module(module): net['r%s' % i].startRouter() # For debugging after starting Quagga/FRR daemons, uncomment the next line - CLI(net) + # CLI(net) def teardown_module(module): @@ -170,61 +170,7 @@ def test_converge_protocols(): print("******************************************\n") # Not really implemented yet - just sleep 60 secs for now - sleep(60) - - # Make sure that all daemons are still running - for i in range(1, 4): - fatal_error = net['r%s' % i].checkRouterRunning() - assert fatal_error == "", fatal_error - - # For debugging after starting FRR/Quagga daemons, uncomment the next line - # CLI(net) - - -def test_eigrp_status(): - global fatal_error - global net - - # Skip if previous fatal error condition is raised - if (fatal_error != ""): - pytest.skip(fatal_error) - - thisDir = os.path.dirname(os.path.realpath(__file__)) - - # Verify EIGRP Status - print("\n\n** Verifing EIGRP status") - print("******************************************\n") - failures = 0 - for i in range(1, 4): - refTableFile = '%s/r%s/eigrp_status.ref' % (thisDir, i) - if os.path.isfile(refTableFile): - # Read expected result from file - expected = open(refTableFile).read().rstrip() - # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) - - # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show ip eigrp topo" 2> /dev/null').rstrip() - # Drop time in next due - actual = re.sub(r"in [0-9]+ seconds", "in XX seconds", actual) - # Drop time in last update - actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual) - # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) - - # Generate Diff - diff = ''.join(difflib.context_diff(actual, expected, - fromfile="actual IP EIGRP status", - tofile="expected IP EIGRP status")) - - # Empty string if it matches, otherwise diff contains unified diff - if diff: - sys.stderr.write('r%s failed IP EIGRP status check:\n%s\n' % (i, diff)) - failures += 1 - else: - print("r%s ok" % i) - - assert failures == 0, "IP EIGRP status failed for router r%s:\n%s" % (i, diff) + sleep(5) # Make sure that all daemons are still running for i in range(1, 4): @@ -258,7 +204,7 @@ def test_eigrp_routes(): expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show ip eigrp" 2> /dev/null').rstrip() + actual = net['r%s' % i].cmd('vtysh -c "show ip eigrp topo" 2> /dev/null').rstrip() # Drop Time actual = re.sub(r"[0-9][0-9]:[0-5][0-9]", "XX:XX", actual) # Fix newlines (make them all the same) @@ -310,9 +256,7 @@ def test_zebra_ipv4_routingTable(): expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show ip route" 2> /dev/null | grep "^R"').rstrip() - # Drop timers on end of line (older Quagga Versions) - actual = re.sub(r", [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", "", actual) + actual = net['r%s' % i].cmd('vtysh -c "show ip route"').rstrip() # Fix newlines (make them all the same) actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1)