diff options
author | Dan Timoney <dtimoney@att.com> | 2020-07-30 14:02:14 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2020-07-30 14:02:14 -0400 |
commit | d998254cf8b8888b85cca8f59f9efeed5a55f053 (patch) | |
tree | 6a8ce9733ecc2b47635c95027494f5ee0916394c /ms/generic-resource-api/src/test/resources/svclogic/GENERIC-RESOURCE-API_contrail-route-topology-operation-assign.xml | |
parent | f308dfd9d85590129215765ca37e635dd86607e2 (diff) |
Implement service topology operation RPC
Add implementation for service-topology-operation RPC.
Change-Id: I154d2ef6504be9a592479acc554b7cb0f8c250f6
Issue-ID: SDNC-1310
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms/generic-resource-api/src/test/resources/svclogic/GENERIC-RESOURCE-API_contrail-route-topology-operation-assign.xml')
-rwxr-xr-x | ms/generic-resource-api/src/test/resources/svclogic/GENERIC-RESOURCE-API_contrail-route-topology-operation-assign.xml | 981 |
1 files changed, 981 insertions, 0 deletions
diff --git a/ms/generic-resource-api/src/test/resources/svclogic/GENERIC-RESOURCE-API_contrail-route-topology-operation-assign.xml b/ms/generic-resource-api/src/test/resources/svclogic/GENERIC-RESOURCE-API_contrail-route-topology-operation-assign.xml new file mode 100755 index 0000000..444b50d --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/svclogic/GENERIC-RESOURCE-API_contrail-route-topology-operation-assign.xml @@ -0,0 +1,981 @@ +<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='contrail-route-topology-operation-assign' mode='sync'> + <block atomic="true"> + <set> + <parameter name='tmp.ar.allotted-resource-id' value='`$contrail-route-topology-operation-input.allotted-resource-information.allotted-resource-id`' /> + <parameter name='tmp.ar.parent-service-instance-id' value='`$contrail-route-topology-operation-input.allotted-resource-information.parent-service-instance-id`' /> + <parameter name='tmp.ar.contrail-applied-service-instance-id' value='`$contrail-route-topology-operation-input.contrail-route-request-input.contrail-applied-service-info.service-instance-id`' /> + <parameter name='tmp.ar.allotted-resource-type' value='`$contrail-route-topology-operation-input.allotted-resource-information.allotted-resource-type`' /> + </set> + <set> + <parameter name='tmp.ar.self-link' value="`'restconf/config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/contrail-route-allotted-resource/' + + $tmp.ar.allotted-resource-id + + '/allotted-resource-data/contrail-route-topology/'` " /> + </set> + <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="`$tmp.ar.allotted-resource-id`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$prop.restapi.network`"/> + <parameter name="outputPath" value="tmp.ar-parentnetwork-url"/> + <parameter name="target" value="{service-instance-id}"/> + <parameter name="replacement" value="`$tmp.ar.parent-service-instance-id`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$prop.restapi.vnf`"/> + <parameter name="outputPath" value="tmp.ar-contrailappliedsvc-url"/> + <parameter name="target" value="{service-instance-id}"/> + <parameter name="replacement" value="`$tmp.ar.contrail-applied-service-instance-id`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$prop.restapi.parent-provided-resource`"/> + <parameter name="outputPath" value="tmp.parent-ar-url"/> + <parameter name="target" value="{service-instance-id}"/> + <parameter name="replacement" value="`$tmp.ar.parent-service-instance-id`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.parent-ar-url`"/> + <parameter name="outputPath" value="tmp.parent-ar-url"/> + <parameter name="target" value="{allotted-resource-id}"/> + <parameter name="replacement" value="`$tmp.ar.allotted-resource-id`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$prop.restapi.network-provided-resource`"/> + <parameter name="outputPath" value="tmp.network-ar-url"/> + <parameter name="target" value="{service-instance-id}"/> + <parameter name="replacement" value="`$tmp.ar.parent-service-instance-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'> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Error: Existing contrail route allotted resource" /> + </return> + </outcome> + </switch> + </block> + </outcome> + <outcome value='Other'> + <block atomic="true"></block> + </outcome> + </execute> + <set> + <parameter name='ar.allotted-resource-id' value="`$tmp.ar.allotted-resource-id` " /> + <parameter name='ar.allotted-resource-status.action' value="`$contrail-route-topology-operation-input.request-information.request-action` " /> + <parameter name='ar.allotted-resource-status.rpc-name' value="contrail-route-topology-operation" /> + <parameter name='ar.allotted-resource-status.rpc-action' value="`$contrail-route-topology-operation-input.sdnc-request-header.svc-action` " /> + <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.request-information.' value="`$contrail-route-topology-operation-input.request-information.` " /> + <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.sdnc-request-header.' value="`$contrail-route-topology-operation-input.sdnc-request-header.` " /> + <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.service-information.' value="`$contrail-route-topology-operation-input.service-information.` " /> + <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.allotted-resource-information.' value="`$contrail-route-topology-operation-input.allotted-resource-information.` " /> + <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.contrail-route-request-input.' value="`$contrail-route-topology-operation-input.contrail-route-request-input.` " /> + </set> + <set> + <parameter name='ar-identifiers.consuming-service-instance-id' value="`$contrail-route-topology-operation-input.service-information.service-instance-id` " /> + <parameter name='ar-identifiers.parent-service-instance-id' value="`$contrail-route-topology-operation-input.allotted-resource-information.parent-service-instance-id` " /> + <parameter name='ar-identifiers.allotted-resource-type' value="`$contrail-route-topology-operation-input.allotted-resource-information.allotted-resource-type` " /> + <parameter name='ar-identifiers.allotted-resource-id' value="`$tmp.ar.allotted-resource-id` " /> + </set> + <set> + <parameter name='ar.allotted-resource-data.contrail-route-topology.onap-model-information.' +value="`$contrail-route-topology-operation-input.allotted-resource-information.onap-model-information.`" /> + </set> + <switch test='$contrail-route-topology-operation-input.allotted-resource-information.onap-model-information.model-invariant-uuid'> + <outcome value=''> + <set> + <parameter name='ar.allotted-resource-data.contrail-route-topology.onap-model-information.model-invariant-uuid' +value="`$ar-model.invariant-uuid`" /> + </set> + </outcome> + </switch> + <switch test='$contrail-route-topology-operation-input.allotted-resource-information.onap-model-information.model-uuid'> + <outcome value=''> + <set> + <parameter name='sar.allotted-resource-data.contrail-route-topology.onap-model-information.model-uuid' +value="`$ar-model.uuid`" /> + </set> + </outcome> + </switch> + <switch test='$contrail-route-topology-operation-input.allotted-resource-information.onap-model-information.model-version'> + <outcome value=''> + <set> + <parameter name='ar.allotted-resource-data.contrail-route-topology.onap-model-information.model-version' +value="`$ar-model.version`" /> + </set> + </outcome> + </switch> + <switch test='`$contrail-route-topology-operation-input.contrail-route-request-input.source-network.network-id`'> + <outcome value=''> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Error assigning contrail route. Source network not found" /> + </return> + </outcome> + <outcome value='Other'> + <block> + <switch test='`$service-data.networks.network_length`'> + <outcome value=''> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Error assigning contrail route. Source network not found" /> + </return> + </outcome> + <outcome value='Other'> + <block atomic="true"> + <set> + <parameter name='source-network-found' value='false' /> + </set> + <for index='nidx' start='0' end='`$service-data.networks.network_length`' > + <block> + <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="tmp.ar-name="/> + <parameter name="field3" value="`$tmp.ar-name`"/> + <parameter name="field4" value="service-data-network-id" /> + <parameter name="field5" value="`$service-data.networks.network[$nidx].network-id`" /> + <parameter name="field6" value="contrail-route-input-network-id" /> + <parameter name="field7" value="`$contrail-route-topology-operation-input.contrail-route-request-input.source-network.network-id`" /> + <parameter name="field8" value="`$nidx`" /> + </record> + <switch test="`$service-data.networks.network[$nidx].network-id == $contrail-route-topology-operation-input.contrail-route-request-input.source-network.network-id`"> + <outcome value='true'> + <block> + <set> + <parameter name='tmp.ar.tenant-id' value='`$service-data.networks.network[$nidx].network-data.network-topology.tenant`' /> + <parameter name='tmp.ar.cloud-region-id' value='`$service-data.networks.network[$nidx].network-data.network-topology.aic-cloud-region`' /> + <parameter name='source-network-found' value='true' /> + </set> + <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" + resource="tenant" + key="cloud-region.cloud-owner = $prop.cloud-region.cloud-owner AND + cloud-region.cloud-region-id = $tmp.ar.cloud-region-id AND + tenant.tenant-id = $tmp.ar.tenant-id" + pfx='aai.tenant' local-only='false' > + <outcome value='success'> + <block atomic="true"> + <set> + <parameter name='tmp.ar.tenant-name' value='`$aai.tenant.tenant-name`' /> + </set> + </block> + </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="Tenant not found in AAI" /> + </return> + </outcome> + <outcome value='Other'> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Tenant not found in AAI" /> + </return> + </outcome> + </get-resource> + </block> + </outcome> + </switch> + </block> + </for> + <switch test="`$source-network-found`"> + <outcome value='false'> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Error assigning contrail route. Source network not found" /> + </return> + </outcome> + </switch> + </block> + </outcome> + </switch> + </block> + </outcome> + </switch> + <switch test='`$ar-model.ecomp-generated-naming`'> + <outcome value='Y'> + <block atomic="true"> + <switch test='`$ar-model.naming-policy`'> + <outcome value='oam_network_policy'> + <block atomic='true'> + <set> + <parameter name='tmp.ar-name' value='$TenantName_$CloudRegionID_$TenantNetworkRole_$LandingNetworkRole_policy_' /> + </set> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.ar-name`"/> + <parameter name="outputPath" value="tmp.ar-name"/> + <parameter name="target" value="$TenantName"/> + <parameter name="replacement" value="`$tmp.ar.tenant-name`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.ar-name`"/> + <parameter name="outputPath" value="tmp.ar-name"/> + <parameter name="target" value="$CloudRegionID"/> + <parameter name="replacement" value="`$tmp.ar.cloud-region-id`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.ar-name`"/> + <parameter name="outputPath" value="tmp.ar-name"/> + <parameter name="target" value="$TenantNetworkRole"/> + <parameter name="replacement" value="`$contrail-route-topology-operation-input.contrail-route-request-input.source-network.network-role`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.ar-name`"/> + <parameter name="outputPath" value="tmp.ar-name"/> + <parameter name="target" value="$LandingNetworkRole"/> + <parameter name="replacement" value="`$contrail-route-topology-operation-input.contrail-route-request-input.dest-network.network-role`"/> + </execute> + <set> + <parameter name='generate-unique-name-input.index-table-name' value='CONTRAIL_ROUTE_NAME_INDEX' /> + <parameter name='generate-unique-name-input.index-table-prefix-column' value='contrail_route_name_prefix' /> + <parameter name='generate-unique-name-input.name-table-type' value='CONTRAIL_ROUTE_INSTANCE' /> + <parameter name='generate-unique-name-input.prefix' value="`$tmp.ar-name`" /> + <parameter name='generate-unique-name-input.index-length' value='2' /> + </set> + <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="tmp.ar-name="/> + <parameter name="field3" value="`$tmp.ar-name`"/> + <parameter name="field4" value="generate-unique-name-input.prefix" /> + <parameter name="field5" value="`$generate-unique-name-input.prefix`" /> + </record> + <call module='GENERIC-RESOURCE-API' rpc='generate-unique-name' 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="`$generate-unique-name-output.error-message`" /> + </return> + </outcome> + <outcome value='success'> + <set> + <parameter name='tmp.ar-name' value='`$generate-unique-name-output.generated-name`' /> + </set> + </outcome> + </call> + <set> + <parameter name='ar-identifiers.allotted-resource-name' value='`$tmp.ar-name`' /> + </set> + </block> + </outcome> + <outcome value='Other'> + <block atomic='true'> + <set> + <parameter name='tmp.ar-name' value='$TenantName_$CloudRegionID_$TenantNetworkRole_$LandingNetworkRole_policy_' /> + </set> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.ar-name`"/> + <parameter name="outputPath" value="tmp.ar-name"/> + <parameter name="target" value="$TenantName"/> + <parameter name="replacement" value="`$tmp.ar.tenant-name`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.ar-name`"/> + <parameter name="outputPath" value="tmp.ar-name"/> + <parameter name="target" value="$CloudRegionID"/> + <parameter name="replacement" value="`$tmp.ar.cloud-region-id`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.ar-name`"/> + <parameter name="outputPath" value="tmp.ar-name"/> + <parameter name="target" value="$TenantNetworkRole"/> + <parameter name="replacement" value="`$contrail-route-topology-operation-input.contrail-route-request-input.source-network.network-role`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.ar-name`"/> + <parameter name="outputPath" value="tmp.ar-name"/> + <parameter name="target" value="$LandingNetworkRole"/> + <parameter name="replacement" value="`$contrail-route-topology-operation-input.contrail-route-request-input.dest-network.network-role`"/> + </execute> + <set> + <parameter name='generate-unique-name-input.index-table-name' value='CONTRAIL_ROUTE_NAME_INDEX' /> + <parameter name='generate-unique-name-input.index-table-prefix-column' value='contrail_route_name_prefix' /> + <parameter name='generate-unique-name-input.name-table-type' value='CONTRAIL_ROUTE_INSTANCE' /> + <parameter name='generate-unique-name-input.prefix' value="`$tmp.ar-name`" /> + <parameter name='generate-unique-name-input.index-length' value='2' /> + </set> + <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="tmp.ar-name="/> + <parameter name="field3" value="`$tmp.ar-name`"/> + <parameter name="field4" value="generate-unique-name-input.prefix" /> + <parameter name="field5" value="`$generate-unique-name-input.prefix`" /> + </record> + <call module='GENERIC-RESOURCE-API' rpc='generate-unique-name' 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="`$generate-unique-name-output.error-message`" /> + </return> + </outcome> + <outcome value='success'> + <set> + <parameter name='tmp.ar-name' value='`$generate-unique-name-output.generated-name`' /> + </set> + </outcome> + </call> + <set> + <parameter name='ar-identifiers.allotted-resource-name' value='`$tmp.ar-name`' /> + </set> + </block> + </outcome> + </switch> + </block> + </outcome> + <outcome value='Other'> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Error in allotted-resource-model data. Ecomp-generated-naming should be true" /> + </return> + </outcome> + </switch> + <set> + <parameter name='ar.allotted-resource-data.contrail-route-topology.allotted-resource-identifiers.' +value="`$ar-identifiers.`" /> + </set> + <set> + <parameter name='ar-assignments.source-network.' value="`$contrail-route-topology-operation-input.contrail-route-request-input.source-network.` " /> + <parameter name='ar-assignments.dest-network.' value="`$contrail-route-topology-operation-input.contrail-route-request-input.dest-network.` " /> + <parameter name='ar-assignments.contrail-applied-service.' value="`$contrail-route-topology-operation-input.contrail-route-request-input.contrail-applied-service-info.` " /> + </set> + <set> + <parameter name='tmp.fq-name' value='$defaultDomain.$defaultProject.$sdncNetworkPolicy' /> + </set> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.fq-name`"/> + <parameter name="outputPath" value="tmp.fq-name"/> + <parameter name="target" value="$defaultDomain"/> + <parameter name="replacement" value="default-domain"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.fq-name`"/> + <parameter name="outputPath" value="tmp.fq-name"/> + <parameter name="target" value="$defaultProject"/> + <parameter name="replacement" value="`$tmp.ar.tenant-name`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.fq-name`"/> + <parameter name="outputPath" value="tmp.fq-name"/> + <parameter name="target" value="$sdncNetworkPolicy"/> + <parameter name="replacement" value="`$tmp.ar-name`"/> + </execute> + <switch test='`$contrail-route-topology-operation-input.contrail-route-request-input.dest-network.network-id`'> + <outcome value=''> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ar-parentnetwork-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="parent-net" /> + <outcome value='success'> + <block atomic="true"> + <switch test='`$parent-net.networks.network_length`'> + <outcome value='1'> + <set> + <parameter name='ar-assignments.dest-network.network-id' value="`$parent-net.networks.network[0].network-id` " /> + </set> + </outcome> + <outcome value='Other'> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Error: Network id not found. Parent Service should only have one network" /> + </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="500" /> + <parameter name="error-message" value="Error: No existing parent netorks" /> + </return> + </block> + </outcome> + </execute> + </outcome> + <outcome value='Other'> + <set> + <parameter name='ar-assignments.dest-network.network-id' value="`$contrail-route-topology-operation-input.contrail-route-request-input.dest-network.network-id` " /> + </set> + </outcome> + </switch> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ar-contrailappliedsvc-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="vnf" /> + <outcome value='success'> + <block atomic="true"> + <switch test='`$vnf.vnfs.vnf_length`'> + <outcome value='1'> + <set> + <parameter name='ar-assignments.contrail-applied-service.vnf-id' value="`$vnf.vnfs.vnf[0].vnf-id` " /> + </set> + </outcome> + <outcome value='Other'> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Error: vnf id not found. Contrail applied service should only have one vnf" /> + </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="500" /> + <parameter name="error-message" value="Error: No existing contrail applied service vnfs" /> + </return> + </block> + </outcome> + </execute> + <switch test='`$contrail-route-topology-operation-input.contrail-route-request-input.contrail-applied-service-info.contrail-fqdn`'> + <outcome value=''> + <block atomic="true"> + <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" + resource="generic-vnf" + key="generic-vnf.vnf-id = $ar-assignments.contrail-applied-service.vnf-id" + pfx='aai.vnf' local-only='false' > + <outcome value='not-found'> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Vnf not found in AAI" /> + </return> + </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 retrieving vnf from AAI" /> + </return> + </outcome> + </get-resource> + <switch test='`$aai.vnf.vf-modules.vf-module_length`'> + <outcome value=''> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="VF Module not found in AAI" /> + </return> + </outcome> + <outcome value='Other'> + <for index='idx' start='0' end='`$aai.vnf.vf-modules.vf-module_length`' > + <switch test='`$aai.vnf.vf-modules.vf-module[$idx].contrail-service-instance-fqdn`'> + <outcome value=''> + <block></block> + </outcome> + <outcome value='Other'> + <block> + <set> + <parameter name='ar-assignments.contrail-applied-service.contrail-fqdn' value="`$aai.vnf.vf-modules.vf-module[$idx].contrail-service-instance-fqdn` " /> + </set> + <break/> + </block> + </outcome> + </switch> + </for> + </outcome> + </switch> + </block> + </outcome> + <outcome value='Other'> + <set> + <parameter name='ar-assignments.contrail-applied-service.contrail-fqdn' value="`$contrail-route-topology-operation-input.contrail-route-request-input.contrail-applied-service-info.contrail-fqdn` " /> + </set> + </outcome> + </switch> + <switch test='`$ar-assignments.contrail-applied-service.contrail-fqdn`'> + <outcome value=''> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="Error: No vf-module with contrail-service-instance-fqdn found in AAI" /> + </return> + </outcome> + </switch> + <set> + <parameter name='ar-assignments.fq-name' value="`$tmp.fq-name` " /> + </set> + <set> + <parameter name='ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.' +value="`$ar-assignments.`" /> + </set> + <switch test='`$service-data.consumed-allotted-resources.consumed-allotted-resource_length`'> + <outcome value=''> + <set> + <parameter name='tmp.cidx' value="`0`" /> + <parameter name='service-data.consumed-allotted-resources.consumed-allotted-resource_length' value="1" /> + </set> + </outcome> + <outcome value='Other'> + <block atomic="true"> + <for index='cidx' start='0' end='`$service-data.consumed-allotted-resources.consumed-allotted-resource_length`' > + <switch test="`$service-data.consumed-allotted-resources.consumed-allotted-resource[$cidx].allotted-resource-id == $tmp.ar.allotted-resource-id`"> + <outcome value='true'> + <block atomic="true"> + <set> + <parameter name='tmp.cidx' value='`$cidx`' /> + <parameter name='ctx.consumed-ar.' value='`$service-data.consumed-allotted-resources.consumed-allotted-resource[$cidx].`' /> + <parameter name='tmp.found-cidx' value='true' /> + </set> + <break/> + </block> + </outcome> + </switch> + </for> + <switch test='`$tmp.found-cidx`'> + <outcome value='false'> + <block atomic="true"> + <set> + <parameter name='tmp.cidx' value='`$service-data.consumed-allotted-resources.consumed-allotted-resource_length`' /> + </set> + </block> + </outcome> + </switch> + </block> + </outcome> + </switch> + <set> + <parameter name='service-data.consumed-allotted-resources.consumed-allotted-resource[$tmp.cidx].allotted-resource-id' value="`$tmp.ar.allotted-resource-id` " /> + <parameter name='service-data.consumed-allotted-resources.consumed-allotted-resource[$tmp.cidx].allotted-resource-type' value="`$contrail-route-topology-operation-input.allotted-resource-information.allotted-resource-type` " /> + <parameter name='service-data.consumed-allotted-resources.consumed-allotted-resource[$tmp.cidx].allotted-resource-pointer' value="`$tmp.ar.self-link` " /> + <parameter name='service-data.consumed-allotted-resources.consumed-allotted-resource_length' value='`$tmp.cidx + 1`' /> + </set> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='setTime' > + <parameter name="outputPath" value="tmp.current-time" /> + </execute> + <set> + <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.order-status' value='PendingCreate' /> + <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.last-action' value='`$contrail-route-topology-operation-input.request-information.request-action`' /> + <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.last-rpc-action' value='`$contrail-route-topology-operation-input.sdnc-request-header.svc-action`' /> + <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.last-svc-request-id' value='`$contrail-route-topology-operation-input.sdnc-request-header.svc-request-id`' /> + <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.create-timestamp' value='`$tmp.current-time`' /> + </set> + <update 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 = $tmp.ar.allotted-resource-id" + pfx='pfx' local-only='false' force='false'> + <parameter name="description" value="`$contrail-route-topology-operation-input.allotted-resource-information.allotted-resource-type`" /> + <parameter name="selflink" value="`$tmp.ar.self-link`" /> + <parameter name="model-invariant-id" value="`$ar-model.invariant-uuid`" /> + <parameter name="model-version-id" value="`$ar-model.uuid`" /> + <parameter name="operational-status" value="null" /> + <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> + </update> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.parentsvc.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.parent-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='PUT' /> + <parameter name="responsePrefix" value="parent" /> + <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> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > + <parameter name="source" value="`$tmp.network-ar-url`"/> + <parameter name="outputPath" value="tmp.network-ar-url"/> + <parameter name="target" value="{network-id}"/> + <parameter name="replacement" value="`$ar-assignments.dest-network.network-id`"/> + </execute> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.network-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="net-ar" /> + <outcome value='success'> + <block atomic="true"> + <set> + <parameter name='tmp.found-nidx' value='false' /> + </set> + <switch test='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`'> + <outcome value=''> + <block atomic="true"> + <set> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id_length' value="1" /> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id[0]' value="`$tmp.ar.allotted-resource-id`" /> + </set> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.network-ar.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.network-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='PUT' /> + <parameter name="responsePrefix" value="p-network-ar" /> + <outcome value='success'> + <block></block> + </outcome> + <outcome value='failure'> + <block></block> + </outcome> + <outcome value='not-found'> + <block></block> + </outcome> + </execute> + </block> + </outcome> + <outcome value='Other'> + <block atomic="true"> + <for index='nidx' start='0' end='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`' > + <switch test="`$net-ar.network-provided-allotted-resources.network-provided-ar-id[$nidx] == $tmp.ar.allotted-resource-id`"> + <outcome value='true'> + <block atomic="true"> + <set> + <parameter name='tmp.found-nidx' value='true' /> + </set> + <break/> + </block> + </outcome> + </switch> + </for> + <switch test='`$tmp.found-nidx`'> + <outcome value='false'> + <block atomic="true"> + <set> + <parameter name='tmp.nidx' value='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`' /> + </set> + <set> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id_length' value='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length + 1`' /> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id[$tmp.nidx]' value="`$tmp.ar.allotted-resource-id`" /> + </set> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.network-ar.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.network-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='PUT' /> + <parameter name="responsePrefix" value="p-network-ar" /> + <outcome value='success'> + <block></block> + </outcome> + <outcome value='failure'> + <block></block> + </outcome> + <outcome value='not-found'> + <block></block> + </outcome> + </execute> + </block> + </outcome> + </switch> + </block> + </outcome> + </switch> + </block> + </outcome> + <outcome value='not-found'> + <block atomic="true"> + <set> + <parameter name='tmp.found-nidx' value='false' /> + </set> + <switch test='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`'> + <outcome value=''> + <block atomic="true"> + <set> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id_length' value="1" /> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id[0]' value="`$tmp.ar.allotted-resource-id`" /> + </set> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.network-ar.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.network-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='PUT' /> + <parameter name="responsePrefix" value="p-network-ar" /> + <outcome value='success'> + <block></block> + </outcome> + <outcome value='failure'> + <block></block> + </outcome> + <outcome value='not-found'> + <block></block> + </outcome> + </execute> + </block> + </outcome> + <outcome value='Other'> + <block atomic="true"> + <for index='nidx' start='0' end='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`' > + <switch test="`$net-ar.network-provided-allotted-resources.network-provided-ar-id[$nidx] == $tmp.ar.allotted-resource-id`"> + <outcome value='true'> + <block atomic="true"> + <set> + <parameter name='tmp.found-nidx' value='true' /> + </set> + <break/> + </block> + </outcome> + </switch> + </for> + <switch test='`$tmp.found-nidx`'> + <outcome value='false'> + <block atomic="true"> + <set> + <parameter name='tmp.nidx' value='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`' /> + </set> + <set> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id_length' value='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length + 1`' /> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id[$tmp.nidx]' value="`$tmp.ar.allotted-resource-id`" /> + </set> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.network-ar.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.network-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='PUT' /> + <parameter name="responsePrefix" value="p-network-ar" /> + <outcome value='success'> + <block></block> + </outcome> + <outcome value='failure'> + <block></block> + </outcome> + <outcome value='not-found'> + <block></block> + </outcome> + </execute> + </block> + </outcome> + </switch> + </block> + </outcome> + </switch> + </block> + </outcome> + <outcome value='failure'> + <block atomic="true"> + <set> + <parameter name='tmp.found-nidx' value='false' /> + </set> + <switch test='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`'> + <outcome value=''> + <block atomic="true"> + <set> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id_length' value="1" /> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id[0]' value="`$tmp.ar.allotted-resource-id`" /> + </set> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.network-ar.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.network-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='PUT' /> + <parameter name="responsePrefix" value="p-network-ar" /> + <outcome value='success'> + <block></block> + </outcome> + <outcome value='failure'> + <block></block> + </outcome> + <outcome value='not-found'> + <block></block> + </outcome> + </execute> + </block> + </outcome> + <outcome value='Other'> + <block atomic="true"> + <for index='nidx' start='0' end='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`' > + <switch test="`$net-ar.network-provided-allotted-resources.network-provided-ar-id[$nidx] == $tmp.ar.allotted-resource-id`"> + <outcome value='true'> + <block atomic="true"> + <set> + <parameter name='tmp.found-nidx' value='true' /> + </set> + <break/> + </block> + </outcome> + </switch> + </for> + <switch test='`$tmp.found-nidx`'> + <outcome value='false'> + <block atomic="true"> + <set> + <parameter name='tmp.nidx' value='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length`' /> + </set> + <set> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id_length' value='`$net-ar.network-provided-allotted-resources.network-provided-ar-id_length + 1`' /> + <parameter name='net-ar.network-provided-allotted-resources.network-provided-ar-id[$tmp.nidx]' value="`$tmp.ar.allotted-resource-id`" /> + </set> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.network-ar.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.network-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='PUT' /> + <parameter name="responsePrefix" value="p-network-ar" /> + <outcome value='success'> + <block></block> + </outcome> + <outcome value='failure'> + <block></block> + </outcome> + <outcome value='not-found'> + <block></block> + </outcome> + </execute> + </block> + </outcome> + </switch> + </block> + </outcome> + </switch> + </block> + </outcome> + </execute> + <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='PUT' /> + <parameter name="responsePrefix" value="mdsal-ar" /> + <outcome value='failure'> + <block> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.parentsvc.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.parent-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="parent" /> + <outcome value='success'> + <block></block> + </outcome> + <outcome value='failure'> + <block></block> + </outcome> + <outcome value='not-found'> + <block></block> + </outcome> + </execute> + <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. Parent provided resource rolled back" /> + </return> + </block> + </outcome> + <outcome value='not-found'> + <block> + <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > + <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.parentsvc.templatefile`" /> + <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.parent-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="parent" /> + <outcome value='success'> + <block></block> + </outcome> + <outcome value='failure'> + <block></block> + </outcome> + <outcome value='not-found'> + <block></block> + </outcome> + </execute> + <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. Parent provided resource rolled back" /> + </return> + </block> + </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 |