aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_network-topology-operation-unassign.xml
blob: 0ae9fa76e566f93977f53dcdc12b353c7efbd871 (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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
<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='network-topology-operation-unassign' mode='sync'>
        <block atomic="true">
            <switch test='`$service-data.networks.network[$nidx].network-data.network-information.from-preload`'>
                <outcome value='true'>
                    <block atomic="true">
                        <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
	resource="l3-network" 
		key="l3-network.network-id = $network-topology-operation-input.network-information.network-id" 
		local-only="false" 
		pfx="aai.l3-network">
                            <outcome value='success'>
                                <block atomic="true">
                                    <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
	resource="l3-network" 
	key="l3-network.network-id = $network-topology-operation-input.network-information.network-id">
                                        <outcome value='failure'>
                                            <return status="failure">
                                                <parameter name="error-code" value="500"/>
                                                <parameter name="error-message" value="An error occured while deleting network from AAI" />
                                            </return>
                                        </outcome>
                                    </delete>
                                </block>
                            </outcome>
                            <outcome value='not-found'></outcome>
                            <outcome value='failure'>
                                <return status='failure'>
                                    <parameter name="error-code" value="500" />
                                    <parameter name="error-message" value="'Error retrieving l3-network with network-id=' + $network-topology-operation-input.network-request-information.network-id + 'from AnAI'" />
                                </return>
                            </outcome>
                        </get-resource>
                    </block>
                </outcome>
                <outcome value='Other'>
                    <switch test='`$network-data.network-topology.network-topology-identifier-structure.network-instance-group-id`'>
                        <outcome value=''>
                            <block atomic="true">
                                <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
  key='SELECT * from NETWORK_MODEL WHERE customization_uuid = $service-data.networks.network[$nidx].network-data.network-information.onap-model-information.model-customization-uuid
  and service_uuid = $service-data.networks.network[$nidx].network-data.service-information.onap-model-information.model-uuid'
  pfx='network-model'></get-resource>
                                <set>
                                    <parameter name="tmp.level1-key-value" value=""/>
                                    <parameter name="tmp.level1inuse" value="false" />
                                    <parameter name="pidx" value="0" />
                                    <parameter name="pidx-len" value="0" />
                                </set>
                                <get-resource
        plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource'
        resource='SQL'
        key="SELECT * from EIPAM_IP_SUBNETS s, EIPAM_IP_SUBNET_KEYS k WHERE s.network_id = $network-topology-operation-input.network-information.network-id and s.entity_id = k.entity_id ; "
        pfx='tmp.eipam-subnet-row[]'>
                                    <outcome value='failure'>
                                        <return status="failure">
                                            <parameter name="tmp.eipam-error" value="true" />
                                            <parameter name="error-code" value="500"/>
                                            <parameter name="error-message" value="Query to DB table EIPAM_IP_SUBNET_KEYS and EIPAM_IP_SUBNETS failed." />
                                        </return>
                                    </outcome>
                                    <outcome value='success'>
                                        <block atomic='true'>
                                            <for silentFailure='true' index='esidx' start='0' end='`$tmp.eipam-subnet-row_length`' >
                                                <block atomic="true">
                                                    <switch test='`$tmp.eipam-subnet-row[$esidx].level`'>
                                                        <outcome value='1'>
                                                            <block atomic="true">
                                                                <set>
                                                                    <parameter name="tmp.level1-key-value[$pidx]" value="`$tmp.eipam-subnet-row[$esidx].key-value`"/>
                                                                </set>
                                                                <set>
                                                                    <parameter name="tmp.plan-name[$pidx]" value="`$tmp.eipam-subnet-row[$esidx].plan-name`"/>
                                                                </set>
                                                                <set>
                                                                    <parameter name="pidx" value="`$pidx + 1`"/>
                                                                </set>
                                                                <set>
                                                                    <parameter name="pidx-len" value="`$pidx`"/>
                                                                </set>
                                                            </block>
                                                        </outcome>
                                                        <outcome value='Other'>
                                                            <block atomic="true"></block>
                                                        </outcome>
                                                    </switch>
                                                </block>
                                            </for>
                                        </block>
                                    </outcome>
                                    <outcome value="not-found">
                                        <block atomic='true'></block>
                                    </outcome>
                                </get-resource>
                                <set>
                                    <parameter name="eipam-ip-block.network-id" value="`$network-topology-operation-input.network-information.network-id`" />
                                    <parameter name="eipam-ip-block.level" value='2' />
                                    <parameter name="eipam-ip-block.entity-id" value='' />
                                </set>
                                <!--subnet and subnet_keys are deleted in the EIPAMPlugin-->
                                <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="deallocateAllSubnets">
                                    <outcome value='failure'>
                                        <return status="failure">
                                            <parameter name="tmp.eipam-error" value="true" />
                                            <parameter name="error-code" value="500"/>
                                            <parameter name="error-message" value="An error occured while deallocating subnets in EIPAM." />
                                        </return>
                                    </outcome>
                                </execute>
                                <!--subnet and subnet_keys are deleted in the EIPAMPlugin-->
                                <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="deletePoolByNetworkLevel">
                                    <outcome value='failure'>
                                        <return status="failure">
                                            <parameter name="tmp.eipam-error" value="true" />
                                            <parameter name="error-code" value="500"/>
                                            <parameter name="error-message" value="An error occured while deleting level 2 plans in EIPAM." />
                                        </return>
                                    </outcome>
                                </execute>
                                <for silentFailure='true' index='npidx' start='0' end='`$pidx-len`' >
                                    <block atomic="true">
                                        <set>
                                            <parameter name="tmp.level1-key-value" value="`$tmp.level1-key-value[$npidx]`" />
                                            <parameter name="tmp.plan-name" value="`$tmp.plan-name[$npidx]`" />
                                        </set>
                                        <switch test='`$tmp.level1-key-value`'>
                                            <outcome value=''>
                                                <block atomic='true'></block>
                                            </outcome>
                                            <outcome value='Other'>
                                                <block atomic='true'>
                                                    <switch test='`$network-model`'>
                                                        <outcome value=''></outcome>
                                                        <outcome value='Other'>
                                                            <block atomic='true'>
                                                                <switch test="`$network-model.use-ipv4`">
                                                                    <outcome value='Y'>
                                                                        <block atomic="true">
                                                                            <set>
                                                                                <parameter name='tmp.plan-name' value='`$network-model.eipam-v4-address-plan`' />
                                                                            </set>
                                                                            <get-resource
        plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource'
        resource='SQL'
        key="SELECT * from EIPAM_IP_POOLS p, EIPAM_IP_SUBNETS s, EIPAM_IP_SUBNET_KEYS k 
        WHERE p.level = 2 
        and p.plan_name = $tmp.plan-name
        and k.level = 1 
        and p.pool_id = s.pool_id and s.entity_id = k.entity_id 
        and k.key_value = $tmp.level1-key-value  ; "
        pfx='tmp.level2pool[]'>
                                                                                <outcome value='failure'>
                                                                                    <return status="failure">
                                                                                        <parameter name="tmp.eipam-error" value="true" />
                                                                                        <parameter name="error-code" value="500"/>
                                                                                        <parameter name="error-message" value="Query to DB table EIPAM_IP_SUBNET_KEYS and EIPAM_IP_SUBNETS failed." />
                                                                                    </return>
                                                                                </outcome>
                                                                                <outcome value='success'>
                                                                                    <block atomic='true'>
                                                                                        <set>
                                                                                            <parameter name="tmp.level1inuse" value="true" />
                                                                                        </set>
                                                                                    </block>
                                                                                </outcome>
                                                                                <outcome value="not-found">
                                                                                    <block atomic='true'>
                                                                                        <get-resource
        plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource'
        resource='SQL'
        key="SELECT * from EIPAM_IP_POOLS p, EIPAM_IP_SUBNETS s, EIPAM_IP_SUBNET_KEYS k 
        WHERE p.level = 1 
        and p.plan_name = $tmp.plan-name
        and k.level = 1 
        and p.pool_id = s.pool_id and s.entity_id = k.entity_id 
        and k.key_value = $tmp.level1-key-value  ; "
        pfx='tmp.level1pool[]'>
                                                                                            <outcome value='failure'>
                                                                                                <return status="failure">
                                                                                                    <parameter name="tmp.eipam-error" value="true" />
                                                                                                    <parameter name="error-code" value="500"/>
                                                                                                    <parameter name="error-message" value="Query to DB table EIPAM_IP_SUBNET_KEYS and EIPAM_IP_SUBNETS failed." />
                                                                                                </return>
                                                                                            </outcome>
                                                                                            <outcome value='success'>
                                                                                                <block atomic='true'>
                                                                                                    <for silentFailure='true' index='lidx' start='0' end='`$tmp.level1pool_length`' >
                                                                                                        <block atomic='true'>
                                                                                                            <set>
                                                                                                                <parameter name='eipam-ip-block.entity-id' value='`$tmp.level1pool[$lidx].entity-id`' />
                                                                                                                <parameter name='eipam-ip-block.ip-address' value='`$tmp.level1pool[$lidx].ip-address`' />
                                                                                                                <parameter name='eipam-ip-block.mask' value='`$tmp.level1pool[$lidx].prefix-length`' />
                                                                                                                <parameter name="eipam-ip-block.network-id" value="`$tmp.level1pool[$lidx].network-id`" />
                                                                                                                <parameter name="eipam-ip-block.pool-id" value="`$tmp.level1pool[$lidx].pool-id`" />
                                                                                                                <parameter name="eipam-ip-block.level" value='1' />
                                                                                                            </set>
                                                                                                            <!--subnet and subnet_keys are deleted in the EIPAMPlugin-->
                                                                                                            <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="deallocateSubnet">
                                                                                                                <outcome value='failure'>
                                                                                                                    <return status="failure">
                                                                                                                        <parameter name="tmp.eipam-error" value="true" />
                                                                                                                        <parameter name="error-code" value="500"/>
                                                                                                                        <parameter name="error-message" value="An error occured while deallocating subnet in EIPAM." />
                                                                                                                    </return>
                                                                                                                </outcome>
                                                                                                            </execute>
                                                                                                            <!--subnet and subnet_keys are deleted in the EIPAMPlugin-->
                                                                                                            <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="deletePoolByPoolId">
                                                                                                                <outcome value='failure'>
                                                                                                                    <return status="failure">
                                                                                                                        <parameter name="tmp.eipam-error" value="true" />
                                                                                                                        <parameter name="error-code" value="500"/>
                                                                                                                        <parameter name="error-message" value="An error occured while deleting pool in EIPAM." />
                                                                                                                    </return>
                                                                                                                </outcome>
                                                                                                            </execute>
                                                                                                        </block>
                                                                                                    </for>
                                                                                                </block>
                                                                                            </outcome>
                                                                                            <outcome value="not-found">
                                                                                                <block atomic='true'></block>
                                                                                            </outcome>
                                                                                        </get-resource>
                                                                                    </block>
                                                                                </outcome>
                                                                            </get-resource>
                                                                        </block>
                                                                    </outcome>
                                                                </switch>
                                                                <switch test="`$network-model.use-ipv6`">
                                                                    <outcome value='Y'>
                                                                        <block atomic="true">
                                                                            <set>
                                                                                <parameter name='tmp.plan-name' value='`$network-model.eipam-v6-address-plan`' />
                                                                            </set>
                                                                            <get-resource
        plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource'
        resource='SQL'
        key="SELECT * from EIPAM_IP_POOLS p, EIPAM_IP_SUBNETS s, EIPAM_IP_SUBNET_KEYS k 
        WHERE p.level = 2 
        and p.plan_name = $tmp.plan-name
        and k.level = 1 
        and p.pool_id = s.pool_id and s.entity_id = k.entity_id 
        and k.key_value = $tmp.level1-key-value  ; "
        pfx='tmp.level2pool[]'>
                                                                                <outcome value='failure'>
                                                                                    <return status="failure">
                                                                                        <parameter name="tmp.eipam-error" value="true" />
                                                                                        <parameter name="error-code" value="500"/>
                                                                                        <parameter name="error-message" value="Query to DB table EIPAM_IP_SUBNET_KEYS and EIPAM_IP_SUBNETS failed." />
                                                                                    </return>
                                                                                </outcome>
                                                                                <outcome value='success'>
                                                                                    <block atomic='true'>
                                                                                        <set>
                                                                                            <parameter name="tmp.level1inuse" value="true" />
                                                                                        </set>
                                                                                    </block>
                                                                                </outcome>
                                                                                <outcome value="not-found">
                                                                                    <block atomic='true'>
                                                                                        <get-resource
        plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource'
        resource='SQL'
        key="SELECT * from EIPAM_IP_POOLS p, EIPAM_IP_SUBNETS s, EIPAM_IP_SUBNET_KEYS k 
        WHERE p.level = 1 
        and p.plan_name = $tmp.plan-name
        and k.level = 1 
        and p.pool_id = s.pool_id and s.entity_id = k.entity_id 
        and k.key_value = $tmp.level1-key-value  ; "
        pfx='tmp.level1pool[]'>
                                                                                            <outcome value='failure'>
                                                                                                <return status="failure">
                                                                                                    <parameter name="tmp.eipam-error" value="true" />
                                                                                                    <parameter name="error-code" value="500"/>
                                                                                                    <parameter name="error-message" value="Query to DB table EIPAM_IP_SUBNET_KEYS and EIPAM_IP_SUBNETS failed." />
                                                                                                </return>
                                                                                            </outcome>
                                                                                            <outcome value='success'>
                                                                                                <block atomic='true'>
                                                                                                    <for silentFailure='true' index='lidx' start='0' end='`$tmp.level1pool_length`' >
                                                                                                        <block atomic='true'>
                                                                                                            <set>
                                                                                                                <parameter name='eipam-ip-block.entity-id' value='`$tmp.level1pool[$lidx].entity-id`' />
                                                                                                                <parameter name='eipam-ip-block.ip-address' value='`$tmp.level1pool[$lidx].ip-address`' />
                                                                                                                <parameter name='eipam-ip-block.mask' value='`$tmp.level1pool[$lidx].prefix-length`' />
                                                                                                                <parameter name="eipam-ip-block.network-id" value="`$tmp.level1pool[$lidx].network-id`" />
                                                                                                                <parameter name="eipam-ip-block.pool-id" value="`$tmp.level1pool[$lidx].pool-id`" />
                                                                                                                <parameter name="eipam-ip-block.level" value='1' />
                                                                                                            </set>
                                                                                                            <!--subnet and subnet_keys are deleted in the EIPAMPlugin-->
                                                                                                            <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="deallocateSubnet">
                                                                                                                <outcome value='failure'>
                                                                                                                    <return status="failure">
                                                                                                                        <parameter name="tmp.eipam-error" value="true" />
                                                                                                                        <parameter name="error-code" value="500"/>
                                                                                                                        <parameter name="error-message" value="An error occured while deallocating subnet in EIPAM." />
                                                                                                                    </return>
                                                                                                                </outcome>
                                                                                                            </execute>
                                                                                                            <!--subnet and subnet_keys are deleted in the EIPAMPlugin-->
                                                                                                            <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="deletePoolByPoolId">
                                                                                                                <outcome value='failure'>
                                                                                                                    <return status="failure">
                                                                                                                        <parameter name="tmp.eipam-error" value="true" />
                                                                                                                        <parameter name="error-code" value="500"/>
                                                                                                                        <parameter name="error-message" value="An error occured while deleting pool in EIPAM." />
                                                                                                                    </return>
                                                                                                                </outcome>
                                                                                                            </execute>
                                                                                                        </block>
                                                                                                    </for>
                                                                                                </block>
                                                                                            </outcome>
                                                                                            <outcome value="not-found">
                                                                                                <block atomic='true'></block>
                                                                                            </outcome>
                                                                                        </get-resource>
                                                                                    </block>
                                                                                </outcome>
                                                                            </get-resource>
                                                                        </block>
                                                                    </outcome>
                                                                </switch>
                                                            </block>
                                                        </outcome>
                                                    </switch>
                                                </block>
                                            </outcome>
                                        </switch>
                                    </block>
                                </for>
                                <switch test='`$service-data.networks.network_length`'>
                                    <outcome value='1'>
                                        <block atomic="true">
                                            <set>
                                                <parameter name="service-data.networks." value=""/>
                                            </set>
                                            <set>
                                                <parameter name="service-data.networks.network_length" value="0"/>
                                            </set>
                                        </block>
                                    </outcome>
                                    <outcome value='Other'>
                                        <block atomic="true">
                                            <set>
                                                <parameter name="tmp.new_length" value="`$service-data.networks.network_length - 1`"/>
                                            </set>
                                            <for silentFailure='true' index='snidx' start='`$tmp.nidx + 1`' end='`$service-data.networks.network_length`' >
                                                <block atomic="true">
                                                    <set>
                                                        <parameter name="tmp.newidx" value="`$snidx - 1`"/>
                                                    </set>
                                                    <set>
                                                        <parameter name="service-data.networks.network[$tmp.newidx]." value="$service-data.networks.network[$snidx]." />
                                                    </set>
                                                </block>
                                            </for>
                                            <set>
                                                <parameter name="service-data.networks.network_length" value="`$service-data.networks.network_length - 1`"/>
                                            </set>
                                            <set>
                                                <parameter name="service-data.networks.network[$tmp.new_length]." value=""/>
                                            </set>
                                        </block>
                                    </outcome>
                                </switch>
                                <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
	resource="l3-network" 
	key="l3-network.network-id = $network-topology-operation-input.network-information.network-id">
                                    <outcome value='failure'>
                                        <return status="failure">
                                            <parameter name="error-code" value="500"/>
                                            <parameter name="error-message" value="An error occured while deleting network from AAI" />
                                        </return>
                                    </outcome>
                                </delete>
                                <set>
                                    <parameter name='naming-policy-generate-name-input.context-id' value='`$network-topology-operation-input.network-information.network-id`' />
                                    <parameter name='naming-policy-generate-name-input.naming-type' value='NETWORK' />
                                    <parameter name='naming-policy-generate-name-input.action' value='DELETE' />
                                </set>
                                <call module='GENERIC-RESOURCE-API' rpc='naming-policy-generate-name' mode='sync' ></call>
                            </block>
                        </outcome>
                        <outcome value='Other'>
                            <block atomic="true">
                                <return status='failure'>
                                    <parameter name='ack-final' value='Y'/>
                                    <parameter name="error-code" value="500" />
                                    <parameter name="error-message" value="network collection activate failed" />
                                </return>
                            </block>
                        </outcome>
                    </switch>
                </outcome>
            </switch>
            <switch test='`$service-data.networks.network_length`'>
                <outcome value='1'>
                    <block atomic="true">
                        <set>
                            <parameter name="service-data.networks." value=""/>
                        </set>
                        <set>
                            <parameter name="service-data.networks.network_length" value="0"/>
                        </set>
                    </block>
                </outcome>
                <outcome value='Other'>
                    <block atomic="true">
                        <set>
                            <parameter name="tmp.new_length" value="`$service-data.networks.network_length - 1`"/>
                        </set>
                        <for silentFailure='true' index='snidx' start='`$tmp.nidx + 1`' end='`$service-data.networks.network_length`' >
                            <block atomic="true">
                                <set>
                                    <parameter name="tmp.newidx" value="`$snidx - 1`"/>
                                </set>
                                <set>
                                    <parameter name="service-data.networks.network[$tmp.newidx]." value="$service-data.networks.network[$snidx]." />
                                </set>
                            </block>
                        </for>
                        <set>
                            <parameter name="service-data.networks.network_length" value="`$service-data.networks.network_length - 1`"/>
                        </set>
                        <set>
                            <parameter name="service-data.networks.network[$tmp.new_length]." value=""/>
                        </set>
                    </block>
                </outcome>
            </switch>
            <return status='success'>
                <parameter name="ack-final-indicator" value="Y" />
                <parameter name="error-code" value="200" />
                <parameter name="error-message" value="`$error-message`" />
            </return>
        </block>
    </method>
</service-logic>