Seed code for Routing Manager (ric-plt/rtmgr).
[ric-plt/rtmgr.git] / api / routing_manager.yaml
diff --git a/api/routing_manager.yaml b/api/routing_manager.yaml
new file mode 100644 (file)
index 0000000..11f09a3
--- /dev/null
@@ -0,0 +1,317 @@
+#
+#==================================================================================
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#   Copyright (c) 2019 Nokia
+#
+#   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.
+#==================================================================================
+#
+#
+#   Abstract:   Routing Manager's RESTful API definition
+#   Date:      29 March 2019
+#
+swagger: "2.0"
+info:
+  title: Routing Manager
+  description: "This is the Swagger/OpenAPI 2.0 definition of Routing Manager's Northbound API."
+  version: "0.2.2"
+  license:
+    name: "Apache 2.0"
+    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
+host: "rtmgr"
+basePath: "/v1"
+tags:
+- name: "handle"
+  description: "Available handles"
+#  externalDocs:
+#    description: "Find out more"
+#    url: "http://127.0.0.1"
+- name: "route"
+  description: "Available routes"
+- name: "health"
+  description: "Health of the system"
+schemes:
+- "https"
+- "http"
+paths:
+  /health:
+    get:
+      tags:
+      - "health"
+      summary: "Retrive the health of Routing Manager"
+      description: "By performing a GET method on the health resource, the API caller is able to retrieve the health of Routing Manager"
+      operationId: "get_health"
+      consumes:
+      - "application/json"
+#      - "application/yaml"
+      produces:
+      - "application/json"
+#      - "application/yaml"
+      responses:
+        200:
+          description: "The health of the system"
+          schema:
+            "$ref": "#/definitions/health-status"
+  /handles:
+    get:
+      tags:
+      - "handle"
+      summary: "Placeholder for further usage"
+      description: "Placeholder for further usage."
+      operationId: "get_handles"
+      consumes:
+      - "application/json"
+#      - "application/yaml"
+      produces:
+      - "application/json"
+#      - "application/yaml"
+      responses:
+        200:
+          description: "Dummy response"
+  /handles/xapp-handle:
+    post:
+      tags:
+      - "handle"
+      summary: "Provide callback"
+      description: "By performing a POST method on the xapp-handle resource, the API caller is able to perform a callback on Routing Manager."
+      operationId: "provide_xapp_handle"
+      consumes:
+      - "application/json"
+#      - "application/yaml"
+      produces:
+      - "application/json"
+#      - "application/yaml"
+      parameters:
+      - in: "body"
+        name: "xapp-callback-data"
+        description: "xApp related callback data"
+        required: true
+        schema:
+          $ref: "#/definitions/xapp-callback-data"
+      responses:
+        400:
+          description: "Invalid data"
+        201:
+          description: "Callback received"
+  /routes:
+    post:
+      tags:
+      - "route"
+      summary: "Add new route"
+      description: "By performing a POST method on the routes resource, the API caller is able to create a new route."
+      operationId: "add_route"
+      consumes:
+      - "application/json"
+#      - "application/yaml"
+      produces:
+      - "application/json"
+#      - "application/yaml"
+      parameters:
+      - in: "body"
+        name: "route"
+        description: "Route object that needs to be created"
+        required: true
+        schema:
+          $ref: "#/definitions/route"
+      responses:
+        400:
+          description: "Invalid route"
+        201:
+          description: "Route created"
+    put:
+      tags:
+      - "route"
+      summary: "Update an existing route"
+      description: "By performing a PUT method on the routes resource, the API caller is able to update an already existing route."
+      operationId: "update_route"
+      consumes:
+      - "application/json"
+#      - "application/yaml"
+      produces:
+      - "application/json"
+#      - "application/yaml"
+      parameters:
+      - in: "body"
+        name: "route"
+        description: "Route object that needs to be updated or created"
+        required: true
+        schema:
+          $ref: "#/definitions/route"
+      responses:
+        400:
+          description: "Invalid route ID supplied"
+        404:
+          description: "Route not found"
+        204:
+          description: "Route updated"
+    get:
+      tags:
+      - "route"
+      summary: "Retrieve the list of routes"
+      description: "By performing a GET method on the routes resource, the API caller is able to retrieve all routes"
+      operationId: "get_routes"
+      consumes:
+      - "application/json"
+#      - "application/yaml"
+      produces:
+      - "application/json"
+#      - "application/yaml"
+      responses:
+        200:
+          description: "All the routes"
+          schema:
+            $ref: "#/definitions/routes"
+
+  /routes/{route-id}:
+    get:
+      tags:
+      - "route"
+      summary: "Find route by ID"
+      description: "Returns a single route"
+      operationId: "get_route_by_id"
+      produces:
+      - "application/json"
+      parameters:
+      - name: "route-id"
+        in: "path"
+        description: "ID of route to return"
+        required: true
+        type: "integer"
+        format: "int64"
+      responses:
+        200:
+          description: "successful operation"
+          schema:
+            $ref: "#/definitions/route"
+        400:
+          description: "Invalid route ID supplied"
+        404:
+          description: "Route not found"
+    put:
+      tags:
+      - "route"
+      summary: "Updates a route by explicitly referencing it by route-id"
+      description: "By performing a PUT method on a specific route referenced by the route-id the API caller is able to update that specific route"
+      operationId: "update-route-by-id"
+      consumes:
+      - "application/json"
+#      - "application/yaml"
+      produces:
+      - "application/json"
+#      - "application/yaml"
+      parameters:
+      - name: "route-id"
+        in: "path"
+        description: "ID of route that needs to be updated"
+        required: true
+        type: "integer"
+        format: "int64"
+      - name: "route"
+        in: "body"
+        description: "The updated route instance"
+        required: false
+        schema:
+          $ref: "#/definitions/route"
+      responses:
+        400:
+          description: "Invalid route ID supplied"
+        204:
+          description: "Route updated"
+    delete:
+      tags:
+      - "route"
+      summary: "Deletes a route"
+      description: "By performing a DELETE method on a specific route referenced by the route-id, the API caller is able to delete that specific route"
+      operationId: "delete_route_by_id"
+      produces:
+      - "application/json"
+#      - "application/yaml"
+      parameters:
+      - name: "route-id"
+        in: "path"
+        description: "ID of the route that needs to be deleted"
+        required: true
+        type: "integer"
+        format: "int64"
+      responses:
+        400:
+          description: "Invalid route ID supplied"
+        404:
+          description: "Route not found"
+        204:
+          description: "Route deleted"
+definitions:
+  health-status:
+    type: "object"
+    properties:
+      status:
+        type: string
+        enum:
+        - healthy
+        - unhealthy
+  routes:
+    type: "array"
+    items:
+        $ref: "#/definitions/route"
+  route:
+    type: "object"
+    required:
+    - "id" # not so sure about that
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      senders:
+        type: "array"
+        items:
+          "$ref": "#/definitions/xapp-instance"
+      message-type:
+        type: "integer"
+        format: "int64"
+      receiver-groups:
+        type: "array"
+        items:
+          "$ref": "#/definitions/xapp-group"
+  xapp-instance:
+    type: "object"
+    required:
+    - "address"
+    - "port"
+    properties:
+      address:
+        type: "string" # I know...
+      port:
+        type: "integer"
+        format: "int32"
+        minimum: 0
+        maximum: 65535
+  xapp-group:
+    type: "array"
+    items:
+      "$ref": "#/definitions/xapp-instance"
+  xapp-callback-data:
+    type: "object"
+    properties:
+      id:
+        type: "integer"
+        format: "int64"
+      event:
+        type: "string"
+      data-version:
+        type: "integer"
+        format: "int64"
+      data:
+        type: "string" #This should be a JSON object, array of xapps
+externalDocs:
+  description: "Routing Manager"
+  url: "http://placeholder"