aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile15
-rw-r--r--docker/Dockerfile.aarch6413
-rw-r--r--docs/release/release-notes/index.rst2
-rw-r--r--docs/testing/developer/devguide/index.rst1
-rw-r--r--docs/testing/user/configguide/configguide.rst1
-rw-r--r--functest/ci/config_aarch64_patch.yaml8
-rwxr-xr-xfunctest/ci/config_functest.yaml4
-rwxr-xr-xfunctest/ci/run_tests.py5
-rwxr-xr-xfunctest/ci/testcases.yaml113
-rw-r--r--functest/core/pytest_suite_runner.py2
-rw-r--r--functest/core/vnf_base.py6
-rw-r--r--functest/opnfv_tests/features/barometer.py5
-rwxr-xr-xfunctest/opnfv_tests/features/security_scan.py4
-rw-r--r--functest/opnfv_tests/openstack/snaps/api_check.py9
-rw-r--r--functest/opnfv_tests/openstack/snaps/connection_check.py9
-rw-r--r--functest/opnfv_tests/openstack/snaps/health_check.py21
-rw-r--r--functest/opnfv_tests/openstack/snaps/smoke.py16
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py30
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py24
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py9
-rwxr-xr-xfunctest/opnfv_tests/sdn/odl/odl.py16
-rw-r--r--functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py38
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py2
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.yaml2
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestra_ims.py211
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestra_ims.yaml14
-rw-r--r--functest/tests/unit/ci/__init__.py0
-rw-r--r--functest/tests/unit/ci/test_prepare_env.py347
-rw-r--r--functest/tests/unit/odl/test_odl.py26
-rw-r--r--functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py0
-rw-r--r--functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py92
-rw-r--r--functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py279
-rw-r--r--functest/utils/functest_constants.py209
-rwxr-xr-xrun_unit_tests.sh12
34 files changed, 1093 insertions, 452 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index de47e157..bb54943d 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -14,7 +14,7 @@ LABEL version="0.1" description="OPNFV Functest Docker container"
# Environment variables
ARG BRANCH=master
ARG RALLY_TAG=0.8.1
-ARG TEMPEST_TAG=14.0.0
+ARG TEMPEST_TAG=15.0.0
ARG ODL_TAG=release/beryllium-sr4
ARG OPENSTACK_TAG=stable/mitaka
ARG KINGBIRD_TAG=0.2.2
@@ -54,6 +54,7 @@ libpq-dev \
libssl-dev \
libxml2-dev \
libxslt-dev \
+libzmq3-dev \
python-dev \
python-mock \
python-pip \
@@ -85,6 +86,7 @@ RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/doctor ${REPO
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/ovno ${REPOS_DIR}/ovno
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/promise ${REPOS_DIR}/promise
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/netready ${REPOS_DIR}/netready
+RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/fds ${REPOS_DIR}/fds
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/barometer ${REPOS_DIR}/barometer
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sfc ${REPOS_DIR}/sfc
RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/snaps ${REPOS_DIR}/snaps
@@ -108,10 +110,10 @@ RUN pip install -r ${REPOS_DIR}/tempest/requirements.txt
RUN cd ${FUNCTEST_REPO_DIR} \
&& pip install -r requirements.txt \
- && pip install .
+ && pip install -e .
RUN cd ${RELENG_MODULE_DIR} \
- && pip install .
+ && pip install -e .
RUN cd ${REPOS_DIR}/barometer \
&& pip install .
@@ -133,12 +135,11 @@ RUN pip install -e ${REPOS_DIR}/snaps/
# SFC integration
RUN /bin/bash -c ". ${REPOS_DIR}/sfc/sfc/tests/functest/setup_scripts/tacker_client_install.sh"
-RUN cd ${REPOS_DIR}/sfc && pip install .
+RUN cd ${REPOS_DIR}/sfc && pip install -e .
# SDNVPN integration
-RUN cd ${REPOS_DIR}/sdnvpn && pip install .
-
-RUN cd ${REPOS_DIR}/bgpvpn && pip install .
+RUN cd ${REPOS_DIR}/sdnvpn && pip install -e .
+RUN cd ${REPOS_DIR}/bgpvpn && pip install -e .
# Kingbird integration
RUN cd ${REPOS_DIR}/kingbird && pip install -e .
diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64
index a469801f..4281dbdc 100644
--- a/docker/Dockerfile.aarch64
+++ b/docker/Dockerfile.aarch64
@@ -14,7 +14,7 @@ LABEL version="0.1" description="OPNFV Functest Aarch64 Docker container"
# Environment variables
ARG BRANCH=master
ARG RALLY_TAG=0.8.1
-ARG TEMPEST_TAG=14.0.0
+ARG TEMPEST_TAG=15.0.0
ARG ODL_TAG=release/beryllium-sr4
ARG OPENSTACK_TAG=stable/mitaka
ARG KINGBIRD_TAG=0.2.2
@@ -105,10 +105,10 @@ RUN pip install -r ${REPOS_DIR}/tempest/requirements.txt
RUN cd ${FUNCTEST_REPO_DIR} \
&& pip install -r requirements.txt \
- && pip install .
+ && pip install -e .
RUN cd ${RELENG_MODULE_DIR} \
- && pip install .
+ && pip install -e .
RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
-not -path "*tests/unit*" |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \
@@ -127,12 +127,11 @@ RUN pip install -e ${REPOS_DIR}/snaps/
# SFC integration
RUN /bin/bash -c ". ${REPOS_DIR}/sfc/sfc/tests/functest/setup_scripts/tacker_client_install.sh"
-RUN cd ${REPOS_DIR}/sfc && pip install .
+RUN cd ${REPOS_DIR}/sfc && pip install -e .
# SDNVPN integration
-RUN cd ${REPOS_DIR}/sdnvpn && pip install .
-
-RUN cd ${REPOS_DIR}/bgpvpn && pip install .
+RUN cd ${REPOS_DIR}/sdnvpn && pip install -e .
+RUN cd ${REPOS_DIR}/bgpvpn && pip install -e .
# Kingbird integration
RUN cd ${REPOS_DIR}/kingbird && pip install -e .
diff --git a/docs/release/release-notes/index.rst b/docs/release/release-notes/index.rst
index 6c6d1810..25ee4771 100644
--- a/docs/release/release-notes/index.rst
+++ b/docs/release/release-notes/index.rst
@@ -1,3 +1,5 @@
+.. _functest-releasenotes:
+
**********************
Functest Release Notes
**********************
diff --git a/docs/testing/developer/devguide/index.rst b/docs/testing/developer/devguide/index.rst
index 11ca241b..ce5dc77b 100644
--- a/docs/testing/developer/devguide/index.rst
+++ b/docs/testing/developer/devguide/index.rst
@@ -197,7 +197,6 @@ functest/utils/
|-- config.py
|-- constants.py
|-- env.py
-|-- functest_constants.py
|-- functest_logger.py
|-- functest_utils.py
|-- openstack_clean.py
diff --git a/docs/testing/user/configguide/configguide.rst b/docs/testing/user/configguide/configguide.rst
index 1bb8358a..6bec8925 100644
--- a/docs/testing/user/configguide/configguide.rst
+++ b/docs/testing/user/configguide/configguide.rst
@@ -426,7 +426,6 @@ follows::
|-- config.py
|-- constants.py
|-- env.py
- |-- functest_constants.py
|-- functest_logger.py
|-- functest_utils.py
|-- openstack
diff --git a/functest/ci/config_aarch64_patch.yaml b/functest/ci/config_aarch64_patch.yaml
index 9a345e3f..b43b5a76 100644
--- a/functest/ci/config_aarch64_patch.yaml
+++ b/functest/ci/config_aarch64_patch.yaml
@@ -5,10 +5,10 @@ os:
image_file_name: cirros-d161201-aarch64-disk.img
image_password: gocubsgo
- snaps_simple_healthcheck:
- disk_image: /home/opnfv/functest/data/cirros-d161201-aarch64-disk.img
- kernel_image: /home/opnfv/functest/data/cirros-d161201-aarch64-kernel
- ramdisk_image: /home/opnfv/functest/data/cirros-d161201-aarch64-initramfs
+ 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
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index 402e2999..b358a332 100755
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -28,8 +28,9 @@ general:
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/vrouter
+ repo_vrouter: /home/opnfv/repos/vnfs/vrouter
functest: /home/opnfv/functest
functest_test: /home/opnfv/repos/functest/functest/opnfv_tests
results: /home/opnfv/functest/results
@@ -38,6 +39,7 @@ general:
functest_data: /home/opnfv/functest/data
ims_data: /home/opnfv/functest/data/ims/
rally_inst: /home/opnfv/.rally
+ repo_kingbird: /home/opnfv/repos/kingbird
openstack:
creds: /home/opnfv/functest/conf/openstack.creds
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index 0e951eff..4a47ba57 100755
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -19,7 +19,6 @@ import sys
import functest.ci.generate_report as generate_report
import functest.ci.tier_builder as tb
import functest.core.testcase_base as testcase_base
-import functest.utils.functest_constants as ft_constants
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_clean as os_clean
@@ -84,16 +83,12 @@ def source_rc_file():
for key, value in os.environ.iteritems():
if re.search("OS_", key):
if key == 'OS_AUTH_URL':
- ft_constants.OS_AUTH_URL = value
CONST.OS_AUTH_URL = value
elif key == 'OS_USERNAME':
- ft_constants.OS_USERNAME = value
CONST.OS_USERNAME = value
elif key == 'OS_TENANT_NAME':
- ft_constants.OS_TENANT_NAME = value
CONST.OS_TENANT_NAME = value
elif key == 'OS_PASSWORD':
- ft_constants.OS_PASSWORD = value
CONST.OS_PASSWORD = value
diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml
index 1a1d0f4b..41541223 100755
--- a/functest/ci/testcases.yaml
+++ b/functest/ci/testcases.yaml
@@ -8,22 +8,6 @@ tiers:
operations in the VIM.
testcases:
-
- name: snaps_health_check
- criteria: 'status == "PASS"'
- blocking: true
- clean_flag: false
- description: >-
- This test case creates executes the SimpleHealthCheck
- Python test class which creates an, image, flavor, network,
- and Cirros VM instance and observes the console output to
- validate the single port obtains the correct IP address.
- dependencies:
- installer: ''
- scenario: '^((?!lxd).)*$'
- run:
- module: 'functest.opnfv_tests.openstack.snaps.health_check'
- class: 'HealthCheck'
- -
name: connection_check
criteria: 'status == "PASS"'
blocking: true
@@ -60,6 +44,22 @@ tiers:
run:
module: 'functest.opnfv_tests.openstack.snaps.api_check'
class: 'ApiCheck'
+ -
+ name: snaps_health_check
+ criteria: 'status == "PASS"'
+ blocking: true
+ clean_flag: false
+ description: >-
+ This test case creates executes the SimpleHealthCheck
+ Python test class which creates an, image, flavor, network,
+ and Cirros VM instance and observes the console output to
+ validate the single port obtains the correct IP address.
+ dependencies:
+ installer: ''
+ scenario: '^((?!lxd).)*$'
+ run:
+ module: 'functest.opnfv_tests.openstack.snaps.health_check'
+ class: 'HealthCheck'
-
name: smoke
order: 1
@@ -161,8 +161,8 @@ tiers:
some test suites from upstream using Robot as the
test framework.
dependencies:
- installer: ''
- scenario: 'netvirt'
+ installer: 'apex'
+ scenario: 'os-odl_l3-nofeature'
run:
module: 'functest.opnfv_tests.sdn.odl.odl'
class: 'ODLTests'
@@ -173,6 +173,25 @@ tiers:
- /home/opnfv/repos/odl_test/csit/suites/openstack/connectivity
-
+ name: fds
+ criteria: 'success_rate == 100%'
+ blocking: false
+ clean_flag: false
+ description: >-
+ Test Suite for the OpenDaylight SDN Controller when GBP features are
+ installed. It integrates some test suites from upstream using
+ Robot as the test framework.
+ dependencies:
+ installer: 'apex'
+ scenario: 'odl_l2-fdio'
+ run:
+ module: 'functest.opnfv_tests.sdn.odl.odl'
+ class: 'ODLTests'
+ args:
+ suites:
+ - /home/opnfv/repos/fds/testing/robot
+
+ -
name: onos
criteria: 'status == "PASS"'
blocking: true
@@ -204,7 +223,7 @@ tiers:
dependencies:
installer: '^((?!netvirt).)*$'
- scenario: ''
+ scenario: '^((?!lxd).)*$'
run:
module: 'functest.opnfv_tests.openstack.snaps.smoke'
class: 'SnapsSmoke'
@@ -239,7 +258,7 @@ tiers:
description: >-
Test suite from Doctor project.
dependencies:
- installer: '(apex)|(fuel)|(joid)'
+ installer: '(apex)|(fuel)'
scenario: '^((?!fdio).)*$'
run:
module: 'functest.opnfv_tests.features.doctor'
@@ -351,19 +370,6 @@ tiers:
module: 'functest.opnfv_tests.features.domino'
class: 'Domino'
-
- name: orchestra
- criteria: 'ret == 0'
- blocking: false
- clean_flag: true
- description: >-
- Test OpenBaton (Orchestra) stack
- dependencies:
- installer: 'joid'
- scenario: 'unknown'
- run:
- module: 'functest.opnfv_tests.features.orchestrator.orchestra'
- class: 'OpenbatonOrchestrator'
- -
name: netready
criteria: 'status == "PASS"'
blocking: false
@@ -481,34 +487,19 @@ tiers:
run:
module: 'functest.opnfv_tests.vnf.ims.cloudify_ims'
class: 'ImsVnf'
- -
- name: aaa
- criteria: 'ret == 0'
- blocking: false
- clean_flag: true
- description: >-
- Test suite from Parser project.
- dependencies:
- installer: ''
- scenario: ''
- run:
- module: 'functest.opnfv_tests.vnf.aaa.aaa'
- class: 'AaaVnf'
-
- -
- name: juju_epc
- criteria: 'ret == 0'
- blocking: false
- clean_flag: true
- description: >-
- Test suite from OAI project, vEPC deployed with Juju.
- dependencies:
- installer: 'unknown'
- scenario: 'unknown'
- run:
- module: 'functest.opnfv_tests.vnf.epc.epc'
- class: 'EpcVnf'
-
+# -
+# name: aaa
+# criteria: 'ret == 0'
+# blocking: false
+# clean_flag: true
+# description: >-
+# Test suite from Parser project.
+# dependencies:
+# installer: ''
+# scenario: ''
+# run:
+# module: 'functest.opnfv_tests.vnf.aaa.aaa'
+# class: 'AaaVnf'
-
name: orchestra_ims
criteria: 'ret == 0'
diff --git a/functest/core/pytest_suite_runner.py b/functest/core/pytest_suite_runner.py
index c168d7d9..f0ae265a 100644
--- a/functest/core/pytest_suite_runner.py
+++ b/functest/core/pytest_suite_runner.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-#
# Copyright (c) 2015 All rights reserved
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py
index 9438dca1..daf8b806 100644
--- a/functest/core/vnf_base.py
+++ b/functest/core/vnf_base.py
@@ -79,7 +79,8 @@ class VnfOnBoardingBase(base.TestcaseBase):
self.details['vnf']['result'] = res_deploy_vnf['result']
self.details['vnf']['duration'] = round(
vnf_ready_time - orchestrator_ready_time, 1)
- except:
+ except Exception:
+ self.logger.error("Error during VNF deployment", exc_info=True)
raise Exception("Error during VNF deployment")
# Test VNF
@@ -91,7 +92,8 @@ class VnfOnBoardingBase(base.TestcaseBase):
self.details['test_vnf']['result'] = res_test_vnf['result']
self.details['test_vnf']['duration'] = round(
test_vnf_done_time - vnf_ready_time, 1)
- except:
+ except Exception:
+ self.logger.error("Error when running VNF tests", exc_info=True)
raise Exception("Error when running VNF tests")
# Clean the system
diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py
index aec2bce5..32067284 100644
--- a/functest/opnfv_tests/features/barometer.py
+++ b/functest/opnfv_tests/features/barometer.py
@@ -6,11 +6,9 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+from baro_tests import collectd
import functest.core.feature_base as base
-import functest.utils.functest_logger as ft_logger
-
-from baro_tests import collectd
class BarometerCollectd(base.FeatureBase):
@@ -22,7 +20,6 @@ class BarometerCollectd(base.FeatureBase):
super(BarometerCollectd, self).__init__(project='barometer',
case='barometercollectd',
repo='dir_repo_barometer')
- self.logger = ft_logger.Logger("BarometerCollectd").getLogger()
def execute(self):
return collectd.main(self.logger)
diff --git a/functest/opnfv_tests/features/security_scan.py b/functest/opnfv_tests/features/security_scan.py
index 2db44175..58f0ec74 100755
--- a/functest/opnfv_tests/features/security_scan.py
+++ b/functest/opnfv_tests/features/security_scan.py
@@ -17,8 +17,8 @@ class SecurityScan(base.FeatureBase):
super(SecurityScan, self).__init__(project='securityscanning',
case='security_scan',
repo='dir_repo_securityscan')
- self.cmd = ('bash {0} && '
+ self.cmd = ('. {0}/stackrc && '
'cd {1} && '
'python security_scan.py --config config.ini && '
- 'cd -'.format(CONST.openstack_creds,
+ 'cd -'.format(CONST.dir_functest_conf,
self.repo))
diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py
index 17d05b92..ad77d9be 100644
--- a/functest/opnfv_tests/openstack/snaps/api_check.py
+++ b/functest/opnfv_tests/openstack/snaps/api_check.py
@@ -9,12 +9,12 @@ import unittest
from snaps import test_suite_builder
-from functest.core.pytest_suite_runner import PyTestSuiteRunner
-from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
+ SnapsTestRunner
from functest.utils.constants import CONST
-class ApiCheck(PyTestSuiteRunner):
+class ApiCheck(SnapsTestRunner):
"""
This test executes the Python Tests included with the SNAPS libraries
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
@@ -25,10 +25,9 @@ class ApiCheck(PyTestSuiteRunner):
self.suite = unittest.TestSuite()
self.case_name = "api_check"
- ext_net_name = snaps_utils.get_ext_net_name()
test_suite_builder.add_openstack_api_tests(
self.suite,
CONST.openstack_creds,
- ext_net_name,
+ self.ext_net_name,
use_keystone=CONST.snaps_use_keystone)
diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py
index 11f8ad07..0637bcfb 100644
--- a/functest/opnfv_tests/openstack/snaps/connection_check.py
+++ b/functest/opnfv_tests/openstack/snaps/connection_check.py
@@ -9,12 +9,12 @@ import unittest
from snaps import test_suite_builder
-from functest.core.pytest_suite_runner import PyTestSuiteRunner
-from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
+ SnapsTestRunner
from functest.utils.constants import CONST
-class ConnectionCheck(PyTestSuiteRunner):
+class ConnectionCheck(SnapsTestRunner):
"""
This test executes the Python Tests included with the SNAPS libraries
that simply obtain the different OpenStack clients and may perform
@@ -25,10 +25,9 @@ class ConnectionCheck(PyTestSuiteRunner):
self.suite = unittest.TestSuite()
self.case_name = "connection_check"
- ext_net_name = snaps_utils.get_ext_net_name()
test_suite_builder.add_openstack_client_tests(
self.suite,
CONST.openstack_creds,
- ext_net_name,
+ self.ext_net_name,
use_keystone=CONST.snaps_use_keystone)
diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py
index 993c1000..8fece746 100644
--- a/functest/opnfv_tests/openstack/snaps/health_check.py
+++ b/functest/opnfv_tests/openstack/snaps/health_check.py
@@ -7,15 +7,15 @@
import unittest
+from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
+ SnapsTestRunner
+from functest.utils.constants import CONST
+
from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase
from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck
-from functest.core.pytest_suite_runner import PyTestSuiteRunner
-from functest.opnfv_tests.openstack.snaps import snaps_utils
-from functest.utils.constants import CONST
-
-class HealthCheck(PyTestSuiteRunner):
+class HealthCheck(SnapsTestRunner):
"""
This test executes the SNAPS Python Test case SimpleHealthCheck which
creates a VM with a single port with an IPv4 address that is assigned by
@@ -26,9 +26,14 @@ class HealthCheck(PyTestSuiteRunner):
self.suite = unittest.TestSuite()
self.case_name = "snaps_health_check"
- ext_net_name = snaps_utils.get_ext_net_name()
+
+ image_custom_config = None
+ if hasattr(CONST, 'snaps_health_check'):
+ image_custom_config = CONST.snaps_health_check
self.suite.addTest(
OSIntegrationTestCase.parameterize(
- SimpleHealthCheck, CONST.openstack_creds, ext_net_name,
- use_keystone=CONST.snaps_use_keystone))
+ SimpleHealthCheck, CONST.openstack_creds, self.ext_net_name,
+ use_keystone=CONST.snaps_use_keystone,
+ flavor_metadata=self.flavor_metadata,
+ image_metadata=image_custom_config))
diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py
index 83eb6600..864bca5e 100644
--- a/functest/opnfv_tests/openstack/snaps/smoke.py
+++ b/functest/opnfv_tests/openstack/snaps/smoke.py
@@ -10,12 +10,12 @@ import unittest
from snaps import test_suite_builder
-from functest.core.pytest_suite_runner import PyTestSuiteRunner
-from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
+ SnapsTestRunner
from functest.utils.constants import CONST
-class SnapsSmoke(PyTestSuiteRunner):
+class SnapsSmoke(SnapsTestRunner):
"""
This test executes the Python Tests included with the SNAPS libraries
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
@@ -27,7 +27,12 @@ class SnapsSmoke(PyTestSuiteRunner):
self.suite = unittest.TestSuite()
self.case_name = "snaps_smoke"
use_fip = CONST.snaps_use_floating_ips
- ext_net_name = snaps_utils.get_ext_net_name()
+
+ # The snaps smoke test uses the same config as the
+ # snaps_health_check suite, so reuse it here
+ image_custom_config = None
+ if hasattr(CONST, 'snaps_health_check'):
+ image_custom_config = CONST.snaps_health_check
# Tests requiring floating IPs leverage files contained within the
# SNAPS repository and are found relative to that path
@@ -38,6 +43,7 @@ class SnapsSmoke(PyTestSuiteRunner):
test_suite_builder.add_openstack_integration_tests(
self.suite,
CONST.openstack_creds,
- ext_net_name,
+ self.ext_net_name,
use_keystone=CONST.snaps_use_keystone,
+ image_metadata=image_custom_config,
use_floating_ips=use_fip)
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
new file mode 100644
index 00000000..67cd9415
--- /dev/null
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -0,0 +1,30 @@
+# Copyright (c) 2015 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+
+from functest.core.pytest_suite_runner import PyTestSuiteRunner
+from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.utils import functest_utils
+
+from snaps.openstack import create_flavor
+
+
+class SnapsTestRunner(PyTestSuiteRunner):
+ """
+ This test executes the SNAPS Python Test case SimpleHealthCheck which
+ creates a VM with a single port with an IPv4 address that is assigned by
+ DHCP. This test then validates the expected IP with the actual
+ """
+ def __init__(self):
+ super(SnapsTestRunner, self).__init__()
+
+ self.ext_net_name = snaps_utils.get_ext_net_name()
+
+ scenario = functest_utils.get_scenario()
+
+ self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_ANY
+ if 'ovs' in scenario or 'fdio' in scenario:
+ self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 893fff8c..2c113367 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -106,6 +106,17 @@ def get_verifier_deployment_dir(verifier_id, deployment_id):
'for-deployment-{}'.format(deployment_id))
+def get_repo_tag(repo):
+ """
+ Returns last tag of current branch
+ """
+ cmd = ("git -C {0} describe --abbrev=0 HEAD".format(repo))
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
+ tag = p.stdout.readline().rstrip()
+
+ return str(tag)
+
+
def backup_tempest_config(conf_file):
"""
Copy config file to tempest results directory
@@ -276,3 +287,16 @@ def configure_tempest_multisite_params(tempest_conf_file):
config.write(config_file)
backup_tempest_config(tempest_conf_file)
+
+
+def install_verifier_ext(path):
+ """
+ Install extension to active verifier
+ """
+ logger.info("Installing verifier from existing repo...")
+ tag = get_repo_tag(path)
+ cmd = ("rally verify add-verifier-ext --source {0} "
+ "--version {1}"
+ .format(path, tag))
+ error_msg = ("Problem while adding verifier extension from %s" % path)
+ ft_utils.execute_command_raise(cmd, error_msg=error_msg)
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index 4c96500d..a6ce4ee6 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -160,13 +160,9 @@ class TempestCommon(testcase_base.TestcaseBase):
result_file.write(str(cases_line) + '\n')
result_file.close()
- def _parse_verification_id(line):
- first_pos = line.index("UUID=") + len("UUID=")
- last_pos = line.index(") for deployment")
- return line[first_pos:last_pos]
-
def run_verifier_tests(self):
- self.OPTION += (" --load-list {}".format(conf_utils.TEMPEST_LIST))
+ self.OPTION += (" --load-list {} --detailed"
+ .format(conf_utils.TEMPEST_LIST))
cmd_line = "rally verify start " + self.OPTION
logger.info("Starting Tempest test suite: '%s'." % cmd_line)
@@ -320,6 +316,7 @@ class TempestMultisite(TempestCommon):
self.case_name = "multisite"
self.MODE = "feature_multisite"
self.OPTION = "--concurrency 1"
+ conf_utils.install_verifier_ext(CONST.dir_repo_kingbird)
class TempestCustom(TempestCommon):
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index 69818f5a..c8e9c492 100755
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -94,8 +94,11 @@ class ODLTests(testcase_base.TestcaseBase):
try:
odlusername = kwargs['odlusername']
odlpassword = kwargs['odlpassword']
- variables = ['KEYSTONE:' + kwargs['keystoneip'],
+ osauthurl = kwargs['osauthurl']
+ keystoneip = urlparse.urlparse(osauthurl).hostname
+ variables = ['KEYSTONE:' + keystoneip,
'NEUTRON:' + kwargs['neutronip'],
+ 'OS_AUTH_URL:"' + osauthurl + '"',
'OSUSERNAME:"' + kwargs['osusername'] + '"',
'OSTENANTNAME:"' + kwargs['ostenantname'] + '"',
'OSPASSWORD:"' + kwargs['ospassword'] + '"',
@@ -147,10 +150,8 @@ class ODLTests(testcase_base.TestcaseBase):
suites = kwargs["suites"]
except KeyError:
pass
- keystone_url = op_utils.get_endpoint(service_type='identity')
neutron_url = op_utils.get_endpoint(service_type='network')
- kwargs = {'keystoneip': urlparse.urlparse(keystone_url).hostname}
- kwargs['neutronip'] = urlparse.urlparse(neutron_url).hostname
+ kwargs = {'neutronip': urlparse.urlparse(neutron_url).hostname}
kwargs['odlip'] = kwargs['neutronip']
kwargs['odlwebport'] = '8080'
kwargs['odlrestconfport'] = '8181'
@@ -161,6 +162,7 @@ class ODLTests(testcase_base.TestcaseBase):
installer_type = os.environ['INSTALLER_TYPE']
kwargs['osusername'] = os.environ['OS_USERNAME']
kwargs['ostenantname'] = os.environ['OS_TENANT_NAME']
+ kwargs['osauthurl'] = os.environ['OS_AUTH_URL']
kwargs['ospassword'] = os.environ['OS_PASSWORD']
if installer_type == 'fuel':
kwargs['odlwebport'] = '8282'
@@ -191,12 +193,12 @@ class ODLParser(object):
def __init__(self):
self.parser = argparse.ArgumentParser()
self.parser.add_argument(
- '-k', '--keystoneip', help='Keystone IP',
- default='127.0.0.1')
- self.parser.add_argument(
'-n', '--neutronip', help='Neutron IP',
default='127.0.0.1')
self.parser.add_argument(
+ '-k', '--osauthurl', help='OS_AUTH_URL as defined by OpenStack',
+ default='http://127.0.0.1:5000/v2.0')
+ self.parser.add_argument(
'-a', '--osusername', help='Username for OpenStack',
default='admin')
self.parser.add_argument(
diff --git a/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py b/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
index 2bef5cc6..25421d40 100644
--- a/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
+++ b/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
@@ -17,7 +17,7 @@ import os
import re
import time
-import functest.utils.functest_constants as ft_constants
+from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
@@ -26,7 +26,7 @@ class Foundation(object):
def __init__(self):
# currentpath = os.getcwd()
- currentpath = '%s/sdn/onos/teston/ci' % ft_constants.FUNCTEST_TEST_DIR
+ currentpath = '%s/sdn/onos/teston/ci' % CONST.dir_functest_data
self.cipath = currentpath
self.logdir = os.path.join(currentpath, 'log')
self.workhome = currentpath[0: currentpath.rfind('opnfv_tests') - 1]
@@ -54,23 +54,23 @@ class Foundation(object):
"""
Get Default Parameters value
"""
- self.Result_DB = str(ft_utils.get_db_url())
- self.masterusername = str(ft_constants.ONOSBENCH_USERNAME)
- self.masterpassword = str(ft_constants.ONOSBENCH_PASSWORD)
- self.agentusername = str(ft_constants.ONOSCLI_USERNAME)
- self.agentpassword = str(ft_constants.ONOSCLI_PASSWORD)
- self.runtimeout = ft_constants.ONOS_RUNTIMEOUT
- self.OCT = str(ft_constants.ONOS_OCT)
- self.OC1 = str(ft_constants.ONOS_OC1)
- self.OC2 = str(ft_constants.ONOS_OC2)
- self.OC3 = str(ft_constants.ONOS_OC3)
- self.OCN = str(ft_constants.ONOS_OCN)
- self.OCN2 = str(ft_constants.ONOS_OCN2)
- self.installer_master = str(ft_constants.ONOS_INSTALLER_MASTER)
- self.installer_master_username = \
- str(ft_constants.ONOS_INSTALLER_MASTER_USERNAME)
- self.installer_master_password = \
- ft_constants.ONOS_INSTALLER_MASTER_PASSWORD
+ self.Result_DB = ft_utils.get_db_url()
+ self.masterusername = CONST.ONOS_onosbench_username
+ self.masterpassword = CONST.ONOS_onosbench_password
+ self.agentusername = CONST.ONOS_onoscli_username
+ self.agentpassword = CONST.ONOS_onoscli_password
+ self.runtimeout = CONST.ONOS_runtimeout
+ self.OCT = CONST.ONOS_environment_OCT
+ self.OC1 = CONST.ONOS_environment_OC1
+ self.OC2 = CONST.ONOS_environment_OC2
+ self.OC3 = CONST.ONOS_environment_OC3
+ self.OCN = CONST.ONOS_environment_OCN
+ self.OCN2 = CONST.ONOS_environment_OCN2
+ self.installer_master = CONST.ONOS_environment_installer_master
+ self.installer_master_username = (
+ CONST.ONOS_environment_installer_master_username)
+ self.installer_master_password = (
+ CONST.ONOS_environment_installer_master_password)
self.hosts = [self.OC1, self.OCN, self.OCN2]
self.localhost = self.OCT
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index c2c251ad..e2401d0f 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -234,7 +234,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
cw.set_external_network_name(ext_net)
- error = cw.deploy_vnf()
+ error = cw.deploy_vnf(self.vnf['blueprint'])
if error:
self.logger.error(error)
return {'status': 'FAIL', 'result': error}
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml
index 775685fa..b84ef8fd 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml
@@ -36,4 +36,4 @@ clearwater:
flavor_id: ''
agent_user: ubuntu
external_network_name: ''
- public_domain: clearwaterfv
+ public_domain: clearwater.opnfv
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.py b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
index 352b609b..42b218e6 100644
--- a/functest/opnfv_tests/vnf/ims/orchestra_ims.py
+++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
@@ -23,6 +23,45 @@ from functest.utils.constants import CONST
from org.openbaton.cli.agents.agents import MainAgent
from org.openbaton.cli.errors.errors import NfvoException
+# ----------------------------------------------------------
+#
+# UTILS
+#
+# -----------------------------------------------------------
+
+
+def get_config(parameter, file):
+ """
+ Returns the value of a given parameter in file.yaml
+ parameter must be given in string format with dots
+ Example: general.openstack.image_name
+ """
+ with open(file) as f:
+ file_yaml = yaml.safe_load(f)
+ f.close()
+ value = file_yaml
+ for element in parameter.split("."):
+ value = value.get(element)
+ if value is None:
+ raise ValueError("The parameter %s is not defined in"
+ " %s" % (parameter, file))
+ return value
+
+
+def download_and_add_image_on_glance(glance, image_name,
+ image_url, data_dir):
+ dest_path = data_dir
+ if not os.path.exists(dest_path):
+ os.makedirs(dest_path)
+ file_name = image_url.rsplit('/')[-1]
+ if not ft_utils.download_url(image_url, dest_path):
+ return False
+ image = os_utils.create_glance_image(
+ glance, image_name, dest_path + file_name)
+ if not image:
+ return False
+ return image
+
def servertest(host, port):
args = socket.getaddrinfo(host, port, socket.AF_INET, socket.SOCK_STREAM)
@@ -38,6 +77,7 @@ def servertest(host, port):
class ImsVnf(vnf_base.VnfOnBoardingBase):
+
def __init__(self, project='functest', case='orchestra_ims',
repo='', cmd=''):
super(ImsVnf, self).__init__(project, case, repo, cmd)
@@ -54,6 +94,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
self.ob_projectid = ""
self.keystone_client = os_utils.get_keystone_client()
self.ob_nsr_id = ""
+ self.nsr = None
self.main_agent = None
# vIMS Data directory creation
if not os.path.exists(self.data_dir):
@@ -66,9 +107,14 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
raise Exception("Orchestra VNF config file not found")
config_file = self.case_dir + self.config
self.imagename = get_config("openbaton.imagename", config_file)
+ self.bootstrap_link = get_config("openbaton.bootstrap_link",
+ config_file)
+ self.bootstrap_config_link = get_config(
+ "openbaton.bootstrap_config_link", config_file)
self.market_link = get_config("openbaton.marketplace_link",
config_file)
self.images = get_config("tenant_images", config_file)
+ self.ims_conf = get_config("vIMS", config_file)
def deploy_orchestrator(self, **kwargs):
self.logger.info("Additional pre-configuration steps")
@@ -77,6 +123,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
glance_client = os_utils.get_glance_client()
# Import images if needed
+ # needs some images
self.logger.info("Upload some OS images if it doesn't exist")
temp_dir = os.path.join(self.data_dir, "tmp/")
for image_name, image_url in self.images.iteritems():
@@ -106,9 +153,9 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
"192.168.100.0/24")
# orchestrator VM flavor
- self.logger.info("Check medium Flavor is available, if not create one")
+ self.logger.info("Check if Flavor is available, if not create one")
flavor_exist, flavor_id = os_utils.get_or_create_flavor(
- "m1.medium",
+ "orchestra",
"4096",
'20',
'2',
@@ -129,13 +176,14 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
self.logger.error("Cannot create floating IP.")
userdata = "#!/bin/bash\n"
+ userdata += "echo \"Executing userdata...\"\n"
userdata += "set -x\n"
userdata += "set -e\n"
+ userdata += "echo \"Set nameserver to '8.8.8.8'...\"\n"
userdata += "echo \"nameserver 8.8.8.8\" >> /etc/resolv.conf\n"
+ userdata += "echo \"Install curl...\"\n"
userdata += "apt-get install curl\n"
- userdata += ("echo \"rabbitmq_broker_ip=%s\" > ./config_file\n"
- % floatip)
- userdata += "echo \"mysql=no\" >> ./config_file\n"
+ userdata += "echo \"Inject public key...\"\n"
userdata += ("echo \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuPXrV3"
"geeHc6QUdyUr/1Z+yQiqLcOskiEGBiXr4z76MK4abiFmDZ18OMQlc"
"fl0p3kS0WynVgyaOHwZkgy/DIoIplONVr2CKBKHtPK+Qcme2PVnCtv"
@@ -145,17 +193,30 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
"7YAdalAnyD/jwCHuwIrUw/lxo7UdNCmaUxeobEYyyFA1YVXzpNFZya"
"XPGAAYIJwEq/ openbaton@opnfv\" >> /home/ubuntu/.ssh/aut"
"horized_keys\n")
- userdata += "cat ./config_file\n"
- userdata += ("curl -s http://get.openbaton.org/bootstrap "
- "> ./bootstrap\n")
+ userdata += "echo \"Download bootstrap...\"\n"
+ userdata += ("curl -s %s "
+ "> ./bootstrap\n" % self.bootstrap_link)
+ userdata += ("curl -s %s"
+ "> ./config_file\n" % self.bootstrap_config_link)
+ userdata += ("echo \"Disable usage of mysql...\"\n")
+ userdata += "sed -i s/mysql=.*/mysql=no/g /config_file\n"
+ userdata += ("echo \"Setting 'rabbitmq_broker_ip' to '%s'\"\n"
+ % floatip)
+ userdata += ("sed -i s/rabbitmq_broker_ip=localhost/rabbitmq_broker_ip"
+ "=%s/g /config_file\n" % floatip)
+ userdata += "echo \"Set autostart of components to 'false'\"\n"
userdata += "export OPENBATON_COMPONENT_AUTOSTART=false\n"
+ userdata += "echo \"Execute bootstrap...\"\n"
bootstrap = "sh ./bootstrap release -configFile=./config_file"
userdata += bootstrap + "\n"
-
+ userdata += "echo \"Setting 'nfvo.plugin.timeout' to '300000'\"\n"
userdata += ("echo \"nfvo.plugin.timeout=300000\" >> "
"/etc/openbaton/openbaton-nfvo.properties\n")
+ userdata += "echo \"Starting NFVO\"\n"
userdata += "service openbaton-nfvo restart\n"
+ userdata += "echo \"Starting Generic VNFM\"\n"
userdata += "service openbaton-vnfm-generic restart\n"
+ userdata += "echo \"...end of userdata...\"\n"
sg_id = os_utils.create_security_group_full(neutron_client,
"orchestra-sec-group",
@@ -200,22 +261,22 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
self.logger.info("Associating floating ip: '%s' to VM '%s' "
% (floatip, "orchestra-openbaton"))
if not os_utils.add_floating_ip(nova_client, instance.id, floatip):
- self.logger.error("Cannot associate floating IP to VM.")
self.step_failure("Cannot associate floating IP to VM.")
- self.logger.info("Waiting for nfvo to be up and running...")
+ self.logger.info("Waiting for Open Baton NFVO to be up and running...")
x = 0
while x < 100:
if servertest(floatip, "8080"):
break
else:
- self.logger.debug("openbaton is not started yet")
+ self.logger.debug(
+ "Open Baton NFVO is not started yet (%ss)" %
+ (x * 5))
time.sleep(5)
x += 1
if x == 100:
- self.logger.error("Openbaton is not started correctly")
- self.step_failure("Openbaton is not started correctly")
+ self.step_failure("Open Baton is not started correctly")
self.ob_ip = floatip
self.ob_password = "openbaton"
@@ -223,10 +284,10 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
self.ob_https = False
self.ob_port = "8080"
- self.logger.info("Deploy orchestrator: OK")
+ self.logger.info("Deploy Open Baton NFVO: OK")
def deploy_vnf(self):
- self.logger.info("vIMS Deployment")
+ self.logger.info("Starting vIMS Deployment...")
self.main_agent = MainAgent(nfvo_ip=self.ob_ip,
nfvo_port=self.ob_port,
@@ -235,15 +296,16 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
username=self.ob_username,
password=self.ob_password)
+ self.logger.info("Getting project 'default'...")
project_agent = self.main_agent.get_agent("project", self.ob_projectid)
for p in json.loads(project_agent.find()):
if p.get("name") == "default":
self.ob_projectid = p.get("id")
+ self.logger.info("Found project 'default': %s" % p)
break
self.logger.debug("project id: %s" % self.ob_projectid)
if self.ob_projectid == "":
- self.logger.error("Default project id was not found!")
self.step_failure("Default project id was not found!")
vim_json = {
@@ -252,9 +314,6 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
"tenant": os_utils.get_credentials().get("tenant_name"),
"username": os_utils.get_credentials().get("username"),
"password": os_utils.get_credentials().get("password"),
- "keyPair": "opnfv",
- # TODO change the keypair to correct value
- # or upload a correct one or remove it
"securityGroups": [
"default",
"orchestra-sec-group"
@@ -267,7 +326,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
}
}
- self.logger.debug("vim: %s" % vim_json)
+ self.logger.debug("Registering VIM: %s" % vim_json)
self.main_agent.get_agent(
"vim",
@@ -280,7 +339,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
try:
self.logger.info("sending: %s" % self.market_link)
nsd = market_agent.create(entity=self.market_link)
- self.logger.info("Onboarded nsd: " + nsd.get("name"))
+ self.logger.info("Onboarded NSD: " + nsd.get("name"))
except NfvoException as e:
self.step_failure(e.message)
@@ -290,34 +349,77 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
if nsd_id is None:
self.step_failure("NSD not onboarded correctly")
- nsr = None
try:
- nsr = nsr_agent.create(nsd_id)
+ self.nsr = nsr_agent.create(nsd_id)
except NfvoException as e:
self.step_failure(e.message)
- if nsr is None:
- self.step_failure("NSR not deployed correctly")
+ if self.nsr.get('code') is not None:
+ self.logger.error(
+ "vIMS cannot be deployed: %s -> %s" %
+ (self.nsr.get('code'), self.nsr.get('message')))
+ self.step_failure("vIMS cannot be deployed")
i = 0
- self.logger.info("waiting NSR to go to active...")
- while nsr.get("status") != 'ACTIVE':
+ self.logger.info("Waiting for NSR to go to ACTIVE...")
+ while self.nsr.get("status") != 'ACTIVE' and self.nsr.get(
+ "status") != 'ERROR':
i += 1
- if i == 100:
- self.step_failure("After %s sec the nsr did not go to active.."
- % 5 * 100)
+ if i == 150:
+ self.step_failure("After %s sec the NSR did not go to ACTIVE.."
+ % 5 * i)
time.sleep(5)
- nsr = json.loads(nsr_agent.find(nsr.get('id')))
+ self.nsr = json.loads(nsr_agent.find(self.nsr.get('id')))
- deploy_vnf = {'status': "PASS", 'result': nsr}
- self.ob_nsr_id = nsr.get("id")
- self.logger.info("Deploy VNF: OK")
+ if self.nsr.get("status") == 'ACTIVE':
+ deploy_vnf = {'status': "PASS", 'result': self.nsr}
+ self.logger.info("Deploy VNF: OK")
+ else:
+ deploy_vnf = {'status': "FAIL", 'result': self.nsr}
+ self.step_failure("Deploy VNF: ERROR")
+ self.ob_nsr_id = self.nsr.get("id")
+ self.logger.info(
+ "Sleep for 60s to ensure that all services are up and running...")
+ time.sleep(60)
return deploy_vnf
def test_vnf(self):
# Adaptations probably needed
# code used for cloudify_ims
# ruby client on jumphost calling the vIMS on the SUT
+ self.logger.info(
+ "Testing if %s works properly..." %
+ self.nsr.get('name'))
+ for vnfr in self.nsr.get('vnfr'):
+ self.logger.info(
+ "Checking ports %s of VNF %s" %
+ (self.ims_conf.get(
+ vnfr.get('name')).get('ports'),
+ vnfr.get('name')))
+ for vdu in vnfr.get('vdu'):
+ for vnfci in vdu.get('vnfc_instance'):
+ self.logger.debug(
+ "Checking ports of VNFC instance %s" %
+ vnfci.get('hostname'))
+ for floatingIp in vnfci.get('floatingIps'):
+ self.logger.debug(
+ "Testing %s:%s" %
+ (vnfci.get('hostname'), floatingIp.get('ip')))
+ for port in self.ims_conf.get(
+ vnfr.get('name')).get('ports'):
+ if servertest(floatingIp.get('ip'), port):
+ self.logger.info(
+ "VNFC instance %s is reachable at %s:%s" %
+ (vnfci.get('hostname'),
+ floatingIp.get('ip'),
+ port))
+ else:
+ self.logger.error(
+ "VNFC instance %s is not reachable "
+ "at %s:%s" % (vnfci.get('hostname'),
+ floatingIp.get('ip'), port))
+ self.step_failure("Test VNF: ERROR")
+ self.logger.info("Test VNF: OK")
return
def clean(self):
@@ -349,42 +451,5 @@ if __name__ == '__main__':
test = ImsVnf()
test.deploy_orchestrator()
test.deploy_vnf()
+ test.test_vnf()
test.clean()
-
-
-# ----------------------------------------------------------
-#
-# UTILS
-#
-# -----------------------------------------------------------
-def get_config(parameter, file):
- """
- Returns the value of a given parameter in file.yaml
- parameter must be given in string format with dots
- Example: general.openstack.image_name
- """
- with open(file) as f:
- file_yaml = yaml.safe_load(f)
- f.close()
- value = file_yaml
- for element in parameter.split("."):
- value = value.get(element)
- if value is None:
- raise ValueError("The parameter %s is not defined in"
- " reporting.yaml" % parameter)
- return value
-
-
-def download_and_add_image_on_glance(glance, image_name,
- image_url, data_dir):
- dest_path = data_dir
- if not os.path.exists(dest_path):
- os.makedirs(dest_path)
- file_name = image_url.rsplit('/')[-1]
- if not ft_utils.download_url(image_url, dest_path):
- return False
- image = os_utils.create_glance_image(
- glance, image_name, dest_path + file_name)
- if not image:
- return False
- return image
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml b/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml
index 2fb33df5..86d6e604 100644
--- a/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml
+++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml
@@ -2,6 +2,18 @@ tenant_images:
ubuntu_14.04: http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
openims: http://marketplace.openbaton.org:8082/api/v1/images/52e2ccc0-1dce-4663-894d-28aab49323aa/img
openbaton:
- bootstrap: sh <(curl -s http://get.openbaton.org/bootstrap) release -configFile=
+ bootstrap_link: http://get.openbaton.org/bootstrap
+ bootstrap_config_link: http://get.openbaton.org/bootstrap-config-file
marketplace_link: http://marketplace.openbaton.org:8082/api/v1/nsds/fokus/OpenImsCore/3.2.0/json
imagename: ubuntu_14.04
+vIMS:
+ scscf:
+ ports: [3870, 6060]
+ pcscf:
+ ports: [4060]
+ icscf:
+ ports: [3869, 5060]
+ fhoss:
+ ports: [3868]
+ bind9:
+ ports: [] \ No newline at end of file
diff --git a/functest/tests/unit/ci/__init__.py b/functest/tests/unit/ci/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/functest/tests/unit/ci/__init__.py
diff --git a/functest/tests/unit/ci/test_prepare_env.py b/functest/tests/unit/ci/test_prepare_env.py
new file mode 100644
index 00000000..540501ff
--- /dev/null
+++ b/functest/tests/unit/ci/test_prepare_env.py
@@ -0,0 +1,347 @@
+#!/usr/bin/env python
+
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+import logging
+import unittest
+
+import mock
+
+from functest.ci import prepare_env
+from functest.tests.unit import test_utils
+from functest.utils.constants import CONST
+from opnfv.utils import constants as opnfv_constants
+
+
+class PrepareEnvTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ def test_print_separator(self, mock_logger_info):
+ str = "=============================================="
+ prepare_env.print_separator()
+ mock_logger_info.assert_called_once_with(str)
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_missing_inst_type(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.INSTALLER_TYPE = None
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+ mock_logger_warn.assert_any_call("The env variable 'INSTALLER_TYPE'"
+ " is not defined.")
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_missing_inst_ip(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.INSTALLER_IP = None
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+ mock_logger_warn.assert_any_call("The env variable 'INSTALLER_IP'"
+ " is not defined. It is needed to"
+ " fetch the OpenStack credentials."
+ " If the credentials are not"
+ " provided to the container as a"
+ " volume, please add this env"
+ " variable to the 'docker run'"
+ " command.")
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_with_inst_ip(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.INSTALLER_IP = mock.Mock()
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+ mock_logger_info.assert_any_call(test_utils.
+ SubstrMatch(" INSTALLER_IP="))
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_missing_scenario(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.DEPLOY_SCENARIO = None
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+ mock_logger_warn.assert_any_call("The env variable"
+ " 'DEPLOY_SCENARIO' is not defined"
+ ". Setting CI_SCENARIO=undefined.")
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_with_scenario(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.DEPLOY_SCENARIO = mock.Mock()
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+ mock_logger_info.assert_any_call(test_utils.
+ SubstrMatch("DEPLOY_SCENARIO="))
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_with_ci_debug(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.CI_DEBUG = mock.Mock()
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+ mock_logger_info.assert_any_call(test_utils.
+ SubstrMatch(" CI_DEBUG="))
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_with_node(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.NODE_NAME = mock.Mock()
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+ mock_logger_info.assert_any_call(test_utils.
+ SubstrMatch(" NODE_NAME="))
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_with_build_tag(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.BUILD_TAG = mock.Mock()
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+
+ mock_logger_info.assert_any_call(test_utils.
+ SubstrMatch(" BUILD_TAG="))
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_check_env_variables_with_is_ci_run(self, mock_logger_warn,
+ mock_logger_info):
+ CONST.IS_CI_RUN = mock.Mock()
+ prepare_env.check_env_variables()
+ mock_logger_info.assert_any_call("Checking environment variables"
+ "...")
+
+ mock_logger_info.assert_any_call(test_utils.
+ SubstrMatch(" IS_CI_RUN="))
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.debug')
+ def test_create_directories_missing_dir(self, mock_logger_debug,
+ mock_logger_info):
+ with mock.patch('functest.ci.prepare_env.os.path.exists',
+ return_value=False), \
+ mock.patch('functest.ci.prepare_env.os.makedirs') \
+ as mock_method:
+ prepare_env.create_directories()
+ mock_logger_info.assert_any_call("Creating needed directories...")
+ mock_method.assert_any_call(CONST.dir_functest_conf)
+ mock_method.assert_any_call(CONST.dir_functest_data)
+ mock_logger_info.assert_any_call(" %s created." %
+ CONST.dir_functest_conf)
+ mock_logger_info.assert_any_call(" %s created." %
+ CONST.dir_functest_data)
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.debug')
+ def test_create_directories_with_dir(self, mock_logger_debug,
+ mock_logger_info):
+ with mock.patch('functest.ci.prepare_env.os.path.exists',
+ return_value=True):
+ prepare_env.create_directories()
+ mock_logger_info.assert_any_call("Creating needed directories...")
+ mock_logger_debug.assert_any_call(" %s already exists." %
+ CONST.dir_functest_conf)
+ mock_logger_debug.assert_any_call(" %s already exists." %
+ CONST.dir_functest_data)
+
+ def _get_env_cred_dict(self, os_prefix=''):
+ return {'OS_USERNAME': os_prefix + 'username',
+ 'OS_PASSWORD': os_prefix + 'password',
+ 'OS_AUTH_URL': 'http://test_ip:test_port/v2.0',
+ 'OS_TENANT_NAME': os_prefix + 'tenant_name',
+ 'OS_USER_DOMAIN_NAME': os_prefix + 'user_domain_name',
+ 'OS_PROJECT_DOMAIN_NAME': os_prefix + 'project_domain_name',
+ 'OS_PROJECT_NAME': os_prefix + 'project_name',
+ 'OS_ENDPOINT_TYPE': os_prefix + 'endpoint_type',
+ 'OS_REGION_NAME': os_prefix + 'region_name'}
+
+ @mock.patch('functest.ci.prepare_env.logger.error')
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.logger.warning')
+ def test_source_rc_missing_rc_file(self, mock_logger_warn,
+ mock_logger_info,
+ mock_logger_error):
+ with mock.patch('functest.ci.prepare_env.os.path.isfile',
+ return_value=True), \
+ mock.patch('functest.ci.prepare_env.os.path.getsize',
+ return_value=0), \
+ self.assertRaises(Exception):
+ CONST.openstack_creds = 'test_creds'
+ prepare_env.source_rc_file()
+
+ def test_source_rc_missing_installer_ip(self):
+ with mock.patch('functest.ci.prepare_env.os.path.isfile',
+ return_value=False), \
+ self.assertRaises(Exception):
+ CONST.INSTALLER_IP = None
+ CONST.openstack_creds = 'test_creds'
+ prepare_env.source_rc_file()
+
+ def test_source_rc_missing_installer_type(self):
+ with mock.patch('functest.ci.prepare_env.os.path.isfile',
+ return_value=False), \
+ self.assertRaises(Exception):
+ CONST.INSTALLER_IP = 'test_ip'
+ CONST.openstack_creds = 'test_creds'
+ CONST.INSTALLER_TYPE = 'test_type'
+ opnfv_constants.INSTALLERS = []
+ prepare_env.source_rc_file()
+
+ def test_source_rc_missing_os_credfile_ci_inst(self):
+ with mock.patch('functest.ci.prepare_env.os.path.isfile',
+ return_value=False), \
+ mock.patch('functest.ci.prepare_env.os.path.getsize'), \
+ mock.patch('functest.ci.prepare_env.os.path.join'), \
+ mock.patch('functest.ci.prepare_env.subprocess.Popen') \
+ as mock_subproc_popen, \
+ self.assertRaises(Exception):
+ CONST.openstack_creds = 'test_creds'
+ CONST.INSTALLER_IP = None
+ CONST.INSTALLER_TYPE = 'test_type'
+ opnfv_constants.INSTALLERS = ['test_type']
+
+ process_mock = mock.Mock()
+ attrs = {'communicate.return_value': ('output', 'error'),
+ 'return_code': 1}
+ process_mock.configure_mock(**attrs)
+ mock_subproc_popen.return_value = process_mock
+
+ prepare_env.source_rc_file()
+
+ def _get_rally_creds(self):
+ return {"type": "ExistingCloud",
+ "admin": {"username": 'test_user_name',
+ "password": 'test_password',
+ "tenant": 'test_tenant'}}
+
+ @mock.patch('functest.ci.prepare_env.os_utils.get_credentials_for_rally')
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ @mock.patch('functest.ci.prepare_env.ft_utils.execute_command_raise')
+ @mock.patch('functest.ci.prepare_env.ft_utils.execute_command')
+ def test_install_rally(self, mock_exec, mock_exec_raise, mock_logger_info,
+ mock_os_utils):
+
+ mock_os_utils.return_value = self._get_rally_creds()
+
+ prepare_env.install_rally()
+
+ cmd = "rally deployment destroy opnfv-rally"
+ error_msg = "Deployment %s does not exist." % \
+ CONST.rally_deployment_name
+ mock_logger_info.assert_any_call("Creating Rally environment...")
+ mock_exec.assert_any_call(cmd, error_msg=error_msg, verbose=False)
+
+ cmd = "rally deployment create --file=rally_conf.json --name="
+ cmd += CONST.rally_deployment_name
+ error_msg = "Problem while creating Rally deployment"
+ mock_exec_raise.assert_any_call(cmd, error_msg=error_msg)
+
+ cmd = "rally deployment check"
+ error_msg = ("OpenStack not responding or "
+ "faulty Rally deployment.")
+ mock_exec_raise.assert_any_call(cmd, error_msg=error_msg)
+
+ cmd = "rally deployment list"
+ error_msg = ("Problem while listing "
+ "Rally deployment.")
+ mock_exec.assert_any_call(cmd, error_msg=error_msg)
+
+ cmd = "rally plugin list | head -5"
+ error_msg = ("Problem while showing "
+ "Rally plugins.")
+ mock_exec.assert_any_call(cmd, error_msg=error_msg)
+
+ @mock.patch('functest.ci.prepare_env.sys.exit')
+ @mock.patch('functest.ci.prepare_env.logger.error')
+ def test_check_environment_missing_file(self, mock_logger_error,
+ mock_sys_exit):
+ with mock.patch('functest.ci.prepare_env.os.path.isfile',
+ return_value=False), \
+ self.assertRaises(Exception):
+ prepare_env.check_environment()
+
+ @mock.patch('functest.ci.prepare_env.sys.exit')
+ @mock.patch('functest.ci.prepare_env.logger.error')
+ def test_check_environment_with_error(self, mock_logger_error,
+ mock_sys_exit):
+ with mock.patch('functest.ci.prepare_env.os.path.isfile',
+ return_value=True), \
+ mock.patch("__builtin__.open", mock.mock_open(read_data='0')), \
+ self.assertRaises(Exception):
+ prepare_env.check_environment()
+
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ def test_check_environment_default(self, mock_logger_info):
+ with mock.patch('functest.ci.prepare_env.os.path.isfile',
+ return_value=True):
+ with mock.patch("__builtin__.open", mock.mock_open(read_data='1')):
+ prepare_env.check_environment()
+ mock_logger_info.assert_any_call("Functest environment"
+ " is installed.")
+
+ @mock.patch('functest.ci.prepare_env.check_environment')
+ @mock.patch('functest.ci.prepare_env.create_flavor')
+ @mock.patch('functest.ci.prepare_env.install_tempest')
+ @mock.patch('functest.ci.prepare_env.install_rally')
+ @mock.patch('functest.ci.prepare_env.verify_deployment')
+ @mock.patch('functest.ci.prepare_env.patch_config_file')
+ @mock.patch('functest.ci.prepare_env.source_rc_file')
+ @mock.patch('functest.ci.prepare_env.create_directories')
+ @mock.patch('functest.ci.prepare_env.check_env_variables')
+ @mock.patch('functest.ci.prepare_env.logger.info')
+ def test_main_start(self, mock_logger_info, mock_env_var,
+ mock_create_dir, mock_source_rc, mock_patch_config,
+ mock_verify_depl, mock_install_rally,
+ mock_install_temp, mock_create_flavor,
+ mock_check_env):
+ with mock.patch("__builtin__.open", mock.mock_open()) as m:
+ args = {'action': 'start'}
+ self.assertEqual(prepare_env.main(**args), 0)
+ mock_logger_info.assert_any_call("######### Preparing Functest "
+ "environment #########\n")
+ self.assertTrue(mock_env_var.called)
+ self.assertTrue(mock_create_dir.called)
+ self.assertTrue(mock_source_rc.called)
+ self.assertTrue(mock_patch_config.called)
+ self.assertTrue(mock_verify_depl.called)
+ self.assertTrue(mock_install_rally.called)
+ self.assertTrue(mock_install_temp.called)
+ self.assertTrue(mock_create_flavor.called)
+ m.assert_called_once_with(CONST.env_active, "w")
+ self.assertTrue(mock_check_env.called)
+
+ @mock.patch('functest.ci.prepare_env.check_environment')
+ def test_main_check(self, mock_check_env):
+ args = {'action': 'check'}
+ self.assertEqual(prepare_env.main(**args), 0)
+ self.assertTrue(mock_check_env.called)
+
+ @mock.patch('functest.ci.prepare_env.logger.error')
+ def test_main_no_arg(self, mock_logger_error):
+ args = {'action': 'not_valid'}
+ self.assertEqual(prepare_env.main(**args), -1)
+ mock_logger_error.assert_called_once_with('Argument not valid.')
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index 8f2a5d7e..5961940f 100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -30,6 +30,7 @@ class ODLTesting(unittest.TestCase):
_keystone_ip = "127.0.0.1"
_neutron_ip = "127.0.0.2"
_sdn_controller_ip = "127.0.0.3"
+ _os_auth_url = "http://{}:5000/v2.0".format(_keystone_ip)
_os_tenantname = "admin"
_os_username = "admin"
_os_password = "admin"
@@ -42,14 +43,15 @@ class ODLTesting(unittest.TestCase):
for var in ("INSTALLER_TYPE", "SDN_CONTROLLER", "SDN_CONTROLLER_IP"):
if var in os.environ:
del os.environ[var]
+ os.environ["OS_AUTH_URL"] = self._os_auth_url
os.environ["OS_USERNAME"] = self._os_username
os.environ["OS_PASSWORD"] = self._os_password
os.environ["OS_TENANT_NAME"] = self._os_tenantname
self.test = odl.ODLTests()
self.defaultargs = {'odlusername': self._odl_username,
'odlpassword': self._odl_password,
- 'keystoneip': self._keystone_ip,
'neutronip': self._keystone_ip,
+ 'osauthurl': self._os_auth_url,
'osusername': self._os_username,
'ostenantname': self._os_tenantname,
'ospassword': self._os_password,
@@ -157,8 +159,8 @@ class ODLTesting(unittest.TestCase):
def _get_main_kwargs(self, key=None):
kwargs = {'odlusername': self._odl_username,
'odlpassword': self._odl_password,
- 'keystoneip': self._keystone_ip,
'neutronip': self._neutron_ip,
+ 'osauthurl': self._os_auth_url,
'osusername': self._os_username,
'ostenantname': self._os_tenantname,
'ospassword': self._os_password,
@@ -178,6 +180,7 @@ class ODLTesting(unittest.TestCase):
if len(args) > 1:
variable = ['KEYSTONE:{}'.format(self._keystone_ip),
'NEUTRON:{}'.format(self._neutron_ip),
+ 'OS_AUTH_URL:"{}"'.format(self._os_auth_url),
'OSUSERNAME:"{}"'.format(self._os_username),
'OSTENANTNAME:"{}"'.format(self._os_tenantname),
'OSPASSWORD:"{}"'.format(self._os_password),
@@ -207,12 +210,12 @@ class ODLTesting(unittest.TestCase):
def test_main_missing_odlpassword(self):
self._test_main_missing_keyword('odlpassword')
- def test_main_missing_keystoneip(self):
- self._test_main_missing_keyword('keystoneip')
-
def test_main_missing_neutronip(self):
self._test_main_missing_keyword('neutronip')
+ def test_main_missing_osauthurl(self):
+ self._test_main_missing_keyword('osauthurl')
+
def test_main_missing_osusername(self):
self._test_main_missing_keyword('osusername')
@@ -347,10 +350,11 @@ class ODLTesting(unittest.TestCase):
self.assertEqual(self.test.run(), status)
self.test.main.assert_called_once_with(
odl.ODLTests.default_suites,
- keystoneip=self._keystone_ip, neutronip=self._neutron_ip,
+ neutronip=self._neutron_ip,
odlip=odlip, odlpassword=self._odl_password,
odlrestconfport=odlrestconfport,
odlusername=self._odl_username, odlwebport=odlwebport,
+ osauthurl=self._os_auth_url,
ospassword=self._os_password, ostenantname=self._os_tenantname,
osusername=self._os_username)
@@ -368,10 +372,11 @@ class ODLTesting(unittest.TestCase):
self.assertEqual(self.test.run(suites=suites), status)
self.test.main.assert_called_once_with(
suites,
- keystoneip=self._keystone_ip, neutronip=self._neutron_ip,
+ neutronip=self._neutron_ip,
odlip=odlip, odlpassword=self._odl_password,
odlrestconfport=odlrestconfport,
odlusername=self._odl_username, odlwebport=odlwebport,
+ osauthurl=self._os_auth_url,
ospassword=self._os_password, ostenantname=self._os_tenantname,
osusername=self._os_username)
@@ -381,6 +386,9 @@ class ODLTesting(unittest.TestCase):
self.assertEqual(self.test.run(),
testcase_base.TestcaseBase.EX_RUN_ERROR)
+ def test_run_missing_os_auth_url(self):
+ self._test_run_missing_env_var("OS_AUTH_URL")
+
def test_run_missing_os_username(self):
self._test_run_missing_env_var("OS_USERNAME")
@@ -507,8 +515,8 @@ class ODLTesting(unittest.TestCase):
def test_argparser_odlpassword(self):
self._test_argparser('odlpassword', 'foo')
- def test_argparser_keystoneip(self):
- self._test_argparser('keystoneip', '127.0.0.4')
+ def test_argparser_osauthurl(self):
+ self._test_argparser('osauthurl', 'http://127.0.0.4:5000/v2')
def test_argparser_neutronip(self):
self._test_argparser('neutronip', '127.0.0.4')
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py b/functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py b/functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py
new file mode 100644
index 00000000..6121f4eb
--- /dev/null
+++ b/functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python
+
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+import logging
+import unittest
+
+import mock
+
+from functest.opnfv_tests.openstack.tempest import conf_utils
+from functest.utils.constants import CONST
+
+
+class OSTempestConfUtilsTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def test_get_verifier_id_missing_verifier(self):
+ CONST.tempest_deployment_name = 'test_deploy_name'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.subprocess.Popen') as mock_popen, \
+ self.assertRaises(Exception):
+ mock_stdout = mock.Mock()
+ attrs = {'stdout.readline.return_value': ''}
+ mock_stdout.configure_mock(**attrs)
+ mock_popen.return_value = mock_stdout
+ conf_utils.get_verifier_id(),
+
+ def test_get_verifier_id_default(self):
+ CONST.tempest_deployment_name = 'test_deploy_name'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.subprocess.Popen') as mock_popen:
+ mock_stdout = mock.Mock()
+ attrs = {'stdout.readline.return_value': 'test_deploy_id'}
+ mock_stdout.configure_mock(**attrs)
+ mock_popen.return_value = mock_stdout
+
+ self.assertEqual(conf_utils.get_verifier_id(),
+ 'test_deploy_id')
+
+ def test_get_verifier_deployment_id_missing_rally(self):
+ CONST.rally_deployment_name = 'test_rally_deploy_name'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.subprocess.Popen') as mock_popen, \
+ self.assertRaises(Exception):
+ mock_stdout = mock.Mock()
+ attrs = {'stdout.readline.return_value': ''}
+ mock_stdout.configure_mock(**attrs)
+ mock_popen.return_value = mock_stdout
+ conf_utils.get_verifier_deployment_id(),
+
+ def test_get_verifier_deployment_id_default(self):
+ CONST.rally_deployment_name = 'test_rally_deploy_name'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.subprocess.Popen') as mock_popen:
+ mock_stdout = mock.Mock()
+ attrs = {'stdout.readline.return_value': 'test_deploy_id'}
+ mock_stdout.configure_mock(**attrs)
+ mock_popen.return_value = mock_stdout
+
+ self.assertEqual(conf_utils.get_verifier_deployment_id(),
+ 'test_deploy_id')
+
+ def test_get_verifier_repo_dir_default(self):
+ with mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.os.path.join',
+ return_value='test_verifier_repo_dir'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.get_verifier_id') as m:
+ self.assertEqual(conf_utils.get_verifier_repo_dir(''),
+ 'test_verifier_repo_dir')
+ self.assertTrue(m.called)
+
+ def test_get_verifier_deployment_dir_default(self):
+ with mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.os.path.join',
+ return_value='test_verifier_repo_dir'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.get_verifier_id') as m1, \
+ mock.patch('functest.opnfv_tests.openstack.tempest.'
+ 'conf_utils.get_verifier_deployment_id') as m2:
+ self.assertEqual(conf_utils.get_verifier_deployment_dir('', ''),
+ 'test_verifier_repo_dir')
+ self.assertTrue(m1.called)
+ self.assertTrue(m2.called)
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py b/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py
new file mode 100644
index 00000000..8ae7b4db
--- /dev/null
+++ b/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py
@@ -0,0 +1,279 @@
+#!/usr/bin/env python
+
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+import logging
+import unittest
+
+import mock
+
+from functest.core import testcase_base
+from functest.opnfv_tests.openstack.tempest import tempest
+from functest.opnfv_tests.openstack.tempest import conf_utils
+from functest.utils.constants import CONST
+
+
+class OSTempestTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.get_verifier_id',
+ return_value='test_deploy_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.get_verifier_deployment_id',
+ return_value='test_deploy_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.get_verifier_repo_dir',
+ return_value='test_verifier_repo_dir'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.get_verifier_deployment_dir',
+ return_value='test_verifier_deploy_dir'):
+ self.tempestcommon = tempest.TempestCommon()
+
+ def test_create_tempest_resources_missing_network_dic(self):
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.get_keystone_client',
+ return_value=mock.Mock()), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_tenant',
+ return_value='test_tenant_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_user',
+ return_value='test_user_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_shared_network_full',
+ return_value=None), \
+ self.assertRaises(Exception) as context:
+ self.tempestcommon.create_tempest_resources()
+ msg = 'Failed to create private network'
+ self.assertTrue(msg in context)
+
+ def test_create_tempest_resources_missing_image(self):
+ CONST.tempest_use_custom_images = 'test_image'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.get_keystone_client',
+ return_value=mock.Mock()), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_tenant',
+ return_value='test_tenant_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_user',
+ return_value='test_user_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_shared_network_full',
+ return_value=mock.Mock()), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.get_or_create_image',
+ return_value=(mock.Mock(), None)), \
+ self.assertRaises(Exception) as context:
+ self.tempestcommon.create_tempest_resources()
+ msg = 'Failed to create image'
+ self.assertTrue(msg in context)
+
+ def test_create_tempest_resources_missing_flavor(self):
+ CONST.tempest_use_custom_images = 'test_image'
+ CONST.tempest_use_custom_flavors = 'test_flavour'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.get_keystone_client',
+ return_value=mock.Mock()), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_tenant',
+ return_value='test_tenant_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_user',
+ return_value='test_user_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.create_shared_network_full',
+ return_value=mock.Mock()), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.get_or_create_image',
+ return_value=(mock.Mock(), 'image_id')), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os_utils.get_or_create_flavor',
+ return_value=(mock.Mock(), None)), \
+ self.assertRaises(Exception) as context:
+ self.tempestcommon.create_tempest_resources()
+ msg = 'Failed to create flavor'
+ self.assertTrue(msg in context)
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.logger.debug')
+ def test_generate_test_list_defcore_mode(self, mock_logger_debug):
+ self.tempestcommon.MODE = 'defcore'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'shutil.copyfile') as m:
+ self.tempestcommon.generate_test_list('test_verifier_repo_dir')
+ self.assertTrue(m.called)
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.logger.error')
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.logger.debug')
+ def test_generate_test_list_custom_mode_missing_file(self,
+ mock_logger_debug,
+ mock_logger_error):
+ self.tempestcommon.MODE = 'custom'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.isfile', return_value=False), \
+ self.assertRaises(Exception) as context:
+ msg = "Tempest test list file %s NOT found."
+ self.tempestcommon.generate_test_list('test_verifier_repo_dir')
+ self.assertTrue((msg % conf_utils.TEMPEST_CUSTOM) in context)
+
+ def test_generate_test_list_custom_mode_default(self):
+ self.tempestcommon.MODE = 'custom'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'shutil.copyfile') as m, \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.isfile', return_value=True):
+ self.tempestcommon.generate_test_list('test_verifier_repo_dir')
+ self.assertTrue(m.called)
+
+ def _test_generate_test_list_mode_default(self, mode):
+ self.tempestcommon.MODE = mode
+ if self.tempestcommon.MODE == 'smoke':
+ testr_mode = "smoke"
+ elif self.tempestcommon.MODE == 'feature_multisite':
+ testr_mode = "'[Kk]ingbird'"
+ elif self.tempestcommon.MODE == 'full':
+ testr_mode = ""
+ else:
+ testr_mode = 'tempest.api.' + self.tempestcommon.MODE
+ conf_utils.TEMPEST_RAW_LIST = 'raw_list'
+ verifier_repo_dir = 'test_verifier_repo_dir'
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'ft_utils.execute_command') as m:
+ cmd = ("cd {0};"
+ "testr list-tests {1} > {2};"
+ "cd -;".format(verifier_repo_dir,
+ testr_mode,
+ conf_utils.TEMPEST_RAW_LIST))
+ self.tempestcommon.generate_test_list('test_verifier_repo_dir')
+ m.assert_any_call(cmd)
+
+ def test_generate_test_list_smoke_mode(self):
+ self._test_generate_test_list_mode_default('smoke')
+
+ def test_generate_test_list_feature_multisite_mode(self):
+ self._test_generate_test_list_mode_default('feature_multisite')
+
+ def test_generate_test_list_full_mode(self):
+ self._test_generate_test_list_mode_default('full')
+
+ def test_parse_verifier_result_missing_verification_uuid(self):
+ self.tempestcommon.VERIFICATION_ID = ''
+ with self.assertRaises(Exception):
+ self.tempestcommon.parse_verifier_result()
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.logger.info')
+ def test_parse_verifier_result_default(self, mock_logger_info):
+ self.tempestcommon.VERIFICATION_ID = 'test_uuid'
+ self.tempestcommon.case_name = 'test_case_name'
+ stdout = ['Testscount||2', 'Success||2', 'Skipped||0', 'Failures||0']
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'subprocess.Popen') as mock_popen, \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'ft_utils.check_success_rate') as mock_method, \
+ mock.patch('__builtin__.open', mock.mock_open()):
+ mock_stdout = mock.Mock()
+ attrs = {'stdout': stdout}
+ mock_stdout.configure_mock(**attrs)
+ mock_popen.return_value = mock_stdout
+
+ self.tempestcommon.parse_verifier_result()
+ mock_method.assert_any_call('test_case_name', 100)
+
+ def test_run_missing_create_tempest_dir(self):
+ ret = testcase_base.TestcaseBase.EX_RUN_ERROR
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.makedirs') as mock_os_makedirs, \
+ mock.patch.object(self.tempestcommon, 'create_tempest_resources',
+ return_value=ret):
+ self.assertEqual(self.tempestcommon.run(),
+ ret)
+ self.assertTrue(mock_os_makedirs.called)
+
+ def test_run_missing_configure_tempest(self):
+ ret = testcase_base.TestcaseBase.EX_RUN_ERROR
+ ret_ok = testcase_base.TestcaseBase.EX_OK
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.makedirs') as mock_os_makedirs, \
+ mock.patch.object(self.tempestcommon,
+ 'create_tempest_resources',
+ return_value=ret_ok), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.configure_tempest',
+ return_value=ret):
+ self.assertEqual(self.tempestcommon.run(),
+ ret)
+ self.assertTrue(mock_os_makedirs.called)
+
+ def test_run_missing_generate_test_list(self):
+ ret = testcase_base.TestcaseBase.EX_RUN_ERROR
+ ret_ok = testcase_base.TestcaseBase.EX_OK
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.makedirs') as mock_os_makedirs, \
+ mock.patch.object(self.tempestcommon, 'create_tempest_resources',
+ return_value=ret_ok), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.configure_tempest',
+ return_value=ret_ok), \
+ mock.patch.object(self.tempestcommon, 'generate_test_list',
+ return_value=ret):
+ self.assertEqual(self.tempestcommon.run(),
+ ret)
+ self.assertTrue(mock_os_makedirs.called)
+
+ def test_run_missing_apply_tempest_blacklist(self):
+ ret = testcase_base.TestcaseBase.EX_RUN_ERROR
+ ret_ok = testcase_base.TestcaseBase.EX_OK
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.makedirs') as mock_os_makedirs, \
+ mock.patch.object(self.tempestcommon, 'create_tempest_resources',
+ return_value=ret_ok), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.configure_tempest',
+ return_value=ret_ok), \
+ mock.patch.object(self.tempestcommon, 'generate_test_list',
+ return_value=ret_ok), \
+ mock.patch.object(self.tempestcommon, 'apply_tempest_blacklist',
+ return_value=ret):
+ self.assertEqual(self.tempestcommon.run(),
+ ret)
+ self.assertTrue(mock_os_makedirs.called)
+
+ def test_run_missing_default_criteria_pass(self):
+ ret_ok = testcase_base.TestcaseBase.EX_OK
+ self.tempestcommon.criteria = "PASS"
+ with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.makedirs') as mock_os_makedirs, \
+ mock.patch.object(self.tempestcommon, 'create_tempest_resources',
+ return_value=ret_ok), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.configure_tempest',
+ return_value=ret_ok), \
+ mock.patch.object(self.tempestcommon, 'generate_test_list',
+ return_value=ret_ok), \
+ mock.patch.object(self.tempestcommon, 'apply_tempest_blacklist',
+ return_value=ret_ok), \
+ mock.patch.object(self.tempestcommon, 'run_verifier_tests'), \
+ mock.patch.object(self.tempestcommon, 'parse_verifier_result'):
+ self.assertEqual(self.tempestcommon.run(),
+ ret_ok)
+ self.assertTrue(mock_os_makedirs.called)
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/utils/functest_constants.py b/functest/utils/functest_constants.py
deleted file mode 100644
index 9fae9a9c..00000000
--- a/functest/utils/functest_constants.py
+++ /dev/null
@@ -1,209 +0,0 @@
-#!/usr/bin/env python
-#
-# yaohelan@huawei.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-import os
-
-import functest.utils.functest_logger as ft_logger
-import functest.utils.functest_utils as ft_utils
-
-logger = ft_logger.Logger("functest_constants").getLogger()
-
-
-""" global variables """
-INSTALLERS = ['fuel', 'compass', 'apex', 'joid']
-CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE')
-CI_INSTALLER_IP = os.getenv('INSTALLER_IP')
-CI_SCENARIO = os.getenv('DEPLOY_SCENARIO')
-CI_NODE = os.getenv('NODE_NAME')
-CI_BUILD_TAG = os.getenv('BUILD_TAG')
-CI_DEBUG = os.getenv('CI_DEBUG')
-CI_LOOP = os.getenv('CI_LOOP')
-OS_AUTH_URL = os.getenv('OS_AUTH_URL')
-OS_USERNAME = os.getenv('OS_USERNAME')
-OS_TENANT_NAME = os.getenv('OS_TENANT_NAME')
-OS_PASSWORD = os.getenv('OS_PASSWORD')
-OS_ENDPOINT_TYPE = os.getenv('OS_ENDPOINT_TYPE')
-OS_REGION_NAME = os.getenv('OS_REGION_NAME')
-OS_CACERT = os.getenv('OS_CACERT')
-FUEL_ENV = os.getenv('FUEL_ENV')
-SDN_CONTROLLER_IP = os.getenv('SDN_CONTROLLER_IP')
-SDN_CONTROLLER = os.getenv('SDN_CONTROLLER')
-
-if CI_BUILD_TAG is not None:
- IS_CI_RUN = True
-else:
- IS_CI_RUN = False
-
-CONFIG_FUNCTEST_YAML = os.getenv("CONFIG_FUNCTEST_YAML")
-
-
-def get_value(functest_config_key, env_variable):
- try:
- constant = ft_utils.get_functest_config(functest_config_key)
- # logger.debug("%s is defined in config_functest.yaml as [%s]"
- # % (env_variable, constant))
- return constant
- except ValueError:
- logger.warning("%s is not defined in config_functest.yaml"
- % functest_config_key)
- constant = os.getenv(env_variable)
- if constant is None:
- raise ValueError("%s is neither defined in config_functest.yaml"
- " nor environment variable" % env_variable)
- else:
- logger.debug("%s is defined as environment variable as [%s]"
- % (env_variable, constant))
- return constant
-
-
-HOME = get_value('general.dir.home', 'HOME')
-REPOS_DIR = get_value('general.dir.repos', 'REPOS_DIR')
-FUNCTEST_BASE_DIR = get_value('general.dir.functest',
- 'FUNCTEST_BASE_DIR')
-FUNCTEST_REPO_DIR = get_value('general.dir.repo_functest',
- 'FUNCTEST_REPO_DIR')
-FUNCTEST_TEST_DIR = get_value('general.dir.functest_test',
- 'FUNCTEST_TEST_DIR')
-FUNCTEST_CONF_DIR = get_value('general.dir.functest_conf',
- 'FUNCTEST_CONF_DIR')
-FUNCTEST_DATA_DIR = get_value('general.dir.functest_data',
- 'FUNCTEST_DATA_DIR')
-FUNCTEST_RESULTS_DIR = get_value('general.dir.results',
- 'FUNCTEST_RESULTS_DIR')
-FUNCTEST_TESTCASES_YAML = get_value('general.functest.testcases_yaml',
- 'FUNCTEST_TESTCASES_YAML')
-RALLY_DEPLOYMENT_NAME = get_value('rally.deployment_name',
- 'RALLY_DEPLOYMENT_NAME')
-TEMPEST_REPO_DIR = get_value('general.dir.repo_tempest',
- 'TEMPEST_REPO_DIR')
-
-ENV_FILE = os.path.join(FUNCTEST_CONF_DIR, "env_active")
-
-OPENSTACK_CREDS = get_value('general.openstack.creds', 'creds')
-OPENSTACK_SNAPSHOT_FILE = get_value('general.openstack.snapshot_file',
- 'OPENSTACK_SNAPSHOT_FILE')
-
-DOMINO_REPO_DIR = get_value('general.dir.repo_domino',
- 'DOMINO_REPO_DIR')
-SDNVPN_REPO_DIR = get_value('general.dir.repo_sdnvpn',
- 'SDNVPN_REPO_DIR')
-SFC_REPO_DIR = get_value('general.dir.repo_sfc',
- 'SFC_REPO_DIR')
-RALLY_RELATIVE_PATH = get_value('general.dir.rally',
- 'RALLY_RELATIVE_PATH')
-RALLY_PRIVATE_NET_NAME = get_value('rally.network_name',
- 'RALLY_PRIVATE_NET_NAME')
-RALLY_PRIVATE_SUBNET_NAME = get_value('rally.subnet_name',
- 'RALLY_PRIVATE_SUBNET_NAME')
-RALLY_PRIVATE_SUBNET_CIDR = get_value('rally.subnet_cidr',
- 'RALLY_PRIVATE_SUBNET_CIDR')
-RALLY_ROUTER_NAME = get_value('rally.router_name', 'RALLY_ROUTER_NAME')
-RALLY_INSTALLATION_DIR = get_value('general.dir.rally_inst',
- 'RALLY_INSTALLATION_DIR')
-GLANCE_IMAGE_NAME = get_value('general.openstack.image_name',
- 'GLANCE_IMAGE_NAME')
-GLANCE_IMAGE_FILENAME = get_value('general.openstack.image_file_name',
- 'GLANCE_IMAGE_FILENAME')
-GLANCE_IMAGE_FORMAT = get_value('general.openstack.image_disk_format',
- 'GLANCE_IMAGE_FORMAT')
-FLAVOR_NAME = get_value('general.openstack.flavor_name',
- 'FLAVOR_NAME')
-FLAVOR_RAM = get_value('general.openstack.flavor_ram',
- 'FLAVOR_RAM')
-FLAVOR_DISK = get_value('general.openstack.flavor_disk',
- 'FLAVOR_DISK')
-FLAVOR_VCPUS = get_value('general.openstack.flavor_vcpus',
- 'FLAVOR_VCPUS')
-TEMPEST_PRIVATE_NET_NAME = get_value('tempest.private_net_name',
- 'TEMPEST_PRIVATE_NET_NAME')
-TEMPEST_PRIVATE_SUBNET_NAME = get_value('tempest.private_subnet_name',
- 'TEMPEST_PRIVATE_SUBNET_NAME')
-TEMPEST_PRIVATE_SUBNET_CIDR = get_value('tempest.private_subnet_cidr',
- 'TEMPEST_PRIVATE_SUBNET_CIDR')
-TEMPEST_ROUTER_NAME = get_value('tempest.router_name',
- 'TEMPEST_ROUTER_NAME')
-TEMPEST_TENANT_NAME = get_value('tempest.identity.tenant_name',
- 'TEMPEST_TENANT_NAME')
-TEMPEST_TENANT_DESCRIPTION = get_value('tempest.identity.tenant_description',
- 'TEMPEST_TENANT_DESCRIPTION')
-TEMPEST_USER_NAME = get_value('tempest.identity.user_name',
- 'TEMPEST_USER_NAME')
-TEMPEST_USER_PASSWORD = get_value('tempest.identity.user_password',
- 'TEMPEST_USER_PASSWORD')
-TEMPEST_SSH_TIMEOUT = get_value('tempest.validation.ssh_timeout',
- 'TEMPEST_SSH_TIMEOUT')
-TEMPEST_OPERATOR_ROLE = get_value('tempest.object_storage.operator_role',
- 'TEMPEST_OPERATOR_ROLE')
-TEMPEST_USE_CUSTOM_IMAGES = get_value('tempest.use_custom_images',
- 'TEMPEST_USE_CUSTOM_IMAGES')
-TEMPEST_USE_CUSTOM_FLAVORS = get_value('tempest.use_custom_flavors',
- 'TEMPEST_USE_CUSTOM_FLAVORS')
-TEMPEST_TEST_LIST_DIR = get_value('general.dir.tempest_cases',
- 'TEMPEST_TEST_LIST_DIR')
-NAME_VM_1 = get_value('vping.vm_name_1', 'NAME_VM_1')
-NAME_VM_2 = get_value('vping.vm_name_2', 'NAME_VM_2')
-PING_TIMEOUT = get_value('vping.ping_timeout', 'PING_TIMEOUT')
-VPING__IMAGE_NAME = get_value('vping.image_name', 'VPING__IMAGE_NAME')
-VPING_VM_FLAVOR = get_value('vping.vm_flavor', 'VPING_VM_FLAVOR')
-VPING_PRIVATE_NET_NAME = get_value('vping.private_net_name',
- 'VPING_PRIVATE_NET_NAME')
-VPING_PRIVATE_SUBNET_NAME = get_value('vping.private_subnet_name',
- 'VPING_PRIVATE_SUBNET_NAME')
-VPING_PRIVATE_SUBNET_CIDR = get_value('vping.private_subnet_cidr',
- 'VPING_PRIVATE_SUBNET_CIDR')
-VPING_ROUTER_NAME = get_value('vping.router_name',
- 'VPING_ROUTER_NAME')
-VPING_SECGROUP_NAME = get_value('vping.sg_name',
- 'VPING_SECGROUP_NAME')
-VPING_SECGROUP_DESCR = get_value('vping.sg_desc',
- 'VPING_SECGROUP_DESCR')
-ONOSBENCH_USERNAME = get_value('ONOS.general.onosbench_username',
- 'ONOSBENCH_USERNAME')
-ONOSBENCH_PASSWORD = get_value('ONOS.general.onosbench_password',
- 'ONOSBENCH_PASSWORD')
-ONOSCLI_USERNAME = get_value('ONOS.general.onoscli_username',
- 'ONOSCLI_USERNAME')
-ONOSCLI_PASSWORD = get_value('ONOS.general.onoscli_password',
- 'ONOSCLI_PASSWORD')
-ONOS_RUNTIMEOUT = get_value('ONOS.general.runtimeout',
- 'ONOS_RUNTIMEOUT')
-ONOS_OCT = get_value('ONOS.environment.OCT', 'ONOS_OCT')
-ONOS_OC1 = get_value('ONOS.environment.OC1', 'ONOS_OC1')
-ONOS_OC2 = get_value('ONOS.environment.OC2', 'ONOS_OC2')
-ONOS_OC3 = get_value('ONOS.environment.OC3', 'ONOS_OC3')
-ONOS_OCN = get_value('ONOS.environment.OCN', 'ONOS_OCN')
-ONOS_OCN2 = get_value('ONOS.environment.OCN2', 'ONOS_OCN2')
-ONOS_INSTALLER_MASTER = get_value('ONOS.environment.installer_master',
- 'ONOS_INSTALLER_MASTER')
-ONOS_INSTALLER_MASTER_USERNAME = get_value(
- 'ONOS.environment.installer_master_username',
- 'ONOS_INSTALLER_MASTER_USERNAME')
-ONOS_INSTALLER_MASTER_PASSWORD = get_value(
- 'ONOS.environment.installer_master_password',
- 'ONOS_INSTALLER_MASTER_PASSWORD')
-EXAMPLE_INSTANCE_NAME = get_value('example.vm_name',
- 'EXAMPLE_INSTANCE_NAME')
-EXAMPLE_FLAVOR = get_value('example.flavor', 'EXAMPLE_FLAVOR')
-EXAMPLE_IMAGE_NAME = get_value('example.image_name',
- 'EXAMPLE_IMAGE_NAME')
-EXAMPLE_PRIVATE_NET_NAME = get_value('example.private_net_name',
- 'EXAMPLE_PRIVATE_NET_NAME')
-EXAMPLE_PRIVATE_SUBNET_NAME = get_value(
- 'example.private_subnet_name',
- 'EXAMPLE_PRIVATE_SUBNET_NAME')
-EXAMPLE_PRIVATE_SUBNET_CIDR = get_value(
- 'example.private_subnet_cidr',
- 'EXAMPLE_PRIVATE_SUBNET_CIDR')
-EXAMPLE_ROUTER_NAME = get_value('example.router_name',
- 'EXAMPLE_ROUTER_NAME')
-EXAMPLE_SECGROUP_NAME = get_value('example.sg_name',
- 'EXAMPLE_SECGROUP_NAME')
-EXAMPLE_SECGROUP_DESCR = get_value('example.sg_desc',
- 'EXAMPLE_SECGROUP_DESCR')
-PARSER_REPO_DIR = get_value('general.dir.repo_parser',
- 'PARSER_REPO_DIR')
diff --git a/run_unit_tests.sh b/run_unit_tests.sh
index 8e02880a..32076dab 100755
--- a/run_unit_tests.sh
+++ b/run_unit_tests.sh
@@ -25,11 +25,10 @@ pip install -r $WORKSPACE/test-requirements.txt
pip install $WORKSPACE
#install releng
-cd $WORKSPACE/../
-git clone https://gerrit.opnfv.org/gerrit/releng
-pip install releng/modules/
-rm -fr releng
-cd $WORKSPACE
+rm -rf releng-unittests
+git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng releng-unittests
+pip install releng-unittests/modules/
+rm -fr releng-unittests
export CONFIG_FUNCTEST_YAML=$(pwd)/functest/ci/config_functest.yaml
# unit tests
@@ -39,12 +38,13 @@ nosetests --with-xunit \
--with-coverage \
--cover-erase \
--cover-tests \
+ --cover-package=functest.ci \
--cover-package=functest.cli \
--cover-package=functest.core.testcase_base \
--cover-package=functest.opnfv_tests.sdn.odl.odl \
--cover-package=functest.opnfv_tests.vnf.ims \
--cover-package=functest.utils \
- --cover-package=functest.opnfv_tests.openstack.rally \
+ --cover-package=functest.opnfv_tests.openstack \
--cover-xml \
--cover-html \
--log-config=$(pwd)/functest/tests/unit/test_logging.ini \