DG's and Templates for A1 Adapter
[ccsdk/distribution.git] / platform-logic / a1Adapter-api / src / main / xml / A1-ADAPTER-API_getStatus.xml
1 <service-logic
2     xmlns='http://www.onap.org/sdnc/svclogic'
3     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}'>
4     <method rpc='getStatus' mode='sync'>
5         <block atomic='true'>
6             <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
7                 <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
8                 <parameter name="level" value="info" />
9                 <parameter name="field1" value="Get status of Policy Instance  associated with Near RT RIC ID and Policy Type ID"/>
10                 <parameter name="field2" value="`$get-status-input.near-rt-ric-id`"/>
11                 <parameter name="field3" value="`$get-status-input.policy-type-id`"/>
12                 <parameter name="field4" value="`$get-status-input.policy-instance-id`"/>
13             </record>
14             <set>
15                 <parameter name='response-code' value='200' />
16                 <parameter name='response-message' value='getStatus executed successfully' />
17             </set>
18             <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >
19                 <parameter name='fileName' value='/opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties' />
20                 <parameter name='contextPrefix' value='prop' />
21             </execute>
22             <switch test='`$prop.ric-plt-A1Mediator-deployed`'>
23                 <outcome value='true'>
24                     <block atomic='true'>
25                         <block atomic='true'>
26                             <set>
27                                 <parameter name="tmp.near-rt-ric-id" value="`$get-status-input.near-rt-ric-id`"/>
28                                 <parameter name="tmp.policy-type-id" value="`$get-status-input.policy-type-id`"/>
29                                 <parameter name="tmp.policy-instance-id" value="`$get-status-input.policy-instance-id`"/>
30                             </set>
31                             <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
32                                 <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
33                                 <parameter name="level" value="info" />
34                                 <parameter name="field1" value="Setting variables for A1 Adapter Getting status for Policy Instance."/>
35                                 <parameter name="field2" value="`$tmp.near-rt-ric-id`"/>
36                                 <parameter name="field3" value="`$tmp.policy-type-id`"/>
37                                 <parameter name="field4" value="`$tmp.policy-instance-id`"/>
38                             </record>
39                             <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
40                                 <parameter name="source" value="`$prop.restapi.policystatus`"/>
41                                 <parameter name="outputPath" value="tmp.restapi.policyinstance-url"/>
42                                 <parameter name="target" value="{policy_type_id}"/>
43                                 <parameter name="replacement" value="`$tmp.policy-type-id`"/>
44                             </execute>
45                             <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
46                                 <parameter name="source" value="`$tmp.restapi.policyinstance-url`"/>
47                                 <parameter name="outputPath" value="tmp.restapi.policyinstance-url"/>
48                                 <parameter name="target" value="{policy_instance_id}"/>
49                                 <parameter name="replacement" value="`$tmp.policy-instance-id`"/>
50                             </execute>
51                             <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
52                                 <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
53                                 <parameter name="level" value="info" />
54                                 <parameter name="field1" value="Setting variables for A1 Adapter getting status for Policy Instance."/>
55                                 <parameter name="field2" value="`$tmp.near-rt-ric-id`"/>
56                                 <parameter name="field3" value="`$tmp.policy-type-id`"/>
57                                 <parameter name="field4" value="`$tmp.policy-instance-id`"/>
58                                 <parameter name="field5" value="`$tmp.restapi.policyinstance-url`"/>
59                             </record>
60                             <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
61                                 <parameter name="restapiUrl" value="`$prop.a1Mediator.url + '/' + $tmp.restapi.policyinstance-url`"/>
62                                 <parameter name="format" value="json"/>
63                                 <parameter name="httpMethod" value="GET"/>
64                                 <parameter name="responsePrefix" value="a1MediatorRsp"/>
65                                 <parameter name='contentType' value='application/json' />
66                                 <parameter name='accept' value='application/json' />
67                                 <parameter name="convertResponse" value="false"/>
68                                 <outcome value='success'>
69                                     <block>
70                                         <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
71                                             <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
72                                             <parameter name="level" value="info" />
73                                             <parameter name="field1" value="Status of A1 Policy Instance "/>
74                                             <parameter name="field2" value="`$a1MediatorRsp`"/>
75                                         </record>
76                                     </block>
77                                 </outcome>
78                                 <outcome value='failure'>
79                                     <block>
80                                         <set>
81                                             <parameter name='response-code' value='500'/>
82                                             <parameter name='response-message' value='Seems A1 Mediator Not Healthy'/>
83                                         </set>
84                                         <return status='failure'>
85                                             <parameter name='ack-final' value='Y'/>
86                                             <parameter name="response-code" value="500" />
87                                             <parameter name="response-message" value="Error in Getting status for A1 Policy Instance. Aborting" />
88                                         </return>
89                                         <block atomic='true'>
90                                             <set>
91                                                 <parameter name='tmp.a1-adapter-api.rpc-name' value='getStatus'/>
92                                                 <parameter name='tmp.a1Adapter-dmaap-resp.status-code' value='`$response-code`'/>
93                                                 <parameter name='tmp.a1Adapter-dmaap-resp.status-value' value='`$response-message`'/>
94                                                 <parameter name='tmp.a1Policy-dmaap-resp.payload' value="Working On it" />
95                                             </set>
96                                             <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
97                                                 <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
98                                                 <parameter name="level" value="info" />
99                                                 <parameter name="field1" value="__TIMESTAMP__"/>
100                                                 <parameter name="field2" value="Before DMAAP Event - template file name, restapiURL"/>
101                                                 <parameter name='field3' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
102                                                 <parameter name='field4' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
103                                                 <parameter name='field5' value="Status Code and Status Value to be published" />
104                                                 <parameter name='field6' value="`$tmp.a1Adapter-dmaap-resp.status-code`" />
105                                                 <parameter name='field7' value="`$tmp.a1Adapter-dmaap-resp.status-value`" />
106                                                 <parameter name='field8' value="A1 Adapter DMAAP Response Payload" />
107                                                 <parameter name='field9' value="`$tmp.a1Policy-dmaap-resp.payload`" />
108                                                 <parameter name='field10' value="RPC Name" />
109                                                 <parameter name='field11' value="`$tmp.a1-adapter-api.rpc-name`" />
110                                             </record>
111                                             <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
112                                                 <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
113                                                 <parameter name='restapiUrl' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
114                                                 <parameter name='format' value='json' />
115                                                 <parameter name='httpMethod' value='POST' />
116                                                 <parameter name='contentType' value='application/json' />
117                                                 <parameter name='responsePrefix' value='dmaap' />
118                                                 <outcome value='failure'>
119                                                     <block>
120                                                         <return status='failure'>
121                                                             <parameter name='ack-final' value='Y'/>
122                                                             <parameter name="response-code" value="500" />
123                                                             <parameter name="response-message" value="Error publishing DMAAP A1 Policy Response message. " />
124                                                         </return>
125                                                     </block>
126                                                 </outcome>
127                                                 <outcome value='success'>
128                                                     <block>
129                                                         <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
130                                                             <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
131                                                             <parameter name="level" value="info" />
132                                                             <parameter name="field1" value="DMAAP A1Policy message Successfully Published "/>
133                                                         </record>
134                                                     </block>
135                                                 </outcome>
136                                             </execute>
137                                         </block>
138                                     </block>
139                                 </outcome>
140                             </execute>
141                         </block>
142                     </block>
143                 </outcome>
144                 <outcome value='false'>
145                     <block>
146                         <set>
147                             <parameter name='response-code' value='500'/>
148                             <parameter name='response-message' value='A1 Mediator Not Deployed'/>
149                         </set>
150                         <block atomic='true'>
151                             <set>
152                                 <parameter name='tmp.a1-adapter-api.rpc-name' value='getStatus'/>
153                                 <parameter name='tmp.a1Adapter-dmaap-resp.status-code' value='`$response-code`'/>
154                                 <parameter name='tmp.a1Adapter-dmaap-resp.status-value' value='`$response-message`'/>
155                                 <parameter name='tmp.a1Policy-dmaap-resp.payload' value="Working On it" />
156                             </set>
157                             <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
158                                 <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
159                                 <parameter name="level" value="info" />
160                                 <parameter name="field1" value="__TIMESTAMP__"/>
161                                 <parameter name="field2" value="Before DMAAP Event - template file name, restapiURL"/>
162                                 <parameter name='field3' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
163                                 <parameter name='field4' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
164                                 <parameter name='field5' value="Status Code and Status Value to be published" />
165                                 <parameter name='field6' value="`$tmp.a1Adapter-dmaap-resp.status-code`" />
166                                 <parameter name='field7' value="`$tmp.a1Adapter-dmaap-resp.status-value`" />
167                                 <parameter name='field8' value="A1 Adapter DMAAP Response Payload" />
168                                 <parameter name='field9' value="`$tmp.a1Policy-dmaap-resp.payload`" />
169                                 <parameter name='field10' value="RPC Name" />
170                                 <parameter name='field11' value="`$tmp.a1-adapter-api.rpc-name`" />
171                             </record>
172                             <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
173                                 <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
174                                 <parameter name='restapiUrl' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
175                                 <parameter name='format' value='json' />
176                                 <parameter name='httpMethod' value='POST' />
177                                 <parameter name='contentType' value='application/json' />
178                                 <parameter name='responsePrefix' value='dmaap' />
179                                 <outcome value='failure'>
180                                     <block>
181                                         <return status='failure'>
182                                             <parameter name='ack-final' value='Y'/>
183                                             <parameter name="response-code" value="500" />
184                                             <parameter name="response-message" value="Error publishing DMAAP A1 Policy Response message. " />
185                                         </return>
186                                     </block>
187                                 </outcome>
188                                 <outcome value='success'>
189                                     <block>
190                                         <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
191                                             <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
192                                             <parameter name="level" value="info" />
193                                             <parameter name="field1" value="DMAAP A1Policy message Successfully Published "/>
194                                         </record>
195                                     </block>
196                                 </outcome>
197                             </execute>
198                         </block>
199                         <return status='failure'>
200                             <parameter name='ack-final' value='Y'/>
201                             <parameter name="response-code" value="500" />
202                             <parameter name="response-message" value="Error in getting status for A1 Policy Instance. Aborting" />
203                         </return>
204                     </block>
205                 </outcome>
206             </switch>
207             <block>
208                 <block atomic='true'>
209                     <set>
210                         <parameter name='tmp.a1-adapter-api.rpc-name' value='getStatus'/>
211                         <parameter name='tmp.a1Adapter-dmaap-resp.status-code' value='`$response-code`'/>
212                         <parameter name='tmp.a1Adapter-dmaap-resp.status-value' value='`$response-message`'/>
213                         <parameter name='tmp.a1Policy-dmaap-resp.payload' value="Working On it" />
214                     </set>
215                     <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
216                         <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
217                         <parameter name="level" value="info" />
218                         <parameter name="field1" value="__TIMESTAMP__"/>
219                         <parameter name="field2" value="Before DMAAP Event - template file name, restapiURL"/>
220                         <parameter name='field3' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
221                         <parameter name='field4' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
222                         <parameter name='field5' value="Status Code and Status Value to be published" />
223                         <parameter name='field6' value="`$tmp.a1Adapter-dmaap-resp.status-code`" />
224                         <parameter name='field7' value="`$tmp.a1Adapter-dmaap-resp.status-value`" />
225                         <parameter name='field8' value="A1 Adapter DMAAP Response Payload" />
226                         <parameter name='field9' value="`$tmp.a1Policy-dmaap-resp.payload`" />
227                         <parameter name='field10' value="RPC Name" />
228                         <parameter name='field11' value="`$tmp.a1-adapter-api.rpc-name`" />
229                     </record>
230                     <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
231                         <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' +  $prop.restapi.dmaap-publish-generic-response.template`" />
232                         <parameter name='restapiUrl' value="`$prop.dmaap-message-router.url + $prop.a1Adapter-dmaap-policy-response.topic`" />
233                         <parameter name='format' value='json' />
234                         <parameter name='httpMethod' value='POST' />
235                         <parameter name='contentType' value='application/json' />
236                         <parameter name='responsePrefix' value='dmaap' />
237                         <outcome value='failure'>
238                             <block>
239                                 <return status='failure'>
240                                     <parameter name='ack-final' value='Y'/>
241                                     <parameter name="response-code" value="500" />
242                                     <parameter name="response-message" value="Error publishing DMAAP A1 Policy Response message. " />
243                                 </return>
244                             </block>
245                         </outcome>
246                         <outcome value='success'>
247                             <block>
248                                 <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
249                                     <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
250                                     <parameter name="level" value="info" />
251                                     <parameter name="field1" value="DMAAP A1Policy message Successfully Published "/>
252                                 </record>
253                             </block>
254                         </outcome>
255                     </execute>
256                 </block>
257                 <return status='success'>
258                     <parameter name="ack-final-indicator" value="Y" />
259                     <parameter name="error-code" value="200" />
260                     <parameter name="error-message" value="`$error-message`" />
261                     <parameter name='response-code' value='200' />
262                     <parameter name='response-message' value='getStatus executed successfully'/>
263                     <parameter name='ack-final' value='Y'/>
264                 </return>
265             </block>
266         </block>
267     </method>
268 </service-logic>

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use