network: Remove duplicate module, update references
In change Id2513fd77fc303b42a52c436e3b0d46f93b7d376, we added support for IPsec policies. However, in this change we appear to have inadvertently merged two near-identical versions of the resource - one in the 'vpn_ipsecpolicy' module and one in the 'vpn_ipsec_policy' module. The latter is slightly more complete and the naming scheme matches that of other modules so we keep that. We also opt to update the proxy methods so that their naming scheme matches this pattern, along with the docstrings for same. Change-Id: I21799cf4ac6494f76b9c6b1963e214565a0e652d Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:

committed by
EunYoung Kim

parent
2fbefe6481
commit
e55a6472cf
@@ -255,8 +255,8 @@ VPNaaS Operations
|
||||
find_vpn_ipsec_site_connection, vpn_ipsec_site_connections,
|
||||
create_vpn_ikepolicy, update_vpn_ikepolicy, delete_vpn_ikepolicy,
|
||||
get_vpn_ikepolicy, find_vpn_ikepolicy, vpn_ikepolicies,
|
||||
create_vpn_ipsecpolicy, update_vpn_ipsecpolicy, delete_vpn_ipsecpolicy,
|
||||
get_vpn_ipsecpolicy, find_vpn_ipsecpolicy, vpn_ipsecpolicies
|
||||
create_vpn_ipsec_policy, update_vpn_ipsec_policy, delete_vpn_ipsec_policy,
|
||||
get_vpn_ipsec_policy, find_vpn_ipsec_policy, vpn_ipsec_policies
|
||||
|
||||
Extension Operations
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
@@ -7,5 +7,5 @@ VPNaaS Resources
|
||||
endpoint_group
|
||||
ipsec_site_connection
|
||||
ikepolicy
|
||||
ipsecpolicy
|
||||
ipsec_policy
|
||||
service
|
||||
|
@@ -63,9 +63,9 @@ from openstack.network.v2 import subnet_pool as _subnet_pool
|
||||
from openstack.network.v2 import trunk as _trunk
|
||||
from openstack.network.v2 import vpn_endpoint_group as _vpn_endpoint_group
|
||||
from openstack.network.v2 import vpn_ikepolicy as _ikepolicy
|
||||
from openstack.network.v2 import vpn_ipsec_policy as _ipsec_policy
|
||||
from openstack.network.v2 import vpn_ipsec_site_connection as \
|
||||
_ipsec_site_connection
|
||||
from openstack.network.v2 import vpn_ipsecpolicy as _ipsecpolicy
|
||||
from openstack.network.v2 import vpn_service as _vpn_service
|
||||
from openstack import proxy
|
||||
|
||||
@@ -4473,15 +4473,15 @@ class Proxy(proxy.Proxy):
|
||||
return self._update(
|
||||
_vpn_endpoint_group.VpnEndpointGroup, vpn_endpoint_group, **attrs)
|
||||
|
||||
# ========== IPSec Site Connection ==========
|
||||
# ========== IPsec Site Connection ==========
|
||||
def create_vpn_ipsec_site_connection(self, **attrs):
|
||||
"""Create a new ipsec site connection from attributes
|
||||
"""Create a new IPsec site connection from attributes
|
||||
|
||||
:param dict attrs: Keyword arguments which will be used to create a
|
||||
:class:`~openstack.network.v2.vpn_ipsec_site_connection.VpnIPSecSiteConnection`,
|
||||
comprised of the properties on the IPSecSiteConnection class.
|
||||
|
||||
:returns: The results of ipsec site connection creation
|
||||
:returns: The results of IPsec site connection creation
|
||||
:rtype:
|
||||
:class:`~openstack.network.v2.vpn_ipsec_site_connection.VpnIPSecSiteConnection`
|
||||
"""
|
||||
@@ -4492,9 +4492,9 @@ class Proxy(proxy.Proxy):
|
||||
def find_vpn_ipsec_site_connection(
|
||||
self, name_or_id, ignore_missing=True, **args
|
||||
):
|
||||
"""Find a single ipsec site connection
|
||||
"""Find a single IPsec site connection
|
||||
|
||||
:param name_or_id: The name or ID of an ipsec site connection.
|
||||
:param name_or_id: The name or ID of an IPsec site connection.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound`
|
||||
will be raised when the resource does not exist.
|
||||
@@ -4511,9 +4511,9 @@ class Proxy(proxy.Proxy):
|
||||
name_or_id, ignore_missing=ignore_missing, **args)
|
||||
|
||||
def get_vpn_ipsec_site_connection(self, ipsec_site_connection):
|
||||
"""Get a single ipsec site connection
|
||||
"""Get a single IPsec site connection
|
||||
|
||||
:param ipsec_site_connection: The value can be the ID of an ipsec site
|
||||
:param ipsec_site_connection: The value can be the ID of an IPsec site
|
||||
connection or a
|
||||
:class:`~openstack.network.v2.vpn_ipsec_site_connection.VpnIPSecSiteConnection`
|
||||
instance.
|
||||
@@ -4528,12 +4528,12 @@ class Proxy(proxy.Proxy):
|
||||
ipsec_site_connection)
|
||||
|
||||
def vpn_ipsec_site_connections(self, **query):
|
||||
"""Return a generator of ipsec site connections
|
||||
"""Return a generator of IPsec site connections
|
||||
|
||||
:param dict query: Optional query parameters to be sent to limit the
|
||||
resources being returned.
|
||||
|
||||
:returns: A generator of ipsec site connection objects
|
||||
:returns: A generator of IPsec site connection objects
|
||||
:rtype:
|
||||
:class:`~openstack.network.v2.vpn_ipsec_site_connection.VpnIPSecSiteConnection`
|
||||
"""
|
||||
@@ -4541,16 +4541,16 @@ class Proxy(proxy.Proxy):
|
||||
_ipsec_site_connection.VpnIPSecSiteConnection, **query)
|
||||
|
||||
def update_vpn_ipsec_site_connection(self, ipsec_site_connection, **attrs):
|
||||
"""Update a ipsec site connection
|
||||
"""Update a IPsec site connection
|
||||
|
||||
:ipsec_site_connection: Either the id of an ipsec site connection or
|
||||
:ipsec_site_connection: Either the id of an IPsec site connection or
|
||||
a
|
||||
:class:`~openstack.network.v2.vpn_ipsec_site_connection.VpnIPSecSiteConnection`
|
||||
instance.
|
||||
:param dict attrs: The attributes to update on the ipsec site
|
||||
:param dict attrs: The attributes to update on the IPsec site
|
||||
connection represented by ``ipsec_site_connection``.
|
||||
|
||||
:returns: The updated ipsec site connection
|
||||
:returns: The updated IPsec site connection
|
||||
:rtype:
|
||||
:class:`~openstack.network.v2.vpn_ipsec_site_connection.VpnIPSecSiteConnection`
|
||||
"""
|
||||
@@ -4561,18 +4561,18 @@ class Proxy(proxy.Proxy):
|
||||
def delete_vpn_ipsec_site_connection(
|
||||
self, ipsec_site_connection, ignore_missing=True
|
||||
):
|
||||
"""Delete a ipsec site connection
|
||||
"""Delete a IPsec site connection
|
||||
|
||||
:param ipsec_site_connection: The value can be either the ID of an
|
||||
ipsec site connection, or a
|
||||
IPsec site connection, or a
|
||||
:class:`~openstack.network.v2.vpn_ipsec_site_connection.VpnIPSecSiteConnection`
|
||||
instance.
|
||||
:param bool ignore_missing:
|
||||
When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be raised when
|
||||
the ipsec site connection does not exist.
|
||||
the IPsec site connection does not exist.
|
||||
When set to ``True``, no exception will be set when attempting to
|
||||
delete a nonexistent ipsec site connection.
|
||||
delete a nonexistent IPsec site connection.
|
||||
|
||||
:returns: ``None``
|
||||
"""
|
||||
@@ -4675,25 +4675,25 @@ class Proxy(proxy.Proxy):
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
# ========== IPSecPolicy ==========
|
||||
def create_vpn_ipsecpolicy(self, **attrs):
|
||||
"""Create a new ipsec policy from attributes
|
||||
def create_vpn_ipsec_policy(self, **attrs):
|
||||
"""Create a new IPsec policy from attributes
|
||||
|
||||
:param dict attrs: Keyword arguments which will be used to create a
|
||||
:class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`,
|
||||
:class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`,
|
||||
comprised of the properties on the VpnIpsecPolicy class.
|
||||
|
||||
:returns: The results of ipsec policy creation :rtype:
|
||||
:class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`
|
||||
:returns: The results of IPsec policy creation :rtype:
|
||||
:class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`
|
||||
"""
|
||||
return self._create(
|
||||
_ipsecpolicy.VpnIpsecPolicy, **attrs)
|
||||
_ipsec_policy.VpnIpsecPolicy, **attrs)
|
||||
|
||||
def find_vpn_ipsecpolicy(
|
||||
def find_vpn_ipsec_policy(
|
||||
self, name_or_id, ignore_missing=True, **args
|
||||
):
|
||||
"""Find a single ipsec policy
|
||||
"""Find a single IPsec policy
|
||||
|
||||
:param name_or_id: The name or ID of an ipsec policy.
|
||||
:param name_or_id: The name or ID of an IPsec policy.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound`
|
||||
will be raised when the resource does not exist. When set to
|
||||
@@ -4702,74 +4702,74 @@ class Proxy(proxy.Proxy):
|
||||
:param dict args: Any additional parameters to be passed into
|
||||
underlying methods such as query filters.
|
||||
:returns: One
|
||||
:class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`
|
||||
:class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`
|
||||
or None.
|
||||
"""
|
||||
return self._find(
|
||||
_ipsecpolicy.VpnIpsecPolicy, name_or_id,
|
||||
_ipsec_policy.VpnIpsecPolicy, name_or_id,
|
||||
ignore_missing=ignore_missing, **args)
|
||||
|
||||
def get_vpn_ipsecpolicy(self, ipsecpolicy):
|
||||
"""Get a single ipsec policy
|
||||
def get_vpn_ipsec_policy(self, ipsec_policy):
|
||||
"""Get a single IPsec policy
|
||||
|
||||
:param ipsecpolicy: The value can be the ID of an ipsecpolicy or a
|
||||
:class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`
|
||||
:param ipsec_policy: The value can be the ID of an IPcec policy or a
|
||||
:class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`
|
||||
instance.
|
||||
|
||||
:returns: One
|
||||
:class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`
|
||||
:rtype: :class:`~openstack.network.v2.ipsecpolicy.VpnIpsecPolicy`
|
||||
:class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`
|
||||
:rtype: :class:`~openstack.network.v2.ipsec_policy.VpnIpsecPolicy`
|
||||
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
|
||||
resource can be found.
|
||||
"""
|
||||
return self._get(
|
||||
_ipsecpolicy.VpnIpsecPolicy, ipsecpolicy)
|
||||
_ipsec_policy.VpnIpsecPolicy, ipsec_policy)
|
||||
|
||||
def vpn_ipsecpolicies(self, **query):
|
||||
"""Return a generator of ipsec policy
|
||||
def vpn_ipsec_policies(self, **query):
|
||||
"""Return a generator of IPsec policies
|
||||
|
||||
:param dict query: Optional query parameters to be sent to limit the
|
||||
resources being returned.
|
||||
|
||||
:returns: A generator of ipsec policy objects
|
||||
:rtype: :class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`
|
||||
:returns: A generator of IPsec policy objects
|
||||
:rtype: :class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`
|
||||
"""
|
||||
return self._list(
|
||||
_ipsecpolicy.VpnIpsecPolicy, **query)
|
||||
_ipsec_policy.VpnIpsecPolicy, **query)
|
||||
|
||||
def update_vpn_ipsecpolicy(self, ipsecpolicy, **attrs):
|
||||
"""Update a ipsec policy
|
||||
def update_vpn_ipsec_policy(self, ipsec_policy, **attrs):
|
||||
"""Update an IPsec policy
|
||||
|
||||
:ipsecpolicy: Either the id of an ipsec policy or a
|
||||
:class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`
|
||||
:ipsec_policy: Either the id of an IPsec policy or a
|
||||
:class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`
|
||||
instance.
|
||||
:param dict attrs: The attributes to update on the ipsec policy
|
||||
represented by ``ipsecpolicy``.
|
||||
:param dict attrs: The attributes to update on the IPsec policy
|
||||
represented by ``ipsec_policy``.
|
||||
|
||||
:returns: The updated ipsec policy
|
||||
:rtype: :class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`
|
||||
:returns: The updated IPsec policy
|
||||
:rtype: :class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`
|
||||
"""
|
||||
return self._update(
|
||||
_ipsecpolicy.VpnIpsecPolicy, ipsecpolicy, **attrs)
|
||||
_ipsec_policy.VpnIpsecPolicy, ipsec_policy, **attrs)
|
||||
|
||||
def delete_vpn_ipsecpolicy(self, ipsecpolicy, ignore_missing=True):
|
||||
"""Delete a ipsecpolicy
|
||||
def delete_vpn_ipsec_policy(self, ipsec_policy, ignore_missing=True):
|
||||
"""Delete an IPsec policy
|
||||
|
||||
:param ipsecpolicy: The value can be either the ID of an ipsec policy,
|
||||
:param ipsec_policy: The value can be either the ID of an IPsec policy,
|
||||
or a
|
||||
:class:`~openstack.network.v2.vpn_ipsecpolicy.VpnIpsecPolicy`
|
||||
:class:`~openstack.network.v2.vpn_ipsec_policy.VpnIpsecPolicy`
|
||||
instance.
|
||||
:param bool ignore_missing:
|
||||
When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound`
|
||||
will be raised when the ipsec policy does not exist. When set to
|
||||
will be raised when the IPsec policy does not exist. When set to
|
||||
``True``, no exception will be set when attempting to delete a
|
||||
nonexistent ipsec policy.
|
||||
nonexistent IPsec policy.
|
||||
|
||||
:returns: ``None``
|
||||
"""
|
||||
self._delete(
|
||||
_ipsecpolicy.VpnIpsecPolicy, ipsecpolicy,
|
||||
_ipsec_policy.VpnIpsecPolicy, ipsec_policy,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
# ========== VPN Service ==========
|
||||
|
@@ -1,57 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack import resource
|
||||
|
||||
|
||||
class VpnIpsecPolicy(resource.Resource):
|
||||
resource_key = 'ipsecpolicy'
|
||||
resources_key = 'ipsecpolicies'
|
||||
base_path = '/vpn/ipsecpolicies'
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_fetch = True
|
||||
allow_commit = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# Properties
|
||||
#: The authentication hash algorithm. Valid values are sha1,
|
||||
# sha256, sha384, sha512. The default is sha1.
|
||||
auth_algorithm = resource.Body('auth_algorithm')
|
||||
#: A human-readable description for the resource.
|
||||
# Default is an empty string.
|
||||
description = resource.Body('description')
|
||||
#: The encryption algorithm. A valid value is 3des, aes-128,
|
||||
# aes-192, aes-256, and so on. Default is aes-128.
|
||||
encryption_algorithm = resource.Body('encryption_algorithm')
|
||||
#: The lifetime of the security association. The lifetime consists
|
||||
# of a unit and integer value. You can omit either the unit or value
|
||||
# portion of the lifetime. Default unit is seconds and
|
||||
# default value is 3600.
|
||||
lifetime = resource.Body('lifetime', type=dict)
|
||||
#: Perfect forward secrecy (PFS). A valid value is Group2,
|
||||
# Group5, Group14, and so on. Default is Group5.
|
||||
pfs = resource.Body('pfs')
|
||||
#: The ID of the project.
|
||||
project_id = resource.Body('project_id')
|
||||
#: The units for the lifetime of the security association.
|
||||
# The lifetime consists of a unit and integer value.
|
||||
# You can omit either the unit or value portion of the lifetime.
|
||||
# Default unit is seconds and default value is 3600.
|
||||
units = resource.Body('units')
|
||||
#: The lifetime value, as a positive integer. The lifetime
|
||||
# consists of a unit and integer value.
|
||||
# You can omit either the unit or value portion of the lifetime.
|
||||
# Default unit is seconds and default value is 3600.
|
||||
value = resource.Body('value', type=int)
|
@@ -60,8 +60,8 @@ from openstack.network.v2 import subnet
|
||||
from openstack.network.v2 import subnet_pool
|
||||
from openstack.network.v2 import vpn_endpoint_group
|
||||
from openstack.network.v2 import vpn_ikepolicy
|
||||
from openstack.network.v2 import vpn_ipsec_policy
|
||||
from openstack.network.v2 import vpn_ipsec_site_connection
|
||||
from openstack.network.v2 import vpn_ipsecpolicy
|
||||
from openstack.network.v2 import vpn_service
|
||||
from openstack import proxy as proxy_base
|
||||
from openstack.tests.unit import test_proxy_base
|
||||
@@ -1686,40 +1686,40 @@ class TestNetworkVpnIkePolicy(TestNetworkProxy):
|
||||
|
||||
|
||||
class TestNetworkVpnIpsecPolicy(TestNetworkProxy):
|
||||
def test_ipsecpolicy_create_attrs(self):
|
||||
def test_ipsec_policy_create_attrs(self):
|
||||
self.verify_create(
|
||||
self.proxy.create_vpn_ipsecpolicy,
|
||||
vpn_ipsecpolicy.VpnIpsecPolicy)
|
||||
self.proxy.create_vpn_ipsec_policy,
|
||||
vpn_ipsec_policy.VpnIpsecPolicy)
|
||||
|
||||
def test_ipsecpolicy_delete(self):
|
||||
def test_ipsec_policy_delete(self):
|
||||
self.verify_delete(
|
||||
self.proxy.delete_vpn_ipsecpolicy,
|
||||
vpn_ipsecpolicy.VpnIpsecPolicy, False)
|
||||
self.proxy.delete_vpn_ipsec_policy,
|
||||
vpn_ipsec_policy.VpnIpsecPolicy, False)
|
||||
|
||||
def test_ipsecpolicy_delete_ignore(self):
|
||||
def test_ipsec_policy_delete_ignore(self):
|
||||
self.verify_delete(
|
||||
self.proxy.delete_vpn_ipsecpolicy,
|
||||
vpn_ipsecpolicy.VpnIpsecPolicy, True)
|
||||
self.proxy.delete_vpn_ipsec_policy,
|
||||
vpn_ipsec_policy.VpnIpsecPolicy, True)
|
||||
|
||||
def test_ipsecpolicy_find(self):
|
||||
def test_ipsec_policy_find(self):
|
||||
self.verify_find(
|
||||
self.proxy.find_vpn_ipsecpolicy,
|
||||
vpn_ipsecpolicy.VpnIpsecPolicy)
|
||||
self.proxy.find_vpn_ipsec_policy,
|
||||
vpn_ipsec_policy.VpnIpsecPolicy)
|
||||
|
||||
def test_ipsecpolicy_get(self):
|
||||
def test_ipsec_policy_get(self):
|
||||
self.verify_get(
|
||||
self.proxy.get_vpn_ipsecpolicy,
|
||||
vpn_ipsecpolicy.VpnIpsecPolicy)
|
||||
self.proxy.get_vpn_ipsec_policy,
|
||||
vpn_ipsec_policy.VpnIpsecPolicy)
|
||||
|
||||
def test_ipsecpolicies(self):
|
||||
def test_ipsec_policies(self):
|
||||
self.verify_list(
|
||||
self.proxy.vpn_ipsecpolicies,
|
||||
vpn_ipsecpolicy.VpnIpsecPolicy)
|
||||
self.proxy.vpn_ipsec_policies,
|
||||
vpn_ipsec_policy.VpnIpsecPolicy)
|
||||
|
||||
def test_ipsecpolicy_update(self):
|
||||
def test_ipsec_policy_update(self):
|
||||
self.verify_update(
|
||||
self.proxy.update_vpn_ipsecpolicy,
|
||||
vpn_ipsecpolicy.VpnIpsecPolicy)
|
||||
self.proxy.update_vpn_ipsec_policy,
|
||||
vpn_ipsec_policy.VpnIpsecPolicy)
|
||||
|
||||
|
||||
class TestNetworkVpnService(TestNetworkProxy):
|
||||
|
@@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack.network.v2 import vpn_ipsecpolicy
|
||||
from openstack.network.v2 import vpn_ipsec_policy
|
||||
from openstack.tests.unit import base
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ EXAMPLE = {
|
||||
class TestVpnIpsecPolicy(base.TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
sot = vpn_ipsecpolicy.VpnIpsecPolicy()
|
||||
sot = vpn_ipsec_policy.VpnIpsecPolicy()
|
||||
self.assertEqual('ipsecpolicy', sot.resource_key)
|
||||
self.assertEqual('ipsecpolicies', sot.resources_key)
|
||||
self.assertEqual('/vpn/ipsecpolicies', sot.base_path)
|
||||
@@ -41,7 +41,7 @@ class TestVpnIpsecPolicy(base.TestCase):
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = vpn_ipsecpolicy.VpnIpsecPolicy(**EXAMPLE)
|
||||
sot = vpn_ipsec_policy.VpnIpsecPolicy(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['auth_algorithm'], sot.auth_algorithm)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['encryption_algorithm'],
|
||||
|
Reference in New Issue
Block a user