From: Mike Marchetti Date: Fri, 17 Nov 2017 15:31:43 +0000 (-0500) Subject: add smoke tests X-Git-Tag: v3.0.2~15 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F5702%2F1;p=osm%2Fdevops.git add smoke tests - upload package tests - vim create/delete Signed-off-by: Mike Marchetti Change-Id: I94a4e57972733d6a60d67f69cf9391ab3e82a49c --- diff --git a/systest/Makefile b/systest/Makefile index 6631eb16..929896f3 100644 --- a/systest/Makefile +++ b/systest/Makefile @@ -165,10 +165,14 @@ ns_scale: check_OSM_HOSTNAME check_openstack_env \ JUNITXML=pytest-$@.xml \ PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m ns_scale" _run_test -smoke: check_OSM_HOSTNAME +smoke: check_OSM_HOSTNAME \ + $(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/cirros_vnf.tar.gz \ + $(DESCRIPTOR_DIR)/nsd/cirros_ns/build/cirros_ns.tar.gz $(Q)$(MAKE) \ JUNITXML=pytest-$@.xml \ - PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m smoke" _run_test + PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m smoke" _run_test \ + TEST_VNFD_DESCRIPTORS=$(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/cirros_vnf.tar.gz \ + TEST_NSD_DESCRIPTORS=$(DESCRIPTOR_DIR)/nsd/cirros_ns/build/cirros_ns.tar.gz vim: check_OSM_HOSTNAME check_openstack_env $(Q)$(MAKE) \ diff --git a/systest/testcases/smoke/test_smoke.py b/systest/testcases/smoke/test_smoke.py index e915e23f..650cf057 100644 --- a/systest/testcases/smoke/test_smoke.py +++ b/systest/testcases/smoke/test_smoke.py @@ -33,3 +33,28 @@ class TestClass(object): def test_empty_ns_catalog(self,osm): assert not osm.get_api().nsd.list() + + def vnf_upload_packages(self, osm, descriptor_file_list ): + for file in descriptor_file_list: + assert not osm.get_api().package.upload(file) + assert not osm.get_api().package.wait_for_upload(file) + desc = osm.get_api().package.get_key_val_from_pkg(file) + assert desc + + def delete_all_packages(self, osm): + for nsd in osm.get_api().nsd.list(): + assert not osm.get_api().nsd.delete(nsd['name']) + + for vnfd in osm.get_api().vnfd.list(): + assert not osm.get_api().vnfd.delete(vnfd['name']) + + def test_upload_vnf_package(self, osm): + vnfd_file_list = osm.vnfd_descriptors_list + nsd_file_list = osm.nsd_descriptors_list + # upload vnfd's + self.vnf_upload_packages(osm, vnfd_file_list ) + # upload nsd's + self.vnf_upload_packages(osm, nsd_file_list ) + + # now delete all packages + self.delete_all_packages(osm) diff --git a/systest/testcases/vim/test_vim.py b/systest/testcases/vim/test_vim.py index d622753c..2769fd05 100644 --- a/systest/testcases/vim/test_vim.py +++ b/systest/testcases/vim/test_vim.py @@ -30,37 +30,77 @@ class TestClass(object): def cleanup_test_add_vim_account(self,osm,request): def teardown(): try: - osm.get_api().vim.delete('pytest') + for vim in osm.get_api().vim.list(False): + osm.get_api().vim.delete(vim['name']) except: pass request.addfinalizer(teardown) @pytest.mark.openstack + @pytest.mark.smoke def test_add_vim_account(self,osm,openstack,cleanup_test_add_vim_account): - os_access=openstack.get_access() - assert not osm.get_api().vim.create('pytest',os_access) + os_access = {} + vim_name = 'helloworld-os' + os_access['vim-url'] = 'https://169.254.169.245/' + os_access['vim-username'] = 'pytest2' + os_access['vim-password'] = 'fred' + os_access['vim-tenant-name'] = 'pytest3' + os_access['vim-type'] = 'openstack' + os_access['description'] = 'a test vim' + assert not osm.get_api().vim.create(vim_name,os_access) - resp=osm.get_api().vim.get('pytest') - assert resp['name'] == 'pytest' + resp=osm.get_api().vim.get(vim_name) + assert resp['name'] == vim_name assert resp['type'] == 'openstack' assert resp['vim_url'] == os_access['vim-url'] assert resp['vim_url_admin'] == os_access['vim-url'] assert resp['vim_tenants'][0]['user'] == os_access['vim-username'] assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name'] - - assert not osm.get_api().vim.delete('pytest') + assert not osm.get_api().vim.delete(vim_name) @pytest.mark.vmware + @pytest.mark.smoke def test_add_vim_account_vmware(self,osm,vmware,cleanup_test_add_vim_account): - os_access=vmware.get_access() - assert not osm.get_api().vim.create('pytest',os_access) + os_access = {} + vim_name = 'helloworld-vmware' + os_access['vim-url'] = 'https://169.254.169.245/' + os_access['vim-username'] = 'pytest2' + os_access['vim-password'] = 'fred' + os_access['vim-tenant-name'] = 'pytest3' + os_access['vim-type'] = 'vmware' + os_access['description'] = 'a test vim' + assert not osm.get_api().vim.create(vim_name,os_access) - resp=osm.get_api().vim.get('pytest') - assert resp['name'] == 'pytest' + resp=osm.get_api().vim.get(vim_name) + assert resp['name'] == vim_name assert resp['type'] == 'vmware' assert resp['vim_url'] == os_access['vim-url'] assert resp['vim_url_admin'] == os_access['vim-url'] assert resp['vim_tenants'][0]['user'] == os_access['vim-username'] assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name'] - assert not osm.get_api().vim.delete('pytest') + assert not osm.get_api().vim.delete(vim_name) + + @pytest.mark.smoke + def test_add_multiple_accounts(self,osm,cleanup_test_add_vim_account): + os_access = {} + vims = [ {'name': 'testvim1', 'vim-type': 'openstack'}, {'name': 'testvim2','vim-type': 'vmware'} ] + os_access['vim-url'] = 'https://169.254.169.245/' + os_access['vim-username'] = 'pytest2' + os_access['vim-password'] = 'fred' + os_access['vim-tenant-name'] = 'pytest3' + os_access['description'] = 'a test vim' + + for vim in vims: + os_access['vim-type'] = vim['vim-type'] + assert not osm.get_api().vim.create(vim['name'],os_access) + resp=osm.get_api().vim.get(vim['name']) + assert resp['name'] == vim['name'] + assert resp['type'] == vim['vim-type'] + assert resp['vim_url'] == os_access['vim-url'] + assert resp['vim_url_admin'] == os_access['vim-url'] + assert resp['vim_tenants'][0]['user'] == os_access['vim-username'] + assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name'] + + for vim in osm.get_api().vim.list(False): + osm.get_api().vim.delete(vim['name'])