X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=systest%2Ftestcases%2Fvim%2Ftest_vim.py;h=a80ae708875e9976d894db02b323fcb79647a63c;hb=84fe31f632166d2fbf566968bd25aa9545e96fdc;hp=5ea7077e5cc4a8cac5f6ab5e11156c7bd44d2a0b;hpb=c7a82d0be7c72183e6db9e0fb522b484f9c8df84;p=osm%2Fdevops.git diff --git a/systest/testcases/vim/test_vim.py b/systest/testcases/vim/test_vim.py index 5ea7077e..a80ae708 100644 --- a/systest/testcases/vim/test_vim.py +++ b/systest/testcases/vim/test_vim.py @@ -20,6 +20,7 @@ import time @pytest.mark.vim @pytest.mark.openstack +@pytest.mark.vmware class TestClass(object): def test_empty_vim(self,osm): @@ -29,22 +30,73 @@ 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) - - resp=osm.get_api().vim.get('pytest') - assert resp['name'] == 'pytest' - assert resp['type'] == 'openstack' - assert resp['vim_url'] == os_access['os-url'] - assert resp['vim_url_admin'] == os_access['os-url'] - assert resp['vim_tenants'][0]['user'] == os_access['os-username'] - assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['os-project-name'] - - assert not osm.get_api().vim.delete('pytest') + 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(vim_name) + assert resp['name'] == vim_name + assert resp['vim_type'] == 'openstack' + assert resp['vim_url'] == os_access['vim-url'] + assert resp['vim_user'] == os_access['vim-username'] + assert resp['vim_tenant_name'] == os_access['vim-tenant-name'] + 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 = {} + 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(vim_name) + assert resp['name'] == vim_name + assert resp['vim_type'] == 'vmware' + assert resp['vim_url'] == os_access['vim-url'] + assert resp['vim_user'] == os_access['vim-username'] + assert resp['vim_tenant_name'] == os_access['vim-tenant-name'] + 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['vim_type'] == vim['vim-type'] + assert resp['vim_url'] == os_access['vim-url'] + assert resp['vim_user'] == os_access['vim-username'] + assert resp['vim_tenant_name'] == os_access['vim-tenant-name'] + + for vim in osm.get_api().vim.list(False): + osm.get_api().vim.delete(vim['name'])