def __init__(self, name, node=None, port=None, link=None, mac=None, **params): """name: interface name (e.g. h1-eth0) node: owning node (where this intf most likely lives) link: parent link if we're part of a link other arguments are passed to config()""" self.node = node self.name = name self.link = link self.mac = mac self.ip, self.prefixLen = None, None # if interface is lo, we know the ip is 127.0.0.1. # This saves an ifconfig command per node if self.name == "lo": self.ip = "127.0.0.1" self.prefixLen = 8 # Add to node (and move ourselves if necessary ) moveIntfFn = params.pop("moveIntfFn", None) if moveIntfFn: node.addIntf(self, port=port, moveIntfFn=moveIntfFn) else: node.addIntf(self, port=port) # Save params for future reference self.params = params self.config(**params)
def __init__( self, name, node=None, port=None, link=None, mac=None, **params ): """name: interface name (e.g. h1-eth0) node: owning node (where this intf most likely lives) link: parent link if we're part of a link other arguments are passed to config()""" self.node = node self.name = name self.link = link self.port = port self.mac = mac self.iface = -1 self.sta = None self.ip, self.prefixLen = None, None # if interface is lo, we know the ip is 127.0.0.1. # This saves an ifconfig command per node if self.name == 'lo': self.ip = '127.0.0.1' # Add to node (and move ourselves if necessary ) moveIntfFn = params.pop( 'moveIntfFn', None ) #if self not in node.linksWifi: if moveIntfFn: node.addIntf( self, port=port, moveIntfFn=moveIntfFn) else: node.addIntf( self, port=port ) # Save params for future reference self.params = params self.config( **params )