def run(): OVSSwitch.setup() setLogLevel('debug') net = Mininet(topo=KeepForwardingSmartDownlinkTestTopo(), switch=OVSSwitch, controller=RemoteController) net.start() CLI(net) net.stop()
def run(): OVSSwitch.setup() setLogLevel('debug') net = Mininet( topo=FailoverTestTopo(), switch=OVSSwitch, controller=RemoteController) net.start() CLI(net) net.stop()
class testNumberedports(unittest.TestCase): @unittest.skipIf(OVSSwitch.setup() or OVSSwitch.isOldOVS(), "old version of OVS") def testConsistency(self): """verify consistency between mininet and ovs ports""" p = pexpect.spawn('python -m mininet.examples.numberedports') opts = [ 'Validating that s1-eth\d is actually on port \d ... Validated.', 'Validating that s1-eth\d is actually on port \d ... WARNING', pexpect.EOF ] correct_ports = True count = 0 while True: index = p.expect(opts) if index == 0: count += 1 elif index == 1: correct_ports = False elif index == 2: self.assertNotEqual(0, count) break self.assertTrue(correct_ports) def testNumbering(self): """verify that all of the port numbers are printed correctly and consistent with their interface""" p = pexpect.spawn('python -m mininet.examples.numberedports') opts = ['s1-eth(\d+) : (\d+)', pexpect.EOF] count_intfs = 0 while True: index = p.expect(opts) if index == 0: count_intfs += 1 intfport = p.match.group(1) ofport = p.match.group(2) self.assertEqual(intfport, ofport) elif index == 1: break self.assertNotEqual(0, count_intfs)
h1 = self.addHost('h1', ip='10.0.1.2/24', defaultRoute='via 10.0.1.1') h2 = self.addHost('h2', ip='10.0.9.2/24', defaultRoute='via 10.0.9.1') s = [ self.addSwitch('s%d' % (i + 1), protocols=OFP) for i in range(0, 6) ] self.addLink(h1, s[0]) self.addLink(h2, s[5]) graph = [[0, 1, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0], [1, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0]] for i in range(0, 6): for j in range(i + 1, 6): if graph[i][j] == 1: self.addLink(s[i], s[j]) if __name__ == '__main__': OVSSwitch.setup() setLogLevel('debug') net = Mininet(topo=KeepForwardingSmartUplinkTestTopo(), switch=OVSSwitch, controller=RemoteController) net.start() CLI(net) net.stop()