aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile1
-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.yaml75
-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.py1
-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/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/utils/functest_constants.py209
-rwxr-xr-xrun_unit_tests.sh10
26 files changed, 534 insertions, 336 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index c5bcfb483..bb54943df 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -86,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
diff --git a/docs/release/release-notes/index.rst b/docs/release/release-notes/index.rst
index 6c6d18109..25ee47713 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 11ca241b2..ce5dc77be 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 1bb8358a8..6bec89258 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 9a345e3f7..b43b5a76c 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 402e29999..b358a3323 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 0e951effe..4a47ba570 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 1a1d0f4b9..bc27f6f8f 100755
--- a/functest/ci/testcases.yaml
+++ b/functest/ci/testcases.yaml
@@ -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'
@@ -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 c168d7d93..f0ae265a4 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 9438dca10..daf8b8061 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 aec2bce5d..32067284b 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 2db44175d..58f0ec748 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 17d05b922..ad77d9be3 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 11f8ad074..0637bcfb3 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 993c1000c..8fece7465 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 83eb6600c..864bca5e6 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 000000000..67cd9415e
--- /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 893fff8c2..2c113367b 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 4c96500db..569a69830 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -320,6 +320,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 69818f5a5..c8e9c4920 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 2bef5cc6e..25421d400 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/tests/unit/ci/__init__.py b/functest/tests/unit/ci/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /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 000000000..540501ff0
--- /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 8f2a5d7e4..5961940f1 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/utils/functest_constants.py b/functest/utils/functest_constants.py
deleted file mode 100644
index 9fae9a9c0..000000000
--- 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 8e02880a6..4c43bfc96 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,6 +38,7 @@ 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 \