Basic EIGRP topo test working

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-08-18 15:37:24 -04:00
parent 1fccd8e958
commit 2dad85f432
5 changed files with 41 additions and 75 deletions

View File

@ -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 EIGRP Topology Table for AS(1)/ID(193.1.1.1)
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 Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply
C(i) 193.1.1.0/26 0.0.0.0 1 self 0 r - reply Status, s - sia Status
R(n) 193.1.2.0/24 193.1.1.2 2 193.1.1.2 0 XX:XX
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

View File

@ -1,3 +1,9 @@
R>* 192.168.2.0/24 [120/3] via 193.1.1.2, r1-eth1 Codes: K - kernel route, C - connected, S - static, R - RIP,
R>* 192.168.3.0/24 [120/3] via 193.1.1.2, r1-eth1 O - OSPF, I - IS-IS, B - BGP, P - PIM, E - EIGRP, N - NHRP,
R>* 193.1.2.0/24 [120/2] via 193.1.1.2, r1-eth1 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

View File

@ -1,2 +1,9 @@
R>* 192.168.2.0/24 [120/2] via 193.1.2.2, r2-eth1 Codes: K - kernel route, C - connected, S - static, R - RIP,
R>* 192.168.3.0/24 [120/2] via 193.1.2.2, r2-eth1 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

View File

@ -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

View File

@ -122,7 +122,7 @@ def setup_module(module):
net['r%s' % i].startRouter() net['r%s' % i].startRouter()
# For debugging after starting Quagga/FRR daemons, uncomment the next line # For debugging after starting Quagga/FRR daemons, uncomment the next line
CLI(net) # CLI(net)
def teardown_module(module): def teardown_module(module):
@ -170,61 +170,7 @@ def test_converge_protocols():
print("******************************************\n") print("******************************************\n")
# Not really implemented yet - just sleep 60 secs for now # Not really implemented yet - just sleep 60 secs for now
sleep(60) sleep(5)
# 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 # Make sure that all daemons are still running
for i in range(1, 4): for i in range(1, 4):
@ -258,7 +204,7 @@ def test_eigrp_routes():
expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1)
# Actual output from router # 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 # Drop Time
actual = re.sub(r"[0-9][0-9]:[0-5][0-9]", "XX:XX", actual) actual = re.sub(r"[0-9][0-9]:[0-5][0-9]", "XX:XX", actual)
# Fix newlines (make them all the same) # Fix newlines (make them all the same)
@ -310,9 +256,7 @@ def test_zebra_ipv4_routingTable():
expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1)
# Actual output from router # Actual output from router
actual = net['r%s' % i].cmd('vtysh -c "show ip route" 2> /dev/null | grep "^R"').rstrip() actual = net['r%s' % i].cmd('vtysh -c "show ip route"').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) # Fix newlines (make them all the same)
actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1)