summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/openstackrapid/README64
-rwxr-xr-xVNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py364
-rwxr-xr-x[-rw-r--r--]VNFs/DPPD-PROX/helper-scripts/openstackrapid/devbind.sh (renamed from VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_sut_user_data.sh)14
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen.cfg18
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py6
-rwxr-xr-x[-rw-r--r--]VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_user_data.sh (renamed from VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_gen_user_data.sh)3
-rwxr-xr-xVNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.py445
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml110
-rwxr-xr-xVNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py453
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml136
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/openstackrapid/sut.cfg13
11 files changed, 1098 insertions, 528 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README
index 49d819d8..7c229904 100644
--- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README
@@ -31,12 +31,17 @@ image in the same directory with the following characteristics:
Source the openrc file of the OpenStack environment so that the OpenStack CLI
commands can be run:
# source openrc
-Now you can run the rapid.py file. Use help for more info on the usage:
- # ./rapid.py --help
+Now you can run the createrapid.py file. Use help for more info on the usage:
+ # ./createrapid.py --help
-rapid will use the OpenStack CLI to create the flavor, key-pair, network, image,
+runrapid.py will use the OpenStack CLI to create the flavor, key-pair, network, image,
stack, ...
-Then it will connect to the 2 VMs that have been instantiated and it will launch
+It will create a <STACK>.cfg file containing all info that will be used by runrapid.py
+to actually run the tests. Logging can be found in the CREATE<STACK>.log file
+
+Now you can run the runrapid.py file. Use help for more info on the usage:
+ # ./runrapid.py --help
+The script will connect to the 2 VMs that have been instantiated and it will launch
PROX in both VMs.
Once that is done it will connect to the PROX tcp socket and start sending
commands to run the actual test.
@@ -45,13 +50,46 @@ The PROX instance in the Generator VM will generate packets which will arrive in
the PROX instance running on the SUT (System Under Test) VM. The SUT will then
send the packets back to the generator by swapping source and destination.
-Notes about prox_gen_user_data.sh and prox_sut_user_data.sh scripts:
-- These scripts contain commands that will be executed using cloud-init at
- startup of the VMs. They contain a hard-coded PCI address for the DPDK
- interface that will be used by PROX. You might want to check that this is
- actually the right PCI address.
-- These scripts also assume some specific DPDK directory and tools which might
- change over different DPDK release. They have been tested with DPDK-17.02.
-- These scripts are also assuming that this interface is on the "dpdk-network"
- network managed by OpenStack.
+Notes about prox_user_data.sh script:
+- The script contains commands that will be executed using cloud-init at
+ startup of the VMs.
+- The script also assumes some specific DPDK directory and tools which might
+ change over different DPDK release. This release has been tested with DPDK-17.02.
+
+An example of the cfg file generated by createrapid.py can be found below.
+Note that this file can be created manually in case the stack is created in a
+different way (not using the createrapid.py). This can be useful in case you are
+not using OpenStack as a VIM or when using special configurations that cannot be
+achieved using createrapid.py. Only the [Generator] and [SUT] section are used as
+input for runrapid.py. In the [SUT] section, you can also set admin_ip = 'none'.
+In that case, only the generator will be controlled by runrapid.py and you must
+start the SUT manually.
+
+[Generator]
+admin_ip = 192.168.3.139
+dp_ip = 10.10.10.3
+hex_dp_ip = 0a 0a 0a 03
+dp_mac = fa:16:3e:96:6c:e7
+
+[SUT]
+admin_ip = 192.168.3.133
+dp_ip = 10.10.10.6
+hex_dp_ip = 0a 0a 0a 06
+dp_mac = fa:16:3e:0b:9c:57
+
+[OpenStack]
+stack = rapidTestEnv
+yaml = rapid.yaml
+key = prox
+flavor = prox_flavor
+image = rapidVM
+image_file = rapidVM.qcow2
+dataplane_network = dataplane-network
+subnet = dpdk-subnet
+subnet_cidr = 10.10.10.0/24
+admin_network = admin_internal_net
+
+[rapid]
+loglevel = DEBUG
+version = 17.09.03
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py
new file mode 100755
index 00000000..9c67453d
--- /dev/null
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py
@@ -0,0 +1,364 @@
+#!/usr/bin/python
+
+##
+## Copyright (c) 2010-2017 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.
+##
+
+from __future__ import print_function
+
+import os
+import stat
+import sys
+import time
+import subprocess
+import getopt
+import re
+import logging
+from logging.handlers import RotatingFileHandler
+from logging import handlers
+from prox_ctrl import prox_ctrl
+import ConfigParser
+
+version="17.09.03"
+stack = "rapidTestEnv" #Default string for stack
+yaml = "rapid.yaml" #Default string for yaml file
+key = "prox" # This is also the default in the yaml file....
+flavor = "prox_flavor" # This is also the default in the yaml file....
+image = "rapidVM" # This is also the default in the yaml file....
+image_file = "rapidVM.qcow2"
+dataplane_network = "dataplane-network" # This is also the default in the yaml file....
+subnet = "dpdk-subnet" #Hardcoded at this moment
+subnet_cidr="10.10.10.0/24" # cidr for dataplane
+admin_network="admin_internal_net"
+loglevel="DEBUG" # sets log level for writing to file
+runtime=10 # time in seconds for 1 test run
+
+def usage():
+ print("usage: rapid [--version] [-v]")
+ print(" [--stack STACK_NAME]")
+ print(" [--yaml YAML_FILE]")
+ print(" [--key KEY_NAME]")
+ print(" [--flavor FLAVOR_NAME]")
+ print(" [--image IMAGE_NAME]")
+ print(" [--image_file IMAGE_FILE]")
+ print(" [--dataplane_network DP_NETWORK]")
+ print(" [--admin_network ADMIN_NETWORK]")
+ print(" [--log DEBUG|INFO|WARNING|ERROR|CRITICAL")
+ print(" [-h] [--help]")
+ print("")
+ print("Command-line interface to RAPID")
+ print("")
+ print("optional arguments:")
+ print(" -v, --version Show program's version number and exit")
+ print(" --stack STACK_NAME Specify a name for the heat stack. Default is rapidTestEnv.")
+ print(" --yaml YAML_FILE Specify the yaml file to be used. Default is rapid.yaml.")
+ print(" --key KEY_NAME Specify the key to be used. Default is prox.")
+ print(" --flavor FLAVOR_NAME Specify the flavor to be used. Default is prox_flavor.")
+ print(" --image IMAGE_NAME Specify the image to be used. Default is rapidVM.")
+ print(" --image_file IMAGE_FILE Specify the image qcow2 file to be used. Default is rapidVM.qcow2.")
+ print(" --dataplane_network NETWORK Specify the network name to be used for the dataplane. Default is dataplane-network.")
+ print(" --admin_network NETWORK Specify the network name to be used for the control plane. Default is admin-network.")
+ print(" --log Specify logging level for log file output, screen output level is hard coded")
+ print(" -h, --help Show help message and exit.")
+ print("")
+ print("To delete the rapid stack, type the following command")
+ print(" openstack stack delete --yes --wait rapidTestEnv")
+ print("Note that rapidTestEnv is the default stack name. Replace with STACK_NAME if needed")
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "vh", ["version","help", "yaml=","stack=","key=","flavor=","image=","dataplane_network=","admin_network=","log="])
+except getopt.GetoptError as err:
+ print("===========================================")
+ print(str(err))
+ print("===========================================")
+ usage()
+ sys.exit(2)
+if args:
+ usage()
+ sys.exit(2)
+for opt, arg in opts:
+ if opt in ("-h", "--help"):
+ usage()
+ sys.exit()
+ if opt in ("-v", "--version"):
+ print("Rapid Automated Performance Indication for Dataplane "+version)
+ sys.exit()
+ if opt in ("--stack"):
+ stack = arg
+ print ("Using '"+stack+"' as name for the stack")
+ elif opt in ("--yaml"):
+ yaml = arg
+ print ("Using stack: "+yaml)
+ elif opt in ("--key"):
+ key = arg
+ print ("Using key: "+key)
+ elif opt in ("--flavor"):
+ flavor = arg
+ print ("Using flavor: "+flavor)
+ elif opt in ("--image"):
+ image = arg
+ print ("Using image: "+image)
+ elif opt in ("--image_file"):
+ image_file = arg
+ print ("Using qcow2 file: "+image_file)
+ elif opt in ("--dataplane_network"):
+ dataplane_network = arg
+ print ("Using dataplane network: "+ dataplane_network)
+ elif opt in ("--admin_network"):
+ admin_network = arg
+ print ("Using controle plane network: "+ admin_network)
+ elif opt in ("--log"):
+ loglevel = arg
+ print ("Log level: "+ loglevel)
+
+
+# create formatters
+screen_formatter = logging.Formatter("%(message)s")
+file_formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
+
+# get a top-level logger,
+# set its log level,
+# BUT PREVENT IT from propagating messages to the root logger
+#
+log = logging.getLogger()
+numeric_level = getattr(logging, loglevel.upper(), None)
+if not isinstance(numeric_level, int):
+ raise ValueError('Invalid log level: %s' % loglevel)
+log.setLevel(numeric_level)
+log.propagate = 0
+
+# create a console handler
+# and set its log level to the command-line option
+#
+console_handler = logging.StreamHandler(sys.stdout)
+console_handler.setLevel(logging.INFO)
+console_handler.setFormatter(screen_formatter)
+
+# create a file handler
+# and set its log level to DEBUG
+#
+log_file = 'CREATE' +stack +'.log'
+file_handler = logging.handlers.RotatingFileHandler(log_file, backupCount=10)
+#file_handler = log.handlers.TimedRotatingFileHandler(log_file, 'D', 1, 5)
+file_handler.setLevel(numeric_level)
+file_handler.setFormatter(file_formatter)
+
+# add handlers to the logger
+#
+log.addHandler(file_handler)
+log.addHandler(console_handler)
+
+# Check if log exists and should therefore be rolled
+needRoll = os.path.isfile(log_file)
+
+
+# This is a stale log, so roll it
+if needRoll:
+ # Add timestamp
+ log.debug('\n---------\nLog closed on %s.\n---------\n' % time.asctime())
+
+ # Roll over on application start
+ log.handlers[0].doRollover()
+
+# Add timestamp
+log.debug('\n---------\nLog started on %s.\n---------\n' % time.asctime())
+
+log.debug("createrapid.py version: "+version)
+# Checking if the control network already exists, if not, stop the script
+log.debug("Checking control plane network: "+admin_network)
+cmd = 'openstack network show '+admin_network
+log.debug (cmd)
+cmd = cmd + ' |grep "status " | tr -s " " | cut -d" " -f 4'
+NetworkExist = subprocess.check_output(cmd , shell=True).strip()
+if NetworkExist == 'ACTIVE':
+ log.info("Control plane network ("+admin_network+") already active")
+else:
+ log.exception("Control plane network " + admin_network + " not existing")
+ raise Exception("Control plane network " + admin_network + " not existing")
+
+# Checking if the image already exists, if not create it
+log.debug("Checking image: "+image)
+cmd = 'openstack image show '+image
+log.debug(cmd)
+cmd = cmd +' |grep "status " | tr -s " " | cut -d" " -f 4'
+ImageExist = subprocess.check_output(cmd , shell=True).strip()
+if ImageExist == 'active':
+ log.info("Image ("+image+") already available")
+else:
+ log.info('Creating image ...')
+ cmd = 'openstack image create --disk-format qcow2 --container-format bare --public --file ./'+image_file+ ' ' +image
+ log.debug(cmd)
+ cmd = cmd + ' |grep "status " | tr -s " " | cut -d" " -f 4'
+ ImageExist = subprocess.check_output(cmd , shell=True).strip()
+ if ImageExist == 'active':
+ log.info('Image created and active')
+ cmd = 'openstack image set --property hw_vif_multiqueue_enabled="true" ' +image
+# subprocess.check_call(cmd , shell=True)
+ else :
+ log.exception("Failed to create image")
+ raise Exception("Failed to create image")
+
+# Checking if the key already exists, if not create it
+log.debug("Checking key: "+key)
+cmd = 'openstack keypair show '+key
+log.debug (cmd)
+cmd = cmd + ' |grep "name " | tr -s " " | cut -d" " -f 4'
+KeyExist = subprocess.check_output(cmd , shell=True).strip()
+if KeyExist == key:
+ log.info("Key ("+key+") already installed")
+else:
+ log.info('Creating key ...')
+ cmd = 'openstack keypair create '+ key + '>' +key+'.pem'
+ log.debug(cmd)
+ subprocess.check_call(cmd , shell=True)
+ cmd = 'chmod 600 ' +key+'.pem'
+ subprocess.check_call(cmd , shell=True)
+ cmd = 'openstack keypair show '+key
+ log.debug(cmd)
+ cmd = cmd + ' |grep "name " | tr -s " " | cut -d" " -f 4'
+ KeyExist = subprocess.check_output(cmd , shell=True).strip()
+ if KeyExist == key:
+ log.info("Key created")
+ else :
+ log.exception("Failed to create key: " + key)
+ raise Exception("Failed to create key: " + key)
+
+# Checking if the flavor already exists, if not create it
+log.debug("Checking flavor: "+flavor)
+cmd = 'openstack flavor show '+flavor
+log.debug (cmd)
+cmd = cmd + ' |grep "name " | tr -s " " | cut -d" " -f 4'
+FlavorExist = subprocess.check_output(cmd , shell=True).strip()
+if FlavorExist == flavor:
+ log.info("Flavor ("+flavor+") already installed")
+else:
+ log.info('Creating flavor ...')
+ cmd = 'openstack flavor create '+flavor+' --ram 8192 --disk 20 --vcpus 4'
+ log.debug(cmd)
+ cmd = cmd + ' |grep "name " | tr -s " " | cut -d" " -f 4'
+ FlavorExist = subprocess.check_output(cmd , shell=True).strip()
+ if FlavorExist == flavor:
+ cmd = 'openstack flavor set '+ flavor +' --property hw:mem_page_size="large" --property hw:cpu_policy="dedicated" --property hw:cpu_threads_policy="isolate"'
+ log.debug(cmd)
+ subprocess.check_call(cmd , shell=True)
+ log.info("Flavor created")
+ else :
+ log.exception("Failed to create flavor: " + flavor)
+ raise Exception("Failed to create flavor: " + flavor)
+
+# Checking if the dataplane network already exists, if not create it
+log.debug("Checking dataplane network: "+dataplane_network)
+cmd = 'openstack network show '+dataplane_network
+log.debug (cmd)
+cmd = cmd + ' |grep "status " | tr -s " " | cut -d" " -f 4'
+NetworkExist = subprocess.check_output(cmd , shell=True).strip()
+if NetworkExist == 'ACTIVE':
+ log.info("Dataplane network ("+dataplane_network+") already active")
+else:
+ log.info('Creating dataplane network ...')
+ cmd = 'openstack network create '+dataplane_network
+ log.debug(cmd)
+ cmd = cmd + ' |grep "status " | tr -s " " | cut -d" " -f 4'
+ NetworkExist = subprocess.check_output(cmd , shell=True).strip()
+ if NetworkExist == 'ACTIVE':
+ log.info("Dataplane network created")
+ else :
+ log.exception("Failed to create dataplane network: " + dataplane_network)
+ raise Exception("Failed to create dataplane network: " + dataplane_network)
+
+# Checking if the dataplane subnet already exists, if not create it
+log.debug("Checking subnet: "+subnet)
+cmd = 'openstack subnet show '+ subnet
+log.debug (cmd)
+cmd = cmd +' |grep "name " | tr -s " " | cut -d"|" -f 3'
+SubnetExist = subprocess.check_output(cmd , shell=True).strip()
+if SubnetExist == subnet:
+ log.info("Subnet (" +subnet+ ") already exists")
+else:
+ log.info('Creating subnet ...')
+ cmd = 'openstack subnet create --network ' + dataplane_network + ' --subnet-range ' + subnet_cidr +' --gateway none ' + subnet
+ log.debug(cmd)
+ cmd = cmd + ' |grep "name " | tr -s " " | cut -d"|" -f 3'
+ SubnetExist = subprocess.check_output(cmd , shell=True).strip()
+ if SubnetExist == subnet:
+ log.info("Subnet created")
+ else :
+ log.exception("Failed to create subnet: " + subnet)
+ raise Exception("Failed to create subnet: " + subnet)
+
+# Checking if the stack already exists, if not create it
+log.debug("Checking Stack: "+stack)
+cmd = 'openstack stack show '+stack
+log.debug (cmd)
+cmd = cmd+' |grep "stack_status " | tr -s " " | cut -d"|" -f 3'
+StackRunning = subprocess.check_output(cmd , shell=True).strip()
+if StackRunning == '':
+ log.info('Creating Stack ...')
+ cmd = 'openstack stack create -t '+ yaml + ' --parameter flavor="'+flavor +'" --parameter key="'+ key + '" --parameter image="'+image + '" --parameter dataplane_network="'+dataplane_network+ '" --parameter admin_network="'+admin_network+'" --wait '+stack
+ log.debug(cmd)
+ cmd = cmd + ' |grep "stack_status " | tr -s " " | cut -d"|" -f 3'
+ StackRunning = subprocess.check_output(cmd , shell=True).strip()
+if StackRunning != 'CREATE_COMPLETE':
+ log.exception("Failed to create stack")
+ raise Exception("Failed to create stack")
+
+# Obtaining IP & MAC addresses for the VMs created in the stack
+log.info("Stack ("+stack+") running")
+cmd='openstack stack show -f yaml -c outputs ' + stack
+log.debug(cmd)
+output = subprocess.check_output(cmd , shell=True).strip()
+matchObj = re.search('.*gen_dataplane_ip.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)', output, re.DOTALL)
+genDPIP = matchObj.group(1)
+matchObj = re.search('.*gen_public_ip.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)', output, re.DOTALL)
+genAdminIP = matchObj.group(1)
+matchObj = re.search('.*gen_dataplane_mac.*?([a-fA-F0-9:]{17})', output, re.DOTALL)
+genDPmac = matchObj.group(1)
+matchObj = re.search('.*sut_dataplane_ip.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)', output, re.DOTALL)
+sutDPIP = matchObj.group(1)
+matchObj = re.search('.*sut_public_ip.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)', output, re.DOTALL)
+sutAdminIP = matchObj.group(1)
+matchObj = re.search('.*sut_dataplane_mac.*?([a-fA-F0-9:]{17})', output, re.DOTALL)
+sutDPmac = matchObj.group(1)
+log.info('Generator: (admin IP: '+ genAdminIP + '), (dataplane IP: ' + genDPIP+'), (dataplane MAC: ' +genDPmac+')')
+log.info('SUT: (admin IP: '+ sutAdminIP + '), (dataplane IP: ' + sutDPIP+'), (dataplane MAC: ' +sutDPmac+')')
+config = ConfigParser.RawConfigParser()
+config.add_section('Generator')
+config.set('Generator', 'admin_ip', genAdminIP)
+config.set('Generator', 'dp_ip', genDPIP)
+config.set('Generator', 'dp_mac', genDPmac)
+config.add_section('SUT')
+config.set('SUT', 'admin_ip', sutAdminIP)
+config.set('SUT', 'dp_ip', sutDPIP)
+config.set('SUT', 'dp_mac', sutDPmac)
+config.add_section('OpenStack')
+config.set('OpenStack', 'stack', stack)
+config.set('OpenStack', 'yaml', yaml)
+config.set('OpenStack', 'key', key)
+config.set('OpenStack', 'flavor', flavor)
+config.set('OpenStack', 'image', image)
+config.set('OpenStack', 'image_file', image_file)
+config.set('OpenStack', 'dataplane_network', dataplane_network)
+config.set('OpenStack', 'subnet', subnet)
+config.set('OpenStack', 'subnet_cidr', subnet_cidr)
+config.set('OpenStack', 'admin_network', admin_network)
+config.add_section('rapid')
+config.set('rapid', 'loglevel', loglevel)
+config.set('rapid', 'version', version)
+config.add_section('DEFAULT')
+config.set('DEFAULT', 'admin_ip', 'none')
+# Writing our configuration file
+with open(stack+'.cfg', 'wb') as configfile:
+ config.write(configfile)
+
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_sut_user_data.sh b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/devbind.sh
index e7f58a9f..adc184e3 100644..100755
--- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_sut_user_data.sh
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/devbind.sh
@@ -16,9 +16,11 @@
## limitations under the License.
##
-echo 128 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
-mount -t hugetlbfs nodev /mnt/huge
-modprobe uio
-insmod /root/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
-/root/dpdk/usertools/dpdk-devbind.py --force --bind igb_uio 00:04.0
-iptables -F
+link="$(ip -o link | grep MACADDRESS |cut -d":" -f 2)"
+if [ -n "$link" ];
+then
+ echo Need to bind
+ /root/dpdk/usertools/dpdk-devbind.py --force --bind igb_uio $(/root/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/openstackrapid/gen.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen.cfg
index 522eb801..f06079f9 100644
--- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen.cfg
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen.cfg
@@ -41,24 +41,12 @@ name=p0
task=0
mode=gen
sub mode=l3
-rx ring=yes
+rx port=p0
tx port=p0
bps=1250000000
pkt inline=00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 00 1c 00 01 00 00 40 11 f7 7d ${gen_hex_ip} ${sut_hex_ip} 0b b8 0b b9 00 08 55 7b
gateway ipv4=${sut_ip}
-local ipv4=${gen_ip}
+;local ipv4=${gen_ip}
min bulk size=$mbs
-;random=XXXXXXXXXXXXXXXX
-;random=0000000000XXXXXX ; 64 possibilities
-;rand_offset=34 ; SOURCE UDP PORT
-;random=XXXXXXXXXXXXXXXX
-;random=000000000XXXXXXX ; 128
-;rand_offset=36 ; DESTINTAITON UDP PORT
-
-[core 2]
-task=0
-mode=arp
-rx port=p0,p0,p0,p0
-tx port=p0
-tx cores=1t0
+max bulk size=16
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py
index b384e9f0..7438d4d6 100644
--- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py
@@ -198,6 +198,12 @@ class prox_sock(object):
def set_random(self, cores, task, offset, mask, length):
self._send('set random %s %s %s %s %s' % (','.join(map(str, cores)), task, offset, mask, length))
+ def set_size(self, cores, task, pkt_size):
+ self._send('pkt_size %s %s %s' % (','.join(map(str, cores)), task, pkt_size))
+
+ def set_value(self, cores, task, offset, value, length):
+ self._send('set value %s %s %s %s %s' % (','.join(map(str, cores)), task, offset, value, length))
+
def _send(self, cmd):
"""Append LF and send command to the PROX instance."""
if self._sock is None:
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_gen_user_data.sh b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_user_data.sh
index e7f58a9f..da2ab925 100644..100755
--- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_gen_user_data.sh
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_user_data.sh
@@ -17,8 +17,7 @@
##
echo 128 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
-mount -t hugetlbfs nodev /mnt/huge
+mount -t hugetlbfs nodev /mnt/huge
modprobe uio
insmod /root/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
-/root/dpdk/usertools/dpdk-devbind.py --force --bind igb_uio 00:04.0
iptables -F
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.py
deleted file mode 100755
index 1a0ea41c..00000000
--- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.py
+++ /dev/null
@@ -1,445 +0,0 @@
-#!/usr/bin/python
-
-##
-## Copyright (c) 2010-2017 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.
-##
-
-import sys
-import time
-import subprocess
-import getopt
-from prox_ctrl import prox_ctrl
-
-version="17.04.19"
-stack = "rapidTestEnv" #Default string for stack
-yaml = "rapid.yaml" #Default string for yaml file
-key = "prox" # This is also the default in the yaml file....
-flavor = "prox_flavor" # This is also the default in the yaml file....
-image = "rapidVM" # This is also the default in the yaml file....
-image_file = "rapidVM.qcow2"
-network = "dpdk-network" # This is also the default in the yaml file....
-subnet = "dpdk-subnet" #Hardcoded at this moment
-
-def usage():
- print("usage: rapid [--version] [-v]")
- print(" [--stack STACK_NAME]")
- print(" [--yaml YAML_FILE]")
- print(" [--key KEY_NAME]")
- print(" [--flavor FLAVOR_NAME]")
- print(" [--image IMAGE_NAME]")
- print(" [--image_file IMAGE_FILE]")
- print(" [--network NETWORK]")
- print(" [-h] [--help]")
- print("")
- print("Command-line interface to RAPID")
- print("")
- print("optional arguments:")
- print(" -v, --version Show program's version number and exit")
- print(" --stack STACK_NAME Specify a name for the heat stack. Default is rapidTestEnv.")
- print(" --yaml YAML_FILE Specify the yaml file to be used. Default is rapid.yaml.")
- print(" --key KEY_NAME Specify the key to be used. Default is prox.")
- print(" --flavor FLAVOR_NAME Specify the flavor to be used. Default is prox_flavor.")
- print(" --image IMAGE_NAME Specify the image to be used. Default is rapidVM.")
- print(" --image_file IMAGE_FILE Specify the image qcow2 file to be used. Default is rapidVM.qcow2.")
- print(" --network NETWORK Specify the network name to be used for the dataplane. Default is dpdk-network.")
- print(" -h, --help Show help message and exit.")
- print("")
- print("To delete the rapid stack, type the following command")
- print(" openstack stack delete --yes --wait DPTestEnv")
- print("Note that rapidTestEnv is the default stack name. Replace with STACK_NAME if needed")
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "vh", ["version","help", "yaml=","stack=","key=","flavor=","image=","network="])
-except getopt.GetoptError as err:
- print("===========================================")
- print str(err)
- print("===========================================")
- usage()
- sys.exit(2)
-if args:
- usage()
- sys.exit(2)
-for opt, arg in opts:
- if opt in ("-h", "--help"):
- usage()
- sys.exit()
- if opt in ("-v", "--version"):
- print("Rapid Automated Performance Indication for Dataplane "+version)
- sys.exit()
- if opt in ("--stack"):
- stack = arg
- print ("Using '"+stack+"' as name for the stack")
- elif opt in ("--yaml"):
- yaml = arg
- print ("Using stack: "+yaml)
- elif opt in ("--key"):
- key = arg
- print ("Using key: "+key)
- elif opt in ("--flavor"):
- flavor = arg
- print ("Using flavor: "+flavor)
- elif opt in ("--image"):
- image = arg
- print ("Using image: "+image)
- elif opt in ("--image_file"):
- image_file = arg
- print ("Using qcow2 file: "+image_file)
- elif opt in ("--network"):
- network = arg
- print ("Using network: "+ network)
-
-print("Checking image: "+image)
-cmd = 'openstack image show '+image+' |grep "status " | tr -s " " | cut -d" " -f 4'
-ImageExist = subprocess.check_output(cmd , shell=True).strip()
-if ImageExist == 'active':
- print("Image already available")
-else:
- print('Creating image ...')
- cmd = 'openstack image create --disk-format qcow2 --container-format bare --public --file ./'+image_file+ ' ' +image+' |grep "status " | tr -s " " | cut -d" " -f 4'
- ImageExist = subprocess.check_output(cmd , shell=True).strip()
- if ImageExist == 'active':
- print('Image created and active')
- cmd = 'openstack image set --property hw_vif_multiqueue_enabled="true" ' +image
- subprocess.check_call(cmd , shell=True)
- else :
- raise Exception("Failed to create image")
-
-print("Checking key: "+key)
-cmd = 'openstack keypair show '+key+' |grep "name " | tr -s " " | cut -d" " -f 4'
-KeyExist = subprocess.check_output(cmd , shell=True).strip()
-if KeyExist == key:
- print("Key already installed")
-else:
- print('Creating key ...')
- cmd = 'openstack keypair create '+ key + '>' +key+'.pem'
- subprocess.check_call(cmd , shell=True)
- cmd = 'chmod 600 ' +key+'.pem'
- subprocess.check_call(cmd , shell=True)
- cmd = 'openstack keypair show '+key+' |grep "name " | tr -s " " | cut -d" " -f 4'
- KeyExist = subprocess.check_output(cmd , shell=True).strip()
- if KeyExist == key:
- print("Key created")
- else :
- raise Exception("Failed to create key: " + key)
-
-print("Checking flavor: "+flavor)
-cmd = 'openstack flavor show '+flavor+' |grep "name " | tr -s " " | cut -d" " -f 4'
-FlavorExist = subprocess.check_output(cmd , shell=True).strip()
-if FlavorExist == flavor:
- print("Flavor already installed")
-else:
- print('Creating flavor ...')
- cmd = 'openstack flavor create '+flavor+' --ram 8192 --disk 80 --vcpus 4 |grep "name " | tr -s " " | cut -d" " -f 4'
- FlavorExist = subprocess.check_output(cmd , shell=True).strip()
- if FlavorExist == flavor:
- cmd = 'openstack flavor set '+ flavor +' --property hw:mem_page_size="large" --property hw:cpu_policy="dedicated" --property hw:cpu_threads_policy="isolate"'
- subprocess.check_call(cmd , shell=True)
- print("Flavor created")
- else :
- raise Exception("Failed to create flavor: " + flavor)
-
-print("Checking network: "+network)
-cmd = 'openstack network show '+network+' |grep "status " | tr -s " " | cut -d" " -f 4'
-NetworkExist = subprocess.check_output(cmd , shell=True).strip()
-if NetworkExist == 'ACTIVE':
- print("Network already active")
-else:
- print('Creating network ...')
- cmd = 'openstack network create '+network+' |grep "status " | tr -s " " | cut -d" " -f 4'
- NetworkExist = subprocess.check_output(cmd , shell=True).strip()
- if NetworkExist == 'ACTIVE':
- print("Network created")
- else :
- raise Exception("Failed to create network: " + network)
-
-print("Checking subnet: "+subnet)
-cmd = 'neutron subnet-show '+ subnet+' |grep "name " | tr -s " " | cut -d" " -f 4'
-SubnetExist = subprocess.check_output(cmd , shell=True).strip()
-if SubnetExist == subnet:
- print("Subnet already exists")
-else:
- print('Creating subnet ...')
- cmd = 'neutron subnet-create --name '+ subnet+ ' ' +network+' 10.10.10.0/24 |grep "name " | tr -s " " | cut -d" " -f 4'
- SubnetExist = subprocess.check_output(cmd , shell=True).strip()
- if SubnetExist == subnet:
- print("Subnet created")
- else :
- raise Exception("Failed to create subnet: " + subnet)
-
-print("Checking Stack: "+stack)
-cmd = 'openstack stack show '+stack+' |grep "stack_status " | tr -s " " | cut -d" " -f 4'
-StackRunning = subprocess.check_output(cmd , shell=True).strip()
-if StackRunning == '':
- print('Creating Stack ...')
- cmd = 'openstack stack create -t '+ yaml + ' --parameter flavor="'+flavor +'" --parameter key="'+ key + '" --parameter image="'+image + '" --parameter dpdk_network="'+network+'" --wait '+stack +' |grep "stack_status " | tr -s " " | cut -d" " -f 4'
- StackRunning = subprocess.check_output(cmd , shell=True).strip()
-if StackRunning != 'CREATE_COMPLETE':
- raise Exception("Failed to create stack")
-
-print('Stack running')
-genName=stack+'-gen'
-sutName=stack+'-sut'
-cmd = 'nova list | grep '+ genName +' | tr -s " " | cut -d " " -f 4'
-genVMName = subprocess.check_output(cmd , shell=True).strip()
-print('Generator: '+ genVMName)
-cmd = 'nova list | grep '+ sutName +' | tr -s " " | cut -d " " -f 4'
-sutVMName = subprocess.check_output(cmd , shell=True).strip()
-print('SUT: '+ sutVMName)
-cmd='nova show ' + genVMName + ' | grep "dpdk-network" | tr -s " " | cut -d" " -f 5'
-genDPIP = subprocess.check_output(cmd , shell=True).strip()
-cmd='nova show ' + genVMName + ' | grep "admin_internal_net" | tr -s " " | cut -d" " -f 6'
-genAdminIP = subprocess.check_output(cmd , shell=True).strip()
-cmd='nova show ' + sutVMName + ' | grep "dpdk-network" | tr -s " " | cut -d" " -f 5'
-sutDPIP = subprocess.check_output(cmd , shell=True).strip()
-cmd='nova show ' + sutVMName + ' | grep "admin_internal_net" | tr -s " " | cut -d" " -f 6'
-sutAdminIP = subprocess.check_output(cmd , shell=True).strip()
-
-#========================================================================
-def connect_socket(client):
- attempts = 1
- print("Trying to connect to PROX (just launched) on %s, attempt: %d"
- % (client.ip(), attempts))
- sock = None
- while True:
- sock = client.prox_sock()
- if sock is not None:
- break
- attempts += 1
- if attempts > 20:
- raise Exception("Failed to connect to PROX on %s after %d attempts"
- % (client.ip(), attempts))
- time.sleep(10)
- print("Trying to connect to PROX (just launched) on %s, attempt: %d"
- % (client.ip(), attempts))
- print("Connected to PROX on %s" % client.ip())
- return sock
-
-def connect_client(client):
- attempts = 1
- print ("Trying to connect to VM which was just launched on %s, attempt: %d"
- % (client.ip(), attempts))
- while True:
- try:
- client.connect()
- break
- except RuntimeWarning, ex:
- attempts += 1
- if attempts > 20:
- raise Exception("Failed to connect to VM after %d attempts:\n%s"
- % (attempts, ex))
- time.sleep(15)
- print ("Trying to connect to VM which was just launched on %s, attempt: %d"
- % (client.ip(), attempts))
- print("Connected to VM on %s" % client.ip())
-
-
-def run_testA():
- global genclient
- global sutclient
- ip = genDPIP.split('.')
- hexgenDPIP=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)
- ip = sutDPIP.split('.')
- hexsutDPIP=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)
- with open("parameters.lua", "w") as f:
- f.write('gen_hex_ip="'+hexgenDPIP+'"\n')
- f.write('sut_hex_ip="'+hexsutDPIP+'"\n')
- f.write('gen_ip="'+genDPIP+'"\n')
- f.write('sut_ip="'+sutDPIP+'"\n')
- f.close
- genclient.scp_put('./gen.cfg', '/root/gen.cfg')
- sutclient.scp_put('./sut.cfg', '/root/sut.cfg')
- genclient.scp_put('./parameters.lua', '/root/parameters.lua')
- sutclient.scp_put('./parameters.lua', '/root/parameters.lua')
- print("Config files copied")
- cmd = '/root/prox/build/prox -e -t -o cli -f /root/gen.cfg'
- genclient.fork_cmd(cmd, 'PROX GEN')
- cmd = '/root/prox/build/prox -t -o cli -f /root/sut.cfg'
- sutclient.fork_cmd(cmd, 'PROX SUT')
- gensock = connect_socket(genclient)
- sutsock = connect_socket(sutclient)
- new_speed = 100
- attempts = 0
- cores = [1,2]
- gencores = [1]
- gensock.reset_stats()
- sutsock.reset_stats()
- gensock.start([2])
- print("+---------------------------------------------------------------------------------------------------------+")
- print("| Generator is sending UDP (1 flow) packets (64 bytes) to SUT. SUT sends packets back |")
- print("+------+-----------------+----------------+----------------+----------------+----------------+------------+")
- print("| Test | Speed requested | Req to Generate| Sent by Gen | Forward by SUT | Rec. by Gen | Result |")
- print("+------+-----------------+----------------+----------------+----------------+----------------+------------+")
- while (new_speed > 0.1):
- attempts += 1
- # Start generating packets at requested speed (in % of a 10Gb/s link)
- gensock.speed(new_speed, gencores)
- gensock.start(gencores)
- time.sleep(1)
- # Get statistics now that the generation is stable and NO ARP messages any more
- old_sut_rx, old_sut_tx, old_sut_drop, old_sut_tsc, sut_tsc_hz = sutsock.core_stats([1])
- old_rx, old_tx, old_drop, old_tsc, tsc_hz = gensock.core_stats(cores)
- time.sleep(10)
- # Get statistics after some execution time
- new_rx, new_tx, new_drop, new_tsc, tsc_hz = gensock.core_stats(cores)
- new_sut_rx, new_sut_tx, new_sut_drop, new_sut_tsc, sut_tsc_hz = sutsock.core_stats([1])
- time.sleep(1)
- # Stop generating
- gensock.stop(gencores)
- drop = new_drop-old_drop # drop is all packets dropped by all tasks. This includes packets dropped at the generator task + packets dropped by the nop task. In steady state, this equals to the number of packets received by this VM
- rx = new_rx - old_rx # rx is all packets received by the nop task = all packets received in the gen VM
- tx = new_tx - old_tx # tx is all generated packets actually accepted by the interface
- tsc = new_tsc - old_tsc # time difference between the 2 measurements, expressed in cycles.
- sut_rx = new_sut_rx - old_sut_rx
- sut_tx = new_sut_tx - old_sut_tx
- sut_tsc = new_sut_tsc - old_sut_tsc
- if (tx == 0):
- raise Exception("TX = 0")
- drop_rate = round(((drop-rx) * 100.0)/(tx+drop-rx),1)
- pps_req_tx = round((tx+drop-rx)*tsc_hz*1.0/(tsc*1000000),5)
- pps_tx = round(tx*tsc_hz*1.0/(tsc*1000000),5)
- pps_rx = round(rx*tsc_hz*1.0/(tsc*1000000),5)
- pps_sut_tx = round(sut_tx*sut_tsc_hz*1.0/(sut_tsc*1000000),5)
- if ((drop_rate) < 1):
- # This will stop the test when number of dropped packets is below a certain percentage
- print("+------+-----------------+----------------+----------------+----------------+----------------+------------+")
- print('|{:>5}'.format(str(attempts))+" | "+ '{:>14}'.format(str(new_speed)) + '% | '+ '{:>9}'.format(str(pps_req_tx))+' Mpps | '+ '{:>9}'.format(str(pps_tx)) +' Mpps | ' + '{:>9}'.format(str(pps_sut_tx)) +' Mpps | '+ '{:>9}'.format(str(pps_rx))+" Mpps | SUCCESS |")
- print("+------+-----------------+----------------+----------------+----------------+----------------+------------+")
- break
- else:
- print('|{:>5}'.format(str(attempts))+" | "+ '{:>14}'.format(str(new_speed)) + '% | '+ '{:>9}'.format(str(pps_req_tx))+' Mpps | '+ '{:>9}'.format(str(pps_tx)) +' Mpps | ' + '{:>9}'.format(str(pps_sut_tx)) +' Mpps | '+ '{:>9}'.format(str(pps_rx))+" Mpps | FAILED |")
- # Following calculates the ratio for the new speed to be applied
- # On the Y axis, we will find the ratio, a number between 0 and 1
- # On the x axis, we find the % of dropped packets, a number between 0 and 100
- # 2 lines are drawn and we take the minumun of these lines to calculate the ratio
- # One line goes through (0,y0) and (p,q)
- # The second line goes through (p,q) and (100,y100)
- y0=0.99
- y100=0.1
- p=15
- q=.9
- ratio = min((q-y0)/p*drop_rate+y0,(q-y100)/(p-100)*drop_rate+q-p*(q-y100)/(p-100))
- new_speed = (int(new_speed*ratio*100)+0.5)/100
- gensock.quit()
- sutsock.quit()
- time.sleep(2)
- print("")
-
-def run_testB():
- global genclient
- global sutclient
- ip = genDPIP.split('.')
- hexgenDPIP=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)
- ip = sutDPIP.split('.')
- hexsutDPIP=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)
- with open("parameters.lua", "w") as f:
- f.write('gen_hex_ip="'+hexgenDPIP+'"\n')
- f.write('sut_hex_ip="'+hexsutDPIP+'"\n')
- f.write('gen_ip="'+genDPIP+'"\n')
- f.write('sut_ip="'+sutDPIP+'"\n')
- f.close
- genclient.scp_put('./gen.cfg', '/root/gen.cfg')
- sutclient.scp_put('./sut.cfg', '/root/sut.cfg')
- genclient.scp_put('./parameters.lua', '/root/parameters.lua')
- sutclient.scp_put('./parameters.lua', '/root/parameters.lua')
- print("Config files copied")
- cmd = '/root/prox/build/prox -e -t -o cli -f /root/gen.cfg'
- genclient.fork_cmd(cmd, 'PROX GEN')
- cmd = '/root/prox/build/prox -t -o cli -f /root/sut.cfg'
- sutclient.fork_cmd(cmd, 'PROX SUT')
- gensock = connect_socket(genclient)
- sutsock = connect_socket(sutclient)
- print("+----------------------------------------------------------------------------------------------+")
- print("| UDP, 64 bytes, different number of flows by randomizing SRC & DST UDP port |")
- print("+--------+-----------------+----------------+----------------+----------------+----------------+")
- print("| Flows | Speed requested | Req to Generate| Sent by Gen | Forward by SUT | Rec. by Gen |")
- print("+--------+-----------------+----------------+----------------+----------------+----------------+")
- cores = [1,2]
- gencores = [1]
- gensock.start([2])
- new_speed = 100
- # To generate a desired number of flows, PROX will randomize the bits in source and destination ports, as specified by the bit masks in the flows variable.
- flows={128:['0000000000000XXX','000000000000XXXX'],1024:['00000000000XXXXX','00000000000XXXXX'],8192:['0000000000XXXXXX','000000000XXXXXXX'],65535:['00000000XXXXXXXX','00000000XXXXXXXX'],524280:['0000000XXXXXXXXX','000000XXXXXXXXXX']}
- for flow_number in sorted(flows.iterkeys()):
- #new_speed = 100 Commented out: Not starting from 100% since we are trying more flows, so speed will not be higher than the speed achieved in previous loop
- attempts = 0
- gensock.reset_stats()
- sutsock.reset_stats()
- source_port,destination_port = flows[flow_number]
- gensock.set_random(gencores,0,34,source_port,2)
- gensock.set_random(gencores,0,36,destination_port,2)
- while (new_speed > 0.1):
- attempts += 1
- # Start generating packets at requested speed (in % of a 10Gb/s link)
- gensock.speed(new_speed, gencores)
- gensock.start(gencores)
- time.sleep(1)
- # Get statistics now that the generation is stable and NO ARP messages any more
- old_sut_rx, old_sut_tx, old_sut_drop, old_sut_tsc, sut_tsc_hz = sutsock.core_stats([1])
- old_rx, old_tx, old_drop, old_tsc, tsc_hz = gensock.core_stats(cores)
- time.sleep(10)
- # Get statistics after some execution time
- new_rx, new_tx, new_drop, new_tsc, tsc_hz = gensock.core_stats(cores)
- new_sut_rx, new_sut_tx, new_sut_drop, new_sut_tsc, sut_tsc_hz = sutsock.core_stats([1])
- time.sleep(1)
- # Stop generating
- gensock.stop(gencores)
- drop = new_drop-old_drop # drop is all packets dropped by all tasks. This includes packets dropped at the generator task + packets dropped by the nop task. In steady state, this equals to the number of packets received by this VM
- rx = new_rx - old_rx # rx is all packets received by the nop task = all packets received in the gen VM
- tx = new_tx - old_tx # tx is all generated packets actually accepted by the interface
- tsc = new_tsc - old_tsc # time difference between the 2 measurements, expressed in cycles.
- sut_rx = new_sut_rx - old_sut_rx
- sut_tx = new_sut_tx - old_sut_tx
- sut_tsc = new_sut_tsc - old_sut_tsc
- if (tx == 0):
- raise Exception("TX = 0")
- drop_rate = round(((drop-rx) * 100.0)/(tx+drop-rx),1)
- pps_req_tx = round((tx+drop-rx)*tsc_hz*1.0/(tsc*1000000),5)
- pps_tx = round(tx*tsc_hz*1.0/(tsc*1000000),5)
- pps_rx = round(rx*tsc_hz*1.0/(tsc*1000000),5)
- pps_sut_tx = round(sut_tx*sut_tsc_hz*1.0/(sut_tsc*1000000),5)
- if ((drop_rate) < 1):
- # This will stop the test when number of dropped packets is below a certain percentage
- print('|{:>7}'.format(str(flow_number))+" | "+ '{:>14}'.format(str(new_speed)) + '% | '+ '{:>9}'.format(str(pps_req_tx))+' Mpps | '+ '{:>9}'.format(str(pps_tx)) +' Mpps | ' + '{:>9}'.format(str(pps_sut_tx)) +' Mpps | '+ '{:>9}'.format(str(pps_rx))+" Mpps |")
- print("+--------+-----------------+----------------+----------------+----------------+----------------+")
- break
- # Following calculates the ratio for the new speed to be applied
- # On the Y axis, we will find the ratio, a number between 0 and 1
- # On the x axis, we find the % of dropped packets, a number between 0 and 100
- # 2 lines are drawn and we take the minumun of these lines to calculate the ratio
- # One line goes through (0,y0) and (p,q)
- # The second line goes through (p,q) and (100,y100)
- y0=0.99
- y100=0.1
- p=15
- q=.9
- ratio = min((q-y0)/p*drop_rate+y0,(q-y100)/(p-100)*drop_rate+q-p*(q-y100)/(p-100))
- new_speed = (int(new_speed*ratio*100)+0.5)/100
- gensock.quit()
- sutsock.quit()
- time.sleep(2)
- print("")
-
-#========================================================================
-genclient = prox_ctrl(genAdminIP, key+'.pem')
-connect_client(genclient)
-sutclient = prox_ctrl(sutAdminIP, key+'.pem')
-connect_client(sutclient)
-#####################################################################################
-run_testA()
-run_testB()
-#####################################################################################
-genclient.close()
-sutclient.close()
-
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml
index eab957f5..6f3c1cd4 100644
--- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml
@@ -32,74 +32,108 @@ parameters:
label: Key name
description: Name of key-pair to be used for compute instance
default: prox
- dpdk_network:
+ dataplane_network:
type: string
label: Private network name or ID
description: Network to attach instance to.
- default: dpdk-network
- private_network:
+ default: dataplane-network
+ admin_network:
type: string
label: Private network name or ID
description: Network to attach instance to.
default: admin_internal_net
+ floating_network:
+ type: string
+ label: Floating network name or ID
+ description: Public Network to attach instance to.
+ default: admin_floating_net
availability_zone:
type: string
description: The Availability Zone to launch the instance.
default: nova
resources:
+ sut_admin_port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: admin_network}
+ security_groups:
+ - default
+ sut_dataplane_port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: dataplane_network}
+ security_groups:
+ - default
+ sut_floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network: {get_param: floating_network}
+ port_id: {get_resource: sut_admin_port}
sut:
type: OS::Nova::Server
properties:
availability_zone: { get_param: availability_zone }
user_data:
- get_file: prox_sut_user_data.sh
+ get_file: prox_user_data.sh
key_name: { get_param: key }
image: { get_param: image }
flavor: { get_param: flavor }
networks:
- - network: { get_param: private_network }
- - network: { get_param: dpdk_network }
+ - port: {get_resource: sut_admin_port}
+ - port: {get_resource: sut_dataplane_port}
+ gen_admin_port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: admin_network}
+ security_groups:
+ - default
+ gen_dataplane_port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: dataplane_network}
+ security_groups:
+ - default
+ gen_floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network: {get_param: floating_network}
+ port_id: {get_resource: gen_admin_port}
gen:
type: OS::Nova::Server
properties:
availability_zone: { get_param: availability_zone }
user_data:
- get_file: prox_gen_user_data.sh
+ get_file: prox_user_data.sh
key_name: { get_param: key }
image: { get_param: image }
flavor: { get_param: flavor }
networks:
- - network: { get_param: private_network }
- - network: { get_param: dpdk_network }
-
- sut_floating_ip:
- type: OS::Nova::FloatingIP
- properties:
- pool: admin_floating_net
-
- gen_floating_ip:
- type: OS::Nova::FloatingIP
- properties:
- pool: admin_floating_net
-
- sut_association:
- type: OS::Nova::FloatingIPAssociation
- properties:
- floating_ip: { get_resource: sut_floating_ip }
- server_id: { get_resource: sut }
-
- gen_association:
- type: OS::Nova::FloatingIPAssociation
- properties:
- floating_ip: { get_resource: gen_floating_ip }
- server_id: { get_resource: gen }
+ - port: {get_resource: gen_admin_port}
+ - port: {get_resource: gen_dataplane_port}
outputs:
- sut_ip:
- description: IP address of the instance
- value: { get_attr: [sut, first_address] }
- gen_ip:
- description: IP address of the instance
- value: { get_attr: [gen, first_address] }
-
+ sut_private_ip:
+ description: IP address of the sut admin port
+ value: { get_attr: [sut_admin_port, fixed_ips, 0, ip_address] }
+ sut_public_ip:
+ description: Floating IP address of sut in public network
+ value: { get_attr: [ sut_floating_ip, floating_ip_address ] }
+ sut_dataplane_ip:
+ description: IP address of sut dataplane port
+ value: { get_attr: [sut_dataplane_port, fixed_ips, 0, ip_address] }
+ sut_dataplane_mac:
+ description: The MAC address of the sut dataplane port
+ value: { get_attr: [sut_dataplane_port, mac_address] }
+ gen_private_ip:
+ description: IP address of the gen admin port
+ value: { get_attr: [gen_admin_port, fixed_ips, 0, ip_address] }
+ gen_public_ip:
+ description: Floating IP address of gen in public network
+ value: { get_attr: [ gen_floating_ip, floating_ip_address ] }
+ gen_dataplane_ip:
+ description: IP address of gen dataplane port
+ value: { get_attr: [gen_dataplane_port, fixed_ips, 0, ip_address] }
+ gen_dataplane_mac:
+ description: The MAC address of the gen dataplane port
+ value: { get_attr: [gen_dataplane_port, mac_address] }
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py
new file mode 100755
index 00000000..b421c709
--- /dev/null
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py
@@ -0,0 +1,453 @@
+#!/usr/bin/python
+
+##
+## Copyright (c) 2010-2017 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.
+##
+
+from __future__ import print_function
+
+import os
+import stat
+import sys
+import time
+import subprocess
+import getopt
+import re
+import logging
+from logging.handlers import RotatingFileHandler
+from logging import handlers
+from prox_ctrl import prox_ctrl
+import ConfigParser
+
+version="17.09.03"
+stack = "rapidTestEnv" #Default string for stack
+loglevel="DEBUG" # sets log level for writing to file
+runtime=10 # time in seconds for 1 test run
+
+def usage():
+ print("usage: rapid [--version] [-v]")
+ print(" [--stack STACK_NAME]")
+ print(" [--runtime TIME_FOR_TEST]")
+ print(" [--log DEBUG|INFO|WARNING|ERROR|CRITICAL")
+ print(" [-h] [--help]")
+ print("")
+ print("Command-line interface to RAPID")
+ print("")
+ print("optional arguments:")
+ print(" -v, --version Show program's version number and exit")
+ print(" --stack STACK_NAME Parameters will be read from STACK_NAME.cfg Default is rapidTestEnv.")
+ print(" --runtime Specify time in seconds for 1 test run")
+ print(" --log Specify logging level for log file output, screen output level is hard coded")
+ print(" -h, --help Show help message and exit.")
+ print("")
+ print("To delete the rapid stack, type the following command")
+ print(" openstack stack delete --yes --wait rapidTestEnv")
+ print("Note that rapidTestEnv is the default stack name. Replace with STACK_NAME if needed")
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "vh", ["version","help", "stack=","runtime=","log="])
+except getopt.GetoptError as err:
+ print("===========================================")
+ print(str(err))
+ print("===========================================")
+ usage()
+ sys.exit(2)
+if args:
+ usage()
+ sys.exit(2)
+for opt, arg in opts:
+ if opt in ("-h", "--help"):
+ usage()
+ sys.exit()
+ if opt in ("-v", "--version"):
+ print("Rapid Automated Performance Indication for Dataplane "+version)
+ sys.exit()
+ if opt in ("--stack"):
+ stack = arg
+ print ("Using '"+stack+"' as name for the stack")
+ elif opt in ("--runtime"):
+ runtime = arg
+ print ("Runtime: "+ runtime)
+ elif opt in ("--log"):
+ loglevel = arg
+ print ("Log level: "+ loglevel)
+
+
+# create formatters
+screen_formatter = logging.Formatter("%(message)s")
+file_formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
+
+# get a top-level logger,
+# set its log level,
+# BUT PREVENT IT from propagating messages to the root logger
+#
+log = logging.getLogger()
+numeric_level = getattr(logging, loglevel.upper(), None)
+if not isinstance(numeric_level, int):
+ raise ValueError('Invalid log level: %s' % loglevel)
+log.setLevel(numeric_level)
+log.propagate = 0
+
+# create a console handler
+# and set its log level to the command-line option
+#
+console_handler = logging.StreamHandler(sys.stdout)
+console_handler.setLevel(logging.INFO)
+console_handler.setFormatter(screen_formatter)
+
+# create a file handler
+# and set its log level to DEBUG
+#
+log_file = 'RUN' +stack +'.log'
+file_handler = logging.handlers.RotatingFileHandler(log_file, backupCount=10)
+#file_handler = log.handlers.TimedRotatingFileHandler(log_file, 'D', 1, 5)
+file_handler.setLevel(numeric_level)
+file_handler.setFormatter(file_formatter)
+
+# add handlers to the logger
+#
+log.addHandler(file_handler)
+log.addHandler(console_handler)
+
+# Check if log exists and should therefore be rolled
+needRoll = os.path.isfile(log_file)
+
+
+# This is a stale log, so roll it
+if needRoll:
+ # Add timestamp
+ log.debug('\n---------\nLog closed on %s.\n---------\n' % time.asctime())
+
+ # Roll over on application start
+ log.handlers[0].doRollover()
+
+# Add timestamp
+log.debug('\n---------\nLog started on %s.\n---------\n' % time.asctime())
+
+log.debug("runrapid.py version: "+version)
+#========================================================================
+def connect_socket(client):
+ attempts = 1
+ log.debug("Trying to connect to PROX (just launched) on %s, attempt: %d" % (client.ip(), attempts))
+ sock = None
+ while True:
+ sock = client.prox_sock()
+ if sock is not None:
+ break
+ attempts += 1
+ if attempts > 20:
+ log.exception("Failed to connect to PROX on %s after %d attempts" % (client.ip(), attempts))
+ raise Exception("Failed to connect to PROX on %s after %d attempts" % (client.ip(), attempts))
+ time.sleep(8)
+ log.debug("Trying to connect to PROX (just launched) on %s, attempt: %d" % (client.ip(), attempts))
+ log.info("Connected to PROX on %s" % client.ip())
+ return sock
+
+def connect_client(client):
+ attempts = 1
+ log.debug("Trying to connect to VM which was just launched on %s, attempt: %d" % (client.ip(), attempts))
+ while True:
+ try:
+ client.connect()
+ break
+ except RuntimeWarning, ex:
+ attempts += 1
+ if attempts > 20:
+ log.exception("Failed to connect to VM after %d attempts:\n%s" % (attempts, ex))
+ raise Exception("Failed to connect to VM after %d attempts:\n%s" % (attempts, ex))
+ time.sleep(8)
+ log.debug("Trying to connect to VM which was just launched on %s, attempt: %d" % (client.ip(), attempts))
+ log.info("Connected to VM on %s" % client.ip())
+
+def run_iteration(gensock,sutsock,cores,gencores):
+ if sutAdminIP!='none':
+ old_sut_rx, old_sut_tx, old_sut_drop, old_sut_tsc, sut_tsc_hz = sutsock.core_stats([1])
+ old_rx, old_tx, old_drop, old_tsc, tsc_hz = gensock.core_stats(cores)
+ time.sleep(float(runtime))
+ # Get statistics after some execution time
+ new_rx, new_tx, new_drop, new_tsc, tsc_hz = gensock.core_stats(cores)
+ if sutAdminIP!='none':
+ new_sut_rx, new_sut_tx, new_sut_drop, new_sut_tsc, sut_tsc_hz = sutsock.core_stats([1])
+ time.sleep(1)
+ #Stop generating
+ gensock.stop(gencores)
+ drop = new_drop-old_drop # drop is all packets dropped by all tasks. This includes packets dropped at the generator task + packets dropped by the nop task. In steady state, this equals to the number of packets received by this VM
+ rx = new_rx - old_rx # rx is all packets received by the nop task = all packets received in the gen VM
+ tx = new_tx - old_tx # tx is all generated packets actually accepted by the interface
+ tsc = new_tsc - old_tsc # time difference between the 2 measurements, expressed in cycles.
+ pps_req_tx = round((tx+drop-rx)*tsc_hz*1.0/(tsc*1000000),3)
+ pps_tx = round(tx*tsc_hz*1.0/(tsc*1000000),3)
+ pps_rx = round(rx*tsc_hz*1.0/(tsc*1000000),3)
+ if sutAdminIP!='none':
+ sut_rx = new_sut_rx - old_sut_rx
+ sut_tx = new_sut_tx - old_sut_tx
+ sut_tsc = new_sut_tsc - old_sut_tsc
+ pps_sut_tx = round(sut_tx*sut_tsc_hz*1.0/(sut_tsc*1000000),3)
+ pps_sut_tx_str = str(pps_sut_tx)
+ else:
+ pps_sut_tx = 0
+ pps_sut_tx_str = 'NO MEAS.'
+ if (tx == 0):
+ raise Exception("TX = 0")
+ drop_rate = round(((pps_req_tx-pps_rx) * 100.0)/pps_req_tx,1)
+ return(drop_rate,pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx)
+
+def new_speed(speed,drop_rate):
+ # Following calculates the ratio for the new speed to be applied
+ # On the Y axis, we will find the ratio, a number between 0 and 1
+ # On the x axis, we find the % of dropped packets, a number between 0 and 100
+ # 2 lines are drawn and we take the minumun of these lines to calculate the ratio
+ # One line goes through (0,y0) and (p,q)
+ # The second line goes through (p,q) and (100,y100)
+ y0=0.99
+ y100=0.1
+ p=15
+ q=.9
+ ratio = min((q-y0)/p*drop_rate+y0,(q-y100)/(p-100)*drop_rate+q-p*(q-y100)/(p-100))
+ return (int(speed*ratio*100)+0.5)/100
+
+def run_speedtest():
+ global genclient
+ global sutclient
+ log.info("Starting PROX")
+ speed = 100
+ attempts = 0
+ cores = [1]
+ gencores = [1]
+ cmd = '/root/prox/build/prox -e -t -o cli -f /root/gen.cfg'
+ genclient.fork_cmd(cmd, 'PROX GEN speed Test')
+ gensock = connect_socket(genclient)
+ gensock.reset_stats()
+ if sutAdminIP!='none':
+ cmd = '/root/prox/build/prox -t -o cli -f /root/sut.cfg'
+ sutclient.fork_cmd(cmd, 'PROX SUT speed Test')
+ sutsock = connect_socket(sutclient)
+ sutsock.reset_stats()
+ else:
+ sutsock = 'none'
+ log.info("+-----------------------------------------------------------------------------------------------------------+")
+ log.info("| Generator is sending UDP (1 flow) packets (64 bytes) to SUT. SUT sends packets back |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+------------+")
+ log.info("| Test | Speed requested | Req to Generate| Sent by Gen | Forward by SUT | Rec. by Gen | Result |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+------------+")
+ while (speed > 0.1):
+ attempts += 1
+ print('Measurement ongoing at speed: ' + str(round(speed,2)) + '% ',end='\r')
+ sys.stdout.flush()
+ # Start generating packets at requested speed (in % of a 10Gb/s link)
+ gensock.speed(speed, gencores)
+ gensock.start(gencores)
+ time.sleep(1)
+ # Get statistics now that the generation is stable and NO ARP messages any more
+ drop_rate,pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx = run_iteration(gensock,sutsock,cores,gencores)
+ if ((drop_rate) < 1):
+ # This will stop the test when number of dropped packets is below a certain percentage
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+------------+")
+ log.info('|{:>7}'.format(str(attempts))+" | "+ '{:>14}'.format(str(round(speed,2))) + '% | '+ '{:>9}'.format(str(pps_req_tx))+' Mpps | '+ '{:>9}'.format(str(pps_tx)) +' Mpps | ' + '{:>9}'.format(pps_sut_tx_str) +' Mpps | '+ '{:>9}'.format(str(pps_rx))+" Mpps | SUCCESS |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+------------+")
+ break
+ else:
+ log.info('|{:>7}'.format(str(attempts))+" | "+ '{:>14}'.format(str(round(speed,2))) + '% | '+ '{:>9}'.format(str(pps_req_tx))+' Mpps | '+ '{:>9}'.format(str(pps_tx)) +' Mpps | ' + '{:>9}'.format(pps_sut_tx_str) +' Mpps | '+ '{:>9}'.format(str(pps_rx))+" Mpps | FAILED |")
+ speed = new_speed(speed,drop_rate)
+ gensock.quit()
+ if sutAdminIP!='none':
+ sutsock.quit()
+ time.sleep(2)
+
+
+# print("")
+
+def run_flowtest():
+ global genclient
+ global sutclient
+ log.info("Starting PROX")
+ speed = 100
+ attempts = 0
+ cores = [1]
+ gencores = [1]
+ cmd = '/root/prox/build/prox -e -t -o cli -f /root/gen.cfg'
+ genclient.fork_cmd(cmd, 'PROX GEN flow Test')
+ gensock = connect_socket(genclient)
+ gensock.reset_stats()
+ if sutAdminIP!='none':
+ cmd = '/root/prox/build/prox -t -o cli -f /root/sut.cfg'
+ sutclient.fork_cmd(cmd, 'PROX SUT flow Test')
+ sutsock = connect_socket(sutclient)
+ sutsock.reset_stats()
+ else:
+ sutsock = 'none'
+ log.info("+----------------------------------------------------------------------------------------------+")
+ log.info("| UDP, 64 bytes, different number of flows by randomizing SRC & DST UDP port |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+")
+ log.info("| Flows | Speed requested | Req to Generate| Sent by Gen | Forward by SUT | Rec. by Gen |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+")
+ cores = [1]
+ gencores = [1]
+ speed = 100
+ # To generate a desired number of flows, PROX will randomize the bits in source and destination ports, as specified by the bit masks in the flows variable.
+ flows={128:['1000000000000XXX','100000000000XXXX'],1024:['10000000000XXXXX','10000000000XXXXX'],8192:['1000000000XXXXXX','100000000XXXXXXX'],65535:['10000000XXXXXXXX','10000000XXXXXXXX'],524280:['1000000XXXXXXXXX','100000XXXXXXXXXX']}
+ for flow_number in sorted(flows.iterkeys()):
+ #speed = 100 Commented out: Not starting from 100% since we are trying more flows, so speed will not be higher than the speed achieved in previous loop
+ attempts = 0
+ gensock.reset_stats()
+ if sutAdminIP!='none':
+ sutsock.reset_stats()
+ source_port,destination_port = flows[flow_number]
+ gensock.set_random(gencores,0,34,source_port,2)
+ gensock.set_random(gencores,0,36,destination_port,2)
+ while (speed > 0.1):
+ print(str(flow_number)+' flows: Measurement ongoing at speed: ' + str(round(speed,2)) + '% ',end='\r')
+ sys.stdout.flush()
+ attempts += 1
+ # Start generating packets at requested speed (in % of a 10Gb/s link)
+ gensock.speed(speed, gencores)
+ gensock.start(gencores)
+ time.sleep(1)
+ # Get statistics now that the generation is stable and NO ARP messages any more
+ drop_rate,pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx = run_iteration(gensock,sutsock,cores,gencores)
+ if ((drop_rate) < 1):
+ # This will stop the test when number of dropped packets is below a certain percentage
+ log.info('|{:>7}'.format(str(flow_number))+" | "+ '{:>14}'.format(str(round(speed,2))) + '% | '+ '{:>9}'.format(str(pps_req_tx))+' Mpps | '+ '{:>9}'.format(str(pps_tx)) +' Mpps | ' + '{:>9}'.format(pps_sut_tx_str) +' Mpps | '+ '{:>9}'.format(str(pps_rx))+" Mpps |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+")
+ break
+ speed = new_speed(speed,drop_rate)
+ gensock.quit()
+ if sutAdminIP!='none':
+ sutsock.quit()
+ time.sleep(2)
+# print("")
+
+def run_sizetest():
+ global genclient
+ global sutclient
+ log.info("Starting PROX")
+ speed = 100
+ attempts = 0
+ cores = [1]
+ gencores = [1]
+ cmd = '/root/prox/build/prox -e -t -o cli -f /root/gen.cfg'
+ genclient.fork_cmd(cmd, 'PROX GEN size Test')
+ gensock = connect_socket(genclient)
+ gensock.reset_stats()
+ if sutAdminIP!='none':
+ cmd = '/root/prox/build/prox -t -o cli -f /root/sut.cfg'
+ sutclient.fork_cmd(cmd, 'PROX SUT size Test')
+ sutsock = connect_socket(sutclient)
+ sutsock.reset_stats()
+ else:
+ sutsock = 'none'
+ log.info("+----------------------------------------------------------------------------------------------+")
+ log.info("| UDP, 1 flow, different packet sizes |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+")
+ log.info("| Pktsize| Speed requested | Req to Generate| Sent by Gen | Forward by SUT | Rec. by Gen |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+")
+ cores = [1]
+ gencores = [1]
+ speed = 100
+ # To generate a desired number of flows, PROX will randomize the bits in source and destination ports, as specified by the bit masks in the flows variable.
+ sizes=[1500,1024,512,256,128,64]
+ for size in sizes:
+ #speed = 100 Commented out: Not starting from 100% since we are trying smaller packets, so speed will not be higher than the speed achieved in previous loop
+ attempts = 0
+ gensock.reset_stats()
+ if sutAdminIP!='none':
+ sutsock.reset_stats()
+ gensock.set_size(gencores,0,size) # This is setting the frame size
+ gensock.set_value(gencores,0,16,(size-18),2) # 18 is the difference between the frame size and IP size = size of (MAC addresses, ethertype and FCS)
+ gensock.set_value(gencores,0,38,(size-38),2) # 38 is the difference between the frame size and UDP size = 18 + size of IP header (=20)
+ # This will only work when using sending UDP packets. For different protocls and ehternet types, we would need a differnt calculation
+ while (speed > 0.1):
+ print(str(size)+' bytes: Measurement ongoing at speed: ' + str(round(speed,2)) + '% ',end='\r')
+ sys.stdout.flush()
+ attempts += 1
+ # Start generating packets at requested speed (in % of a 10Gb/s link)
+ gensock.speed(speed, gencores)
+ gensock.start(gencores)
+ time.sleep(1)
+ # Get statistics now that the generation is stable and NO ARP messages any more
+ drop_rate,pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx = run_iteration(gensock,sutsock,cores,gencores)
+ if ((drop_rate) < 1):
+ # This will stop the test when number of dropped packets is below a certain percentage
+ log.info('|{:>7}'.format(str(size))+" | "+ '{:>14}'.format(str(round(speed,2))) + '% | '+ '{:>9}'.format(str(pps_req_tx))+' Mpps | '+ '{:>9}'.format(str(pps_tx)) +' Mpps | ' + '{:>9}'.format(pps_sut_tx_str) +' Mpps | '+ '{:>9}'.format(str(pps_rx))+" Mpps |")
+ log.info("+--------+-----------------+----------------+----------------+----------------+----------------+")
+ break
+ speed = new_speed(speed,drop_rate)
+ gensock.quit()
+ if sutAdminIP!='none':
+ sutsock.quit()
+ time.sleep(2)
+#========================================================================
+config = ConfigParser.RawConfigParser()
+config.read(stack+'.cfg')
+
+genAdminIP = config.get('Generator', 'admin_ip')
+genDPmac = config.get('Generator', 'dp_mac')
+genDPIP = config.get('Generator', 'dp_ip')
+sutAdminIP = config.get('SUT', 'admin_ip')
+sutDPmac = config.get('SUT', 'dp_mac')
+sutDPIP = config.get('SUT', 'dp_ip')
+key = config.get('OpenStack', 'key')
+ip = genDPIP.split('.')
+hexgenDPIP=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)
+ip = sutDPIP.split('.')
+hexsutDPIP=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)
+with open("parameters.lua", "w") as f:
+ f.write('gen_hex_ip="'+hexgenDPIP+'"\n')
+ f.write('sut_hex_ip="'+hexsutDPIP+'"\n')
+ f.write('gen_ip="'+genDPIP+'"\n')
+ f.write('sut_ip="'+sutDPIP+'"\n')
+ f.close
+
+#####################################################################################
+genclient = prox_ctrl(genAdminIP, key+'.pem','root')
+connect_client(genclient)
+genclient.scp_put('./gen.cfg', '/root/gen.cfg')
+genclient.scp_put('./parameters.lua', '/root/parameters.lua')
+# Creating script to bind the right network interface to the poll mode driver
+with open("devbind.sh") as f:
+ newText=f.read().replace('MACADDRESS', genDPmac)
+with open("gendevbind.sh", "w") as f:
+ f.write(newText)
+st = os.stat('gendevbind.sh')
+os.chmod('gendevbind.sh', st.st_mode | stat.S_IEXEC)
+genclient.scp_put('./gendevbind.sh', '/root/gendevbind.sh')
+cmd = '/root/gendevbind.sh'
+genclient.run_cmd(cmd)
+log.info("Generator Config files copied & running devbind.sh")
+
+#####################################################################################
+if sutAdminIP!='none':
+ sutclient = prox_ctrl(sutAdminIP, key+'.pem','root')
+ connect_client(sutclient)
+ sutclient.scp_put('./sut.cfg', '/root/sut.cfg')
+ sutclient.scp_put('./parameters.lua', '/root/parameters.lua')
+# Creating script to bind the right network interface to the poll mode driver
+ with open("devbind.sh") as f:
+ newText=f.read().replace('MACADDRESS', sutDPmac)
+ with open("sutdevbind.sh", "w") as f:
+ f.write(newText)
+ st = os.stat('sutdevbind.sh')
+ os.chmod('sutdevbind.sh', st.st_mode | stat.S_IEXEC)
+ sutclient.scp_put('./sutdevbind.sh', '/root/sutdevbind.sh')
+ cmd = '/root/sutdevbind.sh'
+ sutclient.run_cmd(cmd)
+ log.info("SUT Config files copied & running devbind.sh")
+run_speedtest()
+run_flowtest()
+run_sizetest()
+#####################################################################################
+genclient.close()
+if sutAdminIP!='none':
+ sutclient.close()
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml
new file mode 100644
index 00000000..e36eff44
--- /dev/null
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml
@@ -0,0 +1,136 @@
+##
+## Copyright (c) 2010-2017 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.
+##
+
+heat_template_version: 2016-04-08
+description: RAPID stack (Rapid Automated Performance Indication for Dataplane)
+parameters:
+ image:
+ type: string
+ label: Image name or ID
+ description: Image to be used for compute instance
+ default: RapidVM
+ flavor:
+ type: string
+ label: Flavor
+ description: Type of instance (flavor) to be used
+ default: prox_flavor
+ key:
+ type: string
+ label: Key name
+ description: Name of key-pair to be used for compute instance
+ default: prox
+ dataplane_network:
+ type: string
+ label: Private network name or ID
+ description: Network to attach instance to.
+ default: dataplane-network
+ admin_network:
+ type: string
+ label: Private network name or ID
+ description: Network to attach instance to.
+ default: admin_internal_net
+ floating_network:
+ type: string
+ label: Floating network name or ID
+ description: Public Network to attach instance to.
+ default: admin_floating_net
+ availability_zone:
+ type: string
+ description: The Availability Zone to launch the instance.
+ default: nova
+ gen_sriov_port:
+ type: string
+ description: The sriov port to be used by the generator
+ default: Port3
+ sut_sriov_port:
+ type: string
+ description: The sriov port to be used by the sut
+ default: Port4
+
+resources:
+ sut_admin_port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: admin_network}
+ security_groups:
+ - default
+ sut_floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network: {get_param: floating_network}
+ port_id: {get_resource: sut_admin_port}
+ sut:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone }
+ user_data:
+ get_file: prox_user_data.sh
+ key_name: { get_param: key }
+ image: { get_param: image }
+ flavor: { get_param: flavor }
+ networks:
+ - port: {get_resource: sut_admin_port}
+ - port: {get_param: sut_sriov_port}
+ gen_admin_port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: admin_network}
+ security_groups:
+ - default
+ gen_floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network: {get_param: floating_network}
+ port_id: {get_resource: gen_admin_port}
+ gen:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone }
+ user_data:
+ get_file: prox_user_data.sh
+ key_name: { get_param: key }
+ image: { get_param: image }
+ flavor: { get_param: flavor }
+ networks:
+ - port: {get_resource: gen_admin_port}
+ - port: {get_param: gen_sriov_port}
+
+outputs:
+ sut_private_ip:
+ description: IP address of the sut admin port
+ value: { get_attr: [sut_admin_port, fixed_ips, 0, ip_address] }
+ sut_public_ip:
+ description: Floating IP address of sut in public network
+ value: { get_attr: [ sut_floating_ip, floating_ip_address ] }
+ sut_dataplane_ip:
+ description: IP address of sut dataplane port
+ value: { get_attr: [sut, networks,{get_param: dataplane_network},0] }
+ sut_dataplane_mac:
+ description: The MAC address of the sut dataplane port
+ value: { get_attr: [sut, addresses, {get_param: dataplane_network}] }
+ gen_private_ip:
+ description: IP address of the gen admin port
+ value: { get_attr: [gen_admin_port, fixed_ips, 0, ip_address] }
+ gen_public_ip:
+ description: Floating IP address of gen in public network
+ value: { get_attr: [ gen_floating_ip, floating_ip_address ] }
+ gen_dataplane_ip:
+ description: IP address of gen dataplane port
+ value: { get_attr: [gen, networks,{get_param: dataplane_network},0] }
+ gen_dataplane_mac:
+ description: The MAC address of the gen dataplane port
+ value: { get_attr: [gen, addresses, {get_param: dataplane_network}] }
+
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sut.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sut.cfg
index 2937a749..9e4d5e3e 100644
--- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sut.cfg
+++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sut.cfg
@@ -29,7 +29,7 @@ mac=hardware
mempool size=2K
[global]
-name=NOP forwarding
+name=SWAP
[core 0]
mode=master
@@ -37,15 +37,10 @@ mode=master
[core 1]
name=swap
task=0
-mode=arp
-sub mode=local
-rx port=if0
-tx port=if0
-tx cores=1t1
-local ipv4=${sut_ip}
-task=1
mode=swap
-rx ring=yes
+sub mode=l3
+rx port=if0
tx port=if0
+;local ipv4=${sut_ip}
drop=no