[SDNC-5] Rebase SDN-C oam
[sdnc/oam.git] / platform-logic / vnfapi / src / main / xml / VNF-API_vnf-topology-assign.xml
diff --git a/platform-logic/vnfapi/src/main/xml/VNF-API_vnf-topology-assign.xml b/platform-logic/vnfapi/src/main/xml/VNF-API_vnf-topology-assign.xml
new file mode 100644 (file)
index 0000000..b365142
--- /dev/null
@@ -0,0 +1,54 @@
+<service-logic xmlns='http://www.openecomp.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd' module='VNF-API' version='${project.version}'><method rpc='vnf-topology-assign' mode='sync'>\r
+<block atomic="true"><switch test="`$vnf-topology-operation-input.vnf-request-information.vnf-id == $service-data.vnf-id`"><outcome value='true'>\r
+<return status='failure'>\r
+       <parameter name='error-code' value='500'/>\r
+       <parameter name='error-message' value='vnf-id is already present in config-tree'/></return></outcome></switch><get-resource plugin="com.att.sdnctl.sli.aai.AAIService" \r
+       resource="vf-module" \r
+               key="vf-module.vf-module-id = $vnf-topology-operation-input.vnf-request-information.vnf-id \r
+                       and generic-vnf.vnf-id = $vnf-topology-operation-input.vnf-request-information.generic-vnf-id" \r
+               local-only="false" \r
+               pfx="tmp.AnAI.vfmodule" ><outcome value='failure'>\r
+<return status='failure'>\r
+       <parameter name='error-code' value='500'/>\r
+       <parameter name='error-message' value="`'Encountered error while querying vf-module from AnAI with vf-module-id = ' + $vnf-topology-operation-input.vnf-request-information.vnf-id + ' and generic-vnf-id = ' + $vnf-topology-operation-input.vnf-request-information.generic-vnf-id`"/></return></outcome><outcome value='not-found'>\r
+<return status='failure'>\r
+       <parameter name='error-code' value='500'/>\r
+       <parameter name='error-message' value="`'vf-module not found in AnAI with vf-module-id = ' + $vnf-topology-operation-input.vnf-request-information.vnf-id + ' and generic-vnf-id = ' + $vnf-topology-operation-input.vnf-request-information.generic-vnf-id`"/></return></outcome></get-resource><call module='VNF-API' rpc='vnf-topology-assign-vfmodule' mode='sync' ></call><switch test="`$service-data.vnf-topology-information.vnf-assignments.vnf-networks_length`"><outcome value=''><set>\r
+<parameter name='service-data.vnf-topology-information.vnf-assignments.vnf-networks_length' value='0' />\r
+</set></outcome></switch><for index="i" start="0" end="`$service-data.vnf-topology-information.vnf-assignments.vnf-networks_length`"><save plugin="com.att.sdnctl.sli.aai.AAIService" \r
+       resource="vf-module:relationship-list" \r
+               key="vf-module.vf-module-id = $vnf-topology-operation-input.vnf-request-information.vnf-id \r
+                       and generic-vnf.vnf-id = $vnf-topology-operation-input.vnf-request-information.generic-vnf-id" \r
+       force="true" \r
+       local-only="false">\r
+       \r
+       <parameter name="relationship-list.relationship[0].related-to" value="l3-network" />\r
+       <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="l3-network.network-id" />\r
+       <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$service-data.vnf-topology-information.vnf-assignments.vnf-networks[$i].network-id`" /><outcome value='failure'>\r
+<block atomic='true'><delete plugin="com.att.sdnctl.sli.aai.AAIService" \r
+       resource="vf-module:relationship-list" \r
+       key="vf-module.vf-module-id = $vnf-topology-operation-input.vnf-request-information.vnf-id \r
+               AND generic-vnf.vnf-id = $vnf-topology-operation-input.vnf-request-information.generic-vnf-id \r
+               AND related-to = l3-network" \r
+       force="true" \r
+       local-only="false"></delete><return status='failure'>\r
+       <parameter name='error-code' value='500'/>\r
+       <parameter name='error-message' value="`'Encountered error while saving vf-module l3-network relationship in AnAI with network-id = ' + $service-data.vnf-topology-information.vnf-assignments.vnf-networks[$i].network-id`"/></return></block></outcome></save></for><update plugin="com.att.sdnctl.sli.aai.AAIService" \r
+       resource="vf-module" \r
+               key="vf-module.vf-module-id = $vnf-topology-operation-input.vnf-request-information.vnf-id \r
+                       and generic-vnf.vnf-id = $vnf-topology-operation-input.vnf-request-information.generic-vnf-id" \r
+               local-only="false" >\r
+       <parameter name="orchestration-status" value="pending-create" /><outcome value='failure'>\r
+<block atomic="true">\r
+<delete plugin="com.att.sdnctl.sli.aai.AAIService" \r
+       resource="vf-module:relationship-list" \r
+       key="vf-module.vf-module-id = $vnf-topology-operation-input.vnf-request-information.vnf-id \r
+               AND generic-vnf.vnf-id = $vnf-topology-operation-input.vnf-request-information.generic-vnf-id \r
+               AND related-to = l3-network" \r
+       force="true" \r
+       local-only="false"></delete><return status='failure'>\r
+       <parameter name='error-code' value='500'/>\r
+       <parameter name='error-message' value="Encountered error while updating vf-module orchestration-status in AnAI"/></return></block></outcome></update><set>\r
+       <parameter name="service-data.oper-status.order-status" value="PendingCreate"/></set><set>\r
+<parameter name="ack-final" value="Y"/></set><return status='success'>\r
+       <parameter name="error-code" value="200" /></return></block></method></service-logic>
\ No newline at end of file