Пример #1
0
    def _create_gre_transport_mode_66(cls,
                                      name,
                                      local_endpoint,
                                      remote_endpoint,
                                      preshared_key,
                                      monitoring_group=None,
                                      vpn_profile=None,
                                      mtu=0,
                                      ttl=0,
                                      pmtu_discovery=True,
                                      enabled=True,
                                      comment=None):
        group = monitoring_group or TunnelMonitoringGroup('Uncategorized')
        profile = vpn_profile or VPNProfile('VPN-A Suite')

        json = {
            'name': name,
            'mtu': mtu,
            'ttl': ttl,
            'preshared_key': preshared_key,
            'pmtu_discovery': pmtu_discovery,
            'tunnel_group_ref': group.href,
            'rbvpn_tunnel_side_a': local_endpoint.data,
            'rbvpn_tunnel_side_b': remote_endpoint.data,
            'tunnel_encryption': 'transport_mode',
            'vpn_profile_ref': profile.href,
            'tunnel_mode': 'gre',
            'enabled': enabled,
            'comment': comment
        }

        try:
            return ElementCreator(cls, json)
        except CreateElementFailed as err:
            raise CreateVPNFailed(err)
Пример #2
0
    def create_gre_transport_mode(cls,
                                  name,
                                  local_endpoint,
                                  remote_endpoint,
                                  preshared_key,
                                  monitoring_group=None,
                                  vpn_profile=None,
                                  mtu=0,
                                  ttl=0,
                                  pmtu_discovery=True,
                                  enabled=True,
                                  comment=None):
        """
        Create a transport based route VPN. This VPN type uses IPSEC
        for protecting the payload, therefore a VPN Profile is specified.
        
        :param str name: name of VPN
        :param TunnelEndpoint local_endpoint: the local side endpoint for
            this VPN.
        :param TunnelEndpoint remote_endpoint: the remote side endpoint for
            this VPN.
        :param str preshared_key: preshared key for RBVPN
        :param TunnelMonitoringGroup monitoring_group: the group to place
            this VPN in for monitoring. (default: 'Uncategorized')
        :param VPNProfile vpn_profile: VPN profile for this VPN.
            (default: VPN-A Suite)
        :param int mtu: Set MTU for this VPN tunnel (default: 0)
        :param boolean pmtu_discovery: enable pmtu discovery (default: True)
        :param int ttl: ttl for connections on the VPN (default: 0)
        :param str comment: optional comment
        :raises CreateVPNFailed: failed to create the VPN with reason
        :rtype: RouteVPN
        """
        group = monitoring_group if monitoring_group else \
            TunnelMonitoringGroup('Uncategorized')
        profile = vpn_profile if vpn_profile else VPNProfile('VPN-A Suite')

        json = {
            'name': name,
            'mtu': mtu,
            'ttl': ttl,
            'preshared_key': preshared_key,
            'pmtu_discovery': pmtu_discovery,
            'monitoring_group_ref': group.href,
            'rbvpn_tunnel_side_a': local_endpoint.data,
            'rbvpn_tunnel_side_b': remote_endpoint.data,
            'tunnel_encryption': 'transport_mode',
            'vpn_profile_ref': profile.href,
            'tunnel_mode': 'gre',
            'enabled': enabled,
            'comment': comment
        }

        try:
            return ElementCreator(cls, json)
        except CreateElementFailed as err:
            raise CreateVPNFailed(err)
