Merge "Add listener stats service client and API test"
diff --git a/octavia_tempest_plugin/clients.py b/octavia_tempest_plugin/clients.py
index 1a0a894..c1894e3 100644
--- a/octavia_tempest_plugin/clients.py
+++ b/octavia_tempest_plugin/clients.py
@@ -18,6 +18,10 @@
from octavia_tempest_plugin.services.load_balancer.v2 import (
amphora_client)
from octavia_tempest_plugin.services.load_balancer.v2 import (
+ flavor_client)
+from octavia_tempest_plugin.services.load_balancer.v2 import (
+ flavor_profile_client)
+from octavia_tempest_plugin.services.load_balancer.v2 import (
healthmonitor_client)
from octavia_tempest_plugin.services.load_balancer.v2 import (
l7policy_client)
@@ -31,6 +35,8 @@
member_client)
from octavia_tempest_plugin.services.load_balancer.v2 import (
pool_client)
+from octavia_tempest_plugin.services.load_balancer.v2 import (
+ provider_client)
CONF = config.CONF
SERVICE_TYPE = 'load-balancer'
@@ -57,3 +63,9 @@
self.auth_provider, SERVICE_TYPE, CONF.identity.region)
self.amphora_client = amphora_client.AmphoraClient(
self.auth_provider, SERVICE_TYPE, CONF.identity.region)
+ self.flavor_profile_client = flavor_profile_client.FlavorProfileClient(
+ self.auth_provider, SERVICE_TYPE, CONF.identity.region)
+ self.flavor_client = flavor_client.FlavorClient(
+ self.auth_provider, SERVICE_TYPE, CONF.identity.region)
+ self.provider_client = provider_client.ProviderClient(
+ self.auth_provider, SERVICE_TYPE, CONF.identity.region)
diff --git a/octavia_tempest_plugin/common/constants.py b/octavia_tempest_plugin/common/constants.py
index 4154e7b..0122424 100644
--- a/octavia_tempest_plugin/common/constants.py
+++ b/octavia_tempest_plugin/common/constants.py
@@ -28,6 +28,7 @@
POOLS = 'pools'
PROJECT_ID = 'project_id'
PROVIDER = 'provider'
+PROVIDER_NAME = 'provider_name'
PROVISIONING_STATUS = 'provisioning_status'
REQUEST_ERRORS = 'request_errors'
TOTAL_CONNECTIONS = 'total_connections'
@@ -77,6 +78,10 @@
URL_PATH = 'url_path'
EXPECTED_CODES = 'expected_codes'
+FLAVOR_DATA = 'flavor_data'
+ENABLED = 'enabled'
+FLAVOR_PROFILE_ID = 'flavor_profile_id'
+
# Other constants
ACTIVE = 'ACTIVE'
ADMIN_STATE_UP_TRUE = 'true'
@@ -89,6 +94,8 @@
NO_MONITOR = 'NO_MONITOR'
ERROR = 'ERROR'
SORT = 'sort'
+SINGLE = 'SINGLE'
+ACTIVE_STANDBY = 'ACTIVE_STANDBY'
# Protocols
HTTP = 'HTTP'
@@ -185,6 +192,9 @@
STATUS_PENDING_DELETE, STATUS_DELETED, STATUS_ERROR
)
+# Flavor capabilities
+LOADBALANCER_TOPOLOGY = 'loadbalancer_topology'
+
# API valid fields
SHOW_LOAD_BALANCER_RESPONSE_FIELDS = (
ADMIN_STATE_UP, CREATED_AT, DESCRIPTION, FLAVOR_ID, ID, LISTENERS, NAME,
@@ -232,3 +242,7 @@
VRRP_PORT_ID, HA_PORT_ID, CERT_EXPIRATION, CERT_BUSY, ROLE, STATUS,
VRRP_INTERFACE, VRRP_ID, VRRP_PRIORITY, CACHED_ZONE
]
+
+SHOW_FLAVOR_PROFILE_FIELDS = [ID, NAME, PROVIDER_NAME, FLAVOR_DATA]
+
+SHOW_FLAVOR_FIELDS = [ID, NAME, DESCRIPTION, ENABLED, FLAVOR_PROFILE_ID]
diff --git a/octavia_tempest_plugin/config.py b/octavia_tempest_plugin/config.py
index 1bc4a63..91aa2c4 100644
--- a/octavia_tempest_plugin/config.py
+++ b/octavia_tempest_plugin/config.py
@@ -114,6 +114,16 @@
help='Type of RBAC tests to run. "advanced" runs the octavia '
'default RBAC tests. "owner_or_admin" runs the legacy '
'owner or admin tests. "none" disables the RBAC tests.'),
+ cfg.DictOpt('enabled_provider_drivers',
+ help=('List of enabled provider drivers and description '
+ 'dictionaries. Must match the driver name in the '
+ 'octavia.api.drivers entrypoint. Example: '
+ '{\'amphora\': \'The Octavia Amphora driver.\', '
+ '\'octavia\': \'Deprecated alias of the Octavia '
+ 'Amphora driver.\'}'),
+ default={'amphora': 'The Octavia Amphora driver.',
+ 'octavia': 'Deprecated alias of the Octavia Amphora '
+ 'driver.'}),
# Networking
cfg.BoolOpt('test_with_ipv6',
default=True,
@@ -176,4 +186,12 @@
default=True,
help="Whether TLS termination is available with provider "
"driver or not."),
+ cfg.BoolOpt('l7_protocol_enabled',
+ default=True,
+ help="Whether L7 Protocols are available with the provider"
+ " driver or not."),
+ cfg.StrOpt('l4_protocol',
+ default="TCP",
+ help="The type of L4 Protocol which is supported with the"
+ " provider driver."),
]
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/base_client.py b/octavia_tempest_plugin/services/load_balancer/v2/base_client.py
index 97e91d9..397c735 100644
--- a/octavia_tempest_plugin/services/load_balancer/v2/base_client.py
+++ b/octavia_tempest_plugin/services/load_balancer/v2/base_client.py
@@ -414,6 +414,13 @@
const.ACTIVE,
self.build_interval,
self.timeout)
+ else:
+ LOG.info("Waiting for %s %s to be DELETED...",
+ wait_client.root_tag, wait_id)
+ waiters.wait_for_deleted_status_or_not_found(
+ wait_func, wait_id, const.PROVISIONING_STATUS,
+ CONF.load_balancer.check_interval,
+ CONF.load_balancer.check_timeout)
LOG.info("Cleanup complete for %s %s...", self.root_tag, obj_id)
return return_status
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/flavor_client.py b/octavia_tempest_plugin/services/load_balancer/v2/flavor_client.py
new file mode 100644
index 0000000..085da9e
--- /dev/null
+++ b/octavia_tempest_plugin/services/load_balancer/v2/flavor_client.py
@@ -0,0 +1,263 @@
+# Copyright 2019 Rackspace US Inc. All rights reserved.
+#
+# 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 oslo_log import log as logging
+from tempest.lib import exceptions
+
+from octavia_tempest_plugin.services.load_balancer.v2 import base_client
+
+LOG = logging.getLogger(__name__)
+Unset = base_client.Unset
+
+
+class FlavorClient(base_client.BaseLBaaSClient):
+
+ root_tag = 'flavor'
+ list_root_tag = 'flavors'
+
+ def create_flavor(self, name, flavor_profile_id, description=Unset,
+ enabled=Unset, return_object_only=True):
+ """Create a flavor.
+
+ :param name: Human-readable name of the resource.
+ :param flavor_profile_id: The ID of the associated flavor profile.
+ :param description: A human-readable description for the resource.
+ :param enabled: If the resource is available for use.
+ The default is True.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A flavor object.
+ """
+ kwargs = {arg: value for arg, value in locals().items()
+ if arg != 'self' and value is not Unset}
+ return self._create_object(**kwargs)
+
+ def show_flavor(self, flavor_id, query_params=None,
+ return_object_only=True):
+ """Get the flavor details.
+
+ :param flavor_id: The flavor ID to query.
+ :param query_params: The optional query parameters to append to the
+ request. Ex. fields=id&fields=name
+ :param return_object_only: If True, the response returns the object
+ inside the root tag. False returns the full
+ response from the API.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A flavor object.
+ """
+ return self._show_object(obj_id=flavor_id,
+ query_params=query_params,
+ return_object_only=return_object_only)
+
+ def list_flavors(self, query_params=None, return_object_only=True):
+ """Get a list of flavor objects.
+
+ :param query_params: The optional query parameters to append to the
+ request. Ex. fields=id&fields=name
+ :param return_object_only: If True, the response returns the object
+ inside the root tag. False returns the full
+ response from the API.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A list of flavor objects.
+ """
+ return self._list_objects(query_params=query_params,
+ return_object_only=return_object_only)
+
+ def update_flavor(self, flavor_id, name=Unset, description=Unset,
+ enabled=Unset, return_object_only=True):
+ """Update a flavor.
+
+ :param flavor_id: The flavor ID to update.
+ :param name: Human-readable name of the resource.
+ :param description: A human-readable description for the resource.
+ :param enabled: If the resource is available for use.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A flavor object.
+ """
+ kwargs = {arg: value for arg, value in locals().items()
+ if arg != 'self' and value is not Unset}
+ kwargs['obj_id'] = kwargs.pop('flavor_id')
+ return self._update_object(**kwargs)
+
+ def delete_flavor(self, flavor_id, ignore_errors=False):
+ """Delete a flavor.
+
+ :param flavor_id: The flavor ID to delete.
+ :param ignore_errors: True if errors should be ignored.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: None if ignore_errors is True, the response status code
+ if not.
+ """
+ return self._delete_obj(obj_id=flavor_id, ignore_errors=ignore_errors)
+
+ def cleanup_a_flavor(self, flavor_id):
+ """Delete a flavor for tempest cleanup.
+
+ We cannot use the cleanup_flavor method as flavors
+ do not have a provisioning_status.
+
+ :param flavor_id: The flavor ID to delete.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: None if ignore_errors is True, the response status code
+ if not.
+ """
+ try:
+ self._delete_obj(obj_id=flavor_id)
+ except exceptions.NotFound:
+ # Already gone, cleanup complete
+ LOG.info("Flavor %s is already gone. "
+ "Cleanup considered complete.", flavor_id)
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/flavor_profile_client.py b/octavia_tempest_plugin/services/load_balancer/v2/flavor_profile_client.py
new file mode 100644
index 0000000..7f359b2
--- /dev/null
+++ b/octavia_tempest_plugin/services/load_balancer/v2/flavor_profile_client.py
@@ -0,0 +1,263 @@
+# Copyright 2019 Rackspace US Inc. All rights reserved.
+#
+# 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 oslo_log import log as logging
+from tempest.lib import exceptions
+
+from octavia_tempest_plugin.services.load_balancer.v2 import base_client
+
+LOG = logging.getLogger(__name__)
+Unset = base_client.Unset
+
+
+class FlavorProfileClient(base_client.BaseLBaaSClient):
+
+ root_tag = 'flavorprofile'
+ list_root_tag = 'flavorprofiles'
+
+ def create_flavor_profile(self, name, provider_name, flavor_data,
+ return_object_only=True):
+ """Create a flavor profile.
+
+ :param name: Human-readable name of the resource.
+ :param provider_name: The octavia provider name.
+ :param flavor_data: The JSON string containing the flavor metadata.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A flavor profile object.
+ """
+ kwargs = {arg: value for arg, value in locals().items()
+ if arg != 'self' and value is not Unset}
+ return self._create_object(**kwargs)
+
+ def show_flavor_profile(self, flavorprofile_id, query_params=None,
+ return_object_only=True):
+ """Get the flavor profile details.
+
+ :param flavorprofile_id: The flavor profile ID to query.
+ :param query_params: The optional query parameters to append to the
+ request. Ex. fields=id&fields=name
+ :param return_object_only: If True, the response returns the object
+ inside the root tag. False returns the full
+ response from the API.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A flavor profile object.
+ """
+ return self._show_object(obj_id=flavorprofile_id,
+ query_params=query_params,
+ return_object_only=return_object_only)
+
+ def list_flavor_profiles(self, query_params=None, return_object_only=True):
+ """Get a list of flavor profile objects.
+
+ :param query_params: The optional query parameters to append to the
+ request. Ex. fields=id&fields=name
+ :param return_object_only: If True, the response returns the object
+ inside the root tag. False returns the full
+ response from the API.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A list of flavor profile objects.
+ """
+ return self._list_objects(query_params=query_params,
+ return_object_only=return_object_only)
+
+ def update_flavor_profile(
+ self, flavorprofile_id, name=Unset, provider_name=Unset,
+ flavor_data=Unset, return_object_only=True):
+ """Update a flavor profile.
+
+ :param flavorprofile_id: The flavor profile ID to update.
+ :param name: Human-readable name of the resource.
+ :param provider_name: The octavia provider name.
+ :param flavor_data: The JSON string containing the flavor metadata.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A flavor profile object.
+ """
+ kwargs = {arg: value for arg, value in locals().items()
+ if arg != 'self' and value is not Unset}
+ kwargs['obj_id'] = kwargs.pop('flavorprofile_id')
+ return self._update_object(**kwargs)
+
+ def delete_flavor_profile(self, flavorprofile_id, ignore_errors=False):
+ """Delete a flavor profile.
+
+ :param flavorprofile_id: The flavor profile ID to delete.
+ :param ignore_errors: True if errors should be ignored.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: None if ignore_errors is True, the response status code
+ if not.
+ """
+ return self._delete_obj(obj_id=flavorprofile_id,
+ ignore_errors=ignore_errors)
+
+ def cleanup_flavor_profile(self, flavorprofile_id):
+ """Delete a flavor profile for tempest cleanup.
+
+ We cannot use the cleanup_flavorprofile method as flavor profiles
+ do not have a provisioning_status.
+
+ :param flavorprofile_id: The flavor profile ID to delete.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: None if ignore_errors is True, the response status code
+ if not.
+ """
+ try:
+ self._delete_obj(obj_id=flavorprofile_id)
+ except exceptions.NotFound:
+ # Already gone, cleanup complete
+ LOG.info("Flavor profile %s is already gone. "
+ "Cleanup considered complete.", flavorprofile_id)
diff --git a/octavia_tempest_plugin/services/load_balancer/v2/provider_client.py b/octavia_tempest_plugin/services/load_balancer/v2/provider_client.py
new file mode 100644
index 0000000..cbef1df
--- /dev/null
+++ b/octavia_tempest_plugin/services/load_balancer/v2/provider_client.py
@@ -0,0 +1,61 @@
+# Copyright 2019 Rackspace US Inc. All rights reserved.
+#
+# 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 octavia_tempest_plugin.services.load_balancer.v2 import base_client
+
+Unset = base_client.Unset
+
+
+class ProviderClient(base_client.BaseLBaaSClient):
+
+ list_root_tag = 'providers'
+
+ def list_providers(self, query_params=None, return_object_only=True):
+ """Get a list of provider objects.
+
+ :param query_params: The optional query parameters to append to the
+ request. Ex. fields=id&fields=name
+ :param return_object_only: If True, the response returns the object
+ inside the root tag. False returns the full
+ response from the API.
+ :raises AssertionError: if the expected_code isn't a valid http success
+ response code
+ :raises BadRequest: If a 400 response code is received
+ :raises Conflict: If a 409 response code is received
+ :raises Forbidden: If a 403 response code is received
+ :raises Gone: If a 410 response code is received
+ :raises InvalidContentType: If a 415 response code is received
+ :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
+ :raises InvalidHttpSuccessCode: if the read code isn't an expected
+ http success code
+ :raises NotFound: If a 404 response code is received
+ :raises NotImplemented: If a 501 response code is received
+ :raises OverLimit: If a 413 response code is received and over_limit is
+ not in the response body
+ :raises RateLimitExceeded: If a 413 response code is received and
+ over_limit is in the response body
+ :raises ServerFault: If a 500 response code is received
+ :raises Unauthorized: If a 401 response code is received
+ :raises UnexpectedContentType: If the content-type of the response
+ isn't an expect type
+ :raises UnexpectedResponseCode: If a response code above 400 is
+ received and it doesn't fall into any
+ of the handled checks
+ :raises UnprocessableEntity: If a 422 response code is received and
+ couldn't be parsed
+ :returns: A list of provider objects.
+ """
+ return self._list_objects(query_params=query_params,
+ return_object_only=return_object_only)
diff --git a/octavia_tempest_plugin/tests/api/v2/test_flavor.py b/octavia_tempest_plugin/tests/api/v2/test_flavor.py
new file mode 100644
index 0000000..be3ac76
--- /dev/null
+++ b/octavia_tempest_plugin/tests/api/v2/test_flavor.py
@@ -0,0 +1,419 @@
+# Copyright 2019 Rackspace US Inc. All rights reserved.
+#
+# 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.
+
+import copy
+from operator import itemgetter
+from uuid import UUID
+
+from oslo_serialization import jsonutils
+from tempest import config
+from tempest.lib.common.utils import data_utils
+from tempest.lib import decorators
+from tempest.lib import exceptions
+
+from octavia_tempest_plugin.common import constants as const
+from octavia_tempest_plugin.tests import test_base
+
+CONF = config.CONF
+
+
+class FlavorAPITest(test_base.LoadBalancerBaseTest):
+ """Test the flavor object API."""
+
+ @classmethod
+ def resource_setup(cls):
+ """Setup resources needed by the tests."""
+ super(FlavorAPITest, cls).resource_setup()
+
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not cls.lb_admin_flavor_profile_client.is_version_supported(
+ cls.api_version, '2.6'):
+ return
+
+ # Create a shared flavor profile
+ flavor_profile_name = data_utils.rand_name(
+ "lb_admin_flavorprofile-setup")
+ flavor_data = {const.LOADBALANCER_TOPOLOGY: const.SINGLE}
+ flavor_data_json = jsonutils.dumps(flavor_data)
+
+ flavor_profile_kwargs = {
+ const.NAME: flavor_profile_name,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data_json
+ }
+
+ cls.flavor_profile = (
+ cls.lb_admin_flavor_profile_client.create_flavor_profile(
+ **flavor_profile_kwargs))
+ cls.addClassResourceCleanup(
+ cls.lb_admin_flavor_profile_client.cleanup_flavor_profile,
+ cls.flavor_profile[const.ID])
+ cls.flavor_profile_id = cls.flavor_profile[const.ID]
+
+ @decorators.idempotent_id('7e8f39ce-53e0-4364-8778-6da9b9a59e5a')
+ def test_flavor_create(self):
+ """Tests flavor create and basic show APIs.
+
+ * Tests that users without the loadbalancer admin role cannot
+ create a flavor.
+ * Create a fully populated flavor.
+ * Validate the response reflects the requested values.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavors are only available on '
+ 'Octavia API version 2.6 or newer.')
+ flavor_name = data_utils.rand_name("lb_admin_flavor-create")
+ flavor_description = data_utils.arbitrary_string(size=255)
+
+ flavor_kwargs = {
+ const.NAME: flavor_name,
+ const.DESCRIPTION: flavor_description,
+ const.ENABLED: True,
+ const.FLAVOR_PROFILE_ID: self.flavor_profile_id}
+
+ # Test that a user without the load balancer admin role cannot
+ # create a flavor
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(exceptions.Forbidden,
+ self.os_primary.flavor_client.create_flavor,
+ **flavor_kwargs)
+
+ # Happy path
+ flavor = self.lb_admin_flavor_client.create_flavor(**flavor_kwargs)
+ self.addCleanup(self.lb_admin_flavor_client.cleanup_a_flavor,
+ flavor[const.ID])
+
+ UUID(flavor[const.ID])
+ self.assertEqual(flavor_name, flavor[const.NAME])
+ self.assertEqual(flavor_description, flavor[const.DESCRIPTION])
+ self.assertTrue(flavor[const.ENABLED])
+ self.assertEqual(self.flavor_profile_id,
+ flavor[const.FLAVOR_PROFILE_ID])
+
+ @decorators.idempotent_id('3ef040ee-fe7e-457b-a56f-8b152f7afa3b')
+ def test_flavor_list(self):
+ """Tests flavor list API and field filtering.
+
+ * Create three flavors.
+ * Validates that non-admin accounts cannot list the flavors.
+ * List the flavors using the default sort order.
+ * List the flavors using descending sort order.
+ * List the flavors using ascending sort order.
+ * List the flavors returning one field at a time.
+ * List the flavors returning two fields.
+ * List the flavors filtering to one of the three.
+ * List the flavors filtered, one field, and sorted.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavors are only available on '
+ 'Octavia API version 2.6 or newer.')
+
+ # Create flavor 1
+ flavor1_name = data_utils.rand_name("lb_admin_flavor-list-1")
+ flavor1_description = 'A'
+
+ flavor1_kwargs = {
+ const.NAME: flavor1_name,
+ const.DESCRIPTION: flavor1_description,
+ const.ENABLED: True,
+ const.FLAVOR_PROFILE_ID: self.flavor_profile_id}
+
+ flavor1 = (self.lb_admin_flavor_client.create_flavor(**flavor1_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_client.cleanup_a_flavor, flavor1[const.ID])
+
+ # Create flavor 2
+ flavor2_name = data_utils.rand_name("lb_admin_flavor-list-2")
+ flavor2_description = 'B'
+
+ flavor2_kwargs = {
+ const.NAME: flavor2_name,
+ const.DESCRIPTION: flavor2_description,
+ const.ENABLED: False,
+ const.FLAVOR_PROFILE_ID: self.flavor_profile_id}
+
+ flavor2 = (self.lb_admin_flavor_client.create_flavor(**flavor2_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_client.cleanup_a_flavor, flavor2[const.ID])
+
+ # Create flavor 3
+ flavor3_name = data_utils.rand_name("lb_admin_flavor-list-3")
+ flavor3_description = 'C'
+
+ flavor3_kwargs = {
+ const.NAME: flavor3_name,
+ const.DESCRIPTION: flavor3_description,
+ const.ENABLED: True,
+ const.FLAVOR_PROFILE_ID: self.flavor_profile_id}
+
+ flavor3 = (self.lb_admin_flavor_client.create_flavor(**flavor3_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_client.cleanup_a_flavor, flavor3[const.ID])
+
+ # default sort order (by ID) reference list
+ ref_id_list_asc = [flavor1[const.ID], flavor2[const.ID],
+ flavor3[const.ID]]
+ ref_id_list_dsc = copy.deepcopy(ref_id_list_asc)
+ ref_id_list_asc.sort()
+ ref_id_list_dsc.sort(reverse=True)
+
+ # Test that a user without the load balancer role cannot
+ # list flavors.
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_client.list_flavors)
+
+ # Check the default sort order (by ID)
+ flavors = self.mem_flavor_client.list_flavors()
+ # Remove flavors not used in this test
+ flavors = [flav for flav in flavors
+ if 'lb_admin_flavor-list' in flav[const.NAME]]
+ self.assertEqual(3, len(flavors))
+ self.assertEqual(ref_id_list_asc[0], flavors[0][const.ID])
+ self.assertEqual(ref_id_list_asc[1], flavors[1][const.ID])
+ self.assertEqual(ref_id_list_asc[2], flavors[2][const.ID])
+
+ # Check the descending sort order by name
+ flavors = self.lb_admin_flavor_client.list_flavors(
+ query_params='{sort}={name}:{order}'.format(
+ sort=const.SORT, name=const.NAME, order=const.DESC))
+ # Remove flavors not used in this test
+ flavors = [flav for flav in flavors
+ if 'lb_admin_flavor-list' in flav[const.NAME]]
+ self.assertEqual(3, len(flavors))
+ self.assertEqual(flavor3_name, flavors[0][const.NAME])
+ self.assertEqual(flavor2_name, flavors[1][const.NAME])
+ self.assertEqual(flavor1_name, flavors[2][const.NAME])
+
+ # Check the ascending sort order by name
+ flavors = self.mem_flavor_client.list_flavors(
+ query_params='{sort}={name}:{order}'.format(
+ sort=const.SORT, name=const.NAME, order=const.ASC))
+ # Remove flavors not used in this test
+ flavors = [flav for flav in flavors
+ if 'lb_admin_flavor-list' in flav[const.NAME]]
+ self.assertEqual(3, len(flavors))
+ self.assertEqual(flavor1_name, flavors[0][const.NAME])
+ self.assertEqual(flavor2_name, flavors[1][const.NAME])
+ self.assertEqual(flavor3_name, flavors[2][const.NAME])
+
+ ref_flavors = [flavor1, flavor2, flavor3]
+ sorted_flavors = sorted(ref_flavors, key=itemgetter(const.ID))
+ sorted_enabled_flavors = [flav for flav in sorted_flavors
+ if flav[const.ENABLED]]
+
+ # Test fields
+ for field in const.SHOW_FLAVOR_FIELDS:
+ flavors = self.mem_flavor_client.list_flavors(
+ query_params='{fields}={field}&{fields}={name}'.format(
+ fields=const.FIELDS, field=field, name=const.NAME))
+ # Remove flavors not used in this test
+ flavors = [flav for flav in flavors
+ if 'lb_admin_flavor-list' in flav[const.NAME]]
+ self.assertEqual(3, len(flavors))
+ self.assertEqual(sorted_flavors[0][field], flavors[0][field])
+ self.assertEqual(sorted_flavors[1][field], flavors[1][field])
+ self.assertEqual(sorted_flavors[2][field], flavors[2][field])
+
+ # Test filtering
+ flavor = self.mem_flavor_client.list_flavors(
+ query_params='{name}={flav_name}'.format(
+ name=const.NAME, flav_name=flavor2[const.NAME]))
+ self.assertEqual(1, len(flavor))
+ self.assertEqual(flavor2[const.ID], flavor[0][const.ID])
+
+ # Test combined params
+ flavors = self.mem_flavor_client.list_flavors(
+ query_params='{enabled}={enable}&{fields}={name}&'
+ '{sort}={ID}:{desc}'.format(
+ enabled=const.ENABLED,
+ enable=True,
+ fields=const.FIELDS, name=const.NAME,
+ sort=const.SORT, ID=const.ID,
+ desc=const.DESC))
+ # Remove flavors not used in this test
+ flavors = [flav for flav in flavors
+ if 'lb_admin_flavor-list' in flav[const.NAME]]
+ self.assertEqual(2, len(flavors))
+ self.assertEqual(1, len(flavors[0]))
+ self.assertEqual(sorted_enabled_flavors[1][const.NAME],
+ flavors[0][const.NAME])
+ self.assertEqual(sorted_enabled_flavors[0][const.NAME],
+ flavors[1][const.NAME])
+
+ @decorators.idempotent_id('7492a862-4011-4924-8e81-70763f479cf8')
+ def test_flavor_show(self):
+ """Tests flavor show API.
+
+ * Create a fully populated flavor.
+ * Validates that non-lb-admin accounts cannot see the flavor.
+ * Show flavor details.
+ * Validate the show reflects the requested values.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavors are only available on '
+ 'Octavia API version 2.6 or newer.')
+ flavor_name = data_utils.rand_name("lb_admin_flavor-show")
+ flavor_description = data_utils.arbitrary_string(size=255)
+
+ flavor_kwargs = {
+ const.NAME: flavor_name,
+ const.DESCRIPTION: flavor_description,
+ const.ENABLED: True,
+ const.FLAVOR_PROFILE_ID: self.flavor_profile_id}
+
+ # Happy path
+ flavor = self.lb_admin_flavor_client.create_flavor(**flavor_kwargs)
+ self.addCleanup(self.lb_admin_flavor_client.cleanup_a_flavor,
+ flavor[const.ID])
+
+ # Test that a user without the load balancer role cannot
+ # show flavor details.
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_client.show_flavor,
+ flavor[const.ID])
+
+ result = self.mem_flavor_client.show_flavor(flavor[const.ID])
+
+ self.assertEqual(flavor[const.ID], result[const.ID])
+ self.assertEqual(flavor_name, result[const.NAME])
+ self.assertEqual(flavor_description, result[const.DESCRIPTION])
+ self.assertTrue(result[const.ENABLED])
+ self.assertEqual(self.flavor_profile_id,
+ result[const.FLAVOR_PROFILE_ID])
+
+ @decorators.idempotent_id('3d9e2820-a68e-4db9-bf94-53cbcff2dc15')
+ def test_flavor_update(self):
+ """Tests flavor update API.
+
+ * Create a fully populated flavor.
+ * Show flavor details.
+ * Validate the show reflects the initial values.
+ * Validates that non-admin accounts cannot update the flavor.
+ * Update the flavor details.
+ * Show flavor details.
+ * Validate the show reflects the updated values.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavors are only available on '
+ 'Octavia API version 2.6 or newer.')
+ flavor_name = data_utils.rand_name("lb_admin_flavor-update")
+ flavor_description = data_utils.arbitrary_string(size=255)
+
+ flavor_kwargs = {
+ const.NAME: flavor_name,
+ const.DESCRIPTION: flavor_description,
+ const.ENABLED: True,
+ const.FLAVOR_PROFILE_ID: self.flavor_profile_id}
+
+ # Happy path
+ flavor = self.lb_admin_flavor_client.create_flavor(**flavor_kwargs)
+ self.addCleanup(self.lb_admin_flavor_client.cleanup_a_flavor,
+ flavor[const.ID])
+
+ flavor_name2 = data_utils.rand_name("lb_admin_flavor-update-2")
+ flavor_description2 = data_utils.arbitrary_string(size=255)
+ flavor_updated_kwargs = {
+ const.NAME: flavor_name2,
+ const.DESCRIPTION: flavor_description2,
+ const.ENABLED: False}
+
+ # Test that a user without the load balancer role cannot
+ # show flavor details.
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_client.update_flavor,
+ flavor[const.ID], **flavor_updated_kwargs)
+
+ updated_flavor = self.lb_admin_flavor_client.update_flavor(
+ flavor[const.ID], **flavor_updated_kwargs)
+
+ self.assertEqual(flavor[const.ID], updated_flavor[const.ID])
+ self.assertEqual(flavor_name2, updated_flavor[const.NAME])
+ self.assertEqual(flavor_description2,
+ updated_flavor[const.DESCRIPTION])
+ self.assertEqual(flavor[const.FLAVOR_PROFILE_ID],
+ updated_flavor[const.FLAVOR_PROFILE_ID])
+ self.assertFalse(updated_flavor[const.ENABLED])
+
+ result = self.mem_flavor_client.show_flavor(flavor[const.ID])
+
+ self.assertEqual(flavor[const.ID], result[const.ID])
+ self.assertEqual(flavor_name2, result[const.NAME])
+ self.assertEqual(flavor_description2,
+ result[const.DESCRIPTION])
+ self.assertEqual(flavor[const.FLAVOR_PROFILE_ID],
+ result[const.FLAVOR_PROFILE_ID])
+ self.assertFalse(result[const.ENABLED])
+
+ @decorators.idempotent_id('dfe9173a-26f3-4bba-9e69-d2b817ff2b86')
+ def test_flavor_delete(self):
+ """Tests flavor create and delete APIs.
+
+ * Creates a flavor.
+ * Validates that other accounts cannot delete the flavor.
+ * Deletes the flavor.
+ * Validates the flavor no longer exists.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavors are only available on '
+ 'Octavia API version 2.6 or newer.')
+ flavor_name = data_utils.rand_name("lb_admin_flavor-delete")
+ flavor_description = data_utils.arbitrary_string(size=255)
+
+ flavor_kwargs = {
+ const.NAME: flavor_name,
+ const.DESCRIPTION: flavor_description,
+ const.ENABLED: True,
+ const.FLAVOR_PROFILE_ID: self.flavor_profile_id}
+
+ # Happy path
+ flavor = self.lb_admin_flavor_client.create_flavor(**flavor_kwargs)
+ self.addCleanup(self.lb_admin_flavor_client.cleanup_a_flavor,
+ flavor[const.ID])
+
+ # Test that a user without the load balancer admin role cannot
+ # delete a flavor.
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_client.delete_flavor,
+ flavor[const.ID])
+
+ # Happy path
+ self.lb_admin_flavor_client.delete_flavor(flavor[const.ID])
+
+ self.assertRaises(exceptions.NotFound,
+ self.lb_admin_flavor_client.show_flavor,
+ flavor[const.ID])
diff --git a/octavia_tempest_plugin/tests/api/v2/test_flavor_profile.py b/octavia_tempest_plugin/tests/api/v2/test_flavor_profile.py
new file mode 100644
index 0000000..3bd6e54
--- /dev/null
+++ b/octavia_tempest_plugin/tests/api/v2/test_flavor_profile.py
@@ -0,0 +1,435 @@
+# Copyright 2019 Rackspace US Inc. All rights reserved.
+#
+# 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.
+
+import copy
+from operator import itemgetter
+from uuid import UUID
+
+from oslo_serialization import jsonutils
+from tempest import config
+from tempest.lib.common.utils import data_utils
+from tempest.lib import decorators
+from tempest.lib import exceptions
+
+from octavia_tempest_plugin.common import constants as const
+from octavia_tempest_plugin.tests import test_base
+
+CONF = config.CONF
+
+
+class FlavorProfileAPITest(test_base.LoadBalancerBaseTest):
+ """Test the flavor profile object API."""
+
+ @decorators.idempotent_id('d0e3a08e-d58a-4460-83ed-34307ca04cde')
+ def test_flavor_profile_create(self):
+ """Tests flavor profile create and basic show APIs.
+
+ * Tests that users without the loadbalancer admin role cannot
+ create flavor profiles.
+ * Create a fully populated flavor profile.
+ * Validate the response reflects the requested values.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_profile_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavor profiles are only available on '
+ 'Octavia API version 2.6 or newer.')
+
+ flavor_profile_name = data_utils.rand_name(
+ "lb_admin_flavorprofile1-create")
+ flavor_data = {const.LOADBALANCER_TOPOLOGY: const.SINGLE}
+ flavor_data_json = jsonutils.dumps(flavor_data)
+
+ flavor_profile_kwargs = {
+ const.NAME: flavor_profile_name,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data_json
+ }
+
+ # Test that a user without the load balancer admin role cannot
+ # create a flavor profile
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_profile_client.create_flavor_profile,
+ **flavor_profile_kwargs)
+
+ # Happy path
+ flavor_profile = (
+ self.lb_admin_flavor_profile_client.create_flavor_profile(
+ **flavor_profile_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_profile_client.cleanup_flavor_profile,
+ flavor_profile[const.ID])
+
+ UUID(flavor_profile[const.ID])
+ self.assertEqual(flavor_profile_name, flavor_profile[const.NAME])
+ self.assertEqual(CONF.load_balancer.provider,
+ flavor_profile[const.PROVIDER_NAME])
+ self.assertEqual(flavor_data_json, flavor_profile[const.FLAVOR_DATA])
+
+ @decorators.idempotent_id('c4e17fdf-849a-4132-93ae-dfca21ce4444')
+ def test_flavor_profile_list(self):
+ """Tests flavor profile list API and field filtering.
+
+ * Create three flavor profiles.
+ * Validates that non-admin accounts cannot list the flavor profiles.
+ * List the flavor profiles using the default sort order.
+ * List the flavor profiles using descending sort order.
+ * List the flavor profiles using ascending sort order.
+ * List the flavor profiles returning one field at a time.
+ * List the flavor profiles returning two fields.
+ * List the flavor profiles filtering to one of the three.
+ * List the flavor profiles filtered, one field, and sorted.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_profile_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavor profiles are only available on '
+ 'Octavia API version 2.6 or newer.')
+
+ # Create flavor profile 1
+ flavor_profile1_name = data_utils.rand_name(
+ "lb_admin_flavorprofile-list-1")
+ flavor_data1 = {const.LOADBALANCER_TOPOLOGY: const.SINGLE}
+ flavor_data1_json = jsonutils.dumps(flavor_data1)
+
+ flavor_profile1_kwargs = {
+ const.NAME: flavor_profile1_name,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data1_json
+ }
+ flavor_profile1 = (
+ self.lb_admin_flavor_profile_client.create_flavor_profile(
+ **flavor_profile1_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_profile_client.cleanup_flavor_profile,
+ flavor_profile1[const.ID])
+
+ # Create flavor profile 2
+ flavor_profile2_name = data_utils.rand_name(
+ "lb_admin_flavorprofile-list-2")
+ flavor_data2 = {const.LOADBALANCER_TOPOLOGY: const.ACTIVE_STANDBY}
+ flavor_data2_json = jsonutils.dumps(flavor_data2)
+
+ flavor_profile2_kwargs = {
+ const.NAME: flavor_profile2_name,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data2_json
+ }
+ flavor_profile2 = (
+ self.lb_admin_flavor_profile_client.create_flavor_profile(
+ **flavor_profile2_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_profile_client.cleanup_flavor_profile,
+ flavor_profile2[const.ID])
+
+ # Create flavor profile 3
+ flavor_profile3_name = data_utils.rand_name(
+ "lb_admin_flavorprofile-list-3")
+ flavor_data3 = {const.LOADBALANCER_TOPOLOGY: const.SINGLE}
+ flavor_data3_json = jsonutils.dumps(flavor_data3)
+
+ flavor_profile3_kwargs = {
+ const.NAME: flavor_profile3_name,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data3_json
+ }
+ flavor_profile3 = (
+ self.lb_admin_flavor_profile_client.create_flavor_profile(
+ **flavor_profile3_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_profile_client.cleanup_flavor_profile,
+ flavor_profile3[const.ID])
+
+ # default sort order (by ID) reference list
+ ref_id_list_asc = [flavor_profile1[const.ID],
+ flavor_profile2[const.ID],
+ flavor_profile3[const.ID]]
+ ref_id_list_dsc = copy.deepcopy(ref_id_list_asc)
+ ref_id_list_asc.sort()
+ ref_id_list_dsc.sort(reverse=True)
+
+ # Test that a user without the load balancer admin role cannot
+ # list flavor profiles.
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_profile_client.list_flavor_profiles)
+
+ # Check the default sort order (by ID)
+ profiles = self.lb_admin_flavor_profile_client.list_flavor_profiles()
+ # Remove flavor profiles not used in this test
+ profiles = [prof for prof in profiles
+ if 'lb_admin_flavorprofile-list' in prof[const.NAME]]
+ self.assertEqual(3, len(profiles))
+ self.assertEqual(ref_id_list_asc[0], profiles[0][const.ID])
+ self.assertEqual(ref_id_list_asc[1], profiles[1][const.ID])
+ self.assertEqual(ref_id_list_asc[2], profiles[2][const.ID])
+
+ # Check the descending sort order by name
+ profiles = self.lb_admin_flavor_profile_client.list_flavor_profiles(
+ query_params='{sort}={name}:{order}'.format(
+ sort=const.SORT, name=const.NAME, order=const.DESC))
+ # Remove flavor profiles not used in this test
+ profiles = [prof for prof in profiles
+ if 'lb_admin_flavorprofile-list' in prof[const.NAME]]
+ self.assertEqual(3, len(profiles))
+ self.assertEqual(flavor_profile3_name, profiles[0][const.NAME])
+ self.assertEqual(flavor_profile2_name, profiles[1][const.NAME])
+ self.assertEqual(flavor_profile1_name, profiles[2][const.NAME])
+
+ # Check the ascending sort order by name
+ profiles = self.lb_admin_flavor_profile_client.list_flavor_profiles(
+ query_params='{sort}={name}:{order}'.format(
+ sort=const.SORT, name=const.NAME, order=const.ASC))
+ # Remove flavor profiles not used in this test
+ profiles = [prof for prof in profiles
+ if 'lb_admin_flavorprofile-list' in prof[const.NAME]]
+ self.assertEqual(3, len(profiles))
+ self.assertEqual(flavor_profile1_name, profiles[0][const.NAME])
+ self.assertEqual(flavor_profile2_name, profiles[1][const.NAME])
+ self.assertEqual(flavor_profile3_name, profiles[2][const.NAME])
+
+ ref_profiles = [flavor_profile1, flavor_profile2, flavor_profile3]
+ sorted_profiles = sorted(ref_profiles, key=itemgetter(const.ID))
+
+ # Test fields
+ flavor_profile_client = self.lb_admin_flavor_profile_client
+ for field in const.SHOW_FLAVOR_PROFILE_FIELDS:
+ profiles = flavor_profile_client.list_flavor_profiles(
+ query_params='{fields}={field}&{fields}={name}'.format(
+ fields=const.FIELDS, field=field, name=const.NAME))
+ # Remove flavor profiles not used in this test
+ profiles = [prof for prof in profiles
+ if 'lb_admin_flavorprofile-list' in prof[const.NAME]]
+
+ self.assertEqual(3, len(profiles))
+ self.assertEqual(sorted_profiles[0][field], profiles[0][field])
+ self.assertEqual(sorted_profiles[1][field], profiles[1][field])
+ self.assertEqual(sorted_profiles[2][field], profiles[2][field])
+
+ # Test filtering
+ profile = self.lb_admin_flavor_profile_client.list_flavor_profiles(
+ query_params='{name}={prof_name}'.format(
+ name=const.NAME,
+ prof_name=flavor_profile2[const.NAME]))
+ self.assertEqual(1, len(profile))
+ self.assertEqual(flavor_profile2[const.ID], profile[0][const.ID])
+
+ # Test combined params
+ profiles = self.lb_admin_flavor_profile_client.list_flavor_profiles(
+ query_params='{provider_name}={provider}&{fields}={name}&'
+ '{sort}={ID}:{desc}'.format(
+ provider_name=const.PROVIDER_NAME,
+ provider=CONF.load_balancer.provider,
+ fields=const.FIELDS, name=const.NAME,
+ sort=const.SORT, ID=const.ID,
+ desc=const.DESC))
+ # Remove flavor profiles not used in this test
+ profiles = [prof for prof in profiles
+ if 'lb_admin_flavorprofile-list' in prof[const.NAME]]
+ self.assertEqual(3, len(profiles))
+ self.assertEqual(1, len(profiles[0]))
+ self.assertEqual(sorted_profiles[2][const.NAME],
+ profiles[0][const.NAME])
+ self.assertEqual(sorted_profiles[1][const.NAME],
+ profiles[1][const.NAME])
+ self.assertEqual(sorted_profiles[0][const.NAME],
+ profiles[2][const.NAME])
+
+ @decorators.idempotent_id('a2c2ff9a-fce1-42fd-8cfd-56dea31610f6')
+ def test_flavor_profile_show(self):
+ """Tests flavor profile show API.
+
+ * Create a fully populated flavor profile.
+ * Show flavor profile details.
+ * Validate the show reflects the requested values.
+ * Validates that non-lb-admin accounts cannot see the flavor profile.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_profile_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavor profiles are only available on '
+ 'Octavia API version 2.6 or newer.')
+
+ flavor_profile_name = data_utils.rand_name(
+ "lb_admin_flavorprofile1-show")
+ flavor_data = {const.LOADBALANCER_TOPOLOGY: const.ACTIVE_STANDBY}
+ flavor_data_json = jsonutils.dumps(flavor_data)
+
+ flavor_profile_kwargs = {
+ const.NAME: flavor_profile_name,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data_json
+ }
+
+ flavor_profile = (
+ self.lb_admin_flavor_profile_client.create_flavor_profile(
+ **flavor_profile_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_profile_client.cleanup_flavor_profile,
+ flavor_profile[const.ID])
+
+ # Test that a user without the load balancer admin role cannot
+ # show a flavor profile
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_profile_client.show_flavor_profile,
+ flavor_profile[const.ID])
+
+ result = (
+ self.lb_admin_flavor_profile_client.show_flavor_profile(
+ flavor_profile[const.ID]))
+
+ self.assertEqual(flavor_profile_name, result[const.NAME])
+ self.assertEqual(CONF.load_balancer.provider,
+ result[const.PROVIDER_NAME])
+ self.assertEqual(flavor_data_json, result[const.FLAVOR_DATA])
+
+ @decorators.idempotent_id('32a2e285-8dfc-485f-a450-a4d450d3c3ec')
+ def test_flavor_profile_update(self):
+ """Tests flavor profile update API.
+
+ * Create a fully populated flavor profile.
+ * Show flavor profile details.
+ * Validate the show reflects the initial values.
+ * Validates that non-admin accounts cannot update the flavor profile.
+ * Update the flavor profile details.
+ * Show flavor profile details.
+ * Validate the show reflects the updated values.
+ """
+
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_profile_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavor profiles are only available on '
+ 'Octavia API version 2.6 or newer.')
+
+ flavor_profile_name = data_utils.rand_name(
+ "lb_admin_flavorprofile1-update")
+ flavor_data = {const.LOADBALANCER_TOPOLOGY: const.SINGLE}
+ flavor_data_json = jsonutils.dumps(flavor_data)
+
+ flavor_profile_kwargs = {
+ const.NAME: flavor_profile_name,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data_json
+ }
+
+ flavor_profile = (
+ self.lb_admin_flavor_profile_client.create_flavor_profile(
+ **flavor_profile_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_profile_client.cleanup_flavor_profile,
+ flavor_profile[const.ID])
+
+ self.assertEqual(flavor_profile_name, flavor_profile[const.NAME])
+ self.assertEqual(CONF.load_balancer.provider,
+ flavor_profile[const.PROVIDER_NAME])
+ self.assertEqual(flavor_data_json, flavor_profile[const.FLAVOR_DATA])
+
+ flavor_profile_name2 = data_utils.rand_name(
+ "lb_admin_flavorprofile1-update2")
+ flavor_data2 = {const.LOADBALANCER_TOPOLOGY: const.ACTIVE_STANDBY}
+ flavor_data2_json = jsonutils.dumps(flavor_data2)
+
+ # TODO(johnsom) Figure out a reliable second provider
+ flavor_profile_updated_kwargs = {
+ const.NAME: flavor_profile_name2,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data2_json
+ }
+
+ # Test that a user without the load balancer admin role cannot
+ # create a flavor profile
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_profile_client.update_flavor_profile,
+ flavor_profile[const.ID], **flavor_profile_updated_kwargs)
+
+ result = self.lb_admin_flavor_profile_client.update_flavor_profile(
+ flavor_profile[const.ID], **flavor_profile_updated_kwargs)
+
+ self.assertEqual(flavor_profile_name2, result[const.NAME])
+ self.assertEqual(CONF.load_balancer.provider,
+ result[const.PROVIDER_NAME])
+ self.assertEqual(flavor_data2_json, result[const.FLAVOR_DATA])
+
+ # Check that a show reflects the new values
+ get_result = (
+ self.lb_admin_flavor_profile_client.show_flavor_profile(
+ flavor_profile[const.ID]))
+
+ self.assertEqual(flavor_profile_name2, get_result[const.NAME])
+ self.assertEqual(CONF.load_balancer.provider,
+ get_result[const.PROVIDER_NAME])
+ self.assertEqual(flavor_data2_json, get_result[const.FLAVOR_DATA])
+
+ @decorators.idempotent_id('4c2eaacf-c2c8-422a-b7dc-a30ceba6bcd4')
+ def test_flavor_profile_delete(self):
+ """Tests flavor profile create and delete APIs.
+
+ * Creates a flavor profile.
+ * Validates that other accounts cannot delete the flavor profile.
+ * Deletes the flavor profile.
+ * Validates the flavor profile is in the DELETED state.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.lb_admin_flavor_profile_client.is_version_supported(
+ self.api_version, '2.6'):
+ raise self.skipException('Flavor profiles are only available on '
+ 'Octavia API version 2.6 or newer.')
+
+ flavor_profile_name = data_utils.rand_name(
+ "lb_admin_flavorprofile1-delete")
+ flavor_data = {const.LOADBALANCER_TOPOLOGY: const.SINGLE}
+ flavor_data_json = jsonutils.dumps(flavor_data)
+
+ flavor_profile_kwargs = {
+ const.NAME: flavor_profile_name,
+ const.PROVIDER_NAME: CONF.load_balancer.provider,
+ const.FLAVOR_DATA: flavor_data_json
+ }
+
+ flavor_profile = (
+ self.lb_admin_flavor_profile_client.create_flavor_profile(
+ **flavor_profile_kwargs))
+ self.addCleanup(
+ self.lb_admin_flavor_profile_client.cleanup_flavor_profile,
+ flavor_profile[const.ID])
+
+ # Test that a user without the load balancer admin role cannot
+ # delete a flavor profile
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.flavor_profile_client.delete_flavor_profile,
+ flavor_profile[const.ID])
+
+ # Happy path
+ self.lb_admin_flavor_profile_client.delete_flavor_profile(
+ flavor_profile[const.ID])
+
+ self.assertRaises(
+ exceptions.NotFound,
+ self.lb_admin_flavor_profile_client.show_flavor_profile,
+ flavor_profile[const.ID])
diff --git a/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py b/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
index 4887995..5f560c4 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_healthmonitor.py
@@ -37,7 +37,7 @@
def skip_checks(cls):
super(HealthMonitorAPITest, cls).skip_checks()
if not CONF.loadbalancer_feature_enabled.health_monitor_enabled:
- cls.skip('Health Monitors not supported')
+ raise cls.skipException('Health Monitors not supported')
@classmethod
def resource_setup(cls):
diff --git a/octavia_tempest_plugin/tests/api/v2/test_l7policy.py b/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
index 255bbde..ee559af 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
@@ -32,6 +32,15 @@
"""Test the l7policy object API."""
@classmethod
+ def skip_checks(cls):
+ super(L7PolicyAPITest, cls).skip_checks()
+ if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
+ raise cls.skipException(
+ '[loadbalancer-feature-enabled] '
+ '"l7_protocol_enabled" is set to False in the Tempest '
+ 'configuration. L7 API tests will be skipped.')
+
+ @classmethod
def resource_setup(cls):
"""Setup resources needed by the tests."""
super(L7PolicyAPITest, cls).resource_setup()
diff --git a/octavia_tempest_plugin/tests/api/v2/test_l7rule.py b/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
index 395a3ad..7fed40c 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
@@ -30,6 +30,14 @@
class L7RuleAPITest(test_base.LoadBalancerBaseTest):
"""Test the l7rule object API."""
+ @classmethod
+ def skip_checks(cls):
+ super(L7RuleAPITest, cls).skip_checks()
+ if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
+ raise cls.skipException(
+ '[loadbalancer-feature-enabled] '
+ '"l7_protocol_enabled" is set to False in the Tempest '
+ 'configuration. L7 API tests will be skipped.')
@classmethod
def resource_setup(cls):
diff --git a/octavia_tempest_plugin/tests/api/v2/test_listener.py b/octavia_tempest_plugin/tests/api/v2/test_listener.py
index b68ae55..599305a 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_listener.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_listener.py
@@ -42,6 +42,10 @@
const.NAME: lb_name}
cls._setup_lb_network_kwargs(lb_kwargs)
+ cls.protocol = const.HTTP
+ lb_feature_enabled = CONF.loadbalancer_feature_enabled
+ if not lb_feature_enabled.l7_protocol_enabled:
+ cls.protocol = lb_feature_enabled.l4_protocol
lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
cls.lb_id = lb[const.ID]
@@ -72,7 +76,7 @@
const.NAME: listener_name,
const.DESCRIPTION: listener_description,
const.ADMIN_STATE_UP: True,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.PROTOCOL_PORT: 80,
const.LOADBALANCER_ID: self.lb_id,
const.CONNECTION_LIMIT: 200,
@@ -142,7 +146,7 @@
self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
else:
self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+ self.assertEqual(self.protocol, listener[const.PROTOCOL])
self.assertEqual(80, listener[const.PROTOCOL_PORT])
self.assertEqual(200, listener[const.CONNECTION_LIMIT])
insert_headers = listener[const.INSERT_HEADERS]
@@ -194,7 +198,7 @@
const.NAME: listener1_name,
const.DESCRIPTION: listener1_desc,
const.ADMIN_STATE_UP: True,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.PROTOCOL_PORT: 80,
const.LOADBALANCER_ID: lb_id,
}
@@ -226,7 +230,7 @@
const.NAME: listener2_name,
const.DESCRIPTION: listener2_desc,
const.ADMIN_STATE_UP: True,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.PROTOCOL_PORT: 81,
const.LOADBALANCER_ID: lb_id,
}
@@ -258,7 +262,7 @@
const.NAME: listener3_name,
const.DESCRIPTION: listener3_desc,
const.ADMIN_STATE_UP: False,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.PROTOCOL_PORT: 82,
const.LOADBALANCER_ID: lb_id,
}
@@ -420,7 +424,7 @@
const.NAME: listener_name,
const.DESCRIPTION: listener_description,
const.ADMIN_STATE_UP: True,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.PROTOCOL_PORT: 81,
const.LOADBALANCER_ID: self.lb_id,
const.CONNECTION_LIMIT: 200,
@@ -479,7 +483,7 @@
self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
else:
self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+ self.assertEqual(self.protocol, listener[const.PROTOCOL])
self.assertEqual(81, listener[const.PROTOCOL_PORT])
self.assertEqual(200, listener[const.CONNECTION_LIMIT])
insert_headers = listener[const.INSERT_HEADERS]
@@ -542,7 +546,7 @@
const.NAME: listener_name,
const.DESCRIPTION: listener_description,
const.ADMIN_STATE_UP: False,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.PROTOCOL_PORT: 82,
const.LOADBALANCER_ID: self.lb_id,
const.CONNECTION_LIMIT: 200,
@@ -590,7 +594,7 @@
UUID(listener[const.ID])
# Operating status will be OFFLINE while admin_state_up = False
self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+ self.assertEqual(self.protocol, listener[const.PROTOCOL])
self.assertEqual(82, listener[const.PROTOCOL_PORT])
self.assertEqual(200, listener[const.CONNECTION_LIMIT])
insert_headers = listener[const.INSERT_HEADERS]
@@ -717,7 +721,7 @@
listener_kwargs = {
const.NAME: listener_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.PROTOCOL_PORT: 83,
const.LOADBALANCER_ID: self.lb_id,
}
diff --git a/octavia_tempest_plugin/tests/api/v2/test_member.py b/octavia_tempest_plugin/tests/api/v2/test_member.py
index 18073cc..a84e121 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_member.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_member.py
@@ -40,8 +40,11 @@
lb_name = data_utils.rand_name("lb_member_lb1_member")
lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
const.NAME: lb_name}
-
cls._setup_lb_network_kwargs(lb_kwargs)
+ cls.protocol = const.HTTP
+ lb_feature_enabled = CONF.loadbalancer_feature_enabled
+ if not lb_feature_enabled.l7_protocol_enabled:
+ cls.protocol = lb_feature_enabled.l4_protocol
lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
cls.lb_id = lb[const.ID]
@@ -58,7 +61,7 @@
listener_name = data_utils.rand_name("lb_member_listener1_member")
listener_kwargs = {
const.NAME: listener_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: cls.protocol,
const.PROTOCOL_PORT: '80',
const.LOADBALANCER_ID: cls.lb_id,
}
@@ -78,7 +81,7 @@
pool_name = data_utils.rand_name("lb_member_pool1_member")
pool_kwargs = {
const.NAME: pool_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: cls.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.LISTENER_ID: cls.listener_id,
}
@@ -96,6 +99,14 @@
CONF.load_balancer.build_interval,
CONF.load_balancer.build_timeout)
+ def _create_member_and_get_monitor_status(self, **member_kwargs):
+ monitor = CONF.loadbalancer_feature_enabled.health_monitor_enabled
+ if not monitor:
+ del member_kwargs[const.MONITOR_ADDRESS]
+ del member_kwargs[const.MONITOR_PORT]
+ member = self.mem_member_client.create_member(**member_kwargs)
+ return member, monitor
+
# Note: This test also covers basic member show API
@decorators.idempotent_id('0623aa1f-753d-44e7-afa1-017d274eace7')
def test_member_ipv4_create(self):
@@ -114,6 +125,7 @@
* Tests that users without the loadbalancer member role cannot
create members.
* Create a fully populated member.
+ * If driver doesnt support Monitors, allow to create without monitor
* Show member details.
* Validate the show reflects the requested values.
"""
@@ -153,7 +165,9 @@
self.os_primary.member_client.create_member,
**member_kwargs)
- member = self.mem_member_client.create_member(**member_kwargs)
+ member, monitor = self._create_member_and_get_monitor_status(
+ **member_kwargs)
+
self.addClassResourceCleanup(
self.mem_member_client.cleanup_member,
member[const.ID], pool_id=self.pool_id,
@@ -178,13 +192,13 @@
self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
- const.PROTOCOL_PORT, const.WEIGHT,
- const.MONITOR_ADDRESS, const.MONITOR_PORT]
-
+ const.PROTOCOL_PORT, const.WEIGHT]
if self.mem_member_client.is_version_supported(
self.api_version, '2.1'):
equal_items.append(const.BACKUP)
+ if monitor:
+ equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
if const.SUBNET_ID in member_kwargs:
equal_items.append(const.SUBNET_ID)
else:
@@ -211,7 +225,8 @@
pool_name = data_utils.rand_name("lb_member_pool2_member-list")
pool = self.mem_pool_client.create_pool(
name=pool_name, loadbalancer_id=self.lb_id,
- protocol=const.HTTP, lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
+ protocol=self.protocol,
+ lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
pool_id = pool[const.ID]
self.addCleanup(
self.mem_pool_client.cleanup_pool, pool_id,
@@ -447,7 +462,9 @@
member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
const.ID]
- member = self.mem_member_client.create_member(**member_kwargs)
+ member, monitor = self._create_member_and_get_monitor_status(
+ **member_kwargs)
+
self.addClassResourceCleanup(
self.mem_member_client.cleanup_member,
member[const.ID], pool_id=self.pool_id,
@@ -472,13 +489,14 @@
self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
- const.PROTOCOL_PORT, const.WEIGHT,
- const.MONITOR_ADDRESS, const.MONITOR_PORT]
+ const.PROTOCOL_PORT, const.WEIGHT]
if self.mem_member_client.is_version_supported(
self.api_version, '2.1'):
equal_items.append(const.BACKUP)
+ if monitor:
+ equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
if const.SUBNET_ID in member_kwargs:
equal_items.append(const.SUBNET_ID)
else:
@@ -549,7 +567,9 @@
member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
const.ID]
- member = self.mem_member_client.create_member(**member_kwargs)
+ member, monitor = self._create_member_and_get_monitor_status(
+ **member_kwargs)
+
self.addClassResourceCleanup(
self.mem_member_client.cleanup_member,
member[const.ID], pool_id=self.pool_id,
@@ -567,27 +587,30 @@
CONF.load_balancer.build_interval,
CONF.load_balancer.build_timeout,
pool_id=self.pool_id)
- if not CONF.load_balancer.test_with_noop:
- member = waiters.wait_for_status(
- self.mem_member_client.show_member,
- member[const.ID], const.OPERATING_STATUS,
- const.OFFLINE,
- CONF.load_balancer.build_interval,
- CONF.load_balancer.build_timeout,
- pool_id=self.pool_id)
+ status = const.OFFLINE
+ if not monitor or CONF.load_balancer.test_with_noop:
+ status = const.NO_MONITOR
+ member = waiters.wait_for_status(
+ self.mem_member_client.show_member,
+ member[const.ID], const.OPERATING_STATUS,
+ status,
+ CONF.load_balancer.build_interval,
+ CONF.load_balancer.build_timeout,
+ pool_id=self.pool_id)
parser.parse(member[const.CREATED_AT])
parser.parse(member[const.UPDATED_AT])
UUID(member[const.ID])
equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
- const.PROTOCOL_PORT, const.WEIGHT,
- const.MONITOR_ADDRESS, const.MONITOR_PORT]
+ const.PROTOCOL_PORT, const.WEIGHT]
if self.mem_member_client.is_version_supported(
self.api_version, '2.1'):
equal_items.append(const.BACKUP)
+ if monitor:
+ equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
if const.SUBNET_ID in member_kwargs:
equal_items.append(const.SUBNET_ID)
else:
@@ -596,8 +619,9 @@
for item in equal_items:
self.assertEqual(member_kwargs[item], member[item])
- if CONF.load_balancer.test_with_noop:
- # Operating status with noop will stay in NO_MONITOR
+ if CONF.load_balancer.test_with_noop or not monitor:
+ # Operating status with noop or Driver not supporting Monitors
+ # will stay in NO_MONITOR
self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
else:
# Operating status will be OFFLINE while admin_state_up = False
@@ -642,18 +666,18 @@
const.NAME: new_name,
const.ADMIN_STATE_UP: not member[const.ADMIN_STATE_UP],
const.WEIGHT: member[const.WEIGHT] + 1,
- const.MONITOR_ADDRESS: '192.0.2.3',
- const.MONITOR_PORT: member[const.MONITOR_PORT] + 1,
}
if self.mem_member_client.is_version_supported(
self.api_version, '2.1'):
member_update_kwargs.update({
const.BACKUP: not member[const.BACKUP]
})
-
+ if monitor:
+ member_update_kwargs[const.MONITOR_ADDRESS] = '192.0.2.3'
+ member_update_kwargs[const.MONITOR_PORT] = member[
+ const.MONITOR_PORT] + 1
member = self.mem_member_client.update_member(
member[const.ID], **member_update_kwargs)
-
waiters.wait_for_status(
self.mem_lb_client.show_loadbalancer, self.lb_id,
const.PROVISIONING_STATUS, const.ACTIVE,
@@ -679,13 +703,14 @@
self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
# Test changed items
- equal_items = [const.NAME, const.ADMIN_STATE_UP, const.WEIGHT,
- const.MONITOR_ADDRESS, const.MONITOR_PORT]
+ equal_items = [const.NAME, const.ADMIN_STATE_UP, const.WEIGHT]
if self.mem_member_client.is_version_supported(
self.api_version, '2.1'):
equal_items.append(const.BACKUP)
+ if monitor:
+ equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
for item in equal_items:
self.assertEqual(member_update_kwargs[item], member[item])
@@ -710,7 +735,8 @@
pool_name = data_utils.rand_name("lb_member_pool3_member-batch")
pool = self.mem_pool_client.create_pool(
name=pool_name, loadbalancer_id=self.lb_id,
- protocol=const.HTTP, lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
+ protocol=self.protocol,
+ lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
pool_id = pool[const.ID]
self.addClassResourceCleanup(
self.mem_pool_client.cleanup_pool, pool_id,
@@ -743,8 +769,9 @@
if self.lb_member_vip_subnet:
member1_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
const.ID]
+ member1, monitor = self._create_member_and_get_monitor_status(
+ **member1_kwargs)
- member1 = self.mem_member_client.create_member(**member1_kwargs)
self.addClassResourceCleanup(
self.mem_member_client.cleanup_member,
member1[const.ID], pool_id=pool_id,
@@ -765,8 +792,6 @@
const.ADDRESS: '192.0.2.3',
const.PROTOCOL_PORT: 81,
const.WEIGHT: 51,
- const.MONITOR_ADDRESS: '192.0.2.4',
- const.MONITOR_PORT: 8081,
}
if self.mem_member_client.is_version_supported(
self.api_version, '2.1'):
@@ -774,6 +799,9 @@
const.BACKUP: True,
})
+ if monitor:
+ member2_kwargs[const.MONITOR_ADDRESS] = '192.0.2.4'
+ member2_kwargs[const.MONITOR_PORT] = 8081
if self.lb_member_vip_subnet:
member2_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
const.ID]
@@ -798,8 +826,6 @@
const.ADDRESS: '192.0.2.5',
const.PROTOCOL_PORT: 82,
const.WEIGHT: 52,
- const.MONITOR_ADDRESS: '192.0.2.6',
- const.MONITOR_PORT: 8082,
}
if self.mem_member_client.is_version_supported(
self.api_version, '2.1'):
@@ -807,6 +833,9 @@
const.BACKUP: True,
})
+ if monitor:
+ member2_kwargs[const.MONITOR_ADDRESS] = '192.0.2.6'
+ member2_kwargs[const.MONITOR_PORT] = 8082
if self.lb_member_vip_subnet:
member3_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
const.ID]
diff --git a/octavia_tempest_plugin/tests/api/v2/test_pool.py b/octavia_tempest_plugin/tests/api/v2/test_pool.py
index 28b95b6..63d9e46 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_pool.py
@@ -39,8 +39,11 @@
lb_name = data_utils.rand_name("lb_member_lb1_pool")
lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
const.NAME: lb_name}
-
cls._setup_lb_network_kwargs(lb_kwargs)
+ cls.protocol = const.HTTP
+ lb_feature_enabled = CONF.loadbalancer_feature_enabled
+ if not lb_feature_enabled.l7_protocol_enabled:
+ cls.protocol = lb_feature_enabled.l4_protocol
lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
cls.lb_id = lb[const.ID]
@@ -57,7 +60,7 @@
listener_name = data_utils.rand_name("lb_member_listener1_pool")
listener_kwargs = {
const.NAME: listener_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: cls.protocol,
const.PROTOCOL_PORT: '80',
const.LOADBALANCER_ID: cls.lb_id,
}
@@ -98,7 +101,7 @@
const.NAME: pool_name,
const.DESCRIPTION: pool_description,
const.ADMIN_STATE_UP: True,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.SESSION_PERSISTENCE: {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -156,7 +159,7 @@
else:
# OFFLINE if it is just on the LB directly or is in noop mode
self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, pool[const.PROTOCOL])
+ self.assertEqual(self.protocol, pool[const.PROTOCOL])
self.assertEqual(1, len(pool[const.LOADBALANCERS]))
self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
if has_listener:
@@ -211,7 +214,7 @@
const.NAME: pool1_name,
const.DESCRIPTION: pool1_desc,
const.ADMIN_STATE_UP: True,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.SESSION_PERSISTENCE: {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -248,7 +251,7 @@
const.NAME: pool2_name,
const.DESCRIPTION: pool2_desc,
const.ADMIN_STATE_UP: True,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.SESSION_PERSISTENCE: {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -284,7 +287,7 @@
const.NAME: pool3_name,
const.DESCRIPTION: pool3_desc,
const.ADMIN_STATE_UP: False,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
# No session persistence, just so there's one test for that
const.LOADBALANCER_ID: lb_id,
@@ -425,7 +428,7 @@
const.NAME: pool_name,
const.DESCRIPTION: pool_description,
const.ADMIN_STATE_UP: True,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.SESSION_PERSISTENCE: {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -460,7 +463,7 @@
UUID(pool[const.ID])
# Operating status for pools will always be offline without members
self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, pool[const.PROTOCOL])
+ self.assertEqual(self.protocol, pool[const.PROTOCOL])
self.assertEqual(1, len(pool[const.LOADBALANCERS]))
self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
self.assertEmpty(pool[const.LISTENERS])
@@ -519,7 +522,7 @@
const.NAME: pool_name,
const.DESCRIPTION: pool_description,
const.ADMIN_STATE_UP: False,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.SESSION_PERSISTENCE: {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -554,7 +557,7 @@
UUID(pool[const.ID])
# Operating status for pools will always be offline without members
self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, pool[const.PROTOCOL])
+ self.assertEqual(self.protocol, pool[const.PROTOCOL])
self.assertEqual(1, len(pool[const.LOADBALANCERS]))
self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
self.assertEmpty(pool[const.LISTENERS])
@@ -667,7 +670,7 @@
pool_sp_cookie_name = 'my_cookie'
pool_kwargs = {
const.NAME: pool_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.SESSION_PERSISTENCE: {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
diff --git a/octavia_tempest_plugin/tests/api/v2/test_provider.py b/octavia_tempest_plugin/tests/api/v2/test_provider.py
new file mode 100644
index 0000000..917b365
--- /dev/null
+++ b/octavia_tempest_plugin/tests/api/v2/test_provider.py
@@ -0,0 +1,73 @@
+# Copyright 2019 Rackspace US Inc. All rights reserved.
+#
+# 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 oslo_log import log as logging
+from tempest import config
+from tempest.lib import decorators
+from tempest.lib import exceptions
+
+from octavia_tempest_plugin.common import constants as const
+from octavia_tempest_plugin.tests import test_base
+
+CONF = config.CONF
+LOG = logging.getLogger(__name__)
+
+
+class ProviderAPITest(test_base.LoadBalancerBaseTest):
+ """Test the provider object API."""
+
+ @decorators.idempotent_id('8b94e0cc-a24d-4c29-bc8e-53f58214dc67')
+ def test_provider_list(self):
+ """Tests provider list API and field filtering.
+
+ * Validates that non-lb member accounts cannot list the providers.
+ * List the providers and validate against the expected provider list.
+ * List the providers returning one field at a time.
+ """
+ # We have to do this here as the api_version and clients are not
+ # setup in time to use a decorator or the skip_checks mixin
+ if not self.mem_provider_client.is_version_supported(
+ self.api_version, '2.1'):
+ raise self.skipException('Providers are only available on '
+ 'Octavia API version 2.1 or newer.')
+
+ # Test that a user without the load balancer role cannot
+ # list providers.
+ if CONF.load_balancer.RBAC_test_type == const.ADVANCED:
+ self.assertRaises(
+ exceptions.Forbidden,
+ self.os_primary.provider_client.list_providers)
+
+ providers = self.mem_provider_client.list_providers()
+
+ # Check against the expected providers from the tempest config
+ enabled_providers = CONF.load_balancer.enabled_provider_drivers
+ for provider in providers:
+ self.assertEqual(enabled_providers[provider[const.NAME]],
+ provider.get(const.DESCRIPTION, ''))
+
+ # Test fields
+ providers = self.mem_provider_client.list_providers(
+ query_params='{fields}={field}'.format(fields=const.FIELDS,
+ field=const.NAME))
+ for provider in providers:
+ self.assertEqual(1, len(provider))
+ self.assertIn(provider[const.NAME], enabled_providers.keys())
+ providers = self.mem_provider_client.list_providers(
+ query_params='{fields}={field}'.format(fields=const.FIELDS,
+ field=const.DESCRIPTION))
+ for provider in providers:
+ self.assertEqual(1, len(provider))
+ self.assertIn(provider[const.DESCRIPTION],
+ enabled_providers.values())
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_healthmonitor.py b/octavia_tempest_plugin/tests/scenario/v2/test_healthmonitor.py
index b2b1d18..e3b4036 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_healthmonitor.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_healthmonitor.py
@@ -32,7 +32,7 @@
def skip_checks(cls):
super(HealthMonitorScenarioTest, cls).skip_checks()
if not CONF.loadbalancer_feature_enabled.health_monitor_enabled:
- cls.skip('Health Monitors not supported')
+ raise cls.skipException('Health Monitors not supported')
@classmethod
def resource_setup(cls):
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py b/octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py
index 9e09f35..a38066c 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py
@@ -29,6 +29,15 @@
class L7PolicyScenarioTest(test_base.LoadBalancerBaseTest):
@classmethod
+ def skip_checks(cls):
+ super(L7PolicyScenarioTest, cls).skip_checks()
+ if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
+ raise cls.skipException(
+ '[loadbalancer-feature-enabled] '
+ '"l7_protocol_enabled" is set to False in the Tempest '
+ 'configuration. L7 Scenario tests will be skipped.')
+
+ @classmethod
def resource_setup(cls):
"""Setup resources needed by the tests."""
super(L7PolicyScenarioTest, cls).resource_setup()
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py b/octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py
index 114ea3e..1c147db 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py
@@ -29,6 +29,15 @@
class L7RuleScenarioTest(test_base.LoadBalancerBaseTest):
@classmethod
+ def skip_checks(cls):
+ super(L7RuleScenarioTest, cls).skip_checks()
+ if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
+ raise cls.skipException(
+ '[loadbalancer-feature-enabled] '
+ '"l7_protocol_enabled" is set to False in the Tempest '
+ 'configuration. L7 Scenario tests will be skipped.')
+
+ @classmethod
def resource_setup(cls):
"""Setup resources needed by the tests."""
super(L7RuleScenarioTest, cls).resource_setup()
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_listener.py b/octavia_tempest_plugin/tests/scenario/v2/test_listener.py
index 7720d27..c504ea2 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_listener.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_listener.py
@@ -51,11 +51,15 @@
const.ACTIVE,
CONF.load_balancer.lb_build_interval,
CONF.load_balancer.lb_build_timeout)
+ cls.protocol = const.HTTP
+ lb_feature_enabled = CONF.loadbalancer_feature_enabled
+ if not lb_feature_enabled.l7_protocol_enabled:
+ cls.protocol = lb_feature_enabled.l4_protocol
pool1_name = data_utils.rand_name("lb_member_pool1_listener")
pool1_kwargs = {
const.NAME: pool1_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: cls.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.LOADBALANCER_ID: cls.lb_id,
}
@@ -75,7 +79,7 @@
pool2_name = data_utils.rand_name("lb_member_pool2_listener")
pool2_kwargs = {
const.NAME: pool2_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: cls.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.LOADBALANCER_ID: cls.lb_id,
}
@@ -109,7 +113,7 @@
const.NAME: listener_name,
const.DESCRIPTION: listener_description,
const.ADMIN_STATE_UP: False,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.PROTOCOL_PORT: 80,
const.LOADBALANCER_ID: self.lb_id,
const.CONNECTION_LIMIT: 200,
@@ -157,7 +161,7 @@
UUID(listener[const.ID])
# Operating status will be OFFLINE while admin_state_up = False
self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+ self.assertEqual(self.protocol, listener[const.PROTOCOL])
self.assertEqual(80, listener[const.PROTOCOL_PORT])
self.assertEqual(200, listener[const.CONNECTION_LIMIT])
insert_headers = listener[const.INSERT_HEADERS]
@@ -230,7 +234,7 @@
self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
else:
self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+ self.assertEqual(self.protocol, listener[const.PROTOCOL])
self.assertEqual(80, listener[const.PROTOCOL_PORT])
self.assertEqual(400, listener[const.CONNECTION_LIMIT])
insert_headers = listener[const.INSERT_HEADERS]
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_member.py b/octavia_tempest_plugin/tests/scenario/v2/test_member.py
index 6bd18de..d5c1b1b 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_member.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_member.py
@@ -50,11 +50,15 @@
const.ACTIVE,
CONF.load_balancer.lb_build_interval,
CONF.load_balancer.lb_build_timeout)
+ protocol = const.HTTP
+ lb_feature_enabled = CONF.loadbalancer_feature_enabled
+ if not lb_feature_enabled.l7_protocol_enabled:
+ cls.protocol = lb_feature_enabled.l4_protocol
listener_name = data_utils.rand_name("lb_member_listener1_member")
listener_kwargs = {
const.NAME: listener_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: protocol,
const.PROTOCOL_PORT: '80',
const.LOADBALANCER_ID: cls.lb_id,
}
@@ -74,7 +78,7 @@
pool_name = data_utils.rand_name("lb_member_pool1_member")
pool_kwargs = {
const.NAME: pool_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.LISTENER_ID: cls.listener_id,
}
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_pool.py b/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
index cd26687..1cdd727 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
@@ -50,11 +50,15 @@
const.ACTIVE,
CONF.load_balancer.lb_build_interval,
CONF.load_balancer.lb_build_timeout)
+ cls.protocol = const.HTTP
+ lb_feature_enabled = CONF.loadbalancer_feature_enabled
+ if not lb_feature_enabled.l7_protocol_enabled:
+ cls.protocol = lb_feature_enabled.l4_protocol
listener_name = data_utils.rand_name("lb_member_listener1_pool")
listener_kwargs = {
const.NAME: listener_name,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: cls.protocol,
const.PROTOCOL_PORT: '80',
const.LOADBALANCER_ID: cls.lb_id,
}
@@ -95,7 +99,7 @@
const.NAME: pool_name,
const.DESCRIPTION: pool_description,
const.ADMIN_STATE_UP: False,
- const.PROTOCOL: const.HTTP,
+ const.PROTOCOL: self.protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.SESSION_PERSISTENCE: {
const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -132,7 +136,7 @@
parser.parse(pool[const.UPDATED_AT])
UUID(pool[const.ID])
self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
- self.assertEqual(const.HTTP, pool[const.PROTOCOL])
+ self.assertEqual(self.protocol, pool[const.PROTOCOL])
self.assertEqual(1, len(pool[const.LOADBALANCERS]))
self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
if has_listener:
@@ -158,10 +162,10 @@
const.DESCRIPTION: new_description,
const.ADMIN_STATE_UP: True,
const.LB_ALGORITHM: const.LB_ALGORITHM_LEAST_CONNECTIONS,
- const.SESSION_PERSISTENCE: {
- const.TYPE: const.SESSION_PERSISTENCE_HTTP_COOKIE,
- },
}
+ if self.protocol == const.HTTP:
+ pool_update_kwargs[const.SESSION_PERSISTENCE] = {
+ const.TYPE: const.SESSION_PERSISTENCE_HTTP_COOKIE}
pool = self.mem_pool_client.update_pool(
pool[const.ID], **pool_update_kwargs)
@@ -183,8 +187,9 @@
self.assertEqual(const.LB_ALGORITHM_LEAST_CONNECTIONS,
pool[const.LB_ALGORITHM])
self.assertIsNotNone(pool.get(const.SESSION_PERSISTENCE))
- self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE,
- pool[const.SESSION_PERSISTENCE][const.TYPE])
+ if self.protocol == const.HTTP:
+ self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE,
+ pool[const.SESSION_PERSISTENCE][const.TYPE])
self.assertIsNone(
pool[const.SESSION_PERSISTENCE].get(const.COOKIE_NAME))
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index b935409..f8acc2b 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -122,6 +122,11 @@
cls.mem_l7policy_client = cls.os_roles_lb_member.l7policy_client
cls.mem_l7rule_client = cls.os_roles_lb_member.l7rule_client
cls.mem_amphora_client = cls.os_roles_lb_member.amphora_client
+ cls.lb_admin_flavor_profile_client = (
+ cls.os_roles_lb_admin.flavor_profile_client)
+ cls.lb_admin_flavor_client = cls.os_roles_lb_admin.flavor_client
+ cls.mem_flavor_client = cls.os_roles_lb_member.flavor_client
+ cls.mem_provider_client = cls.os_roles_lb_member.provider_client
@classmethod
def resource_setup(cls):
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index f5426cc..d53fa42 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -91,6 +91,13 @@
vars:
devstack_localrc:
DIB_LOCAL_ELEMENTS: openstack-ci-mirrors
+ devstack_local_conf:
+ post-config:
+ $OCTAVIA_CONF:
+ haproxy_amphora:
+ # Set these higher for non-nested virt nodepool instances
+ connection_max_retries: 300
+ build_active_retries: 300
devstack_services:
neutron-qos: true
devstack_plugins: