SNAPS tests now support offline testing.
authorspisarski <s.pisarski@cablelabs.com>
Wed, 31 May 2017 18:46:36 +0000 (12:46 -0600)
committerspisarski <s.pisarski@cablelabs.com>
Tue, 27 Jun 2017 19:29:01 +0000 (13:29 -0600)
Images by type (cirros, centos, ubuntu) can now have the download URL be
overridden, told to leverage a local file, or have custom configuration
when using the snaps.openstack.tests.openstack_tests.py image settings
helper functions.

JIRA: FUNCTEST-809

Change-Id: I790094a7a26eb5a55f53d6e875c658dc5e7ac2f9
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
functest/ci/config_aarch64_patch.yaml
functest/ci/config_functest.yaml
functest/ci/download_images.sh
functest/opnfv_tests/openstack/snaps/api_check.py
functest/opnfv_tests/openstack/snaps/health_check.py
functest/opnfv_tests/openstack/snaps/smoke.py
functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
functest/opnfv_tests/openstack/vping/vping_base.py

index 80cf4cc..45af8d7 100644 (file)
@@ -5,14 +5,6 @@ os:
             image_file_name:  cirros-d161201-aarch64-disk.img
             image_password:  gocubsgo
 
-    snaps_health_check:
-        disk_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img
-        kernel_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-kernel
-        ramdisk_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-initramfs
-        extra_properties:
-            os_command_line: root=/dev/vdb1 rw rootwait console=tty0 console=ttyS0 console=ttyAMA0
-            hw_video_model: vga
-
     vping:
         image_name: TestVM
 
index 1199be5..e02c197 100644 (file)
@@ -13,7 +13,6 @@ general:
         repo_copper:        /home/opnfv/repos/copper
         repo_parser:        /home/opnfv/repos/parser
         repo_domino:        /home/opnfv/repos/domino
-        repo_snaps:         /home/opnfv/repos/snaps
         repo_fds:           /home/opnfv/repos/fds
         repo_securityscan:  /home/opnfv/repos/securityscanning
         repo_vrouter:       /home/opnfv/repos/vnfs/vrouter
@@ -58,19 +57,14 @@ snaps:
     use_keystone: True
     use_floating_ips: True
     images:
+      glance_tests:
+        disk_file: /home/opnfv/functest/images/cirros-0.3.5-x86_64-disk.img
       cirros:
         disk_file: /home/opnfv/functest/images/cirros-0.3.5-x86_64-disk.img
-        # ARM
-#        disk_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img
-#        kernel_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-kernel
-#        ramdisk_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-initramfs
-#        extra_properties:
-#            os_command_line: root=/dev/vdb1 rw rootwait console=tty0 console=ttyS0 console=ttyAMA0
-#            hw_video_model: vga
-#      ubuntu:
-#        disk_url: http://uec-images.ubuntu.com/releases/trusty/14.04/ubuntu-14.04-server-cloudimg-amd64-disk1.img
-#      centos:
-#        disk_url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
+      ubuntu:
+        disk_file: /home/opnfv/functest/images/ubuntu-14.04-server-cloudimg-amd64-disk1.img
+      centos:
+        disk_file: /home/opnfv/functest/images/CentOS-7-x86_64-GenericCloud.qcow2
 
 vping:
     ping_timeout:   200
index f3fdef2..23e09c1 100755 (executable)
@@ -28,4 +28,11 @@ wget -nc http://artifacts.opnfv.org/sdnvpn/ubuntu-16.04-server-cloudimg-amd64-di
 wget -nc ${CIRROS_REPO_URL}/daily/20${CIRROS_AARCH64_TAG}/cirros-d${CIRROS_AARCH64_TAG}-aarch64-disk.img -P ${IMAGES_FOLDER_DIR}
 wget -nc ${CIRROS_REPO_URL}/daily/20${CIRROS_AARCH64_TAG}/cirros-d${CIRROS_AARCH64_TAG}-aarch64-initramfs -P ${IMAGES_FOLDER_DIR}
 wget -nc ${CIRROS_REPO_URL}/daily/20${CIRROS_AARCH64_TAG}/cirros-d${CIRROS_AARCH64_TAG}-aarch64-kernel -P ${IMAGES_FOLDER_DIR}
