add smoke tests 02/5702/1
authorMike Marchetti <mmarchetti@sandvine.com>
Fri, 17 Nov 2017 15:31:43 +0000 (10:31 -0500)
committerMike Marchetti <mmarchetti@sandvine.com>
Fri, 17 Nov 2017 15:31:43 +0000 (10:31 -0500)
- upload package tests
- vim create/delete
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
Change-Id: I94a4e57972733d6a60d67f69cf9391ab3e82a49c

systest/Makefile
systest/testcases/smoke/test_smoke.py
systest/testcases/vim/test_vim.py

index 6631eb1..929896f 100644 (file)
@@ -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) \
index e915e23..650cf05 100644 (file)
@@ -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)
index d622753..2769fd0 100644 (file)
@@ -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'])