NS scenarios without VNFs compatibility
[osm/LCM.git] / osm_lcm / ROclient.py
index fe12f8b..73a1b13 100644 (file)
@@ -104,7 +104,7 @@ class ROClient:
     mandatory_for_create = {
         'tenant': ("name", ),
         'vnfd': ("name", "id", "connection-point", "vdu"),
-        'nsd': ("name", "id", "constituent-vnfd"),
+        'nsd': ("name", "id"),
         'ns': ("name", "scenario", "datacenter"),
         'vim': ("name", "vim_url"),
         'vim_account': (),
@@ -206,7 +206,7 @@ class ROClient:
         try:
             UUID(uuid_text)
             return True
-        except (ValueError, TypeError):
+        except Exception:
             return False
 
     @staticmethod
@@ -693,7 +693,14 @@ class ROClient:
                 all_tenants = None
 
             with aiohttp.ClientSession(loop=self.loop) as session:
-                return await self._del_item(session, self.client_to_RO[item], item_id_name, all_tenants=all_tenants)
+                result = await self._del_item(session, self.client_to_RO[item], item_id_name, all_tenants=all_tenants)
+                # in case of ns delete, get the action_id embeded in text
+                if item == "ns" and result.get("result"):
+                    _, _, action_id = result["result"].partition("action_id=")
+                    action_id, _, _ = action_id.partition(" ")
+                    if action_id:
+                        result["action_id"] = action_id
+                return result
         except aiohttp.errors.ClientOSError as e:
             raise ROClientException(e, http_code=504)
         except asyncio.TimeoutError: