Add availability zone and availability zone profile resources to load balancer

Change-Id: I979a5b84492e73f02417004fb74cf0523d2f9a20
This commit is contained in:
Sam Morrison 2020-03-23 13:02:11 +11:00 committed by Monty Taylor
parent e7237b468f
commit d404a6021c
12 changed files with 599 additions and 4 deletions

View File

@ -150,3 +150,28 @@ Amphora Operations
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.find_amphora
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.configure_amphora
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.failover_amphora
Availability Zone Profile Operations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.load_balancer.v2._proxy.Proxy
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.create_availability_zone_profile
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.get_availability_zone_profile
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.availability_zone_profiles
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.delete_availability_zone_profile
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.find_availability_zone_profile
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.update_availability_zone_profile
Availability Zone Operations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openstack.load_balancer.v2._proxy.Proxy
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.create_availability_zone
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.get_availability_zone
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.availability_zones
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.delete_availability_zone
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.find_availability_zone
.. automethod:: openstack.load_balancer.v2._proxy.Proxy.update_availability_zone

View File

@ -16,3 +16,5 @@ Load Balancer Resources
v2/flavor
v2/quota
v2/amphora
v2/availability_zone_profile
v2/availability_zone

View File

@ -0,0 +1,13 @@
openstack.load_balancer.v2.availability_zone
============================================
.. automodule:: openstack.load_balancer.v2.availability_zone
The AvailabilityZone Class
--------------------------
The ``AvailabilityZone`` class inherits from
:class:`~openstack.resource.Resource`.
.. autoclass:: openstack.load_balancer.v2.availability_zone.AvailabilityZone
:members:

View File

@ -0,0 +1,13 @@
openstack.load_balancer.v2.availability_zone_profile
====================================================
.. automodule:: openstack.load_balancer.v2.availability_zone_profile
The AvailabilityZoneProfile Class
---------------------------------
The ``AvailabilityZoneProfile`` class inherits from
:class:`~openstack.resource.Resource`.
.. autoclass:: openstack.load_balancer.v2.availability_zone_profile.AvailabilityZoneProfile
:members:

View File

