IPV6 testing & minor changes and fixes 32/70232/1
authorLuc Provoost <luc.provoost@intel.com>
Thu, 28 May 2020 10:57:46 +0000 (12:57 +0200)
committerLuc Provoost <luc.provoost@intel.com>
Thu, 28 May 2020 10:57:46 +0000 (12:57 +0200)
IPV6 test has been added. The generator will now generate IPV6 packets
using NDP to resolve MAC addresses. The hex IP addresses in the inline
definition of the packets in the cfg files is now calculated by a lua
function called in parameters.lua. The hard-coded path /home/centos has
been replaced by ~. An error in the speed calculations has been fixed.
See the RapidTest class for details. The actual number of generated
flows is now reported. If the requested number of flows is not a power
of 2, the lowest power of 2 that is larger than the requested number of
flows will be used and reported.

Change-Id: I36b8d345b4a03c2cf358c19ec353ca8ad2831293
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
20 files changed:
VNFs/DPPD-PROX/helper-scripts/rapid/basicrapid.test
VNFs/DPPD-PROX/helper-scripts/rapid/centos.json
VNFs/DPPD-PROX/helper-scripts/rapid/check_prox_system_setup.sh
VNFs/DPPD-PROX/helper-scripts/rapid/config_file
VNFs/DPPD-PROX/helper-scripts/rapid/deploycentostools.sh
VNFs/DPPD-PROX/helper-scripts/rapid/devbind.sh
VNFs/DPPD-PROX/helper-scripts/rapid/genv6.cfg [new file with mode: 0644]
VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua [new file with mode: 0644]
VNFs/DPPD-PROX/helper-scripts/rapid/ipv6.test [new file with mode: 0644]
VNFs/DPPD-PROX/helper-scripts/rapid/l3framerate.test
VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml
VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml
VNFs/DPPD-PROX/helper-scripts/rapid/rapid-openstack-server.yaml
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_flowsizetest.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_warmuptest.py
VNFs/DPPD-PROX/helper-scripts/rapid/swapv6.cfg [new file with mode: 0644]

index 69a5a30..25561bc 100644 (file)
@@ -49,13 +49,17 @@ test=flowsizetest
 # all combinations must be meeting the same threshold
 # The threshold is expressed in Mpps
 pass_threshold=0.1
-imixs=[[64], [64,800],[128]]
+# Each element in the imix list will result in a separate test. Each element
+# is on its turn a list of packet sizes which will be used during one test
+# execution. If you only want to test 1 size, define a list with only one
+# element.
+imixs=[[64],[64,250,800,800]]
 # the number of flows in the list need to be powers of 2, max 2^30
 # If not a power of 2, we will use the lowest power of 2 that is larger than
 # the requested number of flows. e.g. 9 will result in 16 flows
 flows=[64,500000]
 # Setting one of the following thresholds to infinity (inf)
-# results in the criterion not being evaluated to rate the test as scussesful
+# results in the criterion not being evaluated to rate the test as succesful
 drop_rate_threshold = 0.1
 lat_avg_threshold = 50
 lat_perc_threshold = 80
index 92617b8..964de93 100644 (file)
    {
    "type": "file",
    "source": "./check_prox_system_setup.sh",
-   "destination": "/home/centos/"
+   "destination": "~/"
    },
    {
    "type": "file",
    "source": "./check-prox-system-setup.service",
-   "destination": "/home/centos/"
+   "destination": "~/"
    },
    {
    "type": "file",
    "source": "./sharkproxlog.sh",
-   "destination": "/home/centos/"
+   "destination": "~/"
    },
    {
    "type": "file",
    "source": "./deploycentostools.sh",
-   "destination": "/home/centos/"
+   "destination": "~/"
    },
    {
    "type": "shell",
    "inline": [
-     "chmod a+x /home/centos/deploycentostools.sh",
-     "/home/centos/deploycentostools.sh -u deploy" ]
+     "chmod a+x ~/deploycentostools.sh",
+     "~/deploycentostools.sh -u deploy" ]
    }
 ]
 }
