TC042 bug fix 65/54065/7
authorliyin <liyin11@huawei.com>
Sun, 18 Mar 2018 14:51:19 +0000 (14:51 +0000)
committerAce Lee <liyin11@huawei.com>
Wed, 21 Mar 2018 07:52:06 +0000 (07:52 +0000)
JIRA:YARDSTICK-786

yardstick DPDK image have problems to build.
We will fix this by using nsb image
the pktgen DPDK testcase will use sampleVNF image

Change-Id: I24b7b6a9acfe21ec956fa9c4ee7ebe7ae1787dbb
Signed-off-by: liyin <liyin11@huawei.com>
ansible/roles/download_pktgen/defaults/main.yml [new file with mode: 0644]
ansible/roles/download_pktgen/tasks/main.yml [new file with mode: 0644]
ansible/roles/install_image_dependencies/defaults/main.yml
ansible/roles/install_pktgen/tasks/main.yml [new file with mode: 0644]
ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml
tests/opnfv/test_cases/opnfv_yardstick_tc042.yaml
yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash
yardstick/benchmark/scenarios/networking/testpmd_fwd.bash

diff --git a/ansible/roles/download_pktgen/defaults/main.yml b/ansible/roles/download_pktgen/defaults/main.yml
new file mode 100644 (file)
index 0000000..b598e1d
--- /dev/null
@@ -0,0 +1,8 @@
+---
+pktgen_version: "3.2.12"
+pktgen_url: "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-{{ pktgen_version }}.zip"
+pktgen_file: "{{ pktgen_url|basename }}"
+pktgen_unarchive: "{{ pktgen_file|regex_replace('[.]zip$', '') }}"
+pktgen_dest: "{{ clone_dest }}/"
+pktgen_sha256s:
+  "3.2.12": "sha256:a20aeb677fb847c0871acabb6e8f965ba3485e92f92e86e0bb5dc11c787b11d8"
diff --git a/ansible/roles/download_pktgen/tasks/main.yml b/ansible/roles/download_pktgen/tasks/main.yml
new file mode 100644 (file)
index 0000000..ff71f20
--- /dev/null
@@ -0,0 +1,38 @@
+# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+- file:
+    path: "{{ pktgen_dest }}"
+    state: directory
+
+- name: fetch pktgen
+  get_url:
+    url: "{{ pktgen_url }}"
+    dest: "{{ pktgen_dest }}"
+    validate_certs: False
+    checksum: "{{ pktgen_sha256s[pktgen_version] }}"
+
+- unarchive:
+    src: "{{ pktgen_dest }}/{{ pktgen_file }}"
+    dest: "{{ pktgen_dest }}/"
+    copy: no
+
+- name: cleanup tar file to save space
+  file:
+      path: "{{ pktgen_dest }}/{{ pktgen_file }}"
+      state: absent
+
+- set_fact:
+    pktgen_path: "{{ pktgen_dest }}/{{ pktgen_unarchive }}"
+
index f0b5321..7a3f5fa 100644 (file)
@@ -28,6 +28,7 @@ install_dependencies:
     # for IxLoad
     - libxft-dev
     - libxss-dev
+    - expect
   RedHat:
     - bc
     - fio
diff --git a/ansible/roles/install_pktgen/tasks/main.yml b/ansible/roles/install_pktgen/tasks/main.yml
new file mode 100644 (file)
index 0000000..294c779
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+- name: set build env vars
+  set_fact:
+      build_env_vars:
+        RTE_SDK: "{{ RTE_SDK }}"
+        RTE_TARGET: "{{ RTE_TARGET }}"
+
+- name: "make pktgen"
+  command: make
+  args:
+    chdir: "{{ pktgen_path }}"
+  environment: "{{ build_env_vars }}"
index 85afa2a..7aa6c8c 100644 (file)
@@ -40,6 +40,8 @@
     - install_dpdk
     - download_trex
     - install_trex
+    - download_pktgen
+    - install_pktgen
     - download_civetweb
     - install_civetweb
     - download_samplevnfs
