def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
config={}, persistent_info={}):
"""Constructor of VIM
def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
config={}, persistent_info={}):
"""Constructor of VIM
- vimconn.vimconnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
+ vimconn.VimConnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
def new_network(self, net_name, net_type, ip_profile=None, shared=False, provider_network_profile=None):
"""Adds a tenant network to VIM
def new_network(self, net_name, net_type, ip_profile=None, shared=False, provider_network_profile=None):
"""Adds a tenant network to VIM
"""
self.logger.debug('new_network: {}'.format(locals()))
if net_type in ['data','ptp']:
"""
self.logger.debug('new_network: {}'.format(locals()))
if net_type in ['data','ptp']:
ip.update({'gateway':ip_profile.get('gateway_address', None)})
desc.update({'ip_configuration':ip_info})
else:
ip.update({'gateway':ip_profile.get('gateway_address', None)})
desc.update({'ip_configuration':ip_info})
else:
desc.update({'ip_configuration':ip})
self.logger.debug('VIM new_network args: {} - Generated Eclipse fog05 Descriptor {}'.format(locals(), desc))
try:
self.fos_api.network.add_network(desc)
except fimapi.FIMAResouceExistingException as free:
desc.update({'ip_configuration':ip})
self.logger.debug('VIM new_network args: {} - Generated Eclipse fog05 Descriptor {}'.format(locals(), desc))
try:
self.fos_api.network.add_network(desc)
except fimapi.FIMAResouceExistingException as free:
self.logger.debug('get_network: {}'.format(net_id))
res = self.get_network_list(filter_dict={'id':net_id})
if len(res) == 0:
self.logger.debug('get_network: {}'.format(net_id))
res = self.get_network_list(filter_dict={'id':net_id})
if len(res) == 0:
return {'id':r.get('uuid'), 'name':r.get('name'), 'fos':r}
def get_flavor_id_from_data(self, flavor_dict):
return {'id':r.get('uuid'), 'name':r.get('name'), 'fos':r}
def get_flavor_id_from_data(self, flavor_dict):
def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
availability_zone_index=None, availability_zone_list=None):
def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
availability_zone_index=None, availability_zone_list=None):
self.logger.debug('new_vminstance returns: {} {}'.format( instance.uuid, created_items))
return str(instance.uuid), created_items
except fimapi.FIMAResouceExistingException as free:
self.logger.debug('new_vminstance returns: {} {}'.format( instance.uuid, created_items))
return str(instance.uuid), created_items
except fimapi.FIMAResouceExistingException as free:
def get_vminstance(self,vm_id):
"""Returns the VM instance information from VIM"""
def get_vminstance(self,vm_id):
"""Returns the VM instance information from VIM"""
return instance.to_json()
def delete_vminstance(self, vm_id, created_items=None):
return instance.to_json()
def delete_vminstance(self, vm_id, created_items=None):
def refresh_vms_status(self, vm_list):
"""Get the status of the virtual machines and their interfaces/ports
def refresh_vms_status(self, vm_list):
"""Get the status of the virtual machines and their interfaces/ports
self.logger.debug('VIM action_vminstance with args: {}'.format(locals()))
nid = self.fdu_node_map.get(vm_id)
if nid is None:
self.logger.debug('VIM action_vminstance with args: {}'.format(locals()))
nid = self.fdu_node_map.get(vm_id)
if nid is None:
elif "pause" in action_dict:
if instance.get('status') == 'RUN':
self.fos_api.fdu.pause(vm_id)
else:
elif "pause" in action_dict:
if instance.get('status') == 'RUN':
self.fos_api.fdu.pause(vm_id)
else:
elif "resume" in action_dict:
if instance.get('status') == 'PAUSE':
self.fos_api.fdu.resume(vm_id)
else:
elif "resume" in action_dict:
if instance.get('status') == 'PAUSE':
self.fos_api.fdu.resume(vm_id)
else:
elif "shutoff" in action_dict or "shutdown" or "forceOff" in action_dict:
if instance.get('status') == 'RUN':
self.fos_api.fdu.stop(vm_id)
else:
elif "shutoff" in action_dict or "shutdown" or "forceOff" in action_dict:
if instance.get('status') == 'RUN':
self.fos_api.fdu.stop(vm_id)
else:
elif "terminate" in action_dict:
if instance.get('status') == 'RUN':
self.fos_api.fdu.stop(vm_id)
elif "terminate" in action_dict:
if instance.get('status') == 'RUN':
self.fos_api.fdu.stop(vm_id)
elif "reboot" in action_dict:
if instance.get('status') == 'RUN':
self.fos_api.fdu.stop(vm_id)
self.fos_api.fdu.start(vm_id)
else:
elif "reboot" in action_dict:
if instance.get('status') == 'RUN':
self.fos_api.fdu.stop(vm_id)
self.fos_api.fdu.start(vm_id)
else: