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