From: borsatti Date: Wed, 18 Dec 2019 15:08:57 +0000 (+0000) Subject: Bug 795 fixed X-Git-Tag: v7.0.1rc1~4 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F8424%2F2;p=osm%2FRO.git Bug 795 fixed Change-Id: I3597c504a18eb46e4fbc07c4a74676d9521c782d Signed-off-by: borsatti --- diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index dad8eb63..b3203189 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -826,7 +826,7 @@ class vimconnector(vimconn.vimconnector): def process_resource_quota(self, quota, prefix, extra_specs): """ :param prefix: - :param extra_specs: + :param extra_specs: :return: """ if 'limit' in quota: @@ -2228,3 +2228,180 @@ class vimconnector(vimconn.vimconnector): ksExceptions.ClientException, neExceptions.NeutronException, ConnectionError) as e: self._format_exception(e) + + + def refresh_sfps_status(self, sfp_list): + '''Get the status of the service function path + Params: the list of sfp identifiers + Returns a dictionary with: + vm_id: #VIM id of this service function path + status: #Mandatory. Text with one of: + # DELETED (not found at vim) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # OTHER (Vim reported other status not understood) + # ERROR (VIM indicates an ERROR status) + # ACTIVE, + # CREATING (on building process) + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + vim_info: #Text with plain information obtained from vim (yaml.safe_dump)F + ''' + sfp_dict={} + self.logger.debug("refresh_sfps status: Getting tenant SFP information from VIM") + for sfp_id in sfp_list: + sfp={} + try: + sfp_vim = self.get_sfp(sfp_id) + if sfp_vim['spi']: + sfp['status'] = vmStatus2manoFormat[ 'ACTIVE' ] + else: + sfp['status'] = "OTHER" + sfp['error_msg'] = "VIM status reported " + vm_vim['status'] + + sfp['vim_info'] = self.serialize(sfp_vim) + + if sfp_vim.get('fault'): + sfp['error_msg'] = str(sfp_vim['fault']) + + except vimconn.vimconnNotFoundException as e: + self.logger.error("Exception getting sfp status: %s", str(e)) + sfp['status'] = "DELETED" + sfp['error_msg'] = str(e) + except vimconn.vimconnException as e: + self.logger.error("Exception getting sfp status: %s", str(e)) + sfp['status'] = "VIM_ERROR" + sfp['error_msg'] = str(e) + sfp_dict[sfp_id] = sfp + return sfp_dict + + + def refresh_sfis_status(self, sfi_list): + '''Get the status of the service function instances + Params: the list of sfi identifiers + Returns a dictionary with: + vm_id: #VIM id of this service function instance + status: #Mandatory. Text with one of: + # DELETED (not found at vim) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # OTHER (Vim reported other status not understood) + # ERROR (VIM indicates an ERROR status) + # ACTIVE, + # CREATING (on building process) + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + vim_info: #Text with plain information obtained from vim (yaml.safe_dump) + ''' + sfi_dict={} + self.logger.debug("refresh_sfis status: Getting tenant sfi information from VIM") + for sfi_id in sfi_list: + sfi={} + try: + sfi_vim = self.get_sfi(sfi_id) + if sfi_vim: + sfi['status'] = vmStatus2manoFormat[ 'ACTIVE' ] + else: + sfi['status'] = "OTHER" + sfi['error_msg'] = "VIM status reported " + vm_vim['status'] + + sfi['vim_info'] = self.serialize(sfi_vim) + + if sfi_vim.get('fault'): + sfi['error_msg'] = str(sfi_vim['fault']) + + except vimconn.vimconnNotFoundException as e: + self.logger.error("Exception getting sfi status: %s", str(e)) + sfi['status'] = "DELETED" + sfi['error_msg'] = str(e) + except vimconn.vimconnException as e: + self.logger.error("Exception getting sfi status: %s", str(e)) + sfi['status'] = "VIM_ERROR" + sfi['error_msg'] = str(e) + sfi_dict[sfi_id] = sfi + return sfi_dict + + + def refresh_sfs_status(self, sf_list): + '''Get the status of the service functions + Params: the list of sf identifiers + Returns a dictionary with: + vm_id: #VIM id of this service function + status: #Mandatory. Text with one of: + # DELETED (not found at vim) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # OTHER (Vim reported other status not understood) + # ERROR (VIM indicates an ERROR status) + # ACTIVE, + # CREATING (on building process) + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + vim_info: #Text with plain information obtained from vim (yaml.safe_dump) + ''' + sf_dict={} + self.logger.debug("refresh_sfs status: Getting tenant sf information from VIM") + for sf_id in sf_list: + sf={} + try: + sf_vim = self.get_sf(sf_id) + if sf_vim: + sf['status'] = vmStatus2manoFormat[ 'ACTIVE' ] + else: + sf['status'] = "OTHER" + sf['error_msg'] = "VIM status reported " + vm_vim['status'] + + sf['vim_info'] = self.serialize(sf_vim) + + if sf_vim.get('fault'): + sf['error_msg'] = str(sf_vim['fault']) + + except vimconn.vimconnNotFoundException as e: + self.logger.error("Exception getting sf status: %s", str(e)) + sf['status'] = "DELETED" + sf['error_msg'] = str(e) + except vimconn.vimconnException as e: + self.logger.error("Exception getting sf status: %s", str(e)) + sf['status'] = "VIM_ERROR" + sf['error_msg'] = str(e) + sf_dict[sf_id] = sf + return sf_dict + + + + def refresh_classifications_status(self, classification_list): + '''Get the status of the classifications + Params: the list of classification identifiers + Returns a dictionary with: + vm_id: #VIM id of this classifier + status: #Mandatory. Text with one of: + # DELETED (not found at vim) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # OTHER (Vim reported other status not understood) + # ERROR (VIM indicates an ERROR status) + # ACTIVE, + # CREATING (on building process) + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + vim_info: #Text with plain information obtained from vim (yaml.safe_dump) + ''' + classification_dict={} + self.logger.debug("refresh_classifications status: Getting tenant classification information from VIM") + for classification_id in classification_list: + classification={} + try: + classification_vim = self.get_classification(classification_id) + if classification_vim: + classification['status'] = vmStatus2manoFormat[ 'ACTIVE' ] + else: + classification['status'] = "OTHER" + classification['error_msg'] = "VIM status reported " + vm_vim['status'] + + classification['vim_info'] = self.serialize(classification_vim) + + if classification_vim.get('fault'): + classification['error_msg'] = str(classification_vim['fault']) + + except vimconn.vimconnNotFoundException as e: + self.logger.error("Exception getting classification status: %s", str(e)) + classification['status'] = "DELETED" + classification['error_msg'] = str(e) + except vimconn.vimconnException as e: + self.logger.error("Exception getting classification status: %s", str(e)) + classification['status'] = "VIM_ERROR" + classification['error_msg'] = str(e) + classification_dict[classification_id] = classification + return classification_dict diff --git a/RO/osm_ro/nfvo.py b/RO/osm_ro/nfvo.py index 36109cb8..1e08a4fe 100644 --- a/RO/osm_ro/nfvo.py +++ b/RO/osm_ro/nfvo.py @@ -2433,7 +2433,6 @@ def new_nsd_v3(mydb, tenant_id, nsd_descriptor): elif vld.get("vim-network-name"): db_sce_net["vim_network_name"] = get_str(vld, "vim-network-name", 255) - # table sce_interfaces (vld:vnfd-connection-point-ref) for iface in vld.get("vnfd-connection-point-ref").values(): # Check if there are VDUs in the descriptor @@ -2447,7 +2446,7 @@ def new_nsd_v3(mydb, tenant_id, nsd_descriptor): "'nsd':'constituent-vnfd'".format( str(nsd["id"]), str(vld["id"]), str(iface["member-vnf-index-ref"])), httperrors.Bad_Request) - + existing_ifaces = mydb.get_rows(SELECT=('i.uuid as uuid', 'i.type as iface_type'), FROM="interfaces as i join vms on i.vm_id=vms.uuid", WHERE={'vnf_id': vnf_index2vnf_uuid[vnf_index], @@ -2474,7 +2473,7 @@ def new_nsd_v3(mydb, tenant_id, nsd_descriptor): "sce_net_id": sce_net_uuid, "interface_id": interface_uuid, "ip_address": iface_ip_address, - } + } db_sce_interfaces.append(db_sce_interface) if not db_sce_net["type"]: db_sce_net["type"] = "bridge" diff --git a/RO/osm_ro/vim_thread.py b/RO/osm_ro/vim_thread.py index 587c0600..06e2592e 100644 --- a/RO/osm_ro/vim_thread.py +++ b/RO/osm_ro/vim_thread.py @@ -660,7 +660,10 @@ class vim_thread(threading.Thread): else: raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"])) elif task["item"] == 'instance_sfis': - if task["action"] == "CREATE": + if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"): + database_update = self._refres_sfis(task) + create_or_find = True + elif task["action"] == "CREATE": create_or_find = True database_update = self.new_sfi(task) elif task["action"] == "DELETE": @@ -668,7 +671,10 @@ class vim_thread(threading.Thread): else: raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"])) elif task["item"] == 'instance_sfs': - if task["action"] == "CREATE": + if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"): + database_update = self._refres_sfs(task) + create_or_find = True + elif task["action"] == "CREATE": create_or_find = True database_update = self.new_sf(task) elif task["action"] == "DELETE": @@ -676,7 +682,10 @@ class vim_thread(threading.Thread): else: raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"])) elif task["item"] == 'instance_classifications': - if task["action"] == "CREATE": + if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"): + database_update = self._refres_classifications(task) + create_or_find = True + elif task["action"] == "CREATE": create_or_find = True database_update = self.new_classification(task) elif task["action"] == "DELETE": @@ -684,7 +693,10 @@ class vim_thread(threading.Thread): else: raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"])) elif task["item"] == 'instance_sfps': - if task["action"] == "CREATE": + if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"): + database_update = self._refres_sfps(task) + create_or_find = True + elif task["action"] == "CREATE": create_or_find = True database_update = self.new_sfp(task) elif task["action"] == "DELETE": @@ -761,7 +773,7 @@ class vim_thread(threading.Thread): if database_update: where_filter = {"related": task["related"]} if task["item"] == "instance_nets" and task["datacenter_vim_id"]: - where_filter["datacenter_tenant_id"] = task["datacenter_vim_id"] + where_filter["datacenter_tenant_id"] = task["datacenter_vim_id"] self.db.update_rows(table=task["item"], UPDATE=database_update, WHERE=where_filter) @@ -1107,7 +1119,7 @@ class vim_thread(threading.Thread): except Exception as e: if isinstance(e, SdnConnectorError) and e.http_error == HTTPStatus.NOT_FOUND.value: pass - else: + else: self._proccess_sdn_exception(e) params = task["params"] @@ -1181,7 +1193,7 @@ class vim_thread(threading.Thread): last_update = time.time() connected_ports = new_connected_ports elif wimconn_net_id: - try: + try: wim_status_dict = self.sdnconnector.get_connectivity_service_status(wimconn_net_id, conn_info=created_items) sdn_status = wim_status_dict["sdn_status"] @@ -1283,7 +1295,7 @@ class vim_thread(threading.Thread): task["extra"]["created"] = True task["extra"]["vim_status"] = "ACTIVE" task["error_msg"] = None - task["status"] = "FINISHED" # with FINISHED instead of DONE it will not be refreshing + task["status"] = "DONE" task["vim_id"] = vim_sfi_id instance_element_update = {"status": "ACTIVE", "vim_sfi_id": vim_sfi_id, "error_msg": None} return instance_element_update @@ -1332,7 +1344,7 @@ class vim_thread(threading.Thread): task["extra"]["created"] = True task["extra"]["vim_status"] = "ACTIVE" task["error_msg"] = None - task["status"] = "FINISHED" # with FINISHED instead of DONE it will not be refreshing + task["status"] = "DONE" task["vim_id"] = vim_sf_id instance_element_update = {"status": "ACTIVE", "vim_sf_id": vim_sf_id, "error_msg": None} return instance_element_update @@ -1428,7 +1440,7 @@ class vim_thread(threading.Thread): task["extra"]["created"] = True task["extra"]["vim_status"] = "ACTIVE" task["error_msg"] = None - task["status"] = "FINISHED" # with FINISHED instead of DONE it will not be refreshing + task["status"] = "DONE" task["vim_id"] = vim_classification_id instance_element_update = {"status": "ACTIVE", "vim_classification_id": vim_classification_id, "error_msg": None} @@ -1484,7 +1496,7 @@ class vim_thread(threading.Thread): task["extra"]["created"] = True task["extra"]["vim_status"] = "ACTIVE" task["error_msg"] = None - task["status"] = "FINISHED" # with FINISHED instead of DONE it will not be refreshing + task["status"] = "DONE" task["vim_id"] = vim_sfp_id instance_element_update = {"status": "ACTIVE", "vim_sfp_id": vim_sfp_id, "error_msg": None} return instance_element_update @@ -1514,3 +1526,149 @@ class vim_thread(threading.Thread): return None task["status"] = "FAILED" return None + + def _refres_sfps(self, task): + """Call VIM to get SFPs status""" + database_update = None + + vim_id = task["vim_id"] + sfp_to_refresh_list = [vim_id] + task_id = task["instance_action_id"] + "." + str(task["task_index"]) + try: + vim_dict = self.vim.refresh_sfps_status(sfp_to_refresh_list) + vim_info = vim_dict[vim_id] + except vimconn.vimconnException as e: + # Mark all tasks at VIM_ERROR status + self.logger.error("task={} get-sfp: vimconnException when trying to refresh sfps {}".format(task_id, e)) + vim_info = {"status": "VIM_ERROR", "error_msg": str(e)} + + self.logger.debug("task={} get-sfp: vim_sfp_id={} result={}".format(task_id, task["vim_id"], vim_info)) + #TODO: Revise this part + vim_info_error_msg = None + if vim_info.get("error_msg"): + vim_info_error_msg = self._format_vim_error_msg(vim_info["error_msg"]) + task_vim_info = task["extra"].get("vim_info") + task_error_msg = task.get("error_msg") + task_vim_status = task["extra"].get("vim_status") + if task_vim_status != vim_info["status"] or task_error_msg != vim_info_error_msg or \ + (vim_info.get("vim_info") and task_vim_info != vim_info["vim_info"]): + database_update = {"status": vim_info["status"], "error_msg": vim_info_error_msg} + if vim_info.get("vim_info"): + database_update["vim_info"] = vim_info["vim_info"] + + task["extra"]["vim_status"] = vim_info["status"] + task["error_msg"] = vim_info_error_msg + if vim_info.get("vim_info"): + task["extra"]["vim_info"] = vim_info["vim_info"] + + return database_update + + def _refres_sfis(self, task): + """Call VIM to get sfis status""" + database_update = None + + vim_id = task["vim_id"] + sfi_to_refresh_list = [vim_id] + task_id = task["instance_action_id"] + "." + str(task["task_index"]) + try: + vim_dict = self.vim.refresh_sfis_status(sfi_to_refresh_list) + vim_info = vim_dict[vim_id] + except vimconn.vimconnException as e: + # Mark all tasks at VIM_ERROR status + self.logger.error("task={} get-sfi: vimconnException when trying to refresh sfis {}".format(task_id, e)) + vim_info = {"status": "VIM_ERROR", "error_msg": str(e)} + + self.logger.debug("task={} get-sfi: vim_sfi_id={} result={}".format(task_id, task["vim_id"], vim_info)) + #TODO: Revise this part + vim_info_error_msg = None + if vim_info.get("error_msg"): + vim_info_error_msg = self._format_vim_error_msg(vim_info["error_msg"]) + task_vim_info = task["extra"].get("vim_info") + task_error_msg = task.get("error_msg") + task_vim_status = task["extra"].get("vim_status") + if task_vim_status != vim_info["status"] or task_error_msg != vim_info_error_msg or \ + (vim_info.get("vim_info") and task_vim_info != vim_info["vim_info"]): + database_update = {"status": vim_info["status"], "error_msg": vim_info_error_msg} + if vim_info.get("vim_info"): + database_update["vim_info"] = vim_info["vim_info"] + + task["extra"]["vim_status"] = vim_info["status"] + task["error_msg"] = vim_info_error_msg + if vim_info.get("vim_info"): + task["extra"]["vim_info"] = vim_info["vim_info"] + + return database_update + + def _refres_sfs(self, task): + """Call VIM to get sfs status""" + database_update = None + + vim_id = task["vim_id"] + sf_to_refresh_list = [vim_id] + task_id = task["instance_action_id"] + "." + str(task["task_index"]) + try: + vim_dict = self.vim.refresh_sfs_status(sf_to_refresh_list) + vim_info = vim_dict[vim_id] + except vimconn.vimconnException as e: + # Mark all tasks at VIM_ERROR status + self.logger.error("task={} get-sf: vimconnException when trying to refresh sfs {}".format(task_id, e)) + vim_info = {"status": "VIM_ERROR", "error_msg": str(e)} + + self.logger.debug("task={} get-sf: vim_sf_id={} result={}".format(task_id, task["vim_id"], vim_info)) + #TODO: Revise this part + vim_info_error_msg = None + if vim_info.get("error_msg"): + vim_info_error_msg = self._format_vim_error_msg(vim_info["error_msg"]) + task_vim_info = task["extra"].get("vim_info") + task_error_msg = task.get("error_msg") + task_vim_status = task["extra"].get("vim_status") + if task_vim_status != vim_info["status"] or task_error_msg != vim_info_error_msg or \ + (vim_info.get("vim_info") and task_vim_info != vim_info["vim_info"]): + database_update = {"status": vim_info["status"], "error_msg": vim_info_error_msg} + if vim_info.get("vim_info"): + database_update["vim_info"] = vim_info["vim_info"] + + task["extra"]["vim_status"] = vim_info["status"] + task["error_msg"] = vim_info_error_msg + if vim_info.get("vim_info"): + task["extra"]["vim_info"] = vim_info["vim_info"] + + return database_update + + def _refres_classifications(self, task): + """Call VIM to get classifications status""" + database_update = None + + vim_id = task["vim_id"] + classification_to_refresh_list = [vim_id] + task_id = task["instance_action_id"] + "." + str(task["task_index"]) + try: + vim_dict = self.vim.refresh_classifications_status(classification_to_refresh_list) + vim_info = vim_dict[vim_id] + except vimconn.vimconnException as e: + # Mark all tasks at VIM_ERROR status + self.logger.error("task={} get-classification: vimconnException when trying to refresh classifications {}" + .format(task_id, e)) + vim_info = {"status": "VIM_ERROR", "error_msg": str(e)} + + self.logger.debug("task={} get-classification: vim_classification_id={} result={}".format(task_id, + task["vim_id"], vim_info)) + #TODO: Revise this part + vim_info_error_msg = None + if vim_info.get("error_msg"): + vim_info_error_msg = self._format_vim_error_msg(vim_info["error_msg"]) + task_vim_info = task["extra"].get("vim_info") + task_error_msg = task.get("error_msg") + task_vim_status = task["extra"].get("vim_status") + if task_vim_status != vim_info["status"] or task_error_msg != vim_info_error_msg or \ + (vim_info.get("vim_info") and task_vim_info != vim_info["vim_info"]): + database_update = {"status": vim_info["status"], "error_msg": vim_info_error_msg} + if vim_info.get("vim_info"): + database_update["vim_info"] = vim_info["vim_info"] + + task["extra"]["vim_status"] = vim_info["status"] + task["error_msg"] = vim_info_error_msg + if vim_info.get("vim_info"): + task["extra"]["vim_info"] = vim_info["vim_info"] + + return database_update diff --git a/RO/osm_ro/vimconn.py b/RO/osm_ro/vimconn.py index c97370da..4b78e2a7 100644 --- a/RO/osm_ro/vimconn.py +++ b/RO/osm_ro/vimconn.py @@ -39,16 +39,16 @@ from osm_ro.utils import deprecated __author__ = "Alfonso Tierno, Igor D.C." __date__ = "$14-aug-2017 23:59:59$" -#Error variables +#Error variables HTTP_Bad_Request = 400 -HTTP_Unauthorized = 401 -HTTP_Not_Found = 404 -HTTP_Method_Not_Allowed = 405 +HTTP_Unauthorized = 401 +HTTP_Not_Found = 404 +HTTP_Method_Not_Allowed = 405 HTTP_Request_Timeout = 408 HTTP_Conflict = 409 HTTP_Not_Implemented = 501 -HTTP_Service_Unavailable = 503 -HTTP_Internal_Server_Error = 500 +HTTP_Service_Unavailable = 503 +HTTP_Internal_Server_Error = 500 class vimconnException(Exception): @@ -102,9 +102,9 @@ class vimconnNotImplemented(vimconnException): class vimconnector(): """Abstract base class for all the VIM connector plugins - These plugins must implement a vimconnector class derived from this + These plugins must implement a vimconnector class derived from this and all these privated methods - """ + """ def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None, config={}, persitent_info={}): """ @@ -141,7 +141,7 @@ class vimconnector(): self.logger.setLevel(getattr(logging, log_level)) if not self.url_admin: # try to use normal url self.url_admin = self.url - + def __getitem__(self, index): if index == 'tenant_id': return self.tenant_id @@ -163,7 +163,7 @@ class vimconnector(): return self.config else: raise KeyError("Invalid key '{}'".format(index)) - + def __setitem__(self, index, value): if index == 'tenant_id': self.tenant_id = value @@ -448,7 +448,7 @@ class vimconnector(): - name: interface name dedicated: yes|no|yes:sriov; for PT, SRIOV or only one SRIOV for the physical NIC bandwidth: X Gbps; requested guarantee bandwidth - vpci: requested virtual PCI address + vpci: requested virtual PCI address disk: disk size is_public: #TODO to concrete @@ -476,7 +476,7 @@ class vimconnector(): Returns the image_id or raises a vimconnNotFoundException """ raise vimconnNotImplemented("Should have implemented this") - + def get_image_list(self, filter_dict={}): """Obtain tenant images from VIM Filter_dict can be: @@ -546,11 +546,11 @@ class vimconnector(): as not present. """ raise vimconnNotImplemented( "Should have implemented this" ) - + def get_vminstance(self,vm_id): """Returns the VM instance information from VIM""" raise vimconnNotImplemented( "Should have implemented this" ) - + def delete_vminstance(self, vm_id, created_items=None): """ Removes a VM instance from VIM and its associated elements @@ -568,14 +568,14 @@ class vimconnector(): vm_id: #VIM id of this Virtual Machine status: #Mandatory. Text with one of: # DELETED (not found at vim) - # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) # OTHER (Vim reported other status not understood) # ERROR (VIM indicates an ERROR status) - # ACTIVE, PAUSED, SUSPENDED, INACTIVE (not running), + # ACTIVE, PAUSED, SUSPENDED, INACTIVE (not running), # BUILD (on building process), ERROR # ACTIVE:NoMgmtIP (Active but any of its interface has an IP address # - error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR vim_info: #Text with plain information obtained from vim (yaml.safe_dump) interfaces: list with interface info. Each item a dictionary with: vim_info: #Text with plain information obtained from vim (yaml.safe_dump) @@ -588,7 +588,7 @@ class vimconnector(): vlan: #physical VLAN used for VF """ raise vimconnNotImplemented( "Should have implemented this" ) - + def action_vminstance(self, vm_id, action_dict, created_items={}): """ Send and action over a VM instance. Returns created_items if the action was successfully sent to the VIM. @@ -602,20 +602,20 @@ class vimconnector(): :return: None, or a console dict """ raise vimconnNotImplemented( "Should have implemented this" ) - + def get_vminstance_console(self, vm_id, console_type="vnc"): """ Get a console for the virtual machine Params: vm_id: uuid of the VM console_type, can be: - "novnc" (by default), "xvpvnc" for VNC types, + "novnc" (by default), "xvpvnc" for VNC types, "rdp-html5" for RDP types, "spice-html5" for SPICE types Returns dict with the console parameters: protocol: ssh, ftp, http, https, ... - server: usually ip address - port: the http, ssh, ... port - suffix: extra text, e.g. the http path and query string + server: usually ip address + port: the http, ssh, ... port + suffix: extra text, e.g. the http path and query string """ raise vimconnNotImplemented( "Should have implemented this" ) @@ -731,6 +731,23 @@ class vimconnector(): """ raise vimconnNotImplemented( "SFC support not implemented" ) + def refresh_classifications_status(self, classification_list): + '''Get the status of the classifications + Params: the list of classification identifiers + Returns a dictionary with: + vm_id: #VIM id of this classifier + status: #Mandatory. Text with one of: + # DELETED (not found at vim) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # OTHER (Vim reported other status not understood) + # ERROR (VIM indicates an ERROR status) + # ACTIVE, + # CREATING (on building process) + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + vim_info: #Text with plain information obtained from vim (yaml.safe_dump) + ''' + raise vimconnNotImplemented("Should have implemented this") + def delete_classification(self, classification_id): """Deletes a classification from the VIM Returns the classification ID (classification_id) or raises an exception upon error or when classification is not found @@ -786,6 +803,23 @@ class vimconnector(): """ raise vimconnNotImplemented( "SFC support not implemented" ) + def refresh_sfis_status(self, sfi_list): + '''Get the status of the service function instances + Params: the list of sfi identifiers + Returns a dictionary with: + vm_id: #VIM id of this service function instance + status: #Mandatory. Text with one of: + # DELETED (not found at vim) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # OTHER (Vim reported other status not understood) + # ERROR (VIM indicates an ERROR status) + # ACTIVE, + # CREATING (on building process) + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + vim_info: #Text with plain information obtained from vim (yaml.safe_dump) + ''' + raise vimconnNotImplemented("Should have implemented this") + def new_sf(self, name, sfis, sfc_encap=True): """Creates (an abstract) service function in the VIM Params: @@ -833,6 +867,23 @@ class vimconnector(): """ raise vimconnNotImplemented( "SFC support not implemented" ) + def refresh_sfs_status(self, sf_list): + '''Get the status of the service functions + Params: the list of sf identifiers + Returns a dictionary with: + vm_id: #VIM id of this service function + status: #Mandatory. Text with one of: + # DELETED (not found at vim) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # OTHER (Vim reported other status not understood) + # ERROR (VIM indicates an ERROR status) + # ACTIVE, + # CREATING (on building process) + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + vim_info: #Text with plain information obtained from vim (yaml.safe_dump) + ''' + raise vimconnNotImplemented("Should have implemented this") + def new_sfp(self, name, classifications, sfs, sfc_encap=True, spi=None): """Creates a service function path Params: @@ -877,6 +928,23 @@ class vimconnector(): """ raise vimconnNotImplemented( "SFC support not implemented" ) + def refresh_sfps_status(self, sfp_list): + '''Get the status of the service function path + Params: the list of sfp identifiers + Returns a dictionary with: + vm_id: #VIM id of this service function path + status: #Mandatory. Text with one of: + # DELETED (not found at vim) + # VIM_ERROR (Cannot connect to VIM, VIM response error, ...) + # OTHER (Vim reported other status not understood) + # ERROR (VIM indicates an ERROR status) + # ACTIVE, + # CREATING (on building process) + error_msg: #Text with VIM error message, if any. Or the VIM connection ERROR + vim_info: #Text with plain information obtained from vim (yaml.safe_dump)F + ''' + raise vimconnNotImplemented("Should have implemented this") + def delete_sfp(self, sfp_id): """Deletes a service function path from the VIM Returns the sfp ID (sfp_id) or raises an exception upon error or when sf is not found @@ -908,19 +976,19 @@ class vimconnector(): def get_processor_rankings(self): """Get the processor rankings in the VIM database""" raise vimconnNotImplemented( "Should have implemented this" ) - + @deprecated def new_host(self, host_data): """Adds a new host to VIM""" """Returns status code of the VIM response""" raise vimconnNotImplemented( "Should have implemented this" ) - + @deprecated def new_external_port(self, port_data): """Adds a external port to VIM""" """Returns the port identifier""" raise vimconnNotImplemented( "Should have implemented this" ) - + @deprecated def new_external_network(self,net_name,net_type): """Adds a external network to VIM (shared)""" @@ -939,4 +1007,3 @@ class vimconnector(): """Adds a VM instance to VIM""" """Returns the instance identifier""" raise vimconnNotImplemented( "Should have implemented this" ) -