Feature 11073: Enhanced OSM declarative modelling for applications. App as first class citizen

Change-Id: Id4b4b188e02000f8df033d8851394314c3795762
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py
index 2cddabb..09ae05d 100644
--- a/osm_nbi/nbi.py
+++ b/osm_nbi/nbi.py
@@ -815,6 +815,22 @@
             },
         }
     },
+    "appinstance": {
+        "v1": {
+            "appinstances": {
+                "METHODS": ("GET", "POST"),
+                "ROLE_PERMISSION": "appinstance:",
+                "<ID>": {
+                    "METHODS": ("GET", "PATCH", "DELETE"),
+                    "ROLE_PERMISSION": "appinstance:id:",
+                },
+                "update": {
+                    "METHODS": ("POST",),
+                    "ROLE_PERMISSION": "appinstance:",
+                },
+            },
+        }
+    },
     "oka": {
         "v1": {
             "oka_packages": {
@@ -1662,6 +1678,7 @@
                 "vnflcm",
                 "k8scluster",
                 "ksu",
+                "appinstance",
                 "oka",
             ):
                 raise NbiException(
@@ -1748,6 +1765,8 @@
                     engine_topic = "node_groups"
             elif main_topic == "ksu" and engine_topic in ("ksus", "clone", "move"):
                 engine_topic = "ksus"
+            elif main_topic == "appinstance":
+                engine_topic = "appinstances"
             if (
                 engine_topic == "vims"
             ):  # TODO this is for backward compatibility, it will be removed in the future
@@ -2080,6 +2099,11 @@
                         engine_session, engine_topic, _id, indata, kwargs
                     )
                     outdata = {"op_id": op_id}
+                elif topic == "appinstances" and item == "update":
+                    op_id = self.engine.update_appinstance(
+                        engine_session, engine_topic, _id, indata, kwargs
+                    )
+                    outdata = {"op_id": op_id}
                 elif topic == "clusters" and item in ("upgrade", "scale"):
                     op_id = self.engine.update_item(
                         engine_session, engine_topic, _id, item, indata