@ -11,6 +11,9 @@
# under the License.
from openstack.load_balancer.v2 import amphora as _amphora
from openstack.load_balancer.v2 import availability_zone as _availability_zone
from openstack.load_balancer.v2 import availability_zone_profile as \
_availability_zone_profile
from openstack.load_balancer.v2 import flavor as _flavor
from openstack.load_balancer.v2 import flavor_profile as _flavor_profile
from openstack.load_balancer.v2 import health_monitor as _hm
@ -1005,3 +1008,178 @@ class Proxy(proxy.Proxy):
:returns: ``None``
"""
return self._update(_amphora.AmphoraFailover, amphora_id=amphora_id)
def create_availability_zone_profile(self, **attrs):
"""Create a new availability zone profile from attributes
:param dict attrs: Keyword arguments which will be used to create
a :class:`~openstack.load_balancer.v2.
availability_zone_profile.AvailabilityZoneProfile`,
comprised of the properties on the
AvailabilityZoneProfile class.
:returns: The results of profile creation creation
:rtype: :class:`~openstack.load_balancer.v2.availability_zone_profile.
AvailabilityZoneProfile`
"""
return self._create(_availability_zone_profile.AvailabilityZoneProfile,
**attrs)
def get_availability_zone_profile(self, *attrs):
"""Get an availability zone profile
:param availability_zone_profile: The value can be the name of an
availability_zone profile
or :class:`~openstack.load_balancer.v2.availability_zone_profile.
AvailabilityZoneProfile` instance.
:returns: One
:class:`~openstack.load_balancer.v2.availability_zone_profile.AvailabilityZoneProfile`
"""
return self._get(_availability_zone_profile.AvailabilityZoneProfile,
*attrs)
def availability_zone_profiles(self, **query):
"""Retrieve a generator of availability zone profiles
:returns: A generator of availability zone profiles instances
"""
return self._list(_availability_zone_profile.AvailabilityZoneProfile,
**query)
def delete_availability_zone_profile(self, availability_zone_profile,
ignore_missing=True):
"""Delete an availability zone profile
:param availability_zone_profile: The availability_zone_profile can be
either the name or a
:class:`~openstack.load_balancer.v2.availability_zone_profile.AvailabilityZoneProfile`
instance
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be raised when
the availability zone profile does not exist.
When set to ``True``, no exception will be set when attempting to
delete a nonexistent availability zone profile.
:returns: ``None``
"""
self._delete(_availability_zone_profile.AvailabilityZoneProfile,
availability_zone_profile, ignore_missing=ignore_missing)
def find_availability_zone_profile(self, name_or_id, ignore_missing=True):
"""Find a single availability zone profile
:param name_or_id: The name or ID of a availability zone profile
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the availability zone profile does not exist.
When set to ``True``, no exception will be set when attempting
to delete a nonexistent availability zone profile.
:returns: ``None``
"""
return self._find(_availability_zone_profile.AvailabilityZoneProfile,
name_or_id, ignore_missing=ignore_missing)
def update_availability_zone_profile(self, availability_zone_profile,
**attrs):
"""Update an availability zone profile
:param availability_zone_profile: The availability_zone_profile can be
either the name or a
:class:`~openstack.load_balancer.v2.availability_zone_profile.AvailabilityZoneProfile`
instance
:param dict attrs: The attributes to update on the availability_zone
profile represented by
``availability_zone_profile``.
:returns: The updated availability zone profile
:rtype: :class:`~openstack.load_balancer.v2.availability_zone_profile.
AvailabilityZoneProfile`
"""
return self._update(_availability_zone_profile.AvailabilityZoneProfile,
availability_zone_profile, **attrs)
def create_availability_zone(self, **attrs):
"""Create a new availability zone from attributes
:param dict attrs: Keyword arguments which will be used to create
a :class:`~openstack.load_balancer.v2.
availability_zone.AvailabilityZone`, comprised of
the properties on the AvailabilityZoneclass.
:returns: The results of availability_zone creation creation
:rtype:
:class:`~openstack.load_balancer.v2.availability_zone.AvailabilityZone`
"""
return self._create(_availability_zone.AvailabilityZone, **attrs)
def get_availability_zone(self, *attrs):
"""Get an availability zone
:param availability_zone: The value can be the name of a
availability_zone or
:class:`~openstack.load_balancer.v2.availability_zone.AvailabilityZone`
instance.
:returns: One
:class:`~openstack.load_balancer.v2.availability_zone.AvailabilityZone`
"""
return self._get(_availability_zone.AvailabilityZone, *attrs)
def availability_zones(self, **query):
"""Retrieve a generator of availability zones
:returns: A generator of availability zone instances
"""
return self._list(_availability_zone.AvailabilityZone, **query)
def delete_availability_zone(self, availability_zone, ignore_missing=True):
"""Delete an availability_zone
:param availability_zone: The availability_zone can be either the name
or a
:class:`~openstack.load_balancer.v2.availability_zone.AvailabilityZone`
instance
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be raised when
the availability zone does not exist.
When set to ``True``, no exception will be set when attempting to
delete a nonexistent availability zone.
:returns: ``None``
"""
self._delete(_availability_zone.AvailabilityZone, availability_zone,
ignore_missing=ignore_missing)
def find_availability_zone(self, name_or_id, ignore_missing=True):
"""Find a single availability zone
:param name_or_id: The name or ID of a availability zone
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be raised
when the availability zone does not exist.
When set to ``True``, no exception will be set when attempting
to delete a nonexistent availability zone.
:returns: ``None``
"""
return self._find(_availability_zone.AvailabilityZone, name_or_id,
ignore_missing=ignore_missing)
def update_availability_zone(self, availability_zone, **attrs):
"""Update an availability zone
:param availability_zone: The availability_zone can be either the name
or a
:class:`~openstack.load_balancer.v2.availability_zone.AvailabilityZone`
instance
:param dict attrs: The attributes to update on the availability_zone
represented by ``availability_zone``.
:returns: The updated availability_zone
:rtype:
:class:`~openstack.load_balancer.v2.availability_zone.AvailabilityZone`
"""
return self._update(_availability_zone.AvailabilityZone,
availability_zone, **attrs)

View File

@ -0,0 +1,43 @@
#
# 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 AvailabilityZone(resource.Resource):
resource_key = 'availability_zone'
resources_key = 'availability_zones'
base_path = '/lbaas/availabilityzones'
# capabilities
allow_create = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'name', 'description', 'availability_zone_profile_id',
is_enabled='enabled'
)
# Properties
#: The name of the availability zone.
name = resource.Body('name')
#: The availability zone description.
description = resource.Body('description')
#: The associated availability zone profile ID
availability_zone_profile_id = resource.Body(
'availability_zone_profile_id')
#: Whether the availability zone is enabled for use or not.
is_enabled = resource.Body('enabled')

View File

@ -0,0 +1,41 @@
#
# 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 AvailabilityZoneProfile(resource.Resource):
resource_key = 'availability_zone_profile'
resources_key = 'availability_zone_profiles'
base_path = '/lbaas/availabilityzoneprofiles'
# capabilities
allow_create = True
allow_fetch = True
allow_commit = True
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'id', 'name', 'provider_name', 'availability_zone_data'
)
# Properties
#: The ID of the availability zone profile.
id = resource.Body('id')
#: The name of the availability zone profile.
name = resource.Body('name')
#: The provider this availability zone profile is for.
provider_name = resource.Body('provider_name')
#: The JSON string containing the availability zone metadata.
availability_zone_data = resource.Body('availability_zone_data')

View File

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.load_balancer.v2 import availability_zone
from openstack.load_balancer.v2 import availability_zone_profile
from openstack.load_balancer.v2 import flavor
from openstack.load_balancer.v2 import flavor_profile
from openstack.load_balancer.v2 import health_monitor
@ -35,6 +37,7 @@ class TestLoadBalancer(base.BaseFunctionalTest):
PROJECT_ID = None
FLAVOR_PROFILE_ID = None
FLAVOR_ID = None
AVAILABILITY_ZONE_PROFILE_ID = None
AMPHORA_ID = None
PROTOCOL = 'HTTP'
PROTOCOL_PORT = 80
@ -52,6 +55,7 @@ class TestLoadBalancer(base.BaseFunctionalTest):
L7RULE_VALUE = 'example'
AMPHORA = 'amphora'
FLAVOR_DATA = '{"loadbalancer_topology": "SINGLE"}'
AVAILABILITY_ZONE_DATA = '{"compute_zone": "nova"}'
DESCRIPTION = 'Test description'
_wait_for_timeout_key = 'OPENSTACKSDK_FUNC_TEST_TIMEOUT_LOAD_BALANCER'
@ -71,8 +75,11 @@ class TestLoadBalancer(base.BaseFunctionalTest):
self.MEMBER_NAME = self.getUniqueString()
self.POOL_NAME = self.getUniqueString()
self.UPDATE_NAME = self.getUniqueString()
self.UPDATE_DESCRIPTION = self.getUniqueString()
self.FLAVOR_PROFILE_NAME = self.getUniqueString()
self.FLAVOR_NAME = self.getUniqueString()
self.AVAILABILITY_ZONE_PROFILE_NAME = self.getUniqueString()
self.AVAILABILITY_ZONE_NAME = self.getUniqueString()
subnets = list(self.conn.network.subnets())
self.VIP_SUBNET_ID = subnets[0].id
self.PROJECT_ID = self.conn.session.get_project_id()
@ -85,12 +92,12 @@ class TestLoadBalancer(base.BaseFunctionalTest):
assert isinstance(test_quota, quota.Quota)
self.assertEqual(self.PROJECT_ID, test_quota.id)
test_profile = self.conn.load_balancer.create_flavor_profile(
test_flavor_profile = self.conn.load_balancer.create_flavor_profile(
name=self.FLAVOR_PROFILE_NAME, provider_name=self.AMPHORA,
flavor_data=self.FLAVOR_DATA)
assert isinstance(test_profile, flavor_profile.FlavorProfile)
self.assertEqual(self.FLAVOR_PROFILE_NAME, test_profile.name)
self.FLAVOR_PROFILE_ID = test_profile.id
assert isinstance(test_flavor_profile, flavor_profile.FlavorProfile)
self.assertEqual(self.FLAVOR_PROFILE_NAME, test_flavor_profile.name)
self.FLAVOR_PROFILE_ID = test_flavor_profile.id
test_flavor = self.conn.load_balancer.create_flavor(
name=self.FLAVOR_NAME, flavor_profile_id=self.FLAVOR_PROFILE_ID,
@ -99,6 +106,24 @@ class TestLoadBalancer(base.BaseFunctionalTest):
self.assertEqual(self.FLAVOR_NAME, test_flavor.name)
self.FLAVOR_ID = test_flavor.id
test_az_profile = \
self.conn.load_balancer.create_availability_zone_profile(
name=self.AVAILABILITY_ZONE_PROFILE_NAME,
provider_name=self.AMPHORA,
availability_zone_data=self.AVAILABILITY_ZONE_DATA)
assert isinstance(test_az_profile,
availability_zone_profile.AvailabilityZoneProfile)
self.assertEqual(self.AVAILABILITY_ZONE_PROFILE_NAME,
test_az_profile.name)
self.AVAILABILITY_ZONE_PROFILE_ID = test_az_profile.id
test_az = self.conn.load_balancer.create_availability_zone(
name=self.AVAILABILITY_ZONE_NAME,
availability_zone_profile_id=self.AVAILABILITY_ZONE_PROFILE_ID,
is_enabled=True, description=self.DESCRIPTION)
assert isinstance(test_az, availability_zone.AvailabilityZone)
self.assertEqual(self.AVAILABILITY_ZONE_NAME, test_az.name)
test_lb = self.conn.load_balancer.create_load_balancer(
name=self.LB_NAME, vip_subnet_id=self.VIP_SUBNET_ID,
project_id=self.PROJECT_ID)
@ -218,6 +243,12 @@ class TestLoadBalancer(base.BaseFunctionalTest):
self.conn.load_balancer.delete_flavor_profile(self.FLAVOR_PROFILE_ID,
ignore_missing=False)
self.conn.load_balancer.delete_availability_zone(
self.AVAILABILITY_ZONE_NAME, ignore_missing=False)
self.conn.load_balancer.delete_availability_zone_profile(
self.AVAILABILITY_ZONE_PROFILE_ID, ignore_missing=False)
def test_lb_find(self):
test_lb = self.conn.load_balancer.find_load_balancer(self.LB_NAME)
self.assertEqual(self.LB_ID, test_lb.id)
@ -593,3 +624,78 @@ class TestLoadBalancer(base.BaseFunctionalTest):
self.conn.load_balancer.failover_amphora(self.AMPHORA_ID)
test_amp = self.conn.load_balancer.get_amphora(self.AMPHORA_ID)
self.assertEqual(self.AMPHORA_ID, test_amp.id)
def test_availability_zone_profile_find(self):
test_profile = self.conn.load_balancer.find_availability_zone_profile(
self.AVAILABILITY_ZONE_PROFILE_NAME)
self.assertEqual(self.AVAILABILITY_ZONE_PROFILE_ID, test_profile.id)
def test_availability_zone_profile_get(self):
test_availability_zone_profile = \
self.conn.load_balancer.get_availability_zone_profile(
self.AVAILABILITY_ZONE_PROFILE_ID)
self.assertEqual(self.AVAILABILITY_ZONE_PROFILE_NAME,
test_availability_zone_profile.name)
self.assertEqual(self.AVAILABILITY_ZONE_PROFILE_ID,
test_availability_zone_profile.id)
self.assertEqual(self.AMPHORA,
test_availability_zone_profile.provider_name)
self.assertEqual(self.AVAILABILITY_ZONE_DATA,
test_availability_zone_profile.availability_zone_data)
def test_availability_zone_profile_list(self):
names = [az.name for az in
self.conn.load_balancer.availability_zone_profiles()]
self.assertIn(self.AVAILABILITY_ZONE_PROFILE_NAME, names)
def test_availability_zone_profile_update(self):
self.conn.load_balancer.update_availability_zone_profile(
self.AVAILABILITY_ZONE_PROFILE_ID, name=self.UPDATE_NAME)
test_availability_zone_profile = \
self.conn.load_balancer.get_availability_zone_profile(
self.AVAILABILITY_ZONE_PROFILE_ID)
self.assertEqual(self.UPDATE_NAME, test_availability_zone_profile.name)
self.conn.load_balancer.update_availability_zone_profile(
self.AVAILABILITY_ZONE_PROFILE_ID,
name=self.AVAILABILITY_ZONE_PROFILE_NAME)
test_availability_zone_profile = \
self.conn.load_balancer.get_availability_zone_profile(
self.AVAILABILITY_ZONE_PROFILE_ID)
self.assertEqual(self.AVAILABILITY_ZONE_PROFILE_NAME,
test_availability_zone_profile.name)
def test_availability_zone_find(self):
test_availability_zone = \
self.conn.load_balancer.find_availability_zone(
self.AVAILABILITY_ZONE_NAME)
self.assertEqual(self.AVAILABILITY_ZONE_NAME,
test_availability_zone.name)
def test_availability_zone_get(self):
test_availability_zone = self.conn.load_balancer.get_availability_zone(
self.AVAILABILITY_ZONE_NAME)
self.assertEqual(self.AVAILABILITY_ZONE_NAME,
test_availability_zone.name)
self.assertEqual(self.DESCRIPTION, test_availability_zone.description)
self.assertEqual(self.AVAILABILITY_ZONE_PROFILE_ID,
test_availability_zone.availability_zone_profile_id)
def test_availability_zone_list(self):
names = [az.name for az in
self.conn.load_balancer.availability_zones()]
self.assertIn(self.AVAILABILITY_ZONE_NAME, names)
def test_availability_zone_update(self):
self.conn.load_balancer.update_availability_zone(
self.AVAILABILITY_ZONE_NAME, description=self.UPDATE_DESCRIPTION)
test_availability_zone = self.conn.load_balancer.get_availability_zone(
self.AVAILABILITY_ZONE_NAME)
self.assertEqual(self.UPDATE_DESCRIPTION,
test_availability_zone.description)
self.conn.load_balancer.update_availability_zone(
self.AVAILABILITY_ZONE_NAME, description=self.DESCRIPTION)
test_availability_zone = self.conn.load_balancer.get_availability_zone(
self.AVAILABILITY_ZONE_NAME)
self.assertEqual(self.DESCRIPTION, test_availability_zone.description)

View File

@ -0,0 +1,59 @@
#
# 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.tests.unit import base
import uuid
from openstack.load_balancer.v2 import availability_zone
AVAILABILITY_ZONE_PROFILE_ID = uuid.uuid4()
EXAMPLE = {
'name': 'strawberry',
'description': 'tasty',
'is_enabled': False,
'availability_zone_profile_id': AVAILABILITY_ZONE_PROFILE_ID}
class TestAvailabilityZone(base.TestCase):
def test_basic(self):
test_availability_zone = availability_zone.AvailabilityZone()
self.assertEqual('availability_zone',
test_availability_zone.resource_key)
self.assertEqual('availability_zones',
test_availability_zone.resources_key)
self.assertEqual('/lbaas/availabilityzones',
test_availability_zone.base_path)
self.assertTrue(test_availability_zone.allow_create)
self.assertTrue(test_availability_zone.allow_fetch)
self.assertTrue(test_availability_zone.allow_commit)
self.assertTrue(test_availability_zone.allow_delete)
self.assertTrue(test_availability_zone.allow_list)
def test_make_it(self):
test_availability_zone = availability_zone.AvailabilityZone(**EXAMPLE)
self.assertEqual(EXAMPLE['name'], test_availability_zone.name)
self.assertEqual(EXAMPLE['description'],
test_availability_zone.description)
self.assertFalse(test_availability_zone.is_enabled)
self.assertEqual(EXAMPLE['availability_zone_profile_id'],
test_availability_zone.availability_zone_profile_id)
self.assertDictEqual(
{'limit': 'limit',
'marker': 'marker',
'name': 'name',
'description': 'description',
'is_enabled': 'enabled',
'availability_zone_profile_id': 'availability_zone_profile_id'},
test_availability_zone._query_mapping._mapping)

View File

@ -0,0 +1,59 @@
#
# 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.tests.unit import base
import uuid
from openstack.load_balancer.v2 import availability_zone_profile
IDENTIFIER = uuid.uuid4()
EXAMPLE = {
'id': IDENTIFIER,
'name': 'acidic',
'provider_name': 'best',
'availability_zone_data': '{"loadbalancer_topology": "SINGLE"}'}
class TestAvailabilityZoneProfile(base.TestCase):
def test_basic(self):
test_profile = availability_zone_profile.AvailabilityZoneProfile()
self.assertEqual('availability_zone_profile',
test_profile.resource_key)
self.assertEqual('availability_zone_profiles',
test_profile.resources_key)
self.assertEqual('/lbaas/availabilityzoneprofiles',
test_profile.base_path)
self.assertTrue(test_profile.allow_create)
self.assertTrue(test_profile.allow_fetch)
self.assertTrue(test_profile.allow_commit)
self.assertTrue(test_profile.allow_delete)
self.assertTrue(test_profile.allow_list)
def test_make_it(self):
test_profile = availability_zone_profile.AvailabilityZoneProfile(
**EXAMPLE)
self.assertEqual(EXAMPLE['id'], test_profile.id)
self.assertEqual(EXAMPLE['name'], test_profile.name)
self.assertEqual(EXAMPLE['provider_name'], test_profile.provider_name)
self.assertEqual(EXAMPLE['availability_zone_data'],
test_profile.availability_zone_data)
self.assertDictEqual(
{'limit': 'limit',
'marker': 'marker',
'id': 'id',
'name': 'name',
'provider_name': 'provider_name',
'availability_zone_data': 'availability_zone_data'},
test_profile._query_mapping._mapping)

View File

@ -15,6 +15,8 @@ import mock
from openstack.load_balancer.v2 import _proxy
from openstack.load_balancer.v2 import amphora
from openstack.load_balancer.v2 import availability_zone
from openstack.load_balancer.v2 import availability_zone_profile
from openstack.load_balancer.v2 import flavor
from openstack.load_balancer.v2 import flavor_profile
from openstack.load_balancer.v2 import health_monitor
@ -388,3 +390,52 @@ class TestLoadBalancerProxy(test_proxy_base.TestProxyBase):
value=[self.AMPHORA_ID],
expected_args=[],
expected_kwargs={'amphora_id': self.AMPHORA_ID})
def test_availability_zone_profiles(self):
self.verify_list(self.proxy.availability_zone_profiles,
availability_zone_profile.AvailabilityZoneProfile)
def test_availability_zone_profile_get(self):
self.verify_get(self.proxy.get_availability_zone_profile,
availability_zone_profile.AvailabilityZoneProfile)
def test_availability_zone_profile_create(self):
self.verify_create(self.proxy.create_availability_zone_profile,
availability_zone_profile.AvailabilityZoneProfile)
def test_availability_zone_profile_delete(self):
self.verify_delete(self.proxy.delete_availability_zone_profile,
availability_zone_profile.AvailabilityZoneProfile,
True)
def test_availability_zone_profile_find(self):
self.verify_find(self.proxy.find_availability_zone_profile,
availability_zone_profile.AvailabilityZoneProfile)
def test_availability_zone_profile_update(self):
self.verify_update(self.proxy.update_availability_zone_profile,
availability_zone_profile.AvailabilityZoneProfile)
def test_availability_zones(self):
self.verify_list(self.proxy.availability_zones,
availability_zone.AvailabilityZone)
def test_availability_zone_get(self):
self.verify_get(self.proxy.get_availability_zone,
availability_zone.AvailabilityZone)
def test_availability_zone_create(self):
self.verify_create(self.proxy.create_availability_zone,
availability_zone.AvailabilityZone)
def test_availability_zone_delete(self):
self.verify_delete(self.proxy.delete_availability_zone,
availability_zone.AvailabilityZone, True)
def test_availability_zone_find(self):
self.verify_find(self.proxy.find_availability_zone,
availability_zone.AvailabilityZone)
def test_availability_zone_update(self):
self.verify_update(self.proxy.update_availability_zone,
availability_zone.AvailabilityZone)

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds Octavia (load_balancer) support for the availability zone and
availability zone profile APIs.