diff options
117 files changed, 2450 insertions, 888 deletions
diff --git a/ansible/build_yardstick_image.yml b/ansible/build_yardstick_image.yml index c9b6e74e9..429ab88aa 100644 --- a/ansible/build_yardstick_image.yml +++ b/ansible/build_yardstick_image.yml @@ -59,7 +59,7 @@ - set_fact: raw_imgfile: "{{ workspace }}/{{ raw_imgfile_basename }}" - # cleanup non-lxd + # cleanup non-lxd - name: unmount all old mount points mount: name: "{{ item }}" @@ -74,6 +74,21 @@ command: kpartx -dv "{{ raw_imgfile }}" ignore_errors: true + - name: Debug dump loop devices + command: losetup + register: losetup_output + + - debug: + var: losetup_output + verbosity: 2 + + - name: delete loop devices for image file + # use this because kpartx -dv will fail if raw_imgfile was delete + # but in theory we could have deleted file still attached to loopback device? + # use grep because of // and awk + shell: losetup -O NAME,BACK-FILE | grep "{{ raw_imgfile_basename }}" | awk '{ print $1 }' | xargs -l1 losetup -d + ignore_errors: true + - name: delete {{ raw_imgfile }} file: path: "{{ raw_imgfile }}" @@ -115,7 +130,6 @@ tags: mknod_devices - name: find first partition device -# command: kpartx -l "{{ loop_device }}" command: kpartx -l "{{ raw_imgfile }}" register: kpartx_res diff --git a/ansible/image_uploaders/upload_yardstick_image.yml b/ansible/image_uploaders/upload_yardstick_image.yml index 9364c52a5..e61e2ab67 100644 --- a/ansible/image_uploaders/upload_yardstick_image.yml +++ b/ansible/image_uploaders/upload_yardstick_image.yml @@ -18,10 +18,9 @@ - get_url: url: "{{ CLOUD_IMG_URL }}" dest: "{{ CLOUD_IMAGE }}" - - - name: Extra cloud image kernel - - unarchive: - asdf: +# +# - name: Extra cloud image kernel +# - unarchive: - os_image: name: yardstick-{{ release }}-kernel diff --git a/ansible/roles/download_pktgen/defaults/main.yml b/ansible/roles/download_pktgen/defaults/main.yml new file mode 100644 index 000000000..b598e1d56 --- /dev/null +++ b/ansible/roles/download_pktgen/defaults/main.yml @@ -0,0 +1,8 @@ +--- +pktgen_version: "3.2.12" +pktgen_url: "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-{{ pktgen_version }}.zip" +pktgen_file: "{{ pktgen_url|basename }}" +pktgen_unarchive: "{{ pktgen_file|regex_replace('[.]zip$', '') }}" +pktgen_dest: "{{ clone_dest }}/" +pktgen_sha256s: + "3.2.12": "sha256:a20aeb677fb847c0871acabb6e8f965ba3485e92f92e86e0bb5dc11c787b11d8" diff --git a/ansible/roles/download_pktgen/tasks/main.yml b/ansible/roles/download_pktgen/tasks/main.yml new file mode 100644 index 000000000..ff71f207d --- /dev/null +++ b/ansible/roles/download_pktgen/tasks/main.yml @@ -0,0 +1,38 @@ +# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- file: + path: "{{ pktgen_dest }}" + state: directory + +- name: fetch pktgen + get_url: + url: "{{ pktgen_url }}" + dest: "{{ pktgen_dest }}" + validate_certs: False + checksum: "{{ pktgen_sha256s[pktgen_version] }}" + +- unarchive: + src: "{{ pktgen_dest }}/{{ pktgen_file }}" + dest: "{{ pktgen_dest }}/" + copy: no + +- name: cleanup tar file to save space + file: + path: "{{ pktgen_dest }}/{{ pktgen_file }}" + state: absent + +- set_fact: + pktgen_path: "{{ pktgen_dest }}/{{ pktgen_unarchive }}" + diff --git a/ansible/roles/install_image_dependencies/defaults/main.yml b/ansible/roles/install_image_dependencies/defaults/main.yml index f0b53215a..7a3f5fa7e 100644 --- a/ansible/roles/install_image_dependencies/defaults/main.yml +++ b/ansible/roles/install_image_dependencies/defaults/main.yml @@ -28,6 +28,7 @@ install_dependencies: # for IxLoad - libxft-dev - libxss-dev + - expect RedHat: - bc - fio diff --git a/ansible/roles/install_pktgen/tasks/main.yml b/ansible/roles/install_pktgen/tasks/main.yml new file mode 100644 index 000000000..294c77971 --- /dev/null +++ b/ansible/roles/install_pktgen/tasks/main.yml @@ -0,0 +1,25 @@ +# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: set build env vars + set_fact: + build_env_vars: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + +- name: "make pktgen" + command: make + args: + chdir: "{{ pktgen_path }}" + environment: "{{ build_env_vars }}" diff --git a/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml b/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml index 85afa2a30..7aa6c8c12 100644 --- a/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml +++ b/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml @@ -40,6 +40,8 @@ - install_dpdk - download_trex - install_trex + - download_pktgen + - install_pktgen - download_civetweb - install_civetweb - download_samplevnfs diff --git a/api/resources/v1/env.py b/api/resources/v1/env.py index 75c981a96..6c9eb8324 100644 --- a/api/resources/v1/env.py +++ b/api/resources/v1/env.py @@ -10,12 +10,16 @@ from __future__ import absolute_import import errno import logging + +import ipaddress import os import subprocess import threading import time import uuid import glob + +import six import yaml import collections @@ -269,6 +273,8 @@ class V1Env(ApiResource): LOG.info('Openrc file not found') installer_ip = os.environ.get('INSTALLER_IP', '192.168.200.2') + # validate installer_ip is a valid ipaddress + installer_ip = str(ipaddress.IPv4Address(six.u(installer_ip))) installer_type = os.environ.get('INSTALLER_TYPE', 'compass') LOG.info('Getting openrc file from %s', installer_type) self._get_remote_rc_file(rc_file, diff --git a/api/resources/v1/testsuites.py b/api/resources/v1/testsuites.py index 5f72c2ea6..3e14670b4 100644 --- a/api/resources/v1/testsuites.py +++ b/api/resources/v1/testsuites.py @@ -20,6 +20,7 @@ from yardstick.common.utils import result_handler from yardstick.benchmark.core import Param from yardstick.benchmark.core.task import Task from api.swagger import models +from api.database.v1.handlers import TasksHandler LOG = logging.getLogger(__name__) LOG.setLevel(logging.DEBUG) @@ -58,7 +59,7 @@ class V1Testsuite(ApiResource): task_args.update(args.get('opts', {})) param = Param(task_args) - task_thread = TaskThread(Task().start, param) + task_thread = TaskThread(Task().start, param, TasksHandler()) task_thread.start() return result_handler(consts.API_SUCCESS, {'task_id': task_id}) diff --git a/dashboard/opnfv_yardstick_tc006.json b/dashboard/opnfv_yardstick_tc006.json index e81e8cca4..b6649a7e4 100644 --- a/dashboard/opnfv_yardstick_tc006.json +++ b/dashboard/opnfv_yardstick_tc006.json @@ -49,7 +49,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -187,7 +187,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 2, @@ -324,7 +324,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 3, @@ -493,4 +493,4 @@ "timezone": "", "title": "opnfv_yardstick_tc006", "version": 3 -}
\ No newline at end of file +} diff --git a/dashboard/opnfv_yardstick_tc019.json b/dashboard/opnfv_yardstick_tc019.json index dfd454e9b..c4fddd817 100644 --- a/dashboard/opnfv_yardstick_tc019.json +++ b/dashboard/opnfv_yardstick_tc019.json @@ -55,7 +55,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -162,7 +162,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 3, @@ -273,7 +273,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "format": "none", "gauge": { "maxValue": 100, @@ -403,4 +403,4 @@ "timezone": "", "title": "opnfv_yardstick_tc019", "version": 3 -}
\ No newline at end of file +} diff --git a/dashboard/opnfv_yardstick_tc045.json b/dashboard/opnfv_yardstick_tc045.json index 8f00851d7..058cef4cc 100644 --- a/dashboard/opnfv_yardstick_tc045.json +++ b/dashboard/opnfv_yardstick_tc045.json @@ -55,7 +55,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -162,7 +162,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 3, @@ -273,7 +273,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "format": "none", "gauge": { "maxValue": 100, @@ -403,4 +403,4 @@ "timezone": "", "title": "opnfv_yardstick_tc045", "version": 5 -}
\ No newline at end of file +} diff --git a/dashboard/opnfv_yardstick_tc046.json b/dashboard/opnfv_yardstick_tc046.json index a869c2f21..76505146d 100644 --- a/dashboard/opnfv_yardstick_tc046.json +++ b/dashboard/opnfv_yardstick_tc046.json @@ -55,7 +55,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -162,7 +162,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 3, @@ -273,7 +273,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "format": "none", "gauge": { "maxValue": 100, @@ -405,4 +405,4 @@ "timezone": "", "title": "opnfv_yardstick_tc046", "version": 3 -}
\ No newline at end of file +} diff --git a/dashboard/opnfv_yardstick_tc047.json b/dashboard/opnfv_yardstick_tc047.json index 401df8634..4c696aa5c 100644 --- a/dashboard/opnfv_yardstick_tc047.json +++ b/dashboard/opnfv_yardstick_tc047.json @@ -55,7 +55,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -162,7 +162,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 3, @@ -273,7 +273,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "format": "none", "gauge": { "maxValue": 100, @@ -405,4 +405,4 @@ "timezone": "", "title": "opnfv_yardstick_tc047", "version": 2 -}
\ No newline at end of file +} diff --git a/dashboard/opnfv_yardstick_tc048.json b/dashboard/opnfv_yardstick_tc048.json index 5972c889f..cdafaceca 100644 --- a/dashboard/opnfv_yardstick_tc048.json +++ b/dashboard/opnfv_yardstick_tc048.json @@ -55,7 +55,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -162,7 +162,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 3, @@ -273,7 +273,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "format": "none", "gauge": { "maxValue": 100, @@ -405,4 +405,4 @@ "timezone": "", "title": "opnfv_yardstick_tc048", "version": 2 -}
\ No newline at end of file +} diff --git a/dashboard/opnfv_yardstick_tc051.json b/dashboard/opnfv_yardstick_tc051.json index 012602ba1..455b2b819 100644 --- a/dashboard/opnfv_yardstick_tc051.json +++ b/dashboard/opnfv_yardstick_tc051.json @@ -55,7 +55,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -235,7 +235,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "format": "none", "gauge": { "maxValue": 100, @@ -367,4 +367,4 @@ "timezone": "", "title": "opnfv_yardstick_tc051", "version": 3 -}
\ No newline at end of file +} diff --git a/dashboard/opnfv_yardstick_tc052.json b/dashboard/opnfv_yardstick_tc052.json index b91c53bce..1a3e9ff6c 100644 --- a/dashboard/opnfv_yardstick_tc052.json +++ b/dashboard/opnfv_yardstick_tc052.json @@ -55,7 +55,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -166,7 +166,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "format": "none", "gauge": { "maxValue": 100, @@ -298,4 +298,4 @@ "timezone": "", "title": "opnfv_yardstick_tc052", "version": 2 -}
\ No newline at end of file +} diff --git a/dashboard/opnfv_yardstick_tc082.json b/dashboard/opnfv_yardstick_tc082.json index 38d9d8f57..1fbaf1d6c 100644 --- a/dashboard/opnfv_yardstick_tc082.json +++ b/dashboard/opnfv_yardstick_tc082.json @@ -49,7 +49,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 7, @@ -167,7 +167,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 9, @@ -274,7 +274,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 1, @@ -369,7 +369,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "${DS_YARDSTICK}", + "datasource": "yardstick", "description": "", "fill": 1, "id": 5, @@ -508,4 +508,4 @@ "timezone": "", "title": "opnfv_yardstick_tc082", "version": 5 -}
\ No newline at end of file +} diff --git a/docker/Dockerfile b/docker/Dockerfile index 959315c6b..b97337e4d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,7 +39,8 @@ RUN ${YARDSTICK_REPO_DIR}/docker/supervisor.sh RUN echo "daemon off;" >> /etc/nginx/nginx.conf -EXPOSE 5000 +# nginx=5000, rabbitmq=5672 +EXPOSE 5000 5672 ADD http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img ${IMAGE_DIR} ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img ${IMAGE_DIR} diff --git a/docker/Dockerfile.aarch64.patch b/docker/Dockerfile.aarch64.patch index 24e3952fb..de272f5a8 100644 --- a/docker/Dockerfile.aarch64.patch +++ b/docker/Dockerfile.aarch64.patch @@ -39,11 +39,11 @@ index 2ee5b4c..23e5ea5 100644 +RUN apt-get update && apt-get install -y git python-setuptools python-pip && apt-get -y autoremove && \ + apt-get install -y libssl-dev && apt-get -y install libffi-dev && apt-get clean RUN easy_install -U setuptools==30.0.0 - RUN pip install appdirs==1.4.0 pyopenssl==17.5.0 python-openstackclient==3.11.0 + RUN pip install appdirs==1.4.0 pyopenssl==17.5.0 python-openstackclient==3.11.0 python-heatclient==1.11.0 @@ -43,8 +44,8 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf - - EXPOSE 5000 +# nginx=5000, rabbitmq=5672 +EXPOSE 5000 5672 -ADD http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img ${IMAGE_DIR} -ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img ${IMAGE_DIR} diff --git a/docs/testing/user/userguide/08-api.rst b/docs/testing/user/userguide/08-api.rst index 79f5d64be..2206c2ac8 100644 --- a/docs/testing/user/userguide/08-api.rst +++ b/docs/testing/user/userguide/08-api.rst @@ -576,7 +576,7 @@ Create a test suite Example:: { - 'action': 'create_sutie', + 'action': 'create_suite', 'args': { 'name': <suite_name>, 'testcases': [ diff --git a/docs/testing/user/userguide/13-nsb_operation.rst b/docs/testing/user/userguide/13-nsb_operation.rst index 8c477fa3f..e791b048d 100644 --- a/docs/testing/user/userguide/13-nsb_operation.rst +++ b/docs/testing/user/userguide/13-nsb_operation.rst @@ -126,7 +126,7 @@ To collectd KPIs from the NFVi compute nodes: Scale-Up ------------------- +-------- VNFs performance data with scale-up @@ -137,21 +137,59 @@ VNFs performance data with scale-up Heat ^^^^ -For VNF scale-up tests we increase the number for VNF worker threads. In the case of VNFs +For VNF scale-up tests we increase the number for VNF worker threads and ports. In the case of VNFs we also need to increase the number of VCPUs and memory allocated to the VNF. An example scale-up Heat testcase is: +.. literalinclude:: /submodules/yardstick/samples/vnf_samples/nsut/vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_scale-up.yaml + :language: yaml + +This testcase template requires specifying the number of VCPUs, Memory and Ports. +We set the VCPUs and memory using the ``--task-args`` options + .. code-block:: console - <repo>/samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml + yardstick task start --task-args='{"mem": 10480, "vcpus": 4, "ports": 2}' \ + samples/vnf_samples/nsut/vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_scale-up.yaml -This testcase template requires specifying the number of VCPUs and Memory. -We set the VCPUs and memory using the --task-args options +In order to support ports scale-up, traffic and topology templates need to be used in testcase. -.. code-block:: console +A example topology template is: + +.. literalinclude:: /submodules/yardstick/samples/vnf_samples/nsut/vfw/vfw-tg-topology-scale-up.yaml + :language: yaml + +This template has ``vports`` as an argument. To pass this argument it needs to +be configured in ``extra_args`` scenario definition. Please note that more +argument can be defined in that section. All of them will be passed to topology +and traffic profile templates + +For example: + +.. code-block:: yaml - yardstick --debug task start --task-args='{"mem": 20480, "vcpus": 10}' samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml + schema: yardstick:task:0.1 + scenarios: + - type: NSPerf + traffic_profile: ../../traffic_profiles/ipv4_throughput-scale-up.yaml + extra_args: + vports: {{ vports }} + topology: vfw-tg-topology-scale-up.yaml + +A example traffic profile template is: + +.. literalinclude:: /submodules/yardstick/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-up.yaml + :language: yaml + +There is an option to provide predefined config for SampleVNFs. Path to config +file may by specified in ``vnf_config`` scenario section. + +.. code-block:: yaml + + vnf__0: + rules: acl_1rule.yaml + vnf_config: {lb_config: 'SW', file: vfw_vnf_pipeline_cores_4_ports_2_lb_1_sw.conf } Baremetal @@ -266,5 +304,3 @@ To enable multiple queue set the queues_per_port value in the TG VNF options sec options: tg_0: queues_per_port: 2 - - diff --git a/docs/testing/user/userguide/15-list-of-tcs.rst b/docs/testing/user/userguide/15-list-of-tcs.rst index 47526cdda..cb99c49cf 100644 --- a/docs/testing/user/userguide/15-list-of-tcs.rst +++ b/docs/testing/user/userguide/15-list-of-tcs.rst @@ -83,6 +83,7 @@ H A opnfv_yardstick_tc056.rst opnfv_yardstick_tc057.rst opnfv_yardstick_tc058.rst + opnfv_yardstick_tc087.rst IPv6 ---- diff --git a/docs/testing/user/userguide/opnfv_yardstick_tc087.rst b/docs/testing/user/userguide/opnfv_yardstick_tc087.rst new file mode 100644 index 000000000..99bfeebfc --- /dev/null +++ b/docs/testing/user/userguide/opnfv_yardstick_tc087.rst @@ -0,0 +1,182 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International +.. License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) OPNFV, Ericsson and others. + +************************************* +Yardstick Test Case Description TC087 +************************************* + ++-----------------------------------------------------------------------------+ +|SDN Controller resilience in non-HA configuration | +| | ++--------------+--------------------------------------------------------------+ +|test case id | OPNFV_YARDSTICK_TC087: SDN controller resilience in | +| | non-HA configuration | +| | | ++--------------+--------------------------------------------------------------+ +|test purpose | This test validates that network data plane services are | +| | highly available in the event of an SDN Controller failure, | +| | even if the SDN controller is deployed in a non-HA | +| | configuration. Specifically, the test verifies that | +| | existing data plane connectivity is not impacted, i.e. all | +| | configured network services such as DHCP, ARP, L2, | +| | L3 Security Groups should continue to operate | +| | between the existing VMs while the SDN controller is | +| | offline or rebooting. | +| | | +| | The test also validates that new network service operations | +| | (creating a new VM in the existing L2/L3 network or in a new | +| | network, etc.) are operational after the SDN controller | +| | has recovered from a failure. | +| | | ++--------------+--------------------------------------------------------------+ +|test method | This test case fails the SDN controller service running | +| | on the OpenStack controller node, then checks if already | +| | configured DHCP/ARP/L2/L3/SNAT connectivity is not | +| | impacted between VMs and the system is able to execute | +| | new virtual network operations once the SDN controller | +| | is restarted and has fully recovered | +| | | ++--------------+--------------------------------------------------------------+ +|attackers | In this test case, an attacker called “kill-process” is | +| | needed. This attacker includes three parameters: | +| | 1. fault_type: which is used for finding the attacker's | +| | scripts. It should be set to 'kill-process' in this test | +| | | +| | 2. process_name: should be set to the name of the SDN | +| | controller process | +| | | +| | 3. host: which is the name of a control node where the | +| | SDN controller process is running | +| | | +| | e.g. -fault_type: "kill-process" | +| | -process_name: "opendaylight" | +| | -host: node1 | +| | | ++--------------+--------------------------------------------------------------+ +|monitors | This test case utilizes two monitors of type "ip-status" | +| | and one monitor of type "process" to track the following | +| | conditions: | +| | 1. "ping_same_network_l2": monitor ICMP traffic between | +| | VMs in the same Neutron network | +| | | +| | 2. "ping_external_snat": monitor ICMP traffic from VMs to | +| | an external host on the Internet to verify SNAT | +| | functionality. | +| | | +| | 3. "SDN controller process monitor": a monitor checking the | +| | state of a specified SDN controller process. It measures | +| | the recovery time of the given process. | +| | | +| | Monitors of type "ip-status" use the "ping" utility to | +| | verify reachability of a given target IP. | +| | | ++--------------+--------------------------------------------------------------+ +|operations | In this test case, the following operations are needed: | +| | 1. "nova-create-instance-in_network": create a VM instance | +| | in one of the existing Neutron network. | +| | | ++--------------+--------------------------------------------------------------+ +|metrics | In this test case, there are two metrics: | +| | 1. process_recover_time: which indicates the maximun | +| | time (seconds) from the process being killed to | +| | recovered | +| | | +| | 2. packet_drop: measure the packets that have been dropped | +| | by the monitors using pktgen. | +| | | ++--------------+--------------------------------------------------------------+ +|test tool | Developed by the project. Please see folder: | +| | "yardstick/benchmark/scenarios/availability/ha_tools" | +| | | ++--------------+--------------------------------------------------------------+ +|references | none | +| | | ++--------------+--------------------------------------------------------------+ +|configuration | This test case needs two configuration files: | +| | 1. test case file: opnfv_yardstick_tc087.yaml | +| | - Attackers: see above “attackers” discription | +| | - waiting_time: which is the time (seconds) from the | +| | process being killed to stoping monitors the monitors | +| | - Monitors: see above “monitors” discription | +| | - SLA: see above “metrics” discription | +| | | +| | 2. POD file: pod.yaml The POD configuration should record | +| | on pod.yaml first. the “host” item in this test case | +| | will use the node name in the pod.yaml. | +| | | ++--------------+--------------------------------------------------------------+ +|test sequence | Description and expected result | +| | | ++--------------+--------------------------------------------------------------+ +|pre-action | 1. The OpenStack cluster is set up with a single SDN | +| | controller in a non-HA configuration. | +| | | +| | 2. One or more Neutron networks are created with two or | +| | more VMs attached to each of the Neutron networks. | +| | | +| | 3. The Neutron networks are attached to a Neutron router | +| | which is attached to an external network towards the | +| | DCGW. | +| | | ++--------------+--------------------------------------------------------------+ +|step 1 | Start IP connectivity monitors: | +| | 1. Check the L2 connectivity between the VMs in the same | +| | Neutron network. | +| | | +| | 2. Check connectivity from one VM to an external host on | +| | the Internet to verify SNAT functionality. +| | | +| | Result: The monitor info will be collected. | +| | | ++--------------+--------------------------------------------------------------+ +|step 2 | Start attacker: | +| | SSH connect to the VIM node and kill the SDN controller | +| | process | +| | | +| | Result: the SDN controller service will be shutdown | +| | | ++--------------+--------------------------------------------------------------+ +|step 3 | Verify the results of the IP connectivity monitors. | +| | | +| | Result: The outage_time metric reported by the monitors | +| | is zero. | +| | | ++--------------+--------------------------------------------------------------+ +|step 4 | Restart the SDN controller. | +| | | ++--------------+--------------------------------------------------------------+ +|step 5 | Create a new VM in the existing Neutron network | +| | | ++--------------+--------------------------------------------------------------+ +|step 6 | Verify connectivity between VMs as follows: | +| | 1. Check the L2 connectivity between the previously | +| | existing VM and the newly created VM on the same | +| | Neutron network by sending ICMP messages | +| | | ++--------------+--------------------------------------------------------------+ +|step 7 | Stop IP connectivity monitors after a period of time | +| | specified by “waiting_time” | +| | | +| | Result: The monitor info will be aggregated | +| | | ++--------------+--------------------------------------------------------------+ +|step 8 | Verify the IP connectivity monitor results | +| | | +| | Result: IP connectivity monitor should not have any packet | +| | drop failures reported | +| | | ++--------------+--------------------------------------------------------------+ +|test verdict | This test fails if the SLAs are not met or if there is a | +| | test case execution problem. The SLAs are define as follows | +| | for this test: | +| | * SDN Controller recovery | +| | * process_recover_time <= 30 sec | +| | | +| | * no impact on data plane connectivity during SDN | +| | controller failure and recovery. | +| | * packet_drop == 0 | +| | | ++--------------+--------------------------------------------------------------+ + diff --git a/docs/testing/user/userguide/opnfv_yardstick_tc090.rst b/docs/testing/user/userguide/opnfv_yardstick_tc090.rst new file mode 100644 index 000000000..1f8747b2b --- /dev/null +++ b/docs/testing/user/userguide/opnfv_yardstick_tc090.rst @@ -0,0 +1,151 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International +.. License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) OPNFV, Yin Kanglin and others. +.. 14_ykl@tongji.edu.cn + +************************************* +Yardstick Test Case Description TC090 +************************************* + ++-----------------------------------------------------------------------------+ +|Control Node OpenStack Service High Availability - Database Instances | +| | ++--------------+--------------------------------------------------------------+ +|test case id | OPNFV_YARDSTICK_TC090: Control node OpenStack service down - | +| | database instances | ++--------------+--------------------------------------------------------------+ +|test purpose | This test case will verify the high availability of the | +| | data base instances used by OpenStack (mysql) on control | +| | node. | +| | | ++--------------+--------------------------------------------------------------+ +|test method | This test case kills the processes of database service on a | +| | selected control node, then checks whether the request of | +| | the related OpenStack command is OK and the killed processes | +| | are recovered. | +| | | ++--------------+--------------------------------------------------------------+ +|attackers | In this test case, an attacker called "kill-process" is | +| | needed. This attacker includes three parameters: | +| | 1) fault_type: which is used for finding the attacker's | +| | scripts. It should be always set to "kill-process" in this | +| | test case. | +| | 2) process_name: which is the process name of the specified | +| | OpenStack service. If there are multiple processes use the | +| | same name on the host, all of them are killed by this | +| | attacker. | +| | In this case. This parameter should always set to the name | +| | of the database service of OpenStack. | +| | 3) host: which is the name of a control node being attacked. | +| | | +| | e.g. | +| | -fault_type: "kill-process" | +| | -process_name: "mysql" | +| | -host: node1 | +| | | ++--------------+--------------------------------------------------------------+ +|monitors | In this test case, two kinds of monitor are needed: | +| | 1. the "openstack-cmd" monitor constantly request a specific | +| | Openstack command, which needs two parameters: | +| | 1) monitor_type: which is used for finding the monitor class | +| | and related scritps. It should be always set to | +| | "openstack-cmd" for this monitor. | +| | 2) command_name: which is the command name used for request. | +| | In this case, the command name should be neutron related | +| | commands. | +| | | +| | 2. the "process" monitor check whether a process is running | +| | on a specific node, which needs three parameters: | +| | 1) monitor_type: which used for finding the monitor class and| +| | related scripts. It should be always set to "process" | +| | for this monitor. | +| | 2) process_name: which is the process name for monitor | +| | 3) host: which is the name of the node running the process | +| | | +| | The examples of monitors show as follows, there are four | +| | instance of the "openstack-cmd" monitor, in order to check | +| | the database connection of different OpenStack components. | +| | | +| | monitor1: | +| | -monitor_type: "openstack-cmd" | +| | -api_name: "openstack image list" | +| | monitor2: | +| | -monitor_type: "openstack-cmd" | +| | -api_name: "openstack router list" | +| | monitor3: | +| | -monitor_type: "openstack-cmd" | +| | -api_name: "openstack stack list" | +| | monitor4: | +| | -monitor_type: "openstack-cmd" | +| | -api_name: "openstack volume list" | +| | monitor5: | +| | -monitor_type: "process" | +| | -process_name: "mysql" | +| | -host: node1 | +| | | ++--------------+--------------------------------------------------------------+ +|metrics | In this test case, there are two metrics: | +| | 1)service_outage_time: which indicates the maximum outage | +| | time (seconds) of the specified OpenStack command request. | +| | 2)process_recover_time: which indicates the maximum time | +| | (seconds) from the process being killed to recovered | +| | | ++--------------+--------------------------------------------------------------+ +|test tool | Developed by the project. Please see folder: | +| | "yardstick/benchmark/scenarios/availability/ha_tools" | +| | | ++--------------+--------------------------------------------------------------+ +|references | ETSI NFV REL001 | +| | | ++--------------+--------------------------------------------------------------+ +|configuration | This test case needs two configuration files: | +| | 1) test case file: opnfv_yardstick_tc090.yaml | +| | -Attackers: see above "attackers" description | +| | -waiting_time: which is the time (seconds) from the process | +| | being killed to stopping monitors the monitors | +| | -Monitors: see above "monitors" description | +| | -SLA: see above "metrics" description | +| | | +| | 2)POD file: pod.yaml | +| | The POD configuration should record on pod.yaml first. | +| | the "host" item in this test case will use the node name in | +| | the pod.yaml. | +| | | ++--------------+--------------------------------------------------------------+ +|test sequence | description and expected result | +| | | ++--------------+--------------------------------------------------------------+ +|step 1 | start monitors: | +| | each monitor will run with independently process | +| | | +| | Result: The monitor info will be collected. | +| | | ++--------------+--------------------------------------------------------------+ +|step 2 | do attacker: connect the host through SSH, and then execute | +| | the kill process script with param value specified by | +| | "process_name" | +| | | +| | Result: Process will be killed. | +| | | ++--------------+--------------------------------------------------------------+ +|step 3 | stop monitors after a period of time specified by | +| | "waiting_time" | +| | | +| | Result: The monitor info will be aggregated. | +| | | ++--------------+--------------------------------------------------------------+ +|step 4 | verify the SLA | +| | | +| | Result: The test case is passed or not. | +| | | ++--------------+--------------------------------------------------------------+ +|post-action | It is the action when the test cases exist. It will check the| +| | status of the specified process on the host, and restart the | +| | process if it is not running for next test cases | +| | | ++--------------+--------------------------------------------------------------+ +|test verdict | Fails only if SLA is not passed, or if there is a test case | +| | execution problem. | +| | | ++--------------+--------------------------------------------------------------+ diff --git a/docs/testing/user/userguide/opnfv_yardstick_tc091.rst b/docs/testing/user/userguide/opnfv_yardstick_tc091.rst new file mode 100644 index 000000000..8e89b6425 --- /dev/null +++ b/docs/testing/user/userguide/opnfv_yardstick_tc091.rst @@ -0,0 +1,138 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International +.. License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) OPNFV, Yin Kanglin and others. +.. 14_ykl@tongji.edu.cn + +************************************* +Yardstick Test Case Description TC091 +************************************* + ++-----------------------------------------------------------------------------+ +|Control Node Openstack Service High Availability - Heat Api | +| | ++--------------+--------------------------------------------------------------+ +|test case id | OPNFV_YARDSTICK_TC091: Control node OpenStack service down - | +| | heat api | ++--------------+--------------------------------------------------------------+ +|test purpose | This test case will verify the high availability of the | +| | orchestration service provided by OpenStack (heat-api) on | +| | control node. | +| | | ++--------------+--------------------------------------------------------------+ +|test method | This test case kills the processes of heat-api service on a | +| | selected control node, then checks whether the request of | +| | the related OpenStack command is OK and the killed processes | +| | are recovered. | +| | | ++--------------+--------------------------------------------------------------+ +|attackers | In this test case, an attacker called "kill-process" is | +| | needed. This attacker includes three parameters: | +| | 1) fault_type: which is used for finding the attacker's | +| | scripts. It should be always set to "kill-process" in this | +| | test case. | +| | 2) process_name: which is the process name of the specified | +| | OpenStack service. If there are multiple processes use the | +| | same name on the host, all of them are killed by this | +| | attacker. | +| | In this case. This parameter should always set to "heat-api".| +| | 3) host: which is the name of a control node being attacked. | +| | | +| | e.g. | +| | -fault_type: "kill-process" | +| | -process_name: "heat-api" | +| | -host: node1 | +| | | ++--------------+--------------------------------------------------------------+ +|monitors | In this test case, two kinds of monitor are needed: | +| | 1. the "openstack-cmd" monitor constantly request a specific | +| | OpenStack command, which needs two parameters: | +| | 1) monitor_type: which is used for finding the monitor class | +| | and related scripts. It should be always set to | +| | "openstack-cmd" for this monitor. | +| | 2) command_name: which is the command name used for request. | +| | In this case, the command name should be neutron related | +| | commands. | +| | | +| | 2. the "process" monitor check whether a process is running | +| | on a specific node, which needs three parameters: | +| | 1) monitor_type: which used for finding the monitor class and| +| | related scripts. It should be always set to "process" | +| | for this monitor. | +| | 2) process_name: which is the process name for monitor | +| | 3) host: which is the name of the node running the process | +| | | +| | e.g. | +| | monitor1: | +| | -monitor_type: "openstack-cmd" | +| | -command_name: "heat stack list" | +| | monitor2: | +| | -monitor_type: "process" | +| | -process_name: "heat-api" | +| | -host: node1 | +| | | ++--------------+--------------------------------------------------------------+ +|metrics | In this test case, there are two metrics: | +| | 1)service_outage_time: which indicates the maximum outage | +| | time (seconds) of the specified OpenStack command request. | +| | 2)process_recover_time: which indicates the maximum time | +| | (seconds) from the process being killed to recovered | +| | | ++--------------+--------------------------------------------------------------+ +|test tool | Developed by the project. Please see folder: | +| | "yardstick/benchmark/scenarios/availability/ha_tools" | +| | | ++--------------+--------------------------------------------------------------+ +|references | ETSI NFV REL001 | +| | | ++--------------+--------------------------------------------------------------+ +|configuration | This test case needs two configuration files: | +| | 1) test case file: opnfv_yardstick_tc091.yaml | +| | -Attackers: see above "attackers" description | +| | -waiting_time: which is the time (seconds) from the process | +| | being killed to the monitor stopped | +| | -Monitors: see above "monitors" description | +| | -SLA: see above "metrics" description | +| | | +| | 2)POD file: pod.yaml | +| | The POD configuration should record on pod.yaml first. | +| | the "host" item in this test case will use the node name in | +| | the pod.yaml. | +| | | ++--------------+--------------------------------------------------------------+ +|test sequence | description and expected result | +| | | ++--------------+--------------------------------------------------------------+ +|step 1 | start monitors: | +| | each monitor will run with independently process | +| | | +| | Result: The monitor info will be collected. | +| | | ++--------------+--------------------------------------------------------------+ +|step 2 | do attacker: connect the host through SSH, and then execute | +| | the kill process script with param value specified by | +| | "process_name" | +| | | +| | Result: Process will be killed. | +| | | ++--------------+--------------------------------------------------------------+ +|step 3 | stop monitors after a period of time specified by | +| | "waiting_time" | +| | | +| | Result: The monitor info will be aggregated. | +| | | ++--------------+--------------------------------------------------------------+ +|step 4 | verify the SLA | +| | | +| | Result: The test case is passed or not. | +| | | ++--------------+--------------------------------------------------------------+ +|post-action | It is the action when the test cases exist. It will check the| +| | status of the specified process on the host, and restart the | +| | process if it is not running for next test cases | +| | | ++--------------+--------------------------------------------------------------+ +|test verdict | Fails only if SLA is not passed, or if there is a test case | +| | execution problem. | +| | | ++--------------+--------------------------------------------------------------+ diff --git a/install.sh b/install.sh index 5cd83677b..6f4ab8c9d 100755 --- a/install.sh +++ b/install.sh @@ -85,6 +85,7 @@ apt-get update && apt-get install -y \ libxss-dev \ sudo \ iputils-ping + rabbitmq-server if [[ "${DOCKER_ARCH}" != "aarch64" ]]; then apt-get install -y libc6:arm64 @@ -94,9 +95,13 @@ apt-get -y autoremove && apt-get clean git config --global http.sslVerify false +# Configure and restart RabbitMQ +rabbitmqctl add_user yardstick yardstick +rabbitmqctl set_permissions yardstick ".*" ".*" ".*" +rabbitmqctl reset # install yardstick + dependencies -easy_install -U pip +easy_install -U pip==9.0.1 pip install -r requirements.txt pip install -e . diff --git a/requirements.txt b/requirements.txt index d45e4b149..02545de1d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,7 +43,7 @@ oslo.utils==3.28.0 # OSI Approved Apache Software License paramiko==2.2.1 # LGPL; OSI Approved GNU Library or Lesser General Public License (LGPL) pbr==3.1.1 # OSI Approved Apache Software License; Apache License, Version 2.0 pika==0.10.0 # BSD; OSI Approved BSD License -pip==9.0.1;python_version=='2.7' # MIT +pip==9.0.1 # MIT positional==1.1.2 # OSI Approved Apache Software License pycrypto==2.6.1 # Public Domain pyparsing==2.2.0 # MIT License; OSI Approved MIT License @@ -55,7 +55,7 @@ python-keystoneclient==3.13.0 # OSI Approved Apache Software License python-neutronclient==6.5.0 # OSI Approved Apache Software License python-novaclient==9.1.1 # OSI Approved Apache Software License pyzmq==16.0.2 # LGPL+BSD; OSI Approved GNU Library or Lesser General Public License (LGPL); OSI Approved BSD License -requests==2.18.2 # Apache 2.0; OSI Approved Apache Software License +requests==2.11.1 # Apache 2.0; OSI Approved Apache Software License requestsexceptions==1.3.0 # OSI Approved Apache Software License scp==0.10.2 # LGPL shade==1.22.2 # OSI Approved Apache Software License diff --git a/samples/dummy-no-context.yaml b/samples/dummy-no-context.yaml index 7667e5a16..e4ace44c2 100644 --- a/samples/dummy-no-context.yaml +++ b/samples/dummy-no-context.yaml @@ -14,7 +14,7 @@ schema: "yardstick:task:0.1" scenarios: - type: Dummy - + name: Dummy runner: type: Duration duration: 5 diff --git a/samples/parser.yaml b/samples/parser.yaml index e2e4b66ce..682c11329 100644 --- a/samples/parser.yaml +++ b/samples/parser.yaml @@ -27,3 +27,4 @@ scenarios: context: type: Dummy + name: Dummy diff --git a/samples/ping_bottlenecks.yaml b/samples/ping_bottlenecks.yaml index e6fef4259..625d4501a 100644 --- a/samples/ping_bottlenecks.yaml +++ b/samples/ping_bottlenecks.yaml @@ -15,6 +15,10 @@ description: > measure VMs latency using ping; run_in_parallel: true {% set stack_num = stack_num or 1 %} +{% set image_name = image_name or "yardstick-image" %} +{% set cpu_num = cpu_num or 1 %} +{% set ram_num = ram_num or 512 %} +{% set disk_num = disk_num or 7 %} scenarios: {% for num in range(stack_num) %} @@ -34,8 +38,11 @@ contexts: {% for num in range(stack_num) %} - name: demo{{num}} - image: yardstick-image - flavor: yardstick-flavor + image: {{image_name}} + flavor: + vcpus: {{cpu_num}} + ram: {{ram_num}} + disk: {{disk_num}} user: ubuntu placement_groups: diff --git a/samples/storage_bottlenecks.yaml b/samples/storage_bottlenecks.yaml index 1aa0d7e35..971a307da 100644 --- a/samples/storage_bottlenecks.yaml +++ b/samples/storage_bottlenecks.yaml @@ -31,6 +31,11 @@ run_in_parallel: true {% set numjobs = numjobs or "1" %} {% set direct = direct or "1" %} {% set volume_size = volume_size or 50 %} +{% set image_name = image_name or "yardstick-image" %} +{% set cpu_num = cpu_num or 1 %} +{% set ram_num = ram_num or 512 %} +{% set disk_num = disk_num or 7 %} +{% set run_time = run_time or 3000 %} scenarios: {% for num in range(stack_num) %} @@ -51,7 +56,7 @@ scenarios: runner: type: Duration - duration: 60 + duration: {{ run_time }} interval: 1 {% endfor %} @@ -59,8 +64,11 @@ contexts: {% for context_num in range(stack_num) %} - name: storage_bottlenecks-{{context_num}}-{{volume_num}} - image: yardstick-image - flavor: yardstick-flavor + image: {{image_name}} + flavor: + vcpus: {{cpu_num}} + ram: {{ram_num}} + disk: {{disk_num}} user: ubuntu servers: @@ -74,4 +82,4 @@ contexts: test: cidr: "10.0.1.0/24" port_security_enabled: true -{% endfor %}
\ No newline at end of file +{% endfor %} diff --git a/samples/storperf.yaml b/samples/storperf.yaml index 2ea022173..00f74c1fe 100644 --- a/samples/storperf.yaml +++ b/samples/storperf.yaml @@ -38,3 +38,4 @@ scenarios: context: type: Dummy + name: Dummy diff --git a/samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_bottlenecks_scale_out.yaml b/samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_bottlenecks_scale_out.yaml new file mode 100644 index 000000000..fe3595b14 --- /dev/null +++ b/samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_bottlenecks_scale_out.yaml @@ -0,0 +1,123 @@ +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +schema: yardstick:task:0.1 + +{% set num_vnfs = num_vnfs or 2 %} +{% set image_name = image_name or "yardstick-samplevnfs" %} +{% set cpu_num = cpu_num or 10 %} +{% set ram_num = ram_num or 10240 %} +{% set disk_num = disk_num or 7 %} + +scenarios: + - type: NSPerf + traffic_profile: ../../traffic_profiles/ipv4_throughput-{{ num_vnfs }}.yaml + topology: acl-tg-topology-3node-{{ num_vnfs }}.yaml + nodes: + tg__0: tg_0.yardstick + tg__1: tg_1.yardstick +{% for vnf_num in range(num_vnfs|int) %} + vnf__{{ vnf_num }}: vnf_{{ vnf_num }}.yardstick +{% endfor %} + options: + framesize: + uplink: {64B: 100} + downlink: {64B: 100} + flow: + src_ip: +{% for vnf_num in range(num_vnfs|int) %} + - {'tg__0': 'xe{{ vnf_num }}'} +{% endfor %} + dst_ip: +{% for vnf_num in range(num_vnfs|int) %} + - {'tg__1': 'xe{{ vnf_num }}'} +{% endfor %} + count: 1 + traffic_type: 4 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + correlated_traffic: true +{% for vnf_num in range(num_vnfs|int) %} + vnf__{{ vnf_num }}: + rules: acl_1rule.yaml + vnf_config: {lb_config: 'SW', lb_count: 1, worker_config: '1C/1T', worker_threads: 1} +{% endfor %} + runner: + type: Iteration + iterations: 10 + interval: 35 +context: + name: yardstick + image: {{ image_name }} + flavor: + vcpus: {{ cpu_num }} + ram: {{ ram_num }} + disk: {{ disk_num }} + extra_specs: + hw:cpu_sockets: 1 + hw:cpu_cores: {{ cpu_num }} + hw:cpu_threads: 1 + user: ubuntu + placement_groups: + pgrp1: + policy: "availability" + servers: + tg_0: + floating_ip: true + placement: "pgrp1" + network_ports: + mgmt: + - mgmt +{% for vnf_num in range(num_vnfs|int) %} + uplink_{{ vnf_num }}: + - xe{{ vnf_num }} +{% endfor %} + tg_1: + floating_ip: true + placement: "pgrp1" + network_ports: + mgmt: + - mgmt +{% for vnf_num in range(num_vnfs|int) %} + downlink_{{ vnf_num }}: + - xe{{ vnf_num }} +{% endfor %} +{% for vnf_num in range(num_vnfs|int) %} + vnf_{{ vnf_num }}: + floating_ip: true + placement: "pgrp1" + network_ports: + mgmt: + - mgmt + uplink_{{ vnf_num }}: + - xe0 + downlink_{{ vnf_num }}: + - xe1 +{% endfor %} + networks: + mgmt: + cidr: '10.0.1.0/24' +{% for vnf_num in range(num_vnfs|int) %} + uplink_{{ vnf_num }}: + cidr: '10.{{ vnf_num + 1 }}.0.0/24' + gateway_ip: 'null' + port_security_enabled: False + enable_dhcp: 'false' + downlink_{{ vnf_num }}: + cidr: '10.{{ vnf_num + 1 }}.1.0/24' + gateway_ip: 'null' + port_security_enabled: False + enable_dhcp: 'false' +{% endfor %} diff --git a/tests/ci/load_images.sh b/tests/ci/load_images.sh index d723823ee..5df769c0d 100755 --- a/tests/ci/load_images.sh +++ b/tests/ci/load_images.sh @@ -251,7 +251,7 @@ main() load_yardstick_image if [ "${YARD_IMG_ARCH}" == "arm64" ]; then #We have overlapping IP with the real network - for filename in tests/opnfv/test_cases/*; do + for filename in ${YARDSTICK_REPO_DIR}/tests/opnfv/test_cases/*; do sed -i "s/cidr: '10.0.1.0\/24'/cidr: '10.3.1.0\/24'/g" "${filename}" done else diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc040.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc040.yaml index 7d3f36984..591ce0356 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc040.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc040.yaml @@ -28,4 +28,4 @@ scenarios: context: type: Dummy - + name: Dummy diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc042.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc042.yaml index f46eb8473..ab41912e3 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc042.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc042.yaml @@ -19,6 +19,8 @@ scenarios: options: packetsize: 64 rate: 100 + eth1: ens4 + eth2: ens5 host: demeter.yardstick-TC042 target: poseidon.yardstick-TC042 @@ -34,8 +36,13 @@ scenarios: context: name: yardstick-TC042 - image: yardstick-image-pktgen-ready - flavor: yardstick-pktgen-dpdk.flavor + image: yardstick-samplevnfs + flavor: + vcpus: 4 + ram: 4096 + disk: 7 + extra_specs: + hw:mem_page_size: "large" user: ubuntu placement_groups: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc074.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc074.yaml index ef4f02c9e..fe8423d25 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc074.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc074.yaml @@ -36,3 +36,4 @@ scenarios: context: type: Dummy + name: Dummy diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc090.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc090.yaml new file mode 100644 index 000000000..41372045d --- /dev/null +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc090.yaml @@ -0,0 +1,78 @@ +############################################################################## +# Copyright (c) 2017 14_ykl@tongji.edu.cn and others. +# +# 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 +############################################################################## +--- + +schema: "yardstick:task:0.1" +description: > + Yardstick TC090 config file; + HA test case: Control node Openstack service down - database instance. + +{% set file = file or '/etc/yardstick/pod.yaml' %} +{% set attack_host = attack_host or "node1" %} +{% set attack_process = attack_process or "mysql" %} +{% set monitor_time = monitor_time or 30 %} + +scenarios: +- + type: ServiceHA + options: + attackers: + - fault_type: "kill-process" + process_name: "{{ attack_process }}" + host: {{attack_host}} + + monitors: + - monitor_type: "openstack-cmd" + command_name: "openstack image list" + monitor_time: {{monitor_time}} + monitor_number: 3 + sla: + max_outage_time: 5 + - monitor_type: "openstack-cmd" + command_name: "openstack router list" + monitor_time: {{monitor_time}} + monitor_number: 3 + sla: + max_outage_time: 5 + - monitor_type: "openstack-cmd" + command_name: "openstack stack list" + monitor_time: {{monitor_time}} + monitor_number: 3 + sla: + max_outage_time: 5 + - monitor_type: "openstack-cmd" + command_name: "openstack volume list" + monitor_time: {{monitor_time}} + monitor_number: 3 + sla: + max_outage_time: 5 + - monitor_type: "process" + process_name: "{{ attack_process }}" + host: {{attack_host}} + monitor_time: {{monitor_time}} + monitor_number: 3 + sla: + max_recover_time: 30 + + nodes: + {{attack_host}}: {{attack_host}}.LF + + runner: + type: Duration + duration: 1 + sla: + outage_time: 5 + action: monitor + + +context: + type: Node + name: LF + file: {{file}} + diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc091.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc091.yaml new file mode 100644 index 000000000..d952464a1 --- /dev/null +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc091.yaml @@ -0,0 +1,59 @@ +############################################################################## +# Copyright (c) 2017 14_ykl@tongji.edu.cn and others. +# +# 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 +############################################################################## +--- + +schema: "yardstick:task:0.1" +description: > + Yardstick TC091 config file; + HA test case: Control node Openstack service down - heat-api. + +{% set file = file or '/etc/yardstick/pod.yaml' %} +{% set attack_host = attack_host or "node1" %} +{% set attack_process = attack_process or "heat-api" %} + +scenarios: +- + type: ServiceHA + options: + attackers: + - fault_type: "kill-process" + process_name: "{{ attack_process }}" + host: {{attack_host}} + + monitors: + - monitor_type: "openstack-cmd" + command_name: "openstack stack list" + monitor_time: 10 + monitor_number: 3 + sla: + max_outage_time: 5 + - monitor_type: "process" + process_name: "{{ attack_process }}" + host: {{attack_host}} + monitor_time: 30 + monitor_number: 3 + sla: + max_recover_time: 30 + + nodes: + {{attack_host}}: {{attack_host}}.LF + + runner: + type: Duration + duration: 1 + sla: + outage_time: 5 + action: monitor + + +context: + type: Node + name: LF + file: {{file}} + diff --git a/tests/opnfv/test_suites/opnfv_k8-nosdn-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_k8-nosdn-nofeature-noha_daily.yaml index 00dccab95..4fd76596f 100644 --- a/tests/opnfv/test_suites/opnfv_k8-nosdn-nofeature-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_k8-nosdn-nofeature-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha_daily.yaml new file mode 100644 index 000000000..cb2b1311d --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha_daily.yaml @@ -0,0 +1,18 @@ +############################################################################## +# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others. +# +# 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 +############################################################################## +--- +# k8 nosdn stor4nfv ha daily task suite + +schema: "yardstick:suite:0.1" + +name: "k8-nosdn-stor4nfv-ha" +test_cases_dir: "tests/opnfv/test_cases/" +test_cases: +- + file_name: opnfv_yardstick_tc080.yaml diff --git a/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha_daily.yaml new file mode 100644 index 000000000..961b8da89 --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha_daily.yaml @@ -0,0 +1,18 @@ +############################################################################## +# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others. +# +# 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 +############################################################################## +--- +# k8 nosdn stor4nfv noha daily task suite + +schema: "yardstick:suite:0.1" + +name: "k8-nosdn-stor4nfv-noha" +test_cases_dir: "tests/opnfv/test_cases/" +test_cases: +- + file_name: opnfv_yardstick_tc080.yaml diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-bar-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-bar-ha_daily.yaml index 35bc0ebd8..d49b11343 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-bar-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-bar-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node4.LF","target": "node5.LF"}' + "host": "node4","target": "node5"}' - file_name: opnfv_yardstick_tc019.yaml constraint: @@ -113,7 +113,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -121,7 +121,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -147,7 +147,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' - file_name: opnfv_yardstick_tc027.yaml constraint: diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-bar-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-bar-noha_daily.yaml index 26e92e704..362c7316c 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-bar-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-bar-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm-ha_daily.yaml index 1be7d13af..854adf11b 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm-noha_daily.yaml index 42bc651b2..b5a30487d 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs-ha_daily.yaml index eb8d0f307..ea0853cb1 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk-ha_daily.yaml index 625fa6ea0..ef47b9f72 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk-ha_daily.yaml @@ -40,7 +40,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -48,7 +48,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -64,4 +64,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk-noha_daily.yaml index 3a3ed3779..2def5c2a6 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk-noha_daily.yaml @@ -40,7 +40,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -48,7 +48,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml index ef09f3c8b..ee25c1287 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml @@ -40,7 +40,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -48,7 +48,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -64,4 +64,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml index a800c5649..8603c1438 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml @@ -40,7 +40,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -48,7 +48,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-ha_daily.yaml index 9de6ab2bb..a249a81e2 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-ha_daily.yaml @@ -41,7 +41,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -49,7 +49,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -65,4 +65,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-noha_daily.yaml index eed5da44d..40fec9fe3 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-noha_daily.yaml @@ -41,7 +41,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -49,7 +49,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -65,4 +65,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml index 222987ec5..7c213e2d9 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml @@ -14,6 +14,8 @@ schema: "yardstick:suite:0.1" name: "os-nosdn-nofeature-ha" test_cases_dir: "tests/opnfv/test_cases/" test_cases: + +# Generic test cases base on VM - file_name: opnfv_yardstick_tc002.yaml - @@ -29,150 +31,164 @@ test_cases: - file_name: opnfv_yardstick_tc037.yaml - + file_name: opnfv_yardstick_tc069.yaml +- + file_name: opnfv_yardstick_tc070.yaml +- + file_name: opnfv_yardstick_tc071.yaml +- + file_name: opnfv_yardstick_tc072.yaml +- + file_name: opnfv_yardstick_tc076.yaml +- + file_name: opnfv_yardstick_tc079.yaml +- + file_name: opnfv_yardstick_tc082.yaml +- + file_name: opnfv_yardstick_tc083.yaml + +# Generic test cases base on NODE +- file_name: opnfv_yardstick_tc043.yaml constraint: installer: compass pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node4.LF","target": "node5.LF"}' + "host": "node4","target": "node5"}' - - file_name: opnfv_yardstick_tc019.yaml + file_name: opnfv_yardstick_tc055.yaml constraint: - installer: compass,fuel - pod: huawei-pod2,ericsson-pod1 + installer: compass + pod: huawei-pod1 task_args: - huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' - ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", + "host": "node5"}' - - file_name: opnfv_yardstick_tc045.yaml + file_name: opnfv_yardstick_tc063.yaml constraint: - installer: compass,fuel - pod: huawei-pod2,ericsson-pod1 + installer: compass + pod: huawei-pod1 task_args: - huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' - ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", + "host": "node5"}' - - file_name: opnfv_yardstick_tc046.yaml + file_name: opnfv_yardstick_tc073.yaml constraint: - installer: fuel + installer: compass + pod: huawei-pod1 task_args: - default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' - - file_name: opnfv_yardstick_tc047.yaml + file_name: opnfv_yardstick_tc075.yaml constraint: - installer: compass,fuel - pod: huawei-pod2,ericsson-pod1 + installer: compass + pod: huawei-pod1 task_args: - huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' - ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", + "host": "node1"}' + +# Feature test cases - - file_name: opnfv_yardstick_tc048.yaml + file_name: opnfv_yardstick_tc027.yaml constraint: installer: compass,fuel - pod: huawei-pod2,ericsson-pod1 + pod: huawei-pod1,lf-pod2 task_args: - huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' - ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", "openrc":"/root/openrc", "external_network":"admin_floating_net"}' - - file_name: opnfv_yardstick_tc049.yaml + file_name: opnfv_yardstick_tc074.yaml constraint: - installer: fuel + installer: compass + pod: huawei-pod1, huawei-pod2 task_args: - default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"public_network": "ext-net", + "StorPerf_ip": "192.168.10.6"}' + huawei-pod2: '{"public_network": "ext-net", + "StorPerf_ip": "192.168.11.2"}' + +# HA test cases - - file_name: opnfv_yardstick_tc050.yaml + file_name: opnfv_yardstick_tc045.yaml constraint: - installer: fuel + installer: compass,fuel + pod: huawei-pod1,lf-pod2 task_args: - default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc051.yaml + file_name: opnfv_yardstick_tc046.yaml constraint: installer: compass,fuel - pod: huawei-pod2,ericsson-pod1 + pod: huawei-pod1,lf-pod2 task_args: - huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' - ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc052.yaml + file_name: opnfv_yardstick_tc047.yaml constraint: - installer: fuel + installer: compass,fuel + pod: huawei-pod1,lf-pod2 task_args: - default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc053.yaml + file_name: opnfv_yardstick_tc048.yaml constraint: - installer: fuel + installer: compass,fuel + pod: huawei-pod1,lf-pod2 task_args: - default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc055.yaml + file_name: opnfv_yardstick_tc049.yaml constraint: - installer: compass - pod: huawei-pod1 + installer: compass,fuel + pod: huawei-pod1,lf-pod2 task_args: - huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc063.yaml + file_name: opnfv_yardstick_tc050.yaml constraint: - installer: compass - pod: huawei-pod1 + installer: compass,fuel + pod: huawei-pod1,lf-pod2 task_args: - huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' -- - file_name: opnfv_yardstick_tc069.yaml -- - file_name: opnfv_yardstick_tc070.yaml -- - file_name: opnfv_yardstick_tc071.yaml -- - file_name: opnfv_yardstick_tc072.yaml + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc074.yaml + file_name: opnfv_yardstick_tc051.yaml constraint: - installer: compass - pod: huawei-pod1, huawei-pod2 + installer: compass,fuel + pod: huawei-pod1,lf-pod2 task_args: - huawei-pod1: '{"public_network": "ext-net", - "StorPerf_ip": "192.168.10.6"}' - huawei-pod2: '{"public_network": "ext-net", - "StorPerf_ip": "192.168.11.2"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc075.yaml + file_name: opnfv_yardstick_tc052.yaml constraint: - installer: compass - pod: huawei-pod1 + installer: compass,fuel + pod: huawei-pod1,lf-pod2 task_args: - huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc027.yaml + file_name: opnfv_yardstick_tc053.yaml constraint: installer: compass,fuel - pod: huawei-pod1,lf-pod2,ericsson-pod3,ericsson-pod4 + pod: huawei-pod1,lf-pod2 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' - lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", "openrc":"/root/openrc", "external_network":"admin_floating_net"}' - ericsson-pod3: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", "openrc":"/root/openrc", "external_network":"admin_floating_net"}' - ericsson-pod4: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", "openrc":"/root/openrc", "external_network":"admin_floating_net"}' -- - file_name: opnfv_yardstick_tc076.yaml + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - - file_name: opnfv_yardstick_tc079.yaml -- - file_name: opnfv_yardstick_tc073.yaml + file_name: opnfv_yardstick_tc019.yaml constraint: - installer: compass - pod: huawei-pod1 + installer: compass,fuel + pod: huawei-pod1,lf-pod2 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}' -- - file_name: opnfv_yardstick_tc082.yaml -- - file_name: opnfv_yardstick_tc083.yaml + lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}' - file_name: opnfv_yardstick_tc025.yaml constraint: diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-noha_daily.yaml index 6700db406..6a6a53b2a 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-openbaton-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-openbaton-ha_daily.yaml index d1b4cce1a..5dccf015b 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-openbaton-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-openbaton-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-openo-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-openo-ha_daily.yaml index 9418e42f4..0375abcc6 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-openo-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-openo-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node4.LF","target": "node5.LF"}' + "host": "node4","target": "node5"}' - file_name: opnfv_yardstick_tc045.yaml constraint: @@ -97,7 +97,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -105,7 +105,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -121,7 +121,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' - file_name: opnfv_yardstick_tc027.yaml constraint: diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-ovs-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-ovs-ha_daily.yaml index 3a540f27a..13eda5bc6 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-ovs-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-ovs-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-ovs-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-ovs-noha_daily.yaml index abc336041..969e47aa2 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-ovs-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-ovs-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-ovs_dpdk-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-ovs_dpdk-ha_daily.yaml index 10772e0cc..822191504 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-ovs_dpdk-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-ovs_dpdk-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-ovs_dpdk-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-ovs_dpdk-noha_daily.yaml index 9b2be3710..e0f6dec7b 100644 --- a/tests/opnfv/test_suites/opnfv_os-nosdn-ovs_dpdk-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-ovs_dpdk-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-ha_daily.yaml index 3f2fe18a3..1b10a4e31 100644 --- a/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-noha_daily.yaml index fcc7a9bb2..dba42cc48 100644 --- a/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl-nofeature-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl-nofeature-ha_daily.yaml index 1ab16e5d1..13cc710f3 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl-nofeature-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl-nofeature-ha_daily.yaml @@ -37,7 +37,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -45,7 +45,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -61,4 +61,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl-nofeature-noha_daily.yaml index 825555d39..42a170a89 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl-nofeature-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl-nofeature-noha_daily.yaml @@ -37,7 +37,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -45,7 +45,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-odl-ovs-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl-ovs-ha_daily.yaml index b5e53b94c..ce36ca0bf 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl-ovs-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl-ovs-ha_daily.yaml @@ -37,7 +37,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -45,7 +45,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -61,4 +61,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl-sfc-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl-sfc-ha_daily.yaml index b464bfeae..6c3f22f57 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl-sfc-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl-sfc-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl-sfc-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl-sfc-noha_daily.yaml index ba870417d..08027373f 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl-sfc-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl-sfc-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-bgpvpn-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-bgpvpn-ha_daily.yaml index 43aae7101..78f461d82 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l2-bgpvpn-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-bgpvpn-ha_daily.yaml @@ -21,7 +21,7 @@ test_cases: pod: ericsson-pod2 task_args: ericsson-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", - "host": "node1.LF","target": "node2.LF"}' + "host": "node1","target": "node2"}' - file_name: opnfv_yardstick_tc002.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-bgpvpn-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-bgpvpn-noha_daily.yaml index 372012928..820db3771 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l2-bgpvpn-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-bgpvpn-noha_daily.yaml @@ -21,7 +21,7 @@ test_cases: pod: ericsson-pod2 task_args: ericsson-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", - "host": "node1.LF","target": "node2.LF"}' + "host": "node1","target": "node2"}' - file_name: opnfv_yardstick_tc002.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-moon-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-moon-ha_daily.yaml index 16c04de37..03a533872 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l2-moon-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-moon-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-moon-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-moon-noha_daily.yaml index cff147720..1dcdeae8e 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l2-moon-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-moon-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-ha_daily.yaml index b8b8c4695..78883c9da 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-ha_daily.yaml @@ -37,7 +37,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -45,7 +45,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -61,4 +61,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-noha_daily.yaml index cd352cc1b..163c21716 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-noha_daily.yaml @@ -37,7 +37,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -45,7 +45,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -61,4 +61,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-ha_daily.yaml index 1dde1cb25..86e84916d 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-noha_daily.yaml index 8d7098160..4101fa970 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l3-nofeature-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l3-nofeature-ha_daily.yaml index a503db99e..d7e7bbb87 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l3-nofeature-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l3-nofeature-ha_daily.yaml @@ -37,7 +37,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -45,7 +45,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -61,4 +61,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l3-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l3-nofeature-noha_daily.yaml index e83aaec9d..6b29394ce 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l3-nofeature-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l3-nofeature-noha_daily.yaml @@ -37,7 +37,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -45,7 +45,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l3-ovs-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l3-ovs-ha_daily.yaml index 4165c5464..c347a80b9 100644 --- a/tests/opnfv/test_suites/opnfv_os-odl_l3-ovs-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-odl_l3-ovs-ha_daily.yaml @@ -37,7 +37,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -45,7 +45,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -61,4 +61,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-onos-nofeature-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-onos-nofeature-ha_daily.yaml index ed8894ce1..536341b0f 100644 --- a/tests/opnfv/test_suites/opnfv_os-onos-nofeature-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-onos-nofeature-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-onos-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-onos-nofeature-noha_daily.yaml index 94390d525..119297563 100644 --- a/tests/opnfv/test_suites/opnfv_os-onos-nofeature-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-onos-nofeature-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-onos-sfc-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-onos-sfc-ha_daily.yaml index 18e27d6d6..3ad6122dd 100644 --- a/tests/opnfv/test_suites/opnfv_os-onos-sfc-ha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-onos-sfc-ha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_os-onos-sfc-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-onos-sfc-noha_daily.yaml index d56be6152..b86599f72 100644 --- a/tests/opnfv/test_suites/opnfv_os-onos-sfc-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-onos-sfc-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - diff --git a/tests/opnfv/test_suites/opnfv_os-ovn-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-ovn-nofeature-noha_daily.yaml index 567642eda..dbbda6872 100644 --- a/tests/opnfv/test_suites/opnfv_os-ovn-nofeature-noha_daily.yaml +++ b/tests/opnfv/test_suites/opnfv_os-ovn-nofeature-noha_daily.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -59,4 +59,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/opnfv/test_suites/opnfv_performance.yaml b/tests/opnfv/test_suites/opnfv_performance.yaml index 948d0633e..10bc6071c 100644 --- a/tests/opnfv/test_suites/opnfv_performance.yaml +++ b/tests/opnfv/test_suites/opnfv_performance.yaml @@ -35,7 +35,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node4.LF","target": "node5.LF"}' + "host": "node4","target": "node5"}' - file_name: opnfv_yardstick_tc055.yaml constraint: @@ -43,7 +43,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC055"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc063.yaml constraint: @@ -51,7 +51,7 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node5.yardstick-TC063"}' + "host": "node5"}' - file_name: opnfv_yardstick_tc069.yaml - @@ -67,4 +67,4 @@ test_cases: pod: huawei-pod1 task_args: huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", - "host": "node1.LF"}' + "host": "node1"}' diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py index c7d2abcd5..26bd1dadd 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py @@ -533,10 +533,12 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase): @mock.patch.object(six, 'BytesIO', return_value=six.BytesIO(b'100\n')) @mock.patch.object(utils, 'read_meminfo', return_value={'Hugepagesize': '2048'}) - def test__setup_hugepages(self, mock_meminfo, *args): + def test__setup_hugepages_no_hugepages_defined(self, mock_meminfo, *args): ssh_helper = mock.Mock() + scenario_helper = mock.Mock() + scenario_helper.all_options = {} dpdk_setup_helper = DpdkVnfSetupEnvHelper( - mock.ANY, ssh_helper, mock.ANY) + mock.ANY, ssh_helper, scenario_helper) with mock.patch.object(sample_vnf.LOG, 'info') as mock_info: dpdk_setup_helper._setup_hugepages() mock_info.assert_called_once_with( @@ -544,6 +546,22 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase): '%s', 2048, 8192, 100) mock_meminfo.assert_called_once_with(ssh_helper) + @mock.patch.object(six, 'BytesIO', return_value=six.BytesIO(b'100\n')) + @mock.patch.object(utils, 'read_meminfo', + return_value={'Hugepagesize': '1048576'}) + def test__setup_hugepages_8gb_hugepages_defined(self, mock_meminfo, *args): + ssh_helper = mock.Mock() + scenario_helper = mock.Mock() + scenario_helper.all_options = {'hugepages_gb': 8} + dpdk_setup_helper = DpdkVnfSetupEnvHelper( + mock.ANY, ssh_helper, scenario_helper) + with mock.patch.object(sample_vnf.LOG, 'info') as mock_info: + dpdk_setup_helper._setup_hugepages() + mock_info.assert_called_once_with( + 'Hugepages size (kB): %s, number claimed: %s, number set: ' + '%s', 1048576, 8, 100) + mock_meminfo.assert_called_once_with(ssh_helper) + @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.open') @mock.patch.object(utils, 'find_relative_file') @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.MultiPortConfig') diff --git a/yardstick/benchmark/contexts/standalone/model.py b/yardstick/benchmark/contexts/standalone/model.py index 14738da8a..f18d090d8 100644 --- a/yardstick/benchmark/contexts/standalone/model.py +++ b/yardstick/benchmark/contexts/standalone/model.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import absolute_import import os import re import time @@ -25,11 +24,12 @@ from netaddr import IPNetwork import xml.etree.ElementTree as ET from yardstick import ssh -from yardstick.common.constants import YARDSTICK_ROOT_PATH +from yardstick.common import constants +from yardstick.common import exceptions from yardstick.common.yaml_loader import yaml_load from yardstick.network_services.utils import PciAddress from yardstick.network_services.helpers.cpu import CpuSysCores -from yardstick.common.utils import write_file + LOG = logging.getLogger(__name__) @@ -106,12 +106,17 @@ class Libvirt(object): @staticmethod def virsh_create_vm(connection, cfg): - err = connection.execute("virsh create %s" % cfg)[0] - LOG.info("VM create status: %s", err) + LOG.info('VM create, XML config: %s', cfg) + status, _, error = connection.execute('virsh create %s' % cfg) + if status: + raise exceptions.LibvirtCreateError(error=error) @staticmethod def virsh_destroy_vm(vm_name, connection): - connection.execute("virsh destroy %s" % vm_name) + LOG.info('VM destroy, VM name: %s', vm_name) + status, _, error = connection.execute('virsh destroy %s' % vm_name) + if status: + LOG.warning('Error destroying VM %s. Error: %s', vm_name, error) @staticmethod def _add_interface_address(interface, pci_address): @@ -132,7 +137,7 @@ class Libvirt(object): return vm_pci @classmethod - def add_ovs_interface(cls, vpath, port_num, vpci, vports_mac, xml): + def add_ovs_interface(cls, vpath, port_num, vpci, vports_mac, xml_str): """Add a DPDK OVS 'interface' XML node in 'devices' node <devices> @@ -156,7 +161,7 @@ class Libvirt(object): vhost_path = ('{0}/var/run/openvswitch/dpdkvhostuser{1}'. format(vpath, port_num)) - root = ET.parse(xml) + root = ET.fromstring(xml_str) pci_address = PciAddress(vpci.strip()) device = root.find('devices') @@ -181,10 +186,10 @@ class Libvirt(object): cls._add_interface_address(interface, pci_address) - root.write(xml) + return ET.tostring(root) @classmethod - def add_sriov_interfaces(cls, vm_pci, vf_pci, vf_mac, xml): + def add_sriov_interfaces(cls, vm_pci, vf_pci, vf_mac, xml_str): """Add a SR-IOV 'interface' XML node in 'devices' node <devices> @@ -207,7 +212,7 @@ class Libvirt(object): -sr_iov-how_sr_iov_libvirt_works """ - root = ET.parse(xml) + root = ET.fromstring(xml_str) device = root.find('devices') interface = ET.SubElement(device, 'interface') @@ -224,7 +229,7 @@ class Libvirt(object): pci_vm_address = PciAddress(vm_pci.strip()) cls._add_interface_address(interface, pci_vm_address) - root.write(xml) + return ET.tostring(root) @staticmethod def create_snapshot_qemu(connection, index, vm_image): @@ -237,7 +242,8 @@ class Libvirt(object): return image @classmethod - def build_vm_xml(cls, connection, flavor, cfg, vm_name, index): + def build_vm_xml(cls, connection, flavor, vm_name, index): + """Build the XML from the configuration parameters""" memory = flavor.get('ram', '4096') extra_spec = flavor.get('extra_specs', {}) cpu = extra_spec.get('hw:cpu_cores', '2') @@ -261,9 +267,7 @@ class Libvirt(object): socket=socket, threads=threads, vm_image=image, cpuset=cpuset, cputune=cputune) - write_file(cfg, vm_xml) - - return [vcpu, mac] + return vm_xml, mac @staticmethod def update_interrupts_hugepages_perf(connection): @@ -283,6 +287,13 @@ class Libvirt(object): cpuset = "%s,%s" % (cores, threads) return cpuset + @classmethod + def write_file(cls, file_name, xml_str): + """Dump a XML string to a file""" + root = ET.fromstring(xml_str) + et = ET.ElementTree(element=root) + et.write(file_name, encoding='utf-8', method='xml') + class StandaloneContextHelper(object): """ This class handles all the common code for standalone @@ -374,7 +385,8 @@ class StandaloneContextHelper(object): except IOError as io_error: if io_error.errno != errno.ENOENT: raise - self.file_path = os.path.join(YARDSTICK_ROOT_PATH, file_path) + self.file_path = os.path.join(constants.YARDSTICK_ROOT_PATH, + file_path) cfg = self.read_config_file() nodes.extend([node for node in cfg["nodes"] if str(node["role"]) != nfvi_role]) @@ -506,7 +518,7 @@ class OvsDeploy(object): StandaloneContextHelper.install_req_libs(self.connection, pkgs) def ovs_deploy(self): - ovs_deploy = os.path.join(YARDSTICK_ROOT_PATH, + ovs_deploy = os.path.join(constants.YARDSTICK_ROOT_PATH, "yardstick/resources/scripts/install/", self.OVS_DEPLOY_SCRIPT) if os.path.isfile(ovs_deploy): @@ -522,4 +534,6 @@ class OvsDeploy(object): cmd = "sudo -E %s --ovs='%s' --dpdk='%s' -p='%s'" % (remote_ovs_deploy, ovs, dpdk, http_proxy) - self.connection.execute(cmd) + exit_status, _, stderr = self.connection.execute(cmd) + if exit_status: + raise exceptions.OVSDeployError(stderr=stderr) diff --git a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py index a18b42ea5..30b685eec 100644 --- a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py +++ b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py @@ -12,26 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import absolute_import -import os -import logging +import io import collections +import logging +import os +import re import time -from collections import OrderedDict - from yardstick import ssh -from yardstick.network_services.utils import get_nsb_option -from yardstick.network_services.utils import provision_tool from yardstick.benchmark.contexts.base import Context -from yardstick.benchmark.contexts.standalone.model import Libvirt -from yardstick.benchmark.contexts.standalone.model import StandaloneContextHelper -from yardstick.benchmark.contexts.standalone.model import Server -from yardstick.benchmark.contexts.standalone.model import OvsDeploy -from yardstick.network_services.utils import PciAddress +from yardstick.benchmark.contexts.standalone import model +from yardstick.common import exceptions +from yardstick.network_services import utils + LOG = logging.getLogger(__name__) +MAIN_BRIDGE = 'br0' + class OvsDpdkContext(Context): """ This class handles OVS standalone nodes - VM running on Non-Managed NFVi @@ -50,8 +48,8 @@ class OvsDpdkContext(Context): } DEFAULT_OVS = '2.6.0' - - PKILL_TEMPLATE = "pkill %s %s" + CMD_TIMEOUT = 30 + DEFAULT_USER_PATH = '/usr/local' def __init__(self): self.file_path = None @@ -65,8 +63,8 @@ class OvsDpdkContext(Context): self.attrs = {} self.vm_flavor = None self.servers = None - self.helper = StandaloneContextHelper() - self.vnf_node = Server() + self.helper = model.StandaloneContextHelper() + self.vnf_node = model.Server() self.ovs_properties = {} self.wait_for_vswitchd = 10 super(OvsDpdkContext, self).__init__() @@ -93,34 +91,32 @@ class OvsDpdkContext(Context): LOG.debug("Networks: %r", self.networks) def setup_ovs(self): - vpath = self.ovs_properties.get("vpath", "/usr/local") - xargs_kill_cmd = self.PKILL_TEMPLATE % ('-9', 'ovs') - + """Initialize OVS-DPDK""" + vpath = self.ovs_properties.get('vpath', self.DEFAULT_USER_PATH) create_from = os.path.join(vpath, 'etc/openvswitch/conf.db') create_to = os.path.join(vpath, 'share/openvswitch/vswitch.ovsschema') cmd_list = [ - "chmod 0666 /dev/vfio/*", - "chmod a+x /dev/vfio", - "pkill -9 ovs", - xargs_kill_cmd, - "killall -r 'ovs*'", - "mkdir -p {0}/etc/openvswitch".format(vpath), - "mkdir -p {0}/var/run/openvswitch".format(vpath), - "rm {0}/etc/openvswitch/conf.db".format(vpath), - "ovsdb-tool create {0} {1}".format(create_from, create_to), - "modprobe vfio-pci", - "chmod a+x /dev/vfio", - "chmod 0666 /dev/vfio/*", + 'killall -r "ovs.*" -q | true', + 'mkdir -p {0}/etc/openvswitch'.format(vpath), + 'mkdir -p {0}/var/run/openvswitch'.format(vpath), + 'rm {0}/etc/openvswitch/conf.db | true'.format(vpath), + 'ovsdb-tool create {0} {1}'.format(create_from, create_to), + 'modprobe vfio-pci', + 'chmod a+x /dev/vfio', + 'chmod 0666 /dev/vfio/*', ] - for cmd in cmd_list: - self.connection.execute(cmd) - bind_cmd = "{dpdk_devbind} --force -b {driver} {port}" - phy_driver = "vfio-pci" + + bind_cmd = '%s --force -b vfio-pci {port}' % self.dpdk_devbind for port in self.networks.values(): - vpci = port.get("phy_port") - self.connection.execute(bind_cmd.format( - dpdk_devbind=self.dpdk_devbind, driver=phy_driver, port=vpci)) + cmd_list.append(bind_cmd.format(port=port.get('phy_port'))) + + for cmd in cmd_list: + LOG.info(cmd) + exit_status, _, stderr = self.connection.execute( + cmd, timeout=self.CMD_TIMEOUT) + if exit_status: + raise exceptions.OVSSetupError(command=cmd, error=stderr) def start_ovs_serverswitch(self): vpath = self.ovs_properties.get("vpath") @@ -166,56 +162,78 @@ class OvsDpdkContext(Context): vpath = self.ovs_properties.get("vpath", "/usr/local") version = self.ovs_properties.get('version', {}) ovs_ver = [int(x) for x in version.get('ovs', self.DEFAULT_OVS).split('.')] - ovs_add_port = \ - "ovs-vsctl add-port {br} {port} -- set Interface {port} type={type_}{dpdk_args}" - ovs_add_queue = "ovs-vsctl set Interface {port} options:n_rxq={queue}" - chmod_vpath = "chmod 0777 {0}/var/run/openvswitch/dpdkvhostuser*" - - cmd_dpdk_list = [ - "ovs-vsctl del-br br0", - "rm -rf {0}/var/run/openvswitch/dpdkvhostuser*".format(vpath), - "ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev", + ovs_add_port = ('ovs-vsctl add-port {br} {port} -- ' + 'set Interface {port} type={type_}{dpdk_args}') + ovs_add_queue = 'ovs-vsctl set Interface {port} options:n_rxq={queue}' + chmod_vpath = 'chmod 0777 {0}/var/run/openvswitch/dpdkvhostuser*' + + cmd_list = [ + 'ovs-vsctl --if-exists del-br {0}'.format(MAIN_BRIDGE), + 'rm -rf {0}/var/run/openvswitch/dpdkvhostuser*'.format(vpath), + 'ovs-vsctl add-br {0} -- set bridge {0} datapath_type=netdev'. + format(MAIN_BRIDGE) ] - ordered_network = OrderedDict(self.networks) + ordered_network = collections.OrderedDict(self.networks) for index, vnf in enumerate(ordered_network.values()): if ovs_ver >= [2, 7, 0]: dpdk_args = " options:dpdk-devargs=%s" % vnf.get("phy_port") - dpdk_list.append(ovs_add_port.format(br='br0', port='dpdk%s' % vnf.get("port_num", 0), - type_='dpdk', dpdk_args=dpdk_args)) - dpdk_list.append(ovs_add_queue.format(port='dpdk%s' % vnf.get("port_num", 0), - queue=self.ovs_properties.get("queues", 1))) + dpdk_list.append(ovs_add_port.format( + br=MAIN_BRIDGE, port='dpdk%s' % vnf.get("port_num", 0), + type_='dpdk', dpdk_args=dpdk_args)) + dpdk_list.append(ovs_add_queue.format( + port='dpdk%s' % vnf.get("port_num", 0), + queue=self.ovs_properties.get("queues", 1))) # Sorting the array to make sure we execute dpdk0... in the order list.sort(dpdk_list) - cmd_dpdk_list.extend(dpdk_list) + cmd_list.extend(dpdk_list) # Need to do two for loop to maintain the dpdk/vhost ports. for index, _ in enumerate(ordered_network): - cmd_dpdk_list.append(ovs_add_port.format(br='br0', port='dpdkvhostuser%s' % index, - type_='dpdkvhostuser', dpdk_args="")) - - for cmd in cmd_dpdk_list: - LOG.info(cmd) - self.connection.execute(cmd) - - # Fixme: add flows code - ovs_flow = "ovs-ofctl add-flow br0 in_port=%s,action=output:%s" + cmd_list.append(ovs_add_port.format( + br=MAIN_BRIDGE, port='dpdkvhostuser%s' % index, + type_='dpdkvhostuser', dpdk_args="")) + ovs_flow = ("ovs-ofctl add-flow {0} in_port=%s,action=output:%s". + format(MAIN_BRIDGE)) network_count = len(ordered_network) + 1 for in_port, out_port in zip(range(1, network_count), range(network_count, network_count * 2)): - self.connection.execute(ovs_flow % (in_port, out_port)) - self.connection.execute(ovs_flow % (out_port, in_port)) + cmd_list.append(ovs_flow % (in_port, out_port)) + cmd_list.append(ovs_flow % (out_port, in_port)) - self.connection.execute(chmod_vpath.format(vpath)) + cmd_list.append(chmod_vpath.format(vpath)) + + for cmd in cmd_list: + LOG.info(cmd) + exit_status, _, stderr = self.connection.execute( + cmd, timeout=self.CMD_TIMEOUT) + if exit_status: + raise exceptions.OVSSetupError(command=cmd, error=stderr) + + def _check_hugepages(self): + meminfo = io.BytesIO() + self.connection.get_file_obj('/proc/meminfo', meminfo) + regex = re.compile(r"HugePages_Total:\s+(?P<hp_total>\d+)[\n\r]" + r"HugePages_Free:\s+(?P<hp_free>\d+)") + match = regex.search(meminfo.getvalue().decode('utf-8')) + if not match: + raise exceptions.OVSHugepagesInfoError() + if int(match.group('hp_total')) == 0: + raise exceptions.OVSHugepagesNotConfigured() + if int(match.group('hp_free')) == 0: + raise exceptions.OVSHugepagesZeroFree( + total_hugepages=int(match.group('hp_total'))) def cleanup_ovs_dpdk_env(self): - self.connection.execute("ovs-vsctl del-br br0") + self.connection.execute( + 'ovs-vsctl --if-exists del-br {0}'.format(MAIN_BRIDGE)) self.connection.execute("pkill -9 ovs") def check_ovs_dpdk_env(self): self.cleanup_ovs_dpdk_env() + self._check_hugepages() version = self.ovs_properties.get("version", {}) ovs_ver = version.get("ovs", self.DEFAULT_OVS) @@ -223,13 +241,15 @@ class OvsDpdkContext(Context): supported_version = self.SUPPORTED_OVS_TO_DPDK_MAP.get(ovs_ver, None) if supported_version is None or supported_version.split('.')[:2] != dpdk_ver[:2]: - raise Exception("Unsupported ovs '{}'. Please check the config...".format(ovs_ver)) + raise exceptions.OVSUnsupportedVersion( + ovs_version=ovs_ver, + ovs_to_dpdk_map=self.SUPPORTED_OVS_TO_DPDK_MAP) status = self.connection.execute("ovs-vsctl -V | grep -i '%s'" % ovs_ver)[0] if status: - deploy = OvsDeploy(self.connection, - get_nsb_option("bin_path"), - self.ovs_properties) + deploy = model.OvsDeploy(self.connection, + utils.get_nsb_option("bin_path"), + self.ovs_properties) deploy.ovs_deploy() def deploy(self): @@ -240,15 +260,15 @@ class OvsDpdkContext(Context): return self.connection = ssh.SSH.from_node(self.host_mgmt) - self.dpdk_devbind = provision_tool( + self.dpdk_devbind = utils.provision_tool( self.connection, - os.path.join(get_nsb_option("bin_path"), "dpdk-devbind.py")) + os.path.join(utils.get_nsb_option('bin_path'), 'dpdk-devbind.py')) # Check dpdk/ovs version, if not present install self.check_ovs_dpdk_env() # Todo: NFVi deploy (sriov, vswitch, ovs etc) based on the config. - StandaloneContextHelper.install_req_libs(self.connection) - self.networks = StandaloneContextHelper.get_nic_details( + model.StandaloneContextHelper.install_req_libs(self.connection) + self.networks = model.StandaloneContextHelper.get_nic_details( self.connection, self.networks, self.dpdk_devbind) self.setup_ovs() @@ -256,9 +276,8 @@ class OvsDpdkContext(Context): self.setup_ovs_bridge_add_flows() self.nodes = self.setup_ovs_dpdk_context() LOG.debug("Waiting for VM to come up...") - self.nodes = StandaloneContextHelper.wait_for_vnfs_to_start(self.connection, - self.servers, - self.nodes) + self.nodes = model.StandaloneContextHelper.wait_for_vnfs_to_start( + self.connection, self.servers, self.nodes) def undeploy(self): @@ -278,7 +297,7 @@ class OvsDpdkContext(Context): # Todo: NFVi undeploy (sriov, vswitch, ovs etc) based on the config. for vm in self.vm_names: - Libvirt.check_if_vm_exists_and_delete(vm, self.connection) + model.Libvirt.check_if_vm_exists_and_delete(vm, self.connection) def _get_server(self, attr_name): """lookup server info by name from context @@ -333,50 +352,53 @@ class OvsDpdkContext(Context): return result def configure_nics_for_ovs_dpdk(self): - portlist = OrderedDict(self.networks) + portlist = collections.OrderedDict(self.networks) for key in portlist: - mac = StandaloneContextHelper.get_mac_address() + mac = model.StandaloneContextHelper.get_mac_address() portlist[key].update({'mac': mac}) self.networks = portlist LOG.info("Ports %s", self.networks) - def _enable_interfaces(self, index, vfs, cfg): + def _enable_interfaces(self, index, vfs, xml_str): vpath = self.ovs_properties.get("vpath", "/usr/local") vf = self.networks[vfs[0]] port_num = vf.get('port_num', 0) - vpci = PciAddress(vf['vpci'].strip()) + vpci = utils.PciAddress(vf['vpci'].strip()) # Generate the vpci for the interfaces slot = index + port_num + 10 vf['vpci'] = \ "{}:{}:{:02x}.{}".format(vpci.domain, vpci.bus, slot, vpci.function) - Libvirt.add_ovs_interface(vpath, port_num, vf['vpci'], vf['mac'], str(cfg)) + return model.Libvirt.add_ovs_interface( + vpath, port_num, vf['vpci'], vf['mac'], xml_str) def setup_ovs_dpdk_context(self): nodes = [] self.configure_nics_for_ovs_dpdk() - for index, (key, vnf) in enumerate(OrderedDict(self.servers).items()): + for index, (key, vnf) in enumerate(collections.OrderedDict( + self.servers).items()): cfg = '/tmp/vm_ovs_%d.xml' % index vm_name = "vm_%d" % index # 1. Check and delete VM if already exists - Libvirt.check_if_vm_exists_and_delete(vm_name, self.connection) + model.Libvirt.check_if_vm_exists_and_delete(vm_name, + self.connection) + xml_str, mac = model.Libvirt.build_vm_xml( + self.connection, self.vm_flavor, vm_name, index) - _, mac = Libvirt.build_vm_xml(self.connection, self.vm_flavor, - cfg, vm_name, index) # 2: Cleanup already available VMs - for vkey, vfs in OrderedDict(vnf["network_ports"]).items(): - if vkey == "mgmt": - continue - self._enable_interfaces(index, vfs, cfg) + for vfs in [vfs for vfs_name, vfs in vnf["network_ports"].items() + if vfs_name != 'mgmt']: + xml_str = self._enable_interfaces(index, vfs, xml_str) # copy xml to target... + model.Libvirt.write_file(cfg, xml_str) self.connection.put(cfg, cfg) # NOTE: launch through libvirt LOG.info("virsh create ...") - Libvirt.virsh_create_vm(self.connection, cfg) + model.Libvirt.virsh_create_vm(self.connection, cfg) self.vm_names.append(vm_name) diff --git a/yardstick/benchmark/contexts/standalone/sriov.py b/yardstick/benchmark/contexts/standalone/sriov.py index d7620552b..5db419e6a 100644 --- a/yardstick/benchmark/contexts/standalone/sriov.py +++ b/yardstick/benchmark/contexts/standalone/sriov.py @@ -16,15 +16,12 @@ from __future__ import absolute_import import os import logging import collections -from collections import OrderedDict from yardstick import ssh from yardstick.network_services.utils import get_nsb_option from yardstick.network_services.utils import provision_tool from yardstick.benchmark.contexts.base import Context -from yardstick.benchmark.contexts.standalone.model import Libvirt -from yardstick.benchmark.contexts.standalone.model import StandaloneContextHelper -from yardstick.benchmark.contexts.standalone.model import Server +from yardstick.benchmark.contexts.standalone import model from yardstick.network_services.utils import PciAddress LOG = logging.getLogger(__name__) @@ -49,8 +46,8 @@ class SriovContext(Context): self.attrs = {} self.vm_flavor = None self.servers = None - self.helper = StandaloneContextHelper() - self.vnf_node = Server() + self.helper = model.StandaloneContextHelper() + self.vnf_node = model.Server() self.drivers = [] super(SriovContext, self).__init__() @@ -87,15 +84,14 @@ class SriovContext(Context): os.path.join(get_nsb_option("bin_path"), "dpdk-devbind.py")) # Todo: NFVi deploy (sriov, vswitch, ovs etc) based on the config. - StandaloneContextHelper.install_req_libs(self.connection) - self.networks = StandaloneContextHelper.get_nic_details( + model.StandaloneContextHelper.install_req_libs(self.connection) + self.networks = model.StandaloneContextHelper.get_nic_details( self.connection, self.networks, self.dpdk_devbind) self.nodes = self.setup_sriov_context() LOG.debug("Waiting for VM to come up...") - self.nodes = StandaloneContextHelper.wait_for_vnfs_to_start(self.connection, - self.servers, - self.nodes) + self.nodes = model.StandaloneContextHelper.wait_for_vnfs_to_start( + self.connection, self.servers, self.nodes) def undeploy(self): """don't need to undeploy""" @@ -105,7 +101,7 @@ class SriovContext(Context): # Todo: NFVi undeploy (sriov, vswitch, ovs etc) based on the config. for vm in self.vm_names: - Libvirt.check_if_vm_exists_and_delete(vm, self.connection) + model.Libvirt.check_if_vm_exists_and_delete(vm, self.connection) # Bind nics back to kernel for ports in self.networks.values(): @@ -136,8 +132,8 @@ class SriovContext(Context): except StopIteration: pass else: - raise ValueError("Duplicate nodes!!! Nodes: %s %s" % - (node, duplicate)) + raise ValueError("Duplicate nodes!!! Nodes: %s %s" + % (node, duplicate)) node["name"] = attr_name return node @@ -179,7 +175,7 @@ class SriovContext(Context): self.connection.execute(build_vfs.format(ports.get('phy_port'))) # configure VFs... - mac = StandaloneContextHelper.get_mac_address() + mac = model.StandaloneContextHelper.get_mac_address() interface = ports.get('interface') if interface is not None: self.connection.execute(vf_cmd.format(interface, mac)) @@ -201,7 +197,7 @@ class SriovContext(Context): slot = index + idx + 10 vf['vpci'] = \ "{}:{}:{:02x}.{}".format(vpci.domain, vpci.bus, slot, vpci.function) - Libvirt.add_sriov_interfaces( + model.Libvirt.add_sriov_interfaces( vf['vpci'], vf['vf_pci']['vf_pci'], vf['mac'], str(cfg)) self.connection.execute("ifconfig %s up" % vf['interface']) self.connection.execute(vf_spoofchk.format(vf['interface'])) @@ -212,34 +208,37 @@ class SriovContext(Context): # 1 : modprobe host_driver with num_vfs self.configure_nics_for_sriov() - for index, (key, vnf) in enumerate(OrderedDict(self.servers).items()): + for index, (key, vnf) in enumerate(collections.OrderedDict( + self.servers).items()): cfg = '/tmp/vm_sriov_%s.xml' % str(index) vm_name = "vm_%s" % str(index) # 1. Check and delete VM if already exists - Libvirt.check_if_vm_exists_and_delete(vm_name, self.connection) + model.Libvirt.check_if_vm_exists_and_delete(vm_name, + self.connection) + xml_str, mac = model.Libvirt.build_vm_xml( + self.connection, self.vm_flavor, vm_name, index) - _, mac = Libvirt.build_vm_xml(self.connection, self.vm_flavor, cfg, vm_name, index) # 2: Cleanup already available VMs - for idx, (vkey, vfs) in enumerate(OrderedDict(vnf["network_ports"]).items()): - if vkey == "mgmt": - continue + network_ports = collections.OrderedDict( + {k: v for k, v in vnf["network_ports"].items() if k != 'mgmt'}) + for idx, vfs in enumerate(network_ports.values()): self._enable_interfaces(index, idx, vfs, cfg) # copy xml to target... + model.Libvirt.write_file(cfg, xml_str) self.connection.put(cfg, cfg) # NOTE: launch through libvirt LOG.info("virsh create ...") - Libvirt.virsh_create_vm(self.connection, cfg) + model.Libvirt.virsh_create_vm(self.connection, cfg) self.vm_names.append(vm_name) # build vnf node details - nodes.append(self.vnf_node.generate_vnf_instance(self.vm_flavor, - self.networks, - self.host_mgmt.get('ip'), - key, vnf, mac)) + nodes.append(self.vnf_node.generate_vnf_instance( + self.vm_flavor, self.networks, self.host_mgmt.get('ip'), + key, vnf, mac)) return nodes @@ -248,7 +247,8 @@ class SriovContext(Context): "mac": vfmac, "pf_if": pfif } - vfs = StandaloneContextHelper.get_virtual_devices(self.connection, value) + vfs = model.StandaloneContextHelper.get_virtual_devices( + self.connection, value) for k, v in vfs.items(): m = PciAddress(k.strip()) m1 = PciAddress(value.strip()) diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py index e7acde696..955b8cae2 100644 --- a/yardstick/benchmark/core/task.py +++ b/yardstick/benchmark/core/task.py @@ -344,7 +344,8 @@ class Task(object): # pragma: no cover # TODO support get multi hosts/vms info context_cfg = {} - server_name = scenario_cfg.get('options', {}).get('server_name', {}) + options = scenario_cfg.get('options') or {} + server_name = options.get('server_name') or {} def config_context_target(cfg): target = cfg['target'] @@ -613,21 +614,32 @@ class TaskParser(object): # pragma: no cover vnf__0: vnf_0.yardstick """ def qualified_name(name): - node_name, context_name = name.split('.') + try: + # for openstack + node_name, context_name = name.split('.') + sep = '.' + except ValueError: + # for kubernetes, some kubernetes resources don't support + # name format like 'xxx.xxx', so we use '-' instead + # need unified later + node_name, context_name = name.split('-') + sep = '-' + try: ctx = next((context for context in contexts - if context.assigned_name == context_name)) + if context.assigned_name == context_name)) except StopIteration: raise y_exc.ScenarioConfigContextNameNotFound( context_name=context_name) - return '{}.{}'.format(node_name, ctx.name) + return '{}{}{}'.format(node_name, sep, ctx.name) if 'host' in scenario: scenario['host'] = qualified_name(scenario['host']) if 'target' in scenario: scenario['target'] = qualified_name(scenario['target']) - server_name = scenario.get('options', {}).get('server_name', {}) + options = scenario.get('options') or {} + server_name = options.get('server_name') or {} if 'host' in server_name: server_name['host'] = qualified_name(server_name['host']) if 'target' in server_name: diff --git a/yardstick/benchmark/runners/duration.py b/yardstick/benchmark/runners/duration.py index fbf72a74c..60b0348c3 100644 --- a/yardstick/benchmark/runners/duration.py +++ b/yardstick/benchmark/runners/duration.py @@ -66,6 +66,8 @@ def _worker_process(queue, cls, method_name, scenario_cfg, data = {} errors = "" + benchmark.pre_run_wait_time(interval) + try: result = method(data) except AssertionError as assertion: @@ -77,7 +79,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg, errors = assertion.args # catch all exceptions because with multiprocessing we can have un-picklable exception # problems https://bugs.python.org/issue9400 - except Exception: + except Exception: # pylint: disable=broad-except errors = traceback.format_exc() LOG.exception("") else: @@ -86,7 +88,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg, # if we do timeout we don't care about dropping individual KPIs output_queue.put(result, True, QUEUE_PUT_TIMEOUT) - time.sleep(interval) + benchmark.post_run_wait_time(interval) benchmark_output = { 'timestamp': time.time(), diff --git a/yardstick/benchmark/runners/iteration.py b/yardstick/benchmark/runners/iteration.py index cb0424377..20d6da054 100644 --- a/yardstick/benchmark/runners/iteration.py +++ b/yardstick/benchmark/runners/iteration.py @@ -71,6 +71,8 @@ def _worker_process(queue, cls, method_name, scenario_cfg, data = {} errors = "" + benchmark.pre_run_wait_time(interval) + try: result = method(data) except AssertionError as assertion: @@ -90,7 +92,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg, scenario_cfg['options']['rate'] -= delta sequence = 1 continue - except Exception: + except Exception: # pylint: disable=broad-except errors = traceback.format_exc() LOG.exception("") else: @@ -99,7 +101,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg, # if we do timeout we don't care about dropping individual KPIs output_queue.put(result, True, QUEUE_PUT_TIMEOUT) - time.sleep(interval) + benchmark.post_run_wait_time(interval) benchmark_output = { 'timestamp': time.time(), diff --git a/yardstick/benchmark/scenarios/base.py b/yardstick/benchmark/scenarios/base.py index 10a728828..58a02805c 100644 --- a/yardstick/benchmark/scenarios/base.py +++ b/yardstick/benchmark/scenarios/base.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -# yardstick comment: this is a modified copy of -# rally/rally/benchmark/scenarios/base.py +import abc +import time +import six from stevedore import extension import yardstick.common.utils as utils @@ -37,20 +38,29 @@ def _iter_scenario_classes(scenario_type=None): yield scenario +@six.add_metaclass(abc.ABCMeta) class Scenario(object): def setup(self): - """ default impl for scenario setup """ + """Default setup implementation for Scenario classes""" pass + @abc.abstractmethod def run(self, *args): - """ catcher for not implemented run methods in subclasses """ - raise RuntimeError("run method not implemented") + """Entry point for scenario classes, called from runner worker""" def teardown(self): - """ default impl for scenario teardown """ + """Default teardown implementation for Scenario classes""" pass + def pre_run_wait_time(self, time_seconds): + """Time waited before executing the run method""" + pass + + def post_run_wait_time(self, time_seconds): + """Time waited after executing the run method""" + time.sleep(time_seconds) + @staticmethod def get_types(): """return a list of known runner type (class) names""" @@ -88,10 +98,14 @@ class Scenario(object): """ return cls.__doc__.splitlines()[0] if cls.__doc__ else str(None) - def _push_to_outputs(self, keys, values): + @staticmethod + def _push_to_outputs(keys, values): + """Return a dictionary given the keys and the values""" return dict(zip(keys, values)) - def _change_obj_to_dict(self, obj): + @staticmethod + def _change_obj_to_dict(obj): + """Return a dictionary from the __dict__ attribute of an object""" dic = {} for k, v in vars(obj).items(): try: diff --git a/yardstick/benchmark/scenarios/lib/create_floating_ip.py b/yardstick/benchmark/scenarios/lib/create_floating_ip.py index 7108722af..e29f9d1fc 100644 --- a/yardstick/benchmark/scenarios/lib/create_floating_ip.py +++ b/yardstick/benchmark/scenarios/lib/create_floating_ip.py @@ -11,7 +11,8 @@ import logging import os from yardstick.benchmark.scenarios import base -import yardstick.common.openstack_utils as op_utils +from yardstick.common import openstack_utils +from yardstick.common import exceptions LOG = logging.getLogger(__name__) @@ -26,9 +27,18 @@ class CreateFloatingIp(base.Scenario): self.scenario_cfg = scenario_cfg self.context_cfg = context_cfg self.ext_net_id = os.getenv("EXTERNAL_NETWORK", "external") + self.options = self.scenario_cfg["options"] + + self.network_name_or_id = self.options.get("network_name_or_id", self.ext_net_id) + self.server = self.options.get("server") + self.fixed_address = self.options.get("fixed_address") + self.nat_destination = self.options.get("nat_destination") + self.port = self.options.get("port") + self.wait = self.options.get("wait", False) + self.timeout = self.options.get("timeout", 60) + + self.shade_client = openstack_utils.get_shade_client() - self.neutron_client = op_utils.get_neutron_client() - self.shade_client = op_utils.get_shade_client() self.setup_done = False def setup(self): @@ -36,21 +46,25 @@ class CreateFloatingIp(base.Scenario): self.setup_done = True - def run(self, *args): + def run(self, result): """execute the test""" if not self.setup_done: self.setup() - net_id = op_utils.get_network_id(self.shade_client, self.ext_net_id) - floating_info = op_utils.create_floating_ip(self.neutron_client, - extnet_id=net_id) + floating_info = openstack_utils.create_floating_ip( + self.shade_client, network_name_or_id=self.network_name_or_id, + server=self.server, fixed_address=self.fixed_address, + nat_destination=self.nat_destination, port=self.port, + wait=self.wait, timeout=self.timeout) if not floating_info: + result.update({"floating_ip_create": 0}) LOG.error("Creating floating ip failed!") - return + raise exceptions.ScenarioCreateFloatingIPError + result.update({"floating_ip_create": 1}) LOG.info("Creating floating ip successful!") - keys = self.scenario_cfg.get('output', '').split() + keys = self.scenario_cfg.get("output", '').split() values = [floating_info["fip_id"], floating_info["fip_addr"]] return self._push_to_outputs(keys, values) diff --git a/yardstick/benchmark/scenarios/lib/create_router.py b/yardstick/benchmark/scenarios/lib/create_router.py index 9aa57ebb2..34252f603 100644 --- a/yardstick/benchmark/scenarios/lib/create_router.py +++ b/yardstick/benchmark/scenarios/lib/create_router.py @@ -7,13 +7,11 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from __future__ import print_function -from __future__ import absolute_import - import logging from yardstick.benchmark.scenarios import base -import yardstick.common.openstack_utils as op_utils +from yardstick.common import openstack_utils +from yardstick.common import exceptions LOG = logging.getLogger(__name__) @@ -28,9 +26,14 @@ class CreateRouter(base.Scenario): self.context_cfg = context_cfg self.options = self.scenario_cfg['options'] - self.openstack = self.options.get("openstack_paras", None) + self.name = self.options.get('name') + self.admin_state_up = self.options.get('admin_state_up', True) + self.ext_gateway_net_id = self.options.get('ext_gateway_net_id') + self.enable_snat = self.options.get('enable_snat') + self.ext_fixed_ips = self.options.get('ext_fixed_ips') + self.project_id = self.options.get('project_id') - self.neutron_client = op_utils.get_neutron_client() + self.shade_client = openstack_utils.get_shade_client() self.setup_done = False @@ -45,22 +48,19 @@ class CreateRouter(base.Scenario): if not self.setup_done: self.setup() - openstack_paras = {'router': self.openstack} - router_id = op_utils.create_neutron_router(self.neutron_client, - openstack_paras) - if router_id: - result.update({"network_create": 1}) - LOG.info("Create router successful!") - else: - result.update({"network_create": 0}) + router_id = openstack_utils.create_neutron_router( + self.shade_client, name=self.name, + admin_state_up=self.admin_state_up, + ext_gateway_net_id=self.ext_gateway_net_id, + enable_snat=self.enable_snat, ext_fixed_ips=self.ext_fixed_ips, + project_id=self.project_id) + if not router_id: + result.update({"router_create": 0}) LOG.error("Create router failed!") + raise exceptions.ScenarioCreateRouterError - check_result = router_id - - try: - keys = self.scenario_cfg.get('output', '').split() - except KeyError: - pass - else: - values = [check_result] - return self._push_to_outputs(keys, values) + result.update({"router_create": 1}) + LOG.info("Create router successful!") + keys = self.scenario_cfg.get('output', '').split() + values = [router_id] + return self._push_to_outputs(keys, values) diff --git a/yardstick/benchmark/scenarios/lib/delete_floating_ip.py b/yardstick/benchmark/scenarios/lib/delete_floating_ip.py index 4314952fb..a35445f6f 100644 --- a/yardstick/benchmark/scenarios/lib/delete_floating_ip.py +++ b/yardstick/benchmark/scenarios/lib/delete_floating_ip.py @@ -7,13 +7,12 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from __future__ import print_function -from __future__ import absolute_import - import logging +from yardstick.common import openstack_utils +from yardstick.common import exceptions from yardstick.benchmark.scenarios import base -import yardstick.common.openstack_utils as op_utils + LOG = logging.getLogger(__name__) @@ -28,9 +27,10 @@ class DeleteFloatingIp(base.Scenario): self.context_cfg = context_cfg self.options = self.scenario_cfg['options'] - self.floating_ip_id = self.options.get("floating_ip_id", None) + self.floating_ip_id = self.options["floating_ip_id"] + self.retry = self.options.get("retry", 1) - self.nova_client = op_utils.get_nova_client() + self.shade_client = openstack_utils.get_shade_client() self.setup_done = False def setup(self): @@ -44,11 +44,13 @@ class DeleteFloatingIp(base.Scenario): if not self.setup_done: self.setup() - status = op_utils.delete_floating_ip(nova_client=self.nova_client, - floatingip_id=self.floating_ip_id) - if status: - result.update({"delete_floating_ip": 1}) - LOG.info("Delete floating ip successful!") - else: + status = openstack_utils.delete_floating_ip( + self.shade_client, self.floating_ip_id, + retry=self.retry) + if not status: result.update({"delete_floating_ip": 0}) LOG.error("Delete floating ip failed!") + raise exceptions.ScenarioDeleteFloatingIPError + + result.update({"delete_floating_ip": 1}) + LOG.info("Delete floating ip successful!") diff --git a/yardstick/benchmark/scenarios/lib/delete_router_interface.py b/yardstick/benchmark/scenarios/lib/delete_router_interface.py index 117c80811..e71aed3ef 100644 --- a/yardstick/benchmark/scenarios/lib/delete_router_interface.py +++ b/yardstick/benchmark/scenarios/lib/delete_router_interface.py @@ -7,13 +7,11 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from __future__ import print_function -from __future__ import absolute_import - import logging from yardstick.benchmark.scenarios import base -import yardstick.common.openstack_utils as op_utils +from yardstick.common import openstack_utils +from yardstick.common import exceptions LOG = logging.getLogger(__name__) @@ -28,10 +26,11 @@ class DeleteRouterInterface(base.Scenario): self.context_cfg = context_cfg self.options = self.scenario_cfg['options'] - self.subnet_id = self.options.get("subnet_id", None) - self.router_id = self.options.get("router_id", None) + self.router = self.options["router"] + self.subnet_id = self.options.get("subnet_id") + self.port_id = self.options.get("port_id") - self.neutron_client = op_utils.get_neutron_client() + self.shade_client = openstack_utils.get_shade_client() self.setup_done = False @@ -46,12 +45,13 @@ class DeleteRouterInterface(base.Scenario): if not self.setup_done: self.setup() - status = op_utils.remove_interface_router(self.neutron_client, - router_id=self.router_id, - subnet_id=self.subnet_id) - if status: - result.update({"delete_router_interface": 1}) - LOG.info("Delete router interface successful!") - else: + status = openstack_utils.remove_router_interface( + self.shade_client, self.router, subnet_id=self.subnet_id, + port_id=self.port_id) + if not status: result.update({"delete_router_interface": 0}) LOG.error("Delete router interface failed!") + raise exceptions.ScenarioRemoveRouterIntError + + result.update({"delete_router_interface": 1}) + LOG.info("Delete router interface successful!") diff --git a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py index ce8a7f497..9a7b975a2 100644 --- a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py +++ b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py @@ -70,39 +70,42 @@ class PktgenDPDKLatency(base.Scenario): def run(self, result): """execute the benchmark""" + options = self.scenario_cfg['options'] + eth1 = options.get("eth1", "ens4") + eth2 = options.get("eth2", "ens5") if not self.setup_done: self.setup() if not self.testpmd_args: - self.testpmd_args = utils.get_port_mac(self.client, 'eth2') + self.testpmd_args = utils.get_port_mac(self.client, eth2) if not self.pktgen_args: - server_rev_mac = utils.get_port_mac(self.server, 'eth1') - server_send_mac = utils.get_port_mac(self.server, 'eth2') - client_src_ip = utils.get_port_ip(self.client, 'eth1') - client_dst_ip = utils.get_port_ip(self.client, 'eth2') + server_rev_mac = utils.get_port_mac(self.server, eth1) + server_send_mac = utils.get_port_mac(self.server, eth2) + client_src_ip = utils.get_port_ip(self.client, eth1) + client_dst_ip = utils.get_port_ip(self.client, eth2) self.pktgen_args = [client_src_ip, client_dst_ip, server_rev_mac, server_send_mac] - options = self.scenario_cfg['options'] packetsize = options.get("packetsize", 64) rate = options.get("rate", 100) - cmd = "screen sudo -E bash ~/testpmd_fwd.sh %s " % (self.testpmd_args) + cmd = "screen sudo -E bash ~/testpmd_fwd.sh %s %s %s" % \ + (self.testpmd_args, eth1, eth2) LOG.debug("Executing command: %s", cmd) self.server.send_command(cmd) time.sleep(1) - cmd = "screen sudo -E bash ~/pktgen_dpdk.sh %s %s %s %s %s %s" % \ + cmd = "screen sudo -E bash ~/pktgen_dpdk.sh %s %s %s %s %s %s %s %s" % \ (self.pktgen_args[0], self.pktgen_args[1], self.pktgen_args[2], - self.pktgen_args[3], rate, packetsize) + self.pktgen_args[3], rate, packetsize, eth1, eth2) LOG.debug("Executing command: %s", cmd) self.client.send_command(cmd) # wait for finishing test - time.sleep(1) + time.sleep(60) cmd = r"""\ cat ~/result.log -vT \ diff --git a/yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash b/yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash index b872aa3df..dcd5a9bfb 100644 --- a/yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash +++ b/yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash @@ -7,7 +7,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -!/bin/sh +#!/bin/sh set -e @@ -18,6 +18,11 @@ FWD_REV_MAC=$3 # MAC address of forwarding receiver in VM B FWD_SEND_MAC=$4 # MAC address of forwarding sender in VM B RATE=$5 # packet rate in percentage PKT_SIZE=$6 # packet size +ETH1=$7 +ETH2=$8 + +DPDK_VERSION="dpdk-17.02" +PKTGEN_VERSION="pktgen-3.2.12" load_modules() @@ -31,13 +36,13 @@ load_modules() if lsmod | grep "igb_uio" &> /dev/null ; then echo "igb_uio module is loaded" else - insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko + insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko fi if lsmod | grep "rte_kni" &> /dev/null ; then echo "rte_kni module is loaded" else - insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko + insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko fi } @@ -48,8 +53,10 @@ change_permissions() } add_interface_to_dpdk(){ + ip link set $ETH1 down + ip link set $ETH2 down interfaces=$(lspci |grep Eth |tail -n +2 |awk '{print $1}') - /dpdk/tools/dpdk-devbind.py --bind=igb_uio $interfaces + /opt/tempT/$DPDK_VERSION/usertools/dpdk-devbind.py --bind=igb_uio $interfaces } @@ -106,20 +113,14 @@ spawn ./app/app/x86_64-native-linuxapp-gcc/pktgen -c 0x07 -n 4 -b $blacklist -- expect "Pktgen>" send "\n" expect "Pktgen>" -send "screen on\n" +send "on\n" expect "Pktgen>" set count 10 while { $count } { send "page latency\n" - expect { - timeout { send "\n" } - -regexp {..*} { - set result "${result}$expect_out(0,string)" - set timeout 1 - exp_continue - } - "Pktgen>" - } + expect -re "(..*)" + set result "${result}$expect_out(0,string)" + set timeout 1 set count [expr $count-1] } send "stop 0\n" @@ -136,7 +137,7 @@ EOF run_pktgen() { blacklist=$(lspci |grep Eth |awk '{print $1}'|head -1) - cd /pktgen-dpdk + cd /opt/tempT/$PKTGEN_VERSION touch /home/ubuntu/result.log result_log="/home/ubuntu/result.log" sudo expect /home/ubuntu/pktgen.exp $blacklist $result_log @@ -153,4 +154,3 @@ main() } main - diff --git a/yardstick/benchmark/scenarios/networking/testpmd_fwd.bash b/yardstick/benchmark/scenarios/networking/testpmd_fwd.bash index 247a8a833..30b63a734 100644 --- a/yardstick/benchmark/scenarios/networking/testpmd_fwd.bash +++ b/yardstick/benchmark/scenarios/networking/testpmd_fwd.bash @@ -13,6 +13,10 @@ set -e # Commandline arguments DST_MAC=$1 # MAC address of the peer port +ETH1=$2 +ETH2=$3 + +DPDK_VERSION="dpdk-17.02" load_modules() { @@ -25,13 +29,13 @@ load_modules() if lsmod | grep "igb_uio" &> /dev/null ; then echo "igb_uio module is loaded" else - insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko + insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko fi if lsmod | grep "rte_kni" &> /dev/null ; then echo "rte_kni module is loaded" else - insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko + insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko fi } @@ -42,15 +46,17 @@ change_permissions() } add_interface_to_dpdk(){ + ip link set $ETH1 down + ip link set $ETH2 down interfaces=$(lspci |grep Eth |tail -n +2 |awk '{print $1}') - /dpdk/tools/dpdk-devbind.py --bind=igb_uio $interfaces + /opt/tempT/$DPDK_VERSION/usertools//dpdk-devbind.py --bind=igb_uio $interfaces } run_testpmd() { blacklist=$(lspci |grep Eth |awk '{print $1}'|head -1) - cd /dpdk - sudo ./destdir/bin/testpmd -c 0x07 -n 4 -b $blacklist -- -a --eth-peer=1,$DST_MAC --forward-mode=mac + cd /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/app + sudo ./testpmd -c 0x07 -n 4 -b $blacklist -- -a --eth-peer=1,$DST_MAC --forward-mode=mac } main() diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index 0e4785294..be2fa3f3b 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -14,6 +14,7 @@ import copy import logging +import time import ipaddress from itertools import chain @@ -484,3 +485,11 @@ class NetworkServiceTestCase(scenario_base.Scenario): # https://bugs.python.org/issue9400 LOG.exception("") raise RuntimeError("Error in teardown") + + def pre_run_wait_time(self, time_seconds): + """Time waited before executing the run method""" + time.sleep(time_seconds) + + def post_run_wait_time(self, time_seconds): + """Time waited after executing the run method""" + pass diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py index 633b36f91..439b9cb1b 100644 --- a/yardstick/common/exceptions.py +++ b/yardstick/common/exceptions.py @@ -82,6 +82,36 @@ class DPDKSetupDriverError(YardstickException): message = '"igb_uio" driver is not loaded' +class OVSUnsupportedVersion(YardstickException): + message = ('Unsupported OVS version "%(ovs_version)s". Please check the ' + 'config. OVS to DPDK version map: %(ovs_to_dpdk_map)s.') + + +class OVSHugepagesInfoError(YardstickException): + message = 'MemInfo cannnot be retrieved.' + + +class OVSHugepagesNotConfigured(YardstickException): + message = 'HugePages are not configured in this system.' + + +class OVSHugepagesZeroFree(YardstickException): + message = ('There are no HugePages free in this system. Total HugePages ' + 'configured: %(total_hugepages)s') + + +class OVSDeployError(YardstickException): + message = 'OVS deploy tool failed with error: %(stderr)s.' + + +class OVSSetupError(YardstickException): + message = 'OVS setup error. Command: %(command)s. Error: %(error)s.' + + +class LibvirtCreateError(YardstickException): + message = 'Error creating the virtual machine. Error: %(error)s.' + + class ScenarioConfigContextNameNotFound(YardstickException): message = 'Context name "%(context_name)s" not found' @@ -120,3 +150,19 @@ class MissingPodInfoError(YardstickException): class UnsupportedPodFormatError(YardstickException): message = 'Failed to load pod info, unsupported format' + + +class ScenarioCreateRouterError(YardstickException): + message = 'Create Neutron Router Scenario failed' + + +class ScenarioRemoveRouterIntError(YardstickException): + message = 'Remove Neutron Router Interface Scenario failed' + + +class ScenarioCreateFloatingIPError(YardstickException): + message = 'Create Neutron Floating IP Scenario failed' + + +class ScenarioDeleteFloatingIPError(YardstickException): + message = 'Delete Neutron Floating IP Scenario failed' diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py index 84bfbbbb1..a6b53a607 100644 --- a/yardstick/common/openstack_utils.py +++ b/yardstick/common/openstack_utils.py @@ -429,12 +429,6 @@ def delete_keypair(nova_client, key): # pragma: no cover # ********************************************* # NEUTRON # ********************************************* -def get_network_id(shade_client, network_name): - networks = shade_client.list_networks({'name': network_name}) - if networks: - return networks[0]['id'] - - def create_neutron_net(shade_client, network_name, shared=False, admin_state_up=True, external=False, provider=None, project_id=None): @@ -519,13 +513,29 @@ def create_neutron_subnet(shade_client, network_name_or_id, cidr=None, return None -def create_neutron_router(neutron_client, json_body): # pragma: no cover +def create_neutron_router(shade_client, name=None, admin_state_up=True, + ext_gateway_net_id=None, enable_snat=None, + ext_fixed_ips=None, project_id=None): + """Create a logical router. + + :param name:(string) the router name. + :param admin_state_up:(bool) the administrative state of the router. + :param ext_gateway_net_id:(string) network ID for the external gateway. + :param enable_snat:(bool) enable Source NAT (SNAT) attribute. + :param ext_fixed_ips: List of dictionaries of desired IP and/or subnet + on the external network. + :param project_id:(string) project ID for the router. + + :returns:(string) the router id. + """ try: - router = neutron_client.create_router(json_body) - return router['router']['id'] - except Exception: # pylint: disable=broad-except - log.error("Error [create_neutron_router(neutron_client)]") - raise Exception("operation error") + router = shade_client.create_router( + name, admin_state_up, ext_gateway_net_id, enable_snat, + ext_fixed_ips, project_id) + return router['id'] + except exc.OpenStackCloudException as o_exc: + log.error("Error [create_neutron_router(shade_client)]. " + "Exception message: %s", o_exc.orig_message) def delete_neutron_router(shade_client, router_id): @@ -547,38 +557,71 @@ def remove_gateway_router(neutron_client, router_id): # pragma: no cover return False -def remove_interface_router(neutron_client, router_id, subnet_id, - **json_body): # pragma: no cover - json_body.update({"subnet_id": subnet_id}) +def remove_router_interface(shade_client, router, subnet_id=None, + port_id=None): + """Detach a subnet from an internal router interface. + + At least one of subnet_id or port_id must be supplied. If you specify both + subnet and port ID, the subnet ID must correspond to the subnet ID of the + first IP address on the port specified by the port ID. + Otherwise an error occurs. + + :param router: The dict object of the router being changed + :param subnet_id:(string) The ID of the subnet to use for the interface + :param port_id:(string) The ID of the port to use for the interface + :returns: True on success + """ try: - neutron_client.remove_interface_router(router=router_id, - body=json_body) + shade_client.remove_router_interface( + router, subnet_id=subnet_id, port_id=port_id) return True - except Exception: # pylint: disable=broad-except - log.error("Error [remove_interface_router(neutron_client, '%s', " - "'%s')]", router_id, subnet_id) + except exc.OpenStackCloudException as o_exc: + log.error("Error [remove_interface_router(shade_client)]. " + "Exception message: %s", o_exc.orig_message) return False -def create_floating_ip(neutron_client, extnet_id): # pragma: no cover - props = {'floating_network_id': extnet_id} +def create_floating_ip(shade_client, network_name_or_id=None, server=None, + fixed_address=None, nat_destination=None, + port=None, wait=False, timeout=60): + """Allocate a new floating IP from a network or a pool. + + :param network_name_or_id: Name or ID of the network + that the floating IP should come from. + :param server: Server dict for the server to create + the IP for and to which it should be attached. + :param fixed_address: Fixed IP to attach the floating ip to. + :param nat_destination: Name or ID of the network + that the fixed IP to attach the floating + IP to should be on. + :param port: The port ID that the floating IP should be + attached to. Specifying a port conflicts with specifying a + server,fixed_address or nat_destination. + :param wait: Whether to wait for the IP to be active.Only applies + if a server is provided. + :param timeout: How long to wait for the IP to be active.Only + applies if a server is provided. + + :returns:Floating IP id and address + """ try: - ip_json = neutron_client.create_floatingip({'floatingip': props}) - fip_addr = ip_json['floatingip']['floating_ip_address'] - fip_id = ip_json['floatingip']['id'] - except Exception: # pylint: disable=broad-except - log.error("Error [create_floating_ip(neutron_client)]") - return None - return {'fip_addr': fip_addr, 'fip_id': fip_id} + fip = shade_client.create_floating_ip( + network=network_name_or_id, server=server, + fixed_address=fixed_address, nat_destination=nat_destination, + port=port, wait=wait, timeout=timeout) + return {'fip_addr': fip['floating_ip_address'], 'fip_id': fip['id']} + except exc.OpenStackCloudException as o_exc: + log.error("Error [create_floating_ip(shade_client)]. " + "Exception message: %s", o_exc.orig_message) -def delete_floating_ip(nova_client, floatingip_id): # pragma: no cover +def delete_floating_ip(shade_client, floating_ip_id, retry=1): try: - nova_client.floating_ips.delete(floatingip_id) - return True - except Exception: # pylint: disable=broad-except - log.error("Error [delete_floating_ip(nova_client, '%s')]", - floatingip_id) + return shade_client.delete_floating_ip(floating_ip_id=floating_ip_id, + retry=retry) + except exc.OpenStackCloudException as o_exc: + log.error("Error [delete_floating_ip(shade_client,'%s')]. " + "Exception message: %s", floating_ip_id, o_exc.orig_message) return False diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index addbd9aa4..77488c479 100644 --- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py @@ -79,7 +79,6 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper): APP_NAME = 'DpdkVnf' FIND_NET_CMD = "find /sys/class/net -lname '*{}*' -printf '%f'" NR_HUGEPAGES_PATH = '/proc/sys/vm/nr_hugepages' - HUGEPAGES_KB = 1024 * 1024 * 16 @staticmethod def _update_packet_type(ip_pipeline_cfg, traffic_options): @@ -118,7 +117,8 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper): def _setup_hugepages(self): meminfo = utils.read_meminfo(self.ssh_helper) hp_size_kb = int(meminfo['Hugepagesize']) - nr_hugepages = int(abs(self.HUGEPAGES_KB / hp_size_kb)) + hugepages_gb = self.scenario_helper.all_options.get('hugepages_gb', 16) + nr_hugepages = int(abs(hugepages_gb * 1024 * 1024 / hp_size_kb)) self.ssh_helper.execute('echo %s | sudo tee %s' % (nr_hugepages, self.NR_HUGEPAGES_PATH)) hp = six.BytesIO() diff --git a/yardstick/tests/unit/apiserver/resources/v1/__init__.py b/yardstick/tests/unit/apiserver/resources/v1/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/yardstick/tests/unit/apiserver/resources/v1/__init__.py diff --git a/yardstick/tests/unit/apiserver/resources/v1/test_testsuites.py b/yardstick/tests/unit/apiserver/resources/v1/test_testsuites.py new file mode 100644 index 000000000..85c045f44 --- /dev/null +++ b/yardstick/tests/unit/apiserver/resources/v1/test_testsuites.py @@ -0,0 +1,35 @@ +############################################################################## +# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others. +# +# 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 mock + +import unittest + +from yardstick.tests.unit.apiserver import APITestCase +from api.utils.thread import TaskThread + + +class TestsuiteTestCase(APITestCase): + + def test_run_test_suite(self): + if self.app is None: + unittest.skip('host config error') + return + + TaskThread.start = mock.MagicMock() + + url = 'yardstick/testsuites/action' + data = { + 'action': 'run_test_suite', + 'args': { + 'opts': {}, + 'testsuite': 'opnfv_smoke' + } + } + resp = self._post(url, data) + self.assertEqual(resp.get('status'), 1) diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py index 18ea3c4e6..b1dcee209 100644 --- a/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py +++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py @@ -13,12 +13,17 @@ # limitations under the License. import copy +import mock import os import unittest -import mock +import uuid from xml.etree import ElementTree + +from yardstick import ssh from yardstick.benchmark.contexts.standalone import model +from yardstick.common import exceptions +from yardstick import constants from yardstick.network_services import utils @@ -38,22 +43,19 @@ XML_SAMPLE_INTERFACE = """<?xml version="1.0"?> </domain> """ + class ModelLibvirtTestCase(unittest.TestCase): def setUp(self): - self.xml = ElementTree.ElementTree( - element=ElementTree.fromstring(XML_SAMPLE)) self.pci_address_str = '0001:04:03.2' self.pci_address = utils.PciAddress(self.pci_address_str) self.mac = '00:00:00:00:00:01' - self._mock_write_xml = mock.patch.object(ElementTree.ElementTree, - 'write') - self.mock_write_xml = self._mock_write_xml.start() - + self._mock_ssh = mock.Mock() + self.mock_ssh = self._mock_ssh.start() self.addCleanup(self._cleanup) def _cleanup(self): - self._mock_write_xml.stop() + self._mock_ssh.stop() # TODO: Remove mocking of yardstick.ssh.SSH (here and elsewhere) # In this case, we are mocking a param to be passed into other methods @@ -67,20 +69,31 @@ class ModelLibvirtTestCase(unittest.TestCase): model.Libvirt.check_if_vm_exists_and_delete("vm_0", ssh_mock) def test_virsh_create_vm(self): - with mock.patch("yardstick.ssh.SSH") as ssh: - ssh_mock = mock.Mock(autospec=ssh.SSH) - ssh_mock.execute = mock.Mock(return_value=(0, "a", "")) - ssh.return_value = ssh_mock - # NOTE(ralonsoh): this test doesn't cover function execution. - model.Libvirt.virsh_create_vm(ssh_mock, "vm_0") + self.mock_ssh.execute = mock.Mock(return_value=(0, 0, 0)) + model.Libvirt.virsh_create_vm(self.mock_ssh, 'vm_0') + self.mock_ssh.execute.assert_called_once_with('virsh create vm_0') + + def test_virsh_create_vm_error(self): + self.mock_ssh.execute = mock.Mock(return_value=(1, 0, 'error_create')) + with self.assertRaises(exceptions.LibvirtCreateError) as exc: + model.Libvirt.virsh_create_vm(self.mock_ssh, 'vm_0') + self.assertEqual('Error creating the virtual machine. Error: ' + 'error_create.', str(exc.exception)) + self.mock_ssh.execute.assert_called_once_with('virsh create vm_0') def test_virsh_destroy_vm(self): - with mock.patch("yardstick.ssh.SSH") as ssh: - ssh_mock = mock.Mock(autospec=ssh.SSH) - ssh_mock.execute = mock.Mock(return_value=(0, "a", "")) - ssh.return_value = ssh_mock - # NOTE(ralonsoh): this test doesn't cover function execution. - model.Libvirt.virsh_destroy_vm("vm_0", ssh_mock) + self.mock_ssh.execute = mock.Mock(return_value=(0, 0, 0)) + model.Libvirt.virsh_destroy_vm('vm_0', self.mock_ssh) + self.mock_ssh.execute.assert_called_once_with('virsh destroy vm_0') + + @mock.patch.object(model, 'LOG') + def test_virsh_destroy_vm_error(self, mock_logger): + self.mock_ssh.execute = mock.Mock(return_value=(1, 0, 'error_destroy')) + mock_logger.warning = mock.Mock() + model.Libvirt.virsh_destroy_vm('vm_0', self.mock_ssh) + mock_logger.warning.assert_called_once_with( + 'Error destroying VM %s. Error: %s', 'vm_0', 'error_destroy') + self.mock_ssh.execute.assert_called_once_with('virsh destroy vm_0') def test_add_interface_address(self): xml = ElementTree.ElementTree( @@ -98,72 +111,65 @@ class ModelLibvirtTestCase(unittest.TestCase): result.get('function')) def test_add_ovs_interfaces(self): - xml_input = mock.Mock() - with mock.patch.object(ElementTree, 'parse', return_value=self.xml) \ - as mock_parse: - xml = copy.deepcopy(self.xml) - mock_parse.return_value = xml - model.Libvirt.add_ovs_interface( - '/usr/local', 0, self.pci_address_str, self.mac, xml_input) - mock_parse.assert_called_once_with(xml_input) - self.mock_write_xml.assert_called_once_with(xml_input) - interface = xml.find('devices').find('interface') - self.assertEqual('vhostuser', interface.get('type')) - mac = interface.find('mac') - self.assertEqual(self.mac, mac.get('address')) - source = interface.find('source') - self.assertEqual('unix', source.get('type')) - self.assertEqual('/usr/local/var/run/openvswitch/dpdkvhostuser0', - source.get('path')) - self.assertEqual('client', source.get('mode')) - _model = interface.find('model') - self.assertEqual('virtio', _model.get('type')) - driver = interface.find('driver') - self.assertEqual('4', driver.get('queues')) - host = driver.find('host') - self.assertEqual('off', host.get('mrg_rxbuf')) - self.assertIsNotNone(interface.find('address')) + xml_input = copy.deepcopy(XML_SAMPLE) + xml_output = model.Libvirt.add_ovs_interface( + '/usr/local', 0, self.pci_address_str, self.mac, xml_input) + + root = ElementTree.fromstring(xml_output) + et_out = ElementTree.ElementTree(element=root) + interface = et_out.find('devices').find('interface') + self.assertEqual('vhostuser', interface.get('type')) + mac = interface.find('mac') + self.assertEqual(self.mac, mac.get('address')) + source = interface.find('source') + self.assertEqual('unix', source.get('type')) + self.assertEqual('/usr/local/var/run/openvswitch/dpdkvhostuser0', + source.get('path')) + self.assertEqual('client', source.get('mode')) + _model = interface.find('model') + self.assertEqual('virtio', _model.get('type')) + driver = interface.find('driver') + self.assertEqual('4', driver.get('queues')) + host = driver.find('host') + self.assertEqual('off', host.get('mrg_rxbuf')) + self.assertIsNotNone(interface.find('address')) def test_add_sriov_interfaces(self): - xml_input = mock.Mock() - with mock.patch.object(ElementTree, 'parse', return_value=self.xml) \ - as mock_parse: - xml = copy.deepcopy(self.xml) - mock_parse.return_value = xml - vm_pci = '0001:05:04.2' - model.Libvirt.add_sriov_interfaces( - vm_pci, self.pci_address_str, self.mac, xml_input) - mock_parse.assert_called_once_with(xml_input) - self.mock_write_xml.assert_called_once_with(xml_input) - interface = xml.find('devices').find('interface') - self.assertEqual('yes', interface.get('managed')) - self.assertEqual('hostdev', interface.get('type')) - mac = interface.find('mac') - self.assertEqual(self.mac, mac.get('address')) - source = interface.find('source') - source_address = source.find('address') - self.assertIsNotNone(source.find('address')) - - self.assertEqual('pci', source_address.get('type')) - self.assertEqual('0x' + self.pci_address_str.split(':')[0], - source_address.get('domain')) - self.assertEqual('0x' + self.pci_address_str.split(':')[1], - source_address.get('bus')) - self.assertEqual('0x' + self.pci_address_str.split(':')[2].split('.')[0], - source_address.get('slot')) - self.assertEqual('0x' + self.pci_address_str.split(':')[2].split('.')[1], - source_address.get('function')) - - interface_address = interface.find('address') - self.assertEqual('pci', interface_address.get('type')) - self.assertEqual('0x' + vm_pci.split(':')[0], - interface_address.get('domain')) - self.assertEqual('0x' + vm_pci.split(':')[1], - interface_address.get('bus')) - self.assertEqual('0x' + vm_pci.split(':')[2].split('.')[0], - interface_address.get('slot')) - self.assertEqual('0x' + vm_pci.split(':')[2].split('.')[1], - interface_address.get('function')) + xml_input = copy.deepcopy(XML_SAMPLE) + vm_pci = '0001:05:04.2' + xml_output = model.Libvirt.add_sriov_interfaces( + vm_pci, self.pci_address_str, self.mac, xml_input) + root = ElementTree.fromstring(xml_output) + et_out = ElementTree.ElementTree(element=root) + interface = et_out.find('devices').find('interface') + self.assertEqual('yes', interface.get('managed')) + self.assertEqual('hostdev', interface.get('type')) + mac = interface.find('mac') + self.assertEqual(self.mac, mac.get('address')) + source = interface.find('source') + source_address = source.find('address') + self.assertIsNotNone(source.find('address')) + + self.assertEqual('pci', source_address.get('type')) + self.assertEqual('0x' + self.pci_address_str.split(':')[0], + source_address.get('domain')) + self.assertEqual('0x' + self.pci_address_str.split(':')[1], + source_address.get('bus')) + self.assertEqual('0x' + self.pci_address_str.split(':')[2].split('.')[0], + source_address.get('slot')) + self.assertEqual('0x' + self.pci_address_str.split(':')[2].split('.')[1], + source_address.get('function')) + + interface_address = interface.find('address') + self.assertEqual('pci', interface_address.get('type')) + self.assertEqual('0x' + vm_pci.split(':')[0], + interface_address.get('domain')) + self.assertEqual('0x' + vm_pci.split(':')[1], + interface_address.get('bus')) + self.assertEqual('0x' + vm_pci.split(':')[2].split('.')[0], + interface_address.get('slot')) + self.assertEqual('0x' + vm_pci.split(':')[2].split('.')[1], + interface_address.get('function')) def test_create_snapshot_qemu(self): result = "/var/lib/libvirt/images/0.qcow2" @@ -175,24 +181,38 @@ class ModelLibvirtTestCase(unittest.TestCase): image = model.Libvirt.create_snapshot_qemu(ssh_mock, "0", "ubuntu.img") self.assertEqual(image, result) - @mock.patch.object(model.Libvirt, 'pin_vcpu_for_perf') - @mock.patch.object(model.Libvirt, 'create_snapshot_qemu') + @mock.patch.object(model.Libvirt, 'pin_vcpu_for_perf', return_value='4,5') + @mock.patch.object(model.Libvirt, 'create_snapshot_qemu', + return_value='qemu_image') def test_build_vm_xml(self, mock_create_snapshot_qemu, - *args): - # NOTE(ralonsoh): this test doesn't cover function execution. This test - # should also check mocked function calls. - cfg_file = 'test_config_file.cfg' - self.addCleanup(os.remove, cfg_file) - result = [4] - with mock.patch("yardstick.ssh.SSH") as ssh: - ssh_mock = mock.Mock(autospec=ssh.SSH) - ssh_mock.execute = \ - mock.Mock(return_value=(0, "a", "")) - ssh.return_value = ssh_mock - mock_create_snapshot_qemu.return_value = "0.img" - - status = model.Libvirt.build_vm_xml(ssh_mock, {}, cfg_file, 'vm_0', 0) - self.assertEqual(status[0], result[0]) + mock_pin_vcpu_for_perf): + extra_specs = {'hw:cpu_cores': '4', + 'hw:cpu_sockets': '3', + 'hw:cpu_threads': '2', + 'cputune': 'cool'} + flavor = {'ram': '1024', + 'extra_specs': extra_specs, + 'hw_socket': '1', + 'images': 'images'} + mac = model.StandaloneContextHelper.get_mac_address(0x00) + _uuid = uuid.uuid4() + connection = mock.Mock() + with mock.patch.object(model.StandaloneContextHelper, + 'get_mac_address', return_value=mac) as \ + mock_get_mac_address, \ + mock.patch.object(uuid, 'uuid4', return_value=_uuid): + xml_out, mac = model.Libvirt.build_vm_xml( + connection, flavor, 'vm_name', 100) + + xml_ref = model.VM_TEMPLATE.format(vm_name='vm_name', + random_uuid=_uuid, mac_addr=mac, memory='1024', vcpu='8', cpu='4', + numa_cpus='0-7', socket='3', threads='2', + vm_image='qemu_image', cpuset='4,5', cputune='cool') + self.assertEqual(xml_ref, xml_out) + mock_get_mac_address.assert_called_once_with(0x00) + mock_create_snapshot_qemu.assert_called_once_with( + connection, 100, 'images') + mock_pin_vcpu_for_perf.assert_called_once_with(connection, '1') # TODO: Edit this test to test state instead of output # update_interrupts_hugepages_perf does not return anything @@ -398,43 +418,80 @@ class ServerTestCase(unittest.TestCase): class OvsDeployTestCase(unittest.TestCase): - NETWORKS = { - 'mgmt': {'cidr': '152.16.100.10/24'}, - 'private_0': { - 'phy_port': "0000:05:00.0", - 'vpci': "0000:00:07.0", - 'driver': 'i40e', - 'mac': '', - 'cidr': '152.16.100.10/24', - 'gateway_ip': '152.16.100.20'}, - 'public_0': { - 'phy_port': "0000:05:00.1", - 'vpci': "0000:00:08.0", - 'driver': 'i40e', - 'mac': '', - 'cidr': '152.16.40.10/24', - 'gateway_ip': '152.16.100.20'} - } - - @mock.patch('yardstick.ssh.SSH') - def setUp(self, mock_ssh): - self.ovs_deploy = model.OvsDeploy(mock_ssh, '/tmp/dpdk-devbind.py', {}) + OVS_DETAILS = {'version': {'ovs': 'ovs_version', 'dpdk': 'dpdk_version'}} - def test___init__(self): - self.assertIsNotNone(self.ovs_deploy.connection) - - @mock.patch('yardstick.benchmark.contexts.standalone.model.os') - def test_prerequisite(self, *args): - # NOTE(ralonsoh): this test should check mocked function calls. - self.ovs_deploy.helper = mock.Mock() - self.assertIsNone(self.ovs_deploy.prerequisite()) - - @mock.patch('yardstick.benchmark.contexts.standalone.model.os') - def test_prerequisite_2(self, *args): - # NOTE(ralonsoh): this test should check mocked function calls. Rename - # this test properly. - self.ovs_deploy.helper = mock.Mock() - self.ovs_deploy.connection.execute = mock.Mock( - return_value=(1, '1.2.3.4 00:00:00:00:00:01', '')) - self.ovs_deploy.prerequisite = mock.Mock() - self.assertIsNone(self.ovs_deploy.ovs_deploy()) + def setUp(self): + self._mock_ssh = mock.patch.object(ssh, 'SSH') + self.mock_ssh = self._mock_ssh .start() + self.ovs_deploy = model.OvsDeploy(self.mock_ssh, + '/tmp/dpdk-devbind.py', + self.OVS_DETAILS) + self._mock_path_isfile = mock.patch.object(os.path, 'isfile') + self._mock_path_join = mock.patch.object(os.path, 'join') + self.mock_path_isfile = self._mock_path_isfile.start() + self.mock_path_join = self._mock_path_join.start() + + self.addCleanup(self._stop_mock) + + def _stop_mock(self): + self._mock_ssh.stop() + self._mock_path_isfile.stop() + self._mock_path_join.stop() + + @mock.patch.object(model.StandaloneContextHelper, 'install_req_libs') + def test_prerequisite(self, mock_install_req_libs): + pkgs = ["git", "build-essential", "pkg-config", "automake", + "autotools-dev", "libltdl-dev", "cmake", "libnuma-dev", + "libpcap-dev"] + self.ovs_deploy.prerequisite() + mock_install_req_libs.assert_called_once_with( + self.ovs_deploy.connection, pkgs) + + def test_ovs_deploy_no_file(self): + self.mock_path_isfile.return_value = False + mock_file = mock.Mock() + self.mock_path_join.return_value = mock_file + + self.ovs_deploy.ovs_deploy() + self.mock_path_isfile.assert_called_once_with(mock_file) + self.mock_path_join.assert_called_once_with( + constants.YARDSTICK_ROOT_PATH, + 'yardstick/resources/scripts/install/', + self.ovs_deploy.OVS_DEPLOY_SCRIPT) + + @mock.patch.object(os.environ, 'get', return_value='test_proxy') + def test_ovs_deploy(self, mock_env_get): + self.mock_path_isfile.return_value = True + mock_deploy_file = mock.Mock() + mock_remove_ovs_deploy = mock.Mock() + self.mock_path_join.side_effect = [mock_deploy_file, + mock_remove_ovs_deploy] + dpdk_version = self.OVS_DETAILS['version']['dpdk'] + ovs_version = self.OVS_DETAILS['version']['ovs'] + + with mock.patch.object(self.ovs_deploy.connection, 'put') as \ + mock_put, \ + mock.patch.object(self.ovs_deploy.connection, 'execute') as \ + mock_execute, \ + mock.patch.object(self.ovs_deploy, 'prerequisite'): + mock_execute.return_value = (0, 0, 0) + self.ovs_deploy.ovs_deploy() + + self.mock_path_isfile.assert_called_once_with(mock_deploy_file) + self.mock_path_join.assert_has_calls([ + mock.call(constants.YARDSTICK_ROOT_PATH, + 'yardstick/resources/scripts/install/', + self.ovs_deploy.OVS_DEPLOY_SCRIPT), + mock.call(self.ovs_deploy.bin_path, + self.ovs_deploy.OVS_DEPLOY_SCRIPT) + ]) + mock_put.assert_called_once_with(mock_deploy_file, + mock_remove_ovs_deploy) + cmd = ("sudo -E %(remote_ovs_deploy)s --ovs='%(ovs_version)s' " + "--dpdk='%(dpdk_version)s' -p='%(proxy)s'" % + {'remote_ovs_deploy': mock_remove_ovs_deploy, + 'ovs_version': ovs_version, + 'dpdk_version': dpdk_version, + 'proxy': 'test_proxy'}) + mock_execute.assert_called_once_with(cmd) + mock_env_get.assert_called_once_with('http_proxy', '') diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py index 0223fd3ff..bc3bb73cd 100644 --- a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py +++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py @@ -12,12 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +import io import os import mock +import six import unittest +from yardstick.benchmark.contexts.standalone import model from yardstick.benchmark.contexts.standalone import ovs_dpdk +from yardstick.common import exceptions +from yardstick.network_services import utils class OvsDpdkContextTestCase(unittest.TestCase): @@ -27,7 +32,6 @@ class OvsDpdkContextTestCase(unittest.TestCase): NODES_DUPLICATE_SAMPLE = "nodes_duplicate_sample.yaml" NETWORKS = { - 'mgmt': {'cidr': '152.16.100.10/24'}, 'private_0': { 'phy_port': "0000:05:00.0", 'vpci': "0000:00:07.0", @@ -82,15 +86,43 @@ class OvsDpdkContextTestCase(unittest.TestCase): self.assertIsNone(self.ovs_dpdk.init(ATTRS)) def test_setup_ovs(self): - with mock.patch("yardstick.ssh.SSH") as ssh: - ssh_mock = mock.Mock(autospec=ssh.SSH) - ssh_mock.execute = \ - mock.Mock(return_value=(0, "a", "")) - ssh.return_value = ssh_mock - self.ovs_dpdk.connection = ssh_mock - self.ovs_dpdk.networks = self.NETWORKS - self.ovs_dpdk.ovs_properties = {} - self.assertIsNone(self.ovs_dpdk.setup_ovs()) + fake_path = '/fake_path' + fake_dpdk_nic_bind = 'dpdk_tool.py' + self.ovs_dpdk.ovs_properties = {'vpath': fake_path} + self.ovs_dpdk.dpdk_devbind = fake_dpdk_nic_bind + self.ovs_dpdk.networks = self.NETWORKS + self.ovs_dpdk.connection = mock.Mock() + self.ovs_dpdk.connection.execute = mock.Mock(return_value=(0, 0, 0)) + create_from = fake_path + '/etc/openvswitch/conf.db' + create_to = fake_path + '/share/openvswitch/vswitch.ovsschema' + cmd_list = [ + 'killall -r "ovs.*" -q | true', + 'mkdir -p {0}/etc/openvswitch'.format(fake_path), + 'mkdir -p {0}/var/run/openvswitch'.format(fake_path), + 'rm {0}/etc/openvswitch/conf.db | true'.format(fake_path), + 'ovsdb-tool create {0} {1}'.format(create_from, create_to), + 'modprobe vfio-pci', + 'chmod a+x /dev/vfio', + 'chmod 0666 /dev/vfio/*', + '{0} --force -b vfio-pci {1}'.format(fake_dpdk_nic_bind, + self.ovs_dpdk.networks['private_0']['phy_port']), + '{0} --force -b vfio-pci {1}'.format(fake_dpdk_nic_bind, + self.ovs_dpdk.networks['public_0']['phy_port']) + ] + calls = [mock.call(cmd, timeout=self.ovs_dpdk.CMD_TIMEOUT) + for cmd in cmd_list] + + self.ovs_dpdk.setup_ovs() + self.ovs_dpdk.connection.execute.assert_has_calls(calls, + any_order=True) + + def test_setup_ovs_exception(self): + self.ovs_dpdk.networks = self.NETWORKS + self.ovs_dpdk.connection = mock.Mock() + self.ovs_dpdk.connection.execute = mock.Mock(return_value=(1, 0, 0)) + + with self.assertRaises(exceptions.OVSSetupError): + self.ovs_dpdk.setup_ovs() def test_start_ovs_serverswitch(self): with mock.patch("yardstick.ssh.SSH") as ssh: @@ -129,34 +161,45 @@ class OvsDpdkContextTestCase(unittest.TestCase): self.ovs_dpdk.wait_for_vswitchd = 0 self.assertIsNone(self.ovs_dpdk.cleanup_ovs_dpdk_env()) - @mock.patch('yardstick.benchmark.contexts.standalone.model.OvsDeploy') - def test_check_ovs_dpdk_env(self, mock_ovs): - with mock.patch("yardstick.ssh.SSH") as ssh: - ssh_mock = mock.Mock(autospec=ssh.SSH) - ssh_mock.execute = \ - mock.Mock(return_value=(1, "a", "")) - ssh.return_value = ssh_mock - self.ovs_dpdk.connection = ssh_mock - self.ovs_dpdk.networks = self.NETWORKS - self.ovs_dpdk.ovs_properties = { - 'version': {'ovs': '2.7.0', 'dpdk': '16.11.1'} - } - self.ovs_dpdk.wait_for_vswitchd = 0 - self.ovs_dpdk.cleanup_ovs_dpdk_env = mock.Mock() - self.assertIsNone(self.ovs_dpdk.check_ovs_dpdk_env()) - self.ovs_dpdk.ovs_properties = { - 'version': {'ovs': '2.0.0'} - } - self.ovs_dpdk.wait_for_vswitchd = 0 - self.cleanup_ovs_dpdk_env = mock.Mock() - mock_ovs.deploy = mock.Mock() - # NOTE(elfoley): Check for a specific Exception - self.assertRaises(Exception, self.ovs_dpdk.check_ovs_dpdk_env) + @mock.patch.object(ovs_dpdk.OvsDpdkContext, '_check_hugepages') + @mock.patch.object(utils, 'get_nsb_option') + @mock.patch.object(model.OvsDeploy, 'ovs_deploy') + def test_check_ovs_dpdk_env(self, mock_ovs_deploy, mock_get_nsb_option, + mock_check_hugepages): + self.ovs_dpdk.connection = mock.Mock() + self.ovs_dpdk.connection.execute = mock.Mock( + return_value=(1, 0, 0)) + self.ovs_dpdk.networks = self.NETWORKS + self.ovs_dpdk.ovs_properties = { + 'version': {'ovs': '2.7.0', 'dpdk': '16.11.1'} + } + self.ovs_dpdk.wait_for_vswitchd = 0 + self.ovs_dpdk.cleanup_ovs_dpdk_env = mock.Mock() + mock_get_nsb_option.return_value = 'fake_path' + + self.ovs_dpdk.check_ovs_dpdk_env() + mock_ovs_deploy.assert_called_once() + mock_check_hugepages.assert_called_once() + mock_get_nsb_option.assert_called_once_with('bin_path') + + @mock.patch.object(ovs_dpdk.OvsDpdkContext, '_check_hugepages') + def test_check_ovs_dpdk_env_wrong_version(self, mock_check_hugepages): + self.ovs_dpdk.connection = mock.Mock() + self.ovs_dpdk.connection.execute = mock.Mock( + return_value=(1, 0, 0)) + self.ovs_dpdk.networks = self.NETWORKS + self.ovs_dpdk.ovs_properties = { + 'version': {'ovs': '0.0.1', 'dpdk': '9.8.7'} + } + self.ovs_dpdk.wait_for_vswitchd = 0 + self.ovs_dpdk.cleanup_ovs_dpdk_env = mock.Mock() - @mock.patch('yardstick.ssh.SSH') - def test_deploy(self, mock_ssh): - mock_ssh.execute.return_value = 0, "a", "" + with self.assertRaises(exceptions.OVSUnsupportedVersion): + self.ovs_dpdk.check_ovs_dpdk_env() + mock_check_hugepages.assert_called_once() + @mock.patch('yardstick.ssh.SSH') + def test_deploy(self, *args): self.ovs_dpdk.vm_deploy = False self.assertIsNone(self.ovs_dpdk.deploy()) @@ -174,21 +217,19 @@ class OvsDpdkContextTestCase(unittest.TestCase): # output. self.assertIsNone(self.ovs_dpdk.deploy()) - @mock.patch('yardstick.benchmark.contexts.standalone.model.Libvirt') - @mock.patch('yardstick.ssh.SSH') - def test_undeploy(self, mock_ssh, *args): - mock_ssh.execute.return_value = 0, "a", "" - - self.ovs_dpdk.vm_deploy = False - self.assertIsNone(self.ovs_dpdk.undeploy()) - + @mock.patch.object(model.Libvirt, 'check_if_vm_exists_and_delete') + def test_undeploy(self, mock_libvirt): self.ovs_dpdk.vm_deploy = True - self.ovs_dpdk.connection = mock_ssh + self.ovs_dpdk.connection = mock.Mock() self.ovs_dpdk.vm_names = ['vm_0', 'vm_1'] self.ovs_dpdk.drivers = ['vm_0', 'vm_1'] self.ovs_dpdk.cleanup_ovs_dpdk_env = mock.Mock() self.ovs_dpdk.networks = self.NETWORKS - self.assertIsNone(self.ovs_dpdk.undeploy()) + self.ovs_dpdk.undeploy() + mock_libvirt.assert_has_calls([ + mock.call(self.ovs_dpdk.vm_names[0], self.ovs_dpdk.connection), + mock.call(self.ovs_dpdk.vm_names[1], self.ovs_dpdk.connection) + ]) def _get_file_abspath(self, filename): curr_path = os.path.dirname(os.path.abspath(__file__)) @@ -310,34 +351,28 @@ class OvsDpdkContextTestCase(unittest.TestCase): self.ovs_dpdk.get_vf_datas = mock.Mock(return_value="") self.assertIsNone(self.ovs_dpdk.configure_nics_for_ovs_dpdk()) - @mock.patch('yardstick.benchmark.contexts.standalone.ovs_dpdk.Libvirt') - def test__enable_interfaces(self, *args): - with mock.patch("yardstick.ssh.SSH") as ssh: - ssh_mock = mock.Mock(autospec=ssh.SSH) - ssh_mock.execute = \ - mock.Mock(return_value=(0, "a", "")) - ssh.return_value = ssh_mock + @mock.patch.object(model.Libvirt, 'add_ovs_interface') + def test__enable_interfaces(self, mock_add_ovs_interface): self.ovs_dpdk.vm_deploy = True - self.ovs_dpdk.connection = ssh_mock + self.ovs_dpdk.connection = mock.Mock() self.ovs_dpdk.vm_names = ['vm_0', 'vm_1'] self.ovs_dpdk.drivers = [] self.ovs_dpdk.networks = self.NETWORKS + self.ovs_dpdk.ovs_properties = {'vpath': 'fake_path'} self.ovs_dpdk.get_vf_datas = mock.Mock(return_value="") - self.assertIsNone(self.ovs_dpdk._enable_interfaces( - 0, ["private_0"], 'test')) - - @mock.patch('yardstick.benchmark.contexts.standalone.model.Server') - @mock.patch('yardstick.benchmark.contexts.standalone.ovs_dpdk.Libvirt') - def test_setup_ovs_dpdk_context(self, mock_libvirt, *args): - with mock.patch("yardstick.ssh.SSH") as ssh: - ssh_mock = mock.Mock(autospec=ssh.SSH) - ssh_mock.execute = \ - mock.Mock(return_value=(0, "a", "")) - ssh_mock.put = \ - mock.Mock(return_value=(0, "a", "")) - ssh.return_value = ssh_mock + self.ovs_dpdk._enable_interfaces(0, ["private_0"], 'test') + mock_add_ovs_interface.assert_called_once_with( + 'fake_path', 0, self.NETWORKS['private_0']['vpci'], + self.NETWORKS['private_0']['mac'], 'test') + + @mock.patch.object(model.Libvirt, 'write_file') + @mock.patch.object(model.Libvirt, 'build_vm_xml') + @mock.patch.object(model.Libvirt, 'check_if_vm_exists_and_delete') + @mock.patch.object(model.Libvirt, 'virsh_create_vm') + def test_setup_ovs_dpdk_context(self, mock_create_vm, mock_check_if_exists, + mock_build_xml, mock_write_file): self.ovs_dpdk.vm_deploy = True - self.ovs_dpdk.connection = ssh_mock + self.ovs_dpdk.connection = mock.Mock() self.ovs_dpdk.vm_names = ['vm_0', 'vm_1'] self.ovs_dpdk.drivers = [] self.ovs_dpdk.servers = { @@ -353,11 +388,64 @@ class OvsDpdkContextTestCase(unittest.TestCase): self.ovs_dpdk.host_mgmt = {} self.ovs_dpdk.flavor = {} self.ovs_dpdk.configure_nics_for_ovs_dpdk = mock.Mock(return_value="") - mock_libvirt.build_vm_xml.return_value = [6, "00:00:00:00:00:01"] - self.ovs_dpdk._enable_interfaces = mock.Mock(return_value="") - mock_libvirt.virsh_create_vm.return_value = "" - mock_libvirt.pin_vcpu_for_perf.return_value = "" + xml_str = mock.Mock() + mock_build_xml.return_value = (xml_str, '00:00:00:00:00:01') + self.ovs_dpdk._enable_interfaces = mock.Mock(return_value=xml_str) + vnf_instance = mock.Mock() self.ovs_dpdk.vnf_node.generate_vnf_instance = mock.Mock( - return_value={}) - - self.assertIsNotNone(self.ovs_dpdk.setup_ovs_dpdk_context()) + return_value=vnf_instance) + + self.assertEqual([vnf_instance], + self.ovs_dpdk.setup_ovs_dpdk_context()) + mock_create_vm.assert_called_once_with( + self.ovs_dpdk.connection, '/tmp/vm_ovs_0.xml') + mock_check_if_exists.assert_called_once_with( + 'vm_0', self.ovs_dpdk.connection) + mock_build_xml.assert_called_once_with( + self.ovs_dpdk.connection, self.ovs_dpdk.vm_flavor, 'vm_0', 0) + mock_write_file.assert_called_once_with('/tmp/vm_ovs_0.xml', xml_str) + + @mock.patch.object(io, 'BytesIO') + def test__check_hugepages(self, mock_bytesio): + data = six.BytesIO('HugePages_Total: 20\n' + 'HugePages_Free: 20\n' + 'HugePages_Rsvd: 0\n' + 'HugePages_Surp: 0\n' + 'Hugepagesize: 1048576 kB'.encode()) + mock_bytesio.return_value = data + self.ovs_dpdk.connection = mock.Mock() + self.ovs_dpdk._check_hugepages() + + @mock.patch.object(io, 'BytesIO') + def test__check_hugepages_no_info(self, mock_bytesio): + data = six.BytesIO(''.encode()) + mock_bytesio.return_value = data + self.ovs_dpdk.connection = mock.Mock() + with self.assertRaises(exceptions.OVSHugepagesInfoError): + self.ovs_dpdk._check_hugepages() + + @mock.patch.object(io, 'BytesIO') + def test__check_hugepages_no_total_hp(self, mock_bytesio): + data = six.BytesIO('HugePages_Total: 0\n' + 'HugePages_Free: 0\n' + 'HugePages_Rsvd: 0\n' + 'HugePages_Surp: 0\n' + 'Hugepagesize: 1048576 kB'.encode()) + mock_bytesio.return_value = data + self.ovs_dpdk.connection = mock.Mock() + with self.assertRaises(exceptions.OVSHugepagesNotConfigured): + self.ovs_dpdk._check_hugepages() + + @mock.patch.object(io, 'BytesIO') + def test__check_hugepages_no_free_hp(self, mock_bytesio): + data = six.BytesIO('HugePages_Total: 20\n' + 'HugePages_Free: 0\n' + 'HugePages_Rsvd: 0\n' + 'HugePages_Surp: 0\n' + 'Hugepagesize: 1048576 kB'.encode()) + mock_bytesio.return_value = data + self.ovs_dpdk.connection = mock.Mock() + with self.assertRaises(exceptions.OVSHugepagesZeroFree) as exc: + self.ovs_dpdk._check_hugepages() + self.assertEqual('There are no HugePages free in this system. Total ' + 'HugePages configured: 20', exc.exception.msg) diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_sriov.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_sriov.py index f0953ef55..e70ab0ae8 100644 --- a/yardstick/tests/unit/benchmark/contexts/standalone/test_sriov.py +++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_sriov.py @@ -18,6 +18,7 @@ import mock import unittest from yardstick import ssh +from yardstick.benchmark.contexts.standalone import model from yardstick.benchmark.contexts.standalone import sriov @@ -69,10 +70,11 @@ class SriovContextTestCase(unittest.TestCase): if self.sriov in self.sriov.list: self.sriov._delete_context() - @mock.patch('yardstick.benchmark.contexts.standalone.sriov.Libvirt') - @mock.patch('yardstick.benchmark.contexts.standalone.model.StandaloneContextHelper') - @mock.patch('yardstick.benchmark.contexts.standalone.model.Server') - def test___init__(self, mock_helper, mock_server, *args): + @mock.patch.object(model, 'StandaloneContextHelper') + @mock.patch.object(model, 'Libvirt') + @mock.patch.object(model, 'Server') + def test___init__(self, mock_helper, mock_libvirt, mock_server): + # pylint: disable=unused-argument # NOTE(ralonsoh): this test doesn't cover function execution. self.sriov.helper = mock_helper self.sriov.vnf_node = mock_server @@ -97,9 +99,11 @@ class SriovContextTestCase(unittest.TestCase): self.sriov.wait_for_vnfs_to_start = mock.Mock(return_value={}) self.assertIsNone(self.sriov.deploy()) - @mock.patch('yardstick.benchmark.contexts.standalone.sriov.Libvirt') @mock.patch.object(ssh, 'SSH', return_value=(0, "a", "")) - def test_undeploy(self, mock_ssh, *args): + @mock.patch.object(model, 'Libvirt') + def test_undeploy(self, mock_libvirt, mock_ssh): + # pylint: disable=unused-argument + # NOTE(ralonsoh): the pylint exception should be removed. self.sriov.vm_deploy = False self.assertIsNone(self.sriov.undeploy()) @@ -237,11 +241,11 @@ class SriovContextTestCase(unittest.TestCase): self.sriov._get_vf_data = mock.Mock(return_value="") self.assertIsNone(self.sriov.configure_nics_for_sriov()) - @mock.patch('yardstick.benchmark.contexts.standalone.sriov.Libvirt') - @mock.patch.object(ssh, 'SSH') - def test__enable_interfaces(self, mock_ssh, *args): - mock_ssh.return_value = 0, "a", "" - + @mock.patch.object(ssh, 'SSH', return_value=(0, "a", "")) + @mock.patch.object(model, 'Libvirt') + def test__enable_interfaces(self, mock_libvirt, mock_ssh): + # pylint: disable=unused-argument + # NOTE(ralonsoh): the pylint exception should be removed. self.sriov.vm_deploy = True self.sriov.connection = mock_ssh self.sriov.vm_names = ['vm_0', 'vm_1'] @@ -251,20 +255,12 @@ class SriovContextTestCase(unittest.TestCase): self.assertIsNone(self.sriov._enable_interfaces( 0, 0, ["private_0"], 'test')) - @mock.patch('yardstick.benchmark.contexts.standalone.model.Server') - @mock.patch('yardstick.benchmark.contexts.standalone.sriov.Libvirt') - def test_setup_sriov_context(self, mock_libvirt, *args): - with mock.patch("yardstick.ssh.SSH") as ssh: - ssh_mock = mock.Mock(autospec=ssh.SSH) - ssh_mock.execute = \ - mock.Mock(return_value=(0, "a", "")) - ssh_mock.put = \ - mock.Mock(return_value=(0, "a", "")) - ssh.return_value = ssh_mock - self.sriov.vm_deploy = True - self.sriov.connection = ssh_mock - self.sriov.vm_names = ['vm_0', 'vm_1'] - self.sriov.drivers = [] + @mock.patch.object(model.Libvirt, 'build_vm_xml') + @mock.patch.object(model.Libvirt, 'check_if_vm_exists_and_delete') + @mock.patch.object(model.Libvirt, 'write_file') + @mock.patch.object(model.Libvirt, 'virsh_create_vm') + def test_setup_sriov_context(self, mock_create_vm, mock_write_file, + mock_check, mock_build_vm_xml): self.sriov.servers = { 'vnf_0': { 'network_ports': { @@ -274,15 +270,31 @@ class SriovContextTestCase(unittest.TestCase): } } } - self.sriov.networks = self.NETWORKS - self.sriov.host_mgmt = {} - self.sriov.flavor = {} - self.sriov.configure_nics_for_sriov = mock.Mock(return_value="") - mock_libvirt.build_vm_xml = mock.Mock( - return_value=[6, "00:00:00:00:00:01"]) - self.sriov._enable_interfaces = mock.Mock(return_value="") - self.sriov.vnf_node.generate_vnf_instance = mock.Mock(return_value={}) - self.assertIsNotNone(self.sriov.setup_sriov_context()) + connection = mock.Mock() + self.sriov.connection = connection + self.sriov.host_mgmt = {'ip': '1.2.3.4'} + self.sriov.vm_flavor = 'flavor' + self.sriov.networks = 'networks' + self.sriov.configure_nics_for_sriov = mock.Mock() + cfg = '/tmp/vm_sriov_0.xml' + vm_name = 'vm_0' + xml_out = mock.Mock() + mock_build_vm_xml.return_value = (xml_out, '00:00:00:00:00:01') + + with mock.patch.object(self.sriov, 'vnf_node') as mock_vnf_node, \ + mock.patch.object(self.sriov, '_enable_interfaces'): + mock_vnf_node.generate_vnf_instance = mock.Mock( + return_value='node') + nodes_out = self.sriov.setup_sriov_context() + self.assertEqual(['node'], nodes_out) + mock_vnf_node.generate_vnf_instance.assert_called_once_with( + 'flavor', 'networks', '1.2.3.4', 'vnf_0', + self.sriov.servers['vnf_0'], '00:00:00:00:00:01') + mock_build_vm_xml.assert_called_once_with( + connection, 'flavor', vm_name, 0) + mock_create_vm.assert_called_once_with(connection, cfg) + mock_check.assert_called_once_with(vm_name, connection) + mock_write_file.assert_called_once_with(cfg, xml_out) def test__get_vf_data(self): with mock.patch("yardstick.ssh.SSH") as ssh: diff --git a/yardstick/tests/unit/benchmark/core/test_task.py b/yardstick/tests/unit/benchmark/core/test_task.py index 1ce30eacb..9e8e4e9f7 100644 --- a/yardstick/tests/unit/benchmark/core/test_task.py +++ b/yardstick/tests/unit/benchmark/core/test_task.py @@ -421,6 +421,34 @@ key2: self.parser._change_node_names(scenario, [my_context]) self.assertEqual(scenario, expected_scenario) + def test__change_node_names_options_empty(self): + ctx_attrs = { + 'name': 'demo', + 'task_id': '1234567890' + } + + my_context = dummy.DummyContext() + my_context.init(ctx_attrs) + scenario = copy.deepcopy(self.scenario) + scenario['options'] = None + + self.parser._change_node_names(scenario, [my_context]) + self.assertIsNone(scenario['options']) + + def test__change_node_names_options_server_name_empty(self): + ctx_attrs = { + 'name': 'demo', + 'task_id': '1234567890' + } + + my_context = dummy.DummyContext() + my_context.init(ctx_attrs) + scenario = copy.deepcopy(self.scenario) + scenario['options']['server_name'] = None + + self.parser._change_node_names(scenario, [my_context]) + self.assertIsNone(scenario['options']['server_name']) + def test__parse_tasks(self): task_obj = task.Task() _uuid = uuid.uuid4() diff --git a/yardstick/tests/unit/benchmark/scenarios/lib/test_create_floating_ip.py b/yardstick/tests/unit/benchmark/scenarios/lib/test_create_floating_ip.py index a7286f5da..894cc1c2a 100644 --- a/yardstick/tests/unit/benchmark/scenarios/lib/test_create_floating_ip.py +++ b/yardstick/tests/unit/benchmark/scenarios/lib/test_create_floating_ip.py @@ -11,48 +11,47 @@ import unittest import mock from yardstick.benchmark.scenarios.lib import create_floating_ip -import yardstick.common.openstack_utils as op_utils +from yardstick.common import openstack_utils +from yardstick.common import exceptions class CreateFloatingIpTestCase(unittest.TestCase): def setUp(self): - self._mock_get_network_id = mock.patch.object( - op_utils, 'get_network_id') - self.mock_get_network_id = self._mock_get_network_id.start() self._mock_create_floating_ip = mock.patch.object( - op_utils, 'create_floating_ip') + openstack_utils, 'create_floating_ip') self.mock_create_floating_ip = self._mock_create_floating_ip.start() - self._mock_get_neutron_client = mock.patch.object( - op_utils, 'get_neutron_client') - self.mock_get_neutron_client = self._mock_get_neutron_client.start() self._mock_get_shade_client = mock.patch.object( - op_utils, 'get_shade_client') + openstack_utils, 'get_shade_client') self.mock_get_shade_client = self._mock_get_shade_client.start() self._mock_log = mock.patch.object(create_floating_ip, 'LOG') self.mock_log = self._mock_log.start() + self.args = {'options': {'network_name_or_id': 'yardstick_net'}} + self.result = {} - self._fip_obj = create_floating_ip.CreateFloatingIp(mock.ANY, mock.ANY) - self._fip_obj.scenario_cfg = {'output': 'key1\nkey2'} + self.fip_obj = create_floating_ip.CreateFloatingIp(self.args, mock.ANY) + self.fip_obj.scenario_cfg = {'output': 'key1\nkey2'} self.addCleanup(self._stop_mock) def _stop_mock(self): - self._mock_get_network_id.stop() self._mock_create_floating_ip.stop() - self._mock_get_neutron_client.stop() self._mock_get_shade_client.stop() self._mock_log.stop() def test_run(self): self.mock_create_floating_ip.return_value = {'fip_id': 'value1', 'fip_addr': 'value2'} - output = self._fip_obj.run(mock.ANY) - self.assertDictEqual({'key1': 'value1', 'key2': 'value2'}, output) + output = self.fip_obj.run(self.result) + self.assertEqual({'floating_ip_create': 1}, self.result) + self.assertEqual({'key1': 'value1', 'key2': 'value2'}, output) + self.mock_log.info.asset_called_once_with( + 'Creating floating ip successful!') def test_run_no_fip(self): self.mock_create_floating_ip.return_value = None - output = self._fip_obj.run(mock.ANY) - self.assertIsNone(output) + with self.assertRaises(exceptions.ScenarioCreateFloatingIPError): + self.fip_obj.run(self.result) + self.assertEqual({'floating_ip_create': 0}, self.result) self.mock_log.error.assert_called_once_with( 'Creating floating ip failed!') diff --git a/yardstick/tests/unit/benchmark/scenarios/lib/test_create_router.py b/yardstick/tests/unit/benchmark/scenarios/lib/test_create_router.py index 3469a2a06..8d6f119ab 100644 --- a/yardstick/tests/unit/benchmark/scenarios/lib/test_create_router.py +++ b/yardstick/tests/unit/benchmark/scenarios/lib/test_create_router.py @@ -6,25 +6,52 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## + +from oslo_utils import uuidutils import unittest import mock -from yardstick.benchmark.scenarios.lib.create_router import CreateRouter +from yardstick.common import openstack_utils +from yardstick.common import exceptions +from yardstick.benchmark.scenarios.lib import create_router class CreateRouterTestCase(unittest.TestCase): - @mock.patch('yardstick.common.openstack_utils.get_neutron_client') - @mock.patch('yardstick.common.openstack_utils.create_neutron_router') - def test_create_router(self, mock_get_neutron_client, mock_create_neutron_router): - options = { - 'openstack_paras': { - 'admin_state_up': 'True', - 'name': 'yardstick_router' - } - } - args = {"options": options} - obj = CreateRouter(args, {}) - obj.run({}) - mock_get_neutron_client.assert_called_once() - mock_create_neutron_router.assert_called_once() + def setUp(self): + + self._mock_create_neutron_router = mock.patch.object( + openstack_utils, 'create_neutron_router') + self.mock_create_neutron_router = ( + self._mock_create_neutron_router.start()) + self._mock_get_shade_client = mock.patch.object( + openstack_utils, 'get_shade_client') + self.mock_get_shade_client = self._mock_get_shade_client.start() + self._mock_log = mock.patch.object(create_router, 'LOG') + self.mock_log = self._mock_log.start() + self.args = {'options': {'name': 'yardstick_net'}} + self.result = {} + + self.crouter_obj = create_router.CreateRouter(self.args, mock.ANY) + self.addCleanup(self._stop_mock) + + def _stop_mock(self): + self._mock_create_neutron_router.stop() + self._mock_get_shade_client.stop() + self._mock_log.stop() + + def test_run(self): + _uuid = uuidutils.generate_uuid() + self.crouter_obj.scenario_cfg = {'output': 'id'} + self.mock_create_neutron_router.return_value = _uuid + output = self.crouter_obj.run(self.result) + self.assertEqual({"router_create": 1}, self.result) + self.assertEqual({'id': _uuid}, output) + self.mock_log.info.asset_called_once_with('Create router successful!') + + def test_run_fail(self): + self.mock_create_neutron_router.return_value = None + with self.assertRaises(exceptions.ScenarioCreateRouterError): + self.crouter_obj.run(self.result) + self.assertEqual({"router_create": 0}, self.result) + self.mock_log.error.assert_called_once_with('Create router failed!') diff --git a/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py b/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py index 3185ec59f..45a39eba2 100644 --- a/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py +++ b/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py @@ -6,22 +6,50 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +from oslo_utils import uuidutils import unittest import mock -from yardstick.benchmark.scenarios.lib.delete_floating_ip import DeleteFloatingIp +from yardstick.common import openstack_utils +from yardstick.common import exceptions +from yardstick.benchmark.scenarios.lib import delete_floating_ip class DeleteFloatingIpTestCase(unittest.TestCase): - @mock.patch('yardstick.common.openstack_utils.get_nova_client') - @mock.patch('yardstick.common.openstack_utils.delete_floating_ip') - def test_delete_floating_ip(self, mock_get_nova_client, mock_delete_floating_ip): - options = { - 'floating_ip_id': '123-123-123' - } - args = {"options": options} - obj = DeleteFloatingIp(args, {}) - obj.run({}) - mock_get_nova_client.assert_called_once() - mock_delete_floating_ip.assert_called_once() + def setUp(self): + self._mock_delete_floating_ip = mock.patch.object( + openstack_utils, 'delete_floating_ip') + self.mock_delete_floating_ip = self._mock_delete_floating_ip.start() + self._mock_get_shade_client = mock.patch.object( + openstack_utils, 'get_shade_client') + self.mock_get_shade_client = self._mock_get_shade_client.start() + self._mock_log = mock.patch.object(delete_floating_ip, 'LOG') + self.mock_log = self._mock_log.start() + self.args = {'options': {'floating_ip_id': uuidutils.generate_uuid()}} + self.result = {} + + self.del_obj = delete_floating_ip.DeleteFloatingIp( + self.args, mock.ANY) + + self.addCleanup(self._stop_mock) + + def _stop_mock(self): + self._mock_delete_floating_ip.stop() + self._mock_get_shade_client.stop() + self._mock_log.stop() + + def test_run(self): + self.mock_delete_floating_ip.return_value = True + self.assertIsNone(self.del_obj.run(self.result)) + self.assertEqual({"delete_floating_ip": 1}, self.result) + self.mock_log.info.assert_called_once_with( + "Delete floating ip successful!") + + def test_run_fail(self): + self.mock_delete_floating_ip.return_value = False + with self.assertRaises(exceptions.ScenarioDeleteFloatingIPError): + self.del_obj.run(self.result) + self.assertEqual({"delete_floating_ip": 0}, self.result) + self.mock_log.error.assert_called_once_with( + "Delete floating ip failed!") diff --git a/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py b/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py index 9e9c5a5b6..823cb951a 100644 --- a/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py +++ b/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py @@ -6,23 +6,51 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## + +from oslo_utils import uuidutils import unittest import mock -from yardstick.benchmark.scenarios.lib.delete_router_interface import DeleteRouterInterface +from yardstick.benchmark.scenarios.lib import delete_router_interface +from yardstick.common import openstack_utils +from yardstick.common import exceptions class DeleteRouterInterfaceTestCase(unittest.TestCase): - @mock.patch('yardstick.common.openstack_utils.get_neutron_client') - @mock.patch('yardstick.common.openstack_utils.remove_interface_router') - def test_delete_router_interface(self, mock_get_neutron_client, mock_remove_interface_router): - options = { - 'router_id': '123-123-123', - 'subnet_id': '321-321-321' - } - args = {"options": options} - obj = DeleteRouterInterface(args, {}) - obj.run({}) - mock_get_neutron_client.assert_called_once() - mock_remove_interface_router.assert_called_once() + def setUp(self): + self._mock_remove_router_interface = mock.patch.object( + openstack_utils, 'remove_router_interface') + self.mock_remove_router_interface = ( + self._mock_remove_router_interface.start()) + self._mock_get_shade_client = mock.patch.object( + openstack_utils, 'get_shade_client') + self.mock_get_shade_client = self._mock_get_shade_client.start() + self._mock_log = mock.patch.object(delete_router_interface, 'LOG') + self.mock_log = self._mock_log.start() + self.args = {'options': {'router': uuidutils.generate_uuid()}} + self.result = {} + self.delrout_obj = delete_router_interface.DeleteRouterInterface( + self.args, mock.ANY) + + self.addCleanup(self._stop_mock) + + def _stop_mock(self): + self._mock_remove_router_interface.stop() + self._mock_get_shade_client.stop() + self._mock_log.stop() + + def test_run(self): + self.mock_remove_router_interface.return_value = True + self.assertIsNone(self.delrout_obj.run(self.result)) + self.assertEqual({"delete_router_interface": 1}, self.result) + self.mock_log.info.assert_called_once_with( + "Delete router interface successful!") + + def test_run_fail(self): + self.mock_remove_router_interface.return_value = False + with self.assertRaises(exceptions.ScenarioRemoveRouterIntError): + self.delrout_obj.run(self.result) + self.assertEqual({"delete_router_interface": 0}, self.result) + self.mock_log.error.assert_called_once_with( + "Delete router interface failed!") diff --git a/yardstick/tests/unit/benchmark/scenarios/test_base.py b/yardstick/tests/unit/benchmark/scenarios/test_base.py index 985338532..284a71cc8 100644 --- a/yardstick/tests/unit/benchmark/scenarios/test_base.py +++ b/yardstick/tests/unit/benchmark/scenarios/test_base.py @@ -13,10 +13,21 @@ # License for the specific language governing permissions and limitations # under the License. +import time + +import mock + from yardstick.benchmark.scenarios import base from yardstick.tests.unit import base as ut_base +class _TestScenario(base.Scenario): + __scenario_type__ = 'Test Scenario' + + def run(self): + pass + + class ScenarioTestCase(ut_base.BaseUnitTestCase): def test_get_scenario_type(self): @@ -85,6 +96,25 @@ class ScenarioTestCase(ut_base.BaseUnitTestCase): self.assertEqual('No such scenario type %s' % wrong_scenario_name, str(exc.exception)) + def test_scenario_abstract_class(self): + # pylint: disable=abstract-class-instantiated + with self.assertRaises(TypeError): + base.Scenario() + + @mock.patch.object(time, 'sleep') + def test_pre_run_wait_time(self, mock_sleep): + """Ensure default behaviour (backwards compatibility): no wait time""" + test_scenario = _TestScenario() + test_scenario.pre_run_wait_time(mock.ANY) + mock_sleep.assert_not_called() + + @mock.patch.object(time, 'sleep') + def test_post_run_wait_time(self, mock_sleep): + """Ensure default behaviour (backwards compatibility): wait time""" + test_scenario = _TestScenario() + test_scenario.post_run_wait_time(100) + mock_sleep.assert_called_once_with(100) + class IterScenarioClassesTestCase(ut_base.BaseUnitTestCase): diff --git a/yardstick/tests/unit/common/test_openstack_utils.py b/yardstick/tests/unit/common/test_openstack_utils.py index c6b0f46b2..b8f85c083 100644 --- a/yardstick/tests/unit/common/test_openstack_utils.py +++ b/yardstick/tests/unit/common/test_openstack_utils.py @@ -35,28 +35,6 @@ class GetHeatApiVersionTestCase(unittest.TestCase): self.assertEqual(api_version, expected_result) -class GetNetworkIdTestCase(unittest.TestCase): - - def test_get_network_id(self): - _uuid = uuidutils.generate_uuid() - mock_shade_client = mock.Mock() - mock_shade_client.list_networks = mock.Mock() - mock_shade_client.list_networks.return_value = [{'id': _uuid}] - - output = openstack_utils.get_network_id(mock_shade_client, - 'network_name') - self.assertEqual(_uuid, output) - - def test_get_network_id_no_network(self): - mock_shade_client = mock.Mock() - mock_shade_client.list_networks = mock.Mock() - mock_shade_client.list_networks.return_value = None - - output = openstack_utils.get_network_id(mock_shade_client, - 'network_name') - self.assertIsNone(output) - - class DeleteNeutronNetTestCase(unittest.TestCase): def setUp(self): @@ -161,3 +139,103 @@ class DeleteNeutronRouterTestCase(unittest.TestCase): 'router_id') mock_logger.error.assert_called_once() self.assertFalse(output) + + +class CreateNeutronRouterTestCase(unittest.TestCase): + + def setUp(self): + self.mock_shade_client = mock.Mock() + self.mock_shade_client.create_subnet = mock.Mock() + + def test_create_neutron_router(self): + _uuid = uuidutils.generate_uuid() + self.mock_shade_client.create_router.return_value = {'id': _uuid} + output = openstack_utils.create_neutron_router( + self.mock_shade_client) + self.assertEqual(_uuid, output) + + @mock.patch.object(openstack_utils, 'log') + def test_create_neutron_subnet_exception(self, mock_logger): + self.mock_shade_client.create_router.side_effect = ( + exc.OpenStackCloudException('error message')) + + output = openstack_utils.create_neutron_router( + self.mock_shade_client) + mock_logger.error.assert_called_once() + self.assertIsNone(output) + + +class RemoveRouterInterfaceTestCase(unittest.TestCase): + + def setUp(self): + self.mock_shade_client = mock.Mock() + self.router = 'router' + self.mock_shade_client.remove_router_interface = mock.Mock() + + def test_remove_router_interface(self): + self.mock_shade_client.remove_router_interface.return_value = True + output = openstack_utils.remove_router_interface( + self.mock_shade_client, self.router) + self.assertTrue(output) + + @mock.patch.object(openstack_utils, 'log') + def test_remove_router_interface_exception(self, mock_logger): + self.mock_shade_client.remove_router_interface.side_effect = ( + exc.OpenStackCloudException('error message')) + output = openstack_utils.remove_router_interface( + self.mock_shade_client, self.router) + mock_logger.error.assert_called_once() + self.assertFalse(output) + + +class CreateFloatingIpTestCase(unittest.TestCase): + + def setUp(self): + self.mock_shade_client = mock.Mock() + self.network_name_or_id = 'name' + self.mock_shade_client.create_floating_ip = mock.Mock() + + def test_create_floating_ip(self): + self.mock_shade_client.create_floating_ip.return_value = \ + {'floating_ip_address': 'value1', 'id': 'value2'} + output = openstack_utils.create_floating_ip(self.mock_shade_client, + self.network_name_or_id) + self.assertEqual({'fip_addr': 'value1', 'fip_id': 'value2'}, output) + + @mock.patch.object(openstack_utils, 'log') + def test_create_floating_ip_exception(self, mock_logger): + self.mock_shade_client.create_floating_ip.side_effect = ( + exc.OpenStackCloudException('error message')) + output = openstack_utils.create_floating_ip( + self.mock_shade_client, self.network_name_or_id) + mock_logger.error.assert_called_once() + self.assertIsNone(output) + + +class DeleteFloatingIpTestCase(unittest.TestCase): + + def setUp(self): + self.mock_shade_client = mock.Mock() + self.floating_ip_id = 'floating_ip_id' + self.mock_shade_client.delete_floating_ip = mock.Mock() + + def test_delete_floating_ip(self): + self.mock_shade_client.delete_floating_ip.return_value = True + output = openstack_utils.delete_floating_ip(self.mock_shade_client, + 'floating_ip_id') + self.assertTrue(output) + + def test_delete_floating_ip_fail(self): + self.mock_shade_client.delete_floating_ip.return_value = False + output = openstack_utils.delete_floating_ip(self.mock_shade_client, + 'floating_ip_id') + self.assertFalse(output) + + @mock.patch.object(openstack_utils, 'log') + def test_delete_floating_ip_exception(self, mock_logger): + self.mock_shade_client.delete_floating_ip.side_effect = ( + exc.OpenStackCloudException('error message')) + output = openstack_utils.delete_floating_ip(self.mock_shade_client, + 'floating_ip_id') + mock_logger.error.assert_called_once() + self.assertFalse(output) |