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 #!/usr/bin/env python
# #
# ospf6-test1.py # test_ospf6_topo1.py
# Part of NetDEF Topology Tests # Part of NetDEF Topology Tests
# #
# Copyright (c) 2016 by # Copyright (c) 2016 by
@ -72,9 +72,9 @@ test_ospf6_topo1.py:
import os import os
import re import re
import StringIO
import sys import sys
import difflib import difflib
import StringIO
from mininet.topo import Topo from mininet.topo import Topo
from mininet.net import Mininet from mininet.net import Mininet
@ -98,6 +98,7 @@ def int2dpid(dpid):
raise Exception('Unable to derive default datapath ID - ' raise Exception('Unable to derive default datapath ID - '
'please either specify a dpid or use a ' 'please either specify a dpid or use a '
'canonical switch name such as s23.') 'canonical switch name such as s23.')
class LinuxRouter(Node): class LinuxRouter(Node):
"A Node with IPv4/IPv6 forwarding enabled." "A Node with IPv4/IPv6 forwarding enabled."
@ -247,6 +248,9 @@ def setup_module(module):
print("\n\n** %s: Setup Topology" % module.__name__) print("\n\n** %s: Setup Topology" % module.__name__)
print("******************************************\n") print("******************************************\n")
print("Cleanup old Mininet runs")
os.system('sudo mn -c > /dev/null 2>&1')
thisDir = os.path.dirname(os.path.realpath(__file__)) thisDir = os.path.dirname(os.path.realpath(__file__))
topo = NetworkTopo() topo = NetworkTopo()
@ -352,8 +356,7 @@ def test_ospf6_routingTable():
actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1)
# Generate Diff # Generate Diff
diff=difflib.unified_diff(actual, expected) diff = ''.join(difflib.unified_diff(actual, expected))
diff=''.join(diff)
# Empty string if it matches, otherwise diff contains unified diff # Empty string if it matches, otherwise diff contains unified diff
if diff: if diff: