diff options
Diffstat (limited to 'VNFs/DPPD-PROX')
22 files changed, 625 insertions, 167 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMrapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMrapid.yaml index 98bc95a4..44099d9d 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMrapid.yaml +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMrapid.yaml @@ -51,6 +51,10 @@ parameters: type: string description: The Availability Zone to launch the instance. default: nova + vm1_availability_zone: + type: string + description: The Availability Zone to launch the instance. + default: nova resources: vm1_admin_port: @@ -73,7 +77,7 @@ resources: vm1: type: OS::Nova::Server properties: - availability_zone: { get_param: availability_zone } + availability_zone: { get_param: vm1_availability_zone } user_data: get_file: prox_user_data.sh key_name: { get_param: key } @@ -146,7 +150,7 @@ outputs: description: Number of VMs created by this stack value: 3 vm1_private_ip: - description: IP address ofVM1 admin port + description: IP address of VM1 admin port value: { get_attr: [vm1_admin_port, fixed_ips, 0, ip_address] } vm1_public_ip: description: Floating IP address of VM1 in public network diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMsriovrapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMsriovrapid.yaml index fe910def..0ad39b8a 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMsriovrapid.yaml +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMsriovrapid.yaml @@ -51,6 +51,10 @@ parameters: type: string description: The Availability Zone to launch the instance. default: nova + vm1_availability_zone: + type: string + description: The Availability Zone to launch the instance. + default: nova vm1_sriov_port: type: string description: The sriov port to be used by VM1 @@ -79,7 +83,7 @@ resources: vm1: type: OS::Nova::Server properties: - availability_zone: { get_param: availability_zone } + availability_zone: { get_param: vm1_availability_zone } user_data: get_file: prox_user_data.sh key_name: { get_param: key } @@ -167,7 +171,7 @@ outputs: description: IP address of VM3 admin port value: { get_attr: [vm3_admin_port, fixed_ips, 0, ip_address] } vm3_public_ip: - description: Floating IP address of VM32 in public network + description: Floating IP address of VM3 in public network value: { get_attr: [ vm3_floating_ip, floating_ip_address ] } vm3_dataplane_ip: description: IP address of VM3 dataplane port diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README index c29532ac..3123a0e2 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README @@ -41,17 +41,19 @@ createrapid.py will use the OpenStack CLI to create the flavor, key-pair, networ stack, ... It will create a <STACK>.env 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 +You can use floating IP addresses by specifying the floating IP network +--floating_network NETWORK +or directly connect throught the INTERNAL_NETWORK by using the following parameter: +--floating_network NO Now you can run the runrapid.py file. Use help for more info on the usage: # ./runrapid.py --help The script will connect to all VMs that have been instantiated and it will launch -PROX in all VMs. -This will be done through the floating IP assigned to the VMs. You need to make sure -that floating IPs are working on your OpenStack deployment. +PROX in all VMs. This will be done through the admin IP assigned to the VMs. Once that is done it will connect to the PROX tcp socket and start sending commands to run the actual test. It will print test results on the screen while running. -The actual test that is running is decribed in <TEST>.test. +The actual test that is running is described in <TEST>.test. Notes about prox_user_data.sh script: - The script contains commands that will be executed using cloud-init at @@ -61,8 +63,8 @@ Notes about prox_user_data.sh script: - huge pages are allocated for DPDK on node 0 (hard-coded) in the VM. Note on using SRIOV ports: -Before running createrapid, it is best to already create the network, subnet and ports -manually by entering the following commands (change the parameters to your needs): +Before running createrapid, make sure the network, subnet and ports are already created +This can be done as follows (change the parameters to your needs): openstack network create --share --external --provider-network-type flat --provider-physical-network physnet2 fast-network openstack subnet create --network fast-network --subnet-range 20.20.20.0/24 --gateway none fast-subnet openstack port create --network fast-network --vnic-type direct --fixed-ip subnet=fast-subnet Port1 @@ -71,6 +73,16 @@ openstack port create --network fast-network --vnic-type direct --fixed-ip subne Make sure to use the network and subnet in the createrapid parameters list. Port1, Port2 and Port3 are being used in the yaml files. +Note when doing tests using the gateway functionality on OVS: +When a GW VM is sending packets on behalf of another VM (e.g. the generator), we need to make sure the OVS +will allow those packets to go through. Therefore you need to the IP address of the generator in the +"allowed address pairs" of the GW VM. + +Note when doing tests using encryption on OVS: +Your OVS configuration might block encrypted packets. To allow packets to go through, +you can disable port_security. You can do this by using the following commands +neutron port-update xxxxxx --no-security-groups +neutron port-update xxxxxx --port_security_enabled=False An example of the env 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 diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/basicrapid.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/basicrapid.test index e1180039..4a94c35f 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/basicrapid.test +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/basicrapid.test @@ -1,3 +1,19 @@ +## +## Copyright (c) 2010-2018 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. +## + [DEFAULT] name = BasicSwapTesting number_of_tests = 3 @@ -6,21 +22,31 @@ init_code=init_test() dest_vm = not_used gw_vm = not_used script_control = false +group1cores = not_used +group2cores = not_used +group3cores = not_used +drop_rate_treshold = 1 +accuracy = 0.01 [VM1] name = Generator config_file = gen.cfg dest_vm = 2 +script_control = true +group1cores = [1] +group2cores = [3] +group3cores = [1,3] [VM2] name = Swap config_file = swap.cfg +group1cores = [1] [test1] -cmd=run_speedtest(sock[0],sock[1],sutstatcores,genstatcores,gencontrolcores) +cmd=run_speedtest(sock[0],sock[1]) [test2] -cmd=run_sizetest(sock[0],sock[1],sutstatcores,genstatcores,gencontrolcores) +cmd=run_sizetest(sock[0],sock[1]) [test3] -cmd=run_flowtest(sock[0],sock[1],sutstatcores,genstatcores,gencontrolcores) +cmd=run_flowtest(sock[0],sock[1]) diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py index 0fb67237..f40cc8b8 100755 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py @@ -31,7 +31,7 @@ from logging import handlers from prox_ctrl import prox_ctrl import ConfigParser -version="17.12.15" +version="18.2.3" stack = "rapid" #Default string for stack yaml = "rapid.yaml" #Default string for yaml file key = "prox" # This is also the default in the yaml file.... @@ -39,7 +39,7 @@ 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 = "dpdk-subnet" #subnet for dataplane subnet_cidr="10.10.10.0/24" # cidr for dataplane internal_network="admin_internal_net" floating_network="admin_floating_net" @@ -76,7 +76,7 @@ def usage(): print(" --subnet DP_SUBNET Specify the subnet name to be used for the dataplane. Default is %s."%subnet) print(" --subnet_cidr SUBNET_CIDR Specify the subnet CIDR to be used for the dataplane. Default is %s."%subnet_cidr) print(" --internal_network NETWORK Specify the network name to be used for the control plane. Default is %s."%internal_network) - print(" --floating_network NETWORK Specify the external floating ip network name. Default is %s."%floating_network) + print(" --floating_network NETWORK Specify the external floating ip network name. Default is %s. NO if no floating ip used."%floating_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("") @@ -131,7 +131,7 @@ for opt, arg in opts: print ("Using dataplane subnet: "+ subnet_cidr) elif opt in ("--internal_network"): internal_network = arg - print ("Using controle plane network: "+ internal_network) + print ("Using control plane network: "+ internal_network) elif opt in ("--floating_network"): floating_network = arg print ("Using floating ip network: "+ floating_network) @@ -205,16 +205,17 @@ else: raise Exception("Control plane network " + internal_network + " not existing") # Checking if the floating ip network already exists, if not, stop the script -log.debug("Checking floating ip network: "+floating_network) -cmd = 'openstack network show '+floating_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("Floating ip network ("+floating_network+") already active") -else: - log.exception("Floating ip network " + floating_network + " not existing") - raise Exception("Floating ip network " + floating_network + " not existing") +if floating_network <>'NO': + log.debug("Checking floating ip network: "+floating_network) + cmd = 'openstack network show '+floating_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("Floating ip network ("+floating_network+") already active") + else: + log.exception("Floating ip network " + floating_network + " not existing") + raise Exception("Floating ip network " + floating_network + " not existing") # Checking if the image already exists, if not create it log.debug("Checking image: "+image) @@ -357,9 +358,14 @@ for vm in range(1, int(total_number_of_VMs)+1): searchString = '.*vm%d_dataplane_ip.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)' % vm matchObj = re.search(searchString, output, re.DOTALL) vmDPIP.append(matchObj.group(1)) - searchString = '.*vm%d_public_ip.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)' % vm - matchObj = re.search(searchString, output, re.DOTALL) - vmAdminIP.append(matchObj.group(1)) + if floating_network <> 'NO': + searchString = '.*vm%d_public_ip.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)' % vm + matchObj = re.search(searchString, output, re.DOTALL) + vmAdminIP.append(matchObj.group(1)) + else: + searchString = '.*vm%d_private_ip.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)' % vm + matchObj = re.search(searchString, output, re.DOTALL) + vmAdminIP.append(matchObj.group(1)) searchString = '.*vm%d_dataplane_mac.*?([a-fA-F0-9:]{17})' % vm matchObj = re.search(searchString, output, re.DOTALL) vmDPmac.append(matchObj.group(1)) diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen.cfg index 3222bde5..7ef0159c 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen.cfg @@ -36,7 +36,7 @@ name=${name} [core 0] mode=master -[core 1] +[core ${group1}] name=p0 task=0 mode=gen @@ -53,7 +53,7 @@ drop=no lat pos=42 accuracy pos=46 -[core 2] +[core ${group2}] name=lat task=0 mode=lat diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen_gw.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen_gw.cfg index 03f8b354..2e900dcf 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen_gw.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/gen_gw.cfg @@ -36,7 +36,7 @@ name=${name} [core 0] mode=master -[core 1] +[core ${group1}] name=p0 task=0 mode=gen @@ -53,7 +53,7 @@ drop=no lat pos=42 accuracy pos=46 -[core 2] +[core ${group2}] name=lat task=0 mode=lat diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.cfg index b508c9b4..4b1f7018 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.cfg @@ -34,14 +34,14 @@ name=${name} [core 0] mode=master -[core 1] +[core ${group1}] name=impair task=0 mode=impair sub mode=l3 rx port=if0 tx port=if0 -delay us=20 -probability=60 +delay us=120 +probability=99 local ipv4=${local_ip} diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.test index da856876..71ae3e12 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.test +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.test @@ -1,3 +1,19 @@ +## +## Copyright (c) 2010-2018 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. +## + [DEFAULT] name = impairTesting number_of_tests = 1 @@ -6,21 +22,31 @@ init_code=init_test() dest_vm = not_used gw_vm = not_used script_control = false +group1cores = not_used +group2cores = not_used +group3cores = not_used +drop_rate_treshold = 1 +accuracy = 0.01 + [VM1] name = Generator config_file = gen_gw.cfg gw_vm = 2 dest_vm = 3 -script_control = true +group1cores = [1] +group2cores = [3] +group3cores = [1,3] [VM2] name = ImpairGW config_file = impair.cfg +group1cores = [1] [VM3] name = Swap config_file = swap.cfg +group1cores = [1] [test1] -cmd=run_speedtest(sock[0],'none',sutstatcores,genstatcores,gencontrolcores) +cmd=run_speedtest(sock[0],sock[2]) diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.cfg new file mode 100644 index 00000000..3ae539c5 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.cfg @@ -0,0 +1,42 @@ +;; +;; 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. +;; + +[eal options] +-n=4 ; force number of memory channels +no-output=no ; disable DPDK debug output + +[lua] +dofile("parameters.lua") + +[port 0] +name=p0 + +[variables] +$mbs=8 + +[defaults] +mempool size=4K + +[global] +name=${name} + +[core 0] +mode=master + +[core ${group1}] +name=irq +task=0 +mode=irq diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.test new file mode 100644 index 00000000..a732dc8e --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.test @@ -0,0 +1,53 @@ +## +## Copyright (c) 2010-2018 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. +## + +[DEFAULT] +name = BasicSwapTesting +number_of_tests = 2 +total_number_of_vms = 2 +init_code= not_used +dest_vm = not_used +gw_vm = not_used +script_control = false +group1cores = not_used +group2cores = not_used +group3cores = not_used +drop_rate_treshold = 1 +accuracy = 0.01 + +[VM1] +name = InterruptTesting +config_file = irq.cfg +group1cores = [1,2,3] + +[VM2] +name = InterruptTesting +config_file = irq.cfg +group1cores = [1,2,3] + +[VM3] +name = InterruptTesting +config_file = irq.cfg +group1cores = [1,2,3] + + +[test1] +cmd=run_irqtest(sock[0]) +[test2] +cmd=run_irqtest(sock[1]) +[test3] +cmd=run_irqtest(sock[2]) + diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2gen.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2gen.cfg new file mode 100644 index 00000000..bf8b6ded --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2gen.cfg @@ -0,0 +1,61 @@ +;; +;; 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. +;; + +[eal options] +-n=4 ; force number of memory channels +no-output=no ; disable DPDK debug output + +[lua] +dofile("parameters.lua") + +[port 0] +name=p0 + +[variables] +$mbs=8 + +[defaults] +mempool size=4K + +[global] +name=${name} + +[core 0] +mode=master + +[core ${group1}] +name=p0 +task=0 +mode=gen +tx port=p0 +bps=1250000000 +pkt inline=${dest_hex_mac} 00 00 00 00 00 00 08 00 45 00 00 24 00 01 00 00 40 11 f7 7d ${local_hex_ip} ${dest_hex_ip} 0b b8 0b b9 00 10 55 7b +pkt size=50 +min bulk size=$mbs +max bulk size=16 +drop=no +lat pos=42 +accuracy pos=46 + +[core ${group2}] +name=lat +task=0 +mode=lat +rx port=p0 +lat pos=42 +accuracy pos=46 + + diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sut.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2swap.cfg index 9e4d5e3e..c02556d9 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sut.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2swap.cfg @@ -29,18 +29,16 @@ mac=hardware mempool size=2K [global] -name=SWAP +name=${name} [core 0] mode=master -[core 1] +[core ${group1}] name=swap task=0 mode=swap -sub mode=l3 rx port=if0 tx port=if0 -;local ipv4=${sut_ip} drop=no diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2zeroloss.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2zeroloss.test new file mode 100644 index 00000000..d7cf1321 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2zeroloss.test @@ -0,0 +1,51 @@ +## +## Copyright (c) 2010-2018 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. +## + +[DEFAULT] +name = L2BasicSwapTesting +number_of_tests = 3 +total_number_of_vms = 2 +init_code=init_test() +dest_vm = not_used +gw_vm = not_used +script_control = false +group1cores = not_used +group2cores = not_used +group3cores = not_used +drop_rate_treshold = 0 +accuracy = 0.01 + +[VM1] +name = Generator +config_file = l2gen.cfg +dest_vm = 2 +script_control = true +group1cores = [1] +group2cores = [3] +group3cores = [1,3] + +[VM2] +name = Swap +config_file = l2swap.cfg +group1cores = [1] + +[test1] +cmd=run_speedtest(sock[0],sock[1]) +[test2] +cmd=run_sizetest(sock[0],sock[1]) +[test3] +cmd=run_flowtest(sock[0],sock[1]) + diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py index daa96a50..059cbf71 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/prox_ctrl.py @@ -184,15 +184,29 @@ class prox_sock(object): self._send('reset stats') def lat_stats(self, cores, task=0): - min_lat = max_lat = avg_lat = 0 + min_lat = 999999999 + max_lat = avg_lat = 0 self._send('lat stats %s %s' % (','.join(map(str, cores)), task)) for core in cores: stats = self._recv().split(',') - min_lat += int(stats[0]) - max_lat += int(stats[1]) + min_lat = min(int(stats[0]),min_lat) + max_lat = max(int(stats[1]),max_lat) avg_lat += int(stats[2]) + avg_lat = avg_lat/len(cores) return min_lat, max_lat, avg_lat + def irq_stats(self, core, bucket, task=0): + self._send('stats task.core(%s).task(%s).irq(%s)' % (core, task, bucket)) + stats = self._recv().split(',') + return int(stats[0]) + + def show_irq_buckets(self, core, task=0): + rx = tx = drop = tsc = hz = 0 + self._send('show irq buckets %s %s' % (core,task)) + buckets = self._recv().split(';') + buckets = buckets[:-1] + return buckets + def core_stats(self, cores, task=0): rx = tx = drop = tsc = hz = 0 self._send('core stats %s %s' % (','.join(map(str, cores)), task)) diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml index 63778c1c..a5da4e28 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml @@ -51,6 +51,10 @@ parameters: type: string description: The Availability Zone to launch the instance. default: nova + vm1_availability_zone: + type: string + description: The Availability Zone to launch the instance. + default: nova resources: vm1_admin_port: @@ -73,7 +77,7 @@ resources: vm1: type: OS::Nova::Server properties: - availability_zone: { get_param: availability_zone } + availability_zone: { get_param: vm1_availability_zone } user_data: get_file: prox_user_data.sh key_name: { get_param: key } @@ -146,7 +150,7 @@ outputs: description: Number of VMs created by this stack value: 2 vm1_private_ip: - description: IP address ofVM1 admin port + description: IP address of VM1 admin port value: { get_attr: [vm1_admin_port, fixed_ips, 0, ip_address] } vm1_public_ip: description: Floating IP address of VM1 in public network diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py index 7447e160..7bbfa2a7 100755 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py @@ -30,16 +30,17 @@ from logging.handlers import RotatingFileHandler from logging import handlers from prox_ctrl import prox_ctrl import ConfigParser +import ast -version="17.12.15" -stack = "rapid" #Default string for stack -test = "basicrapid" #Default string for stack +version="18.2.12" +env = "rapid" #Default string for environment +test = "basicrapid" #Default string for test loglevel="DEBUG" # sets log level for writing to file runtime=10 # time in seconds for 1 test run def usage(): print("usage: runrapid [--version] [-v]") - print(" [--stack STACK_NAME]") + print(" [--env ENVIRONMENT_NAME]") print(" [--test TEST_NAME]") print(" [--runtime TIME_FOR_TEST]") print(" [--log DEBUG|INFO|WARNING|ERROR|CRITICAL]") @@ -49,7 +50,7 @@ def usage(): 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.env Default is %s."%stack) + print(" --env ENVIRONMENT_NAME Parameters will be read from ENVIRONMENT_NAME.env Default is %s."%env) print(" --test TEST_NAME Test cases will be read from TEST_NAME.test Default is %s."%test) 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") @@ -57,7 +58,7 @@ def usage(): print("") try: - opts, args = getopt.getopt(sys.argv[1:], "vh", ["version","help", "stack=", "test=","runtime=","log="]) + opts, args = getopt.getopt(sys.argv[1:], "vh", ["version","help", "env=", "test=","runtime=","log="]) except getopt.GetoptError as err: print("===========================================") print(str(err)) @@ -74,16 +75,16 @@ for opt, arg in opts: 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") + if opt in ("--env"): + env = arg + print ("Using '"+env+"' as name for the environment") if opt in ("--test"): test = arg print ("Using '"+test+".test' for test case definition") - elif opt in ("--runtime"): + if opt in ("--runtime"): runtime = arg print ("Runtime: "+ runtime) - elif opt in ("--log"): + if opt in ("--log"): loglevel = arg print ("Log level: "+ loglevel) @@ -113,7 +114,7 @@ console_handler.setFormatter(screen_formatter) # create a file handler # and set its log level to DEBUG # -log_file = 'RUN' +stack+'.'+test+'.log' +log_file = 'RUN' +env+'.'+test+'.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) @@ -172,57 +173,71 @@ def connect_client(client): raise Exception("Failed to connect to VM after %d attempts:\n%s" % (attempts, ex)) time.sleep(2) 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,sutstatcores,genstatcores,gencontrolcores): - gensock.start(gencontrolcores) - time.sleep(1) + log.debug("Connected to VM on %s" % client.ip()) + +def run_iteration(gensock,sutsock): + sleep_time = 2 + # Sleep_time is needed to be able to do accurate measurements to check for packet loss. We need to make this time large enough so that we do not take the first measurement while some packets from the previous tests migth still be in flight + abs_old_rx, abs_old_tx, abs_old_drop, abs_old_tsc, abs_tsc_hz = gensock.core_stats(genstatcores) + gensock.start(gencores) + time.sleep(sleep_time) if sutsock!='none': old_sut_rx, old_sut_tx, old_sut_drop, old_sut_tsc, sut_tsc_hz = sutsock.core_stats(sutstatcores) old_rx, old_tx, old_drop, old_tsc, tsc_hz = gensock.core_stats(genstatcores) time.sleep(float(runtime)) - lat_min, lat_max, lat_avg = gensock.lat_stats([2]) + lat_min, lat_max, lat_avg = gensock.lat_stats(latcores) # Get statistics after some execution time new_rx, new_tx, new_drop, new_tsc, tsc_hz = gensock.core_stats(genstatcores) if sutsock!='none': new_sut_rx, new_sut_tx, new_sut_drop, new_sut_tsc, sut_tsc_hz = sutsock.core_stats(sutstatcores) - time.sleep(1) #Stop generating - gensock.stop(gencontrolcores) + gensock.stop(gencores) + time.sleep(sleep_time) + abs_new_rx, abs_new_tx, abs_new_drop, abs_new_tsc, abs_tsc_hz = gensock.core_stats(genstatcores) 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 + abs_dropped = (abs_new_tx - abs_old_tx) - (abs_new_rx - abs_old_rx) 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) + pps_req_tx = (tx+drop-rx)*tsc_hz*1.0/(tsc*1000000) + pps_tx = tx*tsc_hz*1.0/(tsc*1000000) + pps_rx = rx*tsc_hz*1.0/(tsc*1000000) if sutsock!='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) + pps_sut_tx = sut_tx*sut_tsc_hz*1.0/(sut_tsc*1000000) + pps_sut_tx_str = '{:>9.3f}'.format(pps_sut_tx) else: pps_sut_tx = 0 pps_sut_tx_str = 'NO MEAS.' if (tx == 0): log.critical("TX = 0. Test interrupted since no packet has been sent.") raise Exception("TX = 0") - return(pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx,lat_avg) + return(pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx,lat_avg,abs_dropped) -def new_speed(speed,drop_rate): +def new_speed(speed,minspeed,maxspeed,success): # 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=1 - q=.99 - 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 +# y0=0.99 +# y100=0.1 +# p=1 +# q=.99 +# 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.0 + if success: + minspeed = speed + else: + maxspeed = speed + newspeed = (maxspeed+minspeed)/2.0 + return (newspeed,minspeed,maxspeed) + +def get_pps(speed,size): + return (speed * 100.0 / (8*(size+24))) def get_drop_rate(speed,pps_rx,size): # pps_rx are all the packets that are received by the generator. That is substracted @@ -231,18 +246,26 @@ def get_drop_rate(speed,pps_rx,size): # that the speed variable is already expressed in % so we only take 100 and not 10000) # divided by the number of bits in 1 packet. That is 8 bits in a byte times the size of # a frame (=our size + 24 bytes overhead). - return (100*(speed * 100 / (8*(size+24)) - pps_rx)/(speed*100.0/(8*(size+24)))) - -def run_speedtest(gensock,sutsock,sutstatcores,genstatcores,gencores): - 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 | Sent to NIC | Sent by Gen | Forward by SUT | Rec. by Gen | Avg. Latency | Result |") - log.info("+--------+-----------------+----------------+----------------+----------------+----------------+----------------+------------+") + tried_to_send = get_pps(speed,size) + return abs(100.0*(tried_to_send - pps_rx)/tried_to_send) + +def run_speedtest(gensock,sutsock): + 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 | Sent to NIC | Sent by Gen | Forward by SUT | Rec. by Gen | Avg. Latency | Packets Lost | Loss Ratio | Result |") + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+------------+") speed = 100 - size=64 + maxspeed = speed + minspeed = 0 + size=60 attempts = 0 - while (speed > 0.1): + endpps_sut_tx_str = 'NO_RESULTS' + 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 (maxspeed-minspeed > ACCURACY): attempts += 1 print('Measurement ongoing at speed: ' + str(round(speed,2)) + '% ',end='\r') sys.stdout.flush() @@ -250,33 +273,45 @@ def run_speedtest(gensock,sutsock,sutstatcores,genstatcores,gencores): gensock.speed(speed, gencores) time.sleep(1) # Get statistics now that the generation is stable and NO ARP messages any more - pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx,lat_avg = run_iteration(gensock,sutsock,sutstatcores,genstatcores,gencores) + pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx,lat_avg,abs_dropped = run_iteration(gensock,sutsock) drop_rate = get_drop_rate(speed,pps_rx,size) - 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 | '+ '{:>9}'.format(str(lat_avg))+" us | SUCCESS |") - log.info("+--------+-----------------+----------------+----------------+----------------+----------------+----------------+------------+") - break + if (drop_rate < DROP_RATE_TRESHOLD) or (abs_dropped==DROP_RATE_TRESHOLD ==0): + log.info('|{:>7}'.format(str(attempts))+" | " + '{:>5.1f}'.format(speed) + '% ' +'{:>6.3f}'.format(get_pps(speed,size)) + ' Mpps | '+ '{:>9.3f}'.format(pps_req_tx)+' Mpps | '+ '{:>9.3f}'.format(pps_tx) +' Mpps | ' + '{:>9}'.format(pps_sut_tx_str) +' Mpps | '+ '{:>9.3f}'.format(pps_rx)+' Mpps | '+ '{:>9.0f}'.format(lat_avg)+' us | '+ '{:>14d}'.format(abs_dropped)+ ' |''{:>9.2f}'.format(drop_rate)+ '% | SUCCESS |') + endspeed = speed + endpps_req_tx = pps_req_tx + endpps_tx = pps_tx + endpps_sut_tx_str = pps_sut_tx_str + endpps_rx = pps_rx + endlat_avg = lat_avg + endabs_dropped = abs_dropped + enddrop_rate = drop_rate + success = True 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 | '+ '{:>9}'.format(str(lat_avg))+" us | FAILED |") - speed = new_speed(speed,drop_rate) - time.sleep(2) - - -# print("") - -def run_flowtest(gensock,sutsock,sutstatcores,genstatcores,gencores): - log.info("+---------------------------------------------------------------------------------------------------------------+") - log.info("| UDP, 64 bytes, different number of flows by randomizing SRC & DST UDP port |") - log.info("+--------+-----------------+----------------+----------------+----------------+----------------+----------------+") - log.info("| Flows | Speed requested | Sent to NIC | Sent by Gen | Forward by SUT | Rec. by Gen | Avg. Latency |") - log.info("+--------+-----------------+----------------+----------------+----------------+----------------+----------------+") + log.info('|{:>7}'.format(str(attempts))+" | " + '{:>5.1f}'.format(speed) + '% ' +'{:>6.3f}'.format(get_pps(speed,size)) + ' Mpps | '+ '{:>9.3f}'.format(pps_req_tx)+' Mpps | '+ '{:>9.3f}'.format(pps_tx) +' Mpps | ' + '{:>9}'.format(pps_sut_tx_str) +' Mpps | '+ '{:>9.3f}'.format(pps_rx)+' Mpps | '+ '{:>9.0f}'.format(lat_avg)+' us | '+ '{:>14d}'.format(abs_dropped)+ ' |''{:>9.2f}'.format(drop_rate)+ '% | FAILED |') + success = False + speed,minspeed,maxspeed = new_speed(speed,minspeed,maxspeed,success) + if endpps_sut_tx_str <> 'NO_RESULTS': + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+------------+") + log.info('|{:>7}'.format('END')+" | " + '{:>5.1f}'.format(endspeed) + '% ' +'{:>6.3f}'.format(get_pps(endspeed,size)) + ' Mpps | '+ '{:>9.3f}'.format(endpps_req_tx)+' Mpps | '+ '{:>9.3f}'.format(endpps_tx) +' Mpps | ' + '{:>9}'.format(endpps_sut_tx_str) +' Mpps | '+ '{:>9.3f}'.format(endpps_rx)+' Mpps | '+ '{:>9.0f}'.format(endlat_avg)+' us | '+ '{:>14d}'.format(endabs_dropped)+ ' |''{:>9.2f}'.format(enddrop_rate)+ '% | SUCCESS |') + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+------------+") + else: + log.info('| Speed 0 or close to 0') + +def run_flowtest(gensock,sutsock): + log.info("+------------------------------------------------------------------------------------------------------------------------------------------------+") + log.info("| UDP, 64 bytes, different number of flows by randomizing SRC & DST UDP port |") + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+") + log.info("| Flows | Speed requested | Sent to NIC | Sent by Gen | Forward by SUT | Rec. by Gen | Avg. Latency | Packets Lost | Loss Ratio |") + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+") speed = 100 - size=64 + size=60 # 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']} # flows={524280:['1000000XXXXXXXXX','100000XXXXXXXXXX']} + 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 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 gensock.reset_stats() @@ -285,33 +320,47 @@ def run_flowtest(gensock,sutsock,sutstatcores,genstatcores,gencores): 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): + endpps_sut_tx_str = 'NO_RESULTS' + maxspeed = speed + minspeed = 0 + while (maxspeed-minspeed > ACCURACY): print(str(flow_number)+' flows: 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) time.sleep(1) # Get statistics now that the generation is stable and NO ARP messages any more - pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx,lat_avg = run_iteration(gensock,sutsock,sutstatcores,genstatcores,gencores) + pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx,lat_avg,abs_dropped = run_iteration(gensock,sutsock) drop_rate = get_drop_rate(speed,pps_rx,size) - 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 |"+ '{:>9}'.format(str(lat_avg))+" us |") - log.info("+--------+-----------------+----------------+----------------+----------------+----------------+----------------+") - break - speed = new_speed(speed,drop_rate) - time.sleep(2) -# print("") - -def run_sizetest(gensock,sutsock,sutstatcores,genstatcores,gencores): - log.info("+---------------------------------------------------------------------------------------------------------------+") - log.info("| UDP, 1 flow, different packet sizes |") - log.info("+--------+-----------------+----------------+----------------+----------------+----------------+----------------+") - log.info("| Pktsize| Speed requested | Sent to NIC | Sent by Gen | Forward by SUT | Rec. by Gen | Avg. Latency |") - log.info("+--------+-----------------+----------------+----------------+----------------+----------------+----------------+") + if (drop_rate < DROP_RATE_TRESHOLD) or (abs_dropped==DROP_RATE_TRESHOLD ==0): + endspeed = speed + endpps_req_tx = pps_req_tx + endpps_tx = pps_tx + endpps_sut_tx_str = pps_sut_tx_str + endpps_rx = pps_rx + endlat_avg = lat_avg + endabs_dropped = abs_dropped + enddrop_rate = drop_rate + success = True + else: + success = False + speed,minspeed,maxspeed = new_speed(speed,minspeed,maxspeed,success) + if endpps_sut_tx_str <> 'NO_RESULTS': + log.info('|{:>7}'.format(str(flow_number))+" | " + '{:>5.1f}'.format(endspeed) + '% ' +'{:>6.3f}'.format(get_pps(endspeed,size)) + ' Mpps | '+ '{:>9.3f}'.format(endpps_req_tx)+' Mpps | '+ '{:>9.3f}'.format(endpps_tx) +' Mpps | ' + '{:>9}'.format(endpps_sut_tx_str) +' Mpps | '+ '{:>9.3f}'.format(endpps_rx)+' Mpps | '+ '{:>9.0f}'.format(endlat_avg)+' us | '+ '{:>14d}'.format(endabs_dropped)+ ' |'+'{:>9.2f}'.format(enddrop_rate)+ '% |') + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+") + else: + log.info('|{:>7}'.format(str(flow_number))+" | Speed 0 or close to 0") + +def run_sizetest(gensock,sutsock): + log.info("+------------------------------------------------------------------------------------------------------------------------------------------------+") + log.info("| UDP, 1 flow, different packet sizes |") + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+") + log.info("| Pktsize| Speed requested | Sent to NIC | Sent by Gen | Forward by SUT | Rec. by Gen | Avg. Latency | Packets Lost | Loss Ratio |") + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+") 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=[1400,1024,512,256,128,64] + # PROX will use different packet sizes as defined in sizes[] +# sizes=[1496,1020,508,252,124,60] + sizes=[1020,508,252,124,60] 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 gensock.reset_stats() @@ -321,43 +370,89 @@ def run_sizetest(gensock,sutsock,sutstatcores,genstatcores,gencores): 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') + endpps_sut_tx_str = 'NO_RESULTS' + maxspeed = speed + minspeed = 0 + while (maxspeed-minspeed > ACCURACY): + print(str(size+4)+' bytes: 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) - time.sleep(1) # Get statistics now that the generation is stable and NO ARP messages any more - pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx,lat_avg = run_iteration(gensock,sutsock,sutstatcores,genstatcores,gencores) + pps_req_tx,pps_tx,pps_sut_tx_str,pps_rx,lat_avg, abs_dropped = run_iteration(gensock,sutsock) drop_rate = get_drop_rate(speed,pps_rx,size) - 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 |"+ '{:>10}'.format(str(lat_avg))+" us |") - log.info("+--------+-----------------+----------------+----------------+----------------+----------------+----------------+") - break - speed = new_speed(speed,drop_rate) - time.sleep(2) -#======================================================================== + if (drop_rate < DROP_RATE_TRESHOLD) or (abs_dropped==DROP_RATE_TRESHOLD ==0): + endspeed = speed + endpps_req_tx = pps_req_tx + endpps_tx = pps_tx + endpps_sut_tx_str = pps_sut_tx_str + endpps_rx = pps_rx + endlat_avg = lat_avg + endabs_dropped = abs_dropped + enddrop_rate = drop_rate + success = True + else: + success = False + speed,minspeed,maxspeed = new_speed(speed,minspeed,maxspeed,success) + if endpps_sut_tx_str <> 'NO_RESULTS': + log.info('|{:>7}'.format(size+4)+" | " + '{:>5.1f}'.format(endspeed) + '% ' +'{:>6.3f}'.format(get_pps(endspeed,size)) + ' Mpps | '+ '{:>9.3f}'.format(endpps_req_tx)+' Mpps | '+ '{:>9.3f}'.format(endpps_tx) +' Mpps | ' + '{:>9}'.format(endpps_sut_tx_str) +' Mpps | '+ '{:>9.3f}'.format(endpps_rx)+' Mpps | '+ '{:>9.0f}'.format(endlat_avg)+' us | '+ '{:>14d}'.format(endabs_dropped)+ ' |'+'{:>9.2f}'.format(enddrop_rate)+ '% |') + log.info("+--------+--------------------+----------------+----------------+----------------+----------------+----------------+----------------+------------+") + else: + log.debug('|{:>7}'.format(str(size))+" | Speed 0 or close to 0") + + +def run_irqtest(sock): + log.info("+----------------------------------------------------------------------------------------------------------------------------") + log.info("| Measuring time probably spent dealing with an interrupt. Interrupting DPDK cores for more than 50us might be problematic ") + log.info("| and result in packet loss. The first row shows the interrupted time buckets: first number is the bucket between 0us and ") + log.info("| that number expressed in us and so on. The numbers in the other rows show how many times per second, the program was ") + log.info("| interrupted for a time as specified by its bucket. '0' is printed when there are no interrupts in this bucket throughout ") + log.info("| the duration of the test. This is to avoid rounding errors in the case of 0.0 ") + log.info("+----------------------------------------------------------------------------------------------------------------------------") + sys.stdout.flush() + buckets=sock.show_irq_buckets(1) + print('Measurement ongoing ... ',end='\r') + sock.stop(irqcores) + old_irq = [[0 for x in range(len(buckets)+1)] for y in range(len(irqcores)+1)] + irq = [[0 for x in range(len(buckets)+1)] for y in range(len(irqcores)+1)] + irq[0][0] = 'bucket us' + for j,bucket in enumerate(buckets,start=1): + irq[0][j] = '<'+ bucket + irq[0][-1] = '>'+ buckets [-2] + for j,bucket in enumerate(buckets,start=1): + for i,irqcore in enumerate(irqcores,start=1): + old_irq[i][j] = sock.irq_stats(irqcore,j-1) + sock.start(irqcores) + time.sleep(float(runtime)) + sock.stop(irqcores) + for i,irqcore in enumerate(irqcores,start=1): + irq[i][0]='core %s '%irqcore + for j,bucket in enumerate(buckets,start=1): + diff = sock.irq_stats(irqcore,j-1) - old_irq[i][j] + if diff == 0: + irq[i][j] = '0' + else: + irq[i][j] = diff/float(runtime) + log.info('\n'.join([''.join(['{:>12}'.format(item) for item in row]) for row in irq])) + def init_test(): - global sutstatcores - global genstatcores - global genrxcores - global gencontrolcores - sutstatcores = [1] - genstatcores = [1,2] - genrxcores = [2] - gencontrolcores = [1] # Running at low speed to make sure the ARP messages can get through. # If not doing this, the ARP message could be dropped by a switch in overload and then the test will not give proper results # Note hoever that if we would run the test steps during a very long time, the ARP would expire in the switch. # PROX will send a new ARP request every seconds so chances are very low that they will all fail to get through - sock[0].speed(0.01, gencontrolcores) + sock[0].speed(0.01, gencores) sock[0].start(genstatcores) time.sleep(2) - sock[0].stop(gencontrolcores) - sock[1].start([1]) - + sock[0].stop(gencores) + +global sutstatcores +global genstatcores +global latcores +global gencores +global irqcores +global DROP_RATE_TRESHOLD +global ACCURACY vmDPIP =[] vmAdminIP =[] vmDPmac =[] @@ -368,8 +463,10 @@ script_control =[] testconfig = ConfigParser.RawConfigParser() testconfig.read(test+'.test') required_number_of_VMs = testconfig.get('DEFAULT', 'total_number_of_vms') +DROP_RATE_TRESHOLD = float(testconfig.get('DEFAULT', 'drop_rate_treshold')) +ACCURACY = float(testconfig.get('DEFAULT', 'accuracy')) config = ConfigParser.RawConfigParser() -config.read(stack+'.env') +config.read(env+'.env') key = config.get('OpenStack', 'key') total_number_of_VMs = config.get('rapid', 'total_number_of_VMs') if int(required_number_of_VMs) > int(total_number_of_VMs): @@ -384,6 +481,15 @@ for vm in range(1, int(total_number_of_VMs)+1): for vm in range(1, int(required_number_of_VMs)+1): config_file.append(testconfig.get('VM%d'%vm, 'config_file')) script_control.append(testconfig.get('VM%d'%vm, 'script_control')) + group1cores=testconfig.get('VM%d'%vm, 'group1cores') + if group1cores <> 'not_used': + group1cores=ast.literal_eval(group1cores) + group2cores=testconfig.get('VM%d'%vm, 'group2cores') + if group2cores <> 'not_used': + group2cores=ast.literal_eval(group2cores) + group3cores=testconfig.get('VM%d'%vm, 'group3cores') + if group3cores <> 'not_used': + group3cores=ast.literal_eval(group3cores) with open("parameters%d.lua"%vm, "w") as f: f.write('name="%s"\n'% testconfig.get('VM%d'%vm, 'name')) f.write('local_ip="%s"\n'% vmDPIP[vm-1]) @@ -398,6 +504,27 @@ for vm in range(1, int(required_number_of_VMs)+1): destVMindex = int(destVM)-1 f.write('dest_ip="%s"\n'% vmDPIP[destVMindex]) f.write('dest_hex_ip="%s"\n'% hexDPIP[destVMindex]) + f.write('dest_hex_mac="%s"\n'% vmDPmac[destVMindex].replace(':',' ')) + if group1cores <> 'not_used': + f.write('group1="%s"\n'% ','.join(map(str, group1cores))) + if group2cores <> 'not_used': + f.write('group2="%s"\n'% ','.join(map(str, group2cores))) + if group3cores <> 'not_used': + f.write('group3="%s"\n'% ','.join(map(str, group3cores))) + if re.match('(l2){0,1}gen.*\.cfg',config_file[-1]): + gencores = group1cores + latcores = group2cores + genstatcores = group3cores + elif config_file[-1] == 'gen_gw.cfg': + gencores = group1cores + latcores = group2cores + genstatcores = group3cores + elif re.match('(l2){0,1}swap.*\.cfg',config_file[-1]): + sutstatcores = group1cores + elif config_file[-1] == 'secgw2.cfg': + sutstatcores = group1cores + elif config_file[-1] == 'irq.cfg': + irqcores = group1cores f.close ##################################################################################### client =[] @@ -417,10 +544,10 @@ for vm in range(0, int(required_number_of_VMs)): client[-1].scp_put('./%s'%devbindfile, '/root/devbind.sh') cmd = '/root/devbind.sh' client[-1].run_cmd(cmd) - log.info("devbind.sh running on VM%d"%(vm+1)) + log.debug("devbind.sh running on VM%d"%(vm+1)) client[-1].scp_put('./%s'%config_file[vm], '/root/%s'%config_file[vm]) client[-1].scp_put('./parameters%d.lua'%(vm+1), '/root/parameters.lua') - log.info("Starting PROX on VM%d"%(vm+1)) + log.debug("Starting PROX on VM%d"%(vm+1)) if script_control[vm] == 'true': cmd = '/root/prox/build/prox -e -t -o cli -f /root/%s'%config_file[vm] else: @@ -429,7 +556,8 @@ for vm in range(0, int(required_number_of_VMs)): sock.append(connect_socket(client[-1])) init_code = testconfig.get('DEFAULT', 'init_code') -eval(init_code) +if init_code <> 'not_used': + eval(init_code) #################################################### # Run test cases # Best to run the flow test at the end since otherwise the tests coming after thatmight be influenced by the big number of entries in the switch flow tables diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw.test index 3f537e33..4db089f9 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw.test +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw.test @@ -1,3 +1,19 @@ +## +## Copyright (c) 2010-2018 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. +## + [DEFAULT] name = GWTesting number_of_tests = 2 @@ -6,7 +22,11 @@ init_code=init_test() dest_vm = not_used gw_vm = not_used script_control = false - +group1cores = not_used +group2cores = not_used +group3cores = not_used +drop_rate_treshold = 1 +accuracy = 0.01 [VM1] name = Generator @@ -14,18 +34,23 @@ config_file = gen_gw.cfg dest_vm = 3 gw_vm = 2 script_control = true +group1cores = [1] +group2cores = [3] +group3cores = [1,3] [VM2] name = GW1 config_file = secgw1.cfg dest_vm = 3 +group1cores = [1] [VM3] name = GW2 config_file = secgw2.cfg +group1cores = [1] [test1] -cmd=run_speedtest(sock[0],'none',sutstatcores,genstatcores,gencontrolcores) +cmd=run_speedtest(sock[0],sock[2]) [test2] -cmd=run_sizetest(sock[0],'none',sutstatcores,genstatcores,gencontrolcores) +cmd=run_sizetest(sock[0],sock[2]) diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw1.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw1.cfg index c4aa82fa..30abb8f7 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw1.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw1.cfg @@ -43,7 +43,7 @@ name=${name} [core 0] mode=master -[core 1] +[core ${group1}] name=esp_enc task=0 mode=esp_enc diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw2.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw2.cfg index 6b9c7500..a361e875 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw2.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw2.cfg @@ -42,7 +42,7 @@ name=${name} [core 0] mode=master -[core 1] +[core ${group1}] name=esp_dec task=0 mode=esp_dec diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml index d76e1ee3..3bfca4ed 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml @@ -51,6 +51,10 @@ parameters: type: string description: The Availability Zone to launch the instance. default: nova + vm1_availability_zone: + type: string + description: The Availability Zone to launch the instance. + default: nova vm1_sriov_port: type: string description: The sriov port to be used by VM1 @@ -79,7 +83,7 @@ resources: vm1: type: OS::Nova::Server properties: - availability_zone: { get_param: availability_zone } + availability_zone: { get_param: vm1_availability_zone } user_data: get_file: prox_user_data.sh key_name: { get_param: key } @@ -167,7 +171,7 @@ outputs: # description: IP address of VM3 admin port # value: { get_attr: [vm3_admin_port, fixed_ips, 0, ip_address] } # vm3_public_ip: -# description: Floating IP address of VM32 in public network +# description: Floating IP address of VM3 in public network # value: { get_attr: [ vm3_floating_ip, floating_ip_address ] } # vm3_dataplane_ip: # description: IP address of VM3 dataplane port diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/swap.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/swap.cfg index 7b8dd492..4229c207 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/swap.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/swap.cfg @@ -34,7 +34,7 @@ name=${name} [core 0] mode=master -[core 1] +[core ${group1}] name=swap task=0 mode=swap |