diff options
Diffstat (limited to 'functest')
38 files changed, 1633 insertions, 592 deletions
diff --git a/functest/ci/config_aarch64_patch.yaml b/functest/ci/config_aarch64_patch.yaml index 37ed406ce..7bdb9e717 100644 --- a/functest/ci/config_aarch64_patch.yaml +++ b/functest/ci/config_aarch64_patch.yaml @@ -2,80 +2,92 @@ os: vmready1: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - vmready2: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - singlevm1: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - singlevm2: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - vping_ssh: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - vping_userdata: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - cinder_test: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - tempest_smoke: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - - neutron-tempest-plugin-api: + tempest_horizon: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - + tempest_neutron: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + tempest_cinder: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + tempest_keystone: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + tempest_heat: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: + /home/opnfv/functest/images/Fedora-Cloud-Base-30-1.2.aarch64.qcow2 + rally_sanity: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img refstack_defcore: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - - patrole: + tempest_full: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + tempest_scenario: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - - vmtp: - image: - /home/opnfv/functest/images/ubuntu-14.04-server-cloudimg-arm64-uefi1.img - - shaker: - image: /home/opnfv/functest/images/shaker-image-arm64.qcow2 - - neutron_trunk: + tempest_slow: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + patrole: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - networking-bgpvpn: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - networking-sfc: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - - barbican: + tempest_barbican: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - - tempest_full: + tempest_neutron_cntt: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - - tempest_scenario: + tempest_cinder_cntt: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - - rally_sanity: + tempest_keystone_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + tempest_heat_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: + /home/opnfv/functest/images/Fedora-Cloud-Base-30-1.2.aarch64.qcow2 + rally_sanity_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + tempest_full_cntt: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + tempest_scenario_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + tempest_slow_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + image_alt: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img rally_full: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - rally_jobs: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - - tempest: - use_custom_flavors: 'True' + rally_full_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img + rally_jobs_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img diff --git a/functest/ci/config_patch.yaml b/functest/ci/config_patch.yaml index 1287d92a5..0256d6d4d 100644 --- a/functest/ci/config_patch.yaml +++ b/functest/ci/config_patch.yaml @@ -1,4 +1,151 @@ --- +gsma: + tempest_smoke: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_horizon: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_neutron: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_cinder: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_keystone: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_heat: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + rally_sanity: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + refstack_defcore: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_full: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_scenario: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_slow: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + patrole: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + networking-bgpvpn: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + networking-sfc: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_barbican: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_neutron_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_cinder_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_keystone_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_heat_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + rally_sanity_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_full_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_scenario_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + tempest_slow_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + rally_full: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + rally_jobs: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + vmtp: + flavor_ram: 2048 + flavor_vcpus: 1 + flavor_disk: 40 + shaker: + flavor_ram: 2048 + flavor_vcpus: 1 + flavor_disk: 40 + rally_full_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + rally_jobs_cntt: + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + cloudify: + flavor_ram: 4096 + flavor_vcpus: 2 + flavor_disk: 40 + cloudify_ims: + flavor_ram: 4096 + flavor_vcpus: 2 + flavor_disk: 40 + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + heat_ims: + flavor_ram: 2048 + flavor_vcpus: 1 + flavor_disk: 40 + vyos_vrouter: + flavor_ram: 4096 + flavor_vcpus: 2 + flavor_disk: 40 + flavor_alt_ram: 2048 + flavor_alt_vcpus: 1 + flavor_alt_disk: 40 + juju_epc: + flavor_ram: 2048 + flavor_vcpus: 1 + flavor_disk: 40 + flavor_alt_ram: 4096 + flavor_alt_vcpus: 2 + flavor_alt_disk: 40 + fdio: vmready1: flavor_ram: 1024 @@ -16,34 +163,62 @@ fdio: flavor_ram: 1024 tempest_smoke: flavor_ram: 1024 - neutron-tempest-plugin-api: + tempest_horizon: + flavor_ram: 1024 + tempest_neutron: + flavor_ram: 1024 + tempest_cinder: + flavor_ram: 1024 + tempest_keystone: + flavor_ram: 1024 + tempest_heat: + flavor_ram: 1024 + rally_sanity: flavor_ram: 1024 refstack_defcore: flavor_ram: 1024 - patrole: + tempest_full: flavor_ram: 1024 - vmtp: - flavor_ram: 2048 - shaker: + tempest_scenario: + flavor_ram: 1024 + tempest_slow: flavor_ram: 1024 - neutron_trunk: + patrole: flavor_ram: 1024 networking-bgpvpn: flavor_ram: 1024 networking-sfc: flavor_ram: 1024 - barbican: + tempest_barbican: flavor_ram: 1024 - tempest_full: + tempest_neutron_cntt: flavor_ram: 1024 - tempest_scenario: + tempest_cinder_cntt: flavor_ram: 1024 - rally_sanity: + tempest_keystone_cntt: + flavor_ram: 1024 + tempest_heat_cntt: + flavor_ram: 1024 + rally_sanity_cntt: + flavor_ram: 1024 + tempest_full_cntt: + flavor_ram: 1024 + tempest_scenario_cntt: + flavor_ram: 1024 + tempest_slow_cntt: flavor_ram: 1024 rally_full: flavor_ram: 1024 rally_jobs: flavor_ram: 1024 + vmtp: + flavor_ram: 2048 + shaker: + flavor_ram: 1024 + rally_full_cntt: + flavor_ram: 1024 + rally_jobs_cntt: + flavor_ram: 1024 ovs: vmready1: @@ -62,34 +237,62 @@ ovs: flavor_ram: 1024 tempest_smoke: flavor_ram: 1024 - neutron-tempest-plugin-api: + tempest_horizon: + flavor_ram: 1024 + tempest_neutron: + flavor_ram: 1024 + tempest_cinder: + flavor_ram: 1024 + tempest_keystone: + flavor_ram: 1024 + tempest_heat: + flavor_ram: 1024 + rally_sanity: flavor_ram: 1024 refstack_defcore: flavor_ram: 1024 - patrole: + tempest_full: flavor_ram: 1024 - vmtp: - flavor_ram: 2048 - shaker: + tempest_scenario: flavor_ram: 1024 - neutron_trunk: + tempest_slow: + flavor_ram: 1024 + patrole: flavor_ram: 1024 networking-bgpvpn: flavor_ram: 1024 networking-sfc: flavor_ram: 1024 - barbican: + tempest_barbican: flavor_ram: 1024 - tempest_full: + tempest_neutron_cntt: flavor_ram: 1024 - tempest_scenario: + tempest_cinder_cntt: flavor_ram: 1024 - rally_sanity: + tempest_keystone_cntt: + flavor_ram: 1024 + tempest_heat_cntt: + flavor_ram: 1024 + rally_sanity_cntt: + flavor_ram: 1024 + tempest_full_cntt: + flavor_ram: 1024 + tempest_scenario_cntt: + flavor_ram: 1024 + tempest_slow_cntt: flavor_ram: 1024 rally_full: flavor_ram: 1024 rally_jobs: flavor_ram: 1024 + vmtp: + flavor_ram: 2048 + shaker: + flavor_ram: 1024 + rally_full_cntt: + flavor_ram: 1024 + rally_jobs_cntt: + flavor_ram: 1024 vio: vmready1: @@ -118,29 +321,56 @@ vio: image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_alt_format: vmdk - neutron-tempest-plugin-api: + tempest_horizon: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_alt_format: vmdk + tempest_neutron: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk + tempest_cinder: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk + tempest_keystone: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk + tempest_heat: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + image_alt: + /home/opnfv/functest/images/Fedora-Cloud-Base-30-1.2.x86_64.vmdk + image_alt_format: vmdk + rally_sanity: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk refstack_defcore: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_alt_format: vmdk - patrole: + tempest_full: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_alt_format: vmdk - vmtp: - image: - /home/opnfv/functest/images/ubuntu-14.04-server-cloudimg-amd64-disk1.vmdk + tempest_scenario: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk - shaker: - image: /home/opnfv/functest/images/shaker-image.vmdk + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk + tempest_slow: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk - neutron_trunk: + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk + patrole: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk @@ -155,30 +385,69 @@ vio: image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_alt_format: vmdk - barbican: + tempest_barbican: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_alt_format: vmdk - tempest_full: + tempest_neutron_cntt: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_alt_format: vmdk - tempest_scenario: + tempest_cinder_cntt: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_alt_format: vmdk - rally_sanity: + tempest_keystone_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk + tempest_heat_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + image_alt: + /home/opnfv/functest/images/Fedora-Cloud-Base-30-1.2.x86_64.vmdk + image_alt_format: vmdk + rally_sanity_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + tempest_full_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk + tempest_scenario_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk + tempest_slow_cntt: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk + image_alt: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_alt_format: vmdk rally_full: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk rally_jobs: image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk image_format: vmdk + vmtp: + image: + /home/opnfv/functest/images/ubuntu-14.04-server-cloudimg-amd64-disk1.vmdk + image_format: vmdk + shaker: + image: /home/opnfv/functest/images/shaker-image.vmdk + image_format: vmdk + rally_full_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk + rally_jobs_cntt: + image: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.vmdk + image_format: vmdk cloudify: image: /home/opnfv/functest/images/ubuntu-16.04-server-cloudimg-amd64-disk1.vmdk diff --git a/functest/ci/download_images.sh b/functest/ci/download_images.sh index 9612f85b2..19ab4ee7e 100644 --- a/functest/ci/download_images.sh +++ b/functest/ci/download_images.sh @@ -10,9 +10,9 @@ http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-aarch64-disk.img -https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-arm64-uefi1.img http://repository.cloudifysource.org/cloudify/19.01.24/community-release/cloudify-docker-manager-community-19.01.24.tar http://testresults.opnfv.org/functest/vyos-1.1.8-amd64.qcow2 -http://testresults.opnfv.org/functest/shaker-image.qcow2 -http://testresults.opnfv.org/functest/shaker-image-arm64.qcow2 +http://testresults.opnfv.org/functest/shaker-image-1.3.0+stretch.qcow2 +https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Cloud/x86_64/images/Fedora-Cloud-Base-30-1.2.x86_64.qcow2 +https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Cloud/aarch64/images/Fedora-Cloud-Base-30-1.2.aarch64.qcow2 EOF diff --git a/functest/ci/logging.debug.ini b/functest/ci/logging.debug.ini index 51ee359c6..d7a361df0 100644 --- a/functest/ci/logging.debug.ini +++ b/functest/ci/logging.debug.ini @@ -100,7 +100,7 @@ args=(sys.stdout,) [handler_file] class=FileHandler -level=DEBUG +level=INFO formatter=standard args=("/home/opnfv/functest/results/functest.log",) diff --git a/functest/ci/logging.ini b/functest/ci/logging.ini index 278529e22..dde079493 100644 --- a/functest/ci/logging.ini +++ b/functest/ci/logging.ini @@ -1,5 +1,5 @@ [loggers] -keys=root,functest,api,ci,core,cli,opnfv_tests,utils,xtesting,xci,xcore,energy,xutils,sfc,baro,warnings +keys=root,functest,api,ci,core,cli,opnfv_tests,utils,xtesting,xci,xcore,xutils,sfc,baro,warnings [handlers] keys=console,wconsole,file,null @@ -61,11 +61,6 @@ level=NOTSET handlers=console qualname=xtesting.core -[logger_energy] -level=NOTSET -handlers=wconsole -qualname=xtesting.energy - [logger_xutils] level=NOTSET handlers=wconsole @@ -106,7 +101,7 @@ args=(sys.stdout,) [handler_file] class=FileHandler -level=DEBUG +level=INFO formatter=standard args=("/home/opnfv/functest/results/functest.log",) diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 5cb5a56fd..17a478df0 100644 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -2,7 +2,6 @@ tiers: - name: healthcheck - order: 0 description: >- First tier to be executed to verify the basic operations in the VIM. @@ -28,6 +27,8 @@ tiers: It creates and configures all tenant network ressources required by advanced testcases (subnet, network and router). + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: tenantnetwork1 @@ -40,6 +41,8 @@ tiers: It creates new user/project before creating and configuring all tenant network ressources required by a testcase (subnet, network and router). + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: tenantnetwork2 @@ -163,14 +166,28 @@ tiers: option: - '--concurrency=4' + - + case_name: tempest_horizon + project_name: functest + criteria: 100 + blocking: false + description: >- + This test case runs the Tempest suite proposed by the + Horizon project. + dependencies: + - DASHBOARD_URL: '^(?!\s*$).+' + run: + name: tempest_horizon + args: + mode: '^tempest_horizon.' + - name: smoke - order: 1 description: >- Set of basic Functional tests to validate the OPNFV scenarios. testcases: - - case_name: neutron-tempest-plugin-api + case_name: tempest_neutron project_name: functest criteria: 100 blocking: false @@ -187,6 +204,52 @@ tiers: - '--concurrency=4' - + case_name: tempest_cinder + project_name: functest + criteria: 100 + blocking: false + description: >- + This test case runs the Tempest suite proposed by the + Cinder project. + run: + name: tempest_common + args: + mode: + '(?!.*test_incremental_backup)(^cinder_tempest_plugin.)' + option: + - '--concurrency=4' + + - + case_name: tempest_keystone + project_name: functest + criteria: 100 + blocking: false + description: >- + This test case runs the Tempest suite proposed by the + Keystone project. + run: + name: tempest_common + args: + mode: 'keystone_tempest_plugin.' + option: + - '--concurrency=4' + + - + case_name: tempest_heat + project_name: functest + criteria: 100 + blocking: false + description: >- + This test case runs the Tempest suite proposed by the + Heat project. + run: + name: tempest_heat + args: + mode: '^heat_tempest_plugin.tests' + option: + - '--concurrency=1' + + - case_name: rally_sanity project_name: functest criteria: 100 @@ -206,6 +269,7 @@ tiers: criteria: 100 blocking: false deny_skipping: true + tests_count: 219 description: >- This test case runs a sub group of tests of the OpenStack Defcore testcases. @@ -243,13 +307,30 @@ tiers: the OpenStack deployment. https://github.com/openstack/tempest/blob/18.0.0/tox.ini#L84 run: - name: tempest_scenario + name: tempest_common args: mode: '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)' option: - '--concurrency=1' - + case_name: tempest_slow + project_name: functest + criteria: 100 + blocking: false + description: >- + The list of test cases is generated by + Tempest automatically and depends on the parameters of + the OpenStack deployment. + https://github.com/openstack/tempest/blob/18.0.0/tox.ini#L84 + run: + name: tempest_common + args: + mode: '(?=.*\[.*\bslow\b.*\])(^tempest\.)' + option: + - '--concurrency=1' + + - case_name: patrole project_name: functest criteria: 100 @@ -270,24 +351,6 @@ tiers: - 'test_list_metadef_namespaces' - - case_name: neutron_trunk - project_name: functest - criteria: 100 - blocking: false - description: >- - This test case runs the neutron trunk subtest of the - OpenStack Tempest suite. The list of test cases is - generated by Tempest having as input the relevant - testcase list file. - run: - name: tempest_common - args: - mode: 'neutron_tempest_plugin.(api|scenario).test_trunk' - neutron_extensions: - - trunk - - trunk-details - - - case_name: networking-bgpvpn project_name: functest criteria: 100 @@ -303,7 +366,7 @@ tiers: neutron_extensions: - bgpvpn option: - - '--concurrency=4' + - '--concurrency=3' - case_name: networking-sfc @@ -325,7 +388,7 @@ tiers: - '--concurrency=0' - - case_name: barbican + case_name: tempest_barbican project_name: functest criteria: 100 blocking: false @@ -339,10 +402,283 @@ tiers: '^barbican_tempest_plugin.((?!test_signed_image_upload_boot_failure).)*$' services: - barbican + option: + - '--concurrency=4' + + - + name: smoke_cntt + description: >- + Set of basic Functional tests to validate the OPNFV scenarios. + testcases: + - + case_name: tempest_neutron_cntt + project_name: functest + criteria: 100 + blocking: false + deny_skipping: true + tests_count: 478 + description: >- + This test case runs the Tempest suite proposed by the + Neutron project. The list of test cases is generated by + Tempest automatically and depends on the parameters of + the OpenStack deployment. + run: + name: tempest_common + args: + mode: "(?!.*admin.test_agent_availability_zone)\ + (?!.*admin.test_dhcp_agent_scheduler)\ + (?!.*admin.test_l3_agent_scheduler)\ + (?!.*admin.test_logging)\ + (?!.*admin.test_logging_negative)\ + (?!.*admin.test_network_segment_range)\ + (?!.*admin.test_ports.PortTestCasesAdmin.test_regenerate_mac_address)\ + (?!.*admin.test_ports.PortTestCasesResourceRequest)\ + (?!.*admin.test_routers_dvr)\ + (?!.*admin.test_routers_flavors)\ + (?!.*admin.test_routers_ha)\ + (?!.*test_conntrack_helper)\ + (?!.*test_floating_ips.FloatingIPPoolTestJSON)\ + (?!.*test_floating_ips.FloatingIPTestJSON.test_create_update_floatingip_port_details)\ + (?!.*test_metering_extensions)\ + (?!.*test_metering_negative)\ + (?!.*test_networks.NetworksSearchCriteriaTest.test_list_validation_filters)\ + (?!.*test_networks.NetworksTestAdmin.test_create_tenant_network_vxlan)\ + (?!.*test_networks.NetworksTestJSON.test_create_update_network_dns_domain)\ + (?!.*test_ports.PortsTestJSON.test_create_port_with_propagate_uplink_status)\ + (?!.*test_ports.PortsTestJSON.test_create_port_without_propagate_uplink_status)\ + (?!.*test_ports.PortsTestJSON.test_create_update_port_with_dns_domain)\ + (?!.*test_ports.PortsTestJSON.test_create_update_port_with_dns_name)\ + (?!.*test_ports.PortsTestJSON.test_create_update_port_with_no_dns_name)\ + (?!.*test_qos.QosMinimumBandwidthRuleTestJSON)\ + (?!.*test_revisions.TestRevisions.test_update_dns_domain_bumps_revision)\ + (?!.*test_revisions.TestRevisions.test_update_router_extra_attributes_bumps_revision)\ + (?!.*test_router_interface_fip)\ + (?!.*test_routers.DvrRoutersTest)\ + (?!.*test_routers.HaRoutersTest)\ + (?!.*test_routers.RoutersIpV6Test.test_extra_routes_atomic)\ + (?!.*test_routers.RoutersTest.test_extra_routes_atomic)\ + (?!.*test_routers_negative.DvrRoutersNegativeTest)\ + (?!.*test_routers_negative.DvrRoutersNegativeTestExtended)\ + (?!.*test_routers_negative.HaRoutersNegativeTest)\ + (?!.*test_security_groups.RbacSharedSecurityGroupTest)\ + (?!.*test_subnetpools.SubnetPoolsSearchCriteriaTest.test_list_validation_filters)\ + (?!.*test_subnets.SubnetsSearchCriteriaTest.test_list_validation_filters)\ + (?!.*test_timestamp.TestTimeStamp.test_segment_with_timestamp)\ + (?!.*test_trunk.TrunkTestInheritJSONBase.test_add_subport)\ + (?!.*test_trunk.TrunkTestMtusJSON)\ + (?!.*test_trunk_negative.TrunkTestJSON.test_create_subport_invalid_inherit_network_segmentation_type)\ + (?!.*test_trunk_negative.TrunkTestMtusJSON)\ + (^neutron_tempest_plugin.api)" + option: + - '--concurrency=4' + + - + case_name: tempest_cinder_cntt + project_name: functest + criteria: 100 + blocking: false + deny_skipping: true + tests_count: 7 + description: >- + This test case runs the Tempest suite proposed by the + Cinder project. + run: + name: tempest_common + args: + mode: "(?!.*test_incremental_backup)\ + (?!.*test_consistencygroups)\ + (^cinder_tempest_plugin.)" + option: + - '--concurrency=4' + + - + case_name: tempest_keystone_cntt + project_name: functest + criteria: 100 + blocking: false + deny_skipping: true + tests_count: 27 + description: >- + This test case runs the Tempest suite proposed by the + Keystone project. + run: + name: tempest_common + args: + mode: "(?!.*api.identity.v3.test_oauth1_tokens)\ + (?!.*scenario.test_federated_authentication)\ + keystone_tempest_plugin." + option: + - '--concurrency=4' + + - + case_name: tempest_heat_cntt + project_name: functest + criteria: 100 + blocking: false + deny_skipping: true + tests_count: 112 + description: >- + This test case runs the Tempest suite proposed by the + Heat project. + run: + name: tempest_heat + args: + mode: "(?!.*functional.test_lbaasv2)\ + (?!.*functional.test_encryption_vol_type)\ + (?!.*functional.test_remote_stack.RemoteStackTest)\ + (?!.*RemoteStackTest.test_stack_create_with_cloud_credential)\ + (?!.*scenario.test_aodh_alarm)\ + (?!.*tests.scenario.test_autoscaling_lb)\ + (?!.*scenario.test_autoscaling_lbv2)\ + (?!.*scenario.test_remote_deeply_nested.RemoteDeeplyNestedStackTest)\ + (?!.*scenario.test_server_software_config)\ + (?!.*test_volumes.VolumeBackupRestoreIntegrationTest)\ + (?!.*scenario.test_octavia_lbaas)\ + (?!.*scenario.test_server_cfn_init)\ + ^heat_tempest_plugin.tests" + option: + - '--concurrency=1' + + - + case_name: rally_sanity_cntt + project_name: functest + criteria: 100 + blocking: false + description: >- + This test case runs a sub group of tests of the OpenStack + Rally suite in smoke mode. + run: + name: rally_sanity + args: + tests: + - 'authenticate' + - 'glance' + - 'cinder' + - 'heat' + - 'keystone' + - 'neutron' + - 'nova' + - 'quotas' + - 'swift' + + - + case_name: tempest_full_cntt + project_name: functest + criteria: 100 + blocking: false + deny_skipping: true + tests_count: 1280 + description: >- + The list of test cases is generated by + Tempest automatically and depends on the parameters of + the OpenStack deployment. + https://github.com/openstack/tempest/blob/18.0.0/tox.ini#L83 + run: + name: tempest_common + args: + mode: "(?!.*test_fixed_ips)\ + (?!.*test_fixed_ips_negative)\ + (?!.*test_auto_allocate_network)(?!.*test_floating_ips_bulk)\ + (?!.*test_flavors_microversions.FlavorsV255TestJSON)\ + (?!.*test_flavors_microversions.FlavorsV261TestJSON)\ + (?!.*test_live_migration.LiveAutoBlockMigrationV225Test.test_iscsi_volume)\ + (?!.*test_live_migration.LiveAutoBlockMigrationV225Test.test_volume_backed_live_migration)\ + (?!.*test_live_migration.LiveMigrationTest.test_iscsi_volume)\ + (?!.*test_live_migration.LiveMigrationTest.test_volume_backed_live_migration)\ + (?!.*test_live_migration.LiveMigrationRemoteConsolesV26Test)\ + (?!.*test_quotas.QuotasAdminTestV257)\ + (?!.*certificates.test_certificates)\ + (?!.*test_quotas_negative.QuotasSecurityGroupAdminNegativeTest)\ + (?!.*test_novnc)(?!.*test_server_personality)\ + (?!.*test_servers.ServerShowV263Test.test_show_update_rebuild_list_server)\ + (?!.*test_servers_microversions.ServerShowV254Test)\ + (?!.*test_servers_microversions.ServerShowV257Test)\ + (?!.*test_servers_negative.ServersNegativeTestJSON.test_personality_file_contents_not_encoded)\ + (?!.*servers.test_virtual_interfaces)\ + (?!.*test_server_actions.ServerActionsTestJSON.test_change_server_password)\ + (?!.*test_server_actions.ServerActionsTestJSON.test_get_vnc_console)\ + (?!.*test_server_actions.ServerActionsTestJSON.test_reboot_server_soft)\ + (?!.*test_security_group_default_rules)\ + (?!.*test_security_groups_negative.SecurityGroupsNegativeTestJSON.test_security_group_create_with_duplicate_name)\ + (?!.*test_security_groups_negative.SecurityGroupsNegativeTestJSON.test_security_group_create_with_invalid_group_description)\ + (?!.*test_security_groups_negative.SecurityGroupsNegativeTestJSON.test_security_group_create_with_invalid_group_name)\ + (?!.*test_security_groups_negative.SecurityGroupsNegativeTestJSON.test_update_security_group_with_invalid_sg_des)\ + (?!.*test_security_groups_negative.SecurityGroupsNegativeTestJSON.test_update_security_group_with_invalid_sg_id)\ + (?!.*test_security_groups_negative.SecurityGroupsNegativeTestJSON.test_update_security_group_with_invalid_sg_name)\ + (?!.*test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filtered_by_ip_regex)\ + (?!.*compute.test_virtual_interfaces)(?!.*compute.test_virtual_interfaces_negative)\ + (?!.*compute.test_networks)\ + (?!.*test_attach_volume.AttachVolumeMultiAttach)\ + (?!.*identity.admin.v2)(?!.*identity.v2)\ + (?!.*image.v1)\ + (?!.*admin.test_dhcp_agent_scheduler)\ + (?!.*admin.test_routers_dvr)\ + (?!.*test_metering_extensions)(?!.*network.test_tags)\ + (?!.*test_routers_negative.DvrRoutersNegativeTest)\ + (?!.*test_routers.RoutersIpV6Test.test_create_router_set_gateway_with_fixed_ip)\ + (?!.*test_routers.RoutersTest.test_create_router_set_gateway_with_fixed_ip)\ + (?!.*test_group_snapshots.GroupSnapshotsV319Test.test_reset_group_snapshot_status)\ + (?!.*test_multi_backend)\ + (?!.*test_snapshot_manage)\ + (?!.*test_volume_retype.VolumeRetypeWithMigrationTest)\ + (?!.*test_volume_delete_cascade.VolumesDeleteCascade.test_volume_from_snapshot_cascade_delete)\ + (?!.*test_volumes_backup.VolumesBackupsTest.test_volume_backup_create_get_detailed_list_restore_delete)\ + (?!.*test_volumes_extend.VolumesExtendAttachedTest.test_extend_attached_volume)\ + (?!.*\\[.*\\bslow\\b.*\\])(^tempest.api)" + option: + - '--concurrency=4' + + - + case_name: tempest_scenario_cntt + project_name: functest + criteria: 100 + blocking: false + deny_skipping: true + tests_count: 9 + description: >- + The list of test cases is generated by + Tempest automatically and depends on the parameters of + the OpenStack deployment. + https://github.com/openstack/tempest/blob/18.0.0/tox.ini#L84 + run: + name: tempest_common + args: + mode: "\ + (?!.*test_volume_boot_pattern.TestVolumeBootPattern.test_boot_server_from_encrypted_volume_luks)\ + (?!.*\\[.*\\bslow\\b.*\\])(^tempest.scenario)" + option: + - '--concurrency=1' + + - + case_name: tempest_slow_cntt + project_name: functest + criteria: 100 + blocking: false + deny_skipping: true + tests_count: 43 + description: >- + The list of test cases is generated by + Tempest automatically and depends on the parameters of + the OpenStack deployment. + https://github.com/openstack/tempest/blob/18.0.0/tox.ini#L84 + run: + name: tempest_common + args: + mode: "(?!.*test_volume_swap)\ + (?!.*test_server_personality)\ + (?!.*test_container_sync.ContainerSyncTest.test_container_synchronization)\ + (?!.*test_container_sync_middleware.ContainerSyncMiddlewareTest.test_container_synchronization)\ + (?!.*test_encrypted_cinder_volumes)\ + (?!.*test_minbw_allocation_placement)\ + (?!.*test_network_basic_ops.TestNetworkBasicOps.test_router_rescheduling)\ + (?!.*test_stamp_pattern.TestStampPattern.test_stamp_pattern)\ + (?!.*test_volume_migrate_attached)\ + (?=.*\\[.*\\bslow\\b.*\\])(^tempest.)" + option: + - '--concurrency=1' - name: benchmarking - order: 2 description: >- Run several OpenStack performance tools https://docs.openstack.org/performance-docs/latest/methodologies/tools.html @@ -369,6 +705,8 @@ tiers: description: >- This test case runs a group of Rally jobs used in OpenStack gating + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: rally_jobs args: @@ -385,7 +723,7 @@ tiers: perform ping connectivity, round trip time measurement (latency) and TCP/UDP throughput dependencies: - - POD_ARCH: '^(?!aarch64$)' + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: vmtp @@ -399,87 +737,55 @@ tiers: like iperf, iperf3 and netperf (with help of flent). Shaker is able to deploy OpenStack instances and networks in different topologies. + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: shaker - - name: features - order: 3 + name: benchmarking_cntt description: >- - Test suites from feature projects - integrated in functest + Run several OpenStack performance tools + https://docs.openstack.org/performance-docs/latest/methodologies/tools.html testcases: - - case_name: doctor-notification - project_name: doctor + case_name: rally_full_cntt + project_name: functest criteria: 100 blocking: false description: >- - Test suite from Doctor project. - dependencies: - - INSTALLER_TYPE: '(apex)|(fuel)|(daisy)' - - DEPLOY_SCENARIO: '^((?!fdio|nofeature).)*$' + This test case runs the full suite of scenarios of the + OpenStack Rally suite using several threads and iterations. run: - name: bashfeature + name: rally_full args: - cmd: 'doctor-test' + tests: + - 'authenticate' + - 'glance' + - 'cinder' + - 'heat' + - 'keystone' + - 'neutron' + - 'nova' + - 'quotas' + - 'swift' - - case_name: functest-odl-sfc - project_name: sfc - criteria: 100 - blocking: false - description: >- - Test suite for odl-sfc to test two chains with one SF and - one chain with two SFs - dependencies: - - DEPLOY_SCENARIO: 'odl.*sfc' - run: - name: functest-odl-sfc - - - - case_name: barometercollectd - project_name: barometer - enabled: false - criteria: 100 - blocking: false - description: >- - Test suite for the Barometer project. Separate tests verify - the proper configuration and basic functionality of all the - collectd plugins as described in the Project Release Plan - dependencies: - - DEPLOY_SCENARIO: 'bar' - run: - name: barometercollectd - - - - case_name: vgpu + case_name: rally_jobs_cntt project_name: functest criteria: 100 blocking: false description: >- - Test suite for the OpenStack vGPU feature - dependencies: - - DEPLOY_SCENARIO: 'vgpu' - run: - name: vgpu - - - - case_name: stor4nfv_os - project_name: stor4nfv - criteria: 100 - blocking: false - description: >- - This tests are necessary demonstrate conformance - of the OpenStack+Stor4NFV deployment. - dependencies: - - DEPLOY_SCENARIO: 'stor4nfv' + This test case runs a group of Rally jobs used in + OpenStack gating run: - name: stor4nfv_os + name: rally_jobs + args: + tests: + - 'neutron' - name: vnf - order: 4 description: >- Collection of VNF test cases. testcases: @@ -502,7 +808,7 @@ tiers: Clearwater using the Cloudify orchestrator. It also runs some signaling traffic. dependencies: - - DEPLOY_SCENARIO: 'os-.*-nofeature-.*ha' + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: cloudify_ims @@ -515,6 +821,8 @@ tiers: This test case deploys an OpenSource vIMS solution from Clearwater using the OpenStack Heat orchestrator. It also runs some signaling traffic. + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: heat_ims @@ -525,6 +833,8 @@ tiers: blocking: false description: >- This test case is vRouter testing. + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: vyos_vrouter @@ -536,5 +846,7 @@ tiers: description: >- vEPC validation with Juju as VNF manager and ABoT as test executor. + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: juju_epc diff --git a/functest/core/cloudify.py b/functest/core/cloudify.py index 21bfc937e..9e80f4b60 100644 --- a/functest/core/cloudify.py +++ b/functest/core/cloudify.py @@ -74,10 +74,11 @@ class Cloudify(singlevm.SingleVm2): "--cap-add SYS_ADMIN --network=host {}".format( os.path.basename(self.cloudify_archive), self.cloudify_container)) - self.__logger.debug("output:\n%s", stdout.read()) - self.__logger.debug("error:\n%s", stderr.read()) + self.__logger.debug("output:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("error:\n%s", stderr.read().decode("utf-8")) self.cfy_client = CloudifyClient( - host=self.fip.floating_ip_address, + host=self.fip.floating_ip_address if self.fip else ( + self.sshvm.public_v4), username='admin', password='admin', tenant='default_tenant') self.__logger.info("Attemps running status of the Manager") secret_key = "foo" @@ -124,8 +125,8 @@ class Cloudify(singlevm.SingleVm2): "cfy_manager_local:/etc/cloudify/ && " "sudo docker exec cfy_manager_local " "chmod 444 /etc/cloudify/cloudify_ims.pem") - self.__logger.debug("output:\n%s", stdout.read()) - self.__logger.debug("error:\n%s", stderr.read()) + self.__logger.debug("output:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("error:\n%s", stderr.read().decode("utf-8")) def upload_cfy_plugins(self, yaml, wgn): """Upload Cloudify plugins""" @@ -133,8 +134,8 @@ class Cloudify(singlevm.SingleVm2): "sudo docker exec cfy_manager_local " "cfy plugins upload -y {} {} && " "sudo docker exec cfy_manager_local cfy status".format(yaml, wgn)) - self.__logger.debug("output:\n%s", stdout.read()) - self.__logger.debug("error:\n%s", stderr.read()) + self.__logger.debug("output:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("error:\n%s", stderr.read().decode("utf-8")) def kill_existing_execution(self, dep_name): """kill existing execution""" diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py index 1da30de34..6d92e6eef 100644 --- a/functest/core/singlevm.py +++ b/functest/core/singlevm.py @@ -212,12 +212,14 @@ class VmReady1(tenantnetwork.TenantNetwork1): vm1 = self.cloud.create_server( name if name else '{}-vm_{}'.format(self.case_name, self.guid), image=self.image.id, flavor=self.flavor.id, - auto_ip=False, network=self.network.id, + auto_ip=False, + network=self.network.id if self.network else env.get( + "EXTERNAL_NETWORK"), timeout=self.create_server_timeout, wait=True, **kwargs) self.__logger.debug("vm: %s", vm1) return vm1 - def check_regex_in_console(self, name, regex=' login: ', loop=1): + def check_regex_in_console(self, name, regex=' login: ', loop=6): """Wait for specific message in console Returns: True or False on errors @@ -257,6 +259,23 @@ class VmReady1(tenantnetwork.TenantNetwork1): self.__logger.debug( "Orphan security group %s in use", sec_group.id) + def count_hypervisors(self): + """Count hypervisors.""" + if env.get('SKIP_DOWN_HYPERVISORS').lower() == 'false': + return len(self.orig_cloud.list_hypervisors()) + return self.count_active_hypervisors() + + def count_active_hypervisors(self): + """Count all hypervisors which are up.""" + compute_cnt = 0 + for hypervisor in self.orig_cloud.list_hypervisors(): + if hypervisor['state'] == 'up': + compute_cnt += 1 + else: + self.__logger.warning( + "%s is down", hypervisor['hypervisor_hostname']) + return compute_cnt + def run(self, **kwargs): """Boot the new VM @@ -351,6 +370,8 @@ class SingleVm1(VmReady1): ssh_connect_timeout = 1 ssh_connect_loops = 6 create_floating_ip_timeout = 120 + check_console_loop = 6 + check_console_regex = ' login: ' def __init__(self, **kwargs): if "case_name" not in kwargs: @@ -398,10 +419,12 @@ class SingleVm1(VmReady1): - None on error """ assert vm1 - fip = self.cloud.create_floating_ip( - network=self.ext_net.id, server=vm1, wait=True, - timeout=self.create_floating_ip_timeout) - self.__logger.debug("floating_ip: %s", fip) + fip = None + if env.get('NO_TENANT_NETWORK').lower() != 'true': + fip = self.cloud.create_floating_ip( + network=self.ext_net.id, server=vm1, wait=True, + timeout=self.create_floating_ip_timeout) + self.__logger.debug("floating_ip: %s", fip) ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy()) for loop in range(self.ssh_connect_loops): @@ -409,7 +432,7 @@ class SingleVm1(VmReady1): p_console = self.cloud.get_server_console(vm1) self.__logger.debug("vm console: \n%s", p_console) ssh.connect( - fip.floating_ip_address, + fip.floating_ip_address if fip else vm1.public_v4, username=getattr( config.CONF, '{}_image_user'.format(self.case_name), self.username), @@ -422,7 +445,7 @@ class SingleVm1(VmReady1): except Exception as exc: # pylint: disable=broad-except self.__logger.debug( "try %s: cannot connect to %s: %s", loop + 1, - fip.floating_ip_address, exc) + fip.floating_ip_address if fip else vm1.public_v4, exc) time.sleep(9) else: self.__logger.error( @@ -438,8 +461,8 @@ class SingleVm1(VmReady1): Returns: echo exit codes """ (_, stdout, stderr) = self.ssh.exec_command('echo Hello World') - self.__logger.debug("output:\n%s", stdout.read()) - self.__logger.debug("error:\n%s", stderr.read()) + self.__logger.debug("output:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("error:\n%s", stderr.read().decode("utf-8")) return stdout.channel.recv_exit_status() def run(self, **kwargs): @@ -464,10 +487,13 @@ class SingleVm1(VmReady1): self.prepare() self.sshvm = self.boot_vm( key_name=self.keypair.id, security_groups=[self.sec.id]) - (self.fip, self.ssh) = self.connect(self.sshvm) - if not self.execute(): - self.result = 100 - status = testcase.TestCase.EX_OK + if self.check_regex_in_console( + self.sshvm.name, regex=self.check_console_regex, + loop=self.check_console_loop): + (self.fip, self.ssh) = self.connect(self.sshvm) + if not self.execute(): + self.result = 100 + status = testcase.TestCase.EX_OK except Exception: # pylint: disable=broad-except self.__logger.exception('Cannot run %s', self.case_name) finally: diff --git a/functest/core/tenantnetwork.py b/functest/core/tenantnetwork.py index ae739ac36..e340cea93 100644 --- a/functest/core/tenantnetwork.py +++ b/functest/core/tenantnetwork.py @@ -31,6 +31,7 @@ from xtesting.core import testcase from functest.utils import config from functest.utils import env +from functest.utils import functest_utils class NewProject(object): @@ -56,7 +57,9 @@ class NewProject(object): assert self.orig_cloud assert self.case_name self.password = ''.join(random.choice( - string.ascii_letters + string.digits) for _ in range(30)) + string.ascii_letters + string.digits + + '!()*+,-.<=>?@[]^_{|}~') for _ in range(30)) + self.__logger.debug("password: %s", self.password) self.domain = self.orig_cloud.get_domain( name_or_id=self.orig_cloud.auth.get( "project_domain_name", "Default")) @@ -146,27 +149,28 @@ class TenantNetwork1(testcase.TestCase): __logger = logging.getLogger(__name__) cidr = '192.168.120.0/24' shared_network = False - allow_no_fip = False def __init__(self, **kwargs): if "case_name" not in kwargs: kwargs["case_name"] = 'tenantnetwork1' super(TenantNetwork1, self).__init__(**kwargs) - self.res_dir = os.path.join( - getattr(config.CONF, 'dir_results'), self.case_name) + self.dir_results = os.path.join(getattr(config.CONF, 'dir_results')) + self.res_dir = os.path.join(self.dir_results, self.case_name) + self.output_log_name = 'functest.log' + self.output_debug_log_name = 'functest.debug.log' + self.ext_net = None try: cloud_config = os_client_config.get_config() self.cloud = self.orig_cloud = shade.OpenStackCloud( cloud_config=cloud_config) except Exception: # pylint: disable=broad-except self.cloud = self.orig_cloud = None - self.ext_net = None self.__logger.exception("Cannot connect to Cloud") - try: - self.ext_net = self.get_external_network(self.cloud) - except Exception: # pylint: disable=broad-except - self.ext_net = None - self.__logger.exception("Cannot get the external network") + if env.get('NO_TENANT_NETWORK').lower() != 'true': + try: + self.ext_net = self.get_external_network(self.cloud) + except Exception: # pylint: disable=broad-except + self.__logger.exception("Cannot get the external network") self.guid = str(uuid.uuid4()) self.network = None self.subnet = None @@ -203,7 +207,7 @@ class TenantNetwork1(testcase.TestCase): @staticmethod def get_public_auth_url(cloud): """Get Keystone public endpoint""" - keystone_id = cloud.search_services('keystone')[0].id + keystone_id = functest_utils.search_services(cloud, 'keystone')[0].id endpoint = cloud.search_endpoints( filters={'interface': 'public', 'service_id': keystone_id})[0].url @@ -218,7 +222,7 @@ class TenantNetwork1(testcase.TestCase): Raises: expection on error """ assert self.cloud - if not self.allow_no_fip: + if env.get('NO_TENANT_NETWORK').lower() != 'true': assert self.ext_net provider = {} if hasattr(config.CONF, '{}_network_type'.format(self.case_name)): @@ -263,7 +267,8 @@ class TenantNetwork1(testcase.TestCase): try: assert self.cloud self.start_time = time.time() - self.create_network_resources() + if env.get('NO_TENANT_NETWORK').lower() != 'true': + self.create_network_resources() self.result = 100 status = testcase.TestCase.EX_OK except Exception: # pylint: disable=broad-except diff --git a/functest/opnfv_tests/openstack/api/connection_check.py b/functest/opnfv_tests/openstack/api/connection_check.py index 7a320b5e4..f3b35e9d9 100644 --- a/functest/opnfv_tests/openstack/api/connection_check.py +++ b/functest/opnfv_tests/openstack/api/connection_check.py @@ -17,6 +17,7 @@ import shade from xtesting.core import testcase from functest.utils import env +from functest.utils import functest_utils class ConnectionCheck(testcase.TestCase): @@ -28,12 +29,14 @@ class ConnectionCheck(testcase.TestCase): "list_endpoints", "list_floating_ip_pools", "list_floating_ips", "list_hypervisors", "list_keypairs", "list_networks", "list_ports", "list_role_assignments", "list_roles", "list_routers", "list_servers", - "list_services", "list_subnets"] + "list_subnets"] def __init__(self, **kwargs): if "case_name" not in kwargs: kwargs["case_name"] = 'connection_check' super(ConnectionCheck, self).__init__(**kwargs) + self.output_log_name = 'functest.log' + self.output_debug_log_name = 'functest.debug.log' try: cloud_config = os_client_config.get_config() self.cloud = shade.OpenStackCloud(cloud_config=cloud_config) @@ -47,11 +50,12 @@ class ConnectionCheck(testcase.TestCase): try: assert self.cloud self.start_time = time.time() - if env.get('PUBLIC_ENDPOINT_ONLY').lower() == 'true': - self.__logger.warning( - "Listing services is skipped " - "because the admin endpoints are unreachable") - self.func_list.remove("list_services") + self.__logger.debug( + "list_services: %s", functest_utils.list_services(self.cloud)) + if env.get('NO_TENANT_NETWORK').lower() == 'true': + self.func_list.remove("list_floating_ip_pools") + self.func_list.remove("list_floating_ips") + self.func_list.remove("list_routers") for func in self.func_list: self.__logger.debug( "%s: %s", func, getattr(self.cloud, func)()) @@ -59,6 +63,7 @@ class ConnectionCheck(testcase.TestCase): self.__logger.debug( "list_service_providers: %s", self.cloud._get_and_munchify('service_providers', data)) + functest_utils.get_openstack_version(self.cloud) self.result = 100 status = testcase.TestCase.EX_OK except Exception: # pylint: disable=broad-except diff --git a/functest/opnfv_tests/openstack/cinder/cinder_test.py b/functest/opnfv_tests/openstack/cinder/cinder_test.py index bbed9a64f..d81bb100a 100644 --- a/functest/opnfv_tests/openstack/cinder/cinder_test.py +++ b/functest/opnfv_tests/openstack/cinder/cinder_test.py @@ -77,8 +77,10 @@ class CinderCheck(singlevm.SingleVm2): self.logger.debug("ssh: %s", self.ssh) (_, stdout, stderr) = self.ssh.exec_command( "sh ~/write_data.sh {}".format(env.get('VOLUME_DEVICE_NAME'))) - self.logger.debug("volume_write stdout: %s", stdout.read()) - self.logger.debug("volume_write stderr: %s", stderr.read()) + self.logger.debug( + "volume_write stdout: %s", stdout.read().decode("utf-8")) + self.logger.debug( + "volume_write stderr: %s", stderr.read().decode("utf-8")) # Detach volume from VM 1 self.logger.info("Detach volume from VM 1") self.cloud.detach_volume( @@ -103,8 +105,10 @@ class CinderCheck(singlevm.SingleVm2): self.logger.debug("ssh: %s", self.ssh2) (_, stdout, stderr) = self.ssh2.exec_command( "sh ~/read_data.sh {}".format(env.get('VOLUME_DEVICE_NAME'))) - self.logger.debug("read volume stdout: %s", stdout.read()) - self.logger.debug("read volume stderr: %s", stderr.read()) + self.logger.debug( + "read volume stdout: %s", stdout.read().decode("utf-8")) + self.logger.debug( + "read volume stderr: %s", stderr.read().decode("utf-8")) self.logger.info("Detach volume from VM 2") self.cloud.detach_volume( self.vm2, self.volume, timeout=self.volume_timeout) diff --git a/functest/opnfv_tests/openstack/rally/blacklist.yaml b/functest/opnfv_tests/openstack/rally/blacklist.yaml index 382e239f8..18727f73c 100644 --- a/functest/opnfv_tests/openstack/rally/blacklist.yaml +++ b/functest/opnfv_tests/openstack/rally/blacklist.yaml @@ -1,13 +1,5 @@ --- scenario: - - - scenarios: - - '^os-' # all scenarios - tests: - # Following test occasionally fails due to race condition issue on - # quota manipulation in nova. - # Ref: https://bugs.launchpad.net/nova/+bug/1552622 - - 'Quotas.nova_update_and_delete' functionality: - @@ -34,7 +26,14 @@ functionality: tests: - HeatStacks.create_and_delete_stack - NovaServers.boot_and_associate_floating_ip + - NovaServers.boot_server_and_list_interfaces - NovaServers.boot_server_associate_and_dissociate_floating_ip - NeutronNetworks.create_and_delete_floating_ips - NeutronNetworks.create_and_list_floating_ips - NeutronNetworks.associate_and_dissociate_floating_ips + - NeutronNetworks.create_and_delete_routers + - NeutronNetworks.create_and_list_routers + - NeutronNetworks.create_and_show_routers + - NeutronNetworks.create_and_update_routers + - NeutronNetworks.set_and_clear_router_gateway + - Quotas.neutron_update diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index b450580c7..592809b76 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -22,10 +22,10 @@ import shutil import subprocess import time -from threading import Timer import pkg_resources import prettytable from ruamel.yaml import YAML +import six from six.moves import configparser from xtesting.core import testcase import yaml @@ -33,6 +33,7 @@ import yaml from functest.core import singlevm from functest.utils import config from functest.utils import env +from functest.utils import functest_utils LOGGER = logging.getLogger(__name__) @@ -42,7 +43,7 @@ class RallyBase(singlevm.VmReady2): # pylint: disable=too-many-instance-attributes, too-many-public-methods stests = ['authenticate', 'glance', 'cinder', 'gnocchi', 'heat', - 'keystone', 'neutron', 'nova', 'quotas'] + 'keystone', 'neutron', 'nova', 'quotas', 'swift'] rally_conf_path = "/etc/rally/rally.conf" rally_aar4_patch_path = pkg_resources.resource_filename( @@ -67,7 +68,6 @@ class RallyBase(singlevm.VmReady2): visibility = 'public' shared_network = True - allow_no_fip = True task_timeout = 3600 def __init__(self, **kwargs): @@ -94,14 +94,12 @@ class RallyBase(singlevm.VmReady2): self.smoke = None self.start_time = None self.result = None - self.details = None self.compute_cnt = 0 self.flavor_alt = None self.tests = [] self.run_cmd = '' self.network_extensions = [] self.services = [] - self.task_aborted = False def _build_task_args(self, test_file_name): """Build arguments for the Rally task.""" @@ -131,7 +129,14 @@ class RallyBase(singlevm.VmReady2): if self.network: task_args['netid'] = str(self.network.id) else: - task_args['netid'] = '' + LOGGER.warning( + 'No tenant network created. ' + 'Trying EXTERNAL_NETWORK as a fallback') + if env.get("EXTERNAL_NETWORK"): + network = self.cloud.get_network(env.get("EXTERNAL_NETWORK")) + task_args['netid'] = str(network.id) if network else '' + else: + task_args['netid'] = '' return task_args @@ -234,20 +239,17 @@ class RallyBase(singlevm.VmReady2): rconfig.write(config_file) @staticmethod - def get_task_id(cmd_raw): + def get_task_id(tag): """ Get task id from command rally result. - :param cmd_raw: + :param tag: :return: task_id as string """ - taskid_re = re.compile('^Task +(.*): started$') - for line in cmd_raw.splitlines(True): - line = line.strip() - match = taskid_re.match(line.decode("utf-8")) - if match: - return match.group(1) - return None + cmd = ["rally", "task", "list", "--tag", tag, "--uuids-only"] + output = subprocess.check_output(cmd).decode("utf-8").rstrip() + LOGGER.info("%s: %s", " ".join(cmd), output) + return output @staticmethod def task_succeed(json_raw): @@ -425,30 +427,22 @@ class RallyBase(singlevm.VmReady2): else: LOGGER.info('Test scenario: "%s" Failed.', test_name) - def kill_task(self, proc): - """ Kill a task.""" - proc.kill() - self.task_aborted = True - def run_task(self, test_name): """Run a task.""" LOGGER.info('Starting test scenario "%s" ...', test_name) LOGGER.debug('running command: %s', self.run_cmd) - proc = subprocess.Popen(self.run_cmd, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - self.task_aborted = False - timer = Timer(self.task_timeout, self.kill_task, [proc]) - timer.start() - output = proc.communicate()[0] - if self.task_aborted: - LOGGER.error("Failed to complete task") - raise Exception("Failed to complete task") - timer.cancel() - task_id = self.get_task_id(output) + if six.PY3: + # pylint: disable=no-member + subprocess.call( + self.run_cmd, timeout=self.task_timeout, + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + else: + with open(os.devnull, 'wb') as devnull: + subprocess.call(self.run_cmd, stdout=devnull, stderr=devnull) + task_id = self.get_task_id(test_name) LOGGER.debug('task_id : %s', task_id) - if task_id is None: + if not task_id: LOGGER.error("Failed to retrieve task_id") - LOGGER.error("Result:\n%s", output.decode("utf-8")) raise Exception("Failed to retrieve task id") self._save_results(test_name, task_id) @@ -524,11 +518,11 @@ class RallyBase(singlevm.VmReady2): shutil.copytree(task_macro, macro_dir) self.update_keystone_default_role() - self.compute_cnt = len(self.cloud.list_hypervisors()) + self.compute_cnt = self.count_hypervisors() self.network_extensions = self.cloud.get_network_extensions() self.flavor_alt = self.create_flavor_alt() self.services = [service.name for service in - self.cloud.list_services()] + functest_utils.list_services(self.cloud)] LOGGER.debug("flavor: %s", self.flavor_alt) @@ -538,7 +532,8 @@ class RallyBase(singlevm.VmReady2): if self.file_is_empty(file_name): LOGGER.info('No tests for scenario "%s"', test_name) return False - self.run_cmd = (["rally", "task", "start", "--abort-on-sla-failure", + self.run_cmd = (["rally", "task", "start", "--tag", test_name, + "--abort-on-sla-failure", "--task", self.task_file, "--task-args", str(self._build_task_args(test_name))]) return True @@ -605,10 +600,10 @@ class RallyBase(singlevm.VmReady2): LOGGER.info("Rally '%s' success_rate is %s%% in %s/%s modules", self.case_name, success_rate, nb_modules, len(self.summary)) - payload.append({'summary': {'duration': total_duration, - 'nb tests': total_nb_tests, - 'nb success': success_rate}}) - self.details = payload + self.details['summary'] = {'duration': total_duration, + 'nb tests': total_nb_tests, + 'nb success': success_rate} + self.details["modules"] = payload @staticmethod def export_task(file_name, export_type="html"): @@ -810,26 +805,10 @@ class RallyJobs(RallyBase): with open(result_file_name, 'w') as fname: template.dump(cases, fname) - @staticmethod - def _remove_plugins_extra(): - inst_dir = getattr(config.CONF, 'dir_rally_inst') - try: - shutil.rmtree(os.path.join(inst_dir, 'plugins')) - shutil.rmtree(os.path.join(inst_dir, 'extra')) - except Exception: # pylint: disable=broad-except - pass - def prepare_task(self, test_name): """Prepare resources for test run.""" - self._remove_plugins_extra() jobs_dir = os.path.join( getattr(config.CONF, 'dir_rally_data'), test_name, 'rally-jobs') - inst_dir = getattr(config.CONF, 'dir_rally_inst') - shutil.copytree(os.path.join(jobs_dir, 'plugins'), - os.path.join(inst_dir, 'plugins')) - shutil.copytree(os.path.join(jobs_dir, 'extra'), - os.path.join(inst_dir, 'extra')) - task_name = self.task_yaml.get(test_name).get("task") task = os.path.join(jobs_dir, task_name) if not os.path.exists(task): @@ -840,9 +819,6 @@ class RallyJobs(RallyBase): os.makedirs(self.temp_dir) task_file_name = os.path.join(self.temp_dir, task_name) self.apply_blacklist(task, task_file_name) - self.run_cmd = (["rally", "task", "start", "--task", task_file_name]) + self.run_cmd = (["rally", "task", "start", "--tag", test_name, + "--task", task_file_name]) return True - - def clean(self): - self._remove_plugins_extra() - super(RallyJobs, self).clean() diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-glance.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-glance.yaml index dfc1fc156..993b83ff7 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-glance.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-glance.yaml @@ -36,8 +36,9 @@ flavor: name: {{ flavor_name }} number_instances: 2 - nics: - - net-id: {{ netid }} + boot_server_kwargs: + nics: + - net-id: {{ netid }} context: {{ user_context(tenants_amount, users_amount, use_existing_users) }} quotas: diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-neutron.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-neutron.yaml index b8b1b9b6b..b2248d499 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-neutron.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-neutron.yaml @@ -150,8 +150,6 @@ subnets_per_network: 1 context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - router: {} quotas: neutron: network: -1 diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml index 8ef5b6cdc..187f2cfd2 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml @@ -39,9 +39,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova() }} @@ -59,9 +56,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova() }} @@ -80,9 +74,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova() }} @@ -104,9 +95,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova() }} @@ -124,9 +112,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova() }} @@ -216,7 +201,7 @@ - args: {{ vm_params(image_name, flavor_name) }} - size: 10 + size: 1 block_migration: {{ block_migration }} boot_server_kwargs: nics: @@ -251,14 +236,11 @@ - args: {{ vm_params(image_name, flavor_name) }} - server_kwargs: + boot_server_kwargs: nics: - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova(keypairs=true) }} @@ -277,9 +259,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_volumes() }} {{ unlimited_neutron() }} @@ -301,9 +280,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-quotas.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-quotas.yaml index 3f0cf0840..dcb007c50 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/opnfv-quotas.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/opnfv-quotas.yaml @@ -35,17 +35,6 @@ sla: {{ no_failures_sla() }} - Quotas.nova_update_and_delete: - - - args: - max_quota: 1024 - context: - {{ user_context(tenants_amount, users_amount, use_existing_users) }} - runner: - {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }} - sla: - {{ no_failures_sla() }} - Quotas.nova_update: - args: diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-swift.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-swift.yaml new file mode 100644 index 000000000..66d7cd24d --- /dev/null +++ b/functest/opnfv_tests/openstack/rally/scenario/opnfv-swift.yaml @@ -0,0 +1,71 @@ + SwiftObjects.create_container_and_object_then_list_objects: + - + args: + objects_per_container: 2 + object_size: 5120 + runner: + {{ constant_runner(concurrency=1, times=iterations, is_smoke=smoke) }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + roles: + - "admin" + sla: + {{ no_failures_sla() }} + + SwiftObjects.list_objects_in_containers: + - + runner: + {{ constant_runner(concurrency=1, times=iterations, is_smoke=smoke) }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + roles: + - "admin" + swift_objects: + containers_per_tenant: 1 + objects_per_container: 10 + object_size: 1024 + sla: + {{ no_failures_sla() }} + + SwiftObjects.create_container_and_object_then_download_object: + - + args: + objects_per_container: 5 + object_size: 1024 + runner: + {{ constant_runner(concurrency=1, times=iterations, is_smoke=smoke) }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + roles: + - "admin" + sla: + {{ no_failures_sla() }} + + SwiftObjects.create_container_and_object_then_delete_all: + - + args: + objects_per_container: 5 + object_size: 102400 + runner: + {{ constant_runner(concurrency=1, times=iterations, is_smoke=smoke) }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + roles: + - "admin" + sla: + {{ no_failures_sla() }} + + SwiftObjects.list_and_download_objects_in_containers: + - + runner: + {{ constant_runner(concurrency=1, times=iterations, is_smoke=smoke) }} + context: + {{ user_context(tenants_amount, users_amount, use_existing_users) }} + roles: + - "admin" + swift_objects: + containers_per_tenant: 1 + objects_per_container: 5 + object_size: 10240 + sla: + {{ no_failures_sla() }} diff --git a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-glance.yaml b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-glance.yaml index 1b61762f9..279e81439 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-glance.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-glance.yaml @@ -36,8 +36,9 @@ flavor: name: {{ flavor_name }} number_instances: 2 - nics: - - net-id: {{ netid }} + boot_server_kwargs: + nics: + - net-id: {{ netid }} context: {{ user_context(tenants_amount, users_amount, use_existing_users) }} quotas: diff --git a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-nova.yaml b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-nova.yaml index 935f3841a..cba5c921f 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-nova.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/sanity/opnfv-nova.yaml @@ -15,7 +15,7 @@ - args: {{ vm_params(image_name, flavor_name) }} - size: 10 + size: 1 block_migration: {{ block_migration }} boot_server_kwargs: nics: @@ -50,14 +50,11 @@ - args: {{ vm_params(image_name, flavor_name) }} - server_kwargs: + boot_server_kwargs: nics: - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova(keypairs=true) }} @@ -76,9 +73,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_volumes() }} {{ unlimited_neutron() }} @@ -100,9 +94,6 @@ - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} - network: - networks_per_tenant: 1 - start_cidr: "100.1.0.0/25" quotas: {{ unlimited_neutron() }} {{ unlimited_nova() }} @@ -128,7 +119,8 @@ - args: {{ vm_params(image_name, flavor_name) }} - auto_assign_nic: true + nics: + - net-id: {{ netid }} context: {% call user_context(tenants_amount, users_amount, use_existing_users) %} network: {} diff --git a/functest/opnfv_tests/openstack/rally/task.yaml b/functest/opnfv_tests/openstack/rally/task.yaml index 181fdb42e..3e692891a 100644 --- a/functest/opnfv_tests/openstack/rally/task.yaml +++ b/functest/opnfv_tests/openstack/rally/task.yaml @@ -42,3 +42,7 @@ {% if "heat" in service_list %} {%- include "var/opnfv-heat.yaml"-%} {% endif %} + +{% if "swift" in service_list %} +{%- include "var/opnfv-swift.yaml"-%} +{% endif %} diff --git a/functest/opnfv_tests/openstack/shaker/shaker.py b/functest/opnfv_tests/openstack/shaker/shaker.py index fd31ea689..917c65980 100644 --- a/functest/opnfv_tests/openstack/shaker/shaker.py +++ b/functest/opnfv_tests/openstack/shaker/shaker.py @@ -19,6 +19,7 @@ and list of tests to execute. import logging import os +import json import scp from functest.core import singlevm @@ -31,23 +32,26 @@ class Shaker(singlevm.SingleVm2): __logger = logging.getLogger(__name__) - filename = '/home/opnfv/functest/images/shaker-image.qcow2' + filename = '/home/opnfv/functest/images/shaker-image-1.3.0+stretch.qcow2' flavor_ram = 512 flavor_vcpus = 1 flavor_disk = 3 - username = 'ubuntu' + username = 'debian' port = 9000 ssh_connect_loops = 12 create_server_timeout = 300 + check_console_loop = 12 shaker_timeout = '3600' quota_instances = -1 + quota_cores = -1 + check_console_loop = 12 def __init__(self, **kwargs): super(Shaker, self).__init__(**kwargs) self.role = None def check_requirements(self): - if len(self.orig_cloud.list_hypervisors()) < 2: + if self.count_hypervisors() < 2: self.__logger.warning("Shaker requires at least 2 hypervisors") self.is_skipped = True self.project.clean() @@ -85,7 +89,8 @@ class Shaker(singlevm.SingleVm2): domain=self.project.domain.id) self.orig_cloud.set_compute_quotas( self.project.project.name, - instances=self.quota_instances) + instances=self.quota_instances, + cores=self.quota_cores) scpc = scp.SCPClient(self.ssh.get_transport()) scpc.put('/home/opnfv/functest/conf/env_file', remote_path='~/') if os.environ.get('OS_CACERT'): @@ -100,10 +105,10 @@ class Shaker(singlevm.SingleVm2): 'unset OS_TENANT_NAME && ' 'unset OS_TENANT_ID && ' 'unset OS_ENDPOINT_TYPE && ' - 'export OS_PASSWORD={} && ' + 'export OS_PASSWORD="{}" && ' '{}' 'env && ' - 'timeout {} shaker --image-name {} --flavor-name {} ' + 'timeout {} shaker --debug --image-name {} --flavor-name {} ' '--server-endpoint {}:9000 --external-net {} --dns-nameservers {} ' '--scenario openstack/full_l2,' 'openstack/full_l3_east_west,' @@ -127,6 +132,13 @@ class Shaker(singlevm.SingleVm2): except scp.SCPException: self.__logger.exception("cannot get report files") return 1 + with open(os.path.join(self.res_dir, 'report.json')) as json_file: + data = json.load(json_file) + for value in data["records"].values(): + if value["status"] != "ok": + self.__logger.error( + "%s failed\n%s", value["scenario"], value["stderr"]) + return 1 return stdout.channel.recv_exit_status() def clean(self): diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml index 8d7d6eca9..e559f619a 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml @@ -4,10 +4,9 @@ - os-ovn-nofeature-ha - os-ovn-nofeature-noha tests: - - neutron_tempest_plugin.api.admin.test_agent_management - neutron_tempest_plugin.api.admin.test_dhcp_agent_scheduler + - neutron_tempest_plugin.api.test_trunk.TrunkTestInheritJSONBase.test_add_subport - patrole_tempest_plugin.tests.api.network.test_agents_rbac - patrole_tempest_plugin.tests.api.network.test_networks_rbac.NetworksRbacTest.test_create_network_provider_network_type - patrole_tempest_plugin.tests.api.network.test_networks_rbac.NetworksRbacTest.test_create_network_provider_segmentation_id - - tempest.api.network.admin.test_agent_management - tempest.api.network.admin.test_dhcp_agent_scheduler diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/public_blacklist.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/public_blacklist.yaml new file mode 100644 index 000000000..e53b577b2 --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/public_blacklist.yaml @@ -0,0 +1,15 @@ +--- +- + scenarios: + - os-* + tests: + - neutron_tempest_plugin.api.admin.test_floating_ips_admin_actions.FloatingIPAdminTestJSON.test_associate_floating_ip_with_port_from_another_project + - neutron_tempest_plugin.api.admin.test_quotas.QuotasTest.test_detail_quotas + - neutron_tempest_plugin.api.admin.test_quotas.QuotasTest.test_quotas + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_floatingip_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_network_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_port_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_router_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_security_group_rule_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_security_group_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_subnet_when_quotas_is_full diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml index ab0bfa98e..758547359 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml @@ -2,25 +2,93 @@ compute: max_microversion: 2.65 compute-feature-enabled: - shelve: false - vnc_console: false - cold_migration: false - block_migration_for_live_migration: true + attach_encrypted_volume: false + block_migration_for_live_migration: false + block_migrate_cinder_iscsi: false + change_password: false + cold_migration: true + config_drive: true + console_output: true + disk_config: true + enable_instance_password: true + interface_attach: true + live_migration: true + live_migrate_back_and_forth: false + metadata_service: true + pause: true + personality: false + rdp_console: false + rescue: true + resize: true + scheduler_available_filters: "RetryFilter,AvailabilityZoneFilter,\ + ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,\ + ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,SameHostFilter,\ + DifferentHostFilter" + serial_console: false + shelve: true + snapshot: true + spice_console: false + suspend: true + swap_volume: false + vnc_console: true + volume_backed_live_migration: false + volume_multiattach: false identity: + auth_version: v3 user_unique_last_password_count: 2 user_lockout_duration: 10 user_lockout_failure_attempts: 2 identity-feature-enabled: + trust: true api_v2: false api_v2_admin: false security_compliance: true + federation: false + external_idp: false + project_tags: true + application_credentials: true image-feature-enabled: api_v2: true api_v1: false +network-feature-enabled: + port_admin_state_change: true + port_security: true placement: - max_microversion: 1.30 + max_microversion: "1.30" +validation: + image_ssh_user: cirros + ssh_timeout: 196 + ip_version_for_ssh: 4 + run_validation: true volume: max_microversion: 3.55 - storage_protocol: iSCSI + storage_protocol: ceph + manage_volume_ref: source-name,volume-%s + manage_snapshot_ref: source-name,snapshot-%s volume-feature-enabled: + multi_backend: false backup: true + snapshot: true + clone: true + manage_snapshot: true + manage_volume: true + extend_attached_volume: false + consistency_group: false + volume_revert: true +neutron_plugin_options: + agent_availability_zone: nova + available_type_drivers: flat,geneve,vlan,gre,local,vxlan + provider_vlans: foo, +object-storage-feature-enabled: + discoverable_apis: "account_quotas,formpost,bulk_upload,bulk_delete,\ + tempurl,crossdomain,container_quotas,staticweb,account_quotas,slo" + object_versioning: true + discoverability: true +heat_plugin: + skip_functional_test_list: EncryptionVolTypeTest + skip_scenario_test_list: "AodhAlarmTest,SoftwareConfigIntegrationTest,\ + VolumeBackupRestoreIntegrationTest,CfnInitIntegrationTest,\ + LoadBalancerTest" + auth_version: 3 +heat_features_enabled: + multi_cloud: false diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml new file mode 100644 index 000000000..37aa2810b --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml @@ -0,0 +1,94 @@ +--- +compute: + max_microversion: 2.65 +compute-feature-enabled: + attach_encrypted_volume: false + block_migration_for_live_migration: false + block_migrate_cinder_iscsi: false + change_password: false + cold_migration: true + config_drive: true + console_output: true + disk_config: true + enable_instance_password: true + interface_attach: true + live_migration: true + live_migrate_back_and_forth: false + metadata_service: true + pause: true + personality: false + rdp_console: false + rescue: true + resize: true + scheduler_available_filters: "RetryFilter,AvailabilityZoneFilter,\ + ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,\ + ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,SameHostFilter,\ + DifferentHostFilter" + serial_console: false + shelve: true + snapshot: true + spice_console: false + suspend: true + swap_volume: false + vnc_console: true + volume_backed_live_migration: false + volume_multiattach: false +identity: + auth_version: v3 + user_unique_last_password_count: 2 + user_lockout_duration: 10 + user_lockout_failure_attempts: 2 +identity-feature-enabled: + trust: true + api_v2: false + api_v2_admin: false + security_compliance: true + federation: false + external_idp: false + project_tags: true + application_credentials: true +image-feature-enabled: + api_v2: true + api_v1: false +network-feature-enabled: + port_admin_state_change: true + port_security: true +placement: + max_microversion: "1.30" +validation: + image_ssh_user: cirros + ssh_timeout: 196 + ip_version_for_ssh: 4 + run_validation: true +volume: + max_microversion: 3.55 + storage_protocol: ceph + manage_volume_ref: source-name,volume-%s + manage_snapshot_ref: source-name,snapshot-%s +volume-feature-enabled: + multi_backend: false + backup: true + snapshot: true + clone: true + manage_snapshot: true + manage_volume: true + extend_attached_volume: false + consistency_group: false + volume_revert: true +neutron_plugin_options: + agent_availability_zone: nova + available_type_drivers: flat,geneve,vlan,local + provider_vlans: public, +object-storage-feature-enabled: + discoverable_apis: "account_quotas,formpost,bulk_upload,bulk_delete,\ + tempurl,crossdomain,container_quotas,staticweb,account_quotas,slo" + object_versioning: true + discoverability: true +heat_plugin: + skip_functional_test_list: EncryptionVolTypeTest + skip_scenario_test_list: "AodhAlarmTest,SoftwareConfigIntegrationTest,\ + VolumeBackupRestoreIntegrationTest,CfnInitIntegrationTest,\ + LoadBalancerTest" + auth_version: 3 +heat_features_enabled: + multi_cloud: false diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index faf2ab5ca..48c673673 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -21,6 +21,7 @@ import subprocess import time import pkg_resources +import six from six.moves import configparser from xtesting.core import testcase import yaml @@ -50,6 +51,9 @@ class TempestCommon(singlevm.VmReady2): tempest_blacklist = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml') + tempest_public_blacklist = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/tempest/custom_tests/public_blacklist.yaml') def __init__(self, **kwargs): if "case_name" not in kwargs: @@ -95,6 +99,7 @@ class TempestCommon(singlevm.VmReady2): except Exception: # pylint: disable=broad-except pass self.deny_skipping = kwargs.get("deny_skipping", False) + self.tests_count = kwargs.get("tests_count", 0) def check_services(self): """Check the mandatory services.""" @@ -195,9 +200,16 @@ class TempestCommon(singlevm.VmReady2): cmd = ("rally verify list-verifiers | awk '/" + getattr(config.CONF, 'tempest_verifier_name') + "/ {print $2}'") - proc = subprocess.Popen(cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + if six.PY3: + # pylint: disable=no-member + proc = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + else: + with open(os.devnull, 'wb') as devnull: + proc = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, + stderr=devnull) verifier_uuid = proc.stdout.readline().rstrip() return verifier_uuid.decode("utf-8") @@ -266,27 +278,8 @@ class TempestCommon(singlevm.VmReady2): # enable multinode tests rconfig.set('compute', 'min_compute_nodes', compute_cnt) rconfig.set('compute-feature-enabled', 'live_migration', True) - filters = ['RetryFilter', 'AvailabilityZoneFilter', 'ComputeFilter', - 'ComputeCapabilitiesFilter', 'ImagePropertiesFilter', - 'ServerGroupAntiAffinityFilter', - 'ServerGroupAffinityFilter'] - rconfig.set( - 'compute-feature-enabled', 'scheduler_available_filters', - functest_utils.convert_list_to_ini(filters)) if os.environ.get('OS_REGION_NAME'): rconfig.set('identity', 'region', os.environ.get('OS_REGION_NAME')) - if env.get("NEW_USER_ROLE").lower() != "member": - rconfig.set( - 'auth', 'tempest_roles', - functest_utils.convert_list_to_ini([env.get("NEW_USER_ROLE")])) - if not json.loads(env.get("USE_DYNAMIC_CREDENTIALS").lower()): - rconfig.set('auth', 'use_dynamic_credentials', False) - account_file = os.path.join( - getattr(config.CONF, 'dir_functest_data'), 'accounts.yaml') - assert os.path.exists( - account_file), "{} doesn't exist".format(account_file) - rconfig.set('auth', 'test_accounts_file', account_file) - rconfig.set('identity', 'auth_version', 'v3') rconfig.set('identity', 'admin_role', admin_role_name) rconfig.set('identity', 'default_domain_id', domain_id) if not rconfig.has_section('network'): @@ -350,7 +343,7 @@ class TempestCommon(singlevm.VmReady2): LOGGER.info("%s\n%s", cmd, output.decode("utf-8")) os.remove('/etc/tempest.conf') - def apply_tempest_blacklist(self): + def apply_tempest_blacklist(self, black_list): """Exclude blacklisted test cases.""" LOGGER.debug("Applying tempest blacklist...") if os.path.exists(self.raw_list): @@ -363,7 +356,7 @@ class TempestCommon(singlevm.VmReady2): deploy_scenario = env.get('DEPLOY_SCENARIO') if bool(deploy_scenario): # if DEPLOY_SCENARIO is set we read the file - black_list_file = open(self.tempest_blacklist) + black_list_file = open(black_list) black_list_yaml = yaml.safe_load(black_list_file) black_list_file.close() for item in black_list_yaml: @@ -500,14 +493,47 @@ class TempestCommon(singlevm.VmReady2): with open(rally_conf, 'w') as config_file: rconfig.write(config_file) + def update_auth_section(self): + """Update auth section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section("auth"): + rconfig.add_section("auth") + if env.get("NEW_USER_ROLE").lower() != "member": + tempest_roles = [] + if rconfig.has_option("auth", "tempest_roles"): + tempest_roles = functest_utils.convert_ini_to_list( + rconfig.get("auth", "tempest_roles")) + rconfig.set( + 'auth', 'tempest_roles', + functest_utils.convert_list_to_ini( + [env.get("NEW_USER_ROLE")] + tempest_roles)) + if not json.loads(env.get("USE_DYNAMIC_CREDENTIALS").lower()): + rconfig.set('auth', 'use_dynamic_credentials', False) + account_file = os.path.join( + getattr(config.CONF, 'dir_functest_data'), 'accounts.yaml') + assert os.path.exists( + account_file), "{} doesn't exist".format(account_file) + rconfig.set('auth', 'test_accounts_file', account_file) + if env.get('NO_TENANT_NETWORK').lower() == 'true': + rconfig.set('auth', 'create_isolated_networks', False) + with open(self.conf_file, 'w') as config_file: + rconfig.write(config_file) + def update_network_section(self): """Update network section in tempest.conf""" rconfig = configparser.RawConfigParser() rconfig.read(self.conf_file) - if not rconfig.has_section('network'): - rconfig.add_section('network') - rconfig.set('network', 'public_network_id', self.ext_net.id) - rconfig.set('network', 'floating_network_name', self.ext_net.name) + if self.ext_net: + if not rconfig.has_section('network'): + rconfig.add_section('network') + rconfig.set('network', 'public_network_id', self.ext_net.id) + rconfig.set('network', 'floating_network_name', self.ext_net.name) + rconfig.set('network-feature-enabled', 'floating_ips', True) + else: + if not rconfig.has_section('network-feature-enabled'): + rconfig.add_section('network-feature-enabled') + rconfig.set('network-feature-enabled', 'floating_ips', False) with open(self.conf_file, 'w') as config_file: rconfig.write(config_file) @@ -517,7 +543,24 @@ class TempestCommon(singlevm.VmReady2): rconfig.read(self.conf_file) if not rconfig.has_section('compute'): rconfig.add_section('compute') - rconfig.set('compute', 'fixed_network_name', self.network.name) + rconfig.set( + 'compute', 'fixed_network_name', + self.network.name if self.network else env.get("EXTERNAL_NETWORK")) + with open(self.conf_file, 'w') as config_file: + rconfig.write(config_file) + + def update_validation_section(self): + """Update validation section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('validation'): + rconfig.add_section('validation') + rconfig.set( + 'validation', 'connect_method', + 'floating' if self.ext_net else 'fixed') + rconfig.set( + 'validation', 'network_for_ssh', + self.network.name if self.network else env.get("EXTERNAL_NETWORK")) with open(self.conf_file, 'w') as config_file: rconfig.write(config_file) @@ -567,8 +610,8 @@ class TempestCommon(singlevm.VmReady2): self.deployment_dir = self.get_verifier_deployment_dir( self.verifier_id, self.deployment_id) - compute_cnt = len(self.orig_cloud.list_hypervisors()) - + compute_cnt = self.count_hypervisors() if self.count_hypervisors( + ) <= 10 else 10 self.image_alt = self.publish_image_alt() self.flavor_alt = self.create_flavor_alt() LOGGER.debug("flavor: %s", self.flavor_alt) @@ -585,8 +628,10 @@ class TempestCommon(singlevm.VmReady2): flavor_alt_id=self.flavor_alt.id, admin_role_name=self.role_name, cidr=self.cidr, domain_id=self.project.domain.id) + self.update_auth_section() self.update_network_section() self.update_compute_section() + self.update_validation_section() self.update_scenario_section() self.backup_tempest_config(self.conf_file, self.res_dir) @@ -603,7 +648,10 @@ class TempestCommon(singlevm.VmReady2): shutil.copy("/etc/rally/rally.conf", self.res_dir) self.configure(**kwargs) self.generate_test_list(**kwargs) - self.apply_tempest_blacklist() + self.apply_tempest_blacklist(TempestCommon.tempest_blacklist) + if env.get('PUBLIC_ENDPOINT_ONLY').lower() == 'true': + self.apply_tempest_blacklist( + TempestCommon.tempest_public_blacklist) self.run_verifier_tests(**kwargs) self.parse_verifier_result() rally.RallyBase.verify_report( @@ -637,16 +685,105 @@ class TempestCommon(singlevm.VmReady2): skips = self.details.get("skipped_number", 0) if skips > 0 and self.deny_skipping: return testcase.TestCase.EX_TESTCASE_FAILED + if self.tests_count and ( + self.details.get("tests_number", 0) != self.tests_count): + return testcase.TestCase.EX_TESTCASE_FAILED return super(TempestCommon, self).is_successful() -class TempestScenario(TempestCommon): - """Tempest scenario testcase implementation class.""" +class TempestHorizon(TempestCommon): + """Tempest Horizon testcase implementation class.""" - quota_instances = -1 + def configure(self, **kwargs): + super(TempestHorizon, self).configure(**kwargs) + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('dashboard'): + rconfig.add_section('dashboard') + rconfig.set('dashboard', 'dashboard_url', env.get('DASHBOARD_URL')) + with open(self.conf_file, 'w') as config_file: + rconfig.write(config_file) + self.backup_tempest_config(self.conf_file, self.res_dir) - def run(self, **kwargs): - self.orig_cloud.set_compute_quotas( - self.project.project.name, - instances=self.quota_instances) - return super(TempestScenario, self).run(**kwargs) + +class TempestHeat(TempestCommon): + """Tempest Heat testcase implementation class.""" + + filename_alt = ('/home/opnfv/functest/images/' + 'Fedora-Cloud-Base-30-1.2.x86_64.qcow2') + flavor_alt_ram = 512 + flavor_alt_vcpus = 1 + flavor_alt_disk = 4 + + def __init__(self, **kwargs): + super(TempestHeat, self).__init__(**kwargs) + self.user2 = self.orig_cloud.create_user( + name='{}-user2_{}'.format(self.case_name, self.project.guid), + password=self.project.password, + domain_id=self.project.domain.id) + self.orig_cloud.grant_role( + self.role_name, user=self.user2.id, + project=self.project.project.id, domain=self.project.domain.id) + if not self.orig_cloud.get_role("heat_stack_owner"): + self.role = self.orig_cloud.create_role("heat_stack_owner") + self.orig_cloud.grant_role( + "heat_stack_owner", user=self.user2.id, + project=self.project.project.id, + domain=self.project.domain.id) + + def configure(self, **kwargs): + assert self.user2 + super(TempestHeat, self).configure(**kwargs) + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('heat_plugin'): + rconfig.add_section('heat_plugin') + # It fails if region and domain ids are unset + rconfig.set( + 'heat_plugin', 'region', + os.environ.get('OS_REGION_NAME', 'RegionOne')) + rconfig.set('heat_plugin', 'auth_url', os.environ["OS_AUTH_URL"]) + rconfig.set('heat_plugin', 'project_domain_id', self.project.domain.id) + rconfig.set('heat_plugin', 'user_domain_id', self.project.domain.id) + rconfig.set( + 'heat_plugin', 'project_domain_name', self.project.domain.name) + rconfig.set( + 'heat_plugin', 'user_domain_name', self.project.domain.name) + rconfig.set('heat_plugin', 'username', self.user2.name) + rconfig.set('heat_plugin', 'password', self.project.password) + rconfig.set('heat_plugin', 'project_name', self.project.project.name) + rconfig.set('heat_plugin', 'admin_username', self.project.user.name) + rconfig.set('heat_plugin', 'admin_password', self.project.password) + rconfig.set( + 'heat_plugin', 'admin_project_name', self.project.project.name) + rconfig.set('heat_plugin', 'image_ref', self.image_alt.id) + rconfig.set('heat_plugin', 'instance_type', self.flavor_alt.id) + rconfig.set('heat_plugin', 'minimal_image_ref', self.image.id) + rconfig.set('heat_plugin', 'minimal_instance_type', self.flavor.id) + if self.ext_net: + rconfig.set( + 'heat_plugin', 'floating_network_name', self.ext_net.name) + if self.network: + rconfig.set('heat_plugin', 'fixed_network_name', self.network.name) + rconfig.set('heat_plugin', 'fixed_subnet_name', self.subnet.name) + rconfig.set('heat_plugin', 'network_for_ssh', self.network.name) + else: + LOGGER.warning( + 'No tenant network created. ' + 'Trying EXTERNAL_NETWORK as a fallback') + rconfig.set( + 'heat_plugin', 'fixed_network_name', + env.get("EXTERNAL_NETWORK")) + rconfig.set( + 'heat_plugin', 'network_for_ssh', env.get("EXTERNAL_NETWORK")) + with open(self.conf_file, 'w') as config_file: + rconfig.write(config_file) + self.backup_tempest_config(self.conf_file, self.res_dir) + + def clean(self): + """ + Cleanup all OpenStack objects. Should be called on completion. + """ + super(TempestHeat, self).clean() + if self.user2: + self.orig_cloud.delete_user(self.user2.id) diff --git a/functest/opnfv_tests/openstack/vmtp/vmtp.py b/functest/opnfv_tests/openstack/vmtp/vmtp.py index 2fd4e089c..cfbd134c7 100644 --- a/functest/opnfv_tests/openstack/vmtp/vmtp.py +++ b/functest/opnfv_tests/openstack/vmtp/vmtp.py @@ -33,6 +33,7 @@ from xtesting.core import testcase from functest.core import singlevm from functest.utils import env +from functest.utils import functest_utils class Vmtp(singlevm.VmReady2): @@ -50,6 +51,7 @@ class Vmtp(singlevm.VmReady2): flavor_vcpus = 1 flavor_disk = 0 create_server_timeout = 300 + ssh_retry_timeout = 240 def __init__(self, **kwargs): if "case_name" not in kwargs: @@ -60,7 +62,7 @@ class Vmtp(singlevm.VmReady2): (_, self.pubkey_filename) = tempfile.mkstemp() def check_requirements(self): - if len(self.orig_cloud.list_hypervisors()) < 2: + if self.count_hypervisors() < 2: self.__logger.warning("Vmtp requires at least 2 hypervisors") self.is_skipped = True self.project.clean() @@ -122,6 +124,7 @@ class Vmtp(singlevm.VmReady2): self.guid) vmtp_conf["dns_nameservers"] = [env.get('NAMESERVER')] vmtp_conf["generic_retry_count"] = self.create_server_timeout // 2 + vmtp_conf["ssh_retry_count"] = self.ssh_retry_timeout // 2 conf.write(yaml.dump(vmtp_conf)) def run_vmtp(self): @@ -135,6 +138,8 @@ class Vmtp(singlevm.VmReady2): OS_USERNAME=self.project.user.name, OS_PROJECT_NAME=self.project.project.name, OS_PROJECT_ID=self.project.project.id, + OS_PROJECT_DOMAIN_NAME=self.project.domain.name, + OS_USER_DOMAIN_NAME=self.project.domain.name, OS_PASSWORD=self.project.password) if not new_env["OS_AUTH_URL"].endswith(('v3', 'v3/')): new_env["OS_AUTH_URL"] = "{}/v3".format(new_env["OS_AUTH_URL"]) @@ -145,6 +150,12 @@ class Vmtp(singlevm.VmReady2): pass cmd = ['vmtp', '-d', '--json', '{}/vmtp.json'.format(self.res_dir), '-c', self.config] + if env.get("VMTP_HYPERVISORS"): + hypervisors = functest_utils.convert_ini_to_list( + env.get("VMTP_HYPERVISORS")) + for hypervisor in hypervisors: + cmd.extend(["--hypervisor", hypervisor]) + self.__logger.debug("cmd: %s", cmd) output = subprocess.check_output( cmd, stderr=subprocess.STDOUT, env=new_env).decode("utf-8") self.__logger.info("%s\n%s", " ".join(cmd), output) diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index 6420013a0..a7bbfc23c 100644 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -44,12 +44,14 @@ class VPingSSH(singlevm.SingleVm2): Returns: ping exit codes """ assert self.ssh + if not self.check_regex_in_console(self.vm2.name): + return 1 (_, stdout, stderr) = self.ssh.exec_command( 'ping -c 1 {}'.format( self.vm2.private_v4 or self.vm2.addresses[ self.network.name][0].addr)) - self.__logger.info("output:\n%s", stdout.read()) - self.__logger.info("error:\n%s", stderr.read()) + self.__logger.info("output:\n%s", stdout.read().decode("utf-8")) + self.__logger.info("error:\n%s", stderr.read().decode("utf-8")) return stdout.channel.recv_exit_status() def clean(self): diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py index 7c8a925bb..5049bd0bb 100644 --- a/functest/opnfv_tests/vnf/epc/juju_epc.py +++ b/functest/opnfv_tests/vnf/epc/juju_epc.py @@ -14,11 +14,11 @@ import os import time import json import re -import subprocess import sys from copy import deepcopy import pkg_resources +import scp from functest.core import singlevm from functest.utils import config @@ -42,7 +42,7 @@ CREDS_TEMPLATE2 = """credentials: default-credential: abot-epc abot-epc: auth-type: userpass - password: {pass} + password: '{pass}' project-domain-name: {project_domain_n} tenant-name: {tenant_n}""" @@ -51,14 +51,14 @@ CREDS_TEMPLATE = """credentials: default-credential: abot-epc abot-epc: auth-type: userpass - password: {pass} + password: '{pass}' project-domain-name: {project_domain_n} tenant-name: {tenant_n} user-domain-name: {user_domain_n} username: {user_n}""" -class JujuEpc(singlevm.VmReady2): +class JujuEpc(singlevm.SingleVm2): # pylint:disable=too-many-instance-attributes """Abot EPC deployed with JUJU Orchestrator Case""" @@ -74,11 +74,10 @@ class JujuEpc(singlevm.VmReady2): flavor_ram = 2048 flavor_vcpus = 1 flavor_disk = 10 - flavor_alt_ram = 4096 flavor_alt_vcpus = 1 flavor_alt_disk = 10 - + username = 'ubuntu' juju_timeout = '4800' def __init__(self, **kwargs): @@ -146,18 +145,20 @@ class JujuEpc(singlevm.VmReady2): self.image_alt = None self.flavor_alt = None - def check_requirements(self): - if not os.path.exists("/src/epc-requirements/go/bin/juju"): - self.__logger.warn( - "Juju cannot be cross-compiled (arm and arm64) from the time " - "being") - self.is_skipped = True - self.project.clean() - if env.get('NEW_USER_ROLE').lower() == "admin": - self.__logger.warn( - "Defining NEW_USER_ROLE=admin will easily break the testcase " - "because Juju doesn't manage tenancy (e.g. subnet " - "overlapping)") + def _install_juju(self): + (_, stdout, stderr) = self.ssh.exec_command( + 'sudo snap install juju --channel=2.3/stable --classic') + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + return not stdout.channel.recv_exit_status() + + def _install_juju_wait(self): + (_, stdout, stderr) = self.ssh.exec_command( + 'sudo apt-get update && sudo apt-get install python3-pip -y && ' + 'sudo pip3 install juju_wait===2.6.4') + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + return not stdout.channel.recv_exit_status() def _register_cloud(self): assert self.public_auth_url @@ -169,9 +170,13 @@ class JujuEpc(singlevm.VmReady2): 'RegionOne')} with open(clouds_yaml, 'w') as yfile: yfile.write(CLOUD_TEMPLATE.format(**cloud_data)) - cmd = ['juju', 'add-cloud', 'abot-epc', '-f', clouds_yaml, '--replace'] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) + scpc = scp.SCPClient(self.ssh.get_transport()) + scpc.put(clouds_yaml, remote_path='~/') + (_, stdout, stderr) = self.ssh.exec_command( + '/snap/bin/juju add-cloud abot-epc -f clouds.yaml --replace') + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + return not stdout.channel.recv_exit_status() def _register_credentials(self): self.__logger.info("Creating Credentials for Abot-epc .....") @@ -186,46 +191,36 @@ class JujuEpc(singlevm.VmReady2): "user_domain_name", "Default")} with open(credentials_yaml, 'w') as yfile: yfile.write(CREDS_TEMPLATE.format(**creds_data)) - cmd = ['juju', 'add-credential', 'abot-epc', '-f', credentials_yaml, - '--replace'] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) - - def prepare(self): - """Prepare testcase (Additional pre-configuration steps).""" - assert self.public_auth_url - self.__logger.info("Additional pre-configuration steps") - try: - os.makedirs(self.res_dir) - except OSError as ex: - if ex.errno != errno.EEXIST: - self.__logger.exception("Cannot create %s", self.res_dir) - raise Exception - - self.__logger.info("ENV:\n%s", env.string()) - self._register_cloud() - self._register_credentials() - - def publish_image(self, name=None): - image = super(JujuEpc, self).publish_image(name) - cmd = ['juju', 'metadata', 'generate-image', '-d', '/root', - '-i', image.id, '-s', 'xenial', - '-r', self.cloud.region_name if self.cloud.region_name else ( - 'RegionOne'), - '-u', self.public_auth_url] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) - return image + scpc = scp.SCPClient(self.ssh.get_transport()) + scpc.put(credentials_yaml, remote_path='~/') + (_, stdout, stderr) = self.ssh.exec_command( + '/snap/bin/juju add-credential abot-epc -f credentials.yaml ' + ' --replace --debug') + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + return not stdout.channel.recv_exit_status() + + def _publish_image(self): + region_name = self.cloud.region_name if self.cloud.region_name else ( + 'RegionOne') + (_, stdout, stderr) = self.ssh.exec_command( + '/snap/bin/juju metadata generate-image -d /home/ubuntu ' + '-i {} -s xenial -r {} -u {}'.format( + self.image.id, region_name, self.public_auth_url)) + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + return not stdout.channel.recv_exit_status() def publish_image_alt(self, name=None): image_alt = super(JujuEpc, self).publish_image_alt(name) - cmd = ['juju', 'metadata', 'generate-image', '-d', '/root', - '-i', image_alt.id, '-s', 'trusty', - '-r', self.cloud.region_name if self.cloud.region_name else ( - 'RegionOne'), - '-u', self.public_auth_url] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) + region_name = self.cloud.region_name if self.cloud.region_name else ( + 'RegionOne') + (_, stdout, stderr) = self.ssh.exec_command( + '/snap/bin/juju metadata generate-image -d /home/ubuntu ' + '-i {} -s trusty -r {} -u {}'.format( + image_alt.id, region_name, self.public_auth_url)) + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) return image_alt def deploy_orchestrator(self): # pylint: disable=too-many-locals @@ -234,47 +229,41 @@ class JujuEpc(singlevm.VmReady2): Bootstrap juju """ + self._publish_image() self.image_alt = self.publish_image_alt() self.flavor_alt = self.create_flavor_alt() self.__logger.info("Starting Juju Bootstrap process...") - try: - cmd = ['timeout', '-t', JujuEpc.juju_timeout, - 'juju', 'bootstrap', - 'abot-epc/{}'.format( - self.cloud.region_name if self.cloud.region_name else ( - 'RegionOne')), - 'abot-controller', - '--agent-version', '2.3.9', - '--metadata-source', '/root', - '--constraints', 'mem=2G', - '--bootstrap-series', 'xenial', - '--config', 'network={}'.format(self.network.id), - '--config', 'ssl-hostname-verification=false', - '--config', 'external-network={}'.format(self.ext_net.id), - '--config', 'use-floating-ip=true', - '--config', 'use-default-secgroup=true', - '--debug'] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) - except subprocess.CalledProcessError as cpe: - self.__logger.error( - "Exception with Juju Bootstrap: %s\n%s", - cpe.cmd, cpe.output.decode("utf-8")) - return False - except Exception: # pylint: disable=broad-except - self.__logger.exception("Some issue with Juju Bootstrap ...") - return False - - return True + region_name = self.cloud.region_name if self.cloud.region_name else ( + 'RegionOne') + (_, stdout, stderr) = self.ssh.exec_command( + 'timeout {} ' + '/snap/bin/juju bootstrap abot-epc/{} abot-controller ' + '--agent-version 2.3.9 --metadata-source /home/ubuntu ' + '--constraints mem=2G --bootstrap-series xenial ' + '--config network={} ' + '--config ssl-hostname-verification=false ' + '--config external-network={} ' + '--config use-floating-ip=true ' + '--config use-default-secgroup=true ' + '--debug'.format( + JujuEpc.juju_timeout, region_name, self.network.id, + self.ext_net.id)) + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + return not stdout.channel.recv_exit_status() def check_app(self, name='abot-epc-basic', status='active'): """Check application status.""" - cmd = ['juju', 'status', '--format', 'short', name] for i in range(10): - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) + (_, stdout, stderr) = self.ssh.exec_command( + '/snap/bin/juju status --format short {}'.format(name)) + output = stdout.read().decode("utf-8") + self.__logger.debug("stdout:\n%s", output) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + if stdout.channel.recv_exit_status(): + continue ret = re.search( - r'(?=workload:({})\))'.format(status), output.decode("utf-8")) + r'(?=workload:({})\))'.format(status), output) if ret: self.__logger.info("%s workload is %s", name, status) break @@ -289,72 +278,80 @@ class JujuEpc(singlevm.VmReady2): def deploy_vnf(self): """Deploy ABOT-OAI-EPC.""" self.__logger.info("Upload VNFD") - descriptor = self.vnf['descriptor'] + scpc = scp.SCPClient(self.ssh.get_transport()) + scpc.put( + '/src/epc-requirements/abot_charm', remote_path='~/', + recursive=True) self.__logger.info("Deploying Abot-epc bundle file ...") - cmd = ['juju', 'deploy', '{}'.format(descriptor.get('file_name'))] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) - self.__logger.info("Waiting for instances .....") - try: - 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.decode("utf-8")) - self.__logger.info("Deployed Abot-epc on Openstack") - except subprocess.CalledProcessError as cpe: - self.__logger.error( - "Exception with Juju VNF Deployment: %s\n%s", - cpe.cmd, cpe.output.decode("utf-8")) - return False - except Exception: # pylint: disable=broad-except - self.__logger.exception("Some issue with the VNF Deployment ..") - return False - + (_, stdout, stderr) = self.ssh.exec_command( + 'sudo mkdir -p /src/epc-requirements && ' + 'sudo mv abot_charm /src/epc-requirements/abot_charm && ' + '/snap/bin/juju deploy ' + '/src/epc-requirements/abot_charm/functest-abot-epc-bundle/' + 'bundle.yaml') + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + if stdout.channel.recv_exit_status(): + return not stdout.channel.recv_exit_status() + (_, stdout, stderr) = self.ssh.exec_command( + 'PATH=/snap/bin/:$PATH ' + 'timeout {} juju-wait'.format(JujuEpc.juju_timeout)) + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + if stdout.channel.recv_exit_status(): + return not stdout.channel.recv_exit_status() self.__logger.info("Checking status of ABot and EPC units ...") - cmd = ['juju', 'status'] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.debug("%s\n%s", " ".join(cmd), output.decode("utf-8")) + (_, stdout, stderr) = self.ssh.exec_command('/snap/bin/juju status') + output = stdout.read().decode("utf-8") + self.__logger.debug("stdout:\n%s", output) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + if stdout.channel.recv_exit_status(): + return not stdout.channel.recv_exit_status() for app in ['abot-epc-basic', 'oai-epc', 'oai-hss']: if not self.check_app(app): return False - - self.__logger.info("Transferring the feature files to Abot_node ...") - 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.decode("utf-8")) - - self.__logger.info("Copying the feature files within Abot_node ") - cmd = ['timeout', '-t', JujuEpc.juju_timeout, - 'juju', 'ssh', 'abot-epc-basic/0', - 'sudo', 'cp', '-vfR', '~/featureFiles/*', - '/etc/rebaca-test-suite/featureFiles'] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) - return True + scpc = scp.SCPClient(self.ssh.get_transport()) + scpc.put( + '{}/featureFiles'.format(self.case_dir), remote_path='~/', + recursive=True) + (_, stdout, stderr) = self.ssh.exec_command( + 'timeout {} /snap/bin/juju scp -- -r -v ~/featureFiles ' + 'abot-epc-basic/0:/etc/rebaca-test-suite/'.format( + JujuEpc.juju_timeout)) + output = stdout.read().decode("utf-8") + self.__logger.debug("stdout:\n%s", output) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + return not stdout.channel.recv_exit_status() def test_vnf(self): """Run test on ABoT.""" start_time = time.time() - self.__logger.info("Running VNF Test cases....") - cmd = ['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.decode("utf-8")) - - 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.decode("utf-8")) - + (_, stdout, stderr) = self.ssh.exec_command( + '/snap/bin/juju run-action abot-epc-basic/0 ' + 'run tagnames={}'.format(self.details['test_vnf']['tag_name'])) + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + if stdout.channel.recv_exit_status(): + return not stdout.channel.recv_exit_status() + (_, stdout, stderr) = self.ssh.exec_command( + 'PATH=/snap/bin/:$PATH ' + 'timeout {} juju-wait'.format(JujuEpc.juju_timeout)) + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + if stdout.channel.recv_exit_status(): + return not stdout.channel.recv_exit_status() duration = time.time() - start_time self.__logger.info("Getting results from Abot node....") - 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)] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) + (_, stdout, stderr) = self.ssh.exec_command( + 'timeout {} /snap/bin/juju scp -- -v abot-epc-basic/0:' + '/var/lib/abot-epc-basic/artifacts/TestResults.json .'.format( + JujuEpc.juju_timeout)) + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + if stdout.channel.recv_exit_status(): + return not stdout.channel.recv_exit_status() + scpc = scp.SCPClient(self.ssh.get_transport()) + scpc.get('TestResults.json', self.res_dir) self.__logger.info("Parsing the Test results...") res = (process_abot_test_result('{}/TestResults.json'.format( self.res_dir))) @@ -369,44 +366,41 @@ class JujuEpc(singlevm.VmReady2): short_result['failures'], short_result['skipped']) return True - def run(self, **kwargs): - self.start_time = time.time() + def execute(self): + """Prepare testcase (Additional pre-configuration steps).""" + assert self.public_auth_url + self.__logger.info("Additional pre-configuration steps") + try: + os.makedirs(self.res_dir) + except OSError as ex: + if ex.errno != errno.EEXIST: + self.__logger.exception("Cannot create %s", self.res_dir) + raise Exception + self.__logger.info("ENV:\n%s", env.string()) try: - assert super(JujuEpc, self).run(**kwargs) == self.EX_OK - self.prepare() - if (self.deploy_orchestrator() and - self.deploy_vnf() and - self.test_vnf()): - self.stop_time = time.time() - self.result = 100 - return self.EX_OK - self.result = 0 - self.stop_time = time.time() - return self.EX_TESTCASE_FAILED + assert self._install_juju() + assert self._install_juju_wait() + assert self._register_cloud() + assert self._register_credentials() + assert self.deploy_orchestrator() + assert self.deploy_vnf() + assert self.test_vnf() except Exception: # pylint: disable=broad-except - self.stop_time = time.time() - self.__logger.exception("Exception on VNF testing") - return self.EX_TESTCASE_FAILED + self.__logger.exception("juju_epc failed") + return 1 + return 0 def clean(self): """Clean created objects/functions.""" - try: - cmd = ['juju', 'debug-log', '--replay', '--no-tail'] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - self.__logger.debug( - "%s\n%s", " ".join(cmd), output.decode("utf-8")) - self.__logger.info("Destroying Orchestrator...") - 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.decode("utf-8")) - except subprocess.CalledProcessError as cpe: - self.__logger.error( - "Exception with Juju Cleanup: %s\n%s", - cpe.cmd, cpe.output.decode("utf-8")) - except Exception: # pylint: disable=broad-except - self.__logger.exception("General issue during the undeployment ..") + (_, stdout, stderr) = self.ssh.exec_command( + '/snap/bin/juju debug-log --replay --no-tail') + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) + (_, stdout, stderr) = self.ssh.exec_command( + '/snap/bin/juju destroy-controller -y abot-controller ' + '--destroy-all-models') + self.__logger.debug("stdout:\n%s", stdout.read().decode("utf-8")) + self.__logger.debug("stderr:\n%s", stderr.read().decode("utf-8")) for fip in self.cloud.list_floating_ips(): self.cloud.delete_floating_ip(fip.id) if self.image_alt: diff --git a/functest/opnfv_tests/vnf/ims/heat_ims.py b/functest/opnfv_tests/vnf/ims/heat_ims.py index 9ea9c5627..61f56c3ac 100644 --- a/functest/opnfv_tests/vnf/ims/heat_ims.py +++ b/functest/opnfv_tests/vnf/ims/heat_ims.py @@ -162,7 +162,7 @@ class HeatIms(singlevm.VmReady2): server.public_v4, username=username, key_filename=self.key_filename, timeout=timeout) (_, stdout, _) = ssh.exec_command('sudo monit summary') - self.__logger.info("output:\n%s", stdout.read()) + self.__logger.info("output:\n%s", stdout.read().decode("utf-8")) ssh.close() def deploy_vnf(self): diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py index b449d2d81..e9e2dc627 100644 --- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py +++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py @@ -40,6 +40,8 @@ class CloudifyVrouter(cloudify.Cloudify): flavor_alt_vcpus = 1 flavor_alt_disk = 3 + check_console_loop = 12 + cop_yaml = ("https://github.com/cloudify-cosmo/cloudify-openstack-plugin/" "releases/download/2.14.7/plugin.yaml") cop_wgn = ("https://github.com/cloudify-cosmo/cloudify-openstack-plugin/" diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index 226d4e69a..5ab82ecc4 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -103,15 +103,19 @@ class OSRallyTesting(unittest.TestCase): mock_method.assert_called() mock_os_makedirs.assert_called() - def test_get_task_id_default(self): - cmd_raw = b'Task 1: started' - self.assertEqual(self.rally_base.get_task_id(cmd_raw), - '1') - - def test_get_task_id_missing_id(self): - cmd_raw = b'' - self.assertEqual(self.rally_base.get_task_id(cmd_raw), - None) + @mock.patch('subprocess.check_output', return_value=b'1\n') + def test_get_task_id_default(self, *args): + tag = 'nova' + self.assertEqual(self.rally_base.get_task_id(tag), '1') + args[0].assert_called_with( + ['rally', 'task', 'list', '--tag', tag, '--uuids-only']) + + @mock.patch('subprocess.check_output', return_value=b'\n') + def test_get_task_id_missing_id(self, *args): + tag = 'nova' + self.assertEqual(self.rally_base.get_task_id(tag), '') + args[0].assert_called_with( + ['rally', 'task', 'list', '--tag', tag, '--uuids-only']) def test_task_succeed_fail(self): json_raw = json.dumps({}) @@ -291,8 +295,8 @@ class OSRallyTesting(unittest.TestCase): def test_prepare_run_flavor_alt_creation_failed(self, *args): # pylint: disable=unused-argument self.rally_base.stests = ['test1', 'test2'] - with mock.patch.object(self.rally_base.cloud, - 'list_hypervisors') as mock_list_hyperv, \ + with mock.patch.object(self.rally_base, 'count_hypervisors') \ + as mock_list_hyperv, \ mock.patch.object(self.rally_base, 'create_flavor_alt', side_effect=Exception) \ as mock_create_flavor: diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py index 87438ae7c..71aa5a257 100644 --- a/functest/tests/unit/openstack/tempest/test_tempest.py +++ b/functest/tests/unit/openstack/tempest/test_tempest.py @@ -125,7 +125,8 @@ class OSTempestTesting(unittest.TestCase): return_value=['test1', 'test2']): self.tempestcommon.tempest_blacklist = Exception os.environ['DEPLOY_SCENARIO'] = 'deploy_scenario' - self.tempestcommon.apply_tempest_blacklist() + self.tempestcommon.apply_tempest_blacklist( + self.tempestcommon.tempest_blacklist) obj = mock_open() obj.write.assert_any_call('test1\n') obj.write.assert_any_call('test2\n') @@ -147,7 +148,8 @@ class OSTempestTesting(unittest.TestCase): mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'yaml.safe_load', return_value=item_dict): os.environ['DEPLOY_SCENARIO'] = 'deploy_scenario' - self.tempestcommon.apply_tempest_blacklist() + self.tempestcommon.apply_tempest_blacklist( + self.tempestcommon.tempest_blacklist) obj = mock_open() obj.write.assert_any_call('test1\n') self.assertFalse(obj.write.assert_any_call('test2\n')) diff --git a/functest/tests/unit/openstack/vping/test_vping_ssh.py b/functest/tests/unit/openstack/vping/test_vping_ssh.py index 05482ed6b..98afe0853 100644 --- a/functest/tests/unit/openstack/vping/test_vping_ssh.py +++ b/functest/tests/unit/openstack/vping/test_vping_ssh.py @@ -61,22 +61,38 @@ class VpingSSHTesting(unittest.TestCase): '{}-vm2_{}'.format(self.vping.case_name, self.vping.guid), security_groups=[self.vping.sec.id]) - def test_execute_exc(self): - self.vping.vm2 = munch.Munch(private_v4='127.0.0.1') + @mock.patch('functest.opnfv_tests.openstack.vping.vping_ssh.VPingSSH.' + 'check_regex_in_console', return_value=True) + def test_execute_exc(self, *args): + self.vping.vm2 = munch.Munch(private_v4='127.0.0.1', name='foo') self.vping.ssh = mock.Mock() self.vping.ssh.exec_command.side_effect = ssh_exception.SSHException with self.assertRaises(ssh_exception.SSHException): self.vping.execute() self.vping.ssh.exec_command.assert_called_once_with( 'ping -c 1 {}'.format(self.vping.vm2.private_v4)) + args[0].assert_called_once_with('foo') + + @mock.patch('functest.opnfv_tests.openstack.vping.vping_ssh.VPingSSH.' + 'check_regex_in_console', return_value=False) + def test_execute_exc2(self, *args): + self.vping.vm2 = munch.Munch(private_v4='127.0.0.1', name='foo') + self.vping.ssh = mock.Mock() + self.vping.execute() + self.vping.ssh.exec_command.assert_not_called() + args[0].assert_called_once_with('foo') def _test_execute(self, ret=0): - self.vping.vm2 = munch.Munch(private_v4='127.0.0.1') + self.vping.vm2 = munch.Munch(private_v4='127.0.0.1', name='foo') self.vping.ssh = mock.Mock() stdout = mock.Mock() stdout.channel.recv_exit_status.return_value = ret self.vping.ssh.exec_command.return_value = (None, stdout, mock.Mock()) - self.assertEqual(self.vping.execute(), ret) + with mock.patch('functest.opnfv_tests.openstack.vping.vping_ssh.' + 'VPingSSH.check_regex_in_console', + return_value=True) as mock_check: + self.assertEqual(self.vping.execute(), ret) + mock_check.assert_called_once_with('foo') self.vping.ssh.exec_command.assert_called_once_with( 'ping -c 1 {}'.format(self.vping.vm2.private_v4)) diff --git a/functest/tests/unit/vnf/ims/test_clearwater.py b/functest/tests/unit/vnf/ims/test_clearwater.py index 435b172db..f590a2857 100644 --- a/functest/tests/unit/vnf/ims/test_clearwater.py +++ b/functest/tests/unit/vnf/ims/test_clearwater.py @@ -38,6 +38,7 @@ class ClearwaterTesting(unittest.TestCase): 'cookies': ""} self.mock_post_200.configure_mock(**attrs) + if __name__ == "__main__": logging.disable(logging.CRITICAL) unittest.main(verbosity=2) diff --git a/functest/utils/env.py b/functest/utils/env.py index ba8d6ce55..2e312726c 100644 --- a/functest/utils/env.py +++ b/functest/utils/env.py @@ -29,18 +29,19 @@ INPUTS = { 'NODE_NAME': env.INPUTS['NODE_NAME'], 'POD_ARCH': None, 'TEST_DB_URL': env.INPUTS['TEST_DB_URL'], - 'ENERGY_RECORDER_API_URL': env.INPUTS['ENERGY_RECORDER_API_URL'], - 'ENERGY_RECORDER_API_USER': env.INPUTS['ENERGY_RECORDER_API_USER'], - 'ENERGY_RECORDER_API_PASSWORD': env.INPUTS['ENERGY_RECORDER_API_PASSWORD'], 'VOLUME_DEVICE_NAME': 'vdb', 'IMAGE_PROPERTIES': '', 'FLAVOR_EXTRA_SPECS': '', 'NAMESERVER': '8.8.8.8', 'NEW_USER_ROLE': 'Member', 'USE_DYNAMIC_CREDENTIALS': 'True', - 'BLOCK_MIGRATION': 'True', + 'BLOCK_MIGRATION': 'False', 'CLEAN_ORPHAN_SECURITY_GROUPS': 'True', - 'PUBLIC_ENDPOINT_ONLY': 'False' + 'SKIP_DOWN_HYPERVISORS': 'False', + 'PUBLIC_ENDPOINT_ONLY': 'False', + 'DASHBOARD_URL': '', + 'VMTP_HYPERVISORS': '', + 'NO_TENANT_NETWORK': 'False' } diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index c953dca81..98121199b 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -11,10 +11,12 @@ from __future__ import print_function import logging +import os import subprocess import sys import yaml +from openstack.cloud import _utils import six LOGGER = logging.getLogger(__name__) @@ -138,6 +140,51 @@ def get_openstack_version(cloud): return "Unknown" +def list_services(cloud): + # pylint: disable=protected-access + """Search Keystone services via $OS_INTERFACE. + + It mainly conforms with `Shade + <https://docs.openstack.org/shade/latest>`_ but allows testing vs + public endpoints. It's worth mentioning that it doesn't support keystone + v2. + + :returns: a list of ``munch.Munch`` containing the services description + + :raises: ``OpenStackCloudException`` if something goes wrong during the + openstack API call. + """ + url, key = '/services', 'services' + data = cloud._identity_client.get( + url, endpoint_filter={ + 'interface': os.environ.get('OS_INTERFACE', 'public')}, + error_message="Failed to list services") + services = cloud._get_and_munchify(key, data) + return _utils.normalize_keystone_services(services) + + +def search_services(cloud, name_or_id=None, filters=None): + # pylint: disable=protected-access + """Search Keystone services ia $OS_INTERFACE. + + It mainly conforms with `Shade + <https://docs.openstack.org/shade/latest>`_ but allows testing vs + public endpoints. It's worth mentioning that it doesn't support keystone + v2. + + :param name_or_id: Name or id of the desired service. + :param filters: a dict containing additional filters to use. e.g. + {'type': 'network'}. + + :returns: a list of ``munch.Munch`` containing the services description + + :raises: ``OpenStackCloudException`` if something goes wrong during the + openstack API call. + """ + services = list_services(cloud) + return _utils._filter_list(services, name_or_id, filters) + + def convert_dict_to_ini(value): "Convert dict to oslo.conf input" assert isinstance(value, dict) |