aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--resources/libraries/robot/shared/suite_setup.robot2
-rw-r--r--resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml6
-rw-r--r--resources/tools/testbed-setup/ansible/inventories/sample_inventory/group_vars/all.yaml9
-rw-r--r--resources/tools/testbed-setup/ansible/inventories/sample_inventory/host_vars/1.1.1.1.yaml1
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml4
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml1
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml33
-rw-r--r--resources/tools/wrk/wrk.py35
-rwxr-xr-xresources/tools/wrk/wrk_utils.sh64
9 files changed, 71 insertions, 84 deletions
diff --git a/resources/libraries/robot/shared/suite_setup.robot b/resources/libraries/robot/shared/suite_setup.robot
index 27f7ddb784..d5cc5836fb 100644
--- a/resources/libraries/robot/shared/suite_setup.robot
+++ b/resources/libraries/robot/shared/suite_setup.robot
@@ -259,4 +259,4 @@
| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.70.1 | 24
| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.80.1 | 24
| | Set Linux interface up | ${tg} | ${intf_name}
-| | Install wrk | ${tg}
+| | Check wrk | ${tg}
diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml
index 907f5aff40..40d7544476 100644
--- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml
+++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml
@@ -51,6 +51,12 @@ dpdk:
aarch64: "arm64-armv8a"
x86_64: "x86_64-native"
+# WRK settings.
+wrk:
+ target_dir: '/opt'
+ version: '4.0.2'
+ url: 'https://github.com/wg/wrk/archive'
+
# Calibration settings.
jitter:
directory: '/tmp/pma_tools'
diff --git a/resources/tools/testbed-setup/ansible/inventories/sample_inventory/group_vars/all.yaml b/resources/tools/testbed-setup/ansible/inventories/sample_inventory/group_vars/all.yaml
index a8e6d0f3a5..484e6ddb4b 100644
--- a/resources/tools/testbed-setup/ansible/inventories/sample_inventory/group_vars/all.yaml
+++ b/resources/tools/testbed-setup/ansible/inventories/sample_inventory/group_vars/all.yaml
@@ -47,6 +47,15 @@ dpdk:
target_dir: '/opt'
version: 'dpdk-19.02'
url: 'https://fast.dpdk.org/rel'
+ build_targets:
+ aarch64: "arm64-armv8a"
+ x86_64: "x86_64-native"
+
+# WRK settings.
+wrk:
+ target_dir: '/opt'
+ version: '4.0.2'
+ url: 'https://github.com/wg/wrk/archive'
# Calibration settings.
jitter:
diff --git a/resources/tools/testbed-setup/ansible/inventories/sample_inventory/host_vars/1.1.1.1.yaml b/resources/tools/testbed-setup/ansible/inventories/sample_inventory/host_vars/1.1.1.1.yaml
index 1cc3e5eaa2..058f7f3ba0 100644
--- a/resources/tools/testbed-setup/ansible/inventories/sample_inventory/host_vars/1.1.1.1.yaml
+++ b/resources/tools/testbed-setup/ansible/inventories/sample_inventory/host_vars/1.1.1.1.yaml
@@ -15,3 +15,4 @@ sysctl:
inventory_ipmi_hostname: 'x.x.x.x'
cobbler_profile: 'ubuntu-18.04.2-server-x86_64'
+cpu_microarchitecture: "skylake"
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml
index f3f5d85aa1..24f433f9b9 100644
--- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml
@@ -3,3 +3,7 @@
- name: Install distribution - release - machine prerequisites
include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml'
+
+- name: Install WRK
+ include_tasks: 'wrk.yaml'
+ tags: install-wrk
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml
index 27b8b7248e..95a47b0917 100644
--- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml
@@ -5,6 +5,7 @@
apt:
name:
- 'unzip'
+ - 'libssl-dev'
state: 'present'
install_recommends: False
tags: install-csit-dependencies
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml
new file mode 100644
index 0000000000..1da45fb4b4
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml
@@ -0,0 +1,33 @@
+---
+# file: roles/tg/tasks/wrk.yaml
+
+- name: Download WRK release archive
+ get_url:
+ url: '{{ wrk.url }}/{{ wrk.version }}.tar.gz'
+ dest: '{{ wrk.target_dir }}/{{ wrk.version }}.tar.gz'
+ mode: 0644
+ register: 'linux__wrk_downloaded'
+ tags: install-wrk
+
+- name: Extract WRK release archive
+ become: yes
+ unarchive:
+ src: '{{ wrk.target_dir }}/{{ wrk.version }}.tar.gz'
+ dest: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}'
+ remote_src: yes
+ when: 'linux__wrk_downloaded'
+ register: 'linux__wrk_extracted'
+ tags: install-wrk
+
+- name: Compile WRK release
+ become: yes
+ shell: 'cd {{ wrk.target_dir }}/wrk-{{ wrk.version }}; make'
+ when: 'linux__wrk_extracted'
+ register: 'linux__wrk_compiled'
+ tags: install-wrk
+
+- name: Move WRK binary
+ become: yes
+ command: 'mv {{ wrk.target_dir }}/wrk-{{ wrk.version }}/wrk /usr/local/bin/'
+ when: 'linux__wrk_compiled'
+ tags: install-wrk
diff --git a/resources/tools/wrk/wrk.py b/resources/tools/wrk/wrk.py
index 43355b99fb..b7989b8852 100644
--- a/resources/tools/wrk/wrk.py
+++ b/resources/tools/wrk/wrk.py
@@ -57,13 +57,13 @@ REGEX_LATENCY_DIST = \
REGEX_NUM = r"(\d*\.*\d*)(\D*)"
-def install_wrk(tg_node):
- """Install wrk on the TG node.
+def check_wrk(tg_node):
+ """Check if wrk is installed on the TG node.
:param tg_node: Traffic generator node.
:type tg_node: dict
:raises: RuntimeError if the given node is not a TG node or if the
- installation fails.
+ command is not availble.
"""
if tg_node['type'] != NodeType.TG:
@@ -74,33 +74,10 @@ def install_wrk(tg_node):
ret, _, _ = ssh.exec_command(
"sudo -E "
- "sh -c '{0}/resources/tools/wrk/wrk_utils.sh install false'".
- format(Constants.REMOTE_FW_DIR), timeout=1800)
+ "sh -c '{0}/resources/tools/wrk/wrk_utils.sh installed'".
+ format(Constants.REMOTE_FW_DIR))
if int(ret) != 0:
- raise RuntimeError('Installation of wrk on TG node failed.')
-
-
-def destroy_wrk(tg_node):
- """Destroy wrk on the TG node.
-
- :param tg_node: Traffic generator node.
- :type tg_node: dict
- :raises: RuntimeError if the given node is not a TG node or the removal of
- wrk failed.
- """
-
- if tg_node['type'] != NodeType.TG:
- raise RuntimeError('Node type is not a TG.')
-
- ssh = SSH()
- ssh.connect(tg_node)
-
- ret, _, _ = ssh.exec_command(
- "sudo -E "
- "sh -c '{0}/resources/tools/wrk/wrk_utils.sh destroy'".
- format(Constants.REMOTE_FW_DIR), timeout=1800)
- if int(ret) != 0:
- raise RuntimeError('Removal of wrk from the TG node failed.')
+ raise RuntimeError('WRK is not installed on TG node.')
def run_wrk(tg_node, profile_name, tg_numa, test_type, warm_up=False):
diff --git a/resources/tools/wrk/wrk_utils.sh b/resources/tools/wrk/wrk_utils.sh
index 2b9f6cf296..1c77fea731 100755
--- a/resources/tools/wrk/wrk_utils.sh
+++ b/resources/tools/wrk/wrk_utils.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2018 Cisco and/or its affiliates.
+# Copyright (c) 2019 Cisco and/or its affiliates.
# 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:
@@ -14,59 +14,19 @@
set -x
-WRK_VERSION="4.0.2"
-WRK_TAR=${WRK_VERSION}".tar.gz"
-WRK_DWNLD_PATH="https://github.com/wg/wrk/archive"
-WRK_TARGET="/opt"
-WRK_INSTALL_DIR=${WRK_TARGET}/wrk-${WRK_VERSION}
+function wrk_utils.installed {
-function wrk_utils.install {
- # Install wrk
+ # Check if the WRK utility is installed. Fail if not installed.
- # Directory for wrk:
- dir=${1}
- # Force the installation:
- force=${2:-false}
+ # Returns:
+ # - 0 - If command is installed.
+ # - 1 - If command is not installed.
- # Check if wrk is installed:
- if [ "${force}" = true ]; then
- wrk_utils.destroy
- else
- which wrk
- if [ $? -eq 0 ]; then
- test -d ${dir}/${WRK_INSTALL_DIR} && echo "WRK already installed: ${dir}/${WRK_INSTALL_DIR}" && exit 0
- fi
- fi
-
- # Install pre-requisites:
- apt-get update
- apt-get install build-essential libssl-dev -y
-
- # Remove previous installation:
- wrk_utils.destroy
-
- # Change the directory:
- cd ${WRK_TARGET}
+ set -exuo pipefail
- # Get the specified version:
- wget ${WRK_DWNLD_PATH}/${WRK_TAR}
- tar xzf ${WRK_TAR}
- rm ${WRK_TAR}
- cd ${WRK_INSTALL_DIR}
-
- # Build the wrk:
- make
-
- # Move the executable to somewhere in the PATH:
- cp wrk /usr/local/bin
+ command -v wrk
}
-function wrk_utils.destroy {
- # Remove wrk
-
- sudo rm /usr/local/bin/wrk || true
- sudo rm -rf ${WRK_INSTALL_DIR} || true
-}
function wrk_utils.traffic_1_url_1_core {
# Send traffic
@@ -271,12 +231,8 @@ function wrk_utils.traffic_n_urls_m_cores {
args=("$@")
case ${1} in
- install)
- force=${2}
- wrk_utils.install ${force}
- ;;
- destroy)
- wrk_utils.destroy
+ installed)
+ wrk_utils.installed
;;
traffic_1_url_1_core)
wrk_utils.traffic_1_url_1_core "${args[@]:1}"