From: Serena Feng Date: Thu, 1 Feb 2018 13:52:46 +0000 (+0000) Subject: Merge "Use snaps_utils to get credentials in tempest" X-Git-Tag: 0.2~99 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=416461c30d5a9a0df38e6c1bdef7061fce2c7eaf;hp=599aa4d480087e9ac24a67467f32431f18fe6d73;p=functest-xtesting.git Merge "Use snaps_utils to get credentials in tempest" --- diff --git a/docker/features/Dockerfile b/docker/features/Dockerfile index eaf88f89..13869f1b 100644 --- a/docker/features/Dockerfile +++ b/docker/features/Dockerfile @@ -3,6 +3,8 @@ FROM opnfv/functest-core ARG BRANCH=master ARG OPENSTACK_TAG=stable/pike ARG FDS_TAG=master +ARG RALLY_TAG=stable/0.10 +ARG OS_FAULTS_TAG=0.1.16 COPY thirdparty-requirements.txt thirdparty-requirements.txt RUN apk --no-cache add --update python3 sshpass && \ @@ -14,12 +16,29 @@ RUN apk --no-cache add --update python3 sshpass && \ > upper-constraints.txt && \ pip install --no-cache-dir --src /src -cupper-constraints.txt \ -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ - -rthirdparty-requirements.txt && \ + -e git+https://github.com/openstack/requirements@$OPENSTACK_TAG#egg=openstack_requirements && \ + pip install --no-cache-dir --src /src -cupper-constraints.txt \ + -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ + -e git+https://github.com/openstack/requirements@$OPENSTACK_TAG#egg=openstack_requirements && \ + git clone --depth 1 https://github.com/openstack/os-faults.git -b $OS_FAULTS_TAG /src/os-faults && \ + update-requirements -s --source /src/openstack-requirements /src/os-faults/ && \ + git clone --depth 1 https://github.com/openstack/rally.git -b $RALLY_TAG /src/rally && \ + update-requirements -s --source /src/openstack-requirements /src/rally/ && \ + pip install --no-cache-dir --src /src -cupper-constraints.txt \ + -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ + tempest /src/os-faults && \ + pip install --no-cache-dir --src /src -cupper-constraints.txt \ + -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ + /src/rally -rthirdparty-requirements.txt && \ git clone --depth 1 -b $FDS_TAG https://gerrit.opnfv.org/gerrit/fds /src/fds && \ python3 -m pip install --no-cache-dir --src /src -cupper-constraints.txt \ -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ doctor-tests && \ - rm -r upper-constraints.txt thirdparty-requirements.txt /src/fds/.git && \ + rm -r upper-constraints.txt thirdparty-requirements.txt /src/fds/.git \ + /src/os-faults /src/rally && \ + mkdir -p /etc/rally && \ + printf "[database]\nconnection = 'sqlite:////var/lib/rally/database/rally.sqlite'" > /etc/rally/rally.conf && \ + mkdir -p /var/lib/rally/database && rally db create && \ apk del .build-deps COPY testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml CMD ["run_tests", "-t", "all"] diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py index 14329329..ada11c3a 100644 --- a/functest/opnfv_tests/vnf/epc/juju_epc.py +++ b/functest/opnfv_tests/vnf/epc/juju_epc.py @@ -23,12 +23,14 @@ from functest.utils.constants import CONST import functest.utils.openstack_utils as os_utils import pkg_resources -from snaps.openstack.os_credentials import OSCreds -from snaps.openstack.create_network import (NetworkSettings, - SubnetSettings, OpenStackNetwork) -from snaps.openstack.create_router import (RouterSettings, OpenStackRouter) -from snaps.openstack.create_flavor import (FlavorSettings, OpenStackFlavor) -from snaps.openstack.create_image import (ImageSettings, OpenStackImage) +from snaps.config.flavor import FlavorConfig +from snaps.config.image import ImageConfig +from snaps.config.network import NetworkConfig, SubnetConfig +from snaps.config.router import RouterConfig +from snaps.openstack.create_flavor import OpenStackFlavor +from snaps.openstack.create_image import OpenStackImage +from snaps.openstack.create_network import OpenStackNetwork +from snaps.openstack.create_router import OpenStackRouter from snaps.openstack.utils import keystone_utils import yaml @@ -63,9 +65,7 @@ class JujuEpc(vnf.VnfOnBoarding): ) self.created_object = [] - self.snaps_creds = '' - - self.os_creds = snaps_utils.get_credentials() + self.snaps_creds = snaps_utils.get_credentials() self.details['orchestrator'] = dict( name=get_config("orchestrator.name", config_file), version=get_config("orchestrator.version", config_file), @@ -121,13 +121,6 @@ class JujuEpc(vnf.VnfOnBoarding): "auth_url": os_utils.get_credentials()['auth_url'] } - self.snaps_creds = OSCreds( - username=self.creds['username'], - password=self.creds['password'], - auth_url=self.creds['auth_url'], - project_name=self.creds['tenant'], - identity_api_version=int(os_utils.get_keystone_client_version())) - cloud_data = { 'url': self.public_auth_url, 'pass': self.tenant_name, @@ -153,10 +146,10 @@ class JujuEpc(vnf.VnfOnBoarding): if image_file and image_name: image_creator = OpenStackImage( self.snaps_creds, - ImageSettings(name=image_name, - image_user='cloud', - img_format='qcow2', - image_file=image_file)) + ImageConfig(name=image_name, + image_user='cloud', + img_format='qcow2', + image_file=image_file)) image_creator.create() self.created_object.append(image_creator) @@ -181,11 +174,11 @@ class JujuEpc(vnf.VnfOnBoarding): 'vnf_{}_external_network_name'.format(self.case_name)) self.__logger.info("Creating full network ...") - subnet_settings = SubnetSettings(name=private_subnet_name, - cidr=private_subnet_cidr, - dns_nameservers=dns_nameserver) - network_settings = NetworkSettings(name=private_net_name, - subnet_settings=[subnet_settings]) + subnet_settings = SubnetConfig(name=private_subnet_name, + cidr=private_subnet_cidr, + dns_nameservers=dns_nameserver) + network_settings = NetworkConfig(name=private_net_name, + subnet_settings=[subnet_settings]) network_creator = OpenStackNetwork(self.snaps_creds, network_settings) network_creator.create() self.created_object.append(network_creator) @@ -194,14 +187,14 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.info("Creating network Router ....") router_creator = OpenStackRouter( self.snaps_creds, - RouterSettings( + RouterConfig( name=abot_router, external_gateway=ext_net_name, internal_subnets=[subnet_settings.name])) router_creator.create() self.created_object.append(router_creator) self.__logger.info("Creating Flavor ....") - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.orchestrator['requirements']['flavor']['name'], ram=self.orchestrator['requirements']['flavor']['ram_min'], disk=10, @@ -255,7 +248,7 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.info("Upload VNFD") descriptor = self.vnf['descriptor'] self.__logger.info("Get or create flavor for all Abot-EPC") - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.vnf['requirements']['flavor']['name'], ram=self.vnf['requirements']['flavor']['ram_min'], disk=10,