diff options
author | Srinivasan Ramanathan <srinivasan.ramanathan2@us.fujitsu.com> | 2020-03-18 09:23:51 +0000 |
---|---|---|
committer | Srinivasan Ramanathan <srinivasan.ramanathan2@us.fujitsu.com> | 2020-03-24 06:44:19 +0000 |
commit | e2708cba9e8190fd022a87d962721eeea2b1a2e3 (patch) | |
tree | e8a959242e9a5f18f9b7ca1469db3308789c75be /bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap | |
parent | 3b6caf9cc8e1341ea000cb55ae277f622c816dda (diff) |
Fix for MDONS create and delete flow
Added service-name update OTN service for Create flow
Added new request format for OTN service Delete flow
Change-Id: Iea3362c2a57a376f181de813158462390aaf27e3
Issue-ID: SO-2460
Signed-off-by: Srinivasan Ramanathan <srinivasan.ramanathan2@us.fujitsu.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap')
3 files changed, 49 insertions, 6 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 8b9726c2b7..7d1bc4c779 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -127,11 +127,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String key = iterator.next() HashMap<String, String> hashMap = new HashMap() hashMap.put("name", key) - if(jsonObject.get(key)==null){ - hashMap.put("value", "") - }else{ - hashMap.put("value", jsonObject.get(key)) - } + hashMap.put("value", jsonObject.get(key)) paramList.add(hashMap) } Map<String, List<Map<String, Object>>> paramMap = new HashMap() @@ -260,6 +256,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { break + case ~/[\w\s\W]*UNI[\w\s\W]*/ : + def resourceInput = resourceInputObj.getResourceParameters() + String incomingRequest = resourceInputObj.getRequestsInputs() + String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") + String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") + JSONObject inputParameters = new JSONObject(requestInputs) + String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.service-name", inputParameters.get("name")) + resourceInputObj.setResourceParameters(uResourceInput) + execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) + break + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : case ~/[\w\s\W]*SOTN-Attachment[\w\s\W]*/ : @@ -363,7 +370,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> - <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-id>${msoUtils.xmlEscape(serviceInstanceId)}</request-id> <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> <service-type>${msoUtils.xmlEscape(serviceType)}</service-type> <notification-url>sdncCallback</notification-url> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 61b1250522..cdc242dbd8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -221,6 +221,30 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { switch (modelType) { case "VNF": + if(modelName.contains("UNI") && "MDONS_OTN".equals(serviceType)){ + String serviceInstanceName = resourceInputObj.getResourceInstanceName() + sdncTopologyDeleteRequest = """<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>optical-service-delete</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-id>${msoUtils.xmlEscape(serviceInstanceId)}</request-id> + <payload> + <param> + <name>service-name</name> + <value>${msoUtils.xmlEscape(serviceInstanceName)}</value> + </param> + </payload> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } else{ sdncTopologyDeleteRequest = """<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"> @@ -275,6 +299,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } break case "GROUP" : //When a new resource creation request reaches SO, the parent resources information needs to be provided diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index a24bc4411e..35af3d34d6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -450,6 +450,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo()) List<Resource> deleteResourceList = serviceDecomposition.getServiceResources() + if (serviceDecomposition.getServiceType().equals("MDONS_OTN")){ + for (Resource resource : deleteResourceList) { + String serviceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + resource.setResourceId(serviceInstanceId) + resource.setResourceInstanceName(serviceName) + def delMap = new ImmutablePair(resource, null) + deleteRealResourceList.add(delMap) + } + } else{ String serviceRelationShip = execution.getVariable("serviceRelationShip") def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() @@ -492,6 +502,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } } + } // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) |