From d2963627c31938740cd8d398abd139f5679405b5 Mon Sep 17 00:00:00 2001 From: kasar Date: Fri, 31 Mar 2017 05:53:17 -0700 Subject: [PATCH] Added code for ip_address parameter Change-Id: I937f39c8be154fd57b000c4f24ff8e8cd4ecb034 Signed-off-by: kasar --- vimconn_vmware.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/vimconn_vmware.py b/vimconn_vmware.py index 10111c1f..384da623 100644 --- a/vimconn_vmware.py +++ b/vimconn_vmware.py @@ -3640,9 +3640,19 @@ class vimconnector(vimconn.vimconnector): raise vimconn.vimconnConnectionException("Failed to connect vCloud director") try: + ip_address = None floating_ip = False if 'floating_ip' in net: floating_ip = net['floating_ip'] - allocation_mode = "POOL" if floating_ip else "DHCP" + + # Stub for ip_address feature + if 'ip_address' in net: ip_address = net['ip_address'] + + if floating_ip: + allocation_mode = "POOL" + elif ip_address: + allocation_mode = "MANUAL" + else: + allocation_mode = "DHCP" if not nic_type: for vms in vapp._get_vms(): @@ -3671,6 +3681,10 @@ class vimconnector(vimconn.vimconnector): {} """.format(primary_nic_index, network_name, nicIndex, allocation_mode) + # Stub for ip_address feature + if ip_address: + ip_tag = '{}'.format(ip_address) + item = item.replace('\n','\n{}\n'.format(ip_tag)) data = data.replace('\n','\n{}\n'.format(item)) else: @@ -3680,6 +3694,10 @@ class vimconnector(vimconn.vimconnector): {} """.format(network_name, nicIndex, allocation_mode) + # Stub for ip_address feature + if ip_address: + ip_tag = '{}'.format(ip_address) + new_item = new_item.replace('\n','\n{}\n'.format(ip_tag)) data = data.replace('\n','\n{}\n'.format(new_item)) @@ -3731,6 +3749,10 @@ class vimconnector(vimconn.vimconnector): {} """.format(primary_nic_index, network_name, nicIndex, allocation_mode, nic_type) + # Stub for ip_address feature + if ip_address: + ip_tag = '{}'.format(ip_address) + item = item.replace('\n','\n{}\n'.format(ip_tag)) data = data.replace('\n','\n{}\n'.format(item)) else: @@ -3741,6 +3763,10 @@ class vimconnector(vimconn.vimconnector): {} """.format(network_name, nicIndex, allocation_mode, nic_type) + # Stub for ip_address feature + if ip_address: + ip_tag = '{}'.format(ip_address) + new_item = new_item.replace('\n','\n{}\n'.format(ip_tag)) data = data.replace('\n','\n{}\n'.format(new_item)) -- 2.25.1