def addnettunnel(self, n):
        try:
            net = self.session.obj(n)
        except __HOLE__:
            raise KeyError, "network node %s not found" % n
        # add other nets here that do not require tunnels
        if isinstance(net, EmaneNet):
            return None
        if isinstance(net, CtrlNet):
            if hasattr(net, 'serverintf'):
                if net.serverintf is not None:
                    return None
            
        servers = self.getserversbynode(n)
        if len(servers) < 2:
            return None
        hosts = []
        for server in servers:
            (host, port, sock) = self.getserver(server)
            if host is None:
                continue
            hosts.append(host)
        if len(hosts) == 0:
            # get IP address from API message sender (master)
            self.session._handlerslock.acquire()
            for h in self.session._handlers:
                if h.client_address != "":
                    hosts.append(h.client_address[0])
            self.session._handlerslock.release()
        
        r = []
        for host in hosts:
            if self.myip:
                # we are the remote emulation server
                myip = self.myip
            else:
                # we are the session master
                myip = host
            key = self.tunnelkey(n, IPAddr.toint(myip))
            if key in self.tunnels.keys():
                continue
            self.session.info("Adding tunnel for net %s to %s with key %s" % \
                              (n, host, key))
            gt = GreTap(node=None, name=None, session=self.session,
                            remoteip=host, key=key)
            self.tunnels[key] = gt
            r.append(gt)
            # attaching to net will later allow gt to be destroyed 
            # during net.shutdown()
            net.attach(gt)
        return r
dataset/ETHPy150Open coreemu/core/daemon/core/broker.py/CoreBroker.addnettunnel