diff options
Diffstat (limited to 'VNFs/DPPD-PROX')
14 files changed, 188 insertions, 928 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMrapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMrapid.yaml deleted file mode 100644 index 8424897b..00000000 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMrapid.yaml +++ /dev/null @@ -1,191 +0,0 @@ -## -## 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 - internal_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 - vm1_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - vm2_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - vm3_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - -resources: - vm1_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm1_dataplane_port: - type: OS::Neutron::Port - properties: - network: {get_param: dataplane_network} - security_groups: - - default - vm1_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm1_admin_port} - vm1: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm1_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: vm1_admin_port} - - port: {get_resource: vm1_dataplane_port} - vm2_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm2_dataplane_port: - type: OS::Neutron::Port - properties: - network: {get_param: dataplane_network} - security_groups: - - default - vm2_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm2_admin_port} - vm2: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm2_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: vm2_admin_port} - - port: {get_resource: vm2_dataplane_port} - vm3_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm3_dataplane_port: - type: OS::Neutron::Port - properties: - network: {get_param: dataplane_network} - security_groups: - - default - vm3_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm3_admin_port} - vm3: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm3_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: vm3_admin_port} - - port: {get_resource: vm3_dataplane_port} - -outputs: - total_number_of_VMs: - description: Number of VMs created by this stack - value: 3 - vm1_private_ip: - 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 - value: { get_attr: [ vm1_floating_ip, floating_ip_address ] } - vm1_dataplane_ip: - description: IP address of VM1 dataplane port - value: { get_attr: [vm1_dataplane_port, fixed_ips, 0, ip_address] } - vm1_dataplane_mac: - description: The MAC address of VM1 dataplane port - value: { get_attr: [vm1_dataplane_port, mac_address] } - vm2_private_ip: - description: IP address of the VM2 admin port - value: { get_attr: [vm2_admin_port, fixed_ips, 0, ip_address] } - vm2_public_ip: - description: Floating IP address of VM2 in public network - value: { get_attr: [ vm2_floating_ip, floating_ip_address ] } - vm2_dataplane_ip: - description: IP address of VM2 dataplane port - value: { get_attr: [vm2_dataplane_port, fixed_ips, 0, ip_address] } - vm2_dataplane_mac: - description: The MAC address of VM2 dataplane port - value: { get_attr: [vm2_dataplane_port, mac_address] } - vm3_private_ip: - description: IP address of the VM3 admin port - value: { get_attr: [vm3_admin_port, fixed_ips, 0, ip_address] } - vm3_public_ip: - 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 - value: { get_attr: [vm3_dataplane_port, fixed_ips, 0, ip_address] } - vm3_dataplane_mac: - description: The MAC address of VM3 dataplane port - value: { get_attr: [vm3_dataplane_port, mac_address] } diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMsriovrapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMsriovrapid.yaml deleted file mode 100644 index 0037d27d..00000000 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/3VMsriovrapid.yaml +++ /dev/null @@ -1,185 +0,0 @@ -## -## 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 - internal_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 - vm1_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - vm2_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - vm3_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 - default: Port1 - vm2_sriov_port: - type: string - description: The sriov port to be used by VM2 - default: Port2 - vm3_sriov_port: - type: string - description: The sriov port to be used by VM3 - default: Port3 - -resources: - vm1_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm1_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm1_admin_port} - vm1: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm1_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: vm1_admin_port} - - port: {get_param: vm1_sriov_port} - vm2_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm2_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm2_admin_port} - vm2: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm2_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: vm2_admin_port} - - port: {get_param: vm2_sriov_port} - vm3_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm3_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm3_admin_port} - vm3: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm3_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: vm3_admin_port} - - port: {get_param: vm3_sriov_port} - -outputs: - total_number_of_VMs: - description: Number of VMs created by this stack - value: 3 - vm1_private_ip: - 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 - value: { get_attr: [ vm1_floating_ip, floating_ip_address ] } - vm1_dataplane_ip: - description: IP address of VM1 dataplane port - value: { get_attr: [vm1, networks,{get_param: dataplane_network},0] } - vm1_dataplane_mac: - description: The MAC address of VM1 dataplane port - value: { get_attr: [vm1, addresses, {get_param: dataplane_network}] } - vm2_private_ip: - description: IP address of VM2 admin port - value: { get_attr: [vm2_admin_port, fixed_ips, 0, ip_address] } - vm2_public_ip: - description: Floating IP address of VM2 in public network - value: { get_attr: [ vm2_floating_ip, floating_ip_address ] } - vm2_dataplane_ip: - description: IP address of VM2 dataplane port - value: { get_attr: [vm2, networks,{get_param: dataplane_network},0] } - vm2_dataplane_mac: - description: The MAC address of VM2 dataplane port - value: { get_attr: [vm2, addresses, {get_param: dataplane_network}]} - vm3_private_ip: - 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 VM3 in public network - value: { get_attr: [ vm3_floating_ip, floating_ip_address ] } - vm3_dataplane_ip: - description: IP address of VM3 dataplane port - value: { get_attr: [vm3, networks,{get_param: dataplane_network},0] } - vm3_dataplane_mac: - description: The MAC address of VM3 dataplane port - value: { get_attr: [vm3, addresses, {get_param: dataplane_network}]} diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README index 3123a0e2..2dac5b69 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/README @@ -38,7 +38,7 @@ Now you can run the createrapid.py file. Use help for more info on the usage: # ./createrapid.py --help createrapid.py will use the OpenStack CLI to create the flavor, key-pair, network, image, -stack, ... +servers, ... 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 @@ -48,8 +48,8 @@ or directly connect throught the INTERNAL_NETWORK by using the following paramet 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 admin IP assigned to the VMs. +The script will connect to all machines that have been instantiated and it will launch +PROX in all machines. This will be done through the admin IP assigned to the machines. 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. @@ -71,7 +71,7 @@ openstack port create --network fast-network --vnic-type direct --fixed-ip subne openstack port create --network fast-network --vnic-type direct --fixed-ip subnet=fast-subnet Port2 openstack port create --network fast-network --vnic-type direct --fixed-ip subnet=fast-subnet Port3 Make sure to use the network and subnet in the createrapid parameters list. Port1, Port2 and Port3 -are being used in the yaml files. +are being used in the *.env file. 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 @@ -88,22 +88,22 @@ 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 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 [VMx] sections are used as +achieved using createrapid.py. Only the [Mx] sections are used as input for runrapid.py. [DEFAULT] admin_ip = none -[VM1] +[M1] admin_ip = 192.168.4.130 dp_ip = 10.10.10.6 dp_mac = fa:16:3e:3c:1e:12 -[VM2] +[M2] admin_ip = 192.168.4.140 dp_ip = 10.10.10.9 dp_mac = fa:16:3e:2a:00:5d -[VM3] +[M3] admin_ip = 192.168.4.138 dp_ip = 10.10.10.11 dp_mac = fa:16:3e:ae:fa:86 diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/basicrapid.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/basicrapid.test index 58851cce..6a9998c6 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/basicrapid.test +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/basicrapid.test @@ -17,7 +17,7 @@ [DEFAULT] name = BasicSwapTesting number_of_tests = 3 -total_number_of_vms = 2 +total_number_of_test_machines = 2 init_code=init_test() dest_vm = not_used gw_vm = not_used @@ -25,12 +25,13 @@ script_control = false group1cores = not_used group2cores = not_used group3cores = not_used -drop_rate_treshold = 0.01 +drop_rate_treshold = 0.1 accuracy = 0.01 -[VM1] +[TestM1] name = Generator +machine_index = 1 config_file = gen.cfg dest_vm = 2 script_control = true @@ -38,8 +39,9 @@ group1cores = [1] group2cores = [3] group3cores = [1,3] -[VM2] +[TestM2] name = Swap +machine_index = 2 config_file = swap.cfg group1cores = [1] diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py index 867ce324..ffba5013 100755 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py @@ -31,30 +31,25 @@ from logging import handlers from prox_ctrl import prox_ctrl import ConfigParser -version="18.2.12" -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.... -flavor = "prox_flavor" # This is also the default in the yaml file.... -image = "rapidVM" # This is also the default in the yaml file.... +version="18.3.27" +stack = "rapid" #Default string for stack. This is not an OpenStack Heat stack, just a group of VMs +vms = "rapidVMs" #Default string for vms file +key = "prox" # default name for kay +image = "rapidVM" # default name for the image image_file = "rapidVM.qcow2" -dataplane_network = "dataplane-network" # This is also the default in the yaml file.... +dataplane_network = "dataplane-network" # default name for the dataplane network 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" -vm1_availability_zone="nova" -vm2_availability_zone="nova" -vm3_availability_zone="nova" loglevel="DEBUG" # sets log level for writing to file runtime=10 # time in seconds for 1 test run def usage(): print("usage: createrapid [--version] [-v]") print(" [--stack STACK_NAME]") - print(" [--yaml YAML_FILE]") + print(" [--vms VMS_FILE]") print(" [--key KEY_NAME]") - print(" [--flavor FLAVOR_NAME]") print(" [--image IMAGE_NAME]") print(" [--image_file IMAGE_FILE]") print(" [--dataplane_network DP_NETWORK]") @@ -62,20 +57,16 @@ def usage(): print(" [--subnet_cidr SUBNET_CIDR]") print(" [--internal_network ADMIN_NETWORK]") print(" [--floating_network ADMIN_NETWORK]") - print(" [--vm1_availability_zone ZONE_FOR_VM1]") - print(" [--vm2_availability_zone ZONE_FOR_VM2]") - print(" [--vm3_availability_zone ZONE_FOR_VM3]") - print(" [--log DEBUG|INFO|WARNING|ERROR|CRITICAL") + print(" [--log DEBUG|INFO|WARNING|ERROR|CRITICAL]") print(" [-h] [--help]") print("") print("Command-line interface to createrapid") 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 %s."%stack) - print(" --yaml YAML_FILE Specify the yaml file to be used. Default is %s."%yaml) + print(" --stack STACK_NAME Specify a name for the stack. Default is %s."%stack) + print(" --vms VMS_FILE Specify the vms file to be used. Default is %s.vms."%vms) print(" --key KEY_NAME Specify the key to be used. Default is %s."%key) - print(" --flavor FLAVOR_NAME Specify the flavor to be used. Default is %s."%flavor) print(" --image IMAGE_NAME Specify the image to be used. Default is %s."%image) print(" --image_file IMAGE_FILE Specify the image qcow2 file to be used. Default is %s."%image_file) print(" --dataplane_network NETWORK Specify the network name to be used for the dataplane. Default is %s."%dataplane_network) @@ -83,18 +74,12 @@ def usage(): 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. NO if no floating ip used."%floating_network) - print(" --vm1_availability_zone ZONE Specify the availability zone for VM1. Default is %s."%vm1_availability_zone) - print(" --vm2_availability_zone ZONE Specify the availability zone for VM2. Default is %s."%vm2_availability_zone) - print(" --vm3_availability_zone ZONE Specify the availability zone for VM3. Default is %s."%vm3_availability_zone) 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 %s"%stack) - print("Note that %s is the default stack name. Replace with STACK_NAME if needed"%stack) try: - opts, args = getopt.getopt(sys.argv[1:], "vh", ["version","help", "yaml=","stack=","key=","flavor=","image=","image_file=","dataplane_network=","subnet=","subnet_cidr=","internal_network=","floating_network=","vm1_availability_zone=","vm2_availability_zone=","vm3_availability_zone=","log="]) + opts, args = getopt.getopt(sys.argv[1:], "vh", ["version","help", "vms=","stack=","key=","image=","image_file=","dataplane_network=","subnet=","subnet_cidr=","internal_network=","floating_network=","log="]) except getopt.GetoptError as err: print("===========================================") print(str(err)) @@ -114,15 +99,12 @@ for opt, arg in opts: 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 ("--vms"): + vms = arg + print ("Using Virtual Machines Description: "+vms) 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) @@ -144,15 +126,6 @@ for opt, arg in opts: elif opt in ("--floating_network"): floating_network = arg print ("Using floating ip network: "+ floating_network) - elif opt in ("--vm1_availability_zone"): - vm1_availability_zone = arg - print ("Using VM1 availability zone: "+ vm1_availability_zone) - elif opt in ("--vm2_availability_zone"): - vm2_availability_zone = arg - print ("Using VM2 availability zone: "+ vm2_availability_zone) - elif opt in ("--vm3_availability_zone"): - vm3_availability_zone = arg - print ("Using VM3 availability zone: "+ vm3_availability_zone) elif opt in ("--log"): loglevel = arg print ("Log level: "+ loglevel) @@ -282,28 +255,6 @@ 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_thread_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) @@ -345,58 +296,105 @@ 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 internal_network="'+internal_network+'" --parameter floating_network="'+floating_network+'" --parameter vm1_availability_zone="'+vm1_availability_zone+'" --parameter vm2_availability_zone="'+vm2_availability_zone+'" --parameter vm3_availability_zone="'+vm3_availability_zone+'" --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('.*total_number_of_VMs.*?([0-9])', output, re.DOTALL) -total_number_of_VMs = matchObj.group(1) -vmDPIP =[] -vmAdminIP =[] -vmDPmac =[] config = ConfigParser.RawConfigParser() +vmconfig = ConfigParser.RawConfigParser() +vmconfig.read(vms+'.vms') +total_number_of_VMs = vmconfig.get('DEFAULT', 'total_number_of_vms') 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)) - 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)) + flavor_info = vmconfig.get('VM%d'%vm, 'flavor_info') + flavor_meta_data = vmconfig.get('VM%d'%vm, 'flavor_meta_data') + boot_info = vmconfig.get('VM%d'%vm, 'boot_info') + SRIOV_port = vmconfig.get('VM%d'%vm, 'SRIOV_port') + server_name = '%s-VM%d'%(stack,vm) + flavor_name = '%s-VM%d-flavor'%(stack,vm) + log.debug("Checking server: "+server_name) + cmd = 'openstack server show '+server_name + log.debug (cmd) + cmd = cmd + ' |grep "\sname\s" | tr -s " " | cut -d" " -f 4' + ServerExist = subprocess.check_output(cmd , shell=True).strip() + if ServerExist == server_name: + log.info("Server ("+server_name+") already active") 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)) - log.info('VM%d: (admin IP: %s), (dataplane IP: %s), (dataplane MAC: %s)' % (vm,vmAdminIP[-1],vmDPIP[-1],vmDPmac[-1])) - config.add_section('VM%d'%vm) - config.set('VM%d'%vm, 'admin_ip', vmAdminIP[-1]) - config.set('VM%d'%vm, 'dp_ip', vmDPIP[-1]) - config.set('VM%d'%vm, 'dp_mac', vmDPmac[-1]) + # Checking if the flavor already exists, if not create it + log.debug("Checking flavor: "+flavor_name) + cmd = 'openstack flavor show '+flavor_name + log.debug (cmd) + cmd = cmd + ' |grep "\sname\s" | tr -s " " | cut -d" " -f 4' + FlavorExist = subprocess.check_output(cmd , shell=True).strip() + if FlavorExist == flavor_name: + log.info("Flavor ("+flavor_name+") already installed") + else: + log.info('Creating flavor ...') + cmd = 'openstack flavor create %s %s'%(flavor_name,flavor_info) + log.debug(cmd) + cmd = cmd + ' |grep "\sname\s" | tr -s " " | cut -d" " -f 4' + FlavorExist = subprocess.check_output(cmd , shell=True).strip() + if FlavorExist == flavor_name: + cmd = 'openstack flavor set %s %s'%(flavor_name, flavor_meta_data) + log.debug(cmd) + subprocess.check_call(cmd , shell=True) + log.info("Flavor created") + else : + log.exception("Failed to create flavor: " + flavor_name) + raise Exception("Failed to create flavor: " + flavor_name) + if SRIOV_port == 'NO': + nic_info = '--nic net-id=%s --nic net-id=%s'%(internal_network,dataplane_network) + else: + nic_info = '--nic net-id=%s'%(internal_network) + for port in SRIOV_port.split(','): + nic_info = nic_info + ' --nic port-id=%s'%(port) + if vm==int(total_number_of_VMs): + # For the last server, we want to wait for the server creation to complete, so the next operations will succeeed (e.g. IP allocation) + # Note that this waiting is not bullet proof. Imagine, we loop through all the VMs, and the last VM was already running, while the previous + # VMs still needed to be created. Or the previous server creations take much longer than the last one. + # In that case, we might be to fast when we query for the IP & MAC addresses. + wait = ' --wait ' + else: + wait = ' ' + log.info("Creating server...") + cmd = 'openstack server create --flavor %s --key-name %s --image %s %s %s%s%s'%(flavor_name,key,image,nic_info,boot_info,wait,server_name) + log.debug(cmd) + cmd = cmd + ' |grep "\sname\s" | tr -s " " | cut -d" " -f 4' + ServerExist = subprocess.check_output(cmd , shell=True).strip() + if floating_network <> 'NO': + log.info('Creating floating IP ...') + cmd = 'openstack floating ip create ' + floating_network + log.debug(cmd) + cmd = cmd + ' |grep "floating_ip_address " | tr -s " " | cut -d"|" -f 3' + vmAdminIP = subprocess.check_output(cmd , shell=True).strip() + log.info('Associating floating IP ...') + cmd = 'openstack server add floating ip %s %s'%(server_name,vmAdminIP) + log.debug(cmd) + output = subprocess.check_output(cmd , shell=True).strip() + print (output) +for vm in range(1, int(total_number_of_VMs)+1): + server_name = '%s-VM%d'%(stack,vm) + cmd = 'openstack server show %s'%(server_name) + log.debug(cmd) + output = subprocess.check_output(cmd , shell=True).strip() + searchString = '.*%s.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)' %(dataplane_network) + matchObj = re.search(searchString, output, re.DOTALL) + vmDPIP = matchObj.group(1) + searchString = '.*%s=([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+),*\s*([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)*' %(internal_network) + matchObj = re.search(searchString, output, re.DOTALL) + vmAdminIP = matchObj.group(2) + if vmAdminIP == None: + vmAdminIP = matchObj.group(1) + cmd = 'openstack port list |grep %s | tr -s " " | cut -d"|" -f 4'%(vmDPIP) + log.debug(cmd) + vmDPmac = subprocess.check_output(cmd , shell=True).strip() + config.add_section('M%d'%vm) + config.set('M%d'%vm, 'name', server_name) + config.set('M%d'%vm, 'admin_ip', vmAdminIP) + config.set('M%d'%vm, 'dp_ip', vmDPIP) + config.set('M%d'%vm, 'dp_mac', vmDPmac) + log.info('%s: (admin IP: %s), (dataplane IP: %s), (dataplane MAC: %s)' % (server_name,vmAdminIP,vmDPIP,vmDPmac)) + config.add_section('OpenStack') config.set('OpenStack', 'stack', stack) -config.set('OpenStack', 'yaml', yaml) +config.set('OpenStack', 'VMs', vms) 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) @@ -407,9 +405,8 @@ config.set('OpenStack', 'floating_network', floating_network) config.add_section('rapid') config.set('rapid', 'loglevel', loglevel) config.set('rapid', 'version', version) -config.set('rapid', 'total_number_of_VMs', total_number_of_VMs) +config.set('rapid', 'total_number_of_machines', total_number_of_VMs) config.set('DEFAULT', 'admin_ip', 'none') # Writing the environment file with open(stack+'.env', 'wb') as envfile: config.write(envfile) - diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.cfg index 4b1f7018..e8b3801d 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.cfg @@ -41,7 +41,7 @@ mode=impair sub mode=l3 rx port=if0 tx port=if0 -delay us=120 -probability=99 +delay us=10 +probability=100 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 71ae3e12..3042e722 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.test +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/impair.test @@ -17,7 +17,7 @@ [DEFAULT] name = impairTesting number_of_tests = 1 -total_number_of_vms = 3 +total_number_of_test_machines = 3 init_code=init_test() dest_vm = not_used gw_vm = not_used @@ -29,8 +29,9 @@ drop_rate_treshold = 1 accuracy = 0.01 -[VM1] +[TestM1] name = Generator +machine_index = 1 config_file = gen_gw.cfg gw_vm = 2 dest_vm = 3 @@ -38,13 +39,15 @@ group1cores = [1] group2cores = [3] group3cores = [1,3] -[VM2] +[TestM2] name = ImpairGW +machine_index = 2 config_file = impair.cfg group1cores = [1] -[VM3] +[TestM3] name = Swap +machine_index = 3 config_file = swap.cfg group1cores = [1] diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.test index a732dc8e..3ad014d5 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.test +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/irq.test @@ -17,7 +17,7 @@ [DEFAULT] name = BasicSwapTesting number_of_tests = 2 -total_number_of_vms = 2 +total_number_of_test_machines = 2 init_code= not_used dest_vm = not_used gw_vm = not_used @@ -28,18 +28,21 @@ group3cores = not_used drop_rate_treshold = 1 accuracy = 0.01 -[VM1] +[TestM1] name = InterruptTesting +machine_index = 1 config_file = irq.cfg group1cores = [1,2,3] -[VM2] +[TestM2] name = InterruptTesting +machine_index = 2 config_file = irq.cfg group1cores = [1,2,3] -[VM3] +[TestM3] name = InterruptTesting +machine_index = 3 config_file = irq.cfg group1cores = [1,2,3] diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2gen.cfg b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2gen.cfg index 1347c3b2..9e7bf90e 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2gen.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2gen.cfg @@ -59,7 +59,6 @@ signature pos=56 name=lat task=0 mode=lat -sub mode=l3 rx port=p0 lat pos=42 accuracy pos=46 diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2zeroloss.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2zeroloss.test index d7cf1321..1ea7f0a2 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2zeroloss.test +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/l2zeroloss.test @@ -17,7 +17,7 @@ [DEFAULT] name = L2BasicSwapTesting number_of_tests = 3 -total_number_of_vms = 2 +total_number_of_test_machines = 2 init_code=init_test() dest_vm = not_used gw_vm = not_used @@ -26,10 +26,11 @@ group1cores = not_used group2cores = not_used group3cores = not_used drop_rate_treshold = 0 -accuracy = 0.01 +accuracy = 0.1 -[VM1] +[TestM1] name = Generator +machine_index = 1 config_file = l2gen.cfg dest_vm = 2 script_control = true @@ -37,8 +38,9 @@ group1cores = [1] group2cores = [3] group3cores = [1,3] -[VM2] +[TestM2] name = Swap +machine_index = 2 config_file = l2swap.cfg group1cores = [1] diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml deleted file mode 100644 index 86efa892..00000000 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/rapid.yaml +++ /dev/null @@ -1,191 +0,0 @@ -## -## 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 - internal_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 - vm1_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - vm2_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - vm3_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - -resources: - vm1_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm1_dataplane_port: - type: OS::Neutron::Port - properties: - network: {get_param: dataplane_network} - security_groups: - - default - vm1_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm1_admin_port} - vm1: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm1_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: vm1_admin_port} - - port: {get_resource: vm1_dataplane_port} - vm2_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm2_dataplane_port: - type: OS::Neutron::Port - properties: - network: {get_param: dataplane_network} - security_groups: - - default - vm2_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm2_admin_port} - vm2: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm2_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: vm2_admin_port} - - port: {get_resource: vm2_dataplane_port} -# vm3_admin_port: -# type: OS::Neutron::Port -# properties: -# network: {get_param: internal_network} -# security_groups: -# - default -# vm3_dataplane_port: -# type: OS::Neutron::Port -# properties: -# network: {get_param: dataplane_network} -# security_groups: -# - default -# vm3_floating_ip: -# type: OS::Neutron::FloatingIP -# properties: -# floating_network: {get_param: floating_network} -# port_id: {get_resource: vm3_admin_port} -# vm3: -# type: OS::Nova::Server -# properties: -# availability_zone: { get_param: vm3_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: vm3_admin_port} -# - port: {get_resource: vm3_dataplane_port} - -outputs: - total_number_of_VMs: - description: Number of VMs created by this stack - value: 2 - vm1_private_ip: - 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 - value: { get_attr: [ vm1_floating_ip, floating_ip_address ] } - vm1_dataplane_ip: - description: IP address of VM1 dataplane port - value: { get_attr: [vm1_dataplane_port, fixed_ips, 0, ip_address] } - vm1_dataplane_mac: - description: The MAC address of VM1 dataplane port - value: { get_attr: [vm1_dataplane_port, mac_address] } - vm2_private_ip: - description: IP address of the VM2 admin port - value: { get_attr: [vm2_admin_port, fixed_ips, 0, ip_address] } - vm2_public_ip: - description: Floating IP address of VM2 in public network - value: { get_attr: [ vm2_floating_ip, floating_ip_address ] } - vm2_dataplane_ip: - description: IP address of VM2 dataplane port - value: { get_attr: [vm2_dataplane_port, fixed_ips, 0, ip_address] } - vm2_dataplane_mac: - description: The MAC address of VM2 dataplane port - value: { get_attr: [vm2_dataplane_port, mac_address] } -# vm3_private_ip: -# description: IP address of the VM3 admin port -# value: { get_attr: [vm3_admin_port, fixed_ips, 0, ip_address] } -# vm3_public_ip: -# 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 -# value: { get_attr: [vm3_dataplane_port, fixed_ips, 0, ip_address] } -# vm3_dataplane_mac: -# description: The MAC address of VM3 dataplane port -# value: { get_attr: [vm3_dataplane_port, mac_address] } diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py index fca7a573..0f523cc0 100755 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/runrapid.py @@ -32,7 +32,7 @@ from prox_ctrl import prox_ctrl import ConfigParser import ast -version="18.2.12" +version="18.3.27" env = "rapid" #Default string for environment test = "basicrapid" #Default string for test loglevel="DEBUG" # sets log level for writing to file @@ -271,7 +271,7 @@ def run_speedtest(gensock,sutsock): # 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,lat_max, abs_dropped, abs_tx = run_iteration(gensock,sutsock) drop_rate = 100.0*abs_dropped/abs_tx - if ((get_pps(speed,size) - pps_tx)/pps_tx)<0.001 and ((drop_rate < DROP_RATE_TRESHOLD) or (abs_dropped==DROP_RATE_TRESHOLD ==0)): + if ((get_pps(speed,size) - pps_tx)/get_pps(speed,size))<0.001 and ((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 | '+ '{:>9.0f}'.format(lat_max)+' us | '+ '{:>14d}'.format(abs_dropped)+ ' |''{:>9.2f}'.format(drop_rate)+ '% | SUCCESS |') endspeed = speed endpps_req_tx = pps_req_tx @@ -328,7 +328,7 @@ def run_flowtest(gensock,sutsock): # 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,lat_max, abs_dropped, abs_tx = run_iteration(gensock,sutsock) drop_rate = 100.0*abs_dropped/abs_tx - if ((get_pps(speed,size) - pps_tx)/pps_tx)<0.001 and ((drop_rate < DROP_RATE_TRESHOLD) or (abs_dropped==DROP_RATE_TRESHOLD ==0)): + if ((get_pps(speed,size) - pps_tx)/get_pps(speed,size))<0.001 and ((drop_rate < DROP_RATE_TRESHOLD) or (abs_dropped==DROP_RATE_TRESHOLD ==0)): endspeed = speed endpps_req_tx = pps_req_tx endpps_tx = pps_tx @@ -377,7 +377,7 @@ def run_sizetest(gensock,sutsock): # 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,lat_max, abs_dropped, abs_tx = run_iteration(gensock,sutsock) drop_rate = 100.0*abs_dropped/abs_tx - if ((get_pps(speed,size) - pps_tx)/pps_tx)<0.001 and ((drop_rate < DROP_RATE_TRESHOLD) or (abs_dropped==DROP_RATE_TRESHOLD ==0)): + if ((get_pps(speed,size) - pps_tx)/get_pps(speed,size))<0.001 and ((drop_rate < DROP_RATE_TRESHOLD) or (abs_dropped==DROP_RATE_TRESHOLD ==0)): endspeed = speed endpps_req_tx = pps_req_tx endpps_tx = pps_tx @@ -459,49 +459,52 @@ script_control =[] testconfig = ConfigParser.RawConfigParser() testconfig.read(test+'.test') -required_number_of_VMs = testconfig.get('DEFAULT', 'total_number_of_vms') +required_number_of_test_machines = testconfig.get('DEFAULT', 'total_number_of_test_machines') DROP_RATE_TRESHOLD = float(testconfig.get('DEFAULT', 'drop_rate_treshold')) ACCURACY = float(testconfig.get('DEFAULT', 'accuracy')) config = ConfigParser.RawConfigParser() 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): - log.exception("Not enough VMs for this test: %s needed and only %s available" % (required_number_of_VMs,total_number_of_VMs)) - raise Exception("Not enough VMs for this test: %s needed and only %s available" % (required_number_of_VMs,total_number_of_VMs)) -for vm in range(1, int(total_number_of_VMs)+1): - vmAdminIP.append(config.get('VM%d'%vm, 'admin_ip')) - vmDPmac.append(config.get('VM%d'%vm, 'dp_mac')) - vmDPIP.append(config.get('VM%d'%vm, 'dp_ip')) +total_number_of_machines = config.get('rapid', 'total_number_of_machines') +if int(required_number_of_test_machines) > int(total_number_of_machines): + log.exception("Not enough VMs for this test: %s needed and only %s available" % (required_number_of_test_machines,total_number_of_machines)) + raise Exception("Not enough VMs for this test: %s needed and only %s available" % (required_number_of_test_machines,total_number_of_machines)) +for vm in range(1, int(total_number_of_machines)+1): + vmAdminIP.append(config.get('M%d'%vm, 'admin_ip')) + vmDPmac.append(config.get('M%d'%vm, 'dp_mac')) + vmDPIP.append(config.get('M%d'%vm, 'dp_ip')) ip = vmDPIP[-1].split('.') hexDPIP.append(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)) -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') +machine_index = [] +for vm in range(1, int(required_number_of_test_machines)+1): + machine_index.append(int(testconfig.get('TestM%d'%vm, 'machine_index'))-1) +for vm in range(1, int(required_number_of_test_machines)+1): + config_file.append(testconfig.get('TestM%d'%vm, 'config_file')) + script_control.append(testconfig.get('TestM%d'%vm, 'script_control')) + group1cores=testconfig.get('TestM%d'%vm, 'group1cores') if group1cores <> 'not_used': group1cores=ast.literal_eval(group1cores) - group2cores=testconfig.get('VM%d'%vm, 'group2cores') + group2cores=testconfig.get('TestM%d'%vm, 'group2cores') if group2cores <> 'not_used': group2cores=ast.literal_eval(group2cores) - group3cores=testconfig.get('VM%d'%vm, 'group3cores') + group3cores=testconfig.get('TestM%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]) - f.write('local_hex_ip="%s"\n'% hexDPIP[vm-1]) - gwVM = testconfig.get('VM%d'%vm, 'gw_vm') + f.write('name="%s"\n'% testconfig.get('TestM%d'%vm, 'name')) + f.write('local_ip="%s"\n'% vmDPIP[machine_index[vm-1]]) + f.write('local_hex_ip="%s"\n'% hexDPIP[machine_index[vm-1]]) + gwVM = testconfig.get('TestM%d'%vm, 'gw_vm') if gwVM <> 'not_used': gwVMindex = int(gwVM)-1 - f.write('gw_ip="%s"\n'% vmDPIP[gwVMindex]) - f.write('gw_hex_ip="%s"\n'% hexDPIP[gwVMindex]) - destVM = testconfig.get('VM%d'%vm, 'dest_vm') + f.write('gw_ip="%s"\n'% vmDPIP[machine_index[gwVMindex]]) + f.write('gw_hex_ip="%s"\n'% hexDPIP[machine_index[gwVMindex]]) + destVM = testconfig.get('TestM%d'%vm, 'dest_vm') if destVM <> 'not_used': 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(':',' ')) + f.write('dest_ip="%s"\n'% vmDPIP[machine_index[destVMindex]]) + f.write('dest_hex_ip="%s"\n'% hexDPIP[machine_index[destVMindex]]) + f.write('dest_hex_mac="%s"\n'% vmDPmac[machine_index[destVMindex]].replace(':',' ')) if group1cores <> 'not_used': f.write('group1="%s"\n'% ','.join(map(str, group1cores))) if group2cores <> 'not_used': @@ -527,13 +530,13 @@ for vm in range(1, int(required_number_of_VMs)+1): client =[] sock =[] -for vm in range(0, int(required_number_of_VMs)): - client.append(prox_ctrl(vmAdminIP[vm], key+'.pem','root')) +for vm in range(0, int(required_number_of_test_machines)): + client.append(prox_ctrl(vmAdminIP[machine_index[vm]], key+'.pem','root')) connect_client(client[-1]) # Creating script to bind the right network interface to the poll mode driver devbindfile = "devbindvm%d.sh"%(vm+1) with open("devbind.sh") as f: - newText=f.read().replace('MACADDRESS', vmDPmac[vm]) + newText=f.read().replace('MACADDRESS', vmDPmac[machine_index[vm]]) with open(devbindfile, "w") as f: f.write(newText) st = os.stat(devbindfile) @@ -550,7 +553,7 @@ for vm in range(0, int(required_number_of_VMs)): else: cmd = '/root/prox/build/prox -t -o cli -f /root/%s'%config_file[vm] if configonly == False: - client[-1].fork_cmd(cmd, 'PROX Testing on VM%d'%(vm+1)) + client[-1].fork_cmd(cmd, 'PROX Testing on TestM%d'%(vm+1)) sock.append(connect_socket(client[-1])) if configonly: sys.exit() @@ -566,6 +569,6 @@ for vm in range(1, int(number_of_tests)+1): cmd=testconfig.get('test%d'%vm,'cmd') eval(cmd) #################################################### -for vm in range(0, int(required_number_of_VMs)): +for vm in range(0, int(required_number_of_test_machines)): sock[vm].quit() client[vm].close() diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw.test b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw.test index fed1e375..1ac171a6 100644 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw.test +++ b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/secgw.test @@ -16,8 +16,8 @@ [DEFAULT] name = GWTesting -number_of_tests = 2 -total_number_of_vms = 3 +number_of_tests = 1 +total_number_of_test_machines = 3 init_code=init_test() dest_vm = not_used gw_vm = not_used @@ -28,8 +28,9 @@ group3cores = not_used drop_rate_treshold = 0.01 accuracy = 0.01 -[VM1] +[TestM1] name = Generator +machine_index = 1 config_file = gen_gw.cfg dest_vm = 3 gw_vm = 2 @@ -38,14 +39,16 @@ group1cores = [1] group2cores = [3] group3cores = [1,3] -[VM2] +[TestM2] name = GW1 +machine_index = 2 config_file = secgw1.cfg dest_vm = 3 group1cores = [1] -[VM3] +[TestM3] name = GW2 +machine_index = 3 config_file = secgw2.cfg group1cores = [1] diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml deleted file mode 100644 index 36d7544b..00000000 --- a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/sriovrapid.yaml +++ /dev/null @@ -1,185 +0,0 @@ -## -## 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 - internal_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 - vm1_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova - vm2_availability_zone: - type: string - description: The Availability Zone to launch the instance. - default: nova -# vm3_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 - default: Port1 - vm2_sriov_port: - type: string - description: The sriov port to be used by VM2 - default: Port2 -# vm3_sriov_port: -# type: string -# description: The sriov port to be used by VM3 -# default: Port3 - -resources: - vm1_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm1_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm1_admin_port} - vm1: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm1_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: vm1_admin_port} - - port: {get_param: vm1_sriov_port} - vm2_admin_port: - type: OS::Neutron::Port - properties: - network: {get_param: internal_network} - security_groups: - - default - vm2_floating_ip: - type: OS::Neutron::FloatingIP - properties: - floating_network: {get_param: floating_network} - port_id: {get_resource: vm2_admin_port} - vm2: - type: OS::Nova::Server - properties: - availability_zone: { get_param: vm2_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: vm2_admin_port} - - port: {get_param: vm2_sriov_port} -# vm3_admin_port: -# type: OS::Neutron::Port -# properties: -# network: {get_param: internal_network} -# security_groups: -# - default -# vm3_floating_ip: -# type: OS::Neutron::FloatingIP -# properties: -# floating_network: {get_param: floating_network} -# port_id: {get_resource: vm3_admin_port} -# vm3: -# type: OS::Nova::Server -# properties: -# availability_zone: { get_param: vm3_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: vm3_admin_port} -# - port: {get_param: vm3_sriov_port} - -outputs: - total_number_of_VMs: - description: Number of VMs created by this stack - value: 2 - vm1_private_ip: - 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 - value: { get_attr: [ vm1_floating_ip, floating_ip_address ] } - vm1_dataplane_ip: - description: IP address of VM1 dataplane port - value: { get_attr: [vm1, networks,{get_param: dataplane_network},0] } - vm1_dataplane_mac: - description: The MAC address of VM1 dataplane port - value: { get_attr: [vm1, addresses, {get_param: dataplane_network}] } - vm2_private_ip: - description: IP address of VM2 admin port - value: { get_attr: [vm2_admin_port, fixed_ips, 0, ip_address] } - vm2_public_ip: - description: Floating IP address of VM2 in public network - value: { get_attr: [ vm2_floating_ip, floating_ip_address ] } - vm2_dataplane_ip: - description: IP address of VM2 dataplane port - value: { get_attr: [vm2, networks,{get_param: dataplane_network},0] } - vm2_dataplane_mac: - description: The MAC address of VM2 dataplane port - value: { get_attr: [vm2, addresses, {get_param: dataplane_network}]} -# vm3_private_ip: -# 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 VM3 in public network -# value: { get_attr: [ vm3_floating_ip, floating_ip_address ] } -# vm3_dataplane_ip: -# description: IP address of VM3 dataplane port -# value: { get_attr: [vm3, networks,{get_param: dataplane_network},0] } -# vm3_dataplane_mac: -# description: The MAC address of VM3 dataplane port -# value: { get_attr: [vm3, addresses, {get_param: dataplane_network}]} |