diff options
author | Dan Timoney <dtimoney@att.com> | 2018-10-16 13:04:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-16 13:04:48 +0000 |
commit | 203df896f6ca0bcfde189ad1649542cbb212d130 (patch) | |
tree | 2f9edcdd73e5668544267dde0f223d08989ac0bd /platform-logic/generic-resource-api/src/main/xml | |
parent | 55e3407ee9aa815fec31cb1de663c93aea39b89a (diff) | |
parent | 00a4dd594c5fce63ab9961ed668c3c4bd2cbeaf9 (diff) |
Merge "Multiple self-serve fixes"
Former-commit-id: 82ba3ce5c73fcc239b413ae0e5a2a49e99989852
Diffstat (limited to 'platform-logic/generic-resource-api/src/main/xml')
3 files changed, 523 insertions, 247 deletions
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-generate-name.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-generate-name.xml index 719d009b..294ce772 100644 --- a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-generate-name.xml +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-generate-name.xml @@ -1,6 +1,6 @@ <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='1.4.1-SNAPSHOT'>
+ 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-generate-name' mode='sync'>
<block atomic="true">
<set>
@@ -107,9 +107,6 @@ <parameter name="outputPath" value="jsonContextPrefix" />
<parameter name="isEscaped" value="false" />
</execute>
- <set>
- <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$i].resource-resolution-data.status`' value='DELETED' />
- </set>
<for index='n' start='0' end='`$jsonContextPrefix.elements_length`' >
<for index='l' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`' >
<execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='contains' emitsOutcome='true' >
@@ -129,9 +126,14 @@ </execute>
<switch test='`$s2[0] == $jsonContextPrefix.elements[$n].resource-name`'>
<outcome value='true'>
- <set>
- <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$l].value`' value="`$jsonContextPrefix.elements[$n].resource-value`" />
- </set>
+ <block>
+ <set>
+ <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$l].value`' value="`$jsonContextPrefix.elements[$n].resource-value`" />
+ </set>
+ <set>
+ <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$l].resource-resolution-data.status`' value='DELETED' />
+ </set>
+ </block>
</outcome>
</switch>
</block>
@@ -231,9 +233,6 @@ <parameter name="outputPath" value="jsonContextPrefix" />
<parameter name="isEscaped" value="false" />
</execute>
- <set>
- <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$i].resource-resolution-data.status`' value='SUCCESS' />
- </set>
<for index='n' start='0' end='`$jsonContextPrefix.elements_length`' >
<for index='l' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`' >
<execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='contains' emitsOutcome='true' >
@@ -253,9 +252,14 @@ </execute>
<switch test='`$s2[0] == $jsonContextPrefix.elements[$n].resource-name`'>
<outcome value='true'>
- <set>
- <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$l].value`' value="`$jsonContextPrefix.elements[$n].resource-value`" />
- </set>
+ <block>
+ <set>
+ <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$l].value`' value="`$jsonContextPrefix.elements[$n].resource-value`" />
+ </set>
+ <set>
+ <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$l].resource-resolution-data.status`' value='SUCCESS' />
+ </set>
+ </block>
</outcome>
</switch>
</block>
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-netbox-ip-assign.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-netbox-ip-assign.xml index 7ef78f6c..adbe98d8 100644 --- a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-netbox-ip-assign.xml +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-netbox-ip-assign.xml @@ -1,6 +1,6 @@ <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='1.4.1-SNAPSHOT'> + 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-assign' mode='sync'> <block atomic="true"> <switch test='`$ss.capability-name`'> @@ -30,266 +30,538 @@ </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> + <switch test="`$ss.capability-type == 'vnf'`"> + <outcome value='true'> + <block> + <for index='i' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`' > + <set> + <parameter name='tmp.ss.param.capability-name' + value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.capability-name`' /> + </set> + <set> + <parameter name='tmp.ss.param.name' + value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.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.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.status`'> + <outcome value='FAILED'> + <block> + <for index="kidx" start="0" end="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.resource-key_length`"> + <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.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.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.resource-key[$kidx].value`' /> + </set> </outcome> - <outcome value='success'> - <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 value='vnf-id'> + <set> + <parameter name='tmp.ss.vnf-id' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.resource-key[$kidx].value`' /> + </set> </outcome> - </execute> - </block> - </outcome> - <outcome value='unassign'> - <block atomic="true"> - <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL' + <outcome value='prefix-id'> + <set> + <parameter name='tmp.ss.prefix-id' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.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.vnf-topology.vnf-parameters-data.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.vnf-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.vnf-topology.vnf-parameters-data.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> + <outcome value='success'> + <block> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' > + <parameter name="original_string" value="`$self_serve_netbox_ip_assignement.ip-address`" /> + <parameter name="regex" value="/"/> + <parameter name="ctx_memory_result_key" value="ip" /> + </execute> + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].value' + value='`$ip[0]`' /> + </set> + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.status' + value='SUCCESS' /> + </set> + </block> + </outcome> + </execute> + </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" + <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'> + <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> + <outcome value='success'> + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.status' + value='DELETED' /> + </set> + </outcome> + </execute> + </block> + </outcome> + </get-resource> + </block> + </outcome> + </switch> + </block> + </outcome> + <outcome value='PENDING'> + <block> + <for index="kidx" start="0" end="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.resource-key_length`"> + <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.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.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.resource-key[$kidx].value`' /> + </set> + </outcome> + <outcome value='vnf-id'> + <set> + <parameter name='tmp.ss.vnf-id' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.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.vnf-topology.vnf-parameters-data.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.vnf-topology.vnf-parameters-data.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.vnf-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.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.status' value='FAILED' /> + </set> <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`" /> + <parameter name='error-code' value='' /> + <parameter name='error-message' value='' /> </return> - </outcome> - <outcome value='success'> + </block> + </outcome> + <outcome value='success'> + <block> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' > + <parameter name="original_string" value="`$self_serve_netbox_ip_assignement.ip-address`" /> + <parameter name="regex" value="/"/> + <parameter name="ctx_memory_result_key" value="ip" /> + </execute> <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' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].value' + value='`$ip[0]`' /> </set> - </outcome> - </execute> - </block> - </outcome> - </get-resource> - </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> - <outcome value='success'> - <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' + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.status' value='SUCCESS' /> - </set> - </block> - </outcome> - </execute> - </block> - </outcome> - <outcome value='unassign'> - <block atomic="true"> - <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL' + </set> + </block> + </outcome> + </execute> + </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" + <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'> + <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> + <outcome value='success'> + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$pidx].resource-resolution-data.status' + value='DELETED' /> + </set> + </outcome> + </execute> + </block> + </outcome> + </get-resource> + </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> + </outcome> + </switch> + <switch test="`$ss.capability-type == 'vf-module'`"> + <outcome value='true'> + <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='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`" /> + <parameter name='error-code' value='' /> + <parameter name='error-message' value='' /> </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'> + </block> + </outcome> + <outcome value='success'> + <block> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' > + <parameter name="original_string" value="`$self_serve_netbox_ip_assignement.ip-address`" /> + <parameter name="regex" value="/"/> + <parameter name="ctx_memory_result_key" value="ip" /> + </execute> + <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='`$ip[0]`' /> + </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> + </execute> + </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> + <outcome value='success'> + <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> + </execute> + </block> + </outcome> + </get-resource> + </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='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`" /> + <parameter name='error-code' value='' /> + <parameter name='error-message' value='' /> </return> - </outcome> - <outcome value='success'> + </block> + </outcome> + <outcome value='success'> + <block> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' > + <parameter name="original_string" value="`$self_serve_netbox_ip_assignement.ip-address`" /> + <parameter name="regex" value="/"/> + <parameter name="ctx_memory_result_key" value="ip" /> + </execute> + <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='`$ip[0]`' /> + </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='DELETED' /> + value='SUCCESS' /> </set> - </outcome> - </execute> - </block> - </outcome> - </get-resource> - </block> - </outcome> - </switch> - </block> + </block> + </outcome> + </execute> + </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> + <outcome value='success'> + <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> + </execute> + </block> + </outcome> + </get-resource> + </block> + </outcome> + </switch> + </block> + </outcome> + </switch> </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> + </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> + </outcome> + </switch> </block> </method> </service-logic>
\ No newline at end of file diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-vf-module-assign.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-vf-module-assign.xml index e39ba78e..5b15d653 100644 --- a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-vf-module-assign.xml +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-vf-module-assign.xml @@ -161,7 +161,7 @@ <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-level-oper-status.last-rpc-action'
value='`$vf-module-topology-operation-input.sdnc-request-header.svc-action`' />
<parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-level-oper-status.last-action'
- value='`$vf-module-topology-operation-input.sdnc-request-header.request-action`' />
+ value='`$vf-module-topology-operation-input.request-information.request-action`' />
</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.sdnc-generated-cloud-resources'
|