

def tunnel_new(self, to_rt_uuid, tunnel_type, policy):
    ' Either create a new tunnel (request side), with status pending,\n            or return an existing tunnel with the same tunnel_type\n            to_rt_uuid: peer node id\n            tunnel_type: tunnel usage string\n            policy: Not currently used\n        '
    try:
        self.network.link_check(to_rt_uuid)
    except:
        tunnel = CalvinTunnel(self.network.links, self.tunnels, None, tunnel_type, policy, rt_id=self.node.id)
        self.network.link_request(to_rt_uuid, CalvinCB(self._tunnel_link_request_finished, tunnel=tunnel, to_rt_uuid=to_rt_uuid, tunnel_type=tunnel_type, policy=policy))
        return tunnel
    tunnel = self._get_tunnel(to_rt_uuid, tunnel_type=tunnel_type)
    if (tunnel != None):
        return tunnel
    tunnel = CalvinTunnel(self.network.links, self.tunnels, to_rt_uuid, tunnel_type, policy, rt_id=self.node.id)
    self._tunnel_new_msg(tunnel, to_rt_uuid, tunnel_type, policy)
    return tunnel

dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/calvin_proto.py CalvinProto.tunnel_new/original