diff options
Diffstat (limited to 'bpmn')
62 files changed, 13459 insertions, 1 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 606b97bec2..34cbb00735 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.fasterxml.jackson.databind.ObjectMapper import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -529,4 +530,24 @@ class OofUtils { return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString() } + + public String buildSelectNSTRequest(String requestId, Map<String, Object> profileInfo) { + def transactionId = requestId + logger.debug( "transactionId is: " + transactionId) + ObjectMapper objectMapper = new ObjectMapper() + String json = objectMapper.writeValueAsString(profileInfo) + StringBuilder response = new StringBuilder() + response.append( + "{\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"${transactionId}\",\n" + + " \"requestId\": \"${requestId}\",\n" + + " \"sourceId\": \"so\",\n" + + " \"timeout\": 600\n" + + " },\n") + response.append(",\n \"serviceInfo\": \n") + response.append(json); + response.append("\n }\n") + return response.toString() + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java new file mode 100644 index 0000000000..eb2567d47c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.restproperties; + +import java.net.MalformedURLException; +import java.net.URL; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.sdnc.common.SDNCConstants; +import org.onap.so.client.sdnc.lcm.SDNCLcmProperties; + +public class SDNCLcmPropertiesImpl implements SDNCLcmProperties { + + public static final String SDNC_HOST = "sdnc.host"; + public static final String SDNC_AUTH = "sdnc.auth"; + public static final String LCM_PATH = "sdnc.lcm.path"; + + public static final String DMAAP_HOST = "sdnc.dmaap.host"; + public static final String DMAAP_AUTH = "sdnc.dmaap.auth"; + public static final String DMAAP_PARTITION = "sdnc.dmaap.partition"; + public static final String DMAAP_TIMEOUT = "sdnc.dmaap.timeout"; + public static final String DMAAP_ENVIRONMENT = "sdnc.dmaap.environment"; + public static final String LCM_DMAAP_READ_TOPIC = "sdnc.lcm.dmapp.readTopic"; + public static final String LCM_DMAAP_WRITE_TOPIC = "sdnc.lcm.dmaap.writeTopic"; + + public static final String MSO_KEY = "mso.msoKey"; + + public SDNCLcmPropertiesImpl() {} + + @Override + public String getHost() { + return UrnPropertiesReader.getVariable(SDNC_HOST); + } + + @Override + public String getPath() { + String path = UrnPropertiesReader.getVariable(LCM_PATH); + return (path != null) ? path : SDNCConstants.LCM_API_BASE_PATH; + } + + @Override + public String getBasicAuth() { + return UrnPropertiesReader.getVariable(SDNC_AUTH); + } + + @Override + public String getDmaapHost() { + return UrnPropertiesReader.getVariable(DMAAP_HOST); + } + + @Override + public String getDmaapAuth() { + return UrnPropertiesReader.getVariable(DMAAP_AUTH); + } + + @Override + public String getDmaapPartition() { + String partition = UrnPropertiesReader.getVariable(DMAAP_PARTITION); + return (partition != null) ? partition : SDNCConstants.LCM_DMAAP_PARTITION; + } + + @Override + public String getDmaapTimeout() { + String timeout = UrnPropertiesReader.getVariable(DMAAP_TIMEOUT); + return (timeout != null) ? timeout : SDNCConstants.LCM_DMAAP_TIMEOUT; + } + + @Override + public String getDmaapEnvironment() { + String environment = UrnPropertiesReader.getVariable(DMAAP_ENVIRONMENT); + return (environment != null) ? environment : SDNCConstants.LCM_DMAAP_ENVIRONMENT; + } + + @Override + public String getDmaaPLcmReadTopic() { + String readTopic = UrnPropertiesReader.getVariable(LCM_DMAAP_READ_TOPIC); + return (readTopic != null) ? readTopic : SDNCConstants.LCM_DMAAP_READ_TOPIC; + } + + @Override + public String getDmaaPLcmWriteTopic() { + String writeTopic = UrnPropertiesReader.getVariable(LCM_DMAAP_WRITE_TOPIC); + return (writeTopic != null) ? writeTopic : SDNCConstants.LCM_DMAAP_WRITE_TOPIC; + } + + @Override + public String getKey() { + return UrnPropertiesReader.getVariable(MSO_KEY); + } + + @Override + public URL getEndpoint() throws MalformedURLException { + return new URL(getHost()); + } + + @Override + public String getSystemName() { + return SDNCConstants.SYSTEM_NAME; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java new file mode 100644 index 0000000000..fd9412e70e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.common; + +public interface SDNCConstants { + String SYSTEM_NAME = "MSO"; + + String LCM_API_VER = "2.00"; + + String LCM_FLAGS_MODE_NORMAL = "NORMAL"; + String LCM_FLAGS_MODE_EXCLUSIVE = "EXCLUSIVE"; + + String LCM_FLAGS_FORCE_TRUE = "TRUE"; + String LCM_FLAGS_FORCE_FALSE = "FALSE"; + + int LCM_FLAGS_TTL = 65000; + + String LCM_API_BASE_PATH = "/restconf/operations/LCM:"; + + String LCM_DMAAP_MSG_VER = "1.0"; + String LCM_DMAAP_MSG_TYPE_REQUEST = "request"; + String LCM_DMAAP_MSG_TYPE_RESPONSE = "response"; + + String LCM_DMAAP_PARTITION = "MSOLCM"; + String LCM_DMAAP_TIMEOUT = "20000"; + String LCM_DMAAP_ENVIRONMENT = "TEST"; + String LCM_DMAAP_READ_TOPIC = "SDNC-LCM-WRITE"; + String LCM_DMAAP_WRITE_TOPIC = "SDNC-LCM-READ"; + + int LCM_TIMEOUT = 300; +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java new file mode 100644 index 0000000000..5616db3577 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +import java.net.URI; +import org.onap.so.client.RestPropertiesLoader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SDNCLcmClientBuilder { + + private static Logger logger = LoggerFactory.getLogger(SDNCLcmClientBuilder.class); + + private final SDNCLcmProperties sdncLcmProperties; + + public SDNCLcmClientBuilder() { + sdncLcmProperties = RestPropertiesLoader.getInstance().getNewImpl(SDNCLcmProperties.class); + } + + public SDNCLcmClientBuilder(SDNCLcmProperties pros) { + sdncLcmProperties = pros; + } + + public SDNCLcmRestClient newSDNCLcmRestClient(String operation) throws SDNCLcmClientBuilderException { + URI pathUri; + try { + String path = sdncLcmProperties.getPath() + operation; + pathUri = new URI(path); + logger.debug("SDNC host: " + sdncLcmProperties.getHost()); + logger.debug("SDNC API path: " + pathUri.getPath()); + } catch (Exception e) { + String msg = "Error API path syntax: "; + logger.error(msg, e); + throw new SDNCLcmClientBuilderException(msg + e.toString()); + } + + try { + SDNCLcmRestClient sdncLcmRestClient = new SDNCLcmRestClient(sdncLcmProperties, pathUri); + logger.debug("Create SDNCLcmRestClient success"); + return sdncLcmRestClient; + } catch (Exception e) { + String msg = "Create SDNCLcmRestClient failure: "; + logger.error(msg, e); + throw new SDNCLcmClientBuilderException(msg + e.toString()); + } + } + + public SDNCLcmDmaapClient newSDNCLcmDmaapClient() throws SDNCLcmClientBuilderException { + try { + SDNCLcmDmaapClient sdncLcmDmaapClient = new SDNCLcmDmaapClient(sdncLcmProperties); + logger.debug("Create SDNCLcmDmaapClient success"); + return sdncLcmDmaapClient; + } catch (Exception e) { + String msg = "Create SDNCLcmDmaapClient failure: "; + logger.error(msg, e); + throw new SDNCLcmClientBuilderException(msg + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilderException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilderException.java new file mode 100644 index 0000000000..9160d4e352 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilderException.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +public class SDNCLcmClientBuilderException extends Exception { + + private static final long serialVersionUID = -1525705272349747712L; + + public SDNCLcmClientBuilderException(String message) { + super(message); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClient.java new file mode 100644 index 0000000000..f6e4ffce59 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClient.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.onap.so.client.sdnc.lcm.beans.LcmDmaapRequest; +import org.onap.so.client.sdnc.lcm.beans.LcmDmaapResponse; +import org.onap.so.client.dmaap.rest.RestPublisher; +import org.onap.so.client.dmaap.rest.RestConsumer; + +public class SDNCLcmDmaapClient { + + private static Logger logger = LoggerFactory.getLogger(SDNCLcmDmaapClient.class); + + private RestPublisher dmaapPublisher; + private RestConsumer dmaapConsumer; + + public SDNCLcmDmaapClient(SDNCLcmProperties sdncLcmProperties) { + Properties properties = new Properties(); + + properties.put("host", sdncLcmProperties.getDmaapHost()); + if (sdncLcmProperties.getDmaapAuth() != null && sdncLcmProperties.getKey() != null) { + properties.put("auth", sdncLcmProperties.getDmaapAuth()); + properties.put("key", sdncLcmProperties.getKey()); + } + properties.put("partition", sdncLcmProperties.getDmaapPartition()); + properties.put("timeout", sdncLcmProperties.getDmaapTimeout()); + properties.put("environment", sdncLcmProperties.getDmaapEnvironment()); + + properties.put("topic", sdncLcmProperties.getDmaaPLcmWriteTopic()); + dmaapPublisher = new RestPublisher(properties); + + properties.put("topic", sdncLcmProperties.getDmaaPLcmReadTopic()); + dmaapConsumer = new RestConsumer(properties); + } + + public void sendRequest(LcmDmaapRequest lcmDmaapRequest) throws Exception { + ObjectMapper mapper = new ObjectMapper(); + String lcmRestRequestString = mapper.writeValueAsString(lcmDmaapRequest); + + dmaapPublisher.send(lcmRestRequestString); + } + + public Iterable<String> fetch() { + return dmaapConsumer.fetch(); + } + + public List<LcmDmaapResponse> getResponse() { + List<LcmDmaapResponse> responseList = new ArrayList<>(); + + ObjectMapper mapper = new ObjectMapper(); + Iterable<String> itrString = dmaapConsumer.fetch(); + for (String message : itrString) { + LcmDmaapResponse lcmDmaapResponse; + try { + lcmDmaapResponse = mapper.readValue(message, LcmDmaapResponse.class); + } catch (Exception e) { + logger.warn("Invalid SDNC LCM DMaaP response: " + message); + continue; + } + + responseList.add(lcmDmaapResponse); + } + + return responseList; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java new file mode 100644 index 0000000000..bf1229a310 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +import java.time.Instant; +import org.onap.so.client.sdnc.common.SDNCConstants; +import org.onap.so.client.sdnc.lcm.beans.*; + +public class SDNCLcmMessageBuilder { + + public static LcmFlags getSDNCFlags() { + LcmFlags lcmFlags = new LcmFlags(); + + lcmFlags.setMode(SDNCConstants.LCM_FLAGS_MODE_NORMAL); + lcmFlags.setForce(SDNCConstants.LCM_FLAGS_FORCE_FALSE); + lcmFlags.setTtl(SDNCConstants.LCM_FLAGS_TTL); + + return lcmFlags; + } + + public static LcmCommonHeader buildLcmCommonHeader(String requestId, String subRequestId) { + LcmCommonHeader lcmCommonHeader = new LcmCommonHeader(); + + lcmCommonHeader.setApiVer(SDNCConstants.LCM_API_VER); + lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME); + lcmCommonHeader.setRequestId(requestId); + lcmCommonHeader.setSubRequestId(subRequestId); + lcmCommonHeader.setFlags(getSDNCFlags()); + lcmCommonHeader.setTimestamp(Instant.now().toString()); + + return lcmCommonHeader; + } + + public static LcmInput buildLcmInputForPnf(String requestId, String subRequestId, String pnfName, String action, + String payload) { + LcmInput lcmInput = new LcmInput(); + + LcmCommonHeader lcmCommonHeader = buildLcmCommonHeader(requestId, subRequestId); + + LcmActionIdentifiers sdncActionIdentifiers = new LcmActionIdentifiers(); + sdncActionIdentifiers.setPnfName(pnfName); + + lcmInput.setCommonHeader(lcmCommonHeader); + lcmInput.setAction(action); + lcmInput.setActionIdentifiers(sdncActionIdentifiers); + lcmInput.setPayload(payload); + + return lcmInput; + } + + public static LcmDmaapRequest buildLcmDmaapRequest(String operation, LcmInput lcmInput) { + LcmDmaapRequest lcmDmaapRequest = new LcmDmaapRequest(); + + LcmRestRequest lcmRestRequest = new LcmRestRequest(); + lcmRestRequest.setInput(lcmInput); + + String correlationId = + lcmInput.getCommonHeader().getRequestId() + "-" + lcmInput.getCommonHeader().getSubRequestId(); + + lcmDmaapRequest.setVersion(SDNCConstants.LCM_DMAAP_MSG_VER); + lcmDmaapRequest.setType(SDNCConstants.LCM_DMAAP_MSG_TYPE_REQUEST); + lcmDmaapRequest.setCambriaPartition(SDNCConstants.SYSTEM_NAME); + lcmDmaapRequest.setCorrelationId(correlationId); + lcmDmaapRequest.setRpcName(operation); + lcmDmaapRequest.setBody(lcmRestRequest); + + return lcmDmaapRequest; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java new file mode 100644 index 0000000000..df5fb3be0b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +import org.onap.so.client.RestProperties; + +public interface SDNCLcmProperties extends RestProperties { + String getHost(); + + String getPath(); + + String getBasicAuth(); + + String getDmaapHost(); + + String getDmaapAuth(); + + String getDmaapPartition(); + + String getDmaapTimeout(); + + String getDmaapEnvironment(); + + String getDmaaPLcmReadTopic(); + + String getDmaaPLcmWriteTopic(); + + String getKey(); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClient.java new file mode 100644 index 0000000000..3faf58ec28 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClient.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +import java.net.URI; +import java.util.Map; +import java.util.Optional; +import org.onap.so.client.RestClient; +import org.onap.logging.filter.base.ONAPComponents; +import org.onap.so.client.sdnc.lcm.beans.LcmInput; +import org.onap.so.client.sdnc.lcm.beans.LcmOutput; +import org.onap.so.client.sdnc.lcm.beans.LcmRestRequest; +import org.onap.so.client.sdnc.lcm.beans.LcmRestResponse; + +public class SDNCLcmRestClient extends RestClient { + + private final SDNCLcmProperties sdncLcmProperties; + + public SDNCLcmRestClient(SDNCLcmProperties props, URI path) { + this(props, path, "application/json", "application/json"); + } + + public SDNCLcmRestClient(SDNCLcmProperties props, URI path, String accept, String contentType) { + super(props, Optional.of(path), accept, contentType); + this.sdncLcmProperties = props; + } + + @Override + protected void initializeHeaderMap(Map<String, String> headerMap) { + headerMap.put("Authorization", sdncLcmProperties.getBasicAuth()); + } + + @Override + public ONAPComponents getTargetEntity() { + return ONAPComponents.SDNC; + } + + public LcmRestResponse sendRequest(LcmRestRequest lcmRestRequest) { + return post(lcmRestRequest, LcmRestResponse.class); + } + + public LcmOutput sendRequest(LcmInput lcmInput) { + LcmRestRequest lcmRestRequest = new LcmRestRequest(); + lcmRestRequest.setInput(lcmInput); + + LcmRestResponse lcmRestResponse = sendRequest(lcmRestRequest); + return lcmRestResponse.getOutput(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmActionIdentifiers.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmActionIdentifiers.java new file mode 100644 index 0000000000..883fd02c78 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmActionIdentifiers.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"serviceInstanceId", "vnfId", "vfModuleId", "vnfcName", "vserverId", "pnfName"}) +public class LcmActionIdentifiers { + + @JsonProperty("service-instance-id") + private String serviceInstanceId; + + @JsonProperty("vnf-id") + private String vnfId; + + @JsonProperty("vf-module-id") + private String vfModuleId; + + @JsonProperty("vnfc-name") + private String vnfcName; + + @JsonProperty("vserver-id") + private String vserverId; + + @JsonProperty("pnf-name") + private String pnfName; + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String value) { + this.serviceInstanceId = value; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String value) { + this.vnfId = value; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String value) { + this.vfModuleId = value; + } + + public String getVnfcName() { + return vnfcName; + } + + public void setVnfcName(String value) { + this.vnfcName = value; + } + + public String getVserverId() { + return vserverId; + } + + public void setVserverId(String value) { + this.vserverId = value; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String value) { + this.pnfName = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmCommonHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmCommonHeader.java new file mode 100644 index 0000000000..f3fd2ca11d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmCommonHeader.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"apiVer", "flags", "originatorId", "requestId", "subRequestId", "timestamp"}) +public class LcmCommonHeader { + + @JsonProperty(value = "api-ver", required = true) + private String apiVer; + + @JsonProperty(value = "flags") + private LcmFlags flags; + + @JsonProperty(value = "originator-id", required = true) + private String originatorId; + + @JsonProperty(value = "request-id", required = true) + private String requestId; + + @JsonProperty(value = "sub-request-id") + private String subRequestId; + + @JsonProperty(value = "timestamp", required = true) + private String timestamp; + + public String getApiVer() { + return apiVer; + } + + public void setApiVer(String value) { + this.apiVer = value; + } + + public String getOriginatorId() { + return originatorId; + } + + public void setOriginatorId(String value) { + this.originatorId = value; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String value) { + this.requestId = value; + } + + public String getSubRequestId() { + return subRequestId; + } + + public void setSubRequestId(String value) { + this.subRequestId = value; + } + + public LcmFlags getFlags() { + return flags; + } + + public void setFlags(LcmFlags value) { + this.flags = value; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String value) { + this.timestamp = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequest.java new file mode 100644 index 0000000000..db62e8b20b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequest.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"version", "type", "cambriaPartition", "correlationId", "rpcName", "body"}) +public class LcmDmaapRequest { + + @JsonProperty(value = "version", required = true) + private String version; + + @JsonProperty(value = "type", required = true) + private String type; + + @JsonProperty(value = "cambria.partition", required = true) + private String cambriaPartition; + + @JsonProperty(value = "correlation-id", required = true) + private String correlationId; + + @JsonProperty(value = "rpc-name", required = true) + private String rpcName; + + @JsonProperty(value = "body") + private LcmRestRequest body; + + public String getVersion() { + return version; + } + + public void setVersion(String value) { + this.version = value; + } + + public String getType() { + return type; + } + + public void setType(String value) { + this.type = value; + } + + public String getCambriaPartition() { + return cambriaPartition; + } + + public void setCambriaPartition(String value) { + this.cambriaPartition = value; + } + + public String getCorrelationId() { + return correlationId; + } + + public void setCorrelationId(String value) { + this.correlationId = value; + } + + public String getRpcName() { + return rpcName; + } + + public void setRpcName(String value) { + this.rpcName = value; + } + + public LcmRestRequest getBody() { + return body; + } + + public void setBody(LcmRestRequest value) { + this.body = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponse.java new file mode 100644 index 0000000000..35f4a26b17 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponse.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"version", "type", "cambriaPartition", "correlationId", "rpcName", "body"}) +public class LcmDmaapResponse { + + @JsonProperty(value = "version", required = true) + private String version; + + @JsonProperty(value = "type", required = true) + private String type; + + @JsonProperty(value = "cambria.partition", required = true) + private String cambriaPartition; + + @JsonProperty(value = "correlation-id", required = true) + private String correlationId; + + @JsonProperty(value = "rpc-name", required = true) + private String rpcName; + + @JsonProperty(value = "body") + private LcmRestResponse body; + + public String getVersion() { + return version; + } + + public void setVersion(String value) { + this.version = value; + } + + public String getType() { + return type; + } + + public void setType(String value) { + this.type = value; + } + + public String getCambriaPartition() { + return cambriaPartition; + } + + public void setCambriaPartition(String value) { + this.cambriaPartition = value; + } + + public String getCorrelationId() { + return correlationId; + } + + public void setCorrelationId(String value) { + this.correlationId = value; + } + + public String getRpcName() { + return rpcName; + } + + public void setRpcName(String value) { + this.rpcName = value; + } + + public LcmRestResponse getBody() { + return body; + } + + public void setBody(LcmRestResponse value) { + this.body = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java new file mode 100644 index 0000000000..36527ec887 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"mode", "force", "ttl"}) +public class LcmFlags { + + @JsonProperty("mode") + private String mode; + + @JsonProperty("force") + private String force; + + @JsonProperty("ttl") + private int ttl; + + public String getMode() { + return mode; + } + + public void setMode(String value) { + this.mode = value; + } + + public String getForce() { + return force; + } + + public void setForce(String value) { + this.force = value; + } + + public Integer getTtl() { + return ttl; + } + + public void setTtl(Integer value) { + this.ttl = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmInput.java new file mode 100644 index 0000000000..6634430bed --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmInput.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"commonHeader", "action", "actionIdentifiers", "payload"}) +public class LcmInput { + + @JsonProperty(value = "common-header", required = true) + private LcmCommonHeader commonHeader; + + @JsonProperty(value = "action", required = true) + private String action; + + @JsonProperty(value = "action-identifiers", required = true) + private LcmActionIdentifiers actionIdentifiers; + + @JsonProperty(value = "payload") + private String payload; + + public LcmCommonHeader getCommonHeader() { + return commonHeader; + } + + public void setCommonHeader(LcmCommonHeader value) { + this.commonHeader = value; + } + + public String getAction() { + return action; + } + + public void setAction(String value) { + this.action = value; + } + + public LcmActionIdentifiers getActionIdentifiers() { + return actionIdentifiers; + } + + public void setActionIdentifiers(LcmActionIdentifiers value) { + this.actionIdentifiers = value; + } + + public String getPayload() { + return payload; + } + + public void setPayload(String value) { + this.payload = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmOutput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmOutput.java new file mode 100644 index 0000000000..3741786671 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmOutput.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"commonHeader", "status", "payload"}) +public class LcmOutput { + + @JsonProperty(value = "common-header", required = true) + private LcmCommonHeader commonHeader; + + @JsonProperty(value = "status", required = true) + private LcmStatus status; + + @JsonProperty(value = "payload") + private String payload; + + public LcmCommonHeader getCommonHeader() { + return commonHeader; + } + + public void setCommonHeader(LcmCommonHeader value) { + this.commonHeader = value; + } + + public LcmStatus getStatus() { + return status; + } + + public void setStatus(LcmStatus value) { + this.status = value; + } + + public String getPayload() { + return payload; + } + + public void setPayload(String value) { + this.payload = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequest.java new file mode 100644 index 0000000000..146eb8a4f6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequest.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"input"}) +public class LcmRestRequest { + + @JsonProperty(value = "input", required = true) + private LcmInput input; + + public LcmInput getInput() { + return input; + } + + public void setInput(LcmInput value) { + this.input = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponse.java new file mode 100644 index 0000000000..6920f95ce2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponse.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"output"}) +public class LcmRestResponse { + + @JsonProperty(value = "output", required = true) + private LcmOutput output; + + public LcmOutput getOutput() { + return output; + } + + public void setOutput(LcmOutput value) { + this.output = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java new file mode 100644 index 0000000000..8a2a142792 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"code", "message"}) +public class LcmStatus { + + @JsonProperty(value = "code", required = true) + private int code; + + @JsonProperty(value = "message", required = true) + private String message; + + public int getCode() { + return code; + } + + public void setCode(int value) { + this.code = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String value) { + this.message = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties index 27da189456..147bc2ee95 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties @@ -1,3 +1,4 @@ org.onap.so.client.restproperties.AAIPropertiesImpl org.onap.so.client.restproperties.CDSPropertiesImpl -org.onap.so.client.restproperties.PolicyRestPropertiesImpl
\ No newline at end of file +org.onap.so.client.restproperties.PolicyRestPropertiesImpl +org.onap.so.client.restproperties.SDNCLcmPropertiesImpl diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java new file mode 100644 index 0000000000..5483792a84 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java @@ -0,0 +1,139 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +import java.util.List; +import org.apache.http.HttpStatus; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.fail; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import org.onap.so.BaseTest; +import org.onap.so.client.restproperties.SDNCLcmPropertiesImpl; +import org.onap.so.client.sdnc.lcm.beans.*; + +public class SDNCLcmDmaapClientTest extends BaseTest { + + protected SDNCLcmMessageBuilderTest sdncLcmMessageBuilderTest = new SDNCLcmMessageBuilderTest(); + + protected static final String DMAAP_HOST_PROP = SDNCLcmPropertiesImpl.DMAAP_HOST; + protected static final String DMAAP_WRITE_TOPIC_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_WRITE_TOPIC; + protected static final String DMAAP_READ_TOPIC_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_READ_TOPIC; + protected static final String DMAAP_PARTITION_PROP = SDNCLcmPropertiesImpl.DMAAP_PARTITION; + + protected String testWriteTopic = "TEST-WRITE-TOPIC"; + protected String testReadTopic = "TEST-READ-TOPIC"; + protected String testPartition = "TESTMSO"; + protected final String defaultConsumerName = "consumer1"; + + private void clearSystemProperty() { + System.clearProperty(DMAAP_HOST_PROP); + System.clearProperty(DMAAP_WRITE_TOPIC_PROP); + System.clearProperty(DMAAP_READ_TOPIC_PROP); + System.clearProperty(DMAAP_PARTITION_PROP); + } + + public SDNCLcmDmaapClient buildSDNCLcmDmaapClient() { + String testHost = "http://localhost:" + wireMockPort; + + System.setProperty(DMAAP_HOST_PROP, testHost); + System.setProperty(DMAAP_WRITE_TOPIC_PROP, testWriteTopic); + System.setProperty(DMAAP_READ_TOPIC_PROP, testReadTopic); + System.setProperty(DMAAP_PARTITION_PROP, testPartition); + + SDNCLcmProperties sdncLcmProperties = new SDNCLcmPropertiesImpl(); + SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(sdncLcmProperties); + + try { + return sdncLcmClientBuilder.newSDNCLcmDmaapClient(); + } catch (Exception e) { + clearSystemProperty(); + fail("Create SDNCLcmDmaapClient error: " + e.toString()); + return null; + } + } + + @Test + public final void testSDNCLcmDmaapClientSendRequest() { + SDNCLcmDmaapClient sdncLcmDmaapClient = buildSDNCLcmDmaapClient(); + + assertNotEquals(null, sdncLcmDmaapClient); + + String testDmaapWritePath = "/events/" + testWriteTopic; + String expectedWriteResponse = "{\"serverTimeMs\":2,\"count\":1}"; + wireMockServer.stubFor(post(urlPathEqualTo(testDmaapWritePath)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedWriteResponse) + .withStatus(HttpStatus.SC_OK))); + + LcmInput lcmInput = sdncLcmMessageBuilderTest.buildLcmInputForPnf(); + LcmDmaapRequest lcmDmaapRequest = + SDNCLcmMessageBuilder.buildLcmDmaapRequest(sdncLcmMessageBuilderTest.getOperation(), lcmInput); + + try { + sdncLcmDmaapClient.sendRequest(lcmDmaapRequest); + } catch (Exception e) { + clearSystemProperty(); + fail("SDNCLcmDmaapClient sends request error: " + e.toString()); + return; + } + + String testDmaapReadPath = "/events/" + testReadTopic + "/" + testPartition + "/" + defaultConsumerName; + + String expectedLcmDmaapResponse = LcmDmaapResponseTest.getExpectedLcmDmaapResponse(); + String expectedResponseListItem; + try { + expectedResponseListItem = sdncLcmMessageBuilderTest.convertToSting(expectedLcmDmaapResponse); + } catch (JsonProcessingException e) { + clearSystemProperty(); + fail("Convert LcmDmaapResponse String to List item error: " + e.toString()); + return; + } + String expectedReadResponse = "[" + expectedResponseListItem + "]"; + wireMockServer.stubFor(get(urlPathEqualTo(testDmaapReadPath)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedReadResponse) + .withStatus(HttpStatus.SC_OK))); + + List<LcmDmaapResponse> LcmDmaapResponseList = sdncLcmDmaapClient.getResponse(); + + clearSystemProperty(); + + if (LcmDmaapResponseList.size() < 1) { + clearSystemProperty(); + fail("Can not get LcmDmaapResponse list"); + return; + } + + LcmOutput lcmOutput = LcmDmaapResponseList.get(0).getBody().getOutput(); + + String expectedLcmOutput = LcmOutputTest.getExpectedLcmOutput(); + try { + String lcmOutputString = sdncLcmMessageBuilderTest.convertToSting(lcmOutput); + assertEquals(expectedLcmOutput, lcmOutputString); + } catch (Exception e) { + fail("Convert LcmOutput to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java new file mode 100644 index 0000000000..d930c6728c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import org.onap.so.client.sdnc.lcm.beans.LcmBeanTest; +import org.onap.so.client.sdnc.lcm.beans.LcmInput; +import org.onap.so.client.sdnc.lcm.beans.LcmInputTest; + +public class SDNCLcmMessageBuilderTest extends LcmBeanTest { + + public LcmInput buildLcmInputForPnf() { + LcmInput lcmInput = + SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, action, inputPayload); + + lcmInput.getCommonHeader().setTimestamp(timestamp); + + return lcmInput; + } + + @Test + public final void testBuildLcmRestRequestForPnf() { + LcmInput lcmInput = buildLcmInputForPnf(); + + String expectedLcmInput = LcmInputTest.getExpectedLcmInput(); + try { + String lcmInputString = convertToSting(lcmInput); + assertEquals(expectedLcmInput, lcmInputString); + } catch (Exception e) { + fail("Convert LcmInput to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java new file mode 100644 index 0000000000..04cfc6e3c8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm; + +import org.apache.http.HttpStatus; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.fail; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import org.onap.logging.filter.base.ONAPComponents; +import org.onap.so.BaseTest; +import org.onap.so.client.restproperties.SDNCLcmPropertiesImpl; +import org.onap.so.client.sdnc.common.SDNCConstants; +import org.onap.so.client.sdnc.lcm.beans.*; + +public class SDNCLcmRestClientTest extends BaseTest { + + protected SDNCLcmMessageBuilderTest sdncLcmMessageBuilderTest = new SDNCLcmMessageBuilderTest(); + + protected static final String SDNC_HOST_PROP = SDNCLcmPropertiesImpl.SDNC_HOST; + protected static final String SDNC_PATH_PROP = SDNCLcmPropertiesImpl.LCM_PATH; + + private void clearSystemProperty() { + System.clearProperty(SDNC_HOST_PROP); + System.clearProperty(SDNC_PATH_PROP); + } + + public SDNCLcmRestClient buildSDNCLcmRestClient() { + String testHost = "http://localhost:" + wireMockPort; + + System.setProperty(SDNC_HOST_PROP, testHost); + System.setProperty(SDNC_PATH_PROP, SDNCConstants.LCM_API_BASE_PATH); + + SDNCLcmProperties sdncLcmProperties = new SDNCLcmPropertiesImpl(); + SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(sdncLcmProperties); + + try { + return sdncLcmClientBuilder.newSDNCLcmRestClient(sdncLcmMessageBuilderTest.getOperation()); + } catch (Exception e) { + clearSystemProperty(); + fail("Create SDNCLcmRestClient error: " + e.toString()); + return null; + } + } + + @Test + public final void testSDNCLcmRestClientSendRequest() { + SDNCLcmRestClient sdncLcmRestClient = buildSDNCLcmRestClient(); + + assertNotEquals(null, sdncLcmRestClient); + assertEquals(ONAPComponents.SDNC, sdncLcmRestClient.getTargetEntity()); + + String testLcmApiPath = SDNCConstants.LCM_API_BASE_PATH + sdncLcmMessageBuilderTest.getOperation(); + String expectedLcmRestResponse = LcmRestResponseTest.getExpectedLcmRestResponse(); + wireMockServer.stubFor(post(urlPathEqualTo(testLcmApiPath)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedLcmRestResponse) + .withStatus(HttpStatus.SC_OK))); + + LcmInput lcmInput = sdncLcmMessageBuilderTest.buildLcmInputForPnf(); + LcmOutput lcmOutput = sdncLcmRestClient.sendRequest(lcmInput); + + clearSystemProperty(); + + String expectedLcmOutput = LcmOutputTest.getExpectedLcmOutput(); + try { + String lcmOutputString = sdncLcmMessageBuilderTest.convertToSting(lcmOutput); + assertEquals(expectedLcmOutput, lcmOutputString); + } catch (Exception e) { + fail("Convert LcmOutput to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java new file mode 100644 index 0000000000..5562444a46 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.onap.so.client.sdnc.common.SDNCConstants; + +public class LcmBeanTest { + private static Logger logger = LoggerFactory.getLogger(LcmBeanTest.class); + + protected String requestId = "9f77f437-1515-44bd-a420-0aaf8a3c31a0"; + protected String subRequestId = "c197a4b5-18d9-48a2-ad2d-a3b56858501c"; + protected String timestamp = "2020-02-25T10:20:28.116Z"; + + protected String pnfName = "testpnf"; + protected String action = "TestAction"; + protected String operation = "test-operation"; + + protected String inputPayload = "{\"testPayload\": \"input test\"}"; + protected String outputPayload = "{\"testPayload\": \"output test\"}"; + + public String getOperation() { + return operation; + } + + public LcmFlags buildSDNCFlags() { + LcmFlags lcmFlags = new LcmFlags(); + + lcmFlags.setMode(SDNCConstants.LCM_FLAGS_MODE_NORMAL); + lcmFlags.setForce(SDNCConstants.LCM_FLAGS_FORCE_FALSE); + lcmFlags.setTtl(SDNCConstants.LCM_FLAGS_TTL); + + return lcmFlags; + } + + public LcmCommonHeader buildLcmCommonHeader() { + LcmCommonHeader lcmCommonHeader = new LcmCommonHeader(); + + lcmCommonHeader.setApiVer(SDNCConstants.LCM_API_VER); + lcmCommonHeader.setFlags(buildSDNCFlags()); + lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME); + lcmCommonHeader.setRequestId(requestId); + lcmCommonHeader.setSubRequestId(subRequestId); + lcmCommonHeader.setTimestamp(timestamp); + + return lcmCommonHeader; + } + + public String convertToSting(Object msgObject) throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + + String msgString = mapper.writeValueAsString(msgObject); + logger.debug(msgObject.getClass().getSimpleName() + "\n" + msgString); + + return msgString; + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java new file mode 100644 index 0000000000..709a557937 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import org.junit.Test; +import org.onap.so.client.sdnc.common.SDNCConstants; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class LcmDmaapRequestTest extends LcmBeanTest { + private static String expectedLcmDmaapRequest = "{" + "\"version\":\"1.0\"," + "\"type\":\"request\"," + + "\"cambria.partition\":\"MSO\"," + + "\"correlation-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0-c197a4b5-18d9-48a2-ad2d-a3b56858501c\"," + + "\"rpc-name\":\"test-operation\"," + "\"body\":" + LcmRestRequestTest.getExpectedLcmRestRequest() + "}"; + + public LcmDmaapRequest buildLcmDmaapRequest() { + LcmDmaapRequest lcmDmaapRequest = new LcmDmaapRequest(); + + LcmRestRequestTest lcmRestRequestTest = new LcmRestRequestTest(); + LcmRestRequest lcmRestRequest = lcmRestRequestTest.buildLcmRestRequest(); + LcmCommonHeader lcmCommonHeader = lcmRestRequest.getInput().getCommonHeader(); + String correlationId = lcmCommonHeader.getRequestId() + "-" + lcmCommonHeader.getSubRequestId(); + + lcmDmaapRequest.setVersion(SDNCConstants.LCM_DMAAP_MSG_VER); + lcmDmaapRequest.setType(SDNCConstants.LCM_DMAAP_MSG_TYPE_REQUEST); + lcmDmaapRequest.setCambriaPartition(SDNCConstants.SYSTEM_NAME); + lcmDmaapRequest.setCorrelationId(correlationId); + lcmDmaapRequest.setRpcName(operation); + lcmDmaapRequest.setBody(lcmRestRequest); + + return lcmDmaapRequest; + } + + public static String getExpectedLcmDmaapRequest() { + return expectedLcmDmaapRequest; + } + + @Test + public final void testLcmDmaapRequest() { + LcmDmaapRequest lcmDmaapRequest = buildLcmDmaapRequest(); + + try { + String lcmDmaapRequestString = convertToSting(lcmDmaapRequest); + assertEquals(expectedLcmDmaapRequest, lcmDmaapRequestString); + } catch (Exception e) { + fail("Convert LcmDmaapRequest to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java new file mode 100644 index 0000000000..0cdbeebb27 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import org.junit.Test; +import org.onap.so.client.sdnc.common.SDNCConstants; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class LcmDmaapResponseTest extends LcmBeanTest { + private static String expectedLcmDmaapResponse = "{" + "\"version\":\"1.0\"," + "\"type\":\"response\"," + + "\"cambria.partition\":\"MSO\"," + + "\"correlation-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0-c197a4b5-18d9-48a2-ad2d-a3b56858501c\"," + + "\"rpc-name\":\"test-operation\"," + "\"body\":" + LcmRestResponseTest.getExpectedLcmRestResponse() + "}"; + + public LcmDmaapResponse buildLcmDmaapResponse() { + LcmDmaapResponse lcmDmaapResponse = new LcmDmaapResponse(); + + LcmRestResponseTest lcmRestResponseTest = new LcmRestResponseTest(); + LcmRestResponse lcmRestResponse = lcmRestResponseTest.buildLcmRestResponse(); + LcmCommonHeader lcmCommonHeader = lcmRestResponse.getOutput().getCommonHeader(); + String correlationId = lcmCommonHeader.getRequestId() + "-" + lcmCommonHeader.getSubRequestId(); + + lcmDmaapResponse.setVersion(SDNCConstants.LCM_DMAAP_MSG_VER); + lcmDmaapResponse.setType(SDNCConstants.LCM_DMAAP_MSG_TYPE_RESPONSE); + lcmDmaapResponse.setCambriaPartition(SDNCConstants.SYSTEM_NAME); + lcmDmaapResponse.setCorrelationId(correlationId); + lcmDmaapResponse.setRpcName(operation); + lcmDmaapResponse.setBody(lcmRestResponse); + + return lcmDmaapResponse; + } + + public static String getExpectedLcmDmaapResponse() { + return expectedLcmDmaapResponse; + } + + @Test + public final void testLcmDmaapResponse() { + LcmDmaapResponse lcmDmaapResponse = buildLcmDmaapResponse(); + + try { + String lcmDmaapResponseString = convertToSting(lcmDmaapResponse); + assertEquals(expectedLcmDmaapResponse, lcmDmaapResponseString); + } catch (Exception e) { + fail("Convert LcmDmaapResponse to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java new file mode 100644 index 0000000000..b8c34fcbc7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class LcmInputTest extends LcmBeanTest { + private static String expectedLcmInput = "{" + "\"common-header\":{" + "\"api-ver\":\"2.00\"," + + "\"flags\":{\"mode\":\"NORMAL\",\"force\":\"FALSE\",\"ttl\":65000}," + "\"originator-id\":\"MSO\"," + + "\"request-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0\"," + + "\"sub-request-id\":\"c197a4b5-18d9-48a2-ad2d-a3b56858501c\"," + + "\"timestamp\":\"2020-02-25T10:20:28.116Z\"" + "}," + "\"action\":\"TestAction\"," + + "\"action-identifiers\":{\"pnf-name\":\"testpnf\"}," + + "\"payload\":\"{\\\"testPayload\\\": \\\"input test\\\"}\"}"; + + public LcmInput buildLcmInput() { + LcmInput lcmInput = new LcmInput(); + + LcmCommonHeader lcmCommonHeader = buildLcmCommonHeader(); + + LcmActionIdentifiers lcmActionIdentifiers = new LcmActionIdentifiers(); + lcmActionIdentifiers.setPnfName(pnfName); + + lcmInput.setCommonHeader(lcmCommonHeader); + lcmInput.setAction(action); + lcmInput.setActionIdentifiers(lcmActionIdentifiers); + lcmInput.setPayload(inputPayload); + + return lcmInput; + } + + public static String getExpectedLcmInput() { + return expectedLcmInput; + } + + @Test + public final void testLcmInput() { + LcmInput lcmInput = buildLcmInput(); + + try { + String lcmInputString = convertToSting(lcmInput); + assertEquals(expectedLcmInput, lcmInputString); + } catch (Exception e) { + fail("Convert LcmInput to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java new file mode 100644 index 0000000000..1530be38a7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import org.onap.so.client.sdnc.common.SDNCConstants; + +public class LcmOutputTest extends LcmBeanTest { + private static String expectedLcmOutput = "{" + "\"common-header\":{" + "\"api-ver\":\"2.00\"," + + "\"originator-id\":\"MSO\"," + "\"request-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0\"," + + "\"sub-request-id\":\"c197a4b5-18d9-48a2-ad2d-a3b56858501c\"" + "}," + + "\"status\":{\"code\":400,\"message\":\"Test output message\"}," + + "\"payload\":\"{\\\"testPayload\\\": \\\"output test\\\"}\"}"; + + @Override + public LcmCommonHeader buildLcmCommonHeader() { + LcmCommonHeader lcmCommonHeader = new LcmCommonHeader(); + + lcmCommonHeader.setApiVer(SDNCConstants.LCM_API_VER); + lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME); + lcmCommonHeader.setRequestId(requestId); + lcmCommonHeader.setSubRequestId(subRequestId); + + return lcmCommonHeader; + } + + public LcmStatus buildLcmStatus() { + LcmStatus lcmStatus = new LcmStatus(); + + lcmStatus.setCode(400); + lcmStatus.setMessage("Test output message"); + + return lcmStatus; + } + + public LcmOutput buildLcmOutput() { + LcmOutput lcmOutput = new LcmOutput(); + + LcmCommonHeader lcmCommonHeader = buildLcmCommonHeader(); + LcmStatus lcmStatus = buildLcmStatus(); + + lcmOutput.setCommonHeader(lcmCommonHeader); + lcmOutput.setStatus(lcmStatus); + lcmOutput.setPayload(outputPayload); + + return lcmOutput; + } + + public static String getExpectedLcmOutput() { + return expectedLcmOutput; + } + + @Test + public final void testLcmOutput() { + LcmOutput lcmOutput = buildLcmOutput(); + + try { + String lcmOutputString = convertToSting(lcmOutput); + assertEquals(expectedLcmOutput, lcmOutputString); + } catch (Exception e) { + fail("Convert LcmOutput to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java new file mode 100644 index 0000000000..c078326c82 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class LcmRestRequestTest extends LcmBeanTest { + private static String expectedLcmRestRequest = "{" + "\"input\":" + LcmInputTest.getExpectedLcmInput() + "}"; + + public LcmRestRequest buildLcmRestRequest() { + LcmRestRequest lcmRestRequest = new LcmRestRequest(); + + LcmInputTest lcmInputTest = new LcmInputTest(); + lcmRestRequest.setInput(lcmInputTest.buildLcmInput()); + + return lcmRestRequest; + } + + public static String getExpectedLcmRestRequest() { + return expectedLcmRestRequest; + } + + @Test + public final void testLcmRestRequest() { + LcmRestRequest lcmRestRequest = buildLcmRestRequest(); + + try { + String lcmRestRequestString = convertToSting(lcmRestRequest); + assertEquals(expectedLcmRestRequest, lcmRestRequestString); + } catch (Exception e) { + fail("Convert LcmRestRequest to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java new file mode 100644 index 0000000000..5867acb421 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class LcmRestResponseTest extends LcmBeanTest { + private static String expectedLcmRestResponse = "{" + "\"output\":" + LcmOutputTest.getExpectedLcmOutput() + "}"; + + public LcmRestResponse buildLcmRestResponse() { + LcmRestResponse lcmRestResponse = new LcmRestResponse(); + + LcmOutputTest lcmOutputTest = new LcmOutputTest(); + lcmRestResponse.setOutput(lcmOutputTest.buildLcmOutput()); + + return lcmRestResponse; + } + + public static String getExpectedLcmRestResponse() { + return expectedLcmRestResponse; + } + + @Test + public final void testLcmRestResponse() { + LcmRestResponse lcmRestResponse = buildLcmRestResponse(); + + try { + String lcmRestResponseString = convertToSting(lcmRestResponse); + assertEquals(expectedLcmRestResponse, lcmRestResponseString); + } catch (Exception e) { + fail("Convert LcmRestResponse to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java new file mode 100644 index 0000000000..542fa2d463 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.core.domain; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"id", "serviceInput", "serviceProperties", "serviceArtifact"}) +@JsonRootName("serviceInfo") +public class ServiceInfo extends JsonWrapper implements Serializable { + private static final long serialVersionUID = 1L; + @JsonProperty("id") + private Integer id; + @JsonProperty("serviceInput") + private String serviceInput; + @JsonProperty("serviceProperties") + private String serviceProperties; + @JsonProperty("serviceArtifact") + private List<ServiceArtifact> serviceArtifact = null; + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("serviceInput") + public String getServiceInput() { + return serviceInput; + } + + @JsonProperty("serviceInput") + public void setServiceInput(String serviceInput) { + this.serviceInput = serviceInput; + } + + @JsonProperty("serviceProperties") + public String getServiceProperties() { + return serviceProperties; + } + + @JsonProperty("serviceProperties") + public void setServiceProperties(String serviceProperties) { + this.serviceProperties = serviceProperties; + } + + @JsonProperty("serviceArtifact") + public List<ServiceArtifact> getServiceArtifact() { + return serviceArtifact; + } + + @JsonProperty("serviceArtifact") + public void setServiceArtifact(List<ServiceArtifact> serviceArtifact) { + this.serviceArtifact = serviceArtifact; + } + + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} + + diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java new file mode 100644 index 0000000000..6903d34987 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.core.domain; + +import java.io.Serializable; +import com.fasterxml.jackson.annotation.*; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"modelInfo", "toscaNodeType", "description", "sourceModelUuid"}) +@JsonRootName("serviceProxy") +public class ServiceProxy extends JsonWrapper implements Serializable { + private static final long serialVersionUID = 1L; + @JsonProperty("modelInfo") + private ModelInfo modelInfo; + @JsonProperty("toscaNodeType") + private String toscaNodeType; + @JsonProperty("description") + private String description; + @JsonProperty("sourceModelUuid") + private String sourceModelUuid; + + @JsonProperty("modelInfo") + public ModelInfo getModelInfo() { + return modelInfo; + } + + @JsonProperty("modelInfo") + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + @JsonProperty("toscaNodeType") + public String getToscaNodeType() { + return toscaNodeType; + } + + @JsonProperty("toscaNodeType") + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("sourceModelUuid") + public String getSourceModelUuid() { + return sourceModelUuid; + } + + @JsonProperty("sourceModelUuid") + public void setSourceModelUuid(String sourceModelUuid) { + this.sourceModelUuid = sourceModelUuid; + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy new file mode 100644 index 0000000000..89490ff620 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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 com.fasterxml.jackson.databind.ObjectMapper +import org.onap.so.db.request.beans.OrchestrationTask + +import static 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.ExceptionUtil +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +class HandleOrchestrationTask extends AbstractServiceTaskProcessor { + private static final Logger logger = LoggerFactory.getLogger(HandleOrchestrationTask.class) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + def supportedMethod = ["GET", "POST", "PUT"] + def validStatus = [200, 201] + + @Override + public void preProcessRequest(DelegateExecution execution) { + logger.debug("Start preProcessRequest") + String method = execution.getVariable("method") + if (!supportedMethod.contains(method)) { + String msg = "Method: " + method + " is not supported" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + String taskId = execution.getVariable("taskId") + if (isBlank(taskId)) { + String msg = "taskId is empty" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint",execution) + def orchestrationTaskEndpoint = dbAdapterEndpoint + "/orchestrationTask/" + if (!"POST".equals(method)) { + orchestrationTaskEndpoint = orchestrationTaskEndpoint + taskId + } + execution.setVariable("url", orchestrationTaskEndpoint) + logger.debug("DB Adapter Endpoint is: " + orchestrationTaskEndpoint) + def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth") + Map<String, String> headerMap = [:] + headerMap.put("content-type", "application/json") + headerMap.put("Authorization", dbAdapterAuth) + execution.setVariable("headerMap", headerMap) + logger.debug("DB Adapter Header is: " + headerMap) + + String requestId = execution.getVariable("requestId") + if (("POST".equals(method) || "PUT".equals(method)) && isBlank(requestId)) { + String msg = "requestId is empty" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + String taskName = execution.getVariable("taskName") + if (("POST".equals(method) || "PUT".equals(method)) && isBlank(taskName)) { + String msg = "task name is empty" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + String taskStatus = execution.getVariable("taskStatus") + if (("POST".equals(method) || "PUT".equals(method)) && isBlank(taskStatus)) { + String msg = "task status is empty" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + String isManual = execution.getVariable("isManual") + if (("POST".equals(method) || "PUT".equals(method)) && isBlank(isManual)) { + String msg = "isManual is empty" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + String paramJson = execution.getVariable("paramJson") + + String payload = "" + if ("POST".equals(method) || "PUT".equals(method)) { + OrchestrationTask task = new OrchestrationTask() + task.setTaskId(taskId) + task.setRequestId(requestId) + task.setName(taskName) + task.setStatus(taskStatus) + task.setIsManual(isManual) + task.setParams(paramJson) + ObjectMapper objectMapper = new ObjectMapper() + payload = objectMapper.writeValueAsString(task) + logger.debug("Outgoing payload is \n" + payload) + } + execution.setVariable("payload", payload) + logger.debug("End preProcessRequest") + } + + public void postProcess(DelegateExecution execution) { + Integer statusCode = execution.getVariable("statusCode") + logger.debug("statusCode: " + statusCode) + String response = execution.getVariable("response") + logger.debug("response: " + response) + if (!validStatus.contains(statusCode)) { + String msg = "Error in sending orchestrationTask request. \nstatusCode: " + statusCode + "\nresponse: " + response + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } +} + 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 new file mode 100644 index 0000000000..630148e899 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy @@ -0,0 +1,585 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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 com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.* +import org.onap.so.beans.nsmf.NSSI +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.beans.OperationStatus +import org.onap.so.logger.ErrorCode +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException +import java.lang.reflect.Type + +import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * This groovy class supports the <class>ActivateSliceService.bpmn</class> process. + * AlaCarte flow for 1702 slice service activate + * + */ + +class ActivateSliceService extends AbstractServiceTaskProcessor { + + + String Prefix = "ACTSS_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + RequestDBUtil requestDBUtil = new RequestDBUtil() + + private static final Logger logger = LoggerFactory.getLogger(ActivateSliceService.class) + + void preProcessRequest(DelegateExecution execution) { + logger.debug(Prefix + "preProcessRequest Start") + execution.setVariable("prefix", Prefix) + String msg + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + logger.debug(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + logger.info("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String source = jsonUtil.getJsonValue(siRequest, "source") + execution.setVariable("source", source) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + logger.info(msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + logger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + execution.setVariable("operationId", operationId) + + execution.getVariable("operationType") + logger.info("operationType is " + execution.getVariable("operationType") ) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "preProcessRequest Exit") + } + + + def sendSyncResponse = { DelegateExecution execution -> + logger.debug(Prefix + "sendSyncResponse Start") + try { + String operationId = execution.getVariable("operationId") + // RESTResponse for API Handler (APIH) Reply Task + String Activate5GsliceServiceRestRequest = """{"operationId":"${operationId}"}""".trim() + logger.debug(" sendSyncResponse to APIH:" + "\n" + Activate5GsliceServiceRestRequest) + sendWorkflowResponse(execution, 202, Activate5GsliceServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "sendSyncResponse Exit") + } + + + public sendSyncError = { DelegateExecution execution -> + logger.debug("sendSyncError Start") + try { + String errorMessage + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") as WorkflowException + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildWorkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + logger.debug(buildWorkflowException) + sendWorkflowResponse(execution, 500, buildWorkflowException) + + } catch (Exception ex) { + logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + logger.debug(Prefix + "sendSyncError Exit") + } + + + def prepareCompletionRequest = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCompletionRequest Start") + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String userId = execution.getVariable("globalSubscriberId") + //String result = execution.getVariable("result") + String result = "finished" + String progress = "100" + String reason = "" + String operationContent = execution.getVariable("operationContent") + String operationType = execution.getVariable("operationType") + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation(operationType) + initStatus.setUserId(userId) + initStatus.setResult(result) + initStatus.setProgress(progress) + initStatus.setReason(reason) + initStatus.setOperationContent(operationContent) + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + logger.debug(Prefix + "prepareCompletionRequest Exit") + } + + + /** + * Init the service Operation Status + */ + def prepareInitServiceOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareActivateServiceOperationStatus Start") + try { + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String userId = execution.getVariable("globalSubscriberId") + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service activation" + + execution.setVariable("e2eserviceInstanceId", serviceId) + execution.setVariable("operationType", operationType) + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation(operationType) + initStatus.setUserId(userId) + initStatus.setResult(result) + initStatus.setProgress(progress) + initStatus.setReason(reason) + initStatus.setOperationContent(operationContent) + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + } catch (Exception e) { + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + execution.setVariable("CVFMI_ErrorResponse", + "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + logger.debug(Prefix + "prepareInitServiceOperationStatus Exit") + } + + + private getSNSSIStatusByNsi = { DelegateExecution execution, String NSIServiceId -> + + logger.debug(Prefix + "getSNSSIStatusByNsi Start") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, NSIServiceId) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if (si.isPresent()) { + + List<Relationship> relatedList = si.get().getRelationshipList().getRelationship() + for (Relationship relationship : relatedList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo.toLowerCase() == "allotted-resource") { + //get snssi from allotted resource in list by nsi + List<String> SNSSIList = new ArrayList<>() + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") { + SNSSIList.add(relationshipData.getRelationshipValue()) + } + } + for (String snssi : SNSSIList) { + AAIResourcesClient client01 = new AAIResourcesClient() + AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, snssi) + if (!client.exists(uri01)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) + Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) + if (nssiSi.isPresent()) { + return nssiSi.get().getOrchestrationStatus() == "deactivated" + } + } + + } + } + + } + logger.debug(Prefix + "getSNSSIStatusByNsi Exit") + } + + + def updateStatusSNSSAIandNSIandNSSI = { DelegateExecution execution -> + logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Start") + logger.debug(" ***** update SNSSAI NSI NSSI slicing ***** ") + String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId") + String NSIserviceInstanceId = execution.getVariable("NSIserviceid") + + String globalCustId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String operationType = execution.getVariable("operationType") + + String nssiMap = execution.getVariable("nssiMap") + Type type = new TypeToken<HashMap<String, NSSI>>() {}.getType() + Map<String, NSSI> activateNssiMap = new Gson().fromJson(nssiMap, type) + //update tn/cn/an nssi + for (Map.Entry<String, NSSI> entry : activateNssiMap.entrySet()) { + NSSI nssi = entry.getValue() + String nssiid = nssi.getNssiId() + updateStratus(execution, globalCustId, serviceType, nssiid, operationType) + } + if (operationType == "activation") { + //update the s-nssai + updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) + //update the nsi + updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType) + } else { + //update the s-nssai + updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) + boolean flag = getSNSSIStatusByNsi(execution, NSIserviceInstanceId) + if (flag) { + //update the nsi + updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType) + } else { + logger.error("Service's status update failed") + String msg = "Service's status update failed" + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Exit") + } + + + def updateStratus = { DelegateExecution execution, String globalCustId, + String serviceType, String serviceId, String operationType -> + logger.debug(Prefix + "updateStratus Start") + + try { + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalCustId, serviceType, serviceId) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + + if (si.isPresent()) { + if (operationType == "activation") { + if (si.get().getOrchestrationStatus() == "deactivated") { + si.get().setOrchestrationStatus("activated") + client.update(uri, si.get()) + } + } else { + if (si.get().getOrchestrationStatus() == "activated") { + si.get().setOrchestrationStatus("deactivated") + client.update(uri, si.get()) + } + } + + } + } catch (Exception e) { + logger.info("Service is already in active state") + String msg = "Service is already in active state, " + e.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "updateStratus Exit") + } + + + def prepareActivation = { DelegateExecution execution -> + logger.debug(Prefix + "prepareActivation Start") + + logger.debug(" ***** prepare active NSI/AN/CN/TN slice ***** ") + String NSIserviceInstanceId = execution.getVariable("NSIserviceid") + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + Map<String, NSSI> nssiMap = new HashMap<>() + + List<String> activationSequence = new ArrayList<>(Arrays.asList("an", "tn", "cn")) + + def activationCount = activationSequence.size() + + execution.setVariable("activationIndex", "0") + + execution.setVariable("activationCount", activationCount) + try { + //get the TN NSSI id by NSI id, active NSSI TN slicing + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, NSIserviceInstanceId) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if (si.isPresent()) { + + List<Relationship> relatedList = si.get().getRelationshipList().getRelationship() + for (Relationship relationship : relatedList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo.toLowerCase() == "service-instance") { + String relatioshipurl = relationship.getRelatedLink() + String nssiserviceid = + relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) + + AAIResourcesClient client01 = new AAIResourcesClient() + AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, nssiserviceid) + if (!client.exists(uri01)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) + Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) + if (nssiSi.isPresent()) { + if (nssiSi.get().getEnvironmentContext().toLowerCase().contains("an") + || nssiSi.get().getEnvironmentContext().toLowerCase().contains("cn") + || nssiSi.get().getEnvironmentContext().toLowerCase().contains("tn")) { + nssiMap.put(nssiSi.get().getEnvironmentContext(), + new NSSI(nssiSi.get().getServiceInstanceId(), + nssiSi.get().getModelInvariantId(), nssiSi.get().getModelVersionId())) + } + } + } + } + + + } + } catch (Exception e) { + String msg = "Requested service does not exist:" + e.getMessage() + logger.info("Service doesnt exist") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + if (nssiMap.size() > 0) { + execution.setVariable("isNSSIActivate", "true") + String nssiMap01 = mapToJsonStr(nssiMap) + execution.setVariable("nssiMap", nssiMap01) + execution.setVariable("operation_type", "activate") + execution.setVariable("activationCount", nssiMap.size()) + logger.info("the nssiMap01 is :" + nssiMap01) + } else { + execution.setVariable("isNSSIActivate", "false") + } + + logger.debug(Prefix + "prepareActivation Exit") + } + + + private mapToJsonStr = { HashMap<String, NSSI> stringNSSIHashMap -> + HashMap<String, NSSI> map = new HashMap<String, NSSI>() + for (Map.Entry<String, NSSI> child : stringNSSIHashMap.entrySet()) { + map.put(child.getKey(), child.getValue()) + } + return new Gson().toJson(map) + } + + + def checkAAIOrchStatusofslice = { DelegateExecution execution -> + logger.debug(Prefix + "CheckAAIOrchStatus Start") + + String msg = "" + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String operationType = execution.getVariable("operationType") + + logger.debug("serviceInstanceId: " + serviceInstanceId) + + //check the e2e slice status + try { + try { + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, serviceInstanceId) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if (si.isPresent()) { + if (si.get().getOrchestrationStatus().toLowerCase() == "activated" && + operationType == "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") { + logger.info("Service is in de-activated state") + execution.setVariable("e2eservicestatus", "deactivated") + execution.setVariable("isContinue", "true") + String snssai = si.get().getEnvironmentContext() + execution.setVariable("snssai", snssai) + } else { + execution.setVariable("isContinue", "false") + } + } + } catch (Exception e) { + msg = "Requested e2eservice does not exist" + logger.info("e2eservice doesnt exist") + execution.setVariable("isContinue", "false") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + //check the NSI is exist or the status of NSI is active or de-active + try { + + //get the allotted-resources by e2e slice id + AAIResourcesClient client_allotted = new AAIResourcesClient() + AAIResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL, + globalSubscriberId, subscriptionServiceType, serviceInstanceId) + if (!client_allotted.exists(uri_allotted)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper_allotted = client_allotted.get(uri_allotted, NotFoundException.class) + Optional<AllottedResources> all_allotted = wrapper_allotted.asBean(AllottedResources.class) + + if (all_allotted.isPresent() && all_allotted.get().getAllottedResource()) { + List<AllottedResource> AllottedResourceList = all_allotted.get().getAllottedResource() + AllottedResource ar = AllottedResourceList.first() + String relatedLink = ar.getRelationshipList().getRelationship().first().getRelatedLink() + String nsiserviceid = relatedLink.substring(relatedLink.lastIndexOf("/") + 1, relatedLink.length()) + execution.setVariable("NSIserviceid", nsiserviceid) + logger.info("the NSI ID is:" + nsiserviceid) + + //Query nsi by nsi id + try { + //get the NSI id by e2e slice id + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, nsiserviceid) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + + if (si.isPresent()) { + if (si.get().getServiceRole().toLowerCase() == "nsi") { + if (si.get().getOrchestrationStatus() == "activated") { + logger.info("NSI services is in activated state") + execution.setVariable("NSIservicestatus", "activated") + } else { + logger.info("NSI services is in deactivated state") + execution.setVariable("NSIservicestatus", "deactivated") + } + } else { + logger.info("the service id" + si.get().getServiceInstanceId() + "is " + + si.get().getServiceRole()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + } catch (Exception e) { + msg = "Requested NSI service does not exist:" + e.getMessage() + logger.info("NSI service doesnt exist") + execution.setVariable("isContinue", "false") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + } catch (Exception e) { + msg = "Requested service does not exist: " + e.getMessage() + logger.info("NSI Service doesnt exist") + execution.setVariable("isActivate", "false") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "CheckAAIOrchStatus Exit") + } + +} 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 new file mode 100644 index 0000000000..e3470cd011 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy @@ -0,0 +1,678 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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 groovy.json.JsonSlurper +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInfo +import org.onap.so.bpmn.core.domain.ServiceProxy +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.beans.OperationStatus +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.springframework.web.util.UriUtils + +import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +class CreateCommunicationService extends AbstractServiceTaskProcessor { + + String Prefix="CRESI_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + RequestDBUtil requestDBUtil = new RequestDBUtil() + + JsonUtils jsonUtil = new JsonUtils() + + AAIResourcesClient client = getAAIClient() + + private static final Logger logger = LoggerFactory.getLogger(CreateCommunicationService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + logger.debug(Prefix + "preProcessRequest Start") + execution.setVariable("prefix", Prefix) + execution.setVariable("startTime", System.currentTimeMillis()) + def msg + //execution.setVariable("bpmnRequest", InputString) + try { + // get request input + String siRequest = execution.getVariable("bpmnRequest") + logger.debug(siRequest) + + //String requestId = execution.getVariable("mso-request-id") + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + logger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + logger.debug("Generated new Service Instance:" + serviceInstanceId) + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + logger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("csServiceModelInfo", serviceModelInfo) + } + + logger.debug("modelInfo: " + serviceModelInfo) + + //requestParameters, subscriptionServiceType is 5G + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + // todo: in create e2e interface, this value is write "MOG", so write it as "5G" + execution.setVariable("subscriptionServiceType", "5G") + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + + Map reqMap = jsonSlurper.parseText(siRequest) as Map + + //InputParams + def userParamsList = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParamsList) { + for (def i=0; i<userParamsList.size(); i++) { + def userParams1 = userParamsList.get(i) + userParams1.each { param -> inputMap.put(param.key, param.value)} + } + } + + logger.debug("User Input Parameters map: " + inputMap.toString()) + execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("uuiRequest", inputMap.get("UUIRequest")) + execution.setVariable("isAllNSMFFinished", "false") + String operationId = UUID.randomUUID().toString() + execution.setVariable("operationId", operationId) + + } catch(BpmnError e) { + throw e + } catch(Exception ex) { + msg = "Exception in CreateCommunicationService.preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "preProcessRequest Exit") + } + + + /** + * create operation status in request db + * + * Init the Operation Status + */ + def prepareInitOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareInitOperationStatus Start") + + String serviceId = execution.getVariable("serviceInstanceId") + // 生成 operationId + String operationId = execution.getVariable("operationId") + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation("CREATE") + initStatus.setUserId(execution.getVariable("globalSubscriberId") as String) + initStatus.setResult("processing") + initStatus.setProgress("0") + initStatus.setReason("") + initStatus.setOperationContent("communication service create operation start") + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + logger.debug(Prefix + "prepareInitOperationStatus Exit") + } + + + /** + * return sync response + */ + def sendSyncResponse = { DelegateExecution execution -> + logger.debug(Prefix + "sendSyncResponse Start") + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String createServiceRestRequest = """ + { + "service": { + "serviceId":"${serviceInstanceId}", + "operationId":"${operationId}" + } + } + """.trim().replaceAll(" ", "") + + logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + + execution.setVariable("sentSyncResponse", true) + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "sendSyncResponse Exit") + } + + + /** + * query e2e service + * @param execution + */ + def prepareDoComposeE2E = { DelegateExecution execution -> + logger.debug(Prefix + "prepareDoComposeE2E Start") + try { + ServiceDecomposition serviceDecomposition = execution.getVariable( + "csServiceDecomposition") as ServiceDecomposition + + logger.debug("serviceDecomposition is:" + serviceDecomposition.toJsonString()) + + List<ServiceProxy> serviceProxies = serviceDecomposition.getServiceProxy() + String sourceModelUuid = serviceProxies.get(0).getSourceModelUuid() + + JSONObject queryJson = new JSONObject() + queryJson.put("modelUuid", sourceModelUuid) + + execution.setVariable("e2eServiceModelInfo", queryJson.toString()) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.prepareDoComposeE2E. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "prepareDoComposeE2E Exit") + } + + + /** + * parse communication service params from request + * @param execution + */ + def parseCSParamsFromReq = { DelegateExecution execution -> + logger.debug(Prefix + "parseCSParamsFromReq Start") + try { + //1. CMS info + + String modelInfo = execution.getVariable("csServiceModelInfo") + String modelInvariantUuid = jsonUtil.getJsonValue(modelInfo, "modelInvariantUuid") + String modelUuid = jsonUtil.getJsonValue(modelInfo, "modelUuid") + + //String modelInvariantUuid = execution.getVariable("modelInvariantId") + //String modelUuid = execution.getVariable("modelUuid") + String uuiRequest = execution.getVariable("uuiRequest") + String useInterval = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.useInterval") + String csServiceName = jsonUtil.getJsonValue(uuiRequest, "service.name") + String csServiceDescription = jsonUtil.getJsonValue(uuiRequest, "service.description") + + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + execution.setVariable("modelUuid", modelUuid) + execution.setVariable("useInterval", useInterval) + execution.setVariable("csServiceName", csServiceName) + execution.setVariable("csServiceDescription", csServiceDescription) + + + //2. profile info + Integer expDataRateDL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateDL") + Integer expDataRateUL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateUL") + Integer latency = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.latency") + Integer maxNumberOfUEs = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.maxNumberofUEs") + String uEMobilityLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.uemobilityLevel") + String resourceSharingLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.resourceSharingLevel") + String coverageArea = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.coverageAreaList") + + // from template construct input map + //String cstTemplate = execution.getVariable("cstTemplate") + ServiceDecomposition csServiceDecomposition = execution.getVariable( + "csServiceDecomposition") as ServiceDecomposition + //String csServiceType = jsonUtil.getJsonValue(cstTemplate, "serviceResources.serviceType") + String csServiceType = csServiceDecomposition.getServiceType() + execution.setVariable("csServiceType", csServiceType) + + //String cstTemplateInfo = jsonUtil.getJsonValue(cstTemplate, "serviceResources.serviceInfo.serviceInput") + ServiceInfo csServiceInfo = csServiceDecomposition.getServiceInfo() + String cstTemplateInfo = csServiceInfo.getServiceProperties() + + List<String> csInputs = jsonUtil.StringArrayToList(cstTemplateInfo) + + Map<String, ?> csInputMap = new HashMap<>() + for (String csInput : csInputs) { + def value + if (jsonUtil.getJsonValue(csInput, "type") == "integer") { + value = jsonUtil.getJsonValue(csInput, "default") + csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), isBlank(value) ? 0 : (value as Integer)) + } else if (jsonUtil.getJsonValue(csInput, "type") == "string") { + csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), + jsonUtil.getJsonValue(csInput, "default")) + } + } + csInputMap.put("expDataRateDL", expDataRateDL) + csInputMap.put("expDataRateUL", expDataRateUL) + csInputMap.put("latency", latency) + csInputMap.put("maxNumberofUEs", maxNumberOfUEs) + csInputMap.put("uEMobilityLevel", uEMobilityLevel) + csInputMap.put("resourceSharingLevel", resourceSharingLevel) + csInputMap.put("coverageAreaTAList", coverageArea) + csInputMap.put("useInterval", useInterval) + + execution.setVariable("csInputMap", csInputMap) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.parseCSParamsFromReq. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "parseCSParamsFromReq Exit") + } + + + /** + * get E2EST id through CST id and change communication profile to E2E service profile + * 1. get E2EST id from cst + * 1.1 查source service id + * 1.2 source service + * 1.3 source service input, init e2e profile + */ + def generateE2EServiceProfile = { DelegateExecution execution -> + logger.debug(Prefix + "generateE2EServiceProfile Start") + try { + ServiceDecomposition e2eServiceDecomposition = execution.getVariable( + "e2eServiceDecomposition") as ServiceDecomposition + String e2estTemplateInfo = e2eServiceDecomposition.getServiceInfo().getServiceProperties() + + List<String> e2eInputs = jsonUtil.StringArrayToList(e2estTemplateInfo) + + Map<String, ?> csInputMap = execution.getVariable("csInputMap") as Map + Map<String, ?> e2eInputMap = new HashMap<>() + String key + def value + + + for (String e2eInput in e2eInputs) { + if (jsonUtil.getJsonValue(e2eInput, "type") == "integer") { + def temp + key = jsonUtil.getJsonValue(e2eInput, "name") + value = csInputMap.containsKey(key) ? csInputMap.getOrDefault(key, 0) : (isBlank(temp = jsonUtil.getJsonValue(e2eInput, "default")) ? 0 : temp) + + e2eInputMap.put(key, value as Integer) + } else { + e2eInputMap.put(key = jsonUtil.getJsonValue(e2eInput, "name"), csInputMap.containsKey(key) + ? csInputMap.getOrDefault(key, null) : (jsonUtil.getJsonValue(e2eInput, "default"))) + } + } + + e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id")) + e2eInputMap.put("areaTrafficCapDL", 100) + e2eInputMap.put("areaTrafficCapUL", 100) + e2eInputMap.put("sST", execution.getVariable("csServiceType")) + + execution.setVariable("e2eInputMap", e2eInputMap) + execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType()) + execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid()) + execution.setVariable("e2eModelUuid", e2eServiceDecomposition.getModelInfo().getModelUuid()) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "generateE2EServiceProfile Exit") + } + + + /** + * call createE2EService get operation id, + * created/processing + */ + def preRequestSend2NSMF(DelegateExecution execution) { + logger.debug(Prefix + "preRequestSend2NSMF Start") + try { + + //String NSMF_endpoint = "/onap/so/infra/e2eServiceInstances/v3" + def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) + def url = NSMF_endpoint + "/e2eServiceInstances/v3" + execution.setVariable("NSMF_endpoint", url) + //get from model catalog inputs + String payload = """ + { + "service":{ + "name": "${execution.getVariable("csServiceName")}", + "description": "e2eService of ${execution.getVariable("modelUuid")}", + "serviceInvariantUuid": "${execution.getVariable("e2eModelInvariantUuid")}", + "serviceUuid": "${execution.getVariable("e2eModelUuid")}", + "globalSubscriberId": "${execution.getVariable("globalSubscriberId")}", + "serviceType": "${execution.getVariable("subscriptionServiceType")}", + "parameters":{ + "requestInputs": ${execution.getVariable("e2eInputMap") as JSONObject} + } + } + } + """ + execution.setVariable("CSMF_NSMFRequest", payload.replaceAll("\\s+", "")) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.preRequestSend2NSMF. " + ex.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "preRequestSend2NSMF Exit") + } + + + def processNSMFResponse = { DelegateExecution execution -> + logger.debug(Prefix + "processNSMFResponse Start") + //oof + try { + def CSMF_NSMFResponseCode = execution.getVariable("CSMF_NSMFResponseCode") as Integer + if (CSMF_NSMFResponseCode >= 200 && CSMF_NSMFResponseCode < 400) { + def CSMF_NSMFResponse = execution.getVariable("CSMF_NSMFResponse") as String + def e2eServiceInstanceId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "service.serviceId") + def e2eOperationId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "service.operationId") + + execution.setVariable("e2eServiceInstanceId", e2eServiceInstanceId) + execution.setVariable("e2eOperationId", e2eOperationId) + execution.setVariable("ProcessNsmfSuccess", "OK") + } else { + execution.setVariable("ProcessNsmfSuccess", "ERROR") + execution.setVariable("operationStatus", "error") + execution.setVariable("operationContent", + "communication service create operation error: nsmf response fail") + execution.setVariable("orchestrationStatus", "error") + } + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in " + Prefix + "processOOFResponse. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "processNSMFResponse Exit") + } + + + /** + * create communication service and e2e service relationship + * + */ + def createCSAndSSRelationship = { DelegateExecution execution -> + logger.debug(Prefix + "createCSAndSSRelationship Start") + String msg = "" + try { + def e2eServiceInstanceId = execution.getVariable("e2eServiceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + Relationship relationship = new Relationship() + String relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${e2eServiceInstanceId}" + relationship.setRelatedLink(relatedLink) + + // create CS and SS relationship in AAI + createRelationShipInAAI(execution, relationship) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + + msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "createCSAndSSRelationship Exit") + } + + + /** + * prepare update operation status to 50% after create relationship in aai + * @param execution + */ + def prepareUpdateOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareUpdateOperationStatus Start") + // update status creating + OperationStatus status = new OperationStatus() + status.setServiceId(execution.getVariable("serviceInstanceId") as String) + status.setOperationId(execution.getVariable("operationId") as String) + status.setOperation("CREATE") + status.setResult("processing") + status.setProgress("20") + status.setOperationContent("communication service create operation processing: waiting nsmf service create finished") + status.setUserId(execution.getVariable("globalSubscriberId") as String) + + requestDBUtil.prepareUpdateOperationStatus(execution, status) + logger.debug(Prefix + "prepareUpdateOperationStatus Exit") + } + + + /** + * create relationship in AAI + */ + private createRelationShipInAAI = { DelegateExecution execution, final Relationship relationship -> + logger.debug(Prefix + "createRelationShipInAAI Start") + String msg + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + execution.getVariable("globalSubscriberId"), + execution.getVariable("subscriptionServiceType"), + serviceInstanceId).relationshipAPI() + client.create(uri, relationship) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "createRelationShipInAAI Exit") + + } + + + def prepareCallCheckProcessStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCallCheckProcessStatus Start") + + def successConditions = new ArrayList<>() + successConditions.add("finished") + execution.setVariable("successConditions", successConditions) + + def errorConditions = new ArrayList<>() + errorConditions.add("error") + execution.setVariable("errorConditions", errorConditions) + + execution.setVariable("processServiceType", "communication service") + + execution.setVariable("subOperationType", "CREATE") + + execution.setVariable("timeOut", 3 * 60 * 60 * 1000) + + def successParamMap = new HashMap<String, Object>() + successParamMap.put("orchestrationStatus", "deactivated") + + execution.setVariable("successParamMap", successParamMap) + + def errorParamMap = new HashMap<String, Object>() + errorParamMap.put("orchestrationStatus", "error") + + execution.setVariable("errorParamMap", errorParamMap) + + def timeOutParamMap = new HashMap<String, Object>() + timeOutParamMap.put("orchestrationStatus", "error") + + execution.setVariable("timeOutParamMap", timeOutParamMap) + + execution.setVariable("initProgress", 20) + execution.setVariable("endProgress", 90) + + logger.debug(Prefix + "prepareCallCheckProcessStatus Exit") + } + + + /** + * prepare update operation status to complete after NSMF process success + * @param execution + */ + def prepareCompleteStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCompleteStatus Start") + OperationStatus status = new OperationStatus() + status.setServiceId(execution.getVariable("serviceInstanceId") as String) + status.setOperationId(execution.getVariable("operationId") as String) + status.setOperation("CREATE") + status.setResult(execution.getVariable("operationStatus") as String) + status.setProgress("100") + status.setOperationContent(execution.getVariable("operationContent") as String) + status.setUserId(execution.getVariable("globalSubscriberId") as String) + + requestDBUtil.prepareUpdateOperationStatus(execution, status) + logger.debug("prepareCompleteStatus end, serviceInstanceId: " + execution.getVariable("serviceInstanceId") + + ", operationId: " + execution.getVariable("operationId")) + logger.debug(Prefix + "prepareCompleteStatus Exit") + } + + + /** + * update NSMF complete status to AAI when the NSMF process finished + * @param execution + */ + def updateFinishStatusInAAI = { DelegateExecution execution -> + logger.debug(Prefix + "updateFinishStatusInAAI Start") + String msg + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String orchestrationStatus = execution.getVariable("orchestrationStatus") + // create service + ServiceInstance csi = new ServiceInstance() + csi.setOrchestrationStatus(orchestrationStatus) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, serviceInstanceId) + client.update(uri, csi) + logger.debug(Prefix + "updateFinishStatusInAAI update communication service status to deactivated") + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in complete communication service " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "updateFinishStatusInAAI Exit") + } + + + public sendSyncError = { DelegateExecution execution -> + logger.debug("sendSyncError Start") + try { + String errorMessage + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") as WorkflowException + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildWorkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + logger.debug(buildWorkflowException) + sendWorkflowResponse(execution, 500, buildWorkflowException) + + } catch (Exception ex) { + logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + logger.debug(Prefix + "sendSyncError Exit") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy new file mode 100644 index 0000000000..c3f36ef545 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy @@ -0,0 +1,513 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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 com.fasterxml.jackson.databind.ObjectMapper +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory + +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.* +import org.springframework.web.util.UriUtils +import groovy.json.JsonSlurper +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.db.request.beans.OrchestrationTask +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.OofUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.ErrorCode +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +public class CreateSliceService extends AbstractServiceTaskProcessor { + String Prefix = "CRESS_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + JsonSlurper jsonSlurper = new JsonSlurper() + ObjectMapper objectMapper = new ObjectMapper() + OofUtils oofUtils = new OofUtils() + private static final Logger logger = LoggerFactory.getLogger(CreateSliceService.class) + + + public void preProcessRequest(DelegateExecution execution) { + logger.debug("Start preProcessRequest") + execution.setVariable("prefix", Prefix) + String msg = "" + + try { + String ssRequest = execution.getVariable("bpmnRequest") + logger.debug(ssRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + logger.debug("Input Request:" + ssRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + + String operationId = UUID.randomUUID().toString() + execution.setVariable("operationId", operationId) + + logger.debug("Generated new Service Instance:" + serviceInstanceId) + serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(ssRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) { + msg = "Input productFamilyId is null" + logger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(ssRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + logger.debug("modelInfo: " + serviceModelInfo) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + logger.debug("subscriptionServiceType: " + subscriptionServiceType) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + Map reqMap = jsonSlurper.parseText(ssRequest) + + //InputParams + def userParamsList = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParamsList) { + for (def i = 0; i < userParamsList.size(); i++) { + def userParams1 = userParamsList.get(i) + userParams1.each { param -> inputMap.put(param.key, param.value) } + } + } + + logger.debug("User Input Parameters map: " + inputMap.toString()) + String uuiRequest = inputMap.get("UUIRequest") + Map uuiReqMap = jsonSlurper.parseText(uuiRequest) + Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service") + Map<String, Object> parameterObject = (Map<String, Object>) serviceObject.get("parameters") + Map<String, Object> requestInputs = (Map<String, Object>) parameterObject.get("requestInputs") + + execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("uuiRequest", uuiRequest) + execution.setVariable("serviceProfile", requestInputs) + + //TODO + //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")) + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug("Finish preProcessRequest") + } + + public void getNSTSelection(DelegateExecution execution) { + logger.debug("Start getNSTSelection") + String requestId = execution.getVariable("msoRequestId") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + String oofUrl = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) + + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) + String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + logger.debug( "Unable to encode username and password string: " + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + + "encode username and password string") + } + } else { + logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } + + URL requestUrl = new URL(oofUrl + "/api/oof/v1/selection/nst") + String oofRequest = oofUtils.buildSelectNSTRequest(requestId, serviceProfile) + HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.OOF) + httpClient.addAdditionalHeader("Authorization", authHeader) + Response httpResponse = httpClient.post(oofRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("OOF sync response code is: " + responseCode) + + if(responseCode != 200){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + } + + Map<String, Object> nstSolution + try { + Map<String, Object> resMap = httpResponse.readEntity(Map.class) + List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions") + nstSolution = nstSolutions.get(0) + execution.setVariable("nstSolution", nstSolution) + } catch (Exception ex) { + logger.debug( "Failed to get NST solution suggested by OOF.") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.") + } + + logger.debug("Finish getNSTSelection") + + } + + public void prepareDecomposeService(DelegateExecution execution) { + logger.debug("Start prepareDecomposeService") + String uuiRequest = execution.getVariable("uuiRequest") + String ssModelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") + String ssModelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") + String ssServiceModelInfo = """{ + "modelInvariantUuid":"${ssModelInvariantUuid}", + "modelUuid":"${ssModelUuid}", + "modelVersion":"" + }""" + execution.setVariable("ssServiceModelInfo", ssServiceModelInfo) + + logger.debug("Finish prepareDecomposeService") + } + + public void processDecomposition(DelegateExecution execution) { + logger.debug("Start processDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + Map<String, Object> nstSolution = execution.getVariable("nstSolution") + + Map uuiReqMap = jsonSlurper.parseText(uuiRequest) + Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service") + String subscriptionServiceType = serviceObject.get("serviceType") + + String serviceType = (String) serviceProfile.get("sST") + String resourceSharingLevel = (String) serviceProfile.get("resourceSharingLevel") + String nstModelUuid = (String) nstSolution.get("UUID") + String nstModelInvariantUuid = (String) nstSolution.get("invariantUUID") + + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + execution.setVariable("serviceType", serviceType) + execution.setVariable("resourceSharingLevel", resourceSharingLevel) + execution.setVariable("nstModelUuid", nstModelUuid) + execution.setVariable("nstModelInvariantUuid", nstModelInvariantUuid) + + logger.debug("Finish processDecomposition") + } + + public void prepareCreateOrchestrationTask(DelegateExecution execution) { + logger.debug("Start createOrchestrationTask") + String taskId = execution.getBusinessKey() + execution.setVariable("orchestrationTaskId", taskId) + logger.debug("BusinessKey: " + taskId) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String taskName = "SliceServiceTask" + String taskStatus = "Planning" + String isManual = "false" + String requestMethod = "POST" + execution.setVariable("CSSOT_taskId", taskId) + execution.setVariable("CSSOT_name", taskName) + execution.setVariable("CSSOT_status", taskStatus) + execution.setVariable("CSSOT_isManual", isManual) + execution.setVariable("CSSOT_requestMethod", requestMethod) + + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + + SliceTaskParams sliceTaskParams = new SliceTaskParams() + sliceTaskParams.setServiceId(serviceInstanceId) + sliceTaskParams.setServiceName(serviceInstanceName) + sliceTaskParams.setServiceProfile(serviceProfile) + execution.setVariable("sliceTaskParams", sliceTaskParams) + + String paramJson = sliceTaskParams.convertToJson() + execution.setVariable("CSSOT_paramJson", paramJson) + logger.debug("CSSOT_paramJson: " + paramJson) + + logger.debug("Finish createOrchestrationTask") + } + + public void prepareUpdateOrchestrationTask(DelegateExecution execution) { + logger.debug("Start prepareUpdateOrchestrationTask") + String requestMethod = "PUT" + String taskStatus = execution.getVariable("taskStatus") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + String paramJson = sliceTaskParams.convertToJson() + execution.setVariable("CSSOT_status", taskStatus) + execution.setVariable("CSSOT_paramJson", paramJson) + execution.setVariable("CSSOT_requestMethod", requestMethod) + logger.debug("Finish prepareUpdateOrchestrationTask") + } + + public void prepareGetUserOptions(DelegateExecution execution) { + logger.debug("Start prepareGetUserOptions") + String requestMethod = "GET" + execution.setVariable("taskAction", "commit") + String taskAction = execution.getVariable("taskAction") + logger.debug("task action is: " + taskAction) + if (!"commit".equals(taskAction) && !"abort".equals(taskAction)) { + String msg = "Unknown task action: " + taskAction + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("CSSOT_requestMethod", requestMethod) + logger.debug("Finish prepareGetUserOptions") + } + + public void processUserOptions(DelegateExecution execution) { + logger.debug("Start processUserOptions") + String response = execution.getVariable("CSSOT_dbResponse") + OrchestrationTask orchestrationTask = objectMapper.readValue(response, OrchestrationTask.class) + String paramJson = orchestrationTask.getParams() + logger.debug("paramJson: " + paramJson) + SliceTaskParams sliceTaskParams = new SliceTaskParams() + sliceTaskParams.convertFromJson(paramJson) + execution.setVariable("sliceTaskParams", sliceTaskParams) + logger.debug("Finish processUserOptions") + } + + public void updateAAIOrchStatus(DelegateExecution execution) { + logger.debug("Start updateAAIOrchStatus") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String orchStatus = execution.getVariable("orchestrationStatus") + + try { + ServiceInstance si = execution.getVariable("serviceInstanceData") + si.setOrchestrationStatus(orchStatus) + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + client.update(uri, si) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug("Finish updateAAIOrchStatus") + } + + public void prepareInitServiceOperationStatus(DelegateExecution execution) { + logger.debug("Start prepareInitServiceOperationStatus") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = "CREATE" + String userId = execution.getVariable("globalSubscriberId") + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) + execution.setVariable("CSSOS_dbAdapterEndpoint", dbAdapterEndpoint) + logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.requestDb.auth") + Map<String, String> CSSOS_headerMap = [:] + CSSOS_headerMap.put("content-type", "application/soap+xml") + CSSOS_headerMap.put("Authorization", dbAdapterAuth) + execution.setVariable("CSSOS_headerMap", CSSOS_headerMap) + logger.debug("DB Adapter Header is: " + CSSOS_headerMap) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:initServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload) + logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + } + logger.debug("Finish prepareInitServiceOperationStatus") + } + + public void prepareUpdateServiceOperationStatus(DelegateExecution execution) { + logger.debug("Start preUpdateServiceOperationStatus") + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String userId = execution.getVariable("globalSubscriberId") + String result = execution.getVariable("operationResult") + String progress = execution.getVariable("operationProgress") + String reason = execution.getVariable("operationReason") + String operationContent = "service: " + result + " progress: " + progress + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:initServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload) + logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e.getMessage()) + } + logger.debug("Finish preUpdateServiceOperationStatus") + } + + public void sendSyncResponse(DelegateExecution execution) { + logger.debug("Start sendSyncResponse") + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() + logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + } catch (Exception e) { + String msg = "Exceptuion in sendSyncResponse:" + e.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug("Finish sendSyncResponse") + } + + public void prepareCompletionRequest (DelegateExecution execution) { + logger.trace("Start prepareCompletionRequest") + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>CREATE</action> + <source>${MsoUtils.xmlEscape(source)}</source> + </request-info> + <status-message>Service Instance was created successfully.</status-message> + <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId> + <mso-bpel-name>CreateGenericALaCarteServiceInstance</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + logger.debug("Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Finish prepareCompletionRequest") + } + +} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy new file mode 100644 index 0000000000..71026f1fa6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy @@ -0,0 +1,460 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.CommunicationServiceProfile +import org.onap.aai.domain.yang.CommunicationServiceProfiles +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.beans.OperationStatus +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.isBlank + +class DeleteCommunicationService extends AbstractServiceTaskProcessor { + private final String PREFIX ="DeleteCommunicationService" + private final Long TIMEOUT = 60 * 60 * 1000 + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private RequestDBUtil requestDBUtil = new RequestDBUtil() + private static final Logger LOGGER = LoggerFactory.getLogger(DeleteCommunicationService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix",PREFIX) + String msg = "" + + LOGGER.trace("Starting preProcessRequest") + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + execution.setVariable("operationType", "DELETE") + + //communication service id + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "communication-service id is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + LOGGER.info("Input Request: ${siRequest}, reqId: ${requestId}, serviceInstanceId: ${serviceInstanceId}") + + //requestParameters + checkAndSetRequestParam(siRequest,"globalSubscriberId",false,execution) + checkAndSetRequestParam(siRequest,"serviceType",false,execution) + checkAndSetRequestParam(siRequest,"operationId",false,execution) + + } catch (BpmnError e) { + throw e + } catch (any) { + msg = "Exception in preProcessRequest " + any.getCause() + LOGGER.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + LOGGER.trace("Exit preProcessRequest") + } + + + /** + * prepare update operation status + * @param execution + */ + void preInitUpdateOperationStatus(DelegateExecution execution){ + LOGGER.trace(" ======== STARTED initUpdateOperationStatus Process ======== ") + try{ + execution.setVariable("result","processing") + execution.setVariable("progress","0") + execution.setVariable("operationContent","delete communication service operation start") + setOperationStatus(execution) + + }catch(Exception e){ + LOGGER.error("Exception Occured Processing initUpdateOperationStatus. Exception is:\n" + e) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during initUpdateOperationStatus Method:\n" + e.getMessage()) + } + LOGGER.trace("======== COMPLETED initUpdateOperationStatus Process ======== ") + } + + /** + * send sync response + * @param execution + */ + void sendSyncResponse(DelegateExecution execution) { + LOGGER.debug("Begin sendSyncResponse") + + try { + String operationId = execution.getVariable("operationId") + String syncResponse = """{"operationId":"${operationId}"}""".trim() + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + LOGGER.debug("Exit sendSyncResponse") + } + + /** + * query CommunicationSerive from AAI + * save e2eslice-service instance id and service name + * @param execution + */ + void queryCommunicationSeriveFromAAI(DelegateExecution execution) + { + LOGGER.trace(" ***** begin queryCommunicationSeriveFromAAI *****") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String errorMsg = "query communication service from aai failed" + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if(si.isPresent()) + { + String serviceInstName = si.get()?.getServiceInstanceName() + String e2eSliceServiceInstId + if(si.isPresent()) + { + List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship() + for (Relationship relationship : relationshipList) + { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "service-instance") + { + String relatedLink = relationship.getRelatedLink()?:"" + e2eSliceServiceInstId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" + break + } + } + } + execution.setVariable("e2eSliceServiceInstanceId", e2eSliceServiceInstId) + execution.setVariable("serviceInstanceName", serviceInstName ?: "") + LOGGER.info("communication-service Id: ${serviceInstanceId}, e2eslice-service Id: ${e2eSliceServiceInstId}, serviceName: ${serviceInstName}") + } + LOGGER.debug(" ***** Exit queryCommunicationSeriveFromAAI *****") + } + + /** + * query AAI + * @param execution + * @param aaiObjectType + * @param instanceId + * @return AAIResultWrapper + */ + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) + { + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) + if (!getAAIClient().exists(resourceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) + } + AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) + return wrapper + } + + + /** + * 再次调用deleteE2EServiceInstance接口,然后获取到operationid, + */ + void sendRequest2NSMFWF(DelegateExecution execution) { + LOGGER.trace("begin preRequestSend2NSMF") + try { + //url:/onap/so/infra/e2eServiceInstances/v3/{serviceInstanceId}" + def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) + String url = "${NSMF_endpoint}/e2eServiceInstances/v3/${execution.getVariable("e2eSliceServiceInstanceId")}" + + String requestBody = """ + { + "globalSubscriberId": "${execution.getVariable("globalSubscriberId")}", + "serviceType": "${execution.getVariable("serviceType")}" + } + """ + requestBody.replaceAll("\\s+", "") + + String basicAuthValue = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) + HttpClient httpClient = new HttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) + httpClient.addAdditionalHeader("Authorization", basicAuthValue) + httpClient.addAdditionalHeader("Accept", "application/json") + Response httpResponse = httpClient.delete(requestBody) + handleNSSMFWFResponse(httpResponse, execution) + + } catch (BpmnError e) { + throw e + } catch (any) { + String msg = "Exception in DeleteCommunicationService.preRequestSend2NSMF. " + any.getCause() + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + LOGGER.trace("exit preRequestSend2NSMF") + } + + /** + * prepare update operation status + * @param execution + */ + private void handleNSSMFWFResponse(Response httpResponse, DelegateExecution execution){ + LOGGER.debug(" ======== STARTED prepareUpdateOperationStatus Process ======== ") + + int nsmfResponseCode = httpResponse.getStatus() + LOGGER.debug("nsmfResponseCode${nsmfResponseCode}") + + if (nsmfResponseCode >= 200 && nsmfResponseCode < 204 && httpResponse.hasEntity()) { + String nsmfResponse = httpResponse.readEntity(String.class) + def e2eOperationId = jsonUtil.getJsonValue(nsmfResponse, "operationId") + execution.setVariable("e2eOperationId", e2eOperationId) + execution.setVariable("progress","20") + execution.setVariable("operationContent","waiting nsmf service delete finished") + + execution.setVariable("currentCycle",0) + execution.setVariable("isNSMFTimeOut", "no") + execution.setVariable("isNSMFWFRspSucceed","yes") + } + else + { + String serviceName = execution.getVariable("serviceInstanceName") + execution.setVariable("progress", "100") + execution.setVariable("result", "error") + execution.setVariable("operationContent", "terminate service failure.") + execution.setVariable("reason","NSMF WF asynchronous response failed, status Code:${nsmfResponseCode}") + execution.setVariable("isNSMFWFRspSucceed","no") + LOGGER.error("nsmf async response error,nsmfResponseCode:${nsmfResponseCode},serivceName:${serviceName}") + } + setOperationStatus(execution) + LOGGER.debug("======== COMPLETED prepareUpdateOperationStatus Process ======== ") + } + + /** + * prepare to call sub process + * @param execution + */ + void prepareCallCheckProcessStatus(DelegateExecution execution) + { + LOGGER.debug(PREFIX + "prepareCallCheckProcessStatus Start") + + def successConditions = new ArrayList<>() + successConditions.add("finished") + execution.setVariable("successConditions", successConditions) + + def errorConditions = new ArrayList<>() + errorConditions.add("error") + execution.setVariable("errorConditions", errorConditions) + + execution.setVariable("processServiceType", "communication service") + execution.setVariable("subOperationType", "DELETE") + execution.setVariable("initProgress", 20) + execution.setVariable("endProgress",90) + + execution.setVariable("timeOut", TIMEOUT) + + LOGGER.debug(PREFIX + "prepareCallCheckProcessStatus Exit") + } + + /** + * delete communication profile from AAI + * @param execution + */ + void delCSProfileFromAAI(DelegateExecution execution) + { + LOGGER.debug("start delete communication service profile from AAI") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String profileId + try + { + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) + Optional<CommunicationServiceProfiles> csProfilesOpt = wrapper.asBean(CommunicationServiceProfiles.class) + if(csProfilesOpt.isPresent()){ + CommunicationServiceProfiles csProfiles = csProfilesOpt.get() + CommunicationServiceProfile csProfile = csProfiles.getCommunicationServiceProfile().get(0) + profileId = csProfile ? csProfile.getProfileId() : "" + } + resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId) + if (!getAAIClient().exists(resourceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "communication service profile was not found in aai") + } + + getAAIClient().delete(resourceUri) + LOGGER.debug("end delete communication service profile from AAI") + } + catch (any) + { + String msg = "delete communication service profile from aai failed! cause-"+any.getCause() + LOGGER.error(any.printStackTrace()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } + + /** + * delete communication service from AAI + * @param execution + */ + void delCSFromAAI(DelegateExecution execution) + { + try + { + LOGGER.debug("start delete communication service from AAI") + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId")) + getAAIClient().delete(serviceInstanceUri) + + execution.setVariable("progress", "100") + execution.setVariable("result", "finished") + execution.setVariable("operationContent", "CSMF completes service terminated.") + setOperationStatus(execution) + LOGGER.debug("end delete communication service from AAI") + } + catch (any) + { + LOGGER.error("Error occured within delCSFromAAI method, cause: ${any.getCause()} ") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during delete communication service from aai") + } + } + + void sendSyncError(DelegateExecution execution) + { + LOGGER.debug("Starting sendSyncError") + + try { + String errorMessage = "Sending Sync Error." + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + LOGGER.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + LOGGER.error("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + } + + /** + * prepare update operation status + * @param execution + */ + void preFailedOperationStatus(DelegateExecution execution) + { + LOGGER.debug(" ======== STARTED preFailedOperationStatus Process ======== ") + + execution.setVariable("progress", "100") + execution.setVariable("result", "error") + execution.setVariable("operationContent", "terminate service failure") + + WorkflowException wfex = execution.getVariable("WorkflowException") as WorkflowException + String errorMessage = wfex.getErrorMessage() + errorMessage = errorMessage.length() > 200 ? errorMessage.substring(0,200) + "......" : errorMessage + execution.setVariable("reason", errorMessage) + setOperationStatus(execution) + + LOGGER.debug("======== COMPLETED prepareEndOperationStatus Process ======== ") + } + + /** + * prepare Operation status + * @param execution + * @param operationType + */ + private void setOperationStatus(DelegateExecution execution) + { + OperationStatus operationStatus = new OperationStatus() + operationStatus.setServiceId(execution.getVariable("serviceInstanceId")) + operationStatus.setOperationId(execution.getVariable("operationId")) + operationStatus.setUserId(execution.getVariable("globalSubscriberId")) + //interface not support update + operationStatus.setServiceName(execution.getVariable("serviceInstanceName")) + operationStatus.setResult(execution.getVariable("result")) + operationStatus.setProgress(execution.getVariable("progress")) + operationStatus.setOperationContent(execution.getVariable("operationContent")) + operationStatus.setReason(execution.getVariable("reason")?:"") + operationStatus.setOperation("DELETE") + + requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus) + } + + void prepareFailureStatus(DelegateExecution execution) + { + execution.setVariable("result", "finished") + execution.setVariable("progress", "100") + execution.setVariable("operationContent", "terminate service failure.") + setOperationStatus(execution) + LOGGER.debug("${PREFIX}-prepareFailureStatus,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}") + } + + /** + * check request json and save parameter to execution + * @param siRequest + * @param paraName + * @param isErrorException + * @param execution + */ + private void checkAndSetRequestParam(String siRequest, String paraName, boolean isErrorException, DelegateExecution execution) + { + String msg = "" + String paramValue = jsonUtil.getJsonValue(siRequest, paraName) + if (isBlank(paramValue)) { + msg = "Input ${paraName} is null" + LOGGER.error(msg) + if(isErrorException) + { + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + } else { + execution.setVariable(paraName, paramValue) + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy new file mode 100644 index 0000000000..f0d43cf8d7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy @@ -0,0 +1,263 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (c) 2019, CMCC Technologies Co., Ltd. + * ================================================================================ + * 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.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceProfile +import org.onap.aai.domain.yang.ServiceProfiles +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.beans.OperationStatus +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException + +import static org.apache.commons.lang3.StringUtils.isBlank + +class DeleteSliceService extends AbstractServiceTaskProcessor { + + String Prefix="DELSS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private RequestDBUtil requestDBUtil = new RequestDBUtil() + + private static final Logger logger = LoggerFactory.getLogger( DeleteSliceService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + execution.setVariable("prefix", Prefix) + String msg = "" + + logger.trace("Starting preProcessRequest") + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + //e2eslice-service instance id + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "e2eslice-service id is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + logger.info("Input Request: ${siRequest}, reqId: ${requestId}, e2eslice-service: ${serviceInstanceId}") + + //subscriberInfo + checkAndSetRequestParam(siRequest,"globalSubscriberId",false, execution) + checkAndSetRequestParam(siRequest,"serviceType",false, execution) + checkAndSetRequestParam(siRequest,"operationId",false, execution) + + //prepare init operation status + execution.setVariable("progress", "0") + execution.setVariable("result", "processing") + execution.setVariable("operationType", "DELETE") + execution.setVariable("operationContent", "Prepare init service") + updateServiceOperationStatus(execution) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit preProcessRequest") + } + + /** + * send asynchronous response + * @param execution + */ + void sendAsyncResponse(DelegateExecution execution) { + logger.trace("Staring sendSyncResponse") + + try { + String operationId = execution.getVariable("operationId") + String syncResponse = """{"operationId":"${operationId}"}""".trim() + logger.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit sendSyncResponse") + } + + /** + * Deletes the slice service instance in aai + */ + void deleteSliceServiceInstance(DelegateExecution execution) { + logger.trace("Entered deleteSliceServiceInstance") + try { + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId")) + resourceClient.delete(serviceInstanceUri) + + execution.setVariable("progress", "100") + execution.setVariable("result", "finished") + execution.setVariable("operationContent", "NSMF completes slicing service termination.") + updateServiceOperationStatus(execution) + + logger.trace("Exited deleteSliceServiceInstance") + }catch(Exception e){ + logger.debug("Error occured within deleteSliceServiceInstance method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteSliceServiceInstance from aai") + } + } + + /** + * update operation status + * @param execution + */ + private void updateServiceOperationStatus(DelegateExecution execution){ + + OperationStatus operationStatus = new OperationStatus() + operationStatus.setServiceId(execution.getVariable("serviceInstanceId")) + operationStatus.setOperationId(execution.getVariable("operationId")) + operationStatus.setUserId(execution.getVariable("globalSubscriberId")) + operationStatus.setResult(execution.getVariable("result")) + operationStatus.setProgress(execution.getVariable("progress")) + operationStatus.setOperationContent(execution.getVariable("operationContent")) + operationStatus.setReason(execution.getVariable("reason")) + operationStatus.setOperation(execution.getVariable("operationType")) + + requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus) + } + + /** + * delete service profile from aai + * @param execution + */ + private void delServiceProfileFromAAI(DelegateExecution execution) + { + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String profileId = "" + + try + { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + Optional<ServiceProfiles> serviceProfilesOpt =wrapper.asBean(ServiceProfiles.class) + if(serviceProfilesOpt.isPresent()){ + ServiceProfiles serviceProfiles = serviceProfilesOpt.get() + ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0) + profileId = serviceProfile ? serviceProfile.getProfileId() : "" + } + resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId) + if (!resourceClient.exists(resourceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + resourceClient.delete(resourceUri) + } + catch (any) + { + String msg = "delete service profile from aai failed! cause-"+any.getCause() + logger.error(any.printStackTrace()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + } + + void sendSyncError(DelegateExecution execution) { + logger.info("Starting sendSyncError") + + try { + String errorMessage + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + logger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + logger.error("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + void prepareEndOperationStatus(DelegateExecution execution){ + logger.debug(" ======== STARTED prepareEndOperationStatus Process ======== ") + + execution.setVariable("progress", "100") + execution.setVariable("result", "error") + execution.setVariable("operationContent", "NSSMF Terminate service failure") + + WorkflowException wfex = execution.getVariable("WorkflowException") as WorkflowException + String errorMessage = wfex.getErrorMessage() + errorMessage = errorMessage.length() > 200 ? errorMessage.substring(0,200) + "......" : errorMessage + execution.setVariable("reason",errorMessage) + updateServiceOperationStatus(execution) + + logger.debug("======== COMPLETED prepareEndOperationStatus Process ======== ") + } + + /** + * check parameters from request body + * set to execution + * @param siRequest + * @param paraName + * @param isErrorException + * @param execution + */ + private void checkAndSetRequestParam(String siRequest, String paraName, boolean isErrorException, DelegateExecution execution) + { + String msg = "" + String paramValue = jsonUtil.getJsonValue(siRequest, paraName) + if (isBlank(paramValue)) { + msg = "Input ${paraName} is null" + logger.error(msg) + if(isErrorException) + { + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + } else { + execution.setVariable(paraName, paramValue) + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy new file mode 100644 index 0000000000..d5b554d841 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -0,0 +1,338 @@ +package org.onap.so.bpmn.infrastructure.scripts + +import com.google.common.reflect.TypeToken +import com.google.gson.Gson +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.AllottedResource +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipList +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceProxy +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIEdgeLabel +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.client.RequestsDbClient +import org.onap.so.db.request.beans.OrchestrationTask +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.UriBuilder + +import static org.apache.commons.lang3.StringUtils.isBlank + +class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{ + + private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSIandNSSI.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + RequestsDbClient requestsDbClient = new RequestsDbClient() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + + void preProcessRequest (DelegateExecution execution) { + String msg = "" + logger.trace("Enter preProcessRequest()") + Map<String, Object> nssiMap = new HashMap<>() + execution.setVariable("nssiMap", nssiMap) + boolean isMoreNSSTtoProcess = true + execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess) + List<String> nsstSequence = new ArrayList<>(Arrays.asList("cn")) + execution.setVariable("nsstSequence", nsstSequence) + logger.trace("Exit preProcessRequest") + } + + void retriveSliceOption(DelegateExecution execution) { + logger.trace("Enter retriveSliceOption() of DoAllocateNSIandNSSI") + String uuiRequest = execution.getVariable("uuiRequest") + boolean isNSIOptionAvailable = false + List<String> nssiAssociated = new ArrayList<>() + SliceTaskParams sliceParams = execution.getVariable("sliceTaskParams") + try + { + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.nstar0_allottedresource0_providing_service_uuid") + String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.nstar0_allottedresource0_providing_service_invariant_uuid") + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + //Params sliceParams = new Gson().fromJson(params, new TypeToken<Params>() {}.getType()); + execution.setVariable("sliceParams", sliceParams) + }catch (Exception ex) { + logger.debug( "Unable to get the task information from request DB: " + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Unable to get task information from request DB.") + } + + if(isBlank(sliceParams.getSuggestNsiId())) + { + isNSIOptionAvailable=false + } + else + { + isNSIOptionAvailable=true + execution.setVariable('nsiServiceInstanceId',sliceParams.getSuggestNsiId()) + execution.setVariable('nsiServiceInstanceName',sliceParams.getSuggestNsiName()) + } + execution.setVariable("isNSIOptionAvailable",isNSIOptionAvailable) + logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI") + } + + void updateRelationship(DelegateExecution execution) { + logger.trace("Enter update relationship in DoAllocateNSIandNSSI()") + String nsiServiceInstanceId = execution.getVariable("nsiServiceInstanceId") + String allottedResourceId = execution.getVariable("allottedResourceId") + //Need to check whether nsi exist : Begin + org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance() + SliceTaskParams sliceParams = execution.getVariable("sliceParams") + + String nsiServiceInstanceID = sliceParams.getSuggestNsiId() + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceID) + //AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.QUERY_ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceID) + + try { + AAIResultWrapper wrapper = resourceClient.get(nsiServiceuri, NotFoundException.class) + Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) + nsiServiceInstance = si.get() + //allottedResourceId=nsiServiceInstance.getAllottedResources().getAllottedResource().get(0).getId() + +// if(resourceClient.exists(nsiServiceuri)){ +// execution.setVariable("nsi_resourceLink", nsiServiceuri.build().toString()) +// }else{ +// exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " + +// "associate for service :"+serviceInstanceId) +// } + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceId, allottedResourceId) + getAAIClient().connect(allottedResourceUri,nsiServiceuri) + + List<String> nssiAssociated = new ArrayList<>() + RelationshipList relationshipList = nsiServiceInstance.getRelationshipList() + List<Relationship> relationships = relationshipList.getRelationship() + for(Relationship relationship in relationships) + { + if(relationship.getRelatedTo().equalsIgnoreCase("service-instance")) + { + String NSSIassociated = relationship.getRelatedLink().substring(relationship.getRelatedLink().lastIndexOf("/") + 1); + if(!NSSIassociated.equals(nsiServiceInstanceID)) + nssiAssociated.add(NSSIassociated) + } + } + execution.setVariable("nssiAssociated",nssiAssociated) + execution.setVariable("nsiServiceInstanceName",nsiServiceInstance.getServiceInstanceName()) + logger.trace("Exit update relationship in DoAllocateNSIandNSSI()") + } + + void prepareNssiModelInfo(DelegateExecution execution){ + logger.trace("Enter prepareNssiModelInfo in DoAllocateNSIandNSSI()") + List<String> nssiAssociated = new ArrayList<>() + Map<String, Object> nssiMap = new HashMap<>() + nssiAssociated=execution.getVariable("nssiAssociated") + for(String nssiID in nssiAssociated) + { + try { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nssiID) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) + org.onap.aai.domain.yang.ServiceInstance nssi = si.get() + nssiMap.put(nssi.getEnvironmentContext(),"""{ + "serviceInstanceId":"${nssi.getServiceInstanceId()}", + "modelUuid":"${nssi.getModelVersionId()}" + }""") + + }catch(NotFoundException e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiID) + }catch(Exception e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiID) + } + execution.setVariable("nssiMap",nssiMap) + + } + logger.trace("Exit prepareNssiModelInfo in DoAllocateNSIandNSSI()") + } + + void createNSIinAAI(DelegateExecution execution) { + logger.trace("Enter CreateNSIinAAI in DoAllocateNSIandNSSI()") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + org.onap.aai.domain.yang.ServiceInstance nsi = new ServiceInstance(); + String sliceInstanceId = UUID.randomUUID().toString() + execution.setVariable("sliceInstanceId",sliceInstanceId) + nsi.setServiceInstanceId(sliceInstanceId) + String sliceInstanceName = "nsi_"+execution.getVariable("serviceInstanceName") + nsi.setServiceInstanceName(sliceInstanceName) + String serviceType = execution.getVariable("serviceType") + nsi.setServiceType(serviceType) + String serviceStatus = "deactivated" + nsi.setOrchestrationStatus(serviceStatus) + String modelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() + String modelUuid = serviceDecomposition.getModelInfo().getModelUuid() + nsi.setModelInvariantId(modelInvariantUuid) + nsi.setModelVersionId(modelUuid) + String uuiRequest = execution.getVariable("uuiRequest") + String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList") + nsi.setServiceInstanceLocationId(serviceInstanceLocationid) + //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.requestInputs.snssai") + //nsi.setEnvironmentContext(snssai) + String serviceRole = "nsi" + nsi.setServiceRole(serviceRole) + try { + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceInstanceId) + client.create(uri, nsi) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + Map<String, Object> nssiMap = new HashMap<>() + List<ServiceProxy> serviceProxyList = serviceDecomposition.getServiceProxy() + List<String> nsstModelInfoList = new ArrayList<>() + for(ServiceProxy serviceProxy : serviceProxyList) + { + //String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid() + String nsstModelUuid = serviceProxy.getSourceModelUuid() + //String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid() + String nsstServiceModelInfo = """{ + "modelInvariantUuid":"", + "modelUuid":"${nsstModelUuid}", + "modelVersion":"" + }""" + nsstModelInfoList.add(nsstServiceModelInfo) + } + int currentIndex=0 + int maxIndex=nsstModelInfoList.size() + if(maxIndex < 1) + { + msg = "Exception in DoAllocateNSIandNSSI. There is no NSST associated with NST " + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + execution.setVariable("nsstModelInfoList",nsstModelInfoList) + execution.setVariable("currentIndex",currentIndex) + execution.setVariable("maxIndex",maxIndex) + execution.setVariable('nsiServiceInstanceId',sliceInstanceId) + execution.setVariable("nsiServiceInstanceName",sliceInstanceName) + logger.trace("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()") + } + + void getOneNsstInfo(DelegateExecution execution){ + List<String> nsstModelInfoList = new ArrayList<>() + nsstModelInfoList = execution.getVariable("nsstModelInfoList") + int currentIndex = execution.getVariable("currentIndex") + int maxIndex = execution.getVariable("maxIndex") + boolean isMoreNSSTtoProcess = true + String nsstServiceModelInfo = nsstModelInfoList.get(currentIndex) + execution.setVariable("serviceModelInfo", nsstServiceModelInfo) + execution.setVariable("currentIndex", currentIndex) + currentIndex = currentIndex+1 + if(currentIndex <= maxIndex ) + isMoreNSSTtoProcess = false + execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess) + } + + void createNSSTMap(DelegateExecution execution){ + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String modelUuid= serviceDecomposition.getModelInfo().getModelUuid() + String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() + //String nsstID = jsonUtil.getJsonValue(content, "metadata.id") + //String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") + //String type = jsonUtil.getJsonValue(content, "metadata.type") + String domain = jsonUtil.getJsonValue(content, "metadata.domainType") + + Map<String, Object> nssiMap = execution.getVariable("nssiMap") + String servicename = execution.getVariable("serviceInstanceName") + String nsiname = "nsi_"+servicename + nssiMap.put(domain,"""{ + "serviceInstanceId":"", + "modelUuid":"${modelUuid}" + }""") + execution.setVariable("nssiMap",nssiMap) + } + + void prepareNSSIList(DelegateExecution execution){ + logger.trace("Enter prepareNSSIList in DoAllocateNSIandNSSI()") + Map<String, Object> nssiMap = new HashMap<>() + Boolean isMoreNSSI = false + nssiMap = execution.getVariable("nssiMap") + List<String> keys=new ArrayList<String>(nssiMap.values()) + List<String> nsstSequence = execution.getVariable("nsstSequence") + Integer currentIndex=0; + execution.setVariable("currentNssiIndex",currentIndex) + Integer maxIndex=keys.size() + execution.setVariable("maxIndex",maxIndex) + if(maxIndex>0) + isMoreNSSI=true + execution.setVariable("isMoreNSSI",isMoreNSSI) + logger.trace("Exit prepareNSSIList in DoAllocateNSIandNSSI()") + } + + + void getOneNSSIInfo(DelegateExecution execution){ + logger.trace("Enter getOneNSSIInfo in DoAllocateNSIandNSSI()") + + //ServiceDecomposition serviceDecompositionObj = execution.getVariable("serviceDecompositionObj") + Map<String, Object> nssiMap=execution.getVariable("nssiMap") + List<String> nsstSequence = execution.getVariable("nsstSequence") + String currentNSST= nsstSequence.get(execution.getVariable("currentNssiIndex")) + boolean isNSSIOptionAvailable = false + String nsstInput=nssiMap.get(currentNSST) + execution.setVariable("nsstInput",nsstInput) + String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid") + String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") + String nssiserviceModelInfo = """{ + "modelInvariantUuid":"", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + Integer currentIndex = execution.getVariable("currentNssiIndex") + currentIndex=currentIndex+1; + execution.setVariable("currentNssiIndex",currentIndex) + execution.setVariable("nssiserviceModelInfo",nssiserviceModelInfo) + execution.setVariable("nssiInstanceId",nssiInstanceId) + logger.trace("Exit getOneNSSIInfo in DoAllocateNSIandNSSI()") + } + + void updateCurrentIndex(DelegateExecution execution){ + + logger.trace("Enter updateCurrentIndex in DoAllocateNSIandNSSI()") + Integer currentIndex = execution.getVariable("currentNssiIndex") + Integer maxIndex = execution.getVariable("maxIndex") + if(currentIndex>=maxIndex) + { + Boolean isMoreNSSI=false + execution.setVariable("isMoreNSSI",isMoreNSSI) + } + logger.trace("Exit updateCurrentIndex in DoAllocateNSIandNSSI()") + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy new file mode 100644 index 0000000000..d786cb0ba1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy @@ -0,0 +1,771 @@ +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.SliceProfile +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.beans.nsmf.AllocateAnNssi +import org.onap.so.beans.nsmf.AllocateCnNssi +import org.onap.so.beans.nsmf.AllocateTnNssi +import org.onap.so.beans.nsmf.AnSliceProfile +import org.onap.so.beans.nsmf.CnSliceProfile +import org.onap.so.beans.nsmf.EsrInfo +import org.onap.so.beans.nsmf.JobStatusRequest +import org.onap.so.beans.nsmf.NetworkType +import org.onap.so.beans.nsmf.NsiInfo +import org.onap.so.beans.nsmf.NssiAllocateRequest +import org.onap.so.beans.nsmf.PerfReq +import org.onap.so.beans.nsmf.PerfReqEmbbList +import org.onap.so.beans.nsmf.PerfReqUrllcList +import org.onap.so.beans.nsmf.ResourceSharingLevel +import org.onap.so.beans.nsmf.ServiceProfile +import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.beans.nsmf.TnSliceProfile +import org.onap.so.beans.nsmf.UeMobilityLevel +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIEdgeLabel +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import com.fasterxml.jackson.databind.ObjectMapper; +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.isBlank + + +class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{ + + private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSSI.class); + private static final ObjectMapper MAPPER = new ObjectMapper(); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + void preProcessRequest (DelegateExecution execution) { + logger.trace("Enter preProcessRequest()") + String msg = "" + String nssmfOperation = "" + String msoRequestId = execution.getVariable("msoRequestId") + String nsstInput = execution.getVariable("nsstInput") + String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid") + //modelUuid="2763777c-27bd-4df7-93b8-c690e23f4d3f" + String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") + String serviceModelInfo = """{ + "modelInvariantUuid":"", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo",serviceModelInfo) + execution.setVariable("nssiInstanceId",nssiInstanceId) + String nssiProfileID = UUID.randomUUID().toString() + execution.setVariable("nssiProfileID",nssiProfileID) + if(isBlank(nssiInstanceId)) + { + nssmfOperation="create" + nssiInstanceId = UUID.randomUUID().toString() + }else { + nssmfOperation = "update" + } + execution.setVariable("nssmfOperation",nssmfOperation) + execution.setVariable("nssiInstanceId",nssiInstanceId) + + def isDebugLogEnabled ="false" + def isNSSICreated = false + execution.setVariable("isNSSICreated",isNSSICreated) + + int currentCycle = 0 + execution.setVariable("currentCycle", currentCycle) + + logger.trace("Exit preProcessRequest") + } + + + void getNSSTInfo(DelegateExecution execution){ + logger.trace("Enter getNSSTInfo in DoAllocateNSSI()") + ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + ModelInfo modelInfo = serviceDecomposition.getModelInfo() + String serviceRole = "nssi" + String nssiServiceInvariantUuid = serviceDecomposition.modelInfo.getModelInvariantUuid() + String nssiServiceUuid = serviceDecomposition.modelInfo.getModelUuid() + String nssiServiceType = serviceDecomposition.getServiceType() + String uuiRequest = execution.getVariable("uuiRequest") + String nssiServiceName = "nssi_"+jsonUtil.getJsonValue(uuiRequest, "service.name") + execution.setVariable("nssiServiceName",nssiServiceName) + execution.setVariable("nssiServiceType",nssiServiceType) + execution.setVariable("nssiServiceInvariantUuid",nssiServiceInvariantUuid) + execution.setVariable("nssiServiceUuid",nssiServiceUuid) + execution.setVariable("serviceRole",serviceRole) + + String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() + String nsstID = jsonUtil.getJsonValue(content, "metadata.id") + String nsstVendor = jsonUtil.getJsonValue(content, "metadata.vendor") + String nsstDomain = jsonUtil.getJsonValue(content, "metadata.domainType") + String nsstType = jsonUtil.getJsonValue(content, "metadata.type") + + execution.setVariable("nsstID",nsstID) + execution.setVariable("nsstVendor",nsstVendor) + execution.setVariable("nsstDomain",nsstDomain) + execution.setVariable("nssiServiceUuid",nssiServiceUuid) + execution.setVariable("nsstType",nsstType) + + String nsstContentInfo = """{ + "NsstID":"${nsstID}", + "Vendor":"${nsstVendor}", + "type":"${nsstType}" + }""" + + logger.trace("Exit getNSSTInfo in DoAllocateNSSI()") + } + + void timeDelay(DelegateExecution execution) { + logger.trace("Enter timeDelay in DoAllocateNSSI()") + try { + Thread.sleep(60000); + int currentCycle = execution.getVariable("currentCycle") + currentCycle=currentCycle+1 + if(currentCycle>60) + { + logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...") + } + execution.setVariable("currentCycle",currentCycle) + } catch(InterruptedException e) { + logger.info("Time Delay exception" + e) + } + logger.trace("Exit timeDelay in DoAllocateNSSI()") + } + + + void sendUpdateRequestNSSMF(DelegateExecution execution) { + logger.trace("Enter sendUpdateRequestNSSMF in DoAllocateNSSI()") + String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution) + logger.debug( "get NSSMF: " + urlString) + + //Prepare auth for NSSMF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.nssmf.auth", execution) + String domain = execution.getVariable("nsstDomain") + String nssmfRequest = buildUpdateNSSMFRequest(execution, domain.toUpperCase()) + + //send request to update NSSI option - Begin + URL url = new URL(urlString+"/api/rest/provMns/v1/NSS/SliceProfiles") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(nssmfRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF sync response code is: " + responseCode) + + if(responseCode < 199 && responseCode > 299){ + String nssmfResponse ="NSSMF response have nobody" + if(httpResponse.hasEntity()) + nssmfResponse = httpResponse.readEntity(String.class) + logger.trace("received error message from NSSMF : "+nssmfResponse) + logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + + if(httpResponse.hasEntity()){ + String nssmfResponse = httpResponse.readEntity(String.class) + execution.setVariable("nssmfResponse", nssmfResponse) + String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId") + String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId") + execution.setVariable("nssiId",nssiId) + execution.setVariable("jobId",jobId) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + logger.trace("Exit sendUpdateRequestNSSMF in DoAllocateNSSI()") + } + + void sendCreateRequestNSSMF(DelegateExecution execution) { + logger.trace("Enter sendCreateRequestNSSMF in DoAllocateNSSI()") + String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution) + logger.debug( "get NSSMF: " + urlString) + + //Prepare auth for NSSMF - Begin + String domain = execution.getVariable("nsstDomain") + String nssmfRequest = buildCreateNSSMFRequest(execution, domain.toUpperCase()) + + //send request to get NSI option - Begin + URL url = new URL(urlString+"/api/rest/provMns/v1/NSS/SliceProfiles") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(nssmfRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF sync response code is: " + responseCode) + + if(responseCode < 199 || responseCode > 299 ){ + String nssmfResponse ="NSSMF response have nobody" + if(httpResponse.hasEntity()) + nssmfResponse = httpResponse.readEntity(String.class) + logger.trace("received error message from NSSMF : "+nssmfResponse) + logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + + if(httpResponse.hasEntity()){ + String nssmfResponse = httpResponse.readEntity(String.class) + execution.setVariable("nssmfResponse", nssmfResponse) + String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId") + String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId") + execution.setVariable("nssiId",nssiId) + execution.setVariable("jobId",jobId) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") + + } + + void getNSSMFProgresss(DelegateExecution execution) { + logger.trace("Enter getNSSMFProgresss in DoAllocateNSSI()") + + String endpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution) + logger.debug( "get NSSMF: " + endpoint) + + //Prepare auth for NSSMF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.nssmf.auth", execution) + + String nssmfRequest = buildNSSMFProgressRequest(execution) + String strUrl="/api/rest/provMns/v1/NSS/jobs/"+execution.getVariable("jobId") + //send request to update NSSI option - Begin + URL url = new URL(endpoint+strUrl) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(nssmfRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF sync response code is: " + responseCode) + + if(responseCode < 199 || responseCode > 299){ + String nssmfResponse ="NSSMF response have nobody" + if(httpResponse.hasEntity()) + nssmfResponse = httpResponse.readEntity(String.class) + logger.trace("received error message from NSSMF : "+nssmfResponse) + logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + + if(httpResponse.hasEntity()){ + String nssmfResponse = httpResponse.readEntity(String.class) + Boolean isNSSICreated = false + execution.setVariable("nssmfResponse", nssmfResponse) + Integer progress = java.lang.Integer.parseInt(jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.progress")) + String status = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.status") + String statusDescription = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.statusDescription") + execution.setVariable("nssmfProgress",progress) + execution.setVariable("nssmfStatus",status) + execution.setVariable("nddmfStatusDescription",statusDescription) + if(progress>99) + isNSSICreated = true + execution.setVariable("isNSSICreated",isNSSICreated) + + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + logger.trace("Exit getNSSMFProgresss in DoAllocateNSSI()") + + } + + void updateRelationship(DelegateExecution execution) { + logger.trace("Enter updateRelationship in DoAllocateNSSI()") + String nssiInstanceId = execution.getVariable("nssiInstanceId") + String nsiInstanceId = execution.getVariable("nsiServiceInstanceId") + try{ + AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nsiInstanceId); + AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId) + getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF); + }catch(Exception ex) { + String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit updateRelationship in DoAllocateNSSI()") + } + + + void instantiateNSSIService(DelegateExecution execution) { + logger.trace("Enter instantiateNSSIService in DoAllocateNSSI()") + //String nssiInstanceId = execution.getVariable("nssiInstanceId") + String nssiInstanceId = execution.getVariable("nssiId") + execution.setVariable("nssiInstanceId",nssiInstanceId) + String sliceInstanceId = execution.getVariable("nsiServiceInstanceId") + try { + org.onap.aai.domain.yang.ServiceInstance nssi = new ServiceInstance(); + Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") + + nssi.setServiceInstanceId(nssiInstanceId) + nssi.setServiceInstanceName(execution.getVariable("nssiServiceName")) + //nssi.setServiceType(execution.getVariable("nssiServiceType")) + nssi.setServiceType(serviceProfileMap.get("sST").toString()) + String serviceStatus = "deactivated" + nssi.setOrchestrationStatus(serviceStatus) + String modelInvariantUuid = execution.getVariable("nssiServiceInvariantUuid") + String modelUuid = execution.getVariable("nssiServiceUuid") + nssi.setModelInvariantId(modelInvariantUuid) + nssi.setModelVersionId(modelUuid) + String uuiRequest = execution.getVariable("uuiRequest") + String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList") + nssi.setServiceInstanceLocationId(serviceInstanceLocationid) + //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.sNSSAI") + String envContext=execution.getVariable("nsstDomain") + nssi.setEnvironmentContext(envContext) + nssi.setServiceRole(execution.getVariable("serviceRole")) + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nssiInstanceId) + client.create(uri, nssi) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + try{ + AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceInstanceId); + AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId) + getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF); + }catch(Exception ex) { + String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + + + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData(); + } + //rollbackData.put("SERVICEINSTANCE", "disableRollback", idisableRollback.toStrng()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", nssiInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + execution.setVariable("RollbackData", rollbackData) + logger.debug("RollbackData:" + rollbackData) + logger.trace("Exit instantiateNSSIService in DoAllocateNSSI()") + } + + + void createSliceProfile(DelegateExecution execution) { + logger.trace("Enter createSliceProfile in DoAllocateNSSI()") + String sliceserviceInstanceId = execution.getVariable("nssiInstanceId") + String nssiProfileID = execution.getVariable("nssiProfileID") + Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn") + Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") + SliceProfile sliceProfile = new SliceProfile() + sliceProfile.setServiceAreaDimension("") + sliceProfile.setPayloadSize(0) + sliceProfile.setJitter(0) + sliceProfile.setSurvivalTime(0) + //sliceProfile.setCsAvailability() + //sliceProfile.setReliability() + sliceProfile.setExpDataRate(0) + sliceProfile.setTrafficDensity(0) + sliceProfile.setConnDensity(0) + sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString())) + sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString())) + sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString())) + sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString()) + sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString()) + sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString()) + sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString())) + sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString())) + sliceProfile.setProfileId(nssiProfileID) + sliceProfile.setE2ELatency(0) + + try { + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, + execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, nssiProfileID) + client.create(uri, sliceProfile) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData(); + } + //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", sliceserviceInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("serviceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + execution.setVariable("RollbackData", rollbackData) + logger.debug("RollbackData:" + rollbackData) + logger.trace("Exit createSliceProfile in DoAllocateNSSI()") + } + + + String buildCreateNSSMFRequest(DelegateExecution execution, String domain) { + + NssiAllocateRequest request = new NssiAllocateRequest() + String strRequest = "" + //String uuiRequest = execution.getVariable("uuiRequest") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + + switch (domain) { + case "AN": + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(execution.getVariable("networkType")) + esrInfo.setVendor(execution.getVariable("nsstVendor")) + + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) + nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + + AnSliceProfile anSliceProfile = new AnSliceProfile() + anSliceProfile.setLatency(execution.getVariable("latency")) + anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList")) + anSliceProfile.setQi(execution.getVariable("qi")) + + AllocateAnNssi allocateAnNssi = new AllocateAnNssi() + allocateAnNssi.setNsstId(execution.getVariable("nsstId")) + allocateAnNssi.setNssiName(execution.getVariable("nssiName")) + allocateAnNssi.setNsiInfo(nsiInfo) + allocateAnNssi.setSliceProfile(anSliceProfile) + String anScriptName = sliceTaskParams.getAnScriptName() + allocateAnNssi.setScriptName(anScriptName) + + request.setAllocateAnNssi(allocateAnNssi) + request.setEsrInfo(esrInfo) + break; + case "CN": + Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId")) + nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName")) + + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(NetworkType.fromString(domain)) + esrInfo.setVendor(execution.getVariable("nsstVendor")) + execution.setVariable("esrInfo",esrInfo) + + + PerfReqEmbbList perfReqEmbb = new PerfReqEmbbList() + perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor")) + perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL")) + perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL")) + perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL")) + perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL")) + + List<PerfReqEmbbList> listPerfReqEmbbList = new ArrayList<>() + listPerfReqEmbbList.add(perfReqEmbb) + + PerfReq perfReq = new PerfReq() + perfReq.setPerfReqEmbbList(listPerfReqEmbbList) + + PerfReqUrllcList perfReqUrllc = new PerfReqUrllcList() + perfReqUrllc.setConnDensity(0) + perfReqUrllc.setTrafficDensity(0) + perfReqUrllc.setExpDataRate(0) + perfReqUrllc.setReliability(0) + perfReqUrllc.setCsAvailability(0) + perfReqUrllc.setSurvivalTime(0) + perfReqUrllc.setJitter(0) + perfReqUrllc.setE2eLatency(0) + perfReqUrllc.setPayloadSize("0") + perfReqUrllc.setServiceAreaDimension("") + + List<PerfReqUrllcList> perfReqUrllcList = new ArrayList<>() + perfReqUrllcList.add(perfReqUrllc) + perfReq.setPerfReqUrllcList(perfReqUrllcList) + + CnSliceProfile cnSliceProfile = new CnSliceProfile() + cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID")) + String plmnStr = serviceProfile.get("plmnIdList") + List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|")) + cnSliceProfile.setPlmnIdList(plmnIdList) + + String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString() + cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel)) + + String coverageArea = serviceProfile.get("coverageAreaTAList") + List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|")) + cnSliceProfile.setCoverageAreaTAList(coverageAreaList) + + String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString() + cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel)) + + int latency = serviceProfile.get("latency") + cnSliceProfile.setLatency(latency) + + int maxUE = serviceProfile.get("maxNumberofUEs") + cnSliceProfile.setMaxNumberofUEs(maxUE) + + String snssai = serviceProfile.get("sNSSAI") + List<String> snssaiList = Arrays.asList(snssai.split("\\|")) + cnSliceProfile.setSnssaiList(snssaiList) + + cnSliceProfile.setPerfReq(perfReq) + + AllocateCnNssi allocateCnNssi = new AllocateCnNssi() + allocateCnNssi.setNsstId(execution.getVariable("nsstid")) + allocateCnNssi.setNssiName(execution.getVariable("nssiName")) + allocateCnNssi.setSliceProfile(cnSliceProfile) + allocateCnNssi.setNsiInfo(nsiInfo) + String cnScriptName = sliceTaskParams.getCnScriptName() + allocateCnNssi.setScriptName(cnScriptName) + request.setAllocateCnNssi(allocateCnNssi) + request.setEsrInfo(esrInfo) + break; + case "TN": + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(execution.getVariable("networkType")) + esrInfo.setVendor(execution.getVariable("vendor")) + + TnSliceProfile tnSliceProfile = new TnSliceProfile() + tnSliceProfile.setLatency(execution.getVariable("latency")) + tnSliceProfile.setBandwidth(execution.getVariable("bandWidth")) + + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) + nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + + AllocateTnNssi allocateTnNssi = new AllocateTnNssi() + allocateTnNssi.setSliceProfile(tnSliceProfile) + allocateTnNssi.setNsiInfo(nsiInfo) + allocateTnNssi.setNsstId(execution.getVariable("nsstid")) + String tnScriptName = sliceTaskParams.getTnScriptName() + allocateTnNssi.setScriptName(tnScriptName) + + request.setAllocateTnNssi(allocateTnNssi) + request.setEsrInfo(esrInfo) + break; + default: + break; + } + try { + strRequest = MAPPER.writeValueAsString(request); + } catch (IOException e) { + logger.error("Invalid get progress request bean to convert as string"); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") + } + return strRequest + } + + + String buildUpdateNSSMFRequest(DelegateExecution execution, String domain) { + NssiAllocateRequest request = new NssiAllocateRequest() + String nsstInput = execution.getVariable("nsstInput") + String nssiId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") + String strRequest = "" + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + switch (domain) { + case "AN": + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(execution.getVariable("nsstType")) + esrInfo.setVendor(execution.getVariable("vendor")) + + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) + nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + + AnSliceProfile anSliceProfile = new AnSliceProfile() + anSliceProfile.setLatency(execution.getVariable("latency")) + anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList")) + anSliceProfile.setQi(execution.getVariable("qi")) + + AllocateAnNssi allocateAnNssi = new AllocateAnNssi() + allocateAnNssi.setNsstId(execution.getVariable("nsstId")) + allocateAnNssi.setNssiName(execution.getVariable("nssiName")) + allocateAnNssi.setNsiInfo(nsiInfo) + allocateAnNssi.setSliceProfile(anSliceProfile) + String anScriptName = sliceTaskParams.getAnScriptName() + allocateAnNssi.setScriptName(anScriptName) + request.setAllocateAnNssi(allocateAnNssi) + request.setEsrInfo(esrInfo) + break; + case "CN": + Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId")) + nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName")) + + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(NetworkType.fromString(domain)) + esrInfo.setVendor(execution.getVariable("nsstVendor")) + execution.setVariable("esrInfo",esrInfo) + + + PerfReqEmbbList perfReqEmbb = new PerfReqEmbbList() + perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor")) + perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL")) + perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL")) + perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL")) + perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL")) + + List<PerfReqEmbbList> listPerfReqEmbbList = new ArrayList<>() + listPerfReqEmbbList.add(perfReqEmbb) + + PerfReq perfReq = new PerfReq() + perfReq.setPerfReqEmbbList(listPerfReqEmbbList) + + PerfReqUrllcList perfReqUrllc = new PerfReqUrllcList() + perfReqUrllc.setConnDensity(0) + perfReqUrllc.setTrafficDensity(0) + perfReqUrllc.setExpDataRate(0) + perfReqUrllc.setReliability(0) + perfReqUrllc.setCsAvailability(0) + perfReqUrllc.setSurvivalTime(0) + perfReqUrllc.setJitter(0) + perfReqUrllc.setE2eLatency(0) + perfReqUrllc.setPayloadSize("0") + perfReqUrllc.setServiceAreaDimension("") + + List<PerfReqUrllcList> perfReqUrllcList = new ArrayList<>() + perfReqUrllcList.add(perfReqUrllc) + perfReq.setPerfReqUrllcList(perfReqUrllcList) + + CnSliceProfile cnSliceProfile = new CnSliceProfile() + cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID")) + String plmnStr = serviceProfile.get("plmnIdList") + List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|")) + cnSliceProfile.setPlmnIdList(plmnIdList) + + String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString() + cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel)) + + String coverageArea = serviceProfile.get("coverageAreaTAList") + List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|")) + cnSliceProfile.setCoverageAreaTAList(coverageAreaList) + + String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString() + cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel)) + + int latency = serviceProfile.get("latency") + cnSliceProfile.setLatency(latency) + + int maxUE = serviceProfile.get("maxNumberofUEs") + cnSliceProfile.setMaxNumberofUEs(maxUE) + + String snssai = serviceProfile.get("sNSSAI") + List<String> snssaiList = Arrays.asList(snssai.split("\\|")) + cnSliceProfile.setSnssaiList(snssaiList) + + cnSliceProfile.setPerfReq(perfReq) + + AllocateCnNssi allocateCnNssi = new AllocateCnNssi() + allocateCnNssi.setNsstId(execution.getVariable("nsstid")) + allocateCnNssi.setNssiName(execution.getVariable("nssiName")) + allocateCnNssi.setSliceProfile(cnSliceProfile) + allocateCnNssi.setNsiInfo(nsiInfo) + allocateCnNssi.setNssiId(nssiId) // need to check this + String cnScriptName = sliceTaskParams.getCnScriptName() + allocateCnNssi.setScriptName(cnScriptName) + request.setAllocateCnNssi(allocateCnNssi) + request.setEsrInfo(esrInfo) + break; + case "TN": + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(execution.getVariable("networkType")) + esrInfo.setVendor(execution.getVariable("vendor")) + + TnSliceProfile tnSliceProfile = new TnSliceProfile() + tnSliceProfile.setLatency(execution.getVariable("latency")) + tnSliceProfile.setBandwidth(execution.getVariable("bandWidth")) + + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) + nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + + AllocateTnNssi allocateTnNssi = new AllocateTnNssi() + allocateTnNssi.setSliceProfile(tnSliceProfile) + allocateTnNssi.setNsiInfo(nsiInfo) + allocateTnNssi.setNsstId(execution.getVariable("nsstid")) + String tnScriptName = sliceTaskParams.getTnScriptName() + allocateTnNssi.setScriptName(tnScriptName) + request.setAllocateTnNssi(allocateTnNssi) + request.setEsrInfo(esrInfo) + break; + default: + break; + } + try { + strRequest = MAPPER.writeValueAsString(request); + } catch (IOException e) { + logger.error("Invalid get progress request bean to convert as string"); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") + } + return strRequest + } + + String buildNSSMFProgressRequest(DelegateExecution execution){ + JobStatusRequest request = new JobStatusRequest() + String strRequest = "" + EsrInfo esrInfo = execution.getVariable("esrInfo") + request.setNsiId(execution.getVariable("nsiServiceInstanceId")) + request.setNssiId(execution.getVariable("nssiId")) + request.setEsrInfo(esrInfo) + + try { + strRequest = MAPPER.writeValueAsString(request); + } catch (IOException e) { + logger.error("Invalid get progress request bean to convert as string"); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") + } + return strRequest + } + + public void prepareUpdateOrchestrationTask(DelegateExecution execution) { + logger.debug("Start prepareUpdateOrchestrationTask progress") + String requestMethod = "PUT" + String progress = execution.getVariable("nssmfProgress") + String status = execution.getVariable("nssmfStatus") + String statusDescription=execution.getVariable("nddmfStatusDescription") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + String domain = execution.getVariable("nsstDomain") + switch (domain.toUpperCase()) { + case "AN": + sliceTaskParams.setAnProgress(progress) + sliceTaskParams.setAnStatus(status) + sliceTaskParams.setAnStatusDescription(statusDescription) + break; + case "CN": + sliceTaskParams.setCnProgress(progress) + sliceTaskParams.setCnStatus(status) + sliceTaskParams.setCnStatusDescription(statusDescription) + break; + case "TN": + sliceTaskParams.setTnProgress(progress) + sliceTaskParams.setTnStatus(status) + sliceTaskParams.setTnStatusDescription(statusDescription) + break; + default: + break; + } + String paramJson = sliceTaskParams.convertToJson() + execution.setVariable("CSSOT_paramJson", paramJson) + execution.setVariable("CSSOT_requestMethod", requestMethod) + logger.debug("Finish prepareUpdateOrchestrationTask progress") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy new file mode 100644 index 0000000000..fb4bd158b7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy @@ -0,0 +1,210 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.CommunicationServiceProfile +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +class DoCreateCommunicationService extends AbstractServiceTaskProcessor{ + String Prefix="DCCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + AAIResourcesClient client = new AAIResourcesClient() + + private static final Logger logger = LoggerFactory.getLogger( DoCreateCommunicationService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + logger.trace("start preProcessRequest") + execution.setVariable("prefix", Prefix) + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + + } catch(BpmnError e) { + throw e + } catch(Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit preProcessRequest") + } + + /** + * create communication service, generate S-NSSAI Id and communication service profile + * 1.create communication service profile + * + */ + def createCommunicationServiceProfile = { DelegateExecution execution -> + logger.trace("createCSandServiceProfile") + String msg = "" + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + try { + // String sNSSAI_id = execution.getVariable("sNSSAI_id") + // create communication service profile + String profileId = UUID.randomUUID().toString() + execution.setVariable("communicationProfileId", profileId) + + def csInputMap = execution.getVariable("csInputMap") as Map<String, ?> + Integer latency = csInputMap.get("latency") as Integer + Integer maxNumberOfUEs = csInputMap.get("maxNumberofUEs") as Integer + Integer expDataRateDL = csInputMap.get("expDataRateDL") as Integer + Integer expDataRateUL = csInputMap.get("expDataRateUL") as Integer + String coverageArea = csInputMap.get("coverageAreaTAList") + String uEMobilityLevel = csInputMap.get("uEMobilityLevel") + String resourceSharingLevel = csInputMap.get("resourceSharingLevel") + + CommunicationServiceProfile csp = new CommunicationServiceProfile() + csp.setProfileId(profileId) + + csp.setLatency(latency) + csp.setMaxNumberOfUEs(maxNumberOfUEs) + csp.setUeMobilityLevel(uEMobilityLevel) + csp.setResourceSharingLevel(resourceSharingLevel) + csp.setExpDataRateDL(expDataRateDL) + csp.setExpDataRateUL(expDataRateUL) + csp.setCoverageAreaList(coverageArea) + + execution.setVariable("communicationServiceInstanceProfile", csp) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, + globalSubscriberId, + subscriptionServiceType, + serviceInstanceId, + profileId + ) + client.create(uri, csp) + + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in createCSandServiceProfile " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("exit createCSandServiceProfile") + } + + + /** + * create communication service, generate S-NSSAI Id + * 1.generate S-NSSAI Id + * 2.create communication service + * + */ + def createCommunicationService = { DelegateExecution execution -> + logger.trace("create communication service") + String msg + String serviceInstanceId = execution.getVariable("serviceInstanceId") + try { + //generate S-NSSAI Id and communication service profile + String sNSSAI_id = generateNSSAI(serviceInstanceId) + + execution.setVariable("sNSSAI_id", sNSSAI_id) + // 创建service + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String csServiceType = execution.getVariable("csServiceType") + String aaiServiceRole = "communication-service" //待确定 + + String oStatus = "processing" + String uuiRequest = execution.getVariable("uuiRequest") + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("modelUuid") + String useInterval = execution.getVariable("useInterval") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + + // create service + ServiceInstance csi = new ServiceInstance() + csi.setServiceInstanceName(serviceInstanceName) + csi.setServiceType(csServiceType) + csi.setServiceRole(aaiServiceRole) + csi.setOrchestrationStatus(oStatus) + csi.setModelInvariantId(modelInvariantUuid) + csi.setModelVersionId(modelUuid) + csi.setInputParameters(uuiRequest) + csi.setWorkloadContext(useInterval) + csi.setEnvironmentContext(sNSSAI_id) + + //timestamp format YYYY-MM-DD hh:mm:ss + csi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) + + execution.setVariable("communicationServiceInstance", csi) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, subscriptionServiceType, serviceInstanceId) + client.create(uri, csi) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in communication service " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("exit communication service") + } + + private static generateNSSAI = { final String instanceId -> + int h, res + res = (instanceId == null) ? 0 : (h = instanceId.hashCode()) ^ (h >>> 16) + res = res >>> 1 + return "01-" + Integer.toHexString(res).toUpperCase() + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy new file mode 100644 index 0000000000..ae239d9e68 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -0,0 +1,232 @@ +package org.onap.so.bpmn.infrastructure.scripts + + +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.aai.domain.yang.AllottedResource + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.OwningEntity +import org.onap.aai.domain.yang.ServiceProfile; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.slf4j.Logger +import org.slf4j.LoggerFactory + + + +class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ + + private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceInstance.class); + JsonUtils jsonUtil = new JsonUtils() + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + void preProcessRequest (DelegateExecution execution) { + String msg = "" + logger.trace("Enter preProcessRequest()") + //Need update + //1. Prepare service parameter. + //2. Prepare slice profile parameters. + + String sliceserviceInstanceId = execution.getVariable("serviceInstanceId") + String allottedResourceId = UUID.randomUUID().toString() + execution.setVariable("sliceserviceInstanceId", sliceserviceInstanceId) + execution.setVariable("allottedResourceId", allottedResourceId) + + String uuiRequest = execution.getVariable("uuiRequest") + String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") + //here modelVersion is not set, we use modelUuid to decompose the service. + def isDebugLogEnabled = true + execution.setVariable("serviceInstanceId",sliceserviceInstanceId) + execution.setVariable("isDebugLogEnabled",isDebugLogEnabled) + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + + logger.trace("Exit preProcessRequest") + } + + + void createServiceProfile(DelegateExecution execution) { + + String sliceserviceInstanceId = execution.getVariable("sliceserviceInstanceId") + Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") + String serviceProfileID = UUID.randomUUID().toString() + ServiceProfile serviceProfile = new ServiceProfile(); + serviceProfile.setProfileId(serviceProfileID) + serviceProfile.setLatency(Integer.parseInt(serviceProfileMap.get("latency").toString())) + serviceProfile.setMaxNumberOfUEs(Integer.parseInt(serviceProfileMap.get("maxNumberofUEs").toString())) + serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString()) + serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString()) + serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString()) + serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString())) + serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString())) + serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString())) + serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString())) + serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString())) + + serviceProfile.setJitter(0) + serviceProfile.setSurvivalTime(0) + serviceProfile.setCsAvailability(new Object()) + serviceProfile.setReliability(new Object()) + serviceProfile.setExpDataRate(0) + serviceProfile.setTrafficDensity(0) + serviceProfile.setConnDensity(0) + try { + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, execution.getVariable("globalSubscriberId"), + execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, serviceProfileID) + client.create(uri, serviceProfile) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + void instantiateSliceService(DelegateExecution execution) { + + ServiceDecomposition serviceDecomposition= execution.getVariable("sliceServiceDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + ModelInfo modelInfo = serviceDecomposition.getModelInfo() + String serviceRole = "e2eslice-service" + String serviceType = execution.getVariable("serviceType") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + String ssInstanceId = execution.getVariable("serviceInstanceId") + try { + org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance() + ss.setServiceInstanceId(ssInstanceId) + String sliceInstanceName = execution.getVariable("serviceInstanceName") + ss.setServiceInstanceName(sliceInstanceName) + ss.setServiceType(serviceType) + String serviceStatus = "deactivated" + ss.setOrchestrationStatus(serviceStatus) + String modelInvariantUuid = modelInfo.getModelInvariantUuid() + String modelUuid = modelInfo.getModelUuid() + ss.setModelInvariantId(modelInvariantUuid) + ss.setModelVersionId(modelUuid) + String serviceInstanceLocationid = serviceProfile.get("plmnIdList") + ss.setServiceInstanceLocationId(serviceInstanceLocationid) + String snssai = serviceProfile.get("sNSSAI") + ss.setEnvironmentContext(snssai) + ss.setServiceRole(serviceRole) + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ssInstanceId) + client.create(uri, ss) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData(); + } + //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", ssInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + execution.setVariable("RollbackData", rollbackData) + logger.debug("RollbackData:" + rollbackData) + + } + + + void createAllottedResource(DelegateExecution execution) { + String serviceInstanceId = execution.getVariable('sliceserviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + +// try { +// +// if(resourceClient.exists(ssServiceuri)){ +// execution.setVariable("ssi_resourceLink", uri.build().toString()) +// }else{ +// exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " + +// "associate allotted resource for service :"+serviceInstanceId) +// } +// }catch(BpmnError e) { +// throw e; +// }catch (Exception ex){ +// String msg = "Exception in getServiceInstance. " + ex.getMessage() +// logger.debug(msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// } + + try { + String allottedResourceId = execution.getVariable("allottedResourceId") + ServiceDecomposition serviceDecomposition = execution.getVariable("sliceServiceDecomposition") + List<org.onap.so.bpmn.core.domain.AllottedResource> allottedResourceList = serviceDecomposition.getAllottedResources() + for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList) + { + //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(ssServiceuri, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, + execution.getVariable("globalSubscriberId"),execution.getVariable("subscriptionServiceType"), + execution.getVariable("sliceserviceInstanceId"), allottedResourceId) + execution.setVariable("allottedResourceUri", allottedResourceUri) + String arType = allottedResource.getAllottedResourceType() + String arRole = allottedResource.getAllottedResourceRole() + String modelInvariantId = allottedResource.getModelInfo().getModelInvariantUuid() + String modelVersionId = allottedResource.getModelInfo().getModelUuid() + + org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource() + resource.setId(allottedResourceId) + resource.setType(arType) + resource.setAllottedResourceName("Allotted_"+ execution.getVariable("serviceInstanceName")) + resource.setRole(arRole) + resource.setModelInvariantId(modelInvariantId) + resource.setModelVersionId(modelVersionId) + getAAIClient().create(allottedResourceUri, resource) + //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build()) + //getAAIClient().connect(allottedResourceUri,ssServiceuri) + } + //execution.setVariable("aaiARPath", allottedResourceUri.build().toString()); + + }catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage()) + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy new file mode 100644 index 0000000000..c66a89b9c6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -0,0 +1,524 @@ +package org.onap.so.bpmn.infrastructure.scripts + +import com.fasterxml.jackson.core.type.TypeReference +import groovy.json.JsonBuilder +import groovy.json.JsonSlurper +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipList +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.OofUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceProxy +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.client.RequestsDbClient +import org.onap.so.db.request.beans.OrchestrationTask +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.isBlank + +public class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ + + private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceOption.class) + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + RequestsDbClient requestsDbClient = new RequestsDbClient() + + OofUtils oofUtils = new OofUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + void preProcessRequest (DelegateExecution execution) { + String msg = "" + logger.trace("Enter preProcessRequest()") + String taskID = execution.getVariable("taskID") + Boolean isSharable = true + String resourceSharingLevel = execution.getVariable("resourceSharingLevel") + if (resourceSharingLevel.equals("shared")) + isSharable = true + execution.setVariable("isSharable",isSharable) + logger.trace("Exit preProcessRequest") + + } + + + void getNSIOptionfromOOF(DelegateExecution execution) { + + String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) + logger.debug( "get NSI option OOF Url: " + urlString) + boolean isNSISuggested = true + execution.setVariable("isNSISuggested",isNSISuggested) + String nsiInstanceId = "" + String nsiName = "" + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + //Prepare auth for OOF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) + String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + logger.debug( "Unable to encode username and password string: " + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + + "encode username and password string") + } + } else { + logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } + //Prepare auth for OOF - End + + String requestId = execution.getVariable("msoRequestId") + Map<String, Object> profileInfo = execution.getVariable("serviceProfile") + String nstModelUuid = execution.getVariable("nstModelUuid") + String nstModelInvariantUuid = execution.getVariable("nstModelInvariantUuid") + String nstInfo = """"NSTInfo" : { + "invariantUUID":"${nstModelInvariantUuid}", + "UUID":"${nstModelUuid}" + }""" + + String oofRequest = oofUtils.buildSelectNSIRequest(execution, requestId, nstInfo, profileInfo) + + //send request to get NSI option - Begin + URL url = new URL(urlString+"/api/oof/v1/selectnsi") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) + httpClient.addAdditionalHeader("Authorization", authHeader) + Response httpResponse = httpClient.post(oofRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("OOF sync response code is: " + responseCode) + + if(responseCode != 200){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + logger.debug("Info: No NSI suggested by OOF" ) + } + + if(httpResponse.hasEntity()){ + String OOFResponse = httpResponse.readEntity(String.class) + execution.setVariable("OOFResponse", OOFResponse) + int index = 0 //This needs to be changed to derive a value when we add policy to decide the solution options. + Map OOFResponseObject = new JsonSlurper().parseText(OOFResponse) + if(execution.getVariable("isSharable" ) == true && OOFResponseObject.get("solutions").containsKey("sharedNSIsolutions")) { + nsiInstanceId = OOFResponseObject.get("solutions").get("sharedNSIsolutions").get(0).get("NSISolution").NSIId + nsiName = OOFResponseObject.get("solutions").get("sharedNSIsolutions").get(0).get("NSISolution").NSIName + sliceTaskParams.setNstId(nsiInstanceId) + sliceTaskParams.setSuggestNsiName(nsiName) + execution.setVariable("nsiInstanceId",nsiInstanceId) + execution.setVariable("nsiName",nsiName) + }else { + if(OOFResponseObject.get("solutions").containsKey("newNSISolutions")) { + List NSSImap = OOFResponseObject.get("solutions").get("newNSISolutions").get(index).get("NSSISolutions") + for(Map nssi : NSSImap) { + String nssiName = nssi.get("NSSISolution").NSSIName + String nssiId = nssi.get("NSSISolution").NSSIId + String domain = nssi.get("NSSISolution").domain.toUpperCase() + switch (domain) { + case "AN": + sliceTaskParams.setAnSuggestNssiId(nssiId) + sliceTaskParams.setAnSuggestNssiName(nssiName) + break; + case "CN": + sliceTaskParams.setCnSuggestNssiId(nssiId) + sliceTaskParams.setCnSuggestNssiName(nssiName) + break; + case "TN": + sliceTaskParams.setTnSuggestNssiId(nssiId) + sliceTaskParams.setTnSuggestNssiName(nssiName) + break; + default: + break; + } + } + } + + } + execution.setVariable("sliceTaskParams", sliceTaskParams) + logger.debug("Info: No NSI suggested by OOF" ) + } + //send request to get NSI option - Begin + + + //send request to get NSI service Info - Begin + + /*** + * Need to check whether its needed. + */ +// logger.debug("Begin to query OOF suggetsed NSI from AAI ") +// if(isBlank(nsiInstanceId)){ +// isNSISuggested = false +// execution.setVariable("isNSISuggested",isNSISuggested) +// }else +// { +// try { +// String globalSubscriberId = execution.getVariable('globalSubscriberId') +// String serviceType = execution.getVariable('subscriptionServiceType') +// AAIResourcesClient resourceClient = new AAIResourcesClient() +// AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nsiInstanceId) +// AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) +// Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) +// org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = si.get() +// execution.setVariable("nsiServiceInstance",nsiServiceInstance) +// isNSISuggested = true +// execution.setVariable("isNSISuggested",isNSISuggested) +// SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") +// sliceTaskParams.setSuggestNsiId(nsiInstanceId) +// sliceTaskParams.setSuggestNsiName(si.get().getServiceInstanceName()) +// execution.setVariable("sliceTaskParams", sliceTaskParams) +// logger.debug("Info: NSI suggested by OOF exist in AAI ") +// }catch(BpmnError e) { +// throw e +// }catch(Exception ex) { +// String msg = "Internal Error in getServiceInstance: " + ex.getMessage() +// //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// logger.debug("Info: NSI suggested by OOF doesnt exist in AAI " + nsiInstanceId) +// } +// } + //send request to get NSI service Info - End + //${OrchestrationTaskHandler.createOrchestrationTask(execution.getVariable("OrchestrationTask"))} + logger.debug( "*** Completed options Call to OOF ***") + + } + + + public void parseServiceProfile(DelegateExecution execution) { + logger.debug("Start parseServiceProfile") + String serviceType = execution.getVariable("serviceType") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + + // set sliceProfile for three domains + Map<String, Object> sliceProfileTn = getSliceProfile(serviceType, "TN", serviceProfile) + Map<String, Object> sliceProfileCn = getSliceProfile(serviceType, "CN", serviceProfile) + Map<String, Object> sliceProfileAn = getSliceProfile(serviceType, "AN", serviceProfile) + + execution.setVariable("sliceProfileTn", sliceProfileTn) + execution.setVariable("sliceProfileCn", sliceProfileCn) + execution.setVariable("sliceProfileAn", sliceProfileAn) + logger.debug("sliceProfileTn: " + sliceProfileTn) + logger.debug("sliceProfileCn: " + sliceProfileCn) + logger.debug("sliceProfileAn: " + sliceProfileAn) + + logger.debug("Finish parseServiceProfile") + } + + public Map getSliceProfile(String serviceType, String domain, Map<String, Object> serviceProfile) { + String variablePath = "nsmf." + serviceType + ".profileMap" + domain + String profileMapStr = UrnPropertiesReader.getVariable(variablePath) + logger.debug("Profile map for " + domain + " : " + profileMapStr) + Map<String, String> profileMaps = objectMapper.readValue(profileMapStr, new TypeReference<Map<String, String>>(){}) + Map<String, Object> sliceProfileTn = [:] + for (Map.Entry<String, String> profileMap : profileMaps) { + sliceProfileTn.put(profileMap.key, serviceProfile.get(profileMap.value)) + } + + return sliceProfileTn + } + + + void prepareNSSIList(DelegateExecution execution) + { + ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + List<String> nssiAssociated = new ArrayList<>() + Map<String, String> nssimap = new HashMap<>() + String nsiInstanceId=execution.getVariable("nsiInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("subscriptionServiceType") + + try { + + ServiceInstance si = execution.getVariable("nsiServiceInstance") + //List<Relationship> relationships = si.getRelationshipList().getRelationship().stream().filter(relation -> + // relation.getRelatedTo().equalsIgnoreCase("service-instance")) + RelationshipList relationshipList = si.getRelationshipList() + List<Relationship> relationships = relationshipList.getRelationship() + for(Relationship relationship in relationships) + { + if(relationship.getRelatedTo().equalsIgnoreCase("service-instance")) + { + String NSSIassociated = relationship.getRelatedLink().substring(relationship.getRelatedLink().lastIndexOf("/") + 1); + if(!NSSIassociated.equals(nsiInstanceId)) + nssiAssociated.add(NSSIassociated) + } + } + }catch(BpmnError e) { + throw e + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + Map<String, Object> params = execution.getVariable("params") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + for(String nssiID in nssiAssociated) + { + try { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiID) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) + org.onap.aai.domain.yang.ServiceInstance nssi = si.get() + + String domain = nssi.getEnvironmentContext().toString().toUpperCase() + switch (domain) { + case "AN": + sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName()) + break; + case "CN": + sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName()) + break; + case "TN": + sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName()) + break; + default: + break; + } + }catch(NotFoundException e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiID) + }catch(Exception e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiID) + } + + } + String nstName = serviceDecomposition.getModelInfo().getModelName() + sliceTaskParams.setNstName(nstName) + String nstId = serviceDecomposition.getModelInfo().getModelUuid() + sliceTaskParams.setNstId(nstId) + execution.setVariable("sliceTaskParams",sliceTaskParams) + + } + + + void updateOptionsInDB(DelegateExecution execution) { + logger.debug("Updating options with default value since not sharable : Begin ") + String taskID = execution.getVariable("taskID") + String params = execution.getVariable("params") + logger.debug("Updating options with default value since not sharable : End ") + + } + + void prepareNSTDecompose(DelegateExecution execution) { + + String modelUuid = execution.getVariable("nstModelUuid") + String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid") + + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + void prepareNSSTDecompose(DelegateExecution execution) { + Boolean isMoreNSSTtoProcess = false + Integer maxNSST = execution.getVariable("maxNSST") + Integer currentNSST=execution.getVariable("currentNSST") + List<String> nsstModelUUIDList = new ArrayList<>() + nsstModelUUIDList = execution.getVariable("nsstModelUUIDList") + String modelUuid = nsstModelUUIDList.get(currentNSST) + String serviceModelInfo = """{ + "modelInvariantUuid":"", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + currentNSST=currentNSST+1 + if(currentNSST<maxNSST) + isMoreNSSTtoProcess=true + execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess) + execution.setVariable("maxNSST",maxNSST) + execution.setVariable("currentNSST",currentNSST) + } + + + void updateStatusInDB(DelegateExecution execution) { + + String taskID = execution.getVariable("taskID") + //OrchestrationTask orchestrationTask = requestsDbClient.getNetworkSliceOption(taskID); + //orchestrationTask.setTaskStage("wait to confirm") + //requestsDbClient.updateNetworkSliceOption(orchestrationTask) + } + + void prepareNSSTlistfromNST(DelegateExecution execution) { + //Need to update this part from decomposition. + logger.trace("Enter prepareNSSTlistfromNST()") + Boolean isMoreNSSTtoProcess = false + ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + String nstName = serviceDecomposition.getModelInfo().getModelName() + sliceTaskParams.setNstName(nstName) + String nstId = serviceDecomposition.getModelInfo().getModelUuid() + sliceTaskParams.setNstId(nstId) + execution.setVariable("sliceTaskParams",sliceTaskParams) + + List<ServiceProxy> proxyList = serviceDecomposition.getServiceProxy() + List<String> nsstModelUUIDList = new ArrayList<>() + for(ServiceProxy serviceProxy:proxyList) + nsstModelUUIDList.add(serviceProxy.getSourceModelUuid()) + execution.setVariable("nsstModelUUIDList",nsstModelUUIDList) + Integer maxNSST = nsstModelUUIDList.size() + Integer currentNSST=0 + execution.setVariable("maxNSST",maxNSST) + execution.setVariable("currentNSST",currentNSST) + if(currentNSST<maxNSST) + isMoreNSSTtoProcess=true + execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess) + logger.trace("Exit prepareNSSTlistfromNST()") + + } + + + void getNSSTOption(DelegateExecution execution) { + ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("subscriptionServiceType") + String nssiInstanceId ="" + String nssiName ="" + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + logger.debug( "get NSI option OOF Url: " + urlString) + boolean isNSISuggested = false + execution.setVariable("isNSISuggested",isNSISuggested) + + //Prepare auth for OOF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) + String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + logger.debug( "Unable to encode username and password string: " + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + + "encode username and password string") + } + } else { + logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } + //Prepare auth for OOF - End + //Prepare send request to OOF - Begin + String requestId = execution.getVariable("msoRequestId") + Map<String, Object> profileInfo = execution.getVariable("serviceProfile") + String nsstModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() + String nsstModelUuid = serviceDecomposition.getModelInfo().getModelUuid() + String nsstInfo = """"NSSTInfo": { + "invariantUUID":"${nsstModelInvariantUuid}", + "UUID":"${nsstModelUuid}" + }""" + String oofRequest = oofUtils.buildSelectNSSIRequest(execution, requestId, nsstInfo ,profileInfo) + + + URL url = new URL(urlString+"/api/oof/v1/selectnssi") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) + httpClient.addAdditionalHeader("Authorization", authHeader) + Response httpResponse = httpClient.post(oofRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("OOF sync response code is: " + responseCode) + + if(responseCode != 200){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + } + + if(httpResponse.hasEntity()){ + String OOFResponse = httpResponse.readEntity(String.class) + execution.setVariable("OOFResponse", OOFResponse) + nssiInstanceId = jsonUtil.getJsonValue(OOFResponse, "NSSIIInfo.NSSIID") + nssiName = jsonUtil.getJsonValue(OOFResponse, "NSSIInfo.NSSIName") + execution.setVariable("nssiInstanceId",nssiInstanceId) + execution.setVariable("nssiName",nssiName) + } + if(isBlank(nssiInstanceId)){ + logger.debug( "There is no valid NSST suggested by OOF.") + }else + { + try { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) + org.onap.aai.domain.yang.ServiceInstance nssi = si.get() + + String domain = nssi.getEnvironmentContext().toString().toUpperCase() + switch (domain) { + case "AN": + sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName()) + break; + case "CN": + sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName()) + break; + case "TN": + sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName()) + break; + default: + break; + } + }catch(NotFoundException e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId) + }catch(Exception e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId) + } + } + + + //Prepare send request to OOF - End + +// String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() +// String nsstID = jsonUtil.getJsonValue(content, "metadata.id") +// String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") +// String domain = jsonUtil.getJsonValue(content, "metadata.domainType") +// String type = jsonUtil.getJsonValue(content, "metadata.type") +// String nsstContentInfo = """{ +// "NsstID":"${nsstID}", +// "Vendor":"${vendor}", +// "type":"${type}" +// }""" + + logger.debug("Prepare NSSI option completed ") + } +} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy new file mode 100644 index 0000000000..7c2a2be6ac --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy @@ -0,0 +1,322 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.AllottedResource +import org.onap.aai.domain.yang.AllottedResources +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.SliceProfiles +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException + +import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * This groovy class supports the <class>DoDeleteSliceService.bpmn</class> process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId - O + * @param - subscriptionServiceType - O + * @param - serviceInstanceId + * + */ +class DoDeleteSliceService extends AbstractServiceTaskProcessor { + private final String PREFIX ="DoDeleteSliceService" + ExceptionUtil exceptionUtil = new ExceptionUtil() + private static final Logger LOGGER = LoggerFactory.getLogger( DoDeleteSliceService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + LOGGER.debug(" *****${PREFIX} preProcessRequest *****") + String msg = "" + + try { + //String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix",PREFIX) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT + execution.getVariable("globalSubscriberId") ?: execution.setVariable("globalSubscriberId", "") + + //requestDetails.requestParameters. for AAI PUT + execution.getVariable("serviceType") ?: execution.setVariable("serviceType", "") + + //Generated in parent for AAI PUT + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + LOGGER.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } catch (BpmnError e) { + throw e + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + LOGGER.debug("*****${PREFIX} Exit preProcessRequest *****") + } + + /** + * query E2ESliceService from AAI + * save snssai + * @param execution + */ + void queryE2ESliceSeriveFromAAI(DelegateExecution execution) + { + LOGGER.trace(" *****${PREFIX} Start queryE2ESliceSeriveFromAAI *****") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String errorMsg = "query e2e slice service from aai failed" + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) + if(si.isPresent()) + { + String snssai = si.get()?.getEnvironmentContext() + execution.setVariable("snssai", snssai ?: "") + LOGGER.info("serviceInstanceId: ${serviceInstanceId}, snssai: ${snssai}") + } + LOGGER.trace(" *****${PREFIX} Exit queryE2ESliceSeriveFromAAI *****") + } + + /** + * get allotted resource from AAI + * save nsi id + * @param execution + */ + void getAllottedResFromAAI(DelegateExecution execution) + { + LOGGER.trace(" *****${PREFIX} Start getAllottedResFromAAI *****") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + try + { + String errorMsg = "query allotted resource from aai failed." + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.ALLOTTED_RESOURCE_ALL, serviceInstanceId, errorMsg) + Optional<AllottedResources> ars = wrapper?.asBean(AllottedResources.class) + if(ars.isPresent() && ars.get().getAllottedResource()) + { + List<AllottedResource> allottedResourceList = ars.get().getAllottedResource() + AllottedResource ar = allottedResourceList.first() + String relatedLink = ar?.getRelationshipList()?.getRelationship()?.first()?.getRelatedLink() + String nsiId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" + execution.setVariable("nsiId", nsiId) + LOGGER.info("serviceInstanceId: ${serviceInstanceId}, nsiId:${nsiId}") + } + } + catch(BpmnError e){ + throw e + } + catch (Exception ex){ + String msg = "Exception in getAllottedResFromAAI " + ex.getMessage() + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + LOGGER.trace(" *****${PREFIX} Exit getAllottedResFromAAI *****") + } + + /** + * get nsi service instance from aai + * save nssi id + * @param execution + */ + void getNSIFromAAI(DelegateExecution execution) + { + LOGGER.trace(" *****${PREFIX} Start getNSIFromAAI *****") + String nsiId = execution.getVariable("nsiId") + try + { + String errorMsg = "query nsi from aai failed." + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, nsiId, errorMsg) + Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) + List<String> nssiIdList = [] + String msg = "nsiId:${nsiId},nssiIdList:" + if(si.isPresent()) + { + List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship() + for (Relationship relationship : relationshipList) + { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "service-instance") + { + String relatedLink = relationship.getRelatedLink()?:"" + String nssiId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" + nssiIdList.add(nssiId) + msg+="${nssiId}, " + } + } + } + LOGGER.info(msg) + execution.setVariable("nssiIdList", nssiIdList) + } + catch(BpmnError e){ + throw e + } + catch (Exception ex){ + String msg = "Exception in getNSIFromAAI " + ex.getMessage() + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + LOGGER.trace(" *****${PREFIX} Exit getNSIFromAAI *****") + } + + /** + * get nssi service from AAI + * prepare list + * @param execution + */ + void getNSSIListFromAAI(DelegateExecution execution) + { + LOGGER.trace("*****${PREFIX} Start getNSSIListFromAAI *****") + List<String> nssiIdList = execution.getVariable("nssiIdList") + List<ServiceInstance> nssiInstanceList = [] + String errorMsg = "query nssi list from aai failed" + for(String nssiId : nssiIdList) + { + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, nssiId, errorMsg) + Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) + if(si.isPresent()) + { + nssiInstanceList.add(si.get()) + } + } + int size = nssiInstanceList.size() + int proportion = size >0 ?((90/size) as int) : 90 + execution.setVariable("nssiInstanceList", nssiInstanceList) + execution.setVariable("currentNSSIIndex", 0) + execution.setVariable("proportion", proportion) + String msg ="nssiInstanceList size: ${nssiInstanceList.size()}, proportion:${proportion}" + LOGGER.info(msg) + LOGGER.trace(" *****${PREFIX} Exit getNSSIListFromAAI *****") + } + + /** + * get current NSSI + * @param execution + */ + void getCurrentNSSI(DelegateExecution execution) + { + LOGGER.trace(" *****${PREFIX} Start getCurrentNSSI *****") + List<ServiceInstance> nssiInstanceList = execution.getVariable("nssiInstanceList") + int currentIndex = execution.getVariable("currentNSSIIndex") as int + ServiceInstance nssi = nssiInstanceList?.get(currentIndex) + def currentNSSI = [:] + currentNSSI['nssiServiceInstanceId'] = nssi?.getServiceInstanceId() + currentNSSI['modelInvariantId'] = nssi?.getModelInvariantId() + currentNSSI['modelVersionId'] = nssi?.getModelVersionId() + currentNSSI['snssai'] = execution.getVariable("snssai") ?: "" + currentNSSI['nsiServiceInstanceId'] = execution.getVariable("nsiId") ?: "" + currentNSSI['operationId'] = execution.getVariable("operationId") ?: "" + currentNSSI['e2eServiceInstanceId'] = execution.getVariable("serviceInstanceId") ?: "" + currentNSSI['msoRequestId'] = execution.getVariable("msoRequestId") ?: "" + currentNSSI['globalSubscriberId'] = execution.getVariable("globalSubscriberId") ?: "" + currentNSSI['serviceType'] = execution.getVariable("serviceType") ?: "" + currentNSSI['serviceModelInfo'] = execution.getVariable("serviceModelInfo") ?: "" + currentNSSI['proportion'] = (execution.getVariable("proportion") as int)*(currentIndex+1) + execution.setVariable("currentNSSI", currentNSSI) + String msg = "Now we deal with nssiServiceInstanceId: ${currentNSSI['nssiServiceInstanceId']}, current Index: ${currentIndex}, current proportion:${currentNSSI['proportion']}" + LOGGER.info(msg) + LOGGER.trace(" *****${PREFIX} Exit getCurrentNSSI *****") + } + + /** + * parse next nssi + * @param execution + */ + void parseNextNSSI(DelegateExecution execution) + { + LOGGER.trace(" *****${PREFIX} Start parseNextNSSI *****") + if(execution.getVariable("WorkflowException") != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "current job failure!") + } + def currentIndex = execution.getVariable("currentNSSIIndex") + List<ServiceInstance> nssiInstanceList = execution.getVariable("nssiInstanceList") + def nextIndex = ++currentIndex + LOGGER.info("nextIndex: ${nextIndex}") + if(nextIndex >= nssiInstanceList.size()){ + execution.setVariable("isAllNSSIFinished", "true") + }else{ + execution.setVariable("isAllNSSIFinished", "false") + execution.setVariable("currentNSSIIndex", nextIndex) + } + LOGGER.trace(" *****${PREFIX} Exit parseNextNSSI *****") + } + + + /** + * query sliceProfile from AAI + * save profileId + * @param execution + */ + void querySliceProfileFromAAI(DelegateExecution execution) + { + LOGGER.trace(" *****${PREFIX} Start querySliceProfileFromAAI *****") + def currentNSSI = execution.getVariable("currentNSSI") + String nssiId = currentNSSI['nssiServiceInstanceId'] + String errorMsg = "query slice profile failed" + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SLICE_PROFILE_ALL, nssiId, errorMsg) + Optional<SliceProfiles> sliceProfiles =wrapper.asBean(SliceProfiles.class) + if(sliceProfiles.isPresent()) + { + String profileId = sliceProfiles.get().getSliceProfile()?.get(0)?.getProfileId() + currentNSSI['profileId'] = profileId ?: "" + LOGGER.info("nssiId: ${nssiId}, profileId: ${profileId}") + } + execution.setVariable("currentNSSI", currentNSSI) + LOGGER.trace(" *****${PREFIX} Exit querySliceProfileFromAAI *****") + } + + /** + * query AAI + * @param execution + * @param aaiObjectType + * @param instanceId + * @return AAIResultWrapper + */ + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) + { + LOGGER.trace(" *****${PREFIX} Start queryAAI *****") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) + if (!resourceClient.exists(resourceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) + } + AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + LOGGER.trace(" *****${PREFIX} Exit queryAAI *****") + return wrapper + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy new file mode 100644 index 0000000000..63cd3c72f9 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy @@ -0,0 +1,463 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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 com.fasterxml.jackson.databind.ObjectMapper +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.beans.nsmf.* +import org.onap.so.bpmn.common.scripts.* +import org.onap.so.bpmn.common.util.OofInfraUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ServiceArtifact +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.springframework.web.util.UriUtils + +import javax.ws.rs.core.Response +import java.lang.reflect.Type + +/** + * This class supports the DoCreateVnf building block subflow + * with the creation of a generic vnf for + * infrastructure. + * + */ +class DoSendCommandToNSSMF extends AbstractServiceTaskProcessor { + + private static final Logger logger = LoggerFactory.getLogger( DoSendCommandToNSSMF.class); + String Prefix="DoCNSSMF_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + OofInfraUtils oofInfraUtils = new OofInfraUtils() + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + logger.debug("STARTED Do sendcommandtoNssmf PreProcessRequest Process") + + /*******************/ + try{ + // Get Variables + String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId") + String serviceInstanceId = execution.getVariable("e2eserviceInstanceId") + execution.setVariable("e2eserviceInstanceId", e2eserviceInstanceId) + execution.setVariable("serviceInstanceId", serviceInstanceId) + logger.debug("Incoming e2eserviceInstanceId is: " + e2eserviceInstanceId) + + String NSIserviceid = execution.getVariable("NSIserviceid") + execution.setVariable("NSIserviceid", NSIserviceid) + logger.debug("Incoming NSI id is: " + NSIserviceid) + + + String nssiMap = execution.getVariable("nssiMap") + Type type = new TypeToken<HashMap<String, NSSI>>(){}.getType() + Map<String, NSSI> DonssiMap = new Gson().fromJson(nssiMap,type) + String strDonssiMap = mapToJsonStr(DonssiMap) + execution.setVariable("DonssiMap",strDonssiMap) + logger.debug("Incoming DonssiMap is: " + strDonssiMap) + + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("msoRequestId", requestId) + + String operationType = execution.getVariable("operationType") + execution.setVariable("operationType", operationType) + logger.debug("Incoming operationType is: " + operationType) + + if (operationType == "activation") { + execution.setVariable("activationSequence","an,tn,cn") + }else { + execution.setVariable("activationSequence","cn,tn,an") + } + execution.setVariable("activationIndex",0) + execution.setVariable("miniute", "0") + execution.setVariable("activateNumberSlice",0) + + logger.info("the end !!") + }catch(BpmnError b){ + logger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + logger.info("the end of catch !!") + logger.debug(" Error Occured in DoSendCommandToNSSMF PreProcessRequest method!" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoSendCommandToNSSMF PreProcessRequest") + + } + logger.trace("COMPLETED DoSendCommandToNSSMF PreProcessRequest Process") + } + private String mapToJsonStr(Map<String, NSSI> stringNSSIHashMap) { + HashMap<String, NSSI> map = new HashMap<String, NSSI>() + for(Map.Entry<String, NSSI> child:stringNSSIHashMap.entrySet()) + { + map.put(child.getKey(), child.getValue()) + } + return new Gson().toJson(map) + } + public void getNSSIformlist(DelegateExecution execution) { + + String nssiMap = execution.getVariable("DonssiMap") + Type type = new TypeToken<HashMap<String, NSSI>>(){}.getType() + Map<String, NSSI> DonssiMap = new Gson().fromJson(nssiMap,type) + String isNSSIActivate = execution.getVariable("isNSSIActivate") + + String activationSequence01 = execution.getVariable("activationSequence") + String[] strlist = activationSequence01.split(",") + + int activationIndex = execution.getVariable("activationIndex") + int indexcurrent = 0 + if (isNSSIActivate == "true") + { + execution.setVariable("isGetSuccessfull", "false") + }else{for (int index = activationIndex; index < 3;index++) { + String domaintype01 = strlist[index] + if (DonssiMap.containsKey(domaintype01)) { + NSSI nssiobject = DonssiMap.get(domaintype01) + execution.setVariable("domainType", domaintype01) + execution.setVariable("nssiId", nssiobject.getNssiId()) + execution.setVariable("modelInvariantUuid", nssiobject.getModelInvariantId()) + execution.setVariable("modelUuid", nssiobject.getModelVersionId()) + execution.setVariable("isGetSuccessfull", "true") + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("modelUuid") + //here modelVersion is not set, we use modelUuid to decompose the service. + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + indexcurrent = index + execution.setVariable("activationIndex", indexcurrent) + break + }else + { + indexcurrent = index + 1 + + } + } + if ( activationIndex > 2) { + execution.setVariable("isGetSuccessfull", "false") + } + execution.setVariable("activationIndex", indexcurrent)} + + } + /** + * get vendor Info + * @param execution + */ + private void processDecomposition(DelegateExecution execution) { + logger.debug("***** processDecomposition *****") + + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") as ServiceDecomposition + ServiceArtifact serviceArtifact = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0) + String content = serviceArtifact.getContent() + String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") + //String domainType = jsonUtil.getJsonValue(content, "metadata.domainType") + + execution.setVariable("vendor", vendor) + // currentNSSI['domainType'] = domainType + logger.info("processDecomposition, current vendor-domainType:" + vendor) + + } catch (any) { + String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage() + logger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + logger.debug("***** Exit processDecomposition *****") + } + public void UpdateIndex(DelegateExecution execution) { + def activationIndex = execution.getVariable("activationIndex") + int activateNumberSlice = execution.getVariable("activateNumberSlice") as Integer + def activationCount= execution.getVariable("activationCount") + //DecimalFormat df1 = new DecimalFormat("##%") + int rate = (activateNumberSlice / activationCount) * 100 + if (rate == 100) + { + execution.setVariable("isNSSIActivate","true") + } + else{ + execution.setVariable("isNSSIActivate","false") + } + activationIndex = activationIndex + 1 + execution.setVariable("activationIndex",activationIndex) + logger.trace("the Progress of activation is " + rate.toString() + "%" ) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = UUID.randomUUID().toString() + String operationType = execution.getVariable("operationType") + String userId = "" + String result = (operationType.equals("activation"))? "ACTIVATING": "DEACTIVATING" + int progress = rate + String reason = "" + String operationContent = "Service activation in progress" + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("e2eserviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> + <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> + <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> + <userId>${MsoUtils.xmlEscape(userId)}</userId> + <result>${MsoUtils.xmlEscape(result)}</result> + <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> + <progress>${MsoUtils.xmlEscape(progress)}</progress> + <reason>${MsoUtils.xmlEscape(reason)}</reason> + </ns:initServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + logger.debug("Outgoing CVFMI_updateServiceOperStatusRequest: \n" + payload) + + }catch(Exception e){ + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing Activate Slice .", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during Activate Slice Method:\n" + e.getMessage()) + } + logger.trace("finished Activate Slice") + } + public void WaitForReturn(DelegateExecution execution) { + //logger.debug("Query : "+ Jobid) + def miniute=execution.getVariable("miniute") + Thread.sleep(10000) + int miniute01 = Integer.parseInt(miniute) + 1 + logger.debug("waiting for : "+ miniute + "miniutes") + execution.setVariable("miniute", String.valueOf(miniute01)) + } + public void GetTheStatusOfActivation(DelegateExecution execution) { + + String snssai= execution.getVariable("snssai") + String domaintype = execution.getVariable("domainType") + String NSIserviceid=execution.getVariable("NSIserviceid") + String nssiId = execution.getVariable("nssiId") + String Jobid=execution.getVariable("JobId") + def miniute=execution.getVariable("miniute") + String vendor = execution.getVariable("vendor") + String jobstatus ="error" + + + logger.debug("Query the jobid activation of SNSSAI: "+ Jobid) + logger.debug("the domain is : "+ domaintype) + logger.debug("the NSSID is : "+nssiId) + logger.debug("the NSIserviceid is : "+NSIserviceid) + + JobStatusRequest jobStatusRequest = new JobStatusRequest() + + EsrInfo info = new EsrInfo() + info.setNetworkType(NetworkType.fromString(domaintype)) + info.setVendor(vendor) + + jobStatusRequest.setNsiId(NSIserviceid) + jobStatusRequest.setNssiId(nssiId) + jobStatusRequest.setEsrInfo(info) + + + ObjectMapper mapper = new ObjectMapper() + String Reqjson = mapper.writeValueAsString(jobStatusRequest) + String isActivateSuccessfull=false + + String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution) + String nssmfRequest = urlString + "/api/rest/provMns/v1/NSS/jobs/" +Jobid + + //send request to active NSSI TN option + URL url = new URL(nssmfRequest) + + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(Reqjson) + + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF activation response code is: " + responseCode) + + if (responseCode == 404) { + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad job status Response from NSSMF.") + isActivateSuccessfull = false + execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) + jobstatus="error" + }else if(responseCode == 200) { + if (httpResponse.hasEntity()) { + JobStatusResponse jobStatusResponse = httpResponse.readEntity(JobStatusResponse.class) + execution.setVariable("statusDescription", jobStatusResponse.getResponseDescriptor().getStatusDescription()) + jobstatus = jobStatusResponse.getResponseDescriptor().getStatus() + switch(jobstatus) { + case "started": + case "processing": + isActivateSuccessfull = "waitting" + execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) + break + case "finished": + isActivateSuccessfull = "true" + execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) + execution.setVariable("activateNumberSlice",execution.getVariable("activateNumberSlice")+ 1) + break + case "error": + default: + isActivateSuccessfull = "false" + execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) + + } + if(Integer.parseInt(miniute) > 6 ) + { + isActivateSuccessfull = "false" + execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a timeout job status Response from NSSMF.") + } + }else + { + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad job status Response from NSSMF.") + isActivateSuccessfull = false + execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) + } + } else { + isActivateSuccessfull = false + execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad job status Response from NSSMF.") + } + } + public void SendCommandToNssmf(DelegateExecution execution) { + + String snssai= execution.getVariable("snssai") + String domaintype = execution.getVariable("domainType") + String NSIserviceid=execution.getVariable("NSIserviceid") + String nssiId = execution.getVariable("nssiId") + String vendor = execution.getVariable("vendor") + + + logger.debug("the domain is : "+domaintype) + logger.debug("SNSSAI: "+snssai +" will be activated") + logger.debug("the NSSID is : "+nssiId) + logger.debug("the NSIserviceid is : "+NSIserviceid) + + EsrInfo esr = new EsrInfo(); + esr.setNetworkType(NetworkType.fromString(domaintype)) + esr.setVendor(vendor) + + ActDeActNssi actNssi = new ActDeActNssi(); + actNssi.setNsiId(NSIserviceid); + actNssi.setNssiId(nssiId); + NssiActDeActRequest actRequest = new NssiActDeActRequest(); + actRequest.setActDeActNssi(actNssi); + actRequest.setEsrInfo(esr) + + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(actRequest); + + + String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution) + + //Prepare auth for NSSMF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.nssmf.auth", execution) + String operationType = execution.getVariable("operationType") + + String nssmfRequest = urlString + "/api/rest/provMns/v1/NSS/" + snssai + "/" + operationType + + //send request to active NSSI TN option + URL url = new URL(nssmfRequest) + + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(json) + + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF activate response code is: " + responseCode) + checkNssmfResponse(httpResponse, execution) + + NssiResponse nssmfResponse = httpResponse.readEntity(NssiResponse.class) + String jobId = nssmfResponse.getJobId() ?: "" + execution.setVariable("JobId", jobId) + + } + private void checkNssmfResponse(Response httpResponse, DelegateExecution execution) { + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF response code is: " + responseCode) + + if ( responseCode < 200 || responseCode > 202 || !httpResponse.hasEntity()) { + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Response from NSSMF.") + String isNSSIActivated = "false" + execution.setVariable("isNSSIActivated", isNSSIActivated) + execution.setVariable("isNSSIActivate","false") + }else{ + String isNSSIActivated = "true" + execution.setVariable("isNSSIActivated", isNSSIActivated) + } + } + + + void sendSyncError (DelegateExecution execution) { + logger.trace("start sendSyncError") + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + logger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + logger.trace("finished sendSyncError") + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationServiceTest.groovy new file mode 100644 index 0000000000..7e02779f10 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationServiceTest.groovy @@ -0,0 +1,224 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.bpmn.common.scripts.MsoGroovyTest + +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + +class ActivateCommunicationServiceTest extends MsoGroovyTest { + + @Before + void init() throws IOException { + super.init("ActivateCommunicationService") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest() { + + String req = """ + { + "globalSubscriberId": "5GCustomer", + "serviceType": "5G", + "operationId": "test123" + } + """ + when(mockExecution.getVariable("bpmnRequest")).thenReturn(req) + when(mockExecution.getVariable("mso-request-id")).thenReturn("54321") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + + + ActivateCommunicationService service = new ActivateCommunicationService() + service.preProcessRequest(mockExecution) + Mockito.verify(mockExecution, times(5)).setVariable(captor.capture(), captor.capture()) + } + + @Test + void testPrepareInitOperationStatus() { + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + + ActivateCommunicationService service = new ActivateCommunicationService() + + service.prepareInitOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + assertNotNull(res) + } + + + @Test + void testSendSyncResponse() { + when(mockExecution.getVariable("operationId")).thenReturn("123456") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + ActivateCommunicationService service = new ActivateCommunicationService() + service.sendSyncResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture()) + def updateVolumeGroupRequest = captor.getValue() + assertEquals(updateVolumeGroupRequest, true) + } + + @Test + void testPreRequestSend2NSMF() { + when(mockExecution.getVariable("e2e_service-instance.service-instance-id")).thenReturn("12333") + when(mockExecution.getVariable("requestParam")).thenReturn("activate") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("test111") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5GConsumer") + ActivateCommunicationService service = new ActivateCommunicationService() + service.preRequestSend2NSMF(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("CSMF_NSMFRequest"), captor.capture()) + String resultSuccess = captor.getValue() + + String expect = """ + { + "globalSubscriberId":"test111", + "serviceType":"5GConsumer" + } + """ + assertEquals(expect.replaceAll("\\s+", ""), resultSuccess.replaceAll("\\s+", "")) + } + + @Test + void testProcessNSMFResponseSuccess() { + when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(202) + when(mockExecution.getVariable("CSMF_NSMFResponse")).thenReturn(""" + { + "operationId": "e3819a23-3777-4172-a834-35ee78acf3f4" + } + """) + + ActivateCommunicationService service = new ActivateCommunicationService() + service.processNSMFResponse(mockExecution) + Mockito.verify(mockExecution, times(2)).setVariable(captor.capture(), captor.capture()) + def resultSuccess = captor.getAllValues() + + def expect = new ArrayList<>() + expect.add("e2eOperationId") + expect.add("e3819a23-3777-4172-a834-35ee78acf3f4") + expect.add("ProcessNsmfSuccess") + expect.add("OK") + assertEquals(expect, resultSuccess) + } + + @Test + void testProcessNSMFResponseError() { + when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(500) + ActivateCommunicationService service = new ActivateCommunicationService() + service.processNSMFResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("ProcessNsmfSuccess"), captor.capture()) + String resultSuccess = captor.getValue() + assertEquals("ERROR", resultSuccess) + } + + @Test + void testPrepareUpdateOperationStatus() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + when(mockExecution.getVariable("operationType")).thenReturn("activate") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")) + .thenReturn("http://localhost:28090/dbadapters/RequestsDbAdapter") + ActivateCommunicationService service = new ActivateCommunicationService() + + service.prepareUpdateOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + + String expect = getExpectPayload("updateServiceOperationStatus", "processing", "20", + "communication service activate operation processing: waiting nsmf service create finished") + + assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", "")) + } + + private static getExpectPayload = { String type, String result, String progress, String operationContent -> + String expect = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:${type} xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>12345</serviceId> + <operationId>54321</operationId> + <operationType>activate</operationType> + <userId>11111</userId> + <result>${result}</result> + <operationContent>${operationContent}</operationContent> + <progress>${progress}</progress> + <reason></reason> + </ns:${type}> + </soapenv:Body> + </soapenv:Envelope> + """ + return expect + } + + @Test + void testPrepareCallCheckProcessStatus() { + ActivateCommunicationService service = new ActivateCommunicationService() + service.prepareCallCheckProcessStatus(mockExecution) + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + def resultSuccess = captor.getAllValues() + assertNotNull(resultSuccess) + } + + @Test + void testPrepareCompleteStatus() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + when(mockExecution.getVariable("operationType")).thenReturn("activate") + when(mockExecution.getVariable("operationContent")) + .thenReturn("communication service activate operation finished") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + when(mockExecution.getVariable("operationStatus")) + .thenReturn("deactivated") + ActivateCommunicationService service = new ActivateCommunicationService() + + service.prepareCompleteStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + + String expect = getExpectPayload("updateServiceOperationStatus", "deactivated", "100", + "communication service activate operation finished") + + assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", "")) + } + +} + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy new file mode 100644 index 0000000000..3622cc0062 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy @@ -0,0 +1,456 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.json.JSONObject +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInfo +import org.onap.so.bpmn.core.domain.ServiceProxy + +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + +class CreateCommunicationServiceTest extends MsoGroovyTest { + + @Before + void init() throws IOException { + super.init("CreateCommunicationService") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(""" + { + "requestDetails": { + "modelInfo": { + "modelInvariantId": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelType": "service", + "modelNameVersionId": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelName": "voLTE", + "modelVersion": "1.0", + "modelVersionId": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelUuid": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelInvariantUuid": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51" + }, + "requestInfo": { + "source": "UUI", + "instanceName": "CSMFService", + "suppressRollback": true + }, + "subscriberInfo": { + "globalSubscriberId": "5GCustomer" + }, + "requestParameters": { + "subscriptionServiceType": "MOG", + "userParams": [{ + "ServiceInstanceName": "CSMFService", + "UUIRequest": "{\\r\\n \\ + "service\\":{\\r\\n \\"name\\":\\"CSMFService\\",\\r\\n + \\"description\\":\\"CSMFService\\",\\r\\n + \\"serviceInvariantUuid\\":\\"e75698d9-925a-4cdd-a6c0-edacbe6a0b51\\",\\r\\n + \\"serviceUuid\\":\\"8ee5926d-720b-4bb2-86f9-d20e921c143b\\",\\r\\n + \\"globalSubscriberId\\":\\"5GCustomer\\",\\r\\n + \\"serviceType\\":\\"5G\\",\\r\\n + \\"parameters\\":{\\r\\n + \\"requestInputs\\":{\\r\\n + \\"expDataRateDL\\":10,\\r\\n + \\"expDataRateUL\\":30,\\r\\n + \\"latency\\":20,\\r\\n + \\"maxNumberofUEs\\":300,\\r\\n + \\"uemobilityLevel\\":\\"stationary\\",\\r\\n + \\"resourceSharingLevel\\":\\"shared\\",\\r\\n + \\"coverageAreaList\\": \\"01001\\",\\r\\n + \\"useInterval\\":\\"3\\"\\r\\n + }\\r\\n + }\\r\\n }\\r\\n}\\r\\n" + }], + "aLaCarte": true, + "usePreload": true + } + }, + "serviceInstanceId": null, + "vnfInstanceId": null, + "networkInstanceId": null, + "volumeGroupInstanceId": null, + "vfModuleInstanceId": null, + "configurationId": null, + "instanceGroupId": null + }""".replaceAll("\\s+", "")) + when(mockExecution.getVariable("mso-request-id")).thenReturn("edb08d97-e0f9-4c71-840a-72080d7be42e") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.preProcessRequest(mockExecution) + Mockito.verify(mockExecution, times(14)).setVariable(captor.capture() as String, captor.capture()) + List<ExecutionEntity> values = captor.getAllValues() + assertNotNull(values) + } + + @Test + void testPrepareInitOperationStatus() { + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareInitOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + assertNotNull(res) + } + + + @Test + void testSendSyncResponse() { + when(mockExecution.getVariable("operationId")).thenReturn("123456") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.sendSyncResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture()) + def updateVolumeGroupRequest = captor.getValue() + assertEquals(updateVolumeGroupRequest, true) + } + + + @Test + void testPrepareDoComposeE2E() { + ServiceDecomposition serviceDecomposition = new ServiceDecomposition() + ServiceProxy serviceProxy = new ServiceProxy() + serviceProxy.setSourceModelUuid("f2f5967e-72d3-4c5c-b880-e214e71dba4e") + serviceDecomposition.setServiceProxy(Arrays.asList(serviceProxy)) + when(mockExecution.getVariable("csServiceDecomposition")).thenReturn(serviceDecomposition) + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.prepareDoComposeE2E(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("e2eServiceModelInfo"), captor.capture()) + String e2eServiceModelInfo = captor.getValue() + assertEquals(e2eServiceModelInfo.trim().replaceAll(" ", ""), + """{"modelUuid":"f2f5967e-72d3-4c5c-b880-e214e71dba4e"}""") + } + + @Test + void testParseCSParamsFromReq() { + mockData() + when(mockExecution.getVariable("csServiceModelInfo")).thenReturn(""" + { + "modelInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelName":"voLTE", + "modelNameVersionId":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelVersion":"1.0", + "modelVersionId":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelInvariantId":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelType":"service", + "modelUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b" + }""") + + ServiceDecomposition decomposition = new ServiceDecomposition() + decomposition.setServiceType("embb") + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.setServiceProperties(""" + [{"name":"useInterval","type":"string","required":false}, + {"default":"39-00","name":"plmnIdList","type":"string","required":false}, + {"name":"maxNumberofUEs","type":"integer","required":false}, + {"name":"latency","type":"integer","required":false}, + {"name":"uEMobilityLevel","type":"string","required":false}, + {"name":"expDataRateUL","type":"integer","required":false}, + {"name":"expDataRateDL","type":"integer","required":false}, + {"name":"coverageAreaList","type":"string","required":false}, + {"name":"sNSSAI","type":"string","required":false}, + {"name":"resourceSharingLevel","type":"string","required":false}] + """) + decomposition.setServiceInfo(serviceInfo) + + when(mockExecution.getVariable("csServiceDecomposition")).thenReturn(decomposition) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.parseCSParamsFromReq(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("csInputMap"), captor.capture()) + def csInputMap = captor.getValue() + assertEquals(getExpectCsInputMap(), csInputMap) + + } + + private static Map<String, Object> getExpectCsInputMap() { + Map<String, Object> csInputMap = new HashMap<>() + csInputMap.put("expDataRateDL", 10) + csInputMap.put("expDataRateUL", 30) + csInputMap.put("latency", 20) + csInputMap.put("maxNumberofUEs", 300) + csInputMap.put("uEMobilityLevel", "stationary") + csInputMap.put("resourceSharingLevel", "shared") + csInputMap.put("coverageAreaTAList", "01001") + csInputMap.put("useInterval", "3") + csInputMap.put("coverageAreaList", null) + csInputMap.put("plmnIdList", "39-00") + csInputMap.put("sNSSAI", null) + return csInputMap + } + + @Test + void testGenerateE2EServiceProfile() { + ServiceDecomposition decomposition = new ServiceDecomposition() + decomposition.setServiceType("embb") + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.setServiceProperties(""" + [{"name":"nstar0_allottedresource0_providing_service_uuid","type":"string","required":true}, + {"name":"areaTrafficCapDL","type":"integer","required":false}, + {"name":"maxNumberofUEs","type":"integer","required":false}, + {"name":"latency","type":"integer","required":false}, + {"name":"expDataRateUL","type":"integer","required":false}, + {"name":"sNSSAI","type":"string","required":false}, + {"name":"plmnIdList","type":"string","required":false}, + {"name":"sST","type":"integer","required":false}, + {"name":"areaTrafficCapUL","type":"integer","required":false}, + {"name":"uEMobilityLevel","type":"string","required":false}, + {"name":"expDataRateDL","type":"integer","required":false}, + {"name":"nstar0_allottedresource0_providing_service_invariant_uuid","type":"string","required":true}, + {"name":"coverageAreaTAList","type":"string","required":false}, + {"name":"activityFactor","type":"integer","required":false}, + {"name":"resourceSharingLevel","type":"string","required":false}] + """) + decomposition.setServiceInfo(serviceInfo) + + ModelInfo modelInfo = new ModelInfo() + modelInfo.setModelInvariantUuid("e75698d9-925a-4cdd-a6c0-edacbe6a0b51") + modelInfo.setModelUuid("8ee5926d-720b-4bb2-86f9-d20e921c143b") + decomposition.setModelInfo(modelInfo) + + when(mockExecution.getVariable("e2eServiceDecomposition")).thenReturn(decomposition) + when(mockExecution.getVariable("csInputMap")).thenReturn(getExpectCsInputMap()) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.generateE2EServiceProfile(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("e2eInputMap"), captor.capture()) + def csInputMap = captor.getValue() + assertEquals(csInputMap, getExpectE2eInputMap()) + } + + private static Map<String, Object> getExpectE2eInputMap() { + Map<String, Object> e2eInputMap = new HashMap<>() + e2eInputMap.put("nstar0_allottedresource0_providing_service_uuid", null) + e2eInputMap.put("nstar0_allottedresource0_providing_service_invariant_uuid", null) + e2eInputMap.put("areaTrafficCapDL", 100) + e2eInputMap.put("areaTrafficCapUL", 100) + e2eInputMap.put("expDataRateDL", 10) + e2eInputMap.put("expDataRateUL", 30) + e2eInputMap.put("latency", 20) + e2eInputMap.put("maxNumberofUEs", 300) + e2eInputMap.put("uEMobilityLevel", "stationary") + e2eInputMap.put("resourceSharingLevel", "shared") + e2eInputMap.put("coverageAreaTAList", "01001") + e2eInputMap.put("sST", null) + e2eInputMap.put("activityFactor", 0) + e2eInputMap.put("plmnIdList", "39-00") + e2eInputMap.put("sNSSAI", null) + + return e2eInputMap + } + + @Test + void testPreRequestSend2NSMF() { + when(mockExecution.getVariable("e2eInputMap")).thenReturn(getExpectE2eInputMap()) + when(mockExecution.getVariable("csServiceName")).thenReturn("testName") + when(mockExecution.getVariable("modelUuid")).thenReturn("12345") + when(mockExecution.getVariable("e2eModelInvariantUuid")).thenReturn("54321") + when(mockExecution.getVariable("e2eModelUuid")).thenReturn("11111") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("test111") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5GConsumer") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.preRequestSend2NSMF(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("CSMF_NSMFRequest"), captor.capture()) + String resultSuccess = captor.getValue() + + def expectMap = getExpectE2eInputMap() + expectMap.put("nstar0_allottedresource0_providing_service_uuid", null) + expectMap.put("nstar0_allottedresource0_providing_service_invariant_uuid", null) + + String expect = """ + { + "service":{ + "name": "testName", + "description": "e2eService of 12345", + "serviceInvariantUuid": "54321", + "serviceUuid": "11111", + "globalSubscriberId": "test111", + "serviceType": "5GConsumer", + "parameters":{ + "requestInputs": ${expectMap as JSONObject} + } + } + } + """ + assertEquals(expect.replaceAll("\\s+", ""), resultSuccess.replaceAll("\\s+", "")) + } + + @Test + void testProcessNSMFResponseSuccess() { + when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(202) + when(mockExecution.getVariable("CSMF_NSMFResponse")).thenReturn(""" + { + "service": { + "serviceId": "945063ff-1a01-4944-9232-8e7999e0d5e4", + "operationId": "e3819a23-3777-4172-a834-35ee78acf3f4" + } + } + """) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.processNSMFResponse(mockExecution) + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + def resultSuccess = captor.getAllValues() + + def expect = new ArrayList<>() + expect.add("e2eServiceInstanceId") + expect.add("945063ff-1a01-4944-9232-8e7999e0d5e4") + expect.add("e2eOperationId") + expect.add("e3819a23-3777-4172-a834-35ee78acf3f4") + expect.add("ProcessNsmfSuccess") + expect.add("OK") + assertEquals(expect, resultSuccess) + } + + @Test + void testProcessNSMFResponseError() { + when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(500) + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.processNSMFResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("ProcessNsmfSuccess"), captor.capture()) + String resultSuccess = captor.getValue() + assertEquals("ERROR", resultSuccess) + } + + @Test + void testPrepareUpdateOperationStatus() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")) + .thenReturn("http://localhost:28090/dbadapters/RequestsDbAdapter") + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareUpdateOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + + String expect = getExpectPayload("updateServiceOperationStatus", "processing", "20", + "communication service create operation processing: waiting nsmf service create finished") + + assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", "")) + } + + + @Test + void testPrepareCallCheckProcessStatus() { + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.prepareCallCheckProcessStatus(mockExecution) + Mockito.verify(mockExecution, times(10)).setVariable(captor.capture(), captor.capture()) + def resultSuccess = captor.getAllValues() + assertNotNull(resultSuccess) + } + + + @Test + void testPrepareCompleteStatus() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + when(mockExecution.getVariable("operationContent")) + .thenReturn("communication service create operation finished") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + when(mockExecution.getVariable("operationStatus")) + .thenReturn("processing") + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareCompleteStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + + String expect = getExpectPayload("updateServiceOperationStatus", "processing", "100", + "communication service create operation finished") + + assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", "")) + } + + private static String getExpectPayload(String type, String result, String progress, String operationContent) { + String expect = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:${type} xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>12345</serviceId> + <operationId>54321</operationId> + <operationType>CREATE</operationType> + <userId>11111</userId> + <result>${result}</result> + <operationContent>${operationContent}</operationContent> + <progress>${progress}</progress> + <reason></reason> + </ns:${type}> + </soapenv:Body> + </soapenv:Envelope> + """ + return expect + } + + private void mockData() { + when(mockExecution.getVariable("uuiRequest")).thenReturn("""{ + "service":{ + "name":"CSMFService", + "description":"CSMFService", + "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "globalSubscriberId":"5GCustomer", + "serviceType":"5G", + "parameters":{ + "requestInputs":{ + "expDataRateDL":10, + "expDataRateUL":30, + "latency":20, + "maxNumberofUEs":300, + "uemobilityLevel":"stationary", + "resourceSharingLevel":"shared", + "coverageAreaList": "01001", + "useInterval":"3" + } + } + } + }""") + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy new file mode 100644 index 0000000000..3beae9aee0 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy @@ -0,0 +1,264 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory + +import javax.ws.rs.NotFoundException + +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.* + +public class DeleteCommunicationServiceTest extends MsoGroovyTest { + + @Before + void init() throws IOException { + super.init("DeleteCommunicationServiceTest") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(""" + { + "globalSubscriberId ":"5GCustomer", + "serviceType ":"5G" + }""".replaceAll("\\\\s+", "")) + when(mockExecution.getVariable("mso-request-id")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82") + + DeleteCommunicationService delCS = new DeleteCommunicationService() + delCS.preProcessRequest(mockExecution) + Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture()) + List<ExecutionEntity> values = captor.getAllValues() + assertNotNull(values) + } + + @Test + void testPreInitUpdateOperationStatus(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test") + when(mockExecution.getVariable("result")).thenReturn("processing") + when(mockExecution.getVariable("progress")).thenReturn("0") + when(mockExecution.getVariable("operationContent")).thenReturn("delete communication service operation start") + + DeleteCommunicationService delCS = new DeleteCommunicationService() + delCS.preInitUpdateOperationStatus(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getAllValues() + assertNotNull(updateOperationStatus) + } + + @Test + void testQueryCommunicationSeriveFromAAI(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + DeleteCommunicationService obj = spy(DeleteCommunicationService.class) + + AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceReturn()) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + obj.queryCommunicationSeriveFromAAI(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("e2eSliceServiceInstanceId"), captor.capture()) + String e2eSliceServiceInstanceId = captor.getValue() + assertNotNull(e2eSliceServiceInstanceId) + } + + @Test + void testPrepareCallCheckProcessStatus(){ + DeleteCommunicationService dcs = new DeleteCommunicationService() + dcs.prepareCallCheckProcessStatus(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("endProgress"), captor.capture()) + int endProgress = captor.getValue() + assertEquals(90,endProgress) + } + + @Test + void testDelCSProfileFromAAI() + { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceProfile()) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-111111") + + DeleteCommunicationService obj = spy(DeleteCommunicationService.class) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.exists(profileUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + doNothing().when(client).delete(profileUri) + obj.delCSProfileFromAAI(mockExecution) + Mockito.verify(client,times(1)).delete(profileUri) + } + + @Test + void testPrepareFailureStatus(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test") + when(mockExecution.getVariable("result")).thenReturn("finished") + when(mockExecution.getVariable("progress")).thenReturn("100") + when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure.") + + DeleteCommunicationService dcs = new DeleteCommunicationService() + dcs.prepareFailureStatus(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getAllValues() + assertNotNull(updateOperationStatus) + } + + @Test + void testDelCSFromAAI(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + DeleteCommunicationService obj = spy(DeleteCommunicationService.class) + when(obj.getAAIClient()).thenReturn(client) + doNothing().when(client).delete(serviceInstanceUri) + + obj.delCSFromAAI(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getAllValues() + assertNotNull(updateOperationStatus) + } + + @Test + void testPreFailedOperationStatus(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test") + when(mockExecution.getVariable("result")).thenReturn("error") + when(mockExecution.getVariable("progress")).thenReturn("100") + when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure") + + DeleteCommunicationService deleteCommunicationService = new DeleteCommunicationService() + WorkflowException exception = new WorkflowException("11113",7000,"terminate service failure") + when(mockExecution.getVariable("WorkflowException")).thenReturn(exception) + deleteCommunicationService.preFailedOperationStatus(mockExecution) + + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getAllValues() + assertNotNull(updateOperationStatus) + } + + + private String mockQueryCommunicationServiceReturn() + { + String expect = + """{ + "service-instance-id": "5G-666", + "service-instance-name": "eMBB_Slice_Communication_Service_5GCustomer", + "service-type": "eMBB", + "service-role": "communication-service", + "environment-context": "01-010101", + "workload-context": "12", + "created-at": "2019-12-11 19:56:00", + "description": "", + "model-invariant-id": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "model-version-id": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "service-instance-location-id": "300-01|300-02", + "resource-version": "1582623470778", + "orchestration-status": "created", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-777", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5G-777" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eMBB_e2e_Slice_Service_5GCustomer" + } + ] + } + ] + } + }""" + return expect + } + + private String mockQueryCommunicationServiceProfile() + { + String expect = + """{ + "communication-service-profile": [ + { + "profile-id": "5G-111111", + "max-number-of-UEs": 50, + "coverage-area-list": "longgang,futian", + "latency": 20, + "exp-data-rate-UL": 300, + "exp-data-rate-DL": 500, + "ue-mobility-level": "stationary", + "resource-sharing-level": "Non-Shared", + "resource-version": "1577454950460" + } + ] + }""" + return expect + } + + + + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy new file mode 100644 index 0000000000..37207f8022 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy @@ -0,0 +1,196 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.aai.domain.yang.CommunicationServiceProfile +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.client.aai.AAIResourcesClient + +import static com.shazam.shazamcrest.MatcherAssert.assertThat +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.* + +class DoCreateCommunicationServiceTest extends MsoGroovyTest { + + private DoCreateCommunicationService communicationService = new DoCreateCommunicationService() + + @Before + public void setUp() throws Exception { + super.init("DoCreateCommunicationService") + communicationService.client = spy(AAIResourcesClient.class) + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + public void testPreProcessRequest(){ + mockData() + DoCreateCommunicationService communicationService = new DoCreateCommunicationService() + communicationService.preProcessRequest(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + assertNotNull(captor.getAllValues()) + } + + @Test + public void testCreateCommunicationService() { + mockData() + ServiceInstance expectedServiceInstanceData = getExpectedServiceInstance() + + try { + communicationService.createCommunicationService(mockExecution) + } catch (Exception e) { + + assertEquals(e.class, BpmnError.class) + } + + + Mockito.verify(mockExecution).setVariable(eq("communicationServiceInstance"), captor.capture()) + ServiceInstance resData = captor.getValue() + resData.setCreatedAt("") + resData.setEnvironmentContext("") + assertThat(resData, sameBeanAs(expectedServiceInstanceData)) + } + + @Test + public void testCreateCommunicationServiceProfile() { + mockData() + DoCreateCommunicationService communicationService = new DoCreateCommunicationService() + + CommunicationServiceProfile expectedServiceInstanceData = getExpectedServiceInstanceProfile() + + try { + communicationService.createCommunicationServiceProfile(mockExecution) + } catch (Exception e) { + assertEquals(e.class, BpmnError.class) + } + + Mockito.verify(mockExecution).setVariable(eq("communicationServiceInstanceProfile"), captor.capture()) + CommunicationServiceProfile resData = captor.getValue() + resData.setProfileId("") + assertThat(resData, sameBeanAs(expectedServiceInstanceData)) + } + + private static CommunicationServiceProfile getExpectedServiceInstanceProfile() { + CommunicationServiceProfile expectedServiceInstanceData = new CommunicationServiceProfile() + expectedServiceInstanceData.setProfileId("") + expectedServiceInstanceData.setLatency(20) + expectedServiceInstanceData.setMaxNumberOfUEs(300) + expectedServiceInstanceData.setUeMobilityLevel("stationary") + expectedServiceInstanceData.setResourceSharingLevel("shared") + expectedServiceInstanceData.setExpDataRateUL(30) + expectedServiceInstanceData.setExpDataRateDL(10) + expectedServiceInstanceData.setCoverageAreaList("01001") + return expectedServiceInstanceData + } + + private static ServiceInstance getExpectedServiceInstance() { + ServiceInstance expectedServiceInstanceData = new ServiceInstance() + expectedServiceInstanceData.setServiceInstanceName("CSMFService") + expectedServiceInstanceData.setServiceRole("communication-service") + expectedServiceInstanceData.setOrchestrationStatus("processing") + expectedServiceInstanceData.setModelInvariantId("e75698d9-925a-4cdd-a6c0-edacbe6a0b51") + expectedServiceInstanceData.setModelVersionId("8ee5926d-720b-4bb2-86f9-d20e921c143b") + expectedServiceInstanceData.setInputParameters("""{ + "service":{ + "name":"CSMFService", + "description":"CSMFService", + "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "globalSubscriberId":"5GCustomer", + "serviceType":"5G", + "parameters":{ + "requestInputs":{ + "expDataRateDL":10, + "expDataRateUL":30, + "latency":20, + "maxNumberofUEs":300, + "uemobilityLevel":"stationary", + "resourceSharingLevel":"shared", + "coverageAreaList": "01001", + "useInterval":"3" + } + } + } + }""") + expectedServiceInstanceData.setWorkloadContext("3") + expectedServiceInstanceData.setCreatedAt("") + expectedServiceInstanceData.setEnvironmentContext("") + return expectedServiceInstanceData + } + + private void mockData() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("CSMFService") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + when(mockExecution.getVariable("uuiRequest")).thenReturn("""{ + "service":{ + "name":"CSMFService", + "description":"CSMFService", + "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "globalSubscriberId":"5GCustomer", + "serviceType":"5G", + "parameters":{ + "requestInputs":{ + "expDataRateDL":10, + "expDataRateUL":30, + "latency":20, + "maxNumberofUEs":300, + "uemobilityLevel":"stationary", + "resourceSharingLevel":"shared", + "coverageAreaList": "01001", + "useInterval":"3" + } + } + } + }""") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + Map<String, Object> csInputMap = new HashMap<>() + csInputMap.put("expDataRateDL", 10) + csInputMap.put("expDataRateUL", 30) + csInputMap.put("latency", 20) + csInputMap.put("maxNumberofUEs", 300) + csInputMap.put("uEMobilityLevel", "stationary") + csInputMap.put("resourceSharingLevel", "shared") + csInputMap.put("coverageAreaTAList", "01001") + csInputMap.put("useInterval", "3") + + when(mockExecution.getVariable("csInputMap")).thenReturn(csInputMap) + + when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("e75698d9-925a-4cdd-a6c0-edacbe6a0b51") + when(mockExecution.getVariable("modelUuid")).thenReturn("8ee5926d-720b-4bb2-86f9-d20e921c143b") + when(mockExecution.getVariable("useInterval")).thenReturn("3") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn new file mode 100644 index 0000000000..cd4cf473a6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn @@ -0,0 +1,372 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:error id="Error_0l3pcnc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn:error id="Error_1eyu7sx" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn:collaboration id="Collaboration_0htncd8"> + <bpmn:participant id="ActivateSliceService01" name="ActivateSliceService" processRef="ActivateSliceService" /> + </bpmn:collaboration> + <bpmn:process id="ActivateSliceService" name="ActivateSliceService" isExecutable="true"> + <bpmn:scriptTask id="Task_1vscxgp" name="Update the status of SNSSAI and NSI and NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1jp9gjt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1gkpl5q</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.updateStatusSNSSAIandNSIandNSSI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0cbth6k" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1gkpl5q</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0pzts4p</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSliceService() +csi.prepareCompletionRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_1aymwlt" name="Update Service Operation Status to Success"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0pzts4p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ozefu5</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_0d1g3mv"> + <bpmn:incoming>SequenceFlow_0r611x8</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ozefu5</bpmn:incoming> + </bpmn:endEvent> + <bpmn:endEvent id="EndEvent_1pujgw8"> + <bpmn:incoming>SequenceFlow_1qa8miv</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_17jklyl" errorRef="Error_1eyu7sx" /> + </bpmn:endEvent> + <bpmn:exclusiveGateway id="ExclusiveGateway_0z7s0nx" name="IsSuccessfull"> + <bpmn:incoming>SequenceFlow_00ba5l9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jp9gjt</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1qa8miv</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:callActivity id="CallActivity_1cvb0iq" name="Send command NSSMF" calledElement="DoSendCommandToNSSMF"> + <bpmn:extensionElements> + <camunda:in source="nssiMap" target="nssiMap" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:in source="NSIserviceid" target="NSIserviceid" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="isNSSIActivate" target="isNSSIActivate" /> + <camunda:in source="snssai" target="snssai" /> + <camunda:in source="e2eserviceInstanceId" target="e2eserviceInstanceId" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="activationCount" target="activationCount" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1o4zjvp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00ba5l9</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_04p0zjj" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1yus0c1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uqgdxr</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSliceService() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_1o8fe1v" name="check AAI Orch Status of slice" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1uqgdxr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_149lhmo</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.checkAAIOrchStatusofslice(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0fcc3uy" name="Success?"> + <bpmn:incoming>SequenceFlow_149lhmo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15fdf5d</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0r611x8</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="Task_08zavab" name="PrepareActiviation" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_15fdf5d</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_144cqr9</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.prepareActivation(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_18urz3r" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1av6du3</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yus0c1</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="Task_1ossedo" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0qksr1g</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_183ypky</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1g8cg9g" name="Any NSSI to activate?"> + <bpmn:incoming>SequenceFlow_144cqr9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1o4zjvp</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1pj1j1o</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:startEvent id="StartEvent_1"> + <bpmn:outgoing>SequenceFlow_0qksr1g</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1taw2p9"> + <bpmn:incoming>SequenceFlow_1pj1j1o</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_03iwehr" errorRef="Error_0l3pcnc" /> + </bpmn:endEvent> + <bpmn:scriptTask id="Task_13zoo6a" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_183ypky</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1av6du3</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.prepareInitServiceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> + <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1wd8iqk"> + <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming> + </bpmn:endEvent> + <bpmn:startEvent id="StartEvent_0hmwdqq"> + <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" /> + <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" /> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_1av6du3" sourceRef="Task_13zoo6a" targetRef="Task_18urz3r" /> + <bpmn:sequenceFlow id="SequenceFlow_1pj1j1o" name="no" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="EndEvent_1taw2p9"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0r611x8" name="NO" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="EndEvent_0d1g3mv"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1qa8miv" name="no" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="EndEvent_1pujgw8"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1jp9gjt" name="yes" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="Task_1vscxgp"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_00ba5l9" sourceRef="CallActivity_1cvb0iq" targetRef="ExclusiveGateway_0z7s0nx" /> + <bpmn:sequenceFlow id="SequenceFlow_1uqgdxr" sourceRef="ScriptTask_04p0zjj" targetRef="Task_1o8fe1v" /> + <bpmn:sequenceFlow id="SequenceFlow_0qksr1g" sourceRef="StartEvent_1" targetRef="Task_1ossedo" /> + <bpmn:sequenceFlow id="SequenceFlow_183ypky" sourceRef="Task_1ossedo" targetRef="Task_13zoo6a" /> + <bpmn:sequenceFlow id="SequenceFlow_1yus0c1" sourceRef="Task_18urz3r" targetRef="ScriptTask_04p0zjj" /> + <bpmn:sequenceFlow id="SequenceFlow_149lhmo" sourceRef="Task_1o8fe1v" targetRef="ExclusiveGateway_0fcc3uy" /> + <bpmn:sequenceFlow id="SequenceFlow_15fdf5d" name="yes" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="Task_08zavab"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_144cqr9" sourceRef="Task_08zavab" targetRef="ExclusiveGateway_1g8cg9g" /> + <bpmn:sequenceFlow id="SequenceFlow_1o4zjvp" name="yes" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="CallActivity_1cvb0iq"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1gkpl5q" sourceRef="Task_1vscxgp" targetRef="ScriptTask_0cbth6k" /> + <bpmn:sequenceFlow id="SequenceFlow_0pzts4p" sourceRef="ScriptTask_0cbth6k" targetRef="ServiceTask_1aymwlt" /> + <bpmn:sequenceFlow id="SequenceFlow_0ozefu5" sourceRef="ServiceTask_1aymwlt" targetRef="EndEvent_0d1g3mv" /> + </bpmn:process> + <bpmn:error id="Error_0vq6f5h" name="Error_3ai5jm1" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8"> + <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="ActivateSliceService01" isHorizontal="true"> + <dc:Bounds x="160" y="120" width="2290" height="990" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1qw5nm4_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true"> + <dc:Bounds x="935" y="680" width="810" height="180" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1azew71_di" bpmnElement="Task_01ooik6"> + <dc:Bounds x="1255" y="720" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk"> + <dc:Bounds x="1492" y="742" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq"> + <dc:Bounds x="1042" y="742" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo"> + <di:waypoint x="1078" y="760" /> + <di:waypoint x="1255" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao"> + <di:waypoint x="1355" y="760" /> + <di:waypoint x="1492" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1lb7w6u_di" bpmnElement="Task_1vscxgp"> + <dc:Bounds x="1670" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv"> + <dc:Bounds x="2212" y="332" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1pujgw8_di" bpmnElement="EndEvent_1pujgw8"> + <dc:Bounds x="1462" y="422" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0cbth6k_di" bpmnElement="ScriptTask_0cbth6k"> + <dc:Bounds x="1860" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0z7s0nx_di" bpmnElement="ExclusiveGateway_0z7s0nx" isMarkerVisible="true"> + <dc:Bounds x="1455" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1449" y="313" width="65" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1cvb0iq_di" bpmnElement="CallActivity_1cvb0iq"> + <dc:Bounds x="1290" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_04p0zjj_di" bpmnElement="ScriptTask_04p0zjj"> + <dc:Bounds x="695" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1nsbn4r_di" bpmnElement="Task_1o8fe1v"> + <dc:Bounds x="850" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0fcc3uy_di" bpmnElement="ExclusiveGateway_0fcc3uy" isMarkerVisible="true"> + <dc:Bounds x="975" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1006" y="315" width="49" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0g9vipz_di" bpmnElement="Task_08zavab"> + <dc:Bounds x="1060" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1tv1ow6_di" bpmnElement="Task_18urz3r"> + <dc:Bounds x="540" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0tam79l_di" bpmnElement="Task_1ossedo"> + <dc:Bounds x="290" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1g8cg9g_di" bpmnElement="ExclusiveGateway_1g8cg9g" isMarkerVisible="true"> + <dc:Bounds x="1195" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1141" y="406" width="58" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="212" y="332" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1o4zjvp_di" bpmnElement="SequenceFlow_1o4zjvp"> + <di:waypoint x="1220" y="350" /> + <di:waypoint x="1290" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1251" y="332" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_144cqr9_di" bpmnElement="SequenceFlow_144cqr9"> + <di:waypoint x="1160" y="350" /> + <di:waypoint x="1195" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15fdf5d_di" bpmnElement="SequenceFlow_15fdf5d"> + <di:waypoint x="1025" y="350" /> + <di:waypoint x="1060" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1034" y="332" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_149lhmo_di" bpmnElement="SequenceFlow_149lhmo"> + <di:waypoint x="950" y="350" /> + <di:waypoint x="975" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yus0c1_di" bpmnElement="SequenceFlow_1yus0c1"> + <di:waypoint x="640" y="350" /> + <di:waypoint x="695" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_183ypky_di" bpmnElement="SequenceFlow_183ypky"> + <di:waypoint x="390" y="350" /> + <di:waypoint x="420" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0qksr1g_di" bpmnElement="SequenceFlow_0qksr1g"> + <di:waypoint x="248" y="350" /> + <di:waypoint x="290" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1uqgdxr_di" bpmnElement="SequenceFlow_1uqgdxr"> + <di:waypoint x="795" y="350" /> + <di:waypoint x="850" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00ba5l9_di" bpmnElement="SequenceFlow_00ba5l9"> + <di:waypoint x="1390" y="350" /> + <di:waypoint x="1455" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jp9gjt_di" bpmnElement="SequenceFlow_1jp9gjt"> + <di:waypoint x="1505" y="350" /> + <di:waypoint x="1670" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1596" y="332" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1qa8miv_di" bpmnElement="SequenceFlow_1qa8miv"> + <di:waypoint x="1480" y="375" /> + <di:waypoint x="1480" y="422" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1489" y="383" width="12" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0r611x8_di" bpmnElement="SequenceFlow_0r611x8"> + <di:waypoint x="1000" y="375" /> + <di:waypoint x="1000" y="500" /> + <di:waypoint x="2230" y="500" /> + <di:waypoint x="2230" y="368" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1608" y="482" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pj1j1o_di" bpmnElement="SequenceFlow_1pj1j1o"> + <di:waypoint x="1220" y="375" /> + <di:waypoint x="1220" y="422" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1199" y="378" width="12" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1taw2p9_di" bpmnElement="EndEvent_1taw2p9"> + <dc:Bounds x="1202" y="422" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0uwsu46_di" bpmnElement="Task_13zoo6a"> + <dc:Bounds x="420" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1av6du3_di" bpmnElement="SequenceFlow_1av6du3"> + <di:waypoint x="520" y="350" /> + <di:waypoint x="540" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1aymwlt_di" bpmnElement="ServiceTask_1aymwlt"> + <dc:Bounds x="2020" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ozefu5_di" bpmnElement="SequenceFlow_0ozefu5"> + <di:waypoint x="2120" y="350" /> + <di:waypoint x="2212" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0pzts4p_di" bpmnElement="SequenceFlow_0pzts4p"> + <di:waypoint x="1960" y="350" /> + <di:waypoint x="2020" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1gkpl5q_di" bpmnElement="SequenceFlow_1gkpl5q"> + <di:waypoint x="1770" y="350" /> + <di:waypoint x="1860" y="350" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn new file mode 100644 index 0000000000..a632266c2e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn @@ -0,0 +1,635 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1xh5s36" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="CreateCommunicationService" name="CreateCommunicationService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start flow"> + <bpmn:outgoing>SequenceFlow_0lzwdto</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0lzwdto" sourceRef="StartEvent_1" targetRef="Task_1beyt5u" /> + <bpmn:sequenceFlow id="SequenceFlow_1gjmyhd" sourceRef="Task_1beyt5u" targetRef="Task_0dz4tto" /> + <bpmn:scriptTask id="Task_1beyt5u" name="PreProcessRequest" scriptFormat="groovy"> + <bpmn:extensionElements> + <camunda:properties> + <camunda:property /> + </camunda:properties> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0lzwdto</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1gjmyhd</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0dz4tto" name="Init Task Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1gjmyhd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vcepmd</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareInitOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1vcepmd" sourceRef="Task_0dz4tto" targetRef="ServiceTask_0ozije4" /> + <bpmn:serviceTask id="ServiceTask_0ozije4" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1vcepmd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ltd3dc</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="Task_1khpb1m" name="Generate E2EService Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0kypqg8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0akbbpi</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.generateE2EServiceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0siw5ye" name="Pre Request Send To NSMF" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0akbbpi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0j35uff</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.preRequestSend2NSMF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0y8x077" name="Send Request To NSMF"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${NSMF_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/json</camunda:entry> + <camunda:entry key="Authorization">Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CSMF_NSMFRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_NSMFResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_NSMFResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0j35uff</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1u66yqo</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="ServiceTask_0yyq6ly" name="Update Service Operation Status Creating"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1iiorr4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15mad8z</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="ServiceTask_1t0awxp" name="Update Service Operation Status Completed"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1inkg6e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0elkfli</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_0lu4p9e" name="end"> + <bpmn:incoming>SequenceFlow_0elkfli</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0elkfli" sourceRef="ServiceTask_1t0awxp" targetRef="EndEvent_0lu4p9e" /> + <bpmn:scriptTask id="Task_1a4kd0x" name="Create Relationship CS-SS" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1uvyn2n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1j65sro</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.createCSAndSSRelationship(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0akbbpi" sourceRef="Task_1khpb1m" targetRef="Task_0siw5ye" /> + <bpmn:callActivity id="CallCreateCommunicationService" name="CallCreateCommunicationService" calledElement="DoCreateCommunicationService"> + <bpmn:extensionElements> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="csInputMap" target="csInputMap" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" /> + <camunda:in source="modelUuid" target="modelUuid" /> + <camunda:in source="useInterval" target="useInterval" /> + <camunda:out source="sNSSAI_id" target="sNSSAI_id" /> + <camunda:out source="communicationProfileId" target="communicationProfileId" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ds2e2l</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0x9rd1d</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1ltd3dc" sourceRef="ServiceTask_0ozije4" targetRef="Task_0k0z1g4" /> + <bpmn:sequenceFlow id="SequenceFlow_0x9rd1d" sourceRef="CallCreateCommunicationService" targetRef="ExclusiveGateway_1djfumr" /> + <bpmn:scriptTask id="Task_0u6zuwq" name="Update Finish Status In AAI " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_114tqpz</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1fpj5vj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04321fy</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.updateFinishStatusInAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_04321fy" sourceRef="Task_0u6zuwq" targetRef="ScriptTask_1y7nvia" /> + <bpmn:sequenceFlow id="SequenceFlow_1inkg6e" sourceRef="ScriptTask_1y7nvia" targetRef="ServiceTask_1t0awxp" /> + <bpmn:scriptTask id="ScriptTask_1y7nvia" name="Prepare Complete Status in requestDB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_04321fy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1inkg6e</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareCompleteStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1iiorr4" sourceRef="Task_0z4msb8" targetRef="ServiceTask_0yyq6ly" /> + <bpmn:scriptTask id="Task_0z4msb8" name="Prepare Update Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1j65sro</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1iiorr4</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareUpdateOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="Task_0k0z1g4" name="Call DocomposeService" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="csServiceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="csServiceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ltd3dc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_13aldsi</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Task_1iyttxg" name="Prepare Compose E2E Template" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_13aldsi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1f1zdf9</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareDoComposeE2E(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0w00x24" name="Call e2e DocomposeService" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="e2eServiceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="e2eServiceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1f1zdf9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ofzxsf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1ofzxsf" sourceRef="CallActivity_0w00x24" targetRef="ScriptTask_0cdmkso" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1w15bcr" name="Goto Create Communication Service"> + <bpmn:incoming>SequenceFlow_18guyhw</bpmn:incoming> + <bpmn:linkEventDefinition name="CreateCommunicationService" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_13aldsi" sourceRef="Task_0k0z1g4" targetRef="Task_1iyttxg" /> + <bpmn:sequenceFlow id="SequenceFlow_1f1zdf9" sourceRef="Task_1iyttxg" targetRef="CallActivity_0w00x24" /> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0mnp81i" name="CreateCommunicationService"> + <bpmn:outgoing>SequenceFlow_1ds2e2l</bpmn:outgoing> + <bpmn:linkEventDefinition name="CreateCommunicationService" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_1ds2e2l" sourceRef="IntermediateThrowEvent_0mnp81i" targetRef="CallCreateCommunicationService" /> + <bpmn:subProcess id="SubProcess_1rxymch" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:endEvent id="EndEvent_0zmwd5y"> + <bpmn:incoming>SequenceFlow_1kmsen3</bpmn:incoming> + </bpmn:endEvent> + <bpmn:startEvent id="StartEvent_0wgf0cs"> + <bpmn:outgoing>SequenceFlow_07fl9jy</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0uaz13d" /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_07fl9jy" sourceRef="StartEvent_0wgf0cs" targetRef="ScriptTask_18gv408" /> + <bpmn:scriptTask id="ScriptTask_18gv408" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_07fl9jy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1kmsen3</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1kmsen3" sourceRef="ScriptTask_18gv408" targetRef="EndEvent_0zmwd5y" /> + </bpmn:subProcess> + <bpmn:exclusiveGateway id="ExclusiveGateway_1djfumr" name="Is create in aai Successful?" default="SequenceFlow_0c89n51"> + <bpmn:incoming>SequenceFlow_0x9rd1d</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1b66kfh</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0c89n51</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1b66kfh" name="Yes" sourceRef="ExclusiveGateway_1djfumr" targetRef="ScriptTask_0sxtscf"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1r29nqs" name="Goto process NSMF"> + <bpmn:incoming>SequenceFlow_1u66yqo</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_1o65kbk" name="ProcessNSMF" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_08tr730" name="ProcessNSMF"> + <bpmn:outgoing>SequenceFlow_0hkz9h0</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_0g6ab6j" name="ProcessNSMF" /> + </bpmn:intermediateCatchEvent> + <bpmn:scriptTask id="ScriptTask_01pvcx5" name="Process NSMF response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0hkz9h0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_056nqyg</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.processNSMFResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_15mad8z" sourceRef="ServiceTask_0yyq6ly" targetRef="IntermediateThrowEvent_1u6yhg1" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1u6yhg1" name="Goto check processing status"> + <bpmn:incoming>SequenceFlow_15mad8z</bpmn:incoming> + <bpmn:linkEventDefinition name="CheckProcessingStatus" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_13zkj1k" name="CheckProcessingStatus"> + <bpmn:outgoing>SequenceFlow_0spge8t</bpmn:outgoing> + <bpmn:linkEventDefinition name="CheckProcessingStatus" /> + </bpmn:intermediateCatchEvent> + <bpmn:exclusiveGateway id="ExclusiveGateway_19x2qmv" name="Is nsmf ansyc response Successful?"> + <bpmn:incoming>SequenceFlow_056nqyg</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uvyn2n</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_114tqpz</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1uvyn2n" name="Yes" sourceRef="ExclusiveGateway_19x2qmv" targetRef="Task_1a4kd0x"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ProcessNsmfSuccess") == "OK"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1j65sro" sourceRef="Task_1a4kd0x" targetRef="Task_0z4msb8" /> + <bpmn:sequenceFlow id="SequenceFlow_056nqyg" sourceRef="ScriptTask_01pvcx5" targetRef="ExclusiveGateway_19x2qmv" /> + <bpmn:endEvent id="EndEvent_1g8f1f0"> + <bpmn:incoming>SequenceFlow_0c89n51</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_1w6xfoc" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0c89n51" name="no" sourceRef="ExclusiveGateway_1djfumr" targetRef="EndEvent_1g8f1f0" /> + <bpmn:sequenceFlow id="SequenceFlow_114tqpz" name="No" sourceRef="ExclusiveGateway_19x2qmv" targetRef="Task_0u6zuwq"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ProcessNsmfSuccess") == "ERROR"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_0sxtscf" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1b66kfh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kypqg8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0cdmkso" name="Parse CS Params From Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ofzxsf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18guyhw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.parseCSParamsFromReq(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_18guyhw" sourceRef="ScriptTask_0cdmkso" targetRef="IntermediateThrowEvent_1w15bcr" /> + <bpmn:sequenceFlow id="SequenceFlow_0kypqg8" sourceRef="ScriptTask_0sxtscf" targetRef="Task_1khpb1m" /> + <bpmn:callActivity id="CallCheckServiceProcessStatus" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus"> + <bpmn:extensionElements> + <camunda:in source="e2eServiceInstanceId" target="serviceInstanceId" /> + <camunda:in source="e2eOperationId" target="operationId" /> + <camunda:in source="successConditions" target="successConditions" /> + <camunda:in source="processServiceType" target="processServiceType" /> + <camunda:in source="errorConditions" target="errorConditions" /> + <camunda:in source="timeOut" target="timeOut" /> + <camunda:in source="successParamMap" target="successParamMap" /> + <camunda:in source="errorParamMap" target="errorParamMap" /> + <camunda:out source="orchestrationStatus" target="orchestrationStatus" /> + <camunda:out source="operationStatus" target="operationStatus" /> + <camunda:out source="operationContent" target="operationContent" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="timeOutParamMap" target="timeOutParamMap" /> + <camunda:in source="subOperationType" target="operationType" /> + <camunda:in source="initProgress" target="initProgress" /> + <camunda:in source="endProgress" target="endProgress" /> + <camunda:in source="serviceInstanceId" target="parentServiceInstanceId" /> + <camunda:in source="operationId" target="parentOperationId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_079hxvu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1fpj5vj</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1fpj5vj" sourceRef="CallCheckServiceProcessStatus" targetRef="Task_0u6zuwq" /> + <bpmn:sequenceFlow id="SequenceFlow_0spge8t" sourceRef="IntermediateThrowEvent_13zkj1k" targetRef="Task_0misguw" /> + <bpmn:scriptTask id="Task_0misguw" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0spge8t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_079hxvu</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateCommunicationService() +csi.prepareCallCheckProcessStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_079hxvu" sourceRef="Task_0misguw" targetRef="CallCheckServiceProcessStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_0j35uff" sourceRef="Task_0siw5ye" targetRef="ServiceTask_0y8x077" /> + <bpmn:sequenceFlow id="SequenceFlow_1u66yqo" sourceRef="ServiceTask_0y8x077" targetRef="IntermediateThrowEvent_1r29nqs" /> + <bpmn:sequenceFlow id="SequenceFlow_0hkz9h0" sourceRef="IntermediateCatchEvent_08tr730" targetRef="ScriptTask_01pvcx5" /> + </bpmn:process> + <bpmn:error id="Error_1w6xfoc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateCommunicationService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="162" y="99" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="158" y="142" width="46" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0lzwdto_di" bpmnElement="SequenceFlow_0lzwdto"> + <di:waypoint x="198" y="117" /> + <di:waypoint x="250" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1gjmyhd_di" bpmnElement="SequenceFlow_1gjmyhd"> + <di:waypoint x="350" y="117" /> + <di:waypoint x="390" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1jxjk8b_di" bpmnElement="Task_1beyt5u"> + <dc:Bounds x="250" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1a9q04w_di" bpmnElement="Task_0dz4tto"> + <dc:Bounds x="390" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1vcepmd_di" bpmnElement="SequenceFlow_1vcepmd"> + <di:waypoint x="490" y="117" /> + <di:waypoint x="550" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0ozije4_di" bpmnElement="ServiceTask_0ozije4"> + <dc:Bounds x="550" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_12shhv4_di" bpmnElement="Task_1khpb1m"> + <dc:Bounds x="710" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1fiq8pw_di" bpmnElement="Task_0siw5ye"> + <dc:Bounds x="890" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0y8x077_di" bpmnElement="ServiceTask_0y8x077"> + <dc:Bounds x="1120" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0yyq6ly_di" bpmnElement="ServiceTask_0yyq6ly"> + <dc:Bounds x="1230" y="496" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1t0awxp_di" bpmnElement="ServiceTask_1t0awxp"> + <dc:Bounds x="1230" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0lu4p9e_di" bpmnElement="EndEvent_0lu4p9e"> + <dc:Bounds x="1382" y="804" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1390" y="850" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0elkfli_di" bpmnElement="SequenceFlow_0elkfli"> + <di:waypoint x="1330" y="822" /> + <di:waypoint x="1382" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1q4zssd_di" bpmnElement="Task_1a4kd0x"> + <dc:Bounds x="910" y="496" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0akbbpi_di" bpmnElement="SequenceFlow_0akbbpi"> + <di:waypoint x="810" y="306" /> + <di:waypoint x="890" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1d14p1s_di" bpmnElement="CallCreateCommunicationService"> + <dc:Bounds x="250" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ltd3dc_di" bpmnElement="SequenceFlow_1ltd3dc"> + <di:waypoint x="650" y="117" /> + <di:waypoint x="720" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0x9rd1d_di" bpmnElement="SequenceFlow_0x9rd1d"> + <di:waypoint x="350" y="306" /> + <di:waypoint x="415" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1anjycx_di" bpmnElement="Task_0u6zuwq"> + <dc:Bounds x="910" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_04321fy_di" bpmnElement="SequenceFlow_04321fy"> + <di:waypoint x="1010" y="822" /> + <di:waypoint x="1080" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1inkg6e_di" bpmnElement="SequenceFlow_1inkg6e"> + <di:waypoint x="1180" y="822" /> + <di:waypoint x="1230" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1y7nvia_di" bpmnElement="ScriptTask_1y7nvia"> + <dc:Bounds x="1080" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1iiorr4_di" bpmnElement="SequenceFlow_1iiorr4"> + <di:waypoint x="1180" y="536" /> + <di:waypoint x="1230" y="536" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1rv123h_di" bpmnElement="Task_0z4msb8"> + <dc:Bounds x="1080" y="496" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0z3vej2_di" bpmnElement="Task_0k0z1g4"> + <dc:Bounds x="720" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_04n3rws_di" bpmnElement="Task_1iyttxg"> + <dc:Bounds x="890" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0w00x24_di" bpmnElement="CallActivity_0w00x24"> + <dc:Bounds x="1040" y="74" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ofzxsf_di" bpmnElement="SequenceFlow_1ofzxsf"> + <di:waypoint x="1140" y="114" /> + <di:waypoint x="1210" y="114" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1lz4unp_di" bpmnElement="IntermediateThrowEvent_1w15bcr"> + <dc:Bounds x="1382" y="96" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1364" y="139" width="77" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13aldsi_di" bpmnElement="SequenceFlow_13aldsi"> + <di:waypoint x="820" y="117" /> + <di:waypoint x="890" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1f1zdf9_di" bpmnElement="SequenceFlow_1f1zdf9"> + <di:waypoint x="990" y="117" /> + <di:waypoint x="1040" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0r2oht8_di" bpmnElement="IntermediateThrowEvent_0mnp81i"> + <dc:Bounds x="162" y="288" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="139" y="331" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ds2e2l_di" bpmnElement="SequenceFlow_1ds2e2l"> + <di:waypoint x="198" y="306" /> + <di:waypoint x="250" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_1rxymch_di" bpmnElement="SubProcess_1rxymch" isExpanded="true"> + <dc:Bounds x="290" y="1053" width="781" height="196" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0zmwd5y_di" bpmnElement="EndEvent_0zmwd5y"> + <dc:Bounds x="1002" y="1139" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1djfumr_di" bpmnElement="ExclusiveGateway_1djfumr" isMarkerVisible="true"> + <dc:Bounds x="415" y="281" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="404" y="244" width="73" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1b66kfh_di" bpmnElement="SequenceFlow_1b66kfh"> + <di:waypoint x="465" y="306" /> + <di:waypoint x="530" y="306" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="491" y="288" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1r29nqs_di" bpmnElement="IntermediateThrowEvent_1r29nqs"> + <dc:Bounds x="1382" y="288" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1371" y="331" width="66" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_08tr730_di" bpmnElement="IntermediateCatchEvent_08tr730"> + <dc:Bounds x="162" y="518" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="148" y="561" width="72" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_01pvcx5_di" bpmnElement="ScriptTask_01pvcx5"> + <dc:Bounds x="390" y="496" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15mad8z_di" bpmnElement="SequenceFlow_15mad8z"> + <di:waypoint x="1330" y="536" /> + <di:waypoint x="1382" y="536" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0kwoo94_di" bpmnElement="IntermediateThrowEvent_1u6yhg1"> + <dc:Bounds x="1382" y="518" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1359" y="561" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0ky7904_di" bpmnElement="IntermediateThrowEvent_13zkj1k"> + <dc:Bounds x="162" y="804" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="138" y="847" width="86" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_19x2qmv_di" bpmnElement="ExclusiveGateway_19x2qmv" isMarkerVisible="true"> + <dc:Bounds x="605" y="511" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="602" y="472" width="68" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1uvyn2n_di" bpmnElement="SequenceFlow_1uvyn2n"> + <di:waypoint x="655" y="536" /> + <di:waypoint x="910" y="536" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="741" y="519" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1j65sro_di" bpmnElement="SequenceFlow_1j65sro"> + <di:waypoint x="1010" y="536" /> + <di:waypoint x="1080" y="536" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_056nqyg_di" bpmnElement="SequenceFlow_056nqyg"> + <di:waypoint x="490" y="536" /> + <di:waypoint x="605" y="536" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_0wgf0cs_di" bpmnElement="StartEvent_0wgf0cs"> + <dc:Bounds x="332" y="1139" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_07fl9jy_di" bpmnElement="SequenceFlow_07fl9jy"> + <di:waypoint x="368" y="1157" /> + <di:waypoint x="620" y="1157" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1bombkp_di" bpmnElement="EndEvent_1g8f1f0"> + <dc:Bounds x="422" y="392" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0c89n51_di" bpmnElement="SequenceFlow_0c89n51"> + <di:waypoint x="440" y="331" /> + <di:waypoint x="440" y="392" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="449" y="345" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_18gv408_di" bpmnElement="ScriptTask_18gv408"> + <dc:Bounds x="620" y="1117" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1kmsen3_di" bpmnElement="SequenceFlow_1kmsen3"> + <di:waypoint x="720" y="1157" /> + <di:waypoint x="1002" y="1157" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_114tqpz_di" bpmnElement="SequenceFlow_114tqpz"> + <di:waypoint x="630" y="561" /> + <di:waypoint x="630" y="630" /> + <di:waypoint x="980" y="630" /> + <di:waypoint x="980" y="782" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="799" y="612" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0sxtscf_di" bpmnElement="ScriptTask_0sxtscf"> + <dc:Bounds x="530" y="266" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0cdmkso_di" bpmnElement="ScriptTask_0cdmkso"> + <dc:Bounds x="1210" y="74" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_18guyhw_di" bpmnElement="SequenceFlow_18guyhw"> + <di:waypoint x="1310" y="114" /> + <di:waypoint x="1382" y="114" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kypqg8_di" bpmnElement="SequenceFlow_0kypqg8"> + <di:waypoint x="630" y="306" /> + <di:waypoint x="710" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0oktqmg_di" bpmnElement="CallCheckServiceProcessStatus"> + <dc:Bounds x="620" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fpj5vj_di" bpmnElement="SequenceFlow_1fpj5vj"> + <di:waypoint x="720" y="822" /> + <di:waypoint x="910" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0spge8t_di" bpmnElement="SequenceFlow_0spge8t"> + <di:waypoint x="198" y="822" /> + <di:waypoint x="330" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0bi31xq_di" bpmnElement="Task_0misguw"> + <dc:Bounds x="330" y="782" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_079hxvu_di" bpmnElement="SequenceFlow_079hxvu"> + <di:waypoint x="430" y="822" /> + <di:waypoint x="620" y="822" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0j35uff_di" bpmnElement="SequenceFlow_0j35uff"> + <di:waypoint x="990" y="306" /> + <di:waypoint x="1120" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1u66yqo_di" bpmnElement="SequenceFlow_1u66yqo"> + <di:waypoint x="1220" y="306" /> + <di:waypoint x="1382" y="306" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hkz9h0_di" bpmnElement="SequenceFlow_0hkz9h0"> + <di:waypoint x="198" y="536" /> + <di:waypoint x="390" y="536" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn new file mode 100644 index 0000000000..013e1b62c2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn @@ -0,0 +1,805 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.2"> + <bpmn:process id="Process_0r5eb97" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Slice Service Creation Flow"> + <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="Waiting for confirmation"> + <bpmn:outgoing>SequenceFlow_1fk37v7</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="WaitingForConfirmation" /> + </bpmn:intermediateCatchEvent> + <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css= new CreateSliceService() +css.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1jgtb0y" name="Process User Options" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1cv0wop</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_197cm2e</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.processUserOptions(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0elbczl" name="Continue Slice?" default="SequenceFlow_038lb9m"> + <bpmn:incoming>SequenceFlow_197cm2e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12t5exy</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_038lb9m</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="ScriptTask_0l3d1ai" name="Process Decomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1t19ips</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jrclmc</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.processDecomposition(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1eo3m4q" name="Get NST Selection" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_046irye</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1o23s0i</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.getNSTSelection(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_139l55g" name="Call DoCreateSliceServiceInstance " calledElement="DoCreateSliceServiceInstance"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="productFamilyId" target="productFamilyId" /> + <camunda:in source="serviceInputParams" target="serviceInputParams" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="requestAction" target="operationType" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="serviceProfile" target="serviceProfile" /> + <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> + <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> + <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> + <camunda:in source="sliceServiceDecomposition" target="sliceServiceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="rollbackData" target="rollbackData" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:out source="allottedResourceId" target="allottedResourceId" /> + <camunda:out source="serviceInstanceData" target="serviceInstanceData" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1p8vxo5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1g8m7tq</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1v96asi" name="Goto Waiting for Confirmation"> + <bpmn:incoming>SequenceFlow_0it2g9j</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_0uj34dx" name="WaitingForConfirmation" /> + </bpmn:intermediateThrowEvent> + <bpmn:scriptTask id="ScriptTask_0gb975b" name="Prepare Update Orchestration Task" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1aaozcg</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18kur12</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("taskStatus", "WaitingToConfirm") +def css = new CreateSliceService() +css.prepareUpdateOrchestrationTask(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_18eld2o" name="Is Slice Successful?" default="SequenceFlow_1c6ka9h"> + <bpmn:incoming>SequenceFlow_0mlrlbv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1c6ka9h</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0n4xku8</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_0x406rw"> + <bpmn:incoming>SequenceFlow_1c6ka9h</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0mlneuw" errorRef="Error_03akl5v" /> + </bpmn:endEvent> + <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1omdx56"> + <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1jx3026"> + <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" /> + <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" /> + </bpmn:subProcess> + <bpmn:scriptTask id="ScriptTask_1ef3voz" name="Prepare Update Orchestration Task" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0klb3ey</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("taskStatus", "Completed") +def css = new CreateSliceService() +css.prepareUpdateOrchestrationTask(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_05h01gx" name="End"> + <bpmn:incoming>SequenceFlow_11rbv41</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1xxag1o" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.prepareInitServiceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto Create Slice Service"> + <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="CreateSliceService" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1wii8im" name="Create Slice Service"> + <bpmn:outgoing>SequenceFlow_1o1tu0f</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_1krpcdk" name="CreateSliceService" /> + </bpmn:intermediateCatchEvent> + <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Service Oper Status((finish)" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0lbdfmt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("operationProgress", "100") +execution.setVariable("operationResult", "finished") +execution.setVariable("operationReason", "Slice completed") +def css = new CreateSliceService() +css.prepareUpdateServiceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0kd6p6p" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CSSOS_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:script scriptFormat="groovy">execution.getVariable("CSSOS_headerMap")</camunda:script> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CSSOS_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSSOS_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSSOS_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0t094g7</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_046irye</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:callActivity id="CallActivity_1bnkmaz" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="sliceServiceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0q7yc2c</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1t19ips</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0o2r07o" name="Prepare Decompose Service " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1o23s0i</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0q7yc2c</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi= new CreateSliceService() +dcsi.prepareDecomposeService(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0b7senu" name="Prepare Create OrchestrationTask" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1o1tu0f</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1sq6kp6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css= new CreateSliceService() +css.prepareCreateOrchestrationTask(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0h88mep" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1sq6kp6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1p8vxo5</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:callActivity id="CallActivity_0n47zoh" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_18kur12</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0it2g9j</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_12h8542" name="Prepare Update Orchestration Task" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_12t5exy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0thd6ny</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("taskStatus", "Creating") +def css = new CreateSliceService() +css.prepareUpdateOrchestrationTask(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0o89wmf" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0thd6ny</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0477975</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:callActivity id="CallActivity_0g98b71" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0h2oree</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1cv0wop</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_08wim95" name="Prepare Get User Options" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_16uz2t9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0h2oree</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.prepareGetUserOptions(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0jdzpem" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_19lsayh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10ng1vx</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1mscu5w" name="Prepare Update Orchestration Task" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_038lb9m</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19lsayh</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("taskStatus", "Aborted") +def css = new CreateSliceService() +css.prepareUpdateOrchestrationTask(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0pkvfun" name="Allocate Slice"> + <bpmn:outgoing>SequenceFlow_1bevt3a</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_1vlfclx" name="AllocateSlice" /> + </bpmn:intermediateCatchEvent> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ktwpki" name="Goto Allocate Slice"> + <bpmn:incoming>SequenceFlow_0477975</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_16f2ri9" name="AllocateSlice" /> + </bpmn:intermediateThrowEvent> + <bpmn:callActivity id="CallActivity_15pl4ld" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0klb3ey</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0lbdfmt</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_1oouvuh" name="End"> + <bpmn:incoming>SequenceFlow_10ng1vx</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="ServiceTask_0esr949" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CSSOS_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:script scriptFormat="groovy">execution.getVariable("CSSOS_headerMap")</camunda:script> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CSSOS_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSSOS_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSSOS_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11rbv41</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="ScriptTask_1jj846g" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1g8m7tq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ey6m1e</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new CreateSliceService() +css.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0cxst1i" name="Call DoAllocateNSIandNSSI " calledElement="DoAllocateNSIandNSSI"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="sliceServiceInstanceId" /> + <camunda:in source="serviceInstanceName" target="sliceServiceInstanceName" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="productFamilyId" target="productFamilyId" /> + <camunda:in source="disableRollback" target="disableRollback" /> + <camunda:in source="serviceInputParams" target="serviceInputParams" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="requestAction" target="operationType" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="serviceProfile" target="serviceProfile" /> + <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> + <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> + <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="resourceSharingLevel" target="resourceSharingLevel" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="rollbackData" target="rollbackData" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:in source="allottedResourceId" target="allottedResourceId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_0bh0kwx"> + <bpmn:incoming>SequenceFlow_12qt5ci</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1xa66sx" errorRef="Error_0p2naox" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> + <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="ScriptTask_1xxag1o" /> + <bpmn:sequenceFlow id="SequenceFlow_1cv0wop" sourceRef="CallActivity_0g98b71" targetRef="ScriptTask_1jgtb0y" /> + <bpmn:sequenceFlow id="SequenceFlow_197cm2e" sourceRef="ScriptTask_1jgtb0y" targetRef="ExclusiveGateway_0elbczl" /> + <bpmn:sequenceFlow id="SequenceFlow_12t5exy" name="continue" sourceRef="ExclusiveGateway_0elbczl" targetRef="ScriptTask_12h8542"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("taskAction") == "commit"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="abort" sourceRef="ExclusiveGateway_0elbczl" targetRef="ScriptTask_1mscu5w" /> + <bpmn:sequenceFlow id="SequenceFlow_1t19ips" sourceRef="CallActivity_1bnkmaz" targetRef="ScriptTask_0l3d1ai" /> + <bpmn:sequenceFlow id="SequenceFlow_1p8vxo5" sourceRef="CallActivity_0h88mep" targetRef="CallActivity_139l55g" /> + <bpmn:sequenceFlow id="SequenceFlow_1g8m7tq" sourceRef="CallActivity_139l55g" targetRef="ScriptTask_1jj846g" /> + <bpmn:sequenceFlow id="SequenceFlow_0it2g9j" sourceRef="CallActivity_0n47zoh" targetRef="IntermediateThrowEvent_1v96asi" /> + <bpmn:sequenceFlow id="SequenceFlow_18kur12" sourceRef="ScriptTask_0gb975b" targetRef="CallActivity_0n47zoh" /> + <bpmn:sequenceFlow id="SequenceFlow_0mlrlbv" sourceRef="CallActivity_0cxst1i" targetRef="ExclusiveGateway_18eld2o" /> + <bpmn:sequenceFlow id="SequenceFlow_1c6ka9h" name="No" sourceRef="ExclusiveGateway_18eld2o" targetRef="EndEvent_0x406rw" /> + <bpmn:sequenceFlow id="SequenceFlow_0n4xku8" name="Yes" sourceRef="ExclusiveGateway_18eld2o" targetRef="ScriptTask_19uxoi8"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0klb3ey" sourceRef="ScriptTask_1ef3voz" targetRef="CallActivity_15pl4ld" /> + <bpmn:sequenceFlow id="SequenceFlow_11rbv41" sourceRef="ServiceTask_0esr949" targetRef="EndEvent_05h01gx" /> + <bpmn:sequenceFlow id="SequenceFlow_0t094g7" sourceRef="ScriptTask_1xxag1o" targetRef="ServiceTask_0kd6p6p" /> + <bpmn:sequenceFlow id="SequenceFlow_1o1tu0f" sourceRef="IntermediateCatchEvent_1wii8im" targetRef="ScriptTask_0b7senu" /> + <bpmn:sequenceFlow id="SequenceFlow_0lbdfmt" sourceRef="CallActivity_15pl4ld" targetRef="ScriptTask_1ssh2l9" /> + <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="ServiceTask_0esr949" /> + <bpmn:sequenceFlow id="SequenceFlow_0q7yc2c" sourceRef="ScriptTask_0o2r07o" targetRef="CallActivity_1bnkmaz" /> + <bpmn:sequenceFlow id="SequenceFlow_1sq6kp6" sourceRef="ScriptTask_0b7senu" targetRef="CallActivity_0h88mep" /> + <bpmn:sequenceFlow id="SequenceFlow_0thd6ny" sourceRef="ScriptTask_12h8542" targetRef="CallActivity_0o89wmf" /> + <bpmn:sequenceFlow id="SequenceFlow_0477975" sourceRef="CallActivity_0o89wmf" targetRef="IntermediateThrowEvent_0ktwpki" /> + <bpmn:sequenceFlow id="SequenceFlow_0h2oree" sourceRef="ScriptTask_08wim95" targetRef="CallActivity_0g98b71" /> + <bpmn:sequenceFlow id="SequenceFlow_19lsayh" sourceRef="ScriptTask_1mscu5w" targetRef="CallActivity_0jdzpem" /> + <bpmn:sequenceFlow id="SequenceFlow_10ng1vx" sourceRef="CallActivity_0jdzpem" targetRef="EndEvent_1oouvuh" /> + <bpmn:sequenceFlow id="SequenceFlow_1bevt3a" sourceRef="IntermediateCatchEvent_0pkvfun" targetRef="CallActivity_0cxst1i" /> + <bpmn:sequenceFlow id="SequenceFlow_1ey6m1e" sourceRef="ScriptTask_1jj846g" targetRef="CallActivity_0v4mw2x" /> + <bpmn:receiveTask id="Task_1b5t88h" name="Waiting for confirmation" messageRef="Message_0c4b2r5"> + <bpmn:incoming>SequenceFlow_1fk37v7</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_16uz2t9</bpmn:outgoing> + </bpmn:receiveTask> + <bpmn:sequenceFlow id="SequenceFlow_1fk37v7" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="Task_1b5t88h" /> + <bpmn:sequenceFlow id="SequenceFlow_16uz2t9" sourceRef="Task_1b5t88h" targetRef="ScriptTask_08wim95" /> + <bpmn:boundaryEvent id="BoundaryEvent_0clo9pv" attachedToRef="Task_1b5t88h"> + <bpmn:outgoing>SequenceFlow_12qt5ci</bpmn:outgoing> + <bpmn:timerEventDefinition> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2H</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="SequenceFlow_12qt5ci" sourceRef="BoundaryEvent_0clo9pv" targetRef="EndEvent_0bh0kwx" /> + <bpmn:callActivity id="CallActivity_0v4mw2x" name="Call DoCreateSliceServiceOption " calledElement="DoCreateSliceServiceOption"> + <bpmn:extensionElements> + <camunda:in source="nstModelUuid" target="nstModelUuid" /> + <camunda:in source="nstModelInvariantUuid" target="nstModelInvariantUuid" /> + <camunda:in source="serviceProfile" target="serviceProfile" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="resourceSharingLevel" target="resourceSharingLevel" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="serviceType" target="serviceType" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ey6m1e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1aaozcg</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1aaozcg" sourceRef="CallActivity_0v4mw2x" targetRef="ScriptTask_0gb975b" /> + <bpmn:sequenceFlow id="SequenceFlow_046irye" sourceRef="ServiceTask_0kd6p6p" targetRef="ScriptTask_1eo3m4q" /> + <bpmn:sequenceFlow id="SequenceFlow_1o23s0i" sourceRef="ScriptTask_1eo3m4q" targetRef="ScriptTask_0o2r07o" /> + <bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" /> + <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("orchestrationStatus", "deactivated") +def css = new CreateSliceService() +css.updateAAIOrchStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ef3voz" /> + </bpmn:process> + <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" /> + <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0r5eb97"> + <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd"> + <dc:Bounds x="178" y="103" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="156" y="146" width="82" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0vilb24_di" bpmnElement="IntermediateCatchEvent_0vilb24"> + <dc:Bounds x="178" y="438" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="168" y="481" width="60" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge"> + <dc:Bounds x="285" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1jgtb0y_di" bpmnElement="ScriptTask_1jgtb0y"> + <dc:Bounds x="830" y="416" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true"> + <dc:Bounds x="1040" y="431" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1027" y="413" width="78" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai"> + <dc:Bounds x="1370" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1eo3m4q_di" bpmnElement="ScriptTask_1eo3m4q"> + <dc:Bounds x="830" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_139l55g_di" bpmnElement="CallActivity_139l55g"> + <dc:Bounds x="645" y="249" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1v96asi_di" bpmnElement="IntermediateThrowEvent_1v96asi"> + <dc:Bounds x="1584" y="271" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1567" y="312" width="81" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0gb975b_di" bpmnElement="ScriptTask_0gb975b"> + <dc:Bounds x="1193" y="249" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_18eld2o_di" bpmnElement="ExclusiveGateway_18eld2o" isMarkerVisible="true"> + <dc:Bounds x="488" y="776" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="483" y="746" width="60" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw"> + <dc:Bounds x="495" y="926" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true"> + <dc:Bounds x="685" y="1080" width="781" height="196" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ef3voz_di" bpmnElement="ScriptTask_1ef3voz"> + <dc:Bounds x="823" y="761" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx"> + <dc:Bounds x="1585" y="783" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1593" y="826" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o"> + <dc:Bounds x="468" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1ex8ke9_di" bpmnElement="IntermediateThrowEvent_1ex8ke9"> + <dc:Bounds x="1584" y="103" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1564" y="144" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1wii8im_di" bpmnElement="IntermediateCatchEvent_1wii8im"> + <dc:Bounds x="178" y="271" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="171" y="314" width="60" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> + <dc:Bounds x="1197" y="761" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0kd6p6p_di" bpmnElement="ServiceTask_0kd6p6p"> + <dc:Bounds x="645" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1bnkmaz_di" bpmnElement="CallActivity_1bnkmaz"> + <dc:Bounds x="1193" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0o2r07o_di" bpmnElement="ScriptTask_0o2r07o"> + <dc:Bounds x="1015" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0b7senu_di" bpmnElement="ScriptTask_0b7senu"> + <dc:Bounds x="285" y="249" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0h88mep_di" bpmnElement="CallActivity_0h88mep"> + <dc:Bounds x="467" y="249" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0n47zoh_di" bpmnElement="CallActivity_0n47zoh"> + <dc:Bounds x="1371" y="249" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_12h8542_di" bpmnElement="ScriptTask_12h8542"> + <dc:Bounds x="1193" y="416" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0o89wmf_di" bpmnElement="CallActivity_0o89wmf"> + <dc:Bounds x="1371" y="416" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0g98b71_di" bpmnElement="CallActivity_0g98b71"> + <dc:Bounds x="645" y="416" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_08wim95_di" bpmnElement="ScriptTask_08wim95"> + <dc:Bounds x="467" y="416" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0jdzpem_di" bpmnElement="CallActivity_0jdzpem"> + <dc:Bounds x="1371" y="605" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1mscu5w_di" bpmnElement="ScriptTask_1mscu5w"> + <dc:Bounds x="1193" y="605" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun"> + <dc:Bounds x="178" y="783" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="168" y="826" width="66" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0ktwpki_di" bpmnElement="IntermediateThrowEvent_0ktwpki"> + <dc:Bounds x="1584" y="438" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1577" y="479" width="67" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_15pl4ld_di" bpmnElement="CallActivity_15pl4ld"> + <dc:Bounds x="1005" y="761" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh"> + <dc:Bounds x="1584" y="627" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1592" y="670" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0esr949_di" bpmnElement="ServiceTask_0esr949"> + <dc:Bounds x="1375" y="761" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1jj846g_di" bpmnElement="ScriptTask_1jj846g"> + <dc:Bounds x="830" y="249" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0cxst1i_di" bpmnElement="CallActivity_0cxst1i"> + <dc:Bounds x="285" y="761" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0bh0kwx_di" bpmnElement="EndEvent_0bh0kwx"> + <dc:Bounds x="317" y="593" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c"> + <di:waypoint x="214" y="121" /> + <di:waypoint x="285" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt"> + <di:waypoint x="385" y="121" /> + <di:waypoint x="468" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop"> + <di:waypoint x="745" y="456" /> + <di:waypoint x="830" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e"> + <di:waypoint x="930" y="456" /> + <di:waypoint x="1040" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy"> + <di:waypoint x="1090" y="456" /> + <di:waypoint x="1193" y="456" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1121.5" y="438" width="42" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m"> + <di:waypoint x="1065" y="481" /> + <di:waypoint x="1065" y="645" /> + <di:waypoint x="1193" y="645" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1067" y="560" width="27" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1t19ips_di" bpmnElement="SequenceFlow_1t19ips"> + <di:waypoint x="1293" y="121" /> + <di:waypoint x="1370" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1p8vxo5_di" bpmnElement="SequenceFlow_1p8vxo5"> + <di:waypoint x="567" y="289" /> + <di:waypoint x="645" y="289" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1g8m7tq_di" bpmnElement="SequenceFlow_1g8m7tq"> + <di:waypoint x="745" y="289" /> + <di:waypoint x="830" y="289" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0it2g9j_di" bpmnElement="SequenceFlow_0it2g9j"> + <di:waypoint x="1471" y="289" /> + <di:waypoint x="1584" y="289" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18kur12_di" bpmnElement="SequenceFlow_18kur12"> + <di:waypoint x="1293" y="289" /> + <di:waypoint x="1371" y="289" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0mlrlbv_di" bpmnElement="SequenceFlow_0mlrlbv"> + <di:waypoint x="385" y="801" /> + <di:waypoint x="488" y="801" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1c6ka9h_di" bpmnElement="SequenceFlow_1c6ka9h"> + <di:waypoint x="513" y="826" /> + <di:waypoint x="513" y="926" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="521" y="832" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0n4xku8_di" bpmnElement="SequenceFlow_0n4xku8"> + <di:waypoint x="538" y="801" /> + <di:waypoint x="645" y="801" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="584" y="783" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0klb3ey_di" bpmnElement="SequenceFlow_0klb3ey"> + <di:waypoint x="923" y="801" /> + <di:waypoint x="1005" y="801" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_11rbv41_di" bpmnElement="SequenceFlow_11rbv41"> + <di:waypoint x="1475" y="801" /> + <di:waypoint x="1585" y="801" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7"> + <di:waypoint x="568" y="121" /> + <di:waypoint x="645" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1o1tu0f_di" bpmnElement="SequenceFlow_1o1tu0f"> + <di:waypoint x="214" y="289" /> + <di:waypoint x="285" y="289" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0lbdfmt_di" bpmnElement="SequenceFlow_0lbdfmt"> + <di:waypoint x="1105" y="801" /> + <di:waypoint x="1197" y="801" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1"> + <di:waypoint x="1297" y="801" /> + <di:waypoint x="1375" y="801" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c"> + <di:waypoint x="1115" y="121" /> + <di:waypoint x="1193" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1sq6kp6_di" bpmnElement="SequenceFlow_1sq6kp6"> + <di:waypoint x="385" y="289" /> + <di:waypoint x="467" y="289" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0thd6ny_di" bpmnElement="SequenceFlow_0thd6ny"> + <di:waypoint x="1293" y="456" /> + <di:waypoint x="1371" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0477975_di" bpmnElement="SequenceFlow_0477975"> + <di:waypoint x="1471" y="456" /> + <di:waypoint x="1584" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree"> + <di:waypoint x="567" y="456" /> + <di:waypoint x="645" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19lsayh_di" bpmnElement="SequenceFlow_19lsayh"> + <di:waypoint x="1293" y="645" /> + <di:waypoint x="1371" y="645" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_10ng1vx_di" bpmnElement="SequenceFlow_10ng1vx"> + <di:waypoint x="1471" y="645" /> + <di:waypoint x="1584" y="645" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a"> + <di:waypoint x="214" y="801" /> + <di:waypoint x="285" y="801" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ey6m1e_di" bpmnElement="SequenceFlow_1ey6m1e"> + <di:waypoint x="930" y="289" /> + <di:waypoint x="1015" y="289" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56"> + <dc:Bounds x="715" y="1166" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026"> + <dc:Bounds x="1353" y="1166" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw"> + <dc:Bounds x="979" y="1144" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s"> + <di:waypoint x="751" y="1184" /> + <di:waypoint x="979" y="1184" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz"> + <di:waypoint x="1079" y="1184" /> + <di:waypoint x="1353" y="1184" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ReceiveTask_0zkpdpa_di" bpmnElement="Task_1b5t88h"> + <dc:Bounds x="285" y="416" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7"> + <di:waypoint x="214" y="456" /> + <di:waypoint x="285" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_16uz2t9_di" bpmnElement="SequenceFlow_16uz2t9"> + <di:waypoint x="385" y="456" /> + <di:waypoint x="467" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="BoundaryEvent_15igwk2_di" bpmnElement="BoundaryEvent_0clo9pv"> + <dc:Bounds x="317" y="478" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_12qt5ci_di" bpmnElement="SequenceFlow_12qt5ci"> + <di:waypoint x="335" y="514" /> + <di:waypoint x="335" y="611" /> + <di:waypoint x="335" y="593" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0v4mw2x_di" bpmnElement="CallActivity_0v4mw2x"> + <dc:Bounds x="1015" y="249" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1aaozcg_di" bpmnElement="SequenceFlow_1aaozcg"> + <di:waypoint x="1115" y="289" /> + <di:waypoint x="1193" y="289" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_046irye_di" bpmnElement="SequenceFlow_046irye"> + <di:waypoint x="745" y="121" /> + <di:waypoint x="830" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1o23s0i_di" bpmnElement="SequenceFlow_1o23s0i"> + <di:waypoint x="930" y="121" /> + <di:waypoint x="1015" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0jrclmc_di" bpmnElement="SequenceFlow_0jrclmc"> + <di:waypoint x="1470" y="121" /> + <di:waypoint x="1584" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8"> + <dc:Bounds x="645" y="761" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj"> + <di:waypoint x="745" y="801" /> + <di:waypoint x="823" y="801" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn new file mode 100644 index 0000000000..58a69621d3 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn @@ -0,0 +1,523 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1nvjixd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="DeleteCommunicationService" name="DeleteCommunicationService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start"> + <bpmn:outgoing>SequenceFlow_1kjqnil</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1kjqnil" sourceRef="StartEvent_1" targetRef="Task_1mqm4nb" /> + <bpmn:sequenceFlow id="SequenceFlow_0ogievs" sourceRef="Task_1mqm4nb" targetRef="Task_0q2v7qe" /> + <bpmn:sequenceFlow id="SequenceFlow_192yyii" sourceRef="Task_0q2v7qe" targetRef="Task_0zaekmn" /> + <bpmn:serviceTask id="Task_0zaekmn" name="Init Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_192yyii</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xvoume</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="Task_0q2v7qe" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ogievs</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_192yyii</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs= new DeleteCommunicationService() +dcs.preInitUpdateOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_1mqm4nb" name="PreProcessRequest" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1kjqnil</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ogievs</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs= new DeleteCommunicationService() +dcs.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1k5stey" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0xvoume</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_017qgen</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0xvoume" sourceRef="Task_0zaekmn" targetRef="ScriptTask_1k5stey" /> + <bpmn:sequenceFlow id="SequenceFlow_017qgen" sourceRef="ScriptTask_1k5stey" targetRef="Task_0ux5uk1" /> + <bpmn:serviceTask id="Task_1kizznk" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0jrbkau</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ssiyug</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Task_0xwjycr" name="update operation status completed"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/json</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_00g94pg</bpmn:incoming> + <bpmn:incoming>SequenceFlow_16ewagx</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1amyd7h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10g2pnj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_0ixagvk" name="end"> + <bpmn:incoming>SequenceFlow_10g2pnj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_10g2pnj" sourceRef="Task_0xwjycr" targetRef="EndEvent_0ixagvk" /> + <bpmn:scriptTask id="Task_0ux5uk1" name="Query CommunicationSerive From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_017qgen</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1j0e2po</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.queryCommunicationSeriveFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ce724z" name="Go to Query delete progress"> + <bpmn:incoming>SequenceFlow_0bmtfxq</bpmn:incoming> + <bpmn:linkEventDefinition name="QueryDeleteProgress" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_11i33ob" name="QueryDeleteProgress"> + <bpmn:outgoing>SequenceFlow_1tcgzv0</bpmn:outgoing> + <bpmn:linkEventDefinition name="QueryDeleteProgress" /> + </bpmn:intermediateCatchEvent> + <bpmn:scriptTask id="Task_0qg5gn6" name="send request to NSMF WF" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_12xn3kz</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0bmtfxq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.sendRequest2NSMFWF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0bmtfxq" sourceRef="Task_0qg5gn6" targetRef="IntermediateThrowEvent_0ce724z" /> + <bpmn:scriptTask id="Task_0qvxmnh" name="Delete CS Profile From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0s7s7zk</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0arvpzv</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.delCSProfileFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0arvpzv" sourceRef="Task_0qvxmnh" targetRef="Task_0b5j6rg" /> + <bpmn:scriptTask id="Task_0b5j6rg" name="Delete CS From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0arvpzv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00g94pg</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.delCSFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:subProcess id="SubProcess_0p6namq" name="Exception Handling Sub-Process" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1843894"> + <bpmn:outgoing>SequenceFlow_1u5ko4h</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1u5ko4h" sourceRef="StartEvent_1843894" targetRef="Task_1spbb2x" /> + <bpmn:scriptTask id="Task_1spbb2x" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1u5ko4h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05yfw7t</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_05yfw7t" sourceRef="Task_1spbb2x" targetRef="Task_0yqtfvh" /> + <bpmn:scriptTask id="Task_0yqtfvh" name="Pre update Failed Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_05yfw7t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0c0btia</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.preFailedOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0c0btia" sourceRef="Task_0yqtfvh" targetRef="Task_1s3l3fc" /> + <bpmn:serviceTask id="Task_1s3l3fc" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0c0btia</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1w55zo7</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_1fsful5"> + <bpmn:incoming>SequenceFlow_1w55zo7</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1w55zo7" sourceRef="Task_1s3l3fc" targetRef="EndEvent_1fsful5" /> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_1tcgzv0" sourceRef="IntermediateThrowEvent_11i33ob" targetRef="ExclusiveGateway_16tdrty" /> + <bpmn:subProcess id="SubProcess_1l7gd5k" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0zc2hnn"> + <bpmn:outgoing>SequenceFlow_0mifi3x</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0mifi3x" sourceRef="StartEvent_0zc2hnn" targetRef="Task_01va9ms" /> + <bpmn:endEvent id="EndEvent_052gdjz"> + <bpmn:incoming>SequenceFlow_073yxs4</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_073yxs4" sourceRef="Task_01va9ms" targetRef="EndEvent_052gdjz" /> + <bpmn:scriptTask id="Task_01va9ms" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0mifi3x</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_073yxs4</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + </bpmn:subProcess> + <bpmn:exclusiveGateway id="ExclusiveGateway_1lyw619" name="Is NSMF timeout?" default="SequenceFlow_0s7s7zk"> + <bpmn:incoming>SequenceFlow_0xipbpr</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1sah9so</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0s7s7zk</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0bqfbxf</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0s7s7zk" sourceRef="ExclusiveGateway_1lyw619" targetRef="Task_0qvxmnh" /> + <bpmn:sequenceFlow id="SequenceFlow_00g94pg" sourceRef="Task_0b5j6rg" targetRef="Task_0xwjycr" /> + <bpmn:sequenceFlow id="SequenceFlow_0bqfbxf" name="yes" sourceRef="ExclusiveGateway_1lyw619" targetRef="Task_1ovewjr"> + <bpmn:documentation>#{(execution.getVariable("isTimeOut") == "YES")}</bpmn:documentation> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTimeOut") == "YES")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_16tdrty" name="is NSMF Async Succeed?" default="SequenceFlow_0jrbkau"> + <bpmn:incoming>SequenceFlow_1tcgzv0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jrbkau</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_16ewagx</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0jrbkau" sourceRef="ExclusiveGateway_16tdrty" targetRef="Task_1kizznk" /> + <bpmn:sequenceFlow id="SequenceFlow_16ewagx" name="no" sourceRef="ExclusiveGateway_16tdrty" targetRef="Task_0xwjycr"> + <bpmn:documentation>#{(execution.getVariable("isNSMFWFRspSucceed" ) == "no")}</bpmn:documentation> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSMFWFRspSucceed" ) == "no")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_0icj4go" name="Is E2E Slice Service Instance Id Exist?" default="SequenceFlow_12xn3kz"> + <bpmn:incoming>SequenceFlow_1j0e2po</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12xn3kz</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0xipbpr</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1j0e2po" sourceRef="Task_0ux5uk1" targetRef="ExclusiveGateway_0icj4go" /> + <bpmn:sequenceFlow id="SequenceFlow_12xn3kz" sourceRef="ExclusiveGateway_0icj4go" targetRef="Task_0qg5gn6" /> + <bpmn:sequenceFlow id="SequenceFlow_0xipbpr" name="no" sourceRef="ExclusiveGateway_0icj4go" targetRef="ExclusiveGateway_1lyw619"> + <bpmn:documentation>#{(execution.getVariable("e2eSliceServiceInstanceId") == null)}</bpmn:documentation> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("e2eSliceServiceInstanceId") == null)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:callActivity id="Task_1ff6flk" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus"> + <bpmn:extensionElements> + <camunda:in source="e2eSliceServiceInstanceId" target="serviceInstanceId" /> + <camunda:in source="e2eOperationId" target="operationId" /> + <camunda:in source="successConditions" target="successConditions" /> + <camunda:in source="errorConditions" target="errorConditions" /> + <camunda:in source="processServiceType" target="processServiceType" /> + <camunda:in source="timeOut" target="timeOut" /> + <camunda:out source="operationStatus" target="result" /> + <camunda:out source="operationContent" target="reason" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="isTimeOut" target="isTimeOut" /> + <camunda:in source="subOperationType" target="operationType" /> + <camunda:in source="initProgress" target="initProgress" /> + <camunda:in source="endProgress" target="endProgress" /> + <camunda:in source="serviceInstanceId" target="parentServiceInstanceId" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="operationId" target="parentOperationId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0thr8dc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1sah9so</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Task_1ovewjr" name="Prepare update operation status error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0bqfbxf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1amyd7h</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.prepareFailureStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1amyd7h" sourceRef="Task_1ovewjr" targetRef="Task_0xwjycr" /> + <bpmn:sequenceFlow id="SequenceFlow_1sah9so" sourceRef="Task_1ff6flk" targetRef="ExclusiveGateway_1lyw619" /> + <bpmn:sequenceFlow id="SequenceFlow_1ssiyug" sourceRef="Task_1kizznk" targetRef="Task_0y1n9ls" /> + <bpmn:sequenceFlow id="SequenceFlow_0thr8dc" sourceRef="Task_0y1n9ls" targetRef="Task_1ff6flk" /> + <bpmn:scriptTask id="Task_0y1n9ls" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ssiyug</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0thr8dc</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcs = new DeleteCommunicationService() +dcs.prepareCallCheckProcessStatus(execution)</bpmn:script> + </bpmn:scriptTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteCommunicationService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="152" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="159" y="145" width="23" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1kjqnil_di" bpmnElement="SequenceFlow_1kjqnil"> + <di:waypoint x="188" y="120" /> + <di:waypoint x="240" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ogievs_di" bpmnElement="SequenceFlow_0ogievs"> + <di:waypoint x="340" y="120" /> + <di:waypoint x="390" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_192yyii_di" bpmnElement="SequenceFlow_192yyii"> + <di:waypoint x="490" y="120" /> + <di:waypoint x="560" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_104igd7_di" bpmnElement="Task_0zaekmn"> + <dc:Bounds x="560" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0tqibrd_di" bpmnElement="Task_0q2v7qe"> + <dc:Bounds x="390" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_18pflck_di" bpmnElement="Task_1mqm4nb"> + <dc:Bounds x="240" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1k5stey_di" bpmnElement="ScriptTask_1k5stey"> + <dc:Bounds x="740" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xvoume_di" bpmnElement="SequenceFlow_0xvoume"> + <di:waypoint x="660" y="120" /> + <di:waypoint x="740" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_017qgen_di" bpmnElement="SequenceFlow_017qgen"> + <di:waypoint x="840" y="120" /> + <di:waypoint x="910" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_17pxrcl_di" bpmnElement="Task_1kizznk"> + <dc:Bounds x="330" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0ucwm85_di" bpmnElement="Task_0xwjycr"> + <dc:Bounds x="1250" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0ixagvk_di" bpmnElement="EndEvent_0ixagvk"> + <dc:Bounds x="1432" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1441" y="375" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10g2pnj_di" bpmnElement="SequenceFlow_10g2pnj"> + <di:waypoint x="1350" y="350" /> + <di:waypoint x="1432" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_05zxl7j_di" bpmnElement="Task_0ux5uk1"> + <dc:Bounds x="910" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1go0jt1_di" bpmnElement="IntermediateThrowEvent_0ce724z"> + <dc:Bounds x="1432" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1417" y="145" width="76" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_09w3u1d_di" bpmnElement="IntermediateThrowEvent_11i33ob"> + <dc:Bounds x="152" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="127" y="375" width="86" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0me3crz_di" bpmnElement="Task_0qg5gn6"> + <dc:Bounds x="1220" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0bmtfxq_di" bpmnElement="SequenceFlow_0bmtfxq"> + <di:waypoint x="1320" y="120" /> + <di:waypoint x="1432" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_14svlaf_di" bpmnElement="Task_0qvxmnh"> + <dc:Bounds x="900" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0arvpzv_di" bpmnElement="SequenceFlow_0arvpzv"> + <di:waypoint x="1000" y="350" /> + <di:waypoint x="1060" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0q6s59r_di" bpmnElement="Task_0b5j6rg"> + <dc:Bounds x="1060" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_04znyto_di" bpmnElement="SubProcess_0p6namq" isExpanded="true"> + <dc:Bounds x="480" y="650" width="730" height="210" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qti4dg_di" bpmnElement="StartEvent_1843894"> + <dc:Bounds x="520" y="742" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1u5ko4h_di" bpmnElement="SequenceFlow_1u5ko4h"> + <di:waypoint x="556" y="760" /> + <di:waypoint x="610" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0xdbw5d_di" bpmnElement="Task_1spbb2x"> + <dc:Bounds x="610" y="720" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05yfw7t_di" bpmnElement="SequenceFlow_05yfw7t"> + <di:waypoint x="710" y="760" /> + <di:waypoint x="770" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0hmczex_di" bpmnElement="Task_0yqtfvh"> + <dc:Bounds x="770" y="720" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0c0btia_di" bpmnElement="SequenceFlow_0c0btia"> + <di:waypoint x="870" y="760" /> + <di:waypoint x="930" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0ra7dbt_di" bpmnElement="Task_1s3l3fc"> + <dc:Bounds x="930" y="720" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1fsful5_di" bpmnElement="EndEvent_1fsful5"> + <dc:Bounds x="1092" y="742" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1w55zo7_di" bpmnElement="SequenceFlow_1w55zo7"> + <di:waypoint x="1030" y="760" /> + <di:waypoint x="1092" y="760" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tcgzv0_di" bpmnElement="SequenceFlow_1tcgzv0"> + <di:waypoint x="188" y="350" /> + <di:waypoint x="235" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0dwywjh_di" bpmnElement="SubProcess_1l7gd5k" isExpanded="true"> + <dc:Bounds x="660" y="950" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_18u3hph_di" bpmnElement="StartEvent_0zc2hnn"> + <dc:Bounds x="700" y="1032" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0mifi3x_di" bpmnElement="SequenceFlow_0mifi3x"> + <di:waypoint x="736" y="1050" /> + <di:waypoint x="790" y="1050" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_052gdjz_di" bpmnElement="EndEvent_052gdjz"> + <dc:Bounds x="952" y="1032" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_073yxs4_di" bpmnElement="SequenceFlow_073yxs4"> + <di:waypoint x="890" y="1050" /> + <di:waypoint x="952" y="1050" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0lzly9f_di" bpmnElement="Task_01va9ms"> + <dc:Bounds x="790" y="1010" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1lyw619_di" bpmnElement="ExclusiveGateway_1lyw619" isMarkerVisible="true"> + <dc:Bounds x="785" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="786.5" y="384.5" width="47" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0s7s7zk_di" bpmnElement="SequenceFlow_0s7s7zk"> + <di:waypoint x="835" y="350" /> + <di:waypoint x="900" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00g94pg_di" bpmnElement="SequenceFlow_00g94pg"> + <di:waypoint x="1160" y="350" /> + <di:waypoint x="1250" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0bqfbxf_di" bpmnElement="SequenceFlow_0bqfbxf"> + <di:waypoint x="810" y="325" /> + <di:waypoint x="810" y="250" /> + <di:waypoint x="900" y="250" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="846" y="232" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_16tdrty_di" bpmnElement="ExclusiveGateway_16tdrty" isMarkerVisible="true"> + <dc:Bounds x="235" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="226" y="295" width="77" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0jrbkau_di" bpmnElement="SequenceFlow_0jrbkau"> + <di:waypoint x="285" y="350" /> + <di:waypoint x="330" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_16ewagx_di" bpmnElement="SequenceFlow_16ewagx"> + <di:waypoint x="260" y="375" /> + <di:waypoint x="260" y="500" /> + <di:waypoint x="1300" y="500" /> + <di:waypoint x="1300" y="390" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="774" y="482" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0icj4go_di" bpmnElement="ExclusiveGateway_0icj4go" isMarkerVisible="true"> + <dc:Bounds x="1085" y="95" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1069" y="50" width="82" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1j0e2po_di" bpmnElement="SequenceFlow_1j0e2po"> + <di:waypoint x="1010" y="120" /> + <di:waypoint x="1085" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12xn3kz_di" bpmnElement="SequenceFlow_12xn3kz"> + <di:waypoint x="1135" y="120" /> + <di:waypoint x="1220" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xipbpr_di" bpmnElement="SequenceFlow_0xipbpr"> + <di:waypoint x="1110" y="145" /> + <di:waypoint x="1110" y="190" /> + <di:waypoint x="810" y="190" /> + <di:waypoint x="810" y="325" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="946" y="172" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1knnc2k_di" bpmnElement="Task_1ff6flk"> + <dc:Bounds x="630" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1r84j75_di" bpmnElement="Task_1ovewjr"> + <dc:Bounds x="900" y="210" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1amyd7h_di" bpmnElement="SequenceFlow_1amyd7h"> + <di:waypoint x="1000" y="250" /> + <di:waypoint x="1300" y="250" /> + <di:waypoint x="1300" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1sah9so_di" bpmnElement="SequenceFlow_1sah9so"> + <di:waypoint x="730" y="350" /> + <di:waypoint x="785" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ssiyug_di" bpmnElement="SequenceFlow_1ssiyug"> + <di:waypoint x="430" y="350" /> + <di:waypoint x="480" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0thr8dc_di" bpmnElement="SequenceFlow_0thr8dc"> + <di:waypoint x="580" y="350" /> + <di:waypoint x="630" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0r8ad9j_di" bpmnElement="Task_0y1n9ls"> + <dc:Bounds x="480" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn new file mode 100644 index 0000000000..6d9df5240d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn @@ -0,0 +1,332 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="DeleteSliceService" name="DeleteSliceService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start"> + <bpmn:outgoing>SequenceFlow_1ti9sxe</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0xmiev9" sourceRef="Task_1f3k0gq" targetRef="Task_0gsr9fu" /> + <bpmn:sequenceFlow id="SequenceFlow_1ti9sxe" sourceRef="StartEvent_1" targetRef="Task_1f3k0gq" /> + <bpmn:scriptTask id="Task_1f3k0gq" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ti9sxe</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xmiev9</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss= new DeleteSliceService() +dss.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_0gsr9fu" name="Init Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="NSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="NSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0xmiev9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uehx9h</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0uehx9h" sourceRef="Task_0gsr9fu" targetRef="Task_0walqr6" /> + <bpmn:scriptTask id="Task_0walqr6" name="Send Async Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0uehx9h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_16lh6o6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss= new DeleteSliceService() +dss.sendAsyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_16lh6o6" sourceRef="Task_0walqr6" targetRef="Task_04n2tl9" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1mcgr3m" name="success?"> + <bpmn:incoming>SequenceFlow_0nl4kfh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0wel7ie</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0eqx2y2</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0nl4kfh" sourceRef="Task_04n2tl9" targetRef="ExclusiveGateway_1mcgr3m" /> + <bpmn:sequenceFlow id="SequenceFlow_0wel7ie" name="yes" sourceRef="ExclusiveGateway_1mcgr3m" targetRef="Task_01siwzc"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0eqx2y2" name="no" sourceRef="ExclusiveGateway_1mcgr3m" targetRef="EndEvent_02ix4tc" /> + <bpmn:endEvent id="EndEvent_02ix4tc"> + <bpmn:incoming>SequenceFlow_0eqx2y2</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_1jz8wj7" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_18oizb2" sourceRef="Task_0k1pi3g" targetRef="Task_1vklzip" /> + <bpmn:scriptTask id="Task_0k1pi3g" name="Delete slice service From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0wel7ie</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18oizb2</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss= new DeleteSliceService() +dss.deleteSliceServiceInstance(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_1vklzip" name="Update Service Operation Status to Success"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_18oizb2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1oxmm7d</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent_0tyqdpw" name="End"> + <bpmn:incoming>SequenceFlow_1oxmm7d</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1oxmm7d" sourceRef="Task_1vklzip" targetRef="EndEvent_0tyqdpw" /> + <bpmn:callActivity id="Task_04n2tl9" name="Do Delete SliceServiceV1" calledElement="DoDeleteSliceServiceV1"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_16lh6o6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0nl4kfh</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Task_01siwzc" name="Delete Service Profile From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0wel7ie</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_142j1q2</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss= new DeleteSliceService() +dss.delServiceProfileFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_142j1q2" sourceRef="Task_01siwzc" targetRef="Task_0k1pi3g" /> + <bpmn:subProcess id="SubProcess_07kf25g" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1qskwib"> + <bpmn:outgoing>SequenceFlow_0x8msq9</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1mmlos4" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_086jahv"> + <bpmn:incoming>SequenceFlow_10lwgo7</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0x8msq9" sourceRef="StartEvent_1qskwib" targetRef="ScriptTask_19sjlk2" /> + <bpmn:scriptTask id="ScriptTask_19sjlk2" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0x8msq9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ihiv5k</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss = new DeleteCustomE2EServiceInstance() +dss.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1ihiv5k" sourceRef="ScriptTask_19sjlk2" targetRef="Task_1fxg7am" /> + <bpmn:sequenceFlow id="SequenceFlow_0zvzs12" sourceRef="Task_1fxg7am" targetRef="ServiceTask_17jq3cx" /> + <bpmn:scriptTask id="Task_1fxg7am" name="Termination Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ihiv5k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0zvzs12</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dss = new DeleteSliceService() +dss.prepareEndOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_17jq3cx" name="Update Service Operation Status To Terminate"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0zvzs12</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10lwgo7</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_10lwgo7" sourceRef="ServiceTask_17jq3cx" targetRef="EndEvent_086jahv" /> + </bpmn:subProcess> + <bpmn:subProcess id="SubProcess_0so7l00" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1jknl5k"> + <bpmn:outgoing>SequenceFlow_0rasmiu</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0rasmiu" sourceRef="StartEvent_1jknl5k" targetRef="Task_0c422xd" /> + <bpmn:endEvent id="EndEvent_1vr9nc9"> + <bpmn:incoming>SequenceFlow_1jipldf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1jipldf" sourceRef="Task_0c422xd" targetRef="EndEvent_1vr9nc9" /> + <bpmn:scriptTask id="Task_0c422xd" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0rasmiu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jipldf</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + </bpmn:subProcess> + </bpmn:process> + <bpmn:error id="Error_1jz8wj7" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSliceService"> + <bpmndi:BPMNEdge id="SequenceFlow_1ti9sxe_di" bpmnElement="SequenceFlow_1ti9sxe"> + <di:waypoint x="188" y="117" /> + <di:waypoint x="290" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xmiev9_di" bpmnElement="SequenceFlow_0xmiev9"> + <di:waypoint x="390" y="117" /> + <di:waypoint x="480" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="152" y="99" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="159" y="142" width="23" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0aqhg4z_di" bpmnElement="Task_1f3k0gq"> + <dc:Bounds x="290" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1n9ja9t_di" bpmnElement="Task_0gsr9fu"> + <dc:Bounds x="480" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0uehx9h_di" bpmnElement="SequenceFlow_0uehx9h"> + <di:waypoint x="580" y="117" /> + <di:waypoint x="660" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_13qpvgg_di" bpmnElement="Task_0walqr6"> + <dc:Bounds x="660" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_16lh6o6_di" bpmnElement="SequenceFlow_16lh6o6"> + <di:waypoint x="760" y="117" /> + <di:waypoint x="840" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1mcgr3m_di" bpmnElement="ExclusiveGateway_1mcgr3m" isMarkerVisible="true"> + <dc:Bounds x="1025" y="92" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1026" y="73" width="47" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0nl4kfh_di" bpmnElement="SequenceFlow_0nl4kfh"> + <di:waypoint x="940" y="117" /> + <di:waypoint x="1025" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0wel7ie_di" bpmnElement="SequenceFlow_0wel7ie"> + <di:waypoint x="1075" y="117" /> + <di:waypoint x="1164" y="117" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1100" y="98" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0eqx2y2_di" bpmnElement="SequenceFlow_0eqx2y2"> + <di:waypoint x="1050" y="142" /> + <di:waypoint x="1050" y="202" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1059" y="169" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_169jlln_di" bpmnElement="EndEvent_02ix4tc"> + <dc:Bounds x="1032" y="202" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_18oizb2_di" bpmnElement="SequenceFlow_18oizb2"> + <di:waypoint x="1440" y="117" /> + <di:waypoint x="1530" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_10g3cz7_di" bpmnElement="Task_0k1pi3g"> + <dc:Bounds x="1340" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0pct2ne_di" bpmnElement="Task_1vklzip"> + <dc:Bounds x="1530" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0tyqdpw_di" bpmnElement="EndEvent_0tyqdpw"> + <dc:Bounds x="1562" y="202" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1570" y="245" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1oxmm7d_di" bpmnElement="SequenceFlow_1oxmm7d"> + <di:waypoint x="1580" y="157" /> + <di:waypoint x="1580" y="202" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1igxzig_di" bpmnElement="Task_04n2tl9"> + <dc:Bounds x="840" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0qqsp7x_di" bpmnElement="Task_01siwzc"> + <dc:Bounds x="1164" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_142j1q2_di" bpmnElement="SequenceFlow_142j1q2"> + <di:waypoint x="1264" y="117" /> + <di:waypoint x="1340" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_07kf25g_di" bpmnElement="SubProcess_07kf25g" isExpanded="true"> + <dc:Bounds x="340" y="430" width="637" height="162" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qskwib_di" bpmnElement="StartEvent_1qskwib"> + <dc:Bounds x="377" y="497" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_086jahv_di" bpmnElement="EndEvent_086jahv"> + <dc:Bounds x="902" y="497" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0x8msq9_di" bpmnElement="SequenceFlow_0x8msq9"> + <di:waypoint x="413" y="515" /> + <di:waypoint x="456" y="515" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_19sjlk2_di" bpmnElement="ScriptTask_19sjlk2"> + <dc:Bounds x="456" y="475" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ihiv5k_di" bpmnElement="SequenceFlow_1ihiv5k"> + <di:waypoint x="556" y="515" /> + <di:waypoint x="615" y="515" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0zvzs12_di" bpmnElement="SequenceFlow_0zvzs12"> + <di:waypoint x="715" y="515" /> + <di:waypoint x="765" y="515" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0bjcnd3_di" bpmnElement="Task_1fxg7am"> + <dc:Bounds x="615" y="475" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_17jq3cx_di" bpmnElement="ServiceTask_17jq3cx"> + <dc:Bounds x="765" y="475" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10lwgo7_di" bpmnElement="SequenceFlow_10lwgo7"> + <di:waypoint x="865" y="515" /> + <di:waypoint x="902" y="515" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_1dd77tu_di" bpmnElement="SubProcess_0so7l00" isExpanded="true"> + <dc:Bounds x="470" y="650" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_14mwxm0_di" bpmnElement="StartEvent_1jknl5k"> + <dc:Bounds x="510" y="732" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0rasmiu_di" bpmnElement="SequenceFlow_0rasmiu"> + <di:waypoint x="546" y="750" /> + <di:waypoint x="600" y="750" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1vr9nc9_di" bpmnElement="EndEvent_1vr9nc9"> + <dc:Bounds x="762" y="732" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1jipldf_di" bpmnElement="SequenceFlow_1jipldf"> + <di:waypoint x="700" y="750" /> + <di:waypoint x="762" y="750" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0vb5d51_di" bpmnElement="Task_0c422xd"> + <dc:Bounds x="600" y="710" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn new file mode 100644 index 0000000000..9c090e0594 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn @@ -0,0 +1,361 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> + <bpmn:process id="DoAllocateNSIandNSSI" name="DoAllocateNSIandNSSI" isExecutable="true"> + <bpmn:scriptTask id="Task_09nzhwk" name="Generate NSI and create NSI in AAI with E2ESS and NSI relationship" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1e40h52</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createNSIinAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is nsi option available?" default="SequenceFlow_1h5bw41"> + <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="Update AAI relationship for E2ESS and NSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoAllocateNSIandNSSI() +dcsi.updateRelationship(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1s23hty" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1e40h52</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1q3ftu4" name="Prepare NSSI model info and instance id" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uhaps2</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoAllocateNSIandNSSI() +dcsi.prepareNssiModelInfo(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="allocateslice_StartEvent" name="allocatensi_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoAllocateNSIandNSSI() +dcso.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0o93dvp" name="read NSI options from request DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dansi = new DoAllocateNSIandNSSI() +dansi.retriveSliceOption(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1k1oonn" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1dhpkhd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hxky5e</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0gunols" name="Get one NSST Info" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ui528w</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1dhpkhd</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.getOneNsstInfo(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1lpgn98" name="prepare NSST Info" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0hxky5e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19jztxv</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createNSSTMap(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_0u8fycy</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="finishNSCreate_Task" name="Get a NSSI to process" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_16nvnxi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoAllocateNSIandNSSI() +dcsi.getOneNSSIInfo(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_07qkrrb" name="Is there more NSSI to process?" default="SequenceFlow_0u8fycy"> + <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1jaxstd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_16nvnxi</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0u8fycy</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:callActivity id="CallActivity_130tuxn" name="Call DoAllocateNSSI" calledElement="DoAllocateNSSI"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="nsstInput" target="nsstInput" /> + <camunda:in source="serviceProfile" target="serviceProfile" /> + <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> + <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> + <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" /> + <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" /> + <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="taskId" target="CSSOT_taskId" /> + <camunda:in source="taskName" target="CSSOT_name" /> + <camunda:in source="taskStatus" target="CSSOT_status" /> + <camunda:in source="isManual" target="CSSOT_isManual" /> + <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00b8ryw</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0anyn7v" name="Update current Index" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_00b8ryw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jaxstd</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoAllocateNSIandNSSI() +dcsi.updateCurrentIndex(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="instantiate_NSTask" name="Prepare NSSI list (with and without shared NSSI)" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0uhaps2</bpmn:incoming> + <bpmn:incoming>SequenceFlow_04yx9ii</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoAllocateNSIandNSSI() +dcso.prepareNSSIList(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1jg3el3" name="Is NSST available?" default="SequenceFlow_04yx9ii"> + <bpmn:incoming>SequenceFlow_19jztxv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04yx9ii</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1ui528w</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0uhaps2" sourceRef="ScriptTask_1q3ftu4" targetRef="instantiate_NSTask" /> + <bpmn:sequenceFlow id="SequenceFlow_1e40h52" sourceRef="CallActivity_1s23hty" targetRef="Task_09nzhwk" /> + <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ScriptTask_1q3ftu4" /> + <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" /> + <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="CallActivity_1s23hty" /> + <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ScriptTask_0gunols" /> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocateslice_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ScriptTask_0o93dvp" /> + <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="ExclusiveGateway_07qkrrb" /> + <bpmn:sequenceFlow id="SequenceFlow_0hxky5e" sourceRef="CallActivity_1k1oonn" targetRef="ScriptTask_1lpgn98" /> + <bpmn:sequenceFlow id="SequenceFlow_1dhpkhd" sourceRef="ScriptTask_0gunols" targetRef="CallActivity_1k1oonn" /> + <bpmn:sequenceFlow id="SequenceFlow_19jztxv" sourceRef="ScriptTask_1lpgn98" targetRef="ExclusiveGateway_1jg3el3" /> + <bpmn:sequenceFlow id="SequenceFlow_0u8fycy" name="No" sourceRef="ExclusiveGateway_07qkrrb" targetRef="EndEvent_1x6k78c" /> + <bpmn:sequenceFlow id="SequenceFlow_16nvnxi" name="Yes" sourceRef="ExclusiveGateway_07qkrrb" targetRef="finishNSCreate_Task"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSI" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSCreate_Task" targetRef="CallActivity_130tuxn" /> + <bpmn:sequenceFlow id="SequenceFlow_1jaxstd" sourceRef="ScriptTask_0anyn7v" targetRef="ExclusiveGateway_07qkrrb" /> + <bpmn:sequenceFlow id="SequenceFlow_00b8ryw" sourceRef="CallActivity_130tuxn" targetRef="ScriptTask_0anyn7v" /> + <bpmn:sequenceFlow id="SequenceFlow_04yx9ii" name="No" sourceRef="ExclusiveGateway_1jg3el3" targetRef="instantiate_NSTask" /> + <bpmn:sequenceFlow id="SequenceFlow_1ui528w" sourceRef="ExclusiveGateway_1jg3el3" targetRef="ScriptTask_0gunols"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSI"> + <bpmndi:BPMNEdge id="SequenceFlow_0uhaps2_di" bpmnElement="SequenceFlow_0uhaps2"> + <di:waypoint x="978" y="350" /> + <di:waypoint x="1736" y="350" /> + <di:waypoint x="1736" y="487" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1e40h52_di" bpmnElement="SequenceFlow_1e40h52"> + <di:waypoint x="799" y="527" /> + <di:waypoint x="878" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw"> + <di:waypoint x="799" y="350" /> + <di:waypoint x="878" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq"> + <di:waypoint x="520" y="527" /> + <di:waypoint x="583" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca"> + <di:waypoint x="608" y="502" /> + <di:waypoint x="608" y="350" /> + <di:waypoint x="699" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="584" y="422" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41"> + <di:waypoint x="633" y="527" /> + <di:waypoint x="699" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="630" y="509" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> + <di:waypoint x="978" y="527" /> + <di:waypoint x="1036" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="631" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint x="210" y="527" /> + <di:waypoint x="268" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="123" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint x="368" y="527" /> + <di:waypoint x="420" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl"> + <di:waypoint x="1786" y="527" /> + <di:waypoint x="1871" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hxky5e_di" bpmnElement="SequenceFlow_0hxky5e"> + <di:waypoint x="1300" y="527" /> + <di:waypoint x="1388" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1dhpkhd_di" bpmnElement="SequenceFlow_1dhpkhd"> + <di:waypoint x="1136" y="527" /> + <di:waypoint x="1200" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19jztxv_di" bpmnElement="SequenceFlow_19jztxv"> + <di:waypoint x="1488" y="527" /> + <di:waypoint x="1564" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0u8fycy_di" bpmnElement="SequenceFlow_0u8fycy"> + <di:waypoint x="1896" y="502" /> + <di:waypoint x="1896" y="409" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1904" y="453" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_16nvnxi_di" bpmnElement="SequenceFlow_16nvnxi"> + <di:waypoint x="1921" y="527" /> + <di:waypoint x="1991" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1942" y="500" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g"> + <di:waypoint x="2091" y="527" /> + <di:waypoint x="2197" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="556.5" y="574" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jaxstd_di" bpmnElement="SequenceFlow_1jaxstd"> + <di:waypoint x="1991" y="665" /> + <di:waypoint x="1896" y="665" /> + <di:waypoint x="1896" y="552" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00b8ryw_di" bpmnElement="SequenceFlow_00b8ryw"> + <di:waypoint x="2247" y="567" /> + <di:waypoint x="2247" y="665" /> + <di:waypoint x="2091" y="665" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_04yx9ii_di" bpmnElement="SequenceFlow_04yx9ii"> + <di:waypoint x="1614" y="527" /> + <di:waypoint x="1686" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1643" y="509" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ui528w_di" bpmnElement="SequenceFlow_1ui528w"> + <di:waypoint x="1589" y="552" /> + <di:waypoint x="1589" y="671" /> + <di:waypoint x="1086" y="671" /> + <di:waypoint x="1086" y="567" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="878" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true"> + <dc:Bounds x="583" y="502" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="578" y="559" width="60" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg"> + <dc:Bounds x="699" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1s23hty_di" bpmnElement="CallActivity_1s23hty"> + <dc:Bounds x="699" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1q3ftu4_di" bpmnElement="ScriptTask_1q3ftu4"> + <dc:Bounds x="878" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateslice_StartEvent"> + <dc:Bounds x="174" y="509" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="152" y="545" width="82" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="268" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp"> + <dc:Bounds x="420" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1k1oonn_di" bpmnElement="CallActivity_1k1oonn"> + <dc:Bounds x="1200" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0gunols_di" bpmnElement="ScriptTask_0gunols"> + <dc:Bounds x="1036" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1lpgn98_di" bpmnElement="ScriptTask_1lpgn98"> + <dc:Bounds x="1388" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1878" y="373" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="412" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task"> + <dc:Bounds x="1991" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_07qkrrb_di" bpmnElement="ExclusiveGateway_07qkrrb" isMarkerVisible="true"> + <dc:Bounds x="1871" y="502" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1853" y="575" width="86" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_130tuxn_di" bpmnElement="CallActivity_130tuxn"> + <dc:Bounds x="2197" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0anyn7v_di" bpmnElement="ScriptTask_0anyn7v"> + <dc:Bounds x="1991" y="625" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> + <dc:Bounds x="1686" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1jg3el3_di" bpmnElement="ExclusiveGateway_1jg3el3" isMarkerVisible="true"> + <dc:Bounds x="1564" y="502" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1564" y="465" width="50" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn new file mode 100644 index 0000000000..445c9378af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn @@ -0,0 +1,364 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> + <bpmn:process id="DoAllocateNSSI" name="DoAllocateNSSI" isExecutable="true"> + <bpmn:startEvent id="allocatenssi_StartEvent" name="allocatenssi_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocatenssi_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="CallActivity_09l7bhc" /> + <bpmn:scriptTask id="Task_09nzhwk" name="send create request to NSSMF adapter" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="instantiate_NSTask" name="create slice profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0yie00u</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0kzlbeh</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1r8qkgf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09pv5lu</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.createSliceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_09pv5lu</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="finishNSCreate_Task" name="Get NSSI progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1smrx3b</bpmn:incoming> + <bpmn:incoming>SequenceFlow_08xcz0v</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1lpxjvi</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.getNSSMFProgresss(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_0xz0xx2" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is NSSI sharable?" default="SequenceFlow_0ueeeca"> + <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="Task_09nzhwk"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="send update request to NSSMF adapter" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.sendUpdateRequestNSSMF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg" /> + <bpmn:scriptTask id="ScriptTask_0o93dvp" name="Get NSST from Catalog DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_03bz6dh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.getNSSTInfo(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" /> + <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ExclusiveGateway_0xz0xx2" /> + <bpmn:scriptTask id="ScriptTask_1mv1npn" name="create NSSI and update relationship" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_07azk0i</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yie00u</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.instantiateNSSIService(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1lpxjvi" sourceRef="finishNSCreate_Task" targetRef="ScriptTask_1fvkcir" /> + <bpmn:callActivity id="CallActivity_09l7bhc" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_03bz6dh</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_03bz6dh" sourceRef="CallActivity_09l7bhc" targetRef="ScriptTask_0o93dvp" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1cgffe3" name="Completed"> + <bpmn:incoming>SequenceFlow_1xzq95u</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1kxwt7k</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0stj4cv</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="ScriptTask_1escji6" name="Time delay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0stj4cv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_08xcz0v</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.timeDelay(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_08xcz0v" sourceRef="ScriptTask_1escji6" targetRef="finishNSCreate_Task" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0xz0xx2"> + <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1smrx3b</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1kxwt7k" name="true" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ExclusiveGateway_09hoejm"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0stj4cv" name="false" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ScriptTask_1escji6"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" ) == false)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1smrx3b" sourceRef="ExclusiveGateway_0xz0xx2" targetRef="finishNSCreate_Task" /> + <bpmn:sequenceFlow id="SequenceFlow_0yie00u" sourceRef="ScriptTask_1mv1npn" targetRef="instantiate_NSTask" /> + <bpmn:sequenceFlow id="SequenceFlow_09pv5lu" sourceRef="instantiate_NSTask" targetRef="EndEvent_1x6k78c" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_09hoejm" name="Is NSSI sharable?" default="SequenceFlow_0c2o5zl2"> + <bpmn:incoming>SequenceFlow_1kxwt7k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07azk0i</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0c2o5zl2</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_07azk0i" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_1mv1npn"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_0y2xmwi" name="Update relationship" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_14lzy4o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kzlbeh</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.updateRelationship(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0c2o5zl2" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_0y2xmwi" /> + <bpmn:sequenceFlow id="SequenceFlow_0kzlbeh" sourceRef="ScriptTask_0y2xmwi" targetRef="instantiate_NSTask" /> + <bpmn:scriptTask id="ScriptTask_1fvkcir" name="Prepare Update Orchestration Task" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1lpxjvi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jjbci8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_11d0poc" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0jjbci8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1xzq95u</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0jjbci8" sourceRef="ScriptTask_1fvkcir" targetRef="CallActivity_11d0poc" /> + <bpmn:sequenceFlow id="SequenceFlow_1xzq95u" sourceRef="CallActivity_11d0poc" targetRef="ExclusiveGateway_1cgffe3" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_19tascw" name="Is NSI option available?" default="SequenceFlow_14lzy4o"> + <bpmn:incoming>SequenceFlow_0c2o5zl2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14lzy4o</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1r8qkgf</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_14lzy4o" sourceRef="ExclusiveGateway_19tascw" targetRef="ScriptTask_0y2xmwi" /> + <bpmn:sequenceFlow id="SequenceFlow_1r8qkgf" sourceRef="ExclusiveGateway_19tascw" targetRef="instantiate_NSTask"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSI"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocatenssi_StartEvent"> + <dc:Bounds x="175" y="509" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="152" y="545" width="85" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint x="211" y="527" /> + <di:waypoint x="269" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="123" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint x="369" y="527" /> + <di:waypoint x="444" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="887" y="659" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="269" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> + <dc:Bounds x="2286" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="2482" y="489" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="412" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task"> + <dc:Bounds x="1238" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> + <di:waypoint x="987" y="699" /> + <di:waypoint x="1103" y="699" /> + <di:waypoint x="1103" y="532" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="631" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true"> + <dc:Bounds x="778" y="502" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="838" y="520" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41"> + <di:waypoint x="803" y="552" /> + <di:waypoint x="803" y="699" /> + <di:waypoint x="883" y="699" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="836" y="681" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg"> + <dc:Bounds x="894" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca"> + <di:waypoint x="803" y="502" /> + <di:waypoint x="803" y="350" /> + <di:waypoint x="894" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="831" y="358" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp"> + <dc:Bounds x="618" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq"> + <di:waypoint x="718" y="527" /> + <di:waypoint x="778" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw"> + <di:waypoint x="994" y="350" /> + <di:waypoint x="1103" y="350" /> + <di:waypoint x="1103" y="482" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1mv1npn_di" bpmnElement="ScriptTask_1mv1npn"> + <dc:Bounds x="2089" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lpxjvi_di" bpmnElement="SequenceFlow_1lpxjvi"> + <di:waypoint x="1338" y="507" /> + <di:waypoint x="1411" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_09l7bhc_di" bpmnElement="CallActivity_09l7bhc"> + <dc:Bounds x="444" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_03bz6dh_di" bpmnElement="SequenceFlow_03bz6dh"> + <di:waypoint x="544" y="527" /> + <di:waypoint x="618" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1cgffe3_di" bpmnElement="ExclusiveGateway_1cgffe3" isMarkerVisible="true"> + <dc:Bounds x="1773" y="482" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1771" y="458" width="54" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1escji6_di" bpmnElement="ScriptTask_1escji6"> + <dc:Bounds x="1748" y="624" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_08xcz0v_di" bpmnElement="SequenceFlow_08xcz0v"> + <di:waypoint x="1748" y="664" /> + <di:waypoint x="1288" y="664" /> + <di:waypoint x="1288" y="547" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0xz0xx2_di" bpmnElement="ExclusiveGateway_0xz0xx2" isMarkerVisible="true"> + <dc:Bounds x="1078" y="482" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1kxwt7k_di" bpmnElement="SequenceFlow_1kxwt7k"> + <di:waypoint x="1823" y="507" /> + <di:waypoint x="1928" y="507" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1866" y="489" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0stj4cv_di" bpmnElement="SequenceFlow_0stj4cv"> + <di:waypoint x="1798" y="532" /> + <di:waypoint x="1798" y="624" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1801" y="575" width="24" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1smrx3b_di" bpmnElement="SequenceFlow_1smrx3b"> + <di:waypoint x="1128" y="507" /> + <di:waypoint x="1238" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yie00u_di" bpmnElement="SequenceFlow_0yie00u"> + <di:waypoint x="2189" y="507" /> + <di:waypoint x="2286" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09pv5lu_di" bpmnElement="SequenceFlow_09pv5lu"> + <di:waypoint x="2386" y="507" /> + <di:waypoint x="2482" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_09hoejm_di" bpmnElement="ExclusiveGateway_09hoejm" isMarkerVisible="true"> + <dc:Bounds x="1928" y="482" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1908" y="542" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_07azk0i_di" bpmnElement="SequenceFlow_07azk0i"> + <di:waypoint x="1978" y="507" /> + <di:waypoint x="2089" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0y2xmwi_di" bpmnElement="ScriptTask_0y2xmwi"> + <dc:Bounds x="2089" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0kzlbeh_di" bpmnElement="SequenceFlow_0kzlbeh"> + <di:waypoint x="2189" y="350" /> + <di:waypoint x="2336" y="350" /> + <di:waypoint x="2336" y="467" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1fvkcir_di" bpmnElement="ScriptTask_1fvkcir"> + <dc:Bounds x="1411" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_11d0poc_di" bpmnElement="CallActivity_11d0poc"> + <dc:Bounds x="1587" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0jjbci8_di" bpmnElement="SequenceFlow_0jjbci8"> + <di:waypoint x="1511" y="507" /> + <di:waypoint x="1587" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1xzq95u_di" bpmnElement="SequenceFlow_1xzq95u"> + <di:waypoint x="1687" y="507" /> + <di:waypoint x="1773" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_19tascw_di" bpmnElement="ExclusiveGateway_19tascw" isMarkerVisible="true"> + <dc:Bounds x="1928" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1854" y="337" width="64" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0c2o5zl_di" bpmnElement="SequenceFlow_0c2o5zl2"> + <di:waypoint x="1953" y="482" /> + <di:waypoint x="1953" y="375" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14lzy4o_di" bpmnElement="SequenceFlow_14lzy4o"> + <di:waypoint x="1978" y="350" /> + <di:waypoint x="2089" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1r8qkgf_di" bpmnElement="SequenceFlow_1r8qkgf"> + <di:waypoint x="1953" y="325" /> + <di:waypoint x="1953" y="205" /> + <di:waypoint x="2336" y="205" /> + <di:waypoint x="2336" y="465" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn new file mode 100644 index 0000000000..1f0e10b1c1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_152rp63" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="DoCreateCommunicationService" name="DoCreateCommunicationService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start"> + <bpmn:outgoing>SequenceFlow_0r43nhn</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0r43nhn" sourceRef="StartEvent_1" targetRef="Task_1n00ul2" /> + <bpmn:scriptTask id="Task_1n00ul2" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0r43nhn</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ojuala</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoCreateCommunicationService() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_13cimkc" name="Create Communication Service Profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0mxvw9q</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15e8qrt</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoCreateCommunicationService() +csi.createCommunicationServiceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_02h3nyo" name="Create Communication Service" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ojuala</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0mxvw9q</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoCreateCommunicationService() +csi.createCommunicationService(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_0tx74b8" name="end"> + <bpmn:incoming>SequenceFlow_15e8qrt</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0mxvw9q" sourceRef="Task_02h3nyo" targetRef="Task_13cimkc" /> + <bpmn:sequenceFlow id="SequenceFlow_15e8qrt" sourceRef="Task_13cimkc" targetRef="EndEvent_0tx74b8" /> + <bpmn:sequenceFlow id="SequenceFlow_1ojuala" sourceRef="Task_1n00ul2" targetRef="Task_02h3nyo" /> + <bpmn:subProcess id="SubProcess_0hvqoiu" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_06faevu"> + <bpmn:outgoing>SequenceFlow_1jckdn4</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1idslt4" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1xkvl7n"> + <bpmn:incoming>SequenceFlow_0ixyf17</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_15u2oe2" name="Process Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1jckdn4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ixyf17</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil exceptionUtil = new ExceptionUtil() +exceptionUtil.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ixyf17" sourceRef="ScriptTask_15u2oe2" targetRef="EndEvent_1xkvl7n" /> + <bpmn:sequenceFlow id="SequenceFlow_1jckdn4" sourceRef="StartEvent_06faevu" targetRef="ScriptTask_15u2oe2" /> + </bpmn:subProcess> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateCommunicationService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="179" y="99" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="186" y="142" width="23" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0r43nhn_di" bpmnElement="SequenceFlow_0r43nhn"> + <di:waypoint x="215" y="117" /> + <di:waypoint x="290" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ilqwj5_di" bpmnElement="Task_1n00ul2"> + <dc:Bounds x="290" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0vpnfpe_di" bpmnElement="Task_13cimkc"> + <dc:Bounds x="660" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03bitgg_di" bpmnElement="Task_02h3nyo"> + <dc:Bounds x="480" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0tx74b8_di" bpmnElement="EndEvent_0tx74b8"> + <dc:Bounds x="912" y="99" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="921" y="142" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0mxvw9q_di" bpmnElement="SequenceFlow_0mxvw9q"> + <di:waypoint x="580" y="117" /> + <di:waypoint x="660" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15e8qrt_di" bpmnElement="SequenceFlow_15e8qrt"> + <di:waypoint x="760" y="117" /> + <di:waypoint x="912" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ojuala_di" bpmnElement="SequenceFlow_1ojuala"> + <di:waypoint x="390" y="117" /> + <di:waypoint x="480" y="117" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0hvqoiu_di" bpmnElement="SubProcess_0hvqoiu" isExpanded="true"> + <dc:Bounds x="290" y="250" width="417" height="161" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_06faevu_di" bpmnElement="StartEvent_06faevu"> + <dc:Bounds x="327" y="317" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1xkvl7n_di" bpmnElement="EndEvent_1xkvl7n"> + <dc:Bounds x="613" y="317" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_15u2oe2_di" bpmnElement="ScriptTask_15u2oe2"> + <dc:Bounds x="438" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ixyf17_di" bpmnElement="SequenceFlow_0ixyf17"> + <di:waypoint x="538" y="335" /> + <di:waypoint x="613" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jckdn4_di" bpmnElement="SequenceFlow_1jckdn4"> + <di:waypoint x="363" y="335" /> + <di:waypoint x="438" y="335" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn new file mode 100644 index 0000000000..894f7d39dc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> + <bpmn:process id="DoCreateSliceServiceInstance" name="DoCreateSliceServiceInstance" isExecutable="true"> + <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="instantiate_NSTask" /> + <bpmn:scriptTask id="Task_09nzhwk" name="Create service profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateSliceServiceInstance() +dcsi.createServiceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateSliceServiceInstance() +dcsi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="instantiate_NSTask" name="create Slice Service in AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateSliceServiceInstance() +dcsi.instantiateSliceService(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="EndEvent_1x6k78c" /> + <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="ScriptTask_18rzwzb" /> + <bpmn:scriptTask id="ScriptTask_18rzwzb" name="Create Allottedsource" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17u69c4</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateSliceServiceInstance() +dcsi.createAllottedResource(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Task_09nzhwk" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceInstance"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> + <dc:Bounds x="175" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="152" y="147" width="83" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint x="211" y="129" /> + <di:waypoint x="251" y="129" /> + <di:waypoint x="251" y="129" /> + <di:waypoint x="293" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="123" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint x="393" y="129" /> + <di:waypoint x="474" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="851" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="293" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> + <dc:Bounds x="474" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1049" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="412" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> + <di:waypoint x="951" y="129" /> + <di:waypoint x="1049" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="631" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl"> + <di:waypoint x="574" y="129" /> + <di:waypoint x="658" y="129" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb"> + <dc:Bounds x="658" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_17u69c4_di" bpmnElement="SequenceFlow_17u69c4"> + <di:waypoint x="758" y="129" /> + <di:waypoint x="851" y="129" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn new file mode 100644 index 0000000000..435f91921d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn @@ -0,0 +1,338 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> + <bpmn:process id="DoCreateSliceServiceOption" name="DoCreateSliceServiceOption" isExecutable="true"> + <bpmn:startEvent id="createNS_StartEvent" name="createOption_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ExclusiveGateway_0b9d9l0" /> + <bpmn:scriptTask id="Task_09nzhwk" name="send request to OOF for NSI options" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1utpplq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.getNSIOptionfromOOF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSCreate_Task" targetRef="ScriptTask_0j3wd2o" /> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_01ak5x3</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ap8kar</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0hnsycl</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="finishNSCreate_Task" name="prepare list of NSSI associated with NSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_15679e8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareNSSIList(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" default="SequenceFlow_0ueeeca"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="NSI Sharable" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="Task_09nzhwk"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isSharable" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="update task status in request DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ojueqq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.updateStatusInDB(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="NSI Not Sharable" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg" /> + <bpmn:endEvent id="EndEvent_00n990e"> + <bpmn:incoming>SequenceFlow_0ojueqq</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0j3wd2o" name="updated options in request DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01ak5x3</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.updateOptionsInDB(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_01ak5x3" sourceRef="ScriptTask_0j3wd2o" targetRef="EndEvent_1x6k78c" /> + <bpmn:scriptTask id="ScriptTask_0kecvrc" name="prepare list of NSST associated with NST" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1614gtr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0lt2cdo</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareNSSTlistfromNST(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1mlytov" name="send request to OOF for NSSI options" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0a5f5y6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1r9n9ef</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.getNSSTOption(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1y1wzs9"> + <bpmn:incoming>SequenceFlow_0lt2cdo</bpmn:incoming> + <bpmn:incoming>SequenceFlow_00gq7h2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ap8kar</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0m2mr0o</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1ap8kar" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="EndEvent_1x6k78c"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == false)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0lt2cdo" sourceRef="ScriptTask_0kecvrc" targetRef="ExclusiveGateway_1y1wzs9" /> + <bpmn:sequenceFlow id="SequenceFlow_0m2mr0o" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="ScriptTask_1e5ysya"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_0ojz4lj" name="save NSI and NSSI options in DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1r9n9ef</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00gq7h2</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.updateOptionsInDB(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1r9n9ef" sourceRef="ScriptTask_1mlytov" targetRef="ScriptTask_0ojz4lj" /> + <bpmn:sequenceFlow id="SequenceFlow_00gq7h2" sourceRef="ScriptTask_0ojz4lj" targetRef="ExclusiveGateway_1y1wzs9" /> + <bpmn:sequenceFlow id="SequenceFlow_0ojueqq" sourceRef="ScriptTask_1ehyrsg" targetRef="EndEvent_00n990e" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1mdr1l2" default="SequenceFlow_1614gtr"> + <bpmn:incoming>SequenceFlow_041f5ne</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15679e8</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1614gtr</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_15679e8" sourceRef="ExclusiveGateway_1mdr1l2" targetRef="finishNSCreate_Task"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1614gtr" sourceRef="ExclusiveGateway_1mdr1l2" targetRef="ScriptTask_0kecvrc" /> + <bpmn:scriptTask id="ScriptTask_0uu3j3h" name="prepare NST decomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0wy6oag</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jnsyix</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareNSTDecompose(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1qs8xd5" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1jnsyix</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_041f5ne</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1e5ysya" name="prepare NSST decomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0m2mr0o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_016vi3s</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareNSSTDecompose(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_016vi3s" sourceRef="ScriptTask_1e5ysya" targetRef="CallActivity_1rfnoe2" /> + <bpmn:callActivity id="CallActivity_1rfnoe2" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_016vi3s</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0a5f5y6</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0a5f5y6" sourceRef="CallActivity_1rfnoe2" targetRef="ScriptTask_1mlytov" /> + <bpmn:sequenceFlow id="SequenceFlow_1utpplq" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_1skfk7w" /> + <bpmn:sequenceFlow id="SequenceFlow_1jnsyix" sourceRef="ScriptTask_0uu3j3h" targetRef="CallActivity_1qs8xd5" /> + <bpmn:sequenceFlow id="SequenceFlow_041f5ne" sourceRef="CallActivity_1qs8xd5" targetRef="ExclusiveGateway_1mdr1l2" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1skfk7w" default="SequenceFlow_0wy6oag"> + <bpmn:incoming>SequenceFlow_1utpplq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0wy6oag</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0hnsycl</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0wy6oag" sourceRef="ExclusiveGateway_1skfk7w" targetRef="ScriptTask_0uu3j3h" /> + <bpmn:sequenceFlow id="SequenceFlow_0hnsycl" sourceRef="ExclusiveGateway_1skfk7w" targetRef="EndEvent_1x6k78c"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> + <dc:Bounds x="175" y="187" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="150" y="223" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint x="211" y="205" /> + <di:waypoint x="251" y="205" /> + <di:waypoint x="251" y="205" /> + <di:waypoint x="293" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="123" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint x="393" y="205" /> + <di:waypoint x="448" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="594" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="293" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g"> + <di:waypoint x="1536" y="205" /> + <di:waypoint x="1592" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="556.5" y="574" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1813" y="187" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="412" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task"> + <dc:Bounds x="1436" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true"> + <dc:Bounds x="448" y="180" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41"> + <di:waypoint x="498" y="205" /> + <di:waypoint x="594" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="514" y="187" width="66" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg"> + <dc:Bounds x="602" y="-197" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca"> + <di:waypoint x="473" y="180" /> + <di:waypoint x="473" y="-157" /> + <di:waypoint x="602" y="-157" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="14" width="86" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_00n990e_di" bpmnElement="EndEvent_00n990e"> + <dc:Bounds x="785" y="-175" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0j3wd2o_di" bpmnElement="ScriptTask_0j3wd2o"> + <dc:Bounds x="1592" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01ak5x3_di" bpmnElement="SequenceFlow_01ak5x3"> + <di:waypoint x="1692" y="205" /> + <di:waypoint x="1813" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0kecvrc_di" bpmnElement="ScriptTask_0kecvrc"> + <dc:Bounds x="1297" y="391" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1mlytov_di" bpmnElement="ScriptTask_1mlytov"> + <dc:Bounds x="1781" y="533" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1y1wzs9_di" bpmnElement="ExclusiveGateway_1y1wzs9" isMarkerVisible="true"> + <dc:Bounds x="1461" y="406" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ap8kar_di" bpmnElement="SequenceFlow_1ap8kar"> + <di:waypoint x="1486" y="406" /> + <di:waypoint x="1486" y="315" /> + <di:waypoint x="1831" y="315" /> + <di:waypoint x="1831" y="223" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0lt2cdo_di" bpmnElement="SequenceFlow_0lt2cdo"> + <di:waypoint x="1397" y="431" /> + <di:waypoint x="1461" y="431" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0m2mr0o_di" bpmnElement="SequenceFlow_0m2mr0o"> + <di:waypoint x="1511" y="431" /> + <di:waypoint x="1592" y="431" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0ojz4lj_di" bpmnElement="ScriptTask_0ojz4lj"> + <dc:Bounds x="1592" y="533" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1r9n9ef_di" bpmnElement="SequenceFlow_1r9n9ef"> + <di:waypoint x="1781" y="573" /> + <di:waypoint x="1692" y="573" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00gq7h2_di" bpmnElement="SequenceFlow_00gq7h2"> + <di:waypoint x="1592" y="573" /> + <di:waypoint x="1486" y="573" /> + <di:waypoint x="1486" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ojueqq_di" bpmnElement="SequenceFlow_0ojueqq"> + <di:waypoint x="702" y="-157" /> + <di:waypoint x="785" y="-157" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1mdr1l2_di" bpmnElement="ExclusiveGateway_1mdr1l2" isMarkerVisible="true"> + <dc:Bounds x="1322" y="180" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15679e8_di" bpmnElement="SequenceFlow_15679e8"> + <di:waypoint x="1372" y="205" /> + <di:waypoint x="1436" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1614gtr_di" bpmnElement="SequenceFlow_1614gtr"> + <di:waypoint x="1347" y="230" /> + <di:waypoint x="1347" y="391" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0uu3j3h_di" bpmnElement="ScriptTask_0uu3j3h"> + <dc:Bounds x="967" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1qs8xd5_di" bpmnElement="CallActivity_1qs8xd5"> + <dc:Bounds x="1136" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1e5ysya_di" bpmnElement="ScriptTask_1e5ysya"> + <dc:Bounds x="1592" y="391" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_016vi3s_di" bpmnElement="SequenceFlow_016vi3s"> + <di:waypoint x="1692" y="431" /> + <di:waypoint x="1781" y="431" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1rfnoe2_di" bpmnElement="CallActivity_1rfnoe2"> + <dc:Bounds x="1781" y="391" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0a5f5y6_di" bpmnElement="SequenceFlow_0a5f5y6"> + <di:waypoint x="1881" y="431" /> + <di:waypoint x="1968" y="431" /> + <di:waypoint x="1968" y="573" /> + <di:waypoint x="1881" y="573" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1utpplq_di" bpmnElement="SequenceFlow_1utpplq"> + <di:waypoint x="694" y="205" /> + <di:waypoint x="796" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jnsyix_di" bpmnElement="SequenceFlow_1jnsyix"> + <di:waypoint x="1067" y="205" /> + <di:waypoint x="1136" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_041f5ne_di" bpmnElement="SequenceFlow_041f5ne"> + <di:waypoint x="1236" y="205" /> + <di:waypoint x="1322" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1skfk7w_di" bpmnElement="ExclusiveGateway_1skfk7w" isMarkerVisible="true"> + <dc:Bounds x="796" y="180" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0wy6oag_di" bpmnElement="SequenceFlow_0wy6oag"> + <di:waypoint x="846" y="205" /> + <di:waypoint x="967" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hnsycl_di" bpmnElement="SequenceFlow_0hnsycl"> + <di:waypoint x="821" y="180" /> + <di:waypoint x="821" y="90" /> + <di:waypoint x="1831" y="90" /> + <di:waypoint x="1831" y="187" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn new file mode 100644 index 0000000000..5f4816e78f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1p1suc9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="DoDeleteSliceServiceV1" name="DoDeleteSliceServiceV1" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start"> + <bpmn:outgoing>SequenceFlow_0ep5het</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0ep5het" sourceRef="StartEvent_1" targetRef="Task_0etki1p" /> + <bpmn:sequenceFlow id="SequenceFlow_1qkgvvu" sourceRef="Task_1ujnqtj" targetRef="Task_1fqiyb4" /> + <bpmn:sequenceFlow id="SequenceFlow_1rgfzzy" sourceRef="Task_1fqiyb4" targetRef="Task_1u755sr" /> + <bpmn:scriptTask id="Task_1ujnqtj" name="Query Allotted Resource From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_029u1wr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1qkgvvu</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.getAllottedResFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_1fqiyb4" name="Query NSI From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qkgvvu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1rgfzzy</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.getNSIFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_1u755sr" name="Query NSSI List From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1rgfzzy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05si1me</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.getNSSIListFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_05si1me" sourceRef="Task_1u755sr" targetRef="Task_1iomfas" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1ogbunu" name="Is all NSSI finished?"> + <bpmn:incoming>SequenceFlow_15z9iio</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1c4fjbv</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0926ghe</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_0jaitqv" name="End"> + <bpmn:incoming>SequenceFlow_1c4fjbv</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1c4fjbv" name="yes" sourceRef="ExclusiveGateway_1ogbunu" targetRef="EndEvent_0jaitqv"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_01o2qpv" sourceRef="Task_1iomfas" targetRef="Task_1qqljvu" /> + <bpmn:sequenceFlow id="SequenceFlow_0c58sw3" sourceRef="Task_1rc7mcw" targetRef="ScriptTask_159855t" /> + <bpmn:sequenceFlow id="SequenceFlow_0926ghe" name="no" sourceRef="ExclusiveGateway_1ogbunu" targetRef="Task_1iomfas"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" ) == false)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="Task_0etki1p" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ep5het</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0npmman</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0npmman" sourceRef="Task_0etki1p" targetRef="Task_13k9usx" /> + <bpmn:scriptTask id="Task_1iomfas" name="Get Current NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0926ghe</bpmn:incoming> + <bpmn:incoming>SequenceFlow_05si1me</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01o2qpv</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.getCurrentNSSI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_159855t" name="Parse Next NSSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0c58sw3</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15z9iio</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.parseNextNSSI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_15z9iio" sourceRef="ScriptTask_159855t" targetRef="ExclusiveGateway_1ogbunu" /> + <bpmn:sequenceFlow id="SequenceFlow_0q83qg3" sourceRef="Task_1qqljvu" targetRef="Task_1rc7mcw" /> + <bpmn:scriptTask id="Task_1qqljvu" name="Query Slice Profile From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_01o2qpv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0q83qg3</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.querySliceProfileFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_029u1wr" sourceRef="Task_13k9usx" targetRef="Task_1ujnqtj" /> + <bpmn:scriptTask id="Task_13k9usx" name="Query E2ESlice Serive From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0npmman</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_029u1wr</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.queryE2ESliceSeriveFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="Task_1rc7mcw" name="Do Deallocate NSSI " calledElement="DoDeallocateNSSIV1"> + <bpmn:extensionElements> + <camunda:in source="currentNSSI" target="currentNSSI" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0q83qg3</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0c58sw3</bpmn:outgoing> + </bpmn:callActivity> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteSliceServiceV1"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="152" y="122" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="159" y="165" width="22" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ep5het_di" bpmnElement="SequenceFlow_0ep5het"> + <di:waypoint x="188" y="140" /> + <di:waypoint x="270" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1qkgvvu_di" bpmnElement="SequenceFlow_1qkgvvu"> + <di:waypoint x="700" y="140" /> + <di:waypoint x="750" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rgfzzy_di" bpmnElement="SequenceFlow_1rgfzzy"> + <di:waypoint x="850" y="140" /> + <di:waypoint x="900" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1bj6tw4_di" bpmnElement="Task_1ujnqtj"> + <dc:Bounds x="600" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xgmbqj_di" bpmnElement="Task_1fqiyb4"> + <dc:Bounds x="750" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_01fp1vt_di" bpmnElement="Task_1u755sr"> + <dc:Bounds x="900" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05si1me_di" bpmnElement="SequenceFlow_05si1me"> + <di:waypoint x="1000" y="140" /> + <di:waypoint x="1040" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1ogbunu_di" bpmnElement="ExclusiveGateway_1ogbunu" isMarkerVisible="true"> + <dc:Bounds x="1555" y="115" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1560" y="85" width="52" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0jaitqv_di" bpmnElement="EndEvent_0jaitqv"> + <dc:Bounds x="1692" y="122" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1700" y="168" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1c4fjbv_di" bpmnElement="SequenceFlow_1c4fjbv"> + <di:waypoint x="1605" y="140" /> + <di:waypoint x="1692" y="140" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1630" y="118" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01o2qpv_di" bpmnElement="SequenceFlow_01o2qpv"> + <di:waypoint x="1140" y="140" /> + <di:waypoint x="1170" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0c58sw3_di" bpmnElement="SequenceFlow_0c58sw3"> + <di:waypoint x="1400" y="140" /> + <di:waypoint x="1420" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0926ghe_di" bpmnElement="SequenceFlow_0926ghe"> + <di:waypoint x="1580" y="165" /> + <di:waypoint x="1580" y="260" /> + <di:waypoint x="1090" y="260" /> + <di:waypoint x="1090" y="180" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1329" y="242" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0icszw6_di" bpmnElement="Task_0etki1p"> + <dc:Bounds x="270" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0npmman_di" bpmnElement="SequenceFlow_0npmman"> + <di:waypoint x="370" y="140" /> + <di:waypoint x="430" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1obnwrr_di" bpmnElement="Task_1iomfas"> + <dc:Bounds x="1040" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_159855t_di" bpmnElement="ScriptTask_159855t"> + <dc:Bounds x="1420" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15z9iio_di" bpmnElement="SequenceFlow_15z9iio"> + <di:waypoint x="1520" y="140" /> + <di:waypoint x="1555" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0q83qg3_di" bpmnElement="SequenceFlow_0q83qg3"> + <di:waypoint x="1270" y="140" /> + <di:waypoint x="1300" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0y9ppnc_di" bpmnElement="Task_1qqljvu"> + <dc:Bounds x="1170" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_029u1wr_di" bpmnElement="SequenceFlow_029u1wr"> + <di:waypoint x="530" y="140" /> + <di:waypoint x="600" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0f9rjq4_di" bpmnElement="Task_13k9usx"> + <dc:Bounds x="430" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_18qkiat_di" bpmnElement="Task_1rc7mcw"> + <dc:Bounds x="1300" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn new file mode 100644 index 0000000000..4f12ca7f41 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn @@ -0,0 +1,344 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:collaboration id="Collaboration_0htncd8"> + <bpmn:participant id="DoSendCommandToNSSMF01" name="DoSendCommandToNSSMF" processRef="DoSendCommandToNSSMF" /> + </bpmn:collaboration> + <bpmn:process id="DoSendCommandToNSSMF" name="DoSendCommandToNSSMF" isExecutable="true"> + <bpmn:scriptTask id="Task_0qx12sa" name="Get one NSSI info from list" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0umnozs</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1vuuuhr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ea3pk8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoSendCommandToNSSMF() +csi.getNSSIformlist(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_18qkm4u" name="Activation completed?"> + <bpmn:incoming>SequenceFlow_1yjsv5s</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1qxmooy</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1lh0it1</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0swcqw8</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:exclusiveGateway id="ExclusiveGateway_07yenxg" name="Get successful?"> + <bpmn:incoming>SequenceFlow_1ea3pk8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_080lgb0</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1oi86yc</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1vuuuhr" sourceRef="ServiceTask_0myj742" targetRef="Task_0qx12sa" /> + <bpmn:sequenceFlow id="SequenceFlow_1oeexsj" sourceRef="Task_1a9qxuo" targetRef="ServiceTask_0myj742" /> + <bpmn:sequenceFlow id="SequenceFlow_1ea3pk8" sourceRef="Task_0qx12sa" targetRef="ExclusiveGateway_07yenxg" /> + <bpmn:sequenceFlow id="SequenceFlow_1yjsv5s" sourceRef="Task_1y09kt4" targetRef="ExclusiveGateway_18qkm4u" /> + <bpmn:sequenceFlow id="SequenceFlow_0swcqw8" name="waitting" sourceRef="ExclusiveGateway_18qkm4u" targetRef="Task_08qjojj"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "waitting"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1lh0it1" name="no" sourceRef="ExclusiveGateway_18qkm4u" targetRef="EndEvent_0k52g73"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1qxmooy" name="yes" sourceRef="ExclusiveGateway_18qkm4u" targetRef="Task_1a9qxuo"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_080lgb0" name="yes" sourceRef="ExclusiveGateway_07yenxg" targetRef="CallActivity_0018jhc"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isGetSuccessfull") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_08xfw41" sourceRef="Task_0xfp2r8" targetRef="ExclusiveGateway_0ljwjfh" /> + <bpmn:sequenceFlow id="SequenceFlow_1s2oozd" name="yes" sourceRef="ExclusiveGateway_0ljwjfh" targetRef="Task_08qjojj"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivated") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_020xvv4" name="no" sourceRef="ExclusiveGateway_0ljwjfh" targetRef="EndEvent_0k52g73"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivated") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_10162l8" sourceRef="Task_08qjojj" targetRef="Task_1y09kt4" /> + <bpmn:sequenceFlow id="SequenceFlow_1pfo460" sourceRef="StartEvent_1" targetRef="ScriptTask_1otgwej" /> + <bpmn:sequenceFlow id="SequenceFlow_1oi86yc" name="no" sourceRef="ExclusiveGateway_07yenxg" targetRef="EndEvent_0d1g3mv"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isGetSuccessfull") == "false"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_0d1g3mv"> + <bpmn:incoming>SequenceFlow_1oi86yc</bpmn:incoming> + </bpmn:endEvent> + <bpmn:startEvent id="StartEvent_1"> + <bpmn:outgoing>SequenceFlow_1pfo460</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_1otgwej" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1pfo460</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0umnozs</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoSendCommandToNSSMF() +dcso.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0hmwdqq"> + <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1wd8iqk"> + <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" /> + <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" /> + <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoSendCommandToNSSMF() +csi.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_0umnozs" sourceRef="ScriptTask_1otgwej" targetRef="Task_0qx12sa" /> + <bpmn:sequenceFlow id="SequenceFlow_1ucjcm1" sourceRef="CallActivity_0018jhc" targetRef="ScriptTask_0q7is68" /> + <bpmn:endEvent id="EndEvent_0k52g73"> + <bpmn:incoming>SequenceFlow_020xvv4</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1lh0it1</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0fypnen" errorRef="Error_08p7hsc" /> + </bpmn:endEvent> + <bpmn:scriptTask id="Task_08qjojj" name="wait for Return" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1s2oozd</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0swcqw8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10162l8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoSendCommandToNSSMF() +csi.WaitForReturn(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_1y09kt4" name="Get the activation status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_10162l8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yjsv5s</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoSendCommandToNSSMF() +csi.GetTheStatusOfActivation(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0ljwjfh" name="Activation successful?"> + <bpmn:incoming>SequenceFlow_08xfw41</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1s2oozd</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_020xvv4</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="Task_0xfp2r8" name="SendCommandToNssmf" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1a6iu8c</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_08xfw41</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoSendCommandToNSSMF() +csi.SendCommandToNssmf(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0018jhc" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="nssiId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_080lgb0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ucjcm1</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0q7is68" name="processDecomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ucjcm1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1a6iu8c</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoSendCommandToNSSMF() +csi.processDecomposition(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1a6iu8c" sourceRef="ScriptTask_0q7is68" targetRef="Task_0xfp2r8" /> + <bpmn:serviceTask id="ServiceTask_0myj742" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1oeexsj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vuuuhr</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="Task_1a9qxuo" name="Update Index" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qxmooy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1oeexsj</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new DoSendCommandToNSSMF() +csi.UpdateIndex(execution)</bpmn:script> + </bpmn:scriptTask> + </bpmn:process> + <bpmn:error id="Error_08p7hsc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8"> + <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="DoSendCommandToNSSMF01" isHorizontal="true"> + <dc:Bounds x="160" y="60" width="2080" height="1000" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv"> + <dc:Bounds x="1642" y="302" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="262" y="302" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao"> + <di:waypoint x="1120" y="860" /> + <di:waypoint x="1257" y="860" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo"> + <di:waypoint x="843" y="860" /> + <di:waypoint x="1020" y="860" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq"> + <dc:Bounds x="807" y="842" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk"> + <dc:Bounds x="1257" y="842" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0s82iw4_di" bpmnElement="Task_0xfp2r8"> + <dc:Bounds x="1230" y="280" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_18qkm4u_di" bpmnElement="ExclusiveGateway_18qkm4u" isMarkerVisible="true"> + <dc:Bounds x="835" y="595" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="832" y="558" width="55" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ea3pk8_di" bpmnElement="SequenceFlow_1ea3pk8"> + <di:waypoint x="770" y="320" /> + <di:waypoint x="815" y="320" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_08xfw41_di" bpmnElement="SequenceFlow_08xfw41"> + <di:waypoint x="1330" y="320" /> + <di:waypoint x="1415" y="320" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yjsv5s_di" bpmnElement="SequenceFlow_1yjsv5s"> + <di:waypoint x="1390" y="620" /> + <di:waypoint x="885" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0ljwjfh_di" bpmnElement="ExclusiveGateway_0ljwjfh" isMarkerVisible="true"> + <dc:Bounds x="1415" y="295" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1412" y="265" width="60" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1s2oozd_di" bpmnElement="SequenceFlow_1s2oozd"> + <di:waypoint x="1440" y="345" /> + <di:waypoint x="1440" y="420" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1451" y="373" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0k52g73_di" bpmnElement="EndEvent_0k52g73"> + <dc:Bounds x="1532" y="302" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_020xvv4_di" bpmnElement="SequenceFlow_020xvv4"> + <di:waypoint x="1465" y="320" /> + <di:waypoint x="1532" y="320" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1494" y="302" width="12" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_121jfnq_di" bpmnElement="Task_0qx12sa"> + <dc:Bounds x="670" y="280" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_07yenxg_di" bpmnElement="ExclusiveGateway_07yenxg" isMarkerVisible="true"> + <dc:Bounds x="815" y="295" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="800" y="353" width="80" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_080lgb0_di" bpmnElement="SequenceFlow_080lgb0"> + <di:waypoint x="865" y="320" /> + <di:waypoint x="930" y="320" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="869" y="302" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_10162l8_di" bpmnElement="SequenceFlow_10162l8"> + <di:waypoint x="1440" y="500" /> + <di:waypoint x="1440" y="580" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1qxmooy_di" bpmnElement="SequenceFlow_1qxmooy"> + <di:waypoint x="835" y="620" /> + <di:waypoint x="770" y="620" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="813" y="623" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0aspjme_di" bpmnElement="Task_1a9qxuo"> + <dc:Bounds x="670" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_170g0ll_di" bpmnElement="Task_08qjojj"> + <dc:Bounds x="1390" y="420" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1meh39q_di" bpmnElement="Task_1y09kt4"> + <dc:Bounds x="1390" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lh0it1_di" bpmnElement="SequenceFlow_1lh0it1"> + <di:waypoint x="860" y="645" /> + <di:waypoint x="860" y="720" /> + <di:waypoint x="1550" y="720" /> + <di:waypoint x="1550" y="338" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1110" y="702" width="12" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0swcqw8_di" bpmnElement="SequenceFlow_0swcqw8"> + <di:waypoint x="860" y="595" /> + <di:waypoint x="860" y="460" /> + <di:waypoint x="1390" y="460" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1067" y="443" width="38" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1oeexsj_di" bpmnElement="SequenceFlow_1oeexsj"> + <di:waypoint x="720" y="580" /> + <di:waypoint x="720" y="520" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0myj742_di" bpmnElement="ServiceTask_0myj742"> + <dc:Bounds x="670" y="440" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1vuuuhr_di" bpmnElement="SequenceFlow_1vuuuhr"> + <di:waypoint x="720" y="440" /> + <di:waypoint x="720" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pfo460_di" bpmnElement="SequenceFlow_1pfo460"> + <di:waypoint x="298" y="320" /> + <di:waypoint x="420" y="320" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1oi86yc_di" bpmnElement="SequenceFlow_1oi86yc"> + <di:waypoint x="840" y="295" /> + <di:waypoint x="840" y="230" /> + <di:waypoint x="1660" y="230" /> + <di:waypoint x="1660" y="302" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="884" y="212" width="12" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1otgwej_di" bpmnElement="ScriptTask_1otgwej"> + <dc:Bounds x="420" y="280" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1hlwd77_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true"> + <dc:Bounds x="700" y="780" width="810" height="180" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1c5l0io_di" bpmnElement="Task_01ooik6"> + <dc:Bounds x="1020" y="820" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0umnozs_di" bpmnElement="SequenceFlow_0umnozs"> + <di:waypoint x="520" y="320" /> + <di:waypoint x="670" y="320" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0018jhc_di" bpmnElement="CallActivity_0018jhc"> + <dc:Bounds x="930" y="280" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ucjcm1_di" bpmnElement="SequenceFlow_1ucjcm1"> + <di:waypoint x="1030" y="320" /> + <di:waypoint x="1070" y="320" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0q7is68_di" bpmnElement="ScriptTask_0q7is68"> + <dc:Bounds x="1070" y="280" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1a6iu8c_di" bpmnElement="SequenceFlow_1a6iu8c"> + <di:waypoint x="1170" y="320" /> + <di:waypoint x="1230" y="320" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/HandleOrchestrationTask.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/HandleOrchestrationTask.bpmn new file mode 100644 index 0000000000..09a14be26b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/HandleOrchestrationTask.bpmn @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1gbzu9i" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.2"> + <bpmn:process id="HandleOrchestrationTask" name="HandleOrchestrationTask" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="Start"> + <bpmn:outgoing>SequenceFlow_0lbtmuu</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_0r0a9ga" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0lbtmuu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uzjpd6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def hot = new HandleOrchestrationTask() +hot.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_1iat8g5" name="Send Orchestration Task Request"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${url}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:script scriptFormat="groovy">execution.getVariable("headerMap")</camunda:script> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${payload}</camunda:inputParameter> + <camunda:inputParameter name="method">${method}</camunda:inputParameter> + <camunda:outputParameter name="statusCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="response">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0uzjpd6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_06rrzml</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="ScriptTask_119zm52" name="Post Process" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_06rrzml</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1qthzdo</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def hot = new HandleOrchestrationTask() +hot.postProcess(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0uzjpd6" sourceRef="ScriptTask_0r0a9ga" targetRef="ServiceTask_1iat8g5" /> + <bpmn:sequenceFlow id="SequenceFlow_06rrzml" sourceRef="ServiceTask_1iat8g5" targetRef="ScriptTask_119zm52" /> + <bpmn:sequenceFlow id="SequenceFlow_0lbtmuu" sourceRef="StartEvent_1" targetRef="ScriptTask_0r0a9ga" /> + <bpmn:endEvent id="EndEvent_18t5h42" name="End"> + <bpmn:incoming>SequenceFlow_1qthzdo</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qthzdo" sourceRef="ScriptTask_119zm52" targetRef="EndEvent_18t5h42" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="HandleOrchestrationTask"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="179" y="103" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="185" y="146" width="25" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0r0a9ga_di" bpmnElement="ScriptTask_0r0a9ga"> + <dc:Bounds x="284" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1iat8g5_di" bpmnElement="ServiceTask_1iat8g5"> + <dc:Bounds x="466" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_119zm52_di" bpmnElement="ScriptTask_119zm52"> + <dc:Bounds x="644" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0uzjpd6_di" bpmnElement="SequenceFlow_0uzjpd6"> + <di:waypoint x="384" y="121" /> + <di:waypoint x="466" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06rrzml_di" bpmnElement="SequenceFlow_06rrzml"> + <di:waypoint x="566" y="121" /> + <di:waypoint x="644" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0lbtmuu_di" bpmnElement="SequenceFlow_0lbtmuu"> + <di:waypoint x="215" y="121" /> + <di:waypoint x="284" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_18t5h42_di" bpmnElement="EndEvent_18t5h42"> + <dc:Bounds x="820" y="103" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="828" y="146" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qthzdo_di" bpmnElement="SequenceFlow_1qthzdo"> + <di:waypoint x="744" y="121" /> + <di:waypoint x="820" y="121" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> + |