aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2018-09-04 11:05:05 -0400
committerAlexis de Talhouët <alexis.de_talhouet@bell.ca>2018-09-05 19:39:22 +0000
commitdb323d0fa39eabc03faf8c803876da5f87079e58 (patch)
treea8c18c828f430f24a121cb57f94df283763f8fca /platform-logic/generic-resource-api/src/main/xml
parent0c99d4765288c57ebf990c58b226f62a2dd3b348 (diff)
Make netbox-ip-assignment resolve all params
While resolving params, multiple of them could be resolved using the same capability. Adding the functionality in this self-serve DG to make sure it's processing all the param involving this capability Change-Id: I7f4d83bf5cfa90e4959fa8599a26b1cf0228a81a Issue-ID: CCSDK-339 Issue-ID: CCSDK-340 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com> Former-commit-id: 059370a180fc6630eea5f771fb61e303132f4352
Diffstat (limited to 'platform-logic/generic-resource-api/src/main/xml')
-rw-r--r--platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-netbox-ip-assignment.xml311
1 files changed, 311 insertions, 0 deletions
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-netbox-ip-assignment.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-netbox-ip-assignment.xml
new file mode 100644
index 00000000..167ab43e
--- /dev/null
+++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-netbox-ip-assignment.xml
@@ -0,0 +1,311 @@
+<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-netbox-ip-assignment' mode='sync'>
+ <block atomic="true">
+ <switch test='`$ss.capability-name`'>
+ <outcome value=''>
+ <return status="failure">
+ <parameter name="ack-final" value="Y" />
+ <parameter name="error-code" value="500"/>
+ <parameter name="error-message" value="ss.capability-name is null" />
+ </return>
+ </outcome>
+ </switch>
+ <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>
+ </switch>
+ <call module='GENERIC-RESOURCE-API' rpc='self-service-capability-param-resolution' mode='sync' >
+ <outcome value='failure'>
+ <return status="failure">
+ <parameter name="ack-final" value="Y" />
+ <parameter name="error-code" value="500"/>
+ <parameter name="error-message" value="`'Not all assignments are resolved' + $error-message`" />
+ </return>
+ </outcome>
+ </call>
+ <block>
+ <for index="pidx" 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-parameters.param_length`">
+ <set>
+ <parameter name='tmp.ss.param.capability-name'
+ value='`$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[$pidx].resource-resolution-data.capability-name`' />
+ </set>
+ <set>
+ <parameter name='tmp.ss.param.name'
+ value='`$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[$pidx].name`' />
+ </set>
+ <switch test='`$tmp.ss.param.capability-name == $ss.capability-name`'>
+ <outcome value='true'>
+ <switch test='`$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[$pidx].resource-resolution-data.status`'>
+ <outcome value='FAILED'>
+ <block>
+ <for index="kidx" 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-parameters.param[$pidx].resource-resolution-data.resource-key_length`">
+ <switch test='`$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[$pidx].resource-resolution-data.resource-key[$kidx].name`'>
+ <outcome value='service-instance-id'>
+ <set>
+ <parameter name='tmp.ss.service-instance-id' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ <outcome value='vf-module-id'>
+ <set>
+ <parameter name='tmp.ss.vf-module-id' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ <outcome value='prefix-id'>
+ <set>
+ <parameter name='tmp.ss.prefix-id' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ <outcome value='ip-address-id'>
+ <set>
+ <parameter name='tmp.ss.ip-address-id' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ <outcome value='external_key'>
+ <set>
+ <parameter name='tmp.ss.external-key' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ </switch>
+ </for>
+ <switch test='`$ss.capability-action`'>
+ <outcome value='assign'>
+ <block atomic='true'>
+ <execute plugin="org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient" method="assignIpAddress">
+ <parameter name="service_instance_id" value="`$tmp.ss.service-instance-id`" />
+ <parameter name="vf_module_id" value="`$tmp.ss.vf-module-id`" />
+ <parameter name="prefix_id" value="`$tmp.ss.prefix-id`" />
+ <parameter name="resource_name" value="`$tmp.ss.param.name`" />
+ <parameter name="external_key" value="`$tmp.ss.external-key`" />
+ <outcome value='failure'>
+ <block atomic='true'>
+ <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[$pidx].resource-resolution-data.status' value='FAILED' />
+ </set>
+ <return status='failure'>
+ <parameter name='error-code' value='' />
+ <parameter name='error-message' value='' />
+ </return>
+ </block>
+ </outcome>
+ </execute>
+ <for index="pidx" 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-parameters.param_length`">
+ <switch test='`$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[$pidx].name`'>
+ <outcome value='`$tmp.ss.param.name`'>
+ <block>
+ <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[$pidx].value'
+ value='`$self_serve_netbox_ip_assignement.ip-address`' />
+ </set>
+ <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[$pidx].resource-resolution-data.status'
+ value='SUCCESS' />
+ </set>
+ </block>
+ </outcome>
+ </switch>
+ </for>
+ </block>
+ </outcome>
+ <outcome value='unassign'>
+ <block atomic="true">
+ <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
+ key='SELECT * from IPAM_IP_ASSIGNEMENT
+ WHERE external_key = $tmp.ss.external-key
+ AND service_instance_id = $tmp.ss.service-instance-id' >
+ <outcome value='not-found'>
+ <block></block>
+ </outcome>
+ <outcome value='success'>
+ <block atomic="true">
+ <set>
+ <parameter name='tmp.status' value="PENDING_DELETE" />
+ </set>
+ <update plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL"
+ key="UPDATE IPAM_IP_ASSIGNEMENT set ip_status = $tmp.status
+ WHERE external_key = $tmp.ss.external-key
+ AND service_instance_id = $tmp.ss.service-instance-id" >
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="`'Error updating NETBOX_IP_ASSIGNMENTS table to unassign ip with external_key=' + $tmp.ss.external-key + ' and service_instance_id=' + $tmp.ss.service-instance-id`" />
+ </return>
+ </outcome>
+ </update>
+ <execute plugin="org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient" method="unassignIpAddress">
+ <parameter name="service_instance_id" value="`$tmp.ss.service-instance-id`" />
+ <parameter name="external_key" value="`$tmp.ss.external-key`" />
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="`'Error in NetboxClient#unassignIPAddress with external-key='+ $tmp.ss.external-key`" />
+ </return>
+ </outcome>
+ </execute>
+ </block>
+ </outcome>
+ </get-resource>
+ <for index="pidx" 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-parameters.param_length`">
+ <switch test='`$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[$pidx].name`'>
+ <outcome value='ip-address'>
+ <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[$pidx].resource-resolution-data.status'
+ value='DELETED' />
+ </set>
+ </outcome>
+ </switch>
+ </for>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </outcome>
+ <outcome value='PENDING'>
+ <block>
+ <for index="kidx" 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-parameters.param[$pidx].resource-resolution-data.resource-key_length`">
+ <switch test='`$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[$pidx].resource-resolution-data.resource-key[$kidx].name`'>
+ <outcome value='service-instance-id'>
+ <set>
+ <parameter name='tmp.ss.service-instance-id' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ <outcome value='vf-module-id'>
+ <set>
+ <parameter name='tmp.ss.vf-module-id' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ <outcome value='prefix-id'>
+ <set>
+ <parameter name='tmp.ss.prefix-id' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ <outcome value='ip-address-id'>
+ <set>
+ <parameter name='tmp.ss.ip-address-id' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ <outcome value='external_key'>
+ <set>
+ <parameter name='tmp.ss.external-key' value='`$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[$pidx].resource-resolution-data.resource-key[$kidx].value`' />
+ </set>
+ </outcome>
+ </switch>
+ </for>
+ <switch test='`$ss.capability-action`'>
+ <outcome value='assign'>
+ <block atomic='true'>
+ <execute plugin="org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient" method="assignIpAddress">
+ <parameter name="service_instance_id" value="`$tmp.ss.service-instance-id`" />
+ <parameter name="vf_module_id" value="`$tmp.ss.vf-module-id`" />
+ <parameter name="prefix_id" value="`$tmp.ss.prefix-id`" />
+ <parameter name="resource_name" value="`$tmp.ss.param.name`" />
+ <parameter name="external_key" value="`$tmp.ss.external-key`" />
+ <outcome value='failure'>
+ <block atomic='true'>
+ <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[$pidx].resource-resolution-data.status' value='FAILED' />
+ </set>
+ <return status='failure'>
+ <parameter name='error-code' value='' />
+ <parameter name='error-message' value='' />
+ </return>
+ </block>
+ </outcome>
+ </execute>
+ <for index="pidx" 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-parameters.param_length`">
+ <switch test='`$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[$pidx].name`'>
+ <outcome value='`$tmp.ss.param.name`'>
+ <block>
+ <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[$pidx].value'
+ value='`$self_serve_netbox_ip_assignement.ip-address`' />
+ </set>
+ <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[$pidx].resource-resolution-data.status'
+ value='SUCCESS' />
+ </set>
+ </block>
+ </outcome>
+ </switch>
+ </for>
+ </block>
+ </outcome>
+ <outcome value='unassign'>
+ <block atomic="true">
+ <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
+ key='SELECT * from IPAM_IP_ASSIGNEMENT
+ WHERE external_key = $tmp.ss.external-key
+ AND service_instance_id = $tmp.ss.service-instance-id' >
+ <outcome value='not-found'>
+ <block></block>
+ </outcome>
+ <outcome value='success'>
+ <block atomic="true">
+ <set>
+ <parameter name='tmp.status' value="PENDING_DELETE" />
+ </set>
+ <update plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL"
+ key="UPDATE IPAM_IP_ASSIGNEMENT set ip_status = $tmp.status
+ WHERE external_key = $tmp.ss.external-key
+ AND service_instance_id = $tmp.ss.service-instance-id" >
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="`'Error updating NETBOX_IP_ASSIGNMENTS table to unassign ip with external_key=' + $tmp.ss.external-key + ' and service_instance_id=' + $tmp.ss.service-instance-id`" />
+ </return>
+ </outcome>
+ </update>
+ <execute plugin="org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient" method="unassignIpAddress">
+ <parameter name="service_instance_id" value="`$tmp.ss.service-instance-id`" />
+ <parameter name="external_key" value="`$tmp.ss.external-key`" />
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="`'Error in NetboxClient#unassignIPAddress with external-key='+ $tmp.ss.external-key`" />
+ </return>
+ </outcome>
+ </execute>
+ </block>
+ </outcome>
+ </get-resource>
+ <for index="pidx" 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-parameters.param_length`">
+ <switch test='`$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[$pidx].name`'>
+ <outcome value='ip-address'>
+ <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[$pidx].resource-resolution-data.status'
+ value='DELETED' />
+ </set>
+ </outcome>
+ </switch>
+ </for>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </outcome>
+ </switch>
+ </outcome>
+ </switch>
+ </for>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log"/>
+ <parameter name="field1" value="__TIMESTAMP__"/>
+ <parameter name="field2" value="`'SS: pidx: ' + $pidx`"/>
+ </record>
+ </block>
+ <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='printContext' >
+ <parameter name='filename' value='/var/tmp/ss.eipam.log' />
+ </execute>
+ </block>
+ </method>
+</service-logic> \ No newline at end of file