Merge "Handle null orchestration-status"
[externalapi/nbi.git] / docs / offeredapis / offeredapis.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2    International License.
3 .. http://creativecommons.org/licenses/by/4.0
4 .. Copyright 2018 ORANGE
5
6
7 ============
8 Offered APIs
9 ============
10 ************
11 Introduction
12 ************
13
14 NBI stands for NorthBound Interface. It brings to ONAP a set of API that can
15 be used by external systems as BSS for example. These API are based on
16 **TMF API**.
17
18 **********************************************
19 Global NBI architecture for Dublin release
20 **********************************************
21
22 Following illustration provides a global view about **NBI** architecture,
23 integration with other ONAP components and API resource/operation provided.
24
25 .. image:: ../images/onap_nbi_dublin.jpg
26    :width: 800px
27
28 ***********
29 API Version
30 ***********
31
32 APIs are described with a  state version with “v” following the API Name,
33 e.g.:  ``nbi/api/v3/productOrder``.
34 The schema associated with a REST API must have its version number aligned
35 with that of the REST API.
36
37 The version number has major, minor and revision numbers. E.g. v1.0.0
38 The version number (without the revision number) is held in the URI.
39
40 The major version number is incremented for an incompatible change.
41 The minor version number is incremented for a compatible change.
42 For minor modifications of the API, version numbering must not be updated,
43 provided the following  backward compatibility rules are respected:
44
45 - New elements in a data type must be optional (``minOccurs=0``)
46 - Changes in the cardinality of an attribute in a data type must be from
47   mandatory to optional or from lower to greater
48 - New attributes defined in an element must be optional (absence of
49   ``use=”required”``).
50 - If new enumerated values are included, the former ones and its meaning must
51   be kept.
52 - If new operations are added, the existing operations must be kept
53 - New parameters added to existing operations must be optional and existing
54   parameters must be kept
55
56 For major modifications of the API, not backward compatible and forcing client
57 implementations to be changed, the version number must be updated.
58
59 *********
60 API Table
61 *********
62
63 .. |pdf-icon| image:: images/pdf.png
64               :width: 40px
65
66 .. |swagger-icon| image:: images/swagger.png
67                   :width: 40px
68
69
70 .. |swaggerUI-icon| image:: images/swaggerUI.png
71                     :width: 40px
72
73 .. |html-icon| image:: images/html.png
74                :width: 40px
75
76 .. |plantuml-icon| image:: images/uml.jpg
77                   :width: 40px
78
79 .. |postman-icon| image:: images/postman.png
80                   :width: 40px
81
82 .. |xml-icon| image:: images/text_xml.png
83                   :width: 40px
84
85 .. csv-table::
86    :header: "API", "|swagger-icon|", "|swagger-icon|", "|plantuml-icon|", "|xml-icon|"
87    :widths: 10,5,5,5,5
88
89    " ", "json file", "yaml file", "plant UML file", "xml schemas"
90    "hub", ":download:`link <api_hub/swagger.json>`", ":download:`link <api_hub/swagger.yaml>`", ":download:`link <api_hub/api.plantuml>`", ":download:`link <api_hub/model.xsd>`"
91    "serviceCatalog", ":download:`link <api_serviceCatalog/swagger.json>`", ":download:`link <api_serviceCatalog/swagger.yaml>`", ":download:`link <api_serviceCatalog/api.plantuml>`", ":download:`link <api_serviceCatalog/model.xsd>`"
92    "serviceInventory", ":download:`link <api_serviceInventory/swagger.json>`", ":download:`link <api_serviceInventory/swagger.yaml>`", ":download:`link <api_serviceInventory/api.plantuml>`", ":download:`link <api_serviceInventory/model.xsd>`"
93    "serviceOrder", ":download:`link <api_serviceOrder/swagger.json>`", ":download:`link <api_serviceOrder/swagger.yaml>`", ":download:`link <api_serviceOrder/api.plantuml>`", ":download:`link <api_serviceOrder/model.xsd>`"
94    "status", ":download:`link <api_status/swagger.json>`", ":download:`link <api_status/swagger.yaml>`", ":download:`link <api_status/api.plantuml>`", ":download:`link <api_status/model.xsd>`"
95
96 ***************
97 API Description
98 ***************
99
100 --------------
101 serviceCatalog
102 --------------
103
104 This API is based from TMF633 serviceCatalog. Only high level information
105 is provided - Swagger is documented.
106
107 Only ``serviceSpecification`` resource is provided.
108 Information are retrieved in **SDC** (and in TOSCA file)
109 - Only GET operation is provided - this API does not update **SDC**.
110
111 Only characteristics at service level will be retrieved in ONAP TOSCA file.
112 For example if an ONAP service is composed of VNF and the VF module, the
113 ``serviceSpecification`` resource will only feature characteristic described in
114 the ONAP service TOSCA model and not attributes in the TOSCA files for VNF
115 or VF module.
116
117 Only *basic* service characteristics will be managed in this release. By
118 *basic* we mean string, boolean, integer parameter type and we do not manage
119 *map* or *list* parameter type.
120
121
122 **GET serviceSpecification(list)**
123
124 Example: ``GET /nbi/api/v3/serviceSpecification/
125 ?category=NetworkService&distributionStatus=DISTRIBUTED``
126
127 It is possible to retrieve a list of ``serviceSpecification`` (get by list).
128
129 Only attributes ``category`` and ``distributionStatus`` are available for
130 ``serviceSpecification`` filtering. It is possible to select retrieved
131 attributes using fields attribute.
132
133 If no ``serviceSpecification`` matches, an empty list is send back.
134
135 **GET service Specification (id)**
136
137 Example: ``GET /nbi/api/v3/serviceSpecification/{uuid}``
138
139 It is use to retrieve one ``serviceSpecification`` - all available information
140 are retieved (see Swagger for description)
141
142 **GET service Specification Schema (id)**
143
144 Example: ``GET /nbi/api/v3/serviceSpecification/{uuid}/specificationInputSchema``
145
146 It is use to retrieve one  input schema from the tosca file stored in **NBI** - all available
147 information are retieved (see Swagger for description)
148
149 ----------------
150 serviceInventory
151 ----------------
152
153 This API is based from TMF638 serviceInventory. Only high level information
154 is provided - Swagger is documented.
155
156 This API retrieves service(s) in the **A&AI** inventory. Only following
157 attributes will be retrieve in service inventory: ``id``, ``name``, ``state``
158 and ``type``
159
160 **GET Service Inventory (list)**
161
162 Example: ``GET /nbi/api/v3/service/?relatedParty.id=Pontus``
163
164 GET (by list) allows to request with following criteria (all optional) :
165
166 *   ``id`` (id of the service instance) - id of the service instance
167     (inventory)
168 *   ``serviceSpecification.id`` - id of the service specification (catalog)
169 *   ``serviceSpecification.name`` - name of the service specification (catalog)
170 *   ``relatedParty.id`` - id of the (**A&AI**) customer - if not filled we use
171     *generic* customer
172
173 if no service matches, an empty list is send back.
174
175 1. If a request is send without any parameter, we’ll retrieve the list of
176    service-instance for the *generic* customer
177 2. If only customer parameter is filled (``relatedParty.id`` +
178    role= relatedParty’ONAPcustomer’) we’ll retrieve the list of
179    service-instance for this customer
180 3. If serviceSpecification.id or name is filled we’ll retrieve the list of
181    Service instance (from this service specification) – We’ll use the customer
182    id if provided (with Role=’ONAPcustomer) or generic if no customer id
183    provided
184
185 **GET Service Inventory (id)**
186
187 Example: ``GET /nbi/api/v3/service/{id}`` When querying for a specific service 
188 instance id, no additional filters are required.
189
190 The Service Inventory API will retrieve the service instance data from A&AI using 
191 the nodes query with the service instance id as the key. ``relatedParty.id`` + 
192 ``serviceSpecification.name`` are added to the response based on the A&AI service 
193 instance url.
194
195 ------------
196 serviceOrder
197 ------------
198
199 This API is based from  TMF641 serviceOrder. Only high level information
200 is provided - Swagger is documented.
201
202 It is possible to use POST operation to create new ``serviceOrder`` in **NBI**
203 and triggers service provisioning. GET operation is also available to retrieve
204 one service order by providing id or a list of service order. For this release,
205 only a subset of criteria is available:
206
207 • ``externalId``
208 • ``state``
209 • ``description``
210 • ``orderDate.gt`` (orderDate must be greater – after -than)
211 • ``orderDate.lt`` (orderDate must be lower-before - than)
212 • ``fields`` – attribute used to filter retrieved attributes (if needed) and
213   also for sorted SO
214 • ``offset`` and ``limit`` are used for pagination purpose
215
216 ServiceOrder will manage following ``actionItem`` action:
217
218 • ``add`` - a new service will be created
219 • ``delete`` - an existing service will be deleted
220 • ``change`` - an existing service will be deleted and then created with new
221   attribute value
222
223 **Prerequisites & assumptions**
224
225 • Cloud & tenant information MUST BE defined in the external API property file
226 • Management of ONAP customer for add service action
227
228 With the current version of APIs used from **SO** and **A&AI** we need to
229 manage a *customer*. This customer concept is confusing with Customer BSS
230 concept. We took the following rules to manage the *customer* information:
231
232 • It could be provided through a ``serviceOrder`` in the service Order a
233   ``relatedParty`` with role ``ONAPcustomer`` should be provided in the
234   ``serviceOrder`` header (we will not consider in this release the party
235   at item level). External API component will check if this customer exists
236   and create it in **A&AI** if not.
237 • If no ``relatedParty`` is provided, the service will be affected to
238   ``generic customer`` (dummy customer) – we assume this ``generic customer``
239   always exists.
240 • Additionally **NBI** will create in **A&AI** the service-type if it did not
241   exists for the customer
242
243 **ServiceOrder management in NBI will support 2 modes:**
244
245 • E2E integration - **NBI** calls **SO** API to perform an End-To-end
246   integration
247 • Service-level only integration - **NBI** will trigger only **SO** request at
248   serviceInstance level. **SO** prerequisite: **SO** must be able to find a
249   BPMN to process service fulfillment (integrate VNF, VNF activation in
250   **SDNC**, VF module
251
252 The choice of the mode is done in NBI depending on information retrieved in
253 **SDC**. If the serviceSpecification is within a Category “E2E Service” ,
254 **NBI** will use E2E **SO** API, if not only API at service instance level
255 will be used.
256
257 There is no difference or specific expectation in the service order API used
258 by **NBI** user.
259
260 **ServiceOrder tracking**
261
262 State management: States are only managed by ServiceOrder component and could
263 not be updated from north side via API.
264 Accordingly to service order item fulfillment progress, order item state are
265 updated. Order state is automatically updated based on item state.
266 Additionnally to this state, **NBI** provided a completion percent progress to
267 have detailled information about order progress.
268 Order Message are retrieved in the ``GET serviceOrder`` to provide **NBI** used
269 addtionnal information about ``serviceOrder`` management.
270
271 **Notification:**
272
273 It is possible for an external system to subscribe to service order
274 notifications. 3 events are managed:
275
276 • A new service order is created in **NBI**
277 • A service order state changes
278 • A service order item state changes
279
280 It is also possible to subscribe to **AAI** and **SDC** notifications via **NBI**.
281 4 events are managed:
282
283 • A new service is created in  **AAI***
284 • A service attribute value is changed in **AAI**
285 • A service is removed in **AAI**
286 • A service specification is distributed in **SDC**
287
288 These 7 events have distinct notification allowing any system to subscribe to
289 one, two or all notification types.
290
291 The implementation will be split in 2 components:
292
293 • A HUB resource must be managed within the NBI/serviceOrder API. This HUB
294   resource allows system to subscribe to **NBI** notification
295 • An Event API must be available at listener side in order to be able to
296   receive Listener (when event occurs). **NBI** will be upgraded to use this
297   API as client – **NBI** will shoot ``POST listener/``
298
299 The following diagram illustrates such notification flow:
300
301 .. image:: images/notification.jpg
302    :width: 800px
303
304
305 ***************
306 Developer Guide
307 ***************
308
309 Technical information about **NBI** (dependencies, configuration, running &
310 testing) could be found here:
311 :doc:`NBI_Developer_Guide <../architecture/NBI_Developer_Guide>`
312
313 API Flow illustration (with example messages) is described in this document:
314 :download:`nbicallflow.pdf <pdf/nbicallflow.pdf>`