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