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)
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'])