X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fvim_sdn.py;h=588aba1c7e16f8cc21ce7c7a94b6b9270ca17eaf;hb=refs%2Fchanges%2F16%2F13216%2F2;hp=41a16e5229bc2844d31add77151fd0f04c1d1cdd;hpb=8e53c6d0046a3015bf015b745aa3cf9a30a8fbe6;p=osm%2FLCM.git diff --git a/osm_lcm/vim_sdn.py b/osm_lcm/vim_sdn.py index 41a16e5..588aba1 100644 --- a/osm_lcm/vim_sdn.py +++ b/osm_lcm/vim_sdn.py @@ -61,7 +61,6 @@ class VimLcm(LcmBase): super().__init__(msg, self.logger) async def create(self, vim_content, order_id): - # HA tasks and backward compatibility: # If 'vim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, 'op_id' is None, and lock_HA() will do nothing. @@ -214,7 +213,6 @@ class VimLcm(LcmBase): self.lcm_tasks.remove("vim_account", vim_id, order_id) async def edit(self, vim_content, order_id): - # HA tasks and backward compatibility: # If 'vim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, and the HA check always returns True @@ -370,7 +368,6 @@ class VimLcm(LcmBase): self.lcm_tasks.remove("vim_account", vim_id, order_id) async def delete(self, vim_content, order_id): - # HA tasks and backward compatibility: # If 'vim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, and the HA check always returns True @@ -483,7 +480,6 @@ class WimLcm(LcmBase): super().__init__(msg, self.logger) async def create(self, wim_content, order_id): - # HA tasks and backward compatibility: # If 'wim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, 'op_id' is None, and lock_HA() will do nothing. @@ -600,7 +596,6 @@ class WimLcm(LcmBase): self.lcm_tasks.remove("wim_account", wim_id, order_id) async def edit(self, wim_content, order_id): - # HA tasks and backward compatibility: # If 'wim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, and the HA check always returns True @@ -628,7 +623,6 @@ class WimLcm(LcmBase): and db_wim["_admin"].get("deployed") and db_wim["_admin"]["deployed"].get("RO") ): - RO_wim_id = db_wim["_admin"]["deployed"]["RO"] step = "Editing wim at RO" RO = ROclient.ROClient(self.loop, **self.ro_config) @@ -721,7 +715,6 @@ class WimLcm(LcmBase): self.lcm_tasks.remove("wim_account", wim_id, order_id) async def delete(self, wim_content, order_id): - # HA tasks and backward compatibility: # If 'vim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, and the HA check always returns True @@ -831,7 +824,6 @@ class SdnLcm(LcmBase): super().__init__(msg, self.logger) async def create(self, sdn_content, order_id): - # HA tasks and backward compatibility: # If 'sdn_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, 'op_id' is None, and lock_HA() will do nothing. @@ -912,7 +904,6 @@ class SdnLcm(LcmBase): self.lcm_tasks.remove("sdn", sdn_id, order_id) async def edit(self, sdn_content, order_id): - # HA tasks and backward compatibility: # If 'sdn_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, and the HA check always returns True @@ -994,7 +985,6 @@ class SdnLcm(LcmBase): self.lcm_tasks.remove("sdn", sdn_id, order_id) async def delete(self, sdn_content, order_id): - # HA tasks and backward compatibility: # If 'vim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, and the HA check always returns True @@ -1127,7 +1117,6 @@ class K8sClusterLcm(LcmBase): } async def create(self, k8scluster_content, order_id): - op_id = k8scluster_content.pop("op_id", None) if not self.lcm_tasks.lock_HA("k8scluster", "create", op_id): return @@ -1299,8 +1288,33 @@ class K8sClusterLcm(LcmBase): self.logger.error(logging_text + "Cannot update database: {}".format(e)) self.lcm_tasks.remove("k8scluster", k8scluster_id, order_id) - async def delete(self, k8scluster_content, order_id): + async def edit(self, k8scluster_content, order_id): + op_id = k8scluster_content.pop("op_id", None) + if not self.lcm_tasks.lock_HA("k8scluster", "edit", op_id): + return + + k8scluster_id = k8scluster_content["_id"] + logging_text = "Task k8scluster_edit={} ".format(k8scluster_id) + self.logger.debug(logging_text + "Enter") + + # TODO the implementation is pending and will be part of a new feature + # It will support rotation of certificates, update of credentials and K8S API endpoint + # At the moment the operation is set as completed + + operation_state = "COMPLETED" + operation_details = "Not implemented" + + self.lcm_tasks.unlock_HA( + "k8scluster", + "edit", + op_id, + operationState=operation_state, + detailed_status=operation_details, + ) + self.lcm_tasks.remove("k8scluster", k8scluster_id, order_id) + + async def delete(self, k8scluster_content, order_id): # HA tasks and backward compatibility: # If 'vim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, 'op_id' is None, and lock_HA() will do nothing. @@ -1352,7 +1366,7 @@ class K8sClusterLcm(LcmBase): db_k8scluster_update["_admin.helm-chart.operationalState"] = "DISABLED" if k8s_h3c_id: - step = "Removing helm-chart-v3 '{}'".format(k8s_hc_id) + step = "Removing helm-chart-v3 '{}'".format(k8s_h3c_id) uninstall_sw = ( deep_get(db_k8scluster, ("_admin", "helm-chart-v3", "created")) or False @@ -1619,7 +1633,6 @@ class VcaLcm(LcmBase): self.lcm_tasks.remove("vca", vca_id, order_id) async def delete(self, vca_content, order_id): - # HA tasks and backward compatibility: # If "vim_content" does not include "op_id", we a running a legacy NBI version. # In such a case, HA is not supported by NBI, "op_id" is None, and lock_HA() will do nothing. @@ -1698,7 +1711,6 @@ class K8sRepoLcm(LcmBase): ) async def create(self, k8srepo_content, order_id): - # HA tasks and backward compatibility: # If 'vim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, 'op_id' is None, and lock_HA() will do nothing. @@ -1763,7 +1775,6 @@ class K8sRepoLcm(LcmBase): self.lcm_tasks.remove("k8srepo", k8srepo_id, order_id) async def delete(self, k8srepo_content, order_id): - # HA tasks and backward compatibility: # If 'vim_content' does not include 'op_id', we a running a legacy NBI version. # In such a case, HA is not supported by NBI, 'op_id' is None, and lock_HA() will do nothing.