diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-08-07 18:16:51 +0530 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-08-07 18:45:48 +0530 |
commit | e588a689be944b6344bb8384b24ce7fa82eca641 (patch) | |
tree | 4dfd4a0c2129b468dd4fcf1b70df36b666f72cf0 /bpmn/so-bpmn-infrastructure-flows/src/main | |
parent | 7b3675d4826d793daafea13900cc86c725392173 (diff) |
Add request body for differnet resource
Add request body for differnet resource.
Change-Id: I2c2b0634d5adb84214b5e3177c9bcdcff3b6f334
Issue-ID: SO-689
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main')
-rw-r--r-- | bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy | 129 |
1 files changed, 126 insertions, 3 deletions
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index cc0f9bb5f4..c819da4be4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -163,8 +163,130 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //here convert json string to xml string String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson))) // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + String sdncTopologyCreateRequest = "" + + switch (modelName) { + case ~/^Site$/: + sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name> + <vnf-information> + <!-- TODO: to be filled as per the request input --> + <vnf-id></vnf-id> + <vnf-type></vnf-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </network-information> + <vnf-input-parameters> + <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters> + </vnf-input-parameters> + <vnf-request-input> + <request-version></request-version> + <vnf-name></vnf-name> + <neutron-id></neutron-id> + <contrail-network-fqdn></contrail-network-fqdn> + <subnets-data> + <subnet-data> + <element> + <ip-version></ip-version> + <subnet-id></subnet-id> + </subnet-data> + </subnets-data> + </vnf-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + case ~/^SOTNAttachment$/: + sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name> + <allotted-resource-information> + <!-- TODO: to be filled as per the request input --> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id><parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + default: + sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> @@ -210,8 +332,9 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) msoLogger.debug(sndcTopologyCreateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) |