index f46eb84..ab41912 100644 (file)
@@ -19,6 +19,8 @@ scenarios:
   options:
     packetsize: 64
     rate: 100
+    eth1: ens4
+    eth2: ens5
 
   host: demeter.yardstick-TC042
   target: poseidon.yardstick-TC042
@@ -34,8 +36,13 @@ scenarios:
 
 context:
   name: yardstick-TC042
-  image: yardstick-image-pktgen-ready
-  flavor: yardstick-pktgen-dpdk.flavor
+  image: yardstick-samplevnfs
+  flavor:
+    vcpus: 4
+    ram: 4096
+    disk: 7
+    extra_specs:
+      hw:mem_page_size: "large"
   user: ubuntu
 
   placement_groups:
index ce8a7f4..9a7b975 100644 (file)
@@ -70,39 +70,42 @@ class PktgenDPDKLatency(base.Scenario):
     def run(self, result):
         """execute the benchmark"""
 
+        options = self.scenario_cfg['options']
+        eth1 = options.get("eth1", "ens4")
+        eth2 = options.get("eth2", "ens5")
         if not self.setup_done:
             self.setup()
 
         if not self.testpmd_args:
-            self.testpmd_args = utils.get_port_mac(self.client, 'eth2')
+            self.testpmd_args = utils.get_port_mac(self.client, eth2)
 
         if not self.pktgen_args:
-            server_rev_mac = utils.get_port_mac(self.server, 'eth1')
-            server_send_mac = utils.get_port_mac(self.server, 'eth2')
-            client_src_ip = utils.get_port_ip(self.client, 'eth1')
-            client_dst_ip = utils.get_port_ip(self.client, 'eth2')
+            server_rev_mac = utils.get_port_mac(self.server, eth1)
+            server_send_mac = utils.get_port_mac(self.server, eth2)
+            client_src_ip = utils.get_port_ip(self.client, eth1)
+            client_dst_ip = utils.get_port_ip(self.client, eth2)
 
             self.pktgen_args = [client_src_ip, client_dst_ip,
                                 server_rev_mac, server_send_mac]
 
-        options = self.scenario_cfg['options']
         packetsize = options.get("packetsize", 64)
         rate = options.get("rate", 100)
 
-        cmd = "screen sudo -E bash ~/testpmd_fwd.sh %s " % (self.testpmd_args)
+        cmd = "screen sudo -E bash ~/testpmd_fwd.sh %s %s %s" % \
+            (self.testpmd_args, eth1, eth2)
         LOG.debug("Executing command: %s", cmd)
         self.server.send_command(cmd)
 
         time.sleep(1)
 
-        cmd = "screen sudo -E bash ~/pktgen_dpdk.sh %s %s %s %s %s %s" % \
+        cmd = "screen sudo -E bash ~/pktgen_dpdk.sh %s %s %s %s %s %s %s %s" % \
             (self.pktgen_args[0], self.pktgen_args[1], self.pktgen_args[2],
-             self.pktgen_args[3], rate, packetsize)
+             self.pktgen_args[3], rate, packetsize, eth1, eth2)
         LOG.debug("Executing command: %s", cmd)
         self.client.send_command(cmd)
 
         # wait for finishing test
