[PMSH] Adding new endpoint to api docs 01/108101/3
authorefiacor <fiachra.corcoran@est.tech>
Thu, 21 May 2020 15:04:56 +0000 (16:04 +0100)
committerefiacor <fiachra.corcoran@est.tech>
Mon, 25 May 2020 10:00:48 +0000 (11:00 +0100)
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: I97cea22d68155d58462ab801b022890c11790587
Issue-ID: DCAEGEN2-2154

docs/sections/apis/PMSH.rst
docs/sections/apis/pmsh_swagger.json [new file with mode: 0644]
docs/sections/apis/pmsh_swagger.yml [new file with mode: 0644]

index 221c3c1..019e4ce 100644 (file)
@@ -15,9 +15,86 @@ Component description can be found under `PM Subscription Handler`_.
 
 .. _PM Subscription Handler: ../../sections/services/pm-subscription-handler/index.html
 
+.. csv-table::
+   :header: "API name", "Swagger JSON", "Swagger YAML"
+   :widths: 10,5,5
+
+   "PM Subscription Handler Service", ":download:`link <pmsh_swagger.json>`", ":download:`link <pmsh_swagger.yaml>`"
+
 Paths
 =====
 
+GET ``/subscriptions``
+----------------------
+
+Description
+~~~~~~~~~~~
+Retrieves all defined Subscriptions and their related Network Functions from ONAP.
+
+Responses
+~~~~~~~~~
+
+**200**
+^^^^^^^
+
+The Subscription details are returned successfully
+
+**Example:**
+
+.. code-block:: javascript
+
+   [
+     {
+       "network_functions": [
+         {
+           "nf_name": "pnf102",
+           "nf_sub_status": "PENDING_CREATE",
+           "orchestration_status": "Active"
+         },
+         {
+           "nf_name": "vnf101",
+           "nf_sub_status": "CREATED",
+           "orchestration_status": "Active"
+         }
+       ],
+       "subscription_name": "demo-subscription",
+       "subscription_status": "UNLOCKED"
+     }
+   ]
+
+The subscription_status refers to the administrative status of the subscription.
+
+.. csv-table:: Potential Values
+   :header: "Status", "Description"
+   :widths: 2,4
+
+   LOCKED, The Subscription is un-deploying / inactive.
+   UNLOCKED, The Subscription is deployed / active.
+
+
+The network_functions.orchestration_status refers to the status of the xNF in AAI ONAP.
+
+.. csv-table:: Potential Values
+   :header: "Status", "Description"
+   :widths: 4,18
+
+   Inventoried, The xNF has been on-boarded in ONAP but not yet operable.
+   Active, The xNF is active and contactable.
+
+
+The network_functions.nf_sub_status refers to the status of the subscription (PM Job) on the xNF.
+
+.. csv-table:: Potential Values
+   :header: "Status", "Description"
+   :widths: 5,16
+
+    PENDING_CREATE, Create event published to Policy topic. Awaiting response.
+    CREATE_FAILED, Subscription failed to be created on the xNF.
+    CREATED, Subscription created successfully on the xNF.
+    PENDING_DELETE, Delete event published to Poilcy topic. Awaiting response.
+    DELETE_FAILED, Subscription deletion failed to be applied on the xNF.
+
+
 GET ``/healthcheck``
 --------------------
 
@@ -29,8 +106,7 @@ If anything other than a 200, the server is either dead or no connection to PMSH
 Responses
 ~~~~~~~~~
 
