Feature 10983: changes to migrate() function so that it can handle both VNF and KNF migration
Change-Id: Ic1cbc0db3492c15fe7bfb3c82cbdd47195a814d6
Signed-off-by: Pedro Pereira <pedrocjdpereira@av.it.pt>
diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py
index ccfda6d..5d3c911 100644
--- a/osm_lcm/ns.py
+++ b/osm_lcm/ns.py
@@ -7979,17 +7979,23 @@
target = {}
target.update(migrate_params)
- desc = await self.RO.migrate(nsr_id, target)
- self.logger.debug("RO return > {}".format(desc))
- action_id = desc["action_id"]
- await self._wait_ng_ro(
- nsr_id,
- action_id,
- nslcmop_id,
- start_deploy,
- self.timeout.migrate,
- operation="migrate",
- )
+
+ if "migrateToHost" in target:
+ desc = await self.RO.migrate(nsr_id, target)
+ self.logger.debug("RO return > {}".format(desc))
+ action_id = desc["action_id"]
+ await self._wait_ng_ro(
+ nsr_id,
+ action_id,
+ nslcmop_id,
+ start_deploy,
+ self.timeout.migrate,
+ operation="migrate",
+ )
+
+ elif "targetHostK8sLabels" in target:
+ await self.k8sclusterhelm3.migrate(nsr_id, target)
+
except (ROclient.ROClientException, DbException, LcmException) as e:
self.logger.error("Exit Exception {}".format(e))
exc = e