Browse Source

Complement Octavia client with a set of features

* Commands added: loadbalancer failover, loadbalancer amphora.
* Allow to filter 'list' calls.
e.g. list all pools that correspond with a given loadbalancer ID.
* Rename API internally, from load_balancer_v2 to Octavia.

Task: 5742
Story: 2001224

Change-Id: I7c38471073d8990de054def3d1d99f2c0524c26e
changes/66/522666/18 1.3.0
Bar RH 4 years ago
committed by Michael Johnson
parent
commit
922edce32a
  1. 10
      doc/source/cli/osc/v2/load-balancer.rst
  2. 19
      octaviaclient/api/constants.py
  3. 0
      octaviaclient/api/v2/__init__.py
  4. 65
      octaviaclient/api/v2/octavia.py
  5. 6
      octaviaclient/osc/plugin.py
  6. 117
      octaviaclient/osc/v2/amphora.py
  7. 35
      octaviaclient/osc/v2/constants.py
  8. 10
      octaviaclient/osc/v2/listener.py
  9. 23
      octaviaclient/osc/v2/load_balancer.py
  10. 10
      octaviaclient/osc/v2/pool.py
  11. 93
      octaviaclient/osc/v2/utils.py
  12. 207
      octaviaclient/tests/unit/api/test_octavia.py
  13. 50
      octaviaclient/tests/unit/osc/v2/fakes.py
  14. 175
      octaviaclient/tests/unit/osc/v2/test_amphora.py
  15. 2
      octaviaclient/tests/unit/osc/v2/test_health_monitor.py
  16. 2
      octaviaclient/tests/unit/osc/v2/test_l7policy.py
  17. 2
      octaviaclient/tests/unit/osc/v2/test_l7rule.py
  18. 2
      octaviaclient/tests/unit/osc/v2/test_listener.py
  19. 20
      octaviaclient/tests/unit/osc/v2/test_load_balancer.py
  20. 6
      octaviaclient/tests/unit/osc/v2/test_member.py
  21. 2
      octaviaclient/tests/unit/osc/v2/test_pool.py
  22. 2
      octaviaclient/tests/unit/osc/v2/test_quota.py
  23. 9
      octaviaclient/tests/utils.py
  24. 5
      releasenotes/notes/add-new-commands-and-options-d520b36d870cbcb4.yaml
  25. 3
      setup.cfg

10
doc/source/cli/osc/v2/load-balancer.rst

@ -26,6 +26,9 @@ loadbalancer
.. autoprogram-cliff:: openstack.load_balancer.v2
:command: loadbalancer stats show
.. autoprogram-cliff:: openstack.load_balancer.v2
:command: loadbalancer failover
========
listener
========
@ -74,3 +77,10 @@ quota
.. autoprogram-cliff:: openstack.load_balancer.v2
:command: loadbalancer quota *
=======
amphora
=======
.. autoprogram-cliff:: openstack.load_balancer.v2
:command: loadbalancer amphora *

19
octaviaclient/api/constants.py

@ -11,27 +11,34 @@
# under the License.
#
BASE_LOADBALANCER_URL = '/loadbalancers'
BASE_LBAAS_ENDPOINT = '/lbaas'
BASE_OCTAVIA_ENDPOINT = '/octavia'
BASE_LOADBALANCER_URL = BASE_LBAAS_ENDPOINT + '/loadbalancers'
BASE_SINGLE_LB_URL = BASE_LOADBALANCER_URL + '/{uuid}'
BASE_LB_STATS_URL = BASE_SINGLE_LB_URL + '/stats'
BASE_LOADBALANCER_FAILOVER_URL = BASE_SINGLE_LB_URL + '/failover'
BASE_LISTENER_URL = '/listeners'
BASE_LISTENER_URL = BASE_LBAAS_ENDPOINT + '/listeners'
BASE_SINGLE_LISTENER_URL = BASE_LISTENER_URL + '/{uuid}'
BASE_POOL_URL = '/pools'
BASE_POOL_URL = BASE_LBAAS_ENDPOINT + '/pools'
BASE_SINGLE_POOL_URL = BASE_POOL_URL + '/{pool_id}'
BASE_MEMBER_URL = BASE_SINGLE_POOL_URL + '/members'
BASE_SINGLE_MEMBER_URL = BASE_MEMBER_URL + '/{member_id}'
BASE_HEALTH_MONITOR_URL = '/healthmonitors'
BASE_HEALTH_MONITOR_URL = BASE_LBAAS_ENDPOINT + '/healthmonitors'
BASE_SINGLE_HEALTH_MONITOR_URL = BASE_HEALTH_MONITOR_URL + '/{uuid}'
BASE_L7POLICY_URL = '/l7policies'
BASE_L7POLICY_URL = BASE_LBAAS_ENDPOINT + '/l7policies'
BASE_SINGLE_L7POLICY_URL = BASE_L7POLICY_URL + '/{policy_uuid}'
BASE_L7RULE_URL = BASE_SINGLE_L7POLICY_URL + '/rules'
BASE_SINGLE_L7RULE_URL = BASE_SINGLE_L7POLICY_URL + '/rules/{rule_uuid}'
BASE_QUOTA_URL = '/quotas'
BASE_QUOTA_URL = BASE_LBAAS_ENDPOINT + '/quotas'
BASE_SINGLE_QUOTA_URL = BASE_QUOTA_URL + '/{uuid}'
BASE_QUOTA_DEFAULT_URL = BASE_QUOTA_URL + '/defaults'
BASE_AMPHORA_URL = BASE_OCTAVIA_ENDPOINT + "/amphorae"
BASE_SINGLE_AMPHORA_URL = BASE_AMPHORA_URL + "/{amphora_id}"

