summaryrefslogtreecommitdiffstats
path: root/platform-logic/a1Adapter-api/src/main/xml/A1-ADAPTER-API_getPolicyInstance.xml
blob: e20c3cd46deaf7040310470e1986a2fc4b21a816 (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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<service-logic
    xmlns='http://www.onap.org/sdnc/svclogic'
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='A1-ADAPTER-API' version='${project.version}'>
    <method rpc='getPolicyInstance' mode='sync'>
        <block atomic='true'>
            <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                <parameter name="level" value="info" />
                <parameter name="field1" value="Get Policy Instance details associated with Near RT RIC ID and Policy Type ID"/>
                <parameter name="field2" value="`$get-policy-instance-input.near-rt-ric-id`"/>
                <parameter name="field3" value="`$get-policy-instance-input.policy-type-id`"/>
                <parameter name="field4" value="`$get-policy-instance-input.policy-instance-id`"/>
            </record>
            <set>
                <parameter name='response-code' value='200' />
                <parameter name='response-message' value='getPolicyInstance executed successfully' />
            </set>
            <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >
                <parameter name='fileName' value='/opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties' />
                <parameter name='contextPrefix' value='prop' />
            </execute>
            <switch test='`$prop.ric-plt-A1Mediator-deployed`'>
                <outcome value='true'>
                    <block atomic='true'>
                        <block atomic='true'>
                            <set>
                                <parameter name="tmp.near-rt-ric-id" value="`$get-policy-instance-input.near-rt-ric-id`"/>
                                <parameter name="tmp.policy-type-id" value="`$get-policy-instance-input.policy-type-id`"/>
                                <parameter name="tmp.policy-instance-id" value="`$get-policy-instance-input.policy-instance-id`"/>
                            </set>
                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                <parameter name="level" value="info" />
                                <parameter name="field1" value="Setting variables for A1 Adapter Get Policy Instance."/>
                                <parameter name="field2" value="`$tmp.near-rt-ric-id`"/>
                                <parameter name="field3" value="`$tmp.policy-type-id`"/>
                                <parameter name="field4" value="`$tmp.policy-instance-id`"/>
                            </record>
                            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                <parameter name="source" value="`$prop.restapi.policy`"/>
                                <parameter name="outputPath" value="tmp.restapi.policyinstance-url"/>
                                <parameter name="target" value="{policy_type_id}"/>
                                <parameter name="replacement" value="`$tmp.policy-type-id`"/>
                            </execute>
                            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                <parameter name="source" value="`$tmp.restapi.policyinstance-url`"/>
                                <parameter name="outputPath" value="tmp.restapi.policyinstance-url"/>
                                <parameter name="target" value="{policy_instance_id}"/>
                                <parameter name="replacement" value="`$tmp.policy-instance-id`"/>
                            </execute>
                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                <parameter name="level" value="info" />
                                <parameter name="field1" value="Setting variables for A1 Adapter Get Policy Instance."/>
                                <parameter name="field2" value="`$tmp.near-rt-ric-id`"/>
                                <parameter name="field3" value="`$tmp.policy-type-id`"/>
                                <parameter name="field4" value="`$tmp.policy-instance-id`"/>
                                <parameter name="field5" value="`$tmp.restapi.policyinstance-url`"/>
                            </record>
                            <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
                                <parameter name="restapiUrl" value="`$prop.a1Mediator.url + '/' + $tmp.restapi.policyinstance-url`"/>
                                <parameter name="format" value="json"/>
                                <parameter name="httpMethod" value="GET"/>
                                <parameter name="responsePrefix" value="a1MediatorRsp"/>
                                <parameter name='contentType' value='application/json' />
                                <parameter name='accept' value='application/json' />
                                <parameter name="convertResponse" value="true"/>
                                <outcome value='success'>
                                    <block>
                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                            <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                            <parameter name="level" value="info" />
                                            <parameter name="field1" value="Details of A1 Policy Instance "/>
                                            <parameter name="field2" value="`$a1MediatorRsp`"/>
                                        </record>
                                    </block>
                                </outcome>
                                <outcome value='failure'>
                                    <block>
                                        <set>
                                            <parameter name='response-code' value='500'/>
                                            <parameter name='response-message' value='Seems A1 Mediator Not Healthy'/>
                                        </set>
                                        <return status='failure'>
                                            <parameter name='ack-final' value='Y'/>
                                            <parameter name="response-code" value="500" />
                                            <parameter name="response-message" value="Error in Getting A1 Policy Instances. Aborting" />
                                        </return>
                                        <block atomic='true'>
                                            <set>
                                                <parameter name='tmp.a1-adapter-api.rpc-name' value='getPolicyInstance'/>
                                                <parameter name='tmp.a1Adapter-dmaap-resp.status-code' value='`$response-code`'/>
                                                <parameter name='tmp.a1Adapter-dmaap-resp.status-value' value='`$response-message`'/>
                                                <parameter name='tmp.a1Policy-dmaap-resp.payload' value="Working On it" />
                                            </set>
                                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                                <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                                <parameter name="level" value="info" />
                                                <parameter name="field1" value="__TIMESTAMP__"/>
                                                <parameter name="field2" value="Before DMAAP Event - template file name, restapiURL"/>
                                                <parameter name='field3' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
                                                <parameter name='field4' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
                                                <parameter name='field5' value="Status Code and Status Value to be published" />
                                                <parameter name='field6' value="`$tmp.a1Adapter-dmaap-resp.status-code`" />
                                                <parameter name='field7' value="`$tmp.a1Adapter-dmaap-resp.status-value`" />
                                                <parameter name='field8' value="A1 Adapter DMAAP Response Payload" />
                                                <parameter name='field9' value="`$tmp.a1Policy-dmaap-resp.payload`" />
                                                <parameter name='field10' value="RPC Name" />
                                                <parameter name='field11' value="`$tmp.a1-adapter-api.rpc-name`" />
                                            </record>
                                            <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
                                                <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
                                                <parameter name='restapiUrl' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
                                                <parameter name='format' value='json' />
                                                <parameter name='httpMethod' value='POST' />
                                                <parameter name='contentType' value='application/json' />
                                                <parameter name='responsePrefix' value='dmaap' />
                                                <outcome value='failure'>
                                                    <block>
                                                        <return status='failure'>
                                                            <parameter name='ack-final' value='Y'/>
                                                            <parameter name="response-code" value="500" />
                                                            <parameter name="response-message" value="Error publishing DMAAP A1 Policy Response message. " />
                                                        </return>
                                                    </block>
                                                </outcome>
                                                <outcome value='success'>
                                                    <block>
                                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                                            <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                                            <parameter name="level" value="info" />
                                                            <parameter name="field1" value="DMAAP A1Policy message Successfully Published "/>
                                                        </record>
                                                    </block>
                                                </outcome>
                                            </execute>
                                        </block>
                                    </block>
                                </outcome>
                            </execute>
                        </block>
                    </block>
                </outcome>
                <outcome value='false'>
                    <block>
                        <set>
                            <parameter name='response-code' value='500'/>
                            <parameter name='response-message' value='A1 Mediator Not Deployed'/>
                        </set>
                        <block atomic='true'>
                            <set>
                                <parameter name='tmp.a1-adapter-api.rpc-name' value='getPolicyInstance'/>
                                <parameter name='tmp.a1Adapter-dmaap-resp.status-code' value='`$response-code`'/>
                                <parameter name='tmp.a1Adapter-dmaap-resp.status-value' value='`$response-message`'/>
                                <parameter name='tmp.a1Policy-dmaap-resp.payload' value="Working On it" />
                            </set>
                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                <parameter name="level" value="info" />
                                <parameter name="field1" value="__TIMESTAMP__"/>
                                <parameter name="field2" value="Before DMAAP Event - template file name, restapiURL"/>
                                <parameter name='field3' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
                                <parameter name='field4' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
                                <parameter name='field5' value="Status Code and Status Value to be published" />
                                <parameter name='field6' value="`$tmp.a1Adapter-dmaap-resp.status-code`" />
                                <parameter name='field7' value="`$tmp.a1Adapter-dmaap-resp.status-value`" />
                                <parameter name='field8' value="A1 Adapter DMAAP Response Payload" />
                                <parameter name='field9' value="`$tmp.a1Policy-dmaap-resp.payload`" />
                                <parameter name='field10' value="RPC Name" />
                                <parameter name='field11' value="`$tmp.a1-adapter-api.rpc-name`" />
                            </record>
                            <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
                                <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
                                <parameter name='restapiUrl' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
                                <parameter name='format' value='json' />
                                <parameter name='httpMethod' value='POST' />
                                <parameter name='contentType' value='application/json' />
                                <parameter name='responsePrefix' value='dmaap' />
                                <outcome value='failure'>
                                    <block>
                                        <return status='failure'>
                                            <parameter name='ack-final' value='Y'/>
                                            <parameter name="response-code" value="500" />
                                            <parameter name="response-message" value="Error publishing DMAAP A1 Policy Response message. " />
                                        </return>
                                    </block>
                                </outcome>
                                <outcome value='success'>
                                    <block>
                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                            <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                            <parameter name="level" value="info" />
                                            <parameter name="field1" value="DMAAP A1Policy message Successfully Published "/>
                                        </record>
                                    </block>
                                </outcome>
                            </execute>
                        </block>
                        <return status='failure'>
                            <parameter name='ack-final' value='Y'/>
                            <parameter name="response-code" value="500" />
                            <parameter name="response-message" value="Error in Getting A1 Policy Instance. Aborting" />
                        </return>
                    </block>
                </outcome>
            </switch>
            <block>
                <block atomic='true'>
                    <set>
                        <parameter name='tmp.a1-adapter-api.rpc-name' value='getPolicyInstance'/>
                        <parameter name='tmp.a1Adapter-dmaap-resp.status-code' value='`$response-code`'/>
                        <parameter name='tmp.a1Adapter-dmaap-resp.status-value' value='`$response-message`'/>
                        <parameter name='tmp.a1Policy-dmaap-resp.payload' value="Working On it" />
                    </set>
                    <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                        <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                        <parameter name="level" value="info" />
                        <parameter name="field1" value="__TIMESTAMP__"/>
                        <parameter name="field2" value="Before DMAAP Event - template file name, restapiURL"/>
                        <parameter name='field3' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
                        <parameter name='field4' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
                        <parameter name='field5' value="Status Code and Status Value to be published" />
                        <parameter name='field6' value="`$tmp.a1Adapter-dmaap-resp.status-code`" />
                        <parameter name='field7' value="`$tmp.a1Adapter-dmaap-resp.status-value`" />
                        <parameter name='field8' value="A1 Adapter DMAAP Response Payload" />
                        <parameter name='field9' value="`$tmp.a1Policy-dmaap-resp.payload`" />
                        <parameter name='field10' value="RPC Name" />
                        <parameter name='field11' value="`$tmp.a1-adapter-api.rpc-name`" />
                    </record>
                    <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
                        <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
                        <parameter name='restapiUrl' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
                        <parameter name='format' value='json' />
                        <parameter name='httpMethod' value='POST' />
                        <parameter name='contentType' value='application/json' />
                        <parameter name='responsePrefix' value='dmaap' />
                        <outcome value='failure'>
                            <block>
                                <return status='failure'>
                                    <parameter name='ack-final' value='Y'/>
                                    <parameter name="response-code" value="500" />
                                    <parameter name="response-message" value="Error publishing DMAAP A1 Policy Response message. " />
                                </return>
                            </block>
                        </outcome>
                        <outcome value='success'>
                            <block>
                                <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                    <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                    <parameter name="level" value="info" />
                                    <parameter name="field1" value="DMAAP A1Policy message Successfully Published "/>
                                </record>
                            </block>
                        </outcome>
                    </execute>
                </block>
                <return status='success'>
                    <parameter name="ack-final-indicator" value="Y" />
                    <parameter name="error-code" value="200" />
                    <parameter name="error-message" value="`$error-message`" />
                    <parameter name='response-code' value='200' />
                    <parameter name='response-message' value='getPolicyInstance executed successfully'/>
                    <parameter name='ack-final' value='Y'/>
                </return>
            </block>
        </block>
    </method>
</service-logic>