MCPcopy Create free account
hub / github.com/mininet/mininet / multiControllerNet

Function multiControllerNet

examples/controllers2.py:20–59  ·  view source on GitHub ↗

Create a network from semi-scratch with multiple controllers.

()

Source from the content-addressed store, hash-verified

18from mininet.log import setLogLevel, info
19
20def multiControllerNet():
21 "Create a network from semi-scratch with multiple controllers."
22
23 net = Mininet( controller=Controller, switch=OVSSwitch,
24 waitConnected=True )
25
26 info( "*** Creating (reference) controllers\n" )
27 c1 = net.addController( 'c1', port=6633 )
28 c2 = net.addController( 'c2', port=6634 )
29
30 info( "*** Creating switches\n" )
31 s1 = net.addSwitch( 's1' )
32 s2 = net.addSwitch( 's2' )
33
34 info( "*** Creating hosts\n" )
35 hosts1 = [ net.addHost( 'h%d' % n ) for n in ( 3, 4 ) ]
36 hosts2 = [ net.addHost( 'h%d' % n ) for n in ( 5, 6 ) ]
37
38 info( "*** Creating links\n" )
39 for h in hosts1:
40 net.addLink( s1, h )
41 for h in hosts2:
42 net.addLink( s2, h )
43 net.addLink( s1, s2 )
44
45 info( "*** Starting network\n" )
46 net.build()
47 c1.start()
48 c2.start()
49 s1.start( [ c1 ] )
50 s2.start( [ c2 ] )
51
52 info( "*** Testing network\n" )
53 net.pingAll()
54
55 info( "*** Running CLI\n" )
56 CLI( net )
57
58 info( "*** Stopping network\n" )
59 net.stop()
60
61
62if __name__ == '__main__':

Callers 1

controllers2.pyFile · 0.85

Calls 10

addControllerMethod · 0.95
addSwitchMethod · 0.95
addHostMethod · 0.95
addLinkMethod · 0.95
buildMethod · 0.95
pingAllMethod · 0.95
stopMethod · 0.95
MininetClass · 0.90
CLIClass · 0.90
startMethod · 0.45

Tested by

no test coverage detected