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

Function emptyNet

examples/emptynet.py:13–40  ·  view source on GitHub ↗

Create an empty network and add nodes to it.

()

Source from the content-addressed store, hash-verified

11from mininet.log import setLogLevel, info
12
13def emptyNet():
14
15 "Create an empty network and add nodes to it."
16
17 net = Mininet( controller=Controller, waitConnected=True )
18
19 info( '*** Adding controller\n' )
20 net.addController( 'c0' )
21
22 info( '*** Adding hosts\n' )
23 h1 = net.addHost( 'h1', ip='10.0.0.1' )
24 h2 = net.addHost( 'h2', ip='10.0.0.2' )
25
26 info( '*** Adding switch\n' )
27 s3 = net.addSwitch( 's3' )
28
29 info( '*** Creating links\n' )
30 net.addLink( h1, s3 )
31 net.addLink( h2, s3 )
32
33 info( '*** Starting network\n')
34 net.start()
35
36 info( '*** Running CLI\n' )
37 CLI( net )
38
39 info( '*** Stopping network' )
40 net.stop()
41
42
43if __name__ == '__main__':

Callers 1

emptynet.pyFile · 0.85

Calls 8

addControllerMethod · 0.95
addHostMethod · 0.95
addSwitchMethod · 0.95
addLinkMethod · 0.95
startMethod · 0.95
stopMethod · 0.95
MininetClass · 0.90
CLIClass · 0.90

Tested by

no test coverage detected