Add generic-resource-api DG seed code
[sdnc/oam.git] / platform-logic / generic-resource-api / src / main / xml / GENERIC-RESOURCE-API_vf-module-topology-operation-unassign.xml
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_vf-module-topology-operation-unassign.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_vf-module-topology-operation-unassign.xml
new file mode 100755 (executable)
index 0000000..79351b2
--- /dev/null
@@ -0,0 +1,111 @@
+<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
+<block atomic="true"><switch test='`$vf-module-topology-operation-input.request-information.request-action`'>\r
+<outcome value='DeleteVfModuleInstance'>\r
+<block>\r
+</block></outcome><outcome value='Other'>\r
+<return status='failure'>\r
+       <parameter name='ack-final' value='Y'/>\r
+       <parameter name="error-code" value="500" />\r
+    <parameter name="error-message" value="If svc-action is 'deactivate' then request-action must be 'DeleteVfModuleInstance'" />\r
+</return></outcome></switch><set>\r
+<parameter name='vnf-index' value='-1' />\r
+</set><switch test='`$service-data.vnfs.vnf_length`'>\r
+<outcome value=''>\r
+<return status='failure'>\r
+       <parameter name='ack-final' value='Y'/>\r
+       <parameter name="error-code" value="500" />\r
+    <parameter name="error-message" value="There are no VNFs defined in MD-SAL" />\r
+</return></outcome><outcome value='Other'>\r
+<for index='idx' start='0' end='`$service-data.vnfs.vnf_length`' >\r
+<switch test='`$service-data.vnfs.vnf[$idx].vnf-id == $vf-module-topology-operation-input.vnf-information.vnf-id`'>\r
+<outcome value='true'>\r
+<block>\r
+<set>\r
+<parameter name='vnf-index' value='`$idx`' />\r
+</set><break/></block></outcome></switch></for></outcome></switch><switch test='`$vnf-index`'>\r
+<outcome value='-1'>\r
+<return status='failure'>\r
+       <parameter name='ack-final' value='Y'/>\r
+       <parameter name="error-code" value="500" />\r
+    <parameter name="error-message" value="`'Unable to find VNF ID ' + $vf-module-topology-operation-input.vnf-information.vnf-id + ' in MD-SAL'`" />\r
+</return></outcome></switch><set>\r
+<parameter name='vf-module-index' value='-1' />\r
+</set><switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`'>\r
+<outcome value=''>\r
+<return status='failure'>\r
+       <parameter name='ack-final' value='Y'/>\r
+       <parameter name="error-code" value="500" />\r
+    <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
+</return></outcome><outcome value='Other'>\r
+<for index='idx' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`' >\r
+<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
+<outcome value='true'>\r
+<block>\r
+<set>\r
+<parameter name='vf-module-index' value='`$idx`' />\r
+</set><break/></block></outcome></switch></for></outcome></switch><switch test='`$vf-module-index`'>\r
+<outcome value='-1'>\r
+<return status='failure'>\r
+       <parameter name='ack-final' value='Y'/>\r
+       <parameter name="error-code" value="500" />\r
+    <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
+</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
+<outcome value='Created'>\r
+<return status='failure'>\r
+       <parameter name='ack-final' value='Y'/>\r
+       <parameter name="error-code" value="500" />\r
+    <parameter name="error-message" value="Order status must not be Created" />\r
+</return></outcome><outcome value='Other'>\r
+<block atomic="true"></block></outcome></switch><set>\r
+<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
+</set><update plugin="org.onap.ccsdk.sli.adaptors.sli.resource.sql.SqlResource" resource="SQL"\r
+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
+<return status='failure'>\r
+       <parameter name='ack-final' value='Y'/>\r
+       <parameter name="error-code" value="500" />\r
+    <parameter name="error-message" value="Error updating EIPAM_IP_ASSIGNMENTS table" />\r
+</return></outcome></update><!--EIPAM plug-in needs this attribute set with this name--><set>\r
+<parameter name='service-data.service-information.service-type' value='`$service-data.service-information.subscription-service-type`' />\r
+</set><execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="unassignIPAddress">\r
+<parameter name="deleteEIPAM_status" value="`$tmp.status`" />\r
+<outcome value='failure'>\r
+<return status='failure'>\r
+       <parameter name='ack-final' value='Y'/>\r
+       <parameter name="error-code" value="500" />\r
+    <parameter name="error-message" value="Error in EIPAM unassign IP address" />\r
+</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
+<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
+<block atomic="true"><delete plugin='org.onap.ccsdk.sli.adaptors.sli.resource.sql.SqlResource' resource='SQL'\r
+  key='DELETE from VIPR_CONFIGURATION WHERE vnf_id = $service-data.vnfs.vnf[$vnf-index].vnf-id\r
+     AND ecomp_service_instance_id = $service-data.service-information.service-instance-id\r
+     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
+<record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">\r
+<parameter name="logger" value="message-log"/>\r
+<parameter name="field1" value="__TIMESTAMP__"/>\r
+<parameter name="field2" value="GENERIC-RESOURCE-API.vf-module-topology-operation-assign:REQID"/>\r
+<parameter name="field3" value="`$vf-module-topology-operation-input.sdnc-request-header.svc-request-id`"/>\r
+<parameter name="field4" value="Failed to insert VIPR_CONFIGURATION record"/>\r
+</record></outcome></delete></block></for></for><switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`'>\r
+<outcome value='1'>\r
+<set>\r
+       <parameter name="service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules." value=""/>\r
+\r
+</set></outcome><outcome value='Other'>\r
+<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
+<set>\r
+       <parameter name="tmpidx" value="`$idx - 1`"/>\r
+       <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
+       \r
+</set></for><!--EIPAM plug-in needs this attribute set with this name--><set>\r
+<parameter name='lastidx' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length - 1`' />\r
+</set><set>\r
+       <parameter name="service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$lastidx]." value=""/>\r
+</set><set>\r
+       <parameter name="service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length" value="`$lastidx`"/>\r
+\r
+       \r
+</set></block></outcome></switch><return status='success'>\r
+<parameter name="ack-final-indicator" value="Y" />\r
+<parameter name="error-code" value="200" />\r
+<parameter name="error-message" value="`$error-message`" />\r
+</return></block></method></service-logic>