11f09a3fbb3aa7e5f74491c4cea6ef9f0b53ea10
[ric-plt/rtmgr.git] / api / routing_manager.yaml
1 #
2 #==================================================================================
3 #   Copyright (c) 2019 AT&T Intellectual Property.
4 #   Copyright (c) 2019 Nokia
5 #
6 #   Licensed under the Apache License, Version 2.0 (the "License");
7 #   you may not use this file except in compliance with the License.
8 #   You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #   Unless required by applicable law or agreed to in writing, software
13 #   distributed under the License is distributed on an "AS IS" BASIS,
14 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #   See the License for the specific language governing permissions and
16 #   limitations under the License.
17 #==================================================================================
18 #
19 #
20 #   Abstract:   Routing Manager's RESTful API definition
21 #   Date:       29 March 2019
22 #
23 swagger: "2.0"
24 info:
25   title: Routing Manager
26   description: "This is the Swagger/OpenAPI 2.0 definition of Routing Manager's Northbound API."
27   version: "0.2.2"
28   license:
29     name: "Apache 2.0"
30     url: "http://www.apache.org/licenses/LICENSE-2.0.html"
31 host: "rtmgr"
32 basePath: "/v1"
33 tags:
34 - name: "handle"
35   description: "Available handles"
36 #  externalDocs:
37 #    description: "Find out more"
38 #    url: "http://127.0.0.1"
39 - name: "route"
40   description: "Available routes"
41 - name: "health"
42   description: "Health of the system"
43 schemes:
44 - "https"
45 - "http"
46 paths:
47   /health:
48     get:
49       tags:
50       - "health"
51       summary: "Retrive the health of Routing Manager"
52       description: "By performing a GET method on the health resource, the API caller is able to retrieve the health of Routing Manager"
53       operationId: "get_health"
54       consumes:
55       - "application/json"
56 #      - "application/yaml"
57       produces:
58       - "application/json"
59 #      - "application/yaml"
60       responses:
61         200:
62           description: "The health of the system"
63           schema:
64             "$ref": "#/definitions/health-status"
65   /handles:
66     get:
67       tags:
68       - "handle"
69       summary: "Placeholder for further usage"
70       description: "Placeholder for further usage."
71       operationId: "get_handles"
72       consumes:
73       - "application/json"
74 #      - "application/yaml"
75       produces:
76       - "application/json"
77 #      - "application/yaml"
78       responses:
79         200:
80           description: "Dummy response"
81   /handles/xapp-handle:
82     post:
83       tags:
84       - "handle"
85       summary: "Provide callback"
86       description: "By performing a POST method on the xapp-handle resource, the API caller is able to perform a callback on Routing Manager."
87       operationId: "provide_xapp_handle"
88       consumes:
89       - "application/json"
90 #      - "application/yaml"
91       produces:
92       - "application/json"
93 #      - "application/yaml"
94       parameters:
95       - in: "body"
96         name: "xapp-callback-data"
97         description: "xApp related callback data"
98         required: true
99         schema:
100           $ref: "#/definitions/xapp-callback-data"
101       responses:
102         400:
103           description: "Invalid data"
104         201:
105           description: "Callback received"
106   /routes:
107     post:
108       tags:
109       - "route"
110       summary: "Add new route"
111       description: "By performing a POST method on the routes resource, the API caller is able to create a new route."
112       operationId: "add_route"
113       consumes:
114       - "application/json"
115 #      - "application/yaml"
116       produces:
117       - "application/json"
118 #      - "application/yaml"
119       parameters:
120       - in: "body"
121         name: "route"
122         description: "Route object that needs to be created"
123         required: true
124         schema:
125           $ref: "#/definitions/route"
126       responses:
127         400:
128           description: "Invalid route"
129         201:
130           description: "Route created"
131     put:
132       tags:
133       - "route"
134       summary: "Update an existing route"
135       description: "By performing a PUT method on the routes resource, the API caller is able to update an already existing route."
136       operationId: "update_route"
137       consumes:
138       - "application/json"
139 #      - "application/yaml"
140       produces:
141       - "application/json"
142 #      - "application/yaml"
143       parameters:
144       - in: "body"
145         name: "route"
146         description: "Route object that needs to be updated or created"
147         required: true
148         schema:
149           $ref: "#/definitions/route"
150       responses:
151         400:
152           description: "Invalid route ID supplied"
153         404:
154           description: "Route not found"
155         204:
156           description: "Route updated"
157     get:
158       tags:
159       - "route"
160       summary: "Retrieve the list of routes"
161       description: "By performing a GET method on the routes resource, the API caller is able to retrieve all routes"
162       operationId: "get_routes"
163       consumes:
164       - "application/json"
165 #      - "application/yaml"
166       produces:
167       - "application/json"
168 #      - "application/yaml"
169       responses:
170         200:
171           description: "All the routes"
172           schema:
173             $ref: "#/definitions/routes"
174
175   /routes/{route-id}:
176     get:
177       tags:
178       - "route"
179       summary: "Find route by ID"
180       description: "Returns a single route"
181       operationId: "get_route_by_id"
182       produces:
183       - "application/json"
184       parameters:
185       - name: "route-id"
186         in: "path"
187         description: "ID of route to return"
188         required: true
189         type: "integer"
190         format: "int64"
191       responses:
192         200:
193           description: "successful operation"
194           schema:
195             $ref: "#/definitions/route"
196         400:
197           description: "Invalid route ID supplied"
198         404:
199           description: "Route not found"
200     put:
201       tags:
202       - "route"
203       summary: "Updates a route by explicitly referencing it by route-id"
204       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"
205       operationId: "update-route-by-id"
206       consumes:
207       - "application/json"
208 #      - "application/yaml"
209       produces:
210       - "application/json"
211 #      - "application/yaml"
212       parameters:
213       - name: "route-id"
214         in: "path"
215         description: "ID of route that needs to be updated"
216         required: true
217         type: "integer"
218         format: "int64"
219       - name: "route"
220         in: "body"
221         description: "The updated route instance"
222         required: false
223         schema:
224           $ref: "#/definitions/route"
225       responses:
226         400:
227           description: "Invalid route ID supplied"
228         204:
229           description: "Route updated"
230     delete:
231       tags:
232       - "route"
233       summary: "Deletes a route"
234       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"
235       operationId: "delete_route_by_id"
236       produces:
237       - "application/json"
238 #      - "application/yaml"
239       parameters:
240       - name: "route-id"
241         in: "path"
242         description: "ID of the route that needs to be deleted"
243         required: true
244         type: "integer"
245         format: "int64"
246       responses:
247         400:
248           description: "Invalid route ID supplied"
249         404:
250           description: "Route not found"
251         204:
252           description: "Route deleted"
253 definitions:
254   health-status:
255     type: "object"
256     properties:
257       status:
258         type: string
259         enum:
260         - healthy
261         - unhealthy
262   routes:
263     type: "array"
264     items:
265         $ref: "#/definitions/route"
266   route:
267     type: "object"
268     required:
269     - "id" # not so sure about that
270     properties:
271       id:
272         type: "integer"
273         format: "int64"
274       senders:
275         type: "array"
276         items:
277           "$ref": "#/definitions/xapp-instance"
278       message-type:
279         type: "integer"
280         format: "int64"
281       receiver-groups:
282         type: "array"
283         items:
284           "$ref": "#/definitions/xapp-group"
285   xapp-instance:
286     type: "object"
287     required:
288     - "address"
289     - "port"
290     properties:
291       address:
292         type: "string" # I know...
293       port:
294         type: "integer"
295         format: "int32"
296         minimum: 0
297         maximum: 65535
298   xapp-group:
299     type: "array"
300     items:
301       "$ref": "#/definitions/xapp-instance"
302   xapp-callback-data:
303     type: "object"
304     properties:
305       id:
306         type: "integer"
307         format: "int64"
308       event:
309         type: "string"
310       data-version:
311         type: "integer"
312         format: "int64"
313       data:
314         type: "string" #This should be a JSON object, array of xapps
315 externalDocs:
316   description: "Routing Manager"
317   url: "http://placeholder"