some minor fixes 03/6203/3
authortierno <alfonso.tiernosepulveda@telefonica.com>
Thu, 24 May 2018 16:05:28 +0000 (18:05 +0200)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 25 May 2018 14:09:52 +0000 (16:09 +0200)
Change-Id: I58730de0d8577518a4f434ae51eeb8bc0402a691
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osm_nbi/engine.py
osm_nbi/nbi.py

index c13240d..b5989c0 100644 (file)
@@ -949,10 +949,8 @@ class Engine(object):
             self.db.del_list("vnfrs", {"nsr-id-ref": _id})
             self.msg.write("ns", "deleted", {"_id": _id})
             return v
-        if item in ("vim_accounts", "sdns"):
-            desc = self.db.get_one(item, filter)
-            desc["_admin"]["to_delete"] = True
-            self.db.replace(item, _id, desc)   # TODO change to set_one
+        if item in ("vim_accounts", "sdns") and not force:
+            self.db.set_one(item, {"_id": _id}, {"_admin.to_delete": True})   # TODO change status
             if item == "vim_accounts":
                 self.msg.write("vim_account", "delete", {"_id": _id})
             elif item == "sdns":
@@ -960,7 +958,10 @@ class Engine(object):
             return {"deleted": 1}  # TODO indicate an offline operation to return 202 ACCEPTED
 
         v = self.db.del_one(item, filter)
-        self.fs.file_delete(_id, ignore_non_exist=True)
+        if item in ("vnfds", "nsds"):
+            self.fs.file_delete(_id, ignore_non_exist=True)
+        if item in ("vim_accounts", "sdns", "vnfds", "nsds"):
+            self.msg.write(item[:-1], "deleted", {"_id": _id})
         return v
 
     def prune(self):
index ff8cd11..fefb3e9 100644 (file)
@@ -59,7 +59,7 @@ URL: /osm                                                       GET     POST
             /ns_instances_content                               O       O
                 /<nsInstanceId>                                 O                       O
             /ns_instances                                       5       5
-                /<nsInstanceId>                                 5                       5
+                /<nsInstanceId>                                 O5                      O5
                     instantiate                                         O5
                     terminate                                           O5
                     action                                              O
@@ -215,7 +215,7 @@ class Server(object):
                                              "<ID>": {"METHODS": ("GET", "DELETE")}
                                              },
                     "ns_instances": {"METHODS": ("GET", "POST"),
-                                     "<ID>": {"TODO": ("GET", "DELETE"),
+                                     "<ID>": {"METHODS": ("GET", "DELETE"),
                                               "scale": {"TODO": "POST"},
                                               "terminate": {"METHODS": "POST"},
                                               "instantiate": {"METHODS": "POST"},