Merge "[odl-sfc] Add function to retrieve a resource from HEAT"
authorMorgan Richomme <morgan.richomme@orange.com>
Wed, 1 Mar 2017 08:55:31 +0000 (08:55 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Wed, 1 Mar 2017 08:55:31 +0000 (08:55 +0000)
13 files changed:
docker/add_images.sh
docs/internship/testapi_evolution/index.rst
docs/userguide/runfunctest.rst
docs/userguide/troubleshooting.rst
functest/ci/config_functest.yaml
functest/ci/config_patch.yaml
functest/ci/prepare_env.py
functest/ci/testcases.yaml
functest/opnfv_tests/openstack/rally/scenario/templates/server_with_ports.yaml.template
functest/opnfv_tests/openstack/rally/scenario/templates/server_with_volume.yaml.template
functest/opnfv_tests/openstack/tempest/custom_tests/test_list.txt [new file with mode: 0644]
functest/opnfv_tests/openstack/tempest/tempest.py
functest/utils/config.py [changed mode: 0644->0755]

index a43e0ba..af2956c 100755 (executable)
@@ -4,14 +4,14 @@
 # and places them in the functest docker image
 
 CIRROS_REPO_URL=http://download.cirros-cloud.net
-CIRROS_AARCH64_TAG=daily/20161201
+CIRROS_AARCH64_TAG=161201
 CIRROS_X86_64_TAG=0.3.5
 
-wget ${CIRROS_REPO_URL}/${CIRROS_X86_64_TAG}/cirros-${CIRROS_X86_64_TAG}-x86_64-disk.img
+wget ${CIRROS_REPO_URL}/${CIRROS_X86_64_TAG}/cirros-${CIRROS_X86_64_TAG}-x86_64-disk.img -P ${FUNCTEST_BASE_DIR}/data/
 wget ${CIRROS_REPO_URL}/${CIRROS_X86_64_TAG}/cirros-${CIRROS_X86_64_TAG}-x86_64-lxc.tar.gz -P ${FUNCTEST_BASE_DIR}/data/
 wget http://205.177.226.237:9999/onosfw/firewall_block_image.img -P ${FUNCTEST_BASE_DIR}/data/
 
 # Add the 3-part image for aarch64, since functest can be run from an x86 machine to test an aarch64 POD
-wget ${CIRROS_REPO_URL}/daily/${CIRROS_AARCH64_TAG}/cirros-$(basename ${CIRROS_AARCH64_TAG})-aarch64-disk.img -P ${FUNCTEST_BASE_DIR}/data/
-wget ${CIRROS_REPO_URL}/daily/${CIRROS_AARCH64_TAG}/cirros-$(basename ${CIRROS_AARCH64_TAG})-aarch64-initramfs -P ${FUNCTEST_BASE_DIR}/data/
-wget ${CIRROS_REPO_URL}/daily/${CIRROS_AARCH64_TAG}/cirros-$(basename ${CIRROS_AARCH64_TAG})-aarch64-kernel -P ${FUNCTEST_BASE_DIR}/data/
+wget ${CIRROS_REPO_URL}/daily/20${CIRROS_AARCH64_TAG}/cirros-d${CIRROS_AARCH64_TAG}-aarch64-disk.img -P ${FUNCTEST_BASE_DIR}/data/
+wget ${CIRROS_REPO_URL}/daily/20${CIRROS_AARCH64_TAG}/cirros-d${CIRROS_AARCH64_TAG}-aarch64-initramfs -P ${FUNCTEST_BASE_DIR}/data/
+wget ${CIRROS_REPO_URL}/daily/20${CIRROS_AARCH64_TAG}/cirros-d${CIRROS_AARCH64_TAG}-aarch64-kernel -P ${FUNCTEST_BASE_DIR}/data/
index 9cca9eb..6a1cde7 100644 (file)
@@ -234,4 +234,4 @@ _`[4]` : http://artifacts.opnfv.org/testapibackup.html
 
 _`[5]` : http://artifacts.opnfv.org/releng/docs/testapi.html
 
-_`[6]` : http://artifacts.opnfv.org/functest/review/26047/devguide/index.html#test-api-authorization
+_`[6]` : http://artifacts.opnfv.org/functest/docs/devguide/index.html#test-api-authorization
index b5c7191..e7ab84b 100644 (file)
@@ -174,7 +174,7 @@ To execute a Test Tier or Test Case, the 'run' command is used::
   2016-06-30 11:50:31,865 - run_tests - INFO - ============================================
   2016-06-30 11:50:31,865 - run_tests - INFO - Running test case 'vping_ssh'...
   2016-06-30 11:50:31,865 - run_tests - INFO - ============================================
-  2016-06-30 11:50:32,977 - vping_ssh - INFO - Creating image 'functest-vping' from '/home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img'...
+  2016-06-30 11:50:32,977 - vping_ssh - INFO - Creating image 'functest-vping' from '/home/opnfv/functest/data/cirros-0.3.5-x86_64-disk.img'...
   2016-06-30 11:50:45,470 - vping_ssh - INFO - Creating neutron network vping-net...
   2016-06-30 11:50:47,645 - vping_ssh - INFO - Creating security group  'vPing-sg'...
   2016-06-30 11:50:48,843 - vping_ssh - INFO - Using existing Flavor 'm1.small'...
index 1b7bf9b..8455019 100644 (file)
@@ -100,7 +100,7 @@ In this case, proceed to create it manually. These are some hints::
     --protocol tcp --port-range-min 80 --port-range-max 80 --remote-ip-prefix 0.0.0.0/0
 
 The next step is to create the instances. The image used is located in
-*/home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img* and a Glance image is created
+*/home/opnfv/functest/data/cirros-0.3.5-x86_64-disk.img* and a Glance image is created
 with the name **functest-vping**. If booting the instances fails (i.e. the status
 is not **ACTIVE**), you can check why it failed by doing::
 
index 489c395..1120e7e 100755 (executable)
@@ -43,8 +43,8 @@ general:
         creds: /home/opnfv/functest/conf/openstack.creds
         snapshot_file: /home/opnfv/functest/conf/openstack_snapshot.yaml
 
-        image_name: Cirros-0.3.4
-        image_file_name:  cirros-0.3.4-x86_64-disk.img
+        image_name: Cirros-0.3.5
+        image_file_name:  cirros-0.3.5-x86_64-disk.img
         image_disk_format:  qcow2
         image_username:  cirros
         image_password:  cubswin:)