index 8621d1f..984f025 100755 (executable)
@@ -18,37 +18,38 @@ NCPUS="$(lscpu | egrep '^CPU\(s\):' | awk '{ print $2 }')"
 MAXCOREID="$((NCPUS-1))"
 
 filename="/etc/tuned/realtime-virtual-guest-variables.conf"
-logfile="/home/centos/prox_system_setup.log"
+#logfile="/home/centos/prox_system_setup.log"
+logfile="/opt/rapid/prox_system_setup.log"
 if [ -f "$filename" ]
 then
-        while read -r line
-        do
-                case $line in
-                        isolated_cores=1-$MAXCOREID*)
-                                echo "Isolated CPU(s) OK, no reboot: $line">>$logfile
-                                sed -i 's/PubkeyAuthentication no/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
-                                service sshd restart
-                                modprobe uio
-                                insmod /home/centos/dpdk/build/kmod/igb_uio.ko
-                                exit 0
-                        ;;
-                        isolated_cores=*)
-                                echo "Isolated CPU(s) NOK, change the config and reboot: $line">>$logfile
-                                sed -i "/^isolated_cores=.*/c\isolated_cores=1-$MAXCOREID" $filename
-                                tuned-adm profile realtime-virtual-guest
-                                reboot
-                                exit 0
-                        ;;
-                        *)
-                                echo "$line"
-                        ;;
-                esac
-        done < "$filename"
-        echo "isolated_cores=1-$MAXCOREID" >> $filename
-        echo "No Isolated CPU(s) defined in config, line added: $line">>$logfile
-        tuned-adm profile realtime-virtual-guest
-        reboot
+    while read -r line
+    do
+        case $line in
+            isolated_cores=1-$MAXCOREID*)
+                echo "Isolated CPU(s) OK, no reboot: $line">>$logfile
+                sed -i 's/PubkeyAuthentication no/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
+                service sshd restart
+                modprobe uio
+                insmod /opt/rapid/dpdk/build/kmod/igb_uio.ko
+                exit 0
+            ;;
+            isolated_cores=*)
+                echo "Isolated CPU(s) NOK, change the config and reboot: $line">>$logfile
+                sed -i "/^isolated_cores=.*/c\isolated_cores=1-$MAXCOREID" $filename
+                tuned-adm profile realtime-virtual-guest
+                reboot
+                exit 0
+            ;;
+            *)
+                echo "$line"
+            ;;
+        esac
+    done < "$filename"
+    echo "isolated_cores=1-$MAXCOREID" >> $filename
+    echo "No Isolated CPU(s) defined in config, line added: $line">>$logfile
+    tuned-adm profile realtime-virtual-guest
+    reboot
 else
-        echo "$filename not found.">>$logfile
+    echo "$filename not found.">>$logfile
 fi
 
index c412b61..e599164 100644 (file)
@@ -1,7 +1,7 @@
 [OpenStack]
 cloud_name = openstackL6
 stack_name = rapid
-heat_template = openstack-rapid.yaml
+heat_template= openstack-rapid.yaml
 heat_param = params_rapid.yaml
 keypair_name = rapid_key
 user = centos
index 18b4546..f89d4fe 100644 (file)
 
 # Directory for package build
 BUILD_DIR="/opt/rapid"
-# Directory where the packer tool has copied some files (e.g. check_prox_system_setup.sh)
-# Runtime scripts are assuming ${WORK_DIR} as the directory for PROX. Check the rundir variable in runrapid.py. Should be the same!
-# This variable is defined in 4 different places and should have the same value: centos.json, deploycentostools.sh, check_prox_system_setup.sh and runrapid.py
-WORK_DIR="/home/centos"
 DPDK_VERSION="19.05"
 PROX_COMMIT="b71a4cfd"
 PROX_CHECKOUT="git checkout ${PROX_COMMIT}"
 ## Next line is overruling the PROX_COMMIT and will replace the version with a very specific patch. Should be commented out
 ##     if you want to use a committed version of PROX with the COMMIT ID specified above
