summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py
diff options
context:
space:
mode:
authorLuc Provoost <luc.provoost@intel.com>2019-04-12 11:20:58 +0200
committerLuc Provoost <luc.provoost@intel.com>2019-04-12 11:20:58 +0200
commitd4216dd28019256fd6363ed4269d540ef64ec23c (patch)
tree60f2fbae8433616b972c804e6dc9525e0757bd07 /VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py
parentaf95b812c39e7fa039b7041b6cb8aba0c5e88c02 (diff)
Improved image building & new PROX
Bug fixes for the script for building an image via the packer tool. This also installs a newer version of PROX with some bug fixes in PROX. The *.test files have been simplified. Also introduced a new file MachineMap.cfg to map test machines on actual VMs. Change-Id: I69445327ef0a907bc8c1566aaa60c733418c541e 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.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py b/VNFs/DPPD-PROX/helper-scripts/openstackrapid/createrapid.py
index 06e2f232..a1c1de60 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="19.1.10"
+version="19.4.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
@@ -56,7 +56,7 @@ def usage():
print(" [--subnet DP_SUBNET]")
print(" [--subnet_cidr SUBNET_CIDR]")
print(" [--internal_network ADMIN_NETWORK]")
- print(" [--floating_network ADMIN_NETWORK]")
+ print(" [--floating_network FLOATING_NETWORK]")
print(" [--log DEBUG|INFO|WARNING|ERROR|CRITICAL]")
print(" [-h] [--help]")
print("")
@@ -363,21 +363,23 @@ for vm in range(1, int(total_number_of_VMs)+1):
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'%(ServerName[vm],vmAdminIP)
- log.debug(cmd)
- output = subprocess.check_output(cmd , shell=True).strip()
+ log.info('Creating & Associating floating IP for ('+ServerName[vm]+')...')
+ cmd = 'openstack server show %s -c addresses -f value |grep -Eo "%s=[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" | cut -d"=" -f2'%(ServerName[vm],internal_network)
+ log.debug(cmd)
+ vmportIP = subprocess.check_output(cmd , shell=True).strip()
+ cmd = 'openstack port list -c ID -c "Fixed IP Addresses" | grep %s' %(vmportIP)
+ cmd = cmd + ' | cut -d" " -f 2 '
+ log.debug(cmd)
+ vmportID = subprocess.check_output(cmd , shell=True).strip()
+ cmd = 'openstack floating ip create --port %s %s'%(vmportID,floating_network)
+ log.debug(cmd)
+ output = subprocess.check_output(cmd , shell=True).strip()
for vm in range(1, int(total_number_of_VMs)+1):
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)
+ 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)