Update RTD (CPS-1515: Spike: Support Multiple CM-Handles for NCMP Get Operation)
[cps.git] / docs / ncmp-data-operation.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright (C) 2023 Nordix Foundation
4
5 .. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING
6 .. _cmHandleDataOperation:
7
8
9 CM Handles Data Operation Endpoints
10 ###################################
11
12 .. toctree::
13    :maxdepth: 1
14
15 Introduction
16 ============
17
18 For data operation CM Handles we have a Post endpoints:
19
20 - /ncmp/v1/data?topic={client-topic-name} forward request to it's dmi plugin service.
21
22 - Returns request id (UUID) with http status 202.
23
24 Request Body
25 ============
26
27 This endpoint executes data operation for given array of operations:
28
29     +--------------------------+-------------+-------------------------------------------------------------------------+
30     | Operation attributes     | Mandatory   |  Description                                                            |
31     +==========================+=============+=========================================================================+
32     | operation                | Yes         | Only read operation is allowed.                                         |
33     +--------------------------+-------------+-------------------------------------------------------------------------+
34     | operationId              | Yes         | Unique operation id for each operation.                                 |
35     +--------------------------+-------------+-------------------------------------------------------------------------+
36     | datastore                | Yes         | Supports only ncmp-datastore:passthrough-operational and                |
37     |                          |             | ncmp-datastore:passthrough-running.                                     |
38     +--------------------------+-------------+-------------------------------------------------------------------------+
39     | options                  | No          | It is mandatory to wrap key(s)=value(s) in parenthesis'()'. The format  |
40     |                          |             | of options parameter depend on the associated DMI Plugin implementation.|
41     +--------------------------+-------------+-------------------------------------------------------------------------+
42     | resourceIdentifier       | No          | The format of resource identifier depend on the associated DMI Plugin   |
43     |                          |             | implementation. For ONAP DMI Plugin it will be RESTConf paths but it can|
44     |                          |             | really be anything.                                                     |
45     +--------------------------+-------------+-------------------------------------------------------------------------+
46     | targetIds                | Yes         | List of cm handle ids.                                                  |
47     +--------------------------+-------------+-------------------------------------------------------------------------+
48
49 The status codes used in the events resulting from these operations are defined here:
50
51 .. toctree::
52    :maxdepth: 1
53
54    cps-ncmp-message-status-codes.rst
55
56 Request Body example from client app to NCMP endpoint:
57
58 .. code-block:: bash
59
60     curl --location 'http: //{ncmp-host-name}:{ncmp-port}/ncmp/v1/data?topic=my-topic-name' \
61     --header 'Content-Type: application/json' \
62     --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \
63     --data '{
64     "operations": [
65         {
66             "operation": "read",
67             "operationId": "operational-12",
68             "datastore": "ncmp-datastore:passthrough-operational",
69             "options": "some option",
70             "resourceIdentifier": "parent/child",
71             "targetIds": [
72                 "836bb62201f34a7aa056a47bd95a81ed",
73                 "202acb75b4a54e43bb1ff8c0c17a8e08"
74             ]
75         },
76         {
77             "operation": "read",
78             "operationId": "running-14",
79             "datastore": "ncmp-datastore:passthrough-running",
80             "targetIds": [
81                 "ec2e9495679a43c58659c07d87025e72",
82                 "0df4d39af6514d99b816758148389cfd"
83             ]
84         }
85     ]
86     }'
87
88
89 DMI service batch endpoint
90 --------------------------
91
92 DMI Service 1 (POST): `http://{dmi-host-name}:{dmi-port}/dmi/v1/data?topic=my-topic-name&requestId=4753fc1f-7de2-449a-b306-a6204b5370b3`
93
94 .. code-block:: json
95
96     [
97     {
98         "operationType": "read",
99         "operationId": "running-14",
100         "datastore": "ncmp-datastore:passthrough-running",
101         "cmHandles": [
102             {
103                 "id": "ec2e9495679a43c58659c07d87025e72",
104                 "cmHandleProperties": {
105                     "neType": "RadioNode"
106                 }
107             },
108             {
109                 "id": "0df4d39af6514d99b816758148389cfd",
110                 "cmHandleProperties": {
111                     "neType": "RadioNode"
112                 }
113             }
114         ]
115     }
116     ]
117
118 DMI Service 2 (POST) : `http://{dmi-host-name}:{dmi-port}/dmi/v1/data?topic=my-topic-name&requestId=4753fc1f-7de2-449a-b306-a6204b5370b3`
119
120 .. code-block:: json
121
122     [
123     {
124         "operationType": "read",
125         "operationId": "operational-12",
126         "datastore": "ncmp-datastore:passthrough-operational",
127         "options": "some option",
128         "resourceIdentifier": "parent/child",
129         "cmHandles": [
130             {
131                 "id": "836bb62201f34a7aa056a47bd95a81ed",
132                 "cmHandleProperties": {
133                     "neType": "RadioNode"
134                 }
135             },
136             {
137                 "id": "202acb75b4a54e43bb1ff8c0c17a8e08",
138                 "cmHandleProperties": {
139                     "neType": "RadioNode"
140                 }
141             }
142         ]
143     }
144     ]
145
146 Above examples are for illustration purpose only please refer link below for latest schema.
147
148 :download:`Data operation event schema <schemas/data-operation-event-schema-1.0.0.json>`