-##PROX_CHECKOUT="git fetch \"https://gerrit.opnfv.org/gerrit/samplevnf\" refs/changes/75/69475/2 && git checkout FETCH_HEAD"
-##Following line has the commit for testing IMIX
-#PROX_CHECKOUT="git fetch \"https://gerrit.opnfv.org/gerrit/samplevnf\" refs/changes/88/69488/3 && git checkout FETCH_HEAD"
-##Following line has the commit for testing IMIX, IPV6, ... It is the merge of all PROX commits on May 12th
-PROX_CHECKOUT="git fetch \"https://gerrit.opnfv.org/gerrit/samplevnf\" refs/changes/59/69859/7 && git checkout FETCH_HEAD"
+##Following line has the commit for testing IMIX, IPV6, ... It is the merge of all PROX commits on May 27th 2020
+PROX_CHECKOUT="git fetch \"https://gerrit.opnfv.org/gerrit/samplevnf\" refs/changes/23/70223/1 && git checkout FETCH_HEAD"
 MULTI_BUFFER_LIB_VER="0.52"
 export RTE_SDK="${BUILD_DIR}/dpdk-${DPDK_VERSION}"
 export RTE_TARGET="x86_64-native-linuxapp-gcc"
@@ -89,9 +82,9 @@ function os_cfg()
 
        # Install the check_tuned_params service to make sure that the grub cmd line has the right cpus in isolcpu. The actual number of cpu's
        # assigned to this VM depends on the flavor used. We don't know at this time what that will be.
-       ${SUDO} chmod +x ${WORK_DIR}/check_prox_system_setup.sh
-       ${SUDO} cp -r ${WORK_DIR}/check_prox_system_setup.sh /usr/local/libexec/
-       ${SUDO} cp -r ${WORK_DIR}/check-prox-system-setup.service /etc/systemd/system/
+       ${SUDO} chmod +x ${HOME}/check_prox_system_setup.sh
+       ${SUDO} mv ${HOME}/check_prox_system_setup.sh /usr/local/libexec/
+       ${SUDO} mv ${HOME}/check-prox-system-setup.service /etc/systemd/system/
        ${SUDO} systemctl daemon-reload
        ${SUDO} systemctl enable check-prox-system-setup.service
     # Following lines are added to fix the following issue: When the VM gets
@@ -155,7 +148,7 @@ function dpdk_install()
        tar -xf ./dpdk-${DPDK_VERSION}.tar.xz
        popd > /dev/null 2>&1
 
-       ${SUDO} ln -s ${RTE_SDK} ${WORK_DIR}/dpdk
+       ${SUDO} ln -s ${RTE_SDK} ${BUILD_DIR}/dpdk
 
        pushd ${RTE_SDK} > /dev/null 2>&1
        make config T=${RTE_TARGET}
@@ -184,6 +177,7 @@ function prox_compile()
        # Compile PROX
        pushd ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX
        make -j`getconf _NPROCESSORS_ONLN`
+       ${SUDO} cp ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/build/app/prox ${HOME}/prox
        popd > /dev/null 2>&1
 }
 
@@ -193,10 +187,9 @@ function prox_install()
        pushd ${BUILD_DIR} > /dev/null 2>&1
        git clone https://git.opnfv.org/samplevnf
        pushd ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX > /dev/null 2>&1
-       ${PROX_CHECKOUT}
+       bash -c "${PROX_CHECKOUT}"
        popd > /dev/null 2>&1
        prox_compile
-       ${SUDO} cp ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/build/app/prox ${WORK_DIR}/prox
        popd > /dev/null 2>&1
 }
 
@@ -206,16 +199,16 @@ function port_info_build()
 
        pushd ${BUILD_DIR}/port_info > /dev/null 2>&1
        make
