def linknet(self, net):
        ''' Link this bridge with another by creating a veth pair and installing
            each device into each bridge.
        '''
        sessionid = self.session.shortsessionid()
        try:
            self_objid = '%x' % self.objid
        except TypeError:
            self_objid = '%s' % self.objid
        try:
            net_objid = '%x' % net.objid
        except __HOLE__:
            net_objid = '%s' % net.objid
        localname = 'veth%s.%s.%s' % (self_objid, net_objid, sessionid)
        if len(localname) >= 16:
            raise ValueError, "interface local name '%s' too long" % \
                localname
        name = 'veth%s.%s.%s' % (net_objid, self_objid, sessionid)
        if len(name) >= 16:
            raise ValueError, "interface name '%s' too long" % name
        netif = VEth(node = None, name = name, localname = localname,
                     mtu = 1500, net = self, start = self.up)        
        self.attach(netif)
        if net.up:
            # this is similar to net.attach() but uses netif.name instead 
            # of localname
            check_call([BRCTL_BIN, "addif", net.brname, netif.name])
            check_call([IP_BIN, "link", "set", netif.name, "up"])
        i = net.newifindex()
        net._netif[i] = netif
        with net._linked_lock:
            net._linked[netif] = {}
        netif.net = self
        netif.othernet = net
        return netif
dataset/ETHPy150Open coreemu/core/daemon/core/netns/vnet.py/LxBrNet.linknet