@@ -67,7 +67,7 @@ general:
         testcases_yaml: /home/opnfv/repos/functest/functest/ci/testcases.yaml
 
 healthcheck:
-    disk_image: /home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img
+    disk_image: /home/opnfv/functest/data/cirros-0.3.5-x86_64-disk.img
     disk_format: qcow2
     wait_time: 60
 
index 46064a0..d984a3f 100755 (executable)
@@ -1,12 +1,12 @@
 lxd:
     general:
         openstack:
-            image_name: Cirros-0.3.4
-            image_file_name:  cirros-0.3.4-x86_64-lxc.tar.gz
+            image_name: Cirros-0.3.5
+            image_file_name:  cirros-0.3.5-x86_64-lxc.tar.gz
             image_disk_format:  raw
 
     healthcheck:
-        disk_image: /home/opnfv/functest/data/cirros-0.3.4-x86_64-lxc.tar.gz
+        disk_image: /home/opnfv/functest/data/cirros-0.3.5-x86_64-lxc.tar.gz
         disk_format: raw
 fdio:
     general:
index f5bae6a..724ea14 100755 (executable)
@@ -31,6 +31,7 @@ logger = ft_logger.Logger("prepare_env").getLogger()
 handler = None
 # set the architecture to default
 pod_arch = None
