From b179638916dd51a19668d91d4011c8aca54839c4 Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Thu, 11 Apr 2019 12:15:14 +0300 Subject: Modify the SO to support BBS usecase Modify the SO to support BBS usecase. Change-Id: I359380bcea9ff4ebb4e021b0425f727392ac590f Issue-ID: SO-1578 Signed-off-by: marios.iakovidis --- .../vnfmadapter/extclients/vnfm/VnfmHelper.java | 3 +- .../bpmn/infrastructure/scripts/HandlePNF.groovy | 84 +++++++++++++++ .../src/main/resources/process/HandlePNF.bpmn | 119 +++++++++++++++++++++ 3 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java index 2e233180bb..c0d3cf8567 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java @@ -166,8 +166,7 @@ public class VnfmHelper { } /** - * Create a {@link LccnSubscriptionRequest} to send in an notification subscription request to a - * VNFM. + * Create a {@link LccnSubscriptionRequest} to send in an notification subscription request to a VNFM. * * @param the ID of the VNF notifications are required for * diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy new file mode 100644 index 0000000000..90c2b923b0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.apache.commons.lang3.StringUtils +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +public class HandlePNF extends AbstractServiceTaskProcessor{ + private static final Logger logger = LoggerFactory.getLogger( HandlePNF.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() + + @Override + void preProcessRequest(DelegateExecution execution) { + msoLogger.debug("Start preProcess for HandlePNF") + + // set correlation ID + def resourceInput = execution.getVariable("resourceInput") + String serInput = jsonUtil.getJsonValue(resourceInput, "requestsInputs") + String correlationId = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_pnf_name") + if (!StringUtils.isEmpty(correlationId)) { + execution.setVariable(ExecutionVariableNames.CORRELATION_ID, correlationId) + msoLogger.debug("Found correlation id : " + correlationId) + } else { + msoLogger.error("== correlation id is empty ==") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "correlation id is not provided") + } + + // next task will set the uuid + msoLogger.debug("exit preProcess for HandlePNF") + } + + void postProcessRequest(DelegateExecution execution) { + msoLogger.debug("start postProcess for HandlePNF") + + msoLogger.debug("exit postProcess for HandlePNF") + } + + public void sendSyncResponse (DelegateExecution execution) { + msoLogger.debug(" *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResponse *****") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn new file mode 100644 index 0000000000..c81b289737 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn @@ -0,0 +1,119 @@ + + + + + SequenceFlow_1c92ks3_activate + + + SequenceFlow_1c92ks3_activate + SequenceFlow_17xr584 + SequenceFlow_12q67gd + import org.onap.so.bpmn.infrastructure.scripts.* +def handlePNF = new HandlePNF() +handlePNF.preProcessRequest(execution) + + + + + + SequenceFlow_02fi1yn + + + + + + + + SequenceFlow_1apj1fn + SequenceFlow_0pujwl4 + + + SequenceFlow_0pujwl4 + SequenceFlow_1la8oih + SequenceFlow_1ezf4gu + import org.onap.so.bpmn.infrastructure.scripts.* +def handlePNF = new HandlePNF() +handlePNF.postProcessRequest(execution) + + + + + SequenceFlow_12q67gd + SequenceFlow_17xr584 + SequenceFlow_1apj1fn + + + + + SequenceFlow_1ezf4gu + SequenceFlow_1la8oih + SequenceFlow_02fi1yn + import org.onap.so.bpmn.infrastructure.scripts.* +def handlePNF = new HandlePNF() +handlePNF.sendSyncResponse(execution) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg