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_contrail-route-topology-operation-create.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_contrail-route-topology-operation-create.xml')
-rwxr-xr-x | platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_contrail-route-topology-operation-create.xml | 688 |
1 files changed, 380 insertions, 308 deletions
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_contrail-route-topology-operation-create.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_contrail-route-topology-operation-create.xml index b17e9d99..2f3c907b 100755 --- a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_contrail-route-topology-operation-create.xml +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_contrail-route-topology-operation-create.xml @@ -1,308 +1,380 @@ -<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-create' 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`' />
-
-
-
-</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.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" />
-
-</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" />
-
-</return></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-assignments.' value="`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.`" />
-
-
-
-</set><switch test='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.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"><for index='nidx' start='0' end='`$service-data.networks.network_length`' >
-<switch test="`$service-data.networks.network[$nidx].network-id == $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.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`' />
-
-
-</set><get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
- resource="tenant"
- key="cloud-region.cloud-owner = 'CloudOwner' 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><outcome value='Other'>
-<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></for></block></outcome></switch></block></outcome></switch><get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
- resource="l3-network"
- key="l3-network.network-id = $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id"
- local-only="false"
- pfx="aai.src-network">
-<outcome value='not-found'>
-<return status='failure'>
- <parameter name="error-code" value="500" />
- <parameter name="error-message" value="`'Error retrieving source network with network-id=' + $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id + ' from AnAI'`" /></return></outcome><outcome value='failure'>
-<return status='failure'>
- <parameter name="error-code" value="500" />
- <parameter name="error-message" value="`'Error retrieving source network with network-id=' + $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id + ' from AnAI'`" /></return></outcome><outcome value='success'>
-<block atomic="true"></block></outcome></get-resource><get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
- resource="l3-network"
- key="l3-network.network-id = $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.dest-network.network-id"
- local-only="false"
- pfx="aai.dest-network">
-<outcome value='not-found'>
-<return status='failure'>
- <parameter name="error-code" value="500" />
- <parameter name="error-message" value="`'Error retrieving destination network with network-id=' + $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id + ' from AnAI'`" /></return></outcome><outcome value='failure'>
-<return status='failure'>
- <parameter name="error-code" value="500" />
- <parameter name="error-message" value="`'Error retrieving destination network with network-id=' + $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id + ' from AnAI'`" /></return></outcome><outcome value='success'>
-<block atomic="true"></block></outcome></get-resource><set>
-<parameter name='cloud-region-id' value='`$tmp.ar.cloud-region-id`' />
-</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="GENERIC-RESOURCE-API.contrail-route-topology-operation-create"/>
-<parameter name='field3' value='network-policy' />
-<parameter name='field4' value='create' />
-<parameter name='field5' value='contrailResp' />
-<parameter name='field6' value='default-domain' />
-<parameter name='field7' value='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.fq-name`' />
-<parameter name='field8' value='`$tmp.ar.tenant-name`' />
-<parameter name='field9' value='`$ar.allotted-resource-data.allotted-resource-operation-information.contrail-route-request-input.contrail-applied-service-info.contrail-fqdn`' />
-<parameter name='field10' value='$aai.dest-network.contrail-network-fqdn' />
-<parameter name='field11' value='$aai.src-network.contrail-network-fqdn' />
-<parameter name='field12' value='<>' />
-<parameter name='field13' value='$tmp.ar.cloud-region-id' />
-
-
-</record><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='create' />
-<parameter name='resp-prefix' value='contrailResp' />
-<parameter name='default-domain' value='default-domain' />
-<parameter name='policy-name' value='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.fq-name`' />
-<parameter name='default-project' value='`$tmp.ar.tenant-name`' />
-<!-- dummy for dev <parameter name='default-project' value='default-project' /> -->
-<parameter name='vipr-service-instance' value='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.contrail-applied-service.contrail-fqdn`' />
-<parameter name='dst-virtual-network' value='`$aai.dest-network.contrail-network-fqdn`' />
-<parameter name='src-virtual-network' value='`$aai.src-network.contrail-network-fqdn`' />
-<parameter name='direction' value='<>' />
-<parameter name='cloud-region-id' value='`$tmp.ar.cloud-region-id`' />
-
-<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="`'Failed to create policy in Contrail. '+ $contrailResp.resp-code + ':' +$contrailResp.resp-message `" />
-</return></outcome></execute><switch test='`$contrailResp.resp-code`'>
-
-<outcome value='0'>
-<block>
-</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="`'Failed to create policy in Contrail. '+ $contrailResp.resp-code + ':' +$contrailResp.resp-message `" />
-</return></outcome></switch><set>
-<parameter name='ar-assignments.contrail-id' value="`$contrailResp.network-policy.uuid`" />
-
-
-
-</set><call module='GENERIC-RESOURCE-API' rpc='policy-manager-create-policy' mode='sync' >
-<outcome value='failure'>
-<block atomic="true">
-<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='default-domain' value='default-domain' />
-<parameter name='policy-name' value='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.fq-name`' />
-<parameter name='default-project' value='`$tmp.ar.tenant-name`' />
-<!-- dummy for dev <parameter name='default-project' value='default-project' /> -->
-<parameter name='vipr-service-instance' value='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.contrail-applied-service.contrail-fqdn`' />
-<parameter name='dst-virtual-network' value='`$aai.dest-network.contrail-network-fqdn`' />
-<parameter name='src-virtual-network' value='`$aai.src-network.contrail-network-fqdn`' />
-<parameter name='direction' value='<>' />
-<parameter name='cloud-region-id' value='`$tmp.ar.cloud-region-id`' />
-
-<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="`'Failed to create Policy in Policy Mgr. Rollback failed to delete policy in Contrail. '+ $contrailResp.resp-code + ':' +$contrailResp.resp-message `" />
-</return></outcome></execute><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 PolicyMgr. '+ $error-message + 'Contrail network policy rolled back.'`" />
-</return></block></outcome><outcome value='success'>
-<block atomic="true"></block></outcome></call><save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
- resource="network-policy"
- key="network-policy.network-policy-id = $ar-assignments.contrail-id" >
-<!-- Create l3-network object -->
-<parameter name="network-policy-id" value="`$ar-assignments.contrail-id`" />
-<parameter name="network-policy-fqdn" value="`$ar-assignments.fq-name`" />
-
-
-<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></save><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="operational-status" value="out-of-service-path" />
-<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><set>
-<parameter name='ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.' value='`$ar-assignments.`' />
-
-
-
-</set><set>
-<parameter name='ar.allotted-resource-data.allotted-resource-oper-status.order-status' value='Created' />
-<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><execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='setTime' >
- <parameter name="outputPath" value="tmp.current-time" />
-
-</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='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> +<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-create' 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`' /> + </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.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" /> + </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" /> + </return> + </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-assignments.' value="`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.`" /> + </set> + <switch test='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.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"> + <for index='nidx' start='0' end='`$service-data.networks.network_length`' > + <switch test="`$service-data.networks.network[$nidx].network-id == $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.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`' /> + </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> + <outcome value='Other'> + <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> + </for> + </block> + </outcome> + </switch> + </block> + </outcome> + </switch> + <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" + resource="l3-network" + key="l3-network.network-id = $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id" + local-only="false" + pfx="aai.src-network"> + <outcome value='not-found'> + <return status='failure'> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="`'Error retrieving source network with network-id=' + $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id + ' from AnAI'`" /> + </return> + </outcome> + <outcome value='failure'> + <return status='failure'> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="`'Error retrieving source network with network-id=' + $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id + ' from AnAI'`" /> + </return> + </outcome> + <outcome value='success'> + <block atomic="true"></block> + </outcome> + </get-resource> + <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" + resource="l3-network" + key="l3-network.network-id = $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.dest-network.network-id" + local-only="false" + pfx="aai.dest-network"> + <outcome value='not-found'> + <return status='failure'> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="`'Error retrieving destination network with network-id=' + $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id + ' from AnAI'`" /> + </return> + </outcome> + <outcome value='failure'> + <return status='failure'> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="`'Error retrieving destination network with network-id=' + $ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.source-network.network-id + ' from AnAI'`" /> + </return> + </outcome> + <outcome value='success'> + <block atomic="true"></block> + </outcome> + </get-resource> + <set> + <parameter name='cloud-region-id' value='`$tmp.ar.cloud-region-id`' /> + </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="GENERIC-RESOURCE-API.contrail-route-topology-operation-create"/> + <parameter name='field3' value='network-policy' /> + <parameter name='field4' value='create' /> + <parameter name='field5' value='contrailResp' /> + <parameter name='field6' value='default-domain' /> + <parameter name='field7' value='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.fq-name`' /> + <parameter name='field8' value='`$tmp.ar.tenant-name`' /> + <parameter name='field9' value='`$ar.allotted-resource-data.allotted-resource-operation-information.contrail-route-request-input.contrail-applied-service-info.contrail-fqdn`' /> + <parameter name='field10' value='$aai.dest-network.contrail-network-fqdn' /> + <parameter name='field11' value='$aai.src-network.contrail-network-fqdn' /> + <parameter name='field12' value='<>' /> + <parameter name='field13' value='$tmp.ar.cloud-region-id' /> + </record> + <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='create' /> + <parameter name='resp-prefix' value='contrailResp' /> + <parameter name='default-domain' value='default-domain' /> + <parameter name='policy-name' value='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.fq-name`' /> + <parameter name='default-project' value='`$tmp.ar.tenant-name`' /> + <!-- dummy for dev <parameter name='default-project' value='default-project' /> --> + <parameter name='vipr-service-instance' value='`$ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.contrail-applied-service.contrail-fqdn`' /> + <parameter name='dst-virtual-network' value='`$aai.dest-network.contrail-network-fqdn`' /> + <parameter name='src-virtual-network' value='`$aai.src-network.contrail-network-fqdn`' /> + <parameter name='direction' value='<>' /> + <parameter name='cloud-region-id' value='`$tmp.ar.cloud-region-id`' /> + <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="`'Failed to create policy in Contrail. '+ $contrailResp.resp-code + ':' +$contrailResp.resp-message `" /> + </return> + </outcome> + </execute> + <switch test='`$contrailResp.resp-code`'> + <outcome value='0'> + <block></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="`'Failed to create policy in Contrail. '+ $contrailResp.resp-code + ':' +$contrailResp.resp-message `" /> + </return> + </outcome> + </switch> + <set> + <parameter name='ar-assignments.contrail-id' value="`$contrailResp.network-policy.uuid`" /> + </set> + <call module='GENERIC-RESOURCE-API' rpc='policy-manager-create-policy' mode='sync' > + <outcome value='failure'> + <block atomic="true"> + <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='`$tmp.ar.cloud-region-id`' /> + <parameter name='contrail-network-policy-id' value='`$ar-assignments.contrail-id`' /> + <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="`'Failed to create Policy in Policy Mgr. Rollback failed to delete policy in Contrail. '+ $contrailResp.resp-code + ':' +$contrailResp.resp-message `" /> + </return> + </outcome> + </execute> + <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 PolicyMgr. '+ $error-message + 'Contrail network policy rolled back.'`" /> + </return> + </block> + </outcome> + <outcome value='success'> + <block atomic="true"></block> + </outcome> + </call> + <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" + resource="network-policy" + key="network-policy.network-policy-id = $ar-assignments.contrail-id" > + <!-- Create l3-network object --> + <parameter name="network-policy-id" value="`$ar-assignments.contrail-id`" /> + <parameter name="network-policy-fqdn" value="`$ar-assignments.fq-name`" /> + <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> + </save> + <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="operational-status" value="out-of-service-path" /> + <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> + <set> + <parameter name='ar.allotted-resource-data.contrail-route-topology.contrail-route-assignments.' value='`$ar-assignments.`' /> + </set> + <set> + <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.order-status' value='Created' /> + <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> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='setTime' > + <parameter name="outputPath" value="tmp.current-time" /> + </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='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 |