Пример #3
0
    def create_ipsec_tunnel(cls,
                            name,
                            local_endpoint,
                            remote_endpoint,
                            preshared_key,
                            monitoring_group=None,
                            vpn_profile=None,
                            mtu=0,
                            pmtu_discovery=True,
                            ttl=0,
                            enabled=True,
                            comment=None):
        """
        The VPN tunnel type negotiates IPsec tunnels in the same way
        as policy-based VPNs, but traffic is selected to be sent into
        the tunnel based on routing.
        
        :param str name: name of VPN
        :param TunnelEndpoint local_endpoint: the local side endpoint for
            this VPN.
        :param TunnelEndpoint remote_endpoint: the remote side endpoint for
            this VPN.
        :param TunnelMonitoringGroup monitoring_group: the group to place
            this VPN in for monitoring. Default: 'Uncategorized'.
        :param VPNProfile vpn_profile: VPN profile for this VPN.
            (default: VPN-A Suite)
        :param int mtu: Set MTU for this VPN tunnel (default: 0)
        :param boolean pmtu_discovery: enable pmtu discovery (default: True)
        :param int ttl: ttl for connections on the VPN (default: 0)
        :param bool enabled: enable the RBVPN or leave it disabled
        :param str comment: optional comment
        :raises CreateVPNFailed: failed to create the VPN with reason
        :rtype: RouteVPN
        """
        group = monitoring_group if monitoring_group else \
            TunnelMonitoringGroup('Uncategorized')
        profile = vpn_profile if vpn_profile else VPNProfile('VPN-A Suite')

        json = {
            'name': name,
            'mtu': mtu,
            'ttl': ttl,
            'enabled': enabled,
            'monitoring_group_ref': group.href,
            'pmtu_discovery': pmtu_discovery,
            'preshared_key': preshared_key,
            'rbvpn_tunnel_side_a': local_endpoint.data,
            'rbvpn_tunnel_side_b': remote_endpoint.data,
            'tunnel_mode': 'vpn',
            'comment': comment,
            'vpn_profile_ref': profile.href
        }

        try:
            return ElementCreator(cls, json)
        except CreateElementFailed as err:
            raise CreateVPNFailed(err)
Пример #4
0
    def create_gre_tunnel_mode(
        cls,
        name,
        local_endpoint,
        remote_endpoint,
        policy_vpn,
        mtu=0,
        pmtu_discovery=True,
        ttl=0,
        enabled=True,
        comment=None,
    ):
        """
        Create a GRE based tunnel mode route VPN. Tunnel mode GRE wraps the
        GRE tunnel in an IPSEC tunnel to provide encrypted end-to-end
        security. Therefore a policy based VPN is required to 'wrap' the
        GRE into IPSEC.

        :param str name: name of VPN
        :param TunnelEndpoint local_endpoint: the local side endpoint for
            this VPN.
        :param TunnelEndpoint remote_endpoint: the remote side endpoint for
            this VPN.
        :param PolicyVPN policy_vpn: reference to a policy VPN
        :param TunnelMonitoringGroup monitoring_group: the group to place
            this VPN in for monitoring. (default: 'Uncategorized')
        :param int mtu: Set MTU for this VPN tunnel (default: 0)
        :param boolean pmtu_discovery: enable pmtu discovery (default: True)
        :param int ttl: ttl for connections on the VPN (default: 0)
        :param str comment: optional comment
        :raises CreateVPNFailed: failed to create the VPN with reason
        :rtype: RouteVPN
        """
        json = {
            "name": name,
            "ttl": ttl,
            "mtu": mtu,
            "pmtu_discovery": pmtu_discovery,
            "tunnel_encryption": "tunnel_mode",
            "tunnel_mode": "gre",
            "enabled": enabled,
            "comment": comment,
            "rbvpn_tunnel_side_a": local_endpoint.data,
            "rbvpn_tunnel_side_b": remote_endpoint.data,
        }
        if policy_vpn is None:
            json["tunnel_encryption"] = "no_encryption"
        else:
            json["tunnel_mode_vpn_ref"] = policy_vpn.href

        try:
            return ElementCreator(cls, json)
        except CreateElementFailed as err:
            raise CreateVPNFailed(err)
Пример #5
0
    def _create_gre_transport_mode_65(
        cls,
        name,
        local_endpoint,
        remote_endpoint,
        preshared_key,
        monitoring_group=None,
        vpn_profile=None,
        mtu=0,
        ttl=0,
        pmtu_discovery=True,
        enabled=True,
        comment=None,
    ):
        group = monitoring_group or RouteVPNTunnelMonitoringGroup(
            "Uncategorized")
        profile = vpn_profile or VPNProfile("VPN-A Suite")

        json = {
            "name": name,
            "mtu": mtu,
            "ttl": ttl,
            "preshared_key": preshared_key,
            "pmtu_discovery": pmtu_discovery,
            "monitoring_group_ref": group.href,
            "rbvpn_tunnel_side_a": local_endpoint.data,
            "rbvpn_tunnel_side_b": remote_endpoint.data,
            "tunnel_encryption": "transport_mode",
            "vpn_profile_ref": profile.href,
            "tunnel_mode": "gre",
            "enabled": enabled,
            "comment": comment,
        }

        try:
            return ElementCreator(cls, json)
        except CreateElementFailed as err:
            raise CreateVPNFailed(err)