0
octaviaclient/api/v2/__init__.py

65
octaviaclient/api/load_balancer_v2.py → octaviaclient/api/v2/octavia.py

@ -11,7 +11,7 @@
# under the License.
#
"""Load Balancer v2 API Library"""
"""Octavia API Library"""
from osc_lib.api import api
@ -40,13 +40,13 @@ def correct_return_codes(func):
return wrapper
class APIv2(api.BaseAPI):
"""Load Balancer v2 API"""
class OctaviaAPI(api.BaseAPI):
"""Octavia API"""
_endpoint_suffix = '/v2.0/lbaas'
_endpoint_suffix = '/v2.0'
def __init__(self, endpoint=None, **kwargs):
super(APIv2, self).__init__(endpoint=endpoint, **kwargs)
super(OctaviaAPI, self).__init__(endpoint=endpoint, **kwargs)
self.endpoint = self.endpoint.rstrip('/')
self._build_url()
@ -58,7 +58,7 @@ class APIv2(api.BaseAPI):
"""List all load balancers
:param params:
Parameters to filter on (not implemented)
Parameters to filter on
:return:
List of load balancers
"""
@ -114,7 +114,7 @@ class APIv2(api.BaseAPI):
"""Update a load balancer's settings
:param string lb_id:
The ID of the load baalancer to update
The ID of the load balancer to update
:param params:
A dict of arguments to update a loadbalancer
:return:
@ -138,11 +138,25 @@ class APIv2(api.BaseAPI):
return response
@correct_return_codes
def load_balancer_failover(self, lb_id):
"""Trigger load balancer failover
:param string lb_id:
ID of the load balancer to failover
:return:
Response Code from the API
"""
url = const.BASE_LOADBALANCER_FAILOVER_URL.format(uuid=lb_id)
response = self.create(url, method='PUT')
return response
def listener_list(self, **kwargs):
"""List all listeners
:param kwargs:
Parameters to filter on (not implemented)
Parameters to filter on
:return:
List of listeners
"""
@ -155,6 +169,7 @@ class APIv2(api.BaseAPI):
"""Show a listener
:param string listener_id:
ID of the listener to show
:return:
A dict of the specified listener's settings
"""
@ -210,7 +225,7 @@ class APIv2(api.BaseAPI):
"""List all pools
:param kwargs:
Parameters to filter on (not implemented)
Parameters to filter on
:return:
List of pools
"""
@ -363,7 +378,7 @@ class APIv2(api.BaseAPI):
"""List all l7policies
:param kwargs:
Parameters to filter on (not implemented)
Parameters to filter on
:return:
List of l7policies
"""
@ -432,7 +447,7 @@ class APIv2(api.BaseAPI):
"""List all l7rules for a l7policy
:param kwargs:
Parameters to filter on (not implemented)
Parameters to filter on
:return:
List of l7policies
"""
@ -512,7 +527,7 @@ class APIv2(api.BaseAPI):
"""List all health monitors
:param kwargs:
Parameters to filter on (not implemented)
Parameters to filter on
:return:
A dict containing a list of health monitors
"""
@ -646,6 +661,32 @@ class APIv2(api.BaseAPI):
return response
def amphora_show(self, amphora_id):
"""Show an amphora
:param string amphora_id:
ID of the amphora to show
:return:
A ``dict`` of the specified amphora's attributes
"""
url = const.BASE_AMPHORA_URL
response = self.find(path=url, value=amphora_id)
return response
def amphora_list(self, **kwargs):
"""List all amphorae
:param kwargs:
Parameters to filter on
:return:
A ``dict`` containing a list of amphorae
"""
url = const.BASE_AMPHORA_URL
response = self.list(path=url, **kwargs)
return response
class OctaviaClientException(Exception):
"""The base exception class for all exceptions this library raises."""

6
octaviaclient/osc/plugin.py

@ -14,7 +14,7 @@
import logging
from octaviaclient.api import load_balancer_v2
from octaviaclient.api.v2 import octavia
from osc_lib import utils
LOG = logging.getLogger(__name__)
@ -24,7 +24,7 @@ API_VERSION_OPTION = 'os_loadbalancer_api_version'
API_NAME = 'load_balancer'
LOAD_BALANCER_API_TYPE = 'loadbalancer'
LOAD_BALANCER_API_VERSIONS = {
'2.0': 'octaviaclient.api.load_balancer_v2.APIv2',
'2.0': 'octaviaclient.api.v2.octavia.OctaviaAPI',
}
@ -35,7 +35,7 @@ def make_client(instance):
region_name=instance.region_name,
interface=instance.interface,
)
client = load_balancer_v2.APIv2(
client = octavia.OctaviaAPI(
session=instance.session,
service_type='load-balancer',
endpoint=endpoint,

117
octaviaclient/osc/v2/amphora.py

@ -0,0 +1,117 @@
# 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.
#
"""Amphora action implementation"""
from cliff import lister
from osc_lib.command import command
from osc_lib import utils
from octaviaclient.osc.v2 import constants as const
from octaviaclient.osc.v2 import utils as v2_utils
class ListAmphora(lister.Lister):
"""List amphorae"""
def get_parser(self, prog_name):
parser = super(ListAmphora, self).get_parser(prog_name)
parser.add_argument(
'--loadbalancer',
metavar='<loadbalancer>',
dest='loadbalancer',
help="Filter by load balancer (name or ID).",
)
parser.add_argument(
'--compute-id',
metavar='<compute-id>',
help="Filter by compute ID.",
)
role_choices = {'MASTER', 'BACKUP', 'STANDALONE'}
parser.add_argument(
'--role',
metavar='{' + ','.join(role_choices) + '}',
choices=role_choices,
type=lambda s: s.upper(), # case insensitive
help="Filter by role."
)
status_choices = {
'ALLOCATED', 'BOOTING', 'DELETED', 'ERROR',
'PENDING_CREATE', 'PENDING_DELETE', 'READY',
}
parser.add_argument(
'--status', '--provisioning-status',
dest='status',
metavar='{' + ','.join(status_choices) + '}',
choices=status_choices,
type=lambda s: s.upper(), # case insensitive
help="Filter by amphora provisioning status."
)
return parser
def take_action(self, parsed_args):
columns = const.AMPHORA_COLUMNS
attrs = v2_utils.get_amphora_attrs(self.app.client_manager,
parsed_args)
data = self.app.client_manager.load_balancer.amphora_list(**attrs)
formatters = {
'amphorae': v2_utils.format_list,
}
return (
columns,
(utils.get_dict_properties(
amp,
columns,
formatters=formatters,
) for amp in data['amphorae']),
)
class ShowAmphora(command.ShowOne):
"""Show the details of a single amphora"""
def get_parser(self, prog_name):
parser = super(ShowAmphora, self).get_parser(prog_name)
parser.add_argument(
'amphora_id',
metavar='<amphora-id>',
help='UUID of the amphora.',
)
return parser
def take_action(self, parsed_args):
attrs = v2_utils.get_amphora_attrs(self.app.client_manager,
parsed_args)
data = self.app.client_manager.load_balancer.amphora_show(
amphora_id=attrs.pop('amphora_id'),
)
rows = const.AMPHORA_ROWS
formatters = {
'loadbalancers': v2_utils.format_list,
'amphorae': v2_utils.format_list,
}
return (rows, utils.get_dict_properties(data, rows,
formatters=formatters))

35
octaviaclient/osc/v2/constants.py

@ -29,7 +29,8 @@ LOAD_BALANCER_ROWS = (
'vip_address',
'vip_network_id',
'vip_port_id',
'vip_subnet_id')
'vip_subnet_id',
)
LOAD_BALANCER_COLUMNS = (
'id',
@ -212,7 +213,7 @@ QUOTA_ROWS = (
'listener',
'pool',
'health_monitor',
'member'
'member',
)
QUOTA_COLUMNS = (
@ -221,5 +222,33 @@ QUOTA_COLUMNS = (
'listener',
'pool',
'health_monitor',
'member'
'member',
)
AMPHORA_ROWS = (
'id',
'loadbalancer_id',
'compute_id',
'lb_network_ip',
'vrrp_ip',
'ha_ip',
'vrrp_port_id',
'ha_port_id',
'cert_expiration',
'cert_busy',
'role',
'status',
'vrrp_interface',
'vrrp_id',
'vrrp_priority',
'cached_zone',
)
AMPHORA_COLUMNS = (
'id',
'loadbalancer_id',
'status',
'role',
'lb_network_ip',
'ha_ip',
)

10
octaviaclient/osc/v2/listener.py

@ -31,7 +31,7 @@ class CreateListener(command.ShowOne):
parser.add_argument(
'loadbalancer',
metavar='<load_balancer>',
metavar='<loadbalancer>',
help="Load balancer for the listener (name or ID)."
)
parser.add_argument(
@ -155,12 +155,17 @@ class ListListener(lister.Lister):
def get_parser(self, prog_name):
parser = super(ListListener, self).get_parser(prog_name)
# Filtering will soon be implemented to allow this
parser.add_argument(
'--name',
metavar='<name>',
help="List listeners by listener name."
)
parser.add_argument(
'--loadbalancer',
metavar='<loadbalancer>',
help="Filter by load balancer (name or ID).",
)
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
'--enable',
@ -174,6 +179,7 @@ class ListListener(lister.Lister):
default=None,
help="List disabled listeners."
)
parser.add_argument(
'--project',
metavar='<project>',

23
octaviaclient/osc/v2/load_balancer.py

@ -81,6 +81,7 @@ class CreateLoadBalancer(command.ShowOne):
metavar='<project>',
help="Project for the load balancer (name or ID)."
)
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
'--enable',
@ -148,6 +149,27 @@ class DeleteLoadBalancer(command.Command):
lb_id=lb_id, **attrs)
class FailoverLoadBalancer(command.Command):
"""Trigger load balancer failover"""
def get_parser(self, prog_name):
parser = super(FailoverLoadBalancer, self).get_parser(prog_name)
parser.add_argument(
'loadbalancer',
metavar='<load_balancer>',
help="Name or UUID of the load balancer."
)
return parser
def take_action(self, parsed_args):
attrs = v2_utils.get_loadbalancer_attrs(self.app.client_manager,
parsed_args)
self.app.client_manager.load_balancer.load_balancer_failover(
lb_id=attrs.pop('loadbalancer_id'))
class ListLoadBalancer(lister.Lister):
"""List load balancers"""
@ -250,6 +272,7 @@ class SetLoadBalancer(command.Command):
metavar='<description>',
help="Set load balancer description."
)
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
'--enable',

10
octaviaclient/osc/v2/pool.py

@ -127,12 +127,18 @@ class ListPool(lister.Lister):
def get_parser(self, prog_name):
parser = super(ListPool, self).get_parser(prog_name)
parser.add_argument(
'--loadbalancer',
metavar='<loadbalancer>',
help="Filter by load balancer (name or ID).",
)
return parser
def take_action(self, parsed_args):
columns = const.POOL_COLUMNS
data = self.app.client_manager.load_balancer.pool_list()
attrs = v2_utils.get_pool_attrs(self.app.client_manager, parsed_args)
data = self.app.client_manager.load_balancer.pool_list(**attrs)
formatters = {'loadbalancers': v2_utils.format_list,
'members': v2_utils.format_list,
'listeners': v2_utils.format_list}

93
octaviaclient/osc/v2/utils.py

@ -17,6 +17,47 @@ from osc_lib import exceptions
from openstackclient.identity import common as identity_common
def _map_attrs(args, source_attr_map):
res = {}
for k, v in args.items():
if (v is None) or (k not in source_attr_map):
continue
source_val = source_attr_map[k]
# Attributes with 2 values map directly to a callable
if len(source_val) == 2:
res[source_val[0]] = source_val[1](v)
# Attributes with 3 values map directly to a resource
elif len(source_val) == 3:
if not isinstance(v, list):
res[source_val[0]] = get_resource_id(
source_val[2],
source_val[1],
v,
)
else:
res[source_val[0]] = [get_resource_id(
source_val[2],
source_val[1],
x,
) for x in v]
# Attributes with 4 values map to a resource with a parent
elif len(source_val) == 4:
parent = source_attr_map[source_val[2]]
parent_id = get_resource_id(
parent[2],
parent[1],
args[source_val[2]],
)
child = source_val
res[child[0]] = get_resource_id(
child[3],
child[1],
{child[0]: str(v), parent[0]: str(parent_id)},
)
return res
def get_resource_id(resource, resource_name, name):
"""Converts a resource name into a UUID for consumption for the API
@ -359,6 +400,26 @@ def get_quota_attrs(client_manager, parsed_args):
return attrs
def get_amphora_attrs(client_manager, parsed_args):
attr_map = {
'amphora_id': (
'amphora_id',
'amphorae',
client_manager.load_balancer.amphora_list,
),
'loadbalancer': (
'loadbalancer_id',
'loadbalancers',
client_manager.load_balancer.load_balancer_list,
),
'compute_id': ('compute_id', str),
'role': ('role', str),
'status': ('status', str),
}
return _map_attrs(vars(parsed_args), attr_map)
def format_list(data):
return '\n'.join(i['id'] for i in data)
@ -378,35 +439,3 @@ def _format_kv(data):
formatted_kv[k] = v
return formatted_kv
def _map_attrs(attrs, attr_map):
mapped_attrs = {}
for k, v in attrs.items():
if v is not None and k in attr_map.keys():
# Attributes with 2 values map directly to a callable
if len(attr_map[k]) is 2:
mapped_attrs[attr_map[k][0]] = attr_map[k][1](v)
# Attributes with 3 values map directly to a resource
elif len(attr_map[k]) is 3:
mapped_attrs[attr_map[k][0]] = get_resource_id(
attr_map[k][2],
attr_map[k][1],
v
)
# Attributes with 4 values map to a resource with a parent
else:
parent = attr_map[attr_map[k][2]]
parent_id = get_resource_id(
parent[2],
parent[1],
attrs[attr_map[k][2]]
)
child = attr_map[k]
mapped_attrs[child[0]] = get_resource_id(
child[3],
child[1],
{child[0]: str(v), parent[0]: str(parent_id)}
)
return mapped_attrs