+arch_filter = ['aarch64']
 
 CONFIG_FUNCTEST_PATH = CONST.CONFIG_FUNCTEST_YAML
 CONFIG_PATCH_PATH = os.path.join(os.path.dirname(
@@ -115,24 +116,28 @@ def get_deployment_handler():
                                          'functest/ci/installer_params.yaml')
     if (CONST.INSTALLER_IP and CONST.INSTALLER_TYPE and
             CONST.INSTALLER_TYPE in opnfv_constants.INSTALLERS):
-        installer_params = ft_utils.get_parameter_from_yaml(
-            CONST.INSTALLER_TYPE, installer_params_yaml)
-
-        user = installer_params.get('user', None)
-        password = installer_params.get('password', None)
-        pkey = installer_params.get('pkey', None)
-
         try:
-            handler = factory.Factory.get_handler(
-                installer=CONST.INSTALLER_TYPE,
-                installer_ip=CONST.INSTALLER_IP,
-                installer_user=user,
-                installer_pwd=password,
-                pkey_file=pkey)
-            if handler:
-                pod_arch = handler.get_arch()
-        except Exception as e:
-            logger.debug("Cannot get deployment information. %s" % e)
+            installer_params = ft_utils.get_parameter_from_yaml(
+                CONST.INSTALLER_TYPE, installer_params_yaml)
+        except ValueError as e:
+            logger.debug('Printing deployment info is not supported for %s' %
+                         CONST.INSTALLER_TYPE)
+            logger.debug(e)
+        else:
+            user = installer_params.get('user', None)
+            password = installer_params.get('password', None)
+            pkey = installer_params.get('pkey', None)
+            try:
+                handler = factory.Factory.get_handler(
+                    installer=CONST.INSTALLER_TYPE,
+                    installer_ip=CONST.INSTALLER_IP,
+                    installer_user=user,
+                    installer_pwd=password,
+                    pkey_file=pkey)
+                if handler:
+                    pod_arch = handler.get_arch()
+            except Exception as e:
+                logger.debug("Cannot get deployment information. %s" % e)
 
 
 def create_directories():
@@ -196,8 +201,7 @@ def source_rc_file():
             raise Exception("The file %s is empty." % CONST.openstack_creds)
 
     logger.info("Sourcing the OpenStack RC file...")
-    os_utils.source_credentials(
-        CONST.openstack_creds)
+    os_utils.source_credentials(CONST.openstack_creds)
     for key, value in os.environ.iteritems():
         if re.search("OS_", key):
             if key == 'OS_AUTH_URL':
@@ -210,10 +214,15 @@ def source_rc_file():
                 CONST.OS_PASSWORD = value
 
 
-def patch_config_file(patch_file_path, arch_filter=None):
-    if arch_filter and pod_arch not in arch_filter:
-        return
+def patch_config_file():
+    patch_file(CONFIG_PATCH_PATH)
+
+    if pod_arch and pod_arch in arch_filter:
+        patch_file(CONFIG_AARCH64_PATCH_PATH)
+
 
+def patch_file(patch_file_path):
+    logger.debug('Updating file: %s', patch_file_path)
     with open(patch_file_path) as f:
         patch_file = yaml.safe_load(f)
 
@@ -250,7 +259,7 @@ def verify_deployment():
 def install_rally():
     print_separator()
 
-    if 'aarch64' in pod_arch:
+    if pod_arch and pod_arch in arch_filter:
         logger.info("Apply aarch64 specific to rally config...")
         with open(RALLY_AARCH64_PATCH_PATH, "r") as f:
             rally_patch_conf = f.read()
@@ -350,8 +359,7 @@ def main(**kwargs):
             get_deployment_handler()
             create_directories()
             source_rc_file()
-            patch_config_file(CONFIG_PATCH_PATH)
-            patch_config_file(CONFIG_AARCH64_PATCH_PATH, 'aarch64')
+            patch_config_file()
             verify_deployment()
             install_rally()
             install_tempest()
index eea1f51..ed3a0b8 100755 (executable)
@@ -397,6 +397,22 @@ tiers:
                 run:
                     module: 'functest.opnfv_tests.openstack.tempest.tempest'
                     class: 'TempestDefcore'
+            -
+                name: tempest_custom
+                criteria: 'success_rate == 100%'
+                blocking: false
+                description: >-
+                    The test case allows running a customized list of tempest
+                    test cases defined in a file under
+                    <dir_functest_repo>/functest/opnfv_tests/openstack/
+                      /tempest/custom_tests/test_list.txt
+                    The file is empty and can be customized with the desired tests.
+                dependencies:
+                    installer: 'unknown'
+                    scenario: 'unknown'
+                run:
+                    module: 'functest.opnfv_tests.openstack.tempest.tempest'
+                    class: 'TempestCustom'
 #            -
 #                name: rally_full
 #                criteria: 'success_rate >= 90%'
index 909f45d..ed5e61f 100644 (file)
@@ -7,7 +7,7 @@ parameters:
     default: public
   image:
     type: string
-    default: cirros-0.3.4-x86_64-uec
+    default: cirros-0.3.5-x86_64-uec
   flavor:
     type: string
     default: m1.tiny
index 826ca9d..116b5bb 100644 (file)
@@ -4,7 +4,7 @@ parameters:
   # set all correct defaults for parameters before launch test
   image:
     type: string
-    default: cirros-0.3.4-x86_64-uec
+    default: cirros-0.3.5-x86_64-uec
   flavor:
     type: string
     default: m1.tiny
diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/test_list.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/test_list.txt
new file mode 100644 (file)
index 0000000..ac4e372
--- /dev/null
@@ -0,0 +1,4 @@
+# This is an empty file to be filled up with the desired tempest test cases
+# Examples:
+#tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
+#tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops
\ No newline at end of file
index 37b5c0e..4c96500 100644 (file)
@@ -324,11 +324,11 @@ class TempestMultisite(TempestCommon):
 
 class TempestCustom(TempestCommon):
 
-    def __init__(self, mode, option):
+    def __init__(self):
         TempestCommon.__init__(self)
         self.case_name = "tempest_custom"
-        self.MODE = mode
-        self.OPTION = option
+        self.MODE = "custom"
+        self.OPTION = "--concurrency 1"
 
 
 class TempestDefcore(TempestCommon):
old mode 100644 (file)
new mode 100755 (executable)
index 84166c1..b5b8450
@@ -2,26 +2,25 @@ import os
 
 import yaml
 
+import env
+
 
 class Config(object):
     def __init__(self):
-        if 'CONFIG_FUNCTEST_YAML' not in os.environ:
-            raise Exception('CONFIG_FUNCTEST_YAML not configed')
-        self.config_functest = os.environ['CONFIG_FUNCTEST_YAML']
         try:
-            with open(self.config_functest) as f:
+            with open(env.ENV.CONFIG_FUNCTEST_YAML) as f:
                 self.functest_yaml = yaml.safe_load(f)
                 self._parse(None, self.functest_yaml)
-        except:
-            raise Exception('Parse {} failed'.format(self.config_functest))
+        except Exception as error:
+            raise Exception('Parse config failed: {}'.format(str(error)))
         self._set_others()
 
     def _parse(self, attr_now, left_parametes):
         for param_n, param_v in left_parametes.iteritems():
             attr_further = self._get_attr_further(attr_now, param_n)
-            if not isinstance(param_v, dict):
+            if attr_further:
                 self.__setattr__(attr_further, param_v)
-            else:
+            if isinstance(param_v, dict):
                 self._parse(attr_further, param_v)
 
     def _get_attr_further(self, attr_now, next):
@@ -33,3 +32,8 @@ class Config(object):
 
 
 CONF = Config()
+
+if __name__ == "__main__":
+    print CONF.vnf_cloudify_ims
+    print CONF.vnf_cloudify_ims_tenant_images
+    print CONF.vnf_cloudify_ims_tenant_images_centos_7