+
+# Add Ubuntu 14 qcow2 image
+wget -nc http://uec-images.ubuntu.com/releases/trusty/14.04/ubuntu-14.04-server-cloudimg-amd64-disk1.img -P ${IMAGES_FOLDER_DIR}
+
+# Add Centos 7 qcow2 image
+wget -nc http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 -P ${IMAGES_FOLDER_DIR}
+
 set +ex
\ No newline at end of file
index 43518cb..c3cd906 100644 (file)
@@ -37,5 +37,6 @@ class ApiCheck(SnapsTestRunner):
             suite=self.suite,
             os_creds=self.os_creds,
             ext_net_name=self.ext_net_name,
-            use_keystone=self.use_keystone)
+            use_keystone=self.use_keystone,
+            image_metadata=self.image_metadata)
         return super(self.__class__, self).run()
index 4e94460..1b8d053 100644 (file)
@@ -8,9 +8,8 @@
 
 import unittest
 
-from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
-    SnapsTestRunner
-from functest.utils.constants import CONST
+from functest.opnfv_tests.openstack.snaps.snaps_test_runner import (
+    SnapsTestRunner)
 
 from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase
 from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck
@@ -35,15 +34,11 @@ class HealthCheck(SnapsTestRunner):
         :param kwargs: the arguments to pass on
         :return:
         """
-        image_custom_config = None
-
-        if hasattr(CONST, 'snaps_images_cirros'):
-            image_custom_config = CONST.__getattribute__('snaps_images_cirros')
         self.suite.addTest(
             OSIntegrationTestCase.parameterize(
                 SimpleHealthCheck, os_creds=self.os_creds,
                 ext_net_name=self.ext_net_name,
                 use_keystone=self.use_keystone,
                 flavor_metadata=self.flavor_metadata,
-                image_metadata=image_custom_config))
+                image_metadata=self.image_metadata))
         return super(self.__class__, self).run()
index c3c55c7..7a3eb2f 100644 (file)
@@ -6,14 +6,12 @@
 #
 # http://www.apache.org/licenses/LICENSE-2.0
 
-import os
 import unittest
 
 from snaps import test_suite_builder
 
-from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
-    SnapsTestRunner
-from functest.utils.constants import CONST
+from functest.opnfv_tests.openstack.snaps.snaps_test_runner import (
+    SnapsTestRunner)
 
 
 class SnapsSmoke(SnapsTestRunner):
@@ -35,23 +33,12 @@ class SnapsSmoke(SnapsTestRunner):
         :param kwargs: the arguments to pass on
         :return:
         """
-        image_config = None
-        if hasattr(CONST, 'snaps_images_cirros'):
-            image_config = CONST.__getattribute__('snaps_images_cirros')
-
-        # Tests requiring floating IPs leverage files contained within the
-        # SNAPS repository and are found relative to that path
-        if self.use_fip:
-            snaps_dir = os.path.join(CONST.__getattribute__('dir_repo_snaps'),
-                                     'snaps')
-            os.chdir(snaps_dir)
-
         test_suite_builder.add_openstack_integration_tests(
             suite=self.suite,
             os_creds=self.os_creds,
             ext_net_name=self.ext_net_name,
             use_keystone=self.use_keystone,
             flavor_metadata=self.flavor_metadata,
-            image_metadata=image_config,
+            image_metadata=self.image_metadata,
             use_floating_ips=self.use_fip)
         return super(self.__class__, self).run()
index e8a4215..0b87440 100644 (file)
@@ -46,3 +46,7 @@ class SnapsTestRunner(unit.Suite):
             self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
 
         self.logger.info("Using flavor metadata '%s'", self.flavor_metadata)
+
+        self.image_metadata = None
+        if hasattr(CONST, 'snaps_images'):
+            self.image_metadata = CONST.__getattribute__('snaps_images')
index 7146067..d3405ab 100644 (file)
@@ -25,7 +25,7 @@ from snaps.openstack.tests import openstack_tests
 from snaps.openstack.utils import deploy_utils, nova_utils
 
 
-class VPingBase(testcase.OSGCTestCase):
+class VPingBase(testcase.TestCase):
 
     """
     Base class for vPing tests that check connectivity between two VMs shared