diff options
Diffstat (limited to 'platform-logic/generic-resource-api/src/main/xml')
-rw-r--r-- | platform-logic/generic-resource-api/src/main/xml/sdwan/GENERIC-RESOURCE-API_sdwan-bandwidth-policy-change.xml | 318 |
1 files changed, 318 insertions, 0 deletions
diff --git a/platform-logic/generic-resource-api/src/main/xml/sdwan/GENERIC-RESOURCE-API_sdwan-bandwidth-policy-change.xml b/platform-logic/generic-resource-api/src/main/xml/sdwan/GENERIC-RESOURCE-API_sdwan-bandwidth-policy-change.xml new file mode 100644 index 00000000..8653689c --- /dev/null +++ b/platform-logic/generic-resource-api/src/main/xml/sdwan/GENERIC-RESOURCE-API_sdwan-bandwidth-policy-change.xml @@ -0,0 +1,318 @@ +<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='sdwan-bandwidth-policy-change' mode='sync'>
+ <block atomic="true">
+ <switch test='`$service-data.vnfs.vnf_length`'>
+ <outcome value=''>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="vnf-topology-operation-input.vnf-request-input.vnf-id not found in service-data" />
+ </return>
+ </outcome>
+ </switch>
+ <for index='idx' start='0' end='`$service-data.vnfs.vnf_length`' >
+ <switch test="`$service-data.vnfs.vnf[$idx].vnf-id == $vf-module-topology-operation-input.vnf-information.vnf-id`">
+ <outcome value='true'>
+ <set>
+ <parameter name='vnf-index' value='`$idx`' />
+ </set>
+ </outcome>
+ </switch>
+ </for>
+ <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`'>
+ <outcome value='0'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="vf-module-operation-input.vf-module-request-input.vf-id not found in service-data" />
+ </return>
+ </outcome>
+ <outcome value=''>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="vf-module-operation-input.vf-module-request-input.vf-id not found in service-data" />
+ </return>
+ </outcome>
+ <outcome value='Other'>
+ <set>
+ <parameter name='vf-module-length' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`' />
+ </set>
+ </outcome>
+ </switch>
+ <for index='idx' start='0' end='`$vf-module-length`' >
+ <block atomic="true">
+ <switch test="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$idx].vf-module-data.request-information.request-action == 'ActivateSDWANPortInstance'`">
+ <outcome value='true'>
+ <block atomic="true">
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
+ <parameter name="file" value="/opt/opendaylight/current/data/log/svclogic121.log"/>
+ <parameter name="field1" value="__TIMESTAMP__"/>
+ <parameter name="field2" value="tmp.wanPortVidx"/>
+ <parameter name="field3" value='`$tmp.wanPortVidx`'/>
+ <parameter name="field4" value="wan port i/p param len"/>
+ <parameter name="field5" value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$idx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param_length`'/>
+ </record>
+ <set>
+ <parameter name='tmp.wanPortVidx' value='`$idx`' />
+ <parameter name='ctx.vf-module-data.' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$idx].vf-module-data.`' />
+ </set>
+ <set>
+ <parameter name='vf-module-request-input.' value='`$ctx.vf-module-data.vf-module-request-input.`' />
+ </set>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-get-wan-param' mode='sync' ></call>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <set>
+ <parameter name='prop.siteAttachements_length' value='0' />
+ <parameter name='prop.siteIds_length' value='0' />
+ </set>
+ <for index='vfidx' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module_length`' >
+ <block>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
+ <parameter name="file" value="/opt/opendaylight/current/data/log/svclogic111.log"/>
+ <parameter name="field1" value="__TIMESTAMP__"/>
+ <parameter name="field2" value="request-action"/>
+ <parameter name="field3" value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.request-information.request-action`'/>
+ </record>
+ <switch test="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.request-information.request-action == 'ActivateSDWANDeviceInstance'`">
+ <outcome value='true'>
+ <block atomic="true">
+ <for index="didx" start="0" end="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param_length`">
+ <block atomic="true">
+ <switch test="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param[$didx].name == 'name'`">
+ <outcome value='true'>
+ <block atomic="true">
+ <switch test="`$prop.wan.deviceName == $service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param[$didx].value`">
+ <outcome value='true'>
+ <block atomic="true">
+ <for index="deviceidx" start="0" end="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param_length`">
+ <block atomic="true">
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
+ <parameter name="file" value="/opt/opendaylight/current/data/log/svclogic113.log"/>
+ <parameter name="field1" value="__TIMESTAMP__"/>
+ <parameter name="field2" value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param[$deviceidx].name`'/>
+ <parameter name="field3" value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param[$deviceidx].value`'/>
+ </record>
+ <switch test="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param[$deviceidx].name == 'deviceId'`">
+ <outcome value='true'>
+ <set>
+ <parameter name='prop.wan.deviceId' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.vf-module-request-input.vf-module-input-parameters.param[$deviceidx].value`' />
+ </set>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <set>
+ <parameter name='tmp.devicevidx' value='`$vfidx`' />
+ </set>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
+ <parameter name="file" value="/opt/opendaylight/current/data/log/svclogic112.log"/>
+ <parameter name="field1" value="__TIMESTAMP__"/>
+ <parameter name="field2" value="tmp.devicevidx"/>
+ <parameter name="field3" value='`$tmp.devicevidx`'/>
+ </record>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ </block>
+ </outcome>
+ </switch>
+ <switch test="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].vf-module-data.request-information.request-action == 'ActivateSiteInstance'`">
+ <outcome value='true'>
+ <set>
+ <parameter name='tmp.siteVidx' value='`$vfidx`' />
+ <parameter name='ctx.site.' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vfidx].`' />
+ </set>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <switch test="`$tmp.wanPortVidx`">
+ <outcome value=''>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="ActivateSDWANPortInstance not found in service-data" />
+ </return>
+ </outcome>
+ </switch>
+ <switch test="`$tmp.siteVidx`">
+ <outcome value=''>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="ActivateSiteInstance not found in service-data" />
+ </return>
+ </outcome>
+ </switch>
+ <switch test="`$tmp.devicevidx`">
+ <outcome value=''>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="ActivateSDWANDeviceInstance not found in service-data" />
+ </return>
+ </outcome>
+ </switch>
+ <for index="sidx" start="0" end="`$ctx.site.vf-module-data.vf-module-request-input.vf-module-input-parameters.param_length`">
+ <block atomic="true">
+ <switch test="`$ctx.site.vf-module-data.vf-module-request-input.vf-module-input-parameters.param[$sidx].name == 'siteId'`">
+ <outcome value='true'>
+ <set>
+ <parameter name='prop.wan.siteId' value='`$ctx.site.vf-module-data.vf-module-request-input.vf-module-input-parameters.param[$sidx].value`' />
+ </set>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <set>
+ <parameter name='prop.tenant-id' value='d9511b64-61ae-446e-96a1-6adbff09582c' />
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/actokentemplate.json'`" />
+ <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/controller/campus/v2/baseservice/tenants/authorization/' + $prop.tenant-id`" />
+ <parameter name="restapiUser" value="`$prop.sdncRestApi.thirdpartySdnc.user`" />
+ <parameter name="restapiPassword" value="`$prop.sdncRestApi.thirdpartySdnc.password`" />
+ <parameter name="format" value="json"/>
+ <parameter name="httpMethod" value="put"/>
+ <parameter name="responsePrefix" value="tenant-result"/>
+ <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.jks"/>
+ <parameter name="trustStorePassword" value="adminadmin"/>
+ <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
+ <parameter name="keyStorePassword" value="adminadmin"/>
+ <parameter name='customHttpHeaders' value="`'X-ACCESS-TOKEN=' + $prop.sdncRestApi.token_id`" />
+ </execute>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/controller/campus/v1/sdwan/net/network-orchestration-resources'`" />
+ <parameter name="restapiUser" value="`$prop.sdncRestApi.thirdpartySdnc.user`" />
+ <parameter name="restapiPassword" value="`$prop.sdncRestApi.thirdpartySdnc.password`" />
+ <parameter name="format" value="json"/>
+ <parameter name="httpMethod" value="get"/>
+ <parameter name="responsePrefix" value="transportNetworksResp"/>
+ <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.jks"/>
+ <parameter name="trustStorePassword" value="adminadmin"/>
+ <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
+ <parameter name="keyStorePassword" value="adminadmin"/>
+ <parameter name='customHttpHeaders' value="`'X-ACCESS-TOKEN=' + $prop.sdncRestApi.token_id`" />
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='ack-final' value='Y'/>
+ <parameter name="error-code" value="500" />
+ <parameter name="error-message" value="Error executing Get transport network info rest api" />
+ </return>
+ </outcome>
+ <outcome value='success'>
+ <block atomic="true"></block>
+ </outcome>
+ </execute>
+ <for index="tidx" start="0" end="`$transportNetworksResp.data.transportNetworks_length`">
+ <block>
+ <switch test="`$transportNetworksResp.data.transportNetworks[$tidx].name == $prop.wan.transportNetworkName`">
+ <outcome value='true'>
+ <set>
+ <parameter name='prop.wan.transportNetworkId' value='`$transportNetworksResp.data.transportNetworks[$tidx].id`' />
+ </set>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' >
+ <parameter name="original_string" value='`$prop.wan.ipAddress`'/>
+ <parameter name="regex" value="/"/>
+ <parameter name="ctx_memory_result_key" value="ipandMask"/>
+ <outcome value='success'>
+ <set>
+ <parameter name='prop.wan.ip-address' value='`$ipandMask[0]`' />
+ <parameter name='prop.wan.prefixLength' value='`$ipandMask[1]`' />
+ </set>
+ </outcome>
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='error-code' value='' />
+ <parameter name='error-message' value="An error occured while splitting sna1_route" />
+ </return>
+ </outcome>
+ </execute>
+ <for index="bwidx" start="0" end="`$vf-module-topology-operation-input.vf-module-request-input.vf-module-input-parameters.param_length`">
+ <block atomic="true">
+ <switch test="`$vf-module-topology-operation-input.vf-module-request-input.vf-module-input-parameters.param[$bwidx].name == 'bandwidth'`">
+ <outcome value='true'>
+ <set>
+ <parameter name='prop.wan.inputBandwidth' value='`$vf-module-topology-operation-input.vf-module-request-input.vf-module-input-parameters.param[$bwidx].value`' />
+ <parameter name='prop.wan.outputBandwidth' value='`$vf-module-topology-operation-input.vf-module-request-input.vf-module-input-parameters.param[$bwidx].value`' />
+ </set>
+ </outcome>
+ </switch>
+ <switch test="`$vf-module-topology-operation-input.vf-module-request-input.vf-module-input-parameters.param[$bwidx].name == 'bandwidth-change-time'`">
+ <outcome value='true'>
+ <set>
+ <parameter name='prop.wan.bandwidth-change-time' value='`$vf-module-topology-operation-input.vf-module-request-input.vf-module-input-parameters.param[$bwidx].value`' />
+ </set>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <switch test="`$prop.wanPortUpdate`">
+ <outcome value=''>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/sdwan-wan-port.json'`" />
+ <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/controller/campus/v1/sdwan/net/transport-network-ports'`" />
+ <parameter name="restapiUser" value="`$prop.sdncRestApi.thirdpartySdnc.user`" />
+ <parameter name="restapiPassword" value="`$prop.sdncRestApi.thirdpartySdnc.password`" />
+ <parameter name="format" value="json"/>
+ <parameter name="httpMethod" value="put"/>
+ <parameter name="responsePrefix" value="wanPortResp"/>
+ <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.jks"/>
+ <parameter name="trustStorePassword" value="adminadmin"/>
+ <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
+ <parameter name="keyStorePassword" value="adminadmin"/>
+ <parameter name='customHttpHeaders' value="`'X-ACCESS-TOKEN=' + $prop.sdncRestApi.token_id`" />
+ <outcome value='failure'>
+ <block atomic="true"></block>
+ </outcome>
+ <outcome value='success'>
+ <block atomic="true"></block>
+ </outcome>
+ </execute>
+ </outcome>
+ </switch>
+ <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='generateUUID' >
+ <parameter name="ctx-destination" value="prop.bandwidth.bandwidth-policyId"/>
+ </execute>
+ <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='bandwidth-history'
+ key='sdwan-bandwidth-policy-id = $prop.bandwidth.bandwidth-policyId' >
+ <parameter name="sdwan-bandwidth-policy-id" value="`$prop.bandwidth.bandwidth-policyId`" />
+ <parameter name="sdwan-bandwidth-policy-name" value="`$prop.bandwidth.bandwidth-policyId`" />
+ <parameter name="bandwidth-value" value="`$prop.wan.inputBandwidth`" />
+ <parameter name="bandwidth-change-time" value="`$prop.wan.bandwidth-change-time`" />
+ <parameter name="vpn-id" value="`$prop.bandwidth.vpnId`" />
+ <!--parameter name='model-customization-id' value='`$vnf-topology-operation-input.vnf-information.onap-model-information.model-customization-uuid`' /><parameter name='model-invariant-id' value='`$vnf-topology-operation-input.vnf-information.onap-model-information.model-invariant-uuid`' /><parameter name='model-version-id' value='`$vnf-topology-operation-input.vnf-information.onap-model-information.model-uuid`' /-->
+ <outcome value='success'>
+ <block atomic="true"></block>
+ </outcome>
+ <outcome value='failure'>
+ <return status='failure'>
+ <parameter name='error-code' value='' />
+ <parameter name='error-message' value="Falied to add AAI bandwidth history record" />
+ </return>
+ </outcome>
+ </save>
+ <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 |