aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-aai-vnf-put.xml
blob: e791088156789f31db84fe59fe290c7214d7db07 (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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<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='GENERIC-RESOURCE-API' version='${project.version}'>
    <method rpc='self-serve-aai-vnf-put' mode='sync'>
        <block atomic="true">
            <switch test='`$ss.capability-action`'>
                <outcome value=''>
                    <return status="failure">
                        <parameter name="ack-final" value="Y" />
                        <parameter name="error-code" value="500"/>
                        <parameter name="error-message" value="ss.capability-action is null" />
                    </return>
                </outcome>
                <outcome value='assign'>
                    <block atomic='true'>
                        <for silentFailure='true' index="aidx" start="0" end="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`">
                            <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$aidx].name`'>
                                <outcome value='vnf_name'>
                                    <set>
                                        <parameter name='ss.param.vnf-name' value ='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$aidx].value`' />
                                        <parameter name='ss.param.vnf-name-index' value='`$aidx`' />
                                    </set>
                                </outcome>
                                <outcome value='vnf_id'>
                                    <set>
                                        <parameter name='ss.param.vnf-id' value ='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$aidx].value`' />
                                        <parameter name='ss.param.vnf-id-index' value='`$aidx`' />
                                    </set>
                                </outcome>
                                <outcome value='license-assignment-group-uuid'>
                                    <set>
                                        <parameter name='ss.param.license-assignment-group-uuid' value ='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$aidx].value`' />
                                        <parameter name='ss.param.license-assignment-group-uuid-index' value='`$aidx`' />
                                    </set>
                                </outcome>
                                <outcome value='entitlement-assignment-group-uuid'>
                                    <set>
                                        <parameter name='ss.param.entitlement-assignment-group-uuid' value ='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$aidx].value`' />
                                        <parameter name='ss.param.entitlement-assignment-group-uuid-index' value='`$aidx`' />
                                    </set>
                                </outcome>
                                <outcome value='aai-vnf-put'>
                                    <set>
                                        <parameter name='ss.param.aai-vnf-put-index' value='`$aidx`' />
                                    </set>
                                </outcome>
                            </switch>
                        </for>
                        <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="generic-vnf"
		key="generic-vnf.vnf-id = $ss.param.vnf-id "
	pfx="tmp.aai.vnf" >
                            <outcome value='failure'>
                                <block atomic='true'>
                                    <set>
                                        <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.param.aai-vnf-put-index].resource-resolution-data.status' 
	value='FAILED' />
                                    </set>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value="`'Encountered error to get generic-vnf with vnf-id=' + $ss.param.vnf-id + ' from AnAI'`" />
                                    </return>
                                </block>
                            </outcome>
                            <outcome value='not-found'>
                                <block atomic='true'>
                                    <set>
                                        <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.param.aai-vnf-put-index].resource-resolution-data.status' 
	value='FAILED' />
                                    </set>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value="`'generic-vnf.vnf-name with vnf-id=' + $ss.param.vnf-id + ' not found in AAI'`" />
                                    </return>
                                </block>
                            </outcome>
                        </get-resource>
                        <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="generic-vnf"
		key="generic-vnf.vnf-id = $ss.param.vnf-id " >
                            <parameter name="vnf-name" value='`$ss.param.vnf-name`' />
                            <outcome value='failure'>
                                <block atomic='true'>
                                    <set>
                                        <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.param.aai-vnf-put-index].resource-resolution-data.status' 
	value='FAILED' />
                                    </set>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value="`'Failed to update generic-vnf.vnf-name in AnAI with vnf-name=' + $ss.param.vnf-name`" />
                                    </return>
                                </block>
                            </outcome>
                            <outcome value='not-found'>
                                <block atomic='true'>
                                    <set>
                                        <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.param.aai-vnf-put-index].resource-resolution-data.status' 
	value='FAILED' />
                                    </set>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value="`'generic-vnf with vnf-id =' + $ss.param.vnf-id + ' is not found in AAI'`" />
                                    </return>
                                </block>
                            </outcome>
                        </update>
                        <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="license"
		key="license.group-uuid = $ss.param.license-assignment-group-uuid 
		AND license.resource-uuid = $ss.param.license-key
		AND generic-vnf.vnf-id = $ss.param.vnf-id" >
                            <parameter name="group-uuid" value='`$ss.param.license-assignment-group-uuid`' />
                            <parameter name="resource-uuid" value='`$ss.param.license-key`' />
                            <outcome value='failure'>
                                <block atomic='true'>
                                    <block>
                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                            <parameter name="logger" value="message-log"/>
                                            <parameter name="field1" value="ROLLBACK generic-vnf update"/>
                                        </record>
                                        <set>
                                            <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$ss.param.aai-vf-put-index].resource-resolution-data.status' 
	value='FAILED' />
                                        </set>
                                        <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="generic-vnf"
		key="generic-vnf.vnf-id = $ss.param.vnf-id " >
                                            <parameter name="vnf-name" value='`$tmp.aai.vnf.vnf-anme`' />
                                            <outcome value='failure'>
                                                <set>
                                                    <parameter name='error-message' value="`' Failed to rollback generic-vnf update in AnAI. MANUAL ROLLBACK IS REQUIRED! '`" />
                                                </set>
                                            </outcome>
                                            <outcome value='not-found'>
                                                <set>
                                                    <parameter name='error-message' value="`' Failed to rollback generic-vnf update because generic-vnf with vnf-id = ' + $ss.param.vnf-id + ' is not found in AAI. MANUAL ROLLBACK IS REQUIRED! '`" />
                                                </set>
                                            </outcome>
                                            <outcome value='success'>
                                                <set>
                                                    <parameter name='error-message' value=" Rollback of generic-vnf update completed. " />
                                                </set>
                                            </outcome>
                                        </update>
                                    </block>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value="`'Failed to save license with group-uuid = ' + $ss.param.license-assignment-group-uuid + ' AND license.resource-uuid = ' + $ss.param.license-key + ' in AAI'`" />
                                    </return>
                                </block>
                            </outcome>
                            <outcome value='not-found'>
                                <block atomic='true'>
                                    <block>
                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                            <parameter name="logger" value="message-log"/>
                                            <parameter name="field1" value="ROLLBACK generic-vnf update"/>
                                        </record>
                                        <set>
                                            <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$ss.param.aai-vf-put-index].resource-resolution-data.status' 
	value='FAILED' />
                                        </set>
                                        <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="generic-vnf"
		key="generic-vnf.vnf-id = $ss.param.vnf-id " >
                                            <parameter name="vnf-name" value='`$tmp.aai.vnf.vnf-anme`' />
                                            <outcome value='failure'>
                                                <set>
                                                    <parameter name='error-message' value="`' Failed to rollback generic-vnf update in AnAI. MANUAL ROLLBACK IS REQUIRED! '`" />
                                                </set>
                                            </outcome>
                                            <outcome value='not-found'>
                                                <set>
                                                    <parameter name='error-message' value="`' Failed to rollback generic-vnf update because generic-vnf with vnf-id = ' + $ss.param.vnf-id + ' is not found in AAI. MANUAL ROLLBACK IS REQUIRED! '`" />
                                                </set>
                                            </outcome>
                                            <outcome value='success'>
                                                <set>
                                                    <parameter name='error-message' value=" Rollback of generic-vnf update completed. " />
                                                </set>
                                            </outcome>
                                        </update>
                                    </block>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value="`'license with group-uuid = ' + $ss.param.license-assignment-group-uuid + ' AND license.resource-uuid = ' + $ss.param.license-key + ' is not found in AAI'`" />
                                    </return>
                                </block>
                            </outcome>
                        </save>
                        <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="entitlement"
		key="entitlement.group-uuid = $ss.param.entitlement-assignment-group-uuid 
		AND entitlement.resource-uuid = $ss.param.entitlement-key
		AND generic-vnf.vnf-id = $ss.param.vnf-id" >
                            <parameter name="group-uuid" value='`$ss.param.entitlement-assignment-group-uuid`' />
                            <parameter name="resource-uuid" value='`$ss.param.entitlement-key`' />
                            <outcome value='failure'>
                                <block atomic='true'>
                                    <block>
                                        <block>
                                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                                <parameter name="logger" value="message-log"/>
                                                <parameter name="field1" value="ROLLBACK generic-vnf update"/>
                                            </record>
                                            <set>
                                                <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$ss.param.aai-vf-put-index].resource-resolution-data.status' 
	value='FAILED' />
                                            </set>
                                            <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="generic-vnf"
		key="generic-vnf.vnf-id = $ss.param.vnf-id " >
                                                <parameter name="vnf-name" value='`$tmp.aai.vnf.vnf-anme`' />
                                                <outcome value='failure'>
                                                    <set>
                                                        <parameter name='error-message' value="`' Failed to rollback generic-vnf update in AnAI. MANUAL ROLLBACK IS REQUIRED! '`" />
                                                    </set>
                                                </outcome>
                                                <outcome value='not-found'>
                                                    <set>
                                                        <parameter name='error-message' value="`' Failed to rollback generic-vnf update because generic-vnf with vnf-id = ' + $ss.param.vnf-id + ' is not found in AAI. MANUAL ROLLBACK IS REQUIRED! '`" />
                                                    </set>
                                                </outcome>
                                                <outcome value='success'>
                                                    <set>
                                                        <parameter name='error-message' value=" Rollback of generic-vnf update completed. " />
                                                    </set>
                                                </outcome>
                                            </update>
                                        </block>
                                        <block>
                                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                                <parameter name="logger" value="message-log"/>
                                                <parameter name="field1" value="ROLLBACK license"/>
                                            </record>
                                            <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="license"
		key="license.group-uuid = $ss.param.license-assignment-group-uuid 
		AND license.resource-uuid = $ss.param.license-key" >
                                                <outcome value='failure'>
                                                    <set>
                                                        <parameter name='error-message' value="`' Failed to rollback license with group-uuid = ' + $ss.param.license-assignment-group-uuid + ' AND license.resource-uuid = ' + $ss.param.license-key + ' in AAI. MANUAL ROLLBACK IS REQUIRED!'`" />
                                                    </set>
                                                </outcome>
                                                <outcome value='not-found'>
                                                    <set>
                                                        <parameter name='error-message' value="`' Failed to rollback license because license with group-uuid = ' + $ss.param.license-assignment-group-uuid + ' AND license.resource-uuid = ' + $ss.param.license-key + ' NOT FOUND in AAI. SILENT SUCCESS! '`" />
                                                    </set>
                                                </outcome>
                                                <outcome value='success'>
                                                    <set>
                                                        <parameter name='error-message' value=" Rollback of license completed. " />
                                                    </set>
                                                </outcome>
                                            </delete>
                                        </block>
                                    </block>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value="`'Failed to save entitlement with group-uuid = ' + $ss.param.entitlement-assignment-group-uuid + ' AND entitlement.resource-uuid = ' + $ss.param.entitlement-key + ' in AAI'`" />
                                    </return>
                                </block>
                            </outcome>
                            <outcome value='not-found'>
                                <block atomic='true'>
                                    <block>
                                        <block>
                                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                                <parameter name="logger" value="message-log"/>
                                                <parameter name="field1" value="ROLLBACK generic-vnf update"/>
                                            </record>
                                            <set>
                                                <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$ss.param.aai-vf-put-index].resource-resolution-data.status' 
	value='FAILED' />
                                            </set>
                                            <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="generic-vnf"
		key="generic-vnf.vnf-id = $ss.param.vnf-id " >
                                                <parameter name="vnf-name" value='`$tmp.aai.vnf.vnf-anme`' />
                                                <outcome value='failure'>
                                                    <set>
                                                        <parameter name='error-message' value="`' Failed to rollback generic-vnf update in AnAI. MANUAL ROLLBACK IS REQUIRED! '`" />
                                                    </set>
                                                </outcome>
                                                <outcome value='not-found'>
                                                    <set>
                                                        <parameter name='error-message' value="`' Failed to rollback generic-vnf update because generic-vnf with vnf-id = ' + $ss.param.vnf-id + ' is not found in AAI. MANUAL ROLLBACK IS REQUIRED! '`" />
                                                    </set>
                                                </outcome>
                                                <outcome value='success'>
                                                    <set>
                                                        <parameter name='error-message' value=" Rollback of generic-vnf update completed. " />
                                                    </set>
                                                </outcome>
                                            </update>
                                        </block>
                                        <block>
                                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                                <parameter name="logger" value="message-log"/>
                                                <parameter name="field1" value="ROLLBACK license"/>
                                            </record>
                                            <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="license"
		key="license.group-uuid = $ss.param.license-assignment-group-uuid 
		AND license.resource-uuid = $ss.param.license-key" >
                                                <outcome value='failure'>
                                                    <set>
                                                        <parameter name='error-message' value="`' Failed to rollback license with group-uuid = ' + $ss.param.license-assignment-group-uuid + ' AND license.resource-uuid = ' + $ss.param.license-key + ' in AAI. MANUAL ROLLBACK IS REQUIRED!'`" />
                                                    </set>
                                                </outcome>
                                                <outcome value='not-found'>
                                                    <set>
                                                        <parameter name='error-message' value="`' Failed to rollback license because license with group-uuid = ' + $ss.param.license-assignment-group-uuid + ' AND license.resource-uuid = ' + $ss.param.license-key + ' NOT FOUND in AAI. SILENT SUCCESS! '`" />
                                                    </set>
                                                </outcome>
                                                <outcome value='success'>
                                                    <set>
                                                        <parameter name='error-message' value=" Rollback of license completed. " />
                                                    </set>
                                                </outcome>
                                            </delete>
                                        </block>
                                    </block>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value="`'entitlement with group-uuid = ' + $ss.param.entitlement-assignment-group-uuid + ' AND entitlement.resource-uuid = ' + $ss.param.entitlement-key + ' is not found in AAI'`" />
                                    </return>
                                </block>
                            </outcome>
                        </save>
                        <set>
                            <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.param.aai-vnf-put-index].resource-resolution-data.status' 
	value='SUCCESS' />
                        </set>
                    </block>
                </outcome>
            </switch>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='printContext' >
                <parameter name='filename' value='/var/tmp/ss.aai.vfmoduleput.log' />
            </execute>
        </block>
    </method>
</service-logic>