diff options
24 files changed, 494 insertions, 232 deletions
diff --git a/ci/build-vsperf.sh b/ci/build-vsperf.sh index 38fda03b..24fbb8fa 100755 --- a/ci/build-vsperf.sh +++ b/ci/build-vsperf.sh @@ -67,7 +67,7 @@ TEST_REPORT_PARTIAL="*_test_report.rst" TEST_REPORT_DIR="${WORKSPACE}/docs/results" TEST_REPORT_INDEX="${TEST_REPORT_DIR}/index.rst" TEST_REPORT_LINK_OLD="https://wiki.opnfv.org/wiki/vsperf_results" -TEST_REPORT_FILE="${WORKSPACE}/docs_output/results/results.pdf" +TEST_REPORT_FILE="${WORKSPACE}/docs_output/results/index.html" TEST_REPORT_TARBALL="vswitchperf_logs_${DATE}.tar.gz" if [[ "x${BRANCH}" == "xmaster" ]]; then @@ -170,8 +170,10 @@ function execute_vsperf() { LOG_SUBDIR="OvsDpdkVhost" LOG_FILE="${LOG_FILE_PREFIX}_${LOG_SUBDIR}_${DATE_SUFFIX}.log" + hugepages_info > $LOG_FILE echo " $VSPERF_BIN $OPNFVPOD --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES > $LOG_FILE" - $VSPERF_BIN $OPNFVPOD --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES &> $LOG_FILE + $VSPERF_BIN $OPNFVPOD --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES &>> $LOG_FILE + hugepages_info >> $LOG_FILE ;; esac @@ -239,9 +241,9 @@ function generate_report() { sed -ie 's,python ,python2 ,g' ./opnfvdocs/scripts/docs-build.sh OPNFVDOCS_DIR='./opnfvdocs' ./opnfvdocs/scripts/docs-build.sh &> /dev/null - # store PDF with test results into dedicated directory + # store HTML report with test results into dedicated directory if [ -f $TEST_REPORT_FILE ] ; then - cp -a $TEST_REPORT_FILE $TEST_REPORT_LOG_DIR + cp -ar $TEST_REPORT_FILE $(dirname $TEST_REPORT_FILE)/_static $TEST_REPORT_LOG_DIR echo "Final test report has been created." else echo "FAILURE: Generation of final test report has failed." @@ -319,7 +321,7 @@ function dependencies_check() { if [ $ID == "ubuntu" ] ; then echo "Dependencies check" echo "==================" - for PACKAGE in "python3-tk" ; do + for PACKAGE in "python3-tk" "sysstat" ; do if dpkg -s $PACKAGE &> /dev/null ; then printf " %-70s %-6s\n" $PACKAGE "OK" else @@ -331,6 +333,19 @@ function dependencies_check() { fi } +# configure hugepages +function configure_hugepages() { + sudo bash -c "echo 2048 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages" + sudo bash -c "echo 0 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages" +} + +# dump hugepages configuration +function hugepages_info() { + echo "-------------------------------------------------------------------" + head /sys/devices/system/node/node*/hugepages/hugepages*/* + echo "-------------------------------------------------------------------" +} + # # main # @@ -361,6 +376,9 @@ dependencies_check # initialization initialize_logdir +# configure hugepages +configure_hugepages + # execute job based on passed parameter case $1 in "verify") diff --git a/conf/02_vswitch.conf b/conf/02_vswitch.conf index f9b8f957..2b74dae9 100644 --- a/conf/02_vswitch.conf +++ b/conf/02_vswitch.conf @@ -23,11 +23,15 @@ OVS_CMD_TIMEOUT = 10 RTE_TARGET = 'x86_64-native-linuxapp-gcc' # list of NIC HWIDs to which traffic generator is connected -# In case of NIC with SRIOV suport, it is possible to define, +# e.g. WHITELIST_NICS = ['05:00.0', '05:00.1'] +# NIC HWIDs for given network device name can be retrieved +# by call of ehtool: +# e.g. ethtool -i eth0 +# In case of NIC with SRIOV support, it is possible to define, # which virtual function should be used # e.g. value '0000:05:00.0|vf1' will configure two VFs and second VF # will be used for testing -WHITELIST_NICS = ['0000:05:00.0', '0000:05:00.1'] +WHITELIST_NICS = [] # vhost character device file used by dpdkvhostport QemuWrap cases VHOST_DEV_FILE = 'ovs-vhost-net' diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index d7327629..87210b8d 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -40,6 +40,29 @@ TRAFFICGEN_RFC2544_TESTS = 1 TRAFFICGEN_RFC2889_TRIALS = 1 TRAFFICGEN_LOSSRATE = 0.0 +############################## +# DUMMY Configuration -- BEGIN + +# By default, dummy traffic generator asks for "measured" values. +# Following dictionary allows to preconfigure these values and +# to avoid user interaction. It can be useful for automated +# integration tests. +# Example of values for continuous traffic type: +# TRAFFICGEN_DUMMY_RESULTS{'frames rx': 500000, +# 'frames tx': 500000, +# 'rx rate %': 100, +# 'tx rate %': 100, +# 'frameloss %': 0, +# 'min latency': 1, +# 'max latency': 15, +# 'avg latency': 2.5, +# } +# +TRAFFICGEN_DUMMY_RESULTS = {} + +# DUMMY Configuration -- END +############################ + ############################# # IXIA Configuration -- BEGIN diff --git a/docs/configguide/installation.rst b/docs/configguide/installation.rst index 2f3faaeb..7ba64bba 100755 --- a/docs/configguide/installation.rst +++ b/docs/configguide/installation.rst @@ -13,7 +13,7 @@ Supported Operating Systems * Fedora 20 * Fedora 21 * Fedora 22 -* RedHat 7.2 +* RedHat 7.2 Enterprise * Ubuntu 14.04 Supported vSwitches @@ -99,8 +99,8 @@ reside in a directory called **vsperfenv** in $HOME. You will need to activate the virtual environment every time you start a new shell session. Its activation is specific to your OS: -CentOS 7 -======== +CentOS 7 and RedHat +=================== .. code:: bash @@ -108,8 +108,8 @@ CentOS 7 $ cd $HOME/vsperfenv $ source bin/activate -Fedora, RedHat and Ubuntu -========================= +Fedora and Ubuntu +================= .. code:: bash diff --git a/docs/configguide/trafficgen.rst b/docs/configguide/trafficgen.rst index 0431b34f..6d75a56f 100644 --- a/docs/configguide/trafficgen.rst +++ b/docs/configguide/trafficgen.rst @@ -443,23 +443,22 @@ https://github.com/emmericp/MoonGen * Note: Today, MoonGen with VSPERF only supports 10Gbps line speeds. -For VSPerf use, MoonGen should be cloned from here (as opposed to the previously -mentioned GitHub): +For VSPERF use, MoonGen should be cloned from here (as opposed to the +previously mentioned GitHub): -git clone https://github.com/atheurer/MoonGen +git clone https://github.com/atheurer/lua-trafficgen -and use the opnfv-stable branch: +and use the master branch: -git checkout opnfv-stable +git checkout master -VSPerf uses a particular example script under the examples directory within -the MoonGen project: +VSPERF uses a particular Lua script with the MoonGen project: -MoonGen/examples/opnfv-vsperf.lua +trafficgen.lua -Follow MoonGen set up instructions here: +Follow MoonGen set up and execution instructions here: -https://github.com/atheurer/MoonGen/blob/opnfv-stable/MoonGenSetUp.html +https://github.com/atheurer/lua-trafficgen/blob/master/README.md Note one will need to set up ssh login to not use passwords between the server running MoonGen and the device under test (running the VSPERF test diff --git a/docs/userguide/yardstick.rst b/docs/userguide/yardstick.rst index 18adbdbe..f118373b 100755 --- a/docs/userguide/yardstick.rst +++ b/docs/userguide/yardstick.rst @@ -34,16 +34,42 @@ Please note, that yardstick uses OpenStack for execution of testcases. OpenStack must be installed with Heat and Neutron services. Otherwise vswitchperf testcases cannot be executed. -Vswitchperf VM image preparation -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +VM image with vswitchperf +^^^^^^^^^^^^^^^^^^^^^^^^^ + +A special VM image is required for execution of vswitchperf specific testcases +by yardstick. It is possible to use a sample VM image available at OPNFV +artifactory or to build customized image. + +Sample VM image with vswitchperf +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sample VM image is available at vswitchperf section of OPNFV artifactory +for free download: + +.. code-block:: console + + $ wget http://artifacts.opnfv.org/vswitchperf/vnf/vsperf-yardstick-image.qcow2 + +This image can be used for execution of sample testcases with dummy traffic +generator. + +**NOTE:** Traffic generators might require an installation of client software. +This software is not included in the sample image and must be installed by user. + +**NOTE:** This image will be updated only in case, that new features related +to yardstick integration will be added to the vswitchperf. + +Preparation of custom VM image +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In general, any Linux distribution supported by vswitchperf can be used as a base image for vswitchperf. One of the possibilities is to modify vloop-vnf -image, which can be downloaded from `<http://artifacts.opnfv.org/>`__. +image, which can be downloaded from `<http://artifacts.opnfv.org/vswitchperf.html/>`__. .. code-block:: console - $ wget http://artifacts.opnfv.org/vswitchperf/vloop-vnf-ubuntu-14.04_20151216.qcow2 + $ wget http://artifacts.opnfv.org/vswitchperf/vnf/vloop-vnf-ubuntu-14.04_20160823.qcow2 Please follow the `installation instructions <http://artifacts.opnfv.org/vswitchperf/docs/configguide/installation.html>`__ to @@ -55,17 +81,52 @@ In case, that selected traffic generator requires installation of additional client software, please follow appropriate documentation. For example in case of IXIA, you would need to install IxOS and IxNetowrk TCL API. -Final image with vswitchperf must be uploaded into the glance service and +VM image usage +~~~~~~~~~~~~~~ + +Image with vswitchperf must be uploaded into the glance service and vswitchperf specific flavor configured, e.g.: .. code-block:: console - $ glance --os-username admin --os-image-api-version 1 image-create --name - vsperf --is-public true --disk-format qcow2 --container-format bare --file - image.qcow2 + $ glance --os-username admin --os-image-api-version 1 image-create --name \ + vsperf --is-public true --disk-format qcow2 --container-format bare --file \ + vsperf-yardstick-image.qcow2 $ nova --os-username admin flavor-create vsperf-flavor 100 2048 25 1 +Testcase execution +^^^^^^^^^^^^^^^^^^ + +After installation, yardstick is available as python package within yardstick +specific virtual environment. It means, that yardstick environment must be +enabled before the test execution, e.g.: + +.. code-block:: console + + source ~/yardstick_venv/bin/activate + + +Next step is configuration of OpenStack environment, e.g. in case of devstack: + +.. code-block:: console + + source /opt/openstack/devstack/openrc + export EXTERNAL_NETWORK=public + +Vswitchperf testcases executable by yardstick are located at vswitchperf +repository inside ``yardstick/tests`` directory. Example of their download +and execution follows: + +.. code-block:: console + + git clone https://gerrit.opnfv.org/gerrit/vswitchperf + cd vswitchperf + + yardstick -d task start yardstick/tests/rfc2544_throughput_dummy.yaml + +**NOTE:** Optional argument ``-d`` shows debug output. + Testcase customization ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,22 +145,22 @@ Example of yaml file: - type: Vsperf options: - testname: 'rfc2544_p2p_tput' + testname: 'p2p_rfc2544_throughput' traffic_type: 'rfc2544' - pkt_sizes: '64' + frame_size '64' bidirectional: 'True' iload: 100 - duration: 30 trafficgen_port1: 'eth1' trafficgen_port2: 'eth3' external_bridge: 'br-ex' - conf-file: '~/vsperf-yardstick.conf' + test_params: 'TRAFFICGEN_DURATION=30;' + conf_file: '~/vsperf-yardstick.conf' host: vsperf.demo runner: type: Sequence - scenario_option_name: pkt_sizes + scenario_option_name: frame_size sequence: - 64 - 128 @@ -123,22 +184,19 @@ argument. Following options are supported: - **traffic_type** - specifies the type of traffic executed by traffic generator; valid values are "rfc2544", "continuous" and "back2back"; Default: 'rfc2544' -- **pkt_sizes** - a packet size for which test should be executed; +- **frame_size** - a packet size for which test should be executed; Multiple packet sizes can be tested by modification of Sequence runner section inside YAML definition. Default: '64' -- **duration** - sets duration for which traffic will be generated; Default: 30 - **bidirectional** - specifies if traffic will be uni (False) or bi-directional (True); Default: False - **iload** - specifies frame rate; Default: 100 -- **rfc2544_tests** - specifies the number of tests performed for each packet - size - **multistream** - specifies the number of simulated streams; Default: 0 (i.e. multistream feature is disabled) - **stream_type** - specifies network layer used for multistream simulation the valid values are "L4", "L3" and "L2"; Default: 'L4' -- **conf-file** - sets path to the vswitchperf configuration file, which will be +- **conf_file** - sets path to the vswitchperf configuration file, which will be uploaded to VM; Default: '~/vsperf-yardstick.conf' -- **setup-script** - sets path to the setup script, which will be executed +- **setup_script** - sets path to the setup script, which will be executed during setup and teardown phases - **trafficgen_port1** - specifies device name of 1st interface connected to the trafficgen @@ -146,16 +204,27 @@ argument. Following options are supported: the trafficgen - **external_bridge** - specifies name of external bridge configured in OVS; Default: 'br-ex' +- **test_params** - specifies a string with a list of vsperf configuration + parameters, which will be passed to the ``--test-params`` CLI argument; + Parameters should be stated in the form of ``param=value`` and separated + by a semicolon. Please check VSPERF documentation for details about + available configuration parameters and their data types. + In case that both **test_params** and **conf_file** are specified, + then values from **test_params** will override values defined + in the configuration file. In case that **trafficgen_port1** and/or **trafficgen_port2** are defined, then these interfaces will be inserted into the **external_bridge** of OVS. It is expected, that OVS runs at the same node, where the testcase is executed. In case of more complex OpenStack installation or a need of additional OVS configuration, -**setup-script** can be used. +**setup_script** can be used. -Note: It is essential to prepare customized configuration file for the vsperf -and to specify its name by **conf-file** option. Config file must specify, which -traffic generator will be used and configure traffic generator specific options. +Note: It is essential to specify a configuration for selected traffic generator. +In case, that standalone testcase is created, then traffic generator can be +selected and configured directly in YAML file by **test_params**. On the other +hand, if multiple testcases should be executed with the same traffic generator +settings, then a customized configuration file should be prepared and its name +passed by **conf_file** option. Section runner ~~~~~~~~~~~~~~ @@ -163,7 +232,7 @@ Section runner Yardstick supports several `runner types <http://artifacts.opnfv.org/yardstick/docs/userguide/architecture.html#runner-types>`__. In case of vswitchperf specific TCs, **Sequence** runner type can be used to -execute the testcase for given list of packet sizes. +execute the testcase for given list of frame sizes. Section sla @@ -189,35 +258,3 @@ In case that any of defined metrics will be lower than defined value, then testcase will be marked as failed. Based on ``action`` policy, yardstick will either stop test execution (value ``assert``) or it will run next test (value ``monitor``). - -Testcase execution -^^^^^^^^^^^^^^^^^^ - -After installation, yardstick is available as python package within yardstick -specific virtual environment. It means, that before test execution yardstick -environment must be enabled, e.g.: - -.. code-block:: console - - source ~/yardstick_venv/bin/activate - - -Next step is configuration of OpenStack environment, e.g. in case of devstack: - -.. code-block:: console - - source /opt/openstack/devstack/openrc - export EXTERNAL_NETWORK=public - -Vswitchperf testcases executable by yardstick are located at vswitchperf -repository inside ``yardstick/tests`` directory. Example of their download -and execution follows: - -.. code-block:: console - - git clone https://gerrit.opnfv.org/gerrit/vswitchperf - cd vswitchperf - - yardstick -d task start yardstick/tests/p2p_cont.yaml - -Note: Optional argument ``-d`` shows debug output. diff --git a/fuel-plugin-vsperf/metadata.yaml b/fuel-plugin-vsperf/metadata.yaml index 2b28fc58..cf64e292 100644 --- a/fuel-plugin-vsperf/metadata.yaml +++ b/fuel-plugin-vsperf/metadata.yaml @@ -3,11 +3,11 @@ name: fuel-plugin-vsperf # Human-readable name for your plugin title: Enable VSPERF plugin # Plugin version -version: '1.0.9' +version: '1.0.10' # Description description: Deploy VSPERF code # Required fuel version -fuel_version: ['9.0'] +fuel_version: ['10.0'] # Specify license of your plugin licenses: ['Apache License Version 2.0'] # Specify author or company name @@ -21,7 +21,7 @@ groups: ['network'] # The plugin is compatible with releases in the list releases: - os: ubuntu - version: mitaka-9.0 + version: newton-10.0 mode: ['ha'] deployment_scripts_path: deployment_scripts/ repository_path: repositories/ubuntu diff --git a/src/dpdk/dpdk.py b/src/dpdk/dpdk.py index 16223915..0c5ed9f4 100644 --- a/src/dpdk/dpdk.py +++ b/src/dpdk/dpdk.py @@ -139,6 +139,9 @@ def _vhost_user_cleanup(): def _bind_nics(): """Bind NICs using the Intel DPDK ``dpdk*bind.py`` tool. """ + if not len(_NICS_PCI): + _LOGGER.info('NICs are not configured - nothing to bind') + return try: _driver = 'igb_uio' if 'vfio-pci' in S.getValue('TOOLS')['dpdk_modules']: @@ -151,7 +154,7 @@ def _bind_nics(): True) tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], - '--bind=' + _driver] + + '--bind=' + _driver] + _NICS_PCI, _LOGGER, 'Binding NICs %s...' % _NICS_PCI, True) @@ -161,6 +164,9 @@ def _bind_nics(): def _unbind_nics(): """Unbind NICs using the Intel DPDK ``dpdk*bind.py`` tool. """ + if not len(_NICS_PCI): + _LOGGER.info('NICs are not configured - nothing to unbind') + return try: tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], '--unbind'] + _NICS_PCI, _LOGGER, diff --git a/systems/centos/build_base_machine.sh b/systems/centos/build_base_machine.sh index d94dc975..5430ceba 100755 --- a/systems/centos/build_base_machine.sh +++ b/systems/centos/build_base_machine.sh @@ -69,8 +69,7 @@ epel-release " | grep -v ^#) # install SCL for python33 -wget https://www.softwarecollections.org/en/scls/rhscl/python33/epel-7-x86_64/download/rhscl-python33-epel-7-x86_64.noarch.rpm -rpm -i rhscl-python33-epel-7-x86_64.noarch.rpm +sudo yum -y install centos-release-scl # install python33 packages and git-review tool yum -y install $(echo " diff --git a/systems/rhel/7.2/build_base_machine.sh b/systems/rhel/7.2/build_base_machine.sh index 2319535b..9eb8bbd2 100755 --- a/systems/rhel/7.2/build_base_machine.sh +++ b/systems/rhel/7.2/build_base_machine.sh @@ -78,23 +78,28 @@ if [ "${#failedinstall[*]}" -gt 0 ]; then exit 1 fi -# python34 is not yet available to Red Hat customers so we will just build -# it as an alternate install in usr/local for use with VSPerf. This prevents -# any functionality issues with pre-installed packages using python. -wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tar.xz -tar -xf Python-3.4.2.tar.xz -cd Python-3.4.2 -./configure -make -make altinstall -cd .. +# install SCL for python33 by adding a repo to find its location to install it +cat <<'EOT' >> /etc/yum.repos.d/python33.repo +[rhscl-python33-el7] +name=Copr repo for python33-el7 owned by rhscl +baseurl=https://copr-be.cloud.fedoraproject.org/results/rhscl/python33-el7/epel-7-$basearch/ +type=rpm-md +skip_if_unavailable=True +gpgcheck=1 +gpgkey=https://copr-be.cloud.fedoraproject.org/results/rhscl/python33-el7/pubkey.gpg +repo_gpgcheck=0 +enabled=1 +enabled_metadata=1 +EOT -# cleanup -rm -Rf Python-3.4.2 -rm -f Python-3.4.2.tar.xz +# install python33 packages and git-review tool +yum -y install $(echo " +python33 +python33-python-tkinter +" | grep -v ^#) -# need virtualenv -pip3.4 install virtualenv +# cleanup python 33 repo file +rm -f /etc/yum.repos.d/python33.repo # Create hugepage dirs mkdir -p /dev/hugepages diff --git a/systems/rhel/7.2/prepare_python_env.sh b/systems/rhel/7.2/prepare_python_env.sh index 1d51380a..bd468d80 100755 --- a/systems/rhel/7.2/prepare_python_env.sh +++ b/systems/rhel/7.2/prepare_python_env.sh @@ -17,18 +17,13 @@ # limitations under the License. if [ -d "$VSPERFENV_DIR" ] ; then - echo "Directory $VSPERFENV_DIR already exists. Skipping python virtualenv \ -creation." + echo "Directory $VSPERFENV_DIR already exists. Skipping python virtualenv creation." exit fi -# enable virtual environment in a subshell, so QEMU build can use python 2.7 -# Also make sure we know which virtualenv was installed. I've seen the file -# name change pending on what type of installation was done. -virtualenv_file=$(ls /usr/local/bin | awk '/virtualenv/') - -($virtualenv_file "$VSPERFENV_DIR" +scl enable python33 " +virtualenv "$VSPERFENV_DIR" source "$VSPERFENV_DIR"/bin/activate -pip3.4 install -r ../requirements.txt -pip3.4 install pylint -)
\ No newline at end of file +pip install -r ../requirements.txt +pip install pylint +"
\ No newline at end of file diff --git a/testcases/integration.py b/testcases/integration.py index 4b9dacfd..f2a5fecf 100644 --- a/testcases/integration.py +++ b/testcases/integration.py @@ -14,19 +14,10 @@ """IntegrationTestCase class """ -import os -import time import logging -import copy -import re from collections import OrderedDict from testcases import TestCase -from conf import settings as S -from tools import namespace -from tools import veth -from tools.teststepstools import TestStepsTools -from core.loader import Loader class IntegrationTestCase(TestCase): """IntegrationTestCase class diff --git a/testcases/testcase.py b/testcases/testcase.py index 01a07391..18ad4240 100644 --- a/testcases/testcase.py +++ b/testcases/testcase.py @@ -32,6 +32,9 @@ from core.results.results_constants import ResultsConstants from tools import tasks from tools import hugepages from tools import functions +from tools import namespace +from tools import veth +from tools.teststepstools import TestStepsTools from tools.pkt_gen.trafficgen.trafficgenhelper import TRAFFIC_DEFAULTS CHECK_PREFIX = 'validate_' @@ -176,7 +179,9 @@ class TestCase(object): self._traffic['l2'] = S.getValue(self._tunnel_type.upper() + '_FRAME_L2') self._traffic['l3'] = S.getValue(self._tunnel_type.upper() + '_FRAME_L3') self._traffic['l4'] = S.getValue(self._tunnel_type.upper() + '_FRAME_L4') - elif S.getValue('NICS')[0]['type'] == 'vf' or S.getValue('NICS')[1]['type'] == 'vf': + elif len(S.getValue('NICS')) and \ + (S.getValue('NICS')[0]['type'] == 'vf' or + S.getValue('NICS')[1]['type'] == 'vf'): mac1 = S.getValue('NICS')[0]['mac'] mac2 = S.getValue('NICS')[1]['mac'] if mac1 and mac2: @@ -278,22 +283,20 @@ class TestCase(object): # cleanup any namespaces created if os.path.isdir('/tmp/namespaces'): - import tools.namespace namespace_list = os.listdir('/tmp/namespaces') if len(namespace_list): self._logger.info('Cleaning up namespaces') for name in namespace_list: - tools.namespace.delete_namespace(name) + namespace.delete_namespace(name) os.rmdir('/tmp/namespaces') # cleanup any veth ports created if os.path.isdir('/tmp/veth'): - import tools.veth veth_list = os.listdir('/tmp/veth') if len(veth_list): self._logger.info('Cleaning up veth ports') for eth in veth_list: port1, port2 = eth.split('-') - tools.veth.del_veth_port(port1, port2) + veth.del_veth_port(port1, port2) os.rmdir('/tmp/veth') def run_report(self): diff --git a/tools/pkt_gen/dummy/dummy.py b/tools/pkt_gen/dummy/dummy.py index 3324824c..528b5902 100755 --- a/tools/pkt_gen/dummy/dummy.py +++ b/tools/pkt_gen/dummy/dummy.py @@ -25,6 +25,7 @@ own. import json +from conf import settings from tools.pkt_gen import trafficgen from core.results.results_constants import ResultsConstants @@ -76,7 +77,10 @@ def get_user_traffic(traffic_type, traffic_conf, flow_conf, traffic_stats): % (traffic_type, traffic_conf, json.dumps(flow_conf, indent=4))) for stat in traffic_stats: - results.append(_get_user_traffic_stat(stat)) + if stat in settings.getValue('TRAFFICGEN_DUMMY_RESULTS'): + results.append(settings.getValue('TRAFFICGEN_DUMMY_RESULTS')[stat]) + else: + results.append(_get_user_traffic_stat(stat)) return results @@ -206,6 +210,33 @@ class Dummy(trafficgen.ITrafficGenerator): result[ResultsConstants.FRAME_LOSS_PERCENT] = float(results[7]) return result + def send_rfc2544_back2back(self, traffic=None, tests=1, duration=2, + lossrate=0.0): + """ + Send traffic per RFC2544 back2back test specifications. + """ + traffic_ = self.traffic_defaults.copy() + result = {} + + if traffic: + traffic_ = trafficgen.merge_spec(traffic_, traffic) + + results = get_user_traffic( + 'back2back', + '%d tests, %d seconds iterations, %f packet loss, multistream ' + '%s' % (tests, duration, lossrate, traffic['multistream']), + traffic_, + ('b2b frames', 'b2b frame loss %')) + + framesize = traffic_['l2']['framesize'] + + # builds results by using user-supplied values + # and guessing remainder using available info + result[ResultsConstants.B2B_FRAMES] = float(results[0]) + result[ResultsConstants.B2B_FRAME_LOSS_PERCENT] = float(results[1]) + return result + + if __name__ == '__main__': TRAFFIC = { @@ -219,4 +250,6 @@ if __name__ == '__main__': with Dummy() as dev: print(dev.send_burst_traffic(traffic=TRAFFIC)) print(dev.send_cont_traffic(traffic=TRAFFIC)) + print(dev.send_rfc2544_throughput(traffic=TRAFFIC)) + print(dev.send_rfc2544_back2back(traffic=TRAFFIC)) print(dev.send_rfc(traffic=TRAFFIC)) diff --git a/tools/pkt_gen/moongen/moongen.py b/tools/pkt_gen/moongen/moongen.py index fe3aca52..7fd67661 100644 --- a/tools/pkt_gen/moongen/moongen.py +++ b/tools/pkt_gen/moongen/moongen.py @@ -222,7 +222,7 @@ class Moongen(ITrafficGenerator): "@" + self._moongen_host_ip_addr cmd_find_moongen = connect_moongen + " ls " + \ - self._moongen_base_dir + "/examples/opnfv-vsperf.lua" + self._moongen_base_dir + "/trafficgen.lua" find_moongen = subprocess.Popen(cmd_find_moongen, shell=True, @@ -367,7 +367,7 @@ class Moongen(ITrafficGenerator): self._moongen_host_ip_addr cmd_moongen = " 'cd " + self._moongen_base_dir + \ - "; ./build/MoonGen examples/opnfv-vsperf.lua | tee moongen_log.txt'" + "; ./MoonGen/build/MoonGen trafficgen.lua | tee moongen_log.txt'" cmd_start_moongen = connect_moongen + cmd_moongen diff --git a/tools/pkt_gen/xena/XenaDriver.py b/tools/pkt_gen/xena/XenaDriver.py index d3862312..04a99e9d 100644 --- a/tools/pkt_gen/xena/XenaDriver.py +++ b/tools/pkt_gen/xena/XenaDriver.py @@ -61,6 +61,10 @@ CMD_RESERVE = 'p_reservation reserve' CMD_RELEASE = 'p_reservation release' CMD_RELINQUISH = 'p_reservation relinquish' CMD_RESET = 'p_reset' +CMD_SET_PORT_ARP_REPLY = 'p_arpreply' +CMD_SET_PORT_ARP_V6_REPLY = 'p_arpv6reply' +CMD_SET_PORT_PING_REPLY = 'p_pingreply' +CMD_SET_PORT_PING_V6_REPLY = 'p_pingv6reply' CMD_SET_PORT_TIME_LIMIT = 'p_txtimelimit' CMD_SET_STREAM_HEADER_PROTOCOL = 'ps_headerprotocol' CMD_SET_STREAM_ON_OFF = 'ps_enable' @@ -532,6 +536,30 @@ class XenaPort(object): command = make_port_command(CMD_RESET, self) return self._manager.driver.ask_verify(command) + def set_port_arp_reply(self, on=True, v6=False): + """ + Set the port arpreply value + :param on: Enable or disable the arp reply on the port + :param v6: set the value on the ip v6, disabled will set at ip v4 + :return: Boolean True if response OK, False if error + """ + command = make_port_command('{} {}'.format( + CMD_SET_PORT_ARP_V6_REPLY if v6 else CMD_SET_PORT_ARP_REPLY, + "on" if on else "off"), self) + return self._manager.driver.ask_verify(command) + + def set_port_ping_reply(self, on=True, v6=False): + """ + Set the port ping reply value + :param on: Enable or disable the ping reply on the port + :param v6: set the value on the ip v6, disabled will set at ip v4 + :return: Boolean True if response OK, False if error + """ + command = make_port_command('{} {}'.format( + CMD_SET_PORT_PING_V6_REPLY if v6 else CMD_SET_PORT_PING_REPLY, + "on" if on else "off"), self) + return self._manager.driver.ask_verify(command) + def set_port_ip(self, ip_addr, cidr, gateway, wild='255'): """ Set the port ip address of the specific port diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py index 8d45053e..798bb832 100755 --- a/tools/pkt_gen/xena/xena.py +++ b/tools/pkt_gen/xena/xena.py @@ -421,7 +421,20 @@ class Xena(ITrafficGenerator): :return: None """ stream.set_on() - stream.set_packet_limit(packet_limit) + if packet_limit != -1: + stream.set_packet_limit(packet_limit) + else: + speed = port.get_port_speed() / 8 # convert to bytes + gap = port.get_inter_frame_gap() + pkt_size = self._params['traffic']['l2']['framesize'] + packets = int(((speed / (pkt_size + gap)) * self._duration) * + (self._params['traffic']['frame_rate'] / 100)) + stream.set_packet_limit(packets) + + port.set_port_arp_reply(on=True) + port.set_port_arp_reply(on=True, v6=True) + port.set_port_ping_reply(on=True) + port.set_port_ping_reply(on=True, v6=True) stream.set_rate_fraction( 10000 * self._params['traffic']['frame_rate']) @@ -431,10 +444,11 @@ class Xena(ITrafficGenerator): 'ETHERNET VLAN IP UDP' if self._params['traffic']['vlan'][ 'enabled'] else 'ETHERNET IP UDP') stream.set_packet_length( - 'fixed', self._params['traffic']['l2']['framesize'], 16383) + 'fixed', self._params['traffic']['l2']['framesize'], + self._params['traffic']['l2']['framesize']) stream.set_packet_payload('incrementing', '0x00') stream.set_payload_id(payload_id) - port.set_port_time_limit(self._duration * 1000000) + port.set_port_time_limit(0) if self._params['traffic']['l2']['framesize'] == 64: # set micro tpld @@ -459,7 +473,7 @@ class Xena(ITrafficGenerator): if not self.xmanager.ports[1].traffic_on(): self._logger.error( "Failure to start port 1. Check settings and retry.") - sleep(self._duration) + sleep(self._duration + 1) # getting results if self._params['traffic']['bidir'] == 'True': # need to aggregate out both ports stats and assign that data diff --git a/tools/report/report.jinja b/tools/report/report.jinja index 8354835c..c9588565 100644 --- a/tools/report/report.jinja +++ b/tools/report/report.jinja @@ -138,7 +138,6 @@ The following are the metrics obtained during this test: The following system statistics were collected during testcase execution: {% for process in test.stats %} -| --------------------------------------------------------------- | | Process: {{ "%-54s |"|format('_'.join(process.split('_')[:-1])) }} | ------------------------------ | ------------------------------ | | Statistic | Value | @@ -504,8 +504,11 @@ def main(): # than both a settings file and environment variables settings.load_from_dict(args) + settings.setValue('mode', args['mode']) + # set dpdk and ovs paths accorfing to VNF and VSWITCH - functions.settings_update_paths() + if settings.getValue('mode') != 'trafficgen': + functions.settings_update_paths() # if required, handle list-* operations handle_list_options(args) @@ -584,8 +587,6 @@ def main(): # for backward compatibility settings.setValue('WHITELIST_NICS', list(nic['pci'] for nic in nic_list)) - settings.setValue('mode', args['mode']) - # generate results directory name date = datetime.datetime.fromtimestamp(time.time()) results_dir = "results_" + date.strftime('%Y-%m-%d_%H-%M-%S') diff --git a/yardstick/tests/p2p_cont.yaml b/yardstick/tests/p2p_cont.yaml deleted file mode 100644 index 5cd63793..00000000 --- a/yardstick/tests/p2p_cont.yaml +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2016 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. - -# VSPERF specific configuration file for execution of continuous traffic. -# Traffic executed by traffic generator is forwarded directly between -# interfaces connected to the traffic generator. So test will only -# benchmark the performance of OVS external bridge at controller node. -# For details about supported test options see following file from -# the yardstick repository: -# -# yardstick/benchmark/scenarios/networking/vsperf.py - -schema: "yardstick:task:0.1" - -scenarios: -- - type: Vsperf - options: - testname: 'rfc2544_p2p_continuous' - traffic_type: 'continuous' - pkt_sizes: '64' - bidirectional: 'True' - iload: 100 - duration: 30 - trafficgen_port1: 'eth1' - trafficgen_port2: 'eth3' - external_bridge: 'br-ex' - conf-file: '~/vsperf-yardstick.conf' - - host: vsperf.demo - - runner: - type: Sequence - scenario_option_name: pkt_sizes - sequence: - - 64 - - 128 - - 512 - - 1024 - - 1518 - sla: - metrics: 'throughput_rx_fps' - throughput_rx_fps: 500000 - action: monitor - -context: - name: demo - image: vsperf - flavor: vsperf-flavor - user: ubuntu - - placement_groups: - pgrp1: - policy: "availability" - - servers: - vsperf: - floating_ip: true - placement: "pgrp1" - - networks: - test: - cidr: '10.0.0.0/24' diff --git a/yardstick/tests/p2p_tput.yaml b/yardstick/tests/p2p_rfc2544_throughput_sample.yaml index 7a172450..b633732b 100644 --- a/yardstick/tests/p2p_tput.yaml +++ b/yardstick/tests/p2p_rfc2544_throughput_sample.yaml @@ -16,10 +16,10 @@ # traffic. Traffic executed by traffic generator is forwarded directly # between interfaces connected to the traffic generator. So test will only # benchmark the performance of OVS external bridge at controller node. -# For details about supported test options see following file from -# the yardstick repository: +# Details about supported test options and test case execution can be +# found in VSPERF documentation: # -# yardstick/benchmark/scenarios/networking/vsperf.py +# http://artifacts.opnfv.org/vswitchperf/docs/userguide/yardstick.html schema: "yardstick:task:0.1" @@ -27,22 +27,22 @@ scenarios: - type: Vsperf options: - testname: 'rfc2544_p2p_tput' + testname: 'p2p_rfc2544_throughput' traffic_type: 'rfc2544' - pkt_sizes: '64' + frame_size: '64' bidirectional: 'True' iload: 100 - duration: 30 + test_params: 'TRAFFICGEN_DURATION=30;' trafficgen_port1: 'eth1' trafficgen_port2: 'eth3' external_bridge: 'br-ex' - conf-file: '~/vsperf-yardstick.conf' + conf_file: '~/vsperf-yardstick.conf' host: vsperf.demo runner: type: Sequence - scenario_option_name: pkt_sizes + scenario_option_name: frame_size sequence: - 64 - 128 @@ -50,6 +50,10 @@ scenarios: - 1024 - 1518 sla: + # The throughput SLA (or any other SLA) cannot be set to a meaningful + # value without knowledge of the server and networking environment, + # possibly including prior testing in that environment to establish + # a baseline SLA level under well-understood circumstances. metrics: 'throughput_rx_fps' throughput_rx_fps: 500000 action: monitor diff --git a/yardstick/tests/p2p_back2back.yaml b/yardstick/tests/rfc2544_back2back_dummy.yaml index 39ab03e1..a3265c52 100644 --- a/yardstick/tests/p2p_back2back.yaml +++ b/yardstick/tests/rfc2544_back2back_dummy.yaml @@ -12,14 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -# VSPERF specific configuration file for execution of back2back traffic. -# Traffic executed by traffic generator is forwarded directly between -# interfaces connected to the traffic generator. So test will only -# benchmark the performance of OVS external bridge at controller node. -# For details about supported test options see following file from -# the yardstick repository: +# VSPERF specific configuration file for execution of RFC2544 back2back +# traffic. +# This test uses a dummy traffic generator, which does not execute a real +# traffic. The purpose of this test is to demonstrate vsperf execution +# by yardstick environment. Provided 'test_params' option can modified +# to use a real traffic generator. +# Details about supported test options and test case execution can be +# found in VSPERF documentation: # -# yardstick/benchmark/scenarios/networking/vsperf.py +# http://artifacts.opnfv.org/vswitchperf/docs/userguide/yardstick.html schema: "yardstick:task:0.1" @@ -27,22 +29,21 @@ scenarios: - type: Vsperf options: - testname: 'rfc2544_p2p_back2back' + testname: 'rfc2544_back2back' traffic_type: 'back2back' - pkt_sizes: '64' + frame_size: '64' bidirectional: 'True' iload: 100 - duration: 30 - trafficgen_port1: 'eth1' - trafficgen_port2: 'eth3' - external_bridge: 'br-ex' - conf-file: '~/vsperf-yardstick.conf' + test_params: 'TRAFFICGEN="Dummy"; + TRAFFICGEN_DUMMY_RESULTS={ + "b2b frames":"10000", + "b2b frame loss %":"0.0"}' host: vsperf.demo runner: type: Sequence - scenario_option_name: pkt_sizes + scenario_option_name: frame_size sequence: - 64 - 128 @@ -50,6 +51,10 @@ scenarios: - 1024 - 1518 sla: + # The throughput SLA (or any other SLA) cannot be set to a meaningful + # value without knowledge of the server and networking environment, + # possibly including prior testing in that environment to establish + # a baseline SLA level under well-understood circumstances. metrics: 'b2b_frames' b2b_frames: 1 action: monitor diff --git a/yardstick/tests/rfc2544_continuous_dummy.yaml b/yardstick/tests/rfc2544_continuous_dummy.yaml new file mode 100644 index 00000000..fea0af3f --- /dev/null +++ b/yardstick/tests/rfc2544_continuous_dummy.yaml @@ -0,0 +1,86 @@ +# Copyright 2016 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. + +# VSPERF specific configuration file for execution of RFC2544 continuous +# traffic. +# This test uses a dummy traffic generator, which does not execute a real +# traffic. The purpose of this test is to demonstrate vsperf execution +# by yardstick environment. Provided 'test_params' option can modified +# to use a real traffic generator. +# Details about supported test options and test case execution can be +# found in VSPERF documentation: +# +# http://artifacts.opnfv.org/vswitchperf/docs/userguide/yardstick.html + +schema: "yardstick:task:0.1" + +scenarios: +- + type: Vsperf + options: + testname: 'rfc2544_continuous' + traffic_type: 'continuous' + frame_size: '64' + bidirectional: 'True' + iload: 100 + test_params: 'TRAFFICGEN_DURATION=30; + TRAFFICGEN="Dummy"; + TRAFFICGEN_DUMMY_RESULTS={ + "frames tx":15000000, + "frames rx":15000000, + "tx rate %":100, + "rx rate %":100, + "min latency":1, + "max latency":15, + "avg latency":2.5, + "frameloss %":0,}' + + host: vsperf.demo + + runner: + type: Sequence + scenario_option_name: frame_size + sequence: + - 64 + - 128 + - 512 + - 1024 + - 1518 + sla: + # The throughput SLA (or any other SLA) cannot be set to a meaningful + # value without knowledge of the server and networking environment, + # possibly including prior testing in that environment to establish + # a baseline SLA level under well-understood circumstances. + metrics: 'throughput_rx_fps' + throughput_rx_fps: 500000 + action: monitor + +context: + name: demo + image: vsperf + flavor: vsperf-flavor + user: ubuntu + + placement_groups: + pgrp1: + policy: "availability" + + servers: + vsperf: + floating_ip: true + placement: "pgrp1" + + networks: + test: + cidr: '10.0.0.0/24' diff --git a/yardstick/tests/rfc2544_throughput_dummy.yaml b/yardstick/tests/rfc2544_throughput_dummy.yaml new file mode 100644 index 00000000..81755c50 --- /dev/null +++ b/yardstick/tests/rfc2544_throughput_dummy.yaml @@ -0,0 +1,86 @@ +# Copyright 2016 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. + +# VSPERF specific configuration file for execution of RFC2544 throughput +# traffic. +# This test uses a dummy traffic generator, which does not execute a real +# traffic. The purpose of this test is to demonstrate vsperf execution +# by yardstick environment. Provided 'test_params' option can modified +# to use a real traffic generator. +# Details about supported test options and test case execution can be +# found in VSPERF documentation: +# +# http://artifacts.opnfv.org/vswitchperf/docs/userguide/yardstick.html + +schema: "yardstick:task:0.1" + +scenarios: +- + type: Vsperf + options: + testname: 'rfc2544_throughput' + traffic_type: 'rfc2544' + frame_size: '64' + bidirectional: 'True' + iload: 100 + test_params: 'TRAFFICGEN_DURATION=30; + TRAFFICGEN="Dummy"; + TRAFFICGEN_DUMMY_RESULTS={ + "frames tx":15000000, + "frames rx":15000000, + "tx rate %":100, + "rx rate %":100, + "min latency":1, + "max latency":15, + "avg latency":2.5, + "frameloss %":0,}' + + host: vsperf.demo + + runner: + type: Sequence + scenario_option_name: frame_size + sequence: + - 64 + - 128 + - 512 + - 1024 + - 1518 + sla: + # The throughput SLA (or any other SLA) cannot be set to a meaningful + # value without knowledge of the server and networking environment, + # possibly including prior testing in that environment to establish + # a baseline SLA level under well-understood circumstances. + metrics: 'throughput_rx_fps' + throughput_rx_fps: 500000 + action: monitor + +context: + name: demo + image: vsperf + flavor: vsperf-flavor + user: ubuntu + + placement_groups: + pgrp1: + policy: "availability" + + servers: + vsperf: + floating_ip: true + placement: "pgrp1" + + networks: + test: + cidr: '10.0.0.0/24' |