summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/README27
-rw-r--r--tools/cover.awk25
-rw-r--r--tools/cover.sh118
-rw-r--r--tools/dpdk_install.yml140
-rw-r--r--tools/os-requirements-check.py112
-rwxr-xr-xtools/run_tests.sh92
-rwxr-xr-xtools/ubuntu-server-cloudimg-dpdk-modify.sh143
-rwxr-xr-xtools/ubuntu-server-cloudimg-modify.sh94
-rw-r--r--tools/vnftest-img-dpdk-finalize.sh57
-rw-r--r--tools/vnftest-img-dpdk-modify169
-rwxr-xr-xtools/vnftest-img-lxd-modify143
-rwxr-xr-xtools/vnftest-img-modify191
-rwxr-xr-xtools/vsperf-img-finalize.sh58
-rwxr-xr-xtools/vsperf-img-modify.sh81
-rw-r--r--tools/vsperf_install.yml133
15 files changed, 1583 insertions, 0 deletions
diff --git a/tools/README b/tools/README
new file mode 100644
index 0000000..0edcf2d
--- /dev/null
+++ b/tools/README
@@ -0,0 +1,27 @@
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/README
+
+This directory contains various utilities needed in the vnftest environment.
+
+vnftest-img-modify is a generic script (but ubuntu cloud image specific) that
+takes a another script as an argument. This second script does the actual
+modifications of the image. sudo is required since the base image is mounted
+using qemu's network block device support.
+
+Usage example:
+
+$ sudo vnftest-img-modify $HOME/vnftest/tools/ubuntu-server-cloudimg-modify.sh
+
diff --git a/tools/cover.awk b/tools/cover.awk
new file mode 100644
index 0000000..e4bb816
--- /dev/null
+++ b/tools/cover.awk
@@ -0,0 +1,25 @@
+BEGIN{
+ template = "%6s %-75s\n"
+ printf template, "Delta", "Module Path"
+}
+
+/^-/{
+ s = substr($1, 2)
+ x[s] = $3;
+};
+
+/^+/{
+ s = substr($1, 2)
+ d = $3
+ if (s in x)
+ d = d - x[s]
+ y[s" "d] = d
+}
+
+END{
+ asorti(y, z1, "@val_num_asc")
+ for (i=1; i <= length(z1); i++){
+ split(z1[i], z2, " ")
+ printf template, z2[2], z2[1]
+ }
+}
diff --git a/tools/cover.sh b/tools/cover.sh
new file mode 100644
index 0000000..8acfb56
--- /dev/null
+++ b/tools/cover.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/cover.sh
+
+if [[ -n $COVER_DIR_NAME ]]; then
+ :
+elif [[ -n $_ ]]; then
+ COVER_DIR_NAME=$( dirname $_ )
+else
+ COVER_DIR_NAME=$( dirname $0 )
+fi
+
+show_diff () {
+ diff -U 0 $1 $2 | awk -f $COVER_DIR_NAME/cover.awk
+}
+
+run_coverage_test() {
+
+ ALLOWED_EXTRA_MISSING=10
+ # enable debugging
+ set -x
+
+ # Stash uncommitted changes, checkout master and save coverage report
+ uncommited=$(git status --porcelain | grep -v "^??")
+ [[ -n ${uncommited} ]] && git stash > /dev/null
+ git checkout HEAD^
+
+ baseline_report=$(mktemp -t vnftest_coverageXXXXXXX)
+
+ find . -type f -name "*.pyc" -delete
+
+ # Temporarily run tests from two directories, until all tests have moved
+ coverage run -p -m unittest discover ./tests/unit
+ coverage run -p -m unittest discover ./vnftest/tests/unit
+ coverage combine
+
+ # Temporarily omit vnftest/tests from the report
+ coverage report --omit=vnftest/tests/*/* > ${baseline_report}
+ coverage erase
+
+ # debug awk
+ tail -1 ${baseline_report}
+ baseline_missing=$(awk 'END { if (int($3) > 0) print $3 }' ${baseline_report})
+
+ if [[ -z $baseline_missing ]]; then
+ echo "Failed to determine baseline missing"
+ exit 1
+ fi
+
+ # Checkout back and unstash uncommitted changes (if any)
+ git checkout -
+ [[ -n ${uncommited} ]] && git stash pop > /dev/null
+
+ # Generate and save coverage report
+ current_report=$(mktemp -t vnftest_coverageXXXXXXX)
+
+ find . -type f -name "*.pyc" -delete
+
+ # Temporarily run tests from two directories, until all tests have moved
+ coverage run -p -m unittest discover ./tests/unit
+ coverage run -p -m unittest discover ./vnftest/tests/unit
+ coverage combine
+
+ # Temporarily omit vnftest/tests from the report
+ coverage report --omit=vnftest/tests/*/* > ${current_report}
+ coverage erase
+
+ rm -rf cover-$PY_VER
+ coverage html -d cover-$PY_VER
+
+ # debug awk
+ tail -1 ${current_report}
+ current_missing=$(awk 'END { if (int($3) > 0) print $3 }' ${current_report})
+
+ if [[ -z $current_missing ]]; then
+ echo "Failed to determine current missing"
+ exit 1
+ fi
+
+ # Show coverage details
+ new_missing=$((current_missing - baseline_missing))
+
+ echo "Missing lines allowed to introduce : ${ALLOWED_EXTRA_MISSING}"
+ echo "Missing lines introduced : ${new_missing}"
+ echo "Missing lines in master : ${baseline_missing}"
+ echo "Missing lines in proposed change : ${current_missing}"
+
+ if [[ ${new_missing} -gt ${ALLOWED_EXTRA_MISSING} ]];
+ then
+ show_diff ${baseline_report} ${current_report}
+ echo "Please write more unit tests, we should keep our test coverage :( "
+ rm ${baseline_report} ${current_report}
+ exit 1
+
+ elif [[ ${new_missing} -gt 0 ]];
+ then
+ show_diff ${baseline_report} ${current_report}
+ echo "I believe you can cover all your code with 100% coverage!"
+
+ else
+ echo "Thank you! You are awesome! Keep writing unit tests! :)"
+ fi
+
+ rm ${baseline_report} ${current_report}
+}
diff --git a/tools/dpdk_install.yml b/tools/dpdk_install.yml
new file mode 100644
index 0000000..09898fd
--- /dev/null
+++ b/tools/dpdk_install.yml
@@ -0,0 +1,140 @@
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/dpdk_install.yml
+
+heat_template_version: 2015-04-30
+
+description: >
+ Used to run VMs with DPDK pktgen
+
+parameters:
+ image:
+ type: string
+ description: Name of the image
+ default: vnftest-wily-server
+
+ timeout:
+ type: number
+ description: Timeout in seconds for WaitCondition, depends on your image and environment
+ default: 900
+
+ external_net_name:
+ type: string
+ description: Name of the external network which management network will connect to
+ default: admin_floating_net
+
+resources:
+ flavor:
+ type: OS::Nova::Flavor
+ properties:
+ ram: 4096
+ vcpus: 4
+ disk: 4
+
+ network:
+ type: OS::Neutron::Net
+ properties:
+ name: dpdk_net
+
+ subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ name: dpdk_subnet
+ ip_version: 4
+ cidr: 192.168.0.0/24
+ network: { get_resource: network }
+
+ management_router:
+ type: OS::Neutron::Router
+ properties:
+ name: management_router
+ external_gateway_info:
+ network: { get_param: external_net_name }
+
+ management_router_interface:
+ type: OS::Neutron::RouterInterface
+ properties:
+ router: { get_resource: management_router }
+ subnet: { get_resource: subnet }
+
+ floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network: { get_param: external_net_name }
+
+ floating_ip_association:
+ type: OS::Nova::FloatingIPAssociation
+ properties:
+ floating_ip: { get_resource: floating_ip }
+ server_id: {get_resource: dpdk_vm}
+
+ keypair:
+ type: OS::Nova::KeyPair
+ properties:
+ name: vnftest-key
+ public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0RkXfW6pksd1cZmXuvXZF/Mlqqq3ahIGcGoULOC97XMpu0vdxMpcUwdjwGqMwEXTVyfHidu0l99bLqOCpSUKCmbWx3ONJ+1kqFx4HwsKEWLiyDYqsuMrDeZT1eFjC5avCoTcrIw2wq5NaBb00lDGagNZOeopaL5YIa4+PizEY23+cir24D67NU21Fg3JE92AIeGlNa4j66L3a+lL0hZq74Dilmp42wm4GsbplRO6KJfyaraowHb1X+TmhCjBgHk6M/OJ9yPAroZyJNcwjMAuuxhAYWRuT3SdbnoUR0RG2VhfDh0qNid7vOqLbhKPeaLLFmzkN+9w3WdCp6LbSYt87 vnftest@vnftest.onap.org
+
+ wait_handle:
+ type: OS::Heat::WaitConditionHandle
+
+ wait_condition:
+ type: OS::Heat::WaitCondition
+ properties:
+ handle: { get_resource: wait_handle }
+ count: 1
+ timeout: { get_param: timeout }
+
+ dpdk_vm:
+ type: OS::Nova::Server
+ depends_on: [subnet, keypair, flavor]
+ properties:
+ name: { get_param: "OS::stack_name" }
+ image: { get_param: image }
+ flavor: { get_resource: flavor }
+ key_name: {get_resource: keypair}
+ networks:
+ - network: { get_resource: network }
+ config_drive: True
+ user_data_format : RAW
+ user_data:
+ str_replace:
+ template: |
+ #!/bin/sh
+ cat <<'CEOF' > /tmp/dpdk_post_build.sh
+ export RTE_SDK=/dpdk
+ export RTE_TARGET=x86_64-native-linuxapp-gcc
+ cd /dpdk
+ make install T=x86_64-native-linuxapp-gcc DESTDIR=destdir
+ modprobe uio
+ insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
+ insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko
+ cd /pktgen-dpdk
+ make RTE_SDK=/dpdk
+ echo "PCKTGEN BUILT"
+ rm -rf /var/lib/cloud/instances
+ echo "rm succesfull"
+ ls /dpdk/x86_64-native-linuxapp-gcc/kmod/
+ $NOTIFY --data-binary '{"status": "SUCCESS"}'
+ CEOF
+ chmod +x /tmp/dpdk_post_build.sh
+ echo "chmod"
+ nohup /tmp/dpdk_post_build.sh &
+ params:
+ $NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] }
+
+outputs:
+ vm_uuid:
+ description: uuid of the VM
+ value: { get_attr: [ dpdk_vm, show,id ] }
diff --git a/tools/os-requirements-check.py b/tools/os-requirements-check.py
new file mode 100644
index 0000000..a9a28d7
--- /dev/null
+++ b/tools/os-requirements-check.py
@@ -0,0 +1,112 @@
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/os-requirements-check.py
+import argparse
+import collections
+import os
+from packaging import version as pkg_version
+import sys
+
+from openstack_requirements import requirement
+
+
+PROJECT_REQUIREMENTS_FILES = ['requirements.txt']
+QUALIFIER_CHARS = ['<', '>', '!', '=']
+
+
+def _grab_args():
+ """Grab and return arguments"""
+ parser = argparse.ArgumentParser(
+ description='Check if project requirements have changed')
+
+ parser.add_argument('env_dir', help='tox environment directory')
+ return parser.parse_args()
+
+
+def _extract_reqs(file_name, blacklist=None):
+ blacklist = blacklist or {}
+ content = open(file_name, 'rt').read()
+ reqs = collections.defaultdict(tuple)
+ parsed = requirement.parse(content)
+ for name, entries in ((name, entries) for (name, entries) in parsed.items()
+ if (name and name not in blacklist)):
+ list_reqs = [r for (r, line) in entries]
+ # Strip the comments out before checking if there are duplicates
+ list_reqs_stripped = [r._replace(comment='') for r in list_reqs]
+ if len(list_reqs_stripped) != len(set(list_reqs_stripped)):
+ print('Requirements file %s has duplicate entries for package '
+ '"%s: %r' % (file_name, name, list_reqs))
+ reqs[name] = list_reqs
+ return reqs
+
+
+def _extract_qualifier_version(specifier):
+ index = 1
+ # Find qualifier (one or two chars).
+ if specifier[0] in QUALIFIER_CHARS and specifier[1] in QUALIFIER_CHARS:
+ index = 2
+ qualifier = specifier[:index]
+ version = pkg_version.Version(specifier[index:])
+ return qualifier, version
+
+
+def main():
+ args = _grab_args()
+
+ # Build a list of requirements from the global list in the
+ # openstack/requirements project so we can match them to the changes
+ env_dir = args.env_dir
+ req_dir = env_dir + '/src/os-requirements/'
+ global_reqs = _extract_reqs(req_dir + '/global-requirements.txt')
+ blacklist = _extract_reqs(req_dir + '/blacklist.txt')
+
+ # Build a list of project requirements.
+ failed = False
+ local_dir = os.getcwd()
+ for file_name in PROJECT_REQUIREMENTS_FILES:
+ print('Validating requirements file "%s"' % file_name)
+ proj_reqs = _extract_reqs(local_dir + '/' + file_name,
+ blacklist=blacklist)
+
+ for name, req in proj_reqs.items():
+ global_req = global_reqs.get(name)
+ if not global_req:
+ continue
+ global_req = global_req[0]
+ req = req[0]
+ if not global_req.specifiers:
+ continue
+
+ specifiers = global_req.specifiers.split(',')
+ for spec in specifiers:
+ _, req_version = _extract_qualifier_version(req.specifiers)
+ g_qualifier, g_version = _extract_qualifier_version(spec)
+ if g_qualifier == '!=' and g_version == req_version:
+ print('Package "%s" version %s is not compatible' %
+ (name, req_version))
+ failed = True
+ if g_qualifier == '>=' and g_version > req_version:
+ print('Package "%s" version %s outdated, minimum version '
+ '%s' % (name, req_version, g_version))
+ failed = True
+
+ if failed:
+ print('Incompatible requirement found!')
+ sys.exit(1)
+ print('Updated requirements match openstack/requirements')
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tools/run_tests.sh b/tools/run_tests.sh
new file mode 100755
index 0000000..4f7aea3
--- /dev/null
+++ b/tools/run_tests.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/run_tests.sh
+
+# Run vnftest's unit, coverage, functional test
+
+getopts ":f" FILE_OPTION
+opts=$@ # get other args
+
+# don't write .pyc files this can cause odd unittest results
+export PYTHONDONTWRITEBYTECODE=1
+
+PY_VER="py$( python --version | sed 's/[^[:digit:]]//g' | cut -c-2 )"
+export PY_VER
+
+COVER_DIR_NAME="./tools/"
+export COVER_DIR_NAME
+
+run_tests() {
+ echo "Get external libs needed for unit test"
+
+ echo "Running unittest ... "
+ if [ $FILE_OPTION == "f" ]; then
+ python -m unittest discover -v -s tests/unit > $logfile 2>&1
+ else
+ python -m unittest discover -v -s tests/unit
+ fi
+
+ if [ $? -ne 0 ]; then
+ if [ $FILE_OPTION == "f" ]; then
+ echo "FAILED, results in $logfile"
+ fi
+ exit 1
+ else
+ if [ $FILE_OPTION == "f" ]; then
+ echo "OK, results in $logfile"
+ fi
+ fi
+}
+
+run_coverage() {
+ source $COVER_DIR_NAME/cover.sh
+ run_coverage_test
+}
+
+run_functional_test() {
+
+ mkdir -p .testrepository
+ python -m subunit.run discover vnftest/tests/functional > .testrepository/subunit.log
+
+ subunit2pyunit < .testrepository/subunit.log
+ EXIT_CODE=$?
+ subunit-stats < .testrepository/subunit.log
+
+ if [ $EXIT_CODE -ne 0 ]; then
+ exit 1
+ else
+ echo "OK"
+ fi
+}
+
+if [[ $opts =~ "--unit" ]]; then
+ run_tests
+fi
+
+if [[ $opts =~ "--coverage" ]]; then
+ run_coverage
+fi
+
+if [[ $opts =~ "--functional" ]]; then
+ run_functional_test
+fi
+
+if [[ -z $opts ]]; then
+ echo "No tests to run!!"
+ echo "Usage: run_tests.sh [--unit] [--coverage] [--functional]"
+ exit 1
+fi
diff --git a/tools/ubuntu-server-cloudimg-dpdk-modify.sh b/tools/ubuntu-server-cloudimg-dpdk-modify.sh
new file mode 100755
index 0000000..2a44eb8
--- /dev/null
+++ b/tools/ubuntu-server-cloudimg-dpdk-modify.sh
@@ -0,0 +1,143 @@
+#!/bin/bash
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/ubuntu-server-clouding-dpmdk-modify.sh
+
+# installs required packages
+# must be run from inside the image (either chrooted or running)
+
+set -ex
+
+if [ $# -eq 1 ]; then
+ nameserver_ip=$1
+
+ # /etc/resolv.conf is a symbolic link to /run, restore at end
+ rm /etc/resolv.conf
+ echo "nameserver $nameserver_ip" > /etc/resolv.conf
+ echo "nameserver 8.8.8.8" >> /etc/resolv.conf
+ echo "nameserver 8.8.4.4" >> /etc/resolv.conf
+fi
+
+# iperf3 only available for wily in backports
+grep wily /etc/apt/sources.list && \
+ echo "deb http://archive.ubuntu.com/ubuntu/ wily-backports main restricted universe multiverse" >> /etc/apt/sources.list
+
+# Workaround for building on CentOS (apt-get is not working with http sources)
+# sed -i 's/http/ftp/' /etc/apt/sources.list
+
+# Force apt to use ipv4 due to build problems on LF POD.
+echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
+
+echo 'GRUB_CMDLINE_LINUX="resume=/dev/sda1 default_hugepagesz=1G hugepagesz=1G hugepages=2 iommu=on iommu=pt intel_iommu=on"' >> /etc/default/grub
+echo 'vm.nr_hugepages=1024' >> /etc/sysctl.conf
+echo 'huge /mnt/huge hugetlbfs defaults 0 0' >> vi /etc/fstab
+
+mkdir /mnt/huge
+chmod 777 /mnt/huge
+
+for i in {1..2}
+do
+ touch /etc/network/interfaces.d/eth$i.cfg
+ chmod 777 /etc/network/interfaces.d/eth$i.cfg
+ echo "auto eth$i" >> /etc/network/interfaces.d/eth$i.cfg
+ echo "iface eth$i inet dhcp" >> /etc/network/interfaces.d/eth$i.cfg
+done
+
+# this needs for checking dpdk status, adding interfaces to dpdk, bind, unbind etc..
+
+# Add hostname to /etc/hosts.
+# Allow console access via pwd
+cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg
+manage_etc_hosts: True
+password: RANDOM
+chpasswd: { expire: False }
+ssh_pwauth: True
+EOF
+
+linuxheadersversion=$(echo ls /boot/vmlinuz* | cut -d- -f2-)
+
+apt-get update
+apt-get install -y \
+ bc \
+ fio \
+ gcc \
+ git \
+ iperf3 \
+ iproute2 \
+ ethtool \
+ linux-tools-common \
+ linux-tools-generic \
+ lmbench \
+ make \
+ unzip \
+ netperf \
+ patch \
+ perl \
+ rt-tests \
+ stress \
+ sysstat \
+ linux-headers-"${linuxheadersversion}" \
+ libpcap-dev \
+ lua5.2 \
+ net-tools \
+ wget \
+ unzip \
+ libpcap-dev \
+ ncurses-dev \
+ libedit-dev \
+ pciutils \
+ pkg-config \
+ liblua5.2-dev \
+ libncursesw5-dev \
+ ncurses-dev \
+ libedit-dev
+
+dpkg -L liblua5.2-dev
+cp /usr/include/lua5.2/lua.h /usr/include/
+cp /usr/include/lua5.2/lua.h /usr/include/x86_64-linux-gnu/
+
+git clone http://dpdk.org/git/dpdk
+git clone http://dpdk.org/git/apps/pktgen-dpdk
+
+CLONE_DEST=/opt/tempT
+# remove before cloning
+rm -rf -- "${CLONE_DEST}"
+git clone https://github.com/kdlucas/byte-unixbench.git "${CLONE_DEST}"
+make --directory "${CLONE_DEST}/UnixBench/"
+
+git clone https://github.com/beefyamoeba5/ramspeed.git "${CLONE_DEST}/RAMspeed"
+cd "${CLONE_DEST}/RAMspeed/ramspeed-2.6.0"
+mkdir temp
+bash build.sh
+
+git clone https://github.com/beefyamoeba5/cachestat.git "${CLONE_DEST}"/Cachestat
+
+cd /root
+wget http://dpdk.org/browse/dpdk/snapshot/dpdk-17.02.zip
+unzip dpdk-17.02.zip
+cd dpdk-17.02
+make install T=x86_64-native-linuxapp-gcc
+
+cd /root
+wget https://01.org/sites/default/files/downloads/intelr-data-plane-performance-demonstrators/dppd-prox-v035.zip
+unzip dppd-prox-v035.zip
+cd dppd-PROX-v035
+chmod +x helper-scripts/trailing.sh
+export RTE_SDK=/root/dpdk-17.02
+export RTE_TARGET=x86_64-native-linuxapp-gcc
+make
+
+# restore symlink
+ln -sfrT /run/resolvconf/resolv.conf /etc/resolv.conf
diff --git a/tools/ubuntu-server-cloudimg-modify.sh b/tools/ubuntu-server-cloudimg-modify.sh
new file mode 100755
index 0000000..50a9a4c
--- /dev/null
+++ b/tools/ubuntu-server-cloudimg-modify.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/ubuntu-server-clouding-modify.sh
+
+# installs required packages
+# must be run from inside the image (either chrooted or running)
+
+set -ex
+
+if [ $# -eq 1 ]; then
+ nameserver_ip=$1
+
+ # /etc/resolv.conf is a symbolic link to /run, restore at end
+ rm /etc/resolv.conf
+ echo "nameserver $nameserver_ip" > /etc/resolv.conf
+ echo "nameserver 8.8.8.8" >> /etc/resolv.conf
+ echo "nameserver 8.8.4.4" >> /etc/resolv.conf
+fi
+
+# iperf3 only available for trusty in backports
+if grep -q trusty /etc/apt/sources.list ; then
+ if [ "${YARD_IMG_ARCH}" = "arm64" ]; then
+ echo "deb [arch=${YARD_IMG_ARCH}] http://ports.ubuntu.com/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
+ else
+ echo "deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
+ fi
+fi
+# Workaround for building on CentOS (apt-get is not working with http sources)
+# sed -i 's/http/ftp/' /etc/apt/sources.list
+
+# Force apt to use ipv4 due to build problems on LF POD.
+echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
+
+# Add hostname to /etc/hosts.
+# Allow console access via pwd
+cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg
+manage_etc_hosts: True
+password: RANDOM
+chpasswd: { expire: False }
+ssh_pwauth: True
+EOF
+apt-get update
+apt-get install -y \
+ bc \
+ bonnie++ \
+ fio \
+ git \
+ gcc \
+ iperf3 \
+ ethtool \
+ iproute2 \
+ linux-tools-common \
+ linux-tools-generic \
+ lmbench \
+ make \
+ netperf \
+ patch \
+ perl \
+ rt-tests \
+ stress \
+ sysstat
+
+CLONE_DEST=/opt/tempT
+
+# remove before cloning
+rm -rf -- "${CLONE_DEST}"
+
+git clone https://github.com/kdlucas/byte-unixbench.git "${CLONE_DEST}"
+
+make --directory "${CLONE_DEST}/UnixBench/"
+
+git clone https://github.com/beefyamoeba5/ramspeed.git "${CLONE_DEST}/RAMspeed"
+
+cd "${CLONE_DEST}/RAMspeed/ramspeed-2.6.0"
+mkdir temp
+bash build.sh
+
+git clone https://github.com/beefyamoeba5/cachestat.git "${CLONE_DEST}/Cachestat"
+
+# restore symlink
+ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf
diff --git a/tools/vnftest-img-dpdk-finalize.sh b/tools/vnftest-img-dpdk-finalize.sh
new file mode 100644
index 0000000..f94de26
--- /dev/null
+++ b/tools/vnftest-img-dpdk-finalize.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/vnftest-img-dpmdk-finalize.sh
+
+# installs dpdk and pktgen packages on modified image
+
+# PREREQUISITES
+# modified image (vnftest-wily-server) must be uploaded to OpenStack
+# heat must be installed: apt-get install python-heatclient, python-glanceclient, python-nova
+# must have a public vnftest-key uploaded in openstack
+# must have a proper flavor for the image (i.e. m1.small)
+
+
+stackname="vnftest-modify-stack"
+template=dpdk_install.yml
+new_image_name="vnftest-image-pktgen-ready"
+
+openstack stack create $stackname -f yaml -t $template
+progress="WARMING_UP"
+
+while [ "$progress" != "CREATE_COMPLETE" ]
+do
+ sleep 10
+ echo "check stack status......."
+ show_output=$(openstack stack show $stackname)
+ progress=$(echo $show_output | sed 's/^.*stack_status . \([^ ]*\).*$/\1/')
+ echo "$progress"
+ if [ "$progress" == "CREATE_FAILED" ];then
+ echo "create $stackname failed"
+ exit 1
+ fi
+done
+
+# workaround: Without wait time, the file size of pktgen is zero in the snapshot.
+sleep 60
+
+status=$(nova image-create --poll $stackname $new_image_name)
+if [[ "$status" =~ "Finished" ]];then
+ echo "$new_image_name finished"
+fi
+
+nova delete $stackname
+sleep 10
+openstack stack delete --yes $stackname
diff --git a/tools/vnftest-img-dpdk-modify b/tools/vnftest-img-dpdk-modify
new file mode 100644
index 0000000..2f718bd
--- /dev/null
+++ b/tools/vnftest-img-dpdk-modify
@@ -0,0 +1,169 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/vnftest-img-dpmdk-modify
+
+# vnftest-img-dpdk-modify - download and modify a Ubuntu cloud image
+#
+# The actual customization is done by a script passed with an absolute path as
+# the only single argument. The command needs to be invoked as sudo
+#
+# Example invocation:
+# vnftest-img-dpdk-modify /home/vnftest/tools/ubuntu-server-cloudimg-dpdk-modify.sh
+#
+# Warning: the script will create files by default in:
+# /tmp/workspace/vnftest
+# the files will be owned by root!
+#
+# TODO: image resize is needed if the base image is too small
+#
+
+set -e
+set -x
+
+die() {
+ echo "error: $1" >&2
+ exit 1
+}
+
+test $# -eq 1 || die "no image specific script as argument"
+test $(id -u) -eq 0 || die "should invoke using sudo"
+
+cmd=$1
+test -x $cmd
+mountdir="/mnt/vnftest"
+
+workspace=${WORKSPACE:-"/tmp/workspace/vnftest"}
+host=${HOST:-"cloud-images.ubuntu.com"}
+release=${RELEASE:-"wily"}
+image_path="${release}/current/${release}-server-cloudimg-amd64-disk1.img"
+image_url=${IMAGE_URL:-"https://${host}/${image_path}"}
+sha256sums_path="${release}/current/SHA256SUMS"
+sha256sums_url=${SHA256SUMS_URL:-"https://${host}/${sha256sums_path}"}
+
+imgfile="${workspace}/vnftest-${release}-server"
+raw_imgfile="${workspace}/vnftest-${release}-server.raw"
+filename=$(basename $image_url)
+
+# download and checksum base image, conditionally if local copy is outdated
+download() {
+ test -d $workspace || mkdir -p $workspace
+ cd $workspace
+ rm -f SHA256SUMS # always download the checksum file to a detect stale image
+ wget $sha256sums_url
+ test -e $filename || wget -nc $image_url
+ grep $filename SHA256SUMS | sha256sum -c ||
+ if [ $? -ne 0 ]; then
+ rm $filename
+ wget -nc $image_url
+ grep $filename SHA256SUMS | sha256sum -c
+ fi
+ qemu-img convert $filename $raw_imgfile
+ cd -
+}
+
+# mount image
+setup() {
+ mkdir -p $mountdir
+
+ for i in $(seq 0 9); do
+ [ -a /dev/loop$i ] || mknod -m 660 /dev/loop$i b 7 $i
+ done
+
+ loopdevice=$(kpartx -l $raw_imgfile | head -1 | cut -f1 -d ' ')
+
+ kpartx -a $raw_imgfile
+
+ mount /dev/mapper/$loopdevice $mountdir
+ mount -t proc none $mountdir/proc
+
+ echo $loopdevice
+
+ sudo resize2fs /dev/mapper/$loopdevice
+
+ cp $cmd $mountdir/$(basename $cmd)
+}
+
+# modify image running a script using in a chrooted environment
+modify() {
+ # resolv.conf does not exist in base image, pass nameserver value from host
+ nameserver_ip=$(grep -m 1 '^nameserver' \
+ /etc/resolv.conf | awk '{ print $2 '})
+
+ # prevent init scripts from running during install
+ echo $'#!/bin/sh\nexit 101' >$mountdir/usr/sbin/policy-rc.d
+ chmod a+x $mountdir/usr/sbin/policy-rc.d
+
+ chroot $mountdir /$(basename $cmd) $nameserver_ip
+
+ rm -rf $mountdir/usr/sbin/policy-rc.d
+
+ umount -f $mountdir/proc
+ umount $mountdir
+
+ qemu-img convert -c -o compat=0.10 -O qcow2 $raw_imgfile $imgfile
+# qemu-img convert -O vmdk $raw_imgfile $imgfile
+
+ if dmsetup table | grep $loopdevice; then
+ dmsetup clear $loopdevice || true
+ fi
+}
+
+# cleanup (umount) the image
+cleanup() {
+ # designed to be idempotent
+ mount | grep $mountdir/proc && umount $mountdir/proc
+ mount | grep $mountdir && umount $mountdir
+ if [ -f $raw_imgfile ]; then
+ kpartx -dv $raw_imgfile || true
+ fi
+ rm -f $raw_imgfile
+ rm -rf $mountdir
+}
+
+exitcode=""
+error_trap()
+{
+ local rc=$?
+
+ set +e
+
+ if [ -z "$exitcode" ]; then
+ exitcode=$rc
+ fi
+
+ cleanup
+
+ echo "Image build failed with $exitcode"
+
+ exit $exitcode
+}
+
+main() {
+ cleanup
+
+ trap "error_trap" EXIT SIGTERM
+
+ download
+ setup
+ modify
+ trap - EXIT SIGTERM
+ cleanup
+
+ echo "the modified image is found here: $imgfile"
+}
+
+main
diff --git a/tools/vnftest-img-lxd-modify b/tools/vnftest-img-lxd-modify
new file mode 100755
index 0000000..5b54a7c
--- /dev/null
+++ b/tools/vnftest-img-lxd-modify
@@ -0,0 +1,143 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/vnftest-img-lxd-modify
+
+# vnftest-img-lxd-modify - download and modify a Ubuntu cloud image
+#
+# The actual customization is done by a script passed with an absolute path as
+# the only single argument. The command needs to be invoked as sudo
+#
+# Example invocation:
+# vnftest-img-lxd-modify /home/vnftest/tools/ubuntu-server-cloudimg-modify.sh
+#
+# Warning: the script will create files by default in:
+# /tmp/workspace/vnftest
+# the files will be owned by root!
+#
+# TODO: image resize is needed if the base image is too small
+#
+
+set -e
+set -x
+
+die() {
+ echo "error: $1" >&2
+ exit 1
+}
+
+test $# -eq 1 -o $# -eq 2 || die "no image specific script as argument"
+test $(id -u) -eq 0 || die "should invoke using sudo"
+
+cmd=$1
+RELEASE=$2
+test -x $cmd
+mountdir="/mnt/vnftest"
+workspace=${WORKSPACE:-"/tmp/workspace/vnftest"}
+host=${HOST:-"cloud-images.ubuntu.com"}
+release=${RELEASE:-"xenial"}
+image_path="${release}/current/${release}-server-cloudimg-amd64-root.tar.gz"
+image_url=${IMAGE_URL:-"https://${host}/${image_path}"}
+sha256sums_path="${release}/current/SHA256SUMS"
+sha256sums_url=${SHA256SUMS_URL:-"https://${host}/${sha256sums_path}"}
+
+imgfile="${workspace}/vnftest-image.tar.gz"
+filename=$(basename $image_url)
+
+# download and checksum base image, conditionally if local copy is outdated
+download() {
+ test -d $workspace || mkdir -p $workspace
+ cd $workspace
+ rm -f SHA256SUMS # always download the checksum file to a detect stale image
+ wget $sha256sums_url
+ test -e $filename || wget -nc --progress=dot:giga $image_url
+ grep $filename SHA256SUMS | sha256sum -c ||
+ if [ $? -ne 0 ]; then
+ rm $filename
+ wget -nc --progress=dot:giga $image_url
+ grep $filename SHA256SUMS | sha256sum -c
+ fi
+ cd -
+}
+
+# extract files
+setup() {
+ mkdir -p $mountdir
+
+ cp $cmd $mountdir/$(basename $cmd)
+
+ cd $workspace
+ tar zxvf $filename -C $mountdir
+}
+
+# modify image running a script using in a chrooted environment
+modify() {
+ # resolv.conf does not exist in base image, pass nameserver value from host
+ nameserver_ip=$(grep -m 1 '^nameserver' \
+ /etc/resolv.conf | awk '{ print $2 '})
+
+ # prevent init scripts from running during install
+ echo $'#!/bin/sh\nexit 101' >$mountdir/usr/sbin/policy-rc.d
+ chmod a+x $mountdir/usr/sbin/policy-rc.d
+
+ chroot $mountdir /$(basename $cmd) $nameserver_ip
+
+ rm -rf $mountdir/usr/sbin/policy-rc.d
+
+ tar zcvf $(basename $imgfile) $mountdir/
+}
+
+# cleanup the image
+cleanup() {
+ rm -rf $mountdir
+}
+
+exitcode=""
+error_trap()
+{
+ local rc=$?
+
+ set +e
+
+ if [ -z "$exitcode" ]; then
+ exitcode=$rc
+ fi
+
+ dmesg -T | tail -50
+
+ cleanup
+
+ echo "Image build failed with $exitcode"
+
+ exit $exitcode
+}
+
+main() {
+ cleanup
+
+ trap "error_trap" EXIT SIGTERM
+
+ download
+ setup
+ modify
+
+ trap - EXIT SIGTERM
+ cleanup
+
+ echo "the modified image is found here: $imgfile"
+}
+
+main
diff --git a/tools/vnftest-img-modify b/tools/vnftest-img-modify
new file mode 100755
index 0000000..d3d1fcf
--- /dev/null
+++ b/tools/vnftest-img-modify
@@ -0,0 +1,191 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/vnftest-img-modify
+
+# vnftest-img-modify - download and modify a Ubuntu cloud image
+#
+# The actual customization is done by a script passed with an absolute path as
+# the only single argument. The command needs to be invoked as sudo
+#
+# Example invocation:
+# vnftest-img-modify /home/vnftest/tools/ubuntu-server-cloudimg-modify.sh
+#
+# Warning: the script will create files by default in:
+# /tmp/workspace/vnftest
+# the files will be owned by root!
+#
+# TODO: image resize is needed if the base image is too small
+#
+set -e
+set -x
+
+die() {
+ echo "error: $1" >&2
+ exit 1
+}
+
+test $# -eq 1 -o $# -eq 2 || die "no image specific script as argument"
+test $(id -u) -eq 0 || die "should invoke using sudo"
+
+cmd=$1
+RELEASE=$2
+test -x $cmd
+mountdir="/mnt/vnftest"
+workspace=${WORKSPACE:-"/tmp/workspace/vnftest"}
+host=${HOST:-"cloud-images.ubuntu.com"}
+release=${RELEASE:-"xenial"}
+boot_mode="disk1"
+if [[ "${YARD_IMG_ARCH}" = "arm64" ]]; then
+ boot_mode="uefi1"
+fi
+
+image_path="${release}/current/${release}-server-cloudimg-${YARD_IMG_ARCH}-${boot_mode}.img"
+image_url=${IMAGE_URL:-"https://${host}/${image_path}"}
+sha256sums_path="${release}/current/SHA256SUMS"
+sha256sums_url=${SHA256SUMS_URL:-"https://${host}/${sha256sums_path}"}
+
+imgfile="${workspace}/vnftest-image.img"
+raw_imgfile_basename="vnftest-${release}-server.raw"
+raw_imgfile="${workspace}/${raw_imgfile_basename}"
+filename=$(basename $image_url)
+
+apt-get install -y parted
+
+# download and checksum base image, conditionally if local copy is outdated
+download() {
+ test -d $workspace || mkdir -p $workspace
+ cd $workspace
+ rm -f SHA256SUMS # always download the checksum file to a detect stale image
+ wget $sha256sums_url
+ test -e $filename || wget -nc --progress=dot:giga $image_url
+ grep $filename SHA256SUMS | sha256sum -c ||
+ if [ $? -ne 0 ]; then
+ rm $filename
+ wget -nc --progress=dot:giga $image_url
+ grep $filename SHA256SUMS | sha256sum -c
+ fi
+
+ for i in $(seq 0 9); do
+ [ -a /dev/loop$i ] || mknod -m 660 /dev/loop$i b 7 $i
+ done
+
+ qemu-img convert $filename $raw_imgfile
+ cd -
+}
+
+# mount image
+setup() {
+ # qemu-img resize $raw_imgfile +5GB
+ mkdir -p $mountdir
+
+ loopdevice=$(kpartx -l $raw_imgfile | head -1 | cut -f1 -d ' ')
+
+ kpartx -av $raw_imgfile
+
+ # for trouble shooting
+ sleep 2
+ dmsetup ls
+ parted -l /dev/${loopdevice:0:5} || true
+ mount /dev/mapper/$loopdevice $mountdir
+ mount -t proc none $mountdir/proc
+
+ cp $cmd $mountdir/$(basename $cmd)
+ if [ "${YARD_IMG_ARCH}" = "arm64" ]; then
+ cp /usr/bin/qemu-aarch64-static $mountdir/usr/bin
+ fi
+}
+
+# modify image running a script using in a chrooted environment
+modify() {
+ # resolv.conf does not exist in base image, pass nameserver value from host
+ nameserver_ip=$(grep -m 1 '^nameserver' \
+ /etc/resolv.conf | awk '{ print $2 '})
+
+ # prevent init scripts from running during install
+ echo $'#!/bin/sh\nexit 101' >$mountdir/usr/sbin/policy-rc.d
+ chmod a+x $mountdir/usr/sbin/policy-rc.d
+
+ chroot $mountdir /$(basename $cmd) $nameserver_ip
+
+ rm -rf $mountdir/usr/sbin/policy-rc.d
+
+ umount -f $mountdir/proc
+ umount $mountdir
+
+ qemu-img convert -c -o compat=0.10 -O qcow2 $raw_imgfile $imgfile
+
+ if dmsetup table | grep $loopdevice; then
+ dmsetup clear $loopdevice || true
+ fi
+}
+
+# cleanup (umount) the image
+cleanup() {
+ # designed to be idempotent
+ mount | grep $mountdir/proc && umount $mountdir/proc
+ mount | grep $mountdir && umount $mountdir
+ mount | grep "/mnt/${release}" && umount "/mnt/${release}"
+
+ if [ -f "${raw_imgfile}" ]; then
+ #kpartx -dv $raw_imgfile sometimes failed, we should checked it agein.
+ #if [ -z "$(kpartx -l $raw_imgfile | grep 'loop deleted')" ]; then
+ # kpartx -dv $raw_imgfile
+ #fi
+ kpartx -dv $raw_imgfile || true
+ fi
+
+ rm -f $raw_imgfile
+ rm -rf $mountdir
+}
+
+exitcode=""
+error_trap()
+{
+ local rc=$?
+
+ set +e
+
+ if [ -z "$exitcode" ]; then
+ exitcode=$rc
+ fi
+
+ dmesg -T | tail -50
+
+ cleanup
+
+ echo "Image build failed with $exitcode"
+
+ exit $exitcode
+}
+
+main() {
+ cleanup
+
+ trap "error_trap" EXIT SIGTERM
+
+ download
+ setup
+ modify
+
+ trap - EXIT SIGTERM
+ cleanup
+
+ echo "the modified image is found here: $imgfile"
+}
+
+main
+
diff --git a/tools/vsperf-img-finalize.sh b/tools/vsperf-img-finalize.sh
new file mode 100755
index 0000000..e0126e4
--- /dev/null
+++ b/tools/vsperf-img-finalize.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/vsperf-img-finalize
+
+# PREREQUISITES
+# modified image (vnftest-vsperf) must be uploaded to OpenStack
+# must have a proper flavor (vsperf-flavor) for the image e.g.
+# nova flavor-create vsperf-flavor auto 8192 80 6
+# nova flavor-key vsperf-flavor set hw:numa_nodes=1
+# nova flavor-key vsperf-flavor set hw:mem_page_size=1GB
+# nova flavor-key vsperf-flavor set hw:cpu_policy=dedicated
+# nova flavor-key vsperf-flavor set hw:vif_multiqueue_enabled=true
+
+stackname="vsperf-install-stack"
+template=vsperf_install.yml
+new_image_name="vnftest-vsperf-server"
+
+openstack stack create $stackname -f yaml -t $template
+progress="WARMING_UP"
+
+while [ "$progress" != "CREATE_COMPLETE" ]
+do
+ sleep 10
+ echo "check stack status......."
+ show_output=$(openstack stack show $stackname)
+ progress=$(echo $show_output | sed 's/^.*stack_status . \([^ ]*\).*$/\1/')
+ echo "$progress"
+ if [ "$progress" == "CREATE_FAILED" ];then
+ echo "create $stackname failed"
+ exit 1
+ fi
+done
+
+# has to stop the instance before taking the snapshot
+nova stop $stackname
+sleep 10
+
+status=$(nova image-create --poll $stackname $new_image_name)
+if [[ "$status" =~ "Finished" ]];then
+ echo "$new_image_name finished"
+fi
+
+nova delete $stackname
+sleep 10
+openstack stack delete --yes $stackname
diff --git a/tools/vsperf-img-modify.sh b/tools/vsperf-img-modify.sh
new file mode 100755
index 0000000..d90adbf
--- /dev/null
+++ b/tools/vsperf-img-modify.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/vsperf-img-modify.sh
+
+# installs required packages
+# must be run from inside the image (either chrooted or running)
+
+set -ex
+
+if [ $# -eq 1 ]; then
+ nameserver_ip=$1
+
+ # /etc/resolv.conf is a symbolic link to /run, restore at end
+ rm /etc/resolv.conf
+ echo "nameserver $nameserver_ip" > /etc/resolv.conf
+ echo "nameserver 8.8.8.8" >> /etc/resolv.conf
+ echo "nameserver 8.8.4.4" >> /etc/resolv.conf
+fi
+
+# Force apt to use ipv4 due to build problems on LF POD.
+echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
+
+echo 'GRUB_CMDLINE_LINUX="resume=/dev/sda1 default_hugepagesz=1G hugepagesz=1G hugepages=32 iommu=on iommu=pt intel_iommu=on"' >> /etc/default/grub
+
+# Add hostname to /etc/hosts.
+# Allow console access via pwd
+cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg
+manage_etc_hosts: True
+password: ubuntu
+chpasswd: { expire: False }
+ssh_pwauth: True
+EOF
+
+linuxheadersversion=`echo ls boot/vmlinuz* | cut -d- -f2-`
+
+apt-get update
+apt-get install -y \
+ linux-headers-$linuxheadersversion \
+ screen \
+ locate \
+ sshpass \
+ git
+
+cd /root
+git clone -b stable/danube https://gerrit.onap.org/gerrit/vswitchperf
+
+# do not compile ovs and qemu
+sed -i.bak -e 's/^\(SUBBUILDS\ =\ src_vanilla\)/#\1/' \
+ -e 's/^\(SUBDIRS\ += ovs.*\)/#\1/' \
+ -e 's/^\(SUBDIRS\ += qemu.*\)/#\1/' \
+ vswitchperf/src/Makefile
+# If these paths do not exist, vsperf wont start
+mkdir -p /root/vswitchperf/src/ovs/ovs/ovsdb/
+touch /root/vswitchperf/src/ovs/ovs/ovsdb/ovsdb-tool
+touch /root/vswitchperf/src/ovs/ovs/ovsdb/ovsdb-server
+mkdir -p /root/vswitchperf/src/qemu/qemu/x86_64-softmmu/
+touch /root/vswitchperf/src/qemu/qemu/x86_64-softmmu/qemu-system-x86_64
+mkdir -p /root/vswitchperf/src/ovs/ovs/utilities/
+touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-dpctl
+touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-vsctl
+touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-ofctl
+touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-appctl
+mkdir -p /root/vswitchperf/src/ovs/ovs/vswitchd/
+touch /root/vswitchperf/src/ovs/ovs/vswitchd/vswitch.ovsschema
+touch /root/vswitchperf/src/ovs/ovs/vswitchd/ovs-vswitchd
+
+# restore symlink
+#ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf
diff --git a/tools/vsperf_install.yml b/tools/vsperf_install.yml
new file mode 100644
index 0000000..413171a
--- /dev/null
+++ b/tools/vsperf_install.yml
@@ -0,0 +1,133 @@
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.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
+#
+# 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
+##############################################################################
+# vnftest comment: this is a modified copy of
+# yardstick/tools/vsperf_install.yml
+
+heat_template_version: 2015-04-30
+
+description: >
+ Used to run VMs with Vsperf
+
+parameters:
+ image:
+ type: string
+ description: Name of the image
+ default: vnftest-vsperf
+
+ flavor:
+ type: string
+ default: vsperf-flavor
+
+ timeout:
+ type: number
+ description: Timeout in seconds for WaitCondition, depends on your image and environment
+ default: 6000
+
+ external_net_name:
+ type: string
+ description: Name of the external network which management network will connect to
+ default: ext-net1
+
+resources:
+ network:
+ type: OS::Neutron::Net
+ properties:
+ name: vsperf_net
+
+ subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ name: vsperf_subnet
+ ip_version: 4
+ cidr: 192.168.0.0/24
+ network: { get_resource: network }
+
+ management_router:
+ type: OS::Neutron::Router
+ properties:
+ name: management_router
+ external_gateway_info:
+ network: { get_param: external_net_name }
+
+ management_router_interface:
+ type: OS::Neutron::RouterInterface
+ properties:
+ router: { get_resource: management_router }
+ subnet: { get_resource: subnet }
+
+ floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network: { get_param: external_net_name }
+
+ floating_ip_association:
+ type: OS::Nova::FloatingIPAssociation
+ properties:
+ floating_ip: { get_resource: floating_ip }
+ server_id: {get_resource: vsperf_vm}
+
+ keypair:
+ type: OS::Nova::KeyPair
+ properties:
+ name: vnftest-key
+ public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0RkXfW6pksd1cZmXuvXZF/Mlqqq3ahIGcGoULOC97XMpu0vdxMpcUwdjwGqMwEXTVyfHidu0l99bLqOCpSUKCmbWx3ONJ+1kqFx4HwsKEWLiyDYqsuMrDeZT1eFjC5avCoTcrIw2wq5NaBb00lDGagNZOeopaL5YIa4+PizEY23+cir24D67NU21Fg3JE92AIeGlNa4j66L3a+lL0hZq74Dilmp42wm4GsbplRO6KJfyaraowHb1X+TmhCjBgHk6M/OJ9yPAroZyJNcwjMAuuxhAYWRuT3SdbnoUR0RG2VhfDh0qNid7vOqLbhKPeaLLFmzkN+9w3WdCp6LbSYt87 vnftest@vnftest.onap.org
+
+ wait_handle:
+ type: OS::Heat::WaitConditionHandle
+
+ wait_condition:
+ type: OS::Heat::WaitCondition
+ properties:
+ handle: { get_resource: wait_handle }
+ count: 1
+ timeout: { get_param: timeout }
+
+ vsperf_vm:
+ type: OS::Nova::Server
+ depends_on: [subnet, keypair]
+ properties:
+ name: { get_param: "OS::stack_name" }
+ image: { get_param: image }
+ flavor: { get_param: flavor }
+ key_name: {get_resource: keypair}
+ networks:
+ - network: { get_resource: network }
+ config_drive: True
+ user_data_format : RAW
+ user_data:
+ str_replace:
+ template: |
+ #!/bin/bash
+ cat <<'CEOF' > /tmp/vsperf_post_build.sh
+ echo "Install vswitchperf"
+ mv /root/vswitchperf /home/ubuntu
+ chown -R ubuntu:ubuntu /home/ubuntu/vswitchperf
+ cd /home/ubuntu/vswitchperf/systems
+ sudo -H -u ubuntu ./build_base_machine.sh
+ echo "Set password less access to MoonGen server"
+ sudo -H -u ubuntu ssh-keygen -b 2048 -t rsa -f /home/ubuntu/.ssh/id_rsa -N ''
+ sudo -H -u ubuntu touch /home/ubuntu/.cloud-warnings.skip
+ echo "Enable 1GB huge pages"
+ update-grub
+ $NOTIFY --data-binary '{"status": "SUCCESS"}'
+ CEOF
+ chmod +x /tmp/vsperf_post_build.sh
+ nohup /tmp/vsperf_post_build.sh &
+ params:
+ $NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] }
+
+outputs:
+ vm_uuid:
+ description: uuid of the VM
+ value: { get_attr: [ vsperf_vm, show,id ] }