Document new APPC LCM actor
[policy/parent.git] / docs / development / actors / appc-legacy / appc-legacy.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 .. _appc-legacy-label:
6
7 #################
8 APPC Legacy Actor
9 #################
10
11 .. contents::
12     :depth: 3
13
14 Overview of APPC Legacy Actor
15 #############################
16 ONAP Policy Framework enables APPC Legacy as one of the supported actors.
17 APPC Legacy uses a single DMaaP topic for both requests and responses.  As a result, the
18 actor implementation must cope with the fact that requests may appear on the same
19 stream from which it is reading responses, thus it must use the message content to
20 distinguish responses from requests.  This particular implementation uses the *Status*
21 field to identify responses.
22
23 In addition, APPC may generate more than one response for a particular request, the
24 first response simply indicating that the request was accepted, while the second
25 response indicates completion of the request.  For each request, a unique sub-request
26 ID is generated.  This is used to match the received responses with the published
27 requests.
28
29 Each operation supported by the actor is associated with its own java class, which is
30 responsible for populating the request structure appropriately.  The operation-specific
31 classes are all derived from the *AppcOperation* class, which is, itself, derived from
32 *BidirectionalTopicOperation*.
33
34
35 Request
36 #######
37
38 CommonHeader
39 ************
40
41 The "CommonHeader" field in the request is built by policy.
42
43 =============================== =========== ==================================================================
44    "CommonHeader" field name       type                             Description
45 =============================== =========== ==================================================================
46 SubRequestID                      string      Generated by Policy. Is a UUID and used internally by policy
47                                               to match the response with the request.
48 RequestID                         string      Inserted by Policy. Maps to the UUID sent by DCAE i.e. the ID
49                                               used throughout the closed loop lifecycle to identify a request.
50 =============================== =========== ==================================================================
51
52 Action
53 ******
54
55 The "Action" field uniquely identifies the operation to perform.  Currently, only
56 "ModifyConfig" is supported.
57
58 Payload
59 *******
60
61 =============================== =========== ==================================================================
62    "Payload" field name            type                             Description
63 =============================== =========== ==================================================================
64 generic-vnf.vnf-id                string      The ID of the VNF selected from the A&AI Custom Query response
65                                               using the Target resource ID specified in the
66                                               *ControlLoopOperationParams*.
67 =============================== =========== ==================================================================
68
69 Additional fields are populated based on the *payload* specified within the
70 *ControlLoopOperationParams*.  Each value found within the *payload* is treated as a
71 JSON string and is decoded into a POJO, which is then inserted into the request payload
72 using the same key.
73
74
75 Examples
76 ########
77
78 Suppose the *ControlLoopOperationParams* were populated as follows:
79
80 .. code-block:: bash
81
82         {
83             "actor": "APPC",
84             "operation": "ModifyConfig",
85             "target": {
86                 "resourceID": "2246ebc9-9b9f-42d0-a5e4-0248324fb884"
87             },
88             "payload": {
89                 "my-key-A": "{\"input\":\"hello\"}",
90                 "my-key-B": "{\"output\":\"world\"}"
91             },
92             "context": {
93                 "event": {
94                     "requestId": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65"
95                 },
96                 "cqdata": {
97                     "generic-vnf": [
98                         {
99                             "vnfId": "my-vnf",
100                             "vf-modules": [
101                                 {
102                                     "model-invariant-id": "2246ebc9-9b9f-42d0-a5e4-0248324fb884"
103                                 }
104                             ]
105                         }
106                     ]
107                 }
108             }
109         }
110
111 An example of a request constructed by the actor using the above parameters, published
112 to the APPC topic:
113
114 .. code-block:: bash
115
116         {
117           "CommonHeader": {
118             "TimeStamp": 1589400050910,
119             "APIver": "1.01",
120             "RequestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
121             "SubRequestID": "ee3f2dc0-a2e0-4ae8-98c3-478c784b8eb5",
122             "RequestTrack": [],
123             "Flags": []
124           },
125           "Action": "ModifyConfig",
126           "Payload": {
127             "my-key-B": {
128               "output": "world"
129             },
130             "my-key-A": {
131               "input": "hello"
132             },
133             "generic-vnf.vnf-id": "my-vnf"
134           }
135         }
136
137
138 An example initial response received from APPC on the same topic:
139
140 .. code-block:: bash
141
142         {
143           "CommonHeader": {
144             "TimeStamp": 1589400050923,
145             "APIver": "1.01",
146             "RequestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
147             "SubRequestID": "ee3f2dc0-a2e0-4ae8-98c3-478c784b8eb5",
148             "RequestTrack": [],
149             "Flags": []
150           },
151           "Status": {
152             "Code": 100,
153             "Value": "ACCEPTED"
154           }
155         }
156
157
158 An example final response received from APPC on the same topic:
159
160 .. code-block:: bash
161
162         {
163           "CommonHeader": {
164             "TimeStamp": 1589400050934,
165             "APIver": "1.01",
166             "RequestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
167             "SubRequestID": "ee3f2dc0-a2e0-4ae8-98c3-478c784b8eb5",
168             "RequestTrack": [],
169             "Flags": []
170           },
171           "Status": {
172             "Code": 400,
173             "Value": "SUCCESS"
174           }
175         }
176
177
178 Configuration of the APPC Legacy Actor
179 ######################################
180
181 The following table specifies the fields that should be provided to configure the APPC
182 Legacy actor.
183
184 =============================== ====================    ==================================================================
185 Field name                         type                             Description
186 =============================== ====================    ==================================================================
187 sinkTopic                         string                  Name of the topic to which the request should be published.
188 sourceTopic                       string                  Name of the topic from which the response should be read.
189 timeoutSec                        integer (optional)      Maximum time, in seconds, to wait for a response to be received
190                                                           on the topic.
191 =============================== ====================    ==================================================================
192
193 The individual operations are configured using these same field names.  However, all
194 of them are optional, as they inherit their values from the corresponding actor-level
195 fields.