1 <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='vf-module-topology-operation-unassign' mode='sync'>
\r
2 <block atomic="true"><switch test='`$vf-module-topology-operation-input.request-information.request-action`'>
\r
3 <outcome value='DeleteVfModuleInstance'>
\r
5 </block></outcome><outcome value='Other'>
\r
6 <return status='failure'>
\r
7 <parameter name='ack-final' value='Y'/>
\r
8 <parameter name="error-code" value="500" />
\r
9 <parameter name="error-message" value="If svc-action is 'deactivate' then request-action must be 'DeleteVfModuleInstance'" />
\r
10 </return></outcome></switch><set>
\r
11 <parameter name='vnf-index' value='-1' />
\r
12 </set><switch test='`$service-data.vnfs.vnf_length`'>
\r
14 <return status='failure'>
\r
15 <parameter name='ack-final' value='Y'/>
\r
16 <parameter name="error-code" value="500" />
\r
17 <parameter name="error-message" value="There are no VNFs defined in MD-SAL" />
\r
18 </return></outcome><outcome value='Other'>
\r
19 <for index='idx' start='0' end='`$service-data.vnfs.vnf_length`' >
\r
20 <switch test='`$service-data.vnfs.vnf[$idx].vnf-id == $vf-module-topology-operation-input.vnf-information.vnf-id`'>
\r
21 <outcome value='true'>
\r
24 <parameter name='vnf-index' value='`$idx`' />
\r
25 </set><break/></block></outcome></switch></for></outcome></switch><switch test='`$vnf-index`'>
\r
26 <outcome value='-1'>
\r
27 <return status='failure'>
\r
28 <parameter name='ack-final' value='Y'/>
\r
29 <parameter name="error-code" value="500" />
\r
30 <parameter name="error-message" value="`'Unable to find VNF ID ' + $vf-module-topology-operation-input.vnf-information.vnf-id + ' in MD-SAL'`" />
\r
31 </return></outcome></switch><set>
\r
32 <parameter name='vf-module-index' value='-1' />
\r
33 </set><switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`'>
\r
35 <return status='failure'>
\r
36 <parameter name='ack-final' value='Y'/>
\r
37 <parameter name="error-code" value="500" />
\r
38 <parameter name="error-message" value="`'There are no VF modules defined in MD-SAL for VNF ' + $vf-module-topology-operation-input.vnf-information.vnf-id`" />
\r
39 </return></outcome><outcome value='Other'>
\r
40 <for index='idx' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`' >
\r
41 <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$idx].vf-module-id == $vf-module-topology-operation-input.vf-module-information.vf-module-id`'>
\r
42 <outcome value='true'>
\r
45 <parameter name='vf-module-index' value='`$idx`' />
\r
46 </set><break/></block></outcome></switch></for></outcome></switch><switch test='`$vf-module-index`'>
\r
47 <outcome value='-1'>
\r
48 <return status='failure'>
\r
49 <parameter name='ack-final' value='Y'/>
\r
50 <parameter name="error-code" value="500" />
\r
51 <parameter name="error-message" value="`'Unable to find VF module ID ' + $vf-module-topology-operation-input.vf-module-information.vf-module-id + ' in MD-SAL'`" />
\r
52 </return></outcome></switch><switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-level-oper-status.order-status`'>
\r
53 <outcome value='Created'>
\r
54 <return status='failure'>
\r
55 <parameter name='ack-final' value='Y'/>
\r
56 <parameter name="error-code" value="500" />
\r
57 <parameter name="error-message" value="Order status must not be Created" />
\r
58 </return></outcome><outcome value='Other'>
\r
59 <block atomic="true"></block></outcome></switch><set>
\r
60 <parameter name='tmp.status' value="`'PENDING_DELETE_' + $service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-topology-identifier.vf-module-id`" />
\r
61 </set><update plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL"
\r
62 key="UPDATE EIPAM_IP_ASSIGNMENTS set status = $tmp.status WHERE info = $service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-topology-identifier.vf-module-id" ><outcome value='failure'>
\r
63 <return status='failure'>
\r
64 <parameter name='ack-final' value='Y'/>
\r
65 <parameter name="error-code" value="500" />
\r
66 <parameter name="error-message" value="Error updating EIPAM_IP_ASSIGNMENTS table" />
\r
67 </return></outcome></update><!--EIPAM plug-in needs this attribute set with this name--><set>
\r
68 <parameter name='service-data.service-information.service-type' value='`$service-data.service-information.subscription-service-type`' />
\r
69 </set><execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="unassignIPAddress">
\r
70 <parameter name="deleteEIPAM_status" value="`$tmp.status`" />
\r
71 <outcome value='failure'>
\r
72 <return status='failure'>
\r
73 <parameter name='ack-final' value='Y'/>
\r
74 <parameter name="error-code" value="500" />
\r
75 <parameter name="error-message" value="Error in EIPAM unassign IP address" />
\r
76 </return></outcome></execute><for silentFailure='true' index='vm-type-index' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-assignments.vms.vm_length`' >
\r
77 <for silentFailure='true' index='vm-index' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-assignments.vms.vm[$vm-type-index].vm-count`' >
\r
78 <block atomic="true"><delete plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
\r
79 key='DELETE from VIPR_CONFIGURATION WHERE vnf_id = $service-data.vnfs.vnf[$vnf-index].vnf-id
\r
80 AND ecomp_service_instance_id = $service-data.service-information.service-instance-id
\r
81 AND vm_name = $service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-assignments.vms.vm[$vm-type-index].vm-names.vm-name[$vm-index]' ><outcome value='failure'>
\r
82 <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
\r
83 <parameter name="logger" value="message-log"/>
\r
84 <parameter name="field1" value="__TIMESTAMP__"/>
\r
85 <parameter name="field2" value="GENERIC-RESOURCE-API.vf-module-topology-operation-assign:REQID"/>
\r
86 <parameter name="field3" value="`$vf-module-topology-operation-input.sdnc-request-header.svc-request-id`"/>
\r
87 <parameter name="field4" value="Failed to insert VIPR_CONFIGURATION record"/>
\r
88 </record></outcome></delete></block></for></for><switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`'>
\r
91 <parameter name="service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules." value=""/>
\r
93 </set></outcome><outcome value='Other'>
\r
94 <block atomic="true"><for index='idx' start='`$vf-module-index + 1`' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`' >
\r
96 <parameter name="tmpidx" value="`$idx - 1`"/>
\r
97 <parameter name="service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$tmpidx]." value="$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$idx]." />
\r
99 </set></for><!--EIPAM plug-in needs this attribute set with this name--><set>
\r
100 <parameter name='lastidx' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length - 1`' />
\r
102 <parameter name="service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$lastidx]." value=""/>
\r
104 <parameter name="service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length" value="`$lastidx`"/>
\r
107 </set></block></outcome></switch><return status='success'>
\r
108 <parameter name="ack-final-indicator" value="Y" />
\r
109 <parameter name="error-code" value="200" />
\r
110 <parameter name="error-message" value="`$error-message`" />
\r
111 </return></block></method></service-logic>