ospf6-topo1: Code cleanup

This commit is contained in:
Martin Winter 2016-11-24 03:56:05 -08:00 committed by Donald Sharp
parent 50bd94cd20
commit 68a655673f

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# ospf6-test1.py
# test_ospf6_topo1.py
# Part of NetDEF Topology Tests
#
# Copyright (c) 2016 by
@ -72,9 +72,9 @@ test_ospf6_topo1.py:
import os
import re
import StringIO
import sys
import difflib
import StringIO
from mininet.topo import Topo
from mininet.net import Mininet
@ -98,6 +98,7 @@ def int2dpid(dpid):
raise Exception('Unable to derive default datapath ID - '
'please either specify a dpid or use a '
'canonical switch name such as s23.')
class LinuxRouter(Node):
"A Node with IPv4/IPv6 forwarding enabled."
@ -244,9 +245,12 @@ class NetworkTopo(Topo):
def setup_module(module):
global topo, net
print ("\n\n** %s: Setup Topology" % module.__name__)
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()
@ -269,7 +273,7 @@ def setup_module(module):
def teardown_module(module):
global net
print ("\n\n** %s: Shutdown Topology" % module.__name__)
print("\n\n** %s: Shutdown Topology" % module.__name__)
print("******************************************\n")
# End - Shutdown network
@ -279,7 +283,7 @@ def teardown_module(module):
def test_quagga_running():
global net
print ("\n\n** Check if Quagga is running on each Router node")
print("\n\n** Check if Quagga is running on each Router node")
print("******************************************\n")
sleep(5)
@ -352,8 +356,7 @@ def test_ospf6_routingTable():
actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1)
# Generate Diff
diff=difflib.unified_diff(actual, expected)
diff=''.join(diff)
diff = ''.join(difflib.unified_diff(actual, expected))
# Empty string if it matches, otherwise diff contains unified diff
if diff: