diff options
author | 2018-07-26 18:10:42 +0000 | |
---|---|---|
committer | 2018-07-26 18:10:42 +0000 | |
commit | 5a41e5c15bdbfba0e84e89e13bb06d9930988e77 (patch) | |
tree | 72fa804d3fc3f1e286e3c8e1209309e97a3ff528 /platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_api-contrail-route-topology-operation-delete.xml | |
parent | 3b79de733187d2c1c9bccf626958a43bb06dbf2e (diff) |
Generic resource API DG catch up
Generic resource API DG catch up with several new capabilities
Change-Id: I6ba4a1716693a2fb0ba5314f60038277a50249a3
Issue-ID: SDNC-403
Signed-off-by: Brandon, Bruce (bb2697) <bb2697@att.com>
Former-commit-id: dd97cf829ce1c0b3bbb0e98e93a2e6619d945beb
Diffstat (limited to 'platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_api-contrail-route-topology-operation-delete.xml')
-rw-r--r-- | platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_api-contrail-route-topology-operation-delete.xml | 332 |
1 files changed, 332 insertions, 0 deletions
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_api-contrail-route-topology-operation-delete.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_api-contrail-route-topology-operation-delete.xml new file mode 100644 index 00000000..f0dacbed --- /dev/null +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_api-contrail-route-topology-operation-delete.xml @@ -0,0 +1,332 @@ +<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='api-contrail-route-topology-operation-delete' mode='sync'>
+ <block atomic="true">
+ <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="GENERIC-RESOURCE-API.api-contrail-route-topology-operation-delete"/>
+ <parameter name='field3' value='cto-api.parent-service-instance-id' />
+ <parameter name='field4' value='`$cto-api.parent-service-instance-id`' />
+ <parameter name='field5' value='cto-api.default-domain' />
+ <parameter name='field6' value='`$cto-api.default-domain`' />
+ <parameter name='field7' value='cto-api.port-mirror-configuration-instance-id' />
+ <parameter name='field8' value='`$cto-api.port-mirror-configuration-instance-id`' />
+ <parameter name='field9' value='cto-api.service-type' />
+ <parameter name='field10' value='`$cto-api.service-type`' />
+ <parameter name='field11' value='cto-api.source-network-role' />
+ <parameter name='field12' value='`$cto-api.source-network-fole`' />
+ <parameter name='field13' value='cto-api.collector-network-role' />
+ <parameter name='field14' value='`$cto-api.collector-network-4ole`' />
+ <parameter name='field15' value='cto-api.default-project' />
+ <parameter name='field16' value='`$cto-api.default-project`' />
+ <parameter name='field17' value='cto-api.cloud-region-id' />
+ <parameter name='field18' value='`$cto-api.cloud-region-id`' />
+ <parameter name='field19' value='cto-api.cloud-owner' />
+ <parameter name='field20' value='`$cto-api.cloud-owner`' />
+ <parameter name='field21' value='cto-api.isTest' />
+ <parameter name='field22' value='`$cto-api.isTest`' />
+ <parameter name='field23' value='service-data.service-information.global-customer-id' />
+ <parameter name='field24' value='`$service-data.service-information.global-customer-id`' />
+ </record>
+ <set>
+ <parameter name="ctotmp." value="" />
+ </set>
+ <set>
+ <parameter name="ctotmp.action" value="delete" />
+ <parameter name="ctotmp.config-count" value="0" />
+ <parameter name="ctotmp.config-found" value="true" />
+ </set>
+ <call module='GENERIC-RESOURCE-API' rpc='validate-api-contrail-route-input' mode='sync' ></call>
+ <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
+ resource="allotted-resource"
+ key="customer.global-customer-id = $service-data.service-information.global-customer-id AND
+ service-subscription.service-type = $service-data.service-information.subscription-service-type AND
+ service-instance.service-instance-id = $service-data.service-information.service-instance-id AND
+ allotted-resource.id = $cto-api.contrail-route-allotted-resource-id"
+ pfx='aai.ar' local-only='false' >
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="AAI failed" />
+ </return>
+ </outcome>
+ <outcome value='not-found'>
+ <block atomic="true">
+ <switch test='`$cto-api.rollback-flag`'>
+ <outcome value='true'>
+ <block atomic="true">
+ <return status='success'>
+ <parameter name="ack-final-indicator" value="Y" />
+ <parameter name="error-code" value="200" />
+ <parameter name="error-message" value="`$error-message`" />
+ </return>
+ </block>
+ </outcome>
+ <outcome value='false'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="AAI failed" />
+ </return>
+ </outcome>
+ </switch>
+ </block>
+ </outcome>
+ <outcome value='Other'>
+ <block atomic="true"></block>
+ </outcome>
+ </get-resource>
+ <for silentFailure='true' index='ridx' start='0' end="`$aai.ar.relationship-list.relationship_length`" >
+ <for silentFailure='false' index='rdidx' start='0' end="`$aai.cloud-region.relationship-list.relationship[$ridx].relationship-data_length`" >
+ <switch test='`$aai.ar.relationship-list.relationship[$ridx].relationship-data[$rdidx].relationship-key`'>
+ <outcome value='configuration.configuration-id'>
+ <block atomic="true">
+ <set>
+ <parameter name='ctotmp.config-count' value='`$ctotmp.config-count+1`' />
+ </set>
+ <switch test='`$aai.ar.relationship-list.relationship[$ridx].relationship-data[$rdidx].relationship-value == $cto-api.configuration-id`'>
+ <outcome value='true'>
+ <block atomic="true">
+ <set>
+ <parameter name='ctotmp.config-found' value='true' />
+ </set>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </outcome>
+ </switch>
+ </for>
+ </for>
+ <switch test="`$ctotmp.config-count > 1`">
+ <outcome value='true'>
+ <block atomic="true">
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="AAI Allotted Resource is tied to more than one configuration object" />
+ </return>
+ </block>
+ </outcome>
+ </switch>
+ <switch test="`$ctotmp.config-count == 1 and $ctotmp.config-found == 'true'`">
+ <outcome value='false'>
+ <block atomic="true">
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="AAI Allotted resource is not tied to configuration object" />
+ </return>
+ </block>
+ </outcome>
+ <outcome value='true'>
+ <block atomic="true"></block>
+ </outcome>
+ </switch>
+ <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >
+ <parameter name='fileName' value='%SDNC_CONFIG_DIR%/generic-resource-api-dg.properties' />
+ <parameter name='contextPrefix' value='prop' />
+ </execute>
+ <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
+ <parameter name="source" value="`$prop.restapi.cr-allottedresource`"/>
+ <parameter name="outputPath" value="tmp.ar-url"/>
+ <parameter name="target" value="{allotted-resource-id}"/>
+ <parameter name="replacement" value="`$cto-api.contrail-route-allotted-resource-id`"/>
+ </execute>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ar-url`' />
+ <parameter name='restapiUser' value='`$prop.controller.user`' />
+ <parameter name='restapiPassword' value='`$prop.controller.pwd`' />
+ <parameter name='format' value='json' />
+ <parameter name='httpMethod' value='GET' />
+ <parameter name="responsePrefix" value="mdsal-ar" />
+ <outcome value='success'>
+ <block atomic="true">
+ <switch test='`$mdsal-ar.contrail-route-allotted-resource_length`'>
+ <outcome value='1'>
+ <block atomic='true'>
+ <set>
+ <parameter name='bk-cr-ar' value='$mdsal-ar.' />
+ </set>
+ <set>
+ <parameter name='ar.' value='$mdsal-ar.contrail-route-allotted-resource[0].' />
+ </set>
+ </block>
+ </outcome>
+ <outcome value='Other'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="404" />
+ <parameter name="error-message" value="Error: Contrail Route not found in md-sal" />
+ </return>
+ </outcome>
+ </switch>
+ </block>
+ </outcome>
+ <outcome value='Other'>
+ <block atomic="true">
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="404" />
+ <parameter name="error-message" value="Error: Contrail Route not found in md-sal" />
+ </return>
+ </block>
+ </outcome>
+ </execute>
+ <set>
+ <parameter name='ar-assignments.' value="`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.`" />
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.contrail.ContrailAdaptor' method='sendContrailRequest' emitsOutcome='true' >
+ <parameter name='api-name' value='network-policy' />
+ <parameter name='api-action' value='delete' />
+ <parameter name='resp-prefix' value='contrailResp' />
+ <parameter name='cloud-region-id' value='`$cto-api.cloud-region-id`' />
+ <parameter name='default-project' value='`$cto-api.default-project`' />
+ <parameter name='default-domain' value='`$cto-api.default-domain`' />
+ <parameter name='contrail-network-policy-id' value='`$ar-assignments.contrail-id`' />
+ <outcome value='success'>
+ <block></block>
+ </outcome>
+ <outcome value='not-found'>
+ <block></block>
+ </outcome>
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="Failed to create policy in Contrail" />
+ </return>
+ </outcome>
+ </execute>
+ <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
+ resource="network-policy"
+ key="network-policy.network-policy-id = $ar-assignments.contrail-id" >
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="Failed to save network policy in AAI" />
+ </return>
+ </outcome>
+ <outcome value='not-found'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="Failed to save network policy in AAI" />
+ </return>
+ </outcome>
+ </delete>
+ <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
+ resource="allotted-resource"
+ key="customer.global-customer-id = $service-data.service-information.global-customer-id AND
+ service-subscription.service-type = $service-data.service-information.subscription-service-type AND
+ service-instance.service-instance-id = $service-data.service-information.service-instance-id AND
+ allotted-resource.id = $cto-api.contrail-route-allotted-resource-id">
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="AAI failed" />
+ </return>
+ </outcome>
+ <outcome value='not-found'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="AAI failed" />
+ </return>
+ </outcome>
+ </delete>
+ <for silentFailure='true' index='snidx' start='0' end='`$service-data.consumed-allotted-resources.consumed-allotted-resource_length`' >
+ <block atomic="true">
+ <switch test='`$service-data.consumed-allotted-resources.consumed-allotted-resource[$sdix].allotted-resource-id == $cto-api.contrail-route-allotted-resource-id`'>
+ <outcome value='true'>
+ <block atomic="true">
+ <set>
+ <parameter name="tmp.sdidx" value="`$snidx`"/>
+ </set>
+ <break/>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <switch test='`$service-data.consumed-allotted-resources.consumed-allotted-resource_length`'>
+ <outcome value='1'>
+ <block atomic="true">
+ <set>
+ <parameter name="service-data.consumed-allotted-resources." value=""/>
+ </set>
+ <set>
+ <parameter name="service-data.consumed-allotted-resources.consumed-allotted-resource_length" value="0"/>
+ </set>
+ </block>
+ </outcome>
+ <outcome value='Other'>
+ <block atomic="true">
+ <set>
+ <parameter name="tmp.new_length" value="`$service-data.consumed-allotted-resources.consumed-allotted-resource_length - 1`"/>
+ </set>
+ <for silentFailure='true' index='snidx' start='`$tmp.sdidx + 1`' end='`$service-data.consumed-allotted-resources.consumed-allotted-resource_length`' >
+ <block atomic="true">
+ <set>
+ <parameter name="tmp.newidx" value="`$snidx - 1`"/>
+ </set>
+ <set>
+ <parameter name="service-data.consumed-allotted-resources.consumed-allotted-resource[$tmp.newidx]." value="$service-data.consumed-allotted-resources.consumed-allotted-resource[$snidx]." />
+ </set>
+ </block>
+ </for>
+ <set>
+ <parameter name="service-data.consumed-allotted-resources.consumed-allotted-resource_length" value="`$service-data.consumed-allotted-resources.consumed-allotted-resource_length - 1`"/>
+ </set>
+ <set>
+ <parameter name="service-data.consumed-allotted-resources.consumed-allotted-resource[$tmp.new_length]." value=""/>
+ </set>
+ </block>
+ </outcome>
+ </switch>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.cr.templatefile`" />
+ <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ar-url`' />
+ <parameter name='restapiUser' value='`$prop.controller.user`' />
+ <parameter name='restapiPassword' value='`$prop.controller.pwd`' />
+ <parameter name='format' value='json' />
+ <parameter name='httpMethod' value='DELETE' />
+ <parameter name="responsePrefix" value="mdsal-ar" />
+ <outcome value='success'>
+ <block></block>
+ </outcome>
+ <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 md-sal for contrail-route-allotted-resource" />
+ </return>
+ </outcome>
+ <outcome value='not-found'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="Error updating md-sal for contrail-route-allotted-resource" />
+ </return>
+ </outcome>
+ </execute>
+ <set>
+ <parameter name='allotted-resource-id' value='`$tmp.ar.allotted-resource-id`' />
+ <parameter name='contrail-route-object-path' value="`$tmp.ar.self-link`"/>
+ <parameter name='service-object-path' value="`'restconf/config/GENERIC-RESOURCE-API:services/service/'
+ + $contrail-route-topology-operation-input.service-information.service-instance-id
+ + '/service-data/service-topology/'`"/>
+ </set>
+ <return status='success'>
+ <parameter name="ack-final-indicator" value="Y" />
+ <parameter name="error-code" value="200" />
+ <parameter name="error-message" value="`$error-message`" />
+ </return>
+ </block>
+ </method>
+</service-logic>
\ No newline at end of file |