diff options
Diffstat (limited to 'functest')
-rw-r--r-- | functest/ci/download_images.sh | 3 | ||||
-rw-r--r-- | functest/cli/commands/cli_tier.py | 2 | ||||
-rw-r--r-- | functest/cli/functest-complete.sh | 8 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 2 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/scenario/full/opnfv-gnocchi.yaml | 18 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-gnocchi.yaml | 9 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_base.py | 41 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_ssh.py | 7 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_userdata.py | 2 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/epc/juju_epc.py | 30 | ||||
-rw-r--r-- | functest/tests/unit/openstack/vping/test_vping.py | 38 |
11 files changed, 101 insertions, 59 deletions
diff --git a/functest/ci/download_images.sh b/functest/ci/download_images.sh index d0b302d94..c498b9bcc 100644 --- a/functest/ci/download_images.sh +++ b/functest/ci/download_images.sh @@ -19,4 +19,5 @@ http://cloud.centos.org/altarch/7/images/aarch64/CentOS-7-aarch64-GenericCloud.q https://sourceforge.net/projects/ool-opnfv/files/vyos-1.1.7.img EOF -xz --decompress --force --keep ${1:-/home/opnfv/functest/images}/CentOS-7-aarch64-GenericCloud.qcow2.xz +xz --decompress --force --keep \ + ${1:-/home/opnfv/functest/images}/CentOS-7-aarch64-GenericCloud.qcow2.xz diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py index a035f8551..ad722a1b9 100644 --- a/functest/cli/commands/cli_tier.py +++ b/functest/cli/commands/cli_tier.py @@ -23,7 +23,7 @@ class Tier(object): self.tiers = tier_builder.TierBuilder( env.get('INSTALLER_TYPE'), env.get('DEPLOY_SCENARIO'), - pkg_resources.resource_filename('functest', 'ci/testcases.yaml')) + pkg_resources.resource_filename('xtesting', 'ci/testcases.yaml')) def list(self): summary = "" diff --git a/functest/cli/functest-complete.sh b/functest/cli/functest-complete.sh deleted file mode 100644 index f01490713..000000000 --- a/functest/cli/functest-complete.sh +++ /dev/null @@ -1,8 +0,0 @@ -_functest_completion() { - COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \ - COMP_CWORD=$COMP_CWORD \ - _FUNCTEST_COMPLETE=complete $1 ) ) - return 0 -} - -complete -F _functest_completion -o default functest; diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 248086e15..8048eddeb 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -80,7 +80,7 @@ class RallyBase(testcase.TestCase): TEMP_DIR = os.path.join(RALLY_DIR, "var") RALLY_PRIVATE_NET_NAME = getattr(config.CONF, 'rally_network_name') - RALLY_PRIVATE_SUBNET_NAME = getattr(config.CONF, 'rally_subnet_name') + RALLY_PRIVATE_SUBNET_NAME = str(getattr(config.CONF, 'rally_subnet_name')) RALLY_PRIVATE_SUBNET_CIDR = getattr(config.CONF, 'rally_subnet_cidr') RALLY_ROUTER_NAME = getattr(config.CONF, 'rally_router_name') diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-gnocchi.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-gnocchi.yaml index 8da5142e7..b4487daa0 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-gnocchi.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-gnocchi.yaml @@ -161,3 +161,21 @@ {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} sla: {{ no_failures_sla() }} + + GnocchiResource.create_resource: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} + + GnocchiResource.create_delete_resource: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-gnocchi.yaml b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-gnocchi.yaml index 15185f385..d99b15f81 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-gnocchi.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-gnocchi.yaml @@ -108,3 +108,12 @@ {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} sla: {{ no_failures_sla() }} + + GnocchiResource.create_delete_resource: + - + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + runner: + {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 05fe9b453..4b6e4e97f 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -16,11 +16,14 @@ import time import uuid from snaps.config.flavor import FlavorConfig -from snaps.config.network import NetworkConfig, SubnetConfig +from snaps.config.network import NetworkConfig +from snaps.config.network import 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.tests import openstack_tests -from snaps.openstack.utils import deploy_utils from xtesting.core import testcase from functest.opnfv_tests.openstack.snaps import snaps_utils @@ -85,20 +88,20 @@ class VPingBase(testcase.TestCase): '%Y-%m-%d %H:%M:%S')) image_base_name = '{}-{}'.format( - getattr(config.CONF, 'vping_image_name'), - str(self.guid)) + getattr(config.CONF, 'vping_image_name'), self.guid) os_image_settings = openstack_tests.cirros_image_settings( image_base_name, image_metadata=self.cirros_image_config) self.logger.info("Creating image with name: '%s'", image_base_name) - self.image_creator = deploy_utils.create_image( + self.image_creator = OpenStackImage( self.os_creds, os_image_settings) + self.image_creator.create() self.creators.append(self.image_creator) private_net_name = getattr( config.CONF, 'vping_private_net_name') + self.guid - private_subnet_name = getattr( - config.CONF, 'vping_private_subnet_name') + self.guid + private_subnet_name = str(getattr( + config.CONF, 'vping_private_subnet_name') + self.guid) private_subnet_cidr = getattr(config.CONF, 'vping_private_subnet_cidr') vping_network_type = None @@ -116,29 +119,31 @@ class VPingBase(testcase.TestCase): self.logger.info( "Creating network with name: '%s'", private_net_name) - self.network_creator = deploy_utils.create_network( + subnet_settings = SubnetConfig( + name=private_subnet_name, + cidr=private_subnet_cidr, + dns_nameservers=[env.get('NAMESERVER')]) + self.network_creator = OpenStackNetwork( self.os_creds, NetworkConfig( name=private_net_name, network_type=vping_network_type, physical_network=vping_physical_network, segmentation_id=vping_segmentation_id, - subnet_settings=[SubnetConfig( - name=private_subnet_name, - cidr=private_subnet_cidr, - dns_nameservers=[env.get('NAMESERVER')])])) + subnet_settings=[subnet_settings])) + self.network_creator.create() self.creators.append(self.network_creator) # Creating router to external network - log = "Creating router with name: '%s'" % self.router_name - self.logger.info(log) + self.logger.info("Creating router with name: '%s'", self.router_name) ext_net_name = snaps_utils.get_ext_net_name(self.os_creds) - self.router_creator = deploy_utils.create_router( + self.router_creator = OpenStackRouter( self.os_creds, RouterConfig( name=self.router_name, external_gateway=ext_net_name, - internal_subnets=[private_subnet_name])) + internal_subnets=[subnet_settings.name])) + self.router_creator.create() self.creators.append(self.router_creator) self.logger.info( @@ -187,8 +192,8 @@ class VPingBase(testcase.TestCase): for creator in reversed(self.creators): try: creator.clean() - except Exception as error: # pylint: disable=broad-except - self.logger.error('Unexpected error cleaning - %s', error) + except Exception: # pylint: disable=broad-except + self.logger.exception('Unexpected error cleaning') def _do_vping(self, vm_creator, test_ip): """ diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index 7cdcd2576..93c9c0976 100644 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -9,6 +9,7 @@ """vPingSSH testcase.""" +import logging import time from scp import SCPClient @@ -29,6 +30,7 @@ from functest.utils import config class VPingSSH(vping_base.VPingBase): + # pylint: disable=too-many-instance-attributes """ VPingSSH testcase implementation. @@ -41,6 +43,7 @@ class VPingSSH(vping_base.VPingBase): if "case_name" not in kwargs: kwargs["case_name"] = "vping_ssh" super(VPingSSH, self).__init__(**kwargs) + self.logger = logging.getLogger(__name__) self.kp_name = getattr(config.CONF, 'vping_keypair_name') + self.guid self.kp_priv_file = getattr(config.CONF, 'vping_keypair_priv_file') @@ -120,8 +123,8 @@ class VPingSSH(vping_base.VPingBase): self.creators.append(self.vm2_creator) return self._execute() - except Exception as exc: # pylint: disable=broad-except - self.logger.error('Unexpected error running test - ' + exc.message) + except Exception: # pylint: disable=broad-except + self.logger.exception('Unexpected error running test') return testcase.TestCase.EX_RUN_ERROR def _do_vping(self, vm_creator, test_ip): diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py index 7d9a57c93..c2ff75150 100644 --- a/functest/opnfv_tests/openstack/vping/vping_userdata.py +++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py @@ -9,6 +9,7 @@ """vping_userdata testcase.""" +import logging import time from snaps.config.network import PortConfig @@ -28,6 +29,7 @@ class VPingUserdata(vping_base.VPingBase): if "case_name" not in kwargs: kwargs["case_name"] = "vping_userdata" super(VPingUserdata, self).__init__(**kwargs) + self.logger = logging.getLogger(__name__) def run(self, **kwargs): """ diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py index 1ba883d40..50253ccac 100644 --- a/functest/opnfv_tests/vnf/epc/juju_epc.py +++ b/functest/opnfv_tests/vnf/epc/juju_epc.py @@ -82,7 +82,7 @@ class JujuEpc(vnf.VnfOnBoarding): __logger = logging.getLogger(__name__) - juju_wait_timeout = '3600' + juju_timeout = '3600' def __init__(self, **kwargs): if "case_name" not in kwargs: @@ -287,7 +287,8 @@ class JujuEpc(vnf.VnfOnBoarding): name=image_name, image_user='cloud', img_format='qcow2', image_file=image_file)) image_id = image_creator.create().id - cmd = ['juju', 'metadata', 'generate-image', '-d', '/root', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'metadata', 'generate-image', '-d', '/root', '-i', image_id, '-s', image_name, '-r', self.snaps_creds.region_name, '-u', self.public_auth_url] @@ -295,7 +296,8 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.info("%s\n%s", " ".join(cmd), output) self.created_object.append(image_creator) self.__logger.info("Network ID : %s", net_id) - cmd = ['juju', 'bootstrap', 'abot-epc', 'abot-controller', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'bootstrap', 'abot-epc', 'abot-controller', '--metadata-source', '/root', '--constraints', 'mem=2G', '--bootstrap-series', 'xenial', @@ -334,11 +336,12 @@ class JujuEpc(vnf.VnfOnBoarding): flavor_creator.create() self.created_object.append(flavor_creator) self.__logger.info("Deploying Abot-epc bundle file ...") - cmd = ['juju', 'deploy', '{}'.format(descriptor.get('file_name'))] + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'deploy', '{}'.format(descriptor.get('file_name'))] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) self.__logger.info("Waiting for instances .....") - cmd = ['timeout', '-t', JujuEpc.juju_wait_timeout, 'juju-wait'] + cmd = ['timeout', '-t', JujuEpc.juju_timeout, 'juju-wait'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) self.__logger.info("Deployed Abot-epc on Openstack") @@ -364,12 +367,14 @@ class JujuEpc(vnf.VnfOnBoarding): if not self.check_app(app): return False self.__logger.info("Copying the feature files to Abot_node ") - cmd = ['juju', 'scp', '--', '-r', '-v', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'scp', '--', '-r', '-v', '{}/featureFiles'.format(self.case_dir), 'abot-epc-basic/0:~/'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) self.__logger.info("Copying the feature files in Abot_node ") - cmd = ['juju', 'ssh', 'abot-epc-basic/0', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'ssh', 'abot-epc-basic/0', 'sudo', 'rsync', '-azvv', '~/featureFiles', '/etc/rebaca-test-suite/featureFiles'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) @@ -380,16 +385,18 @@ class JujuEpc(vnf.VnfOnBoarding): """Run test on ABoT.""" start_time = time.time() self.__logger.info("Running VNF Test cases....") - cmd = ['juju', 'run-action', 'abot-epc-basic/0', 'run', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'run-action', 'abot-epc-basic/0', 'run', 'tagnames={}'.format(self.details['test_vnf']['tag_name'])] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) - cmd = ['timeout', '-t', JujuEpc.juju_wait_timeout, 'juju-wait'] + cmd = ['timeout', '-t', JujuEpc.juju_timeout, 'juju-wait'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) duration = time.time() - start_time self.__logger.info("Getting results from Abot node....") - cmd = ['juju', 'scp', '--', '-v', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'scp', '--', '-v', 'abot-epc-basic/0:' '/var/lib/abot-epc-basic/artifacts/TestResults.json', '{}/.'.format(self.res_dir)] @@ -417,7 +424,8 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.debug("%s\n%s", " ".join(cmd), output) if not self.orchestrator['requirements']['preserve_setup']: self.__logger.info("Destroying Orchestrator...") - cmd = ['juju', 'destroy-controller', '-y', 'abot-controller', + cmd = ['timeout', '-t', JujuEpc.juju_timeout, + 'juju', 'destroy-controller', '-y', 'abot-controller', '--destroy-all-models'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output) diff --git a/functest/tests/unit/openstack/vping/test_vping.py b/functest/tests/unit/openstack/vping/test_vping.py index 3aaa4594a..adc0f69a6 100644 --- a/functest/tests/unit/openstack/vping/test_vping.py +++ b/functest/tests/unit/openstack/vping/test_vping.py @@ -60,14 +60,16 @@ class VPingUserdataTesting(unittest.TestCase): 'get_ext_net_name', return_value='foo') def test_vping_userdata(self, *args): # pylint: disable=unused-argument - with mock.patch('snaps.openstack.utils.deploy_utils.create_image', + with mock.patch('snaps.openstack.create_image.OpenStackImage.create', return_value=OpenStackImage(self.os_creds, None)), \ - mock.patch('snaps.openstack.utils.deploy_utils.create_network', - return_value=OpenStackNetwork( - self.os_creds, NetworkConfig(name='foo'))), \ - mock.patch('snaps.openstack.utils.deploy_utils.create_router', - return_value=OpenStackRouter( - self.os_creds, RouterConfig(name='foo'))), \ + mock.patch( + 'snaps.openstack.create_network.OpenStackNetwork.create', + return_value=OpenStackNetwork( + self.os_creds, NetworkConfig(name='foo'))), \ + mock.patch( + 'snaps.openstack.create_router.OpenStackRouter.create', + return_value=OpenStackRouter( + self.os_creds, RouterConfig(name='foo'))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_vm_instance', return_value=OpenStackVmInstance( @@ -133,14 +135,15 @@ class VPingSSHTesting(unittest.TestCase): cidr='10.0.0.1/24', dns_nameservers=[env.get('NAMESERVER')]) - with mock.patch('snaps.openstack.utils.deploy_utils.create_image', + with mock.patch('snaps.openstack.create_image.OpenStackImage.create', return_value=OpenStackImage(self.os_creds, None)), \ - mock.patch('snaps.openstack.utils.deploy_utils.create_network', - return_value=OpenStackNetwork( - self.os_creds, - NetworkConfig( - name='foo', - subnet_settings=[subnet_config]))), \ + mock.patch( + 'snaps.openstack.create_network.OpenStackNetwork.create', + return_value=OpenStackNetwork( + self.os_creds, + NetworkConfig( + name='foo', + subnet_settings=[subnet_config]))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_vm_instance', return_value=OpenStackVmInstance( @@ -153,9 +156,10 @@ class VPingSSHTesting(unittest.TestCase): mock.patch('snaps.openstack.utils.deploy_utils.create_keypair', return_value=OpenStackKeypair( self.os_creds, KeypairConfig(name='foo'))), \ - mock.patch('snaps.openstack.utils.deploy_utils.create_router', - return_value=OpenStackRouter( - self.os_creds, RouterConfig(name='foo'))), \ + mock.patch( + 'snaps.openstack.create_router.OpenStackRouter.create', + return_value=OpenStackRouter( + self.os_creds, RouterConfig(name='foo'))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_security_group', return_value=OpenStackSecurityGroup( |