def __init__(self, name, node, port=None, nsNode=None, nsDevice=None, mode=None, **params): """ """ self.name = name self.createTap() self.delayedMove = True if node.inNamespace: self.inRightNamespace = False else: self.inRightNamespace = True Intf.__init__(self, name, node, port, **params) allTBIntfs.append(self) self.nsNode = nsNode self.nsDevice = nsDevice self.mode = mode self.params = params self.nsInstalled = False self.tapbridge = ns.tap_bridge.TapBridge() if self.nsNode and self.nsDevice and (self.mode or self.node): self.nsInstall() if self.node and self.nsInstalled and self.isInstant( ): # instant mode to be implemented in ns-3 self.namespaceMove()
def __init__(self, name, node, port=None, nsNode=None, nsDevice=None, mode=None, **params): """name: interface name (e.g. h1-eth0) node: owning Mininet node (where this intf most likely lives) link: parent link if we're part of a link #TODO nsNode: underlying ns-3 node nsDevice: ns-3 device which the tap interface is bridged with mode: mode of TapBridge ns-3 device (UseLocal or UseBridge) other arguments are passed to config()""" self.name = name # Create a tap interface in the system, ns-3 TapBridge will connect to that interface later. self.createTap() # Set this Intf to be delayed move. This tells Mininet not to move the interface to the right # namespace during Intf.__init__(). Therefore, the interface must be moved manually later. # Actually, interfaces are moved right after the simulator thread start, in the start() global # function. self.delayedMove = True # If this node is running in its own namespace... if node.inNamespace: # ...this interface is not yet in the right namespace (it is in the root namespace just after # creation) and should be moved later. self.inRightNamespace = False else: # ...interface should stay in the root namespace, so it is in right namespace now. self.inRightNamespace = True # Initialize parent Intf object. Intf.__init__(self, name, node, port, **params) allTBIntfs.append(self) self.nsNode = nsNode self.nsDevice = nsDevice self.mode = mode self.params = params self.nsInstalled = False # Create TapBridge ns-3 device. self.tapbridge = ns.tap_bridge.TapBridge() # If ns-3 node and bridged ns-3 device are set and TapBridge mode is known... if self.nsNode and self.nsDevice and (self.mode or self.node): # ...call nsInstall(). self.nsInstall()
def __init__( self, name, node, port=None, nsNode=None, nsDevice=None, mode=None, **params ): """name: interface name (e.g. h1-eth0) node: owning Mininet node (where this intf most likely lives) link: parent link if we're part of a link #TODO nsNode: underlying ns-3 node nsDevice: ns-3 device which the tap interface is bridged with mode: mode of TapBridge ns-3 device (UseLocal or UseBridge) other arguments are passed to config()""" self.name = name # Create a tap interface in the system, ns-3 TapBridge will connect to that interface later. self.createTap() # Set this Intf to be delayed move. This tells Mininet not to move the interface to the right # namespace during Intf.__init__(). Therefore, the interface must be moved manually later. # Actually, interfaces are moved right after the simulator thread start, in the start() global # function. self.delayedMove = True # If this node is running in its own namespace... if node.inNamespace: # ...this interface is not yet in the right namespace (it is in the root namespace just after # creation) and should be moved later. self.inRightNamespace = False else: # ...interface should stay in the root namespace, so it is in right namespace now. self.inRightNamespace = True # Initialize parent Intf object. Intf.__init__( self, name, node, port , **params) allTBIntfs.append( self ) self.nsNode = nsNode self.nsDevice = nsDevice self.mode = mode self.params = params self.nsInstalled = False # Create TapBridge ns-3 device. self.tapbridge = ns.tap_bridge.TapBridge() # If ns-3 node and bridged ns-3 device are set and TapBridge mode is known... if self.nsNode and self.nsDevice and ( self.mode or self.node ): # ...call nsInstall(). self.nsInstall()
def __init__( self, name, node, port=None, nsNode=None, nsDevice=None, mode=None, **params ): """ """ self.name = name self.createTap() self.delayedMove = True if node.inNamespace: self.inRightNamespace = False else: self.inRightNamespace = True Intf.__init__( self, name, node, port , **params) allTBIntfs.append( self ) self.nsNode = nsNode self.nsDevice = nsDevice self.mode = mode self.params = params self.nsInstalled = False self.tapbridge = ns.tap_bridge.TapBridge() if self.nsNode and self.nsDevice and ( self.mode or self.node ): self.nsInstall() if self.node and self.nsInstalled and self.isInstant(): # instant mode to be implemented in ns-3 self.namespaceMove()