From bafa097c93d617ee19f7f8d14e35a66178bc92e4 Mon Sep 17 00:00:00 2001 From: hetengjiao Date: Wed, 11 Mar 2020 15:21:21 +0800 Subject: resolve Activation/Deactivation DB data modification problem Issue-ID: SO-2720 Change-Id: I464882c4351568843c1d8856e813e73db5c5ea8c Signed-off-by: hetengjiao --- .../scripts/ActivateCommunicationService.groovy | 7 +++++-- .../infrastructure/scripts/ActivateSliceService.groovy | 18 ++++++++++-------- .../scripts/CreateCommunicationService.groovy | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy index dc33bc930a..4ed0ea6a44 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy @@ -102,6 +102,9 @@ class ActivateCommunicationService extends AbstractServiceTaskProcessor { String operationId = jsonUtil.getJsonValue(siRequest, "operationId") execution.setVariable("operationId", operationId) + String operationType = execution.getVariable("operationType") + execution.setVariable("operationType", operationType.toUpperCase()) + } catch (BpmnError e) { throw e } catch (Exception ex) { @@ -139,14 +142,14 @@ class ActivateCommunicationService extends AbstractServiceTaskProcessor { if(si.isPresent()) { if (si.get().getOrchestrationStatus().toLowerCase() == "activated" && - operationType == "deactivation") { + operationType.equalsIgnoreCase("deactivation")) { logger.info("Service is in active state") execution.setVariable("serviceExpectStatus", "deactivated") execution.setVariable("isContinue", "true") execution.setVariable("requestParam", "deactivate") } else if (si.get().getOrchestrationStatus().toLowerCase() == "deactivated" && - operationType == "activation"){ + operationType.equalsIgnoreCase("activation")){ logger.info("Service is in de-activated state") execution.setVariable("serviceExpectStatus", "activated") execution.setVariable("isContinue", "true") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy index 5570842149..a8c3ef189e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy @@ -95,6 +95,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId' is null" logger.info(msg) + execution.setVariable("globalSubscriberId", "5GCustomer") } else { execution.setVariable("globalSubscriberId", globalSubscriberId) } @@ -104,14 +105,16 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" logger.debug(msg) - //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + execution.setVariable("subscriptionServiceType", "5G") } else { execution.setVariable("subscriptionServiceType", subscriptionServiceType) } String operationId = jsonUtil.getJsonValue(siRequest, "operationId") execution.setVariable("operationId", operationId) - execution.getVariable("operationType") + String operationType = execution.getVariable("operationType") + execution.setVariable("operationType", operationType.toUpperCase()) + logger.info("operationType is " + execution.getVariable("operationType") ) } catch (BpmnError e) { throw e @@ -308,7 +311,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { String nssiid = nssi.getNssiId() updateStratus(execution, globalCustId, serviceType, nssiid, operationType) } - if (operationType == "activation") { + if (operationType.equalsIgnoreCase("activation")) { //update the s-nssai updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) //update the nsi @@ -345,7 +348,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { Optional si = wrapper.asBean(ServiceInstance.class) if (si.isPresent()) { - if (operationType == "activation") { + if (operationType.equalsIgnoreCase("activation")) { if (si.get().getOrchestrationStatus() == "deactivated") { si.get().setOrchestrationStatus("activated") client.update(uri, si.get()) @@ -484,15 +487,14 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { Optional si = wrapper.asBean(ServiceInstance.class) if (si.isPresent()) { if (si.get().getOrchestrationStatus().toLowerCase() == "activated" && - operationType == "deactivation") { + operationType.equalsIgnoreCase("deactivation")) { logger.info("Service is in active state") execution.setVariable("e2eservicestatus", "activated") execution.setVariable("isContinue", "true") String snssai = si.get().getEnvironmentContext() execution.setVariable("snssai", snssai) - } else if ((si.get().getOrchestrationStatus().toLowerCase() == "deactivated" || - si.get().getOrchestrationStatus().toLowerCase() == "created") && - operationType == "activation") { + } else if (si.get().getOrchestrationStatus().toLowerCase() == "deactivated" && + operationType.equalsIgnoreCase("activation")) { logger.info("Service is in de-activated state") execution.setVariable("e2eservicestatus", "deactivated") execution.setVariable("isContinue", "true") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy index e3470cd011..71da2abd05 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy @@ -54,7 +54,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank */ class CreateCommunicationService extends AbstractServiceTaskProcessor { - String Prefix="CRESI_" + String Prefix="CCS_" ExceptionUtil exceptionUtil = new ExceptionUtil() -- cgit 1.2.3-korg