aboutsummaryrefslogtreecommitdiffstats
path: root/docs/development/actors/appc-legacy/appc-legacy.rst
blob: 5d1bd7c00373b50fabef5e7ef2f5fd3fc4ad6920 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
.. This work is licensed under a
.. Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0

.. _appc-legacy-label:

#################
APPC Legacy Actor
#################

.. contents::
    :depth: 3

Overview of APPC Legacy Actor
#############################
ONAP Policy Framework enables APPC Legacy as one of the supported actors.
APPC Legacy uses a single DMaaP topic for both requests and responses.  As a result, the
actor implementation must cope with the fact that requests may appear on the same
stream from which it is reading responses, thus it must use the message content to
distinguish responses from requests.  This particular implementation uses the *Status*
field to identify responses.

In addition, APPC may generate more than one response for a particular request, the
first response simply indicating that the request was accepted, while the second
response indicates completion of the request.  For each request, a unique sub-request
ID is generated.  This is used to match the received responses with the published
requests.

Each operation supported by the actor is associated with its own java class, which is
responsible for populating the request structure appropriately.  The operation-specific
classes are all derived from the *AppcOperation* class, which is, itself, derived from
*BidirectionalTopicOperation*.


Request
#######

CommonHeader
************

The "CommonHeader" field in the request is built by policy.

=============================== =========== ==================================================================
   "CommonHeader" field name       type                             Description
=============================== =========== ==================================================================
SubRequestID                      string      Generated by Policy. Is a UUID and used internally by policy
                                              to match the response with the request.
RequestID                         string      Inserted by Policy. Maps to the UUID sent by DCAE i.e. the ID
                                              used throughout the closed loop lifecycle to identify a request.
=============================== =========== ==================================================================

Action
******

The "Action" field uniquely identifies the operation to perform.  Currently, only
"ModifyConfig" is supported.

Payload
*******

=============================== =========== ==================================================================
   "Payload" field name            type                             Description
=============================== =========== ==================================================================
generic-vnf.vnf-id                string      The ID of the VNF selected from the A&AI Custom Query response
                                              using the Target resource ID specified in the
                                              *ControlLoopOperationParams*.
=============================== =========== ==================================================================

Additional fields are populated based on the *payload* specified within the
*ControlLoopOperationParams*.  Each value found within the *payload* is treated as a
JSON string and is decoded into a POJO, which is then inserted into the request payload
using the same key.


Examples
########

Suppose the *ControlLoopOperationParams* were populated as follows:

.. code-block:: bash

        {
            "actor": "APPC",
            "operation": "ModifyConfig",
            "target": {
                "resourceID": "2246ebc9-9b9f-42d0-a5e4-0248324fb884"
            },
            "payload": {
                "my-key-A": "{\"input\":\"hello\"}",
                "my-key-B": "{\"output\":\"world\"}"
            },
            "context": {
                "event": {
                    "requestId": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65"
                },
                "cqdata": {
                    "generic-vnf": [
                        {
                            "vnfId": "my-vnf",
                            "vf-modules": [
                                {
                                    "model-invariant-id": "2246ebc9-9b9f-42d0-a5e4-0248324fb884"
                                }
                            ]
                        }
                    ]
                }
            }
        }

An example of a request constructed by the actor using the above parameters, published
to the APPC topic:

.. code-block:: bash

        {
          "CommonHeader": {
            "TimeStamp": 1589400050910,
            "APIver": "1.01",
            "RequestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
            "SubRequestID": "ee3f2dc0-a2e0-4ae8-98c3-478c784b8eb5",
            "RequestTrack": [],
            "Flags": []
          },
          "Action": "ModifyConfig",
          "Payload": {
            "my-key-B": {
              "output": "world"
            },
            "my-key-A": {
              "input": "hello"
            },
            "generic-vnf.vnf-id": "my-vnf"
          }
        }


An example initial response received from APPC on the same topic:

.. code-block:: bash

        {
          "CommonHeader": {
            "TimeStamp": 1589400050923,
            "APIver": "1.01",
            "RequestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
            "SubRequestID": "ee3f2dc0-a2e0-4ae8-98c3-478c784b8eb5",
            "RequestTrack": [],
            "Flags": []
          },
          "Status": {
            "Code": 100,
            "Value": "ACCEPTED"
          }
        }


An example final response received from APPC on the same topic:

.. code-block:: bash

        {
          "CommonHeader": {
            "TimeStamp": 1589400050934,
            "APIver": "1.01",
            "RequestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
            "SubRequestID": "ee3f2dc0-a2e0-4ae8-98c3-478c784b8eb5",
            "RequestTrack": [],
            "Flags": []
          },
          "Status": {
            "Code": 400,
            "Value": "SUCCESS"
          }
        }


Configuration of the APPC Legacy Actor
######################################

The following table specifies the fields that should be provided to configure the APPC
Legacy actor.

=============================== ====================    ==================================================================
Field name                         type                             Description
=============================== ====================    ==================================================================
sinkTopic                         string                  Name of the topic to which the request should be published.
sourceTopic                       string                  Name of the topic from which the response should be read.
timeoutSec                        integer (optional)      Maximum time, in seconds, to wait for a response to be received
                                                          on the topic.
=============================== ====================    ==================================================================

The individual operations are configured using these same field names.  However, all
of them are optional, as they inherit their values from the corresponding actor-level
fields.