def makeIntfPair(cls, intf1, intf2): """Create pair of interfaces intf1: name of interface 1 intf2: name of interface 2 (override this class method [and possibly delete()] to change link type)""" makeIntfPair(intf1, intf2)
def makeIntfPair( cls, intf1, intf2 ): """Create pair of interfaces intf1: name of interface 1 intf2: name of interface 2 (override this class method [and possibly delete()] to change link type)""" makeIntfPair( intf1, intf2 )
def makeIntfPair(cls, intfname1, intfname2, addr1=None, addr2=None, node1=None, node2=None, deleteIntfs=True): """Create pair of interfaces intfname1: name for interface 1 intfname2: name for interface 2 addr1: MAC address for interface 1 (optional) addr2: MAC address for interface 2 (optional) node1: home node for interface 1 (optional) node2: home node for interface 2 (optional) (override this method [and possibly delete()] to change link type)""" # Leave this as a class method for now assert cls return makeIntfPair(intfname1, intfname2, addr1, addr2, node1, node2, deleteIntfs=deleteIntfs)
def makeIntfPair(cls, intfname1, intfname2, addr1=None, addr2=None, node1=None, node2=None, deleteIntfs=True): """Create pair of interfaces intfname1: name for interface 1 intfname2: name for interface 2 addr1: MAC address for interface 1 (optional) addr2: MAC address for interface 2 (optional) node1: home node for interface 1 (optional) node2: home node for interface 2 (optional) (override this method [and possibly delete()] to change link type)""" # Leave this as a class method for now assert cls return makeIntfPair( intfname1, intfname2, addr1, addr2, node1, node2, deleteIntfs=deleteIntfs)
def makeIntfPair( _cls, intfname1, intfname2, addr1=None, addr2=None ): """Create pair of interfaces intfname1: name of interface 1 intfname2: name of interface 2 (override this method [and possibly delete()] to change link type)""" return makeIntfPair( intfname1, intfname2, addr1, addr2 )
def create_mirror_interface(self, port, delete=False): """Create/delete a mirror interface for the given port""" mirror_intf_name = self.topology.mirror_iface_name(port) mirror_intf_peer = mirror_intf_name + '-ext' mirror_port = self.topology.mirror_port(port) if delete: LOGGER.info('Deleting mirror pair %s <-> %s', mirror_intf_name, mirror_intf_peer) self.pri.cmd('ip link del %s' % mirror_intf_name) else: LOGGER.info('Creating mirror pair %s <-> %s at %d', mirror_intf_name, mirror_intf_peer, mirror_port) mininet_util.makeIntfPair(mirror_intf_name, mirror_intf_peer) self.pri.cmd('ip link set %s up' % mirror_intf_name) self.pri.cmd('ip link set %s up' % mirror_intf_peer) self.pri.vsctl('add-port', self.pri.name, mirror_intf_name, '--', 'set', 'interface', mirror_intf_name, 'ofport_request=%s' % mirror_port) return mirror_intf_name
def linkTo( self, node2, port1=None, port2=None ): """Create link to another node, making two new interfaces. node2: Node to link us to port1: our port number (optional) port2: node2 port number (optional) returns: intf1 name, intf2 name""" node1 = self if port1 is None: port1 = node1.newPort() if port2 is None: port2 = node2.newPort() intf1 = node1.intfName( port1 ) intf2 = node2.intfName( port2 ) makeIntfPair( intf1, intf2 ) node1.addIntf( intf1, port1 ) node2.addIntf( intf2, port2 ) node1.registerIntf( intf1, node2, intf2 ) node2.registerIntf( intf2, node1, intf1 ) return intf1, intf2
def makeIntfPair( self, intfname1, intfname2, addr1=None, addr2=None ): """Create pair of interfaces intfname1: name of interface 1 intfname2: name of interface 2 (override this method [and possibly delete()] to change link type)""" node1, node2 = self.node1, self.node2 server1 = getattr( node1, 'server', 'localhost' ) server2 = getattr( node2, 'server', 'localhost' ) if server1 == 'localhost' and server2 == 'localhost': # Local link return makeIntfPair( intfname1, intfname2, addr1, addr2 ) elif server1 == server2: # Remote link on same remote server return makeIntfPair( intfname1, intfname2, addr1, addr2, run=node1.rcmd ) # Otherwise, make a tunnel self.tunnel = self.makeTunnel( node1, node2, intfname1, intfname2, addr1, addr2 ) return self.tunnel
def linkTo(self, node2, port1=None, port2=None): """Create link to another node, making two new interfaces. node2: Node to link us to port1: our port number (optional) port2: node2 port number (optional) returns: intf1 name, intf2 name""" node1 = self if port1 is None: port1 = node1.newPort() if port2 is None: port2 = node2.newPort() intf1 = node1.intfName(port1) intf2 = node2.intfName(port2) makeIntfPair(intf1, intf2) node1.addIntf(intf1, port1) node2.addIntf(intf2, port2) node1.registerIntf(intf1, node2, intf2) node2.registerIntf(intf2, node1, intf1) return intf1, intf2
def makeIntfPair( cls, intfname1, intfname2, addr1=None, addr2=None ): """Create pair of interfaces intfname1: name of interface 1 intfname2: name of interface 2 (override this method [and possibly delete()] to change link type)""" # Leave this as a class method for now assert cls return makeIntfPair( intfname1, intfname2, addr1, addr2 )