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

Method __init__

mininet/net.py:118–178  ·  view source on GitHub ↗

Create Mininet object. topo: Topo (topology) object or None switch: default Switch class host: default Host class/constructor controller: default Controller class/constructor link: default Link class/constructor intf: default Intf cla

( self, topo=None, switch=OVSKernelSwitch, host=Host,
                  controller=DefaultController, link=Link, intf=Intf,
                  build=True, xterms=False, cleanup=False, ipBase='10.0.0.0/8',
                  inNamespace=False,
                  autoSetMacs=False, autoStaticArp=False, autoPinCpus=False,
                  listenPort=None, waitConnected=False )

Source from the content-addressed store, hash-verified

116
117 # pylint: disable=too-many-arguments
118 def __init__( self, topo=None, switch=OVSKernelSwitch, host=Host,
119 controller=DefaultController, link=Link, intf=Intf,
120 build=True, xterms=False, cleanup=False, ipBase='10.0.0.0/8',
121 inNamespace=False,
122 autoSetMacs=False, autoStaticArp=False, autoPinCpus=False,
123 listenPort=None, waitConnected=False ):
124 """Create Mininet object.
125 topo: Topo (topology) object or None
126 switch: default Switch class
127 host: default Host class/constructor
128 controller: default Controller class/constructor
129 link: default Link class/constructor
130 intf: default Intf class/constructor
131 ipBase: base IP address for hosts,
132 build: build now from topo?
133 xterms: if build now, spawn xterms?
134 cleanup: if build now, cleanup before creating?
135 inNamespace: spawn switches and controller in net namespaces?
136 autoSetMacs: set MAC addrs automatically like IP addresses?
137 autoStaticArp: set all-pairs static MAC addrs?
138 autoPinCpus: pin hosts to (real) cores (requires CPULimitedHost)?
139 listenPort: base listening port to open; will be incremented for
140 each additional switch in the net if inNamespace=False
141 waitConnected: wait for switches to Connect?
142 (False; True/None=wait indefinitely; time(s)=timed wait)"""
143 self.topo = topo
144 self.switch = switch
145 self.host = host
146 self.controller = controller
147 self.link = link
148 self.intf = intf
149 self.ipBase = ipBase
150 self.ipBaseNum, self.prefixLen = netParse( self.ipBase )
151 hostIP = ( 0xffffffff >> self.prefixLen ) & self.ipBaseNum
152 # Start for address allocation
153 self.nextIP = hostIP if hostIP > 0 else 1
154 self.inNamespace = inNamespace
155 self.xterms = xterms
156 self.cleanup = cleanup
157 self.autoSetMacs = autoSetMacs
158 self.autoStaticArp = autoStaticArp
159 self.autoPinCpus = autoPinCpus
160 self.numCores = numCores()
161 self.nextCore = 0 # next core for pinning hosts to CPUs
162 self.listenPort = listenPort
163 self.waitConn = waitConnected
164
165 self.hosts = []
166 self.switches = []
167 self.controllers = []
168 self.links = []
169
170 self.nameToNode = {} # name to Node (Host/Switch) objects
171
172 self.terms = [] # list of spawned xterm processes
173
174 Mininet.init() # Initialize Mininet if necessary
175

Callers

nothing calls this directly

Calls 4

buildMethod · 0.95
netParseFunction · 0.90
numCoresFunction · 0.90
initMethod · 0.45

Tested by

no test coverage detected