예제 #1
0
def setup_ipsec(instance, host, create_config, start_config):
    """
    If the supplied instance is a network agent, configures the ports needed
    to achieve multi-host networking.
    """
    if instance.get('agentId') is None:
        network_agent = False
    elif instance.get('systemContainer') is None or \
            instance.get('systemContainer') == 'NetworkAgent':
        network_agent = True
    else:
        network_agent = False

    if not network_agent or \
            not _has_service(instance, 'ipsecTunnelService'):
        return

    try:
        host_id = str(host.id)
        nat = instance.data.ipsec[host_id]['nat']
        isakmp = instance.data.ipsec[host_id]['isakmp']

        ports = get_or_create_list(create_config, 'ports')
        binding = get_or_create_map(start_config, 'port_bindings')

        ports.append((500, 'udp'))
        ports.append((4500, 'udp'))
        binding['500/udp'] = ('0.0.0.0', isakmp)
        binding['4500/udp'] = ('0.0.0.0', nat)
    except (KeyError, AttributeError):
        pass
예제 #2
0
    def before_start(self, instance, host, config, start_config):
        if instance.get('agentId') is None:
            network_agent = False
        elif instance.get('systemContainer') is None or \
                instance.get('systemContainer') == 'NetworkAgent':
            network_agent = True
        else:
            network_agent = False

        if not network_agent or \
                not has_service(instance, 'ipsecTunnelService'):
            return

        try:
            id = str(host.id)
            nat = instance.data.ipsec[id]['nat']
            isakmp = instance.data.ipsec[id]['isakmp']

            ports = get_or_create_list(config, 'ports')
            binding = get_or_create_map(start_config, 'port_bindings')

            ports.append((500, 'udp'))
            ports.append((4500, 'udp'))
            binding['500/udp'] = ('0.0.0.0', isakmp)
            binding['4500/udp'] = ('0.0.0.0', nat)
        except (KeyError, AttributeError):
            pass
예제 #3
0
def setup_ipsec(instance, host, create_config, start_config):
    """
    If the supplied instance is a network agent, configures the ports needed
    to achieve multi-host networking.
    """
    if instance.get('agentId') is None:
        network_agent = False
    elif instance.get('systemContainer') is None or \
            instance.get('systemContainer') == 'NetworkAgent':
        network_agent = True
    else:
        network_agent = False

    if not network_agent or \
            not _has_service(instance, 'ipsecTunnelService'):
        return

    try:
        host_id = str(host.id)
        nat = instance.data.ipsec[host_id]['nat']
        isakmp = instance.data.ipsec[host_id]['isakmp']

        ports = get_or_create_list(create_config, 'ports')
        binding = get_or_create_map(start_config, 'port_bindings')

        ports.append((500, 'udp'))
        ports.append((4500, 'udp'))
        binding['500/udp'] = ('0.0.0.0', isakmp)
        binding['4500/udp'] = ('0.0.0.0', nat)
    except (KeyError, AttributeError):
        pass
예제 #4
0
    def before_start(self, instance, host, config, start_config):
        if instance.get('agentId') is None or \
                not has_service(instance, 'ipsecTunnelService'):
            return

        try:
            id = str(host.id)
            nat = instance.data.ipsec[id]['nat']
            isakmp = instance.data.ipsec[id]['isakmp']

            ports = get_or_create_list(config, 'ports')
            binding = get_or_create_map(start_config, 'port_bindings')

            ports.append((500, 'udp'))
            ports.append((4500, 'udp'))
            binding['500/udp'] = ('0.0.0.0', isakmp)
            binding['4500/udp'] = ('0.0.0.0', nat)
        except (KeyError, AttributeError):
            pass