-        time.sleep(1)
+        time.sleep(60)
 
         cmd = r"""\
 cat ~/result.log -vT \
index b872aa3..dcd5a9b 100644 (file)
@@ -7,7 +7,7 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
-!/bin/sh
+#!/bin/sh
 
 set -e
 
@@ -18,6 +18,11 @@ FWD_REV_MAC=$3    # MAC address of forwarding receiver in VM B
 FWD_SEND_MAC=$4   # MAC address of forwarding sender in VM B
 RATE=$5           # packet rate in percentage
 PKT_SIZE=$6       # packet size
+ETH1=$7
+ETH2=$8
+
+DPDK_VERSION="dpdk-17.02"
+PKTGEN_VERSION="pktgen-3.2.12"
 
 
 load_modules()
@@ -31,13 +36,13 @@ load_modules()
     if lsmod | grep "igb_uio" &> /dev/null ; then
     echo "igb_uio module is loaded"
     else
-    insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
+    insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
     fi
 
     if lsmod | grep "rte_kni" &> /dev/null ; then
     echo "rte_kni module is loaded"
     else
-    insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko
+    insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko
     fi
 }
 
@@ -48,8 +53,10 @@ change_permissions()
 }
 
 add_interface_to_dpdk(){
+    ip link set $ETH1 down
+    ip link set $ETH2 down
     interfaces=$(lspci |grep Eth |tail -n +2 |awk '{print $1}')
-    /dpdk/tools/dpdk-devbind.py --bind=igb_uio $interfaces
+    /opt/tempT/$DPDK_VERSION/usertools/dpdk-devbind.py --bind=igb_uio $interfaces
 
 }
 
@@ -106,20 +113,14 @@ spawn ./app/app/x86_64-native-linuxapp-gcc/pktgen -c 0x07 -n 4 -b $blacklist --
 expect "Pktgen>"
 send "\n"
 expect "Pktgen>"
-send "screen on\n"
+send "on\n"
 expect "Pktgen>"
 set count 10
 while { $count } {
     send "page latency\n"
-    expect {
-        timeout { send "\n" }
-        -regexp {..*} {
-            set result "${result}$expect_out(0,string)"
-            set timeout 1
-            exp_continue
-         }
-        "Pktgen>"
-    }
+    expect -re "(..*)"
+    set result "${result}$expect_out(0,string)"
+    set timeout 1
     set count [expr $count-1]
 }
 send "stop 0\n"
@@ -136,7 +137,7 @@ EOF
 run_pktgen()
 {
     blacklist=$(lspci |grep Eth |awk '{print $1}'|head -1)
-    cd /pktgen-dpdk
+    cd /opt/tempT/$PKTGEN_VERSION
     touch /home/ubuntu/result.log
     result_log="/home/ubuntu/result.log"
     sudo expect /home/ubuntu/pktgen.exp $blacklist $result_log
@@ -153,4 +154,3 @@ main()
 }
 
 main
-
index 247a8a8..30b63a7 100644 (file)
@@ -13,6 +13,10 @@ set -e
 
 # Commandline arguments
 DST_MAC=$1         # MAC address of the peer port
+ETH1=$2
+ETH2=$3
+
+DPDK_VERSION="dpdk-17.02"
 
 load_modules()
 {
@@ -25,13 +29,13 @@ load_modules()
     if lsmod | grep "igb_uio" &> /dev/null ; then
     echo "igb_uio module is loaded"
     else
-    insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
+    insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
     fi
 
     if lsmod | grep "rte_kni" &> /dev/null ; then
     echo "rte_kni module is loaded"
     else
-    insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko
+    insmod /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko
     fi
 }
 
@@ -42,15 +46,17 @@ change_permissions()
 }
 
 add_interface_to_dpdk(){
+    ip link set $ETH1 down
+    ip link set $ETH2 down
     interfaces=$(lspci |grep Eth |tail -n +2 |awk '{print $1}')
-    /dpdk/tools/dpdk-devbind.py --bind=igb_uio $interfaces
+    /opt/tempT/$DPDK_VERSION/usertools//dpdk-devbind.py --bind=igb_uio $interfaces
 }
 
 run_testpmd()
 {
     blacklist=$(lspci |grep Eth |awk '{print $1}'|head -1)
-    cd /dpdk
-    sudo ./destdir/bin/testpmd -c 0x07 -n 4 -b $blacklist -- -a --eth-peer=1,$DST_MAC --forward-mode=mac
+    cd /opt/tempT/$DPDK_VERSION/x86_64-native-linuxapp-gcc/app
+    sudo ./testpmd -c 0x07 -n 4 -b $blacklist -- -a --eth-peer=1,$DST_MAC --forward-mode=mac
 }
 
 main()