diff options
author | 2018-08-14 22:22:33 +0530 | |
---|---|---|
committer | 2018-08-15 12:57:35 +0000 | |
commit | 3f685b55bb87cf53c78ba5c8d0bbe032387d1282 (patch) | |
tree | cb1e1a787151e5c987d4ffa1664f12aee5a9ae80 /platform-logic/generic-resource-api/src/main/xml | |
parent | 352fe4eda18c7bb084510dbae906d24d41ced8a8 (diff) |
SDWAN device instance DGs
SDWAN DeviceInstance vnf topology operation DGs
Change-Id: I7072271ca36030046f0146b072ad0ecfa9efd69d
Issue-ID: SDNC-357
Signed-off-by: Prakash E <prakash.e@huawei.com>
Former-commit-id: c3161a030a9c6fd044572ff4a0dfd58da674dae2
Diffstat (limited to 'platform-logic/generic-resource-api/src/main/xml')
6 files changed, 677 insertions, 0 deletions
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-get-device-param.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-get-device-param.xml new file mode 100644 index 00000000..c4bbca19 --- /dev/null +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-get-device-param.xml @@ -0,0 +1,87 @@ +<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-get-device-param' mode='sync'> + <block atomic="true"> + <for index='idx' start='0' end='`$vnf-request-input.vnf-input-parameters.param_length`' > + <block> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'name'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.name' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'esn'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.esn' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'class'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.class' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'type'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.deviceModel' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'version'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.version' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'systemIp'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.systemIP' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'description'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.description' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'vendor'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.vendor' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'deviceId'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.deviceId' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <switch test="`$vnf-request-input.vnf-input-parameters.param[$idx].name == 'sdncCreate'`"> + <outcome value='true'> + <set> + <parameter name='prop.device.sdncCreate' value='`$vnf-request-input.vnf-input-parameters.param[$idx].value`' /> + </set> + </outcome> + </switch> + <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> + </for> + </block> + </method> +</service-logic>
\ No newline at end of file diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-activate.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-activate.xml new file mode 100644 index 00000000..5c4d4785 --- /dev/null +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-activate.xml @@ -0,0 +1,160 @@ +<service-logic
+ xmlns='http://www.onap.org/sdnc/svclogic'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='GENERIC-RESOURCE-API' version='1.2.1-SNAPSHOT'>
+ <method rpc='sdwan-vnf-topology-operation-device-activate' mode='sync'>
+ <block atomic="true">
+ <for index='vidx' start='0' end='`$service-data.vnfs.vnf_length`' >
+ <block>
+ <switch test="`$service-data.vnfs.vnf[$vidx].vnf-id == $vnf-topology-operation-input.vnf-information.vnf-id`">
+ <outcome value='true'>
+ <block atomic="true">
+ <set>
+ <parameter name='tmp.vidx' value='`$vidx`' />
+ <parameter name='ctx.vnf-data.' value='`$service-data.vnfs.vnf[$vidx].`' />
+ </set>
+ <set>
+ <parameter name='vnf-request-input.' value='`$ctx.vnf-data.vnf-data.vnf-request-input.`' />
+ </set>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-get-device-param' mode='sync' ></call>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <switch test="`$tmp.vidx`">
+ <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>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
+ <parameter name="file" value="/opt/opendaylight/current/data/log/svclogic.log"/>
+ <parameter name="field1" value="__TIMESTAMP__"/>
+ <parameter name="field2" value="Provided alloted resource length"/>
+ <parameter name="field3" value="'parameters length'"/>
+ <parameter name="field4" value='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param_length`'/>
+ </record>
+ <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>
+ <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
+ resource="esr-thirdparty-sdnc"
+ key="esr-thirdparty-sdnc.thirdparty-sdnc-id = SDWAN-Controller AND
+ depth = '1'"
+ pfx='tmp.aai.esr-thirdparty-sdnc' local-only='false' >
+ <outcome value='success'>
+ <set>
+ <parameter name='prop.sdncRestApi.thirdpartySdnc.url' value="`$tmp.aai.esr-thirdparty-sdnc.esr-system-info-list.esr-system-info[0].service-url`" />
+ <parameter name='prop.sdncRestApi.thirdpartySdnc.user' value="`$tmp.aai.esr-thirdparty-sdnc.esr-system-info-list.esr-system-info[0].user-name`" />
+ <parameter name='prop.sdncRestApi.thirdpartySdnc.password' value="`$tmp.aai.esr-thirdparty-sdnc.esr-system-info-list.esr-system-info[0].password`" />
+ </set>
+ </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="`'An error occurred while querying esr-thirdparty-sdnc from AnAI with thirdparty-sdnc-id = ' + $tmp.thirdparty-sdnc-id`" />
+ </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="`'Unexpected error occurred while querying esr-thirdparty-sdnc from AnAI with thirdparty-sdnc-id = ' + $tmp.thirdparty-sdnc-id`" />
+ </return>
+ </outcome>
+ </get-resource>
+ <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/v2/tokens'`" />
+ <parameter name="format" value="json"/>
+ <parameter name="httpMethod" value="post"/>
+ <parameter name="responsePrefix" value="token-result"/>
+ <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.openecomp.client.jks"/>
+ <parameter name="trustStorePassword" value="adminadmin"/>
+ <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
+ <parameter name="keyStorePassword" value="adminadmin"/>
+ <outcome value='success'>
+ <set>
+ <parameter name='prop.sdncRestApi.token_id' value='`$token-result.data.token_id`' />
+ </set>
+ </outcome>
+ <outcome value='failure'>
+ <block></block>
+ </outcome>
+ </execute>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/sdwan-device.json'`" />
+ <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/controller/campus/v3/devices'`" />
+ <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="deviceResp"/>
+ <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.openecomp.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 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="post"/><parameter name="responsePrefix" value="wanPortResp"/><parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.openecomp.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='success'>
+ <block atomic="true"></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 executing Activate Device rest api" />
+ </return>
+ </outcome>
+ </execute>
+ <set>
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-request-input.vnf-input-parameters.param[$service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-request-input.vnf-input-parameters.param_length].name' value="deviceId" />
+ <!--parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-request-input.vnf-input-parameters.param[$service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-request-input.vnf-input-parameters.param_length].value' value='`$deviceResp[0].id`' /-->
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-request-input.vnf-input-parameters.param[$service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-request-input.vnf-input-parameters.param_length].value' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-request-input.vnf-input-parameters.param_length' value='`$service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-request-input.vnf-input-parameters.param_length + 1`' />
+ </set>
+ <set>
+ <parameter name='vnfId' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' />
+ <parameter name="vnf-object-path" value="`'restconf/config/GENERIC-RESOURCE-API:services/service/' + $vnf-topology-operation-input.service-information.service-instance-id + '/service-data/vnfs/vnf/' + $vnf-topology-operation-input.vnf-information.vnf-id + '/vnf-data/'` " />
+ </set>
+ <set>
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-level-oper-status.order-status' value='Active' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-level-oper-status.last-rpc-action' value='`$vnf-topology-operation-input.sdnc-request-header.svc-action`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-level-oper-status.last-action' value='`$vnf-topology-operation-input.request-information.request-action`' />
+ </set>
+ <set>
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-id' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.sdnc-request-header.' value='`$vnf-topology-operation-input.sdnc-request-header.`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.request-information.' value='`$vnf-topology-operation-input.request-information.`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.service-information.' value='`$vnf-topology-operation-input.service-information.`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-information.' value='`$vnf-topology-operation-input.vnf-information.`' />
+ </set>
+ <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='device'
+ key='device.id = $vnf-topology-operation-input.vnf-information.vnf-id' >
+ <parameter name='id' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' />
+ <parameter name='device-id' value='$deviceResp[0].id' />
+ <parameter name='operational-status' value='Active' />
+ </save>
+ <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='service-instance:relationship-list'
+ key='service-instance.service-instance-id = $service-data.service-information.service-instance-id
+ AND customer.global-customer-id = $service-data.vnfs.vnf[$vnf-index].vnf-data.service-information.global-customer-id
+ AND service-subscription.service-type = $service-data.vnfs.vnf[$vnf-index].vnf-data.service-information.subscription-service-type'
+ force="true" pfx="tmp.AnAI-data">
+ <parameter name="relationship-list.relationship[0].related-to" value="device" />
+ <parameter name="relationship-list.relationship[0].related-link" value="`'/network/devices/device/' + $vnf-topology-operation-input.vnf-information.vnf-id`" />
+ <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="device.id" />
+ <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$vnf-topology-operation-input.vnf-information.vnf-id`" />
+ </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>
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-create.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-create.xml new file mode 100644 index 00000000..821fc1f6 --- /dev/null +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-create.xml @@ -0,0 +1,162 @@ +<service-logic + xmlns='http://www.onap.org/sdnc/svclogic' + xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='GENERIC-RESOURCE-API' version='1.2.1-SNAPSHOT'> + <method rpc='sdwan-vnf-topology-operation-device-create' mode='sync'> + <block atomic="true"> + <set> + <parameter name='prop.sdncCreate' value='false' /> + </set> + <switch test="`$vnf-topology-operation-input.vnf-information.vnf-id`"> + <outcome value=''> + <block atomic="true"> + <set> + <parameter name='prop.sdncCreate' value='true' /> + </set> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='generateUUID' > + <parameter name="ctx-destination" value="prop.vnf-id"/> + </execute> + <block atomic="true"> + <switch test='`$service-data.vnfs.vnf_length`'> + <outcome value=''> + <set> + <parameter name='vnf-index' value='0' /> + </set> + </outcome> + <outcome value='Other'> + <set> + <parameter name='vnf-index' value='`$service-data.vnfs.vnf_length`' /> + </set> + </outcome> + </switch> + <set> + <parameter name='service-data.vnfs.vnf_length' value='`$vnf-index + 1`' /> + </set> + </block> + </block> + </outcome> + <outcome value='Other'> + <block atomic="true"> + <block atomic="true"> + <switch test='`$service-data.vnfs.vnf_length`'> + <outcome value=''> + <set> + <parameter name='vnf-index' value='0' /> + </set> + </outcome> + <outcome value='Other'> + <set> + <parameter name='vnf-index' value='`$service-data.vnfs.vnf_length`' /> + </set> + </outcome> + </switch> + <set> + <parameter name='service-data.vnfs.vnf_length' value='`$vnf-index + 1`' /> + </set> + </block> + <for index='idx' start='0' end='`$service-data.vnfs.vnf_length`' > + <switch test='`$vnf-topology-operation-input.vnf-information.vnf-id == $service-data.vnfs.vnf[$idx].vnf-id`'> + <outcome value='true'> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="`'VNF id ' + $service-data.vnfs.vnf[$idx].vnf-id + + ' already exists, and has order status ' + $service-data.vnfs.vnf[$idx].vnf-data.vnf-level-oper-status.order-status`" /> + </return> + </outcome> + </switch> + </for> + <set> + <parameter name='prop.vnf-id' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' /> + </set> + </block> + </outcome> + </switch> + <for index="idx" start="0" end="`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param_length`"> + <block> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' > + <parameter name="original_string" value='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$idx].name`'/> + <parameter name="regex" value="_"/> + <parameter name="ctx_memory_result_key" value="param-prefix"/> + </execute> + <set> + <parameter name="`vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$idx].name`" value='`$param-prefix[$param-prefix_length -1]`'/> + </set> + </block> + </for> + <set> + <parameter name='vnf-request-input.' value='`$vnf-topology-operation-input.vnf-request-input.`' /> + </set> + <call module='GENERIC-RESOURCE-API' rpc='sdwan-get-device-param' mode='sync' ></call> + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-id' value='`$prop.vnf-id`' /> + </set> + <set> + <parameter name='vnfId' value='`$prop.vnf-id`' /> + <parameter name="vnf-object-path" value="`'restconf/config/GENERIC-RESOURCE-API:services/service/' + $vnf-topology-operation-input.service-information.service-instance-id + '/service-data/vnfs/vnf/' + $prop.vnf-id + '/vnf-data/'` " /> + </set> + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-level-oper-status.order-status' value='Created' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-level-oper-status.last-rpc-action' value='`$vnf-topology-operation-input.sdnc-request-header.svc-action`' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-level-oper-status.last-action' value='`$vnf-topology-operation-input.request-information.request-action`' /> + </set> + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-id' value='`$prop.vnf-id`' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.sdnc-request-header.' value='`$vnf-topology-operation-input.sdnc-request-header.`' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.request-information.' value='`$vnf-topology-operation-input.request-information.`' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.service-information.' value='`$vnf-topology-operation-input.service-information.`' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-information.' value='`$vnf-topology-operation-input.vnf-information.`' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-request-input.' value='`$vnf-topology-operation-input.vnf-request-input.`' /> + </set> + <switch test='`$prop.sdncCreate`'> + <outcome value='true'> + <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='device' + key='device.id = $prop.vnf-id' > + <parameter name='id' value='`$prop.vnf-id`' /> + <parameter name='esn' value='`$prop.device.name`' /> + <parameter name='name' value="true" /> + <parameter name='description' value='`$prop.device.description`' /> + <parameter name='vendor' value='`$prop.device.vendor`' /> + <parameter name='class' value='`$prop.device.class`' /> + <parameter name='type' value='`$prop.device.deviceModel`' /> + <parameter name='version' value='`$prop.device.version`' /> + <parameter name='system-ip' value='`$prop.device.systemIp`' /> + <parameter name='operational-status' value='Created' /> + <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`' /> + <parameter name='selflink' value="`'restconf/config/GENERIC-RESOURCE-API:services/service/' + $vnf-topology-operation-input.service-information.service-instance-id + '/service-data/vnfs/vnf/' + $prop.vnf-id + '/vnf-data/'` " /> + </save> + </outcome> + <outcome value='false'> + <update plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='device' + key='device.id = $prop.vnf-id' > + <parameter name='id' value='`$prop.vnf-id`' /> + <parameter name='esn' value='`$prop.device.name`' /> + <parameter name='name' value="true" /> + <parameter name='description' value='`$prop.device.description`' /> + <parameter name='vendor' value='`$prop.device.vendor`' /> + <parameter name='class' value='`$prop.device.class`' /> + <parameter name='type' value='`$prop.device.deviceModel`' /> + <parameter name='version' value='`$prop.device.version`' /> + <parameter name='system-ip' value='`$prop.device.systemIp`' /> + <parameter name='operational-status' value='Created' /> + <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`' /> + <parameter name='selflink' value="`'restconf/config/GENERIC-RESOURCE-API:services/service/' + $vnf-topology-operation-input.service-information.service-instance-id + '/service-data/vnfs/vnf/' + $prop.vnf-id + '/vnf-data/'` " /> + </update> + </outcome> + </switch> + <set> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-request-input.vnf-input-parameters.param[$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-request-input.vnf-input-parameters.param_length].name' value="sdncCreate" /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-request-input.vnf-input-parameters.param[$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-request-input.vnf-input-parameters.param_length].value' value='`$prop.sdncCreate`' /> + <parameter name='service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-request-input.vnf-input-parameters.param_length' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-request-input.vnf-input-parameters.param_length + 1`' /> + </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 diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-deactivate.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-deactivate.xml new file mode 100644 index 00000000..d9cea851 --- /dev/null +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-deactivate.xml @@ -0,0 +1,141 @@ +<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-vnf-topology-operation-device-deactivate' mode='sync'>
+ <block atomic="true">
+ <for index='vidx' start='0' end='`$service-data.vnfs.vnf_length`' >
+ <block>
+ <switch test="`$service-data.vnfs.vnf[$vidx].vnf-id == $vnf-topology-operation-input.vnf-information.vnf-id`">
+ <outcome value='true'>
+ <block atomic="true">
+ <set>
+ <parameter name='tmp.vidx' value='`$vidx`' />
+ <parameter name='ctx.vnf-data.' value='`$service-data.vnfs.vnf[$vidx].`' />
+ </set>
+ <set>
+ <parameter name='vnf-request-input.' value='`$ctx.vnf-data.vnf-data.vnf-request-input.`' />
+ </set>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-get-device-param' mode='sync' ></call>
+ </block>
+ </outcome>
+ </switch>
+ </block>
+ </for>
+ <switch test="`$tmp.vidx`">
+ <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>
+ <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>
+ <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
+ resource="esr-thirdparty-sdnc"
+ key="esr-thirdparty-sdnc.thirdparty-sdnc-id = SDWAN-Controller AND
+ depth = '1'"
+ pfx='tmp.aai.esr-thirdparty-sdnc' local-only='false' >
+ <outcome value='success'>
+ <set>
+ <parameter name='prop.sdncRestApi.thirdpartySdnc.url' value="`$tmp.aai.esr-thirdparty-sdnc.esr-system-info-list.esr-system-info[0].service-url`" />
+ <parameter name='prop.sdncRestApi.thirdpartySdnc.user' value="`$tmp.aai.esr-thirdparty-sdnc.esr-system-info-list.esr-system-info[0].user-name`" />
+ <parameter name='prop.sdncRestApi.thirdpartySdnc.password' value="`$tmp.aai.esr-thirdparty-sdnc.esr-system-info-list.esr-system-info[0].password`" />
+ </set>
+ </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="`'An error occurred while querying esr-thirdparty-sdnc from AnAI with thirdparty-sdnc-id = ' + $tmp.thirdparty-sdnc-id`" />
+ </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="`'Unexpected error occurred while querying esr-thirdparty-sdnc from AnAI with thirdparty-sdnc-id = ' + $tmp.thirdparty-sdnc-id`" />
+ </return>
+ </outcome>
+ </get-resource>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/sdwan-device.json'`" />
+ <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/controller/v2/tokens'`" />
+ <parameter name="format" value="json"/>
+ <parameter name="httpMethod" value="post"/>
+ <parameter name="responsePrefix" value="token-result"/>
+ <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.openecomp.client.jks"/>
+ <parameter name="trustStorePassword" value="adminadmin"/>
+ <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
+ <parameter name="keyStorePassword" value="adminadmin"/>
+ <outcome value='success'>
+ <set>
+ <parameter name='prop.sdncRestApi.token_id' value='`$token-result.data.token_id`' />
+ </set>
+ </outcome>
+ <outcome value='failure'>
+ <block></block>
+ </outcome>
+ </execute>
+ <set>
+ <parameter name='prop.devices_length' value='1' />
+ </set>
+ <set>
+ <parameter name='prop.devices[0]' value='`$prop.device.deviceId`' />
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/sdwan-device-del.json'`" />
+ <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/controller/campus/v3/devices'`" />
+ <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="delete"/>
+ <parameter name="responsePrefix" value="deviceResp"/>
+ <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.openecomp.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='success'>
+ <block atomic="true"></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 executing Create vpn rest api" />
+ </return>
+ </outcome>
+ </execute>
+ <set>
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-id' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.sdnc-request-header.' value='`$vnf-topology-operation-input.sdnc-request-header.`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.request-information.' value='`$vnf-topology-operation-input.request-information.`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.service-information.' value='`$vnf-topology-operation-input.service-information.`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-information.' value='`$vnf-topology-operation-input.vnf-information.`' />
+ </set>
+ <set>
+ <parameter name='vnfId' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' />
+ <parameter name="vnf-object-path" value="`'restconf/config/GENERIC-RESOURCE-API:services/service/' + $vnf-topology-operation-input.service-information.service-instance-id + '/service-data/vnfs/vnf/' + $vnf-topology-operation-input.vnf-information.vnf-id + '/vnf-data/'` " />
+ </set>
+ <set>
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-level-oper-status.order-status' value='PendingDelete' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-level-oper-status.last-rpc-action' value='`$vnf-topology-operation-input.sdnc-request-header.svc-action`' />
+ <parameter name='service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-level-oper-status.last-action' value='`$vnf-topology-operation-input.request-information.request-action`' />
+ </set>
+ <update plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='device'
+ key='device.id = $vnf-topology-operation-input.vnf-information.vnf-id' >
+ <parameter name='id' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' />
+ <parameter name='operational-status' value='PendingDelete' />
+ </update>
+ <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>
diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-delete.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-delete.xml new file mode 100644 index 00000000..0190be0b --- /dev/null +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_sdwan-vnf-topology-operation-device-delete.xml @@ -0,0 +1,103 @@ +<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-vnf-topology-operation-device-delete' mode='sync'> + <block atomic="true"> + <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='requiredParameters' > + <parameter name="vnf-topology-operation-input.vnf-information.vnf-id" value="$vnf-topology-operation-input.vnf-information.vnf-id"/> + </execute> + <switch test="`$vnf-topology-operation-input.vnf-information.vnf-id`"> + <outcome value=''> + <return status='failure'> + <parameter name='ack-final' value='Y'/> + <parameter name="error-code" value="500" /> + <parameter name="error-message" value="vnf-request-input.vnf-input-parameters.name is a required input" /> + </return> + </outcome> + </switch> + <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> + <outcome value='Other'> + <block atomic="true"> + <for index='vidx' start='0' end='`$service-data.vnfs.vnf_length`' > + <switch test="`$service-data.vnfs.vnf[$vidx].vnf-id == $vnf-topology-operation-input.vnf-information.vnf-id`"> + <outcome value='true'> + <block atomic="true"> + <set> + <parameter name='tmp.vidx' value='`$vidx`' /> + <parameter name='ctx.vnf-data.' value='`$service-data.vnfs.vnf[$vidx].`' /> + </set> + <set> + <parameter name='vnf-request-input.' value='`$ctx.vnf-data.vnf-data.vnf-request-input.`' /> + </set> + <call module='GENERIC-RESOURCE-API' rpc='sdwan-get-device-param' mode='sync' ></call> + <set> + <parameter name='tmp.vidx' value='`$vidx`' /> + <parameter name='ctx.vnf-data.' value='`$service-data.vnfs.vnf[$vidx].vnf-data.`' /> + </set> + </block> + </outcome> + </switch> + </for> + <switch test="`$tmp.vidx`"> + <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> + <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder"> + <parameter name="file" value="/opt/opendaylight/current/data/log/svclogic.log"/> + <parameter name="field1" value="__TIMESTAMP__"/> + <parameter name="field2" value="tmp.vidx1234555"/> + <parameter name="field3" value='`$tmp.vidx`'/> + </record> + </block> + </outcome> + </switch> + <switch test='`$service-data.vnfs.vnf[$tmp.vidx].vnf-data.vnf-level-oper-status.order-status`'> + <outcome value='PendingDelete'> + <block atomic="true"></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="`'VNF is not in appropriate state for activate. Current state is ' + $service-data.vnfs.vnf[$tmp.nidx].vnf-data.vnf-level-oper-status.order-status`" /> + </return> + </outcome> + </switch> + <set> + <parameter name="service-data.vnfs.vnf_length" value="`$service-data.vnfs.vnf_length - 1`"/> + </set> + <set> + <parameter name="service-data.vnfs.vnf[$tmp.vidx]." value=""/> + </set> + <set> + <parameter name='vnfId' value='`$vnf-topology-operation-input.vnf-information.vnf-id`' /> + <parameter name='vnf-object-path' value="`'restconf/config/GENERIC-RESOURCE-API:services/service/' + + $vnf-topology-operation-input.service-information.service-instance-id + + '/service-data/service-topology/'` " /> + </set> + <switch test="`$prop.device.sdncCreate`"> + <outcome value='true'> + <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource='device' + key='device.id = $vnf-topology-operation-input.vnf-information.vnf-id'></delete> + </outcome> + </switch> + <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 diff --git a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_vnf-topology-operation.xml b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_vnf-topology-operation.xml index e0332cc6..6dbe24bf 100644 --- a/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_vnf-topology-operation.xml +++ b/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_vnf-topology-operation.xml @@ -14,6 +14,12 @@ <outcome value='ActivateSiteInstance'>
<call module='GENERIC-RESOURCE-API' rpc='site-vnf-topology-operation-activate' mode='sync' ></call>
</outcome>
+ <outcome value='ActivateSDWANDeviceInstance'>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-vnf-topology-operation-device-activate' mode='sync' ></call>
+ </outcome>
+ <outcome value='ActivateSDWANPortInstance'>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-vnf-topology-operation-wanport-activate' mode='sync' ></call>
+ </outcome>
<outcome value='Other'>
<call module='GENERIC-RESOURCE-API' rpc='vnf-topology-operation-activate' mode='sync' ></call>
</outcome>
@@ -26,6 +32,12 @@ <outcome value='DeactivateSiteInstance'>
<call module='GENERIC-RESOURCE-API' rpc='site-vnf-topology-operation-deactivate' mode='sync' ></call>
</outcome>
+ <outcome value='DeactivateSDWANDeviceInstance'>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-vnf-topology-operation-device-deactivate' mode='sync' ></call>
+ </outcome>
+ <outcome value='DeactivateSDWANPortInstance'>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-vnf-topology-operation-wanport-deactivate' mode='sync' ></call>
+ </outcome>
<outcome value='Other'>
<call module='GENERIC-RESOURCE-API' rpc='vnf-topology-operation-deactivate' mode='sync' ></call>
</outcome>
@@ -41,6 +53,12 @@ <outcome value='CreateSiteInstance'>
<call module='GENERIC-RESOURCE-API' rpc='site-vnf-topology-operation-create' mode='sync' ></call>
</outcome>
+ <outcome value='CreateSDWANDeviceInstance'>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-vnf-topology-operation-device-create' mode='sync' ></call>
+ </outcome>
+ <outcome value='CreateSDWANPortInstance'>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-vnf-topology-operation-wanport-create' mode='sync' ></call>
+ </outcome>
<outcome value='Other'>
<block></block>
</outcome>
@@ -53,6 +71,12 @@ <outcome value='DeleteSiteInstance'>
<call module='GENERIC-RESOURCE-API' rpc='site-vnf-topology-operation-delete' mode='sync' ></call>
</outcome>
+ <outcome value='DeleteSDWANDeviceInstance'>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-vnf-topology-operation-device-delete' mode='sync' ></call>
+ </outcome>
+ <outcome value='DeleteSDWANPortInstance'>
+ <call module='GENERIC-RESOURCE-API' rpc='sdwan-vnf-topology-operation-wanport-delete' mode='sync' ></call>
+ </outcome>
<outcome value='Other'>
<block></block>
</outcome>
|