diff options
-rw-r--r-- | docker/components/Dockerfile | 2 | ||||
-rw-r--r-- | docker/features/testcases.yaml | 1 | ||||
-rw-r--r-- | docker/features/thirdparty-requirements.txt | 2 | ||||
-rw-r--r-- | docker/restapi/Dockerfile | 5 | ||||
-rw-r--r-- | docker/restapi/thirdparty-requirements.txt | 2 | ||||
-rw-r--r-- | docker/smoke/Dockerfile | 2 | ||||
-rw-r--r-- | docs/testing/developer/devguide/index.rst | 8 | ||||
-rw-r--r-- | docs/testing/user/configguide/ci.rst | 1 | ||||
-rw-r--r-- | docs/testing/user/configguide/configguide.rst | 9 | ||||
-rw-r--r-- | docs/testing/user/userguide/test_overview.rst | 34 | ||||
-rw-r--r-- | functest/ci/check_deployment.py | 32 | ||||
-rw-r--r-- | functest/ci/testcases.yaml | 1 | ||||
-rw-r--r-- | functest/cli/commands/cli_os.py | 5 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 44 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/snaps_utils.py | 10 | ||||
-rw-r--r-- | functest/tests/unit/ci/test_check_deployment.py | 17 | ||||
-rw-r--r-- | functest/tests/unit/openstack/rally/test_rally.py | 5 |
17 files changed, 88 insertions, 92 deletions
diff --git a/docker/components/Dockerfile b/docker/components/Dockerfile index 781022efd..a0f7a48eb 100644 --- a/docker/components/Dockerfile +++ b/docker/components/Dockerfile @@ -27,7 +27,7 @@ RUN apk --no-cache add --virtual .build-deps --update \ rm -r upper-constraints.txt /src/os-faults /src/rally && \ mkdir -p /etc/rally && \ printf "[database]\nconnection = 'sqlite:////var/lib/rally/database/rally.sqlite'" > /etc/rally/rally.conf && \ - mkdir -p /var/lib/rally/database && rally-manage db create && \ + mkdir -p /var/lib/rally/database && rally db create && \ apk del .build-deps COPY testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml CMD ["bash","-c","prepare_env start && run_tests -t all"] diff --git a/docker/features/testcases.yaml b/docker/features/testcases.yaml index d29b8322c..ee8e7c7c8 100644 --- a/docker/features/testcases.yaml +++ b/docker/features/testcases.yaml @@ -27,7 +27,6 @@ tiers: - case_name: bgpvpn project_name: sdnvpn - enabled: false criteria: 100 blocking: false description: >- diff --git a/docker/features/thirdparty-requirements.txt b/docker/features/thirdparty-requirements.txt index 1acf63ea2..a89fd2265 100644 --- a/docker/features/thirdparty-requirements.txt +++ b/docker/features/thirdparty-requirements.txt @@ -1,4 +1,4 @@ # baro_tests -# sdnvpn +sdnvpn sfc # doctor-tests;python_version>='3.0' diff --git a/docker/restapi/Dockerfile b/docker/restapi/Dockerfile index dc0119a9e..81b79fd86 100644 --- a/docker/restapi/Dockerfile +++ b/docker/restapi/Dockerfile @@ -44,10 +44,13 @@ RUN apk --no-cache add --update python3 sshpass \ git clone --depth 1 -b $FDS_TAG https://gerrit.opnfv.org/gerrit/fds /src/fds && \ git clone --depth 1 -b $VIMS_TAG https://github.com/boucherv-orange/clearwater-live-test /src/vims-test && \ ln -s /src/tempest /src/refstack-client/.tempest && \ - virtualenv --system-site-packages /src/tempest/.venv && \ + virtualenv --system-site-packages /src/tempest/.venv --python=python2.7 && \ (cd /src/vims-test && bundle config build.nokogiri --use-system-libraries && bundle install --system) && \ rm -r upper-constraints.txt thirdparty-requirements.txt /src/refstack-client/.git /src/odl_test/.git \ /src/os-faults /src/rally /src/fds/.git /src/vims-test/.git && \ + mkdir -p /etc/rally && \ + printf "[database]\nconnection = 'sqlite:////var/lib/rally/database/rally.sqlite'" > /etc/rally/rally.conf && \ + mkdir -p /var/lib/rally/database && rally db create && \ apk del .build-deps EXPOSE 5000 CMD ["functest_restapi"] diff --git a/docker/restapi/thirdparty-requirements.txt b/docker/restapi/thirdparty-requirements.txt index 50e0d1c96..8eb82d77e 100644 --- a/docker/restapi/thirdparty-requirements.txt +++ b/docker/restapi/thirdparty-requirements.txt @@ -1,4 +1,4 @@ # baro_tests -# sdnvpn +sdnvpn sfc # doctor-tests;python_version>='3.0' diff --git a/docker/smoke/Dockerfile b/docker/smoke/Dockerfile index 01414f3e7..4485699c9 100644 --- a/docker/smoke/Dockerfile +++ b/docker/smoke/Dockerfile @@ -36,7 +36,7 @@ RUN apk --no-cache add --virtual .build-deps --update \ rm -r upper-constraints.txt /src/refstack-client/.git /src/odl_test/.git /src/os-faults /src/rally && \ mkdir -p /etc/rally && \ printf "[database]\nconnection = 'sqlite:////var/lib/rally/database/rally.sqlite'" > /etc/rally/rally.conf && \ - mkdir -p /var/lib/rally/database && rally-manage db create && \ + mkdir -p /var/lib/rally/database && rally db create && \ apk del .build-deps COPY testcases.yaml /usr/lib/python2.7/site-packages/functest/ci/testcases.yaml CMD ["bash","-c","prepare_env start && run_tests -t all"] diff --git a/docs/testing/developer/devguide/index.rst b/docs/testing/developer/devguide/index.rst index d03a10e28..12325c66c 100644 --- a/docs/testing/developer/devguide/index.rst +++ b/docs/testing/developer/devguide/index.rst @@ -47,11 +47,6 @@ Functest High level architecture Functest is a project delivering test containers dedicated to OPNFV. It includes the tools, the scripts and the test scenarios. -Until Danube, Functest produced 2 docker files based on Ubuntu 14.04: - - * x86 Functest: https://hub.docker.com/r/opnfv/functest/ - * aarch64 Functest: https://hub.docker.com/r/opnfv/functest_aarch64/ - In Euphrates Alpine containers have been introduced in order to lighten the container and manage testing slicing. The new containers are created according to the different tiers: @@ -95,8 +90,7 @@ The internal test cases in Euphrates are: * vping_ssh * vping_userdata * odl - * odl-netvirt - * odl-fds + * odl_netvirt * rally_full * rally_sanity * tempest_smoke_serial diff --git a/docs/testing/user/configguide/ci.rst b/docs/testing/user/configguide/ci.rst index ada803c58..f3901d867 100644 --- a/docs/testing/user/configguide/ci.rst +++ b/docs/testing/user/configguide/ci.rst @@ -5,7 +5,6 @@ container from Jenkins. 4 steps have been defined:: * functest-cleanup: clean existing functest dockers on the jumphost - * set-functest-env-alpine: prepare en environement files * functest-daily: run dockers opnfv/functest-* (healthcheck, smoke, features, vnf) * functest-store-results: push logs to artifacts diff --git a/docs/testing/user/configguide/configguide.rst b/docs/testing/user/configguide/configguide.rst index b82376dbd..7da7285ed 100644 --- a/docs/testing/user/configguide/configguide.rst +++ b/docs/testing/user/configguide/configguide.rst @@ -9,8 +9,6 @@ Alpine allows Functest testing in several very light containers and thanks to the refactoring on dependency management should allow the creation of light and fully customized docker images. -It is still possible to use the monolithic Ubuntu image opnfv/functest especially -for tests on Aarch64 architecture. Functest Dockers ---------------- @@ -362,12 +360,8 @@ The structure of functest repo can be described as follows:: |-- build.sh |-- commons |-- docker - | |-- Dockerfile - | |-- Dockerfile.aarch64.patch | |-- components - | |-- config_install_env.sh | |-- core - | |-- docker_remote_api | |-- features | |-- healthcheck | |-- smoke @@ -413,7 +407,6 @@ The structure of functest repo can be described as follows:: │ |-- config_functest.yaml │ |-- config_patch.yaml │ |-- download_images.sh - │ |-- installer_params.yaml │ |-- logging.ini │ |-- prepare_env.py │ |-- rally_aarch64_patch.conf @@ -735,9 +728,7 @@ work with the above pre-requisite actions. .. _`[4]`: http://docs.opnfv.org/en/latest/submodules/functest/docs/testing/user/configguide/index.html .. _`dockerdocs`: https://docs.docker.com/ -.. _`dockerhub`: https://hub.docker.com/r/opnfv/functest/ .. _`Proxy`: https://docs.docker.com/engine/admin/systemd/#http-proxy -.. _`FunctestDockerTags`: https://hub.docker.com/r/opnfv/functest/tags/ .. _`Install Docker on CentOS`: https://docs.docker.com/engine/installation/linux/centos/ .. _`Functest User Guide`: http://docs.opnfv.org/en/stable-danube/submodules/functest/docs/testing/user/userguide/index.html .. _`images/CentOS-7-x86_64-GenericCloud.qcow2` http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img diff --git a/docs/testing/user/userguide/test_overview.rst b/docs/testing/user/userguide/test_overview.rst index a23df02db..98af61437 100644 --- a/docs/testing/user/userguide/test_overview.rst +++ b/docs/testing/user/userguide/test_overview.rst @@ -91,13 +91,6 @@ validate the scenario for the release. | | | | integrates some test suites from | | | | | upstream using Robot as the test | | | | | framework | -| | +----------------+----------------------------------+ -| | | fds | Test Suite for the OpenDaylight | -| | | | SDN Controller when the GBP | -| | | | features are installed. It | -| | | | integrates some test suites from | -| | | | upstream using Robot as the test | -| | | | framework | +-------------+---------------+----------------+----------------------------------+ | Features | features | bgpvpn | Implementation of the OpenStack | | | | | bgpvpn API from the SDNVPN | @@ -117,15 +110,6 @@ validate the scenario for the release. | | | | See `Doctor User Guide`_ for | | | | | details | | | +----------------+----------------------------------+ -| | | domino | Domino provides TOSCA template | -| | | | distribution service for network | -| | | | service and VNF descriptors | -| | | | among MANO components e.g., | -| | | | NFVO, VNFM, VIM, SDN-C, etc., | -| | | | as well as OSS/BSS functions. | -| | | | See `Domino User Guide`_ for | -| | | | details | -| | +----------------+----------------------------------+ | | | odl-sfc | SFC testing for odl scenarios | | | | | See `SFC User Guide`_ for details| | | +----------------+----------------------------------+ @@ -139,16 +123,12 @@ validate the scenario for the release. | | | | See `Parser User Guide`_ for | | | | | details | | | +----------------+----------------------------------+ -| | | promise | Resource reservation and | -| | | | management project to identify | -| | | | NFV related requirements and | -| | | | realize resource reservation for | -| | | | future usage by capacity | -| | | | management of resource pools | -| | | | regarding compute, network and | -| | | | storage. | -| | | | See `Promise User Guide`_ for | -| | | | details | +| | | fds | Test Suite for the OpenDaylight | +| | | | SDN Controller when the GBP | +| | | | features are installed. It | +| | | | integrates some test suites from | +| | | | upstream using Robot as the test | +| | | | framework | +-------------+---------------+----------------+----------------------------------+ | VNF | vnf | cloudify_ims | Example of a real VNF deployment | | | | | to show the NFV capabilities of | @@ -253,9 +233,7 @@ section. .. _`[2]`: http://docs.openstack.org/developer/tempest/overview.html .. _`[3]`: https://rally.readthedocs.org/en/latest/index.html .. _`Doctor User Guide`: http://artifacts.opnfv.org/doctor/colorado/userguide/index.html -.. _`Promise User Guide`: http://artifacts.opnfv.org/promise/colorado/docs/userguide/index.html .. _`SDNVPN User Guide`: http://artifacts.opnfv.org/sdnvpn/colorado/docs/userguide/index.html -.. _`Domino User Guide`: http://artifacts.opnfv.org/domino/docs/userguide-single/index.html .. _`Parser User Guide`: http://artifacts.opnfv.org/parser/colorado/docs/userguide/index.html .. _`Functest Dashboard`: http://testresults.opnfv.org/kibana_dashboards/ .. _`SFC User Guide`: http://artifacts.opnfv.org/sfc/colorado/userguide/index.html diff --git a/functest/ci/check_deployment.py b/functest/ci/check_deployment.py index e593e17b8..db94fd746 100644 --- a/functest/ci/check_deployment.py +++ b/functest/ci/check_deployment.py @@ -22,6 +22,8 @@ import pkg_resources import socket from urlparse import urlparse +from functest.opnfv_tests.openstack.snaps import snaps_utils + from snaps.openstack.utils import glance_utils from snaps.openstack.utils import keystone_utils from snaps.openstack.utils import neutron_utils @@ -33,16 +35,20 @@ __author__ = "Jose Lausuch <jose.lausuch@ericsson.com>" LOGGER = logging.getLogger(__name__) -def verify_connectivity(adress, port): +def verify_connectivity(endpoint): """ Returns true if an ip/port is reachable""" connection = socket.socket() connection.settimeout(10) + ip = urlparse(endpoint).hostname + port = urlparse(endpoint).port + if not port: + port = 443 if urlparse(endpoint).scheme == "https" else 80 try: - connection.connect((adress, port)) - LOGGER.debug('%s:%s is reachable!', adress, port) + connection.connect((ip, port)) + LOGGER.debug('%s:%s is reachable!', ip, port) return True except socket.error: - LOGGER.error('%s:%s is not reachable.', adress, port) + LOGGER.exception('%s:%s is not reachable.', ip, port) return False @@ -65,8 +71,7 @@ class CheckDeployment(object): def check_auth_endpoint(self): """ Verifies connectivity to the OS_AUTH_URL given in the RC file """ rc_endpoint = self.os_creds.auth_url - if not (verify_connectivity(urlparse(rc_endpoint).hostname, - urlparse(rc_endpoint).port)): + if not (verify_connectivity(rc_endpoint)): raise Exception("OS_AUTH_URL {} is not reachable.". format(rc_endpoint)) LOGGER.info("Connectivity to OS_AUTH_URL %s ...OK", rc_endpoint) @@ -76,8 +81,7 @@ class CheckDeployment(object): public_endpoint = keystone_utils.get_endpoint(self.os_creds, 'identity', interface='public') - if not (verify_connectivity(urlparse(public_endpoint).hostname, - urlparse(public_endpoint).port)): + if not (verify_connectivity(public_endpoint)): raise Exception("Public endpoint {} is not reachable.". format(public_endpoint)) LOGGER.info("Connectivity to the public endpoint %s ...OK", @@ -88,8 +92,7 @@ class CheckDeployment(object): endpoint = keystone_utils.get_endpoint(self.os_creds, service, interface='public') - if not (verify_connectivity(urlparse(endpoint).hostname, - urlparse(endpoint).port)): + if not (verify_connectivity(endpoint)): raise Exception("{} endpoint {} is not reachable.". format(service, endpoint)) LOGGER.info("Connectivity to endpoint '%s' %s ...OK", @@ -125,6 +128,14 @@ class CheckDeployment(object): LOGGER.error("Glance service ...FAILED") raise error + def check_ext_net(self): + """ checks if external network exists """ + ext_net = snaps_utils.get_ext_net_name(self.os_creds) + if ext_net: + LOGGER.info("External network found: %s" % ext_net) + else: + raise Exception("ERROR: No external networks in the deployment.") + def check_all(self): """ Calls all the class functions and returns 0 if all of them succeed. @@ -147,6 +158,7 @@ class CheckDeployment(object): self.check_nova() self.check_neutron() self.check_glance() + self.check_ext_net() return 0 diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index ea9f4e7bc..6b1eaa9cb 100644 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -236,7 +236,6 @@ tiers: - case_name: bgpvpn project_name: sdnvpn - enabled: false criteria: 100 blocking: false description: >- diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py index e97ab0809..71cd78c58 100644 --- a/functest/cli/commands/cli_os.py +++ b/functest/cli/commands/cli_os.py @@ -9,6 +9,7 @@ import os +from urlparse import urlparse import click @@ -27,8 +28,8 @@ class OpenStack(object): self.openstack_creds = CONST.__getattribute__('openstack_creds') self.snapshot_file = CONST.__getattribute__('openstack_snapshot_file') if self.os_auth_url: - self.endpoint_ip = self.os_auth_url.rsplit("/")[2].rsplit(":")[0] - self.endpoint_port = self.os_auth_url.rsplit("/")[2].rsplit(":")[1] + self.endpoint_ip = urlparse(self.os_auth_url).hostname + self.endpoint_port = urlparse(self.os_auth_url).port def ping_endpoint(self): if self.os_auth_url is None: diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 0117e69c5..0c657688e 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -346,27 +346,24 @@ class RallyBase(testcase.TestCase): LOGGER.info('No tests for scenario "%s"', test_name) return - cmd_line = ("rally task start --abort-on-sla-failure " - "--task {0} " - "--task-args \"{1}\"" - .format(task_file, self._build_task_args(test_name))) - LOGGER.debug('running command line: %s', cmd_line) - - proc = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, shell=True) + cmd = (["rally", "task", "start", "--abort-on-sla-failure", "--task", + task_file, "--task-args", + str(self._build_task_args(test_name))]) + LOGGER.debug('running command: %s', cmd) + + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) output = self._get_output(proc, test_name) task_id = self.get_task_id(output) LOGGER.debug('task_id : %s', task_id) if task_id is None: LOGGER.error('Failed to retrieve task_id, validating task...') - cmd_line = ("rally task validate " - "--task {0} " - "--task-args \"{1}\"" - .format(task_file, self._build_task_args(test_name))) - LOGGER.debug('running command line: %s', cmd_line) - proc = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, shell=True) + cmd = (["rally", "task", "validate", "--task", task_file, + "--task-args", str(self._build_task_args(test_name))]) + LOGGER.debug('running command: %s', cmd) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) output = self.get_cmd_output(proc) LOGGER.error("Task validation result:" + "\n" + output) return @@ -380,17 +377,18 @@ class RallyBase(testcase.TestCase): # write html report file report_html_name = 'opnfv-{}.html'.format(test_name) report_html_dir = os.path.join(self.RESULTS_DIR, report_html_name) - cmd_line = "rally task report {} --out {}".format(task_id, - report_html_dir) + cmd = (["rally", "task", "report", task_id, "--out", report_html_dir]) - LOGGER.debug('running command line: %s', cmd_line) - os.popen(cmd_line) + LOGGER.debug('running command: %s', cmd) + subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) # get and save rally operation JSON result - cmd_line = "rally task results %s" % task_id - LOGGER.debug('running command line: %s', cmd_line) - cmd = os.popen(cmd_line) - json_results = cmd.read() + cmd = (["rally", "task", "results", task_id]) + LOGGER.debug('running command: %s', cmd) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + json_results = self.get_cmd_output(proc) report_json_name = 'opnfv-{}.json'.format(test_name) report_json_dir = os.path.join(self.RESULTS_DIR, report_json_name) with open(report_json_dir, 'w') as r_file: diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py index c3cd6245e..284e88b51 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py @@ -5,17 +5,25 @@ # # http://www.apache.org/licenses/LICENSE-2.0 +from functest.utils.constants import CONST + from snaps.openstack.utils import neutron_utils, nova_utils def get_ext_net_name(os_creds): """ - Returns the first external network name + Returns the configured external network name or + the first retrieved external network name :param: os_creds: an instance of snaps OSCreds object :return: """ neutron = neutron_utils.neutron_client(os_creds) ext_nets = neutron_utils.get_external_networks(neutron) + if (hasattr(CONST, 'EXTERNAL_NETWORK')): + extnet_config = CONST.__getattribute__('EXTERNAL_NETWORK') + for ext_net in ext_nets: + if ext_net.name == extnet_config: + return extnet_config return ext_nets[0].name if ext_nets else "" diff --git a/functest/tests/unit/ci/test_check_deployment.py b/functest/tests/unit/ci/test_check_deployment.py index 1f44d0787..24e3ce53c 100644 --- a/functest/tests/unit/ci/test_check_deployment.py +++ b/functest/tests/unit/ci/test_check_deployment.py @@ -170,6 +170,23 @@ class CheckDeploymentTesting(unittest.TestCase): self.assertRaises(Exception) self.assertTrue(m.called) + @mock.patch('functest.ci.check_deployment.LOGGER.info') + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' + 'get_ext_net_name', return_value='ext-net') + def test_check_extnet(self, mock_getext, mock_loginfo): + self.deployment.check_ext_net() + self.assertTrue(mock_getext.called) + mock_loginfo.assert_called_once_with("External network found: ext-net") + + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' + 'get_ext_net_name', return_value='') + def test_check_extnet_None(self, mock_getext): + with self.assertRaises(Exception) as context: + self.deployment.check_ext_net() + self.assertTrue(mock_getext.called) + msg = 'ERROR: No external networks in the deployment.' + self.assertTrue(msg in context) + if __name__ == "__main__": logging.disable(logging.CRITICAL) diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index 83f0c86a3..450eb85bc 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -260,13 +260,10 @@ class OSRallyTesting(unittest.TestCase): return_value=True) @mock.patch('functest.opnfv_tests.openstack.rally.rally.subprocess.Popen') @mock.patch('functest.opnfv_tests.openstack.rally.rally.os.makedirs') - @mock.patch('functest.opnfv_tests.openstack.rally.rally.os.popen') @mock.patch('functest.opnfv_tests.openstack.rally.rally.LOGGER.info') @mock.patch('functest.opnfv_tests.openstack.rally.rally.LOGGER.error') def test_run_task_default(self, mock_logger_error, mock_logger_info, - mock_popen, *args): - attrs = {'read.return_value': 'json_result'} - mock_popen.return_value.configure_mock(**attrs) + *args): self.rally_base._run_task('test_name') text = 'Test scenario: "test_name" OK.\n' mock_logger_info.assert_any_call(text) |