diff options
-rwxr-xr-x | ci/exec_test.sh | 4 | ||||
-rw-r--r-- | ci/testcases.yaml | 8 | ||||
-rw-r--r-- | docker/Dockerfile | 4 | ||||
-rw-r--r-- | testcases/Controllers/ONOS/Teston/onosfunctest.py | 71 |
4 files changed, 39 insertions, 48 deletions
diff --git a/ci/exec_test.sh b/ci/exec_test.sh index 519ade4b6..362cd9ec1 100755 --- a/ci/exec_test.sh +++ b/ci/exec_test.sh @@ -137,6 +137,10 @@ function run_test(){ "copper") python ${FUNCTEST_REPO_DIR}/testcases/features/copper.py ;; + "moon") + # TODO put the link to Moon script to be run (if test runnable) here + ${repos_dir}/moon/tests/run_tests.sh + ;; *) echo "The test case '${test_name}' does not exist." exit 1 diff --git a/ci/testcases.yaml b/ci/testcases.yaml index 491ddad90..25aba04e5 100644 --- a/ci/testcases.yaml +++ b/ci/testcases.yaml @@ -150,6 +150,14 @@ tiers: dependencies: installer: 'apex' scenario: '' + - + name: moon + criteria: 'status == "PASS"' + description: >- + Security management system for OPNFV + dependencies: + installer: 'compass' + scenario: '(odl)*(moon)' - name: openstack diff --git a/docker/Dockerfile b/docker/Dockerfile index 30d2a7a15..04be6f80f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -79,6 +79,7 @@ RUN git clone https://github.com/wuwenbin2/OnosSystemTest.git ${repos_dir}/onos RUN git clone https://github.com/opnfv/promise ${repos_dir}/promise RUN git clone https://gerrit.opnfv.org/gerrit/ovno ${repos_dir}/ovno RUN git clone https://gerrit.opnfv.org/gerrit/copper ${repos_dir}/copper +RUN git clone https://gerrit.opnfv.org/gerrit/moon ${repos_dir}/moon RUN pip install -r ${repos_dir}/functest/docker/requirements.pip RUN pip install -r ${repos_dir}/rally/requirements.txt @@ -92,6 +93,9 @@ ADD http://205.177.226.237:9999/onosfw/firewall_block_image.img /home/opnfv/func RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 RUN curl -L https://get.rvm.io | bash -s stable +RUN /bin/bash -c ". /home/opnfv/repos/functest/testcases/features/sfc/tacker_client_install.sh" +RUN cd ${repos_dir}/bgpvpn && pip install . + RUN /bin/bash -c ". /etc/profile.d/rvm.sh \ && cd /home/opnfv/repos/vims-test \ && rvm autolibs enable" diff --git a/testcases/Controllers/ONOS/Teston/onosfunctest.py b/testcases/Controllers/ONOS/Teston/onosfunctest.py index 780e36c99..bd00d476d 100644 --- a/testcases/Controllers/ONOS/Teston/onosfunctest.py +++ b/testcases/Controllers/ONOS/Teston/onosfunctest.py @@ -14,36 +14,25 @@ lanqinglong@huawei.com # """ -# import argparse import datetime import os import re import time -import yaml - -from keystoneclient.v2_0 import client as keystoneclient -from glanceclient import client as glanceclient import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as functest_utils import functest.utils.openstack_utils as openstack_utils -# parser = argparse.ArgumentParser() -# parser.add_argument("-i", "--installer", help="Installer type") -# args = parser.parse_args() """ logging configuration """ logger = ft_logger.Logger("onos").getLogger() -with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: - functest_yaml = yaml.safe_load(f) -f.close() - # onos parameters -TEST_DB = functest_yaml.get("results").get("test_db_url") -ONOS_REPO_PATH = functest_yaml.get("general").get("directories").get( - "dir_repos") -ONOS_CONF_DIR = functest_yaml.get("general").get("directories").get( - "dir_functest_conf") +TEST_DB = functest_utils.get_parameter_from_yaml( + "results.test_db_url") +ONOS_REPO_PATH = functest_utils.get_parameter_from_yaml( + "general.directories.dir_repos") +ONOS_CONF_DIR = functest_utils.get_parameter_from_yaml( + "general.directories.dir_functest_conf") REPO_PATH = ONOS_REPO_PATH + '/functest/' if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) @@ -56,14 +45,14 @@ HOME = os.environ['HOME'] + "/" INSTALLER_TYPE = os.environ['INSTALLER_TYPE'] DEPLOY_SCENARIO = os.environ['DEPLOY_SCENARIO'] ONOSCI_PATH = ONOS_REPO_PATH + "/" -GLANCE_IMAGE_NAME = functest_yaml.get("onos_sfc").get("image_name") -GLANCE_IMAGE_FILENAME = functest_yaml.get("onos_sfc").get("image_file_name") -GLANCE_IMAGE_FORMAT = functest_yaml.get("general").get("openstack").get( - "image_disk_format") -GLANCE_IMAGE_PATH = functest_yaml.get("general").get("directories").get( - "dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME -SFC_PATH = REPO_PATH + functest_yaml.get("general").get("directories").get( - "dir_onos_sfc") +GLANCE_IMAGE_NAME = functest_utils.get_parameter_from_yaml( + "onos_sfc.image_name") +GLANCE_IMAGE_FILENAME = functest_utils.get_parameter_from_yaml( + "onos_sfc.image_file_name") +GLANCE_IMAGE_PATH = functest_utils.get_parameter_from_yaml( + "general.directories.dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME +SFC_PATH = REPO_PATH + functest_utils.get_parameter_from_yaml( + "general.directories.dir_onos_sfc") def RunScript(testname): @@ -179,30 +168,16 @@ def CleanOnosTest(): def CreateImage(): - creds_keystone = openstack_utils.get_credentials("keystone") - keystone_client = keystoneclient.Client(**creds_keystone) - glance_endpoint = keystone_client.service_catalog.url_for( - service_type='image', endpoint_type='publicURL') - glance_client = glanceclient.Client(1, glance_endpoint, - token=keystone_client.auth_token) + glance_client = openstack_utils.get_glance_client() + image_id = openstack_utils.create_glance_image(glance_client, + GLANCE_IMAGE_NAME, + GLANCE_IMAGE_PATH) EXIT_CODE = -1 - # Check if the given image exists - image_id = openstack_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME) - if image_id != '': - logger.info("Using existing image '%s'..." % GLANCE_IMAGE_NAME) - global image_exists - image_exists = True - else: - logger.info("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME, - GLANCE_IMAGE_PATH)) - image_id = openstack_utils.create_glance_image(glance_client, - GLANCE_IMAGE_NAME, - GLANCE_IMAGE_PATH) - if not image_id: - logger.error("Failed to create a Glance image...") - return(EXIT_CODE) - logger.debug("Image '%s' with ID=%s created successfully." - % (GLANCE_IMAGE_NAME, image_id)) + if not image_id: + logger.error("Failed to create a Glance image...") + return(EXIT_CODE) + logger.debug("Image '%s' with ID=%s created successfully." + % (GLANCE_IMAGE_NAME, image_id)) def SfcTest(): |