Update ranger-tempest-plugin to python 3.6
Small changes to ensure ranger-tempest-plugin is ready for the end of python 2.7 support. Change-Id: Ib1dd506ccf5bbd419ced9c3e81dabfb0cde08719
This commit is contained in:
parent
a14ad5d3eb
commit
e687324086
37
Dockerfile
37
Dockerfile
@ -1,20 +1,20 @@
|
|||||||
FROM ubuntu:16.04
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
ENV container docker
|
ENV container docker
|
||||||
ENV LC_ALL C.UTF-8
|
ENV LC_ALL C.UTF-8
|
||||||
ENV LANG C.UTF-8
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
RUN apt -qq update && \
|
RUN apt update && \
|
||||||
apt -y install git \
|
apt -y install git \
|
||||||
netcat \
|
netcat \
|
||||||
netbase \
|
netbase \
|
||||||
openssh-server \
|
openssh-server \
|
||||||
python-minimal \
|
python3-minimal \
|
||||||
python-setuptools \
|
python3-setuptools \
|
||||||
python-pip \
|
python3-pip \
|
||||||
python-dev \
|
python3-dev \
|
||||||
python-dateutil \
|
python3-dateutil \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
openstack-pkg-tools \
|
openstack-pkg-tools \
|
||||||
apache2 \
|
apache2 \
|
||||||
@ -32,10 +32,10 @@ RUN apt -qq update && \
|
|||||||
/usr/share/doc \
|
/usr/share/doc \
|
||||||
/usr/share/doc-base
|
/usr/share/doc-base
|
||||||
|
|
||||||
RUN pip install -U setuptools && \
|
RUN ln -s /usr/bin/python3 /usr/bin/python && \
|
||||||
pip install wheel && \
|
pip3 install -U setuptools && \
|
||||||
pip install --upgrade six && \
|
pip3 install wheel && \
|
||||||
pip install pbr==2.0.0
|
pip3 install pbr==2.0.0
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -62,8 +62,8 @@ WORKDIR /
|
|||||||
RUN git clone https://git.openstack.org/openstack/tempest
|
RUN git clone https://git.openstack.org/openstack/tempest
|
||||||
|
|
||||||
### now run 'pip install -r requirements'
|
### now run 'pip install -r requirements'
|
||||||
RUN pip install -r /tempest/requirements.txt && \
|
RUN pip3 install -r /tempest/requirements.txt && \
|
||||||
pip install -r /tempest/test-requirements.txt
|
pip3 install -r /tempest/test-requirements.txt
|
||||||
|
|
||||||
### create required tempest directories - and remove .stestr folder
|
### create required tempest directories - and remove .stestr folder
|
||||||
RUN mkdir -p /tempest/logs \
|
RUN mkdir -p /tempest/logs \
|
||||||
@ -86,14 +86,15 @@ COPY tempest_setup/tempest.conf /tempest/etc
|
|||||||
### RUN tempest tests on test_regions
|
### RUN tempest tests on test_regions
|
||||||
##########################################################################
|
##########################################################################
|
||||||
### create egg-info for tempest
|
### create egg-info for tempest
|
||||||
RUN python /tempest/setup.py develop
|
RUN cd /tempest && \
|
||||||
|
python setup.py develop
|
||||||
|
|
||||||
#ENTRYPOINT ostestr run ranger_tempest_plugin.tests.api.test_regions \
|
#ENTRYPOINT stestr run ranger_tempest_plugin.tests.api.test_regions \
|
||||||
# && /bin/bash
|
# && /bin/bash
|
||||||
#ENTRYPOINT ostestr run ranger_tempest_plugin.tests.api.test_flavors/ \
|
#ENTRYPOINT stestr run ranger_tempest_plugin.tests.api.test_flavors/ \
|
||||||
# && /bin/bash
|
# && /bin/bash
|
||||||
#ENTRYPOINT ostestr run ranger_tempest_plugin.tests.api.test_customers/ \
|
#ENTRYPOINT stestr run ranger_tempest_plugin.tests.api.test_customers/ \
|
||||||
# && /bin/bash
|
# && /bin/bash
|
||||||
#ENTRYPOINT ostestr run ranger_tempest_plugin.tests.api.test_images/ \
|
#ENTRYPOINT stestr run ranger_tempest_plugin.tests.api.test_images/ \
|
||||||
# && /bin/bash
|
# && /bin/bash
|
||||||
|
|
||||||
|
@ -1,51 +1,51 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin.services import base_client
|
from ranger_tempest_plugin.services import base_client
|
||||||
from ranger_tempest_plugin.services.cms_client import CmsClient
|
from ranger_tempest_plugin.services.cms_client import CmsClient
|
||||||
from ranger_tempest_plugin.services.fms_client import FmsClient
|
from ranger_tempest_plugin.services.fms_client import FmsClient
|
||||||
from ranger_tempest_plugin.services.ims_client import ImsClient
|
from ranger_tempest_plugin.services.ims_client import ImsClient
|
||||||
from ranger_tempest_plugin.services.rms_client import RmsClient
|
from ranger_tempest_plugin.services.rms_client import RmsClient
|
||||||
|
|
||||||
from tempest import clients
|
from tempest import clients
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class OrmClientManager(clients.Manager):
|
class OrmClientManager(clients.Manager):
|
||||||
|
|
||||||
def __init__(self, credentials=None):
|
def __init__(self, credentials=None):
|
||||||
super(OrmClientManager, self).__init__(credentials)
|
super(OrmClientManager, self).__init__(credentials)
|
||||||
self.cms_client = CmsClient(
|
self.cms_client = CmsClient(
|
||||||
base_client.RangerAuthProvider(credentials),
|
base_client.RangerAuthProvider(credentials),
|
||||||
CONF.identity.catalog_type,
|
CONF.identity.catalog_type,
|
||||||
CONF.identity.region,
|
CONF.identity.region,
|
||||||
CONF.ranger.RANGER_CMS_BASE_URL)
|
CONF.ranger.RANGER_CMS_BASE_URL)
|
||||||
self.fms_client = FmsClient(
|
self.fms_client = FmsClient(
|
||||||
base_client.RangerAuthProvider(credentials),
|
base_client.RangerAuthProvider(credentials),
|
||||||
CONF.identity.catalog_type,
|
CONF.identity.catalog_type,
|
||||||
CONF.identity.region,
|
CONF.identity.region,
|
||||||
CONF.ranger.RANGER_FMS_BASE_URL)
|
CONF.ranger.RANGER_FMS_BASE_URL)
|
||||||
self.rms_client = RmsClient(
|
self.rms_client = RmsClient(
|
||||||
base_client.RangerAuthProvider(credentials),
|
base_client.RangerAuthProvider(credentials),
|
||||||
CONF.identity.catalog_type,
|
CONF.identity.catalog_type,
|
||||||
CONF.identity.region,
|
CONF.identity.region,
|
||||||
CONF.ranger.RANGER_RMS_BASE_URL)
|
CONF.ranger.RANGER_RMS_BASE_URL)
|
||||||
self.ims_client = ImsClient(
|
self.ims_client = ImsClient(
|
||||||
base_client.RangerAuthProvider(credentials),
|
base_client.RangerAuthProvider(credentials),
|
||||||
CONF.identity.catalog_type,
|
CONF.identity.catalog_type,
|
||||||
CONF.identity.region,
|
CONF.identity.region,
|
||||||
CONF.ranger.RANGER_IMS_BASE_URL)
|
CONF.ranger.RANGER_IMS_BASE_URL)
|
||||||
|
@ -1,129 +1,129 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the 'License'); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
from ranger_tempest_plugin.schemas import customers_schema as schema
|
from ranger_tempest_plugin.schemas import customers_schema as schema
|
||||||
from ranger_tempest_plugin.services import base_client
|
from ranger_tempest_plugin.services import base_client
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class CmsClient(base_client.RangerClientBase):
|
class CmsClient(base_client.RangerClientBase):
|
||||||
|
|
||||||
cms_url = CONF.ranger.RANGER_CMS_BASE_URL
|
cms_url = CONF.ranger.RANGER_CMS_BASE_URL
|
||||||
version = 'v1'
|
version = 'v1'
|
||||||
|
|
||||||
# POST
|
# POST
|
||||||
|
|
||||||
def create_customer(self, **kwargs):
|
def create_customer(self, **kwargs):
|
||||||
uri = '%s/%s/orm/customers' % (self.cms_url, self.version)
|
uri = '%s/%s/orm/customers' % (self.cms_url, self.version)
|
||||||
post_body = json.dumps(kwargs)
|
post_body = json.dumps(kwargs)
|
||||||
return self.post_request(uri, post_body, schema.create_customer)
|
return self.post_request(uri, post_body, schema.create_customer)
|
||||||
|
|
||||||
def add_default_user(self, customer_id, *args):
|
def add_default_user(self, customer_id, *args):
|
||||||
uri = '%s/%s/orm/customers/%s/users' \
|
uri = '%s/%s/orm/customers/%s/users' \
|
||||||
% (self.cms_url, self.version, customer_id)
|
% (self.cms_url, self.version, customer_id)
|
||||||
post_body = json.dumps(args)
|
post_body = json.dumps(args)
|
||||||
return self.post_request(uri, post_body, schema.add_users)
|
return self.post_request(uri, post_body, schema.add_users)
|
||||||
|
|
||||||
def add_regions(self, customer_id, regions):
|
def add_regions(self, customer_id, regions):
|
||||||
uri = '%s/%s/orm/customers/%s/regions' \
|
uri = '%s/%s/orm/customers/%s/regions' \
|
||||||
% (self.cms_url, self.version, customer_id)
|
% (self.cms_url, self.version, customer_id)
|
||||||
post_body = json.dumps(regions)
|
post_body = json.dumps(regions)
|
||||||
return self.post_request(uri, post_body, schema.add_regions)
|
return self.post_request(uri, post_body, schema.add_regions)
|
||||||
|
|
||||||
def add_region_user(self, customer_id, region_id, *args):
|
def add_region_user(self, customer_id, region_id, *args):
|
||||||
uri = '%s/%s/orm/customers/%s/regions/%s/users' \
|
uri = '%s/%s/orm/customers/%s/regions/%s/users' \
|
||||||
% (self.cms_url, self.version, customer_id, region_id)
|
% (self.cms_url, self.version, customer_id, region_id)
|
||||||
post_body = json.dumps(args)
|
post_body = json.dumps(args)
|
||||||
return self.post_request(uri, post_body, schema.add_users)
|
return self.post_request(uri, post_body, schema.add_users)
|
||||||
|
|
||||||
def add_metadata(self, customer_id, metadata):
|
def add_metadata(self, customer_id, metadata):
|
||||||
uri = '%s/%s/orm/customers/%s/metadata' \
|
uri = '%s/%s/orm/customers/%s/metadata' \
|
||||||
% (self.cms_url, self.version, customer_id)
|
% (self.cms_url, self.version, customer_id)
|
||||||
post_body = json.dumps(metadata)
|
post_body = json.dumps(metadata)
|
||||||
return self.post_request(uri, post_body, schema.add_metadata)
|
return self.post_request(uri, post_body, schema.add_metadata)
|
||||||
|
|
||||||
# PUT
|
# PUT
|
||||||
|
|
||||||
def update_customer(self, customer_id, customer):
|
def update_customer(self, customer_id, customer):
|
||||||
uri = '%s/%s/orm/customers/%s' \
|
uri = '%s/%s/orm/customers/%s' \
|
||||||
% (self.cms_url, self.version, customer_id)
|
% (self.cms_url, self.version, customer_id)
|
||||||
put_body = json.dumps(customer)
|
put_body = json.dumps(customer)
|
||||||
return self.put_request(uri, put_body, schema.update_customer)
|
return self.put_request(uri, put_body, schema.update_customer)
|
||||||
|
|
||||||
def enable_customer(self, customer_id, value):
|
def enable_customer(self, customer_id, value):
|
||||||
uri = '%s/%s/orm/customers/%s/enabled' \
|
uri = '%s/%s/orm/customers/%s/enabled' \
|
||||||
% (self.cms_url, self.version, customer_id)
|
% (self.cms_url, self.version, customer_id)
|
||||||
put_body = json.dumps({'enabled': value})
|
put_body = json.dumps({'enabled': value})
|
||||||
return self.put_request(uri, put_body, schema.enable_customer)
|
return self.put_request(uri, put_body, schema.enable_customer)
|
||||||
|
|
||||||
def replace_default_user(self, customer_id, *args):
|
def replace_default_user(self, customer_id, *args):
|
||||||
uri = '%s/%s/orm/customers/%s/users' \
|
uri = '%s/%s/orm/customers/%s/users' \
|
||||||
% (self.cms_url, self.version, customer_id)
|
% (self.cms_url, self.version, customer_id)
|
||||||
put_body = json.dumps(args)
|
put_body = json.dumps(args)
|
||||||
return self.put_request(uri, put_body, schema.replace_users)
|
return self.put_request(uri, put_body, schema.replace_users)
|
||||||
|
|
||||||
def replace_region_user(self, customer_id, region_id, *args):
|
def replace_region_user(self, customer_id, region_id, *args):
|
||||||
uri = '%s/%s/orm/customers/%s/regions/%s/users' \
|
uri = '%s/%s/orm/customers/%s/regions/%s/users' \
|
||||||
% (self.cms_url, self.version, customer_id, region_id)
|
% (self.cms_url, self.version, customer_id, region_id)
|
||||||
|
|
||||||
put_body = json.dumps(args)
|
put_body = json.dumps(args)
|
||||||
return self.put_request(uri, put_body, schema.replace_users)
|
return self.put_request(uri, put_body, schema.replace_users)
|
||||||
|
|
||||||
def replace_metadata(self, customer_id, metadata):
|
def replace_metadata(self, customer_id, metadata):
|
||||||
uri = '%s/%s/orm/customers/%s/metadata' \
|
uri = '%s/%s/orm/customers/%s/metadata' \
|
||||||
% (self.cms_url, self.version, customer_id)
|
% (self.cms_url, self.version, customer_id)
|
||||||
put_body = json.dumps(metadata)
|
put_body = json.dumps(metadata)
|
||||||
return self.put_request(uri, put_body, schema.replace_metadata)
|
return self.put_request(uri, put_body, schema.replace_metadata)
|
||||||
|
|
||||||
# GET
|
# GET
|
||||||
|
|
||||||
def get_customer(self, identifier):
|
def get_customer(self, identifier):
|
||||||
uri = '%s/%s/orm/customers/%s' \
|
uri = '%s/%s/orm/customers/%s' \
|
||||||
% (self.cms_url, self.version, identifier)
|
% (self.cms_url, self.version, identifier)
|
||||||
return self.get_request(uri, schema.get_customer)
|
return self.get_request(uri, schema.get_customer)
|
||||||
|
|
||||||
def list_customers(self, filter=None):
|
def list_customers(self, filter=None):
|
||||||
uri = '%s/%s/orm/customers' % (self.cms_url, self.version)
|
uri = '%s/%s/orm/customers' % (self.cms_url, self.version)
|
||||||
if filter is not None:
|
if filter is not None:
|
||||||
uri += '?' + urllib.urlencode(filter)
|
uri += '?' + urllib.parse.urlencode(filter)
|
||||||
return self.get_request(uri, schema.list_customer)
|
return self.get_request(uri, schema.list_customer)
|
||||||
|
|
||||||
# DELETE
|
# DELETE
|
||||||
|
|
||||||
def delete_region_from_customer(self, customer_id, region_id):
|
def delete_region_from_customer(self, customer_id, region_id):
|
||||||
uri = '%s/%s/orm/customers/%s/regions/%s' % (
|
uri = '%s/%s/orm/customers/%s/regions/%s' % (
|
||||||
self.cms_url, self.version, customer_id, region_id)
|
self.cms_url, self.version, customer_id, region_id)
|
||||||
return self.delete_request(uri, schema.delete_region_from_customer)
|
return self.delete_request(uri, schema.delete_region_from_customer)
|
||||||
|
|
||||||
def delete_customer(self, customer_id):
|
def delete_customer(self, customer_id):
|
||||||
uri = '%s/%s/orm/customers/%s' \
|
uri = '%s/%s/orm/customers/%s' \
|
||||||
% (self.cms_url, self.version, customer_id)
|
% (self.cms_url, self.version, customer_id)
|
||||||
return self.delete_request(uri, schema.delete_customer)
|
return self.delete_request(uri, schema.delete_customer)
|
||||||
|
|
||||||
def delete_default_user(self, customer_id, user_id):
|
def delete_default_user(self, customer_id, user_id):
|
||||||
uri = '%s/%s/orm/customers/%s/users/%s' \
|
uri = '%s/%s/orm/customers/%s/users/%s' \
|
||||||
% (self.cms_url, self.version, customer_id, user_id)
|
% (self.cms_url, self.version, customer_id, user_id)
|
||||||
return self.delete_request(uri, schema.delete_default_user)
|
return self.delete_request(uri, schema.delete_default_user)
|
||||||
|
|
||||||
def delete_region_user(self, customer_id, region_id, user_id):
|
def delete_region_user(self, customer_id, region_id, user_id):
|
||||||
uri = '%s/%s/orm/customers/%s/regions/%s/users/%s' \
|
uri = '%s/%s/orm/customers/%s/regions/%s/users/%s' \
|
||||||
% (self.cms_url, self.version, customer_id, region_id, user_id)
|
% (self.cms_url, self.version, customer_id, region_id, user_id)
|
||||||
return self.delete_request(uri, schema.delete_user_from_region)
|
return self.delete_request(uri, schema.delete_user_from_region)
|
||||||
|
@ -1,149 +1,149 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ranger_tempest_plugin.schemas import flavors_schema as schema
|
from ranger_tempest_plugin.schemas import flavors_schema as schema
|
||||||
from ranger_tempest_plugin.services import base_client
|
from ranger_tempest_plugin.services import base_client
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
from tempest.lib.common import rest_client
|
from tempest.lib.common import rest_client
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class FmsClient(base_client.RangerClientBase):
|
class FmsClient(base_client.RangerClientBase):
|
||||||
|
|
||||||
fms_url = CONF.ranger.RANGER_FMS_BASE_URL
|
fms_url = CONF.ranger.RANGER_FMS_BASE_URL
|
||||||
version = "v1"
|
version = "v1"
|
||||||
|
|
||||||
def create_flavor(self, **kwargs):
|
def create_flavor(self, **kwargs):
|
||||||
uri = '%s/%s/orm/flavors' % (self.fms_url, self.version)
|
uri = '%s/%s/orm/flavors' % (self.fms_url, self.version)
|
||||||
post_body = {"flavor": kwargs}
|
post_body = {"flavor": kwargs}
|
||||||
post_body = json.dumps(post_body)
|
post_body = json.dumps(post_body)
|
||||||
return self.post_request(uri, post_body, schema.create_flavor)
|
return self.post_request(uri, post_body, schema.create_flavor)
|
||||||
|
|
||||||
def get_flavor(self, identifier, para=None):
|
def get_flavor(self, identifier, para=None):
|
||||||
if para is None:
|
if para is None:
|
||||||
uri = '%s/%s/orm/flavors/%s' % (self.fms_url, self.version,
|
uri = '%s/%s/orm/flavors/%s' % (self.fms_url, self.version,
|
||||||
identifier)
|
identifier)
|
||||||
else:
|
else:
|
||||||
uri = '%s/%s/orm/flavors/%s/%s' % (self.fms_url, self.version,
|
uri = '%s/%s/orm/flavors/%s/%s' % (self.fms_url, self.version,
|
||||||
identifier, para)
|
identifier, para)
|
||||||
return self.get_request(uri, schema.get_flavor)
|
return self.get_request(uri, schema.get_flavor)
|
||||||
|
|
||||||
def list_flavors(self, para=None):
|
def list_flavors(self, para=None):
|
||||||
if para is None:
|
if para is None:
|
||||||
uri = '%s/%s/orm/flavors' % (self.fms_url, self.version)
|
uri = '%s/%s/orm/flavors' % (self.fms_url, self.version)
|
||||||
else:
|
else:
|
||||||
uri = '%s/%s/orm/flavors/%s' % (self.fms_url, self.version, para)
|
uri = '%s/%s/orm/flavors/%s' % (self.fms_url, self.version, para)
|
||||||
return self.get_request(uri, schema.list_flavors)
|
return self.get_request(uri, schema.list_flavors)
|
||||||
|
|
||||||
def delete_region_from_flavor(self, flavor_id, region_id):
|
def delete_region_from_flavor(self, flavor_id, region_id):
|
||||||
uri = '%s/%s/orm/flavors/%s/regions/%s' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/regions/%s' % (self.fms_url,
|
||||||
self.version, flavor_id,
|
self.version, flavor_id,
|
||||||
region_id)
|
region_id)
|
||||||
ex_headers = self.get_headers()
|
ex_headers = self.get_headers()
|
||||||
resp, body = self.delete(uri, extra_headers=ex_headers)
|
resp, body = self.delete(uri, extra_headers=ex_headers)
|
||||||
self.expected_success(204, resp.status)
|
self.expected_success(204, resp.status)
|
||||||
return rest_client.ResponseBody(resp, body)
|
return rest_client.ResponseBody(resp, body)
|
||||||
|
|
||||||
def delete_flavor(self, flavor_id):
|
def delete_flavor(self, flavor_id):
|
||||||
uri = '%s/%s/orm/flavors/%s' %\
|
uri = '%s/%s/orm/flavors/%s' %\
|
||||||
(self.fms_url, self.version, flavor_id)
|
(self.fms_url, self.version, flavor_id)
|
||||||
return self.delete_request(uri, schema.delete_flavor)
|
return self.delete_request(uri, schema.delete_flavor)
|
||||||
|
|
||||||
def delete_tags(self, flavor_id, para):
|
def delete_tags(self, flavor_id, para):
|
||||||
if para is None:
|
if para is None:
|
||||||
uri = '%s/%s/orm/flavors/%s/tags' % (self.fms_url, self.version,
|
uri = '%s/%s/orm/flavors/%s/tags' % (self.fms_url, self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
else:
|
else:
|
||||||
uri = '%s/%s/orm/flavors/%s/tags/%s' % (self.fms_url, self.version,
|
uri = '%s/%s/orm/flavors/%s/tags/%s' % (self.fms_url, self.version,
|
||||||
flavor_id, para)
|
flavor_id, para)
|
||||||
return self.delete_request(uri, schema.delete_tags)
|
return self.delete_request(uri, schema.delete_tags)
|
||||||
|
|
||||||
def get_tags(self, flavor_id):
|
def get_tags(self, flavor_id):
|
||||||
uri = '%s/%s/orm/flavors/%s/tags' % (self.fms_url, self.version,
|
uri = '%s/%s/orm/flavors/%s/tags' % (self.fms_url, self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
return self.get_request(uri, schema.get_tags)
|
return self.get_request(uri, schema.get_tags)
|
||||||
|
|
||||||
def add_tags(self, flavor_id, tag_body):
|
def add_tags(self, flavor_id, tag_body):
|
||||||
uri = '%s/%s/orm/flavors/%s/tags' % (self.fms_url, self.version,
|
uri = '%s/%s/orm/flavors/%s/tags' % (self.fms_url, self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
post_body = json.dumps(tag_body)
|
post_body = json.dumps(tag_body)
|
||||||
return self.post_request(uri, post_body, schema.add_tags)
|
return self.post_request(uri, post_body, schema.add_tags)
|
||||||
|
|
||||||
def update_tags(self, flavor_id, tag_body):
|
def update_tags(self, flavor_id, tag_body):
|
||||||
uri = '%s/%s/orm/flavors/%s/tags' % (self.fms_url, self.version,
|
uri = '%s/%s/orm/flavors/%s/tags' % (self.fms_url, self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
put_body = json.dumps(tag_body)
|
put_body = json.dumps(tag_body)
|
||||||
return self.put_request(uri, put_body, schema.update_tags)
|
return self.put_request(uri, put_body, schema.update_tags)
|
||||||
|
|
||||||
def get_extra_specs(self, flavor_id):
|
def get_extra_specs(self, flavor_id):
|
||||||
uri = '%s/%s/orm/flavors/%s/os_extra_specs' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/os_extra_specs' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
return self.get_request(uri, schema.get_extra_specs)
|
return self.get_request(uri, schema.get_extra_specs)
|
||||||
|
|
||||||
def add_flvr_tenants(self, flavor_id, tenant_body):
|
def add_flvr_tenants(self, flavor_id, tenant_body):
|
||||||
uri = '%s/%s/orm/flavors/%s/tenants/' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/tenants/' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
post_body = json.dumps(tenant_body)
|
post_body = json.dumps(tenant_body)
|
||||||
return self.post_request(uri, post_body, schema.add_tenant)
|
return self.post_request(uri, post_body, schema.add_tenant)
|
||||||
|
|
||||||
def add_flvr_regions(self, flavor_id, region_body):
|
def add_flvr_regions(self, flavor_id, region_body):
|
||||||
uri = '%s/%s/orm/flavors/%s/regions' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/regions' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
post_body = json.dumps(region_body)
|
post_body = json.dumps(region_body)
|
||||||
return self.post_request(uri, post_body, schema.add_region)
|
return self.post_request(uri, post_body, schema.add_region)
|
||||||
|
|
||||||
def delete_flvr_region(self, flavor_id, region_id):
|
def delete_flvr_region(self, flavor_id, region_id):
|
||||||
uri = '%s/%s/orm/flavors/%s/regions/%s' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/regions/%s' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id, region_id)
|
flavor_id, region_id)
|
||||||
return self.delete_request(uri, schema.delete_region)
|
return self.delete_request(uri, schema.delete_region)
|
||||||
|
|
||||||
def add_extra_specs(self, flavor_id, extra_specs_body):
|
def add_extra_specs(self, flavor_id, extra_specs_body):
|
||||||
uri = '%s/%s/orm/flavors/%s/os_extra_specs' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/os_extra_specs' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
post_body = json.dumps(extra_specs_body)
|
post_body = json.dumps(extra_specs_body)
|
||||||
return self.post_request(uri, post_body, schema.add_extra_specs)
|
return self.post_request(uri, post_body, schema.add_extra_specs)
|
||||||
|
|
||||||
def update_extra_specs(self, flavor_id, extra_specs_body):
|
def update_extra_specs(self, flavor_id, extra_specs_body):
|
||||||
uri = '%s/%s/orm/flavors/%s/os_extra_specs' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/os_extra_specs' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
put_body = json.dumps(extra_specs_body)
|
put_body = json.dumps(extra_specs_body)
|
||||||
return self.put_request(uri, put_body, schema.update_extra_specs)
|
return self.put_request(uri, put_body, schema.update_extra_specs)
|
||||||
|
|
||||||
def delete_extra_specs(self, flavor_id, para):
|
def delete_extra_specs(self, flavor_id, para):
|
||||||
if para is None:
|
if para is None:
|
||||||
uri = '%s/%s/orm/flavors/%s/os_extra_specs' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/os_extra_specs' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id)
|
flavor_id)
|
||||||
else:
|
else:
|
||||||
uri = '%s/%s/orm/flavors/%s/os_extra_specs/%s' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/os_extra_specs/%s' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id, para)
|
flavor_id, para)
|
||||||
return self.delete_request(uri, schema.delete_extra_specs)
|
return self.delete_request(uri, schema.delete_extra_specs)
|
||||||
|
|
||||||
def delete_flvr_tenant(self, flavor_id, tenant):
|
def delete_flvr_tenant(self, flavor_id, tenant):
|
||||||
uri = '%s/%s/orm/flavors/%s/tenants/%s' % (self.fms_url,
|
uri = '%s/%s/orm/flavors/%s/tenants/%s' % (self.fms_url,
|
||||||
self.version,
|
self.version,
|
||||||
flavor_id, tenant)
|
flavor_id, tenant)
|
||||||
return self.delete_request(uri, schema.delete_tenant)
|
return self.delete_request(uri, schema.delete_tenant)
|
||||||
|
@ -45,7 +45,7 @@ class GrpClient(base_client.RangerClientBase):
|
|||||||
def list_groups(self, filter=None):
|
def list_groups(self, filter=None):
|
||||||
uri = '%s/%s/orm/groups' % (self.cms_url, self.version)
|
uri = '%s/%s/orm/groups' % (self.cms_url, self.version)
|
||||||
if filter is not None:
|
if filter is not None:
|
||||||
uri += '?' + urllib.urlencode(filter)
|
uri += '?' + urllib.parse.urlencode(filter)
|
||||||
return self.get_request(uri, schema.list_groups)
|
return self.get_request(uri, schema.list_groups)
|
||||||
|
|
||||||
def add_groups_region(self, group_id, *args):
|
def add_groups_region(self, group_id, *args):
|
||||||
|
@ -1,102 +1,102 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ranger_tempest_plugin.schemas import images_schema as schema
|
from ranger_tempest_plugin.schemas import images_schema as schema
|
||||||
from ranger_tempest_plugin.services import base_client
|
from ranger_tempest_plugin.services import base_client
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class ImsClient(base_client.RangerClientBase):
|
class ImsClient(base_client.RangerClientBase):
|
||||||
|
|
||||||
ims_url = CONF.ranger.RANGER_IMS_BASE_URL
|
ims_url = CONF.ranger.RANGER_IMS_BASE_URL
|
||||||
version = "v1"
|
version = "v1"
|
||||||
|
|
||||||
def create_image(self, **kwargs):
|
def create_image(self, **kwargs):
|
||||||
uri = '%s/%s/orm/images' % (self.ims_url, self.version)
|
uri = '%s/%s/orm/images' % (self.ims_url, self.version)
|
||||||
post_body = {"image": kwargs}
|
post_body = {"image": kwargs}
|
||||||
post_body = json.dumps(post_body)
|
post_body = json.dumps(post_body)
|
||||||
return self.post_request(uri, post_body, schema.create_image)
|
return self.post_request(uri, post_body, schema.create_image)
|
||||||
|
|
||||||
def update_image(self, image_id, para=None, **kwargs):
|
def update_image(self, image_id, para=None, **kwargs):
|
||||||
if para is None:
|
if para is None:
|
||||||
uri = '%s/%s/orm/images/%s' % (
|
uri = '%s/%s/orm/images/%s' % (
|
||||||
self.ims_url, self.version, image_id)
|
self.ims_url, self.version, image_id)
|
||||||
else:
|
else:
|
||||||
uri = '%s/%s/orm/images/%s/%s' % (
|
uri = '%s/%s/orm/images/%s/%s' % (
|
||||||
self.ims_url, self.version, image_id, para)
|
self.ims_url, self.version, image_id, para)
|
||||||
put_body = {"image": kwargs}
|
put_body = {"image": kwargs}
|
||||||
put_body = json.dumps(put_body)
|
put_body = json.dumps(put_body)
|
||||||
return self.put_request(uri, put_body, schema.update_image)
|
return self.put_request(uri, put_body, schema.update_image)
|
||||||
|
|
||||||
def get_image(self, identifier, para=None):
|
def get_image(self, identifier, para=None):
|
||||||
if para is None:
|
if para is None:
|
||||||
uri = '%s/%s/orm/images/%s' % (self.ims_url, self.version,
|
uri = '%s/%s/orm/images/%s' % (self.ims_url, self.version,
|
||||||
identifier)
|
identifier)
|
||||||
else:
|
else:
|
||||||
uri = '%s/%s/orm/images/%s/%s' % (self.ims_url, self.version,
|
uri = '%s/%s/orm/images/%s/%s' % (self.ims_url, self.version,
|
||||||
identifier, para)
|
identifier, para)
|
||||||
return self.get_request(uri, schema.get_image)
|
return self.get_request(uri, schema.get_image)
|
||||||
|
|
||||||
def list_images(self, para=None):
|
def list_images(self, para=None):
|
||||||
if para is None:
|
if para is None:
|
||||||
uri = '%s/%s/orm/images' % (self.ims_url, self.version)
|
uri = '%s/%s/orm/images' % (self.ims_url, self.version)
|
||||||
else:
|
else:
|
||||||
uri = '%s/%s/orm/images/%s' % (self.ims_url, self.version, para)
|
uri = '%s/%s/orm/images/%s' % (self.ims_url, self.version, para)
|
||||||
return self.get_request(uri, schema.list_images)
|
return self.get_request(uri, schema.list_images)
|
||||||
|
|
||||||
def enabled_image(self, image_id, bool):
|
def enabled_image(self, image_id, bool):
|
||||||
uri = '%s/%s/orm/images/%s/enabled' \
|
uri = '%s/%s/orm/images/%s/enabled' \
|
||||||
% (self.ims_url, self.version, image_id)
|
% (self.ims_url, self.version, image_id)
|
||||||
put_body = json.dumps({'enabled': bool})
|
put_body = json.dumps({'enabled': bool})
|
||||||
return self.put_request(uri, put_body, schema.enable_image_resp)
|
return self.put_request(uri, put_body, schema.enable_image_resp)
|
||||||
|
|
||||||
def add_region_to_image(self, image_id, region_id):
|
def add_region_to_image(self, image_id, region_id):
|
||||||
uri = '%s/%s/orm/images/%s/regions/' % (self.ims_url,
|
uri = '%s/%s/orm/images/%s/regions/' % (self.ims_url,
|
||||||
self.version, image_id)
|
self.version, image_id)
|
||||||
post_body = json.dumps({"regions": [{"name": region_id}]})
|
post_body = json.dumps({"regions": [{"name": region_id}]})
|
||||||
return self.post_request(uri, post_body, schema.add_region)
|
return self.post_request(uri, post_body, schema.add_region)
|
||||||
|
|
||||||
def delete_region_from_image(self, image_id, region_id):
|
def delete_region_from_image(self, image_id, region_id):
|
||||||
uri = '%s/%s/orm/images/%s/regions/%s' % (self.ims_url,
|
uri = '%s/%s/orm/images/%s/regions/%s' % (self.ims_url,
|
||||||
self.version, image_id,
|
self.version, image_id,
|
||||||
region_id)
|
region_id)
|
||||||
return self.delete_request(uri, schema.delete_region)
|
return self.delete_request(uri, schema.delete_region)
|
||||||
|
|
||||||
def delete_image(self, image_id):
|
def delete_image(self, image_id):
|
||||||
uri = '%s/%s/orm/images/%s' % (self.ims_url, self.version, image_id)
|
uri = '%s/%s/orm/images/%s' % (self.ims_url, self.version, image_id)
|
||||||
return self.delete_request(uri, schema.delete_image)
|
return self.delete_request(uri, schema.delete_image)
|
||||||
|
|
||||||
def add_customer_to_image(self, image_id, tenant_id):
|
def add_customer_to_image(self, image_id, tenant_id):
|
||||||
uri = '%s/%s/orm/images/%s/customers' % (
|
uri = '%s/%s/orm/images/%s/customers' % (
|
||||||
self.ims_url, self.version, image_id)
|
self.ims_url, self.version, image_id)
|
||||||
post_body = json.dumps({"customers": [tenant_id]})
|
post_body = json.dumps({"customers": [tenant_id]})
|
||||||
return self.post_request(uri, post_body, schema.add_tenant_to_image)
|
return self.post_request(uri, post_body, schema.add_tenant_to_image)
|
||||||
|
|
||||||
def update_customer(self, image_id, tenant_id):
|
def update_customer(self, image_id, tenant_id):
|
||||||
uri = '%s/%s/orm/images/%s/customers' % (self.ims_url, self.version,
|
uri = '%s/%s/orm/images/%s/customers' % (self.ims_url, self.version,
|
||||||
image_id)
|
image_id)
|
||||||
put_body = json.dumps({"customers": [tenant_id]})
|
put_body = json.dumps({"customers": [tenant_id]})
|
||||||
return self.put_request(uri, put_body, schema.update_tenant)
|
return self.put_request(uri, put_body, schema.update_tenant)
|
||||||
|
|
||||||
def delete_customer_from_image(self, image_id, tenant_id):
|
def delete_customer_from_image(self, image_id, tenant_id):
|
||||||
uri = '%s/%s/orm/images/%s/customers/%s' % (self.ims_url,
|
uri = '%s/%s/orm/images/%s/customers/%s' % (self.ims_url,
|
||||||
self.version,
|
self.version,
|
||||||
image_id,
|
image_id,
|
||||||
tenant_id)
|
tenant_id)
|
||||||
return self.delete_request(uri, schema.delete_tenant_from_image)
|
return self.delete_request(uri, schema.delete_tenant_from_image)
|
||||||
|
@ -1,160 +1,160 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
from ranger_tempest_plugin.schemas import regions_schema as schema
|
from ranger_tempest_plugin.schemas import regions_schema as schema
|
||||||
from ranger_tempest_plugin.services import base_client
|
from ranger_tempest_plugin.services import base_client
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class RmsClient(base_client.RangerClientBase):
|
class RmsClient(base_client.RangerClientBase):
|
||||||
|
|
||||||
rms_url = CONF.ranger.RANGER_RMS_BASE_URL
|
rms_url = CONF.ranger.RANGER_RMS_BASE_URL
|
||||||
identity_url = CONF.identity.uri_v3 or ""
|
identity_url = CONF.identity.uri_v3 or ""
|
||||||
identity_url = identity_url.strip('/v3')
|
identity_url = identity_url.strip('/v3')
|
||||||
version = "v2"
|
version = "v2"
|
||||||
|
|
||||||
def create_region(self, region_id, **kwargs):
|
def create_region(self, region_id, **kwargs):
|
||||||
uri = '%s/%s/orm/regions' % (self.rms_url, self.version)
|
uri = '%s/%s/orm/regions' % (self.rms_url, self.version)
|
||||||
post_body = {
|
post_body = {
|
||||||
'status': 'functional',
|
'status': 'functional',
|
||||||
'name': region_id,
|
'name': region_id,
|
||||||
'id': region_id,
|
'id': region_id,
|
||||||
'description': region_id,
|
'description': region_id,
|
||||||
'designType': 'compact',
|
'designType': 'compact',
|
||||||
'locationType': 'testlocation',
|
'locationType': 'testlocation',
|
||||||
'vlcpName': 'testvlcp',
|
'vlcpName': 'testvlcp',
|
||||||
'address': {
|
'address': {
|
||||||
'country': 'usa',
|
'country': 'usa',
|
||||||
'state': 'tx',
|
'state': 'tx',
|
||||||
'city': 'austin',
|
'city': 'austin',
|
||||||
'street': '12 main',
|
'street': '12 main',
|
||||||
'zip': '12345'
|
'zip': '12345'
|
||||||
},
|
},
|
||||||
'metadata': {
|
'metadata': {
|
||||||
'key': ["value"]
|
'key': ["value"]
|
||||||
},
|
},
|
||||||
'endpoints': [
|
'endpoints': [
|
||||||
{
|
{
|
||||||
'publicURL':
|
'publicURL':
|
||||||
'https://dashboard-ranger.%s.com' % region_id,
|
'https://dashboard-ranger.%s.com' % region_id,
|
||||||
'type': 'dashboard'
|
'type': 'dashboard'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'publicURL': self.identity_url,
|
'publicURL': self.identity_url,
|
||||||
'type': 'identity'
|
'type': 'identity'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'publicURL':
|
'publicURL':
|
||||||
'https://ranger-agent.%s.com:9010' % region_id,
|
'https://ranger-agent.%s.com:9010' % region_id,
|
||||||
'type': 'ord'
|
'type': 'ord'
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
'rangerAgentVersion': '3.6',
|
'rangerAgentVersion': '3.6',
|
||||||
'OSVersion': 'kilo',
|
'OSVersion': 'kilo',
|
||||||
'CLLI': 'testclli'
|
'CLLI': 'testclli'
|
||||||
}
|
}
|
||||||
if kwargs is not None:
|
if kwargs is not None:
|
||||||
for key in kwargs:
|
for key in kwargs:
|
||||||
post_body[key] = kwargs[key]
|
post_body[key] = kwargs[key]
|
||||||
|
|
||||||
post_body = json.dumps(post_body)
|
post_body = json.dumps(post_body)
|
||||||
return self.post_request(uri, post_body, schema.create_region)
|
return self.post_request(uri, post_body, schema.create_region)
|
||||||
|
|
||||||
def update_region(self, region_id, **kwargs):
|
def update_region(self, region_id, **kwargs):
|
||||||
uri = '%s/%s/orm/regions/%s' % (self.rms_url, self.version, region_id)
|
uri = '%s/%s/orm/regions/%s' % (self.rms_url, self.version, region_id)
|
||||||
put_body = json.dumps(kwargs)
|
put_body = json.dumps(kwargs)
|
||||||
return self.put_request(uri, put_body, schema.update_region)
|
return self.put_request(uri, put_body, schema.update_region)
|
||||||
|
|
||||||
def update_region_status(self, region_id, status):
|
def update_region_status(self, region_id, status):
|
||||||
uri = '%s/%s/orm/regions/%s/status' \
|
uri = '%s/%s/orm/regions/%s/status' \
|
||||||
% (self.rms_url, self.version, region_id)
|
% (self.rms_url, self.version, region_id)
|
||||||
put_body = json.dumps(status)
|
put_body = json.dumps(status)
|
||||||
return self.put_request(uri, put_body, schema.update_status)
|
return self.put_request(uri, put_body, schema.update_status)
|
||||||
|
|
||||||
def update_region_metadata(self, region_id, metadata):
|
def update_region_metadata(self, region_id, metadata):
|
||||||
uri = '%s/%s/orm/regions/%s/metadata' \
|
uri = '%s/%s/orm/regions/%s/metadata' \
|
||||||
% (self.rms_url, self.version, region_id)
|
% (self.rms_url, self.version, region_id)
|
||||||
put_body = json.dumps(metadata)
|
put_body = json.dumps(metadata)
|
||||||
return self.put_request(uri, put_body, schema.update_metadata)
|
return self.put_request(uri, put_body, schema.update_metadata)
|
||||||
|
|
||||||
def get_region(self, identifier):
|
def get_region(self, identifier):
|
||||||
uri = '%s/%s/orm/regions/%s' % (self.rms_url, self.version, identifier)
|
uri = '%s/%s/orm/regions/%s' % (self.rms_url, self.version, identifier)
|
||||||
return self.get_request(uri, schema.get_region)
|
return self.get_request(uri, schema.get_region)
|
||||||
|
|
||||||
def get_region_metadata(self, identifier):
|
def get_region_metadata(self, identifier):
|
||||||
uri = '%s/%s/orm/regions/%s/metadata'\
|
uri = '%s/%s/orm/regions/%s/metadata'\
|
||||||
% (self.rms_url, self.version, identifier)
|
% (self.rms_url, self.version, identifier)
|
||||||
return self.get_request(uri, schema.get_region_metadata)
|
return self.get_request(uri, schema.get_region_metadata)
|
||||||
|
|
||||||
def list_regions_v1(self):
|
def list_regions_v1(self):
|
||||||
uri = self.rms_url + '/lcp'
|
uri = self.rms_url + '/lcp'
|
||||||
return self.get_request(uri, schema.list_region_v1)
|
return self.get_request(uri, schema.list_region_v1)
|
||||||
|
|
||||||
def list_regions(self, filter=None):
|
def list_regions(self, filter=None):
|
||||||
uri = '%s/%s/orm/regions' % (self.rms_url, self.version)
|
uri = '%s/%s/orm/regions' % (self.rms_url, self.version)
|
||||||
if filter is not None:
|
if filter is not None:
|
||||||
uri += '?' + urllib.urlencode(filter)
|
uri += '?' + urllib.parse.urlencode(filter)
|
||||||
return self.get_request(uri, schema.list_region)
|
return self.get_request(uri, schema.list_region)
|
||||||
|
|
||||||
def delete_region(self, region_id):
|
def delete_region(self, region_id):
|
||||||
uri = '%s/%s/orm/regions/%s' % (self.rms_url, self.version, region_id)
|
uri = '%s/%s/orm/regions/%s' % (self.rms_url, self.version, region_id)
|
||||||
return self.delete_request(uri, schema.delete_region)
|
return self.delete_request(uri, schema.delete_region)
|
||||||
|
|
||||||
def add_region_metadata(self, region_id, **kwargs):
|
def add_region_metadata(self, region_id, **kwargs):
|
||||||
uri = '%s/%s/orm/regions/%s/metadata'\
|
uri = '%s/%s/orm/regions/%s/metadata'\
|
||||||
% (self.rms_url, self.version, region_id)
|
% (self.rms_url, self.version, region_id)
|
||||||
post_body = json.dumps(kwargs)
|
post_body = json.dumps(kwargs)
|
||||||
return self.post_request(uri, post_body, schema.update_metadata)
|
return self.post_request(uri, post_body, schema.update_metadata)
|
||||||
#
|
#
|
||||||
# def delete_region_metadata(self, region_id, key):
|
# def delete_region_metadata(self, region_id, key):
|
||||||
# uri = '%s/%s/orm/regions/%s/metadata/%s' % (
|
# uri = '%s/%s/orm/regions/%s/metadata/%s' % (
|
||||||
# self.rms_url, self.version, region_id, key)
|
# self.rms_url, self.version, region_id, key)
|
||||||
# ex_headers = self.get_headers()
|
# ex_headers = self.get_headers()
|
||||||
# resp, body = self.delete(uri, extra_headers=ex_headers)
|
# resp, body = self.delete(uri, extra_headers=ex_headers)
|
||||||
# self.expected_success(200, resp.status)
|
# self.expected_success(200, resp.status)
|
||||||
# body = json.loads(body)
|
# body = json.loads(body)
|
||||||
# return rest_client.ResponseBody(resp, body)
|
# return rest_client.ResponseBody(resp, body)
|
||||||
|
|
||||||
def create_region_group(self, **kwargs):
|
def create_region_group(self, **kwargs):
|
||||||
uri = '%s/%s/orm/groups' % (self.rms_url, self.version)
|
uri = '%s/%s/orm/groups' % (self.rms_url, self.version)
|
||||||
post_body = json.dumps(kwargs)
|
post_body = json.dumps(kwargs)
|
||||||
return self.post_request(uri, post_body, schema.create_region_group)
|
return self.post_request(uri, post_body, schema.create_region_group)
|
||||||
|
|
||||||
def update_region_group(self, group_id, **kwargs):
|
def update_region_group(self, group_id, **kwargs):
|
||||||
uri = '%s/%s/orm/groups/%s' % (self.rms_url, self.version, group_id)
|
uri = '%s/%s/orm/groups/%s' % (self.rms_url, self.version, group_id)
|
||||||
put_body = json.dumps(kwargs)
|
put_body = json.dumps(kwargs)
|
||||||
return self.put_request(uri, put_body, schema.update_region_group)
|
return self.put_request(uri, put_body, schema.update_region_group)
|
||||||
|
|
||||||
def get_region_group(self, identifier):
|
def get_region_group(self, identifier):
|
||||||
uri = '%s/%s/orm/groups/%s'\
|
uri = '%s/%s/orm/groups/%s'\
|
||||||
% (self.rms_url, self.version, identifier)
|
% (self.rms_url, self.version, identifier)
|
||||||
return self.get_request(uri, schema.get_region_group)
|
return self.get_request(uri, schema.get_region_group)
|
||||||
|
|
||||||
def list_region_groups(self):
|
def list_region_groups(self):
|
||||||
uri = '%s/%s/orm/groups' % (self.rms_url, self.version)
|
uri = '%s/%s/orm/groups' % (self.rms_url, self.version)
|
||||||
return self.get_request(uri, schema.list_region_groups)
|
return self.get_request(uri, schema.list_region_groups)
|
||||||
|
|
||||||
def delete_region_group(self, region_group_id):
|
def delete_region_group(self, region_group_id):
|
||||||
uri = '%s/%s/orm/groups/%s' % (self.rms_url, self.version,
|
uri = '%s/%s/orm/groups/%s' % (self.rms_url, self.version,
|
||||||
region_group_id)
|
region_group_id)
|
||||||
return self.delete_request(uri, schema.delete_region_group)
|
return self.delete_request(uri, schema.delete_region_group)
|
||||||
|
@ -1,52 +1,51 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from ranger_tempest_plugin import clients
|
from ranger_tempest_plugin import clients
|
||||||
|
|
||||||
import six
|
from tempest import config
|
||||||
from tempest import config
|
from tempest import test
|
||||||
from tempest import test
|
|
||||||
|
CONF = config.CONF
|
||||||
CONF = config.CONF
|
LOG = logging.getLogger(__name__)
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
class BaseOrmTest(test.BaseTestCase):
|
||||||
class BaseOrmTest(test.BaseTestCase):
|
|
||||||
|
credentials = ['admin', 'primary', 'alt']
|
||||||
credentials = ['admin', 'primary', 'alt']
|
|
||||||
|
client_manager = clients.OrmClientManager
|
||||||
client_manager = clients.OrmClientManager
|
|
||||||
|
build_timeout = 120
|
||||||
build_timeout = 120
|
build_interval = 10
|
||||||
build_interval = 10
|
|
||||||
|
@classmethod
|
||||||
@classmethod
|
def setup_clients(cls):
|
||||||
def setup_clients(cls):
|
super(BaseOrmTest, cls).setup_clients()
|
||||||
super(BaseOrmTest, cls).setup_clients()
|
cls.identity_client = cls.os_admin.projects_client
|
||||||
cls.identity_client = cls.os_admin.projects_client
|
|
||||||
|
@classmethod
|
||||||
@classmethod
|
def skip_checks(cls):
|
||||||
def skip_checks(cls):
|
super(BaseOrmTest, cls).skip_checks()
|
||||||
super(BaseOrmTest, cls).skip_checks()
|
if not CONF.service_available.ranger:
|
||||||
if not CONF.service_available.ranger:
|
skip_msg = ("%s skipped as ranger is not available" % cls.__name__)
|
||||||
skip_msg = ("%s skipped as ranger is not available" % cls.__name__)
|
raise cls.skipException(skip_msg)
|
||||||
raise cls.skipException(skip_msg)
|
|
||||||
|
def assert_expected(self, expected, actual, excluded_keys):
|
||||||
def assertExpected(self, expected, actual, excluded_keys):
|
for key, value in list(expected.items()):
|
||||||
for key, value in six.iteritems(expected):
|
if key not in excluded_keys:
|
||||||
if key not in excluded_keys:
|
self.assertIn(key, actual)
|
||||||
self.assertIn(key, actual)
|
self.assertEqual(value, actual[key], key)
|
||||||
self.assertEqual(value, actual[key], key)
|
|
||||||
|
@ -1,324 +1,317 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
from tempest.common.utils import data_utils
|
from tempest.common.utils import data_utils
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class CmsBaseOrmTest(base.BaseOrmTest):
|
class CmsBaseOrmTest(base.BaseOrmTest):
|
||||||
credentials = ['admin', 'primary', 'alt']
|
credentials = ['admin', 'primary', 'alt']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(CmsBaseOrmTest, cls).setup_clients()
|
super(CmsBaseOrmTest, cls).setup_clients()
|
||||||
cls.client = cls.os_primary.cms_client
|
cls.client = cls.os_primary.cms_client
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_quota(cls):
|
def _get_quota(cls):
|
||||||
compute, storage, network, quota = {}, {}, {}, {}
|
compute, storage, network, quota = {}, {}, {}, {}
|
||||||
compute["instances"] = "10"
|
compute["instances"] = "10"
|
||||||
compute["injected-files"] = "10"
|
compute["injected-files"] = "10"
|
||||||
compute["key-pairs"] = "10"
|
compute["key-pairs"] = "10"
|
||||||
compute["ram"] = "10"
|
compute["ram"] = "10"
|
||||||
compute["vcpus"] = "51"
|
compute["vcpus"] = "51"
|
||||||
compute["metadata-items"] = "34"
|
compute["metadata-items"] = "34"
|
||||||
compute["injected-file-content-bytes"] = "25"
|
compute["injected-file-content-bytes"] = "25"
|
||||||
storage["gigabytes"] = "10"
|
storage["gigabytes"] = "10"
|
||||||
storage["snapshots"] = "10"
|
storage["snapshots"] = "10"
|
||||||
storage["volumes"] = "10"
|
storage["volumes"] = "10"
|
||||||
network["floating-ips"] = "10"
|
network["floating-ips"] = "10"
|
||||||
network["networks"] = "10"
|
network["networks"] = "10"
|
||||||
network["ports"] = "10"
|
network["ports"] = "10"
|
||||||
network["routers"] = "10"
|
network["routers"] = "10"
|
||||||
network["subnets"] = "10"
|
network["subnets"] = "10"
|
||||||
network["security-group-rules"] = "51"
|
network["security-group-rules"] = "51"
|
||||||
network["security-groups"] = "50"
|
network["security-groups"] = "50"
|
||||||
quota['compute'] = [compute]
|
quota['compute'] = [compute]
|
||||||
quota['storage'] = [storage]
|
quota['storage'] = [storage]
|
||||||
quota['network'] = [network]
|
quota['network'] = [network]
|
||||||
return quota
|
return quota
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_additional_quota_for_cust(cls):
|
def _get_additional_quota_for_cust(cls):
|
||||||
quota = cls._get_quota()
|
quota = cls._get_quota()
|
||||||
quota["compute"][0]["floating-ips"] = "10"
|
quota["compute"][0]["floating-ips"] = "10"
|
||||||
quota["compute"][0]["fixed-ips"] = "10"
|
quota["compute"][0]["fixed-ips"] = "10"
|
||||||
quota["compute"][0]["injected-file-path-bytes"] = "34"
|
quota["compute"][0]["injected-file-path-bytes"] = "34"
|
||||||
quota["compute"][0]["server-groups"] = "10"
|
quota["compute"][0]["server-groups"] = "10"
|
||||||
quota["compute"][0]["server-group-members"] = "34"
|
quota["compute"][0]["server-group-members"] = "34"
|
||||||
quota["network"][0]["health-monitor"] = "10"
|
quota["network"][0]["health-monitor"] = "10"
|
||||||
quota["network"][0]["member"] = "10"
|
quota["network"][0]["member"] = "10"
|
||||||
quota["network"][0]["nat-instance"] = "10"
|
quota["network"][0]["nat-instance"] = "10"
|
||||||
quota["network"][0]["pool"] = "10"
|
quota["network"][0]["pool"] = "10"
|
||||||
quota["network"][0]["route-table"] = "10"
|
quota["network"][0]["route-table"] = "10"
|
||||||
quota["network"][0]["vip"] = "10"
|
quota["network"][0]["vip"] = "10"
|
||||||
return quota
|
return quota
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_customer_params(cls, quota=None, enabled=True, region_users=True,
|
def _get_customer_params(cls, quota=None, enabled=True, region_users=True,
|
||||||
default_users=True):
|
default_users=True):
|
||||||
region, user, metadata, payload = {}, {}, {}, {}
|
region, user, metadata, payload = {}, {}, {}, {}
|
||||||
cust_name = data_utils.rand_name('ormTempestCms')
|
cust_name = data_utils.rand_name('ormTempestCms')
|
||||||
if not quota:
|
if not quota:
|
||||||
quota = cls._get_quota()
|
quota = cls._get_quota()
|
||||||
region['name'] = CONF.identity.region
|
region['name'] = CONF.identity.region
|
||||||
region['type'] = 'single'
|
region['type'] = 'single'
|
||||||
region['quotas'] = [quota]
|
region['quotas'] = [quota]
|
||||||
user['id'] = cls.os_primary.credentials.username
|
user['id'] = cls.os_primary.credentials.username
|
||||||
user['role'] = ["admin"]
|
user['role'] = ["admin"]
|
||||||
region["users"] = [user] if region_users else []
|
region["users"] = [user] if region_users else []
|
||||||
regions = [region]
|
regions = [region]
|
||||||
metadata['my_server_name'] = cust_name
|
metadata['my_server_name'] = cust_name
|
||||||
metadata['ocx_cust'] = random.randint(0, 999999999)
|
metadata['ocx_cust'] = random.randint(0, 999999999)
|
||||||
payload["description"] = cust_name
|
payload["description"] = cust_name
|
||||||
payload["enabled"] = True if enabled else False
|
payload["enabled"] = True if enabled else False
|
||||||
payload["name"] = cust_name
|
payload["name"] = cust_name
|
||||||
payload['metadata'] = metadata
|
payload['metadata'] = metadata
|
||||||
payload["regions"] = regions
|
payload["regions"] = regions
|
||||||
payload["defaultQuotas"] = [quota]
|
payload["defaultQuotas"] = [quota]
|
||||||
payload['users'] = [user] if default_users else []
|
payload['users'] = [user] if default_users else []
|
||||||
return payload
|
return payload
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_bare_customer_params(cls):
|
def _get_bare_customer_params(cls):
|
||||||
customer = {}
|
customer = {}
|
||||||
customer['description'] = ''
|
customer['description'] = ''
|
||||||
customer['enabled'] = True
|
customer['enabled'] = True
|
||||||
customer['name'] = data_utils.rand_name('ormTempestCms')
|
customer['name'] = data_utils.rand_name('ormTempestCms')
|
||||||
customer['regions'] = []
|
customer['regions'] = []
|
||||||
customer['defaultQuotas'] = []
|
customer['defaultQuotas'] = []
|
||||||
customer['users'] = []
|
customer['users'] = []
|
||||||
return customer
|
return customer
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_user_params(cls, alt=False):
|
def _get_user_params(cls, alt=False):
|
||||||
users = []
|
users = []
|
||||||
if not alt:
|
if not alt:
|
||||||
users.append({'id': cls.os_primary.credentials.username,
|
users.append({'id': cls.os_primary.credentials.username,
|
||||||
'role': ['admin']})
|
'role': ['admin']})
|
||||||
else:
|
else:
|
||||||
users.append({'id': cls.os_alt.credentials.username,
|
users.append({'id': cls.os_alt.credentials.username,
|
||||||
'role': ['admin_viewer', 'admin_support']})
|
'role': ['admin_viewer', 'admin_support']})
|
||||||
return users
|
return users
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_region_params(cls):
|
def _get_region_params(cls):
|
||||||
quota = cls._get_quota()
|
quota = cls._get_quota()
|
||||||
region = {}
|
region = {}
|
||||||
region['name'] = CONF.identity.region
|
region['name'] = CONF.identity.region
|
||||||
region['type'] = 'single'
|
region['type'] = 'single'
|
||||||
region['quotas'] = [quota]
|
region['quotas'] = [quota]
|
||||||
return [region]
|
return [region]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _create_cust_validate_creation_on_dcp_and_lcp(self, **kwargs):
|
def _create_cust_validate_creation_on_dcp_and_lcp(cls, **kwargs):
|
||||||
"""Creates a customer record
|
"""Creates a customer record
|
||||||
|
|
||||||
kwargs contains field data needed for customer POST body:
|
kwargs contains field data needed for customer POST body:
|
||||||
- name
|
- name
|
||||||
- description
|
- description
|
||||||
- enabled
|
- enabled
|
||||||
- metadata
|
- metadata
|
||||||
- regions
|
- regions
|
||||||
- defaultQuotas
|
- defaultQuotas
|
||||||
- ephemeral
|
- ephemeral
|
||||||
- regions
|
- regions
|
||||||
- visibility
|
- visibility
|
||||||
- tenants
|
- tenants
|
||||||
"""
|
"""
|
||||||
_, body = self.client.create_customer(**kwargs)
|
_, body = cls.client.create_customer(**kwargs)
|
||||||
customer_id = body["customer"]["id"]
|
customer_id = body["customer"]["id"]
|
||||||
_, customer = self.client.get_customer(customer_id)
|
_, customer = cls.client.get_customer(customer_id)
|
||||||
if customer["name"] == kwargs["name"]:
|
if customer["name"] == kwargs["name"]:
|
||||||
if customer["regions"] == []:
|
if customer["regions"] == []:
|
||||||
customer_status = "no regions"
|
customer_status = "no regions"
|
||||||
else:
|
else:
|
||||||
customer_status = "Success"
|
customer_status = "Success"
|
||||||
|
else:
|
||||||
self._wait_for_status(customer_id, customer_status)
|
message = "customer %s not created successfully" % kwargs["name"]
|
||||||
return customer_id
|
exceptions.TempestException(message)
|
||||||
else:
|
cls._wait_for_status(customer_id, customer_status)
|
||||||
message = "customer %s not created successfully" % kwargs["name"]
|
return customer_id
|
||||||
exceptions.TempestException(message)
|
|
||||||
|
@classmethod
|
||||||
@classmethod
|
def _wait_for_status(cls, customer_id, status):
|
||||||
def _wait_for_status(cls, customer_id, status):
|
customer_status = cls.client.get_customer(customer_id)[1]["status"]
|
||||||
customer_status = cls.client.get_customer(customer_id)[1]["status"]
|
start = int(time.time())
|
||||||
start = int(time.time())
|
while customer_status != status:
|
||||||
while customer_status != status:
|
time.sleep(cls.build_interval)
|
||||||
time.sleep(cls.build_interval)
|
customer_status = cls.client.get_customer(customer_id)[1]["status"]
|
||||||
customer_status = cls.client.get_customer(customer_id)[1]["status"]
|
if customer_status == 'Error':
|
||||||
if customer_status == 'Error':
|
message = ('customer %s failed to reach %s status'
|
||||||
message = ('customer %s failed to reach %s status'
|
' and is in ERROR status on orm' %
|
||||||
' and is in ERROR status on orm' %
|
(customer_id, status))
|
||||||
(customer_id, status))
|
raise exceptions.TempestException(message)
|
||||||
raise exceptions.TempestException(message)
|
if int(time.time()) - start >= cls.build_timeout:
|
||||||
if int(time.time()) - start >= cls.build_timeout:
|
message = ('customer %s failed to reach %s'
|
||||||
message = ('customer %s failed to reach %s'
|
'status within the required time (%s s)'
|
||||||
'status within the required time (%s s)'
|
'on orm and is in %s status.'
|
||||||
'on orm and is in %s status.'
|
% (customer_id, status,
|
||||||
% (customer_id, status,
|
cls.build_timeout,
|
||||||
cls.build_timeout,
|
customer_status))
|
||||||
customer_status))
|
raise exceptions.TimeoutException(message)
|
||||||
raise exceptions.TimeoutException(message)
|
|
||||||
|
@classmethod
|
||||||
@classmethod
|
def _validate_cust_quota_on_lcp(cls, quota, cust_id):
|
||||||
def _validate_cust_quota_on_lcp(cls, quota, cust_id):
|
expected_quota_count = len(quota["compute"][0]) +\
|
||||||
expected_quota_count = len(quota["compute"][0]) +\
|
len(quota["storage"][0]) +\
|
||||||
len(quota["storage"][0]) +\
|
len(quota["network"][0])
|
||||||
len(quota["network"][0])
|
actual_quota_count = 0
|
||||||
actual_quota_count = 0
|
body = cls.nova_quotas_client.show_quota_set(cust_id)
|
||||||
body = cls.nova_quotas_client.show_quota_set(cust_id)
|
for param in quota["compute"][0]:
|
||||||
for param in quota["compute"][0]:
|
if param in body["quota_set"]:
|
||||||
if param in body["quota_set"]:
|
if (quota["compute"][0][param] ==
|
||||||
if (quota["compute"][0][param] ==
|
str(body["quota_set"][param])):
|
||||||
str(body["quota_set"][param])):
|
actual_quota_count += 1
|
||||||
actual_quota_count += 1
|
body = cls.volume_quotas_client.show_quota_set(cust_id)
|
||||||
body = cls.volume_quotas_client.show_quota_set(cust_id)
|
for param in quota["storage"][0]:
|
||||||
for param in quota["storage"][0]:
|
if param in body["quota_set"]:
|
||||||
if param in body["quota_set"]:
|
if str(body["quota_set"][param]) == quota["compute"][0][param]:
|
||||||
if str(body["quota_set"][param]) == quota["compute"][0][param]:
|
actual_quota_count += 1
|
||||||
actual_quota_count += 1
|
body = cls.networks_quotas_client.show_quotas(cust_id)
|
||||||
body = cls.networks_quotas_client.show_quotas(cust_id)
|
for param in quota["network"][0]:
|
||||||
for param in quota["network"][0]:
|
if param in body["quota_set"]:
|
||||||
if param in body["quota_set"]:
|
if (quota["compute"][0][param] ==
|
||||||
if (quota["compute"][0][param] ==
|
str(body["quota_set"][param])):
|
||||||
str(body["quota_set"][param])):
|
actual_quota_count += 1
|
||||||
actual_quota_count += 1
|
return bool(expected_quota_count == actual_quota_count)
|
||||||
if expected_quota_count == actual_quota_count:
|
|
||||||
return True
|
@classmethod
|
||||||
else:
|
def _validate_users_on_cust_on_dcp_and_lcp(cls, post_body, cust_id):
|
||||||
return False
|
default_users_req, region_users_req, \
|
||||||
|
default_users_dcp, region_users_dcp, \
|
||||||
@classmethod
|
users_lcp = [], [], [], [], []
|
||||||
def _validate_users_on_cust_on_dcp_and_lcp(cls, post_body, cust_id):
|
for user in post_body["regions"][0]["users"]:
|
||||||
default_users_req, region_users_req, \
|
region_users_req.append(user["id"])
|
||||||
default_users_dcp, region_users_dcp, \
|
for user in post_body["users"]:
|
||||||
users_lcp = [], [], [], [], []
|
default_users_req.append(user["id"])
|
||||||
for user in post_body["regions"][0]["users"]:
|
expected_users_count = len(region_users_req) + len(default_users_req)
|
||||||
region_users_req.append(user["id"])
|
actual_users_count = 0
|
||||||
for user in post_body["users"]:
|
lcp_body = cls.identity_client.list_tenant_users(cust_id)
|
||||||
default_users_req.append(user["id"])
|
for user in lcp_body["users"]:
|
||||||
expected_users_count = len(region_users_req) + len(default_users_req)
|
users_lcp.append(user["id"])
|
||||||
actual_users_count = 0
|
dcp_body = cls.client.get_customer(cust_id)
|
||||||
lcp_body = cls.identity_client.list_tenant_users(cust_id)
|
for user in dcp_body["regions"][0]["users"]:
|
||||||
for user in lcp_body["users"]:
|
region_users_dcp.append(user["id"])
|
||||||
users_lcp.append(user["id"])
|
for user in dcp_body["users"]:
|
||||||
dcp_body = cls.client.get_customer(cust_id)
|
default_users_dcp.append(user["id"])
|
||||||
for user in dcp_body["regions"][0]["users"]:
|
for user in default_users_req:
|
||||||
region_users_dcp.append(user["id"])
|
if (user in users_lcp) and (user in default_users_dcp):
|
||||||
for user in dcp_body["users"]:
|
actual_users_count += 1
|
||||||
default_users_dcp.append(user["id"])
|
for user in region_users_req:
|
||||||
for user in default_users_req:
|
if (user in users_lcp) and (user in region_users_dcp):
|
||||||
if (user in users_lcp) and (user in default_users_dcp):
|
actual_users_count += 1
|
||||||
actual_users_count += 1
|
return bool(expected_users_count == actual_users_count)
|
||||||
for user in region_users_req:
|
|
||||||
if (user in users_lcp) and (user in region_users_dcp):
|
@classmethod
|
||||||
actual_users_count += 1
|
def _del_cust_validate_deletion_on_dcp_and_lcp(cls, customer_id):
|
||||||
if expected_users_count == actual_users_count:
|
_, customer = cls.client.get_customer(customer_id)
|
||||||
return True
|
regions_on_customer = [region for region in customer["regions"]]
|
||||||
else:
|
if regions_on_customer:
|
||||||
return False
|
region_name_on_customer = regions_on_customer[0]["name"]
|
||||||
|
cls._delete_region_from_customer_and_validate_deletion(
|
||||||
@classmethod
|
customer_id, region_name_on_customer)
|
||||||
def _del_cust_validate_deletion_on_dcp_and_lcp(cls, customer_id):
|
cls.client.delete_customer(customer_id)
|
||||||
_, customer = cls.client.get_customer(customer_id)
|
cls._wait_for_customer_deletion_on_dcp(customer_id)
|
||||||
regions_on_customer = [region for region in customer["regions"]]
|
cls._validate_customer_deletion_on_lcp(customer_id)
|
||||||
if regions_on_customer:
|
|
||||||
region_name_on_customer = regions_on_customer[0]["name"]
|
@classmethod
|
||||||
cls._delete_region_from_customer_and_validate_deletion(
|
def _delete_region_from_customer_and_validate_deletion(
|
||||||
customer_id, region_name_on_customer)
|
cls, customer_id, rname):
|
||||||
cls.client.delete_customer(customer_id)
|
_, region = cls.os_admin.rms_client.get_region(rname)
|
||||||
cls._wait_for_customer_deletion_on_dcp(customer_id)
|
region_id = region["id"]
|
||||||
cls._validate_customer_deletion_on_lcp(customer_id)
|
cls.client.delete_region_from_customer(customer_id, region_id)
|
||||||
|
# cls._wait_for_cust_status_on_dcp(customer_id, "no regions")
|
||||||
@classmethod
|
cls._wait_for_status(customer_id, "no regions")
|
||||||
def _delete_region_from_customer_and_validate_deletion(
|
_, body = cls.client.get_customer(customer_id)
|
||||||
cls, customer_id, rname):
|
regions_on_customer = [rgn for rgn in body["regions"]]
|
||||||
_, region = cls.os_admin.rms_client.get_region(rname)
|
if regions_on_customer:
|
||||||
region_id = region["id"]
|
message = "Region %s failed to get deleted from customer %s " % (
|
||||||
cls.client.delete_region_from_customer(customer_id, region_id)
|
rname, customer_id)
|
||||||
# cls._wait_for_cust_status_on_dcp(customer_id, "no regions")
|
raise exceptions.TempestException(message)
|
||||||
cls._wait_for_status(customer_id, "no regions")
|
cls._validate_customer_deletion_on_lcp(customer_id)
|
||||||
_, body = cls.client.get_customer(customer_id)
|
|
||||||
regions_on_customer = [rgn for rgn in body["regions"]]
|
@classmethod
|
||||||
if regions_on_customer:
|
def _wait_for_customer_deletion_on_dcp(cls, customer_id):
|
||||||
message = "Region %s failed to get deleted from customer %s " % (
|
_, body = cls.client.list_customers()
|
||||||
rname, customer_id)
|
customer_list = body["customers"]
|
||||||
raise exceptions.TempestException(message)
|
customer_ids = [customer["id"]
|
||||||
cls._validate_customer_deletion_on_lcp(customer_id)
|
for customer in customer_list
|
||||||
|
if customer["id"] == customer_id]
|
||||||
@classmethod
|
start = int(time.time())
|
||||||
def _wait_for_customer_deletion_on_dcp(cls, customer_id):
|
while customer_ids:
|
||||||
_, body = cls.client.list_customers()
|
time.sleep(cls.build_interval)
|
||||||
customer_list = body["customers"]
|
_, body = cls.client.list_customers()["customers"]
|
||||||
customer_ids = [customer["id"]
|
customer_list = body["customers"]
|
||||||
for customer in customer_list
|
customer_ids = [customer["id"]
|
||||||
if customer["id"] == customer_id]
|
for customer in customer_list
|
||||||
start = int(time.time())
|
if customer["id"] == customer_id]
|
||||||
while customer_ids:
|
if customer_ids:
|
||||||
time.sleep(cls.build_interval)
|
customer_status = customer_ids[0]["status"]
|
||||||
_, body = cls.client.list_customers()["customers"]
|
if customer_status == 'Error':
|
||||||
customer_list = body["customers"]
|
message = "customer %s failed to get deleted and is in\
|
||||||
customer_ids = [customer["id"]
|
error status" % customer_id
|
||||||
for customer in customer_list
|
raise exceptions.TempestException(message)
|
||||||
if customer["id"] == customer_id]
|
if int(time.time()) - start >= cls.build_timeout:
|
||||||
if customer_ids:
|
message = (
|
||||||
customer_status = customer_ids[0]["status"]
|
'customer %s failed to get deleted within '
|
||||||
if customer_status == 'Error':
|
'the required time (%s s) and is in %s status.'
|
||||||
message = "customer %s failed to get deleted and is in\
|
% (customer_id, cls.build_timeout,
|
||||||
error status" % customer_id
|
customer_status))
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TimeoutException(message)
|
||||||
if int(time.time()) - start >= cls.build_timeout:
|
|
||||||
message = (
|
@classmethod
|
||||||
'customer %s failed to get deleted within '
|
def _validate_customer_deletion_on_lcp(cls, customer_id):
|
||||||
'the required time (%s s) and is in %s status.'
|
body = cls.identity_client.list_projects()["projects"]
|
||||||
% (customer_id, cls.build_timeout,
|
customer_ids = [customer["id"]
|
||||||
customer_status))
|
for customer in body
|
||||||
raise exceptions.TimeoutException(message)
|
if customer["id"] == customer_id]
|
||||||
|
if customer_ids:
|
||||||
@classmethod
|
message = "customer %s failed to get deleted on lcp" \
|
||||||
def _validate_customer_deletion_on_lcp(cls, customer_id):
|
% customer_id
|
||||||
body = cls.identity_client.list_projects()["projects"]
|
raise exceptions.TempestException(message)
|
||||||
customer_ids = [customer["id"]
|
|
||||||
for customer in body
|
@classmethod
|
||||||
if customer["id"] == customer_id]
|
def _update_cust_and_validate_status_on_dcp_and_lcp(
|
||||||
if customer_ids:
|
cls, customer_id, para, **kwargs):
|
||||||
message = "customer %s failed to get deleted on lcp" \
|
body = cls.client.update_customer(customer_id, para, **kwargs)
|
||||||
% customer_id
|
if body["id"] == customer_id:
|
||||||
raise exceptions.TempestException(message)
|
cls._wait_for_cust_status_on_dcp(customer_id, "Success")
|
||||||
|
cls._validate_cust_creation_on_lcp(customer_id)
|
||||||
@classmethod
|
else:
|
||||||
def _update_cust_and_validate_status_on_dcp_and_lcp(
|
message = "customer %s not updated successfully" % customer_id
|
||||||
cls, customer_id, para, **kwargs):
|
raise exceptions.TempestException(message)
|
||||||
body = cls.client.update_customer(customer_id, para, **kwargs)
|
return body
|
||||||
if body["id"] == customer_id:
|
|
||||||
cls._wait_for_cust_status_on_dcp(customer_id, "Success")
|
|
||||||
cls._validate_cust_creation_on_lcp(customer_id)
|
|
||||||
else:
|
|
||||||
message = "customer %s not updated successfully" % customer_id
|
|
||||||
raise exceptions.TempestException(message)
|
|
||||||
return body
|
|
||||||
|
@ -1,261 +1,251 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class FmsBaseOrmTest(base.BaseOrmTest):
|
class FmsBaseOrmTest(base.BaseOrmTest):
|
||||||
credentials = ['admin', 'primary', 'alt']
|
credentials = ['admin', 'primary', 'alt']
|
||||||
|
|
||||||
# added setup_clients function by stew
|
# added setup_clients function by stew
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(FmsBaseOrmTest, cls).setup_clients()
|
super(FmsBaseOrmTest, cls).setup_clients()
|
||||||
cls.client = cls.os_primary.fms_client
|
cls.client = cls.os_primary.fms_client
|
||||||
cls.flavors_client = cls.os_admin.flavors_client
|
cls.flavors_client = cls.os_admin.flavors_client
|
||||||
cls.tenant_id = cls._get_project_id(
|
cls.tenant_id = cls._get_project_id(
|
||||||
cls.os_primary.credentials.project_name)
|
cls.os_primary.credentials.project_name)
|
||||||
cls.alt_tenant_id = cls._get_project_id(
|
cls.alt_tenant_id = cls._get_project_id(
|
||||||
cls.os_alt.credentials.project_name)
|
cls.os_alt.credentials.project_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_flavor_params(cls, set_region=True, single_tenant=True):
|
def _get_flavor_params(cls, set_region=True, single_tenant=True):
|
||||||
post_body, region = {}, {}
|
post_body, region = {}, {}
|
||||||
region["name"] = CONF.identity.region
|
region["name"] = CONF.identity.region
|
||||||
ram = random.randint(1, 4) * 1024
|
ram = random.randint(1, 4) * 1024
|
||||||
swap = random.randint(1, 40) * 1024
|
swap = random.randint(1, 40) * 1024
|
||||||
vcpus = random.randint(2, 40)
|
vcpus = random.randint(2, 40)
|
||||||
disk = random.randint(2, 102)
|
disk = random.randint(2, 102)
|
||||||
post_body["description"] = \
|
post_body["description"] = \
|
||||||
"orm-plugin-BaseORMTest-flavor"
|
"orm-plugin-BaseORMTest-flavor"
|
||||||
post_body["series"] = random.choice(CONF.ranger.flavor_series)
|
post_body["series"] = random.choice(CONF.ranger.flavor_series)
|
||||||
post_body["alias"] = "flavor_alias"
|
post_body["alias"] = "flavor_alias"
|
||||||
post_body["ram"] = str(ram)
|
post_body["ram"] = str(ram)
|
||||||
post_body["vcpus"] = str(vcpus)
|
post_body["vcpus"] = str(vcpus)
|
||||||
post_body["disk"] = str(disk)
|
post_body["disk"] = str(disk)
|
||||||
post_body["swap"] = str(swap)
|
post_body["swap"] = str(swap)
|
||||||
post_body["ephemeral"] = "1024"
|
post_body["ephemeral"] = "1024"
|
||||||
post_body["regions"] = [region] if set_region else []
|
post_body["regions"] = [region] if set_region else []
|
||||||
post_body["visibility"] = "private"
|
post_body["visibility"] = "private"
|
||||||
post_body['tag'] = {'a': 'b', 'c': 'd'}
|
post_body['tag'] = {'a': 'b', 'c': 'd'}
|
||||||
|
|
||||||
if single_tenant:
|
if single_tenant:
|
||||||
post_body["tenants"] = [cls.tenant_id]
|
post_body["tenants"] = [cls.tenant_id]
|
||||||
else:
|
else:
|
||||||
post_body["tenants"] = [cls.tenant_id, cls.alt_tenant_id]
|
post_body["tenants"] = [cls.tenant_id, cls.alt_tenant_id]
|
||||||
return post_body
|
return post_body
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _create_flv_and_validate_creation_on_dcp_and_lcp(cls, **kwargs):
|
def _create_flv_and_validate_creation_on_dcp_and_lcp(cls, **kwargs):
|
||||||
"""kwargs contain all field data needed in a flavor POST body:
|
"""kwargs contain all field data needed in a flavor POST body:
|
||||||
|
|
||||||
- name
|
- name
|
||||||
- description
|
- description
|
||||||
- alias
|
- alias
|
||||||
- ram
|
- ram
|
||||||
- vcpus
|
- vcpus
|
||||||
- disk
|
- disk
|
||||||
- swap
|
- swap
|
||||||
- ephemeral
|
- ephemeral
|
||||||
- regions
|
- regions
|
||||||
- visibility
|
- visibility
|
||||||
- tenants
|
- tenants
|
||||||
"""
|
"""
|
||||||
_, body = cls.client.create_flavor(**kwargs)
|
_, body = cls.client.create_flavor(**kwargs)
|
||||||
flavor = body["flavor"]
|
flavor = body["flavor"]
|
||||||
flavor_id = flavor["id"]
|
flavor_id = flavor["id"]
|
||||||
_, body = cls.client.get_flavor(flavor_id)
|
_, body = cls.client.get_flavor(flavor_id)
|
||||||
flavor_detail = body["flavor"]
|
flavor_detail = body["flavor"]
|
||||||
if flavor_detail["vcpus"] == kwargs["vcpus"]:
|
if flavor_detail["vcpus"] == kwargs["vcpus"]:
|
||||||
if flavor_detail["regions"] == []:
|
if flavor_detail["regions"] == []:
|
||||||
flavor_status = "no regions"
|
flavor_status = "no regions"
|
||||||
else:
|
else:
|
||||||
flavor_status = "Success"
|
flavor_status = "Success"
|
||||||
flavor_id = flavor_detail["id"]
|
flavor_id = flavor_detail["id"]
|
||||||
cls._wait_for_flavor_status_on_dcp(flavor_id, flavor_status)
|
cls._wait_for_flavor_status_on_dcp(flavor_id, flavor_status)
|
||||||
cls._validate_flavor_creation_on_lcp(flavor_id)
|
cls._validate_flavor_creation_on_lcp(flavor_id)
|
||||||
return flavor
|
return flavor
|
||||||
else:
|
else:
|
||||||
message = "flavor %s not created successfully" % flavor_id
|
message = "flavor %s not created successfully" % flavor_id
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TempestException(message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _wait_for_flavor_status_on_dcp(cls, flavor_id, status):
|
def _wait_for_flavor_status_on_dcp(cls, flavor_id, status):
|
||||||
_, body = cls.client.get_flavor(flavor_id)
|
_, body = cls.client.get_flavor(flavor_id)
|
||||||
flavor = body["flavor"]
|
flavor = body["flavor"]
|
||||||
flavor_status = flavor["status"]
|
flavor_status = flavor["status"]
|
||||||
start = int(time.time())
|
start = int(time.time())
|
||||||
while flavor_status != status:
|
while flavor_status != status:
|
||||||
time.sleep(cls.build_interval)
|
time.sleep(cls.build_interval)
|
||||||
_, body = cls.client.get_flavor(flavor_id)
|
_, body = cls.client.get_flavor(flavor_id)
|
||||||
flavor = body["flavor"]
|
flavor = body["flavor"]
|
||||||
flavor_status = flavor["status"]
|
flavor_status = flavor["status"]
|
||||||
if flavor_status == 'Error':
|
if flavor_status == 'Error':
|
||||||
message = ('flavor %s failed to reach %s status'
|
message = ('flavor %s failed to reach %s status'
|
||||||
' and is in ERROR status' %
|
' and is in ERROR status' %
|
||||||
(flavor_id, status))
|
(flavor_id, status))
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TempestException(message)
|
||||||
if int(time.time()) - start >= cls.build_timeout:
|
if int(time.time()) - start >= cls.build_timeout:
|
||||||
message =\
|
message = ('flavor %s failed to reach %s status within'
|
||||||
'flavor %s failed to reach %s status within'
|
' the required time (%s s) and is in'
|
||||||
' the required time (%s s) and is in'
|
' %s status.') % (flavor_id, status,
|
||||||
'%s status.' % (flavor_id, status,
|
cls.build_timeout,
|
||||||
cls.build_timeout, flavor_status)
|
flavor_status)
|
||||||
raise exceptions.TimeoutException(message)
|
raise exceptions.TimeoutException(message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _validate_flavor_creation_on_lcp(cls, flavor_id):
|
def _validate_flavor_creation_on_lcp(cls, flavor_id):
|
||||||
_, body = cls.client.list_flavors()
|
_, body = cls.client.list_flavors()
|
||||||
flavor = [flavor["id"] for flavor in body["flavors"]
|
flavor = [flavor["id"] for flavor in body["flavors"]
|
||||||
if flavor["id"] == flavor_id]
|
if flavor["id"] == flavor_id]
|
||||||
if not flavor:
|
if not flavor:
|
||||||
message = "flavor %s not in nova flavor list" % flavor_id
|
message = "flavor %s not in nova flavor list" % flavor_id
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TempestException(message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _validate_flv_extraspecs_on_dcp_and_lcp(cls, flavor_id,
|
def _validate_flv_extraspecs_on_dcp_and_lcp(cls, flavor_id,
|
||||||
expected_specs):
|
expected_specs):
|
||||||
expected_specs_count = len(expected_specs)
|
expected_specs_count = len(expected_specs)
|
||||||
_, body = cls.client.get_flavor(flavor_id)
|
_, body = cls.client.get_flavor(flavor_id)
|
||||||
flavor_orm = body["flavor"]
|
flavor_orm = body["flavor"]
|
||||||
flavor_lcp = cls.flavors_client.show_flavor(flavor_id)["flavor"]
|
flavor_lcp = cls.flavors_client.show_flavor(flavor_id)["flavor"]
|
||||||
|
|
||||||
def _validate_extra_specs(flv):
|
def _validate_extra_specs(flv):
|
||||||
actual_specs_count = 0
|
actual_specs_count = 0
|
||||||
actual_specs = {}
|
actual_specs = {}
|
||||||
for spec in flv["extra-specs"]:
|
for spec in flv["extra-specs"]:
|
||||||
actual_specs[spec] = flv["extra-specs"][spec]
|
actual_specs[spec] = flv["extra-specs"][spec]
|
||||||
for spec in expected_specs:
|
for spec in expected_specs:
|
||||||
if spec in actual_specs:
|
if spec in actual_specs:
|
||||||
if expected_specs[spec] == actual_specs[spec]:
|
if expected_specs[spec] == actual_specs[spec]:
|
||||||
actual_specs_count += 1
|
actual_specs_count += 1
|
||||||
if expected_specs_count == actual_specs_count:
|
return bool(expected_specs_count == actual_specs_count)
|
||||||
return True
|
return bool(_validate_extra_specs(flavor_orm) and
|
||||||
else:
|
_validate_extra_specs(flavor_lcp))
|
||||||
return False
|
|
||||||
if _validate_extra_specs(flavor_orm) and\
|
@classmethod
|
||||||
_validate_extra_specs(flavor_lcp):
|
def _del_flv_and_validate_deletion_on_dcp_and_lcp(cls, flavor_id):
|
||||||
return True
|
_, body = cls.client.get_flavor(flavor_id)
|
||||||
else:
|
regions_on_flavor = [region for region in body["flavor"]["regions"]]
|
||||||
return False
|
|
||||||
|
if regions_on_flavor:
|
||||||
@classmethod
|
region_name_on_flavor = regions_on_flavor[0]["name"]
|
||||||
def _del_flv_and_validate_deletion_on_dcp_and_lcp(cls, flavor_id):
|
cls._delete_region_from_flavor_and_validate_deletion(
|
||||||
_, body = cls.client.get_flavor(flavor_id)
|
flavor_id, region_name_on_flavor)
|
||||||
regions_on_flavor = [region for region in body["flavor"]["regions"]]
|
cls.client.delete_flavor(flavor_id)
|
||||||
|
cls._wait_for_flavor_deletion_on_dcp(flavor_id)
|
||||||
if regions_on_flavor:
|
cls._validate_flavor_deletion_on_lcp(flavor_id)
|
||||||
region_name_on_flavor = regions_on_flavor[0]["name"]
|
|
||||||
cls._delete_region_from_flavor_and_validate_deletion(
|
@classmethod
|
||||||
flavor_id, region_name_on_flavor)
|
def _delete_region_from_flavor_and_validate_deletion(
|
||||||
cls.client.delete_flavor(flavor_id)
|
cls, flavor_id, rname):
|
||||||
cls._wait_for_flavor_deletion_on_dcp(flavor_id)
|
_, body = cls.rms_client.get_region(rname)
|
||||||
cls._validate_flavor_deletion_on_lcp(flavor_id)
|
region_id = body["id"]
|
||||||
|
cls.client.delete_region_from_flavor(flavor_id, region_id)
|
||||||
@classmethod
|
cls._wait_for_flavor_status_on_dcp(flavor_id, "no regions")
|
||||||
def _delete_region_from_flavor_and_validate_deletion(
|
_, body = cls.client.get_flavor(flavor_id)
|
||||||
cls, flavor_id, rname):
|
regions_on_flavor = body["flavor"]["regions"]
|
||||||
_, body = cls.rms_client.get_region(rname)
|
|
||||||
region_id = body["id"]
|
if regions_on_flavor:
|
||||||
cls.client.delete_region_from_flavor(flavor_id, region_id)
|
message = \
|
||||||
cls._wait_for_flavor_status_on_dcp(flavor_id, "no regions")
|
"Region %s failed to get deleted from flavor %s " % (
|
||||||
_, body = cls.client.get_flavor(flavor_id)
|
rname, flavor_id)
|
||||||
regions_on_flavor = body["flavor"]["regions"]
|
raise exceptions.TempestException(message)
|
||||||
|
cls._validate_flavor_deletion_on_lcp(flavor_id)
|
||||||
if regions_on_flavor:
|
|
||||||
message = \
|
@classmethod
|
||||||
"Region %s failed to get deleted from flavor %s " % (
|
def _wait_for_flavor_deletion_on_dcp(cls, flavor_id):
|
||||||
rname, flavor_id)
|
_, body = cls.client.list_flavors()
|
||||||
raise exceptions.TempestException(message)
|
flavor_ids = [flavor["id"] for flavor in body["flavors"]
|
||||||
cls._validate_flavor_deletion_on_lcp(flavor_id)
|
if flavor["id"] == flavor_id]
|
||||||
|
start = int(time.time())
|
||||||
@classmethod
|
while flavor_ids:
|
||||||
def _wait_for_flavor_deletion_on_dcp(cls, flavor_id):
|
time.sleep(cls.build_interval)
|
||||||
_, body = cls.client.list_flavors()
|
_, body = cls.client.list_flavors()
|
||||||
flavor_ids = [flavor["id"] for flavor in body["flavors"]
|
flavor_ids = [flavor["id"] for flavor in body["flavors"]
|
||||||
if flavor["id"] == flavor_id]
|
if flavor["id"] == flavor_id]
|
||||||
start = int(time.time())
|
if flavor_ids:
|
||||||
while flavor_ids:
|
flavor_status = flavor_ids[0]["status"]
|
||||||
time.sleep(cls.build_interval)
|
if flavor_status == 'Error':
|
||||||
_, body = cls.client.list_flavors()
|
message = \
|
||||||
flavor_ids = [flavor["id"] for flavor in body["flavors"]
|
('Flavor %s failed to get deleted'
|
||||||
if flavor["id"] == flavor_id]
|
'and is in error status') % flavor_id
|
||||||
if flavor_ids:
|
raise exceptions.TempestException(message)
|
||||||
flavor_status = flavor_ids[0]["status"]
|
if int(time.time()) - start >= cls.build_timeout:
|
||||||
if flavor_status == 'Error':
|
message = (
|
||||||
message = \
|
'flavor %s failed to get deleted within '
|
||||||
'Flavor %s failed to get deleted'
|
'the required time (%s s) and is in %s status.'
|
||||||
'and is in error status' % \
|
% (flavor_id, cls.build_timeout, flavor_status))
|
||||||
flavor_id
|
raise exceptions.TimeoutException(message)
|
||||||
raise exceptions.TempestException(message)
|
|
||||||
if int(time.time()) - start >= cls.build_timeout:
|
@classmethod
|
||||||
message = (
|
def _validate_flavor_deletion_on_lcp(cls, flavor_id):
|
||||||
'flavor %s failed to get deleted within '
|
body = cls.flavors_client.list_flavors()["flavors"]
|
||||||
'the required time (%s s) and is in %s status.'
|
flavor_ids = [flavor["id"] for flavor in body
|
||||||
% (flavor_id, cls.build_timeout, flavor_status))
|
if flavor["id"] == flavor_id]
|
||||||
raise exceptions.TimeoutException(message)
|
if flavor_ids:
|
||||||
|
flavor_status = cls.flavors_client.show_flavor(
|
||||||
@classmethod
|
flavor_id)["flavor"]["status"]
|
||||||
def _validate_flavor_deletion_on_lcp(cls, flavor_id):
|
message = "flavor %s failed to get deleted and is in %s status" \
|
||||||
body = cls.flavors_client.list_flavors()["flavors"]
|
% (flavor_id, flavor_status)
|
||||||
flavor_ids = [flavor["id"] for flavor in body
|
raise exceptions.TempestException(message)
|
||||||
if flavor["id"] == flavor_id]
|
|
||||||
if flavor_ids:
|
@classmethod
|
||||||
flavor_status = cls.flavors_client.show_flavor(
|
def _get_project_id(cls, project_name):
|
||||||
flavor_id)["flavor"]["status"]
|
body = cls.identity_client.list_projects()
|
||||||
message = "flavor %s failed to get deleted and is in %s status" \
|
for project in body["projects"]:
|
||||||
% (flavor_id, flavor_status)
|
if(project["name"] == project_name):
|
||||||
raise exceptions.TempestException(message)
|
return project["id"]
|
||||||
|
message = ('project %s not found on projects list' % project_name)
|
||||||
@classmethod
|
raise exceptions.TempestException(message)
|
||||||
def _get_project_id(cls, project_name):
|
|
||||||
body = cls.identity_client.list_projects()
|
@classmethod
|
||||||
for project in body["projects"]:
|
def _get_expected_flavor_name(cls, post_body):
|
||||||
if(project["name"] == project_name):
|
name = post_body["series"] + "." + "c" + \
|
||||||
return project["id"]
|
post_body["vcpus"] + "r" + \
|
||||||
message = ('project %s not found on projects list' % project_name)
|
str(int(post_body["ram"]) // 1024) \
|
||||||
raise exceptions.TempestException(message)
|
+ "d" + post_body["disk"] + "s" + \
|
||||||
|
str(int(post_body["swap"]) // 1024) \
|
||||||
@classmethod
|
+ "e" + str(int(post_body["ephemeral"]) // 1024)
|
||||||
def _get_expected_flavor_name(cls, post_body):
|
return name
|
||||||
name = post_body["series"] + "." + "c" + \
|
|
||||||
post_body["vcpus"] + "r" + \
|
@classmethod
|
||||||
str(int(post_body["ram"]) / 1024) \
|
def _validate_flv_geometry_on_lcp(cls, flavor_id, post_body):
|
||||||
+ "d" + post_body["disk"] + "s" + \
|
flv = cls.flavors_client.show_flavor(flavor_id)["flavor"]
|
||||||
str(int(post_body["swap"]) / 1024) \
|
return bool(flv["vcpus"] == int(post_body["vcpus"]) and
|
||||||
+ "e" + str(int(post_body["ephemeral"]) / 1024)
|
flv["ram"] == post_body["ram"] and
|
||||||
return name
|
flv["swap"] == int(post_body["swap"]) and
|
||||||
|
flv["disk"] == int(post_body["disk"]) and
|
||||||
@classmethod
|
flv["ephemeral"] == post_body["ephemeral"])
|
||||||
def _validate_flv_geometry_on_lcp(cls, flavor_id, post_body):
|
|
||||||
flv = cls.flavors_client.show_flavor(flavor_id)["flavor"]
|
|
||||||
if flv["vcpus"] == int(post_body["vcpus"]) and \
|
|
||||||
flv["ram"] == post_body["ram"] and \
|
|
||||||
flv["swap"] == int(post_body["swap"]) and \
|
|
||||||
flv["disk"] == int(post_body["disk"]) and \
|
|
||||||
flv["ephemeral"] == post_body["ephemeral"]:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
@ -1,244 +1,243 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
from tempest.common.utils import data_utils
|
from tempest.common.utils import data_utils
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ImsBaseOrmTest(base.BaseOrmTest):
|
class ImsBaseOrmTest(base.BaseOrmTest):
|
||||||
credentials = ['admin', 'primary', 'alt']
|
credentials = ['admin', 'primary', 'alt']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(ImsBaseOrmTest, cls).setup_clients()
|
super(ImsBaseOrmTest, cls).setup_clients()
|
||||||
# service clients
|
# service clients
|
||||||
cls.client = cls.os_primary.ims_client
|
cls.client = cls.os_primary.ims_client
|
||||||
cls.rms_client = cls.os_primary.rms_client
|
cls.rms_client = cls.os_primary.rms_client
|
||||||
cls.cms_client = cls.os_primary.cms_client
|
cls.cms_client = cls.os_primary.cms_client
|
||||||
|
|
||||||
# setup variables
|
# setup variables
|
||||||
cls.region_id = CONF.identity.region
|
cls.region_id = CONF.identity.region
|
||||||
cls.tenant_id = cls._get_project_id(
|
cls.tenant_id = cls._get_project_id(
|
||||||
cls.os_primary.credentials.project_name)
|
cls.os_primary.credentials.project_name)
|
||||||
cls.alt_tenant_id = cls._get_project_id(
|
cls.alt_tenant_id = cls._get_project_id(
|
||||||
cls.os_alt.credentials.project_name)
|
cls.os_alt.credentials.project_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_image_params(cls, set_region=True, single_tenant=True,
|
def _get_image_params(cls, set_region=True, single_tenant=True,
|
||||||
set_private=True, set_enabled=True):
|
set_private=True, set_enabled=True):
|
||||||
region, post_body = {}, {}
|
region, post_body = {}, {}
|
||||||
post_body["name"] = data_utils.rand_name(
|
post_body["name"] = data_utils.rand_name(
|
||||||
"orm-plugin-TestTempestIms-image")
|
"orm-plugin-TestTempestIms-image")
|
||||||
|
|
||||||
post_body["url"] = CONF.ranger.image_url
|
post_body["url"] = CONF.ranger.image_url
|
||||||
post_body["disk-format"] = "qcow2"
|
post_body["disk-format"] = "qcow2"
|
||||||
post_body["container-format"] = "bare"
|
post_body["container-format"] = "bare"
|
||||||
|
|
||||||
region["name"] = cls.region_id
|
region["name"] = cls.region_id
|
||||||
region["type"] = "single"
|
region["type"] = "single"
|
||||||
region["checksum"] = "7297321c2fa6424417a548c85edd6e98"
|
region["checksum"] = "7297321c2fa6424417a548c85edd6e98"
|
||||||
region["virtual_size"] = "None"
|
region["virtual_size"] = "None"
|
||||||
region["size"] = "38797312"
|
region["size"] = "38797312"
|
||||||
|
|
||||||
# set enabled status to True or False based on set_enabled value
|
# set enabled status to True or False based on set_enabled value
|
||||||
post_body["enabled"] = True if set_enabled else False
|
post_body["enabled"] = True if set_enabled else False
|
||||||
# add region for the image as needed
|
# add region for the image as needed
|
||||||
post_body["regions"] = [region] if set_region else []
|
post_body["regions"] = [region] if set_region else []
|
||||||
# create image with visibililty = "public" or "private"
|
# create image with visibililty = "public" or "private"
|
||||||
post_body["visibility"] = "private" if set_private else "public"
|
post_body["visibility"] = "private" if set_private else "public"
|
||||||
# set image tags
|
# set image tags
|
||||||
post_body["tags"] = ["tag1", "tag2"]
|
post_body["tags"] = ["tag1", "tag2"]
|
||||||
|
|
||||||
# add tenant for the image only if set_private
|
# add tenant for the image only if set_private
|
||||||
if set_private:
|
if set_private:
|
||||||
if single_tenant:
|
if single_tenant:
|
||||||
post_body["customers"] = [cls.tenant_id]
|
post_body["customers"] = [cls.tenant_id]
|
||||||
else:
|
else:
|
||||||
post_body["customers"] = [cls.tenant_id, cls.alt_tenant_id]
|
post_body["customers"] = [cls.tenant_id, cls.alt_tenant_id]
|
||||||
else:
|
else:
|
||||||
post_body["customers"] = []
|
post_body["customers"] = []
|
||||||
|
|
||||||
return post_body
|
return post_body
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_project_id(cls, project_name):
|
def _get_project_id(cls, project_name):
|
||||||
body = cls.identity_client.list_projects()
|
body = cls.identity_client.list_projects()
|
||||||
for project in body["projects"]:
|
for project in body["projects"]:
|
||||||
if(project["name"] == project_name):
|
if(project["name"] == project_name):
|
||||||
return project["id"]
|
return project["id"]
|
||||||
message = ('project %s not found on project list' % project_name)
|
message = ('project %s not found on project list' % project_name)
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TempestException(message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _create_img_and_validate_creation_on_dcp_and_lcp(cls, **kwargs):
|
def _create_img_and_validate_creation_on_dcp_and_lcp(cls, **kwargs):
|
||||||
_, body = cls.client.create_image(**kwargs)
|
_, body = cls.client.create_image(**kwargs)
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
image_id = image["id"]
|
image_id = image["id"]
|
||||||
|
|
||||||
_, body = cls.client.get_image(image_id)
|
_, body = cls.client.get_image(image_id)
|
||||||
image_detail = body["image"]
|
image_detail = body["image"]
|
||||||
if image_detail["name"] == kwargs["name"]:
|
if image_detail["name"] == kwargs["name"]:
|
||||||
if image_detail["regions"] == []:
|
if image_detail["regions"] == []:
|
||||||
image_status = "no regions"
|
image_status = "no regions"
|
||||||
else:
|
else:
|
||||||
image_status = "Success"
|
image_status = "Success"
|
||||||
|
|
||||||
cls._wait_for_image_status_on_dcp(image_id, image_status)
|
cls._wait_for_image_status_on_dcp(image_id, image_status)
|
||||||
return image
|
return image
|
||||||
else:
|
else:
|
||||||
message = ('image %s not created successfully' % kwargs["name"])
|
message = ('image %s not created successfully' % kwargs["name"])
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TempestException(message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _wait_for_image_status_on_dcp(cls, image_id, status):
|
def _wait_for_image_status_on_dcp(cls, image_id, status):
|
||||||
_, body = cls.client.get_image(image_id)
|
_, body = cls.client.get_image(image_id)
|
||||||
image_status = body["image"]["status"]
|
image_status = body["image"]["status"]
|
||||||
start = int(time.time())
|
start = int(time.time())
|
||||||
while image_status != status:
|
while image_status != status:
|
||||||
time.sleep(cls.build_interval)
|
time.sleep(cls.build_interval)
|
||||||
_, body = cls.client.get_image(image_id)
|
_, body = cls.client.get_image(image_id)
|
||||||
image_status = body["image"]["status"]
|
image_status = body["image"]["status"]
|
||||||
if image_status == 'Error':
|
if image_status == 'Error':
|
||||||
message = ('Image %s failed to reach %s status'
|
message = ('Image %s failed to reach %s status'
|
||||||
' and is in ERROR status on orm' %
|
' and is in ERROR status on orm' %
|
||||||
(image_id, status))
|
(image_id, status))
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TempestException(message)
|
||||||
if int(time.time()) - start >= cls.build_timeout:
|
if int(time.time()) - start >= cls.build_timeout:
|
||||||
message = ('Image %s failed to reach %s'
|
message = ('Image %s failed to reach %s'
|
||||||
' status within ''the required time (%s s)'
|
' status within ''the required time (%s s)'
|
||||||
' on orm and is in %s status.'
|
' on orm and is in %s status.'
|
||||||
% (image_id, status,
|
% (image_id, status,
|
||||||
cls.build_timeout,
|
cls.build_timeout,
|
||||||
image_status))
|
image_status))
|
||||||
raise exceptions.TimeoutException(message)
|
raise exceptions.TimeoutException(message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _validate_image_status_on_lcp(cls, image_id, status):
|
def _validate_image_status_on_lcp(cls, image_id, status):
|
||||||
_, body = cls.client.list_images()["images"]
|
_, body = cls.client.list_images()["images"]
|
||||||
image_ids = [image["id"] for image in body]
|
image_ids = [image["id"] for image in body]
|
||||||
if image_id not in image_ids:
|
if image_id not in image_ids:
|
||||||
message = ('Image %s not in image list on LCP' % image_id)
|
message = ('Image %s not in image list on LCP' % image_id)
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TempestException(message)
|
||||||
else:
|
else:
|
||||||
image_status = cls.client.show_image()["image"]["status"]
|
image_status = cls.client.show_image()["image"]["status"]
|
||||||
if image_status != status:
|
if image_status != status:
|
||||||
message = ('Image %s is in %s status instead of %s on LCP.'
|
message = ('Image %s is in %s status instead of %s on LCP.'
|
||||||
% (image_id, image_status, status))
|
% (image_id, image_status, status))
|
||||||
raise exceptions.TempestException(message)
|
raise exceptions.TempestException(message)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _update_img_validate_status_on_dcp_and_lcp(cls, image_id, para=None,
|
def _update_img_validate_status_on_dcp_and_lcp(cls, image_id, para=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
if para:
|
if para:
|
||||||
cls.client.update_image(image_id, para, **kwargs)
|
cls.client.update_image(image_id, para, **kwargs)
|
||||||
else:
|
else:
|
||||||
cls.client.update_image(image_id, **kwargs)
|
cls.client.update_image(image_id, **kwargs)
|
||||||
cls._wait_for_image_status_on_dcp(image_id, "Success")
|
cls._wait_for_image_status_on_dcp(image_id, "Success")
|
||||||
cls._validate_image_status_on_lcp(image_id, "active")
|
cls._validate_image_status_on_lcp(image_id, "active")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _del_img_validate_deletion_on_dcp_and_lcp(cls, image_id):
|
def _del_img_validate_deletion_on_dcp_and_lcp(cls, image_id):
|
||||||
_, body = cls.client.get_image(image_id)
|
_, body = cls.client.get_image(image_id)
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
|
|
||||||
regions_on_image = [region for region in image["regions"]]
|
regions_on_image = [region for region in image["regions"]]
|
||||||
if regions_on_image:
|
if regions_on_image:
|
||||||
region_id = regions_on_image[0]["name"]
|
region_id = regions_on_image[0]["name"]
|
||||||
cls._delete_region_from_image_and_validate_deletion(
|
cls._delete_region_from_image_and_validate_deletion(
|
||||||
image_id, region_id)
|
image_id, region_id)
|
||||||
|
|
||||||
cls.client.delete_image(image_id)
|
cls.client.delete_image(image_id)
|
||||||
cls._validate_image_deletion_on_lcp(image_id)
|
cls._validate_image_deletion_on_lcp(image_id)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _delete_region_from_image_and_validate_deletion(cls, image_id,
|
def _delete_region_from_image_and_validate_deletion(cls, image_id,
|
||||||
region_id):
|
region_id):
|
||||||
cls.client.delete_region_from_image(image_id, region_id)
|
cls.client.delete_region_from_image(image_id, region_id)
|
||||||
cls._wait_for_image_status_on_dcp(image_id, "no regions")
|
cls._wait_for_image_status_on_dcp(image_id, "no regions")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _wait_for_image_deletion_on_dcp(cls, image_id):
|
def _wait_for_image_deletion_on_dcp(cls, image_id):
|
||||||
_, body = cls.client.list_images()
|
_, body = cls.client.list_images()
|
||||||
image_ids = [image["id"] for image in body["images"]]
|
image_ids = [image["id"] for image in body["images"]]
|
||||||
if image_id in image_ids:
|
if image_id in image_ids:
|
||||||
start = int(time.time())
|
start = int(time.time())
|
||||||
while image_id in image_ids:
|
while image_id in image_ids:
|
||||||
time.sleep(cls.build_interval)
|
time.sleep(cls.build_interval)
|
||||||
_, image_list = cls.client.list_images()["images"]
|
_, image_list = cls.client.list_images()["images"]
|
||||||
image_ids = [image["id"]
|
image_ids = [image["id"]
|
||||||
for image in image_list if image["id"] ==
|
for image in image_list if image["id"] ==
|
||||||
image_id]
|
image_id]
|
||||||
if image_ids:
|
if image_ids:
|
||||||
image_status = image_list[0]["status"]
|
image_status = image_list[0]["status"]
|
||||||
_, body = cls.client.list_images()["images"]
|
_, body = cls.client.list_images()["images"]
|
||||||
image_ids = [image["id"] for image in body]
|
image_ids = [image["id"] for image in body]
|
||||||
if image_id in image_ids:
|
if image_id in image_ids:
|
||||||
image_status = image_ids[0]["status"]
|
image_status = image_ids[0]["status"]
|
||||||
if image_status == 'Error':
|
if image_status == 'Error':
|
||||||
message = \
|
message = \
|
||||||
'Image %s failed to get deleted '
|
('Image %s failed to get deleted '
|
||||||
'and is in error status' % \
|
'and is in error status') % image_id
|
||||||
image_id
|
raise exceptions.TempestException(message)
|
||||||
raise exceptions.TempestException(message)
|
if int(time.time()) - start >= cls.build_timeout:
|
||||||
if int(time.time()) - start >= cls.build_timeout:
|
message = ('Image %s failed to get deleted within '
|
||||||
message = ('Image %s failed to get deleted within '
|
'the required time (%s s) on orm '
|
||||||
'the required time (%s s) on orm '
|
'and is in %s status.'
|
||||||
'and is in %s status.'
|
% (image_id, cls.build_timeout, image_status))
|
||||||
% (image_id, cls.build_timeout, image_status))
|
raise exceptions.TimeoutException(message)
|
||||||
raise exceptions.TimeoutException(message)
|
|
||||||
|
@classmethod
|
||||||
@classmethod
|
def _validate_image_deletion_on_lcp(cls, image_id):
|
||||||
def _validate_image_deletion_on_lcp(cls, image_id):
|
_, body = cls.client.list_images()
|
||||||
_, body = cls.client.list_images()
|
image_ids = [image["id"] for image in body["images"]
|
||||||
image_ids = [image["id"] for image in body["images"]
|
if image["id"] == image_id]
|
||||||
if image["id"] == image_id]
|
if image_id in image_ids:
|
||||||
if image_id in image_ids:
|
image_status = body["status"]
|
||||||
image_status = body["status"]
|
message = "image %s failed to get deleted and is in %s status" \
|
||||||
message = "image %s failed to get deleted and is in %s status" \
|
% (image_id, image_status)
|
||||||
% (image_id, image_status)
|
raise exceptions.TempestException(message)
|
||||||
raise exceptions.TempestException(message)
|
|
||||||
|
@classmethod
|
||||||
@classmethod
|
def _validate_custs_on_img_on_dcp_and_lcp(cls, image_id,
|
||||||
def _validate_custs_on_img_on_dcp_and_lcp(cls, image_id,
|
expected_customers):
|
||||||
expected_customers):
|
expected_customers = sorted(expected_customers)
|
||||||
expected_customers = sorted(expected_customers)
|
|
||||||
|
_, actual_customers_orm = sorted(
|
||||||
_, actual_customers_orm = sorted(
|
cls.client.get_image(image_id)["customers"])
|
||||||
cls.client.get_image(image_id)["customers"])
|
members = cls.client.member_list(image_id)["members"]
|
||||||
members = cls.client.member_list(image_id)["members"]
|
actual_customers_lcp =\
|
||||||
actual_customers_lcp =\
|
sorted([member["member_id"] for member in members])
|
||||||
sorted([member["member_id"] for member in members])
|
if actual_customers_orm != expected_customers:
|
||||||
if actual_customers_orm != expected_customers:
|
message = (
|
||||||
message = (
|
'Incorrect customers on image on orm.'
|
||||||
'Incorrect customers on image on orm.'
|
'expected customers = %s, actual customers = %s'
|
||||||
'expected customers = %s, actual customers = %s'
|
% (expected_customers, actual_customers_orm))
|
||||||
% (expected_customers, actual_customers_orm))
|
raise exceptions.TempestException(message)
|
||||||
raise exceptions.TempestException(message)
|
if actual_customers_lcp != expected_customers:
|
||||||
if actual_customers_lcp != expected_customers:
|
message = (
|
||||||
message = (
|
'Incorrect customers on image on orm.'
|
||||||
'Incorrect customers on image on orm.'
|
'expected customers = %s, actual customers = %s'
|
||||||
'expected customers = %s, actual customers = %s'
|
% (expected_customers, actual_customers_lcp))
|
||||||
% (expected_customers, actual_customers_lcp))
|
raise exceptions.TempestException(message)
|
||||||
raise exceptions.TempestException(message)
|
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class RmsBaseOrmTest(base.BaseOrmTest):
|
class RmsBaseOrmTest(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
cls.client = cls.os_primary.rms_client
|
cls.client = cls.os_primary.rms_client
|
||||||
super(RmsBaseOrmTest, cls).setup_clients()
|
super(RmsBaseOrmTest, cls).setup_clients()
|
||||||
|
@ -1,344 +1,344 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the 'License'); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from ranger_tempest_plugin.tests.api import cms_base
|
from ranger_tempest_plugin.tests.api import cms_base
|
||||||
from tempest import config
|
from tempest import config
|
||||||
from tempest.lib import decorators
|
from tempest.lib import decorators
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestCms(cms_base.CmsBaseOrmTest):
|
class TestTempestCms(cms_base.CmsBaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.setup_customer = cls._get_customer_params()
|
cls.setup_customer = cls._get_customer_params()
|
||||||
cls.setup_customer_id = \
|
cls.setup_customer_id = \
|
||||||
cls._create_cust_validate_creation_on_dcp_and_lcp(
|
cls._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**cls.setup_customer)
|
**cls.setup_customer)
|
||||||
|
|
||||||
cls.bare_customer = cls._get_bare_customer_params()
|
cls.bare_customer = cls._get_bare_customer_params()
|
||||||
cls.bare_customer_id = \
|
cls.bare_customer_id = \
|
||||||
cls._create_cust_validate_creation_on_dcp_and_lcp(
|
cls._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**cls.bare_customer)
|
**cls.bare_customer)
|
||||||
|
|
||||||
super(TestTempestCms, cls).resource_setup()
|
super(TestTempestCms, cls).resource_setup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
cls._del_cust_validate_deletion_on_dcp_and_lcp(cls.setup_customer_id)
|
cls._del_cust_validate_deletion_on_dcp_and_lcp(cls.setup_customer_id)
|
||||||
cls._del_cust_validate_deletion_on_dcp_and_lcp(cls.bare_customer_id)
|
cls._del_cust_validate_deletion_on_dcp_and_lcp(cls.bare_customer_id)
|
||||||
super(TestTempestCms, cls).resource_cleanup()
|
super(TestTempestCms, cls).resource_cleanup()
|
||||||
|
|
||||||
@decorators.idempotent_id('6072c438-1e45-4c0b-97a6-e5127bd33d89')
|
@decorators.idempotent_id('6072c438-1e45-4c0b-97a6-e5127bd33d89')
|
||||||
def test_get_customer(self):
|
def test_get_customer(self):
|
||||||
"""Execute 'get_customer' using the following options
|
"""Execute 'get_customer' using the following options
|
||||||
|
|
||||||
- get customer by id (using cust_id parameter)
|
- get customer by id (using cust_id parameter)
|
||||||
- get customer by name (using cust_name parameter)
|
- get customer by name (using cust_name parameter)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# execute get_customer using cust_id and cust_name
|
# execute get_customer using cust_id and cust_name
|
||||||
for identifier in [self.setup_customer_id,
|
for identifier in [self.setup_customer_id,
|
||||||
self.setup_customer['name']]:
|
self.setup_customer['name']]:
|
||||||
_, body = self.client.get_customer(identifier)
|
_, body = self.client.get_customer(identifier)
|
||||||
self.assertIn(self.setup_customer_id, body['uuid'])
|
self.assertIn(self.setup_customer_id, body['uuid'])
|
||||||
|
|
||||||
@decorators.idempotent_id('6072c438-1e45-4c0b-97a6-e5127bd33d90')
|
@decorators.idempotent_id('6072c438-1e45-4c0b-97a6-e5127bd33d90')
|
||||||
def test_list_customers_with_filters(self):
|
def test_list_customers_with_filters(self):
|
||||||
"""This function executes 'list customer' with all available filters
|
"""This function executes 'list customer' with all available filters
|
||||||
|
|
||||||
- no filter (i.e. list all customers)
|
- no filter (i.e. list all customers)
|
||||||
- filter by metadata key
|
- filter by metadata key
|
||||||
- filter by region
|
- filter by region
|
||||||
- filter by default user id
|
- filter by default user id
|
||||||
- customer name contains a substring
|
- customer name contains a substring
|
||||||
- customer name starting with a string
|
- customer name starting with a string
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# format filter parameter values
|
# format filter parameter values
|
||||||
region_name = [
|
region_name = [
|
||||||
region['name'] for region in self.setup_customer['regions']]
|
region['name'] for region in self.setup_customer['regions']]
|
||||||
userid = [user['id'] for user in self.setup_customer['users']]
|
userid = [user['id'] for user in self.setup_customer['users']]
|
||||||
cust_name = self.setup_customer['name']
|
cust_name = self.setup_customer['name']
|
||||||
substr_name = random.randint(0, len(cust_name))
|
substr_name = random.randint(0, len(cust_name))
|
||||||
|
|
||||||
# get the first key from metadata as the metadata key filter
|
# get the first key from metadata as the metadata key filter
|
||||||
metadata_key = list(self.setup_customer['metadata'].keys())[0]
|
metadata_key = list(self.setup_customer['metadata'].keys())[0]
|
||||||
|
|
||||||
# define the list customer filters to be used for this test
|
# define the list customer filters to be used for this test
|
||||||
no_filter = None
|
no_filter = None
|
||||||
metadata_filter = {'metadata': metadata_key}
|
metadata_filter = {'metadata': metadata_key}
|
||||||
region_filter = {'region': region_name[0]}
|
region_filter = {'region': region_name[0]}
|
||||||
user_filter = {'user': userid[0]}
|
user_filter = {'user': userid[0]}
|
||||||
contains_filter = {'contains': cust_name[substr_name:]}
|
contains_filter = {'contains': cust_name[substr_name:]}
|
||||||
startswith_filter = {'starts_with': cust_name[:substr_name]}
|
startswith_filter = {'starts_with': cust_name[:substr_name]}
|
||||||
|
|
||||||
# execute list_customers with the available filters
|
# execute list_customers with the available filters
|
||||||
for list_filter in [no_filter, metadata_filter, region_filter,
|
for list_filter in [no_filter, metadata_filter, region_filter,
|
||||||
user_filter, contains_filter, startswith_filter]:
|
user_filter, contains_filter, startswith_filter]:
|
||||||
_, body = self.client.list_customers(list_filter)
|
_, body = self.client.list_customers(list_filter)
|
||||||
customers = [cust['id'] for cust in body['customers']]
|
customers = [cust['id'] for cust in body['customers']]
|
||||||
self.assertIn(self.setup_customer_id, customers)
|
self.assertIn(self.setup_customer_id, customers)
|
||||||
|
|
||||||
@decorators.idempotent_id('ac132678-fdb6-4037-a310-813313044055')
|
@decorators.idempotent_id('ac132678-fdb6-4037-a310-813313044055')
|
||||||
def test_enable_customer(self):
|
def test_enable_customer(self):
|
||||||
# setup data for test case
|
# setup data for test case
|
||||||
post_body = self._get_customer_params(enabled=False)
|
post_body = self._get_customer_params(enabled=False)
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
|
|
||||||
# update enabled status from 'False' to 'True' and validate update OK
|
# update enabled status from 'False' to 'True' and validate update OK
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertFalse(body['enabled'])
|
self.assertFalse(body['enabled'])
|
||||||
self.client.enable_customer(test_customer_id, True)
|
self.client.enable_customer(test_customer_id, True)
|
||||||
self._wait_for_status(test_customer_id, 'Success')
|
self._wait_for_status(test_customer_id, 'Success')
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertTrue(body['enabled'])
|
self.assertTrue(body['enabled'])
|
||||||
|
|
||||||
@decorators.idempotent_id('7dfd5f7e-7031-4ee1-b355-cd5cdeb21bd1')
|
@decorators.idempotent_id('7dfd5f7e-7031-4ee1-b355-cd5cdeb21bd1')
|
||||||
def test_add_default_user(self):
|
def test_add_default_user(self):
|
||||||
# setup data for "add_default_user" test case; leave default
|
# setup data for "add_default_user" test case; leave default
|
||||||
# and region users blank at the initial data creation
|
# and region users blank at the initial data creation
|
||||||
post_body = self._get_customer_params(default_users=False,
|
post_body = self._get_customer_params(default_users=False,
|
||||||
region_users=False)
|
region_users=False)
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertFalse(body['users'])
|
self.assertFalse(body['users'])
|
||||||
self.assertFalse(body["regions"][0]['users'])
|
self.assertFalse(body["regions"][0]['users'])
|
||||||
|
|
||||||
# now add a default user, then validate that new user is added to
|
# now add a default user, then validate that new user is added to
|
||||||
# BOTH default user AND region user successfully
|
# BOTH default user AND region user successfully
|
||||||
post_default_user = self._get_user_params()
|
post_default_user = self._get_user_params()
|
||||||
new_user_id = post_default_user[0]["id"]
|
new_user_id = post_default_user[0]["id"]
|
||||||
_, body = self.client.add_default_user(test_customer_id,
|
_, body = self.client.add_default_user(test_customer_id,
|
||||||
*post_default_user)
|
*post_default_user)
|
||||||
self._wait_for_status(test_customer_id, 'Success')
|
self._wait_for_status(test_customer_id, 'Success')
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertIn(new_user_id, [x['id'] for x in body['users']])
|
self.assertIn(new_user_id, [x['id'] for x in body['users']])
|
||||||
self.assertIn(new_user_id, [x['id']
|
self.assertIn(new_user_id, [x['id']
|
||||||
for x in body['regions'][0]['users']])
|
for x in body['regions'][0]['users']])
|
||||||
|
|
||||||
@decorators.idempotent_id('699e8487-035e-4ae0-97b4-ca51b9a08aea')
|
@decorators.idempotent_id('699e8487-035e-4ae0-97b4-ca51b9a08aea')
|
||||||
def test_delete_default_user(self):
|
def test_delete_default_user(self):
|
||||||
# setup data for delete_default_user test case
|
# setup data for delete_default_user test case
|
||||||
post_body = self._get_customer_params()
|
post_body = self._get_customer_params()
|
||||||
default_user_id = post_body["users"][0]["id"]
|
default_user_id = post_body["users"][0]["id"]
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertEqual(default_user_id, body['users'][0]['id'])
|
self.assertEqual(default_user_id, body['users'][0]['id'])
|
||||||
self.assertIn(default_user_id,
|
self.assertIn(default_user_id,
|
||||||
[x['id'] for x in body['regions'][0]['users']])
|
[x['id'] for x in body['regions'][0]['users']])
|
||||||
|
|
||||||
# delete default user and validate operation success by confirming
|
# delete default user and validate operation success by confirming
|
||||||
# user id no longer in both default users and region users list
|
# user id no longer in both default users and region users list
|
||||||
_, body = self.client.delete_default_user(test_customer_id,
|
_, body = self.client.delete_default_user(test_customer_id,
|
||||||
default_user_id)
|
default_user_id)
|
||||||
self._wait_for_status(test_customer_id, 'Success')
|
self._wait_for_status(test_customer_id, 'Success')
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertFalse(body['users'])
|
self.assertFalse(body['users'])
|
||||||
self.assertNotIn(default_user_id,
|
self.assertNotIn(default_user_id,
|
||||||
[x['id'] for x in body['regions'][0]['users']])
|
[x['id'] for x in body['regions'][0]['users']])
|
||||||
|
|
||||||
@decorators.idempotent_id('48ffd49f-2b36-40b4-b1b4-0c805b7ba7c2')
|
@decorators.idempotent_id('48ffd49f-2b36-40b4-b1b4-0c805b7ba7c2')
|
||||||
def test_replace_default_user(self):
|
def test_replace_default_user(self):
|
||||||
# setup data for "replace_default_user" test case; no need to
|
# setup data for "replace_default_user" test case; no need to
|
||||||
# set region user as default user will also be assigned to it
|
# set region user as default user will also be assigned to it
|
||||||
post_body = self._get_customer_params(region_users=False)
|
post_body = self._get_customer_params(region_users=False)
|
||||||
default_user_id = post_body["users"][0]["id"]
|
default_user_id = post_body["users"][0]["id"]
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertIn(default_user_id, [x['id'] for x in body['users']])
|
self.assertIn(default_user_id, [x['id'] for x in body['users']])
|
||||||
self.assertEqual(body['users'], body['regions'][0]['users'])
|
self.assertEqual(body['users'], body['regions'][0]['users'])
|
||||||
|
|
||||||
# replace default user
|
# replace default user
|
||||||
put_default_user = self._get_user_params(alt=True)
|
put_default_user = self._get_user_params(alt=True)
|
||||||
updated_user_id = put_default_user[0]["id"]
|
updated_user_id = put_default_user[0]["id"]
|
||||||
_, body = self.client.replace_default_user(test_customer_id,
|
_, body = self.client.replace_default_user(test_customer_id,
|
||||||
*put_default_user)
|
*put_default_user)
|
||||||
self._wait_for_status(test_customer_id, 'Success')
|
self._wait_for_status(test_customer_id, 'Success')
|
||||||
|
|
||||||
# validate that BOTH the customer default user and region user
|
# validate that BOTH the customer default user and region user
|
||||||
# are replaced with the new default_user successfully
|
# are replaced with the new default_user successfully
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertEqual(len(body['users']),
|
self.assertEqual(len(body['users']),
|
||||||
len(body['regions'][0]['users']))
|
len(body['regions'][0]['users']))
|
||||||
self.assertIn(updated_user_id, [x['id'] for x in body['users']])
|
self.assertIn(updated_user_id, [x['id'] for x in body['users']])
|
||||||
self.assertEqual(body['users'], body['regions'][0]['users'])
|
self.assertEqual(body['users'], body['regions'][0]['users'])
|
||||||
|
|
||||||
@decorators.idempotent_id('07a631f9-3aa5-4797-9ead-4531ced89e2a')
|
@decorators.idempotent_id('07a631f9-3aa5-4797-9ead-4531ced89e2a')
|
||||||
def test_add_region_user(self):
|
def test_add_region_user(self):
|
||||||
# We are leaving both default and region users as blank to ensure
|
# We are leaving both default and region users as blank to ensure
|
||||||
# region user is empty on initial data creation for this test case
|
# region user is empty on initial data creation for this test case
|
||||||
post_body = self._get_customer_params(region_users=False,
|
post_body = self._get_customer_params(region_users=False,
|
||||||
default_users=False)
|
default_users=False)
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
# confirm that the region users body is empty after data creation
|
# confirm that the region users body is empty after data creation
|
||||||
self.assertFalse(body["regions"][0]["users"])
|
self.assertFalse(body["regions"][0]["users"])
|
||||||
|
|
||||||
# now we shall add user to regions[0]
|
# now we shall add user to regions[0]
|
||||||
post_region_user = self._get_user_params()
|
post_region_user = self._get_user_params()
|
||||||
_, body = self.client.add_region_user(test_customer_id,
|
_, body = self.client.add_region_user(test_customer_id,
|
||||||
CONF.identity.region,
|
CONF.identity.region,
|
||||||
*post_region_user)
|
*post_region_user)
|
||||||
self._wait_for_status(test_customer_id, 'Success')
|
self._wait_for_status(test_customer_id, 'Success')
|
||||||
_, customer = self.client.get_customer(test_customer_id)
|
_, customer = self.client.get_customer(test_customer_id)
|
||||||
# validate that the region user is no longer empty after the add
|
# validate that the region user is no longer empty after the add
|
||||||
self.assertTrue(customer["regions"][0]["users"])
|
self.assertTrue(customer["regions"][0]["users"])
|
||||||
|
|
||||||
@decorators.idempotent_id('9b2b3af8-2444-4143-a9e6-78c33b36c823')
|
@decorators.idempotent_id('9b2b3af8-2444-4143-a9e6-78c33b36c823')
|
||||||
def test_delete_region_user(self):
|
def test_delete_region_user(self):
|
||||||
# To test delete_region_users scenario, leave default user blank
|
# To test delete_region_users scenario, leave default user blank
|
||||||
# for the test customer data, or else default user info will be
|
# for the test customer data, or else default user info will be
|
||||||
# added as region user as well
|
# added as region user as well
|
||||||
post_body = self._get_customer_params(default_users=False)
|
post_body = self._get_customer_params(default_users=False)
|
||||||
region_user_id = post_body["regions"][0]["users"][0]["id"]
|
region_user_id = post_body["regions"][0]["users"][0]["id"]
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
_, body = self.client.get_customer(test_customer_id)
|
_, body = self.client.get_customer(test_customer_id)
|
||||||
self.assertTrue(body["regions"][0]["users"])
|
self.assertTrue(body["regions"][0]["users"])
|
||||||
|
|
||||||
# delete the user from the region, then validate operation success
|
# delete the user from the region, then validate operation success
|
||||||
_, body = self.client.delete_region_user(test_customer_id,
|
_, body = self.client.delete_region_user(test_customer_id,
|
||||||
CONF.identity.region,
|
CONF.identity.region,
|
||||||
region_user_id)
|
region_user_id)
|
||||||
self._wait_for_status(test_customer_id, 'Success')
|
self._wait_for_status(test_customer_id, 'Success')
|
||||||
_, customer = self.client.get_customer(test_customer_id)
|
_, customer = self.client.get_customer(test_customer_id)
|
||||||
# validate that the region user is now empty
|
# validate that the region user is now empty
|
||||||
self.assertFalse(customer["regions"][0]["users"])
|
self.assertFalse(customer["regions"][0]["users"])
|
||||||
|
|
||||||
@decorators.idempotent_id('0ca59977-ef29-46b9-be92-14980a12c573')
|
@decorators.idempotent_id('0ca59977-ef29-46b9-be92-14980a12c573')
|
||||||
def test_replace_region_user(self):
|
def test_replace_region_user(self):
|
||||||
post_body = self._get_customer_params()
|
post_body = self._get_customer_params()
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
|
|
||||||
# update region user then confirm that update is successful
|
# update region user then confirm that update is successful
|
||||||
put_region_user = self._get_user_params(alt=True)
|
put_region_user = self._get_user_params(alt=True)
|
||||||
new_region_user_id = put_region_user[0]["id"]
|
new_region_user_id = put_region_user[0]["id"]
|
||||||
|
|
||||||
_, body = self.client.replace_region_user(test_customer_id,
|
_, body = self.client.replace_region_user(test_customer_id,
|
||||||
CONF.identity.region,
|
CONF.identity.region,
|
||||||
*put_region_user)
|
*put_region_user)
|
||||||
self._wait_for_status(test_customer_id, 'Success')
|
self._wait_for_status(test_customer_id, 'Success')
|
||||||
_, customer = self.client.get_customer(test_customer_id)
|
_, customer = self.client.get_customer(test_customer_id)
|
||||||
self.assertIn(new_region_user_id, [x['id']
|
self.assertIn(new_region_user_id, [x['id']
|
||||||
for x in customer["regions"][0]['users']])
|
for x in customer["regions"][0]['users']])
|
||||||
|
|
||||||
@decorators.idempotent_id('f1444965-c711-438d-ab86-a2412acbe8e0')
|
@decorators.idempotent_id('f1444965-c711-438d-ab86-a2412acbe8e0')
|
||||||
def test_replace_metadata(self):
|
def test_replace_metadata(self):
|
||||||
metadata = {'metadata': {'replace_key': 'replace_value'}}
|
metadata = {'metadata': {'replace_key': 'replace_value'}}
|
||||||
_, body = self.client.replace_metadata(self.setup_customer_id,
|
_, body = self.client.replace_metadata(self.setup_customer_id,
|
||||||
metadata)
|
metadata)
|
||||||
self._wait_for_status(self.setup_customer_id, 'Success')
|
self._wait_for_status(self.setup_customer_id, 'Success')
|
||||||
_, body = self.client.list_customers({'metadata': 'replace_key'})
|
_, body = self.client.list_customers({'metadata': 'replace_key'})
|
||||||
self.assertIn(self.setup_customer_id,
|
self.assertIn(self.setup_customer_id,
|
||||||
[x['id'] for x in body['customers']])
|
[x['id'] for x in body['customers']])
|
||||||
|
|
||||||
@decorators.idempotent_id('80713a87-8e95-481f-a198-6b4515d48362')
|
@decorators.idempotent_id('80713a87-8e95-481f-a198-6b4515d48362')
|
||||||
def test_add_metadata(self):
|
def test_add_metadata(self):
|
||||||
metadata = {'metadata': {'add_key': 'add_value'}}
|
metadata = {'metadata': {'add_key': 'add_value'}}
|
||||||
_, body = self.client.add_metadata(self.setup_customer_id,
|
_, body = self.client.add_metadata(self.setup_customer_id,
|
||||||
metadata)
|
metadata)
|
||||||
self._wait_for_status(self.setup_customer_id, 'Success')
|
self._wait_for_status(self.setup_customer_id, 'Success')
|
||||||
_, body = self.client.list_customers({'metadata': 'add_key'})
|
_, body = self.client.list_customers({'metadata': 'add_key'})
|
||||||
self.assertIn(self.setup_customer_id,
|
self.assertIn(self.setup_customer_id,
|
||||||
[x['id'] for x in body['customers']])
|
[x['id'] for x in body['customers']])
|
||||||
|
|
||||||
@decorators.idempotent_id('19a6bbe2-92b9-46be-95b7-aa0d9f247d88')
|
@decorators.idempotent_id('19a6bbe2-92b9-46be-95b7-aa0d9f247d88')
|
||||||
def test_add_regions(self):
|
def test_add_regions(self):
|
||||||
region = self._get_region_params()
|
region = self._get_region_params()
|
||||||
_, body = self.client.add_regions(self.bare_customer_id,
|
_, body = self.client.add_regions(self.bare_customer_id,
|
||||||
region)
|
region)
|
||||||
self._wait_for_status(self.setup_customer_id, 'Success')
|
self._wait_for_status(self.setup_customer_id, 'Success')
|
||||||
_, body = self.client.list_customers({'region': region[0]['name']})
|
_, body = self.client.list_customers({'region': region[0]['name']})
|
||||||
self.assertIn(self.setup_customer_id,
|
self.assertIn(self.setup_customer_id,
|
||||||
[x['id'] for x in body['customers']])
|
[x['id'] for x in body['customers']])
|
||||||
|
|
||||||
@decorators.idempotent_id('09a43bc1-439e-4497-a026-f2c3de451d29')
|
@decorators.idempotent_id('09a43bc1-439e-4497-a026-f2c3de451d29')
|
||||||
def test_delete_regions(self):
|
def test_delete_regions(self):
|
||||||
# setup data for delete_region
|
# setup data for delete_region
|
||||||
post_body = self._get_customer_params()
|
post_body = self._get_customer_params()
|
||||||
region_name = post_body["regions"][0]["name"]
|
region_name = post_body["regions"][0]["name"]
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
_, customer = self.client.get_customer(test_customer_id)
|
_, customer = self.client.get_customer(test_customer_id)
|
||||||
self.assertTrue(customer["regions"])
|
self.assertTrue(customer["regions"])
|
||||||
_, body = self.client.delete_region_from_customer(test_customer_id,
|
_, body = self.client.delete_region_from_customer(test_customer_id,
|
||||||
region_name)
|
region_name)
|
||||||
self._wait_for_status(test_customer_id, 'no regions')
|
self._wait_for_status(test_customer_id, 'no regions')
|
||||||
_, customer = self.client.get_customer(test_customer_id)
|
_, customer = self.client.get_customer(test_customer_id)
|
||||||
self.assertFalse(customer["regions"])
|
self.assertFalse(customer["regions"])
|
||||||
|
|
||||||
@decorators.idempotent_id('c7a24667-2a99-41ac-a42d-6c1163ef48af')
|
@decorators.idempotent_id('c7a24667-2a99-41ac-a42d-6c1163ef48af')
|
||||||
def test_create_customer(self):
|
def test_create_customer(self):
|
||||||
post_body = self._get_customer_params(quota=False)
|
post_body = self._get_customer_params(quota=False)
|
||||||
test_cust_name = post_body['name']
|
test_cust_name = post_body['name']
|
||||||
_, body = self.client.create_customer(**post_body)
|
_, body = self.client.create_customer(**post_body)
|
||||||
test_customer_id = body['customer']['id']
|
test_customer_id = body['customer']['id']
|
||||||
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_cust_validate_deletion_on_dcp_and_lcp,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
self._wait_for_status(test_customer_id, 'Success')
|
self._wait_for_status(test_customer_id, 'Success')
|
||||||
_, body = self.client.get_customer(test_cust_name)
|
_, body = self.client.get_customer(test_cust_name)
|
||||||
self.assertIn(test_customer_id, body['uuid'])
|
self.assertIn(test_customer_id, body['uuid'])
|
||||||
|
|
||||||
@decorators.idempotent_id('43785f87-27d5-408d-997f-de602caeb698')
|
@decorators.idempotent_id('43785f87-27d5-408d-997f-de602caeb698')
|
||||||
def test_replace_customer(self):
|
def test_replace_customer(self):
|
||||||
customer = self._get_bare_customer_params()
|
customer = self._get_bare_customer_params()
|
||||||
customer['name'] = self.setup_customer['name']
|
customer['name'] = self.setup_customer['name']
|
||||||
customer['regions'] = [{'name': CONF.identity.region}]
|
customer['regions'] = [{'name': CONF.identity.region}]
|
||||||
_, body = self.client.update_customer(self.setup_customer_id,
|
_, body = self.client.update_customer(self.setup_customer_id,
|
||||||
customer)
|
customer)
|
||||||
self._wait_for_status(self.setup_customer_id, 'Success')
|
self._wait_for_status(self.setup_customer_id, 'Success')
|
||||||
_, body = self.client.get_customer(self.setup_customer_id)
|
_, body = self.client.get_customer(self.setup_customer_id)
|
||||||
self.assertExpected(customer, body, ['name', 'regions'])
|
self.assert_expected(customer, body, ['name', 'regions'])
|
||||||
for region in customer['regions']:
|
for region in customer['regions']:
|
||||||
self.assertIn(region['name'], [x['name'] for x in body['regions']])
|
self.assertIn(region['name'], [x['name'] for x in body['regions']])
|
||||||
|
|
||||||
@decorators.idempotent_id('e8b9077a-d45c-4e24-a433-e7dfa07486b9')
|
@decorators.idempotent_id('e8b9077a-d45c-4e24-a433-e7dfa07486b9')
|
||||||
def test_delete_customer(self):
|
def test_delete_customer(self):
|
||||||
# setup data for test case
|
# setup data for test case
|
||||||
post_body = self._get_customer_params()
|
post_body = self._get_customer_params()
|
||||||
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
test_customer_id = self._create_cust_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
|
|
||||||
# delete the data and do get_customer to ensure 404-NotFound response
|
# delete the data and do get_customer to ensure 404-NotFound response
|
||||||
self._del_cust_validate_deletion_on_dcp_and_lcp(test_customer_id)
|
self._del_cust_validate_deletion_on_dcp_and_lcp(test_customer_id)
|
||||||
self.assertRaises(exceptions.NotFound, self.client.get_customer,
|
self.assertRaises(exceptions.NotFound, self.client.get_customer,
|
||||||
test_customer_id)
|
test_customer_id)
|
||||||
|
@ -1,42 +1,42 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestCmsNegative(base.BaseOrmTest):
|
class TestTempestCmsNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
super(TestTempestCmsNegative, cls).setup_credentials()
|
super(TestTempestCmsNegative, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestCmsNegative, cls).setup_clients()
|
super(TestTempestCmsNegative, cls).setup_clients()
|
||||||
cls.client = cls.cmsclient
|
cls.client = cls.cmsclient
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.set_role_to_admin()
|
cls.set_role_to_admin()
|
||||||
super(TestTempestCmsNegative, cls).resource_setup()
|
super(TestTempestCmsNegative, cls).resource_setup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
cls.delete_role_to_admin()
|
cls.delete_role_to_admin()
|
||||||
super(TestTempestCmsNegative, cls).resource_cleanup()
|
super(TestTempestCmsNegative, cls).resource_cleanup()
|
||||||
|
@ -1,361 +1,361 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ranger_tempest_plugin.tests.api import fms_base
|
from ranger_tempest_plugin.tests.api import fms_base
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
from tempest.lib import decorators
|
from tempest.lib import decorators
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestFms(fms_base.FmsBaseOrmTest):
|
class TestTempestFms(fms_base.FmsBaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
super(TestTempestFms, cls).setup_credentials()
|
super(TestTempestFms, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestFms, cls).setup_clients()
|
super(TestTempestFms, cls).setup_clients()
|
||||||
cls.rms_client = cls.os_primary.rms_client
|
cls.rms_client = cls.os_primary.rms_client
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
|
|
||||||
# create flavor then save off flavor_id for use in test cases
|
# create flavor then save off flavor_id for use in test cases
|
||||||
body = cls._get_flavor_params()
|
body = cls._get_flavor_params()
|
||||||
cls.flavor = cls._create_flv_and_validate_creation_on_dcp_and_lcp(
|
cls.flavor = cls._create_flv_and_validate_creation_on_dcp_and_lcp(
|
||||||
**body)
|
**body)
|
||||||
|
|
||||||
# these variables will be used to test list filters
|
# these variables will be used to test list filters
|
||||||
cls.flavor_id = cls.flavor['id']
|
cls.flavor_id = cls.flavor['id']
|
||||||
cls.flavor_name = cls.flavor['name']
|
cls.flavor_name = cls.flavor['name']
|
||||||
cls.visibility = cls.flavor['visibility']
|
cls.visibility = cls.flavor['visibility']
|
||||||
cls.series = cls.flavor['series']
|
cls.series = cls.flavor['series']
|
||||||
cls.tenant_id = cls.tenant_id
|
cls.tenant_id = cls.tenant_id
|
||||||
cls.region_id = CONF.identity.region
|
cls.region_id = CONF.identity.region
|
||||||
cls.alias = cls.flavor['alias']
|
cls.alias = cls.flavor['alias']
|
||||||
cls.dflt_ex_specs = cls.flavor['extra-specs']
|
cls.dflt_ex_specs = cls.flavor['extra-specs']
|
||||||
|
|
||||||
cls.tags = cls.flavor['tag']
|
cls.tags = cls.flavor['tag']
|
||||||
|
|
||||||
# add custom extra specs
|
# add custom extra specs
|
||||||
cls.custom_es = {'os_extra_specs': {'g': 'guava', 'h': 'honeydew'}}
|
cls.custom_es = {'os_extra_specs': {'g': 'guava', 'h': 'honeydew'}}
|
||||||
cls.client.add_extra_specs(cls.flavor_id, cls.custom_es)
|
cls.client.add_extra_specs(cls.flavor_id, cls.custom_es)
|
||||||
cls._wait_for_flavor_status_on_dcp(cls.flavor_id, 'Success')
|
cls._wait_for_flavor_status_on_dcp(cls.flavor_id, 'Success')
|
||||||
|
|
||||||
super(TestTempestFms, cls).resource_setup()
|
super(TestTempestFms, cls).resource_setup()
|
||||||
|
|
||||||
def _get_flavor_details(self, flavor_id):
|
def _get_flavor_details(self, flavor_id):
|
||||||
_, body = self.client.get_flavor(flavor_id)
|
_, body = self.client.get_flavor(flavor_id)
|
||||||
return body["flavor"]
|
return body["flavor"]
|
||||||
|
|
||||||
def _data_setup(self, post_body):
|
def _data_setup(self, post_body):
|
||||||
flavor = self._create_flv_and_validate_creation_on_dcp_and_lcp(
|
flavor = self._create_flv_and_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_flv_and_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_flv_and_validate_deletion_on_dcp_and_lcp,
|
||||||
flavor["id"])
|
flavor["id"])
|
||||||
return flavor
|
return flavor
|
||||||
|
|
||||||
def _exec_tags_function(self, flavor_id, req_json, action, para):
|
def _exec_tags_function(self, flavor_id, req_json, action, para):
|
||||||
|
|
||||||
if action == 'add':
|
if action == 'add':
|
||||||
_, body = self.client.add_tags(flavor_id, req_json)
|
_, body = self.client.add_tags(flavor_id, req_json)
|
||||||
|
|
||||||
elif action == 'update':
|
elif action == 'update':
|
||||||
_, body = self.client.update_tags(flavor_id, req_json)
|
_, body = self.client.update_tags(flavor_id, req_json)
|
||||||
|
|
||||||
elif action == 'delete':
|
elif action == 'delete':
|
||||||
_, body = self.client.delete_tags(flavor_id, para)
|
_, body = self.client.delete_tags(flavor_id, para)
|
||||||
|
|
||||||
self._wait_for_flavor_status_on_dcp(flavor_id, 'Success')
|
self._wait_for_flavor_status_on_dcp(flavor_id, 'Success')
|
||||||
|
|
||||||
def _exec_ex_spec_function(self, flavor_id, es_body, action, para):
|
def _exec_ex_spec_function(self, flavor_id, es_body, action, para):
|
||||||
if action == 'add':
|
if action == 'add':
|
||||||
_, body = self.client.add_extra_specs(flavor_id, es_body)
|
_, body = self.client.add_extra_specs(flavor_id, es_body)
|
||||||
|
|
||||||
elif action == 'update':
|
elif action == 'update':
|
||||||
_, body = self.client.update_extra_specs(flavor_id, es_body)
|
_, body = self.client.update_extra_specs(flavor_id, es_body)
|
||||||
|
|
||||||
elif action == 'delete':
|
elif action == 'delete':
|
||||||
_, body = self.client.delete_extra_specs(flavor_id, para)
|
_, body = self.client.delete_extra_specs(flavor_id, para)
|
||||||
|
|
||||||
self._wait_for_flavor_status_on_dcp(flavor_id, 'Success')
|
self._wait_for_flavor_status_on_dcp(flavor_id, 'Success')
|
||||||
|
|
||||||
def _restore_default_tags(self, flavor_id):
|
def _restore_default_tags(self, flavor_id):
|
||||||
tag_body = {"tags": self.tags}
|
tag_body = {"tags": self.tags}
|
||||||
_, body = self.client.update_tags(flavor_id, tag_body)
|
_, body = self.client.update_tags(flavor_id, tag_body)
|
||||||
self._wait_for_flavor_status_on_dcp(flavor_id, 'Success')
|
self._wait_for_flavor_status_on_dcp(flavor_id, 'Success')
|
||||||
|
|
||||||
_, tag_body = self.client.get_tags(flavor_id)
|
_, tag_body = self.client.get_tags(flavor_id)
|
||||||
self.assertDictEqual(self.tags, body.get("tags"))
|
self.assertDictEqual(self.tags, body.get("tags"))
|
||||||
|
|
||||||
def _restore_custom_es(self, flavor_id):
|
def _restore_custom_es(self, flavor_id):
|
||||||
_, body = self.client.update_extra_specs(flavor_id, self.custom_es)
|
_, body = self.client.update_extra_specs(flavor_id, self.custom_es)
|
||||||
self._wait_for_flavor_status_on_dcp(flavor_id, 'Success')
|
self._wait_for_flavor_status_on_dcp(flavor_id, 'Success')
|
||||||
|
|
||||||
_, es = self.client.get_extra_specs(flavor_id)
|
_, extra_specs = self.client.get_extra_specs(flavor_id)
|
||||||
es_expected = self.custom_es.get("os_extra_specs")
|
es_expected = self.custom_es.get("os_extra_specs")
|
||||||
es_expected.update(self.dflt_ex_specs)
|
es_expected.update(self.dflt_ex_specs)
|
||||||
self.assertDictEqual(es_expected, es.get("os_extra_specs"))
|
self.assertDictEqual(es_expected, extra_specs.get("os_extra_specs"))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
# cls.delete_role_to_admin()
|
# cls.delete_role_to_admin()
|
||||||
flavor_id = cls.flavor['id']
|
flavor_id = cls.flavor['id']
|
||||||
cls._del_flv_and_validate_deletion_on_dcp_and_lcp(flavor_id)
|
cls._del_flv_and_validate_deletion_on_dcp_and_lcp(flavor_id)
|
||||||
super(TestTempestFms, cls).resource_cleanup()
|
super(TestTempestFms, cls).resource_cleanup()
|
||||||
|
|
||||||
@decorators.idempotent_id('2a4481cd-acce-4a5d-af7c-940222a6238b')
|
@decorators.idempotent_id('2a4481cd-acce-4a5d-af7c-940222a6238b')
|
||||||
def test_get_flavor(self):
|
def test_get_flavor(self):
|
||||||
"""Execute get_flavor using flavor_id / flavor_name"""
|
"""Execute get_flavor using flavor_id / flavor_name"""
|
||||||
for para in [self.flavor_id, self.flavor_name]:
|
for para in [self.flavor_id, self.flavor_name]:
|
||||||
_, body = self.client.get_flavor(para)
|
_, body = self.client.get_flavor(para)
|
||||||
self.assertIn(self.flavor_id, body["flavor"]["id"])
|
self.assertIn(self.flavor_id, body["flavor"]["id"])
|
||||||
|
|
||||||
@decorators.idempotent_id('c46a503a-951c-4d00-afaa-46076b54db16')
|
@decorators.idempotent_id('c46a503a-951c-4d00-afaa-46076b54db16')
|
||||||
def test_list_flavor_with_filters(self):
|
def test_list_flavor_with_filters(self):
|
||||||
"""This function executes 'list flavors' with the following filters:
|
"""This function executes 'list flavors' with the following filters:
|
||||||
|
|
||||||
- None (no filters, i.e. list all flavors)
|
- None (no filters, i.e. list all flavors)
|
||||||
- alias filter
|
- alias filter
|
||||||
- region filter
|
- region filter
|
||||||
- visibility filter
|
- visibility filter
|
||||||
- 'contains' filter
|
- 'contains' filter
|
||||||
- 'starts_with' filter
|
- 'starts_with' filter
|
||||||
- 'series' filter
|
- 'series' filter
|
||||||
- "tenant" filter
|
- "tenant" filter
|
||||||
"""
|
"""
|
||||||
# for use by the 'constains and 'starts_with' filter
|
# for use by the 'constains and 'starts_with' filter
|
||||||
str_index1 = data_utils.rand_int_id(0, len(self.flavor_name) - 1)
|
str_index1 = data_utils.rand_int_id(0, len(self.flavor_name) - 1)
|
||||||
str_index2 = data_utils.rand_int_id(str_index1 + 1,
|
str_index2 = data_utils.rand_int_id(str_index1 + 1,
|
||||||
len(self.flavor_name))
|
len(self.flavor_name))
|
||||||
|
|
||||||
# define the list flavors filters to be used for this test
|
# define the list flavors filters to be used for this test
|
||||||
alias_filter = "?alias=%s" % self.alias
|
alias_filter = "?alias=%s" % self.alias
|
||||||
region_filter = "?region=%s" % self.region_id
|
region_filter = "?region=%s" % self.region_id
|
||||||
visibility_filter = "?visibility=%s" % self.visibility
|
visibility_filter = "?visibility=%s" % self.visibility
|
||||||
contains_filter = '?contains=%s' \
|
contains_filter = '?contains=%s' \
|
||||||
% self.flavor_name[str_index1:str_index2]
|
% self.flavor_name[str_index1:str_index2]
|
||||||
startswith_filter = "?starts_with=%s" % self.flavor_name[:str_index2]
|
startswith_filter = "?starts_with=%s" % self.flavor_name[:str_index2]
|
||||||
series_filter = "?series=%s" % self.series
|
series_filter = "?series=%s" % self.series
|
||||||
tenant_filter = "?tenant=%s" % self.tenant_id
|
tenant_filter = "?tenant=%s" % self.tenant_id
|
||||||
|
|
||||||
for list_filter in [None, region_filter, visibility_filter,
|
for list_filter in [None, region_filter, visibility_filter,
|
||||||
alias_filter, contains_filter, startswith_filter,
|
alias_filter, contains_filter, startswith_filter,
|
||||||
series_filter, tenant_filter]:
|
series_filter, tenant_filter]:
|
||||||
_, body = self.client.list_flavors(list_filter)
|
_, body = self.client.list_flavors(list_filter)
|
||||||
flavor_ids = [flvr["id"] for flvr in body["flavors"]]
|
flavor_ids = [flvr["id"] for flvr in body["flavors"]]
|
||||||
self.assertIn(self.flavor_id, flavor_ids)
|
self.assertIn(self.flavor_id, flavor_ids)
|
||||||
|
|
||||||
@decorators.idempotent_id('7b9d1f91-a8a4-458d-aaad-a98b5bf033b4')
|
@decorators.idempotent_id('7b9d1f91-a8a4-458d-aaad-a98b5bf033b4')
|
||||||
def test_create_flavor(self):
|
def test_create_flavor(self):
|
||||||
post_body = self._get_flavor_params()
|
post_body = self._get_flavor_params()
|
||||||
# call client create_flavor and wait till status equals 'Success'
|
# call client create_flavor and wait till status equals 'Success'
|
||||||
_, body = self.client.create_flavor(**post_body)
|
_, body = self.client.create_flavor(**post_body)
|
||||||
test_flvr_id = body["flavor"]['id']
|
test_flvr_id = body["flavor"]['id']
|
||||||
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'Success')
|
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'Success')
|
||||||
|
|
||||||
# do not forget to add this account to addCleanUp
|
# do not forget to add this account to addCleanUp
|
||||||
self.addCleanup(self._del_flv_and_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_flv_and_validate_deletion_on_dcp_and_lcp,
|
||||||
test_flvr_id)
|
test_flvr_id)
|
||||||
|
|
||||||
# verify flavor record created successfully
|
# verify flavor record created successfully
|
||||||
flavor = self._get_flavor_details(test_flvr_id)
|
flavor = self._get_flavor_details(test_flvr_id)
|
||||||
self.assertEqual(flavor["visibility"], "private")
|
self.assertEqual(flavor["visibility"], "private")
|
||||||
self.assertEqual(flavor["regions"][0]["name"], CONF.identity.region)
|
self.assertEqual(flavor["regions"][0]["name"], CONF.identity.region)
|
||||||
self.assertEqual(flavor["status"], "Success")
|
self.assertEqual(flavor["status"], "Success")
|
||||||
|
|
||||||
@decorators.idempotent_id('4cad10ce-67d2-4633-b347-2c16783a31b9')
|
@decorators.idempotent_id('4cad10ce-67d2-4633-b347-2c16783a31b9')
|
||||||
def test_add_flvr_tags(self):
|
def test_add_flvr_tags(self):
|
||||||
# test add_tags command with two sets of key:values
|
# test add_tags command with two sets of key:values
|
||||||
add_tag_body = {"tags": {"aa": "bb", "cc": "dd"}}
|
add_tag_body = {"tags": {"aa": "bb", "cc": "dd"}}
|
||||||
self._exec_tags_function(self.flavor_id, add_tag_body, 'add', None)
|
self._exec_tags_function(self.flavor_id, add_tag_body, 'add', None)
|
||||||
_, tag_body = self.client.get_tags(self.flavor_id)
|
_, tag_body = self.client.get_tags(self.flavor_id)
|
||||||
|
|
||||||
subset = {k: v for k, v in tag_body.get("tags").items()
|
subset = {k: v for k, v in list(tag_body.get("tags").items())
|
||||||
if k in add_tag_body.get("tags")}
|
if k in add_tag_body.get("tags")}
|
||||||
|
|
||||||
self.assertDictEqual(add_tag_body.get("tags"), subset)
|
self.assertDictEqual(add_tag_body.get("tags"), subset)
|
||||||
|
|
||||||
@decorators.idempotent_id('db8e5c0f-0041-45d4-9939-e079296123d8')
|
@decorators.idempotent_id('db8e5c0f-0041-45d4-9939-e079296123d8')
|
||||||
def test_replace_flvr_tags(self):
|
def test_replace_flvr_tags(self):
|
||||||
# test replace_tags command
|
# test replace_tags command
|
||||||
replace_tag_body = {"tags": {"ee": "ff", "gg": "hh"}}
|
replace_tag_body = {"tags": {"ee": "ff", "gg": "hh"}}
|
||||||
self._exec_tags_function(self.flavor_id, replace_tag_body,
|
self._exec_tags_function(self.flavor_id, replace_tag_body,
|
||||||
'update', None)
|
'update', None)
|
||||||
self.addCleanup(self._restore_default_tags, self.flavor_id)
|
self.addCleanup(self._restore_default_tags, self.flavor_id)
|
||||||
_, tag_body = self.client.get_tags(self.flavor_id)
|
_, tag_body = self.client.get_tags(self.flavor_id)
|
||||||
self.assertDictEqual(replace_tag_body.get("tags"),
|
self.assertDictEqual(replace_tag_body.get("tags"),
|
||||||
tag_body.get("tags"))
|
tag_body.get("tags"))
|
||||||
|
|
||||||
@decorators.idempotent_id('e0a0eca6-e120-45ab-a1a4-f5b95fdf97f1')
|
@decorators.idempotent_id('e0a0eca6-e120-45ab-a1a4-f5b95fdf97f1')
|
||||||
def test_delete_flvr_tag(self):
|
def test_delete_flvr_tag(self):
|
||||||
# test delete_tag command - delete a tag from tags body
|
# test delete_tag command - delete a tag from tags body
|
||||||
delete_tag_key = "a"
|
delete_tag_key = "a"
|
||||||
self._exec_tags_function(self.flavor_id, None, 'delete',
|
self._exec_tags_function(self.flavor_id, None, 'delete',
|
||||||
delete_tag_key)
|
delete_tag_key)
|
||||||
# do get_tag and tries to retrieve the deleted tag
|
# do get_tag and tries to retrieve the deleted tag
|
||||||
_, tag_body = self.client.get_tags(self.flavor_id)
|
_, tag_body = self.client.get_tags(self.flavor_id)
|
||||||
tag_present = tag_body.get("tags").get(delete_tag_key, None)
|
tag_present = tag_body.get("tags").get(delete_tag_key, None)
|
||||||
self.assertIsNone(tag_present)
|
self.assertIsNone(tag_present)
|
||||||
|
|
||||||
@decorators.idempotent_id('9c511020-53ed-4139-8c53-451cb0ea8c75')
|
@decorators.idempotent_id('9c511020-53ed-4139-8c53-451cb0ea8c75')
|
||||||
def test_delete_all_flvr_tags(self):
|
def test_delete_all_flvr_tags(self):
|
||||||
# ensure there is at least a tag
|
# ensure there is at least a tag
|
||||||
_, tag_body = self.client.get_tags(self.flavor_id)
|
_, tag_body = self.client.get_tags(self.flavor_id)
|
||||||
self.assertTrue(True if tag_body.get("tags") else False)
|
self.assertTrue(True if tag_body.get("tags") else False)
|
||||||
|
|
||||||
# test delete_all_tags command - run get_tag again and confirm
|
# test delete_all_tags command - run get_tag again and confirm
|
||||||
# that the tag dict is now empty
|
# that the tag dict is now empty
|
||||||
self._exec_tags_function(self.flavor_id, None, 'delete', None)
|
self._exec_tags_function(self.flavor_id, None, 'delete', None)
|
||||||
self.addCleanup(self._restore_default_tags, self.flavor_id)
|
self.addCleanup(self._restore_default_tags, self.flavor_id)
|
||||||
_, tag_body = self.client.get_tags(self.flavor_id)
|
_, tag_body = self.client.get_tags(self.flavor_id)
|
||||||
# assert that tag_body contains nothing
|
# assert that tag_body contains nothing
|
||||||
self.assertFalse(tag_body["tags"])
|
self.assertFalse(tag_body["tags"])
|
||||||
|
|
||||||
@decorators.idempotent_id('ec74d68f-b42a-41a8-9685-ff5eca25ea0c')
|
@decorators.idempotent_id('ec74d68f-b42a-41a8-9685-ff5eca25ea0c')
|
||||||
def test_add_delete_flvr_region(self):
|
def test_add_delete_flvr_region(self):
|
||||||
# setup data to add region
|
# setup data to add region
|
||||||
post_body = self._get_flavor_params(set_region=False)
|
post_body = self._get_flavor_params(set_region=False)
|
||||||
flavor = self._data_setup(post_body)
|
flavor = self._data_setup(post_body)
|
||||||
test_flvr_id = flavor['id']
|
test_flvr_id = flavor['id']
|
||||||
|
|
||||||
post_region_body = '{"regions": [{"name": "%s"}]}' % (self.region_id)
|
post_region_body = '{"regions": [{"name": "%s"}]}' % (self.region_id)
|
||||||
post_region_body = json.loads(post_region_body)
|
post_region_body = json.loads(post_region_body)
|
||||||
_, body = self.client.add_flvr_regions(test_flvr_id,
|
_, body = self.client.add_flvr_regions(test_flvr_id,
|
||||||
post_region_body)
|
post_region_body)
|
||||||
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'Success')
|
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'Success')
|
||||||
_, body = self.client.get_flavor(test_flvr_id)
|
_, body = self.client.get_flavor(test_flvr_id)
|
||||||
self.assertEqual(body["flavor"]["regions"][0]["name"],
|
self.assertEqual(body["flavor"]["regions"][0]["name"],
|
||||||
post_region_body["regions"][0]["name"])
|
post_region_body["regions"][0]["name"])
|
||||||
|
|
||||||
# remove added region and then check to confirm flavor status
|
# remove added region and then check to confirm flavor status
|
||||||
_, body = self.client.delete_flvr_region(test_flvr_id,
|
_, body = self.client.delete_flvr_region(test_flvr_id,
|
||||||
self.region_id)
|
self.region_id)
|
||||||
# flavor status must show 'no regions' when it has no region assigned
|
# flavor status must show 'no regions' when it has no region assigned
|
||||||
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'no regions')
|
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'no regions')
|
||||||
# flavor region is now empty after the lone region was removed
|
# flavor region is now empty after the lone region was removed
|
||||||
_, body = self.client.get_flavor(test_flvr_id)
|
_, body = self.client.get_flavor(test_flvr_id)
|
||||||
self.assertTrue(len(body["flavor"]["regions"]) == 0)
|
self.assertTrue(len(body["flavor"]["regions"]) == 0)
|
||||||
|
|
||||||
@decorators.idempotent_id('71404409-5d95-472c-8dac-b49a1c0c4b37')
|
@decorators.idempotent_id('71404409-5d95-472c-8dac-b49a1c0c4b37')
|
||||||
def test_add_flvr_extra_specs(self):
|
def test_add_flvr_extra_specs(self):
|
||||||
# get extra specs before the add
|
# get extra specs before the add
|
||||||
_, es_body = self.client.get_extra_specs(self.flavor_id)
|
_, es_body = self.client.get_extra_specs(self.flavor_id)
|
||||||
es_expected = es_body.get("os_extra_specs")
|
es_expected = es_body.get("os_extra_specs")
|
||||||
|
|
||||||
# add custom extra specs
|
# add custom extra specs
|
||||||
add_es_body = {"os_extra_specs": {"a": "apple", "b": "banana"}}
|
add_es_body = {"os_extra_specs": {"a": "apple", "b": "banana"}}
|
||||||
self._exec_ex_spec_function(self.flavor_id, add_es_body, 'add', None)
|
self._exec_ex_spec_function(self.flavor_id, add_es_body, 'add', None)
|
||||||
_, es = self.client.get_extra_specs(self.flavor_id)
|
_, extra_specs = self.client.get_extra_specs(self.flavor_id)
|
||||||
|
|
||||||
# assert extra specs add results match expected
|
# assert extra specs add results match expected
|
||||||
es_expected.update(add_es_body["os_extra_specs"])
|
es_expected.update(add_es_body["os_extra_specs"])
|
||||||
self.assertDictEqual(es_expected, es.get("os_extra_specs"))
|
self.assertDictEqual(es_expected, extra_specs.get("os_extra_specs"))
|
||||||
|
|
||||||
@decorators.idempotent_id('043948fd-125b-4d96-bf40-42464066a7e1')
|
@decorators.idempotent_id('043948fd-125b-4d96-bf40-42464066a7e1')
|
||||||
def test_update_flvr_extra_specs(self):
|
def test_update_flvr_extra_specs(self):
|
||||||
# add custom extra spec using update_extra_spec
|
# add custom extra spec using update_extra_spec
|
||||||
replace_es_body = {"os_extra_specs": {"z": "zebra", "x": "xray"}}
|
replace_es_body = {"os_extra_specs": {"z": "zebra", "x": "xray"}}
|
||||||
self._exec_ex_spec_function(self.flavor_id, replace_es_body, 'update',
|
self._exec_ex_spec_function(self.flavor_id, replace_es_body, 'update',
|
||||||
None)
|
None)
|
||||||
self.addCleanup(self._restore_custom_es, self.flavor_id)
|
self.addCleanup(self._restore_custom_es, self.flavor_id)
|
||||||
|
|
||||||
# assert extra specs update results match expected
|
# assert extra specs update results match expected
|
||||||
_, flvr_ex_specs = self.client.get_extra_specs(self.flavor_id)
|
_, flvr_ex_specs = self.client.get_extra_specs(self.flavor_id)
|
||||||
|
|
||||||
es_expected = replace_es_body.get("os_extra_specs")
|
es_expected = replace_es_body.get("os_extra_specs")
|
||||||
es_expected.update(self.dflt_ex_specs)
|
es_expected.update(self.dflt_ex_specs)
|
||||||
self.assertDictEqual(es_expected, flvr_ex_specs.get("os_extra_specs"))
|
self.assertDictEqual(es_expected, flvr_ex_specs.get("os_extra_specs"))
|
||||||
|
|
||||||
@decorators.idempotent_id('df83e2cd-d202-4b2f-8459-391a73067ec5')
|
@decorators.idempotent_id('df83e2cd-d202-4b2f-8459-391a73067ec5')
|
||||||
def test_delete_flvr_extra_spec(self):
|
def test_delete_flvr_extra_spec(self):
|
||||||
# get extra specs before the delete
|
# get extra specs before the delete
|
||||||
_, es_body = self.client.get_extra_specs(self.flavor_id)
|
_, es_body = self.client.get_extra_specs(self.flavor_id)
|
||||||
|
|
||||||
# now delete one of the custom extra specs
|
# now delete one of the custom extra specs
|
||||||
delete_es_key_h = "h"
|
delete_es_key_h = "h"
|
||||||
self._exec_ex_spec_function(self.flavor_id, None, 'delete',
|
self._exec_ex_spec_function(self.flavor_id, None, 'delete',
|
||||||
delete_es_key_h)
|
delete_es_key_h)
|
||||||
|
|
||||||
# assert extra specs update results match expected
|
# assert extra specs update results match expected
|
||||||
es_body["os_extra_specs"].pop(delete_es_key_h)
|
es_body["os_extra_specs"].pop(delete_es_key_h)
|
||||||
_, flvr_ex_specs = self.client.get_extra_specs(self.flavor_id)
|
_, flvr_ex_specs = self.client.get_extra_specs(self.flavor_id)
|
||||||
self.assertDictEqual(es_body["os_extra_specs"],
|
self.assertDictEqual(es_body["os_extra_specs"],
|
||||||
flvr_ex_specs.get("os_extra_specs"))
|
flvr_ex_specs.get("os_extra_specs"))
|
||||||
|
|
||||||
@decorators.idempotent_id('e3fc7ce3-c8fe-4805-8ad3-7be2c94fe7ad')
|
@decorators.idempotent_id('e3fc7ce3-c8fe-4805-8ad3-7be2c94fe7ad')
|
||||||
def test_delete_all_flvr_extra_specs(self):
|
def test_delete_all_flvr_extra_specs(self):
|
||||||
# run delete ALL extra specs - note that this will only
|
# run delete ALL extra specs - note that this will only
|
||||||
# delete custom extra specs, NOT the default extra specs
|
# delete custom extra specs, NOT the default extra specs
|
||||||
self._exec_ex_spec_function(self.flavor_id, None, 'delete', None)
|
self._exec_ex_spec_function(self.flavor_id, None, 'delete', None)
|
||||||
self.addCleanup(self._restore_custom_es, self.flavor_id)
|
self.addCleanup(self._restore_custom_es, self.flavor_id)
|
||||||
_, flvr_ex_specs = self.client.get_extra_specs(self.flavor_id)
|
_, flvr_ex_specs = self.client.get_extra_specs(self.flavor_id)
|
||||||
# assert that flavor extra specs now contains only
|
# assert that flavor extra specs now contains only
|
||||||
# the default extra specs
|
# the default extra specs
|
||||||
self.assertDictEqual(self.dflt_ex_specs,
|
self.assertDictEqual(self.dflt_ex_specs,
|
||||||
flvr_ex_specs.get("os_extra_specs"))
|
flvr_ex_specs.get("os_extra_specs"))
|
||||||
|
|
||||||
@decorators.idempotent_id('187195b5-adfb-4c73-a2f5-42117021f5f2')
|
@decorators.idempotent_id('187195b5-adfb-4c73-a2f5-42117021f5f2')
|
||||||
def test_add_delete_flvr_tenant(self):
|
def test_add_delete_flvr_tenant(self):
|
||||||
# setup data for test case
|
# setup data for test case
|
||||||
post_body = self._get_flavor_params()
|
post_body = self._get_flavor_params()
|
||||||
flavor = self._data_setup(post_body)
|
flavor = self._data_setup(post_body)
|
||||||
test_flvr_id = flavor['id']
|
test_flvr_id = flavor['id']
|
||||||
|
|
||||||
# check that flavor contains one tenant before testing add_flvr_tenant
|
# check that flavor contains one tenant before testing add_flvr_tenant
|
||||||
flavor = self._get_flavor_details(test_flvr_id)
|
flavor = self._get_flavor_details(test_flvr_id)
|
||||||
self.assertEqual(len(flavor["tenants"]), 1)
|
self.assertEqual(len(flavor["tenants"]), 1)
|
||||||
self.assertEqual(flavor["tenants"][0], self.tenant_id)
|
self.assertEqual(flavor["tenants"][0], self.tenant_id)
|
||||||
|
|
||||||
# test add_flvr_tenant by adding one more tenant
|
# test add_flvr_tenant by adding one more tenant
|
||||||
post_tenant_body = '{"tenants": ["%s"]}' % (self.alt_tenant_id)
|
post_tenant_body = '{"tenants": ["%s"]}' % (self.alt_tenant_id)
|
||||||
post_tenant_body = json.loads(post_tenant_body)
|
post_tenant_body = json.loads(post_tenant_body)
|
||||||
_, body = self.client.add_flvr_tenants(test_flvr_id, post_tenant_body)
|
_, body = self.client.add_flvr_tenants(test_flvr_id, post_tenant_body)
|
||||||
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'Success')
|
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'Success')
|
||||||
|
|
||||||
# get flavor on same flavor id and confirm we have two tenants now
|
# get flavor on same flavor id and confirm we have two tenants now
|
||||||
flavor = self._get_flavor_details(test_flvr_id)
|
flavor = self._get_flavor_details(test_flvr_id)
|
||||||
self.assertEqual(len(flavor["tenants"]), 2)
|
self.assertEqual(len(flavor["tenants"]), 2)
|
||||||
self.assertIn(self.alt_tenant_id, flavor["tenants"])
|
self.assertIn(self.alt_tenant_id, flavor["tenants"])
|
||||||
|
|
||||||
# delete one tenant, then wait until status = 'Success'
|
# delete one tenant, then wait until status = 'Success'
|
||||||
_, body = self.client.delete_flvr_tenant(test_flvr_id,
|
_, body = self.client.delete_flvr_tenant(test_flvr_id,
|
||||||
self.alt_tenant_id)
|
self.alt_tenant_id)
|
||||||
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'Success')
|
self._wait_for_flavor_status_on_dcp(test_flvr_id, 'Success')
|
||||||
# get flavor to confirm flavor["tenants"] now shows one tenant only
|
# get flavor to confirm flavor["tenants"] now shows one tenant only
|
||||||
flavor = self._get_flavor_details(test_flvr_id)
|
flavor = self._get_flavor_details(test_flvr_id)
|
||||||
self.assertEqual(len(flavor["tenants"]), 1)
|
self.assertEqual(len(flavor["tenants"]), 1)
|
||||||
self.assertEqual(flavor["tenants"][0], self.tenant_id)
|
self.assertEqual(flavor["tenants"][0], self.tenant_id)
|
||||||
|
|
||||||
@decorators.idempotent_id('36958bba-673e-4397-85a9-fddb01e9ca0d')
|
@decorators.idempotent_id('36958bba-673e-4397-85a9-fddb01e9ca0d')
|
||||||
def test_delete_flavor(self):
|
def test_delete_flavor(self):
|
||||||
# setup data for test case
|
# setup data for test case
|
||||||
post_body = self._get_flavor_params()
|
post_body = self._get_flavor_params()
|
||||||
flavor = self._create_flv_and_validate_creation_on_dcp_and_lcp(
|
flavor = self._create_flv_and_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
test_flvr_id = flavor['id']
|
test_flvr_id = flavor['id']
|
||||||
|
|
||||||
# delete the data and do get_flavor to ensure 404-NotFound response
|
# delete the data and do get_flavor to ensure 404-NotFound response
|
||||||
self._del_flv_and_validate_deletion_on_dcp_and_lcp(test_flvr_id)
|
self._del_flv_and_validate_deletion_on_dcp_and_lcp(test_flvr_id)
|
||||||
self.assertRaises(exceptions.NotFound, self.client.get_flavor,
|
self.assertRaises(exceptions.NotFound, self.client.get_flavor,
|
||||||
test_flvr_id)
|
test_flvr_id)
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestFmsNegative(base.BaseOrmTest):
|
class TestTempestFmsNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
super(TestTempestFmsNegative, cls).setup_credentials()
|
super(TestTempestFmsNegative, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestFmsNegative, cls).setup_clients()
|
super(TestTempestFmsNegative, cls).setup_clients()
|
||||||
cls.client = cls.fmsclient
|
cls.client = cls.fmsclient
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.set_role_to_admin()
|
cls.set_role_to_admin()
|
||||||
super(TestTempestFmsNegative, cls).resource_setup()
|
super(TestTempestFmsNegative, cls).resource_setup()
|
||||||
cls.env_name = cls.env_name
|
cls.env_name = cls.env_name
|
||||||
cls.tenant_id = cls.tenant_id
|
cls.tenant_id = cls.tenant_id
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
cls.delete_role_to_admin()
|
cls.delete_role_to_admin()
|
||||||
super(TestTempestFmsNegative, cls).resource_cleanup()
|
super(TestTempestFmsNegative, cls).resource_cleanup()
|
||||||
|
@ -1,260 +1,260 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin.tests.api import ims_base
|
from ranger_tempest_plugin.tests.api import ims_base
|
||||||
from tempest import config
|
from tempest import config
|
||||||
from tempest.lib import decorators
|
from tempest.lib import decorators
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestIms(ims_base.ImsBaseOrmTest):
|
class TestTempestIms(ims_base.ImsBaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
super(TestTempestIms, cls).setup_credentials()
|
super(TestTempestIms, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestIms, cls).setup_clients()
|
super(TestTempestIms, cls).setup_clients()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
# setup public image for tempest testing
|
# setup public image for tempest testing
|
||||||
cls.image_params = \
|
cls.image_params = \
|
||||||
cls._get_image_params(set_private=False)
|
cls._get_image_params(set_private=False)
|
||||||
cls.public_image = \
|
cls.public_image = \
|
||||||
cls._create_img_and_validate_creation_on_dcp_and_lcp(
|
cls._create_img_and_validate_creation_on_dcp_and_lcp(
|
||||||
**cls.image_params)
|
**cls.image_params)
|
||||||
|
|
||||||
# setup private image for tempest testing
|
# setup private image for tempest testing
|
||||||
cls.image_params = cls._get_image_params(set_enabled=False)
|
cls.image_params = cls._get_image_params(set_enabled=False)
|
||||||
cls.private_image = \
|
cls.private_image = \
|
||||||
cls._create_img_and_validate_creation_on_dcp_and_lcp(
|
cls._create_img_and_validate_creation_on_dcp_and_lcp(
|
||||||
**cls.image_params)
|
**cls.image_params)
|
||||||
|
|
||||||
super(TestTempestIms, cls).resource_setup()
|
super(TestTempestIms, cls).resource_setup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
cls._del_img_validate_deletion_on_dcp_and_lcp(cls.public_image['id'])
|
cls._del_img_validate_deletion_on_dcp_and_lcp(cls.public_image['id'])
|
||||||
cls._del_img_validate_deletion_on_dcp_and_lcp(cls.private_image['id'])
|
cls._del_img_validate_deletion_on_dcp_and_lcp(cls.private_image['id'])
|
||||||
super(TestTempestIms, cls).resource_cleanup()
|
super(TestTempestIms, cls).resource_cleanup()
|
||||||
|
|
||||||
def _data_setup(self, post_body):
|
def _data_setup(self, post_body):
|
||||||
image = self._create_img_and_validate_creation_on_dcp_and_lcp(
|
image = self._create_img_and_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
self.addCleanup(self._del_img_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_img_validate_deletion_on_dcp_and_lcp,
|
||||||
image["id"])
|
image["id"])
|
||||||
# only check for Success image status if "regions" is not empty
|
# only check for Success image status if "regions" is not empty
|
||||||
if image["regions"]:
|
if image["regions"]:
|
||||||
self._wait_for_image_status_on_dcp(image["id"], 'Success')
|
self._wait_for_image_status_on_dcp(image["id"], 'Success')
|
||||||
|
|
||||||
return image
|
return image
|
||||||
|
|
||||||
@decorators.idempotent_id('2b1bb28b-4151-4e75-ae1b-d21089c3418c')
|
@decorators.idempotent_id('2b1bb28b-4151-4e75-ae1b-d21089c3418c')
|
||||||
def test_get_image(self):
|
def test_get_image(self):
|
||||||
"""Execute 'get_image' using the following options:
|
"""Execute 'get_image' using the following options:
|
||||||
|
|
||||||
- get image by id (using cust_id parameter)
|
- get image by id (using cust_id parameter)
|
||||||
- get image by name (using cust_name parameter)
|
- get image by name (using cust_name parameter)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# execute get_image using image ID and iamge_name
|
# execute get_image using image ID and iamge_name
|
||||||
for identifier in [self.public_image['id'], self.public_image['name']]:
|
for identifier in [self.public_image['id'], self.public_image['name']]:
|
||||||
_, body = self.client.get_image(identifier)
|
_, body = self.client.get_image(identifier)
|
||||||
self.assertIn(self.public_image['id'], body['image']['id'])
|
self.assertIn(self.public_image['id'], body['image']['id'])
|
||||||
|
|
||||||
@decorators.idempotent_id('6072c438-1e45-4c0b-97a6-e5127bd33d90')
|
@decorators.idempotent_id('6072c438-1e45-4c0b-97a6-e5127bd33d90')
|
||||||
def test_list_images_with_filters(self):
|
def test_list_images_with_filters(self):
|
||||||
"""This function executes 'list customer' with all available filters:
|
"""This function executes 'list customer' with all available filters:
|
||||||
|
|
||||||
- no filter (i.e. list all images)
|
- no filter (i.e. list all images)
|
||||||
- filter by region
|
- filter by region
|
||||||
- filter by customer
|
- filter by customer
|
||||||
- filter by visibility (public/private)
|
- filter by visibility (public/private)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# define the list customer filters to be used for this test
|
# define the list customer filters to be used for this test
|
||||||
no_filter = None
|
no_filter = None
|
||||||
customer_filter = "?customer=%s" % self.tenant_id
|
customer_filter = "?customer=%s" % self.tenant_id
|
||||||
region_filter = "?region=%s" % self.region_id
|
region_filter = "?region=%s" % self.region_id
|
||||||
public_filter = "?visibility=public"
|
public_filter = "?visibility=public"
|
||||||
private_filter = "?visibility=private"
|
private_filter = "?visibility=private"
|
||||||
|
|
||||||
# list public images
|
# list public images
|
||||||
_, body = self.client.list_images(public_filter)
|
_, body = self.client.list_images(public_filter)
|
||||||
image_ids = [img['id'] for img in body['images']]
|
image_ids = [img['id'] for img in body['images']]
|
||||||
self.assertIn(self.public_image['id'], image_ids)
|
self.assertIn(self.public_image['id'], image_ids)
|
||||||
|
|
||||||
# list private images
|
# list private images
|
||||||
_, body = self.client.list_images(private_filter)
|
_, body = self.client.list_images(private_filter)
|
||||||
image_ids = [img['id'] for img in body['images']]
|
image_ids = [img['id'] for img in body['images']]
|
||||||
self.assertIn(self.private_image['id'], image_ids)
|
self.assertIn(self.private_image['id'], image_ids)
|
||||||
|
|
||||||
# execute list_customers with the rest of the filters
|
# execute list_customers with the rest of the filters
|
||||||
for list_filter in [no_filter, region_filter,
|
for list_filter in [no_filter, region_filter,
|
||||||
customer_filter]:
|
customer_filter]:
|
||||||
_, body = self.client.list_images(list_filter)
|
_, body = self.client.list_images(list_filter)
|
||||||
images = [image['id'] for image in body['images']]
|
images = [image['id'] for image in body['images']]
|
||||||
self.assertIn(self.private_image['id'], images)
|
self.assertIn(self.private_image['id'], images)
|
||||||
|
|
||||||
@decorators.idempotent_id('4435fef4-49a9-435b-8463-cf8a1e0b7cd8')
|
@decorators.idempotent_id('4435fef4-49a9-435b-8463-cf8a1e0b7cd8')
|
||||||
def test_disable_image(self):
|
def test_disable_image(self):
|
||||||
# disable self.public_image and check if request is successful
|
# disable self.public_image and check if request is successful
|
||||||
self.client.enabled_image(self.public_image['id'], False)
|
self.client.enabled_image(self.public_image['id'], False)
|
||||||
self._wait_for_image_status_on_dcp(self.public_image['id'], 'Success')
|
self._wait_for_image_status_on_dcp(self.public_image['id'], 'Success')
|
||||||
_, body = self.client.get_image(self.public_image['id'])
|
_, body = self.client.get_image(self.public_image['id'])
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
|
|
||||||
# assert that the image["enabled"] value is 'False'
|
# assert that the image["enabled"] value is 'False'
|
||||||
self.assertTrue(not image['enabled'])
|
self.assertTrue(not image['enabled'])
|
||||||
|
|
||||||
@decorators.idempotent_id('f32a13e3-6f38-423b-a616-09c8d4e1c277')
|
@decorators.idempotent_id('f32a13e3-6f38-423b-a616-09c8d4e1c277')
|
||||||
def test_enable_image(self):
|
def test_enable_image(self):
|
||||||
# enable self.private_image and check if request is successful
|
# enable self.private_image and check if request is successful
|
||||||
self.client.enabled_image(self.private_image['id'], True)
|
self.client.enabled_image(self.private_image['id'], True)
|
||||||
self._wait_for_image_status_on_dcp(self.private_image['id'], 'Success')
|
self._wait_for_image_status_on_dcp(self.private_image['id'], 'Success')
|
||||||
_, body = self.client.get_image(self.private_image['id'])
|
_, body = self.client.get_image(self.private_image['id'])
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
|
|
||||||
# assert that the image["enabled"] value is 'True'
|
# assert that the image["enabled"] value is 'True'
|
||||||
self.assertTrue(image['enabled'])
|
self.assertTrue(image['enabled'])
|
||||||
|
|
||||||
@decorators.idempotent_id('cb9e3022-00d7-4a21-bdb2-67d3cd15a4f8')
|
@decorators.idempotent_id('cb9e3022-00d7-4a21-bdb2-67d3cd15a4f8')
|
||||||
def test_add_delete_image_region(self):
|
def test_add_delete_image_region(self):
|
||||||
# skip region assignment in data setup
|
# skip region assignment in data setup
|
||||||
post_body = self._get_image_params(set_region=False)
|
post_body = self._get_image_params(set_region=False)
|
||||||
image = self._data_setup(post_body)
|
image = self._data_setup(post_body)
|
||||||
test_image_id = image['id']
|
test_image_id = image['id']
|
||||||
|
|
||||||
# add region to image then check to confirm image status = "Success"
|
# add region to image then check to confirm image status = "Success"
|
||||||
self.client.add_region_to_image(test_image_id, self.region_id)
|
self.client.add_region_to_image(test_image_id, self.region_id)
|
||||||
# image status must show 'Success' when assigned to a region
|
# image status must show 'Success' when assigned to a region
|
||||||
self._wait_for_image_status_on_dcp(test_image_id, 'Success')
|
self._wait_for_image_status_on_dcp(test_image_id, 'Success')
|
||||||
|
|
||||||
# check that region is successfully added
|
# check that region is successfully added
|
||||||
_, body = self.client.get_image(test_image_id)
|
_, body = self.client.get_image(test_image_id)
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
self.assertEqual(image["regions"][0]["name"], self.region_id)
|
self.assertEqual(image["regions"][0]["name"], self.region_id)
|
||||||
|
|
||||||
# delete the region then check to confirm image status = "no regions"
|
# delete the region then check to confirm image status = "no regions"
|
||||||
_, body = self.client.delete_region_from_image(test_image_id,
|
_, body = self.client.delete_region_from_image(test_image_id,
|
||||||
self.region_id)
|
self.region_id)
|
||||||
self._wait_for_image_status_on_dcp(test_image_id, 'no regions')
|
self._wait_for_image_status_on_dcp(test_image_id, 'no regions')
|
||||||
|
|
||||||
# image region array should be empty after the region was removed
|
# image region array should be empty after the region was removed
|
||||||
_, body = self.client.get_image(test_image_id)
|
_, body = self.client.get_image(test_image_id)
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
self.assertFalse(image["regions"])
|
self.assertFalse(image["regions"])
|
||||||
|
|
||||||
@decorators.idempotent_id('0ee68189-66a8-4213-ad68-bc12991c174a')
|
@decorators.idempotent_id('0ee68189-66a8-4213-ad68-bc12991c174a')
|
||||||
def test_add_delete_image_tenant(self):
|
def test_add_delete_image_tenant(self):
|
||||||
# add alt tenant to self.private_image & check if status = "Success"
|
# add alt tenant to self.private_image & check if status = "Success"
|
||||||
self.client.add_customer_to_image(self.private_image['id'],
|
self.client.add_customer_to_image(self.private_image['id'],
|
||||||
self.alt_tenant_id)
|
self.alt_tenant_id)
|
||||||
self._wait_for_image_status_on_dcp(self.private_image['id'],
|
self._wait_for_image_status_on_dcp(self.private_image['id'],
|
||||||
'Success')
|
'Success')
|
||||||
|
|
||||||
# check that alt tenant successfully added to image tenants array
|
# check that alt tenant successfully added to image tenants array
|
||||||
_, body = self.client.get_image(self.private_image['id'])
|
_, body = self.client.get_image(self.private_image['id'])
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
self.assertEqual(len(image["customers"]), 2)
|
self.assertEqual(len(image["customers"]), 2)
|
||||||
self.assertIn(self.alt_tenant_id, image['customers'])
|
self.assertIn(self.alt_tenant_id, image['customers'])
|
||||||
|
|
||||||
# now delete alt_tenant_id and ensure operation is successful
|
# now delete alt_tenant_id and ensure operation is successful
|
||||||
_, body = self.client.delete_customer_from_image(
|
_, body = self.client.delete_customer_from_image(
|
||||||
self.private_image['id'],
|
self.private_image['id'],
|
||||||
self.alt_tenant_id)
|
self.alt_tenant_id)
|
||||||
self._wait_for_image_status_on_dcp(self.private_image['id'], 'Success')
|
self._wait_for_image_status_on_dcp(self.private_image['id'], 'Success')
|
||||||
|
|
||||||
# image region array should no longer contain alt tenant
|
# image region array should no longer contain alt tenant
|
||||||
_, body = self.client.get_image(self.private_image['id'])
|
_, body = self.client.get_image(self.private_image['id'])
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
self.assertNotIn(self.alt_tenant_id, image['customers'])
|
self.assertNotIn(self.alt_tenant_id, image['customers'])
|
||||||
|
|
||||||
@decorators.idempotent_id('bac99348-6b13-4b30-958b-3c039b27eda3')
|
@decorators.idempotent_id('bac99348-6b13-4b30-958b-3c039b27eda3')
|
||||||
def test_update_image_tenant(self):
|
def test_update_image_tenant(self):
|
||||||
# replace current tenant in self.private_image with alt tenant
|
# replace current tenant in self.private_image with alt tenant
|
||||||
self.client.update_customer(self.private_image['id'],
|
self.client.update_customer(self.private_image['id'],
|
||||||
self.alt_tenant_id)
|
self.alt_tenant_id)
|
||||||
self._wait_for_image_status_on_dcp(self.private_image['id'], 'Success')
|
self._wait_for_image_status_on_dcp(self.private_image['id'], 'Success')
|
||||||
|
|
||||||
# check that image tenants array contains only alt tenant
|
# check that image tenants array contains only alt tenant
|
||||||
_, body = self.client.get_image(self.private_image['id'])
|
_, body = self.client.get_image(self.private_image['id'])
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
self.assertEqual(len(image["customers"]), 1)
|
self.assertEqual(len(image["customers"]), 1)
|
||||||
self.assertIn(self.alt_tenant_id, image['customers'])
|
self.assertIn(self.alt_tenant_id, image['customers'])
|
||||||
|
|
||||||
@decorators.idempotent_id('0331e02a-ab52-4341-b676-a02462244277')
|
@decorators.idempotent_id('0331e02a-ab52-4341-b676-a02462244277')
|
||||||
def test_create_image(self):
|
def test_create_image(self):
|
||||||
post_body = self._get_image_params()
|
post_body = self._get_image_params()
|
||||||
# call client create_IMAGE and wait till status equals 'Success'
|
# call client create_IMAGE and wait till status equals 'Success'
|
||||||
_, body = self.client.create_image(**post_body)
|
_, body = self.client.create_image(**post_body)
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
test_image_id = image["id"]
|
test_image_id = image["id"]
|
||||||
self._wait_for_image_status_on_dcp(test_image_id, 'Success')
|
self._wait_for_image_status_on_dcp(test_image_id, 'Success')
|
||||||
|
|
||||||
# do not forget to add this account to addCleanUp
|
# do not forget to add this account to addCleanUp
|
||||||
self.addCleanup(self._del_img_validate_deletion_on_dcp_and_lcp,
|
self.addCleanup(self._del_img_validate_deletion_on_dcp_and_lcp,
|
||||||
test_image_id)
|
test_image_id)
|
||||||
# verify image record created successfully
|
# verify image record created successfully
|
||||||
_, body = self.client.get_image(test_image_id)
|
_, body = self.client.get_image(test_image_id)
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
self.assertEqual(image["regions"][0]["name"], CONF.identity.region)
|
self.assertEqual(image["regions"][0]["name"], CONF.identity.region)
|
||||||
|
|
||||||
@decorators.idempotent_id('01160918-e217-401d-a6a0-e7992ab76e41')
|
@decorators.idempotent_id('01160918-e217-401d-a6a0-e7992ab76e41')
|
||||||
def test_update_image(self):
|
def test_update_image(self):
|
||||||
region = {}
|
region = {}
|
||||||
post_body = self._get_image_params(set_region=False)
|
post_body = self._get_image_params(set_region=False)
|
||||||
image = self._data_setup(post_body)
|
image = self._data_setup(post_body)
|
||||||
test_image_id = image['id']
|
test_image_id = image['id']
|
||||||
|
|
||||||
# setup region and change 'enabled', 'customers' properties
|
# setup region and change 'enabled', 'customers' properties
|
||||||
region["name"] = self.region_id
|
region["name"] = self.region_id
|
||||||
region["type"] = "single"
|
region["type"] = "single"
|
||||||
region["checksum"] = "7297321c2fa6424417a548c85edd6e98"
|
region["checksum"] = "7297321c2fa6424417a548c85edd6e98"
|
||||||
region["virtual_size"] = "None"
|
region["virtual_size"] = "None"
|
||||||
region["size"] = "38797312"
|
region["size"] = "38797312"
|
||||||
post_body["regions"] = [region]
|
post_body["regions"] = [region]
|
||||||
post_body["enabled"] = False
|
post_body["enabled"] = False
|
||||||
post_body["customers"] = [self.alt_tenant_id]
|
post_body["customers"] = [self.alt_tenant_id]
|
||||||
# empty tags list
|
# empty tags list
|
||||||
post_body["tags"] = []
|
post_body["tags"] = []
|
||||||
|
|
||||||
_, body = self.client.update_image(test_image_id, para=None,
|
_, body = self.client.update_image(test_image_id, para=None,
|
||||||
**post_body)
|
**post_body)
|
||||||
self._wait_for_image_status_on_dcp(test_image_id, 'Success')
|
self._wait_for_image_status_on_dcp(test_image_id, 'Success')
|
||||||
# verify image record updated successfully
|
# verify image record updated successfully
|
||||||
_, body = self.client.get_image(test_image_id)
|
_, body = self.client.get_image(test_image_id)
|
||||||
image = body["image"]
|
image = body["image"]
|
||||||
self.assertEqual(image["regions"][0]["name"], CONF.identity.region)
|
self.assertEqual(image["regions"][0]["name"], CONF.identity.region)
|
||||||
self.assertIn(self.alt_tenant_id, image['customers'])
|
self.assertIn(self.alt_tenant_id, image['customers'])
|
||||||
self.assertFalse(image['enabled'])
|
self.assertFalse(image['enabled'])
|
||||||
self.assertFalse(image['tags'])
|
self.assertFalse(image['tags'])
|
||||||
|
|
||||||
@decorators.idempotent_id('23e2e7e2-5b19-4c66-b35c-7c686a986627')
|
@decorators.idempotent_id('23e2e7e2-5b19-4c66-b35c-7c686a986627')
|
||||||
def test_delete_image(self):
|
def test_delete_image(self):
|
||||||
# setup data for test case
|
# setup data for test case
|
||||||
post_body = self._get_image_params()
|
post_body = self._get_image_params()
|
||||||
image = self._create_img_and_validate_creation_on_dcp_and_lcp(
|
image = self._create_img_and_validate_creation_on_dcp_and_lcp(
|
||||||
**post_body)
|
**post_body)
|
||||||
test_image_id = image['id']
|
test_image_id = image['id']
|
||||||
|
|
||||||
# delete the data and do get_image to ensure 404-NotFound response
|
# delete the data and do get_image to ensure 404-NotFound response
|
||||||
self._del_img_validate_deletion_on_dcp_and_lcp(test_image_id)
|
self._del_img_validate_deletion_on_dcp_and_lcp(test_image_id)
|
||||||
self.assertRaises(exceptions.NotFound, self.client.get_image,
|
self.assertRaises(exceptions.NotFound, self.client.get_image,
|
||||||
test_image_id)
|
test_image_id)
|
||||||
|
@ -1,47 +1,47 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestImsNegative(base.BaseOrmTest):
|
class TestTempestImsNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
super(TestTempestImsNegative, cls).setup_credentials()
|
super(TestTempestImsNegative, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestImsNegative, cls).setup_clients()
|
super(TestTempestImsNegative, cls).setup_clients()
|
||||||
cls.client = cls.imsclient
|
cls.client = cls.imsclient
|
||||||
cls.servers_client = cls.servers_client
|
cls.servers_client = cls.servers_client
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.set_role_to_admin()
|
cls.set_role_to_admin()
|
||||||
super(TestTempestImsNegative, cls).resource_setup()
|
super(TestTempestImsNegative, cls).resource_setup()
|
||||||
cls.env_name = cls.env_name
|
cls.env_name = cls.env_name
|
||||||
cls.tenant_id = cls.tenant_id
|
cls.tenant_id = cls.tenant_id
|
||||||
cls.flavor_ref = CONF.compute.flavor_ref
|
cls.flavor_ref = CONF.compute.flavor_ref
|
||||||
cls.network_ref = CONF.network.public_network_id
|
cls.network_ref = CONF.network.public_network_id
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
cls.delete_role_to_admin()
|
cls.delete_role_to_admin()
|
||||||
super(TestTempestImsNegative, cls).resource_cleanup()
|
super(TestTempestImsNegative, cls).resource_cleanup()
|
||||||
|
@ -1,87 +1,87 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin import data_utils as orm_data_utils
|
from ranger_tempest_plugin import data_utils as orm_data_utils
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
from tempest.lib import decorators
|
from tempest.lib import decorators
|
||||||
|
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestRegionGroup(base.BaseOrmTest):
|
class TestTempestRegionGroup(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
super(TestTempestRegionGroup, cls).setup_credentials()
|
super(TestTempestRegionGroup, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestRegionGroup, cls).setup_clients()
|
super(TestTempestRegionGroup, cls).setup_clients()
|
||||||
cls.client = cls.os_primary.rms_client
|
cls.client = cls.os_primary.rms_client
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.setup_ids = []
|
cls.setup_ids = []
|
||||||
cls.group_ids = []
|
cls.group_ids = []
|
||||||
# create standard region
|
# create standard region
|
||||||
_, cls.region_1 = cls.client.create_region(data_utils.rand_name())
|
_, cls.region_1 = cls.client.create_region(data_utils.rand_name())
|
||||||
cls.setup_ids.append(cls.region_1['id'])
|
cls.setup_ids.append(cls.region_1['id'])
|
||||||
# create region sharing region_1 properties
|
# create region sharing region_1 properties
|
||||||
_, cls.region_2 = cls.client.create_region(data_utils.rand_name())
|
_, cls.region_2 = cls.client.create_region(data_utils.rand_name())
|
||||||
cls.setup_ids.append(cls.region_2['id'])
|
cls.setup_ids.append(cls.region_2['id'])
|
||||||
|
|
||||||
_, cls.group_1 = cls.client.create_region_group(
|
_, cls.group_1 = cls.client.create_region_group(
|
||||||
**orm_data_utils.rand_region_group([cls.setup_ids[0]])
|
**orm_data_utils.rand_region_group([cls.setup_ids[0]])
|
||||||
)
|
)
|
||||||
cls.group_ids.append(cls.group_1['group']['id'])
|
cls.group_ids.append(cls.group_1['group']['id'])
|
||||||
_, cls.group_2 = cls.client.create_region_group(
|
_, cls.group_2 = cls.client.create_region_group(
|
||||||
**orm_data_utils.rand_region_group(cls.setup_ids)
|
**orm_data_utils.rand_region_group(cls.setup_ids)
|
||||||
)
|
)
|
||||||
cls.group_ids.append(cls.group_2['group']['id'])
|
cls.group_ids.append(cls.group_2['group']['id'])
|
||||||
|
|
||||||
super(TestTempestRegionGroup, cls).resource_setup()
|
super(TestTempestRegionGroup, cls).resource_setup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
for region_id in cls.setup_ids:
|
for region_id in cls.setup_ids:
|
||||||
cls.client.delete_region(region_id)
|
cls.client.delete_region(region_id)
|
||||||
for group_id in cls.group_ids:
|
for group_id in cls.group_ids:
|
||||||
cls.client.delete_region_group(group_id)
|
cls.client.delete_region_group(group_id)
|
||||||
super(TestTempestRegionGroup, cls).resource_cleanup()
|
super(TestTempestRegionGroup, cls).resource_cleanup()
|
||||||
|
|
||||||
@decorators.idempotent_id('0d377eb2-754d-49c1-9a4f-c7019dfe80ca')
|
@decorators.idempotent_id('0d377eb2-754d-49c1-9a4f-c7019dfe80ca')
|
||||||
def test_update_group(self):
|
def test_update_group(self):
|
||||||
id = self.group_ids[-1]
|
_id = self.group_ids[-1]
|
||||||
group = orm_data_utils.rand_region_group(self.setup_ids, id)
|
group = orm_data_utils.rand_region_group(self.setup_ids, _id)
|
||||||
_, body = self.client.update_region_group(id, **group)
|
_, body = self.client.update_region_group(_id, **group)
|
||||||
self.assertExpected(group, body['group'], ['regions'])
|
self.assert_expected(group, body['group'], ['regions'])
|
||||||
|
|
||||||
@decorators.idempotent_id('b946c6c4-d601-42b9-befd-ba40992a3c53')
|
@decorators.idempotent_id('b946c6c4-d601-42b9-befd-ba40992a3c53')
|
||||||
def test_list_groups(self):
|
def test_list_groups(self):
|
||||||
_, body = self.client.list_region_groups()
|
_, body = self.client.list_region_groups()
|
||||||
groups = [x['id'] for x in body['groups']]
|
groups = [x['id'] for x in body['groups']]
|
||||||
self.assertIn(self.group_1['group']['id'], groups)
|
self.assertIn(self.group_1['group']['id'], groups)
|
||||||
self.assertIn(self.group_2['group']['id'], groups)
|
self.assertIn(self.group_2['group']['id'], groups)
|
||||||
|
|
||||||
@decorators.idempotent_id('9a37d966-4416-4ff3-8f3b-6847810662d7')
|
@decorators.idempotent_id('9a37d966-4416-4ff3-8f3b-6847810662d7')
|
||||||
def test_get_group(self):
|
def test_get_group(self):
|
||||||
id = self.group_1['group']['id']
|
_id = self.group_1['group']['id']
|
||||||
_, body = self.client.get_region_group(id)
|
_, body = self.client.get_region_group(_id)
|
||||||
self.assertExpected(self.group_1['group'], body, ['links'])
|
self.assert_expected(self.group_1['group'], body, ['links'])
|
||||||
|
@ -1,42 +1,42 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestRegGroupNegative(base.BaseOrmTest):
|
class TestTempestRegGroupNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
super(TestTempestRegGroupNegative, cls).setup_credentials()
|
super(TestTempestRegGroupNegative, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestRegGroupNegative, cls).setup_clients()
|
super(TestTempestRegGroupNegative, cls).setup_clients()
|
||||||
cls.client = cls.rmsclient
|
cls.client = cls.rmsclient
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.set_role_to_admin()
|
cls.set_role_to_admin()
|
||||||
super(TestTempestRegGroupNegative, cls).resource_setup()
|
super(TestTempestRegGroupNegative, cls).resource_setup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
cls.delete_role_to_admin()
|
cls.delete_role_to_admin()
|
||||||
super(TestTempestRegGroupNegative, cls).resource_cleanup()
|
super(TestTempestRegGroupNegative, cls).resource_cleanup()
|
||||||
|
@ -1,177 +1,177 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin import data_utils as orm_data_utils
|
from ranger_tempest_plugin import data_utils as orm_data_utils
|
||||||
from ranger_tempest_plugin.tests.api import rms_base
|
from ranger_tempest_plugin.tests.api import rms_base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
from tempest.lib import decorators
|
from tempest.lib import decorators
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestRegion(rms_base.RmsBaseOrmTest):
|
class TestTempestRegion(rms_base.RmsBaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.setup_ids = []
|
cls.setup_ids = []
|
||||||
# create standard region
|
# create standard region
|
||||||
_, cls.region_1 = cls.client.create_region(data_utils.rand_name())
|
_, cls.region_1 = cls.client.create_region(data_utils.rand_name())
|
||||||
cls.setup_ids.append(cls.region_1['id'])
|
cls.setup_ids.append(cls.region_1['id'])
|
||||||
# create region sharing region_1 properties
|
# create region sharing region_1 properties
|
||||||
_, cls.region_2 = cls.client.create_region(data_utils.rand_name())
|
_, cls.region_2 = cls.client.create_region(data_utils.rand_name())
|
||||||
cls.setup_ids.append(cls.region_2['id'])
|
cls.setup_ids.append(cls.region_2['id'])
|
||||||
# create region with differing properties
|
# create region with differing properties
|
||||||
_, cls.region_3 = cls.client.create_region(
|
_, cls.region_3 = cls.client.create_region(
|
||||||
data_utils.rand_name(),
|
data_utils.rand_name(),
|
||||||
**{'status': 'down',
|
**{'status': 'down',
|
||||||
'rangerAgentVersion': '3.0',
|
'rangerAgentVersion': '3.0',
|
||||||
'OSVersion': 'mitaka',
|
'OSVersion': 'mitaka',
|
||||||
'CLLI': '123450',
|
'CLLI': '123450',
|
||||||
'address': {'country': 'Mexico', 'state': 'Sonora',
|
'address': {'country': 'Mexico', 'state': 'Sonora',
|
||||||
'city': 'Nogales', 'street': '12 main',
|
'city': 'Nogales', 'street': '12 main',
|
||||||
'zip': '84000'},
|
'zip': '84000'},
|
||||||
'metadata': {'meta1': ['val1']},
|
'metadata': {'meta1': ['val1']},
|
||||||
'designType': 'large'})
|
'designType': 'large'})
|
||||||
cls.setup_ids.append(cls.region_3['id'])
|
cls.setup_ids.append(cls.region_3['id'])
|
||||||
|
|
||||||
super(TestTempestRegion, cls).resource_setup()
|
super(TestTempestRegion, cls).resource_setup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
for region_id in cls.setup_ids:
|
for region_id in cls.setup_ids:
|
||||||
cls.client.delete_region(region_id)
|
cls.client.delete_region(region_id)
|
||||||
super(TestTempestRegion, cls).resource_cleanup()
|
super(TestTempestRegion, cls).resource_cleanup()
|
||||||
|
|
||||||
@decorators.idempotent_id('829c7da0-2332-4f80-ad35-24306b67ed0e')
|
@decorators.idempotent_id('829c7da0-2332-4f80-ad35-24306b67ed0e')
|
||||||
def test_create_and_delete_region(self):
|
def test_create_and_delete_region(self):
|
||||||
# create new region for API test
|
# create new region for API test
|
||||||
region = orm_data_utils.rand_region()
|
region = orm_data_utils.rand_region()
|
||||||
_, region_body = self.client.create_region(region['id'], **region)
|
_, region_body = self.client.create_region(region['id'], **region)
|
||||||
|
|
||||||
test_region_name = region_body['name']
|
test_region_name = region_body['name']
|
||||||
test_region_id = region_body['id']
|
test_region_id = region_body['id']
|
||||||
_, body = self.client.get_region(test_region_name)
|
_, body = self.client.get_region(test_region_name)
|
||||||
self.assertEqual(test_region_id, body['id'])
|
self.assertEqual(test_region_id, body['id'])
|
||||||
|
|
||||||
# now delete the region
|
# now delete the region
|
||||||
self.client.delete_region(test_region_id)
|
self.client.delete_region(test_region_id)
|
||||||
self.assertRaises(exceptions.NotFound, self.client.get_region,
|
self.assertRaises(exceptions.NotFound, self.client.get_region,
|
||||||
test_region_id)
|
test_region_id)
|
||||||
|
|
||||||
@decorators.idempotent_id('eecedcb0-9c96-453d-bd72-71dba26fa1c5')
|
@decorators.idempotent_id('eecedcb0-9c96-453d-bd72-71dba26fa1c5')
|
||||||
def test_list_region(self):
|
def test_list_region(self):
|
||||||
_, body = self.client.list_regions()
|
_, body = self.client.list_regions()
|
||||||
regions = [x['id'] for x in body['regions']]
|
regions = [x['id'] for x in body['regions']]
|
||||||
self.assertIn(self.region_1['id'], regions)
|
self.assertIn(self.region_1['id'], regions)
|
||||||
|
|
||||||
@decorators.idempotent_id('0164e040-7775-4837-9ac2-aaa0f71cdfca')
|
@decorators.idempotent_id('0164e040-7775-4837-9ac2-aaa0f71cdfca')
|
||||||
def test_list_region_v1(self):
|
def test_list_region_v1(self):
|
||||||
_, body = self.client.list_regions_v1()
|
_, body = self.client.list_regions_v1()
|
||||||
regions = [x['id'] for x in body]
|
regions = [x['id'] for x in body]
|
||||||
self.assertIn(self.region_1['id'], regions)
|
self.assertIn(self.region_1['id'], regions)
|
||||||
|
|
||||||
@decorators.idempotent_id('e6c6fdfe-5fa2-45f5-8bd8-fb9cf79e99fc')
|
@decorators.idempotent_id('e6c6fdfe-5fa2-45f5-8bd8-fb9cf79e99fc')
|
||||||
def test_list_region_with_name(self):
|
def test_list_region_with_name(self):
|
||||||
filter = {'regionname': self.region_1['name']}
|
filter = {'regionname': self.region_1['name']}
|
||||||
self._list_regions_with_filter(filter, 'name')
|
self._list_regions_with_filter(filter, 'name')
|
||||||
|
|
||||||
@decorators.idempotent_id('b3310e32-0c31-4d37-9789-cc3c4639dabe')
|
@decorators.idempotent_id('b3310e32-0c31-4d37-9789-cc3c4639dabe')
|
||||||
def test_list_region_with_osversion(self):
|
def test_list_region_with_osversion(self):
|
||||||
filter = {'osversion': self.region_1['OSVersion']}
|
filter = {'osversion': self.region_1['OSVersion']}
|
||||||
self._list_regions_with_filter(filter, 'OSVersion')
|
self._list_regions_with_filter(filter, 'OSVersion')
|
||||||
|
|
||||||
@decorators.idempotent_id('0b2d3e79-c14a-4527-94b0-04eeae053a80')
|
@decorators.idempotent_id('0b2d3e79-c14a-4527-94b0-04eeae053a80')
|
||||||
def test_list_region_with_status(self):
|
def test_list_region_with_status(self):
|
||||||
filter = {'status': self.region_1['status']}
|
filter = {'status': self.region_1['status']}
|
||||||
self._list_regions_with_filter(filter, 'status')
|
self._list_regions_with_filter(filter, 'status')
|
||||||
|
|
||||||
@decorators.idempotent_id('871be582-ecaa-4a46-a403-4d6b5e59d7de')
|
@decorators.idempotent_id('871be582-ecaa-4a46-a403-4d6b5e59d7de')
|
||||||
def test_list_region_with_ranger_version(self):
|
def test_list_region_with_ranger_version(self):
|
||||||
filter = {'ranger_agent_version': self.region_1['rangerAgentVersion']}
|
filter = {'ranger_agent_version': self.region_1['rangerAgentVersion']}
|
||||||
self._list_regions_with_filter(filter, 'rangerAgentVersion')
|
self._list_regions_with_filter(filter, 'rangerAgentVersion')
|
||||||
|
|
||||||
@decorators.idempotent_id('ac18be48-c787-4a65-913f-a0b0a80fbd1d')
|
@decorators.idempotent_id('ac18be48-c787-4a65-913f-a0b0a80fbd1d')
|
||||||
def test_list_region_with_clli(self):
|
def test_list_region_with_clli(self):
|
||||||
filter = {'clli': self.region_1['CLLI']}
|
filter = {'clli': self.region_1['CLLI']}
|
||||||
self._list_regions_with_filter(filter, 'CLLI')
|
self._list_regions_with_filter(filter, 'CLLI')
|
||||||
|
|
||||||
@decorators.idempotent_id('f2b2361d-ce71-43a8-9f01-acb529835880')
|
@decorators.idempotent_id('f2b2361d-ce71-43a8-9f01-acb529835880')
|
||||||
def test_list_region_with_metadata(self):
|
def test_list_region_with_metadata(self):
|
||||||
filter = {'metadata': self.region_1['metadata'].keys()[0]}
|
filter = {'metadata': list(self.region_1['metadata'].keys())[0]}
|
||||||
self._list_regions_with_filter(filter, 'metadata')
|
self._list_regions_with_filter(filter, 'metadata')
|
||||||
|
|
||||||
@decorators.idempotent_id('4533b31a-115d-466d-bf75-8ac24338c1a5')
|
@decorators.idempotent_id('4533b31a-115d-466d-bf75-8ac24338c1a5')
|
||||||
def test_list_region_with_address(self):
|
def test_list_region_with_address(self):
|
||||||
filter = {
|
filter = {
|
||||||
'country': self.region_1['address']['country'],
|
'country': self.region_1['address']['country'],
|
||||||
'city': self.region_1['address']['city'],
|
'city': self.region_1['address']['city'],
|
||||||
'street': self.region_1['address']['street'],
|
'street': self.region_1['address']['street'],
|
||||||
'zip': self.region_1['address']['zip']
|
'zip': self.region_1['address']['zip']
|
||||||
}
|
}
|
||||||
self._list_regions_with_filter(filter, 'address')
|
self._list_regions_with_filter(filter, 'address')
|
||||||
|
|
||||||
@decorators.idempotent_id('726b8215-af10-4385-83c7-32b51502dff1')
|
@decorators.idempotent_id('726b8215-af10-4385-83c7-32b51502dff1')
|
||||||
def test_list_region_with_type(self):
|
def test_list_region_with_type(self):
|
||||||
filter = {'type': self.region_1['designType']}
|
filter = {'type': self.region_1['designType']}
|
||||||
self._list_regions_with_filter(filter, 'designType')
|
self._list_regions_with_filter(filter, 'designType')
|
||||||
|
|
||||||
@decorators.idempotent_id('4875ea70-a5a1-4b46-b752-246221670d26')
|
@decorators.idempotent_id('4875ea70-a5a1-4b46-b752-246221670d26')
|
||||||
def test_list_region_with_vlcp(self):
|
def test_list_region_with_vlcp(self):
|
||||||
filter = {'vlcp_name': self.region_1['vlcpName']}
|
filter = {'vlcp_name': self.region_1['vlcpName']}
|
||||||
self._list_regions_with_filter(filter, 'vlcpName')
|
self._list_regions_with_filter(filter, 'vlcpName')
|
||||||
|
|
||||||
@decorators.idempotent_id('358f3cbc-4ae5-4b43-be36-6df55eae8fd9')
|
@decorators.idempotent_id('358f3cbc-4ae5-4b43-be36-6df55eae8fd9')
|
||||||
def test_get_region(self):
|
def test_get_region(self):
|
||||||
_, body = self.client.get_region(self.region_1['id'])
|
_, body = self.client.get_region(self.region_1['id'])
|
||||||
self.assertExpected(self.region_1, body, [])
|
self.assert_expected(self.region_1, body, [])
|
||||||
|
|
||||||
@decorators.idempotent_id('cefb952f-7777-4878-87d2-d78ac345f0d2')
|
@decorators.idempotent_id('cefb952f-7777-4878-87d2-d78ac345f0d2')
|
||||||
def test_get_region_metadata(self):
|
def test_get_region_metadata(self):
|
||||||
_, body = self.client.get_region_metadata(self.region_1['id'])
|
_, body = self.client.get_region_metadata(self.region_1['id'])
|
||||||
self.assertExpected(self.region_1['metadata'], body['metadata'], [])
|
self.assert_expected(self.region_1['metadata'], body['metadata'], [])
|
||||||
|
|
||||||
@decorators.idempotent_id('b2c3baf5-22af-4bf9-bcad-b6a1a74e82d9')
|
@decorators.idempotent_id('b2c3baf5-22af-4bf9-bcad-b6a1a74e82d9')
|
||||||
def test_update_region(self):
|
def test_update_region(self):
|
||||||
id = self.setup_ids[-1]
|
_id = self.setup_ids[-1]
|
||||||
region = orm_data_utils.rand_region(id)
|
region = orm_data_utils.rand_region(_id)
|
||||||
_, body = self.client.update_region(id, **region)
|
_, body = self.client.update_region(_id, **region)
|
||||||
self.assertExpected(region, body, [])
|
self.assert_expected(region, body, [])
|
||||||
|
|
||||||
@decorators.idempotent_id('0d5644d8-92bc-497c-8fc5-b57417d86e6d')
|
@decorators.idempotent_id('0d5644d8-92bc-497c-8fc5-b57417d86e6d')
|
||||||
def test_update_region_status(self):
|
def test_update_region_status(self):
|
||||||
status = {}
|
status = {}
|
||||||
status['status'] = orm_data_utils.rand_region_status(
|
status['status'] = orm_data_utils.rand_region_status(
|
||||||
[self.region_1['status']])
|
[self.region_1['status']])
|
||||||
_, body = self.client.update_region_status(self.region_1['id'], status)
|
_, body = self.client.update_region_status(self.region_1['id'], status)
|
||||||
self.assertExpected(status, body, ['links'])
|
self.assert_expected(status, body, ['links'])
|
||||||
|
|
||||||
@decorators.idempotent_id('5c1a2624-6abe-49e7-82c8-30e8df1377d0')
|
@decorators.idempotent_id('5c1a2624-6abe-49e7-82c8-30e8df1377d0')
|
||||||
def test_update_region_metadata(self):
|
def test_update_region_metadata(self):
|
||||||
metadata = {}
|
metadata = {}
|
||||||
metadata['metadata'] = orm_data_utils.rand_region_metadata()
|
metadata['metadata'] = orm_data_utils.rand_region_metadata()
|
||||||
_, body = self.client.update_region_metadata(self.region_1['id'],
|
_, body = self.client.update_region_metadata(self.region_1['id'],
|
||||||
metadata)
|
metadata)
|
||||||
self.assertExpected(metadata, body, [])
|
self.assert_expected(metadata, body, [])
|
||||||
|
|
||||||
def _list_regions_with_filter(self, filter, key):
|
def _list_regions_with_filter(self, filter, key):
|
||||||
_, body = self.client.list_regions(filter)
|
_, body = self.client.list_regions(filter)
|
||||||
regions = [x for x in body['regions']]
|
regions = [x for x in body['regions']]
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
all([region[key] == self.region_1[key] for region in regions]))
|
all([region[key] == self.region_1[key] for region in regions]))
|
||||||
|
@ -1,42 +1,42 @@
|
|||||||
# Copyright 2016 AT&T Corp
|
# Copyright 2016 AT&T Corp
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ranger_tempest_plugin.tests.api import base
|
from ranger_tempest_plugin.tests.api import base
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestTempestRegionsNegative(base.BaseOrmTest):
|
class TestTempestRegionsNegative(base.BaseOrmTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
super(TestTempestRegionsNegative, cls).setup_credentials()
|
super(TestTempestRegionsNegative, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(TestTempestRegionsNegative, cls).setup_clients()
|
super(TestTempestRegionsNegative, cls).setup_clients()
|
||||||
cls.client = cls.rmsclient
|
cls.client = cls.rmsclient
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
cls.set_role_to_admin()
|
cls.set_role_to_admin()
|
||||||
super(TestTempestRegionsNegative, cls).resource_setup()
|
super(TestTempestRegionsNegative, cls).resource_setup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
cls.delete_role_to_admin()
|
cls.delete_role_to_admin()
|
||||||
super(TestTempestRegionsNegative, cls).resource_cleanup()
|
super(TestTempestRegionsNegative, cls).resource_cleanup()
|
||||||
|
@ -17,7 +17,7 @@ classifier =
|
|||||||
Natural Language :: English
|
Natural Language :: English
|
||||||
Topic :: Software Development :: Quality Assurance
|
Topic :: Software Development :: Quality Assurance
|
||||||
Topic :: Software Development :: Testing
|
Topic :: Software Development :: Testing
|
||||||
Programming Language :: Python
|
Programming Language :: Python :: 3.6
|
||||||
keywords =
|
keywords =
|
||||||
Plugin
|
Plugin
|
||||||
Tempest
|
Tempest
|
||||||
|
Loading…
x
Reference in New Issue
Block a user