-       ${SUDO} cp ${BUILD_DIR}/port_info/build/app/port_info ${WORK_DIR}/port_info
+       ${SUDO} cp ${BUILD_DIR}/port_info/build/app/port_info ${HOME}/port_info
        popd > /dev/null 2>&1
 }
 
 function create_minimal_install()
 {
-       ldd ${WORK_DIR}/prox | awk '{ if ($(NF-1) != "=>") print $(NF-1) }' >> ${BUILD_DIR}/list_of_install_components
+       ldd ${HOME}/prox | awk '{ if ($(NF-1) != "=>") print $(NF-1) }' >> ${BUILD_DIR}/list_of_install_components
 
-       echo "${WORK_DIR}/prox" >> ${BUILD_DIR}/list_of_install_components
-       echo "${WORK_DIR}/port_info" >> ${BUILD_DIR}/list_of_install_components
+       echo "${HOME}/prox" >> ${BUILD_DIR}/list_of_install_components
+       echo "${HOME}/port_info" >> ${BUILD_DIR}/list_of_install_components
 
        tar -czvhf ${BUILD_DIR}/install_components.tgz -T ${BUILD_DIR}/list_of_install_components
 }
index ac6ccaa..f2e3fe2 100755 (executable)
@@ -2,7 +2,7 @@ link="$(sudo ip -o link | grep MACADDRESS |cut -d":" -f 2)"
 if [ -n "$link" ];
 then
        echo Need to bind
