Document new SDNR Actor
[policy/parent.git] / docs / development / actors / sdnr / sdnr.rst
1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 .. _sdnr-label:
6
7 ##########
8 SDNR Actor
9 ##########
10
11 .. contents::
12     :depth: 3
13
14 Overview of SDNR Actor
15 ######################
16 ONAP Policy Framework enables SDNR as one of the supported actors.  SDNR uses two
17 DMaaP topics, one to which requests are published, and another from which responses
18 are received.  SDNR may generate more than one response for a particular request,
19 the first response simply indicating that the request was accepted, while the second
20 response indicates completion of the request.  For each request, a unique sub-request
21 ID is generated.  This is used to match the received responses with the published
22 requests.
23
24 When an SDNR request completes, whether successfully or unsuccessfully, the actor
25 populates the *controlLoopResponse* within the *OperationOutcome*.  The application
26 will typically publish this to a notification topic so that downstream systems can
27 take appropriate action.
28
29 All SDNR operations are currently supported by a single java class,
30 *SdnrOperation*, which is responsible for populating the request structure
31 appropriately.  This class is derived from *BidirectionalTopicOperation*.
32
33
34 Request
35 #######
36
37 CommonHeader
38 ************
39
40 The "CommonHeader" field in the request is built by policy.
41
42 =============================== =========== ==================================================================
43    "CommonHeader" field name       type                             Description
44 =============================== =========== ==================================================================
45 SubRequestID                      string      Generated by Policy. Is a UUID and used internally by policy
46                                               to match the response with the request.
47 RequestID                         string      Inserted by Policy. Maps to the UUID sent by DCAE i.e. the ID
48                                               used throughout the closed loop lifecycle to identify a request.
49 =============================== =========== ==================================================================
50
51
52 Action
53 ******
54
55 The "action" field uniquely identifies the operation to perform.  Operation names are
56 not validated.  Instead, they are passed to SDNR, untouched.
57
58
59 RPC Name
60 ********
61
62 The "rpc-name" field is the same as the "action" field, with everything mapped to lower
63 case.
64
65
66 Payload
67 *******
68
69 The "payload" field is populated with the *payload* text that is provided within the
70 ONSET event; no additional transformation is applied.
71
72
73 Examples
74 ########
75
76 Suppose the *ControlLoopOperationParams* were populated as follows:
77
78 .. code-block:: bash
79
80         {
81             "actor": "SDNR",
82             "operation": "ModifyConfig",
83             "context": {
84                 "event": {
85                     "requestId": "664be3d2-6c12-4f4b-a3e7-c349acced200",
86                     "payload": "some text"
87                 }
88             }
89         }
90
91 An example of a request constructed by the actor using the above parameters, published
92 to the SDNR request topic:
93
94 .. code-block:: bash
95
96         {
97           "body": {
98             "input": {
99               "CommonHeader": {
100                 "TimeStamp": "2020-05-18T14:43:58.550499700Z",
101                 "APIVer": "1.0",
102                 "RequestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
103                 "SubRequestID": "848bfd15-b189-43a1-bdea-80982b41fa24",
104                 "RequestTrack": {},
105                 "Flags": {}
106               },
107               "Action": "ModifyConfig",
108               "Payload": "some text"
109             }
110           },
111           "version": "1.0",
112           "rpc-name": "modifyconfig",
113           "correlation-id": "664be3d2-6c12-4f4b-a3e7-c349acced200-848bfd15-b189-43a1-bdea-80982b41fa24",
114           "type": "request"
115         }
116
117
118 An example initial response received from the SDNR response topic:
119
120 .. code-block:: bash
121
122         {
123             "body": {
124                 "output": {
125                     "CommonHeader": {
126                         "TimeStamp": "2020-05-18T14:44:10.000Z",
127                         "APIver": "1.0",
128                         "RequestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
129                         "SubRequestID": "848bfd15-b189-43a1-bdea-80982b41fa24",
130                         "RequestTrack": [],
131                         "Flags": []
132                     },
133                     "Status": {
134                         "Code": 100,
135                         "Value": "ACCEPTED"
136                     }
137                 }
138             },
139             "version": "1.0",
140             "rpc-name": "modifyconfig",
141             "correlation-id": "664be3d2-6c12-4f4b-a3e7-c349acced200-848bfd15-b189-43a1-bdea-80982b41fa24",
142             "type": "response"
143         }
144
145
146 An example final response received from the SDNR on the same response topic:
147
148 .. code-block:: bash
149
150         {
151             "body": {
152                 "output": {
153                     "CommonHeader": {
154                         "TimeStamp": "2020-05-18T14:44:20.000Z",
155                         "APIver": "1.0",
156                         "RequestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
157                         "SubRequestID": "848bfd15-b189-43a1-bdea-80982b41fa24",
158                         "RequestTrack": [],
159                         "Flags": []
160                     },
161                     "Status": {
162                         "Code": 200,
163                         "Value": "SUCCESS"
164                     },
165                     "Payload": "{ \"Configurations\":[ { \"Status\": { \"Code\": 200, \"Value\": \"SUCCESS\" }, \"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}} } ] }"
166                 }
167             },
168             "version": "1.0",
169             "rpc-name": "modifyconfig",
170             "correlation-id": "664be3d2-6c12-4f4b-a3e7-c349acced200-848bfd15-b189-43a1-bdea-80982b41fa24",
171             "type": "response"
172         }
173
174
175 Configuration of the SDNR Actor
176 ###############################
177
178 The following table specifies the fields that should be provided to configure the SNDR
179 actor.
180
181 =============================== ====================    ==================================================================
182 Field name                         type                             Description
183 =============================== ====================    ==================================================================
184 sinkTopic                         string                  Name of the topic to which the request should be published.
185 sourceTopic                       string                  Name of the topic from which the response should be read.
186                                                           This must not be the same as the *sinkTopic*.
187 timeoutSec                        integer (optional)      Maximum time, in seconds, to wait for a response to be received
188                                                           on the topic.
189 =============================== ====================    ==================================================================
190
191 The individual operations are configured using these same field names.  However, all
192 of them are optional, as they inherit their values from the corresponding actor-level
193 fields.