summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py
diff options
context:
space:
mode:
authorLuc Provoost <luc.provoost@intel.com>2018-06-15 22:39:28 +0200
committerDeepak S <deepak.s@linux.intel.com>2018-06-29 17:48:09 +0530
commit260bc7b07eb34db5d46abaa4e84ab26c82a0b665 (patch)
treedb3edb6f69c9c87a8c4b1bc31f33bde5372299fc /VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py
parentbc032eefb98358a4741caf732c475258ebbd5850 (diff)
Adding centos.json to be used with packer to generate a VM with PROX
Based on a CentOS cloud image downloadable from the web, you can now use packer to create an image that has DPDK and PROX installed in the proper directories. The VM is also tuned for guest VNFs. A service is also created to deal with the proper isolated_cpu settings for tuned. The service will also make sure uio and igb_uio are loaded. The prox_user_data.sh is not needed any more and hence deleted. ctrl-c of runrapid.py will now also stop prox in all the VMs so a new test can be started. Change-Id: I16cc59878e2d4912757f42e05f98d51dff5feb89 Signed-off-by: Luc Provoost <luc.provoost@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py')
-rwxr-xr-xVNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py
index ffba5013..f21b91d7 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="18.3.27"
+version="18.6.15"
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
@@ -296,7 +296,8 @@ else:
log.exception("Failed to create subnet: " + subnet)
raise Exception("Failed to create subnet: " + subnet)
-
+ServerToBeCreated=[]
+ServerName=[]
config = ConfigParser.RawConfigParser()
vmconfig = ConfigParser.RawConfigParser()
vmconfig.read(vms+'.vms')
@@ -306,16 +307,18 @@ for vm in range(1, int(total_number_of_VMs)+1):
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)
+ ServerName.append('%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("Checking server: "+ServerName[-1])
+ cmd = 'openstack server show '+ServerName[-1]
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")
+ if ServerExist == ServerName[-1]:
+ log.info("Server ("+ServerName[-1]+") already active")
+ ServerToBeCreated.append("no")
else:
+ ServerToBeCreated.append("yes")
# Checking if the flavor already exists, if not create it
log.debug("Checking flavor: "+flavor_name)
cmd = 'openstack flavor show '+flavor_name
@@ -353,24 +356,25 @@ for vm in range(1, int(total_number_of_VMs)+1):
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)
+ cmd = 'openstack server create --flavor %s --key-name %s --image %s %s %s%s%s'%(flavor_name,key,image,nic_info,boot_info,wait,ServerName[-1])
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':
+if floating_network <> 'NO':
+ for vm in range(0, int(total_number_of_VMs)):
+ if ServerToBeCreated[vm] =="yes":
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)
+ cmd = 'openstack server add floating ip %s %s'%(ServerName[vm],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)
+ cmd = 'openstack server show %s'%(ServerName[vm-1])
log.debug(cmd)
output = subprocess.check_output(cmd , shell=True).strip()
searchString = '.*%s.*?([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)' %(dataplane_network)
@@ -381,15 +385,15 @@ for vm in range(1, int(total_number_of_VMs)+1):
vmAdminIP = matchObj.group(2)
if vmAdminIP == None:
vmAdminIP = matchObj.group(1)
- cmd = 'openstack port list |grep %s | tr -s " " | cut -d"|" -f 4'%(vmDPIP)
+ cmd = 'openstack port list |egrep "\\b%s\\b" | 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, 'name', ServerName[vm-1])
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))
+ log.info('%s: (admin IP: %s), (dataplane IP: %s), (dataplane MAC: %s)' % (ServerName[vm-1],vmAdminIP,vmDPIP,vmDPmac))
config.add_section('OpenStack')
config.set('OpenStack', 'stack', stack)