-+-----------+---------------------+
-| HTTP Code | Description         |
-+===========+=====================+
-| **200**   | successful response |
-+-----------+---------------------+
+**200**
+^^^^^^^
+
+The PMSH instance is running
diff --git a/docs/sections/apis/pmsh_swagger.json b/docs/sections/apis/pmsh_swagger.json
new file mode 100644 (file)
index 0000000..59be876
--- /dev/null
@@ -0,0 +1,103 @@
+{
+  "swagger": "2.0",
+  "info": {
+    "title": "PM Subscription Handler Service",
+    "version": "1.1.0",
+    "description": "PM subscription handler enables control of performance management jobs on network functions in ONAP"
+  },
+  "produces": [
+    "application/json"
+  ],
+  "basePath": "/",
+  "schemes": [
+    "https"
+  ],
+  "paths": {
+    "/subscriptions": {
+      "get": {
+        "description": "Get all defined Subscriptions and their related Network Functions from ONAP.",
+        "operationId": "mod.api.controller.get_all_sub_to_nf_relations",
+        "responses": {
+          "200": {
+            "description": "OK; Array of subscriptions are returned as an object",
+            "schema": {
+              "type": "array",
+              "items": {
+                "type": "object",
+                "properties": {
+                  "subscription_name": {
+                    "type": "string",
+                    "description": "Name of the Subscription"
+                  },
+                  "subscription_status": {
+                    "type": "string",
+                    "description": "Status of the Subscription"
+                  },
+                  "network_functions": {
+                    "type": "array",
+                    "items": {
+                      "type": "object",
+                      "properties": {
+                        "nf_name": {
+                          "type": "string",
+                          "description": "Name of the Network Function"
+                        },
+                        "nf_sub_status": {
+                          "type": "string",
+                          "description": "Status of the Subscription on the Network Function"
+                        },
+                        "orchestration_status": {
+                          "type": "string",
+                          "description": "Orchestration status of the Network Function"
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "401": {
+            "description": "Unauthorized"
+          },
+          "403": {
+            "description": "Forbidden"
+          },
+          "404": {
+            "description": "there are no subscriptions defined"
+          }
+        }
+      }
+    },
+    "/healthcheck": {
+      "get": {
+        "operationId": "mod.api.controller.status",
+        "tags": [
+          "HealthCheck"
+        ],
+        "description": "This is the health check endpoint. If this returns a 200, the server is alive.",
+        "responses": {
+          "200": {
+            "description": "Successful response",
+            "schema": {
+              "type": "object",
+              "properties": {
+                "status": {
+                  "type": "string",
+                  "description": "Overall health of PMSH",
+                  "enum": [
+                    "healthy",
+                    "unhealthy"
+                  ]
+                }
+              }
+            }
+          },
+          "503": {
+            "description": "the pmsh service is unavailable"
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/docs/sections/apis/pmsh_swagger.yml b/docs/sections/apis/pmsh_swagger.yml
new file mode 100644 (file)
index 0000000..58e6a78
--- /dev/null
@@ -0,0 +1,89 @@
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2020 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+swagger: "2.0"
+info:
+  title: PM Subscription Handler Service
+  version: "1.1.0"
+  description: PM subscription handler enables control of performance management jobs on network functions in ONAP
+produces:
+  - "application/json"
+basePath: "/"
+schemes:
+  - https
+# Paths supported by the server application
+paths:
+  /subscriptions:
+    get:
+      description: >-
+        Get all defined Subscriptions and their related Network Functions from ONAP.
+      operationId: mod.api.controller.get_all_sub_to_nf_relations
+      responses:
+        200:
+          description: OK; Array of subscriptions are returned as an object
+          schema:
+            type: array
+            items:
+              type: object
+              properties:
+                subscription_name:
+                  type: string
+                  description: Name of the Subscription
+                subscription_status:
+                  type: string
+                  description: Status of the Subscription
+                network_functions:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      nf_name:
+                        type: string
+                        description: Name of the Network Function
+                      nf_sub_status:
+                        type: string
+                        description: Status of the Subscription on the Network Function
+                      orchestration_status:
+                        type: string
+                        description: Orchestration status of the Network Function
+        401:
+          description: Unauthorized
+        403:
+          description: Forbidden
+        404:
+          description: there are no subscriptions defined
+
+  /healthcheck:
+    get:
+      operationId: mod.api.controller.status
+      tags:
+        - "HealthCheck"
+      description: >-
+        This is the health check endpoint. If this returns a 200, the server is alive.
+      responses:
+        200:
+          description: Successful response
+          schema:
+            type: object
+            properties:
+              status:
+                type: string
+                description: Overall health of PMSH
+                enum: [healthy, unhealthy]
+        503:
+          description: the pmsh service is unavailable