207
octaviaclient/tests/unit/api/test_load_balancer.py → octaviaclient/tests/unit/api/test_octavia.py

@ -17,12 +17,14 @@ from keystoneauth1 import session
from oslo_utils import uuidutils
from requests_mock.contrib import fixture
from octaviaclient.api import load_balancer_v2 as lb
from osc_lib.tests import utils
from octaviaclient.api.v2 import octavia
FAKE_ACCOUNT = 'q12we34r'
FAKE_AUTH = '11223344556677889900'
FAKE_URL = 'http://example.com/v2.0/lbaas/'
FAKE_URL = 'http://example.com/v2.0/'
FAKE_LBAAS_URL = FAKE_URL + 'lbaas/'
FAKE_LB = uuidutils.generate_uuid()
FAKE_LI = uuidutils.generate_uuid()
@ -111,23 +113,23 @@ SINGLE_QT_RESP = {'quota': {'pool': -1}}
SINGLE_QT_UPDATE = {'quota': {'pool': -1}}
class TestLoadBalancerv2(utils.TestCase):
class TestOctaviaClient(utils.TestCase):
def setUp(self):
super(TestLoadBalancerv2, self).setUp()
super(TestOctaviaClient, self).setUp()
sess = session.Session()
self.api = lb.APIv2(session=sess, endpoint=FAKE_URL)
self.api = octavia.OctaviaAPI(session=sess, endpoint=FAKE_URL)
self.requests_mock = self.useFixture(fixture.Fixture())
class TestLoadBalancer(TestLoadBalancerv2):
class TestLoadBalancer(TestOctaviaClient):
_error_message = ("Validation failure: Test message.")
def test_list_load_balancer_no_options(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'loadbalancers',
FAKE_LBAAS_URL + 'loadbalancers',
json=LIST_LB_RESP,
status_code=200,
)
@ -137,7 +139,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_show_load_balancer(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'loadbalancers/' + FAKE_LB,
FAKE_LBAAS_URL + 'loadbalancers/' + FAKE_LB,
json=SINGLE_LB_RESP,
status_code=200
)
@ -147,7 +149,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_load_balancer(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'loadbalancers',
FAKE_LBAAS_URL + 'loadbalancers',
json=SINGLE_LB_RESP,
status_code=200
)
@ -157,11 +159,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_load_balancer_error(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'loadbalancers',
FAKE_LBAAS_URL + 'loadbalancers',
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.load_balancer_create,
json=SINGLE_LB_RESP)
@ -169,7 +171,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_load_balancer(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'loadbalancers/' + FAKE_LB,
FAKE_LBAAS_URL + 'loadbalancers/' + FAKE_LB,
json=SINGLE_LB_UPDATE,
status_code=200
)
@ -179,20 +181,41 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_load_balancer_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'loadbalancers/' + FAKE_LB,
FAKE_LBAAS_URL + 'loadbalancers/' + FAKE_LB,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.load_balancer_set,
FAKE_LB,
json=SINGLE_LB_UPDATE)
def test_failover_load_balancer(self):
self.requests_mock.register_uri(
'PUT',
FAKE_LBAAS_URL + 'loadbalancers/' + FAKE_LB + '/failover',
status_code=202,
)
ret = self.api.load_balancer_failover(FAKE_LB)
self.assertEqual(202, ret.status_code)
def test_failover_load_balancer_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_LBAAS_URL + 'loadbalancers/' + FAKE_LB + '/failover',
text='{"faultstring": "%s"}' % self._error_message,
status_code=409,
)
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.load_balancer_failover,
FAKE_LB)
def test_delete_load_balancer(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'loadbalancers/' + FAKE_LB,
FAKE_LBAAS_URL + 'loadbalancers/' + FAKE_LB,
status_code=200
)
ret = self.api.load_balancer_delete(FAKE_LB)
@ -201,11 +224,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_load_balancer_error(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'loadbalancers/' + FAKE_LB,
FAKE_LBAAS_URL + 'loadbalancers/' + FAKE_LB,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.load_balancer_delete,
FAKE_LB)
@ -213,7 +236,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_stats_show_load_balancer(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'loadbalancers/' + FAKE_LB + '/stats',
FAKE_LBAAS_URL + 'loadbalancers/' + FAKE_LB + '/stats',
json=SINGLE_LB_STATS_RESP,
status_code=200,
)
@ -223,7 +246,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_list_listeners_no_options(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'listeners',
FAKE_LBAAS_URL + 'listeners',
json=LIST_LI_RESP,
status_code=200,
)
@ -233,7 +256,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_show_listener(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'listeners/' + FAKE_LI,
FAKE_LBAAS_URL + 'listeners/' + FAKE_LI,
json=SINGLE_LI_RESP,
status_code=200
)
@ -243,7 +266,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_listener(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'listeners',
FAKE_LBAAS_URL + 'listeners',
json=SINGLE_LI_RESP,
status_code=200
)
@ -253,11 +276,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_listener_error(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'listeners',
FAKE_LBAAS_URL + 'listeners',
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.listener_create,
json=SINGLE_LI_RESP)
@ -265,7 +288,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_listeners(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'listeners/' + FAKE_LI,
FAKE_LBAAS_URL + 'listeners/' + FAKE_LI,
json=SINGLE_LI_UPDATE,
status_code=200
)
@ -275,11 +298,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_listeners_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'listeners/' + FAKE_LI,
FAKE_LBAAS_URL + 'listeners/' + FAKE_LI,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.listener_set,
FAKE_LI, json=SINGLE_LI_UPDATE)
@ -287,7 +310,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_listener(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'listeners/' + FAKE_LI,
FAKE_LBAAS_URL + 'listeners/' + FAKE_LI,
status_code=200
)
ret = self.api.listener_delete(FAKE_LI)
@ -296,11 +319,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_listener_error(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'listeners/' + FAKE_LI,
FAKE_LBAAS_URL + 'listeners/' + FAKE_LI,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.listener_delete,
FAKE_LI)
@ -308,7 +331,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_list_pool_no_options(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'pools',
FAKE_LBAAS_URL + 'pools',
json=LIST_PO_RESP,
status_code=200,
)
@ -318,7 +341,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_show_pool(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'pools/' + FAKE_PO,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO,
json=SINGLE_PO_RESP,
status_code=200
)
@ -328,7 +351,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_pool(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'pools',
FAKE_LBAAS_URL + 'pools',
json=SINGLE_PO_RESP,
status_code=200
)
@ -338,11 +361,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_pool_error(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'pools',
FAKE_LBAAS_URL + 'pools',
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.pool_create,
json=SINGLE_PO_RESP)
@ -350,7 +373,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_pool(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'pools/' + FAKE_PO,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO,
json=SINGLE_PO_UPDATE,
status_code=200
)
@ -360,11 +383,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_pool_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'pools/' + FAKE_PO,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.pool_set,
FAKE_PO, json=SINGLE_PO_UPDATE)
@ -372,7 +395,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_pool(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'pools/' + FAKE_PO,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO,
status_code=200
)
ret = self.api.pool_delete(FAKE_PO)
@ -381,11 +404,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_pool_error(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'pools/' + FAKE_PO,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.pool_delete,
FAKE_PO)
@ -393,7 +416,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_list_member_no_options(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'pools/' + FAKE_PO + '/members',
FAKE_LBAAS_URL + 'pools/' + FAKE_PO + '/members',
json=LIST_ME_RESP,
status_code=200,
)
@ -403,7 +426,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_show_member(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
json=SINGLE_ME_RESP,
status_code=200
)
@ -413,7 +436,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_member(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'pools/' + FAKE_PO + '/members',
FAKE_LBAAS_URL + 'pools/' + FAKE_PO + '/members',
json=SINGLE_ME_RESP,
status_code=200
)
@ -423,11 +446,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_member_error(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'pools/' + FAKE_PO + '/members',
FAKE_LBAAS_URL + 'pools/' + FAKE_PO + '/members',
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.member_create,
json=SINGLE_ME_RESP, pool_id=FAKE_PO)
@ -435,7 +458,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_member(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
json=SINGLE_ME_UPDATE,
status_code=200
)
@ -446,11 +469,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_member_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.member_set,
pool_id=FAKE_PO, member_id=FAKE_ME,
@ -459,7 +482,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_member(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
status_code=200
)
ret = self.api.member_delete(pool_id=FAKE_PO, member_id=FAKE_ME)
@ -468,11 +491,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_member_error(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
FAKE_LBAAS_URL + 'pools/' + FAKE_PO + '/members/' + FAKE_ME,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.member_delete,
pool_id=FAKE_PO, member_id=FAKE_ME)
@ -480,7 +503,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_list_l7policy_no_options(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'l7policies',
FAKE_LBAAS_URL + 'l7policies',
json=LIST_L7PO_RESP,
status_code=200,
)
@ -490,7 +513,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_show_l7policy(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'l7policies/' + FAKE_L7PO,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO,
json=SINGLE_L7PO_RESP,
status_code=200
)
@ -500,7 +523,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_l7policy(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'l7policies',
FAKE_LBAAS_URL + 'l7policies',
json=SINGLE_L7PO_RESP,
status_code=200
)
@ -510,11 +533,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_l7policy_error(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'l7policies',
FAKE_LBAAS_URL + 'l7policies',
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.l7policy_create,
json=SINGLE_L7PO_RESP)
@ -522,7 +545,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_l7policy(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'l7policies/' + FAKE_L7PO,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO,
json=SINGLE_L7PO_UPDATE,
status_code=200
)
@ -532,11 +555,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_l7policy_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'l7policies/' + FAKE_L7PO,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.l7policy_set,
FAKE_L7PO, json=SINGLE_L7PO_UPDATE)
@ -544,7 +567,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_l7policy(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'l7policies/' + FAKE_L7PO,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO,
status_code=200
)
ret = self.api.l7policy_delete(FAKE_L7PO)
@ -553,11 +576,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_l7policy_error(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'l7policies/' + FAKE_L7PO,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.l7policy_delete,
FAKE_L7PO)
@ -565,7 +588,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_list_l7rule_no_options(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'l7policies/' + FAKE_L7PO + '/rules',
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO + '/rules',
json=LIST_L7RU_RESP,
status_code=200,
)
@ -575,7 +598,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_show_l7rule(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
json=SINGLE_L7RU_RESP,
status_code=200
)
@ -585,7 +608,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_l7rule(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'l7policies/' + FAKE_L7PO + '/rules',
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO + '/rules',
json=SINGLE_L7RU_RESP,
status_code=200
)
@ -595,11 +618,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_l7rule_error(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'l7policies/' + FAKE_L7PO + '/rules',
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO + '/rules',
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.l7rule_create,
FAKE_L7PO, json=SINGLE_L7RU_RESP)
@ -607,7 +630,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_l7rule(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
json=SINGLE_L7RU_UPDATE,
status_code=200
)
@ -621,11 +644,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_l7rule_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.l7rule_set,
l7rule_id=FAKE_L7RU,
@ -635,7 +658,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_l7rule(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
status_code=200
)
ret = self.api.l7rule_delete(
@ -647,11 +670,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_l7rule_error(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
FAKE_LBAAS_URL + 'l7policies/' + FAKE_L7PO + '/rules/' + FAKE_L7RU,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.l7rule_delete,
l7rule_id=FAKE_L7RU,
@ -660,7 +683,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_list_health_monitor_no_options(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'healthmonitors',
FAKE_LBAAS_URL + 'healthmonitors',
json=LIST_HM_RESP,
status_code=200,
)
@ -670,7 +693,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_show_health_monitor(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'healthmonitors/' + FAKE_HM,
FAKE_LBAAS_URL + 'healthmonitors/' + FAKE_HM,
json=SINGLE_HM_RESP,
status_code=200
)
@ -680,7 +703,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_health_monitor(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'healthmonitors',
FAKE_LBAAS_URL + 'healthmonitors',
json=SINGLE_HM_RESP,
status_code=200
)
@ -690,11 +713,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_create_health_monitor_error(self):
self.requests_mock.register_uri(
'POST',
FAKE_URL + 'healthmonitors',
FAKE_LBAAS_URL + 'healthmonitors',
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.health_monitor_create,
json=SINGLE_HM_RESP)
@ -702,7 +725,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_health_monitor(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'healthmonitors/' + FAKE_HM,
FAKE_LBAAS_URL + 'healthmonitors/' + FAKE_HM,
json=SINGLE_HM_UPDATE,
status_code=200
)
@ -712,11 +735,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_health_monitor_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'healthmonitors/' + FAKE_HM,
FAKE_LBAAS_URL + 'healthmonitors/' + FAKE_HM,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.health_monitor_set,
FAKE_HM, json=SINGLE_HM_UPDATE)
@ -724,7 +747,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_health_monitor(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'healthmonitors/' + FAKE_HM,
FAKE_LBAAS_URL + 'healthmonitors/' + FAKE_HM,
status_code=200
)
ret = self.api.health_monitor_delete(FAKE_HM)
@ -733,11 +756,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_delete_health_monitor_error(self):
self.requests_mock.register_uri(
'DELETE',
FAKE_URL + 'healthmonitors/' + FAKE_HM,
FAKE_LBAAS_URL + 'healthmonitors/' + FAKE_HM,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.health_monitor_delete,
FAKE_HM)
@ -745,7 +768,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_list_quota_no_options(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'quotas',
FAKE_LBAAS_URL + 'quotas',
json=LIST_QT_RESP,
status_code=200,
)
@ -755,7 +778,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_show_quota(self):
self.requests_mock.register_uri(
'GET',
FAKE_URL + 'quotas/' + FAKE_PRJ,
FAKE_LBAAS_URL + 'quotas/' + FAKE_PRJ,
json=SINGLE_QT_RESP,
status_code=200
)
@ -765,7 +788,7 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_quota(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'quotas/' + FAKE_PRJ,
FAKE_LBAAS_URL + 'quotas/' + FAKE_PRJ,
json=SINGLE_QT_UPDATE,
status_code=200
)
@ -775,11 +798,11 @@ class TestLoadBalancer(TestLoadBalancerv2):
def test_set_quota_error(self):
self.requests_mock.register_uri(
'PUT',
FAKE_URL + 'quotas/' + FAKE_PRJ,
FAKE_LBAAS_URL + 'quotas/' + FAKE_PRJ,
text='{"faultstring": "%s"}' % self._error_message,
status_code=400
)
self.assertRaisesRegex(lb.OctaviaClientException,
self.assertRaisesRegex(octavia.OctaviaClientException,
self._error_message,
self.api.quota_set,