import subprocess
import tempfile
import traceback
-import itertools
import requests
import ssl
import atexit
'ERROR': 'ERROR', 'DELETED': 'DELETED'
}
+
class vimconnector(vimconn.vimconnector):
# dict used to store flavor in memory
flavorlist = {}
try:
host = self.url
org = 'System'
- client_as_admin = Client(host, verify_ssl_certs=False)
- client_as_admin.set_highest_supported_version()
+ client_as_admin = Client(host, verify_ssl_certs=False, api_version=API_VERSION)
client_as_admin.set_credentials(BasicLoginCredentials(self.admin_user, org, self.admin_password))
except Exception as e:
raise vimconn.vimconnException(
- "Can't connect to a vCloud director as: {} with exception {}".format(self.admin_user, e))
+ "Can't connect to vCloud director as: {} with exception {}".format(self.admin_user, e))
return client_as_admin
"""
try:
self.logger.debug("Logging into vCD {} as {} to datacenter {}.".format(self.org_name,
- self.user,
- self.org_name))
+ self.user,
+ self.org_name))
host = self.url
- client = Client(host, verify_ssl_certs=False)
- client.set_highest_supported_version()
+ client = Client(host, verify_ssl_certs=False, api_version=API_VERSION)
client.set_credentials(BasicLoginCredentials(self.user, self.org_name, self.passwd))
- except:
- raise vimconn.vimconnConnectionException("Can't connect to a vCloud director org: "
- "{} as user: {}".format(self.org_name, self.user))
+ except Exception as e:
+ raise vimconn.vimconnConnectionException("Can't connect to vCloud director org: "
+ "{} as user {} with exception: {}".format(self.org_name,
+ self.user,
+ e))
return client
else:
raise vimconn.vimconnException("Tenant id indicated but not present in vcloud director")
self.logger.debug("Setting organization uuid {}".format(self.org_uuid))
- except:
- self.logger.debug("Failed initialize organization UUID for org {}".format(self.org_name))
+ except Exception as e:
+ self.logger.debug("Failed initialize organization UUID for org {}: {}".format(self.org_name), e)
self.logger.debug(traceback.format_exc())
self.org_uuid = None
response.status_code))
raise vimconn.vimconnNotFoundException("Fail to get tenant {}".format(tenant_id))
- lxmlroot_respond = lxmlElementTree.fromstring(response.content)
+ lxmlroot_respond = lxmlElementTree.fromstring(response.text)
namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
namespaces["xmlns"]= "http://www.vmware.com/vcloud/v1.5"
vdc_remove_href = lxmlroot_respond.find("xmlns:Link[@rel='remove']",namespaces).attrib['href']
# network_uuid = self.create_dvPort_group(net_name)
parent_network_uuid = None
- import traceback
- traceback.print_stack()
-
if provider_network_profile is not None:
for k, v in provider_network_profile.items():
if k == 'physical_network':
self.logger.error("Failed to get vdc content")
raise vimconn.vimconnNotFoundException("Failed to get vdc content")
else:
- content = XmlElementTree.fromstring(response.content)
+ content = XmlElementTree.fromstring(response.text)
network_list = []
try:
self.logger.error("Failed to get network content")
raise vimconn.vimconnNotFoundException("Failed to get network content")
else:
- net_details = XmlElementTree.fromstring(response.content)
+ net_details = XmlElementTree.fromstring(response.text)
filter_dict = {}
net_uuid = net_details.get('id').split(":")
self.logger.error("Failed to get vdc content")
raise vimconn.vimconnNotFoundException("Failed to get vdc content")
else:
- content = XmlElementTree.fromstring(response.content)
+ content = XmlElementTree.fromstring(response.text)
network_list = []
for item in content:
self.logger.error("Failed to get network content")
raise vimconn.vimconnNotFoundException("Failed to get network content")
else:
- net_details = XmlElementTree.fromstring(response.content)
+ net_details = XmlElementTree.fromstring(response.text)
filter_entry = {}
net_uuid = net_details.get('id').split(":")
self.logger.error("Failed to get vdc content")
raise vimconn.vimconnNotFoundException("Failed to get vdc content")
else:
- content = XmlElementTree.fromstring(response.content)
+ content = XmlElementTree.fromstring(response.text)
filter_dict = {}
self.logger.error("Failed to get network content")
raise vimconn.vimconnNotFoundException("Failed to get network content")
else:
- net_details = XmlElementTree.fromstring(response.content)
+ net_details = XmlElementTree.fromstring(response.text)
vdc_network_id = net_details.get('id').split(":")
if len(vdc_network_id) == 4 and vdc_network_id[3] == net_id:
response.status_code))
raise vimconn.vimconnNotFoundException("Fail to get image {}".format(image_id))
- lxmlroot_respond = lxmlElementTree.fromstring(response.content)
+ lxmlroot_respond = lxmlElementTree.fromstring(response.text)
namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
namespaces["xmlns"]= "http://www.vmware.com/vcloud/v1.5"
catalogItem,
image_id))
- lxmlroot_respond = lxmlElementTree.fromstring(response.content)
+ lxmlroot_respond = lxmlElementTree.fromstring(response.text)
namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
namespaces["xmlns"]= "http://www.vmware.com/vcloud/v1.5"
catalogitem_remove_href = lxmlroot_respond.find("xmlns:Link[@rel='remove']",namespaces).attrib['href']
data=data)
if response.status_code == requests.codes.created:
- catalogItem = XmlElementTree.fromstring(response.content)
+ catalogItem = XmlElementTree.fromstring(response.text)
entity = [child for child in catalogItem if
child.get("type") == "application/vnd.vmware.vcloud.vAppTemplate+xml"][0]
href = entity.get('href')
if response.status_code == requests.codes.ok:
headers['Content-Type'] = 'Content-Type text/xml'
- result = re.search('rel="upload:default"\shref="(.*?\/descriptor.ovf)"',response.content)
+ result = re.search('rel="upload:default"\shref="(.*?\/descriptor.ovf)"', response.text)
if result:
transfer_href = result.group(1)
headers=headers)
if response.status_code == requests.codes.ok:
- result = re.search('rel="upload:default"\s*href="(.*?vmdk)"',response.content)
+ result = re.search('rel="upload:default"\s*href="(.*?vmdk)"', response.text)
if result:
link_href = result.group(1)
# we skip ovf since it already uploaded.
else:
self.logger.debug(
'file upload failed with error: [{}] {}'.format(response.status_code,
- response.content))
+ response.text))
f.close()
return False
raise vimconn.vimconnException("Wrong container. vCloud director supports only OVF.")
catalog_name = os.path.splitext(filename)[0]
- catalog_md5_name = hashlib.md5(path).hexdigest()
+ catalog_md5_name = hashlib.md5(path.encode('utf-8')).hexdigest()
self.logger.debug("File name {} Catalog Name {} file path {} "
"vdc catalog name {}".format(filename, catalog_name, path, catalog_md5_name))
if response.status_code == 403:
response = self.retry_rest('GET', vapp_call)
- tree = XmlElementTree.fromstring(response.content)
- return tree.attrib['name']
+ tree = XmlElementTree.fromstring(response.text)
+ return tree.attrib['name'] if 'name' in tree.attrib else None
except Exception as e:
self.logger.exception(e)
return None
# client must provide at least one entry in net_list if not we report error
#If net type is mgmt, then configure it as primary net & use its NIC index as primary NIC
- #If no mgmt, then the 1st NN in netlist is considered as primary net.
+ # If no mgmt, then the 1st NN in netlist is considered as primary net.
primary_net = None
primary_netname = None
primary_net_href = None
try:
primary_net_id = primary_net['net_id']
url_list = [self.url, '/api/network/', primary_net_id]
- primary_net_href = ''.join(url_list)
+ primary_net_href = ''.join(url_list)
network_dict = self.get_vcd_network(network_uuid=primary_net_id)
if 'name' in network_dict:
primary_netname = network_dict['name']
if not vdc_obj:
raise vimconn.vimconnNotFoundException("new_vminstance(): Failed to get VDC object")
- for retry in (1,2):
+ for retry in (1, 2):
items = org.get_catalog_item(catalog_hash_name, catalog_hash_name)
catalog_items = [items.attrib]
response = self.perform_request(req_type='GET',
url=catalog_items[0].get('href'),
headers=headers)
- catalogItem = XmlElementTree.fromstring(response.content)
+ catalogItem = XmlElementTree.fromstring(response.text)
entity = [child for child in catalogItem if child.get("type") == "application/vnd.vmware.vcloud.vAppTemplate+xml"][0]
vapp_tempalte_href = entity.get("href")
self.logger.debug("REST API call {} failed. Return status code {}".format(vapp_tempalte_href,
response.status_code))
else:
- result = (response.content).replace("\n"," ")
+ result = (response.text).replace("\n", " ")
- vapp_template_tree = XmlElementTree.fromstring(response.content)
+ vapp_template_tree = XmlElementTree.fromstring(response.text)
children_element = [child for child in vapp_template_tree if 'Children' in child.tag][0]
vm_element = [child for child in children_element if 'Vm' in child.tag][0]
vm_name = vm_element.get('name')
vdc_id = vdc.get('id').split(':')[-1]
instantiate_vapp_href = "{}/api/vdc/{}/action/instantiateVAppTemplate".format(self.url,
vdc_id)
- data = """<?xml version="1.0" encoding="UTF-8"?>
- <InstantiateVAppTemplateParams
- xmlns="http://www.vmware.com/vcloud/v1.5"
- name="{}"
- deploy="false"
- powerOn="false"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
- <Description>Vapp instantiation</Description>
- <InstantiationParams>
- <NetworkConfigSection>
- <ovf:Info>Configuration parameters for logical networks</ovf:Info>
- <NetworkConfig networkName="{}">
- <Configuration>
- <ParentNetwork href="{}" />
- <FenceMode>bridged</FenceMode>
- </Configuration>
- </NetworkConfig>
- </NetworkConfigSection>
- <LeaseSettingsSection
- type="application/vnd.vmware.vcloud.leaseSettingsSection+xml">
- <ovf:Info>Lease Settings</ovf:Info>
- <StorageLeaseInSeconds>172800</StorageLeaseInSeconds>
- <StorageLeaseExpiration>2014-04-25T08:08:16.438-07:00</StorageLeaseExpiration>
- </LeaseSettingsSection>
- </InstantiationParams>
- <Source href="{}"/>
- <SourcedItem>
- <Source href="{}" id="{}" name="{}"
- type="application/vnd.vmware.vcloud.vm+xml"/>
- <VmGeneralParams>
- <NeedsCustomization>false</NeedsCustomization>
- </VmGeneralParams>
- <InstantiationParams>
- <NetworkConnectionSection>
- <ovf:Info>Specifies the available VM network connections</ovf:Info>
- <NetworkConnection network="{}">
- <NetworkConnectionIndex>0</NetworkConnectionIndex>
- <IsConnected>true</IsConnected>
- <IpAddressAllocationMode>DHCP</IpAddressAllocationMode>
- </NetworkConnection>
- </NetworkConnectionSection><ovf:VirtualHardwareSection>
- <ovf:Info>Virtual hardware requirements</ovf:Info>
- <ovf:Item xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
- xmlns:vmw="http://www.vmware.com/schema/ovf">
- <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
- <rasd:Description>Number of Virtual CPUs</rasd:Description>
- <rasd:ElementName xmlns:py="http://codespeak.net/lxml/objectify/pytype" py:pytype="str">{cpu} virtual CPU(s)</rasd:ElementName>
- <rasd:InstanceID>4</rasd:InstanceID>
- <rasd:Reservation>0</rasd:Reservation>
- <rasd:ResourceType>3</rasd:ResourceType>
- <rasd:VirtualQuantity xmlns:py="http://codespeak.net/lxml/objectify/pytype" py:pytype="int">{cpu}</rasd:VirtualQuantity>
- <rasd:Weight>0</rasd:Weight>
- <vmw:CoresPerSocket ovf:required="false">{core}</vmw:CoresPerSocket>
- </ovf:Item><ovf:Item xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">
- <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
- <rasd:Description>Memory Size</rasd:Description>
- <rasd:ElementName xmlns:py="http://codespeak.net/lxml/objectify/pytype" py:pytype="str">{memory} MB of memory</rasd:ElementName>
- <rasd:InstanceID>5</rasd:InstanceID>
- <rasd:Reservation>0</rasd:Reservation>
- <rasd:ResourceType>4</rasd:ResourceType>
- <rasd:VirtualQuantity xmlns:py="http://codespeak.net/lxml/objectify/pytype" py:pytype="int">{memory}</rasd:VirtualQuantity>
- <rasd:Weight>0</rasd:Weight>
- </ovf:Item>
- </ovf:VirtualHardwareSection>
- </InstantiationParams>
- </SourcedItem>
- <AllEULAsAccepted>false</AllEULAsAccepted>
- </InstantiateVAppTemplateParams>""".format(vmname_andid,
- primary_netname,
- primary_net_href,
- vapp_tempalte_href,
- vm_href,
- vm_id,
- vm_name,
- primary_netname,
- cpu=cpus,
- core=cores,
- memory=memory_mb)
+ with open(os.path.join(os.path.dirname(__file__), 'InstantiateVAppTemplateParams.xml'), 'r') as f:
+ template = f.read()
+
+ data = template.format(vmname_andid,
+ primary_netname,
+ primary_net_href,
+ vapp_tempalte_href,
+ vm_href,
+ vm_id,
+ vm_name,
+ primary_netname,
+ cpu=vm_cpus,
+ core=1,
+ memory=vm_memory)
response = self.perform_request(req_type='POST',
url=instantiate_vapp_href,
if response.status_code != 201:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(instantiate_vapp_href,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("new_vminstance(): Failed to create"\
"vAapp {}".format(vmname_andid))
else:
- vapptask = self.get_task_from_response(response.content)
+ vapptask = self.get_task_from_response(response.text)
if vapptask is None and retry==1:
self.get_token() # Retry getting token
except Exception as exp:
raise vimconn.vimconnUnexpectedResponse(
- "new_vminstance(): Failed to retrieve vApp {} after creation: Exception:{}"
- .format(vmname_andid, exp))
+ "new_vminstance(): Failed to retrieve vApp {} after creation: Exception:{}"
+ .format(vmname_andid, exp))
if vapp_uuid is None:
raise vimconn.vimconnUnexpectedResponse(
- "new_vminstance(): Failed to retrieve vApp {} after creation".format(
- vmname_andid))
+ "new_vminstance(): Failed to retrieve vApp {} after creation".format(vmname_andid))
- #Add PCI passthrough/SRIOV configrations
- vm_obj = None
+ # Add PCI passthrough/SRIOV configrations
pci_devices_info = []
reserve_memory = False
elif (net["type"] == "VF" or net["type"] == "SR-IOV" or net["type"] == "VFnotShared") and 'net_id'in net:
reserve_memory = True
- #Add PCI
+ # Add PCI
if len(pci_devices_info) > 0:
self.logger.info("Need to add PCI devices {} into VM {}".format(pci_devices_info,
- vmname_andid ))
- PCI_devices_status, vm_obj, vcenter_conect = self.add_pci_devices(vapp_uuid,
- pci_devices_info,
- vmname_andid)
- if PCI_devices_status:
- self.logger.info("Added PCI devives {} to VM {}".format(
+ vmname_andid))
+ PCI_devices_status, _, _ = self.add_pci_devices(vapp_uuid,
pci_devices_info,
vmname_andid)
- )
+ if PCI_devices_status:
+ self.logger.info("Added PCI devives {} to VM {}".format(
+ pci_devices_info,
+ vmname_andid))
reserve_memory = True
else:
self.logger.info("Fail to add PCI devives {} to VM {}".format(
- pci_devices_info,
- vmname_andid)
- )
+ pci_devices_info,
+ vmname_andid))
+
+ # Add serial console - this allows cloud images to boot as if we are running under OpenStack
+ self.add_serial_device(vapp_uuid)
- # Modify vm disk
if vm_disk:
- #Assuming there is only one disk in ovf and fast provisioning in organization vDC is disabled
+ # Assuming there is only one disk in ovf and fast provisioning in organization vDC is disabled
result = self.modify_vm_disk(vapp_uuid, vm_disk)
- if result :
+ if result:
self.logger.debug("Modified Disk size of VM {} ".format(vmname_andid))
#Add new or existing disks to vApp
.format(name, exp))
raise vimconn.vimconnException("new_vminstance(): Failed create new vm instance {} with exception {}"
.format(name, exp))
-
# check if vApp deployed and if that the case return vApp UUID otherwise -1
wait_time = 0
vapp_uuid = None
self.logger.error(error_msg)
raise Exception(error_msg)
- catalogItem = XmlElementTree.fromstring(response.content)
+ catalogItem = XmlElementTree.fromstring(response.text)
entity = [child for child in catalogItem if child.get("type") == "application/vnd.vmware.vcloud.media+xml"][0]
entity_href = entity.get('href')
media_upload_href = match.group(1)
else:
raise Exception('Could not parse the upload URL for the media file from the last response')
- upload_iso_task = self.get_task_from_response(response.content)
+ upload_iso_task = self.get_task_from_response(response.text)
headers['Content-Type'] = 'application/octet-stream'
response = self.perform_request(req_type='PUT',
url=media_upload_href,
self.logger.debug ("REST API call {} failed. Return status code {}"\
.format(url, response.status_code))
else:
- xmlroot_response = XmlElementTree.fromstring(response.content)
+ xmlroot_response = XmlElementTree.fromstring(response.text)
for child in xmlroot_response:
if 'ProviderVdcReference' in child.tag:
pvdc_href = child.attrib.get('href')
if response.status_code != 200:
self.logger.error("refresh_vms_status : REST call {} failed reason : {}"\
"status code : {}".format(vm.get('href'),
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("refresh_vms_status : Failed to get "\
"VM details")
- xmlroot = XmlElementTree.fromstring(response.content)
+ xmlroot = XmlElementTree.fromstring(response.text)
-
- result = response.content.replace("\n"," ")
+ result = response.text.replace("\n", " ")
hdd_match = re.search('vcloud:capacity="(\d+)"\svcloud:storageProfileOverrideVmDefault=',result)
if hdd_match:
hdd_mb = hdd_match.group(1)
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("get_vminstance_console : Failed to get "\
"VM Mks ticket details")
- s = re.search("<Host>(.*?)</Host>",response.content)
+ s = re.search("<Host>(.*?)</Host>", response.text)
console_dict['server'] = s.group(1) if s else None
- s1 = re.search("<Port>(\d+)</Port>",response.content)
+ s1 = re.search("<Port>(\d+)</Port>", response.text)
console_dict['port'] = s1.group(1) if s1 else None
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("get_vminstance_console : Failed to get "\
"VM console details")
- s = re.search(">.*?/(vm-\d+.*)</",response.content)
+ s = re.search(">.*?/(vm-\d+.*)</", response.text)
console_dict['suffix'] = s.group(1) if s else None
console_dict['protocol'] = "https"
return None
else:
try:
- vm_list_xmlroot = XmlElementTree.fromstring(response.content)
+ vm_list_xmlroot = XmlElementTree.fromstring(response.text)
for child in vm_list_xmlroot:
if child.tag.split("}")[1] == 'ProviderVdcReference':
add_vdc_rest_url = child.attrib.get('href')
except:
self.logger.debug("Failed parse respond for rest api call {}".format(vm_list_rest_call))
- self.logger.debug("Respond body {}".format(response.content))
+ self.logger.debug("Respond body {}".format(response.text))
return None
# find pvdc provided available network
return None
try:
- vm_list_xmlroot = XmlElementTree.fromstring(response.content)
+ vm_list_xmlroot = XmlElementTree.fromstring(response.text)
for child in vm_list_xmlroot.iter():
if child.tag.split("}")[1] == 'AvailableNetworks':
for networks in child.iter():
response = self.retry_rest('GET', vm_list_rest_call)
if response.status_code == requests.codes.ok:
- return response.content
+ return response.text
return None
response = self.retry_rest('GET', vm_list_rest_call)
if response.status_code == requests.codes.ok:
- return response.content
+ return response.text
return None
def get_org(self, org_uuid=None):
verify=vca.verify,
logger=vca.logger)
if response.status_code == requests.codes.ok:
- return response.content
+ return response.text
return None
response = self.retry_rest('GET', vm_list_rest_call)
if response.status_code == requests.codes.ok:
- return response.content
+ return response.text
return None
return None
else:
try:
- vm_list_xmlroot = XmlElementTree.fromstring(response.content)
+ vm_list_xmlroot = XmlElementTree.fromstring(response.text)
for child in vm_list_xmlroot:
if child.tag.split("}")[1] == 'ProviderVdcReference':
add_vdc_rest_url = child.attrib.get('href')
except:
self.logger.debug("Failed parse respond for rest api call {}".format(vm_list_rest_call))
- self.logger.debug("Respond body {}".format(response.content))
+ self.logger.debug("Respond body {}".format(response.text))
return None
# find pvdc provided available network
if parent_network_uuid is None:
try:
- vm_list_xmlroot = XmlElementTree.fromstring(response.content)
+ vm_list_xmlroot = XmlElementTree.fromstring(response.text)
for child in vm_list_xmlroot.iter():
if child.tag.split("}")[1] == 'AvailableNetworks':
for networks in child.iter():
data=data)
if response.status_code != 201:
- self.logger.debug("Create Network POST REST API call failed. Return status code {}, Response content: {}"
- .format(response.status_code,response.content))
+ self.logger.debug("Create Network POST REST API call failed. Return status code {}, response.text: {}"
+ .format(response.status_code, response.text))
else:
- network_task = self.get_task_from_response(response.content)
+ network_task = self.get_task_from_response(response.text)
self.logger.debug("Create Network REST : Waiting for Network creation complete")
time.sleep(5)
result = self.client.get_task_monitor().wait_for_success(task=network_task)
if result.get('status') == 'success':
- return response.content
+ return response.text
else:
self.logger.debug("create_network_rest task failed. Network Create response : {}"
- .format(response.content))
+ .format(response.text))
except Exception as exp:
self.logger.debug("create_network_rest : Exception : {} ".format(exp))
headers=headers)
if response.status_code == requests.codes.ok:
- return response.content
+ return response.text
return None
def create_vdc(self, vdc_name=None):
# container url to a template
vdc_template_ref = None
try:
- vm_list_xmlroot = XmlElementTree.fromstring(response.content)
+ vm_list_xmlroot = XmlElementTree.fromstring(response.text)
for child in vm_list_xmlroot:
# application/vnd.vmware.admin.providervdc+xml
# we need find a template from witch we instantiate VDC
vdc_template_ref = child.attrib.get('href')
except:
self.logger.debug("Failed parse respond for rest api call {}".format(vm_list_rest_call))
- self.logger.debug("Respond body {}".format(response.content))
+ self.logger.debug("Respond body {}".format(response.text))
return None
# if we didn't found required pre defined template we return None
headers=headers,
data=data)
- vdc_task = self.get_task_from_response(response.content)
+ vdc_task = self.get_task_from_response(response.text)
self.client.get_task_monitor().wait_for_success(task=vdc_task)
# if we all ok we respond with content otherwise by default None
if response.status_code >= 200 and response.status_code < 300:
- return response.content
+ return response.text
return None
except:
self.logger.debug("Failed parse respond for rest api call {}".format(vm_list_rest_call))
- self.logger.debug("Respond body {}".format(response.content))
+ self.logger.debug("Respond body {}".format(response.text))
return None
return None
else:
try:
- vm_list_xmlroot = XmlElementTree.fromstring(response.content)
+ vm_list_xmlroot = XmlElementTree.fromstring(response.text)
for child in vm_list_xmlroot:
# application/vnd.vmware.admin.providervdc+xml
if child.tag.split("}")[1] == 'Link':
add_vdc_rest_url = child.attrib.get('href')
except:
self.logger.debug("Failed parse respond for rest api call {}".format(vm_list_rest_call))
- self.logger.debug("Respond body {}".format(response.content))
+ self.logger.debug("Respond body {}".format(response.text))
return None
response = self.get_provider_rest(vca=vca)
# if we all ok we respond with content otherwise by default None
if response.status_code == 201:
- return response.content
+ return response.text
return None
def get_vapp_details_rest(self, vapp_uuid=None, need_admin_access=False):
return parsed_respond
try:
- xmlroot_respond = XmlElementTree.fromstring(response.content)
+ xmlroot_respond = XmlElementTree.fromstring(response.text)
parsed_respond['ovfDescriptorUploaded'] = xmlroot_respond.attrib['ovfDescriptorUploaded']
namespaces = {"vssd":"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" ,
response = self.retry_rest('POST', console_rest_call)
if response.status_code == requests.codes.ok:
- return response.content
+ return response.text
return None
response.status_code))
return None
try:
- lxmlroot_respond = lxmlElementTree.fromstring(response.content)
+ lxmlroot_respond = lxmlElementTree.fromstring(response.text)
namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
namespaces["xmlns"]= "http://www.vmware.com/vcloud/v1.5"
self.logger.debug("PUT REST API call {} failed. Return status code {}".format(disk_href,
response.status_code))
else:
- modify_disk_task = self.get_task_from_response(response.content)
+ modify_disk_task = self.get_task_from_response(response.text)
result = self.client.get_task_monitor().wait_for_success(task=modify_disk_task)
if result.get('status') == 'success':
return True
return False
return None
- except Exception as exp :
+ except Exception as exp:
self.logger.info("Error occurred calling rest api for modifing disk size {}".format(exp))
return None
- def add_pci_devices(self, vapp_uuid , pci_devices , vmname_andid):
+ def add_serial_device(self, vapp_uuid):
+ """
+ Method to attach a serial device to a VM
+
+ Args:
+ vapp_uuid - uuid of vApp/VM
+
+ Returns:
+ """
+ self.logger.info("Add serial devices into vApp {}".format(vapp_uuid))
+ _, content = self.get_vcenter_content()
+ vm_moref_id = self.get_vm_moref_id(vapp_uuid)
+ if vm_moref_id:
+ try:
+ host_obj, vm_obj = self.get_vm_obj(content, vm_moref_id)
+ self.logger.info("VM {} is currently on host {}".format(vm_obj, host_obj))
+ if host_obj and vm_obj:
+ spec = vim.vm.ConfigSpec()
+ spec.deviceChange = []
+ serial_spec = vim.vm.device.VirtualDeviceSpec()
+ serial_spec.operation = 'add'
+ serial_port = vim.vm.device.VirtualSerialPort()
+ serial_port.yieldOnPoll = True
+ backing = serial_port.URIBackingInfo()
+ backing.serviceURI = 'tcp://:65500'
+ backing.direction = 'server'
+ serial_port.backing = backing
+ serial_spec.device = serial_port
+ spec.deviceChange.append(serial_spec)
+ vm_obj.ReconfigVM_Task(spec=spec)
+
+ self.logger.info("Adding serial device to VM {}".format(vm_obj))
+ except vmodl.MethodFault as error:
+ self.logger.error("Error occurred while adding PCI devices {} ", error)
+
+ def add_pci_devices(self, vapp_uuid, pci_devices, vmname_andid):
"""
Method to attach pci devices to VM
vcenter_conect object
"""
vm_obj = None
- self.logger.info("Add pci devices {} into vApp {}".format(pci_devices , vapp_uuid))
+ self.logger.info("Add pci devices {} into vApp {}".format(pci_devices, vapp_uuid))
vcenter_conect, content = self.get_vcenter_content()
vm_moref_id = self.get_vm_moref_id(vapp_uuid)
if len(avalible_devices) < need_devices:
self.logger.debug("Host {} don't have {} number of active devices".format(host,
need_devices))
- self.logger.debug("found only {} devives {}".format(len(avalible_devices),
+ self.logger.debug("found only {} devices {}".format(len(avalible_devices),
avalible_devices))
return None
else:
required_devices = avalible_devices[:need_devices]
- self.logger.info("Found {} PCI devivces on host {} but required only {}".format(
+ self.logger.info("Found {} PCI devices on host {} but required only {}".format(
len(avalible_devices),
host,
need_devices))
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("reserve_memory_for_all_vms : Failed to get "\
"memory")
- bytexml = bytes(bytearray(response.content, encoding='utf-8'))
+ bytexml = bytes(bytearray(response.text, encoding='utf-8'))
contentelem = lxmlElementTree.XML(bytexml)
namespaces = {prefix:uri for prefix,uri in contentelem.nsmap.items() if prefix}
namespaces["xmlns"]= "http://www.vmware.com/vcloud/v1.5"
if response.status_code != 202:
self.logger.error("REST call {} failed reason : {}"\
"status code : {} ".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("reserve_memory_for_all_vms : Failed to update "\
"virtual hardware memory section")
else:
- mem_task = self.get_task_from_response(response.content)
+ mem_task = self.get_task_from_response(response.text)
result = self.client.get_task_monitor().wait_for_success(task=mem_task)
if result.get('status') == 'success':
self.logger.info("reserve_memory_for_all_vms(): VM {} succeeded "\
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("connect_vapp_to_org_vdc_network : Failed to get "\
"network config section")
- data = response.content
+ data = response.text
headers['Content-Type'] = 'application/vnd.vmware.vcloud.networkConfigSection+xml'
net_id = self.get_network_id_by_name(net_name)
if not net_id:
if response.status_code != 202:
self.logger.error("REST call {} failed reason : {}"\
"status code : {} ".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("connect_vapp_to_org_vdc_network : Failed to update "\
"network config section")
else:
- vapp_task = self.get_task_from_response(response.content)
+ vapp_task = self.get_task_from_response(response.text)
result = self.client.get_task_monitor().wait_for_success(task=vapp_task)
if result.get('status') == 'success':
self.logger.info("connect_vapp_to_org_vdc_network(): Vapp {} connected to "\
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("remove_primary_network_adapter : Failed to get "\
"network connection section")
- data = response.content
+ data = response.text
data = data.split('<Link rel="edit"')[0]
headers['Content-Type'] = 'application/vnd.vmware.vcloud.networkConnectionSection+xml'
if response.status_code != 202:
self.logger.error("REST call {} failed reason : {}"\
"status code : {} ".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("remove_primary_network_adapter : Failed to update "\
"network connection section")
else:
- nic_task = self.get_task_from_response(response.content)
+ nic_task = self.get_task_from_response(response.text)
result = self.client.get_task_monitor().wait_for_success(task=nic_task)
if result.get('status') == 'success':
self.logger.info("remove_primary_network_adapter(): VM {} conneced to "\
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("add_network_adapter_to_vms : Failed to get "\
"network connection section")
- data = response.content
+ data = response.text
data = data.split('<Link rel="edit"')[0]
if '<PrimaryNetworkConnectionIndex>' not in data:
self.logger.debug("add_network_adapter PrimaryNIC not in data")
if response.status_code != 202:
self.logger.error("REST call {} failed reason : {}"\
"status code : {} ".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("add_network_adapter_to_vms : Failed to update "\
"network connection section")
else:
- nic_task = self.get_task_from_response(response.content)
+ nic_task = self.get_task_from_response(response.text)
result = self.client.get_task_monitor().wait_for_success(task=nic_task)
if result.get('status') == 'success':
self.logger.info("add_network_adapter_to_vms(): VM {} conneced to "\
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("add_network_adapter_to_vms : Failed to get "\
"network connection section")
- data = response.content
+ data = response.text
data = data.split('<Link rel="edit"')[0]
vcd_netadapter_type = nic_type
if nic_type in ['SR-IOV', 'VF']:
if response.status_code != 202:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("add_network_adapter_to_vms : Failed to update "\
"network connection section")
else:
- nic_task = self.get_task_from_response(response.content)
+ nic_task = self.get_task_from_response(response.text)
result = self.client.get_task_monitor().wait_for_success(task=nic_task)
if result.get('status') == 'success':
self.logger.info("add_network_adapter_to_vms(): VM {} "\
headers=headers,
data=data)
if response.status_code == 202:
- guest_task = self.get_task_from_response(response.content)
+ guest_task = self.get_task_from_response(response.text)
self.client.get_task_monitor().wait_for_success(task=guest_task)
self.logger.info("guest_customization : customized guest os task "\
"completed for VM {}".format(vm_name))
return status
try:
#Find but type & max of instance IDs assigned to disks
- lxmlroot_respond = lxmlElementTree.fromstring(response.content)
+ lxmlroot_respond = lxmlElementTree.fromstring(response.text)
namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
namespaces["xmlns"]= "http://www.vmware.com/vcloud/v1.5"
instance_id = 0
<rasd:ResourceType>17</rasd:ResourceType>
</Item>""".format(disk_size_mb, bus_subtype, bus_type, instance_id)
- new_data = response.content
+ new_data = response.text
#Add new item at the bottom
new_data = new_data.replace('</Item>\n</RasdItemsList>', '</Item>\n{}\n</RasdItemsList>'.format(new_item))
response = self.retry_rest('PUT', disk_href, add_headers, new_data)
if response.status_code != 202:
- self.logger.error("PUT REST API call {} failed. Return status code {}. Response Content:{}"
- .format(disk_href, response.status_code, response.content))
+ self.logger.error("PUT REST API call {} failed. Return status code {}. response.text:{}"
+ .format(disk_href, response.status_code, response.text))
else:
- add_disk_task = self.get_task_from_response(response.content)
+ add_disk_task = self.get_task_from_response(response.text)
result = self.client.get_task_monitor().wait_for_success(task=add_disk_task)
if result.get('status') == 'success':
status = True
response = self.perform_request(req_type='GET',
url=catalog_items[0].get('href'),
headers=headers)
- catalogItem = XmlElementTree.fromstring(response.content)
+ catalogItem = XmlElementTree.fromstring(response.text)
entity = [child for child in catalogItem if child.get("type") == "application/vnd.vmware.vcloud.vAppTemplate+xml"][0]
vapp_tempalte_href = entity.get("href")
#get vapp details and parse moref id
vapp_tempalte_href, response.status_code))
else:
- xmlroot_respond = XmlElementTree.fromstring(response.content)
+ xmlroot_respond = XmlElementTree.fromstring(response.text)
children_section = xmlroot_respond.find('vm:Children/', namespaces)
if children_section is not None:
vCloud_extension_section = children_section.find('xmlns:VCloudExtension', namespaces)
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(url_rest_call,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("insert_media_to_vm(): Failed to get "\
"catalog details")
# searching iso name and id
- iso_name,media_id = self.get_media_details(vca, response.content)
+ iso_name, media_id = self.get_media_details(vca, response.text)
if iso_name and media_id:
data ="""<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns6:MediaInsertOrEjectParams
- xmlns="http://www.vmware.com/vcloud/versions" xmlns:ns2="http://schemas.dmtf.org/ovf/envelope/1"
- xmlns:ns3="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
- xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/common"
- xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
- xmlns:ns6="http://www.vmware.com/vcloud/v1.5"
- xmlns:ns7="http://www.vmware.com/schema/ovf"
- xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1"
+ xmlns="http://www.vmware.com/vcloud/versions" xmlns:ns2="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:ns3="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/common"
+ xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ xmlns:ns6="http://www.vmware.com/vcloud/v1.5"
+ xmlns:ns7="http://www.vmware.com/schema/ovf"
+ xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1"
xmlns:ns9="http://www.vmware.com/vcloud/extension/v1.5">
<ns6:Media
type="application/vnd.vmware.vcloud.media+xml"
self.logger.error(error_msg)
raise vimconn.vimconnException(error_msg)
else:
- task = self.get_task_from_response(response.content)
+ task = self.get_task_from_response(response.text)
result = self.client.get_task_monitor().wait_for_success(task=task)
if result.get('status') == 'success':
self.logger.info("insert_media_to_vm(): Sucessfully inserted media ISO"\
if response.status_code != 200:
self.logger.error("REST call {} failed reason : {}"\
"status code : {}".format(href,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("get_media_details : Failed to get "\
"catalogitem details")
- list_xmlroot = XmlElementTree.fromstring(response.content)
+ list_xmlroot = XmlElementTree.fromstring(response.text)
for child in list_xmlroot.iter():
if 'Entity' in child.tag:
if 'media' in child.attrib.get('href'):
Returns:
The return client object that letter can be used to connect to vCloud director as admin for VDC
"""
- try:
- self.logger.debug("Generate token for vca {} as {} to datacenter {}.".format(self.org_name,
- self.user,
- self.org_name))
- host = self.url
- client = Client(host, verify_ssl_certs=False)
- client.set_highest_supported_version()
- client.set_credentials(BasicLoginCredentials(self.user, self.org_name, self.passwd))
- # connection object
- self.client = client
-
- except:
- raise vimconn.vimconnConnectionException("Can't connect to a vCloud director org: "
- "{} as user: {}".format(self.org_name, self.user))
-
- if not client:
- raise vimconn.vimconnConnectionException("Failed while reconnecting vCD")
-
+ self.client = self.connect()
def get_vdc_details(self):
""" Get VDC details using pyVcloud Lib
def get_task_from_response(self, content):
"""
- content - API response content(response.content)
+ content - API response.text(response.text)
return task object
"""
xmlroot = XmlElementTree.fromstring(content)
if response.status_code != 202:
self.logger.error("REST call {} failed reason : {}"\
"status code : {} ".format(poweron_href,
- response.content,
+ response.text,
response.status_code))
raise vimconn.vimconnException("power_on_vapp() : Failed to power on "\
"vApp {}".format(vapp_name))
else:
- poweron_task = self.get_task_from_response(response.content)
+ poweron_task = self.get_task_from_response(response.text)
return poweron_task
else:
# create new flavor
self.__class__.flavor_id = test_config["vim_conn"].new_flavor(flavor_data)
- self.assertIsInstance(self.__class__.flavor_id, (str, unicode))
+ self.assertIsInstance(self.__class__.flavor_id, str)
self.assertIsInstance(uuid.UUID(self.__class__.flavor_id), uuid.UUID)
def test_010_delete_flavor(self):
if 'name' in item:
self.__class__.image_name = item['name']
self.__class__.image_id = item['id']
- self.assertIsInstance(self.__class__.image_name, (str, unicode))
- self.assertIsInstance(self.__class__.image_id, (str, unicode))
+ self.assertIsInstance(self.__class__.image_name, str)
+ self.assertIsInstance(self.__class__.image_id, str)
else:
with self.assertRaises(Exception) as context:
image_list = test_config["vim_conn"].get_image_list()
logger.debug("{}: Result image list: {}".format(self.__class__.test_text, image_list))
for item in image_list:
- self.assertIsInstance(item['id'], (str, unicode))
- self.assertIsInstance(item['name'], (str, unicode))
+ self.assertIsInstance(item['id'], str)
+ self.assertIsInstance(item['name'], str)
#self.assertEqual(item['id'], self.__class__.image_id)
self.assertEqual(item['name'], self.__class__.image_name)
filter_image_list = test_config["vim_conn"].get_image_list({'id': self.__class__.image_id})
for item1 in filter_image_list:
- self.assertIsInstance(item1['id'], (str, unicode))
- self.assertIsInstance(item1['name'], (str, unicode))
+ self.assertIsInstance(item1['id'], str)
+ self.assertIsInstance(item1['name'], str)
self.assertEqual(item1['id'], self.__class__.image_id)
self.assertEqual(item1['name'], self.__class__.image_name)
image_id=self.__class__.image_id,
flavor_id=flavor_id, net_list=net_list)
- self.assertIsInstance(self.__class__.instance_id, (str, unicode))
+ self.assertIsInstance(self.__class__.instance_id, str)
def test_010_new_vminstance_by_model(self):
flavor_data = {'name': _get_random_string(20),'ram': 1024, 'vcpus': 2, 'disk': 10}
image_id=self.__class__.image_id,
flavor_id=flavor_id,net_list=net_list)
- self.assertIsInstance(instance_id, (str, unicode))
+ self.assertIsInstance(instance_id, str)
# Deleting created vm instance
logger.info("Deleting created vm intance")
instance_id, _ = test_config["vim_conn"].new_vminstance(name='Test1_vm', description='', start=False,
image_id=self.__class__.image_id,disk_list=None,
flavor_id=flavor_id, net_list=net_list)
- self.assertIsInstance(instance_id, (str, unicode))
+ self.assertIsInstance(instance_id, str)
# Deleting created vm instance
logger.info("Deleting created vm intance")
flavor_id=flavor_id,net_list=net_list,
cloud_config=cloud_data)
- self.assertIsInstance(instance_id, (str, unicode))
+ self.assertIsInstance(instance_id, str)
# Deleting created vm instance
logger.info("Deleting created vm intance")
flavor_id=flavor_id, net_list=net_list,
disk_list=device_data)
- self.assertIsInstance(instance_id, (str, unicode))
+ self.assertIsInstance(instance_id, str)
# Deleting created vm instance
logger.info("Deleting created vm intance")
test_config["vim_conn"].delete_vminstance(instance_id)
image_id=self.__class__.image_id, flavor_id=flavor_id,
net_list=net_list)
- self.assertIsInstance(instance_id, (str, unicode))
+ self.assertIsInstance(instance_id, str)
logger.info("Waiting for created sriov-vm intance")
time.sleep(10)
for item in tenant_list:
if test_config['tenant'] == item['name']:
self.__class__.tenant_id = item['id']
- self.assertIsInstance(item['name'], (str, unicode))
- self.assertIsInstance(item['id'], (str, unicode))
+ self.assertIsInstance(item['name'], str)
+ self.assertIsInstance(item['id'], str)
def test_010_get_tenant_list_by_id(self):
self.__class__.test_text = "{}.{}. TEST {}".format(test_config["test_number"],
logger.debug(self.__class__.test_text + "Tenant list: " + str(filter_tenant_list))
for item in filter_tenant_list:
- self.assertIsInstance(item['id'], (str, unicode))
+ self.assertIsInstance(item['id'], str)
self.assertEqual(item['id'], self.__class__.tenant_id)
def test_020_get_tenant_list_by_name(self):
logger.debug(self.__class__.test_text + "Tenant list: " + str(filter_tenant_list))
for item in filter_tenant_list:
- self.assertIsInstance(item['name'], (str, unicode))
+ self.assertIsInstance(item['name'], str)
self.assertEqual(item['name'], test_config['tenant'])
def test_030_get_tenant_list_by_name_and_id(self):
logger.debug(self.__class__.test_text + "Tenant list: " + str(filter_tenant_list))
for item in filter_tenant_list:
- self.assertIsInstance(item['name'], (str, unicode))
- self.assertIsInstance(item['id'], (str, unicode))
+ self.assertIsInstance(item['name'], str)
+ self.assertIsInstance(item['id'], str)
self.assertEqual(item['name'], test_config['tenant'])
self.assertEqual(item['id'], self.__class__.tenant_id)
self.__class__.tenant_id = test_config["vim_conn"].new_tenant(tenant_name, "")
time.sleep(15)
- self.assertIsInstance(self.__class__.tenant_id, (str, unicode))
+ self.assertIsInstance(self.__class__.tenant_id, str)
else:
with self.assertRaises(Exception) as context:
test_config["vim_conn"].new_tenant(self.__class__.tenant_id, "")
if test_config['vimtype'] != 'azure':
tenant_id = test_config["vim_conn"].delete_tenant(self.__class__.tenant_id)
- self.assertIsInstance(tenant_id, (str, unicode))
+ self.assertIsInstance(tenant_id, str)
else:
with self.assertRaises(Exception) as context:
test_config["vim_conn"].delete_tenant(self.__class__.tenant_id)
Pre-requesite: provided IP address should be from IP pool range which has used for network creation
"""
name = "eth0"
- # provide ip address
- ip_address = ''
+ # provide ip address
+ ip_address = ''
flavor_data = {'ram': 1024, 'vcpus': 1, 'disk': 10}
def test_030_vminstance_by_mac_address(self):
name = "eth1"
- mac_address = "74:54:2f:21:da:8c"
+ mac_address = "74:54:2f:21:da:8c"
flavor_data = {'ram': 1024, 'vcpus': 1, 'disk': 10}
# create new flavor
class test_vimconn_vminstance_by_adding_10_nics(test_base):
network_name = None
- net_ids = []
+ net_ids = []
def setUp(self):
# create network
def test_000_vminstance_by_existing_disk(self):
- """ This testcase will add existing disk only if given catalog/image is free
+ """ This testcase will add existing disk only if given catalog/image is free
means not used by any other VM
"""
net_list = [{'use': 'bridge', 'name': name, 'floating_ip': False, 'port_security': True,
'type': 'virtual', 'net_id': self.network_id}]
- instance_id, _ = test_config["vim_conn"].new_vminstance(name='Test1_vm', description='', start=False,
+ instance_id, _ = test_config["vim_conn"].new_vminstance(name='Test1_vm', description='', start=False,
image_id=image_id,
flavor_id=flavor_id, net_list=net_list,disk_list=disk_list)
net_list = [{'use': 'bridge', 'name': name, 'floating_ip': False, 'port_security': True,
'type': 'virtual', 'net_id': self.network_id}]
- instance_id, _ = test_config["vim_conn"].new_vminstance(name='Test1_vm', description='', start=False,
+ instance_id, _ = test_config["vim_conn"].new_vminstance(name='Test1_vm', description='', start=False,
image_id=image_id,
flavor_id=flavor_id, net_list=net_list,disk_list=disk_list)
net_list = [{'use': 'bridge', 'name': name, 'floating_ip': False, 'port_security': True,
'type': 'virtual', 'net_id': self.network_id}]
- instance_id, _ = test_config["vim_conn"].new_vminstance(name='Test1_vm', description='', start=False,
+ instance_id, _ = test_config["vim_conn"].new_vminstance(name='Test1_vm', description='', start=False,
image_id=image_id,
flavor_id=flavor_id, net_list=net_list)