-       sudo ~/dpdk/usertools/dpdk-devbind.py --force --bind igb_uio $(sudo ~/dpdk/usertools/dpdk-devbind.py --status |grep  $link | cut -d" " -f 1)
+       sudo /opt/rapid/dpdk/usertools/dpdk-devbind.py --force --bind igb_uio $(sudo /opt/rapid/dpdk/usertools/dpdk-devbind.py --status |grep  $link | cut -d" " -f 1)
 else
        echo Assuming port is already bound to DPDK
 fi
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/genv6.cfg b/VNFs/DPPD-PROX/helper-scripts/rapid/genv6.cfg
new file mode 100644 (file)
index 0000000..8f5e399
--- /dev/null
@@ -0,0 +1,78 @@
+;;
+;; Copyright (c) 2010-2020 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.
+;;
+
+[lua]
+dofile("parameters.lua")
+
+[eal options]
+-n=4 ; force number of memory channels
+no-output=no ; disable DPDK debug output
+eal=--proc-type auto ${eal}
+
+[port 0]
+name=p0
+rx desc=2048
+tx desc=2048
+vlan=yes
+
+[variables]
+$mbs=8
+
+[defaults]
+mempool size=8K
+
+[global]
+name=${name}
+heartbeat timeout=${heartbeat}
+
+[core 0]
+mode=master
+
+[core $gencores]
+name=gen
+task=0
+mode=gen
+sub mode=ndp
+tx port=p0
+bps=1000
+pkt inline=00 00 01 00 00 01 00 00 02 00 00 02 86 dd 60 00 00 00 00 1a 11 40 ${local_hex_ip1} ${dest_hex_ip1} 13 88 13 88 00 1a 55 7b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+global ipv6=${local_ip1}
+min bulk size=$mbs
+max bulk size=16
+drop=yes
+lat pos=62
+packet id pos=66
+signature pos=72
+signature=0x98765432
+accuracy pos=76
+pkt size=80
+
+
+
+[core $latcores]
+name=lat
+task=0
+mode=lat
+sub mode=ndp
+rx port=p0
+lat pos=62
+accuracy pos=76
+packet id pos=66
+signature=0x98765432
+signature pos=72
+accuracy limit nsec=1000000
+latency bucket size=${bucket_size_exp}
+global ipv6=${local_ip1}
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua b/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua
new file mode 100644 (file)
index 0000000..d38bb80
--- /dev/null
@@ -0,0 +1,61 @@
+--
+-- Copyright (c) 2010-2020 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.
+--
+
+function convertIPToHex(ip)
+  local address_chunks = {}
+  if type(ip) ~= "string" then
+    print ("IP ADDRESS ERROR: ", ip)
+    return "IP ADDRESS ERROR"
+  end
+
+  local chunks = {ip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)$")}
+  if #chunks == 4 then
+    for i,v in ipairs(chunks) do
+      if tonumber(v) > 255 then
+        print ("IPV4 ADDRESS ERROR: ", ip)
+        return "IPV4 ADDRESS ERROR"
+      end
+      address_chunks[#address_chunks + 1] = string.format ("%02x", v)
+    end
+    result = table.concat(address_chunks, " ")
+    print ("Hex IPV4: ", result)
+    return result
+  end
+
+  delimiter = ":"
+  for match in (ip..delimiter):gmatch("(.-)"..delimiter) do
+    if match ~= "" then
+      number = tonumber(match, 16)
+      if number <= 65535 then
+        table.insert(address_chunks, string.format("%02x %02x",number/256,number % 256))
+      end
+    else
+      table.insert(address_chunks, "")
+    end
+  end
+  for i, chunk in ipairs(address_chunks) do
+    if chunk =="" then
+      table.remove(address_chunks, i)
+      for j = 1,(8-#address_chunks) do
+        table.insert(address_chunks, i, "00 00")
+      end
+      break
+    end
+  end
+  result = table.concat(address_chunks, " ")
+  print ("Hex IPV6: ", result)
+  return result
+end
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/ipv6.test b/VNFs/DPPD-PROX/helper-scripts/rapid/ipv6.test
new file mode 100644 (file)
index 0000000..2dd571b
--- /dev/null
@@ -0,0 +1,64 @@
+##
+## Copyright (c) 2010-2019 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.
+##
+
+[TestParameters]
+name = BasicSwapTesting
+number_of_tests = 2
+total_number_of_test_machines = 2
+lat_percentile = 99
+
+[TestM1]
+name = Generator
+config_file = genv6.cfg
+dest_vm = 2
+gencores = [1]
+latcores = [3]
+#bucket_size_exp = 12
+
+[TestM2]
+name = Swap
+config_file = swapv6.cfg
+cores = [1,2]
+#prox_socket = true
+#prox_launch_exit = true
+
+[test1]
+test=warmuptest
+flowsize=512
+imix=[64]
+warmupspeed=1
+warmuptime=2
+
+[test2]
+test=flowsizetest
+# Following parameter defines the success criterium for the test.
+# When this test uses multiple combinations of packet size and flows,
+# all combinations must be meeting the same threshold
+# The threshold is expressed in Mpps
+pass_threshold=0.1
+imixs=[[64], [128]]
+# the number of flows in the list need to be powers of 2, max 2^30
+# If not a power of 2, we will use the lowest power of 2 that is larger than
+# the requested number of flows. e.g. 9 will result in 16 flows
+flows=[64,500000]
+# Setting one of the following thresholds to infinity (inf)
+# results in the criterion not being evaluated to rate the test as succesful
+drop_rate_threshold = 0.1
+lat_avg_threshold = 50
+lat_perc_threshold = 80
+lat_max_threshold = inf
+accuracy = 1
+startspeed = 50
index 5b4b914..67a57ce 100644 (file)
@@ -42,6 +42,7 @@ warmuptime=2
 test=fixed_rate
 imixs=[[64],[128]]
 # the number of flows in the list need to be powers of 2, max 2^20
-# Select from following numbers: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576
+# If not a power of 2, we will use the lowest power of 2 that is larger than
+# the requested number of flows. e.g. 9 will result in 16 flows
 flows=[1,64]
 startspeed=5
index 2dec717..1c6fbee 100644 (file)
@@ -108,8 +108,8 @@ outputs:
   data_plane_ips:
     description: List of list of list of DataPlane IPs of the VMs
     value: 
-      - {get_attr: [PROXVMs, data_plane_ip]}
-      - {get_attr: [PROX2VMs, data_plane_ip]}
+      - {get_attr: [PROXVMs, data_plane_ips]}
+      - {get_attr: [PROX2VMs, data_plane_ips]}
   data_plane_macs:
     description: List of list of list of DataPlane MACs of the VMs
     value: 
index 3640905..7c1884e 100644 (file)
@@ -1,5 +1,6 @@
 parameters:\r
   public_net_name: admin_floating_net\r
+  data_net_name: dataplane-network\r
   PROX_image: rapidVM\r
   my_availability_zone: nova\r
   security_group: prox_security_group\r
index f1b5274..84311e2 100644 (file)
@@ -72,7 +72,7 @@ outputs:
   mngmt_ip:
     description: Management IP of the VM
     value: {get_attr: [floating_ip, floating_ip_address ]}
-  data_plane_ip:
+  data_plane_ips:
     description: List of DataPlane IPs of the VM
     value:
         - {get_attr: [data_port, fixed_ips, 0, ip_address]}
index f5155a5..661554d 100644 (file)
@@ -126,7 +126,7 @@ class FlowSizeTest(RapidTest):
                 self.gen_machine.reset_stats()
                 if self.sut_machine:
                     self.sut_machine.reset_stats()
-                self.gen_machine.set_flows(flow_number)
+                flow_number = self.gen_machine.set_flows(flow_number)
                 self.set_background_flows(self.background_machines, flow_number)
                 endspeed = None
                 speed = self.get_start_speed_and_init(size)
index cfd0bb1..3540753 100644 (file)
@@ -37,32 +37,43 @@ class RandomPortBits(object):
             # and that might be an invalid UDP port and result in 
             # packets begin discarded
         src_number_of_random_bits = number_of_random_bits // 2
-        dst_number_of_random_bits = number_of_random_bits - src_number_of_random_bits
-        src_port_bitmap = '1000000000000000'.replace ('0','X',src_number_of_random_bits)
-        dst_port_bitmap = '1000000000000000'.replace ('0','X',dst_number_of_random_bits)
-        return [src_port_bitmap, dst_port_bitmap]
+        dst_number_of_random_bits = (number_of_random_bits -
+                src_number_of_random_bits)
+        src_port_bitmap = '1000000000000000'.replace ('0','X',
+                src_number_of_random_bits)
+        dst_port_bitmap = '1000000000000000'.replace ('0','X',
+                dst_number_of_random_bits)
+        return [src_port_bitmap, dst_port_bitmap, 1<<number_of_random_bits]
 
 class RapidGeneratorMachine(RapidMachine):
     """
     Class to deal with rapid configuration files
     """
     def get_cores(self):
-        return (self.machine_params['gencores'] + self.machine_params['latcores'])
+        return (self.machine_params['gencores'] +
+                self.machine_params['latcores'])
 
     def generate_lua(self, vim):
-        appendix = 'gencores="%s"\n'% ','.join(map(str, self.machine_params['gencores']))
-        appendix = appendix + 'latcores="%s"\n'% ','.join(map(str, self.machine_params['latcores']))
+        appendix = 'gencores="%s"\n'% ','.join(map(str,
+            self.machine_params['gencores']))
+        appendix = appendix + 'latcores="%s"\n'% ','.join(map(str,
+            self.machine_params['latcores']))
         if 'gw_vm' in self.machine_params.keys():
-            for index, gw_ip in enumerate(self.machine_params['gw_ips'], start = 1):
+            for index, gw_ip in enumerate(self.machine_params['gw_ips'],
+                    start = 1):
                 appendix = appendix + 'gw_ip{}="{}"\n'.format(index, gw_ip)
-                appendix = appendix + 'gw_hex_ip{}="{}"\n'.format(index, self.ip2hex(gw_ip))
+                appendix = (appendix +
+                        'gw_hex_ip{}=convertIPToHex(gw_ip{})\n'.format(index,
+                            index))
         if 'bucket_size_exp' in self.machine_params.keys():
             self.bucket_size_exp = self.machine_params['bucket_size_exp']
         else:
             self.bucket_size_exp = 11
-        appendix = appendix + 'bucket_size_exp="{}"\n'.format(self.bucket_size_exp)
+        appendix = (appendix +
+                'bucket_size_exp="{}"\n'.format(self.bucket_size_exp))
         if 'heartbeat' in self.machine_params.keys():
-            appendix = appendix + 'heartbeat="%s"\n'% self.machine_params['heartbeat']
+            appendix = (appendix +
+                    'heartbeat="%s"\n'% self.machine_params['heartbeat'])
         else:
             appendix = appendix + 'heartbeat="60"\n'
         super().generate_lua(vim, appendix)
@@ -103,12 +114,13 @@ class RapidGeneratorMachine(RapidMachine):
                     prox_sizes)
 
     def set_flows(self, number_of_flows):
-        source_port,destination_port = RandomPortBits.get_bitmap(
+        source_port, destination_port, actualflows = RandomPortBits.get_bitmap(
                 number_of_flows)
         self.socket.set_random(self.machine_params['gencores'],0,34,
                 source_port,2)
         self.socket.set_random(self.machine_params['gencores'],0,36,
                 destination_port,2)
+        return actualflows
 
     def start_gen_cores(self):
         self.socket.start(self.machine_params['gencores'])
index eeed238..89e337d 100644 (file)
@@ -43,15 +43,15 @@ class ImpairTest(RapidTest):
         imix = self.test['imix']
         size = mean (imix)
         flow_number = self.test['flowsize']
+        attempts = 0
+        self.gen_machine.set_udp_packet_size(imix)
+        flow_number = self.gen_machine.set_flows(flow_number)
+        self.gen_machine.start_latency_cores()
         RapidLog.info("+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+")
         RapidLog.info("| Generator is sending UDP ("+'{:>5}'.format(flow_number)+" flow) packets ("+ '{:>5}'.format(size) +" bytes) to SUT via GW dropping and delaying packets. SUT sends packets back. Use ctrl-c to stop the test    |")
         RapidLog.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+")
         RapidLog.info("| Test   |  Speed requested   | Sent to NIC    |  Sent by Gen   | Forward by SUT |  Rec. by Gen   |  Avg. Latency  |  Max. Latency  |  Packets Lost  | Loss Ratio |")
         RapidLog.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+")
-        attempts = 0
-        self.gen_machine.set_udp_packet_size(imix)
-        self.gen_machine.set_flows(flow_number)
-        self.gen_machine.start_latency_cores()
         speed = self.test['startspeed']
         self.gen_machine.set_generator_speed(speed)
         while True:
index b5b90d6..a052ba3 100644 (file)
@@ -24,11 +24,6 @@ class RapidMachine(object):
     """
     Class to deal with rapid configuration files
     """
-    @staticmethod
-    def ip2hex(ip):
-        ip = ip.split('.')
-        return(hex(int(ip[0]))[2:].zfill(2) + ' ' + hex(int(ip[1]))[2:].zfill(2) + ' ' + hex(int(ip[2]))[2:].zfill(2) + ' ' + hex(int(ip[3]))[2:].zfill(2))
-
     def __init__(self, key, user, vim, rundir, machine_params):
         self.name = machine_params['name']
         self.ip = machine_params['admin_ip']
@@ -78,10 +73,11 @@ class RapidMachine(object):
         self.all_tasks_for_this_cfg = set(re.findall("task\s*=\s*(\d+)",PROXConfig))
         self.LuaFileName = 'parameters-{}.lua'.format(self.ip)
         with open(self.LuaFileName, "w") as LuaFile:
+            LuaFile.write('require "helper"\n')
             LuaFile.write('name="%s"\n'% self.name)
             for index, dp_port in enumerate(self.dp_ports, start = 1):
                 LuaFile.write('local_ip{}="{}"\n'.format(index, dp_port['ip']))
-                LuaFile.write('local_hex_ip{}="{}"\n'.format(index, self.ip2hex(dp_port['ip'])))
+                LuaFile.write('local_hex_ip{}=convertIPToHex(local_ip{})\n'.format(index, index))
             if vim in ['kubernetes']:
                 LuaFile.write("eal=\"--socket-mem=512,0 --file-prefix %s --pci-whitelist %s\"\n" % (self.name, self.machine_params['dp_pci_dev']))
             else:
@@ -93,11 +89,11 @@ class RapidMachine(object):
             if 'dest_ports' in self.machine_params.keys():
                 for index, dest_port in enumerate(self.machine_params['dest_ports'], start = 1):
                     LuaFile.write('dest_ip{}="{}"\n'.format(index, dest_port['ip']))
-                    LuaFile.write('dest_hex_ip{}="{}"\n'.format(index, self.ip2hex(dest_port['ip'])))
-                    LuaFile.write('dest_hex_ip{}="{}"\n'.format(index, self.ip2hex(dest_port['ip'])))
+                    LuaFile.write('dest_hex_ip{}=convertIPToHex(dest_ip{})\n'.format(index, index))
                     LuaFile.write('dest_hex_mac{}="{}"\n'.format(index , dest_port['mac'].replace(':',' ')))
             LuaFile.write(appendix)
         self._client.scp_put(self.LuaFileName, self.rundir + '/parameters.lua')
+        self._client.scp_put('helper.lua', self.rundir + '/helper.lua')
 
     def start_prox(self, autostart=''):
         if self.machine_params['prox_launch_exit']:
index 2466d89..b39520c 100644 (file)
@@ -29,22 +29,34 @@ class RapidTest(object):
     @staticmethod
     def get_percentageof10Gbps(pps_speed,size):
         # speed is given in pps, returning % of 10Gb/s
-        return (pps_speed / 1000000.0 * 0.08 * (size+28))
+        # 12 bytes is the inter packet gap 
+        # pre-amble is 7 bytes
+        # SFD (start of frame delimiter) is 1 byte
+        # Total of 20 bytes overhead per packet
+        return (pps_speed / 1000000.0 * 0.08 * (size+20))
 
     @staticmethod
     def get_pps(speed,size):
         # speed is given in % of 10Gb/s, returning Mpps
-        return (speed * 100.0 / (8*(size+28)))
+        # 12 bytes is the inter packet gap 
+        # pre-amble is 7 bytes
+        # SFD (start of frame delimiter) is 1 byte
+        # Total of 20 bytes overhead per packet
+        return (speed * 100.0 / (8*(size+20)))
 
     @staticmethod
     def get_speed(packet_speed,size):
         # return speed in Gb/s
-        return (packet_speed / 1000.0 * (8*(size+28)))
+        # 12 bytes is the inter packet gap 
+        # pre-amble is 7 bytes
+        # SFD (start of frame delimiter) is 1 byte
+        # Total of 20 bytes overhead per packet
+        return (packet_speed / 1000.0 * (8*(size+20)))
 
     @staticmethod
     def set_background_flows(background_machines, number_of_flows):
         for machine in background_machines:
-            machine.set_flows(number_of_flows)
+            _ = machine.set_flows(number_of_flows)
 
     @staticmethod
     def set_background_speed(background_machines, speed):
index 587ef22..e316f6e 100644 (file)
@@ -42,7 +42,7 @@ class WarmupTest(RapidTest):
         self.gen_machine.set_generator_speed(WARMUPSPEED)
         self.gen_machine.set_udp_packet_size(imix)
     #    gen_machine['socket'].set_value(gencores,0,56,1,1)
-        self.gen_machine.set_flows(FLOWSIZE)
+        _ = self.gen_machine.set_flows(FLOWSIZE)
         self.gen_machine.start()
         time.sleep(WARMUPTIME)
         self.gen_machine.stop()
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/swapv6.cfg b/VNFs/DPPD-PROX/helper-scripts/rapid/swapv6.cfg
new file mode 100644 (file)
index 0000000..ce323e9
--- /dev/null
@@ -0,0 +1,47 @@
+;;
+;; Copyright (c) 2010-2019 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.
+;;
+
+[lua]
+dofile("parameters.lua")
+
+[eal options]
+-n=4 ; force number of memory channels
+no-output=no ; disable DPDK debug output
+eal=--proc-type auto ${eal}
+
+[port 0]
+name=if0
+mac=hardware
+vlan=yes
+
+[defaults]
+mempool size=8K
+
+[global]
+name=${name}
+
+[core 0]
+mode=master
+
+[core $cores]
+name=swap
+task=0
+mode=swap
+sub mode=ndp
+rx port=if0
+tx port=if0
+global ipv6=${local_ip1}
+drop=no