diff options
329 files changed, 14537 insertions, 4429 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java index 98793601d0..da81da91ea 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java @@ -2,14 +2,15 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ + * Copyright (C) 2018 Intel Corp. All rights reserved. * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,6 +23,9 @@ package org.onap.so.openstack.utils; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; import org.onap.so.config.beans.PoConfig; import org.onap.so.logger.MessageEnum; @@ -35,10 +39,13 @@ import org.onap.so.openstack.exceptions.MsoOpenstackException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.base.client.OpenStackBaseException; import com.woorea.openstack.base.client.OpenStackConnectException; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.heat.model.CreateStackParam; import com.woorea.openstack.heat.model.Explanation; import com.woorea.openstack.keystone.model.Error; import com.woorea.openstack.quantum.model.NeutronError; @@ -57,11 +64,11 @@ public class MsoCommonUtils { * sub-category that identifies the specific call (using the real * openstack-java-sdk classname of the OpenStackRequest<T> parameter). */ - + protected <T> T executeAndRecordOpenstackRequest (OpenStackRequest <T> request) { - + int limit; - + long start = System.currentTimeMillis (); String requestType; if (request.getClass ().getEnclosingClass () != null) { @@ -70,17 +77,17 @@ public class MsoCommonUtils { } else { requestType = request.getClass ().getSimpleName (); } - + int retryDelay = poConfig.getRetryDelay(); int retryCount = poConfig.getRetryCount(); String retryCodes = poConfig.getRetryCodes(); - + // Run the actual command. All exceptions will be propagated while (true) { try { return request.execute (); - } + } catch (OpenStackResponseException e) { boolean retry = false; if (retryCodes != null ) { @@ -128,11 +135,11 @@ public class MsoCommonUtils { } else throw e; - + } } } - + /* * Convert an Openstack Exception on a Keystone call to an MsoException. * This method supports both OpenstackResponseException and OpenStackConnectException. @@ -281,7 +288,7 @@ public class MsoCommonUtils { return me; } - + protected MsoException ioExceptionToMsoException(IOException e, String context) { MsoAdapterException me = new MsoAdapterException (e.getMessage (), e); me.addContext (context); @@ -297,7 +304,105 @@ public class MsoCommonUtils { public boolean isNullOrEmpty (String s) { return s == null || s.isEmpty(); } - - + + + protected CreateStackParam createStackParam(String stackName, + String heatTemplate, + Map <String, ?> stackInputs, + int timeoutMinutes, + String environment, + Map <String, Object> files, + Map <String, Object> heatFiles) { + + // Create local variables checking to see if we have an environment, nested, get_files + // Could later add some checks to see if it's valid. + boolean haveEnvtVariable = true; + if (environment == null || "".equalsIgnoreCase (environment.trim ())) { + haveEnvtVariable = false; + logger.debug ("createStackParam called with no environment variable"); + } else { + logger.debug ("createStackParam called with an environment variable: " + environment); + } + + boolean haveFiles = true; + if (files == null || files.isEmpty ()) { + haveFiles = false; + logger.debug ("createStackParam called with no files / child template ids"); + } else { + logger.debug ("createStackParam called with " + files.size () + " files / child template ids"); + } + + boolean haveHeatFiles = true; + if (heatFiles == null || heatFiles.isEmpty ()) { + haveHeatFiles = false; + logger.debug ("createStackParam called with no heatFiles"); + } else { + logger.debug ("createStackParam called with " + heatFiles.size () + " heatFiles"); + } + + //force entire stackInput object to generic Map<String, Object> for openstack compatibility + ObjectMapper mapper = new ObjectMapper(); + Map<String, Object> normalized = new HashMap<>(); + try { + normalized = mapper.readValue(mapper.writeValueAsString(stackInputs), new TypeReference<HashMap<String,Object>>() {}); + } catch (IOException e1) { + logger.debug("could not map json", e1); + } + + // Build up the stack to create + // Disable auto-rollback, because error reason is lost. Always rollback in the code. + CreateStackParam stack = new CreateStackParam (); + stack.setStackName (stackName); + stack.setTimeoutMinutes (timeoutMinutes); + stack.setParameters (normalized); + stack.setTemplate (heatTemplate); + stack.setDisableRollback (true); + // TJM New for PO Adapter - add envt variable + if (haveEnvtVariable) { + logger.debug ("Found an environment variable - value: " + environment); + stack.setEnvironment (environment); + } + // Now handle nested templates or get_files - have to combine if we have both + // as they're both treated as "files:" on the stack. + if (haveFiles && haveHeatFiles) { + // Let's do this here - not in the bean + logger.debug ("Found files AND heatFiles - combine and add!"); + Map <String, Object> combinedFiles = new HashMap <> (); + for (Entry<String, Object> entry : files.entrySet()) { + combinedFiles.put(entry.getKey(), entry.getValue()); + } + for (Entry<String, Object> entry : heatFiles.entrySet()) { + combinedFiles.put(entry.getKey(), entry.getValue()); + } + stack.setFiles (combinedFiles); + } else { + // Handle if we only have one or neither: + if (haveFiles) { + logger.debug ("Found files - adding to stack"); + stack.setFiles (files); + } + if (haveHeatFiles) { + logger.debug ("Found heatFiles - adding to stack"); + // the setFiles was modified to handle adding the entries + stack.setFiles (heatFiles); + } + } + + // 1802 - attempt to add better formatted printout of request to openstack + try { + Map<String, Object> inputs = new HashMap<>(); + for (Entry<String, ?> entry : stackInputs.entrySet()) { + if (entry.getValue() != null) { + inputs.put(entry.getKey(), entry.getValue()); + } + } + logger.debug("stack request:" + stack.toString()); + } catch (Exception e) { + // that's okay - this is a nice-to-have + logger.debug("(had an issue printing nicely formatted request to debuglog) " + e.getMessage()); + } + + return stack; + } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index 6b66970ea0..15f84890b7 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -8,9 +8,9 @@ * 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. @@ -106,18 +106,18 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ // Fetch cloud configuration each time (may be cached in CloudConfig class) @Autowired protected CloudConfig cloudConfig; - + @Autowired private Environment environment; @Autowired private AuthenticationMethodFactory authenticationMethodFactory; - + @Autowired private MsoTenantUtilsFactory tenantUtilsFactory; - + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoHeatUtils.class); - + // Properties names and variables (with default values) protected String createPollIntervalProp = "ecomp.mso.adapters.po.pollInterval"; private String deletePollIntervalProp = "ecomp.mso.adapters.po.pollInterval"; @@ -125,7 +125,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ protected static final String createPollIntervalDefault = "15"; private static final String deletePollIntervalDefault = "15"; - + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); /** @@ -275,31 +275,19 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ Map <String, Object> files, Map <String, Object> heatFiles, boolean backout) throws MsoException { - // Create local variables checking to see if we have an environment, nested, get_files - // Could later add some checks to see if it's valid. - boolean haveEnvtVariable = true; - if (environment == null || "".equalsIgnoreCase (environment.trim ())) { - haveEnvtVariable = false; - LOGGER.debug ("createStack called with no environment variable"); - } else { - LOGGER.debug ("createStack called with an environment variable: " + environment); - } - boolean haveFiles = true; - if (files == null || files.isEmpty ()) { - haveFiles = false; - LOGGER.debug ("createStack called with no files / child template ids"); - } else { - LOGGER.debug ("createStack called with " + files.size () + " files / child template ids"); + // Take out the multicloud inputs, if present. + String[] directives = { "oof_directives", "sdnc_directives", "generic_vnf_id", "vf_module_id" }; + for (String key : directives) { + if (stackInputs.containsKey(key)) { + stackInputs.remove(key); + if (stackInputs.isEmpty()) { + break; + } + } } - boolean haveHeatFiles = true; - if (heatFiles == null || heatFiles.isEmpty ()) { - haveHeatFiles = false; - LOGGER.debug ("createStack called with no heatFiles"); - } else { - LOGGER.debug ("createStack called with " + heatFiles.size () + " heatFiles"); - } + CreateStackParam stack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles); // Obtain the cloud site information where we will create the stack CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( @@ -309,73 +297,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated) Heat heatClient = getHeatClient (cloudSite, tenantId); if (heatClient != null) { - LOGGER.debug("Found: " + heatClient.toString()); + LOGGER.debug("Found: " + heatClient.toString()); } LOGGER.debug ("Ready to Create Stack (" + heatTemplate + ") with input params: " + stackInputs); - //force entire stackInput object to generic Map<String, Object> for openstack compatibility - ObjectMapper mapper = new ObjectMapper(); - Map<String, Object> normalized = new HashMap<>(); - try { - normalized = mapper.readValue(mapper.writeValueAsString(stackInputs), new TypeReference<HashMap<String,Object>>() {}); - } catch (IOException e1) { - LOGGER.debug("could not map json", e1); - } - - // Build up the stack to create - // Disable auto-rollback, because error reason is lost. Always rollback in the code. - CreateStackParam stack = new CreateStackParam (); - stack.setStackName (stackName); - stack.setTimeoutMinutes (timeoutMinutes); - stack.setParameters (normalized); - stack.setTemplate (heatTemplate); - stack.setDisableRollback (true); - // TJM New for PO Adapter - add envt variable - if (haveEnvtVariable) { - LOGGER.debug ("Found an environment variable - value: " + environment); - stack.setEnvironment (environment); - } - // Now handle nested templates or get_files - have to combine if we have both - // as they're both treated as "files:" on the stack. - if (haveFiles && haveHeatFiles) { - // Let's do this here - not in the bean - LOGGER.debug ("Found files AND heatFiles - combine and add!"); - Map <String, Object> combinedFiles = new HashMap <> (); - for (Entry<String, Object> entry : files.entrySet()) { - combinedFiles.put(entry.getKey(), entry.getValue()); - } - for (Entry<String, Object> entry : heatFiles.entrySet()) { - combinedFiles.put(entry.getKey(), entry.getValue()); - } - stack.setFiles (combinedFiles); - } else { - // Handle if we only have one or neither: - if (haveFiles) { - LOGGER.debug ("Found files - adding to stack"); - stack.setFiles (files); - } - if (haveHeatFiles) { - LOGGER.debug ("Found heatFiles - adding to stack"); - // the setFiles was modified to handle adding the entries - stack.setFiles (heatFiles); - } - } - - // 1802 - attempt to add better formatted printout of request to openstack - try { - Map<String, Object> inputs = new HashMap<>(); - for (Entry<String, ?> entry : stackInputs.entrySet()) { - if (entry.getValue() != null) { - inputs.put(entry.getKey(), entry.getValue()); - } - } - LOGGER.debug(this.printStackRequest(tenantId, heatFiles, files, environment, inputs, stackName, heatTemplate, timeoutMinutes, backout, cloudSiteId)); - } catch (Exception e) { - // that's okay - this is a nice-to-have - LOGGER.debug("(had an issue printing nicely formatted request to debuglog) " + e.getMessage()); - } - Stack heatStack = null; try { // Execute the actual Openstack command to create the Heat stack @@ -401,7 +327,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ throw me; } else { // Convert the OpenStackResponseException to an MsoOpenstackException - LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage()); + LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage()); throw heatExceptionToMsoException (e, CREATE_STACK); } } catch (OpenStackConnectException e) { @@ -422,8 +348,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ // Set a time limit on overall polling. // Use the resource (template) timeout for Openstack (expressed in minutes) // and add one poll interval to give Openstack a chance to fail on its own.s - - int createPollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault)); + + int createPollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault)); int pollTimeout = (timeoutMinutes * 60) + createPollInterval; // New 1610 - poll on delete if we rollback - use same values for now int deletePollInterval = createPollInterval; @@ -741,7 +667,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ else { LOGGER.debug ("Heat Client is NULL" ); } - + executeAndRecordOpenstackRequest (request); } catch (OpenStackResponseException e) { if (e.getStatus () == 404) { @@ -765,7 +691,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ if (pollForCompletion) { // Set a timeout on polling - + int pollInterval = Integer.parseInt(this.environment.getProperty(deletePollIntervalProp, "" + deletePollIntervalDefault)); int pollTimeout = Integer.parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + deletePollIntervalDefault)); @@ -914,7 +840,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ // Remove any extraneous parameters (don't throw an error) Map <String, Object> updatedParams = new HashMap <> (); List <String> extraParams = new ArrayList <> (); - + for (Entry<String, Object> entry : inputParams.entrySet()) { if (!paramList.contains(entry.getKey())) { // This is not a valid parameter for this template @@ -1079,7 +1005,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ */ protected Stack queryHeatStack (Heat heatClient, String stackName) throws MsoException { if (stackName == null) { - return null; + return null; } try { OpenStackRequest <Stack> request = heatClient.getStacks ().byName (stackName); @@ -1204,7 +1130,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } - private StringBuilder getOutputsAsStringBuilder(Stack heatStack) { + protected StringBuilder getOutputsAsStringBuilder(Stack heatStack) { // This should only be used as a utility to print out the stack outputs // to the log StringBuilder sb = new StringBuilder(""); @@ -1237,7 +1163,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } catch (Exception e) { LOGGER.debug("Exception :",e); sb.append("(a LinkedHashMap value that would not convert nicely)"); - } + } } else if (obj instanceof Integer) { String str = ""; try { @@ -1281,8 +1207,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ sb.append("[END]"); return sb; } - - + + public void copyBaseOutputsToInputs(Map<String, Object> inputs, Map<String, Object> otherStackOutputs, List<String> paramNames, Map<String, String> aliases) { if (inputs == null || otherStackOutputs == null) @@ -1331,7 +1257,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } return; } - + public List<String> convertCdlToArrayList(String cdl) { String cdl2 = cdl.trim(); String cdl3; @@ -1342,7 +1268,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } return new ArrayList<>(Arrays.asList(cdl3.split(","))); } - + /** * New with 1707 - this method will convert all the String *values* of the inputs * to their "actual" object type (based on the param type: in the db - which comes from the template): @@ -1364,12 +1290,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ HashMap<String, Object> newInputs = new HashMap<>(); HashMap<String, HeatTemplateParam> params = new HashMap<>(); HashMap<String, HeatTemplateParam> paramAliases = new HashMap<>(); - + if (inputs == null) { LOGGER.debug("convertInputMap - inputs is null - nothing to do here"); return new HashMap<>(); } - + LOGGER.debug("convertInputMap in MsoHeatUtils called, with " + inputs.size() + " inputs, and template " + template.getArtifactUuid()); try { LOGGER.debug(template.toString()); @@ -1378,7 +1304,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } catch (Exception e) { LOGGER.debug("Exception occurred in convertInputMap:" + e.getMessage(), e); } - + for (HeatTemplateParam htp : template.getParameters()) { LOGGER.debug("Adding " + htp.getParamName()); params.put(htp.getParamName(), htp); @@ -1413,9 +1339,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ if ("string".equalsIgnoreCase(type)) { // Easiest! String str = inputs.get(key); - if (alias) + if (alias) newInputs.put(realName, str); - else + else newInputs.put(key, str); } else if ("number".equalsIgnoreCase(type)) { String integerString = inputs.get(key); @@ -1480,9 +1406,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } return newInputs; } - - /* - * This helpful method added for Valet + + /* + * This helpful method added for Valet */ public String getCloudSiteKeystoneUrl(String cloudSiteId) throws MsoCloudSiteNotFound { String keystone_url = null; @@ -1498,17 +1424,17 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } return keystone_url; } - + /* - * Create a string suitable for being dumped to a debug log that creates a + * Create a string suitable for being dumped to a debug log that creates a * pseudo-JSON request dumping what's being sent to Openstack API in the create or update request */ - - private String printStackRequest(String tenantId, + + private String printStackRequest(String tenantId, Map<String, Object> heatFiles, Map<String, Object> nestedTemplates, String environment, - Map<String, Object> inputs, + Map<String, Object> inputs, String vfModuleName, String template, int timeoutMinutes, @@ -1520,14 +1446,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ sb.append("{\n"); sb.append(" \"stack_name\": \"" + vfModuleName + "\",\n"); sb.append(" \"disable_rollback\": " + backout + ",\n"); - sb.append(" \"timeout_mins\": " + timeoutMinutes + ",\n"); + sb.append(" \"timeout_mins\": " + timeoutMinutes + ",\n"); sb.append(" \"template\": {\n"); sb.append(template); sb.append(" },\n"); sb.append(" \"environment\": {\n"); - if (environment == null) + if (environment == null) sb.append("<none>"); - else + else sb.append(environment); sb.append(" },\n"); sb.append(" \"files\": {\n"); @@ -1574,19 +1500,19 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } } sb.append("\n }\n}\n"); - + return sb.toString(); } - + /******************************************************************************* - * + * * Methods (and associated utilities) to implement the VduPlugin interface - * + * *******************************************************************************/ - + /** * VduPlugin interface for instantiate function. - * + * * Translate the VduPlugin parameters to the corresponding 'createStack' parameters, * and then invoke the existing function. */ @@ -1601,7 +1527,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ { String cloudSiteId = cloudInfo.getCloudSiteId(); String tenantId = cloudInfo.getTenantId(); - + // Translate the VDU ModelInformation structure to that which is needed for // creating the Heat stack. Loop through the artifacts, looking specifically // for MAIN_TEMPLATE and ENVIRONMENT. Any other artifact will @@ -1610,7 +1536,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ Map<String,Object> nestedTemplates = new HashMap<>(); Map<String,Object> files = new HashMap<>(); String heatEnvironment = null; - + for (VduArtifact vduArtifact: vduModel.getArtifacts()) { if (vduArtifact.getType() == ArtifactType.MAIN_TEMPLATE) { heatTemplate = new String(vduArtifact.getContent()); @@ -1622,7 +1548,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ heatEnvironment = new String(vduArtifact.getContent()); } } - + try { StackInfo stackInfo = createStack (cloudSiteId, tenantId, @@ -1635,7 +1561,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ nestedTemplates, files, rollbackOnFailure); - + // Populate a vduInstance from the StackInfo return stackInfoToVduInstance(stackInfo); } @@ -1643,8 +1569,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ throw new VduException ("MsoHeatUtils (instantiateVDU): createStack Exception", e); } } - - + + /** * VduPlugin interface for query function. */ @@ -1654,19 +1580,19 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ { String cloudSiteId = cloudInfo.getCloudSiteId(); String tenantId = cloudInfo.getTenantId(); - + try { // Query the Cloudify Deployment object and populate a VduInstance StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId); - + return stackInfoToVduInstance(stackInfo); } catch (Exception e) { throw new VduException ("MsoHeatUtile (queryVdu): queryStack Exception ", e); } } - - + + /** * VduPlugin interface for delete function. */ @@ -1676,31 +1602,31 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ { String cloudSiteId = cloudInfo.getCloudSiteId(); String tenantId = cloudInfo.getTenantId(); - + try { // Delete the Heat stack StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId, true); - + // Populate a VduInstance based on the deleted Cloudify Deployment object VduInstance vduInstance = stackInfoToVduInstance(stackInfo); - + // Override return state to DELETED (HeatUtils sets to NOTFOUND) vduInstance.getStatus().setState(VduStateType.DELETED); - + return vduInstance; } catch (Exception e) { throw new VduException ("Delete VDU Exception", e); } } - - + + /** * VduPlugin interface for update function. - * + * * Update is currently not supported in the MsoHeatUtils implementation of VduPlugin. * Just return a VduException. - * + * */ @Override public VduInstance updateVdu ( @@ -1713,38 +1639,38 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ { throw new VduException ("MsoHeatUtils: updateVdu interface not supported"); } - - + + /* * Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object */ - private VduInstance stackInfoToVduInstance (StackInfo stackInfo) + protected VduInstance stackInfoToVduInstance (StackInfo stackInfo) { VduInstance vduInstance = new VduInstance(); - + // The full canonical name as the instance UUID vduInstance.setVduInstanceId(stackInfo.getCanonicalName()); vduInstance.setVduInstanceName(stackInfo.getName()); - + // Copy inputs and outputs vduInstance.setInputs(stackInfo.getParameters()); vduInstance.setOutputs(stackInfo.getOutputs()); - + // Translate the status elements vduInstance.setStatus(stackStatusToVduStatus (stackInfo)); - + return vduInstance; } - + private VduStatus stackStatusToVduStatus (StackInfo stackInfo) { VduStatus vduStatus = new VduStatus(); - + // Map the status fields to more generic VduStatus. // There are lots of HeatStatus values, so this is a bit long... HeatStatus heatStatus = stackInfo.getStatus(); String statusMessage = stackInfo.getStatusMessage(); - + if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) { vduStatus.setState(VduStateType.INSTANTIATING); vduStatus.setLastAction((new PluginAction ("create", "in_progress", statusMessage))); @@ -1774,10 +1700,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } else { vduStatus.setState(VduStateType.UNKNOWN); } - + return vduStatus; } - + private void sleep(long time) { try { Thread.sleep(time); @@ -1786,5 +1712,5 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ Thread.currentThread().interrupt(); } } - + } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudParam.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudParam.java new file mode 100644 index 0000000000..9b2475a1c4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudParam.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.openstack.utils; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class MsoMulticloudParam { + + @JsonProperty("generic-vnf-id") + private String genericVnfId; + + @JsonProperty("vf-module-id") + private String vfModuleId; + + @JsonProperty("oof_directives") + private String oofDirectives; + + @JsonProperty("sdnc_directives") + private String sdncDirectives; + + @JsonProperty("template_type") + private String templateType; + + @JsonProperty("template_data") + private String templateData; + + public void setGenericVnfId(String genericVnfId){ + this.genericVnfId = genericVnfId; + } + + public String getGenericVnfId(){ + return this.genericVnfId; + } + + public void setVfModuleId(String vfModuleId){ + this.vfModuleId = vfModuleId; + } + + public String getVfModuleId(){ + return this.vfModuleId; + } + + public void setOofDirectives(String oofDirectives){ + this.oofDirectives = oofDirectives; + } + + public String getOofDirectives(){ + return this.oofDirectives; + } + + public void setSdncDirectives(String sdncDirectives){ + this.sdncDirectives = sdncDirectives; + } + + public String getSdncDirectives(){ + return this.sdncDirectives; + } + + public void setTemplateType(String templateType){ + this.templateType = templateType; + } + + public String TemplateType(){ + return this.templateType; + } + + public void setTemplateData(String templateData){ + this.templateData = templateData; + } + + public String getTemplateData(){ + return this.templateData; + } + + @Override + public String toString() { + return String.format("MulticloudParam{" + + "genericVnfId='%s'," + + " vfModuleId='%s'," + + " oofDirectives='%s'," + + " sdncDirectives='%s'," + + " templateType='%s'," + + " templateData='%s'" + + "}", + genericVnfId, + vfModuleId, + oofDirectives, + sdncDirectives, + templateType, + templateData); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java new file mode 100644 index 0000000000..4ed35a4d28 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -0,0 +1,483 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.openstack.utils; + +import java.net.MalformedURLException; +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriBuilderException; +import javax.ws.rs.core.Response; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.onap.so.adapters.vdu.CloudInfo; +import org.onap.so.adapters.vdu.PluginAction; +import org.onap.so.adapters.vdu.VduArtifact; +import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; +import org.onap.so.adapters.vdu.VduException; +import org.onap.so.adapters.vdu.VduInstance; +import org.onap.so.adapters.vdu.VduModelInfo; +import org.onap.so.adapters.vdu.VduPlugin; +import org.onap.so.adapters.vdu.VduStateType; +import org.onap.so.adapters.vdu.VduStatus; +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoOpenstackException; +import org.onap.so.openstack.mappers.StackInfoMapper; +import org.onap.so.client.HttpClient; +import org.onap.so.client.RestClient; +import org.onap.so.cloud.CloudConfig; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.utils.TargetEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +import com.woorea.openstack.heat.model.CreateStackParam; +import com.woorea.openstack.heat.model.Stack; + +@Component +public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ + + @Autowired + protected CloudConfig cloudConfig; + + @Autowired + private Environment env; + + private static final String ONAP_IP = "ONAP_IP"; + + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + + private static final Integer DEFAULT_MSB_PORT = 80; + + private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class); + + /****************************************************************************** + * + * Methods (and associated utilities) to implement the VduPlugin interface + * + *******************************************************************************/ + + /** + * Create a new Stack in the specified cloud location and tenant. The Heat template + * and parameter map are passed in as arguments, along with the cloud access credentials. + * It is expected that parameters have been validated and contain at minimum the required + * parameters for the given template with no extra (undefined) parameters.. + * + * The Stack name supplied by the caller must be unique in the scope of this tenant. + * However, it should also be globally unique, as it will be the identifier for the + * resource going forward in Inventory. This latter is managed by the higher levels + * invoking this function. + * + * The caller may choose to let this function poll Openstack for completion of the + * stack creation, or may handle polling itself via separate calls to query the status. + * In either case, a StackInfo object will be returned containing the current status. + * When polling is enabled, a status of CREATED is expected. When not polling, a + * status of BUILDING is expected. + * + * An error will be thrown if the requested Stack already exists in the specified + * Tenant and Cloud. + * + * For 1510 - add "environment", "files" (nested templates), and "heatFiles" (get_files) as + * parameters for createStack. If environment is non-null, it will be added to the stack. + * The nested templates and get_file entries both end up being added to the "files" on the + * stack. We must combine them before we add them to the stack if they're both non-null. + * + * @param cloudSiteId The cloud (may be a region) in which to create the stack. + * @param tenantId The Openstack ID of the tenant in which to create the Stack + * @param stackName The name of the stack to create + * @param heatTemplate The Heat template + * @param stackInputs A map of key/value inputs + * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client + * @param environment An optional yaml-format string to specify environmental parameters + * @param files a Map<String, Object> that lists the child template IDs (file is the string, object is an int of + * Template id) + * @param heatFiles a Map<String, Object> that lists the get_file entries (fileName, fileBody) + * @param backout Donot delete stack on create Failure - defaulted to True + * @return A StackInfo object + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. + */ + + @SuppressWarnings("unchecked") + @Override + public StackInfo createStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map <String, ?> stackInputs, + boolean pollForCompletion, + int timeoutMinutes, + String environment, + Map <String, Object> files, + Map <String, Object> heatFiles, + boolean backout) throws MsoException { + + // Get the directives, if present. + String oofDirectives = null; + String sdncDirectives = null; + String genericVnfId = null; + String vfModuleId = null; + + String key = "oof_directives"; + if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) { + oofDirectives = (String) stackInputs.get(key); + stackInputs.remove(key); + } + key = "sdnc_directives"; + if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) { + sdncDirectives = (String) stackInputs.get(key); + stackInputs.remove(key); + } + key = "generic_vnf_id"; + if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) { + genericVnfId = (String) stackInputs.get(key); + stackInputs.remove(key); + } + key = "vf_module_id"; + if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) { + vfModuleId = (String) stackInputs.get(key); + stackInputs.remove(key); + } + + // create the multicloud payload + CreateStackParam stack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles); + + MsoMulticloudParam multicloudParam = new MsoMulticloudParam(); + multicloudParam.setGenericVnfId(genericVnfId); + multicloudParam.setVfModuleId(vfModuleId); + multicloudParam.setOofDirectives(oofDirectives); + multicloudParam.setSdncDirectives(sdncDirectives); + multicloudParam.setTemplateType("heat"); + multicloudParam.setTemplateData(stack.toString()); + + + String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, null); + RestClient multicloudClient = getMulticloudClient(multicloudEndpoint); + + if (multicloudClient != null) { + Response res = multicloudClient.post(multicloudParam); + logger.debug("Multicloud Post response is: " + res); + } + + Stack responseStack = new Stack(); + responseStack.setStackStatus(HeatStatus.CREATED.toString()); + + return new StackInfoMapper(responseStack).map(); + } + + public Map<String, Object> queryStackForOutputs(String cloudSiteId, + String tenantId, String stackName) throws MsoException { + logger.debug("MsoHeatUtils.queryStackForOutputs)"); + StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName); + if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) { + return null; + } + return heatStack.getOutputs(); + } + + /** + * Query for a single stack (by Name) in a tenant. This call will always return a + * StackInfo object. If the stack does not exist, an "empty" StackInfo will be + * returned - containing only the stack name and a status of NOTFOUND. + * + * @param tenantId The Openstack ID of the tenant in which to query + * @param cloudSiteId The cloud identifier (may be a region) in which to query + * @param stackName The name of the stack to query (may be simple or canonical) + * @return A StackInfo object + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. + */ + @Override + public StackInfo queryStack (String cloudSiteId, String tenantId, String stackName) throws MsoException { + logger.debug ("Query multicloud HEAT stack: " + stackName + " in tenant " + tenantId); + + String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackName); + + RestClient multicloudClient = getMulticloudClient(multicloudEndpoint); + + if (multicloudClient != null) { + Response response = multicloudClient.get(); + logger.debug("Multicloud Get response is: " + response); + + return new StackInfo (stackName, HeatStatus.CREATED); + } + + return new StackInfo (stackName, HeatStatus.NOTFOUND); + } + + public StackInfo deleteStack (String cloudSiteId, String tenantId, String stackName) throws MsoException { + logger.debug ("Delete multicloud HEAT stack: " + stackName + " in tenant " + tenantId); + + String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackName); + + RestClient multicloudClient = getMulticloudClient(multicloudEndpoint); + + if (multicloudClient != null) { + Response response = multicloudClient.delete(); + logger.debug("Multicloud Get response is: " + response); + + return new StackInfo (stackName, HeatStatus.DELETING); + } + + return new StackInfo (stackName, HeatStatus.FAILED); + } + + // --------------------------------------------------------------- + // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS + + + private String getMsbHost() { + // MSB_IP will be set as ONAP_IP environment parameter in install flow. + String msbIp = System.getenv().get(ONAP_IP); + + // if ONAP IP is not set. get it from config file. + if (null == msbIp || msbIp.isEmpty()) { + msbIp = env.getProperty("mso.msb-ip", DEFAULT_MSB_IP); + } + Integer msbPort = env.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT); + + return UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString(); + } + + private String getMulticloudEndpoint(String cloudSiteId, String workloadId) throws MsoCloudSiteNotFound { + + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId)); + String endpoint = getMsbHost() + cloudSite.getIdentityService().getIdentityUrl(); + + if (workloadId != null) { + return endpoint + workloadId; + } else { + return endpoint; + } + } + + private RestClient getMulticloudClient(String endpoint) { + RestClient client = null; + try { + client= new HttpClient(UriBuilder.fromUri(endpoint).build().toURL(), + "application/json", TargetEntity.OPENSTACK_ADAPTER); + } catch (MalformedURLException e) { + logger.debug("Encountered malformed URL error getting multicloud rest client " + e.getMessage()); + } catch (IllegalArgumentException e) { + logger.debug("Encountered illegal argument getting multicloud rest client " + e.getMessage()); + } catch (UriBuilderException e) { + logger.debug("Encountered URI builder error getting multicloud rest client " + e.getMessage()); + } + return client; + } + + /** + * VduPlugin interface for instantiate function. + * + * Translate the VduPlugin parameters to the corresponding 'createStack' parameters, + * and then invoke the existing function. + */ + @Override + public VduInstance instantiateVdu ( + CloudInfo cloudInfo, + String instanceName, + Map<String,Object> inputs, + VduModelInfo vduModel, + boolean rollbackOnFailure) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + // Translate the VDU ModelInformation structure to that which is needed for + // creating the Heat stack. Loop through the artifacts, looking specifically + // for MAIN_TEMPLATE and ENVIRONMENT. Any other artifact will + // be attached as a FILE. + String heatTemplate = null; + Map<String,Object> nestedTemplates = new HashMap<>(); + Map<String,Object> files = new HashMap<>(); + String heatEnvironment = null; + + for (VduArtifact vduArtifact: vduModel.getArtifacts()) { + if (vduArtifact.getType() == ArtifactType.MAIN_TEMPLATE) { + heatTemplate = new String(vduArtifact.getContent()); + } + else if (vduArtifact.getType() == ArtifactType.NESTED_TEMPLATE) { + nestedTemplates.put(vduArtifact.getName(), new String(vduArtifact.getContent())); + } + else if (vduArtifact.getType() == ArtifactType.ENVIRONMENT) { + heatEnvironment = new String(vduArtifact.getContent()); + } + } + + try { + StackInfo stackInfo = createStack (cloudSiteId, + tenantId, + instanceName, + heatTemplate, + inputs, + true, // poll for completion + vduModel.getTimeoutMinutes(), + heatEnvironment, + nestedTemplates, + files, + rollbackOnFailure); + // Populate a vduInstance from the StackInfo + return stackInfoToVduInstance(stackInfo); + } + catch (Exception e) { + throw new VduException ("MsoMulticloudUtils (instantiateVDU): createStack Exception", e); + } + } + + + /** + * VduPlugin interface for query function. + */ + @Override + public VduInstance queryVdu (CloudInfo cloudInfo, String instanceId) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + try { + // Query the Cloudify Deployment object and populate a VduInstance + StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId); + + return stackInfoToVduInstance(stackInfo); + } + catch (Exception e) { + throw new VduException ("MsoMulticloudUtils (queryVdu): queryStack Exception ", e); + } + } + + + /** + * VduPlugin interface for delete function. + */ + @Override + public VduInstance deleteVdu (CloudInfo cloudInfo, String instanceId, int timeoutMinutes) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + try { + // Delete the Multicloud stack + StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId, true); + + // Populate a VduInstance based on the deleted Cloudify Deployment object + VduInstance vduInstance = stackInfoToVduInstance(stackInfo); + + // Override return state to DELETED (MulticloudUtils sets to NOTFOUND) + vduInstance.getStatus().setState(VduStateType.DELETED); + + return vduInstance; + } + catch (Exception e) { + throw new VduException ("Delete VDU Exception", e); + } + } + + + /** + * VduPlugin interface for update function. + * + * Update is currently not supported in the MsoMulticloudUtils implementation of VduPlugin. + * Just return a VduException. + * + */ + @Override + public VduInstance updateVdu ( + CloudInfo cloudInfo, + String instanceId, + Map<String,Object> inputs, + VduModelInfo vduModel, + boolean rollbackOnFailure) + throws VduException + { + throw new VduException ("MsoMulticloudUtils: updateVdu interface not supported"); + } + + + /* + * Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object + */ + protected VduInstance stackInfoToVduInstance (StackInfo stackInfo) + { + VduInstance vduInstance = new VduInstance(); + + // The full canonical name as the instance UUID + vduInstance.setVduInstanceId(stackInfo.getCanonicalName()); + vduInstance.setVduInstanceName(stackInfo.getName()); + + // Copy inputs and outputs + vduInstance.setInputs(stackInfo.getParameters()); + vduInstance.setOutputs(stackInfo.getOutputs()); + + // Translate the status elements + vduInstance.setStatus(stackStatusToVduStatus (stackInfo)); + + return vduInstance; + } + + private VduStatus stackStatusToVduStatus (StackInfo stackInfo) + { + VduStatus vduStatus = new VduStatus(); + + // Map the status fields to more generic VduStatus. + // There are lots of HeatStatus values, so this is a bit long... + HeatStatus heatStatus = stackInfo.getStatus(); + String statusMessage = stackInfo.getStatusMessage(); + + if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) { + vduStatus.setState(VduStateType.INSTANTIATING); + vduStatus.setLastAction((new PluginAction ("create", "in_progress", statusMessage))); + } + else if (heatStatus == HeatStatus.NOTFOUND) { + vduStatus.setState(VduStateType.NOTFOUND); + } + else if (heatStatus == HeatStatus.CREATED) { + vduStatus.setState(VduStateType.INSTANTIATED); + vduStatus.setLastAction((new PluginAction ("create", "complete", statusMessage))); + } + else if (heatStatus == HeatStatus.UPDATED) { + vduStatus.setState(VduStateType.INSTANTIATED); + vduStatus.setLastAction((new PluginAction ("update", "complete", statusMessage))); + } + else if (heatStatus == HeatStatus.UPDATING) { + vduStatus.setState(VduStateType.UPDATING); + vduStatus.setLastAction((new PluginAction ("update", "in_progress", statusMessage))); + } + else if (heatStatus == HeatStatus.DELETING) { + vduStatus.setState(VduStateType.DELETING); + vduStatus.setLastAction((new PluginAction ("delete", "in_progress", statusMessage))); + } + else if (heatStatus == HeatStatus.FAILED) { + vduStatus.setState(VduStateType.FAILED); + vduStatus.setErrorMessage(stackInfo.getStatusMessage()); + } else { + vduStatus.setState(VduStateType.UNKNOWN); + } + + return vduStatus; + } +} diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/HeatStack.json b/adapters/mso-adapter-utils/src/test/resources/__files/HeatStack.json index 411a3e0bd7..679e8e1832 100644 --- a/adapters/mso-adapter-utils/src/test/resources/__files/HeatStack.json +++ b/adapters/mso-adapter-utils/src/test/resources/__files/HeatStack.json @@ -1,11 +1,11 @@ { "description" : "description", "links" : [], - "stackStatusReason" : "stackStatusReason", - "stackName" : "stackName", - "updatedTime" : null, - "creationTime" : null, - "stackStatus" : "stackStatus", + "stack_status_reason" : "stackStatusReason", + "stack_name" : "stackName", + "updated_time" : null, + "creation_time" : null, + "stack_status" : "stackStatus", "id" : "id", "files" : {} }
\ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json index f1c08cc093..cd516ad082 100644 --- a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json @@ -18,7 +18,7 @@ "adminURL": null } ], - "endpointsLinks": null + "endpoints_links": null }, { "type": "network", @@ -31,7 +31,7 @@ "adminURL": null } ], - "endpointsLinks": null + "endpoints_links": null }, { "type": "identity", @@ -44,7 +44,7 @@ "adminURL": null } ], - "endpointsLinks": null + "endpoints_links": null } ], "user": null, diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json index 8612258eee..a26a551f7d 100644 --- a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json @@ -2,10 +2,10 @@ "stack": { "description": null, "links": null, - "stackStatusReason": null, - "stackName": null, - "updatedTime": null, - "creationTime": null, + "stack_status_reason": null, + "stack_name": null, + "updated_time": null, + "creation_time": null, "stack_status": "DELETE_COMPLETE", "id": "stackId", "files": null, diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/UpdateStack.json b/adapters/mso-adapter-utils/src/test/resources/__files/UpdateStack.json index 0a09d599ba..bf61cc8c8b 100644 --- a/adapters/mso-adapter-utils/src/test/resources/__files/UpdateStack.json +++ b/adapters/mso-adapter-utils/src/test/resources/__files/UpdateStack.json @@ -1,11 +1,11 @@ { "description" : "description", "links" : [], - "stackStatusReason" : "stackStatusReason", - "stackName" : "stackName", - "updatedTime" : null, - "creationTime" : null, - "stackStatus" : "UPDATE_COMPLETE", + "stack_status_reason" : "stackStatusReason", + "stack_name" : "stackName", + "updated_time" : null, + "creation_time" : null, + "stack_status" : "UPDATE_COMPLETE", "id" : "id", "files" : {} }
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json b/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json index c0f08f8bd7..968f6179b0 100644 --- a/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json +++ b/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json @@ -1,13 +1,12 @@ { "outputs" : [{ - "outputKey": "key1", - "outputValue": "value1" + "output_key": "key1", + "output_value": "value1" },{ - "outputKey": "key2", - "outputValue": "value2" + "output_key": "key2", + "output_value": "value2" },{ - "outputKey": "key3", - "outputValue": "value3" + "output_key": "key3", + "output_value": "value3" }] - }
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.11__RecreateRecipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.11__RecreateRecipe.sql new file mode 100644 index 0000000000..627f7a4a61 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.11__RecreateRecipe.sql @@ -0,0 +1,5 @@ +use catalogdb; + +INSERT INTO `vnf_recipe` (`NF_ROLE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `RECIPE_TIMEOUT`) +VALUES +('GR-API-DEFAULT', 'recreateInstance', '1', 'Gr api recipe to recreate vnf', '/mso/async/services/WorkflowActionBB', 180);
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index 8ccf40eff5..e15311eb0e 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -111,7 +111,7 @@ public class CatalogDBRestTest { assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value()); for(ILoggingEvent logEvent : TestAppender.events) if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") && - logEvent.getMarker().getName().equals("ENTRY") + logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY") ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index 4ec5839cb6..3783a51689 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -38,6 +38,7 @@ import org.onap.so.db.catalog.beans.VnfComponentsRecipe; import org.onap.so.db.catalog.beans.VnfRecipe; import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; @@ -63,6 +64,18 @@ public class CatalogDbClientTest { } @Test + public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(){ + RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "*", "*", "*", "*"); + Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy()); + } + + @Test + public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound(){ + RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(UUID.randomUUID().toString(), "*", "*", "*", "*"); + Assert.assertNull(rainyDayHandlerStatus); + } + + @Test public void testGetCloudSiteHappyPath() throws Exception { CloudSite cloudSite = client.getCloudSite(MTN13); Assert.assertNotNull(cloudSite); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 2eeed777de..b47905d134 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -294,7 +294,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = "Error sending updateNetwork notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -311,7 +311,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending updateNotification request" + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -376,9 +376,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null); } catch (Exception e1) { - error = "Error sending createNetwork notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e1); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -398,9 +398,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { vlans.value, copyQuerySubnetIdMap (subnetIdMap)); } catch (Exception e) { - error = "Error sending createNetwork notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -463,9 +463,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null); } catch (Exception e1) { - error = "Error sending createNetwork notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e1); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -477,7 +477,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending deleteNetwork notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -527,9 +527,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg); } catch (Exception e1) { - error = "Error sending createNetwork notification " + e1.getMessage (); + error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -541,7 +541,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending rollbackNetwork notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -627,7 +627,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { String error1 = "Unable to set authorization in callback request" + e.getMessage (); LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error1); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error1); } return notifyPort; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index ac33a5269e..4b6bd09144 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -42,6 +42,8 @@ import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.so.db.catalog.beans.NetworkResource; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.data.repository.CollectionNetworkResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; @@ -108,6 +110,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private NetworkResourceCustomizationRepository networkCustomRepo; @Autowired + private CollectionNetworkResourceCustomizationRepository collectionNetworkCustomRepo; + + @Autowired private NetworkResourceRepository networkResourceRepo; /** * Health Check web method. Does nothing but return to show the adapter is deployed. @@ -1124,18 +1129,26 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Retrieve the Network Resource definition NetworkResource networkResource = null; NetworkResourceCustomization networkCust = null; + CollectionNetworkResourceCustomization collectionNetworkCust = null; if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) { if (!commonUtils.isNullOrEmpty(networkType)) { - networkResource = networkResourceRepo.findOneByModelName(networkType); + networkResource = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType); } } else { networkCust = networkCustomRepo.findOneByModelCustomizationUUID(modelCustomizationUuid); + if (networkCust == null) { + collectionNetworkCust = collectionNetworkCustomRepo.findOneByModelCustomizationUUID(modelCustomizationUuid); + } } if(networkCust != null){ LOGGER.debug("Got Network Customization definition from Catalog: " + networkCust.toString()); networkResource = networkCust.getNetworkResource(); + } else if (collectionNetworkCust != null) { + LOGGER.debug("Retrieved Collection Network Resource Customization from Catalog: " + + collectionNetworkCust.toString()); + networkResource = collectionNetworkCust.getNetworkResource(); } if (networkResource == null) { String error = "Create/UpdateNetwork: Unable to get network resource with NetworkType:" diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index 465fb6d866..effe7a8c61 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -84,8 +84,8 @@ import io.swagger.annotations.ApiResponses; public class NetworkAdapterRest { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,NetworkAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; - - + private String APPEND_RESPONSE = ", resp="; + private String EXCEPTION = "Exception:"; @Autowired private MsoNetworkAdapterImpl adapter; @@ -239,7 +239,7 @@ public class NetworkAdapterRest { rollback.value, req.getMessageId()); } catch (NetworkException e) { - LOGGER.debug ("Exception:", e); + LOGGER.debug (EXCEPTION, e); eresp = new CreateNetworkError( e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -248,7 +248,7 @@ public class NetworkAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("CreateNetworkTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug ("CreateNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse()); } } @@ -345,7 +345,7 @@ public class NetworkAdapterRest { } response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId()); } catch (NetworkException e) { - LOGGER.debug ("Exception:", e); + LOGGER.debug (EXCEPTION, e); eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -353,7 +353,7 @@ public class NetworkAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("DeleteNetworkTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("DeleteNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse()); } } @@ -501,7 +501,7 @@ public class NetworkAdapterRest { adapter.rollbackNetwork(nwr); response = new RollbackNetworkResponse(true, req.getMessageId()); } catch (NetworkException e) { - LOGGER.debug ("Exception:", e); + LOGGER.debug (EXCEPTION, e); eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -509,7 +509,7 @@ public class NetworkAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("RollbackNetworkTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("RollbackNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse()); } } @@ -649,7 +649,7 @@ public class NetworkAdapterRest { subnetIdMap.value, req.getMessageId()); } catch (NetworkException e) { - LOGGER.debug ("Exception:", e); + LOGGER.debug (EXCEPTION, e); eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -657,7 +657,7 @@ public class NetworkAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("UpdateNetworkTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("UpdateNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse()); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java index d65cdc4638..f2238fce78 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java @@ -4,7 +4,6 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ - * Modifications Copyright 2018 IBM. * 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 diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java index 996e2c2712..72c74ccaf9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java @@ -47,7 +47,7 @@ import org.onap.so.adapters.vnf.VnfAdapterRestV2; import org.onap.so.adapters.vnf.VolumeAdapterRest; import org.onap.so.adapters.vnf.VolumeAdapterRestV2; import org.onap.so.client.policy.JettisonStyleMapperProvider; -import org.onap.so.logger.MsoLogger; + import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; import org.springframework.beans.factory.annotation.Autowired; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java index 02aa0843ae..a9aa50f654 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java @@ -22,6 +22,8 @@ package org.onap.so.adapters.openstack; import java.util.concurrent.Executor; +import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -38,6 +40,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @EntityScan({ "org.onap.so.db.catalog.beans", "org.onap.so.db.request.beans"}) public class MsoOpenstackAdaptersApplication { + @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -63,6 +66,7 @@ public class MsoOpenstackAdaptersApplication { @Bean public Executor asyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setTaskDecorator(new MDCTaskDecorator()); executor.setCorePoolSize(corePoolSize); executor.setMaxPoolSize(maxPoolSize); executor.setQueueCapacity(queueCapacity); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java index 5cce4dd35f..2f688dbf48 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java @@ -50,6 +50,8 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; import org.springframework.stereotype.Component; @@ -108,13 +110,11 @@ public class ValetClient { URI uri = builder.build(); ValetCreateRequest vcr = this.createValetCreateRequest(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); - RestTemplate restTemplate = new RestTemplate(); String body = mapper.writeValueAsString(vcr); HttpHeaders headers = generateHeaders(requestId); - HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet create req: " + uri.toString() + HEADERS + headers.toString() + BODY + body); + HttpEntity<String> entity = new HttpEntity<>(body, headers); - response = restTemplate.exchange(uri, HttpMethod.POST, entity, ValetCreateResponse.class); + response = getRestTemplate().exchange(uri, HttpMethod.POST, entity, ValetCreateResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { LOGGER.error("An exception occurred in callValetCreateRequest", e); @@ -123,6 +123,12 @@ public class ValetClient { return gvr; } + private RestTemplate getRestTemplate(){ + RestTemplate restTemplate = new RestTemplate(); + restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); + return restTemplate; + } + /* * This method will be invoked to send an Update request to Valet. */ @@ -135,14 +141,13 @@ public class ValetClient { UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId); URI uri = builder.build(); - ValetUpdateRequest vur = this.createValetUpdateRequest(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); - RestTemplate restTemplate = new RestTemplate(); + ValetUpdateRequest vur = this.createValetUpdateRequest(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); String body = mapper.writeValueAsString(vur); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet update req: " + uri.toString() + HEADERS + headers.toString() + BODY + body); + - response = restTemplate.exchange(uri, HttpMethod.PUT, entity, ValetUpdateResponse.class); + response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetUpdateResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { LOGGER.error("An exception occurred in callValetUpdateRequest", e); @@ -163,13 +168,13 @@ public class ValetClient { URI uri = builder.build(); ValetDeleteRequest vdr = this.createValetDeleteRequest(regionId, tenantId, vfModuleId, vfModuleName); - RestTemplate restTemplate = new RestTemplate(); + String body = mapper.writeValueAsString(vdr); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet delete req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body); - response = restTemplate.exchange(uri, HttpMethod.DELETE, entity, ValetDeleteResponse.class); + + response = getRestTemplate().exchange(uri, HttpMethod.DELETE, entity, ValetDeleteResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { LOGGER.error("An exception occurred in callValetDeleteRequest", e); @@ -190,13 +195,13 @@ public class ValetClient { URI uri = builder.build(requestId); ValetConfirmRequest vcr = this.createValetConfirmRequest(stackId); - RestTemplate restTemplate = new RestTemplate(); + String body = mapper.writeValueAsString(vcr); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); LOGGER.debug("valet confirm req: " + uri.toString() + HEADERS + headers.toString() + BODY + body); - response = restTemplate.exchange(uri, HttpMethod.PUT, entity, ValetConfirmResponse.class); + response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetConfirmResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { LOGGER.error("An exception occurred in callValetConfirmRequest", e); @@ -217,13 +222,13 @@ public class ValetClient { URI uri = builder.build(requestId); ValetRollbackRequest vrr = this.createValetRollbackRequest(stackId, suppressRollback, errorMessage); - RestTemplate restTemplate = new RestTemplate(); + String body = mapper.writeValueAsString(vrr); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet rollback req: " + uri.toString() + HEADERS + headers.toString() + BODY + body); - response = restTemplate.exchange(uri, HttpMethod.PUT, entity, ValetRollbackResponse.class); + + response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetRollbackResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { LOGGER.error("An exception occurred in callValetRollbackRequest", e); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index b440f7d521..e9567170dd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -29,7 +29,7 @@ * - base and volume module queries * - rollback logic * - logging and error handling - * + * * Then based on the orchestration mode of the VNF, it will invoke different VDU plug-ins * to perform the low level instantiations, deletions, and queries. At this time, the * set of available plug-ins is hard-coded, though in the future a dynamic selection @@ -81,6 +81,7 @@ import org.onap.so.openstack.exceptions.MsoExceptionCategory; import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry; import org.onap.so.openstack.utils.MsoHeatUtils; import org.onap.so.openstack.utils.MsoKeystoneUtils; +import org.onap.so.openstack.utils.MsoMulticloudUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -100,28 +101,31 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); - + @Autowired protected CloudConfig cloudConfig; - + @Autowired private VFModuleCustomizationRepository vfModuleCustomRepo; - + @Autowired private Environment environment; @Autowired protected MsoKeystoneUtils keystoneUtils; - + @Autowired protected MsoCloudifyUtils cloudifyUtils; - + @Autowired protected MsoHeatUtils heatUtils; - + + @Autowired + protected MsoMulticloudUtils multicloudUtils; + @Autowired protected VfModuleCustomizationToVduMapper vduMapper; - + /** * Health Check web method. Does nothing but return to show the adapter is deployed. */ @@ -192,9 +196,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { /** * This is the "Query VNF" web service implementation. - * + * * This really should be QueryVfModule, but nobody ever changed it. - * + * * The method returns an indicator that the VNF exists, along with its status and outputs. * The input "vnfName" will also be reflected back as its ID. * @@ -244,7 +248,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (e); } - + if (vduInstance != null && vduInstance.getStatus().getState() != VduStateType.NOTFOUND) { vnfExists.value = Boolean.TRUE; status.value = vduStatusToVnfStatus(vduInstance); @@ -265,7 +269,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { return; } - + /** * This is the "Delete VNF" web service implementation. * This function is now unsupported and will return an error. @@ -278,7 +282,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { MsoRequest msoRequest) throws VnfException { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("DeleteVnf"); - + // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. LOGGER.debug ("DeleteVNF command attempted but not supported"); throw new VnfException ("DeleteVNF: Unsupported command", MsoExceptionCategory.USERDATA); @@ -289,7 +293,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { * A rollback object is returned to the client in a successful creation * response. The client can pass that object as-is back to the rollbackVnf * operation to undo the creation. - * + * * TODO: This should be rollbackVfModule and/or rollbackVolumeGroup, * but APIs were apparently never updated. */ @@ -309,7 +313,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Rollback VF Module - nothing to roll back"); return; } - + // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudSiteId (); String tenantId = rollback.getTenantId (); @@ -330,7 +334,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { try { // TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object and use that. vduInstance = vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5); - + LOGGER.debug("Rolled back VDU instantiation: " + vduInstance.getVduInstanceId()); LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VDU Plugin", "VDU", "DeleteVdu", null); } @@ -354,7 +358,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // DeploymentInfo object should be enhanced to report a better status internally. VduStatus vduStatus = vdu.getStatus(); VduStateType status = vduStatus.getState(); - + if (status == null) { return VnfStatus.UNKNOWN; } @@ -379,7 +383,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { { String type = templateParam.getParamType(); LOGGER.debug("Parameter: " + templateParam.getParamName() + " is of type " + type); - + if (type.equalsIgnoreCase("number")) { try { return Integer.valueOf(inputValue); @@ -400,7 +404,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } else if (type.equalsIgnoreCase("boolean")) { return new Boolean(inputValue); } - + // Nothing else matched. Return the original string return inputValue; } @@ -464,9 +468,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } } LOGGER.debug(sb.toString()); - return; + return; } - + private void sendMapToDebug(Map<String, String> inputs) { int i = 0; StringBuilder sb = new StringBuilder("inputs:"); @@ -612,7 +616,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - + MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("CreateVfModule"); @@ -625,14 +629,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } - + // Clean up some inputs to make comparisons easier if (requestType == null) requestType = ""; - + if ("".equals(volumeGroupId) || "null".equals(volumeGroupId)) - volumeGroupId = null; - + volumeGroupId = null; + if ("".equals(baseVfModuleId) || "null".equals(baseVfModuleId)) baseVfModuleId = null; @@ -643,7 +647,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } else { this.sendMapToDebug(inputs); } - + // Check if this is for a "Volume" module boolean isVolumeRequest = false; if (requestType.startsWith("VOLUME")) { @@ -663,7 +667,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { vfRollback.setBaseGroupHeatStackId(baseVfModuleId); vfRollback.setModelCustomizationUuid(modelCustomizationUuid); vfRollback.setMode("CFY"); - + rollback.value = vfRollback; // Default rollback - no updates performed // Get the VNF/VF Module definition from the Catalog DB first. @@ -675,7 +679,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { try { vfModuleCust = vfModuleCustomRepo.findByModelCustomizationUUID(modelCustomizationUuid); - + if (vfModuleCust == null) { String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid; LOGGER.debug(error); @@ -692,7 +696,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { vnfResource = vfModuleCust.getVfModule().getVnfResources(); } catch (Exception e) { - + LOGGER.debug("unhandled exception in create VF - [Query]" + e.getMessage()); throw new VnfException("Exception during create VF " + e.getMessage()); } @@ -706,10 +710,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { CloudSite cloudSite = cloudSiteOp.get(); MavenLikeVersioning aicV = new MavenLikeVersioning(); aicV.setVersion(cloudSite.getCloudVersion()); - + String vnfMin = vnfResource.getAicVersionMin(); String vnfMax = vnfResource.getAicVersionMax(); - + if ( (vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin))) || (vnfMax != null && aicV.isMoreRecentThan(vnfMax))) { @@ -720,11 +724,11 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { throw new VnfException(error, MsoExceptionCategory.USERDATA); } // End Version check - - + + VduInstance vduInstance = null; CloudInfo cloudInfo = new CloudInfo (cloudSiteId, tenantId, null); - + // Use the VduPlugin. VduPlugin vduPlugin = getVduPlugin(cloudSiteId); @@ -746,12 +750,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { me.addContext ("CreateVFModule"); throw new VnfException (me); } - + // More precise handling/messaging if the Module already exists if (vduInstance != null && !(vduInstance.getStatus().getState() == VduStateType.NOTFOUND)) { VduStateType status = vduInstance.getStatus().getState(); LOGGER.debug ("Found Existing VDU, status=" + status); - + if (status == VduStateType.INSTANTIATED) { if (failIfExists != null && failIfExists) { // fail - it exists @@ -799,8 +803,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); } } - - + + // Collect outputs from Base Modules and Volume Modules Map<String, Object> baseModuleOutputs = null; Map<String, Object> volumeGroupOutputs = null; @@ -824,7 +828,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { me.addContext ("CreateVFModule(QueryVolume)"); throw new VnfException (me); } - + if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) { String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached Volume Group DOES NOT EXIST"); @@ -837,7 +841,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { this.sendMapToDebug(volumeGroupOutputs, "volumeGroupOutputs"); } } - + // If this is an Add-On Module, query the Base Module outputs // Note: This will be performed whether or not the current request is for an // Add-On Volume Group or Add-On VF Module @@ -847,7 +851,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { vfRollback.setIsBase(true); } else { LOGGER.debug("This is an Add-On Module request"); - + // Add-On Modules should always have a Base, but just treat as a warning if not provided. // Add-on Volume requests may or may not specify a base. if (!isVolumeRequest && baseVfModuleId == null) { @@ -867,12 +871,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.DataError, "Exception - queryVdu(Base)", me); LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu(Base)", baseVfModuleId); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); - + // Convert to a generic VnfException me.addContext ("CreateVFModule(QueryBase)"); throw new VnfException (me); } - + if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) { String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Base Module DOES NOT EXIST"); @@ -886,14 +890,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } } } - + // NOTE: For this section, heatTemplate is used for all template artifacts. // In final implementation (post-POC), the template object would either be generic or there would // be a separate DB Table/Object for different sub-orchestrators. // NOTE: The template is fixed for the VF Module. The environment is part of the customization. - + HeatTemplate heatTemplate = null; HeatEnvironment heatEnvironment = null; if (isVolumeRequest) { @@ -903,7 +907,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { heatTemplate = vfModule.getModuleHeatTemplate(); heatEnvironment = vfModuleCust.getHeatEnvironment(); } - + if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "VNF", "", MsoLogger.ErrorCode.DataError, error); @@ -914,7 +918,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); } - + if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); @@ -927,15 +931,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); } - + // Create the combined set of parameters from the incoming request, base-module outputs, // volume-module outputs. Also, convert all variables to their native object types. - + HashMap<String, Object> goldenInputs = new HashMap<String,Object>(); List<String> extraInputs = new ArrayList<String>(); Boolean skipInputChecks = false; - + if (skipInputChecks) { goldenInputs = new HashMap<String,Object>(); for (String key : inputs.keySet()) { @@ -945,10 +949,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { else { // Build maps for the parameters (including aliases) to simplify checks HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>(); - + Set<HeatTemplateParam> paramSet = heatTemplate.getParameters(); LOGGER.debug("paramSet has " + paramSet.size() + " entries"); - + for (HeatTemplateParam htp : paramSet) { params.put(htp.getParamName(), htp); @@ -958,7 +962,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { params.put(alias, htp); } } - + // First, convert all inputs to their "template" type for (String key : inputs.keySet()) { if (params.containsKey(key)) { @@ -973,11 +977,22 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { extraInputs.add(key); } } - + if (!extraInputs.isEmpty()) { + // Add directive inputs + String[] directives = { "oof_directives", "sdnc_directives" }; + for (String key : directives) { + if (extraInputs.contains(key)) { + goldenInputs.put(key, inputs.get(key)); + extraInputs.remove(key); + if (extraInputs.isEmpty()) { + break; + } + } + } LOGGER.debug("Ignoring extra inputs: " + extraInputs); } - + // Next add in Volume Group Outputs if there are any. Copy directly without conversions. if (volumeGroupOutputs != null && !volumeGroupOutputs.isEmpty()) { for (String key : volumeGroupOutputs.keySet()) { @@ -986,7 +1001,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } } } - + // Next add in Base Module Outputs if there are any. Copy directly without conversions. if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) { for (String key : baseModuleOutputs.keySet()) { @@ -995,14 +1010,13 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } } } - + // TODO: The model should support a mechanism to pre-assign default parameter values // per "customization" (i.e. usage) of a given module. In HEAT, this is specified by // an Environment file. There is not a general mechanism in the model to handle this. // For the general case, any such parameter/values can be added dynamically to the // inputs (only if not already specified). - - + // Check that required parameters have been supplied from any of the sources String missingParams = null; boolean checkRequiredParameters = true; @@ -1017,7 +1031,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // No problem - default is true LOGGER.debug ("An exception occured trying to get property " + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS, e); } - + // Do the actual parameter checking. // Include looking at the ENV file as a valid definition of a parameter value. // TODO: This handling of ENV applies only to Heat. A general mechanism to @@ -1040,7 +1054,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } } } - + if (missingParams != null) { if (checkRequiredParameters) { // Problem - missing one or more required parameters @@ -1056,12 +1070,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } } // NOTE: END PARAMETER CHECKING - - + + // Here we go... ready to deploy the VF Module. long instantiateVduStartTime = System.currentTimeMillis (); if (backout == null) backout = true; - + try { // Construct the VDU Model structure to pass to the targeted VduPlugin VduModelInfo vduModel = null; @@ -1070,10 +1084,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } else { vduModel = vduMapper.mapVfModuleCustVolumeToVdu(vfModuleCust); } - + // Invoke the VduPlugin to instantiate the VF Module vduInstance = vduPlugin.instantiateVdu(cloudInfo, vfModuleName, goldenInputs, vduModel, backout); - + LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "instantiateVdu", vfModuleName); } catch (VduException me) { @@ -1100,7 +1114,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, error); LOGGER.debug("Unhandled exception at vduPlugin.instantiateVdu", e); throw new VnfException("Exception during instantiateVdu: " + e.getMessage()); - } + } // Reach this point if create is successful. @@ -1108,7 +1122,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { vfRollback.setVnfCreated (true); vfRollback.setVnfId (vduInstance.getVduInstanceId()); vnfId.value = vduInstance.getVduInstanceId(); - outputs.value = copyStringOutputs (vduInstance.getOutputs ()); + outputs.value = copyStringOutputs (vduInstance.getOutputs ()); rollback.value = vfRollback; @@ -1117,7 +1131,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { return; } - + public void deleteVfModule (String cloudSiteId, String tenantId, String vfModuleId, @@ -1126,15 +1140,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("DeleteVfModule"); - + LOGGER.debug ("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - + // Capture the output parameters on a delete, so need to query first VduInstance vduInstance = null; CloudInfo cloudInfo = new CloudInfo(cloudSiteId, tenantId, null); - + // Use the VduPlugin. VduPlugin vduPlugin = getVduPlugin(cloudSiteId); @@ -1152,7 +1166,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (e); } - + // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected Object types outputs.value = convertMapStringObjectToStringString(vduInstance.getOutputs()); @@ -1214,16 +1228,18 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (cloudSiteOp.isPresent()) { CloudSite cloudSite = cloudSiteOp.get(); String orchestrator = cloudSite.getOrchestrator(); - + if (orchestrator.equalsIgnoreCase("CLOUDIFY")) { - return cloudifyUtils; + return cloudifyUtils; } else if (orchestrator.equalsIgnoreCase("HEAT")) { return heatUtils; } + if (orchestrator.equalsIgnoreCase("MULTICLOUD")) { + LOGGER.debug ("Got MulticloudUtils for vduPlugin"); + return multicloudUtils; } } - - // Default - return HEAT plugin, though will fail later + // Default - return HEAT plugin, though will fail later return heatUtils; } -}
\ No newline at end of file +} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java index 4da026f454..88f102c2a5 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java @@ -7,9 +7,9 @@ * 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. @@ -32,16 +32,19 @@ import org.springframework.stereotype.Component; public class VnfAdapterRestUtils { private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRestUtils.class); - + @Autowired private CloudConfig cloudConfig; - + @Autowired private MsoVnfCloudifyAdapterImpl cloudifyImpl; - + @Autowired private MsoVnfAdapterImpl vnfImpl; - + + @Autowired + private MsoVnfPluginAdapterImpl vnfPluginImpl; + /* * Choose which implementation of VNF Adapter to use, based on the orchestration mode. * Currently, the two supported orchestrators are HEAT and CLOUDIFY. @@ -72,7 +75,7 @@ public class VnfAdapterRestUtils LOGGER.debug ("GetVnfAdapterImpl: mode=" + mode); MsoVnfAdapter vnfAdapter = null; - + // TODO: Make this more dynamic (e.g. Service Loader) if ("CLOUDIFY".equalsIgnoreCase(mode)) { LOGGER.debug ("GetVnfAdapterImpl: Return Cloudify Adapter"); @@ -82,12 +85,16 @@ public class VnfAdapterRestUtils LOGGER.debug ("GetVnfAdapterImpl: Return Heat Adapter"); vnfAdapter = vnfImpl; } + else if ("MULTICLOUD".equalsIgnoreCase(mode)) { + LOGGER.debug ("GetVnfAdapterImpl: Return Plugin (multicloud) Adapter"); + vnfAdapter = vnfPluginImpl; + } else { // Don't expect this, but default is the HEAT adapter LOGGER.debug ("GetVnfAdapterImpl: Return Default (Heat) Adapter"); vnfAdapter = vnfImpl; } - + return vnfAdapter; } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java index 2a4564bcb2..6123415b41 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java @@ -142,7 +142,7 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - + CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( new File("src/test/resources/__files/CreateNetworkResponse2.json"), CreateNetworkResponse.class); @@ -150,6 +150,8 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { assertThat(response.getBody(), sameBeanAs(expectedResponse)); } + + @Test public void testDeleteNetwork() throws IOException{ @@ -267,6 +269,33 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } + @Test + public void testCreateNetworkCNRC_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { + + mockOpenStackResponseAccess(wireMockPort); + + mockOpenStackPostPublicUrlWithBodyFile_200(); + + mockOpenStackGetStackCreatedAppC_200(); + + mockOpenStackGetStackAppC_404(); + + headers.add("Content-Type", MediaType.APPLICATION_JSON); + headers.add("Accept", MediaType.APPLICATION_JSON); + + String request = readJsonFileAsString("src/test/resources/CreateNetwork3.json"); + HttpEntity<String> entity = new HttpEntity<String>(request, headers); + + ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); + + CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateNetworkResponse3.json"), CreateNetworkResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + @Override protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{ return new String(Files.readAllBytes(Paths.get(fileLocation))); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java index b21f1f3db2..77ef8d4776 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,15 +20,31 @@ package org.onap.so.adapters.vnf; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.client.WireMock; import org.apache.http.HttpStatus; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.mockito.MockitoAnnotations; +import org.onap.so.adapters.vdu.CloudInfo; +import org.onap.so.adapters.vdu.VduInstance; +import org.onap.so.adapters.vdu.VduStateType; +import org.onap.so.adapters.vdu.VduStatus; import org.onap.so.adapters.vnf.exceptions.VnfException; +import org.onap.so.db.catalog.beans.AuthenticationType; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.beans.VnfRollback; +import org.onap.so.openstack.utils.MsoMulticloudUtils; import org.springframework.beans.factory.annotation.Autowired; +import javax.ws.rs.core.MediaType; import javax.xml.ws.Holder; import java.util.HashMap; import java.util.Map; @@ -36,11 +52,15 @@ import java.util.Map; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.delete; import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.reset; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.mockito.Mockito.when; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessMulticloud; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse; public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { @@ -52,6 +72,53 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; + /*** + * Before each test execution, updating IdentityUrl port value to the ramdom wireMockPort + * Since URL will be used as a rest call and required to be mocked in unit tests + */ + @Before + public void setUp() throws Exception { + reset(); + mapper = new ObjectMapper(); + + CloudIdentity identity = new CloudIdentity(); + identity.setId("MTN13"); + identity.setMsoId("m93945"); + identity.setMsoPass("93937EA01B94A10A49279D4572B48369"); + identity.setAdminTenant("admin"); + identity.setMemberRole("admin"); + identity.setTenantMetadata(new Boolean(true)); + identity.setIdentityUrl("http://localhost:"+wireMockPort+"/v2.0"); + identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); + + CloudSite cloudSite = new CloudSite(); + cloudSite.setId("MTN13"); + cloudSite.setCloudVersion("3.0"); + cloudSite.setClli("MDT13"); + cloudSite.setRegionId("MTN13"); + cloudSite.setOrchestrator("multicloud" + + ""); + identity.setIdentityServerType(ServerType.KEYSTONE); + cloudSite.setIdentityService(identity); + + + + stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + cloudConfig.getCloudSite("MTN13").get().getIdentityService().setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0"); + + } + @Test public void createVfModule_ModelCustUuidIsNull() throws Exception { expectedException.expect(VnfException.class); @@ -88,18 +155,52 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { new Holder<VnfRollback>()); } - @Test + /* @Test public void createVfModule_INSTANTIATED() throws Exception { mockOpenStackResponseAccess(wireMockPort); mockOpenStackGetStackVfModule_200(); + MsoRequest msoRequest = getMsoRequest(); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, + msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), + new Holder<VnfRollback>()); + }*/ + + @Test + public void createVfModule_INSTANTIATED_Multicloud() throws Exception { + mockOpenStackResponseAccessMulticloud(wireMockPort); + mockOpenStackGetStackVfModule_200(); + + MsoRequest msoRequest = getMsoRequest(); + Map<String, String> map = new HashMap<>(); + map.put("key1", "value1"); + msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), + new Holder<VnfRollback>()); + } + + /* + @Test + public void createVfModule_Multicloud() throws Exception { + expectedException.expect(VnfException.class); + mockOpenStackResponseAccessMulticloud(wireMockPort); + mockOpenStackGetStackVfModule_404(); + + MsoRequest msoRequest = getMsoRequest(); + Map<String, String> map = new HashMap<>(); + map.put("key1", "value1"); + map.put("oof_directives", "{ abc: 123 }"); + map.put("sdnc_directives", "{ def: 456 }"); + msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); } + */ @Test public void createVfModule_queryVduNotFoundWithVolumeGroupId() throws Exception { diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java index 98d5f7eb5f..569a845caa 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java @@ -49,6 +49,12 @@ public class StubOpenStack { .withStatus(HttpStatus.SC_OK))); } + public static void mockOpenStackResponseAccessMulticloud(int port) throws IOException { + stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_AccessMulticloud.json", port, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + } + public static void mockOpenStackResponseAccessQueryNetwork(int port) throws IOException { stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork3.json b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork3.json new file mode 100644 index 0000000000..accd9e9a54 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork3.json @@ -0,0 +1,42 @@ +{ + "createNetworkRequest": { + "skipAAI": true, + "messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709", + "synchronous": true, + "cloudSiteId": "mtn13", + "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f", + "networkId": "da886914-efb2-4917-b335-c8381528d90b", + "networkName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3", + "networkType": "CONTRAIL30_BASIC", + "modelCustomizationUuid": "3bdbb104-ffff-483e-9f8b-c095b3d30844", + "networkTechnology": "NEUTRON", + "subnets": [{ + "subnetName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3_subnet_1", + "subnetId": "da60501d-9aa8-48d2-99b7-26644fa01093", + "cidr": "20", + "gatewayIp": "", + "ipVersion": "4", + "enableDHCP": false, + "addrFromStart": true, + "hostRoutes": [] + }], + "providerVlanNetwork": { + "physicalNetworkName": "FALSE", + "vlans": [] + }, + "contrailNetwork": { + "shared": "false", + "external": "false", + "routeTargets": [], + "policyFqdns": [], + "routeTableFqdns": [] + }, + "failIfExists": true, + "backout": false, + "msoRequest": { + "requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7", + "serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6" + }, + "contrailRequest": false + } +}
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse3.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse3.json new file mode 100644 index 0000000000..2e5517cebb --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse3.json @@ -0,0 +1,25 @@ +{ + "createNetworkResponse": { + "networkId": "da886914-efb2-4917-b335-c8381528d90b", + "neutronNetworkId": null, + "networkStackId": "stackname/stackId", + "networkFqdn": null, + "networkCreated": true, + "subnetMap": { + + }, + "rollback": { + "networkStackId": "stackname/stackId", + "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f", + "cloudId": "mtn13", + "networkType": "CONTRAIL30_BASIC", + "modelCustomizationUuid": "3bdbb104-ffff-483e-9f8b-c095b3d30844", + "networkCreated": true, + "msoRequest": { + "requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7", + "serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6" + } + }, + "messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709" + } +}
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_AccessMulticloud.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_AccessMulticloud.json new file mode 100644 index 0000000000..23fbe840e4 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_AccessMulticloud.json @@ -0,0 +1,40 @@ +{ + "access": { + "token": { + "id": "tokenId1234", + "issued_at": null, + "expires": "1517418429142", + "tenant": null + }, + "serviceCatalog": [ + { + "type": "orchestration", + "name": null, + "endpoints": [ + { + "region": "MTN13", + "publicURL": "port", + "internalURL": null, + "adminURL": null + } + ], + "endpointsLinks": null + }, + { + "type": "network", + "name": null, + "endpoints": [ + { + "region": "MTN13", + "publicURL": "port", + "internalURL": null, + "adminURL": null + } + ], + "endpointsLinks": null + } + ], + "user": null, + "metadata": null + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/data.sql b/adapters/mso-openstack-adapters/src/test/resources/data.sql index d16ca4528c..960f483e46 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/data.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/data.sql @@ -71,6 +71,20 @@ insert into network_resource_customization(model_customization_uuid, model_insta ('3bdbb104-476c-483e-9f8b-c095b3d30844', 'CONTRAIL30_BASIC', '', 'CONTRAIL30_BASIC', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c4789'), ('3bdbb104-476c-483e-9f8b-c095b3d3068c', 'CONTRAIL31_BASIC', '', 'CONTRAIL31_BASIC', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c4790'); +insert into instance_group(model_uuid, model_name, model_invariant_uuid, model_version, tosca_node_type, role, object_type, cr_model_uuid, instance_group_type) values +('21e43a7c-d823-4f5b-a427-5235f63035ff', 'dror_cr_network_resource_1806..NetworkCollection..0', '81c94263-c01e-4046-b0c7-51878d658eab', '1', 'org.openecomp.groups.NetworkCollection', 'SUB_INTERFACE', 'L3_NETWORK', '5e3fca45-e2d8-4987-bef1-016d9bda1a8c', 'L3_NETWORK'); + +insert into collection_resource(model_uuid, model_name, model_invariant_uuid, model_version, tosca_node_type, description) values +('5e3fca45-e2d8-4987-bef1-016d9bda1a8c', 'Dror_CR_Network_Resource_1806', 'fe243154-ac18-405f-94c2-ef629d26b8bb', '2.0', 'org.openecomp.resource.cr.DrorCrNetworkResource1806', 'Creation date: 07/25/18'); + +insert into collection_resource_customization(model_customization_uuid, model_instance_name, role, object_type, function, collection_resource_type, cr_model_uuid) values +('c51096a4-6081-41f4-a540-3ed015a8064a', 'Dror_CR_Network_Resource_1806', 'Dror2', 'NetworkCollection', 'Dror1', 'Dror3', '5e3fca45-e2d8-4987-bef1-016d9bda1a8c'); + +insert into collection_network_resource_customization(model_customization_uuid, model_instance_name, network_technology, network_type, network_role, network_scope, network_resource_model_uuid, instance_group_model_uuid, crc_model_customization_uuid) values +('3bdbb104-ffff-483e-9f8b-c095b3d30844', 'ExtVL 0', 'CONTRAIL', 'L3-NETWORK', '', '', '10b36f65-f4e6-4be6-ae49-9596dc1c4789', '21e43a7c-d823-4f5b-a427-5235f63035ff', 'c51096a4-6081-41f4-a540-3ed015a8064a'), +('3bdbb104-ffff-483e-9f8b-c095b3d3068c', 'ExtVL 0', 'CONTRAIL', 'L3-NETWORK', '', '', '10b36f65-f4e6-4be6-ae49-9596dc1c4790', '21e43a7c-d823-4f5b-a427-5235f63035ff', 'c51096a4-6081-41f4-a540-3ed015a8064a'); + + insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values ('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002672', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '2.0', 'vSAMP10a', 'VF', null); diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java index 21ec8f7518..fc12120166 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java @@ -68,7 +68,7 @@ public class HealthCheckHandlerTest { assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value()); for(ILoggingEvent logEvent : TestAppender.events) if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") && - logEvent.getMarker().getName().equals("ENTRY") + logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY") ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); @@ -78,7 +78,7 @@ public class HealthCheckHandlerTest { assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); }else if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") && - logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){ + logEvent.getMarker() != null && logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java index f1269f412b..7c037e4885 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java @@ -7,9 +7,9 @@ * 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. @@ -26,6 +26,9 @@ import org.junit.runner.RunWith; import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.OperationStatus; +import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; +import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; +import org.onap.so.db.request.beans.RequestProcessingData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; @@ -41,6 +44,8 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertFalse; @RunWith(SpringRunner.class) @SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -90,6 +95,7 @@ public class RequestsDbClientTest { assertThat(request, sameBeanAs(response).ignoring("operateAt").ignoring("finishedAt")); } + private void verifyInfraActiveRequests(InfraActiveRequests infraActiveRequestsResponse) { assertThat(infraActiveRequestsResponse, sameBeanAs(infraActiveRequests).ignoring("modifyTime").ignoring("log")); } @@ -189,4 +195,37 @@ public class RequestsDbClientTest { assertNull(requestsDbClient.getOneByServiceIdAndOperationId(UUID.randomUUID().toString(),operationStatus.getOperationId())); } + + + @Test + public void getRequestProcessingDataBySoRequestIdTest(){ + List<RequestProcessingData> requestProcessingDataList = requestsDbClient + .getRequestProcessingDataBySoRequestId("00032ab7-na18-42e5-965d-8ea592502018"); + assertNotNull(requestProcessingDataList); + assertFalse(requestProcessingDataList.isEmpty()); + assertEquals(2,requestProcessingDataList.size()); + } + + @Test + public void findOneByOperationalEnvIdAndServiceModelVersionIdTest(){ + OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionId("1234","TEST1234"); + assertNotNull(operationalEnvServiceModelStatus); + assertEquals("1234",operationalEnvServiceModelStatus.getOperationalEnvId()); + assertEquals("TEST1234",operationalEnvServiceModelStatus.getServiceModelVersionId()); + } + + @Test + public void getAllByOperationalEnvIdAndRequestId(){ + List<OperationalEnvServiceModelStatus> operationalEnvServiceModelStatuses =requestsDbClient.getAllByOperationalEnvIdAndRequestId("1234","00032ab7-3fb3-42e5-965d-8ea592502017"); + assertNotNull(operationalEnvServiceModelStatuses); + assertFalse(operationalEnvServiceModelStatuses.isEmpty()); + assertEquals(2,operationalEnvServiceModelStatuses.size()); + } + + @Test + public void getDistributionStatusByIdTest(){ + OperationalEnvDistributionStatus operationalEnvDistributionStatus =requestsDbClient.getDistributionStatusById("111"); + assertNotNull(operationalEnvDistributionStatus); + assertEquals("111",operationalEnvDistributionStatus.getDistributionId()); + } } diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql index ae5f5e9124..fcfd1483da 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -36,3 +36,14 @@ VALUES (1, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca714', 'requestAction', 'assign', 'pincFabricConfigRequest'), (2, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca715', 'configurationId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfigRequest'), (3, '5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'configId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfig'); + +INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) +VALUES +('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59'); +INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) +VALUES +('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59'); + +INSERT INTO `activate_operational_env_per_distributionid_status` (`DISTRIBUTION_ID`, `DISTRIBUTION_ID_STATUS`, `DISTRIBUTION_ID_ERROR_REASON`, `CREATE_TIME`, `MODIFY_TIME`, `OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`) +VALUES +('111', 'TEST', 'ERROR', '2018-09-12 19:29:24', '2018-09-12 19:29:25', '1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017');
\ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java index 3d88a1467a..f88aab08a6 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java @@ -22,6 +22,8 @@ package org.onap.so.adapters.sdnc; import java.util.concurrent.Executor; +import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -35,6 +37,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @EntityScan({ "org.onap.so.db.request.beans"}) public class SDNCAdapterApplication { + @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -61,7 +64,7 @@ public class SDNCAdapterApplication { @Bean public Executor asyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - + executor.setTaskDecorator(new MDCTaskDecorator()); executor.setCorePoolSize(corePoolSize); executor.setMaxPoolSize(maxPoolSize); executor.setQueueCapacity(queueCapacity); diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index 87b269f3f6..9ea397701c 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -196,12 +196,12 @@ <dependency> <groupId>org.onap.sdc.sdc-tosca</groupId> <artifactId>sdc-tosca</artifactId> - <version>1.3.5</version> + <version>1.4.4</version> </dependency> <dependency> <groupId>org.onap.sdc.jtosca</groupId> <artifactId>jtosca</artifactId> - <version>1.3.5</version> + <version>1.4.4</version> </dependency> <dependency> <groupId>org.onap.so</groupId> diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java index a365d0740d..bd3b2d1c54 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java @@ -26,6 +26,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication(scanBasePackages = { "org.onap.so" }) public class Application { + private static final String MSO_CONFIG_PATH = "mso.config.path"; private static final String LOGS_DIR = "logs_dir"; private static void setLogsDir() { @@ -33,11 +34,16 @@ public class Application { System.getProperties().setProperty(LOGS_DIR, "./logs/asdc/"); } } + + private static void setConfigPath() { + if(System.getProperty(MSO_CONFIG_PATH) == null) + System.getProperties().setProperty(MSO_CONFIG_PATH, "."); + } public static void main(String[] args) { SpringApplication.run(Application.class, args); System.getProperties().setProperty("mso.db", "MARIADB"); - System.getProperties().setProperty("mso.config.path", "."); + System.getProperties().setProperty("server.name", "Springboot"); setLogsDir(); } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index 85e3e9e747..8276826456 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -70,6 +70,7 @@ public class ASDCConfiguration implements IConfiguration { public static final String HEAT_VOL="HEAT_VOL"; public static final String OTHER="OTHER"; public static final String TOSCA_CSAR="TOSCA_CSAR"; + public static final String WORKFLOWS="Workflows"; public static final String VF_MODULES_METADATA="VF_MODULES_METADATA"; private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC,ASDCConfiguration.class); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index fae3a49910..7ead6cbb7f 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -22,6 +22,7 @@ d * ============LICENSE_START=================================================== package org.onap.so.asdc.client; +import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -47,6 +48,7 @@ import org.onap.so.asdc.installer.IVfResourceInstaller; import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.asdc.installer.VfModuleStructure; import org.onap.so.asdc.installer.VfResourceStructure; +import org.onap.so.asdc.installer.bpmn.BpmnInstaller; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.asdc.tenantIsolation.DistributionStatus; import org.onap.so.asdc.tenantIsolation.WatchdogDistribution; @@ -78,6 +80,9 @@ public class ASDCController { private ToscaResourceInstaller toscaInstaller; @Autowired + private BpmnInstaller bpmnInstaller; + + @Autowired private WatchdogDistributionStatusRepository wdsRepo; @Autowired @@ -352,9 +357,17 @@ public class ASDCController { + artifact.getArtifactUUID () + ")"); + String filePath = System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName(); + // make parent directory + File file = new File(filePath); + File fileParent = file.getParentFile(); + if (!fileParent.exists()) { + fileParent.mkdirs(); + } + byte[] payloadBytes = resultArtifact.getArtifactPayload(); - try (FileOutputStream outFile = new FileOutputStream(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName())) { + try (FileOutputStream outFile = new FileOutputStream(filePath)) { LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName()); outFile.write(payloadBytes, 0, payloadBytes.length); outFile.close(); @@ -675,6 +688,13 @@ public class ASDCController { this.processCsarServiceArtifacts(iNotif, toscaResourceStructure); + if (toscaResourceStructure.getServiceVersion() == null) { + LOGGER.debug("Deploy the workflow"); + IArtifactInfo iArtifact = toscaResourceStructure.getToscaArtifact(); + String csarFilePath = System.getProperty("mso.config.path") + "/ASDC" + "/" + iArtifact.getArtifactName(); + bpmnInstaller.installBpmn(csarFilePath); + } + // Install a service with no resources, only the service itself if (iNotif.getResources() == null || iNotif.getResources().size() < 1) { @@ -763,6 +783,26 @@ public class ASDCController { "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e); } } + else if(artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOWS)){ + + try{ + + IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,iNotif.getDistributionID()); + + writeArtifactToFile(artifact, resultArtifact); + + toscaResourceStructure.setToscaArtifact(artifact); + + LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif)); + + + } catch(Exception e){ + System.out.println("Whats the error " + e.getMessage()); + LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, + "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e); + } + } + } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index 8353f708a9..030035157d 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -126,7 +126,9 @@ public class ToscaResourceStructure { LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path")); - File spoolFile = new File(System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactName()); + String filePath = System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName(); + + File spoolFile = new File(filePath); LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath()); LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath()); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java new file mode 100644 index 0000000000..f131b73175 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -0,0 +1,165 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.asdc.installer.bpmn; + +import java.io.*; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.zip.*; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.impl.client.HttpClientBuilder; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.ByteArrayBody; +import org.apache.http.entity.mime.content.StringBody; +import org.apache.http.entity.mime.FormBodyPartBuilder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class BpmnInstaller { + protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,BpmnInstaller.class); + private static final String BPMN_SUFFIX = ".bpmn"; + private static final String CAMUNDA_URL = "mso.camundaURL"; + private static final String CREATE_DEPLOYMENT_PATH = "/sobpmnengine/deployment/create"; + + @Autowired + private Environment env; + + public void installBpmn(String csarFilePath) { + LOGGER.info("Deploying BPMN files from " + csarFilePath); + try { + ZipInputStream csarFile = new ZipInputStream(new FileInputStream(csarFilePath)); + ZipEntry entry = csarFile.getNextEntry(); + + while (entry != null) { + String name = entry.getName(); + if (name.endsWith(BPMN_SUFFIX)) { + LOGGER.debug("Attempting to deploy BPMN file: " + name); + try { + Path p = Paths.get(name); + String fileName = p.getFileName().toString(); + extractBpmnFileFromCsar(csarFile, fileName); + HttpResponse response = sendDeploymentRequest(fileName); + LOGGER.debug("Response status line: " + response.getStatusLine()); + LOGGER.debug("Response entity: " + response.getEntity().toString()); + if (response.getStatusLine().getStatusCode() != 200) { + LOGGER.debug("Failed deploying BPMN " + name); + LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, + name, + fileName, + "", + Integer.toString(response.getStatusLine().getStatusCode()), "", "", MsoLogger.ErrorCode.DataError, "ASDC BPMN deploy failed"); + } + else { + LOGGER.debug("Successfully deployed to Camunda: " + name); + } + } + catch (Exception e) { + LOGGER.debug("Exception :",e); + LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, + name, + "", + "", + e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC BPMN deploy failed"); + } + } + entry = csarFile.getNextEntry(); + } + csarFile.close(); + } catch (IOException ex) { + LOGGER.debug("Exception :",ex); + LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, + csarFilePath, + "", + "", + ex.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC reading CSAR with workflows failed"); + } + return; + } + + protected HttpResponse sendDeploymentRequest(String bpmnFileName) throws Exception { + HttpClient client = HttpClientBuilder.create().build(); + String deploymentUri = this.env.getProperty(CAMUNDA_URL) + CREATE_DEPLOYMENT_PATH; + HttpPost post = new HttpPost(deploymentUri); + RequestConfig requestConfig = + RequestConfig.custom().setSocketTimeout(1000000).setConnectTimeout(1000).setConnectionRequestTimeout(1000).build(); + post.setConfig(requestConfig); + HttpEntity requestEntity = buildMimeMultipart(bpmnFileName); + post.setEntity(requestEntity); + return client.execute(post); + } + + protected HttpEntity buildMimeMultipart(String bpmnFileName) throws Exception { + FileInputStream bpmnFileStream = new FileInputStream (System.getProperty("mso.config.path") + "/ASDC" + "/" + bpmnFileName); + + byte[] bytesToSend = IOUtils.toByteArray(bpmnFileStream); + HttpEntity requestEntity = MultipartEntityBuilder.create() + .addPart(FormBodyPartBuilder.create() + .setName("deployment-name") + .setBody(new StringBody("MSO Sample 1", ContentType.TEXT_PLAIN)) + .setField("Content-Disposition", String.format("form-data; name=\"%s\"", "deployment-name")) + .build()) + .addPart(FormBodyPartBuilder.create() + .setName("enable-duplicate-filtering") + .setBody(new StringBody("false", ContentType.TEXT_PLAIN)) + .setField("Content-Disposition", String.format("form-data; name=\"%s\"", "enable-duplicate-filtering")) + .build()) + .addPart(FormBodyPartBuilder.create() + .setName("deplpy-changed-only") + .setBody(new StringBody("false", ContentType.TEXT_PLAIN)) + .setField("Content-Disposition", String.format("form-data; name=\"%s\"", "deploy-changed-only")) + .build()) + .addPart(FormBodyPartBuilder.create() + .setName("deployment-source") + .setBody(new StringBody("local", ContentType.TEXT_PLAIN)) + .setField("Content-Disposition", String.format("form-data; name=\"%s\"", "deployment-source")) + .build()) + .addPart(FormBodyPartBuilder.create() + .setName(bpmnFileName) + .setBody(new ByteArrayBody(bytesToSend, ContentType.create("octet"), bpmnFileName)) + .setField("Content-Disposition", String.format("form-data; name=\"%s\"; filename=\"%s\"; size=%d", bpmnFileName, bpmnFileName, bytesToSend.length)) + .build()) + .build(); + return requestEntity; + } + + protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException { + String filePath = System.getProperty("mso.config.path") + "/ASDC" + "/" + fileName; + BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath)); + byte[] bytesIn = new byte[4096]; + int read = 0; + while ((read = zipIn.read(bytesIn)) != -1) { + outputStream.write(bytesIn, 0, read); + } + outputStream.close(); + } +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 1fca9d3ff2..f77a48a1f8 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -488,23 +488,24 @@ public class ToscaResourceInstaller { .getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID); IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata(); - logger.debug("Comparing VFModule Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID()); - for(Group group : vfGroups){ - logger.debug("To Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID")); - } + logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID()); - Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream(). - filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID())). - findFirst(); + Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream() + .peek(group -> logger.debug("To Csar Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID"))) + .filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID())) + .findFirst(); if(matchingObject.isPresent()){ VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, vfResourceStructure,vfMetadata, vnfResource, service, existingCvnfcSet, existingVnfcSet); vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); }else - throw new Exception("Cannot find matching VFModule Customization for VF Module Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID()); + throw new Exception("Cannot find matching VFModule Customization in Csar for Vf_Modules_Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID()); } service.getVnfCustomizations().add(vnfResource); + } else{ + logger.debug("Notification VF ResourceCustomizationUUID: " + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match " + + "Tosca VF Customization UUID: " + vfCustomizationUUID); } } } @@ -1152,7 +1153,7 @@ public class ToscaResourceInstaller { vfcInstanceGroup.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - vfcInstanceGroup.setToscaNodeType(group.getType()); + vfcInstanceGroup.setToscaNodeType(group.getType()); vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type @@ -1203,7 +1204,7 @@ public class ToscaResourceInstaller { if(vfModule==null) vfModule=createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata); - vfModuleCustomization = createVfModuleCustomzation(group, toscaResourceStructure, vfModule, vfModuleData); + vfModuleCustomization = createVfModuleCustomization(group, toscaResourceStructure, vfModule, vfModuleData); setHeatInformationForVfModule(toscaResourceStructure, vfResourceStructure, vfModule, vfModuleCustomization, vfMetadata); vfModuleCustomization.setVfModule(vfModule); @@ -1418,7 +1419,7 @@ public class ToscaResourceInstaller { return vfModule; } - protected VfModuleCustomization createVfModuleCustomzation(Group group, + protected VfModuleCustomization createVfModuleCustomization(Group group, ToscaResourceStructure toscaResourceStructure, VfModule vfModule, IVfModuleData vfModuleData) { VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); @@ -1693,6 +1694,8 @@ public class ToscaResourceInstaller { testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); vnfResource.setAicVersionMin( testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + vnfResource.setCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + vnfResource.setSubCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); return vnfResource; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java index 54977104ff..9df9ffc7af 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java @@ -201,18 +201,13 @@ public class ASDCNotificationLogging { } } - buffer.append(System.lineSeparator()); - buffer.append(System.lineSeparator()); - buffer.append("VNF Level Properties:"); - buffer.append(System.lineSeparator()); - List<NodeTemplate> vfNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceVfList(); for (NodeTemplate vfNodeTemplate : vfNodeTemplatesList) { - + + buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("VNF Properties:"); - buffer.append(System.lineSeparator()); - + buffer.append(System.lineSeparator()); buffer.append("Model Name:"); buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); buffer.append(System.lineSeparator()); @@ -267,6 +262,7 @@ public class ASDCNotificationLogging { for (Group group : groupList) { Metadata instanceMetadata = group.getMetadata(); + buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("VNFC Instance Group Properties:"); buffer.append(System.lineSeparator()); @@ -282,22 +278,22 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("InvariantUuid:"); buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); } } - - buffer.append(System.lineSeparator()); - buffer.append("VF Module Properties:"); - buffer.append(System.lineSeparator()); List<Group> vfGroups = toscaResourceStructure.getSdcCsarHelper().getVfModulesByVf(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); for(Group group : vfGroups){ Metadata vfMetadata = group.getMetadata(); + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append("VF Module Properties:"); + buffer.append(System.lineSeparator()); buffer.append("ModelInvariantUuid:"); buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID))); buffer.append(System.lineSeparator()); @@ -312,22 +308,79 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("Description:"); buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); - buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + } + + List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC); + + for(NodeTemplate cvfcTemplate : cvfcList) { + + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append("CVNFC Properties:"); + buffer.append(System.lineSeparator()); + buffer.append("ModelCustomizationUuid:"); + buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + buffer.append(System.lineSeparator()); + buffer.append("ModelInvariantUuid:"); + buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + buffer.append(System.lineSeparator()); + buffer.append("ModelName:"); + buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(System.lineSeparator()); + buffer.append("ModelUuid:"); + buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(System.lineSeparator()); + buffer.append("ModelVersion:"); + buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(System.lineSeparator()); + buffer.append("Description:"); + buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + buffer.append(System.lineSeparator()); + + + List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC); + + for(NodeTemplate vfcTemplate : vfcList) { + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append("VNFC Properties:"); + buffer.append(System.lineSeparator()); + buffer.append("ModelCustomizationUuid:"); + buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + buffer.append(System.lineSeparator()); + buffer.append("ModelInvariantUuid:"); + buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + buffer.append(System.lineSeparator()); + buffer.append("ModelName:"); + buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(System.lineSeparator()); + buffer.append("ModelUuid:"); + buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(System.lineSeparator()); + buffer.append("ModelVersion:"); + buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(System.lineSeparator()); + buffer.append("Description:"); + buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + buffer.append(System.lineSeparator()); + + } + } - } List<NodeTemplate> nodeTemplatesVLList = toscaResourceStructure.getSdcCsarHelper().getServiceVlList(); if(nodeTemplatesVLList != null){ - - buffer.append(System.lineSeparator()); - buffer.append("NETWORK Level Properties:"); - buffer.append(System.lineSeparator()); - + for(NodeTemplate vlNode : nodeTemplatesVLList){ + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append("NETWORK Level Properties:"); + buffer.append(System.lineSeparator()); buffer.append("Model Name:"); buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); buffer.append(System.lineSeparator()); @@ -365,6 +418,7 @@ public class ASDCNotificationLogging { if (networkCollectionList != null) { for (NodeTemplate crNode : networkCollectionList) { + buffer.append(System.lineSeparator()); buffer.append("Model Name:"); buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); buffer.append(System.lineSeparator()); @@ -399,6 +453,7 @@ public class ASDCNotificationLogging { Metadata vlMetadata = vlNodeTemplate.getMetaData(); + buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("Network CR VL Properties:"); buffer.append(System.lineSeparator()); @@ -432,7 +487,8 @@ public class ASDCNotificationLogging { if(groupList != null){ for (Group group : groupList) { Metadata instanceMetadata = group.getMetadata(); - buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); buffer.append("Network Instance Group Properties:"); buffer.append(System.lineSeparator()); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java index 32f512b0f0..3418ee3295 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java @@ -50,6 +50,10 @@ public class YamlEditor { public YamlEditor (byte[] body) { init (body); } + + public YamlEditor (Yaml yaml) { + this.yaml = yaml; + } @SuppressWarnings("unchecked") protected synchronized void init (byte[] body) { diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java new file mode 100644 index 0000000000..535434db32 --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.asdc.installer.bpmn; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import javax.transaction.Transactional; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.message.BasicHttpResponse; +import org.apache.http.message.BasicStatusLine; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.installer.bpmn.BpmnInstaller; +import org.springframework.beans.factory.annotation.Autowired; + +@Transactional +public class BpmnInstallerTest extends BaseTest { + + @Autowired + private BpmnInstaller bpmnInstaller; + + @Before + public void init() throws Exception { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void buildMimeMultiPart_Test() throws Exception { + + HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn"); + String mimeMultipartBodyFilePath = System.getProperty("mso.config.path") + "/mime-multipart-body.txt"; + + File mimeMultipartBody = new File(mimeMultipartBodyFilePath); + InputStream expectedContent = new FileInputStream(mimeMultipartBody); + + assertThat(IOUtils.contentEquals(expectedContent, entity.getContent())); + } + + @Test + public void installBpmn_Test() throws Exception { + HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "")); + HttpClient httpClient = mock(HttpClient.class); + String csarPath = System.getProperty("mso.config.path") + "/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar"; + doReturn(response).when(httpClient).execute(any(HttpPost.class)); + bpmnInstaller.installBpmn(csarPath); + } + +} diff --git a/asdc-controller/src/test/resources/ASDC/TestBB.bpmn b/asdc-controller/src/test/resources/ASDC/TestBB.bpmn new file mode 100644 index 0000000000..47d1f6e649 --- /dev/null +++ b/asdc-controller/src/test/resources/ASDC/TestBB.bpmn @@ -0,0 +1,53 @@ +<?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="1.4.0"> + <bpmn:process id="TestBB" name="TestBB" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="Start"> + <bpmn:outgoing>SequenceFlow_1owu825</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_06wodhm" name="End"> + <bpmn:incoming>SequenceFlow_1gwcdup</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1owu825" sourceRef="StartEvent_1" targetRef="FisrtTask" /> + <bpmn:sequenceFlow id="SequenceFlow_1gwcdup" sourceRef="FisrtTask" targetRef="EndEvent_06wodhm" /> + <bpmn:scriptTask id="FisrtTask" name="FirstTask" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1owu825</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1gwcdup</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +DoCreateVnf createVnf = new DoCreateVnf() +createVnf.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="TestBB"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="217" y="171" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="223" y="207" width="23" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_06wodhm_di" bpmnElement="EndEvent_06wodhm"> + <dc:Bounds x="630" y="171" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="638" y="207" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1owu825_di" bpmnElement="SequenceFlow_1owu825"> + <di:waypoint xsi:type="dc:Point" x="253" y="189" /> + <di:waypoint xsi:type="dc:Point" x="390" y="189" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="322" y="174" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1gwcdup_di" bpmnElement="SequenceFlow_1gwcdup"> + <di:waypoint xsi:type="dc:Point" x="490" y="189" /> + <di:waypoint xsi:type="dc:Point" x="630" y="189" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="560" y="174" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0u50zcm_di" bpmnElement="FisrtTask"> + <dc:Bounds x="390" y="149" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/asdc-controller/src/test/resources/mime-multipart-body.txt b/asdc-controller/src/test/resources/mime-multipart-body.txt new file mode 100644 index 0000000000..09d3aa7696 --- /dev/null +++ b/asdc-controller/src/test/resources/mime-multipart-body.txt @@ -0,0 +1,84 @@ +--Oz34MbsoUcF5cyWT62NuPjcHb9SU_GIfNHI +Content-Disposition: form-data; name="deployment-name" +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit + +MSO Sample 1 +--Oz34MbsoUcF5cyWT62NuPjcHb9SU_GIfNHI +Content-Disposition: form-data; name="enable-duplicate-filtering" +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit + +false +--Oz34MbsoUcF5cyWT62NuPjcHb9SU_GIfNHI +Content-Disposition: form-data; name="deploy-changed-only" +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit + +false +--Oz34MbsoUcF5cyWT62NuPjcHb9SU_GIfNHI +Content-Disposition: form-data; name="deployment-source" +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit + +local +--Oz34MbsoUcF5cyWT62NuPjcHb9SU_GIfNHI +Content-Disposition: form-data; name="testBB.bpmn"; filename="testBB.bpmn"; size=2990 +Content-Type: octet +Content-Transfer-Encoding: binary + +<?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="1.4.0"> + <bpmn:process id="TestBB" name="TestBB" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="Start"> + <bpmn:outgoing>SequenceFlow_1owu825</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_06wodhm" name="End"> + <bpmn:incoming>SequenceFlow_1gwcdup</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1owu825" sourceRef="StartEvent_1" targetRef="FisrtTask" /> + <bpmn:sequenceFlow id="SequenceFlow_1gwcdup" sourceRef="FisrtTask" targetRef="EndEvent_06wodhm" /> + <bpmn:scriptTask id="FisrtTask" name="FirstTask" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1owu825</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1gwcdup</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +DoCreateVnf createVnf = new DoCreateVnf() +createVnf.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="TestBB"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="217" y="171" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="223" y="207" width="23" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_06wodhm_di" bpmnElement="EndEvent_06wodhm"> + <dc:Bounds x="630" y="171" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="638" y="207" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1owu825_di" bpmnElement="SequenceFlow_1owu825"> + <di:waypoint xsi:type="dc:Point" x="253" y="189" /> + <di:waypoint xsi:type="dc:Point" x="390" y="189" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="322" y="174" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1gwcdup_di" bpmnElement="SequenceFlow_1gwcdup"> + <di:waypoint xsi:type="dc:Point" x="490" y="189" /> + <di:waypoint xsi:type="dc:Point" x="630" y="189" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="560" y="174" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0u50zcm_di" bpmnElement="FisrtTask"> + <dc:Bounds x="390" y="149" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> + +--Oz34MbsoUcF5cyWT62NuPjcHb9SU_GIfNHI-- diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/Notification_MultipleModules.txt b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/Notification_MultipleModules.txt new file mode 100644 index 0000000000..5b6d9e4eaf --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/Notification_MultipleModules.txt @@ -0,0 +1,302 @@ +DistributionID:a2872f55-8628-4486-8548-7b132c9a47db +ServiceName:Vf zrdm5bpxmc02092017-Service +ServiceVersion:1.0 +ServiceUUID:bad955c3-29b2-4a27-932e-28e942cc6480 +ServiceInvariantUUID:b16a9398-ffa3-4041-b78c-2956b8ad9c7b +ServiceDescription:Demo + + + +Service Artifacts List: +{ +Service Artifacts Info: +ArtifactName:service-VfZrdm5bpxmc02092017Service-csar.csar +ArtifactVersion:1 +ArtifactType:TOSCA_CSAR +ArtifactDescription:TOSCA definition package of the asset +ArtifactTimeout:0 +ArtifactURL:service-VfZrdm5bpxmc02092017Service-csar.csar +ArtifactUUID:396cfd49-0f4b-4fec-9f33-0fd7e90d5a22 +ArtifactChecksum:MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + + +} + +Resource Instances List: +{ +Resource Instance Info: +ResourceInstanceName:Vf zrdm5bpxmc02092017-VF 0 +ResourceCustomizationUUID:96c23a4a-6887-4b2c-9cce-1e4ea35eaade +ResourceInvariantUUID:23122c9b-dd7f-483f-bf0a-e069303db2f7 +ResourceName:Vf zrdm5bpxmc02092017-VF +ResourceType:VF +ResourceUUID:14ba5d1e-3862-407c-a236-1cbaebccce77 +ResourceVersion:1.0 +Category:Generic +SubCategory:Network Elements +Resource Artifacts List: +{ +Service Artifacts Info: +ArtifactName:pxmc_mmn_volume.env +ArtifactVersion:2 +ArtifactType:HEAT_ENV +ArtifactDescription:Auto-generated HEAT Environment deployment artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.env +ArtifactUUID:c1ae6284-48d9-4437-a195-b2cf2ba23070 +ArtifactChecksum:NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} +, +Service Artifacts Info: +ArtifactName:pxmc_base.env +ArtifactVersion:2 +ArtifactType:HEAT_ENV +ArtifactDescription:Auto-generated HEAT Environment deployment artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.env +ArtifactUUID:6dd99c31-c52e-4c45-b99b-d223c877a296 +ArtifactChecksum:OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + +, +Service Artifacts Info: +ArtifactName:vfzrdm5bpxmc02092017vf0_modules.json +ArtifactVersion:1 +ArtifactType:VF_MODULES_METADATA +ArtifactDescription:Auto-generated VF Modules information artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/vfzrdm5bpxmc02092017vf0_modules.json +ArtifactUUID:e3b82cd6-485e-4d56-8d2c-17ccf6a59533 +ArtifactChecksum:MjY0NzcxMjJkZGI4YzQ1MDU2NjhkNWYyM2IwNmYzYmU= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + +, +Service Artifacts Info: +ArtifactName:pxmc_vmt.yaml +ArtifactVersion:1 +ArtifactType:HEAT +ArtifactDescription:created from csar +ArtifactTimeout:120 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.yaml +ArtifactUUID:ad12ab80-5419-4346-a5d7-dac2fc15575f +ArtifactChecksum:ODE0YTRiYzc2YzkxOTliZjJhNjc0M2RhMWU4M2VlZmE= +GeneratedArtifact:{Service Artifacts Info: +ArtifactName:pxmc_vmt.env +ArtifactVersion:2 +ArtifactType:HEAT_ENV +ArtifactDescription:Auto-generated HEAT Environment deployment artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.env +ArtifactUUID:bc1640f1-69f0-4760-8fc3-3318ec2ff129 +ArtifactChecksum:MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} +} +RelatedArtifacts:{ +Service Artifacts Info: +ArtifactName:user_data_zrdm5bpxmc02vmt001.txt +ArtifactVersion:1 +ArtifactType:HEAT_ARTIFACT +ArtifactDescription:created from csar +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02vmt001.txt +ArtifactUUID:53acdabe-689f-45e5-8578-f1514d3529da +ArtifactChecksum:MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + + +} + + +, +Service Artifacts Info: +ArtifactName:pxmc_mmn.yaml +ArtifactVersion:1 +ArtifactType:HEAT +ArtifactDescription:created from csar +ArtifactTimeout:120 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.yaml +ArtifactUUID:b8bca13b-811f-44ab-9d27-45b842c664d8 +ArtifactChecksum:YmNiYTU5YTM4ODVhYTlhODc5NGMwNWZkZjI5MTRmNTE= +GeneratedArtifact:{Service Artifacts Info: +ArtifactName:pxmc_mmn.env +ArtifactVersion:2 +ArtifactType:HEAT_ENV +ArtifactDescription:Auto-generated HEAT Environment deployment artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.env +ArtifactUUID:e88ce0b9-1496-4d03-ab1d-6d8d79bfc737 +ArtifactChecksum:ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} +} +RelatedArtifacts:{ +Service Artifacts Info: +ArtifactName:user_data_zrdm5bpxmc02mmn001.txt +ArtifactVersion:1 +ArtifactType:HEAT_ARTIFACT +ArtifactDescription:created from csar +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02mmn001.txt +ArtifactUUID:5bc62c72-5f7a-40bc-a167-1a4fed9afdef +ArtifactChecksum:OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + + +} + + +, +Service Artifacts Info: +ArtifactName:pxmc_mmn.env +ArtifactVersion:2 +ArtifactType:HEAT_ENV +ArtifactDescription:Auto-generated HEAT Environment deployment artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.env +ArtifactUUID:e88ce0b9-1496-4d03-ab1d-6d8d79bfc737 +ArtifactChecksum:ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + +, +Service Artifacts Info: +ArtifactName:pxmc_vmt.env +ArtifactVersion:2 +ArtifactType:HEAT_ENV +ArtifactDescription:Auto-generated HEAT Environment deployment artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.env +ArtifactUUID:bc1640f1-69f0-4760-8fc3-3318ec2ff129 +ArtifactChecksum:MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} +, +Service Artifacts Info: +ArtifactName:user_data_zrdm5bpxmc02mmn001.txt +ArtifactVersion:1 +ArtifactType:HEAT_ARTIFACT +ArtifactDescription:created from csar +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02mmn001.txt +ArtifactUUID:5bc62c72-5f7a-40bc-a167-1a4fed9afdef +ArtifactChecksum:OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + +, +Service Artifacts Info: +ArtifactName:pxmc_base.yaml +ArtifactVersion:1 +ArtifactType:HEAT +ArtifactDescription:created from csar +ArtifactTimeout:120 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.yaml +ArtifactUUID:7e7f7356-11bd-4f2f-bbbc-5c10954e3189 +ArtifactChecksum:YThkNGFhZjAwNmM4NzMzODc0YzNhYTUxOTljNGQwNmM= +GeneratedArtifact:{Service Artifacts Info: +ArtifactName:pxmc_base.env +ArtifactVersion:2 +ArtifactType:HEAT_ENV +ArtifactDescription:Auto-generated HEAT Environment deployment artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.env +ArtifactUUID:6dd99c31-c52e-4c45-b99b-d223c877a296 +ArtifactChecksum:OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + +} +RelatedArtifacts:{ +} +, +Service Artifacts Info: +ArtifactName:user_data_zrdm5bpxmc02vmt001.txt +ArtifactVersion:1 +ArtifactType:HEAT_ARTIFACT +ArtifactDescription:created from csar +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02vmt001.txt +ArtifactUUID:53acdabe-689f-45e5-8578-f1514d3529da +ArtifactChecksum:MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + +, +Service Artifacts Info: +ArtifactName:pxmc_mmn_volume.yaml +ArtifactVersion:2 +ArtifactType:HEAT_VOL +ArtifactDescription:created from csar +ArtifactTimeout:120 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.yaml +ArtifactUUID:2f372a02-df1b-46ca-b81e-822e3f406965 +ArtifactChecksum:MzA5MGY5ODQ0NDY5MDhiMDM3YjFlNGIwNzJkNjFhOTI= +GeneratedArtifact:{Service Artifacts Info: +ArtifactName:pxmc_mmn_volume.env +ArtifactVersion:2 +ArtifactType:HEAT_ENV +ArtifactDescription:Auto-generated HEAT Environment deployment artifact +ArtifactTimeout:0 +ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.env +ArtifactUUID:c1ae6284-48d9-4437-a195-b2cf2ba23070 +ArtifactChecksum:NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU= +GeneratedArtifact:{NULL +} +RelatedArtifacts:{ +} + + +} +RelatedArtifacts:{ +} + + + +} + + + +} diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/ServiceResponse.json b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/ServiceResponse.json new file mode 100644 index 0000000000..37b7987f46 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/ServiceResponse.json @@ -0,0 +1,458 @@ +{ + "modelName": "Vf zrdm5bpxmc02092017-Service", + "description": "Demo", + "modelUUID": "bad955c3-29b2-4a27-932e-28e942cc6480", + "modelInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", + "serviceType": "", + "serviceRole": "", + "environmentContext": "General_Revenue-Bearing", + "networkCustomizations": [], + "vnfCustomizations": [ + { + "modelCustomizationUuid": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade", + "modelInstanceName": "Vf zrdm5bpxmc02092017-VF 0", + "multiStageDesign": "false", + "vnfResources": { + "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", + "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", + "modelName": "Vf zrdm5bpxmc02092017-VF", + "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", + "description": "Demo", + "orchestrationMode": "HEAT", + "modelVersion": "1.0", + "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" + }, + "vfModuleCustomizations": [ + { + "modelCustomizationUuid": "074c64d0-7e13-4bcc-8bdb-ea922331102d", + "label": "pxmc_base", + "minInstances": 1, + "maxInstances": 1, + "initialCount": 1, + "heatEnvironment": { + "artifactUuid": "6dd99c31-c52e-4c45-b99b-d223c877a296", + "name": "pxmc_base.env", + "description": "Auto-generated HEAT Environment deployment artifact", + "environment": "parameters:\n vnf_name: \n", + "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg=", + "version": "2" + }, + "vfModule": { + "modelUUID": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46", + "modelInvariantUUID": "f7a867f2-596b-4f4a-a128-421e825a6190", + "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_base..module-0", + "modelVersion": "1", + "isBase": 1, + "moduleHeatTemplate": { + "artifactUuid": "7e7f7356-11bd-4f2f-bbbc-5c10954e3189", + "templateName": "pxmc_base.yaml", + "templateBody": "heat_template_version: 2015-04-30\n\nparameters:\n\n## GLOBAL//Basic Parameters\n vnf_name:\n type: string\n description: Unique name for this VF instance\n# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC\n\nresources:\n\n## MSP RSG//Resource:SecurityGroup\n sec_grp_msp_0:\n type: OS::Neutron::SecurityGroup\n properties:\n description: Security Group for PXMC\n name:\n str_replace:\n template: VF_NAME_sec_grp_msp\n params:\n VF_NAME: { get_param: vnf_name }\n rules:\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n\noutputs:\n\n sec_grp_msp_id:\n description: uuid of the security group\n value: {get_resource: sec_grp_msp_0 }\n", + "timeoutMinutes": 120, + "version": "1", + "description": "created from csar", + "artifactChecksum": "YThkNGFhZjAwNmM4NzMzODc0YzNhYTUxOTljNGQwNmM=", + "parameters": [ + { + "heatTemplateArtifactUuid": "7e7f7356-11bd-4f2f-bbbc-5c10954e3189", + "paramName": "vnf_name", + "required": true, + "paramType": "string" + } + ], + "childTemplates": [], + "heatTemplate": "heat_template_version: 2015-04-30\n\nparameters:\n\n## GLOBAL//Basic Parameters\n vnf_name:\n type: string\n description: Unique name for this VF instance\n# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC\n\nresources:\n\n## MSP RSG//Resource:SecurityGroup\n sec_grp_msp_0:\n type: OS::Neutron::SecurityGroup\n properties:\n description: Security Group for PXMC\n name:\n str_replace:\n template: VF_NAME_sec_grp_msp\n params:\n VF_NAME: { get_param: vnf_name }\n rules:\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n\noutputs:\n\n sec_grp_msp_id:\n description: uuid of the security group\n value: {get_resource: sec_grp_msp_0 }\n" + }, + "heatFiles": [], + "vnfResources": { + "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", + "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", + "modelName": "Vf zrdm5bpxmc02092017-VF", + "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", + "description": "Demo", + "orchestrationMode": "HEAT", + "modelVersion": "1.0", + "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" + }, + "modelInvariantUuid": "f7a867f2-596b-4f4a-a128-421e825a6190", + "base": true + } + }, + { + "modelCustomizationUuid": "5336a98e-0966-4e59-b6e6-c8162804a024", + "label": "pxmc_vmt", + "minInstances": 0, + "initialCount": 0, + "heatEnvironment": { + "artifactUuid": "bc1640f1-69f0-4760-8fc3-3318ec2ff129", + "name": "pxmc_vmt.env", + "description": "Auto-generated HEAT Environment deployment artifact", + "environment": "parameters:\n cinder_delete_on_termination_false: \n cinder_delete_on_termination_true: \n oam_protected_net_name: \n sec_grp_msp_id: \n vf_module_id: \n vmt_block_device_names: \n vmt_flavor_name: \n vmt_name_0: \n vmt_oam_protected_ip_0: \n vmt_volume_image_name_0: \n vmt_volume_image_name_1: \n vmt_volume_name_0: \n vmt_volume_name_1: \n vmt_volume_size_0: \n vmt_volume_size_1: \n vnf_id: \n", + "artifactChecksum": "MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY=", + "version": "2" + }, + "vfModule": { + "modelUUID": "4d4423e2-17e8-455a-b9ae-7e4ab71b9cdc", + "modelInvariantUUID": "1e099992-6222-41a9-acde-5a8abb690775", + "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_vmt..module-1", + "modelVersion": "1", + "isBase": 0, + "moduleHeatTemplate": { + "artifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "templateName": "pxmc_vmt.yaml", + "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus MSP VMT stack under MobiSupport Tenant\n\nparameters:\n vmt_name_0:\n type: string\n label: MSP VMT server names\n description: name of the MSP VMT instances\n# vmt_image_name:\n# type: string\n# label: MSP VMT image name\n# description: MSP VMT image name\n vmt_flavor_name:\n type: string\n label: MSP VMT flavor name\n description: MSP VMT flavor name\n# availability_zone_0:\n# type: string\n# label: MSP VMT availability zones\n# description: MSP VMT availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n vmt_oam_protected_ip_0:\n type: string\n label: MSP VMT OAM IP Addresses\n description: MSP VMT OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP VMT OAM net name\n description: MSP VMT OAM net name\n vmt_block_device_names:\n type: comma_delimited_list\n label: MSP VMT Block Device Names\n description: MSP VMT Block Device Names\n vmt_volume_name_0:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_name_1:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_size_0:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_size_1:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_image_name_0:\n type: string\n label: Mobisupport MSP VMT VDA Cinder Volume image name\n description: Mobisupport MSP VMT VDA Cinder Volume image name\n vmt_volume_image_name_1:\n type: string\n label: Mobisupport MSP VMT VDB Cinder Volume image name\n description: Mobisupport MSP VMT VDB Cinder Volume image name\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP VMT VNF ID\n description: MSP VMT VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF Module instance\n\nresources:\n################ Cinder Volumes ##############################\n vmt_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_0}\n size: {get_param: vmt_volume_size_0}\n image: {get_param: vmt_volume_image_name_0}\n\n vmt_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_1}\n size: {get_param: vmt_volume_size_1}\n image: {get_param: vmt_volume_image_name_1}\n\n################ Ports ##############################\n vmt_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: vmt_oam_protected_ip_0}}]\n security_groups: [{get_param: sec_grp_msp_id}]\n replacement_policy: AUTO\n\n################### Servers #########################\n vmt_zrdm5bpxmc02vmt_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: vmt_name_0}\n# image: {get_param: vmt_image_name}\n flavor: {get_param: vmt_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2: \n - device_name: {get_param: [vmt_block_device_names, 0]}\n volume_id: {get_resource: vmt_volume_0}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: 0\n - device_name: {get_param: [vmt_block_device_names, 1]}\n volume_id: {get_resource: vmt_volume_1}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: -1\n networks:\n - port: {get_resource: vmt_oam_protected_0_port}\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02vmt001.txt\n\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n", + "timeoutMinutes": 120, + "version": "1", + "description": "created from csar", + "artifactChecksum": "ODE0YTRiYzc2YzkxOTliZjJhNjc0M2RhMWU4M2VlZmE=", + "parameters": [ + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_name_0", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vf_module_id", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "sec_grp_msp_id", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_volume_name_1", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_volume_name_0", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_block_device_names", + "required": true, + "paramType": "comma_delimited_list" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_flavor_name", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vnf_id", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "oam_protected_net_name", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_volume_image_name_1", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_volume_image_name_0", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_oam_protected_ip_0", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_volume_size_0", + "required": true, + "paramType": "number" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "cinder_delete_on_termination_false", + "required": true, + "paramType": "boolean" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "vmt_volume_size_1", + "required": true, + "paramType": "number" + }, + { + "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", + "paramName": "cinder_delete_on_termination_true", + "required": true, + "paramType": "boolean" + } + ], + "childTemplates": [], + "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus MSP VMT stack under MobiSupport Tenant\n\nparameters:\n vmt_name_0:\n type: string\n label: MSP VMT server names\n description: name of the MSP VMT instances\n# vmt_image_name:\n# type: string\n# label: MSP VMT image name\n# description: MSP VMT image name\n vmt_flavor_name:\n type: string\n label: MSP VMT flavor name\n description: MSP VMT flavor name\n# availability_zone_0:\n# type: string\n# label: MSP VMT availability zones\n# description: MSP VMT availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n vmt_oam_protected_ip_0:\n type: string\n label: MSP VMT OAM IP Addresses\n description: MSP VMT OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP VMT OAM net name\n description: MSP VMT OAM net name\n vmt_block_device_names:\n type: comma_delimited_list\n label: MSP VMT Block Device Names\n description: MSP VMT Block Device Names\n vmt_volume_name_0:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_name_1:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_size_0:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_size_1:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_image_name_0:\n type: string\n label: Mobisupport MSP VMT VDA Cinder Volume image name\n description: Mobisupport MSP VMT VDA Cinder Volume image name\n vmt_volume_image_name_1:\n type: string\n label: Mobisupport MSP VMT VDB Cinder Volume image name\n description: Mobisupport MSP VMT VDB Cinder Volume image name\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP VMT VNF ID\n description: MSP VMT VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF Module instance\n\nresources:\n################ Cinder Volumes ##############################\n vmt_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_0}\n size: {get_param: vmt_volume_size_0}\n image: {get_param: vmt_volume_image_name_0}\n\n vmt_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_1}\n size: {get_param: vmt_volume_size_1}\n image: {get_param: vmt_volume_image_name_1}\n\n################ Ports ##############################\n vmt_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: vmt_oam_protected_ip_0}}]\n security_groups: [{get_param: sec_grp_msp_id}]\n replacement_policy: AUTO\n\n################### Servers #########################\n vmt_zrdm5bpxmc02vmt_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: vmt_name_0}\n# image: {get_param: vmt_image_name}\n flavor: {get_param: vmt_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2: \n - device_name: {get_param: [vmt_block_device_names, 0]}\n volume_id: {get_resource: vmt_volume_0}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: 0\n - device_name: {get_param: [vmt_block_device_names, 1]}\n volume_id: {get_resource: vmt_volume_1}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: -1\n networks:\n - port: {get_resource: vmt_oam_protected_0_port}\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02vmt001.txt\n\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n" + }, + "heatFiles": [], + "vnfResources": { + "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", + "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", + "modelName": "Vf zrdm5bpxmc02092017-VF", + "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", + "description": "Demo", + "orchestrationMode": "HEAT", + "modelVersion": "1.0", + "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" + }, + "modelInvariantUuid": "1e099992-6222-41a9-acde-5a8abb690775", + "base": false + } + }, + { + "modelCustomizationUuid": "e38906fa-717c-49b0-b391-e6ec12b50c4a", + "label": "pxmc_mmn", + "minInstances": 0, + "initialCount": 0, + "heatEnvironment": { + "artifactUuid": "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737", + "name": "pxmc_mmn.env", + "description": "Auto-generated HEAT Environment deployment artifact", + "environment": "parameters:\n cinder_delete_on_termination_false: \n cinder_delete_on_termination_true: \n mmn_arch_volume_id_2: \n mmn_backup_volume_id_3: \n mmn_block_device_names: \n mmn_data_volume_id_1: \n mmn_flavor_name: \n mmn_misc_volume_id_4: \n mmn_name_0: \n mmn_oam_protected_ip_0: \n mmn_volume_image_name_0: \n mmn_volume_name_0: \n mmn_volume_size_0: \n oam_protected_net_name: \n sec_grp_msp_id: \n vf_module_id: \n vnf_id: \n", + "artifactChecksum": "ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ=", + "version": "2" + }, + "vfModule": { + "modelUUID": "a8cb1182-9b6d-46f8-b06b-ded4fe69e10d", + "modelInvariantUUID": "8e53c069-b2f0-437a-9c00-21cbc5c8f081", + "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_mmn..module-2", + "modelVersion": "1", + "isBase": 0, + "volumeHeatTemplate": { + "artifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "templateName": "pxmc_mmn_volume.yaml", + "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates MSP MMN Cinder Volumes under MobiSupport Tenant\n\nparameters:\n mmn_volume_name_1:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_2:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_3:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_4:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_size_1:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_2:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_3:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_4:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\nresources:\n mmn_data_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_1}\n size: {get_param: mmn_volume_size_1}\n \n mmn_arch_volume_2:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_2}\n size: {get_param: mmn_volume_size_2}\n \n mmn_backup_volume_3:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_3}\n size: {get_param: mmn_volume_size_3}\n \n mmn_misc_volume_4:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_4}\n size: {get_param: mmn_volume_size_4}\n\noutputs:\n mmn_data_volume_id_1:\n description: msp mmn data volume 1\n value: {get_resource: mmn_data_volume_1}\n \n mmn_arch_volume_id_2:\n description: msp mn arch volume 2\n value: {get_resource: mmn_arch_volume_2}\n \n mmn_backup_volume_id_3:\n description: msp mn backup volume 3\n value: {get_resource: mmn_backup_volume_3}\n \n mmn_misc_volume_id_4:\n description: msp mn volume 4\n value: {get_resource: mmn_misc_volume_4}\n", + "timeoutMinutes": 120, + "version": "2", + "description": "created from csar", + "artifactChecksum": "MzA5MGY5ODQ0NDY5MDhiMDM3YjFlNGIwNzJkNjFhOTI=", + "parameters": [ + { + "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "paramName": "mmn_volume_name_2", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "paramName": "mmn_volume_size_2", + "required": true, + "paramType": "number" + }, + { + "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "paramName": "mmn_volume_name_1", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "paramName": "mmn_volume_size_1", + "required": true, + "paramType": "number" + }, + { + "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "paramName": "mmn_volume_name_4", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "paramName": "mmn_volume_name_3", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "paramName": "mmn_volume_size_4", + "required": true, + "paramType": "number" + }, + { + "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", + "paramName": "mmn_volume_size_3", + "required": true, + "paramType": "number" + } + ], + "childTemplates": [], + "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates MSP MMN Cinder Volumes under MobiSupport Tenant\n\nparameters:\n mmn_volume_name_1:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_2:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_3:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_4:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_size_1:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_2:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_3:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_4:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\nresources:\n mmn_data_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_1}\n size: {get_param: mmn_volume_size_1}\n \n mmn_arch_volume_2:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_2}\n size: {get_param: mmn_volume_size_2}\n \n mmn_backup_volume_3:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_3}\n size: {get_param: mmn_volume_size_3}\n \n mmn_misc_volume_4:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_4}\n size: {get_param: mmn_volume_size_4}\n\noutputs:\n mmn_data_volume_id_1:\n description: msp mmn data volume 1\n value: {get_resource: mmn_data_volume_1}\n \n mmn_arch_volume_id_2:\n description: msp mn arch volume 2\n value: {get_resource: mmn_arch_volume_2}\n \n mmn_backup_volume_id_3:\n description: msp mn backup volume 3\n value: {get_resource: mmn_backup_volume_3}\n \n mmn_misc_volume_id_4:\n description: msp mn volume 4\n value: {get_resource: mmn_misc_volume_4}\n" + }, + "moduleHeatTemplate": { + "artifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "templateName": "pxmc_mmn.yaml", + "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus vMSP MMN stack.\n\nparameters:\n mmn_name_0:\n type: string\n label: MSP MMN server names\n description: name of the MSP MMN instances\n mmn_flavor_name:\n type: string\n label: MSP MMN flavor name\n description: MSP MMN flavor name\n# mmn_image_name:\n# type: string\n# label: MSP MMN image name\n# description: MSP MMN image name\n# availability_zone_0:\n# type: string\n# label: MSP MMN availability zones\n# description: MSP MMN availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n mmn_oam_protected_ip_0:\n type: string\n label: MSP MMN OAM IP Addresses\n description: MSP MMN OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP MMN OAM net name\n description: MSP MMN OAM net name\n mmn_volume_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n mmn_volume_size_0:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n mmn_volume_image_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume image name\n description: Mobisupport MSP MMN Cinder Volume image name\n mmn_data_volume_id_1:\n type: string\n label: MSP MMN Volume id 1\n description: MSP MMN Volume id 1\n mmn_arch_volume_id_2:\n type: string\n label: MSP MMN Volume id 2\n description: MSP MMN Volume id 2\n mmn_backup_volume_id_3:\n type: string\n label: MSP MMN Volume id 3\n description: MSP MMN Volume id 3\n mmn_misc_volume_id_4:\n type: string\n label: MSP MMN Volume id 4\n description: MSP MMN Volume id 4\n mmn_block_device_names:\n type: comma_delimited_list\n label: MSP MMN Block Device Names\n description: MSP MMN Block Device Names\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP MMN VNF ID\n description: MSP MMN VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF module instance\n\nresources:\n################ Cinder Volume ########################\n mmn_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_0}\n size: {get_param: mmn_volume_size_0}\n image: {get_param: mmn_volume_image_name_0}\n\n################ Server ##############################\n mmn_zrdm5bpxmc02mmn_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: mmn_name_0}\n# image: {get_param: mmn_image_name}\n flavor: {get_param: mmn_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2:\n - device_name: { get_param: [mmn_block_device_names, 0] }\n volume_id: { get_resource: mmn_volume_0 }\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n networks:\n - port: { get_resource: mmn_oam_protected_0_port }\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02mmn001.txt\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n\n################ Ports ##############################\n mmn_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: mmn_oam_protected_ip_0}}]\n security_groups: [{ get_param: sec_grp_msp_id }]\n replacement_policy: AUTO\n\n################ Volume Attachment ##############################\n volume_attachment_vdb:\n type: OS::Cinder::VolumeAttachment\n depends_on: mmn_zrdm5bpxmc02mmn_0\n properties:\n volume_id: { get_param: mmn_data_volume_id_1 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdb\n\n volume_attachment_vdc:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdb\n properties:\n volume_id: { get_param: mmn_arch_volume_id_2 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdc\n\n volume_attachment_vdd:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdc\n properties:\n volume_id: { get_param: mmn_backup_volume_id_3 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdd\n\n volume_attachment_vde:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdd\n properties:\n volume_id: { get_param: mmn_misc_volume_id_4 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vde\n", + "timeoutMinutes": 120, + "version": "1", + "description": "created from csar", + "artifactChecksum": "YmNiYTU5YTM4ODVhYTlhODc5NGMwNWZkZjI5MTRmNTE=", + "parameters": [ + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "vnf_id", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_block_device_names", + "required": true, + "paramType": "comma_delimited_list" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_name_0", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_arch_volume_id_2", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_volume_image_name_0", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "cinder_delete_on_termination_false", + "required": true, + "paramType": "boolean" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_oam_protected_ip_0", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_data_volume_id_1", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_backup_volume_id_3", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "vf_module_id", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "sec_grp_msp_id", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_volume_size_0", + "required": true, + "paramType": "number" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "cinder_delete_on_termination_true", + "required": true, + "paramType": "boolean" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_volume_name_0", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "oam_protected_net_name", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_misc_volume_id_4", + "required": true, + "paramType": "string" + }, + { + "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", + "paramName": "mmn_flavor_name", + "required": true, + "paramType": "string" + } + ], + "childTemplates": [], + "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus vMSP MMN stack.\n\nparameters:\n mmn_name_0:\n type: string\n label: MSP MMN server names\n description: name of the MSP MMN instances\n mmn_flavor_name:\n type: string\n label: MSP MMN flavor name\n description: MSP MMN flavor name\n# mmn_image_name:\n# type: string\n# label: MSP MMN image name\n# description: MSP MMN image name\n# availability_zone_0:\n# type: string\n# label: MSP MMN availability zones\n# description: MSP MMN availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n mmn_oam_protected_ip_0:\n type: string\n label: MSP MMN OAM IP Addresses\n description: MSP MMN OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP MMN OAM net name\n description: MSP MMN OAM net name\n mmn_volume_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n mmn_volume_size_0:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n mmn_volume_image_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume image name\n description: Mobisupport MSP MMN Cinder Volume image name\n mmn_data_volume_id_1:\n type: string\n label: MSP MMN Volume id 1\n description: MSP MMN Volume id 1\n mmn_arch_volume_id_2:\n type: string\n label: MSP MMN Volume id 2\n description: MSP MMN Volume id 2\n mmn_backup_volume_id_3:\n type: string\n label: MSP MMN Volume id 3\n description: MSP MMN Volume id 3\n mmn_misc_volume_id_4:\n type: string\n label: MSP MMN Volume id 4\n description: MSP MMN Volume id 4\n mmn_block_device_names:\n type: comma_delimited_list\n label: MSP MMN Block Device Names\n description: MSP MMN Block Device Names\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP MMN VNF ID\n description: MSP MMN VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF module instance\n\nresources:\n################ Cinder Volume ########################\n mmn_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_0}\n size: {get_param: mmn_volume_size_0}\n image: {get_param: mmn_volume_image_name_0}\n\n################ Server ##############################\n mmn_zrdm5bpxmc02mmn_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: mmn_name_0}\n# image: {get_param: mmn_image_name}\n flavor: {get_param: mmn_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2:\n - device_name: { get_param: [mmn_block_device_names, 0] }\n volume_id: { get_resource: mmn_volume_0 }\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n networks:\n - port: { get_resource: mmn_oam_protected_0_port }\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02mmn001.txt\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n\n################ Ports ##############################\n mmn_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: mmn_oam_protected_ip_0}}]\n security_groups: [{ get_param: sec_grp_msp_id }]\n replacement_policy: AUTO\n\n################ Volume Attachment ##############################\n volume_attachment_vdb:\n type: OS::Cinder::VolumeAttachment\n depends_on: mmn_zrdm5bpxmc02mmn_0\n properties:\n volume_id: { get_param: mmn_data_volume_id_1 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdb\n\n volume_attachment_vdc:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdb\n properties:\n volume_id: { get_param: mmn_arch_volume_id_2 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdc\n\n volume_attachment_vdd:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdc\n properties:\n volume_id: { get_param: mmn_backup_volume_id_3 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdd\n\n volume_attachment_vde:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdd\n properties:\n volume_id: { get_param: mmn_misc_volume_id_4 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vde\n" + }, + "heatFiles": [], + "vnfResources": { + "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", + "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", + "modelName": "Vf zrdm5bpxmc02092017-VF", + "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", + "description": "Demo", + "orchestrationMode": "HEAT", + "modelVersion": "1.0", + "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" + }, + "modelInvariantUuid": "8e53c069-b2f0-437a-9c00-21cbc5c8f081", + "base": false + } + } + ], + "vnfResource": { + "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", + "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", + "modelName": "Vf zrdm5bpxmc02092017-VF", + "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", + "description": "Demo", + "orchestrationMode": "HEAT", + "modelVersion": "1.0", + "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" + } + } + ], + "allotedCustomizations": [], + "recipes": { + + }, + "csar": { + "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22", + "name": "service-VfZrdm5bpxmc02092017Service-csar.csar", + "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=", + "url": "service-VfZrdm5bpxmc02092017Service-csar.csar", + "description": "TOSCA definition package of the asset", + "version": "1" + } +} diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/WorkflowBpmn.json b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/WorkflowBpmn.json new file mode 100644 index 0000000000..68204ac350 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/WorkflowBpmn.json @@ -0,0 +1,20 @@ +{ + "serviceName": "Vf zrdm5bpxmc02092017-Service", + "serviceInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", + "serviceUUID": "bad955c3-29b2-4a27-932e-28e942cc6480", + "serviceVersion": "1.0", + "serviceArtifacts": + [{ + "artifactName": "service-CxSvc-csar.csar", + "artifactType": "Workflow", + "artifactURL": "service-CxSvc-csar.csar", + "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22", + "artifactVersion": "1" + }] + , + "serviceDescription": "Demo", + "distributionID": "a2872f55-8628-4486-8548-7b132c9a47db" +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar Binary files differnew file mode 100644 index 0000000000..9add57f1dd --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-VfZrdm5bpxmc02092017Service-csar.csar b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-VfZrdm5bpxmc02092017Service-csar.csar Binary files differnew file mode 100644 index 0000000000..69b1c23404 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-VfZrdm5bpxmc02092017Service-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/testStructure.json b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/testStructure.json new file mode 100644 index 0000000000..db95690064 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/testStructure.json @@ -0,0 +1,20 @@ +{ + "distributionID": "a2872f55-8628-4486-8548-7b132c9a47db", + "serviceName": "Service-CxSvc", + "serviceVersion": "1.0", + "serviceUUID": "bad955c3-29b2-4a27-932e-28e942cc6480", + "serviceInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", + "serviceDescription": "Demo", + "serviceArtifacts": [ + { + "artifactName": "service-CxSvc-csar.csar", + "artifactVersion": "1", + "artifactType": "Workflows", + "artifactDescription": "Workflows Container", + "artifactTimeout": "0", + "artifactURL": "service-CxSvc-csar.csar", + "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22", + "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=" + } + ] +} diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 83714ed022..456b8ae074 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -207,10 +207,6 @@ </dependencyManagement> <dependencies> <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - </dependency> - <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-engine</artifactId> </dependency> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index cae80e9137..3e451a5a4a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -25,7 +25,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.rest.APIResponse; import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig -import org.onap.so.logger.MessageEnum +import org.springframework.web.util.UriUtils import org.onap.so.logger.MsoLogger class AaiUtil { @@ -43,6 +43,8 @@ class AaiUtil { public AaiUtil(AbstractServiceTaskProcessor taskProcessor) { this.taskProcessor = taskProcessor } + public AaiUtil() { + } public String getNetworkGenericVnfEndpoint(DelegateExecution execution) { String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) @@ -87,6 +89,12 @@ class AaiUtil { return uri } + public String getNetworkDeviceUri(DelegateExecution execution) { + def uri = getUri(execution, 'device') + msoLogger.debug('AaiUtil.getNetworkDeviceUri() - AAI URI: ' + uri) + return uri + } + public String getBusinessCustomerUri(DelegateExecution execution) { def uri = getUri(execution, 'customer') msoLogger.debug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri) @@ -109,7 +117,7 @@ class AaiUtil { } //public String getBusinessCustomerUriv7(DelegateExecution execution) { - // // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) + // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) // def uri = getUri(execution, 'Customer') // msoLogger.debug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri) // return uri @@ -178,9 +186,30 @@ class AaiUtil { (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}") } + public String getMainProcessKey(DelegateExecution execution) { + DelegateExecution exec = execution + + while (true) { + DelegateExecution parent = exec.getSuperExecution() + + if (parent == null) { + parent = exec.getParent() + + if (parent == null) { + break + } + } + + exec = parent + } + + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(exec.getProcessDefinitionId()).getKey() + } + public String getUri(DelegateExecution execution, resourceName) { - def processKey = taskProcessor.getMainProcessKey(execution) + def processKey = getMainProcessKey(execution) //set namespace setNamespace(execution) @@ -656,9 +685,9 @@ class AaiUtil { private def getPInterface(DelegateExecution execution, String aai_uri) { - String namespace = getNamespaceFromUri(aai_uri) + String namespace = getNamespaceFromUri(execution, aai_uri) String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = ${aai_endpoint}${aai_uri} + String serviceAaiPath = aai_endpoint + aai_uri APIResponse response = executeAAIGetCall(execution, serviceAaiPath) return new XmlParser().parseText(response.getResponseBodyAsString()) @@ -680,58 +709,102 @@ class AaiUtil { String aai_uri = '/aai/v14/network/logical-links' String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = ${aai_endpoint}${aai_uri} + String serviceAaiPath = aai_endpoint + aai_uri APIResponse response = executeAAIGetCall(execution, serviceAaiPath) def logicalLinks = new XmlParser().parseText(response.getResponseBodyAsString()) - logicalLinks."logical-links".find { link -> - def pInterface = [] + logicalLinks."logical-link".each { link -> + def isRemoteLink = false + def pInterfaces = [] def relationship = link."relationship-list"."relationship" - relationship.each { - if ("p-interface".compareToIgnoreCase(it."related-to")) { - pInterface.add(it) + relationship.each { rel -> + if ("ext-aai-network".compareToIgnoreCase("${rel."related-to"[0]?.text()}") == 0) { + isRemoteLink = true + } + if ("p-interface".compareToIgnoreCase("${rel."related-to"[0]?.text()}") == 0) { + pInterfaces.add(rel) } } - if (pInterface.size() == 2) { + + // if remote link then process + if (isRemoteLink) { + + // find remote p interface def localTP = null def remoteTP = null - if (pInterface[0]."related-link".contains("ext-aai-networks")) { - remoteTP = pInterface[0] - localTP = pInterface[1] - } + def pInterface0 = pInterfaces[0] + def pIntfUrl = "${pInterface0."related-link"[0].text()}" - if (pInterface[1]."related-link".contains("ext-aai-networks")) { - localTP = pInterface[0] - remoteTP = pInterface[1] + if (isRemotePInterface(execution, pIntfUrl)) { + remoteTP = pInterfaces[0] + localTP = pInterfaces[1] + } else { + localTP = pInterfaces[0] + remoteTP = pInterfaces[1] } if (localTP != null && remoteTP != null) { // give local tp - var intfLocal = getPInterface(execution, localTP."related-link") - tpInfotpInfo.put("local-access-node-id", localTP."related-link".split("/")[6]) + def tpUrl = "${localTP."related-link"[0]?.text()}" + def intfLocal = getPInterface(execution, "${localTP?."related-link"[0]?.text()}") + tpInfo.put("local-access-node-id", tpUrl.split("/")[6]) - def networkRef = intfLocal."network-ref".split("/") - tpInfo.put("local-access-provider-id", networkRef[1]) - tpInfo.put("local-access-client-id", networkRef[3]) - tpInfo.put("local-access-topology-id", networkRef[5]) - tpInfo.put("local-access-ltp-id", localTP."interface-name") + def networkRef = "${intfLocal."network-ref"[0]?.text()}".split("/") + if (networkRef.size() == 6) { + tpInfo.put("local-access-provider-id", networkRef[1]) + tpInfo.put("local-access-client-id", networkRef[3]) + tpInfo.put("local-access-topology-id", networkRef[5]) + } + def ltpIdStr = tpUrl?.substring(tpUrl?.lastIndexOf("/") + 1) + if (ltpIdStr?.contains("-")) { + tpInfo.put("local-access-ltp-id", ltpIdStr?.substring(ltpIdStr?.lastIndexOf("-") + 1)) + } - // give local tp - var intfRemote = getPInterface(execution, remoteTP."related-link") - tpInfo.put("remote-access-node-id", remoteTP."related-link".split("/")[6]) - def networkRefRemote = intfRemote."network-ref".split("/") - tpInfo.put("remote-access-provider-id", networkRefRemote[1]) - tpInfo.put("remote-access-client-id", networkRefRemote[3]) - tpInfo.put("remote-access-topology-id", networkRefRemote[5]) - tpInfo.put("remote-access-ltp-id", remoteTP."interface-name") + // give remote tp + tpUrl = "${remoteTP."related-link"[0]?.text()}" + def intfRemote = getPInterface(execution, "${remoteTP."related-link"[0].text()}") + tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]) + + def networkRefRemote = "${intfRemote."network-ref"[0]?.text()}".split("/") + + if (networkRefRemote.size() == 6) { + tpInfo.put("remote-access-provider-id", networkRefRemote[1]) + tpInfo.put("remote-access-client-id", networkRefRemote[3]) + tpInfo.put("remote-access-topology-id", networkRefRemote[5]) + } + def ltpIdStrR = tpUrl?.substring(tpUrl?.lastIndexOf("/") + 1) + if (ltpIdStrR?.contains("-")) { + tpInfo.put("remote-access-ltp-id", ltpIdStrR?.substring(ltpIdStr?.lastIndexOf("-") + 1)) + } + return tpInfo } } } return tpInfo } + + // this method check if pInterface is remote + private def isRemotePInterface(DelegateExecution execution, String uri) { + def aai_uri = uri.substring(0, uri.indexOf("/p-interfaces")) + + String namespace = getNamespaceFromUri(execution, aai_uri) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = aai_endpoint + aai_uri + + APIResponse response = executeAAIGetCall(execution, serviceAaiPath) + def pnf = new XmlParser().parseText(response.getResponseBodyAsString()) + + def relationship = pnf."relationship-list"."relationship" + relationship.each { + if ("ext-aai-network".compareToIgnoreCase("${it."related-to"[0]?.text()}") == 0) { + return true + } + } + return false + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index 1e2a703e70..0692e5022a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -755,8 +755,6 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) { try { String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) - utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) - def encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValueDB",encodedString) } catch (IOException ex) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index 8b786bc152..bcd740eae9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -43,7 +43,6 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ execution.setVariable("CVGN_queryVolumeGroupResponseCode",null) execution.setVariable("CVGN_queryVolumeGroupResponse","") execution.setVariable("CVGN_ResponseCode",null) -// execution.setVariable("CVGN_ErrorResponse","") execution.setVariable("RollbackData", null) } @@ -125,10 +124,6 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the A&AI query returns a response code other than 200/404 public void handleAAIQueryFailure(DelegateExecution execution) { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse")); - //String processKey = getProcessKey(execution); - //WorkflowException exception = new WorkflowException(processKey, 5000, - //execution.getVariable("CVGN_queryVolumeGroupResponse")) - //execution.setVariable("WorkflowException", exception) } // generates a WorkflowException if the volume group name does not match AAI record for this volume group @@ -137,16 +132,6 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ " is not associated with " + execution.getVariable("CVGN_volumeGroupName") msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorNotAssociated, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) - //String processKey = getProcessKey(execution); - //WorkflowException exception = new WorkflowException(processKey, 1002, - // errorNotAssociated) - //execution.setVariable("WorkflowException", exception) } - // sends a successful WorkflowResponse - public void reportSuccess(DelegateExecution execution) { - msoLogger.debug("Sending 200 back to the caller") - def responseXML = "" - execution.setVariable("WorkflowResponse", responseXML) - } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 2c2cd8269c..7d4adaea58 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -37,9 +37,9 @@ class ExternalAPIUtil { public MsoUtils utils = new MsoUtils() ExceptionUtil exceptionUtil = new ExceptionUtil() - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExternalAPIUtil.class) - + public static final String PostServiceOrderRequestsTemplate = "{\n" + "\t\"externalId\": <externalId>,\n" + @@ -83,6 +83,8 @@ class ExternalAPIUtil { "\t} \n" + "}" + public ExternalAPIUtil() { + } // public String getUri(DelegateExecution execution, resourceName) { // diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 35e68bb79f..70f91671a8 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -24,8 +24,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.bpmn.core.domain.CloudFlavor + import org.onap.so.bpmn.core.domain.InventoryType import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ResourceType @@ -33,7 +32,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger +import org.onap.so.db.catalog.beans.CloudIdentity +import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.rest.APIResponse import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig @@ -52,7 +52,6 @@ import static org.onap.so.bpmn.common.scripts.GenericUtils.* */ class OofHoming extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofHoming.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() OofUtils oofUtils = new OofUtils(this) @@ -114,10 +113,7 @@ class OofHoming extends AbstractServiceTaskProcessor { 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) { utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue, @@ -156,8 +152,8 @@ class OofHoming extends AbstractServiceTaskProcessor { execution.setVariable("oofRequest", oofRequest) utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled) - String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution); - String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution); + String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution) + String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution) String url = host + endpoint utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled) @@ -240,30 +236,12 @@ class OofHoming extends AbstractServiceTaskProcessor { } resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) - // TODO Deal with Placement Solutions & Assignment Info here JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") - Integer arrayIndex = 0 - Integer flavorsIndex = null - Boolean foundFlavors = false - String flavors = null - Map<String, String> flavorsMap = null - ArrayList<CloudFlavor> flavorsArrayList = new ArrayList<CloudFlavor>() + String oofDirectives = null assignmentArr.each { element -> JSONObject jsonObject = new JSONObject(element.toString()) - if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "flavors") { - flavors = jsonUtil.getJsonRawValue(jsonObject.toString(), "value") - foundFlavors = true - flavorsIndex = arrayIndex - } else { - arrayIndex += 1 - } - } - if (foundFlavors) { - assignmentArr.remove(flavorsIndex) - flavorsMap = jsonUtil.jsonStringToMap(execution, flavors.toString()) - flavorsMap.each { label, flavor -> - CloudFlavor cloudFlavor = new CloudFlavor(label, flavor) - flavorsArrayList.add(cloudFlavor) + if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "oof_directives") { + oofDirectives = jsonUtil.getJsonRawValue(jsonObject.toString(), "value") } } Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, @@ -272,10 +250,26 @@ class OofHoming extends AbstractServiceTaskProcessor { String cloudRegionId = assignmentMap.get("locationId") resource.getHomingSolution().setCloudOwner(cloudOwner) resource.getHomingSolution().setCloudRegionId(cloudRegionId) - if (flavorsArrayList != null && flavorsArrayList.size != 0) { - resource.getHomingSolution().setFlavors(flavorsArrayList) - execution.setVariable(cloudRegionId + "_flavorList", flavorsArrayList) - utils.log("DEBUG", "***** _flavorList is: " + flavorsArrayList.toString() + + + CloudSite cloudSite = new CloudSite(); + cloudSite.setId(cloudRegionId) + cloudSite.setRegionId(cloudRegionId) + String orchestrator = execution.getVariable("orchestrator") + if ((orchestrator != null) || (orchestrator != "")) { + cloudSite.setOrchestrator(orchestrator) + } + + CloudIdentity cloudIdentity = new CloudIdentity(); + cloudIdentity.setId(cloudRegionId); + cloudIdentity.setIdentityUrl("/api/multicloud /v1/" + cloudOwner + "/" + cloudRegionId + "/infra_workload") + cloudSite.setIdentityService(cloudIdentity); + + // Set cloudsite in catalog DB here + oofUtils.createCloudSiteCatalogDb(cloudSite) + + if (oofDirectives != null && oofDirectives != "") { + resource.getHomingSolution().setOofDirectives(oofDirectives) + utils.log("DEBUG", "***** OofDirectives is: " + oofDirectives + " *****", "true") } 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 8ce633845b..d95795906f 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 @@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts 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.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.domain.HomingSolution import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.Resource @@ -33,22 +33,32 @@ import org.onap.so.bpmn.core.domain.ServiceInstance import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger - -import java.lang.reflect.Array +import org.onap.so.db.catalog.beans.CloudSite +import org.onap.so.rest.APIResponse +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.springframework.http.HttpEntity +import org.springframework.http.HttpHeaders +import org.springframework.http.HttpMethod +import org.springframework.http.ResponseEntity +import org.springframework.http.client.BufferingClientHttpRequestFactory +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory +import org.springframework.web.client.RestTemplate +import org.springframework.web.util.UriComponentsBuilder + +import javax.ws.rs.core.MediaType +import javax.ws.rs.core.Response +import javax.xml.ws.http.HTTPException import static org.onap.so.bpmn.common.scripts.GenericUtils.* class OofUtils { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofUtils.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() private AbstractServiceTaskProcessor utils - public MsoUtils msoUtils = new MsoUtils() - - public OofUtils(AbstractServiceTaskProcessor taskProcessor) { + OofUtils(AbstractServiceTaskProcessor taskProcessor) { this.utils = taskProcessor } @@ -466,4 +476,39 @@ class OofUtils { if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)} return candidatesJson } + /** + * This method creates a cloudsite in catalog database. + * + * @param CloudSite cloudSite + * + * @return void + */ + Void createCloudSiteCatalogDb(CloudSite cloudSite, DelegateExecution execution) { + + String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution) + String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution) + String uri = "/cloudSite" + + HttpHeaders headers = new HttpHeaders() + + headers.set(HttpHeaders.AUTHORIZATION, auth) + headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) + headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(endpoint + uri) + HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers) + RESTConfig config = new RESTConfig(endpoint + uri) + RESTClient client = new RESTClient(config).addAuthorizationHeader(auth). + addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + APIResponse response = client.httpPost(request.getBody().toString()) + + int responseCode = response.getStatusCode() + logDebug("CatalogDB response code is: " + responseCode, isDebugEnabled) + String syncResponse = response.getResponseBodyAsString() + logDebug("CatalogDB response is: " + syncResponse, isDebugEnabled) + + if(responseCode != 202){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.") + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy index 9b144323c0..5ff49fbae8 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy @@ -322,7 +322,6 @@ class SniroUtils{ } if((isBlank(placements) || placements.equalsIgnoreCase("[]")) && (isBlank(licenses) || licenses.equalsIgnoreCase("[]"))){ msoLogger.debug("Sniro Async Response does not contain: licenses or placements") - exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Sniro Async Callback Response does not contain: licenses or placements") }else{ return } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java index c3511e69a4..78f3e96978 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java @@ -20,13 +20,14 @@ package org.onap.so.bpmn.common.baseclient; +import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.http.client.BufferingClientHttpRequestFactory; -import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; @@ -59,11 +60,12 @@ public class BaseClient<I,O> { public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { return run(data, HttpMethod.POST, typeRef, uriVariables); } - + public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader()); RestTemplate restTemplate = new RestTemplate(); - restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); + restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); + restTemplate.getInterceptors().add(new SpringClientFilter()); ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables); return responseEntity.getBody(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index bb2ad9507f..35bd25fabf 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -191,7 +191,9 @@ public class ResourceRequestBuilder { HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType()); - File csarFile = new File(System.getProperty("mso.config.path") + "ASDC/" + map.get("name")); + String filePath = System.getProperty("mso.config.path") + "ASDC/" + map.get("version") + "/" + map.get("name"); + + File csarFile = new File(filePath); if(!csarFile.exists()) { throw new Exception("csar file does not exist."); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java index 24c0548641..5e49ffcf40 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java @@ -47,7 +47,8 @@ public class RequestParameters implements Serializable { private List<Map<String, Object>> userParams = new ArrayList<>(); @JsonProperty("aLaCarte") private Boolean aLaCarte; - + @JsonProperty("payload") + private String payload; public String getSubscriptionServiceType() { return subscriptionServiceType; @@ -68,6 +69,13 @@ public class RequestParameters implements Serializable { public Boolean isaLaCarte() { return aLaCarte; } + + public String getPayload(){ + return payload; + } + public void setPayload(String value){ + this.payload = value; + } public List<Map<String, Object>> getUserParams() { return userParams; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 6d5fb2f825..eb4f4ca0d5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -190,14 +190,19 @@ public class BBInputSetup implements JavaDelegate { if(requestDetails == null) { requestDetails = bbInputSetupUtils.getRequestDetails(requestId); } - ModelType modelType = requestDetails.getModelInfo().getModelType(); - if (aLaCarte && modelType.equals(ModelType.service)) { - return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); - } else if (aLaCarte && !modelType.equals(ModelType.service)) { - return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, - vnfType); - } else { - return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + if (requestDetails.getModelInfo() == null) { + return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); + } + else { + ModelType modelType = requestDetails.getModelInfo().getModelType(); + if (aLaCarte && modelType.equals(ModelType.service)) { + return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); + } else if (aLaCarte && !modelType.equals(ModelType.service)) { + return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, + vnfType); + } else { + return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } } } @@ -236,6 +241,25 @@ public class BBInputSetup implements JavaDelegate { throw new Exception("Could not find relevant information for related Service Instance"); } } + + protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB, + RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction, + String resourceId) throws Exception { + ServiceInstance serviceInstance = new ServiceInstance(); + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + serviceInstance.setServiceInstanceId(serviceInstanceId); + + List<GenericVnf> genericVnfs = serviceInstance.getVnfs(); + + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + + GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf); + genericVnfs.add(genericVnf); + + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, new Customer()); + + } protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType) @@ -790,7 +814,9 @@ public class BBInputSetup implements JavaDelegate { customer = mapCustomer(globalCustomerId, subscriptionServiceType); } outputBB.setServiceInstance(serviceInstance); - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + if (customer.getServiceSubscription() != null) { + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + } outputBB.setCustomer(customer); return outputBB; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 877d5bb88f..0c7eb0973f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -341,6 +341,7 @@ public class BBInputSetupMapperLayer { requestParams.setaLaCarte(requestParameters.getALaCarte()); requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); requestParams.setUserParams(requestParameters.getUserParams()); + requestParams.setPayload(requestParameters.getPayload()); return requestParams; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index 7a56ab88ab..70d523eab4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -42,7 +42,7 @@ public class ExecuteBuildingBlockRainyDay { @Autowired private CatalogDbClient catalogDbClient; - private static final String ASTERISK = "ASTERISK"; + private static final String ASTERISK = "*"; public void setRetryTimer(DelegateExecution execution) { try { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index c74e81506c..42da72528f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -7,9 +7,9 @@ * 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. @@ -37,9 +37,9 @@ public class ExceptionBuilder { String msg = "Exception in %s.%s "; try{ msoLogger.error(exception); - + String errorVariable = "Error%s%s"; - + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); for (StackTraceElement traceElement : trace) { if (!traceElement.getClassName().equals(this.getClass().getName()) && !traceElement.getClassName().equals(Thread.class.getName())) { @@ -49,7 +49,7 @@ public class ExceptionBuilder { break; } } - + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn index 67bd961844..63c867f3c7 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true"> <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> @@ -56,6 +56,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry> + <camunda:entry key="X-ONAP-RequestID">#{CMSO_request_id}</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="method">POST</camunda:inputParameter> @@ -88,7 +89,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ExclusiveGateway_7" targetRef="BuildErrorMessage" /> <bpmn2:boundaryEvent id="BoundaryEvent_7" name="" attachedToRef="updateInfraRequest"> <bpmn2:outgoing>SequenceFlow_0mipf25</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" /> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" /> </bpmn2:boundaryEvent> <bpmn2:endEvent id="EndEvent_1"> <bpmn2:incoming>SequenceFlow_1pzb94j</bpmn2:incoming> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn index c59564b1e3..990863ec93 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="FalloutHandler" name="Fallout Handler" isExecutable="true"> <bpmn2:parallelGateway id="ParallelGateway_1"> <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> @@ -139,6 +139,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraRespons <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry> + <camunda:entry key="X-ONAP-RequestID">#{FH_request_id}</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload"> @@ -168,7 +169,7 @@ return updateRequestInfra.updateRequestInfraPayload(execution)]]></camunda:scrip </bpmn2:sequenceFlow> <bpmn2:boundaryEvent id="BoundaryEvent_3" name="Connect Fault" attachedToRef="ServiceTask_2"> <bpmn2:outgoing>SequenceFlow_80</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_2" /> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_2" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" /> </bpmn2:boundaryEvent> <bpmn2:sequenceFlow id="SequenceFlow_80" name="" sourceRef="BoundaryEvent_3" targetRef="ScriptTask_7" /> <bpmn2:subProcess id="SubProcess_1" name="Event Handler" triggeredByEvent="true"> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy index 9b3b8c2fb0..e065ccd14f 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy @@ -22,28 +22,12 @@ package org.onap.so.bpmn.common.scripts import com.github.tomakehurst.wiremock.junit.WireMockRule -import static org.junit.Assert.*; import static org.mockito.Mockito.* - -import org.onap.so.rest.HttpHeader -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.junit.Before -import org.onap.so.bpmn.common.scripts.AaiUtil; -import org.junit.Rule; -import org.junit.Test -import org.junit.Ignore -import org.junit.runner.RunWith -import org.junit.Before; -import org.junit.Test; import org.camunda.bpm.engine.ProcessEngineServices import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl import org.camunda.bpm.engine.repository.ProcessDefinition import org.junit.Assert -import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -51,16 +35,18 @@ import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mockito import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName import org.onap.so.bpmn.core.WorkflowException import static com.github.tomakehurst.wiremock.client.WireMock.* -import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) -@Ignore class ConfirmVolumeGroupNameTest extends MsoGroovyTest { + private static final def AAA_URI = "uri_test" + private static final def AIC_CLOUD_REGION = "AicClReg_test" + private static final def VOLUME_GROUP_NAME = "volumeTestGName" + private static final def VOLUME_GROUP_ID = "vol_gr_id_test" + @Captor ArgumentCaptor<ExecutionEntity> captor= ArgumentCaptor.forClass(ExecutionEntity.class); @@ -68,6 +54,60 @@ class ConfirmVolumeGroupNameTest extends MsoGroovyTest { public WireMockRule wireMockRule = new WireMockRule(8090); @Test + void preProcessRequestSuccessful() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("ConfirmVolumeGroupName_volumeGroupId")).thenReturn(VOLUME_GROUP_ID) + when(mockExecution.getVariable("ConfirmVolumeGroupName_volumeGroupName")).thenReturn(VOLUME_GROUP_NAME) + when(mockExecution.getVariable("ConfirmVolumeGroupName_aicCloudRegion")).thenReturn(AIC_CLOUD_REGION) + + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('namespace_test') + when(mockExecution.getVariable("mso.workflow.ConfirmVolumeGroupName.aai.cloud-region.uri")).thenReturn(AAA_URI) + new ConfirmVolumeGroupName().preProcessRequest(mockExecution) + + verifyInitProcessVariables(mockExecution) + verify(mockExecution).setVariable("CVGN_volumeGroupId", VOLUME_GROUP_ID) + verify(mockExecution).setVariable("CVGN_volumeGroupName", "volumeTestGName") + verify(mockExecution).setVariable("CVGN_aicCloudRegion", AIC_CLOUD_REGION) + verify(mockExecution).setVariable("CVGN_volumeGroupGetEndpoint", + "${AAA_URI}/${AIC_CLOUD_REGION}/volume-groups/volume-group/" + VOLUME_GROUP_ID) + } + + private void verifyInitProcessVariables(ExecutionEntity mockExecution) { + verify(mockExecution).setVariable("prefix", "CVGN_") + verify(mockExecution).setVariable("CVGN_volumeGroupId", null) + verify(mockExecution).setVariable("CVGN_volumeGroupName", null) + verify(mockExecution).setVariable("CVGN_aicCloudRegion", null) + verify(mockExecution).setVariable("CVGN_volumeGroupGetEndpoint", null) + verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", false) + verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponseCode", null) + verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponse", "") + verify(mockExecution).setVariable("CVGN_ResponseCode", null) + verify(mockExecution).setVariable("RollbackData", null) + } + + @Test + void checkAAIQueryResult_volumeGroupNamesMatch() { + ExecutionEntity mockExecution = setupMock() + commonPartOfCheckAAIQueryTest(mockExecution, VOLUME_GROUP_NAME) + verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", true) + } + + @Test + void checkAAIQueryResult_volumeGroupNamesDoNotMatch() { + ExecutionEntity mockExecution = setupMock() + commonPartOfCheckAAIQueryTest(mockExecution, "grName2") + verify(mockExecution, Mockito.times(0)).setVariable("CVGN_volumeGroupNameMatches", true) + } + + private void commonPartOfCheckAAIQueryTest(ExecutionEntity mockExecution, def volumeGroupName) { + when(mockExecution.getVariable("CVGN_volumeGroupName")).thenReturn(VOLUME_GROUP_NAME) + def xml = "<volume-group-name>" + volumeGroupName + "</volume-group-name>" + when(mockExecution.getVariable("CVGN_queryVolumeGroupResponse")).thenReturn(xml) + new ConfirmVolumeGroupName().checkAAIQueryResult(mockExecution) + verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", false) + } + + @Test public void testQueryAAIForVolumeGroupId() { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 9897c04ad8..d0ecedf878 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -301,6 +301,35 @@ public class BBInputSetupTest { assertThat(actual, sameBeanAs(expected)); } + + @Test + public void testGetGBBCM() throws Exception { + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"), + GeneralBuildingBlock.class); + + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setRequestId("requestId"); + RequestDetails requestDetails = new RequestDetails(); + requestDetails.setModelInfo(null); + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(true); + requestDetails.setRequestParameters(requestParams); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setSuppressRollback(true); + requestDetails.setRequestInfo(requestInfo); + doReturn(requestDetails).when(SPY_bbInputSetupUtils).getRequestDetails(executeBB.getRequestId()); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + String resourceId = "123"; + String requestAction = "createInstance"; + doReturn(expected).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, + requestAction, resourceId); + doNothing().when(SPY_bbInputSetup).populateLookupKeyMapWithIds(any(WorkflowResourceIds.class), any()); + doReturn(null).when(bbInputSetupMapperLayer).mapAAIGenericVnfIntoGenericVnf(any(org.onap.aai.domain.yang.GenericVnf.class)); + GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, + resourceId); + + assertThat(actual, sameBeanAs(expected)); + } @Test public void testGetGBBALaCarteNonService() throws Exception { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index 2144f1c69a..0c2a95f5d1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -53,6 +53,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { private GenericVnf vnf; private BuildingBlock buildingBlock; private ExecuteBuildingBlock executeBuildingBlock; + private static final String ASTERISK = "*"; @Before public void before() { @@ -99,7 +100,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setServiceType("st1"); rainyDayHandlerStatus.setVnfType("vnft1"); rainyDayHandlerStatus.setPolicy("Rollback"); - rainyDayHandlerStatus.setWorkStep("ASTERISK"); + rainyDayHandlerStatus.setWorkStep(ASTERISK); doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*"); @@ -115,15 +116,15 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { vnf.setVnfType("vnft1"); RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); - rainyDayHandlerStatus.setErrorCode("ASTERISK"); + rainyDayHandlerStatus.setErrorCode(ASTERISK); rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB"); - rainyDayHandlerStatus.setServiceType("ASTERISK"); - rainyDayHandlerStatus.setVnfType("ASTERISK"); + rainyDayHandlerStatus.setServiceType(ASTERISK); + rainyDayHandlerStatus.setVnfType(ASTERISK); rainyDayHandlerStatus.setPolicy("Rollback"); - rainyDayHandlerStatus.setWorkStep("ASTERISK"); + rainyDayHandlerStatus.setWorkStep(ASTERISK); - doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", "ASTERISK"); - doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "ASTERISK", "ASTERISK", "ASTERISK", "ASTERISK"); + doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "st1", "vnft1", "7000", ASTERISK); + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", ASTERISK, ASTERISK, ASTERISK, ASTERISK); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json new file mode 100644 index 0000000000..8cd04fdd8e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json @@ -0,0 +1,29 @@ +{ + "requestContext": { + "source": "VID", + "mso-request-id": "requestId", + "action": "createInstance", + "requestParameters": { + "userParams": [], + "aLaCarte": true + }, + "configurationParameters": [] + }, + "orchContext": { + "is-rollback-enabled": true + }, + "cloudRegion": { + "cloud-owner": "att-aic" + }, + "userInput": null, + "customer": { + "vpn-bindings": [] + }, + "serviceInstance": { + "vnfs": [null], + "pnfs": [], + "allotted-resources": [], + "networks": [], + "configurations": [] + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java index 57e6864943..e4eb01e7fb 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java @@ -45,7 +45,7 @@ public class HomingSolution extends JsonWrapper implements Serializable { private String aicVersion; private String tenant; private VnfResource vnf; - private List<CloudFlavor> flavors; + private String oofDirectives; private License license = new License(); @@ -130,12 +130,12 @@ public class HomingSolution extends JsonWrapper implements Serializable { /** * @return a map<string, string> key is label name, value is any flavor */ - public List<CloudFlavor> getFlavors() { - return flavors; + public String getOofDirectives() { + return oofDirectives; } - public void setFlavors(List<CloudFlavor> flavors) { - this.flavors = flavors; + public void setOofDirectives(String oofDirectives) { + this.oofDirectives = oofDirectives; } public License getLicense() { diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index da24ba14fd..9ea97258ef 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -31,7 +31,6 @@ import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; import org.onap.so.logger.MsoLogger; import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException; -import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -46,19 +45,14 @@ public class WorkflowProcessor extends ProcessEngineAwareService { @Async public void startProcess( String processKey, VariableMapImpl variableMap) throws InterruptedException { - MDC.getCopyOfContextMap(); + long startTime = System.currentTimeMillis(); Map<String, Object> inputVariables = null; String processInstanceId = null; try { inputVariables = getInputVariables(variableMap); - setLogContext(processKey, inputVariables); - // This variable indicates that the flow was invoked asynchronously inputVariables.put("isAsyncProcess", "true"); - - - setLogContext(processKey, inputVariables); // Note: this creates a random businessKey if it wasn't specified. String businessKey = getBusinessKey(inputVariables); @@ -87,14 +81,6 @@ public class WorkflowProcessor extends ProcessEngineAwareService { } } - protected static void setLogContext(String processKey, - Map<String, Object> inputVariables) { - MsoLogger.setServiceName("MSO." + processKey); - if (inputVariables != null) { - MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id")); - } - } - protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) { if (inputVariables == null) { return ""; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 00ee6eb235..9b65cca6c9 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -70,9 +70,7 @@ import org.springframework.stereotype.Component; * Plugin for MSO logging and URN mapping. */ @Component -public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingAndURNMappingPlugin.class); - private static final String FSPROPKEY = "URNMapping.FileSystemLoading.Enabled"; +public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { @Autowired private LoggingParseListener loggingParseListener; @@ -198,7 +196,6 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { @Override public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) { - //injectLogExecutionListener(activity); } @Override @@ -216,9 +213,9 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { injectLogExecutionListener(timerActivity); } - @Override + @Override public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) { - //injectLogExecutionListener(activity); + } @Override @@ -298,17 +295,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { } @Override - public void notify(DelegateExecution execution) throws Exception { - logger.trace("Logging for activity---------------:" + event + ":" - + execution.getCurrentActivityName() - + ", processDefinitionId=" - + execution.getProcessDefinitionId() + ", activtyId=" - + execution.getCurrentActivityId() + ", activtyName='" - + execution.getCurrentActivityName() + "'" - + ", processInstanceId=" - + execution.getProcessInstanceId() + ", businessKey=" - + execution.getProcessBusinessKey() + ", executionId=" - + execution.getId()); + public void notify(DelegateExecution execution) throws Exception { //required for legacy groovy processing in camunda execution.setVariable("isDebugLogEnabled", "true"); if (!isBlank(execution.getCurrentActivityName())) { @@ -322,20 +309,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { .singleResult() .getName(); - if (execution.getBpmnModelElementInstance() instanceof StartEvent) { - logger.debug("Starting process: " + processName); - } - if (execution.getBpmnModelElementInstance() instanceof EndEvent) { - logger.debug("Ending process: " + processName); - } - - String serviceName = MDC.get(MsoLogger.SERVICE_NAME); - - if(serviceName != null && !serviceName.contains(processName)) - MsoLogger.setServiceName( serviceName + "." + processName); - else if(serviceName == null) - MsoLogger.setServiceName(processName); - + MsoLogger.setServiceName(processName); String requestId = (String) execution.getVariable("mso-request-id"); String svcid = (String) execution.getVariable("mso-service-instance-id"); MsoLogger.setLogContext(requestId, svcid); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index db2304d6b7..efd73ba4f2 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -30,6 +30,8 @@ import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; import org.onap.so.logger.MsoLogger; +import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -102,7 +104,7 @@ public class MSOInfrastructureApplication { @Primary public Executor asyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - + executor.setTaskDecorator(new MDCTaskDecorator()); executor.setCorePoolSize(corePoolSize); executor.setMaxPoolSize(maxPoolSize); executor.setQueueCapacity(queueCapacity); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java index 9bcc5593e2..d2dbde4843 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java @@ -38,7 +38,6 @@ import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.core.domain.AllottedResource; -import org.onap.so.bpmn.core.domain.CloudFlavor; import org.onap.so.bpmn.core.domain.HomingSolution; import org.onap.so.bpmn.core.domain.ModelInfo; import org.onap.so.bpmn.core.domain.NetworkResource; @@ -122,12 +121,133 @@ public class OofHomingIT extends BaseIntegrationTest { VnfResource vnf = new VnfResource(); vnf.setResourceId("testResourceIdVNF"); vnf.setNfFunction("testVnfFunctionName"); - ArrayList<CloudFlavor> flavors = new ArrayList<>(); - CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx"); - CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx"); - flavors.add(flavor1); - flavors.add(flavor2); - vnf.getHomingSolution().setFlavors(flavors); + vnf.getHomingSolution().setOofDirectives( + "{ \n" + + " \"directives\":[ \n" + + " { \n" + + " \"vnfc_directives\":[ \n" + + " { \n" + + " \"vnfc_id\":\"<ID of VNFC>\",\n" + + " \"directives\":[ \n" + + " { \n" + + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" + + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" + + " \"attribute_value\":\"<value such as direct/normal>\"\n" + + " },\n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" + + " \"attribute_value\":\"<value such as physnet>\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"vnf_directives\":{ \n" + + " \"directives\":[ \n" + + " { \n" + + " \"directive_name\":\"<Name of directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value>\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"directive_name\":\"<Name of directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value >\"\n" + + " },\n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value >\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"sdnc_directives\":{ \n" + + " \"directives\":[ \n" + + " { \n" + + " \"vnfc_directives\":[ \n" + + " { \n" + + " \"vnfc_id\":\"<ID of VNFC>\",\n" + + " \"directives\":[ \n" + + " { \n" + + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" + + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" + + " \"attribute_value\":\"<value such as direct/normal>\"\n" + + " },\n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" + + " \"attribute_value\":\"<value such as physnet>\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"vnf_directives\":{ \n" + + " \"directives\":[ \n" + + " { \n" + + " \"directive_name\":\"<Name of directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value>\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"directive_name\":\"<Name of directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value >\"\n" + + " },\n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value >\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + " ]\n" + + " }"); ModelInfo vnfModel = new ModelInfo(); vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF"); vnfModel.setModelInvariantUuid("testModelInvariantIdVNF"); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java index 33e444310f..748552623e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java @@ -26,7 +26,6 @@ import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.core.domain.AllottedResource; -import org.onap.so.bpmn.core.domain.CloudFlavor; import org.onap.so.bpmn.core.domain.HomingSolution; import org.onap.so.bpmn.core.domain.ModelInfo; import org.onap.so.bpmn.core.domain.NetworkResource; @@ -126,12 +125,133 @@ public class OofHomingTestIT extends BaseIntegrationTest { VnfResource vnf = new VnfResource(); vnf.setResourceId("testResourceIdVNF"); vnf.setResourceInstanceName("testVnfInstanceName"); - ArrayList<CloudFlavor> flavors = new ArrayList<>(); - CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx"); - CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx"); - flavors.add(flavor1); - flavors.add(flavor2); - vnf.getHomingSolution().setFlavors(flavors); + vnf.getHomingSolution().setOofDirectives( + "{ \n" + + " \"directives\":[ \n" + + " { \n" + + " \"vnfc_directives\":[ \n" + + " { \n" + + " \"vnfc_id\":\"<ID of VNFC>\",\n" + + " \"directives\":[ \n" + + " { \n" + + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" + + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" + + " \"attribute_value\":\"<value such as direct/normal>\"\n" + + " },\n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" + + " \"attribute_value\":\"<value such as physnet>\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"vnf_directives\":{ \n" + + " \"directives\":[ \n" + + " { \n" + + " \"directive_name\":\"<Name of directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value>\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"directive_name\":\"<Name of directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value >\"\n" + + " },\n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value >\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"sdnc_directives\":{ \n" + + " \"directives\":[ \n" + + " { \n" + + " \"vnfc_directives\":[ \n" + + " { \n" + + " \"vnfc_id\":\"<ID of VNFC>\",\n" + + " \"directives\":[ \n" + + " { \n" + + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" + + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" + + " \"attribute_value\":\"<value such as direct/normal>\"\n" + + " },\n" + + " { \n" + + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" + + " \"attribute_value\":\"<value such as physnet>\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"vnf_directives\":{ \n" + + " \"directives\":[ \n" + + " { \n" + + " \"directive_name\":\"<Name of directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value>\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " { \n" + + " \"directive_name\":\"<Name of directive>\",\n" + + " \"attributes\":[ \n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value >\"\n" + + " },\n" + + " { \n" + + " \"attribute_name\":\"<name of attribute>\",\n" + + " \"attribute_value\":\"<value >\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + " ]\n" + + " }"); ModelInfo vnfModel = new ModelInfo(); vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF"); vnfModel.setModelInvariantUuid("testModelInvariantIdVNF"); diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 9368be1575..4e36b775f5 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -18,8 +18,7 @@ <camunda.version>7.8.0</camunda.version> <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> <camunda.bpm.webapp.artifact>camunda-webapp-jboss-standalone</camunda.bpm.webapp.artifact> - <h2.version>1.4.196</h2.version> - <groovy.version>2.4.7</groovy.version> + <groovy.version>2.4.8</groovy.version> <saxon.version>9.5.1-8</saxon.version> <xmlunit.version>2.4.0</xmlunit.version> @@ -43,11 +42,6 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>${h2.version}</version> - </dependency> - <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>${groovy.version}</version> @@ -78,11 +72,6 @@ <dependencies> <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.9.3</version> - </dependency> - <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> </dependency> diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml index 98232639e6..a523c1e676 100644 --- a/bpmn/so-bpmn-building-blocks/pom.xml +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -12,7 +12,7 @@ <httpclient.version>3.1</httpclient.version> <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> <h2.version>1.4.196</h2.version> - <groovy.version>2.4.7</groovy.version> + <groovy.version>2.4.8</groovy.version> <saxon.version>9.5.1-8</saxon.version> <xmlunit.version>1.6</xmlunit.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> diff --git a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java new file mode 100644 index 0000000000..db1f7cb6f9 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.activity; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.http.HttpResponse; +import org.apache.http.StatusLine; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.springframework.stereotype.Component; + +@Component +public class DeployActivitySpecs { + private static final String ACTIVITY_FILE_LOCATION = "src/main/resources/ActivitySpec/"; + private static final String ACTIVITY_SPEC_URI = "/activityspec-api/v1.0/activity-spec"; + private static final String CONTENT_TYPE_JSON = "application/json"; + + public static void main(String[] args) throws Exception { + + if (args == null || args.length == 0) { + System.out.println("Please specify hostname argument"); + return; + } + + String hostname = args[0]; + + File dir = new File(ACTIVITY_FILE_LOCATION); + if (!dir.isDirectory()) { + System.out.println("ActivitySpec store is not a directory"); + return; + } + + for (File f : dir.listFiles()) { + String activitySpecName = f.getName(); + String errorMessage = deployActivitySpec(hostname, activitySpecName); + if (errorMessage == null) { + System.out.println("Deployed Activity Spec: " + activitySpecName); + } + else { + System.out.println("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage); + } + } + return; + } + + protected static String deployActivitySpec(String hostname, String activitySpecName) throws Exception { + String payload = new String(Files.readAllBytes(Paths.get(ACTIVITY_FILE_LOCATION + activitySpecName))); + try { + HttpClient client = HttpClientBuilder.create().build(); + + String url = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString(); + HttpPost post = new HttpPost(url); + + StringEntity input = new StringEntity(payload); + input.setContentType(CONTENT_TYPE_JSON); + post.setEntity(input); + + HttpResponse response = client.execute(post); + StatusLine statusLine = response.getStatusLine(); + + if (statusLine != null) { + if (statusLine.getStatusCode() != 200) { + return (statusLine.toString()); + } + else { + return null; + } + } + else { + return("Empty response from the remote endpoint"); + } + + } catch (Exception e) { + return e.getMessage(); + } + + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/FlowCompleteActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/FlowCompleteActivitySpec.json new file mode 100644 index 0000000000..e031c85501 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/FlowCompleteActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "FlowCompleteActivity", + "description": "Activity to Complete the BPMN Flow", + "categoryList": [ + "VNF" + ], + "inputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ], + "outputParameters": [] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFHealthCheckActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFHealthCheckActivitySpec.json new file mode 100644 index 0000000000..9f278b20c1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFHealthCheckActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFHealthCheckActivity", + "description": "Activity to HealthCheck VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFQuiesceTrafficActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFQuiesceTrafficActivitySpec.json new file mode 100644 index 0000000000..c64098dcea --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFQuiesceTrafficActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFResumeTrafficActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFResumeTrafficActivitySpec.json new file mode 100644 index 0000000000..6527f2e66d --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFResumeTrafficActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFResumeTrafficActivity", + "description": "Activity to ResumeTraffic on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFSetInMaintFlagActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFSetInMaintFlagActivitySpec.json new file mode 100644 index 0000000000..8f3211c9a9 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFSetInMaintFlagActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFSetInMaintFlagActivity", + "description": "Activity to Set InMaint Flag in A&AI", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUnsetInMaintFlagActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUnsetInMaintFlagActivitySpec.json new file mode 100644 index 0000000000..1c3f862fec --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUnsetInMaintFlagActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFUnsetInMaintFlagActivity", + "description": "Activity to Unset InMaint Flag in A&AI", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePostCheckActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePostCheckActivitySpec.json new file mode 100644 index 0000000000..722fd6e667 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePostCheckActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFUpgradePostCheckActivity", + "description": "Activity to UpgradePostCheck on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePreCheckActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePreCheckActivitySpec.json new file mode 100644 index 0000000000..bae912ee3b --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradePreCheckActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFUpgradePreCheckActivity", + "description": "Activity to UpgradePreCheck on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradeSoftwareActivitySpec.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradeSoftwareActivitySpec.json new file mode 100644 index 0000000000..606fa6cd1f --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/VNFUpgradeSoftwareActivitySpec.json @@ -0,0 +1,14 @@ +{ + "name": "VNFUpgradeSoftwareActivity", + "description": "Activity to UpgradeSoftware on VNF", + "categoryList": [ + "VNF" + ], + "inputParameters": [], + "outputParameters": [ + { + "name": "WorkflowException", + "type": "WorkflowException" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/FlowCompleteActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/FlowCompleteActivity.bpmn new file mode 100644 index 0000000000..e255689e75 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/FlowCompleteActivity.bpmn @@ -0,0 +1,49 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="FlowCompleteActivity" name="FlowCompleteActivity" isExecutable="true"> + <bpmn:startEvent id="FlowCompleteActivity_Start"> + <bpmn:outgoing>SequenceFlow_1tbhm2c</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="FlowCompleteActivity_End"> + <bpmn:incoming>SequenceFlow_10spt85</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1tbhm2c" sourceRef="FlowCompleteActivity_Start" targetRef="TaskUpdateRequestDB" /> + <bpmn:sequenceFlow id="SequenceFlow_10spt85" sourceRef="TaskUpdateRequestDB" targetRef="FlowCompleteActivity_End" /> + <bpmn:serviceTask id="TaskUpdateRequestDB" name="Update Request DB with Status" camunda:expression="${FlowCompletionTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1tbhm2c</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_10spt85</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="FlowCompleteActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="FlowCompleteActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0uee341_di" bpmnElement="FlowCompleteActivity_End"> + <dc:Bounds x="428" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="446" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1tbhm2c_di" bpmnElement="SequenceFlow_1tbhm2c"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="264" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="237" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_10spt85_di" bpmnElement="SequenceFlow_10spt85"> + <di:waypoint xsi:type="dc:Point" x="364" y="120" /> + <di:waypoint xsi:type="dc:Point" x="394" y="120" /> + <di:waypoint xsi:type="dc:Point" x="394" y="120" /> + <di:waypoint xsi:type="dc:Point" x="428" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="409" y="120" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0f1gnqq_di" bpmnElement="TaskUpdateRequestDB"> + <dc:Bounds x="264" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFHealthCheckActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFHealthCheckActivity.bpmn new file mode 100644 index 0000000000..2e97206867 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFHealthCheckActivity.bpmn @@ -0,0 +1,62 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFHealthCheckActivity" name="VNFHealthCheckActivity" isExecutable="true"> + <bpmn:startEvent id="VNFHealthCheckActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFHealthCheckActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFHealthCheckActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskHealthCheck" targetRef="VNFHealthCheckActivity_End" /> + <bpmn:serviceTask id="TaskHealthCheck" name="VNF Health Check" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionHealthCheck"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskHealthCheck" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFHealthCheckActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFHealthCheckActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFHealthCheckActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskHealthCheck"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFQuiesceTrafficActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFQuiesceTrafficActivity.bpmn new file mode 100644 index 0000000000..ac09674884 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFQuiesceTrafficActivity.bpmn @@ -0,0 +1,62 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFQuiesceTrafficActivity" name="VNFQuiesceTrafficActivity" isExecutable="true"> + <bpmn:startEvent id="VNFQuiesceTrafficActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFQuiesceTrafficActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFQuiesceTrafficActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskQuiesceTraffic" targetRef="VNFQuiesceTrafficActivity_End" /> + <bpmn:serviceTask id="TaskQuiesceTraffic" name="VNF Quiesce Traffic" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionQuiesceTraffic"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskQuiesceTraffic" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFQuiesceTrafficActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFQuiesceTrafficActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFQuiesceTrafficActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskQuiesceTraffic"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFResumeTrafficActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFResumeTrafficActivity.bpmn new file mode 100644 index 0000000000..c21072a32a --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFResumeTrafficActivity.bpmn @@ -0,0 +1,62 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFResumeTrafficActivity" name="VNFResumeTrafficActivity" isExecutable="true"> + <bpmn:startEvent id="VNFResumeTrafficActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFResumeTrafficActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFResumeTrafficActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskResumeTraffic" targetRef="VNFResumeTrafficActivity_End" /> + <bpmn:serviceTask id="TaskResumeTraffic" name="VNF Resume Traffic" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionResumeTraffic"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskResumeTraffic" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFResumeTrafficActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFResumeTrafficActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFResumeTrafficActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskResumeTraffic"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetInMaintFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetInMaintFlagActivity.bpmn new file mode 100644 index 0000000000..2bdb1d7533 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetInMaintFlagActivity.bpmn @@ -0,0 +1,50 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFSetInMaintFlagActivity" name="VNFSetInMaintFlagActivity " isExecutable="true"> + <bpmn:startEvent id="VNFSetInMaintFlagActivity_Start"> + <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFSetInMaintFlagActivity_End"> + <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="TaskSetInMaint" name="VNF Set InMaint Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfInMaintFlag(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), true)}"> + <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jwsja5</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="VNFSetInMaintFlagActivity_Start" targetRef="TaskSetInMaint" /> + <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="TaskSetInMaint" targetRef="VNFSetInMaintFlagActivity_End" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFSetInMaintFlagActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFSetInMaintFlagActivity_Start"> + <dc:Bounds x="104" y="76" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="122" y="112" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFSetInMaintFlagActivity_End"> + <dc:Bounds x="320" y="76" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="338" y="116" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskSetInMaint"> + <dc:Bounds x="192" y="54" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> + <di:waypoint xsi:type="dc:Point" x="140" y="94" /> + <di:waypoint xsi:type="dc:Point" x="192" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="166" y="73" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> + <di:waypoint xsi:type="dc:Point" x="292" y="94" /> + <di:waypoint xsi:type="dc:Point" x="320" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="306" y="79" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetInMaintFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetInMaintFlagActivity.bpmn new file mode 100644 index 0000000000..05d3fcfa27 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetInMaintFlagActivity.bpmn @@ -0,0 +1,50 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFUnsetInMaintFlagActivity" name="VNFUnsetInMaintFlagActivity " isExecutable="true"> + <bpmn:startEvent id="VNFUnsetInMaintFlagActivity_Start"> + <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFUnsetInMaintFlagActivity_End"> + <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="TaskUnsetInMaint" name="VNF UnSet InMaint Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfInMaintFlag(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), false)}"> + <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jwsja5</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="VNFUnsetInMaintFlagActivity_Start" targetRef="TaskUnsetInMaint" /> + <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="TaskUnsetInMaint" targetRef="VNFUnsetInMaintFlagActivity_End" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUnsetInMaintFlagActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUnsetInMaintFlagActivity_Start"> + <dc:Bounds x="104" y="76" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="122" y="112" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFUnsetInMaintFlagActivity_End"> + <dc:Bounds x="320" y="76" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="338" y="116" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskUnsetInMaint"> + <dc:Bounds x="192" y="54" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> + <di:waypoint xsi:type="dc:Point" x="140" y="94" /> + <di:waypoint xsi:type="dc:Point" x="192" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="166" y="73" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> + <di:waypoint xsi:type="dc:Point" x="292" y="94" /> + <di:waypoint xsi:type="dc:Point" x="320" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="306" y="79" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePostCheckActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePostCheckActivity.bpmn new file mode 100644 index 0000000000..56c24dabc9 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePostCheckActivity.bpmn @@ -0,0 +1,62 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFUpgradePostCheckActivity" name="VNFUpgradePostCheckActivity" isExecutable="true"> + <bpmn:startEvent id="VNFUpgradePostCheckActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFUpgradePostCheckActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFUpgradePostCheckActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskUpgradePostCheck" targetRef="VNFUpgradePostCheckActivity_End" /> + <bpmn:serviceTask id="TaskUpgradePostCheck" name="VNF Upgrade PostCheck " camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionUpgradePostCheck"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskUpgradePostCheck" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUpgradePostCheckActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUpgradePostCheckActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFUpgradePostCheckActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskUpgradePostCheck"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePreCheckActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePreCheckActivity.bpmn new file mode 100644 index 0000000000..1ec0a18dd5 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradePreCheckActivity.bpmn @@ -0,0 +1,62 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFUpgradePreCheckActivity" name="VNFUpgradePreCheckActivity" isExecutable="true"> + <bpmn:startEvent id="VNFUpgradePreCheckActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFUpgradePreCheckActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFUpgradePreCheckActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskUpgradePreCheck" targetRef="VNFUpgradePreCheckActivity_End" /> + <bpmn:serviceTask id="TaskUpgradePreCheck" name="VNF Upgrade PreCheck " camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionUpgradePreCheck"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskUpgradePreCheck" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUpgradePreCheckActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUpgradePreCheckActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFUpgradePreCheckActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskUpgradePreCheck"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeSoftwareActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeSoftwareActivity.bpmn new file mode 100644 index 0000000000..89481a5640 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeSoftwareActivity.bpmn @@ -0,0 +1,62 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="VNFUpgradeSoftwareActivity" name="VNFUpgradeSoftwareActivity" isExecutable="true"> + <bpmn:startEvent id="VNFUpgradeSoftwareActivity_Start"> + <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="VNFUpgradeSoftwareActivity_End"> + <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFUpgradeSoftwareActivity_Start" targetRef="TaskPreProcessActivity" /> + <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskUpgradeSoftware" targetRef="VNFUpgradeSoftwareActivity_End" /> + <bpmn:serviceTask id="TaskUpgradeSoftware" name="VNF Upgrade Software" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),execution.getVariable("actionUpgradeSoftware"))}"> + <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskUpgradeSoftware" /> + <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUpgradeSoftwareActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUpgradeSoftwareActivity_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFUpgradeSoftwareActivity_End"> + <dc:Bounds x="561" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="579" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="255" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="232" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj"> + <di:waypoint xsi:type="dc:Point" x="497" y="120" /> + <di:waypoint xsi:type="dc:Point" x="561" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskUpgradeSoftware"> + <dc:Bounds x="397" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu"> + <di:waypoint xsi:type="dc:Point" x="355" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity"> + <dc:Bounds x="255" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAICheckVnfInMaintBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAICheckVnfInMaintBB.bpmn index de0f450624..99d03d69d7 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAICheckVnfInMaintBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAICheckVnfInMaintBB.bpmn @@ -1,10 +1,10 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="AAICheckVnfInMaintBB" name="AAICheckVnfInMaintBB" isExecutable="true"> - <bpmn:startEvent id="Start_AAICheckVnfInMaintBB" name="start"> + <bpmn:startEvent id="Start_AAICheckVnfInMaintBB"> <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:endEvent id="End_AAICheckVnfInMaintBB" name="end"> + <bpmn:endEvent id="End_AAICheckVnfInMaintBB"> <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="Task_CheckVnfInMaint" name="Check If Vnf In Maint (AAI)" camunda:expression="${AAIFlagTasks.checkVnfInMaintFlag(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -17,9 +17,9 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AAICheckVnfInMaintBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_AAICheckVnfInMaintBB"> - <dc:Bounds x="104" y="76" width="36" height="36" /> + <dc:Bounds x="99" y="76" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="111" y="112" width="22" height="12" /> + <dc:Bounds x="106" y="112" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="End_AAICheckVnfInMaintBB"> @@ -32,10 +32,10 @@ <dc:Bounds x="192" y="54" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> - <di:waypoint xsi:type="dc:Point" x="140" y="94" /> + <di:waypoint xsi:type="dc:Point" x="135" y="94" /> <di:waypoint xsi:type="dc:Point" x="192" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="166" y="73" width="0" height="12" /> + <dc:Bounds x="118.5" y="73" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> @@ -47,4 +47,4 @@ </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAISetVnfInMaintBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAISetVnfInMaintBB.bpmn index b2e100061d..c55b519def 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAISetVnfInMaintBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAISetVnfInMaintBB.bpmn @@ -1,10 +1,10 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="AAISetVnfInMaintBB" name="AAISetVnfInMaintBB" isExecutable="true"> - <bpmn:startEvent id="Start_AAISetVnfInMaintBB" name="start"> + <bpmn:startEvent id="Start_AAISetVnfInMaintBB"> <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:endEvent id="End_AAISetVnfInMaintBB" name="end"> + <bpmn:endEvent id="End_AAISetVnfInMaintBB"> <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="Task_SetInMaint" name="VNF Set InMaint Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfInMaintFlag(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), true)}"> @@ -17,34 +17,34 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AAISetVnfInMaintBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_AAISetVnfInMaintBB"> - <dc:Bounds x="104" y="76" width="36" height="36" /> + <dc:Bounds x="95" y="76" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="111" y="112" width="22" height="12" /> + <dc:Bounds x="102" y="112" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="End_AAISetVnfInMaintBB"> - <dc:Bounds x="320" y="76" width="36" height="36" /> + <dc:Bounds x="361" y="76" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="329" y="116" width="18" height="12" /> + <dc:Bounds x="370" y="116" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="Task_SetInMaint"> <dc:Bounds x="192" y="54" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> - <di:waypoint xsi:type="dc:Point" x="140" y="94" /> + <di:waypoint xsi:type="dc:Point" x="131" y="94" /> <di:waypoint xsi:type="dc:Point" x="192" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="166" y="73" width="0" height="12" /> + <dc:Bounds x="116.5" y="73" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> <di:waypoint xsi:type="dc:Point" x="292" y="94" /> - <di:waypoint xsi:type="dc:Point" x="320" y="94" /> + <di:waypoint xsi:type="dc:Point" x="361" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="306" y="79" width="0" height="0" /> + <dc:Bounds x="281.5" y="79" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAIUnsetVnfInMaintBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAIUnsetVnfInMaintBB.bpmn index 7335f8677c..463b82d88c 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAIUnsetVnfInMaintBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AAIUnsetVnfInMaintBB.bpmn @@ -1,10 +1,10 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="AAIUnsetVnfInMaintBB" name="AAIUnsetVnfInMaintBB" isExecutable="true"> - <bpmn:startEvent id="Start_AAIUnsetVnfInMaintBB" name="start"> + <bpmn:startEvent id="Start_AAIUnsetVnfInMaintBB"> <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:endEvent id="End_AAIUnsetVnfInMaintBB" name="end"> + <bpmn:endEvent id="End_AAIUnsetVnfInMaintBB"> <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_AAIUnsetVnfInMaintBB" targetRef="Task_UnsetInMaint" /> @@ -17,22 +17,22 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AAIUnsetVnfInMaintBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_AAIUnsetVnfInMaintBB"> - <dc:Bounds x="104" y="76" width="36" height="36" /> + <dc:Bounds x="87" y="76" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="111" y="112" width="22" height="12" /> + <dc:Bounds x="94" y="112" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="End_AAIUnsetVnfInMaintBB"> - <dc:Bounds x="320" y="76" width="36" height="36" /> + <dc:Bounds x="361" y="76" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="329" y="116" width="18" height="12" /> + <dc:Bounds x="370" y="116" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> - <di:waypoint xsi:type="dc:Point" x="140" y="94" /> + <di:waypoint xsi:type="dc:Point" x="123" y="94" /> <di:waypoint xsi:type="dc:Point" x="192" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="166" y="73" width="0" height="0" /> + <dc:Bounds x="112.5" y="79" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="Task_UnsetInMaint"> @@ -40,11 +40,11 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> <di:waypoint xsi:type="dc:Point" x="292" y="94" /> - <di:waypoint xsi:type="dc:Point" x="320" y="94" /> + <di:waypoint xsi:type="dc:Point" x="361" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="306" y="79" width="0" height="0" /> + <dc:Bounds x="281.5" y="79" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn index 6ca3745f43..dc6e4a8d94 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkBB.bpmn @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="ActivateNetworkBB" name="ActivateNetworkBB" isExecutable="true"> - <bpmn2:startEvent id="activateNetwork_startEvent" name="Start Flow"> + <bpmn2:startEvent id="activateNetwork_startEvent"> <bpmn2:outgoing>SequenceFlow_05elmhj</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:endEvent id="activateNetwork_EndEvent" name="End Flow"> + <bpmn2:endEvent id="activateNetwork_EndEvent"> <bpmn2:incoming>SequenceFlow_18atf08</bpmn2:incoming> </bpmn2:endEvent> - <bpmn2:serviceTask id="Activate_Network_SDNC_ServiceTask" name="Activate Network (SDNC)" camunda:expression="${SDNCActivateTasks.activateNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="Activate_Network_SDNC_ServiceTask" name=" SDNC Activate (network) " camunda:expression="${SDNCActivateTasks.activateNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_05elmhj</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0xbvwsu</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="Activate_Network_AAI_ServiceTask" name="Activate Network (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="Activate_Network_AAI_ServiceTask" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0xbvwsu</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18atf08</bpmn2:outgoing> </bpmn2:serviceTask> @@ -26,13 +26,13 @@ <bpmndi:BPMNShape id="StartEvent_0lbwmd1_di" bpmnElement="activateNetwork_startEvent"> <dc:Bounds x="545" y="-55" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="538" y="-14" width="49" height="12" /> + <dc:Bounds x="538" y="-14" width="50" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10l9a3s_di" bpmnElement="activateNetwork_EndEvent"> <dc:Bounds x="975" y="-55" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="971" y="-19" width="45" height="12" /> + <dc:Bounds x="971" y="-19" width="46" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1k7d8ih_di" bpmnElement="Activate_Network_SDNC_ServiceTask"> @@ -68,4 +68,4 @@ </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file +</bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkCollectionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkCollectionBB.bpmn index 87a1dae090..e927a78017 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkCollectionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateNetworkCollectionBB.bpmn @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="ActivateNetworkCollectionBB" name="ActivateNetworkCollectionBB" isExecutable="true"> - <bpmn2:startEvent id="activateNetworkCollection_startEvent" name="Start Flow"> + <bpmn2:startEvent id="activateNetworkCollection_startEvent"> <bpmn2:outgoing>SequenceFlow_05elmhj</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:endEvent id="activateNetworkCollection_EndEvent" name="End Flow"> + <bpmn2:endEvent id="activateNetworkCollection_EndEvent"> <bpmn2:incoming>SequenceFlow_18atf08</bpmn2:incoming> </bpmn2:endEvent> - <bpmn2:serviceTask id="Activate_Network_Collection_AAI_ServiceTask" name="Activate Network Collection (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="Activate_Network_Collection_AAI_ServiceTask" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_05elmhj</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18atf08</bpmn2:outgoing> </bpmn2:serviceTask> @@ -19,32 +19,32 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateNetworkCollectionBB"> <bpmndi:BPMNShape id="StartEvent_0lbwmd1_di" bpmnElement="activateNetworkCollection_startEvent"> - <dc:Bounds x="590" y="-55" width="36" height="36" /> + <dc:Bounds x="197" y="115" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="583" y="-14" width="49" height="12" /> + <dc:Bounds x="190" y="156" width="50" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10l9a3s_di" bpmnElement="activateNetworkCollection_EndEvent"> - <dc:Bounds x="894" y="-55" width="36" height="36" /> + <dc:Bounds x="501" y="115" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="890" y="-19" width="45" height="12" /> + <dc:Bounds x="497" y="151" width="46" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1911vum_di" bpmnElement="Activate_Network_Collection_AAI_ServiceTask"> - <dc:Bounds x="715" y="-77" width="100" height="80" /> + <dc:Bounds x="322" y="93" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_05elmhj_di" bpmnElement="SequenceFlow_05elmhj"> - <di:waypoint xsi:type="dc:Point" x="626" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="715" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="233" y="133" /> + <di:waypoint xsi:type="dc:Point" x="322" y="133" /> <bpmndi:BPMNLabel> - <dc:Bounds x="671" y="-52" width="0" height="0" /> + <dc:Bounds x="233" y="118" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18atf08_di" bpmnElement="SequenceFlow_18atf08"> - <di:waypoint xsi:type="dc:Point" x="815" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="894" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="422" y="133" /> + <di:waypoint xsi:type="dc:Point" x="501" y="133" /> <bpmndi:BPMNLabel> - <dc:Bounds x="855" y="-52" width="0" height="0" /> + <dc:Bounds x="417" y="118" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn index 3d55ecd8f6..47cd3cf30b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateServiceInstanceBB.bpmn @@ -1,10 +1,10 @@ <?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="1.8.2"> +<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="1.10.0"> <bpmn:process id="ActivateServiceInstanceBB" name="ActivateServiceInstanceBB" isExecutable="true"> - <bpmn:startEvent id="Start_ActivateServiceInstanceBB" name="start"> + <bpmn:startEvent id="Start_ActivateServiceInstanceBB"> <bpmn:outgoing>SequenceFlow_1byfr8v</bpmn:outgoing> </bpmn:startEvent> - <bpmn:endEvent id="End_ActivateServiceInstanceBB" name="end"> + <bpmn:endEvent id="End_ActivateServiceInstanceBB"> <bpmn:incoming>SequenceFlow_0pioehv</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_00q7fsg" sourceRef="Task_NoOpServiceInstance" targetRef="Task_UpdateServiceOrchestrationStatusToActive" /> @@ -13,7 +13,7 @@ <bpmn:outgoing>SequenceFlow_00q7fsg</bpmn:outgoing> </bpmn:task> <bpmn:sequenceFlow id="SequenceFlow_0pioehv" sourceRef="Task_UpdateServiceOrchestrationStatusToActive" targetRef="End_ActivateServiceInstanceBB" /> - <bpmn:serviceTask id="Task_UpdateServiceOrchestrationStatusToActive" name="Update Service Orchestration Status to Active (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveService(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_UpdateServiceOrchestrationStatusToActive" name=" AAI Update (svc instance) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveService(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_00q7fsg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0pioehv</bpmn:outgoing> </bpmn:serviceTask> @@ -24,7 +24,7 @@ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ActivateServiceInstanceBB"> <dc:Bounds x="174" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="181" y="138" width="22" height="12" /> + <dc:Bounds x="181" y="138" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1qdtskz_di" bpmnElement="End_ActivateServiceInstanceBB"> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn index b118d9b71c..c7b7952f02 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn @@ -1,19 +1,19 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="ActivateVfModuleBB" name="ActivateVfModuleBB" isExecutable="true"> - <bpmn:startEvent id="ActivateVfModuleBB_Start" name="Start"> + <bpmn:startEvent id="ActivateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_0ieafii" sourceRef="ActivateVfModuleBB_Start" targetRef="ActivateVfModule" /> - <bpmn:endEvent id="ActivateVfModuleBB_End" name="End"> + <bpmn:endEvent id="ActivateVfModuleBB_End"> <bpmn:incoming>SequenceFlow_0xsp0pv</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="ActivateVfModule" name="SDNC Adapter VFModule Activate" camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ActivateVfModule" name=" SDNC Activate (vf module) " camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming> <bpmn:outgoing>SequenceFlow_14kvrbe</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_14kvrbe" sourceRef="ActivateVfModule" targetRef="UpdateVfModuleActiveStatus" /> - <bpmn:serviceTask id="UpdateVfModuleActiveStatus" name="Activate OStatus (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleActiveStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_14kvrbe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xsp0pv</bpmn:outgoing> </bpmn:serviceTask> @@ -30,35 +30,35 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii"> <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="260" y="120" /> + <di:waypoint xsi:type="dc:Point" x="288" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="189.5" y="99" width="90" height="12" /> + <dc:Bounds x="203.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ActivateVfModuleBB_End"> - <dc:Bounds x="636" y="102" width="36" height="36" /> + <dc:Bounds x="624" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="645" y="142" width="19" height="12" /> + <dc:Bounds x="633" y="142" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule"> - <dc:Bounds x="260" y="80" width="100" height="80" /> + <dc:Bounds x="288" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_14kvrbe_di" bpmnElement="SequenceFlow_14kvrbe"> - <di:waypoint xsi:type="dc:Point" x="360" y="120" /> - <di:waypoint xsi:type="dc:Point" x="466" y="120" /> + <di:waypoint xsi:type="dc:Point" x="388" y="120" /> + <di:waypoint xsi:type="dc:Point" x="433" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="368" y="99" width="90" height="12" /> + <dc:Bounds x="365.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus"> - <dc:Bounds x="466" y="80" width="100" height="80" /> + <dc:Bounds x="433" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> - <di:waypoint xsi:type="dc:Point" x="566" y="120" /> - <di:waypoint xsi:type="dc:Point" x="636" y="120" /> + <di:waypoint xsi:type="dc:Point" x="533" y="120" /> + <di:waypoint xsi:type="dc:Point" x="624" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="601" y="99" width="0" height="12" /> + <dc:Bounds x="533.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn index 61d8f6eb44..1147283160 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVnfBB.bpmn @@ -1,20 +1,20 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="ActivateVnfBB" name="ActivateVnfBB" isExecutable="true"> - <bpmn:startEvent id="Start_ActivateVnfBB" name="start"> + <bpmn:startEvent id="Start_ActivateVnfBB"> <bpmn:outgoing>SequenceFlow_0k9qnoi</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_0k9qnoi" sourceRef="Start_ActivateVnfBB" targetRef="Task_SDNCAdapterVnfTopologyActivate" /> <bpmn:sequenceFlow id="SequenceFlow_0r6pzwt" sourceRef="Task_SDNCAdapterVnfTopologyActivate" targetRef="Task_ActivateOrchestrationStatusVnf" /> - <bpmn:endEvent id="End_ActivateVnfBB" name="end"> + <bpmn:endEvent id="End_ActivateVnfBB"> <bpmn:incoming>SequenceFlow_0vnitwg</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0vnitwg" sourceRef="Task_ActivateOrchestrationStatusVnf" targetRef="End_ActivateVnfBB" /> - <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyActivate" name="Call SDNC Adapter VNF Topology Activate" camunda:expression="${SDNCActivateTasks.activateVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyActivate" name=" SDNC Activate (vnf) " camunda:expression="${SDNCActivateTasks.activateVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0k9qnoi</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0r6pzwt</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_ActivateOrchestrationStatusVnf" name="Activate Orchestration Status Vnf (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_ActivateOrchestrationStatusVnf" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0r6pzwt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0vnitwg</bpmn:outgoing> </bpmn:serviceTask> @@ -24,41 +24,41 @@ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ActivateVnfBB"> <dc:Bounds x="173" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="180" y="138" width="22" height="12" /> + <dc:Bounds x="180" y="138" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0k9qnoi_di" bpmnElement="SequenceFlow_0k9qnoi"> <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="263" y="120" /> + <di:waypoint xsi:type="dc:Point" x="279" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="236" y="99" width="0" height="12" /> + <dc:Bounds x="199" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0r6pzwt_di" bpmnElement="SequenceFlow_0r6pzwt"> - <di:waypoint xsi:type="dc:Point" x="363" y="120" /> - <di:waypoint xsi:type="dc:Point" x="422" y="120" /> + <di:waypoint xsi:type="dc:Point" x="379" y="120" /> + <di:waypoint xsi:type="dc:Point" x="411" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="392.5" y="99" width="0" height="12" /> + <dc:Bounds x="350" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1ad7eym_di" bpmnElement="End_ActivateVnfBB"> - <dc:Bounds x="572" y="102" width="36" height="36" /> + <dc:Bounds x="580" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="581" y="142" width="18" height="12" /> + <dc:Bounds x="589" y="142" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vnitwg_di" bpmnElement="SequenceFlow_0vnitwg"> - <di:waypoint xsi:type="dc:Point" x="522" y="120" /> - <di:waypoint xsi:type="dc:Point" x="572" y="120" /> + <di:waypoint xsi:type="dc:Point" x="511" y="120" /> + <di:waypoint xsi:type="dc:Point" x="580" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="547" y="99" width="0" height="12" /> + <dc:Bounds x="500.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1k98q3r_di" bpmnElement="Task_SDNCAdapterVnfTopologyActivate"> - <dc:Bounds x="263" y="80" width="100" height="80" /> + <dc:Bounds x="279" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1vg25fs_di" bpmnElement="Task_ActivateOrchestrationStatusVnf"> - <dc:Bounds x="422" y="80" width="100" height="80" /> + <dc:Bounds x="411" y="80" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVolumeGroupBB.bpmn index 03ba8bbe43..bb79e552e7 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVolumeGroupBB.bpmn @@ -1,14 +1,14 @@ <?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="1.8.2"> +<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="1.10.0"> <bpmn:process id="ActivateVolumeGroupBB" name="ActivateVolumeGroupBB" isExecutable="true"> - <bpmn:startEvent id="ActivateVolumeGroupBB_Start" name="Start"> + <bpmn:startEvent id="ActivateVolumeGroupBB_Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_1wz1rfg" sourceRef="ActivateVolumeGroupBB_Start" targetRef="ActivateVolumeGroup" /> <bpmn:endEvent id="ActivateVolumeGroupBB_End"> <bpmn:incoming>SequenceFlow_0mh0v9h</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="ActivateVolumeGroup" name="ActivateVolumeGroup" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ActivateVolumeGroup" name=" AAI Update (volume) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing> </bpmn:serviceTask> @@ -26,25 +26,25 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1wz1rfg_di" bpmnElement="SequenceFlow_1wz1rfg"> <di:waypoint xsi:type="dc:Point" x="346" y="120" /> - <di:waypoint xsi:type="dc:Point" x="464" y="120" /> + <di:waypoint xsi:type="dc:Point" x="441" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="360" y="99" width="90" height="12" /> + <dc:Bounds x="348.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1k6463v_di" bpmnElement="ActivateVolumeGroupBB_End"> - <dc:Bounds x="662" y="102" width="36" height="36" /> + <dc:Bounds x="638" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="635" y="142" width="90" height="12" /> + <dc:Bounds x="611" y="142" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0rytcj0_di" bpmnElement="ActivateVolumeGroup"> - <dc:Bounds x="464" y="80" width="100" height="80" /> + <dc:Bounds x="441" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mh0v9h_di" bpmnElement="SequenceFlow_0mh0v9h"> - <di:waypoint xsi:type="dc:Point" x="564" y="120" /> - <di:waypoint xsi:type="dc:Point" x="662" y="120" /> + <di:waypoint xsi:type="dc:Point" x="541" y="120" /> + <di:waypoint xsi:type="dc:Point" x="638" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="613" y="98" width="0" height="13" /> + <dc:Bounds x="544.5" y="98.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn index 57c342455d..5f7b29b3ab 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn @@ -1,63 +1,68 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="AssignNetworkBB" name="AssignNetworkBB" isExecutable="true"> - <bpmn2:startEvent id="AssignNetworkBB_start" name="Start Flow"> + <bpmn2:startEvent id="AssignNetworkBB_start"> <bpmn2:outgoing>SequenceFlow_11op1ih</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:serviceTask id="ServiceTask_get_cloud_region" name="Process cloud region by version " camunda:expression="${AssignNetworkBBUtils.getCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_0mxc4ri</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_017131q</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing> + <bpmn2:serviceTask id="ServiceTask_get_cloud_region" name=" Process cloud region by version " camunda:expression="${AssignNetworkBBUtils.getCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_0jm95hf</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_16hhbw3</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="ServiceTask_assign_network_sdnc" name="Assign Network (SDNC)" camunda:expression="${SDNCAssignTasks.assignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0do51t8</bpmn2:outgoing> + <bpmn2:serviceTask id="ServiceTask_assign_network_sdnc" name=" SDNC Assign (network) " camunda:expression="${SDNCAssignTasks.assignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_16hhbw3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0oawye1</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="ServiceTask_get_cloud_region" targetRef="ServiceTask_assign_network_sdnc" /> - <bpmn2:sequenceFlow id="SequenceFlow_0do51t8" sourceRef="ServiceTask_assign_network_sdnc" targetRef="ServiceTask_assign_network_aai" /> - <bpmn2:serviceTask id="ServiceTask_put_network_in_AAI" name="Put network shell in AAI " camunda:expression="${AAICreateTasks.createNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="ServiceTask_put_network_in_AAI" name=" AAI Create (network) " camunda:expression="${AAICreateTasks.createNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0gkr871</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1ctpnpe</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="ServiceTask_assign_network_aai" name="Assign Network (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_0do51t8</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0ln3hj3</bpmn2:outgoing> + <bpmn2:serviceTask id="ServiceTask_assign_network_aai" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_0oawye1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0988gld</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:exclusiveGateway id="networkFoundByName_ExclusiveGateway" name="skip if network found by name" default="SequenceFlow_0gkr871"> - <bpmn2:incoming>SequenceFlow_11op1ih</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_017131q</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_0gkr871</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_017131q" name="Yes" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ServiceTask_get_cloud_region"> + <bpmn2:sequenceFlow id="SequenceFlow_017131q" name="Yes" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ExclusiveGateway_0vtj8n8"> <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{AssignNetwork.networkFoundByName(execution.getVariable("gBuildingBlockExecution")) == true}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0gkr871" name="No" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ServiceTask_put_network_in_AAI" /> - <bpmn2:endEvent id="AssignNetworkBB_end" name="End Flow"> - <bpmn2:incoming>SequenceFlow_0ln3hj3</bpmn2:incoming> + <bpmn2:endEvent id="AssignNetworkBB_end"> + <bpmn2:incoming>SequenceFlow_0988gld</bpmn2:incoming> </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0ln3hj3" sourceRef="ServiceTask_assign_network_aai" targetRef="AssignNetworkBB_end" /> <bpmn2:sequenceFlow id="SequenceFlow_11op1ih" sourceRef="AssignNetworkBB_start" targetRef="networkFoundByName_ExclusiveGateway" /> - <bpmn2:serviceTask id="ServiceTask_connect_to_NCIG" name="Connect L3Network to NetworkCollectionInstanceGroup " camunda:expression="${AAICreateTasks.connectNetworkToNetworkCollectionInstanceGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="ServiceTask_connect_to_NCIG" name=" AAI Connect (collection) " camunda:expression="${AAICreateTasks.connectNetworkToNetworkCollectionInstanceGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_07z7hcu</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0e08b9t</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="ServiceTask_connect_to_NCSI" name="Connect L3Network to ServiceInstance " camunda:expression="${AAICreateTasks.connectNetworkToNetworkCollectionServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="ServiceTask_connect_to_NCSI" name=" AAI Connect (svc instance) " camunda:expression="${AAICreateTasks.connectNetworkToNetworkCollectionServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0e08b9t</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0mxc4ri</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_1ctpnpe" sourceRef="ServiceTask_put_network_in_AAI" targetRef="ServiceTask_connect_to_Tenant" /> <bpmn2:sequenceFlow id="SequenceFlow_0e08b9t" sourceRef="ServiceTask_connect_to_NCIG" targetRef="ServiceTask_connect_to_NCSI" /> - <bpmn2:sequenceFlow id="SequenceFlow_0mxc4ri" sourceRef="ServiceTask_connect_to_NCSI" targetRef="ServiceTask_get_cloud_region" /> - <bpmn2:serviceTask id="ServiceTask_connect_to_Tenant" name="Connect L3Network to Tenant " camunda:expression="${AAICreateTasks.connectNetworkToTenant(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:sequenceFlow id="SequenceFlow_0mxc4ri" sourceRef="ServiceTask_connect_to_NCSI" targetRef="ExclusiveGateway_0vtj8n8" /> + <bpmn2:serviceTask id="ServiceTask_connect_to_Tenant" name=" AAI Connect (tenant) " camunda:expression="${AAICreateTasks.connectNetworkToTenant(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_1ctpnpe</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0fwcvep</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="ServiceTask_connect_to_CloudRegion" name="Connect L3Network to Cloud Region " camunda:expression="${AAICreateTasks.connectNetworkToCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="ServiceTask_connect_to_CloudRegion" name=" AAI Connect (cloud region) " camunda:expression="${AAICreateTasks.connectNetworkToCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0fwcvep</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_07z7hcu</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_0fwcvep" sourceRef="ServiceTask_connect_to_Tenant" targetRef="ServiceTask_connect_to_CloudRegion" /> <bpmn2:sequenceFlow id="SequenceFlow_07z7hcu" sourceRef="ServiceTask_connect_to_CloudRegion" targetRef="ServiceTask_connect_to_NCIG" /> + <bpmn2:inclusiveGateway id="networkFoundByName_ExclusiveGateway" name="Network Name Found?" default="SequenceFlow_0gkr871"> + <bpmn2:incoming>SequenceFlow_11op1ih</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_017131q</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0gkr871</bpmn2:outgoing> + </bpmn2:inclusiveGateway> + <bpmn2:inclusiveGateway id="ExclusiveGateway_0vtj8n8"> + <bpmn2:incoming>SequenceFlow_017131q</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0mxc4ri</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0jm95hf</bpmn2:outgoing> + </bpmn2:inclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0jm95hf" sourceRef="ExclusiveGateway_0vtj8n8" targetRef="ServiceTask_get_cloud_region" /> + <bpmn2:sequenceFlow id="SequenceFlow_16hhbw3" sourceRef="ServiceTask_get_cloud_region" targetRef="ServiceTask_assign_network_sdnc" /> + <bpmn2:sequenceFlow id="SequenceFlow_0oawye1" sourceRef="ServiceTask_assign_network_sdnc" targetRef="ServiceTask_assign_network_aai" /> + <bpmn2:sequenceFlow id="SequenceFlow_0988gld" sourceRef="ServiceTask_assign_network_aai" targetRef="AssignNetworkBB_end" /> <bpmn2:textAnnotation id="TextAnnotation_0dnksb2"> <bpmn2:text>sets Cloud Region on BB execution for SDNC assign</bpmn2:text> </bpmn2:textAnnotation> <bpmn2:association id="Association_1rsqd3z" sourceRef="ServiceTask_get_cloud_region" targetRef="TextAnnotation_0dnksb2" /> @@ -70,138 +75,154 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignNetworkBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="AssignNetworkBB_start"> - <dc:Bounds x="764" y="-105" width="36" height="36" /> + <dc:Bounds x="746" y="-105" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="757" y="-64" width="49" height="12" /> + <dc:Bounds x="739" y="-64" width="50" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1wo7ke9_di" bpmnElement="ServiceTask_get_cloud_region"> - <dc:Bounds x="1298" y="224" width="100" height="80" /> + <dc:Bounds x="1632" y="-127" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1ofnl0p_di" bpmnElement="ServiceTask_assign_network_sdnc"> - <dc:Bounds x="1449" y="229" width="100" height="80" /> + <dc:Bounds x="1769" y="-127" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_53" bpmnElement="SequenceFlow_32"> - <di:waypoint xsi:type="dc:Point" x="1398" y="264" /> - <di:waypoint xsi:type="dc:Point" x="1446" y="264" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1422" y="249" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0do51t8_di" bpmnElement="SequenceFlow_0do51t8"> - <di:waypoint xsi:type="dc:Point" x="1499" y="309" /> - <di:waypoint xsi:type="dc:Point" x="1499" y="378" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1514" y="343.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="TextAnnotation_0dnksb2_di" bpmnElement="TextAnnotation_0dnksb2"> - <dc:Bounds x="1393" y="153" width="212" height="30" /> + <dc:Bounds x="1576" y="35" width="212" height="30" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1rsqd3z_di" bpmnElement="Association_1rsqd3z"> - <di:waypoint xsi:type="dc:Point" x="1397" y="233" /> - <di:waypoint xsi:type="dc:Point" x="1475" y="183" /> + <di:waypoint xsi:type="dc:Point" x="1682" y="-47" /> + <di:waypoint xsi:type="dc:Point" x="1682" y="35" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1dm3ngd_di" bpmnElement="ServiceTask_put_network_in_AAI"> - <dc:Bounds x="813" y="-22" width="100" height="80" /> + <dc:Bounds x="906" y="-49" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_18yks1p_di" bpmnElement="ServiceTask_assign_network_aai"> - <dc:Bounds x="1449" y="378" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_19hvq7h_di" bpmnElement="networkFoundByName_ExclusiveGateway" isMarkerVisible="true"> - <dc:Bounds x="838" y="-112" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="833" y="-169" width="85" height="48" /> - </bpmndi:BPMNLabel> + <dc:Bounds x="1909" y="-127" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_017131q_di" bpmnElement="SequenceFlow_017131q"> - <di:waypoint xsi:type="dc:Point" x="888" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="1348" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="1348" y="224" /> + <di:waypoint xsi:type="dc:Point" x="863" y="-112" /> + <di:waypoint xsi:type="dc:Point" x="863" y="-161" /> + <di:waypoint xsi:type="dc:Point" x="1562" y="-161" /> + <di:waypoint xsi:type="dc:Point" x="1562" y="-112" /> <bpmndi:BPMNLabel> - <dc:Bounds x="904" y="-113" width="18" height="12" /> + <dc:Bounds x="871.5" y="-151.96931534232883" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0gkr871_di" bpmnElement="SequenceFlow_0gkr871"> <di:waypoint xsi:type="dc:Point" x="863" y="-62" /> - <di:waypoint xsi:type="dc:Point" x="863" y="-22" /> + <di:waypoint xsi:type="dc:Point" x="863" y="-9" /> + <di:waypoint xsi:type="dc:Point" x="906" y="-9" /> <bpmndi:BPMNLabel> - <dc:Bounds x="887" y="-53" width="14" height="12" /> + <dc:Bounds x="872.125" y="-36.06410256410257" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_083u1a5_di" bpmnElement="AssignNetworkBB_end"> - <dc:Bounds x="1481" y="512" width="36" height="36" /> + <dc:Bounds x="2118" y="-105" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1476" y="552" width="45" height="12" /> + <dc:Bounds x="2113" y="-65" width="46" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ln3hj3_di" bpmnElement="SequenceFlow_0ln3hj3"> - <di:waypoint xsi:type="dc:Point" x="1499" y="458" /> - <di:waypoint xsi:type="dc:Point" x="1499" y="512" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1514" y="475" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11op1ih_di" bpmnElement="SequenceFlow_11op1ih"> - <di:waypoint xsi:type="dc:Point" x="800" y="-87" /> + <di:waypoint xsi:type="dc:Point" x="782" y="-87" /> <di:waypoint xsi:type="dc:Point" x="838" y="-87" /> <bpmndi:BPMNLabel> - <dc:Bounds x="819" y="-102" width="0" height="0" /> + <dc:Bounds x="765" y="-102" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0a96yhg_di" bpmnElement="ServiceTask_connect_to_NCIG"> - <dc:Bounds x="970" y="224" width="100" height="80" /> + <dc:Bounds x="1286" y="-49" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0mauyto_di" bpmnElement="ServiceTask_connect_to_NCSI"> - <dc:Bounds x="1130" y="224" width="100" height="80" /> + <dc:Bounds x="1422" y="-49" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ctpnpe_di" bpmnElement="SequenceFlow_1ctpnpe"> - <di:waypoint xsi:type="dc:Point" x="863" y="58" /> - <di:waypoint xsi:type="dc:Point" x="863" y="99" /> + <di:waypoint xsi:type="dc:Point" x="1006" y="-9" /> + <di:waypoint xsi:type="dc:Point" x="1036" y="-9" /> <bpmndi:BPMNLabel> - <dc:Bounds x="878" y="79" width="0" height="0" /> + <dc:Bounds x="976" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0e08b9t_di" bpmnElement="SequenceFlow_0e08b9t"> - <di:waypoint xsi:type="dc:Point" x="1070" y="264" /> - <di:waypoint xsi:type="dc:Point" x="1130" y="264" /> + <di:waypoint xsi:type="dc:Point" x="1386" y="-9" /> + <di:waypoint xsi:type="dc:Point" x="1422" y="-9" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1100" y="249" width="0" height="0" /> + <dc:Bounds x="1359" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0mxc4ri_di" bpmnElement="SequenceFlow_0mxc4ri"> - <di:waypoint xsi:type="dc:Point" x="1230" y="264" /> - <di:waypoint xsi:type="dc:Point" x="1298" y="264" /> + <di:waypoint xsi:type="dc:Point" x="1522" y="-9" /> + <di:waypoint xsi:type="dc:Point" x="1562" y="-9" /> + <di:waypoint xsi:type="dc:Point" x="1562" y="-62" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1264" y="239" width="0" height="0" /> + <dc:Bounds x="1497" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_019bzpc_di" bpmnElement="ServiceTask_connect_to_Tenant"> - <dc:Bounds x="813" y="99" width="100" height="80" /> + <dc:Bounds x="1036" y="-49" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1alvmym_di" bpmnElement="ServiceTask_connect_to_CloudRegion"> - <dc:Bounds x="813" y="224" width="100" height="80" /> + <dc:Bounds x="1162" y="-49" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0fwcvep_di" bpmnElement="SequenceFlow_0fwcvep"> - <di:waypoint xsi:type="dc:Point" x="863" y="179" /> - <di:waypoint xsi:type="dc:Point" x="863" y="224" /> + <di:waypoint xsi:type="dc:Point" x="1136" y="-9" /> + <di:waypoint xsi:type="dc:Point" x="1162" y="-9" /> <bpmndi:BPMNLabel> - <dc:Bounds x="878" y="191.5" width="0" height="0" /> + <dc:Bounds x="1104" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07z7hcu_di" bpmnElement="SequenceFlow_07z7hcu"> - <di:waypoint xsi:type="dc:Point" x="913" y="264" /> - <di:waypoint xsi:type="dc:Point" x="970" y="264" /> + <di:waypoint xsi:type="dc:Point" x="1262" y="-9" /> + <di:waypoint xsi:type="dc:Point" x="1286" y="-9" /> <bpmndi:BPMNLabel> - <dc:Bounds x="942" y="239" width="0" height="0" /> + <dc:Bounds x="1229" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="TextAnnotation_17jb2vn_di" bpmnElement="TextAnnotation_17jb2vn"> - <dc:Bounds x="941" y="344" width="158" height="54" /> + <dc:Bounds x="1232" y="86" width="158" height="54" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_15ppe1t_di" bpmnElement="Association_15ppe1t"> - <di:waypoint xsi:type="dc:Point" x="996" y="304" /> - <di:waypoint xsi:type="dc:Point" x="973" y="344" /> + <di:waypoint xsi:type="dc:Point" x="1306" y="31" /> + <di:waypoint xsi:type="dc:Point" x="1267" y="86" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="InclusiveGateway_0kiphfm_di" bpmnElement="networkFoundByName_ExclusiveGateway"> + <dc:Bounds x="838" y="-112" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="898" y="-104" width="73" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_0pxktc3_di" bpmnElement="ExclusiveGateway_0vtj8n8"> + <dc:Bounds x="1537" y="-112" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1562" y="-58" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0jm95hf_di" bpmnElement="SequenceFlow_0jm95hf"> + <di:waypoint xsi:type="dc:Point" x="1587" y="-87" /> + <di:waypoint xsi:type="dc:Point" x="1632" y="-87" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1609.5" y="-108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_16hhbw3_di" bpmnElement="SequenceFlow_16hhbw3"> + <di:waypoint xsi:type="dc:Point" x="1732" y="-87" /> + <di:waypoint xsi:type="dc:Point" x="1769" y="-87" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1750.5" y="-108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0oawye1_di" bpmnElement="SequenceFlow_0oawye1"> + <di:waypoint xsi:type="dc:Point" x="1869" y="-87" /> + <di:waypoint xsi:type="dc:Point" x="1909" y="-87" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1889" y="-108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0988gld_di" bpmnElement="SequenceFlow_0988gld"> + <di:waypoint xsi:type="dc:Point" x="2009" y="-87" /> + <di:waypoint xsi:type="dc:Point" x="2118" y="-87" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2063.5" y="-108" width="0" height="12" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn index f68fc91584..d1f2286258 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignServiceInstanceBB.bpmn @@ -1,22 +1,22 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="AssignServiceInstanceBB" name="AssignServiceInstanceBB" isExecutable="true"> - <bpmn:startEvent id="Start_AssignServiceInstanceBB" name="start"> + <bpmn:startEvent id="Start_AssignServiceInstanceBB"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="Task_CreateServiceInstance" name="Create Service Instance (AAI)" camunda:expression="${AAICreateTasks.createServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_CreateServiceInstance" name=" AAI Create (svc instance) " camunda:expression="${AAICreateTasks.createServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1h6t7yr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0czewtx</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_CreateProject" name="Create Project (AAI)" camunda:expression="${AAICreateTasks.createProject(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_CreateProject" name=" AAI Create (project) " camunda:expression="${AAICreateTasks.createProject(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0czewtx</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1t55i01</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_CreateOwningEntity" name="Create Owning Entity (AAI)" camunda:expression="${AAICreateTasks.createOwningEntity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_CreateOwningEntity" name=" AAI Create (owning entity) " camunda:expression="${AAICreateTasks.createOwningEntity(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1t55i01</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0aef1l8</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_AssignServiceInstance" name="Assign Service Instance (SDNC)" camunda:expression="${SDNCAssignTasks.assignServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_AssignServiceInstance" name=" SDNC Assign (svc instance) " camunda:expression="${SDNCAssignTasks.assignServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0aef1l8</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07ea5ui</bpmn:outgoing> </bpmn:serviceTask> @@ -24,16 +24,16 @@ <bpmn:sequenceFlow id="SequenceFlow_0czewtx" sourceRef="Task_CreateServiceInstance" targetRef="Task_CreateProject" /> <bpmn:sequenceFlow id="SequenceFlow_1t55i01" sourceRef="Task_CreateProject" targetRef="Task_CreateOwningEntity" /> <bpmn:sequenceFlow id="SequenceFlow_07ea5ui" sourceRef="Task_AssignServiceInstance" targetRef="Task_UpdateServiceOstatusToAssigned" /> - <bpmn:endEvent id="End_AssignServiceInstanceBB" name="end"> + <bpmn:endEvent id="End_AssignServiceInstanceBB"> <bpmn:incoming>SequenceFlow_14xl505</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_14xl505" sourceRef="Task_UpdateServiceOstatusToAssigned" targetRef="End_AssignServiceInstanceBB" /> - <bpmn:serviceTask id="Task_UpdateServiceOstatusToAssigned" name="Update Service Ostatus to Assigned (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedService(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_UpdateServiceOstatusToAssigned" name=" AAI Update (svc instance) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedService(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_07ea5ui</bpmn:incoming> <bpmn:outgoing>SequenceFlow_14xl505</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1h6t7yr" sourceRef="Task_CreateServiceSubscription" targetRef="Task_CreateServiceInstance" /> - <bpmn:serviceTask id="Task_CreateServiceSubscription" name="Create Service Subscription (AAI)" camunda:expression="${AAICreateTasks.createServiceSubscription(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_CreateServiceSubscription" name=" AAI Create (svc subscrip) " camunda:expression="${AAICreateTasks.createServiceSubscription(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1xr6chl</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1h6t7yr</bpmn:outgoing> </bpmn:serviceTask> @@ -43,84 +43,84 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignServiceInstanceBB"> <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="Start_AssignServiceInstanceBB"> - <dc:Bounds x="75" y="-3" width="36" height="36" /> + <dc:Bounds x="68" y="90" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="82" y="33" width="23" height="12" /> + <dc:Bounds x="75" y="126" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0028k7a_di" bpmnElement="Task_CreateServiceInstance"> - <dc:Bounds x="285" y="-25" width="100" height="80" /> + <dc:Bounds x="290" y="68" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0oh47a9_di" bpmnElement="Task_CreateProject"> - <dc:Bounds x="426" y="-25" width="100" height="80" /> + <dc:Bounds x="431" y="68" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_06hn530_di" bpmnElement="Task_CreateOwningEntity"> - <dc:Bounds x="572" y="-25" width="100" height="80" /> + <dc:Bounds x="577" y="68" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="Task_AssignServiceInstance"> - <dc:Bounds x="714" y="-25" width="100" height="80" /> + <dc:Bounds x="719" y="68" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> - <di:waypoint xsi:type="dc:Point" x="111" y="15" /> - <di:waypoint xsi:type="dc:Point" x="148" y="15" /> + <di:waypoint xsi:type="dc:Point" x="104" y="108" /> + <di:waypoint xsi:type="dc:Point" x="153" y="108" /> <bpmndi:BPMNLabel> - <dc:Bounds x="84.5" y="-6" width="90" height="12" /> + <dc:Bounds x="83.5" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0czewtx_di" bpmnElement="SequenceFlow_0czewtx"> - <di:waypoint xsi:type="dc:Point" x="385" y="15" /> - <di:waypoint xsi:type="dc:Point" x="426" y="15" /> + <di:waypoint xsi:type="dc:Point" x="390" y="108" /> + <di:waypoint xsi:type="dc:Point" x="431" y="108" /> <bpmndi:BPMNLabel> - <dc:Bounds x="361.5" y="-6" width="0" height="12" /> + <dc:Bounds x="322" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1t55i01_di" bpmnElement="SequenceFlow_1t55i01"> - <di:waypoint xsi:type="dc:Point" x="526" y="15" /> - <di:waypoint xsi:type="dc:Point" x="572" y="15" /> + <di:waypoint xsi:type="dc:Point" x="531" y="108" /> + <di:waypoint xsi:type="dc:Point" x="577" y="108" /> <bpmndi:BPMNLabel> - <dc:Bounds x="504" y="-6" width="0" height="12" /> + <dc:Bounds x="464" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07ea5ui_di" bpmnElement="SequenceFlow_07ea5ui"> - <di:waypoint xsi:type="dc:Point" x="814" y="15" /> - <di:waypoint xsi:type="dc:Point" x="864" y="15" /> + <di:waypoint xsi:type="dc:Point" x="819" y="108" /> + <di:waypoint xsi:type="dc:Point" x="869" y="108" /> <bpmndi:BPMNLabel> - <dc:Bounds x="794" y="-6" width="90" height="12" /> + <dc:Bounds x="799" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="End_AssignServiceInstanceBB"> - <dc:Bounds x="1007" y="-3" width="36" height="36" /> + <dc:Bounds x="1030" y="90" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1016" y="37" width="18" height="12" /> + <dc:Bounds x="1039" y="130" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_14xl505_di" bpmnElement="SequenceFlow_14xl505"> - <di:waypoint xsi:type="dc:Point" x="964" y="15" /> - <di:waypoint xsi:type="dc:Point" x="1007" y="15" /> + <di:waypoint xsi:type="dc:Point" x="969" y="108" /> + <di:waypoint xsi:type="dc:Point" x="1030" y="108" /> <bpmndi:BPMNLabel> - <dc:Bounds x="940.5" y="-6" width="90" height="12" /> + <dc:Bounds x="954.5" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="Task_UpdateServiceOstatusToAssigned"> - <dc:Bounds x="864" y="-25" width="100" height="80" /> + <dc:Bounds x="869" y="68" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1h6t7yr_di" bpmnElement="SequenceFlow_1h6t7yr"> - <di:waypoint xsi:type="dc:Point" x="248" y="15" /> - <di:waypoint xsi:type="dc:Point" x="285" y="15" /> + <di:waypoint xsi:type="dc:Point" x="253" y="108" /> + <di:waypoint xsi:type="dc:Point" x="290" y="108" /> <bpmndi:BPMNLabel> - <dc:Bounds x="266.5" y="-6" width="0" height="12" /> + <dc:Bounds x="227" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_09fq3rp_di" bpmnElement="Task_CreateServiceSubscription"> - <dc:Bounds x="148" y="-25" width="100" height="80" /> + <dc:Bounds x="153" y="68" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0aef1l8_di" bpmnElement="SequenceFlow_0aef1l8"> - <di:waypoint xsi:type="dc:Point" x="672" y="15" /> - <di:waypoint xsi:type="dc:Point" x="714" y="15" /> + <di:waypoint xsi:type="dc:Point" x="677" y="108" /> + <di:waypoint xsi:type="dc:Point" x="719" y="108" /> <bpmndi:BPMNLabel> - <dc:Bounds x="693" y="-6" width="0" height="12" /> + <dc:Bounds x="653" y="87" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn index b7ce68eace..92b03a79d0 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn @@ -1,30 +1,30 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="AssignVfModuleBB" name="AssignVfModuleBB" isExecutable="true"> - <bpmn:startEvent id="AssignVfModuleBB_Start" name="Start"> + <bpmn:startEvent id="AssignVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="CreateVfModule" name="Create VF Module (AAI)" camunda:expression="${AAICreateTasks.createVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="CreateVfModule" name=" AAI Create (vf module) " camunda:expression="${AAICreateTasks.createVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1xr6chl</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0czewtx</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="AssignVfModule" name="Assign VF Module (SDNC)" camunda:expression="${SDNCAssignTasks.assignVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="AssignVfModule" name=" SDNC Assign (vf module) " camunda:expression="${SDNCAssignTasks.assignVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0574gaa</bpmn:incoming> <bpmn:outgoing>SequenceFlow_15hn8si</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1xr6chl" sourceRef="AssignVfModuleBB_Start" targetRef="CreateVfModule" /> <bpmn:sequenceFlow id="SequenceFlow_0czewtx" sourceRef="CreateVfModule" targetRef="ConnectVfModuleToVolumeGroup" /> - <bpmn:endEvent id="AssignVfModuleBB_End" name="End"> + <bpmn:endEvent id="AssignVfModuleBB_End"> <bpmn:incoming>SequenceFlow_14xl505</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_14xl505" sourceRef="UpdateVfModuleStatus" targetRef="AssignVfModuleBB_End" /> - <bpmn:serviceTask id="UpdateVfModuleStatus" name="Update VF Module Ostatus to Assigned (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_15hn8si</bpmn:incoming> <bpmn:outgoing>SequenceFlow_14xl505</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_15hn8si" sourceRef="AssignVfModule" targetRef="UpdateVfModuleStatus" /> <bpmn:sequenceFlow id="SequenceFlow_0574gaa" sourceRef="ConnectVfModuleToVolumeGroup" targetRef="AssignVfModule" /> - <bpmn:serviceTask id="ConnectVfModuleToVolumeGroup" name="Connect VfModule to VolumeGroup (AAI)" camunda:expression="${AAICreateTasks.connectVfModuleToVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ConnectVfModuleToVolumeGroup" name=" AAI Connect (volume) " camunda:expression="${AAICreateTasks.connectVfModuleToVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0czewtx</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0574gaa</bpmn:outgoing> </bpmn:serviceTask> @@ -32,63 +32,63 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignVfModuleBB"> <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="AssignVfModuleBB_Start"> - <dc:Bounds x="213" y="-3" width="36" height="36" /> + <dc:Bounds x="184" y="68" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="219" y="33" width="23" height="12" /> + <dc:Bounds x="190" y="104" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0028k7a_di" bpmnElement="CreateVfModule"> - <dc:Bounds x="326" y="-25" width="100" height="80" /> + <dc:Bounds x="297" y="46" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="AssignVfModule"> - <dc:Bounds x="661" y="-25" width="100" height="80" /> + <dc:Bounds x="632" y="46" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> - <di:waypoint xsi:type="dc:Point" x="249" y="15" /> - <di:waypoint xsi:type="dc:Point" x="326" y="15" /> + <di:waypoint xsi:type="dc:Point" x="220" y="86" /> + <di:waypoint xsi:type="dc:Point" x="297" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="288" y="0" width="0" height="0" /> + <dc:Bounds x="214" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0czewtx_di" bpmnElement="SequenceFlow_0czewtx"> - <di:waypoint xsi:type="dc:Point" x="426" y="15" /> - <di:waypoint xsi:type="dc:Point" x="490" y="15" /> + <di:waypoint xsi:type="dc:Point" x="397" y="86" /> + <di:waypoint xsi:type="dc:Point" x="461" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="458" y="0" width="0" height="0" /> + <dc:Bounds x="384" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="AssignVfModuleBB_End"> - <dc:Bounds x="1037" y="-3" width="36" height="36" /> + <dc:Bounds x="1008" y="68" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1045" y="37" width="19" height="12" /> + <dc:Bounds x="1016" y="108" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_14xl505_di" bpmnElement="SequenceFlow_14xl505"> - <di:waypoint xsi:type="dc:Point" x="935" y="15" /> - <di:waypoint xsi:type="dc:Point" x="1037" y="15" /> + <di:waypoint xsi:type="dc:Point" x="906" y="86" /> + <di:waypoint xsi:type="dc:Point" x="1008" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="986" y="0" width="0" height="0" /> + <dc:Bounds x="912" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="UpdateVfModuleStatus"> - <dc:Bounds x="835" y="-25" width="100" height="80" /> + <dc:Bounds x="806" y="46" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15hn8si_di" bpmnElement="SequenceFlow_15hn8si"> - <di:waypoint xsi:type="dc:Point" x="761" y="15" /> - <di:waypoint xsi:type="dc:Point" x="835" y="15" /> + <di:waypoint xsi:type="dc:Point" x="732" y="86" /> + <di:waypoint xsi:type="dc:Point" x="806" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="0" width="0" height="0" /> + <dc:Bounds x="724" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0574gaa_di" bpmnElement="SequenceFlow_0574gaa"> - <di:waypoint xsi:type="dc:Point" x="590" y="15" /> - <di:waypoint xsi:type="dc:Point" x="661" y="15" /> + <di:waypoint xsi:type="dc:Point" x="561" y="86" /> + <di:waypoint xsi:type="dc:Point" x="632" y="86" /> <bpmndi:BPMNLabel> - <dc:Bounds x="626" y="0" width="0" height="0" /> + <dc:Bounds x="552" y="71" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0ekqpfn_di" bpmnElement="ConnectVfModuleToVolumeGroup"> - <dc:Bounds x="490" y="-25" width="100" height="80" /> + <dc:Bounds x="461" y="46" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn index f1a023910b..eaee5399e6 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -1,45 +1,39 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="AssignVnfBB" name="AssignVnfBB" isExecutable="true"> - <bpmn:startEvent id="Start_AssignVnfBB" name="start"> + <bpmn:startEvent id="Start_AssignVnfBB"> <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyAssign" name="Call SDNC Adapter VNF Topology Assign" camunda:expression="${SDNCAssignTasks.assignVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_11jum90</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0v8d14a</bpmn:incoming> + <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyAssign" name=" SDNC Assign (vnf) " camunda:expression="${SDNCAssignTasks.assignVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_14mpqit</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ks8kmt</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="End_AssignVnfBB" name="end"> + <bpmn:endEvent id="End_AssignVnfBB"> <bpmn:incoming>SequenceFlow_0csh9dc</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="Task_CreateVnf" name="Create Vnf (AAI)" camunda:expression="${AAICreateTasks.createVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_CreateVnf" name=" AAI Create (vnf) " camunda:expression="${AAICreateTasks.createVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1jwsja5</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_AssignVnfBB" targetRef="Task_CreateVnf" /> <bpmn:sequenceFlow id="SequenceFlow_1ks8kmt" sourceRef="Task_SDNCAdapterVnfTopologyAssign" targetRef="Task_UpdateVnfOrchestrationStatusAssigned" /> <bpmn:sequenceFlow id="SequenceFlow_0csh9dc" sourceRef="Task_UpdateVnfOrchestrationStatusAssigned" targetRef="End_AssignVnfBB" /> - <bpmn:serviceTask id="Task_UpdateVnfOrchestrationStatusAssigned" name="Update VNF Orchestration Status Assigned (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_UpdateVnfOrchestrationStatusAssigned" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1ks8kmt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0csh9dc</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_createInstanceGroups" name="Create Instance Groups (AAI)" camunda:expression="${AssignVnf.createInstanceGroups(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_createInstanceGroups" name=" AAI Create (instance grp) " camunda:expression="${AssignVnf.createInstanceGroups(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1lppa2m</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1nle8kc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="Task_CreateVnf" targetRef="Task_createPlatform" /> <bpmn:sequenceFlow id="SequenceFlow_1nle8kc" sourceRef="Task_createInstanceGroups" targetRef="ExclusiveGateway_02tchpp" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_02tchpp" name="Call Homing?" default="SequenceFlow_11jum90"> - <bpmn:incoming>SequenceFlow_1nle8kc</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_11jum90</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1uiok7v</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_11jum90" name="no" sourceRef="ExclusiveGateway_02tchpp" targetRef="Task_SDNCAdapterVnfTopologyAssign" /> + <bpmn:sequenceFlow id="SequenceFlow_11jum90" name="no" sourceRef="ExclusiveGateway_02tchpp" targetRef="ExclusiveGateway_1blf52g" /> <bpmn:sequenceFlow id="SequenceFlow_1uiok7v" name="yes" sourceRef="ExclusiveGateway_02tchpp" targetRef="Task_callHoming"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("callHoming")}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0v8d14a" sourceRef="Task_callHoming" targetRef="Task_SDNCAdapterVnfTopologyAssign" /> - <bpmn:callActivity id="Task_callHoming" name="Call Homing" calledElement="HomingV2"> + <bpmn:sequenceFlow id="SequenceFlow_0v8d14a" sourceRef="Task_callHoming" targetRef="ExclusiveGateway_1blf52g" /> + <bpmn:callActivity id="Task_callHoming" name="Call Homing" calledElement="HomingBB"> <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:in source="mso-request-id" target="mso-request-id" /> @@ -50,127 +44,187 @@ </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_169g0ir" sourceRef="Task_createPlatform" targetRef="Task_createLineOfBusiness" /> <bpmn:sequenceFlow id="SequenceFlow_1lppa2m" sourceRef="Task_createLineOfBusiness" targetRef="Task_createInstanceGroups" /> - <bpmn:serviceTask id="Task_createPlatform" name="Create/Connect Platform" camunda:expression="${AAICreateTasks.createPlatform(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_createPlatform" name=" AAI Connect (platform) " camunda:expression="${AAICreateTasks.createPlatform(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming> <bpmn:outgoing>SequenceFlow_169g0ir</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_createLineOfBusiness" name="Create/Connect Line of Business" camunda:expression="${AAICreateTasks.createLineOfBusiness(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_createLineOfBusiness" name=" AAI Create (line bus) " camunda:expression="${AAICreateTasks.createLineOfBusiness(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_169g0ir</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1lppa2m</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:subProcess id="SubProcess_19596dp" name="Error Handling " triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1c3cyuv"> + <bpmn:outgoing>SequenceFlow_1i52a7x</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1bywujf"> + <bpmn:incoming>SequenceFlow_1i52a7x</bpmn:incoming> + <bpmn:terminateEventDefinition /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1i52a7x" sourceRef="StartEvent_1c3cyuv" targetRef="EndEvent_1bywujf" /> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_14mpqit" sourceRef="ExclusiveGateway_1blf52g" targetRef="Task_SDNCAdapterVnfTopologyAssign" /> + <bpmn:inclusiveGateway id="ExclusiveGateway_02tchpp" name="Call Homing?" default="SequenceFlow_11jum90"> + <bpmn:incoming>SequenceFlow_1nle8kc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11jum90</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1uiok7v</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:inclusiveGateway id="ExclusiveGateway_1blf52g"> + <bpmn:incoming>SequenceFlow_11jum90</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0v8d14a</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14mpqit</bpmn:outgoing> + </bpmn:inclusiveGateway> </bpmn:process> <bpmn:error id="Error_0rgauy1" name="gDelegateError" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignVnfBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_AssignVnfBB"> - <dc:Bounds x="-111" y="76" width="36" height="36" /> + <dc:Bounds x="72" y="116" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-104" y="112" width="22" height="12" /> + <dc:Bounds x="79" y="152" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0m0ikey_di" bpmnElement="Task_SDNCAdapterVnfTopologyAssign"> - <dc:Bounds x="605" y="54" width="100" height="80" /> + <dc:Bounds x="930" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="End_AssignVnfBB"> - <dc:Bounds x="895" y="76" width="36" height="36" /> + <dc:Bounds x="1229" y="116" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="904" y="116" width="18" height="12" /> + <dc:Bounds x="1238" y="156" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="Task_CreateVnf"> - <dc:Bounds x="-36" y="54" width="100" height="80" /> + <dc:Bounds x="147" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> - <di:waypoint xsi:type="dc:Point" x="-75" y="94" /> - <di:waypoint xsi:type="dc:Point" x="-36" y="94" /> + <di:waypoint xsi:type="dc:Point" x="108" y="134" /> + <di:waypoint xsi:type="dc:Point" x="147" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-100" y="73" width="90" height="12" /> + <dc:Bounds x="83" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ks8kmt_di" bpmnElement="SequenceFlow_1ks8kmt"> - <di:waypoint xsi:type="dc:Point" x="705" y="94" /> - <di:waypoint xsi:type="dc:Point" x="747" y="94" /> + <di:waypoint xsi:type="dc:Point" x="1030" y="134" /> + <di:waypoint xsi:type="dc:Point" x="1056" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="681" y="73" width="90" height="12" /> + <dc:Bounds x="998" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0csh9dc_di" bpmnElement="SequenceFlow_0csh9dc"> - <di:waypoint xsi:type="dc:Point" x="847" y="94" /> - <di:waypoint xsi:type="dc:Point" x="895" y="94" /> + <di:waypoint xsi:type="dc:Point" x="1156" y="134" /> + <di:waypoint xsi:type="dc:Point" x="1229" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="826" y="73" width="90" height="12" /> + <dc:Bounds x="1147.5" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0s6d1be_di" bpmnElement="Task_UpdateVnfOrchestrationStatusAssigned"> - <dc:Bounds x="747" y="54" width="100" height="80" /> + <dc:Bounds x="1056" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0wjy7za_di" bpmnElement="Task_createInstanceGroups"> - <dc:Bounds x="351" y="54" width="100" height="80" /> + <dc:Bounds x="534" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5"> - <di:waypoint xsi:type="dc:Point" x="64" y="94" /> - <di:waypoint xsi:type="dc:Point" x="96" y="94" /> + <di:waypoint xsi:type="dc:Point" x="247" y="134" /> + <di:waypoint xsi:type="dc:Point" x="279" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="35" y="73" width="90" height="12" /> + <dc:Bounds x="218" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1nle8kc_di" bpmnElement="SequenceFlow_1nle8kc"> - <di:waypoint xsi:type="dc:Point" x="451" y="94" /> - <di:waypoint xsi:type="dc:Point" x="496" y="94" /> + <di:waypoint xsi:type="dc:Point" x="634" y="134" /> + <di:waypoint xsi:type="dc:Point" x="679" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="428.5" y="73" width="90" height="12" /> + <dc:Bounds x="611.5" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_02tchpp_di" bpmnElement="ExclusiveGateway_02tchpp" isMarkerVisible="true"> - <dc:Bounds x="496" y="69" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="489" y="123" width="64" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11jum90_di" bpmnElement="SequenceFlow_11jum90"> - <di:waypoint xsi:type="dc:Point" x="546" y="94" /> - <di:waypoint xsi:type="dc:Point" x="605" y="94" /> + <di:waypoint xsi:type="dc:Point" x="704" y="159" /> + <di:waypoint xsi:type="dc:Point" x="704" y="195" /> + <di:waypoint xsi:type="dc:Point" x="874" y="195" /> + <di:waypoint xsi:type="dc:Point" x="874" y="159" /> <bpmndi:BPMNLabel> - <dc:Bounds x="569.5" y="73" width="12" height="12" /> + <dc:Bounds x="715.1383523847063" y="174" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1uiok7v_di" bpmnElement="SequenceFlow_1uiok7v"> - <di:waypoint xsi:type="dc:Point" x="521" y="69" /> - <di:waypoint xsi:type="dc:Point" x="521" y="-23" /> - <di:waypoint xsi:type="dc:Point" x="605" y="-23" /> + <di:waypoint xsi:type="dc:Point" x="704" y="109" /> + <di:waypoint xsi:type="dc:Point" x="704" y="68" /> + <di:waypoint xsi:type="dc:Point" x="739" y="68" /> <bpmndi:BPMNLabel> - <dc:Bounds x="527" y="17.494623655913976" width="18" height="12" /> + <dc:Bounds x="711" y="75.5" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0v8d14a_di" bpmnElement="SequenceFlow_0v8d14a"> - <di:waypoint xsi:type="dc:Point" x="655" y="17" /> - <di:waypoint xsi:type="dc:Point" x="655" y="54" /> + <di:waypoint xsi:type="dc:Point" x="839" y="68" /> + <di:waypoint xsi:type="dc:Point" x="874" y="68" /> + <di:waypoint xsi:type="dc:Point" x="874" y="109" /> <bpmndi:BPMNLabel> - <dc:Bounds x="670" y="29.5" width="0" height="12" /> + <dc:Bounds x="811.5" y="47" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_14ye6fs_di" bpmnElement="Task_callHoming"> - <dc:Bounds x="605" y="-63" width="100" height="80" /> + <dc:Bounds x="739" y="28" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_169g0ir_di" bpmnElement="SequenceFlow_169g0ir"> - <di:waypoint xsi:type="dc:Point" x="196" y="94" /> - <di:waypoint xsi:type="dc:Point" x="221" y="94" /> + <di:waypoint xsi:type="dc:Point" x="379" y="134" /> + <di:waypoint xsi:type="dc:Point" x="404" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="208.5" y="73" width="0" height="12" /> + <dc:Bounds x="347" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1lppa2m_di" bpmnElement="SequenceFlow_1lppa2m"> - <di:waypoint xsi:type="dc:Point" x="321" y="94" /> - <di:waypoint xsi:type="dc:Point" x="351" y="94" /> + <di:waypoint xsi:type="dc:Point" x="504" y="134" /> + <di:waypoint xsi:type="dc:Point" x="534" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="336" y="73" width="0" height="12" /> + <dc:Bounds x="474" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0c97kfg_di" bpmnElement="Task_createPlatform"> - <dc:Bounds x="96" y="54" width="100" height="80" /> + <dc:Bounds x="279" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1b9yljc_di" bpmnElement="Task_createLineOfBusiness"> - <dc:Bounds x="221" y="54" width="100" height="80" /> + <dc:Bounds x="404" y="94" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_19596dp_di" bpmnElement="SubProcess_19596dp" isExpanded="true"> + <dc:Bounds x="249" y="267" width="231" height="135" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1c3cyuv_di" bpmnElement="StartEvent_1c3cyuv"> + <dc:Bounds x="286" y="323" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="259" y="359" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1bywujf_di" bpmnElement="EndEvent_1bywujf"> + <dc:Bounds x="422" y="323" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="395" y="359" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1i52a7x_di" bpmnElement="SequenceFlow_1i52a7x"> + <di:waypoint xsi:type="dc:Point" x="322" y="341" /> + <di:waypoint xsi:type="dc:Point" x="422" y="341" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="372" y="320" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14mpqit_di" bpmnElement="SequenceFlow_14mpqit"> + <di:waypoint xsi:type="dc:Point" x="899" y="134" /> + <di:waypoint xsi:type="dc:Point" x="930" y="134" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="914.5" y="113" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="InclusiveGateway_0x0c3kk_di" bpmnElement="ExclusiveGateway_02tchpp"> + <dc:Bounds x="679" y="109" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="732" y="128" width="64" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_0ijggth_di" bpmnElement="ExclusiveGateway_1blf52g"> + <dc:Bounds x="849" y="109" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="896" y="163" width="0" height="12" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVolumeGroupBB.bpmn index b1626c8a53..7331d84e05 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVolumeGroupBB.bpmn @@ -1,5 +1,5 @@ <?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="1.8.2"> +<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="1.10.0"> <bpmn:process id="AssignVolumeGroupBB" name="AssignVolumeGroupBB" isExecutable="true"> <bpmn:startEvent id="AssignVolumeGroupBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> @@ -8,7 +8,7 @@ <bpmn:endEvent id="AssignVolumeGroupBB_End"> <bpmn:incoming>SequenceFlow_0mh0v9h</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="AssignVolumeGroup" name="AssignVolumeGroup" camunda:expression="${AAICreateTasks.createVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="AssignVolumeGroup" name=" AAI Create (volume) " camunda:expression="${AAICreateTasks.createVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing> </bpmn:serviceTask> @@ -19,32 +19,32 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignVolumeGroupBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="AssignVolumeGroupBB_Start"> - <dc:Bounds x="310" y="102" width="36" height="36" /> + <dc:Bounds x="177" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="316" y="138" width="24" height="12" /> + <dc:Bounds x="183" y="138" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1wz1rfg_di" bpmnElement="SequenceFlow_1wz1rfg"> - <di:waypoint xsi:type="dc:Point" x="346" y="120" /> - <di:waypoint xsi:type="dc:Point" x="464" y="120" /> + <di:waypoint xsi:type="dc:Point" x="213" y="120" /> + <di:waypoint xsi:type="dc:Point" x="331" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="360" y="99" width="90" height="12" /> + <dc:Bounds x="227" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1k6463v_di" bpmnElement="AssignVolumeGroupBB_End"> - <dc:Bounds x="662" y="102" width="36" height="36" /> + <dc:Bounds x="529" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="635" y="142" width="90" height="12" /> + <dc:Bounds x="502" y="142" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0rytcj0_di" bpmnElement="AssignVolumeGroup"> - <dc:Bounds x="464" y="80" width="100" height="80" /> + <dc:Bounds x="331" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mh0v9h_di" bpmnElement="SequenceFlow_0mh0v9h"> - <di:waypoint xsi:type="dc:Point" x="564" y="120" /> - <di:waypoint xsi:type="dc:Point" x="662" y="120" /> + <di:waypoint xsi:type="dc:Point" x="431" y="120" /> + <di:waypoint xsi:type="dc:Point" x="529" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="613" y="98" width="0" height="13" /> + <dc:Bounds x="435" y="98" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn index 6641516bfa..fa0c7f4f44 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelServiceInstanceBB.bpmn @@ -1,20 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="ChangeModelServiceInstanceBB" name="ChangeModelServiceInstanceBB" isExecutable="true"> - <bpmn2:startEvent id="ChangeModelServiceInstance_Start" name="Start"> + <bpmn2:startEvent id="ChangeModelServiceInstance_Start"> <bpmn2:outgoing>SequenceFlow_18i4a05</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:endEvent id="ChangeModelServiceInstance_End" name="End"> + <bpmn2:endEvent id="ChangeModelServiceInstance_End"> <bpmn2:incoming>SequenceFlow_0g502yj</bpmn2:incoming> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_18i4a05" sourceRef="ChangeModelServiceInstance_Start" targetRef="SDNCChangeModelServiceInstance" /> <bpmn2:sequenceFlow id="SequenceFlow_19kfk17" sourceRef="SDNCChangeModelServiceInstance" targetRef="AAIUpdateModelServiceInstance" /> <bpmn2:sequenceFlow id="SequenceFlow_0g502yj" sourceRef="AAIUpdateModelServiceInstance" targetRef="ChangeModelServiceInstance_End" /> - <bpmn2:serviceTask id="SDNCChangeModelServiceInstance" name="SDNC ChangeModel ServiceInstance" camunda:expression="${SDNCChangeAssignTasks.changeModelServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="SDNCChangeModelServiceInstance" name=" SDNC Change (svc instance) " camunda:expression="${SDNCChangeAssignTasks.changeModelServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_18i4a05</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_19kfk17</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="AAIUpdateModelServiceInstance" name="AAI Update Model ServiceInstance" camunda:expression="${AAIUpdateTasks.updateServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="AAIUpdateModelServiceInstance" name=" AAI Update (svc Instance) " camunda:expression="${AAIUpdateTasks.updateServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_19kfk17</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0g502yj</bpmn2:outgoing> </bpmn2:serviceTask> @@ -38,30 +38,30 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18i4a05_di" bpmnElement="SequenceFlow_18i4a05"> <di:waypoint xsi:type="dc:Point" x="111" y="106" /> - <di:waypoint xsi:type="dc:Point" x="213" y="106" /> + <di:waypoint xsi:type="dc:Point" x="234" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="162" y="85" width="0" height="12" /> + <dc:Bounds x="127.5" y="85" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_19kfk17_di" bpmnElement="SequenceFlow_19kfk17"> - <di:waypoint xsi:type="dc:Point" x="313" y="106" /> - <di:waypoint xsi:type="dc:Point" x="423" y="106" /> + <di:waypoint xsi:type="dc:Point" x="334" y="106" /> + <di:waypoint xsi:type="dc:Point" x="390" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="368" y="85" width="0" height="12" /> + <dc:Bounds x="317" y="85" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0g502yj_di" bpmnElement="SequenceFlow_0g502yj"> - <di:waypoint xsi:type="dc:Point" x="523" y="106" /> + <di:waypoint xsi:type="dc:Point" x="490" y="106" /> <di:waypoint xsi:type="dc:Point" x="632" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="577.5" y="85" width="0" height="12" /> + <dc:Bounds x="516" y="85" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_03km5f0_di" bpmnElement="SDNCChangeModelServiceInstance"> - <dc:Bounds x="213" y="66" width="100" height="80" /> + <dc:Bounds x="234" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_10b2mxq_di" bpmnElement="AAIUpdateModelServiceInstance"> - <dc:Bounds x="423" y="66" width="100" height="80" /> + <dc:Bounds x="390" y="66" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn index a48abe25a1..fd247d26eb 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVfModuleBB.bpmn @@ -1,19 +1,19 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="ChangeModelVfModuleBB" name="ChangeModelVfModuleBB" isExecutable="true"> - <bpmn:startEvent id="ChangeModelVfModuleBB_Start" name="Start"> + <bpmn:startEvent id="ChangeModelVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_0ieafii" sourceRef="ChangeModelVfModuleBB_Start" targetRef="ChangeModelVfModule" /> - <bpmn:endEvent id="ChangeModelVfModuleBB_End" name="End"> + <bpmn:endEvent id="ChangeModelVfModuleBB_End"> <bpmn:incoming>SequenceFlow_0xsp0pv</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="ChangeModelVfModule" name="SDNC VFModule Change Model" camunda:expression="${SDNCChangeAssignTasks.changeAssignModelVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ChangeModelVfModule" name=" SDNC Change (vf model) " camunda:expression="${SDNCChangeAssignTasks.changeAssignModelVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming> <bpmn:outgoing>SequenceFlow_14kvrbe</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_14kvrbe" sourceRef="ChangeModelVfModule" targetRef="UpdateVfModuleModel" /> - <bpmn:serviceTask id="UpdateVfModuleModel" name="Change VFModule Model (AAI)" camunda:expression="${AAIUpdateTasks.updateModelVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleModel" name=" AAI Update (vf model) " camunda:expression="${AAIUpdateTasks.updateModelVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_14kvrbe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xsp0pv</bpmn:outgoing> </bpmn:serviceTask> @@ -30,9 +30,9 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii"> <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="260" y="120" /> + <di:waypoint xsi:type="dc:Point" x="297" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="189.5" y="99" width="90" height="12" /> + <dc:Bounds x="208" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ChangeModelVfModuleBB_End"> @@ -42,23 +42,23 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ChangeModelVfModule"> - <dc:Bounds x="260" y="80" width="100" height="80" /> + <dc:Bounds x="297" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_14kvrbe_di" bpmnElement="SequenceFlow_14kvrbe"> - <di:waypoint xsi:type="dc:Point" x="360" y="120" /> - <di:waypoint xsi:type="dc:Point" x="466" y="120" /> + <di:waypoint xsi:type="dc:Point" x="397" y="120" /> + <di:waypoint xsi:type="dc:Point" x="435" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="368" y="99" width="90" height="12" /> + <dc:Bounds x="371" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleModel"> - <dc:Bounds x="466" y="80" width="100" height="80" /> + <dc:Bounds x="435" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> - <di:waypoint xsi:type="dc:Point" x="566" y="120" /> + <di:waypoint xsi:type="dc:Point" x="535" y="120" /> <di:waypoint xsi:type="dc:Point" x="636" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="601" y="99" width="0" height="12" /> + <dc:Bounds x="540.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn index 68f491e1f0..b320c12a5e 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ChangeModelVnfBB.bpmn @@ -1,23 +1,34 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="ChangeModelVnfBB" name="ChangeModelVnfBB" isExecutable="true"> - <bpmn2:startEvent id="ChangeModelVnf_Start" name="Start"> + <bpmn2:startEvent id="ChangeModelVnf_Start"> <bpmn2:outgoing>SequenceFlow_18i4a05</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:endEvent id="ChangeModelVnf_End" name="End"> + <bpmn2:endEvent id="ChangeModelVnf_End"> <bpmn2:incoming>SequenceFlow_0g502yj</bpmn2:incoming> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_18i4a05" sourceRef="ChangeModelVnf_Start" targetRef="SDNCChangeModel" /> <bpmn2:sequenceFlow id="SequenceFlow_19kfk17" sourceRef="SDNCChangeModel" targetRef="AAIUpdateModel" /> <bpmn2:sequenceFlow id="SequenceFlow_0g502yj" sourceRef="AAIUpdateModel" targetRef="ChangeModelVnf_End" /> - <bpmn2:serviceTask id="SDNCChangeModel" name="SDNC ChangeModel Vnf" camunda:expression="${SDNCChangeAssignTasks.changeModelVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="SDNCChangeModel" name=" SDNC Change (vnf model) " camunda:expression="${SDNCChangeAssignTasks.changeModelVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_18i4a05</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_19kfk17</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="AAIUpdateModel" name="AAI Update Model Vnf" camunda:expression="${AAIUpdateTasks.updateObjectVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="AAIUpdateModel" name=" AAI Update (vnf model) " camunda:expression="${AAIUpdateTasks.updateObjectVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_19kfk17</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0g502yj</bpmn2:outgoing> </bpmn2:serviceTask> + <bpmn2:subProcess id="SubProcess_1nibii6" name="Error Handling " triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_1fnfrm5"> + <bpmn2:outgoing>SequenceFlow_0s2743f</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_124ugc0"> + <bpmn2:incoming>SequenceFlow_0s2743f</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0s2743f" sourceRef="StartEvent_1fnfrm5" targetRef="EndEvent_124ugc0" /> + </bpmn2:subProcess> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -63,6 +74,28 @@ <bpmndi:BPMNShape id="ServiceTask_10b2mxq_di" bpmnElement="AAIUpdateModel"> <dc:Bounds x="423" y="66" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1nibii6_di" bpmnElement="SubProcess_1nibii6" isExpanded="true"> + <dc:Bounds x="164" y="244" width="231" height="135" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fnfrm5_di" bpmnElement="StartEvent_1fnfrm5"> + <dc:Bounds x="201" y="300" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="174" y="336" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_124ugc0_di" bpmnElement="EndEvent_124ugc0"> + <dc:Bounds x="338" y="300" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="311" y="336" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0s2743f_di" bpmnElement="SequenceFlow_0s2743f"> + <di:waypoint xsi:type="dc:Point" x="237" y="318" /> + <di:waypoint xsi:type="dc:Point" x="338" y="318" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="287.5" y="297" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateCustomerBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateCustomerBB.bpmn index 1e88963c21..42c6383f8b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateCustomerBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateCustomerBB.bpmn @@ -1,14 +1,14 @@ <?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="1.8.2"> +<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="1.10.0"> <bpmn:process id="CreateCustomerBB" name="CreateCustomerBB" isExecutable="true"> - <bpmn:startEvent id="CreateCustomerBB_Start" name="Start"> + <bpmn:startEvent id="CreateCustomerBB_Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_1wz1rfg" sourceRef="CreateCustomerBB_Start" targetRef="CreateCustomerAAI" /> <bpmn:endEvent id="CreateCustomerBB_End"> <bpmn:incoming>SequenceFlow_0kfkpbh</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="CreateCustomerAAI" name="CreateCustomer (AAI)" camunda:expression="${AAICreateTasks.createCustomer(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="CreateCustomerAAI" name=" AAI Create (cust) " camunda:expression="${AAICreateTasks.createCustomer(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kfkpbh</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn index 0d2d829b6b..609edf4b9b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateNetworkBB" name="CreateNetworkBB" isExecutable="true"> - <bpmn2:startEvent id="createNetwork_startEvent" name="Start Flow"> + <bpmn2:startEvent id="createNetwork_startEvent"> <bpmn2:outgoing>SequenceFlow_1maepy7</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:endEvent id="createNetwork_EndEvent" name="End Flow"> + <bpmn2:endEvent id="createNetwork_EndEvent"> <bpmn2:incoming>SequenceFlow_0sissul</bpmn2:incoming> </bpmn2:endEvent> - <bpmn2:serviceTask id="QueryVpnBinding_ServiceTask" name="Query Vpn Binding in AAI" camunda:expression="${AAIQueryTasks.queryNetworkVpnBinding(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="QueryVpnBinding_ServiceTask" name=" AAI Query (vpn binding) " camunda:expression="${AAIQueryTasks.queryNetworkVpnBinding(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_1oc7wcr</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0n42zi5</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="Create_Network_ServiceTask" name="Create Network" camunda:expression="${NetworkAdapterCreateTasks.createNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="Create_Network_ServiceTask" name=" AIC Create (network) " camunda:expression="${NetworkAdapterCreateTasks.createNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_1eqfh23</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0innva6</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="QueryNetworkPolicy_ServiceTask" name="Query Network Policy in AAI" camunda:expression="${AAIQueryTasks.queryNetworkPolicy(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="QueryNetworkPolicy_ServiceTask" name=" AAI Query (net policy) " camunda:expression="${AAIQueryTasks.queryNetworkPolicy(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0n42zi5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1yy4aik</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="QueryNetworkTableRef_ServiceTask" name="Query Network TableRef in AAI" camunda:expression="${AAIQueryTasks.queryNetworkTableRef(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="QueryNetworkTableRef_ServiceTask" name=" AAI Query (net table) " camunda:expression="${AAIQueryTasks.queryNetworkTableRef(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_1yy4aik</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1h9kkhb</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="Update_Network_AAI_ServiceTask" name="Update Network in AAI" camunda:expression="${AAIUpdateTasks.updateNetworkCreated(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="Update_Network_AAI_ServiceTask" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateNetworkCreated(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0innva6</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0sissul</bpmn2:outgoing> </bpmn2:serviceTask> @@ -64,13 +64,13 @@ <bpmndi:BPMNShape id="StartEvent_0lbwmd1_di" bpmnElement="createNetwork_startEvent"> <dc:Bounds x="236" y="-55" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="230" y="-14" width="48" height="14" /> + <dc:Bounds x="229" y="-14" width="50" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10l9a3s_di" bpmnElement="createNetwork_EndEvent"> <dc:Bounds x="656" y="326" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="652" y="362" width="45" height="14" /> + <dc:Bounds x="652" y="362" width="46" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1k7d8ih_di" bpmnElement="QueryVpnBinding_ServiceTask"> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn index c6c3599449..fb2bfae01a 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkCollectionBB.bpmn @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateNetworkCollectionBB" name="CreateNetworkCollectionBB" isExecutable="true"> - <bpmn2:startEvent id="createNetworkCollection_startEvent" name="Start Flow"> + <bpmn2:startEvent id="createNetworkCollection_startEvent"> <bpmn2:outgoing>SequenceFlow_1maepy7</bpmn2:outgoing> </bpmn2:startEvent> - <bpmn2:endEvent id="createNetworkCollection_EndEvent" name="End Flow"> + <bpmn2:endEvent id="createNetworkCollection_EndEvent"> <bpmn2:incoming>SequenceFlow_0hhklb4</bpmn2:incoming> </bpmn2:endEvent> <bpmn2:serviceTask id="BuildName_ServiceTask" name="Buld Collection and Instance Names" camunda:expression="${CreateNetworkCollection.buildNetworkCollectionName(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))} "> @@ -12,22 +12,22 @@ <bpmn2:outgoing>SequenceFlow_06rq9pi</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_1maepy7" sourceRef="createNetworkCollection_startEvent" targetRef="BuildName_ServiceTask" /> - <bpmn2:serviceTask id="ServiceTask_create_NetworkCollection" name="Create Network Collection in AAI " camunda:expression="${AAICreateTasks.createNetworkCollection(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="ServiceTask_create_NetworkCollection" name=" AAI Create (net collection) " camunda:expression="${AAICreateTasks.createNetworkCollection(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_06rq9pi</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_05yxpu5</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_06rq9pi" sourceRef="BuildName_ServiceTask" targetRef="ServiceTask_create_NetworkCollection" /> - <bpmn2:serviceTask id="ServiceTask_create_NetworkCollectionInstanceGroup" name="Create Network Collection Instance Group in AAI " camunda:expression="${AAICreateTasks.createNetworkCollectionInstanceGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="ServiceTask_create_NetworkCollectionInstanceGroup" name=" AAI Create (instance grp) " camunda:expression="${AAICreateTasks.createNetworkCollectionInstanceGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_05yxpu5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0z4c30j</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="ServiceTask_Connect_Collection_to_InstanceGroup" name="Connect Collection to InstanceGroup " camunda:expression="${CreateNetworkCollection.connectCollectionToInstanceGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))} "> + <bpmn2:serviceTask id="ServiceTask_Connect_Collection_to_InstanceGroup" name=" AAI Connect (net collection) " camunda:expression="${CreateNetworkCollection.connectCollectionToInstanceGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))} "> <bpmn2:incoming>SequenceFlow_0z4c30j</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1hij1px</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_05yxpu5" sourceRef="ServiceTask_create_NetworkCollection" targetRef="ServiceTask_create_NetworkCollectionInstanceGroup" /> <bpmn2:sequenceFlow id="SequenceFlow_0z4c30j" sourceRef="ServiceTask_create_NetworkCollectionInstanceGroup" targetRef="ServiceTask_Connect_Collection_to_InstanceGroup" /> - <bpmn2:serviceTask id="ServiceTask_Connect_Collection_to_ServiceInstance" name="Connect Collection to ServiceInstance " camunda:expression="${CreateNetworkCollection.connectCollectionToServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))} "> + <bpmn2:serviceTask id="ServiceTask_Connect_Collection_to_ServiceInstance" name=" AAI Connect (svc instance) " camunda:expression="${CreateNetworkCollection.connectCollectionToServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))} "> <bpmn2:incoming>SequenceFlow_1hij1px</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0hhklb4</bpmn2:outgoing> </bpmn2:serviceTask> @@ -41,13 +41,13 @@ <bpmndi:BPMNShape id="StartEvent_0lbwmd1_di" bpmnElement="createNetworkCollection_startEvent"> <dc:Bounds x="236" y="-55" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="230" y="-14" width="48" height="14" /> + <dc:Bounds x="229" y="-14" width="50" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10l9a3s_di" bpmnElement="createNetworkCollection_EndEvent"> <dc:Bounds x="1132" y="-55" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1128" y="-19" width="45" height="12" /> + <dc:Bounds x="1128" y="-19" width="46" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_08q9eo4_di" bpmnElement="BuildName_ServiceTask"> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn index bd24eeaed7..bd126de24e 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn @@ -1,15 +1,15 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="CreateVfModuleBB" name="CreateVfModuleBB" isExecutable="true"> - <bpmn:startEvent id="CreateVfModuleBB_Start" name="Start"> + <bpmn:startEvent id="CreateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="QueryVfModule" name="Query VF Module (SDNC)" camunda:expression="${SDNCQueryTasks.queryVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="QueryVfModule" name=" SDNC Get (vf module) " camunda:expression="${SDNCQueryTasks.queryVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1s4rpyp</bpmn:incoming> <bpmn:outgoing>SequenceFlow_15hn8si</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1xr6chl" sourceRef="CreateVfModuleBB_Start" targetRef="QueryVnf" /> - <bpmn:endEvent id="CreateVfModuleBB_End" name="End"> + <bpmn:endEvent id="CreateVfModuleBB_End"> <bpmn:incoming>SequenceFlow_1stomxq</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="CreateVfModule" name="Create VF Module (VNF)" camunda:expression="${VnfAdapterCreateTasks.createVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -18,7 +18,7 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_15hn8si" sourceRef="QueryVfModule" targetRef="CreateVfModule" /> <bpmn:sequenceFlow id="SequenceFlow_1s4rpyp" sourceRef="QueryVnf" targetRef="QueryVfModule" /> - <bpmn:serviceTask id="QueryVnf" name="Query VNF (SDNC)" camunda:expression="${SDNCQueryTasks.queryVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="QueryVnf" name=" SDNC Get (vnf) " camunda:expression="${SDNCQueryTasks.queryVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1xr6chl</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1s4rpyp</bpmn:outgoing> </bpmn:serviceTask> @@ -35,97 +35,130 @@ <bpmn:outgoing>SequenceFlow_0ecr393</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_1stomxq" sourceRef="UpdateVfModuleStatus" targetRef="CreateVfModuleBB_End" /> - <bpmn:serviceTask id="UpdateVfModuleStatus" name="Update VfModule Ostatus to Created (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0qqsilv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1stomxq</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0qqsilv" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleStatus" /> - <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name="Update VfModule HeatStackId (AAI)" camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0ecr393</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0qqsilv</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:subProcess id="SubProcess_1getwnf" name="Error Handling " triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1c8o652"> + <bpmn:outgoing>SequenceFlow_0gcots6</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1emam1w"> + <bpmn:incoming>SequenceFlow_0gcots6</bpmn:incoming> + <bpmn:terminateEventDefinition /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0gcots6" sourceRef="StartEvent_1c8o652" targetRef="EndEvent_1emam1w" /> + </bpmn:subProcess> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVfModuleBB"> <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="CreateVfModuleBB_Start"> - <dc:Bounds x="213" y="-3" width="36" height="36" /> + <dc:Bounds x="100" y="88" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="219" y="33" width="23" height="12" /> + <dc:Bounds x="106" y="124" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="QueryVfModule"> - <dc:Bounds x="529" y="-25" width="100" height="80" /> + <dc:Bounds x="416" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> - <di:waypoint xsi:type="dc:Point" x="249" y="15" /> - <di:waypoint xsi:type="dc:Point" x="329" y="15" /> + <di:waypoint xsi:type="dc:Point" x="136" y="106" /> + <di:waypoint xsi:type="dc:Point" x="216" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="289" y="0" width="0" height="0" /> + <dc:Bounds x="131" y="91" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="CreateVfModuleBB_End"> - <dc:Bounds x="1391" y="-3" width="36" height="36" /> + <dc:Bounds x="1278" y="88" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1399" y="37" width="19" height="12" /> + <dc:Bounds x="1286" y="128" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="CreateVfModule"> - <dc:Bounds x="725" y="-25" width="100" height="80" /> + <dc:Bounds x="612" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15hn8si_di" bpmnElement="SequenceFlow_15hn8si"> - <di:waypoint xsi:type="dc:Point" x="629" y="15" /> - <di:waypoint xsi:type="dc:Point" x="725" y="15" /> + <di:waypoint xsi:type="dc:Point" x="516" y="106" /> + <di:waypoint xsi:type="dc:Point" x="612" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="677" y="0" width="0" height="0" /> + <dc:Bounds x="519" y="91" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1s4rpyp_di" bpmnElement="SequenceFlow_1s4rpyp"> - <di:waypoint xsi:type="dc:Point" x="429" y="15" /> - <di:waypoint xsi:type="dc:Point" x="529" y="15" /> + <di:waypoint xsi:type="dc:Point" x="316" y="106" /> + <di:waypoint xsi:type="dc:Point" x="416" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="479" y="0" width="0" height="0" /> + <dc:Bounds x="321" y="91" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1frb5h2_di" bpmnElement="QueryVnf"> - <dc:Bounds x="329" y="-25" width="100" height="80" /> + <dc:Bounds x="216" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_16g4dz0_di" bpmnElement="SequenceFlow_16g4dz0"> - <di:waypoint xsi:type="dc:Point" x="825" y="15" /> - <di:waypoint xsi:type="dc:Point" x="890" y="15" /> + <di:waypoint xsi:type="dc:Point" x="712" y="106" /> + <di:waypoint xsi:type="dc:Point" x="777" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="857.5" y="-6" width="0" height="12" /> + <dc:Bounds x="700" y="85" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ecr393_di" bpmnElement="SequenceFlow_0ecr393"> - <di:waypoint xsi:type="dc:Point" x="990" y="15" /> - <di:waypoint xsi:type="dc:Point" x="1063" y="15" /> + <di:waypoint xsi:type="dc:Point" x="877" y="106" /> + <di:waypoint xsi:type="dc:Point" x="950" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1027" y="0" width="0" height="0" /> + <dc:Bounds x="869" y="91" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1i1pfzb_di" bpmnElement="VnfAdapter"> - <dc:Bounds x="890" y="-25" width="100" height="80" /> + <dc:Bounds x="777" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1stomxq_di" bpmnElement="SequenceFlow_1stomxq"> - <di:waypoint xsi:type="dc:Point" x="1327" y="15" /> - <di:waypoint xsi:type="dc:Point" x="1391" y="15" /> + <di:waypoint xsi:type="dc:Point" x="1214" y="106" /> + <di:waypoint xsi:type="dc:Point" x="1278" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1359" y="0" width="0" height="0" /> + <dc:Bounds x="1201" y="91" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0fpfn71_di" bpmnElement="UpdateVfModuleStatus"> - <dc:Bounds x="1227" y="-25" width="100" height="80" /> + <dc:Bounds x="1114" y="66" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0qqsilv_di" bpmnElement="SequenceFlow_0qqsilv"> - <di:waypoint xsi:type="dc:Point" x="1163" y="15" /> - <di:waypoint xsi:type="dc:Point" x="1227" y="15" /> + <di:waypoint xsi:type="dc:Point" x="1050" y="106" /> + <di:waypoint xsi:type="dc:Point" x="1114" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1195" y="0" width="0" height="0" /> + <dc:Bounds x="1037" y="91" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_04k1b85_di" bpmnElement="UpdateVfModuleHeatStackId"> - <dc:Bounds x="1063" y="-25" width="100" height="80" /> + <dc:Bounds x="950" y="66" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1getwnf_di" bpmnElement="SubProcess_1getwnf" isExpanded="true"> + <dc:Bounds x="172" y="276" width="231" height="135" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1c8o652_di" bpmnElement="StartEvent_1c8o652"> + <dc:Bounds x="211" y="334" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="184" y="370" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1emam1w_di" bpmnElement="EndEvent_1emam1w"> + <dc:Bounds x="348" y="334" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="321" y="370" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gcots6_di" bpmnElement="SequenceFlow_0gcots6"> + <di:waypoint xsi:type="dc:Point" x="247" y="352" /> + <di:waypoint xsi:type="dc:Point" x="348" y="352" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="297.5" y="331" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn index ffe74d1295..747265c2cf 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn @@ -1,5 +1,5 @@ <?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="1.4.0"> +<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="1.10.0"> <bpmn:process id="CreateVolumeGroupBB" name="CreateVolumeGroupBB" isExecutable="true"> <bpmn:startEvent id="CreateVolumeGroupBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> @@ -8,17 +8,17 @@ <bpmn:endEvent id="CreateVolumeGroupBB_End"> <bpmn:incoming>SequenceFlow_0mh0v9h</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="CreateVolumeGroupVnfAdapter" name="CreateVolumeGroupVnfAdapter Request" camunda:expression="${VnfAdapterCreateTasks.createVolumeGroupRequest(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="CreateVolumeGroupVnfAdapter" name="Create Request" camunda:expression="${VnfAdapterCreateTasks.createVolumeGroupRequest(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_06q6g74</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kfkpbh</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0kfkpbh" sourceRef="CreateVolumeGroupVnfAdapter" targetRef="Vnf_Adapter" /> - <bpmn:serviceTask id="UpdateVolumeGroupAAI" name="UpdateVolumeGroupAAI" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVolumeGroupAAI" name=" AAI Update (volume) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1d5nux2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0mh0v9h" sourceRef="UpdateVolumeGroupAAI" targetRef="CreateVolumeGroupBB_End" /> - <bpmn:serviceTask id="QueryVfModuleSDNC" name="Query Vf Module (SDNC)" camunda:expression="${SDNCQueryTasks.queryVfModuleForVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="QueryVfModuleSDNC" name=" SDNC Get (vnf) " camunda:expression="${SDNCQueryTasks.queryVfModuleForVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_06q6g74</bpmn:outgoing> </bpmn:serviceTask> @@ -35,10 +35,21 @@ </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_06flg6h" sourceRef="Vnf_Adapter" targetRef="UpdateVolumeGroupHeatStackId" /> <bpmn:sequenceFlow id="SequenceFlow_1d5nux2" sourceRef="UpdateVolumeGroupHeatStackId" targetRef="UpdateVolumeGroupAAI" /> - <bpmn:serviceTask id="UpdateVolumeGroupHeatStackId" name="Update VolumeGroup HeatStackId (AAI)" camunda:expression="${AAIUpdateTasks.updateHeatStackIdVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVolumeGroupHeatStackId" name=" AAI Update (volume) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_06flg6h</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1d5nux2</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:subProcess id="SubProcess_14koudj" name="Error Handling " triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1f7qpgu"> + <bpmn:outgoing>SequenceFlow_1wtq4y7</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0zycnsk"> + <bpmn:incoming>SequenceFlow_1wtq4y7</bpmn:incoming> + <bpmn:terminateEventDefinition /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1wtq4y7" sourceRef="StartEvent_1f7qpgu" targetRef="EndEvent_0zycnsk" /> + </bpmn:subProcess> </bpmn:process> <bpmn:error id="Error_0pz4sdi" name="gDelegateError" errorCode="7000" /> <bpmn:escalation id="Escalation_1hjulni" name="Escalation_2cgup2p" /> @@ -113,6 +124,28 @@ <bpmndi:BPMNShape id="ServiceTask_0m035ns_di" bpmnElement="UpdateVolumeGroupHeatStackId"> <dc:Bounds x="774" y="80" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_14koudj_di" bpmnElement="SubProcess_14koudj" isExpanded="true"> + <dc:Bounds x="310" y="264" width="231" height="135" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1f7qpgu_di" bpmnElement="StartEvent_1f7qpgu"> + <dc:Bounds x="350" y="323" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="323" y="359" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0zycnsk_di" bpmnElement="EndEvent_0zycnsk"> + <dc:Bounds x="487" y="323" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="460" y="359" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1wtq4y7_di" bpmnElement="SequenceFlow_1wtq4y7"> + <di:waypoint xsi:type="dc:Point" x="386" y="341" /> + <di:waypoint xsi:type="dc:Point" x="487" y="341" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436.5" y="320" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn index 836f52b9be..5c85d17403 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateNetworkBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DeactivateNetworkBB" name="DeactivateNetworkBB" isExecutable="true"> <bpmn2:startEvent id="DeactivateNetworkBB_Start" name="Start"> <bpmn2:outgoing>SequenceFlow_05elmhj</bpmn2:outgoing> @@ -7,11 +7,11 @@ <bpmn2:endEvent id="DeactivateNetworkBB_End" name="End"> <bpmn2:incoming>SequenceFlow_18atf08</bpmn2:incoming> </bpmn2:endEvent> - <bpmn2:serviceTask id="DeactivateNetworkSDNC" name="Deactivate Network (SDNC)" camunda:expression="${SDNCDeactivateTasks.deactivateNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="DeactivateNetworkSDNC" name=" SDNC Deactivate Network " camunda:expression="${SDNCDeactivateTasks.deactivateNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_05elmhj</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0xbvwsu</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="DeactivateNetworkAAI" name="Deactivate Network (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:serviceTask id="DeactivateNetworkAAI" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0xbvwsu</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18atf08</bpmn2:outgoing> </bpmn2:serviceTask> @@ -25,46 +25,46 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeactivateNetworkBB"> <bpmndi:BPMNShape id="StartEvent_0lbwmd1_di" bpmnElement="DeactivateNetworkBB_Start"> - <dc:Bounds x="545" y="-55" width="36" height="36" /> + <dc:Bounds x="242" y="100" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="551" y="-14" width="24" height="12" /> + <dc:Bounds x="248" y="141" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10l9a3s_di" bpmnElement="DeactivateNetworkBB_End"> - <dc:Bounds x="975" y="-55" width="36" height="36" /> + <dc:Bounds x="672" y="100" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="985" y="-19" width="19" height="12" /> + <dc:Bounds x="682" y="136" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1k7d8ih_di" bpmnElement="DeactivateNetworkSDNC"> - <dc:Bounds x="653" y="-77" width="100" height="80" /> + <dc:Bounds x="350" y="78" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1911vum_di" bpmnElement="DeactivateNetworkAAI"> - <dc:Bounds x="802" y="-77" width="100" height="80" /> + <dc:Bounds x="499" y="78" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_05elmhj_di" bpmnElement="SequenceFlow_05elmhj"> - <di:waypoint xsi:type="dc:Point" x="581" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="653" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="278" y="118" /> + <di:waypoint xsi:type="dc:Point" x="350" y="118" /> <bpmndi:BPMNLabel> - <dc:Bounds x="617" y="-62" width="0" height="0" /> + <dc:Bounds x="269" y="93" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0xbvwsu_di" bpmnElement="SequenceFlow_0xbvwsu"> - <di:waypoint xsi:type="dc:Point" x="753" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="778" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="778" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="802" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="450" y="118" /> + <di:waypoint xsi:type="dc:Point" x="475" y="118" /> + <di:waypoint xsi:type="dc:Point" x="475" y="118" /> + <di:waypoint xsi:type="dc:Point" x="499" y="118" /> <bpmndi:BPMNLabel> - <dc:Bounds x="793" y="-37" width="0" height="0" /> + <dc:Bounds x="445" y="118" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18atf08_di" bpmnElement="SequenceFlow_18atf08"> - <di:waypoint xsi:type="dc:Point" x="902" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="939" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="939" y="-37" /> - <di:waypoint xsi:type="dc:Point" x="975" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="599" y="118" /> + <di:waypoint xsi:type="dc:Point" x="636" y="118" /> + <di:waypoint xsi:type="dc:Point" x="636" y="118" /> + <di:waypoint xsi:type="dc:Point" x="672" y="118" /> <bpmndi:BPMNLabel> - <dc:Bounds x="954" y="-37" width="0" height="0" /> + <dc:Bounds x="606" y="118" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn index 80faf1378c..5284788b89 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateServiceInstanceBB.bpmn @@ -1,5 +1,5 @@ <?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="1.8.2"> +<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="1.10.0"> <bpmn:process id="DeactivateServiceInstanceBB" name="DeactivateServiceInstanceBB" isExecutable="true"> <bpmn:startEvent id="Start_DeactivateServiceInstanceBB" name="Start"> <bpmn:outgoing>SequenceFlow_101w1ck</bpmn:outgoing> @@ -9,11 +9,11 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_00q7fsg" sourceRef="Task_DeactivateServiceInstance_SDNC" targetRef="Task_DeactivateServiceInstance_AAI" /> <bpmn:sequenceFlow id="SequenceFlow_0pioehv" sourceRef="Task_DeactivateServiceInstance_AAI" targetRef="End_DeactivateServiceInstanceBB" /> - <bpmn:serviceTask id="Task_DeactivateServiceInstance_AAI" name="Update Service OStatus to Assigned (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedService(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_DeactivateServiceInstance_AAI" name=" AAI Update (svc instance) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedService(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_00q7fsg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0pioehv</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_DeactivateServiceInstance_SDNC" name="Service Instance Deactivate (SDNC)" camunda:expression="${SDNCDeactivateTasks.deactivateServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_DeactivateServiceInstance_SDNC" name=" SDNC Deactivate (svc instance) " camunda:expression="${SDNCDeactivateTasks.deactivateServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_101w1ck</bpmn:incoming> <bpmn:outgoing>SequenceFlow_00q7fsg</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn index 85cde2aca7..f30a1f18ce 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVfModuleBB.bpmn @@ -1,15 +1,15 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DeactivateVfModuleBB" name="DeactivateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="DeactivateVfModuleBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_0m379r2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="DeactivateVfModule" name="SDNC Vf Module Deactivate " camunda:expression="${SDNCDeactivateTasks.deactivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="DeactivateVfModule" name=" SDNC Deactivate (vf module) " camunda:expression="${SDNCDeactivateTasks.deactivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0m379r2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_01bdpek</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0m379r2" sourceRef="DeactivateVfModuleBB_Start" targetRef="DeactivateVfModule" /> - <bpmn:serviceTask id="UpdateVfModuleDeactivateStatus" name="Deactivate OStatus (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeactivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleDeactivateStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeactivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_01bdpek</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1y1c7fh</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn index d6b7dd6534..790cab1737 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVnfBB.bpmn @@ -1,5 +1,5 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DeactivateVnfBB" name="DeactivateVnfBB" isExecutable="true"> <bpmn:startEvent id="Start_DeactivateVnfBB" name="start"> <bpmn:outgoing>SequenceFlow_0k9qnoi</bpmn:outgoing> @@ -10,11 +10,11 @@ <bpmn:incoming>SequenceFlow_0vnitwg</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0vnitwg" sourceRef="Task_DeactivateOrchestrationStatusVnf" targetRef="End_DeactivateVnfBB" /> - <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyDeactivate" name="Call SDNC Adapter VNF Topology Deactivate" camunda:expression="${SDNCDeactivateTasks.deactivateVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyDeactivate" name=" SDNC Deactivate (vnf) " camunda:expression="${SDNCDeactivateTasks.deactivateVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0k9qnoi</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0r6pzwt</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Task_DeactivateOrchestrationStatusVnf" name="Deactivate Orchestration Status Vnf (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_DeactivateOrchestrationStatusVnf" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0r6pzwt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0vnitwg</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVolumeGroupBB.bpmn index 2b2e30b773..63a01d6573 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivateVolumeGroupBB.bpmn @@ -1,5 +1,5 @@ <?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="1.8.2"> +<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="1.10.0"> <bpmn:process id="DeactivateVolumeGroupBB" name="DeactivateVolumeGroupBB" isExecutable="true"> <bpmn:startEvent id="DeactivateVolumeGroupBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> @@ -8,7 +8,7 @@ <bpmn:endEvent id="DeactivateVolumeGroupBB_End"> <bpmn:incoming>SequenceFlow_0mh0v9h</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="DeactivateVolumeGroup" name="Deactivate VolumeGroup" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="DeactivateVolumeGroup" name=" AAI Update (volume) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn index faa40600a5..95e481db4f 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn @@ -1,20 +1,20 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DeleteNetworkBB" name="DeleteNetworkBB" isExecutable="true"> - <bpmn:startEvent id="deleteNetwork_startEvent" name="Start Flow"> + <bpmn:startEvent id="deleteNetwork_startEvent"> <bpmn:outgoing>SequenceFlow_1mc3d3f</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="updateNetworkAAI" name="Update Network (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="updateNetworkAAI" name=" AAI Update (network) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1c906im</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0nhd7b7</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1mc3d3f" sourceRef="deleteNetwork_startEvent" targetRef="deleteNetworkAIC" /> <bpmn:sequenceFlow id="SequenceFlow_1c906im" sourceRef="deleteNetworkAIC" targetRef="updateNetworkAAI" /> - <bpmn:serviceTask id="deleteNetworkAIC" name="Delete Network (AIC)" camunda:expression="${NetworkAdapterDeleteTasks.deleteNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="deleteNetworkAIC" name=" AIC Delete (network) " camunda:expression="${NetworkAdapterDeleteTasks.deleteNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1mc3d3f</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1c906im</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="deleteNetwork_endEvent" name="End Flow"> + <bpmn:endEvent id="deleteNetwork_endEvent"> <bpmn:incoming>SequenceFlow_0nhd7b7</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0nhd7b7" sourceRef="updateNetworkAAI" targetRef="deleteNetwork_endEvent" /> @@ -38,24 +38,24 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0zd65z2_di" bpmnElement="updateNetworkAAI"> - <dc:Bounds x="555" y="80" width="100" height="80" /> + <dc:Bounds x="530" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1mc3d3f_di" bpmnElement="SequenceFlow_1mc3d3f"> <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="320" y="120" /> + <di:waypoint xsi:type="dc:Point" x="370" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="219.5" y="99" width="90" height="12" /> + <dc:Bounds x="244.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1c906im_di" bpmnElement="SequenceFlow_1c906im"> - <di:waypoint xsi:type="dc:Point" x="420" y="120" /> - <di:waypoint xsi:type="dc:Point" x="555" y="120" /> + <di:waypoint xsi:type="dc:Point" x="470" y="120" /> + <di:waypoint xsi:type="dc:Point" x="530" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="442.5" y="99" width="90" height="12" /> + <dc:Bounds x="455" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1gcfuzf_di" bpmnElement="deleteNetworkAIC"> - <dc:Bounds x="320" y="80" width="100" height="80" /> + <dc:Bounds x="370" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_02vxchc_di" bpmnElement="deleteNetwork_endEvent"> <dc:Bounds x="806" y="102" width="36" height="36" /> @@ -64,10 +64,10 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0nhd7b7_di" bpmnElement="SequenceFlow_0nhd7b7"> - <di:waypoint xsi:type="dc:Point" x="655" y="120" /> + <di:waypoint xsi:type="dc:Point" x="630" y="120" /> <di:waypoint xsi:type="dc:Point" x="806" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="685.5" y="99" width="90" height="12" /> + <dc:Bounds x="673" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index 832a96cae7..5795c1c671 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -1,7 +1,7 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DeleteVfModuleBB" name="Start" isExecutable="true"> - <bpmn:startEvent id="DeleteVfModuleBB_Start" name="Start"> + <bpmn:startEvent id="DeleteVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1537yw5</bpmn:outgoing> </bpmn:startEvent> <bpmn:serviceTask id="DeleteVfModuleVnfAdapter" name="Delete Vf Module VnfAdapter" camunda:expression="${VnfAdapterDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -9,12 +9,12 @@ <bpmn:outgoing>SequenceFlow_08tvhtf</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1537yw5" sourceRef="DeleteVfModuleBB_Start" targetRef="DeleteVfModuleVnfAdapter" /> - <bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name="Update OStatus (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1mxrfqv</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_08tvhtf" sourceRef="DeleteVfModuleVnfAdapter" targetRef="VnfAdapter" /> - <bpmn:endEvent id="DeleteVfModuleBB_End" name="End"> + <bpmn:endEvent id="DeleteVfModuleBB_End"> <bpmn:incoming>SequenceFlow_1mxrfqv</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1mxrfqv" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" /> @@ -30,6 +30,17 @@ <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="UpdateVfModuleDeleteStatus" /> + <bpmn:subProcess id="SubProcess_11p7mrh" name="Error Handling " triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1xp6ewt"> + <bpmn:outgoing>SequenceFlow_0h607z0</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0guhjau"> + <bpmn:incoming>SequenceFlow_0h607z0</bpmn:incoming> + <bpmn:terminateEventDefinition /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0h607z0" sourceRef="StartEvent_1xp6ewt" targetRef="EndEvent_0guhjau" /> + </bpmn:subProcess> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB"> @@ -82,6 +93,28 @@ <dc:Bounds x="560" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true"> + <dc:Bounds x="261" y="276" width="231" height="135" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1xp6ewt_di" bpmnElement="StartEvent_1xp6ewt"> + <dc:Bounds x="304" y="338" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="277" y="374" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0guhjau_di" bpmnElement="EndEvent_0guhjau"> + <dc:Bounds x="433" y="338" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="406" y="374" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0h607z0_di" bpmnElement="SequenceFlow_0h607z0"> + <di:waypoint xsi:type="dc:Point" x="340" y="356" /> + <di:waypoint xsi:type="dc:Point" x="433" y="356" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="386.5" y="335" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn index 97ac11373e..f2bd2246e4 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn @@ -1,5 +1,5 @@ <?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="1.4.0"> +<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="1.10.0"> <bpmn:process id="DeleteVolumeGroupBB" name="DeleteVolumeGroupBB" isExecutable="true"> <bpmn:startEvent id="DeleteVolumeGroupBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> @@ -8,7 +8,7 @@ <bpmn:endEvent id="DeleteVolumeGroupBB_End"> <bpmn:incoming>SequenceFlow_0mh0v9h</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="UpdateVolumeGroupAAI" name="Update Volume Group A&AI (AAI Assigned)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVolumeGroupAAI" name=" AAI Update (volume grp) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0fkan8t</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing> </bpmn:serviceTask> @@ -33,6 +33,16 @@ <bpmn:incoming>SequenceFlow_13ngwev</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0fkan8t</bpmn:outgoing> </bpmn:callActivity> + <bpmn:subProcess id="SubProcess_089t601" name="Sub Process Error" triggeredByEvent="true"> + <bpmn:endEvent id="EndEvent_18lpeyi" name="End"> + <bpmn:incoming>SequenceFlow_07rsz9o</bpmn:incoming> + </bpmn:endEvent> + <bpmn:startEvent id="StartEvent_1gun94q" name="Start"> + <bpmn:outgoing>SequenceFlow_07rsz9o</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_07rsz9o" sourceRef="StartEvent_1gun94q" targetRef="EndEvent_18lpeyi" /> + </bpmn:subProcess> </bpmn:process> <bpmn:error id="Error_0pz4sdi" name="gDelegateError" errorCode="7000" /> <bpmn:escalation id="Escalation_1hjulni" name="Escalation_2cgup2p" /> @@ -87,6 +97,30 @@ <bpmndi:BPMNShape id="CallActivity_0li7q97_di" bpmnElement="VnfAdapter"> <dc:Bounds x="526" y="80" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_089t601_di" bpmnElement="SubProcess_089t601" isExpanded="true"> + <dc:Bounds x="459" y="242" width="233" height="135" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_18lpeyi_di" bpmnElement="EndEvent_18lpeyi"> + <dc:Bounds x="613" y="287" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="622" y="327" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1gun94q_di" bpmnElement="StartEvent_1gun94q"> + <dc:Bounds x="498" y="287" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="505" y="327" width="24" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_07rsz9o_di" bpmnElement="SequenceFlow_07rsz9o"> + <di:waypoint xsi:type="dc:Point" x="534" y="305" /> + <di:waypoint xsi:type="dc:Point" x="573" y="305" /> + <di:waypoint xsi:type="dc:Point" x="573" y="305" /> + <di:waypoint xsi:type="dc:Point" x="613" y="305" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="543" y="305" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn index 8640f7e069..01d88b91dc 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn @@ -1,5 +1,5 @@ <?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="1.8.2"> +<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="1.10.0"> <bpmn:process id="ExecuteBuildingBlock" name="ExecuteBuildingBlock" isExecutable="true"> <bpmn:startEvent id="Start_ExecuteBuildingBlock" name="start"> <bpmn:outgoing>SequenceFlow_0rq4c5r</bpmn:outgoing> @@ -38,271 +38,240 @@ <bpmn:outgoing>SequenceFlow_1ryv9sh</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0je0y25" sourceRef="StatusPolicy" targetRef="CheckOrchestrationStatusValidationResults" /> - <bpmn:boundaryEvent id="BoundaryEvent_0i3q236" attachedToRef="Task_BBInputSetup"> - <bpmn:outgoing>SequenceFlow_0yeaaxu</bpmn:outgoing> - <bpmn:errorEventDefinition errorRef="Error_17zcdbk" /> - </bpmn:boundaryEvent> - <bpmn:serviceTask id="Task_QueryRainyDayTable" name="QueryRainyDayTable" camunda:expression="${ExecuteBuildingBlockRainyDay.queryRainyDayTable(execution)}"> - <bpmn:incoming>SequenceFlow_0yeaaxu</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1b5op07</bpmn:incoming> - <bpmn:incoming>SequenceFlow_030qtgc</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0a62t4c</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:endEvent id="ErrorEnd2" name="end"> - <bpmn:incoming>SequenceFlow_0h8v45y</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1db2c7t</bpmn:incoming> - </bpmn:endEvent> - <bpmn:exclusiveGateway id="ExclusiveGateway_1aonzik" name="Check HandlingCode" default="SequenceFlow_0h8v45y"> - <bpmn:incoming>SequenceFlow_0a62t4c</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0fwsjva</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0h8v45y</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_RetryTimer" name="RetryTimer"> - <bpmn:incoming>SequenceFlow_0ndt8ft</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_07a1ytc</bpmn:outgoing> - <bpmn:timerEventDefinition> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("RetryDuration")}]]></bpmn:timeDuration> - </bpmn:timerEventDefinition> - </bpmn:intermediateCatchEvent> - <bpmn:exclusiveGateway id="ExclusiveGateway_0ey4zpt" name="Retries Left?"> - <bpmn:incoming>SequenceFlow_0fwsjva</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1wbevp0</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1db2c7t</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:endEvent id="EndEvent_1sez2lh" name="end"> - <bpmn:incoming>SequenceFlow_07a1ytc</bpmn:incoming> - </bpmn:endEvent> - <bpmn:serviceTask id="Task_SetRetryTimer" name="Set Retry Timer" camunda:expression="${ExecuteBuildingBlockRainyDay.setRetryTimer(execution)}"> - <bpmn:incoming>SequenceFlow_1wbevp0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ndt8ft</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0h8v45y" name="Rollback or Abort" sourceRef="ExclusiveGateway_1aonzik" targetRef="ErrorEnd2" /> - <bpmn:sequenceFlow id="SequenceFlow_1db2c7t" name="no" sourceRef="ExclusiveGateway_0ey4zpt" targetRef="ErrorEnd2" /> - <bpmn:sequenceFlow id="SequenceFlow_0fwsjva" name="Retry" sourceRef="ExclusiveGateway_1aonzik" targetRef="ExclusiveGateway_0ey4zpt"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Retry"}]]></bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0ndt8ft" sourceRef="Task_SetRetryTimer" targetRef="IntermediateCatchEvent_RetryTimer" /> - <bpmn:sequenceFlow id="SequenceFlow_07a1ytc" sourceRef="IntermediateCatchEvent_RetryTimer" targetRef="EndEvent_1sez2lh" /> - <bpmn:sequenceFlow id="SequenceFlow_1wbevp0" name="yes" sourceRef="ExclusiveGateway_0ey4zpt" targetRef="Task_SetRetryTimer"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<5}]]></bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0a62t4c" sourceRef="Task_QueryRainyDayTable" targetRef="ExclusiveGateway_1aonzik" /> - <bpmn:sequenceFlow id="SequenceFlow_0yeaaxu" sourceRef="BoundaryEvent_0i3q236" targetRef="Task_QueryRainyDayTable" /> - <bpmn:sequenceFlow id="SequenceFlow_1b5op07" sourceRef="BoundaryEvent_0c2v381" targetRef="Task_QueryRainyDayTable" /> - <bpmn:sequenceFlow id="SequenceFlow_030qtgc" sourceRef="BoundaryEvent_1jzujri" targetRef="Task_QueryRainyDayTable" /> - <bpmn:boundaryEvent id="BoundaryEvent_1jzujri" attachedToRef="Call_BBToExecute"> - <bpmn:outgoing>SequenceFlow_030qtgc</bpmn:outgoing> - <bpmn:errorEventDefinition errorRef="Error_17zcdbk" /> - </bpmn:boundaryEvent> - <bpmn:boundaryEvent id="BoundaryEvent_0c2v381" attachedToRef="StatusPolicy"> - <bpmn:outgoing>SequenceFlow_1b5op07</bpmn:outgoing> - <bpmn:errorEventDefinition errorRef="Error_17zcdbk" /> - </bpmn:boundaryEvent> + <bpmn:subProcess id="SubProcess_0tv8zda" name="Error Handling " triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0tmcs9g"> + <bpmn:outgoing>SequenceFlow_09synl9</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_09synl9" sourceRef="StartEvent_0tmcs9g" targetRef="Task_QueryRainyDayTable" /> + <bpmn:serviceTask id="Task_QueryRainyDayTable" name="QueryRainyDayTable" camunda:expression="${ExecuteBuildingBlockRainyDay.queryRainyDayTable(execution)}"> + <bpmn:incoming>SequenceFlow_09synl9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0a62t4c</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="ErrorEnd2"> + <bpmn:incoming>SequenceFlow_1db2c7t</bpmn:incoming> + </bpmn:endEvent> + <bpmn:exclusiveGateway id="ExclusiveGateway_1aonzik" name="Check HandlingCode" default="SequenceFlow_0h8v45y"> + <bpmn:incoming>SequenceFlow_0a62t4c</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0fwsjva</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0h8v45y</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_RetryTimer" name="RetryTimer"> + <bpmn:incoming>SequenceFlow_0ndt8ft</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07a1ytc</bpmn:outgoing> + <bpmn:timerEventDefinition> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("RetryDuration")}]]></bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:exclusiveGateway id="ExclusiveGateway_0ey4zpt" name="Retries Left?"> + <bpmn:incoming>SequenceFlow_0fwsjva</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wbevp0</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1db2c7t</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="Task_SetRetryTimer" name="Set Retry Timer" camunda:expression="${ExecuteBuildingBlockRainyDay.setRetryTimer(execution)}"> + <bpmn:incoming>SequenceFlow_1wbevp0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ndt8ft</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0a62t4c" sourceRef="Task_QueryRainyDayTable" targetRef="ExclusiveGateway_1aonzik" /> + <bpmn:sequenceFlow id="SequenceFlow_0h8v45y" name="Rollback or Abort" sourceRef="ExclusiveGateway_1aonzik" targetRef="EndEvent_0mvmk3i" /> + <bpmn:sequenceFlow id="SequenceFlow_1db2c7t" name="no" sourceRef="ExclusiveGateway_0ey4zpt" targetRef="ErrorEnd2" /> + <bpmn:sequenceFlow id="SequenceFlow_0fwsjva" name="Retry" sourceRef="ExclusiveGateway_1aonzik" targetRef="ExclusiveGateway_0ey4zpt"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Retry"}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0ndt8ft" sourceRef="Task_SetRetryTimer" targetRef="IntermediateCatchEvent_RetryTimer" /> + <bpmn:sequenceFlow id="SequenceFlow_07a1ytc" sourceRef="IntermediateCatchEvent_RetryTimer" targetRef="EndEvent_1sez2lh" /> + <bpmn:sequenceFlow id="SequenceFlow_1wbevp0" name="yes" sourceRef="ExclusiveGateway_0ey4zpt" targetRef="Task_SetRetryTimer"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<5}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_0mvmk3i"> + <bpmn:incoming>SequenceFlow_0h8v45y</bpmn:incoming> + </bpmn:endEvent> + <bpmn:endEvent id="EndEvent_1sez2lh" name="end"> + <bpmn:incoming>SequenceFlow_07a1ytc</bpmn:incoming> + <bpmn:terminateEventDefinition /> + </bpmn:endEvent> + </bpmn:subProcess> </bpmn:process> <bpmn:error id="Error_0tnktdw" name="Error" errorCode="java.lang.Exception" /> <bpmn:error id="Error_17zcdbk" name="Bpmn Error" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ExecuteBuildingBlock"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ExecuteBuildingBlock"> - <dc:Bounds x="-46" y="162" width="36" height="36" /> + <dc:Bounds x="42" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-39" y="198" width="23" height="12" /> + <dc:Bounds x="49" y="198" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0n67obl_di" bpmnElement="Call_BBToExecute"> - <dc:Bounds x="501" y="140" width="100" height="80" /> + <dc:Bounds x="589" y="140" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0rq4c5r_di" bpmnElement="SequenceFlow_0rq4c5r"> - <di:waypoint xsi:type="dc:Point" x="-10" y="180" /> - <di:waypoint xsi:type="dc:Point" x="53" y="180" /> + <di:waypoint xsi:type="dc:Point" x="78" y="180" /> + <di:waypoint xsi:type="dc:Point" x="141" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-23.5" y="165" width="90" height="0" /> + <dc:Bounds x="65" y="165" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0uzwjrq_di" bpmnElement="SequenceFlow_0uzwjrq"> - <di:waypoint xsi:type="dc:Point" x="153" y="180" /> - <di:waypoint xsi:type="dc:Point" x="219" y="180" /> + <di:waypoint xsi:type="dc:Point" x="241" y="180" /> + <di:waypoint xsi:type="dc:Point" x="307" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="141" y="165" width="90" height="0" /> + <dc:Bounds x="229" y="165" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1jcuk3b_di" bpmnElement="Task_BBInputSetup"> - <dc:Bounds x="53" y="140" width="100" height="80" /> + <dc:Bounds x="141" y="140" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0ahsxzi_di" bpmnElement="End_ExecuteBuildingBlock"> - <dc:Bounds x="668" y="162" width="36" height="36" /> + <dc:Bounds x="808" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="677" y="202" width="18" height="12" /> + <dc:Bounds x="817" y="202" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_01h9qmz_di" bpmnElement="SequenceFlow_01h9qmz"> - <di:waypoint xsi:type="dc:Point" x="601" y="180" /> - <di:waypoint xsi:type="dc:Point" x="668" y="180" /> + <di:waypoint xsi:type="dc:Point" x="689" y="180" /> + <di:waypoint xsi:type="dc:Point" x="808" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="589.5" y="159" width="90" height="12" /> + <dc:Bounds x="703.5" y="159" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0ey4zpt_di" bpmnElement="ExclusiveGateway_0ey4zpt" isMarkerVisible="true"> - <dc:Bounds x="392" y="493" width="50" height="50" /> + <dc:Bounds x="435" y="467" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="386" y="468" width="63" height="13" /> + <dc:Bounds x="430" y="442" width="62" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0qjyidb_di" bpmnElement="IntermediateCatchEvent_RetryTimer"> - <dc:Bounds x="655" y="500" width="36" height="36" /> + <dc:Bounds x="668" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="645" y="475" width="55" height="13" /> + <dc:Bounds x="658" y="449" width="56" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1aonzik_di" bpmnElement="ExclusiveGateway_1aonzik" isMarkerVisible="true"> - <dc:Bounds x="264" y="493" width="50" height="50" /> + <dc:Bounds x="324" y="467" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="236" y="456" width="70" height="25" /> + <dc:Bounds x="315" y="429" width="68" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1wbevp0_di" bpmnElement="SequenceFlow_1wbevp0"> - <di:waypoint xsi:type="dc:Point" x="442" y="518" /> - <di:waypoint xsi:type="dc:Point" x="507" y="518" /> + <di:waypoint xsi:type="dc:Point" x="485" y="492" /> + <di:waypoint xsi:type="dc:Point" x="539" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="458" y="493" width="18" height="13" /> + <dc:Bounds x="496.68461538461537" y="467" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0fwsjva_di" bpmnElement="SequenceFlow_0fwsjva"> - <di:waypoint xsi:type="dc:Point" x="314" y="518" /> - <di:waypoint xsi:type="dc:Point" x="392" y="518" /> + <di:waypoint xsi:type="dc:Point" x="374" y="492" /> + <di:waypoint xsi:type="dc:Point" x="435" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="339" y="526" width="27" height="13" /> + <dc:Bounds x="390.60897435897436" y="500" width="27" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0h8v45y_di" bpmnElement="SequenceFlow_0h8v45y"> - <di:waypoint xsi:type="dc:Point" x="289" y="543" /> - <di:waypoint xsi:type="dc:Point" x="289" y="617" /> - <di:waypoint xsi:type="dc:Point" x="475" y="617" /> + <di:waypoint xsi:type="dc:Point" x="349" y="517" /> + <di:waypoint xsi:type="dc:Point" x="349" y="573" /> <bpmndi:BPMNLabel> - <dc:Bounds x="323" y="624" width="85" height="13" /> + <dc:Bounds x="355" y="538" width="85" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0svi3iy_di" bpmnElement="ErrorEnd2"> - <dc:Bounds x="475" y="599" width="36" height="36" /> + <dc:Bounds x="442" y="573" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="484" y="639" width="19" height="13" /> + <dc:Bounds x="452" y="613" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1tifgqh_di" bpmnElement="Task_QueryRainyDayTable"> - <dc:Bounds x="80" y="478" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1sez2lh_di" bpmnElement="EndEvent_1sez2lh"> - <dc:Bounds x="733" y="500" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="742" y="540" width="19" height="13" /> - </bpmndi:BPMNLabel> + <dc:Bounds x="181" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1db2c7t_di" bpmnElement="SequenceFlow_1db2c7t"> - <di:waypoint xsi:type="dc:Point" x="417" y="543" /> - <di:waypoint xsi:type="dc:Point" x="417" y="574" /> - <di:waypoint xsi:type="dc:Point" x="493" y="574" /> - <di:waypoint xsi:type="dc:Point" x="493" y="599" /> + <di:waypoint xsi:type="dc:Point" x="460" y="517" /> + <di:waypoint xsi:type="dc:Point" x="460" y="573" /> <bpmndi:BPMNLabel> - <dc:Bounds x="449" y="553" width="13" height="13" /> + <dc:Bounds x="469" y="518.5833333333333" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ndt8ft_di" bpmnElement="SequenceFlow_0ndt8ft"> - <di:waypoint xsi:type="dc:Point" x="607" y="518" /> - <di:waypoint xsi:type="dc:Point" x="655" y="518" /> + <di:waypoint xsi:type="dc:Point" x="639" y="492" /> + <di:waypoint xsi:type="dc:Point" x="668" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="586" y="497" width="90" height="12" /> + <dc:Bounds x="608.5" y="471" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07a1ytc_di" bpmnElement="SequenceFlow_07a1ytc"> - <di:waypoint xsi:type="dc:Point" x="691" y="518" /> - <di:waypoint xsi:type="dc:Point" x="733" y="518" /> + <di:waypoint xsi:type="dc:Point" x="704" y="492" /> + <di:waypoint xsi:type="dc:Point" x="753" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="667" y="497" width="90" height="12" /> + <dc:Bounds x="683.5" y="471" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1obvxht_di" bpmnElement="Task_SetRetryTimer"> - <dc:Bounds x="507" y="478" width="100" height="80" /> + <dc:Bounds x="539" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0kdjsnx_di" bpmnElement="Continue"> - <di:waypoint xsi:type="dc:Point" x="420" y="180" /> - <di:waypoint xsi:type="dc:Point" x="501" y="180" /> + <di:waypoint xsi:type="dc:Point" x="508" y="180" /> + <di:waypoint xsi:type="dc:Point" x="589" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="439.6328125" y="159" width="43" height="12" /> + <dc:Bounds x="528" y="159" width="43" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0brnbqx_di" bpmnElement="StatusPolicy"> - <dc:Bounds x="219" y="140" width="100" height="80" /> + <dc:Bounds x="307" y="140" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ryv9sh_di" bpmnElement="SequenceFlow_1ryv9sh"> - <di:waypoint xsi:type="dc:Point" x="395" y="155" /> - <di:waypoint xsi:type="dc:Point" x="395" y="75" /> - <di:waypoint xsi:type="dc:Point" x="686" y="75" /> - <di:waypoint xsi:type="dc:Point" x="686" y="162" /> + <di:waypoint xsi:type="dc:Point" x="483" y="155" /> + <di:waypoint xsi:type="dc:Point" x="483" y="75" /> + <di:waypoint xsi:type="dc:Point" x="826" y="75" /> + <di:waypoint xsi:type="dc:Point" x="826" y="162" /> <bpmndi:BPMNLabel> - <dc:Bounds x="506.4229651162791" y="54" width="69" height="12" /> + <dc:Bounds x="620" y="54" width="69" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0f8ghh3_di" bpmnElement="CheckOrchestrationStatusValidationResults" isMarkerVisible="true"> - <dc:Bounds x="370" y="155" width="50" height="50" /> + <dc:Bounds x="458" y="155" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="354" y="209" width="87" height="48" /> + <dc:Bounds x="442" y="209" width="87" height="48" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0je0y25_di" bpmnElement="SequenceFlow_0je0y25"> - <di:waypoint xsi:type="dc:Point" x="319" y="180" /> - <di:waypoint xsi:type="dc:Point" x="370" y="180" /> + <di:waypoint xsi:type="dc:Point" x="407" y="180" /> + <di:waypoint xsi:type="dc:Point" x="458" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="344.5" y="159" width="0" height="12" /> + <dc:Bounds x="388" y="159" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="BoundaryEvent_1xzskt3_di" bpmnElement="BoundaryEvent_0i3q236"> - <dc:Bounds x="135" y="202" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="153" y="241" width="0" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0a62t4c_di" bpmnElement="SequenceFlow_0a62t4c"> - <di:waypoint xsi:type="dc:Point" x="180" y="518" /> - <di:waypoint xsi:type="dc:Point" x="264" y="518" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="222" y="496" width="0" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0yeaaxu_di" bpmnElement="SequenceFlow_0yeaaxu"> - <di:waypoint xsi:type="dc:Point" x="153" y="238" /> - <di:waypoint xsi:type="dc:Point" x="153" y="302" /> - <di:waypoint xsi:type="dc:Point" x="130" y="302" /> - <di:waypoint xsi:type="dc:Point" x="130" y="478" /> + <di:waypoint xsi:type="dc:Point" x="281" y="492" /> + <di:waypoint xsi:type="dc:Point" x="324" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="141.5" y="280.5" width="0" height="13" /> + <dc:Bounds x="257.5" y="470.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1b5op07_di" bpmnElement="SequenceFlow_1b5op07"> - <di:waypoint xsi:type="dc:Point" x="235" y="226" /> - <di:waypoint xsi:type="dc:Point" x="190" y="331" /> - <di:waypoint xsi:type="dc:Point" x="166" y="473" /> + <bpmndi:BPMNShape id="SubProcess_0tv8zda_di" bpmnElement="SubProcess_0tv8zda" isExpanded="true"> + <dc:Bounds x="76" y="376" width="733" height="253" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0tmcs9g_di" bpmnElement="StartEvent_0tmcs9g"> + <dc:Bounds x="96" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="212.5" y="257" width="0" height="13" /> + <dc:Bounds x="24" y="510" width="0" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_030qtgc_di" bpmnElement="SequenceFlow_030qtgc"> - <di:waypoint xsi:type="dc:Point" x="504" y="231" /> - <di:waypoint xsi:type="dc:Point" x="334" y="373" /> - <di:waypoint xsi:type="dc:Point" x="177" y="485" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_09synl9_di" bpmnElement="SequenceFlow_09synl9"> + <di:waypoint xsi:type="dc:Point" x="132" y="492" /> + <di:waypoint xsi:type="dc:Point" x="181" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="419" y="280.5" width="0" height="13" /> + <dc:Bounds x="156.5" y="471" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="BoundaryEvent_0k0rmt1_di" bpmnElement="BoundaryEvent_1jzujri"> - <dc:Bounds x="499" y="202" width="36" height="36" /> + <bpmndi:BPMNShape id="EndEvent_0mvmk3i_di" bpmnElement="EndEvent_0mvmk3i"> + <dc:Bounds x="331" y="573" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="517" y="241" width="0" height="13" /> + <dc:Bounds x="349" y="613" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BoundaryEvent_1pw6a23_di" bpmnElement="BoundaryEvent_0c2v381"> - <dc:Bounds x="233" y="202" width="36" height="36" /> + <bpmndi:BPMNShape id="EndEvent_1aww7yx_di" bpmnElement="EndEvent_1sez2lh"> + <dc:Bounds x="753" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="251" y="241" width="0" height="13" /> + <dc:Bounds x="763" y="514" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn new file mode 100644 index 0000000000..344b7d8761 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="HomingBB" name="Homing" isExecutable="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:scriptTask id="callSniro" name=" Call Sniro/Oof " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0lc15i7</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* +if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")).getVariable("homingService") == "oof"){ + OofHoming oofHoming = new OofHoming() + oofHoming.callOof(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +}else{ + SniroHomingV2 sniroHoming = new SniroHomingV2() + SniroHoming.callSniro(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +}</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="callSniro" /> + <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true"> + <bpmn2:endEvent id="EndEvent_07tjq3v"> + <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:startEvent id="StartEvent_1qiitb2"> + <bpmn2:outgoing>SequenceFlow_00nlh7l</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processSubflowsBPMNException(execution)</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1rf4vs8" sourceRef="processMsoWorkflowException" targetRef="EndEvent_07tjq3v" /> + <bpmn2:sequenceFlow id="SequenceFlow_00nlh7l" sourceRef="StartEvent_1qiitb2" targetRef="processMsoWorkflowException" /> + </bpmn2:subProcess> + <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Sub Process" triggeredByEvent="true"> + <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:startEvent id="StartEvent_1fbpeuw"> + <bpmn2:outgoing>SequenceFlow_0kamg53</bpmn2:outgoing> + <bpmn2:errorEventDefinition errorRef="Error_1lwpypa" /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_0jbvnr0"> + <bpmn2:incoming>SequenceFlow_1o7154s</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" /> + <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" /> + </bpmn2:subProcess> + <bpmn2:scriptTask id="processSniroHomingSolution" name=" Process Solution " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1fipbmk</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_01apjvo</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* +if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")).getVariable("homingService") == "oof"){ + OofHoming oofHoming = new OofHoming() + oofHoming.processHomingSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +}else{ + SniroHomingV2 sniroHoming = new SniroHomingV2 () + sniroHoming.processSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), asyncResponse) +}</bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage"> + <bpmn2:extensionElements> + <camunda:in source="true" target="isDebugLogEnabled" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="asyncMessageType" target="RCVWFMSG_messageType" /> + <camunda:in source="asyncCorrelator" target="RCVWFMSG_correlator" /> + <camunda:in source="asyncTimeout" target="RCVWFMSG_timeout" /> + <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0lc15i7</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1fipbmk</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_1fipbmk" sourceRef="receiveAsyncCallback" targetRef="processSniroHomingSolution" /> + <bpmn2:sequenceFlow id="SequenceFlow_01apjvo" sourceRef="processSniroHomingSolution" targetRef="EndEvent_0rrbz2a" /> + <bpmn2:endEvent id="EndEvent_0rrbz2a"> + <bpmn2:incoming>SequenceFlow_01apjvo</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0lc15i7" sourceRef="callSniro" targetRef="receiveAsyncCallback" /> + </bpmn2:process> + <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="147" y="275" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro"> + <dc:Bounds x="313" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6"> + <di:waypoint x="183" y="293" /> + <di:waypoint x="313" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="203" y="278" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true"> + <dc:Bounds x="254" y="449" width="409" height="168" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_12gjiy8_di" bpmnElement="javaExceptionSubProcess" isExpanded="true"> + <dc:Bounds x="284" y="632" width="350" height="159" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_07tjq3v_di" bpmnElement="EndEvent_07tjq3v"> + <dc:Bounds x="579" y="523" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="552" y="564" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qiitb2_di" bpmnElement="StartEvent_1qiitb2"> + <dc:Bounds x="299" y="523" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="272" y="564" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03hs6s9_di" bpmnElement="processMsoWorkflowException"> + <dc:Bounds x="406" y="501" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_19gqykh_di" bpmnElement="processJavaException"> + <dc:Bounds x="410" y="680" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fbpeuw_di" bpmnElement="StartEvent_1fbpeuw"> + <dc:Bounds x="318" y="702" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="291" y="743" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0jbvnr0_di" bpmnElement="EndEvent_0jbvnr0"> + <dc:Bounds x="567" y="702" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540" y="743" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8"> + <di:waypoint x="506" y="541" /> + <di:waypoint x="579" y="541" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="498" y="526" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l"> + <di:waypoint x="335" y="541" /> + <di:waypoint x="363" y="541" /> + <di:waypoint x="363" y="541" /> + <di:waypoint x="406" y="541" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="333" y="541" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53"> + <di:waypoint x="354" y="720" /> + <di:waypoint x="410" y="720" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="337" y="705" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s"> + <di:waypoint x="510" y="720" /> + <di:waypoint x="567" y="720" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="494" y="705" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processSniroHomingSolution"> + <dc:Bounds x="597" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback"> + <dc:Bounds x="455" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fipbmk_di" bpmnElement="SequenceFlow_1fipbmk"> + <di:waypoint x="555" y="293" /> + <di:waypoint x="597" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="531" y="272" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01apjvo_di" bpmnElement="SequenceFlow_01apjvo"> + <di:waypoint x="697" y="293" /> + <di:waypoint x="860" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="778.5" y="272" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_07i1a5x_di" bpmnElement="EndEvent_0rrbz2a"> + <dc:Bounds x="860" y="275" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="877.17" y="315" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0lc15i7_di" bpmnElement="SequenceFlow_0lc15i7"> + <di:waypoint x="413" y="293" /> + <di:waypoint x="455" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="434" y="272" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn index fb250fc03f..fdae49fdda 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn @@ -4,7 +4,7 @@ <bpmn:startEvent id="Start_UnassignNetworkBB" name="start"> <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="Task_SNDCUnAssign" name="Call SDNC Adapter Topology UnAssign" camunda:expression="${SDNCUnassignTasks.unassignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_SNDCUnAssign" name=" SDNC Unassign (network) " camunda:expression="${SDNCUnassignTasks.unassignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0le4vrj</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ks8kmt</bpmn:outgoing> </bpmn:serviceTask> @@ -14,7 +14,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_UnassignNetworkBB" targetRef="Task_VfModuleRelatioship" /> <bpmn:sequenceFlow id="SequenceFlow_1ks8kmt" sourceRef="Task_SNDCUnAssign" targetRef="Task_DeleteNetwork" /> <bpmn:sequenceFlow id="SequenceFlow_0csh9dc" sourceRef="Task_DeleteNetwork" targetRef="End_UnassignNetworkBB" /> - <bpmn:serviceTask id="Task_DeleteNetwork" name="Delete Network (AAI)" camunda:expression="${AAIDeleteTasks.deleteNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_DeleteNetwork" name=" AAI Delete (network) " camunda:expression="${AAIDeleteTasks.deleteNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1ks8kmt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0csh9dc</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn index 235c7c9eac..f077c78348 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignServiceInstanceBB.bpmn @@ -1,20 +1,20 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="UnassignServiceInstanceBB" name="UnassignServiceInstanceBB" isExecutable="true"> - <bpmn:startEvent id="Start_UnassignServiceInstanceBB" name="start"> + <bpmn:startEvent id="Start_UnassignServiceInstanceBB"> <bpmn:outgoing>SequenceFlow_0fzrhkc</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="Task_AAIDeleteServiceInstance" name="Delete Service Instance (AAI)" camunda:expression="${AAIDeleteTasks.deleteServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_AAIDeleteServiceInstance" name=" AAI Delete (svc instance) " camunda:expression="${AAIDeleteTasks.deleteServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0pu9j6i</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0sfeg65</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0sfeg65" sourceRef="Task_AAIDeleteServiceInstance" targetRef="End_UnassignServiceInstanceBB" /> - <bpmn:serviceTask id="Task_SdncUnassignServiceInstance" name="Unassign Service Instance (SDNC)" camunda:expression="${SDNCUnassignTasks.unassignServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Task_SdncUnassignServiceInstance" name=" SDNC Unassign (svc instance) " camunda:expression="${SDNCUnassignTasks.unassignServiceInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0fzrhkc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0pu9j6i</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0pu9j6i" sourceRef="Task_SdncUnassignServiceInstance" targetRef="Task_AAIDeleteServiceInstance" /> - <bpmn:endEvent id="End_UnassignServiceInstanceBB" name="end"> + <bpmn:endEvent id="End_UnassignServiceInstanceBB"> <bpmn:incoming>SequenceFlow_0sfeg65</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0fzrhkc" sourceRef="Start_UnassignServiceInstanceBB" targetRef="Task_SdncUnassignServiceInstance" /> @@ -24,9 +24,9 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UnassignServiceInstanceBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_UnassignServiceInstanceBB"> - <dc:Bounds x="474" y="213" width="36" height="36" /> + <dc:Bounds x="444" y="213" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="482" y="256" width="22" height="12" /> + <dc:Bounds x="452" y="256" width="23" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0ltb3dj_di" bpmnElement="Task_AAIDeleteServiceInstance"> @@ -34,9 +34,9 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0sfeg65_di" bpmnElement="SequenceFlow_0sfeg65"> <di:waypoint xsi:type="dc:Point" x="808" y="231" /> - <di:waypoint xsi:type="dc:Point" x="853" y="231" /> + <di:waypoint xsi:type="dc:Point" x="871" y="231" /> <bpmndi:BPMNLabel> - <dc:Bounds x="785.5" y="210" width="90" height="12" /> + <dc:Bounds x="794.5" y="210" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_11klnmn_di" bpmnElement="Task_SdncUnassignServiceInstance"> @@ -50,16 +50,16 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1p34ka9_di" bpmnElement="End_UnassignServiceInstanceBB"> - <dc:Bounds x="853" y="213" width="36" height="36" /> + <dc:Bounds x="871" y="213" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="863" y="255" width="21" height="12" /> + <dc:Bounds x="883" y="255" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0fzrhkc_di" bpmnElement="SequenceFlow_0fzrhkc"> - <di:waypoint xsi:type="dc:Point" x="510" y="231" /> + <di:waypoint xsi:type="dc:Point" x="480" y="231" /> <di:waypoint xsi:type="dc:Point" x="563" y="231" /> <bpmndi:BPMNLabel> - <dc:Bounds x="536.5" y="210" width="0" height="12" /> + <dc:Bounds x="476.5" y="210" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn index 2b9edbc3d5..0f3138121e 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVfModuleBB.bpmn @@ -1,18 +1,18 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="UnassignVfModuleBB" name="UnassignVfModuleBB" isExecutable="true"> - <bpmn:startEvent id="UnassignVfModuleBB_Start" name="Start"> + <bpmn:startEvent id="UnassignVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1kfxl04</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="DeleteVfModule" name="Delete VF Module (AAI)" camunda:expression="${AAIDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="DeleteVfModule" name=" AAI Delete (vf module) " camunda:expression="${AAIDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1p2r4og</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0qa6sxx</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="UnassignVfModule" name="Unassign VF Module (SDNC)" camunda:expression="${SDNCUnassignTasks.unassignVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UnassignVfModule" name=" SDNC Unassign (vf module) " camunda:expression="${SDNCUnassignTasks.unassignVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1kfxl04</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1p2r4og</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="UnassignVfModuleBB_End" name="End"> + <bpmn:endEvent id="UnassignVfModuleBB_End"> <bpmn:incoming>SequenceFlow_0qa6sxx</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1kfxl04" sourceRef="UnassignVfModuleBB_Start" targetRef="UnassignVfModule" /> @@ -24,14 +24,14 @@ <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="UnassignVfModuleBB_Start"> <dc:Bounds x="213" y="-3" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="219" y="33" width="23" height="12" /> + <dc:Bounds x="219" y="33" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0028k7a_di" bpmnElement="DeleteVfModule"> - <dc:Bounds x="571" y="-25" width="100" height="80" /> + <dc:Bounds x="537" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="UnassignVfModule"> - <dc:Bounds x="367" y="-25" width="100" height="80" /> + <dc:Bounds x="387" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="UnassignVfModuleBB_End"> <dc:Bounds x="782" y="-3" width="36" height="36" /> @@ -41,23 +41,23 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1kfxl04_di" bpmnElement="SequenceFlow_1kfxl04"> <di:waypoint xsi:type="dc:Point" x="249" y="15" /> - <di:waypoint xsi:type="dc:Point" x="367" y="15" /> + <di:waypoint xsi:type="dc:Point" x="387" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="308" y="0" width="0" height="0" /> + <dc:Bounds x="273" y="0" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1p2r4og_di" bpmnElement="SequenceFlow_1p2r4og"> - <di:waypoint xsi:type="dc:Point" x="467" y="15" /> - <di:waypoint xsi:type="dc:Point" x="571" y="15" /> + <di:waypoint xsi:type="dc:Point" x="487" y="15" /> + <di:waypoint xsi:type="dc:Point" x="537" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="519" y="-10" width="0" height="0" /> + <dc:Bounds x="467" y="0" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0qa6sxx_di" bpmnElement="SequenceFlow_0qa6sxx"> - <di:waypoint xsi:type="dc:Point" x="671" y="15" /> + <di:waypoint xsi:type="dc:Point" x="637" y="15" /> <di:waypoint xsi:type="dc:Point" x="782" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="727" y="0" width="0" height="0" /> + <dc:Bounds x="664.5" y="0" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn index 83ba0a9155..4676acfa42 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVnfBB.bpmn @@ -1,23 +1,23 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="UnassignVnfBB" name="UnassignVnfBB" isExecutable="true"> - <bpmn:startEvent id="UnassignVnfBB_Start" name="Start"> + <bpmn:startEvent id="UnassignVnfBB_Start"> <bpmn:outgoing>SequenceFlow_1kfxl04</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="DeleteVnf" name="Delete Vnf (AAI)" camunda:expression="${AAIDeleteTasks.deleteVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="DeleteVnf" name=" AAI Delete (vnf) " camunda:expression="${AAIDeleteTasks.deleteVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0w3s09a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0qa6sxx</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="UnassignVnf" name="Unassign Vnf (SDNC)" camunda:expression="${SDNCUnassignTasks.unassignVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UnassignVnf" name=" SDNC Unassign (vnf) " camunda:expression="${SDNCUnassignTasks.unassignVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1kfxl04</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02st1i1</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="UnassignVnfBB_End" name="End"> + <bpmn:endEvent id="UnassignVnfBB_End"> <bpmn:incoming>SequenceFlow_0qa6sxx</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1kfxl04" sourceRef="UnassignVnfBB_Start" targetRef="UnassignVnf" /> <bpmn:sequenceFlow id="SequenceFlow_0qa6sxx" sourceRef="DeleteVnf" targetRef="UnassignVnfBB_End" /> - <bpmn:serviceTask id="DeleteVnfInstanceGroups" name="Delete Vnf Instance Groups (AAI)" camunda:expression="${UnassignVnf.deleteInstanceGroups(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="DeleteVnfInstanceGroups" name=" AAI Delete (instance grp) " camunda:expression="${UnassignVnf.deleteInstanceGroups(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_02st1i1</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0w3s09a</bpmn:outgoing> </bpmn:serviceTask> @@ -29,7 +29,7 @@ <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="UnassignVnfBB_Start"> <dc:Bounds x="213" y="-3" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="218" y="33" width="25" height="12" /> + <dc:Bounds x="219" y="33" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0028k7a_di" bpmnElement="DeleteVnf"> @@ -41,7 +41,7 @@ <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="UnassignVnfBB_End"> <dc:Bounds x="959" y="-3" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="967" y="37" width="20" height="12" /> + <dc:Bounds x="968" y="37" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1kfxl04_di" bpmnElement="SequenceFlow_1kfxl04"> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVolumeGroupBB.bpmn index 12af246153..9947d1a1c5 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignVolumeGroupBB.bpmn @@ -1,10 +1,10 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="UnassignVolumeGroupBB" name="UnassignVolumeGroupBB" isExecutable="true"> <bpmn:startEvent id="UnassignVolumeGroupBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1kfxl04</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="UnassignVolumeGroup" name="Delete VolumeGroup (AAI)" camunda:expression="${AAIDeleteTasks.deleteVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UnassignVolumeGroup" name=" AAI Delete (volume grp) " camunda:expression="${AAIDeleteTasks.deleteVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1kfxl04</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0qa6sxx</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn index daf0358683..1cfb9a3860 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn @@ -56,17 +56,6 @@ <bpmn2:incoming>SequenceFlow_0fhfitm</bpmn2:incoming> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_0fhfitm" sourceRef="UpdateNetworkAAI" targetRef="UpdateNetworkBB_End" /> - <bpmn2:subProcess id="SubProcess_1srp3f9" triggeredByEvent="true"> - <bpmn2:startEvent id="Error_start" name="Start"> - <bpmn2:outgoing>SequenceFlow_1vfwv05</bpmn2:outgoing> - <bpmn2:errorEventDefinition errorRef="Error_01yvdm8" camunda:errorCodeVariable="gBBErrorCode" camunda:errorMessageVariable="gBBErrorMessage" /> - </bpmn2:startEvent> - <bpmn2:endEvent id="Error_end" name="End"> - <bpmn2:incoming>SequenceFlow_1vfwv05</bpmn2:incoming> - <bpmn2:errorEventDefinition errorRef="Error_01yvdm8" /> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1vfwv05" sourceRef="Error_start" targetRef="Error_end" /> - </bpmn2:subProcess> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -190,28 +179,6 @@ <dc:Bounds x="535" y="329" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="SubProcess_11x1b8w_di" bpmnElement="SubProcess_1srp3f9" isExpanded="true"> - <dc:Bounds x="115" y="516" width="350" height="200" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1uqy6gg_di" bpmnElement="Error_start"> - <dc:Bounds x="194" y="592" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="200" y="632" width="24" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0oe6ngb_di" bpmnElement="Error_end"> - <dc:Bounds x="358" y="592" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="367" y="632" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1vfwv05_di" bpmnElement="SequenceFlow_1vfwv05"> - <di:waypoint xsi:type="dc:Point" x="230" y="610" /> - <di:waypoint xsi:type="dc:Point" x="358" y="610" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="294" y="589" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn index 04f3684ee4..30a95eb81f 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn @@ -1,7 +1,7 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="VnfAdapter" name="Vnf Adapter" isExecutable="true"> - <bpmn:startEvent id="VnfAdapter_Start" name="Start"> + <bpmn:startEvent id="VnfAdapter_Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> </bpmn:startEvent> <bpmn:subProcess id="VnfAdapter_Error" name="Sub Process Error" triggeredByEvent="true"> @@ -15,7 +15,7 @@ <bpmn:sequenceFlow id="SequenceFlow_1abat8l" sourceRef="Error_Start" targetRef="Error_End" /> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_1xr6chl" sourceRef="VnfAdapter_Start" targetRef="PreProcessRequest" /> - <bpmn:endEvent id="VnfAdapter_End" name="End"> + <bpmn:endEvent id="VnfAdapter_End"> <bpmn:incoming>SequenceFlow_1ivhukd</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="PreProcessRequest" name="Pre Process Request" camunda:expression="${VnfAdapterImpl.preProcessVnfAdapter(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index e8891eeb53..ac62af2e9d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -38,6 +38,7 @@ import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.infrastructure.aai.tasks.AAICommonTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAICreateTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIDeleteTasks; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIQueryTasks; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks; import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterCreateTasks; @@ -46,6 +47,7 @@ import org.onap.so.bpmn.infrastructure.adapter.network.tasks.NetworkAdapterUpdat import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterCreateTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterDeleteTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; +import org.onap.so.bpmn.infrastructure.appc.tasks.AppcRunTasks; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf; @@ -61,6 +63,7 @@ import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCChangeAssignTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCDeactivateTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCQueryTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCUnassignTasks; +import org.onap.so.bpmn.infrastructure.workflow.tasks.FlowCompletionTasks; import org.onap.so.bpmn.infrastructure.workflow.tasks.OrchestrationStatusValidator; import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction; import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks; @@ -105,6 +108,13 @@ public abstract class BaseBPMNTest { @MockBean protected AAIDeleteTasks aaiDeleteTasks; + + @MockBean + protected AAIFlagTasks aaiFlagTasks; + + + @MockBean + protected AppcRunTasks appcRunTasks; @MockBean protected SDNCActivateTasks sdncActivateTasks; @@ -190,6 +200,9 @@ public abstract class BaseBPMNTest { @MockBean protected ConfigurationScaleOut configurationScaleOut; + @MockBean + protected FlowCompletionTasks flowCompletionTasks; + @LocalServerPort private int port; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java new file mode 100644 index 0000000000..77146593ba --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.activity; + +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.message.BasicHttpResponse; +import org.junit.Test; + +public class DeployActivitySpecsTest { + private static final String RESULT_STRING = "HTTP/1.1 404 "; + private static final String HOSTNAME = "http://localhost:8080"; + + @Test + public void DeployActivitySpecsMain_Test() throws Exception { + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setStatusCode(404); + response.setStatusLine(protocolVersion, 1, ""); + HttpClient clientMock = mock(HttpClient.class); + when(clientMock.execute(any(HttpPost.class))).thenReturn(response); + String[] args = new String[] {HOSTNAME}; + DeployActivitySpecs.main(args); + } + + @Test + public void DeployActivitySpec_Test() throws Exception { + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setStatusCode(404); + response.setStatusLine(protocolVersion, 1, ""); + HttpClient clientMock = mock(HttpClient.class); + when(clientMock.execute(any(HttpPost.class))).thenReturn(response); ; + String result = DeployActivitySpecs.deployActivitySpec(HOSTNAME, "VNFQuiesceTrafficActivitySpec.json"); + assertEquals(result, RESULT_STRING); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java new file mode 100644 index 0000000000..50184a535d --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; + +public class FlowCompleteActivity extends BaseBPMNTest{ + @Test + public void sunnyDayFlowCompleteActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", + "TaskUpdateRequestDB", + "FlowCompleteActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayFlowCompleteActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(flowCompletionTasks) + .updateRequestDbStatus(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", + "TaskUpdateRequestDB").hasNotPassed( + "FlowCompleteActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java new file mode 100644 index 0000000000..99e7f308f7 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFHealthCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFHealthCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", + "TaskPreProcessActivity", + "TaskHealthCheck", + "VNFHealthCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFHealthCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", + "TaskPreProcessActivity", + "TaskHealthCheck").hasNotPassed( + "VNFHealthCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java new file mode 100644 index 0000000000..2305485bfc --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFQuiesceTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskQuiesceTraffic", + "VNFQuiesceTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskQuiesceTraffic").hasNotPassed( + "VNFQuiesceTrafficActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java new file mode 100644 index 0000000000..d3ff31eb9c --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFResumeTrafficActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFResumeTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskResumeTraffic", + "VNFResumeTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFResumeTrafficActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", + "TaskPreProcessActivity", + "TaskResumeTraffic").hasNotPassed( + "VNFResumeTrafficActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java new file mode 100644 index 0000000000..b3b4d82c35 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; + +public class VNFSetInMaintFlagActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFSetInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", + "TaskSetInMaint", + "VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFSetInMaintFlagActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", + "TaskSetInMaint").hasNotPassed( + "VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java new file mode 100644 index 0000000000..1225da5829 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; + +public class VNFUnsetInMaintFlagActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUnsetInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", + "TaskUnsetInMaint", + "VNFUnsetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUnsetInMaintFlag_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", + "TaskUnsetInMaint").hasNotPassed( + "VNFUnsetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java new file mode 100644 index 0000000000..288cf48778 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradePostCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePostCheck", + "VNFUpgradePostCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePostCheck").hasNotPassed( + "VNFUpgradePostCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java new file mode 100644 index 0000000000..2b82197342 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradePreCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePreCheck", + "VNFUpgradePreCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradePreCheck").hasNotPassed( + "VNFUpgradePreCheckActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java new file mode 100644 index 0000000000..93d20e9109 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.appc.client.lcm.model.Action; + +public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest{ + @Test + public void sunnyDayVNFUpgradeSoftwareActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradeSoftware", + "VNFUpgradeSoftwareActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", + "TaskPreProcessActivity", + "TaskUpgradeSoftware").hasNotPassed( + "VNFUpgradeSoftwareActivity_End"); + assertThat(pi).isEnded(); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index ad51b3f69e..3523703ee8 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -197,11 +197,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - - </dependency> - <dependency> <groupId>com.fasterxml.uuid</groupId> <artifactId>java-uuid-generator</artifactId> </dependency> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index 545cba7f8c..c48d000ab3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -32,14 +32,16 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.logger.MsoLogger +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger /** * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Activate */ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ActivateSDNCNetworkResource.class); + String Prefix = "ACTSDNCRES_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -48,18 +50,19 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + MsoUtils msoUtils = new MsoUtils() + + public void preProcessRequest(DelegateExecution execution) { - msoLogger.trace("Started preProcessRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) @@ -78,9 +81,41 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - // TODO: based on the resource type decide action and operation type String sdnc_svcAction = "activate" - operationType = "SOTNConnectivity" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + break + + default: + break + } String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) @@ -92,38 +127,39 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { - msoLogger.trace("started prepareUpdateAfterActivateSDNCResource ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("started prepareUpdateAfterActivateSDNCResource ") ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String ServiceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "SDCN resource creation completed" + String progress = "80" + String status = "activated" + String statusDescription = "SDCN resource activation completed" execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -131,8 +167,32 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { setProgressUpdateVariables(execution, body) } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + String customizeResourceParam(String networkInputParametersJson) { + List<Map<String, Object>> paramList = new ArrayList(); + JSONObject jsonObject = new JSONObject(networkInputParametersJson); + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + HashMap<String, String> hashMap = new HashMap(); + hashMap.put("name", key); + hashMap.put("value", jsonObject.get(key)) + paramList.add(hashMap) + } + Map<String, List<Map<String, Object>>> paramMap = new HashMap(); + paramMap.put("param", paramList); + + return new JSONObject(paramMap).toString(); + } + public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.trace("Started prepareSDNCRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("Started prepareSDNCRequest ") try { // get variables @@ -141,11 +201,13 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") String hdrRequestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String networkInstanceId = execution.getVariable("networkInstanceId") String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -165,172 +227,169 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncTopologyActivateRequest = "" switch (modelName) { - case ~/^Site$/: - sdncTopologyActivateRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <vnf-id></vnf-id> + <vnf-id>${msoUtils.xmlEncode(networkInstanceId)}</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </vnf-information> - <vnf-input-parameters> - <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> - </vnf-input-parameters> <vnf-request-input> - <request-version></request-version> - <vnf-name></vnf-name> - <neutron-id></neutron-id> - <contrail-network-fqdn></contrail-network-fqdn> - <subnets-data> - <subnet-data> - <element> - <ip-version></ip-version> - <subnet-id></subnet-id> - </subnet-data> - </subnets-data> - </vnf-request-input> + <vnf-input-parameters> + $netowrkInputParameters + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> + </vnf-networks> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <allotted-resource-information> <!-- TODO: to be filled as per the request input --> - <allotted-resource-input></allotted-resource-input> + <allotted-resource-id>${msoUtils.xmlEncode(networkInstanceId)}</allotted-resource-id> <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id><parent-service-instance-id> + <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> - <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> + $netowrkInputParameters </connection-attachment-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + // for SDWANConnectivity and SOTN Connectivity default: sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <network-information> <!-- TODO: to be filled by response from create --> - <network-id></network-id> + <network-id>${msoUtils.xmlEncode(networkInstanceId)}</network-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> - <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters> + <network-input-parameters>$netowrkInputParameters</network-input-parameters> </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() @@ -338,21 +397,20 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } String sdncTopologyActivateRequesAsString = utils.formatXml(sdncTopologyActivateRequest) - msoLogger.debug(sdncTopologyActivateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyActivateRequesAsString) - msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyActivateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + msoLogger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Exit prepareSDNCRequest ") + msoLogger.info(" ***** Exit prepareSDNCRequest *****") } - public void postCreateSDNCCall(DelegateExecution execution) { - msoLogger.trace("started postCreateSDNCCall ") + public void postActivateSDNCCall(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("started postCreateSDNCCall ") String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") @@ -361,24 +419,22 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void sendSyncResponse(DelegateExecution execution) { - msoLogger.trace("started sendSyncResponse ") - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + msoLogger.dubug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + msoLogger.dubug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + msoLogger.dubug(" ***** Exit sendSyncResopnse *****") } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index ec8df3daa1..d2903f5396 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -20,12 +20,12 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.json.JSONArray import org.json.JSONObject import org.json.XML import static org.apache.commons.lang3.StringUtils.* import groovy.xml.XmlUtil -import groovy.json.* import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil @@ -39,6 +39,7 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.Abstr import org.onap.so.rest.APIResponse import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory +import java.util.Map import java.util.UUID import org.onap.so.logger.MsoLogger @@ -62,7 +63,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Create3rdONAPE2EServiceInstance.class) public void checkSPPartnerInfo (DelegateExecution execution) { @@ -77,19 +78,19 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceInput = execution.getVariable("resourceInput") msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String resourceInputPrameters = resourceInputObj.getResourceParameters() - String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) + String inputParametersJson = JsonUtils.getJsonValue(resourceInputPrameters, "requestInputs") + JSONObject inputParameters = new JSONObject(inputParametersJson) // set local resourceInput execution.setVariable(Prefix + "ResourceInput", resourceInputObj) boolean is3rdONAPExist = false - if(inputParameters.has("url")) + if(inputParameters.has("sppartner_url")) { - String sppartnerUrl = inputParameters.get("url") + String sppartnerUrl = inputParameters.get("sppartner_url") if(!isBlank(sppartnerUrl)) { execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) is3rdONAPExist = true @@ -100,32 +101,32 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.debug(msg) } } - if(inputParameters.has("providingServiceInvarianteUuid")) + if(inputParameters.has("sppartner_providingServiceUuid")) { - String sppartnerInvarianteUUID = inputParameters.get("providingServiceInvarianteUuid") - execution.setVariable(Prefix + "SppartnerInvarianteUUID", sppartnerInvarianteUUID) + String sppartnerUUID= inputParameters.get("sppartner_providingServiceUuid") + execution.setVariable(Prefix + "SppartnerUUID", sppartnerUUID) is3rdONAPExist = true } else { is3rdONAPExist = false - String msg = "sppartner providingServiceInvarianteUuid is blank." + String msg = "sppartner providingServiceUuid is blank." msoLogger.debug(msg) } - if(inputParameters.has("providingServiceUuid")) + if(inputParameters.has("sppartner_providingServiceInvariantUuid")) { - String sppartnerUUID = inputParameters.get("providingServiceUuid") - execution.setVariable(Prefix + "SppartnerUUID", sppartnerUUID) + String sppartnerInvarianteUUID = inputParameters.get("sppartner_providingServiceInvariantUuid") + execution.setVariable(Prefix + "SppartnerInvarianteUUID", sppartnerInvarianteUUID) is3rdONAPExist = true } else { is3rdONAPExist = false - String msg = "sppartner providingServiceUuid is blank." + String msg = "sppartner providingServiceInvarianteUuid is blank." msoLogger.debug(msg) } - if(inputParameters.has("handoverMode")) + if(inputParameters.has("sppartner_handoverMode")) { - String handoverMode = inputParameters.get("handoverMode") + String handoverMode = inputParameters.get("sppartner_handoverMode") execution.setVariable(Prefix + "HandoverMode", handoverMode) is3rdONAPExist = true } @@ -134,7 +135,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String msg = "sppartner handoverMode is blank." msoLogger.debug(msg) } - + execution.setVariable("Is3rdONAPExist", is3rdONAPExist) execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) @@ -150,7 +151,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void checkLocallCall (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started checkLocallCall *****") try { @@ -159,9 +159,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso //uuiRequest String incomingRequest = resourceInputObj.getRequestsInputs() - String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") + String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") - JSONObject inputParameters = new JSONObject(customizeResourceParam(requestInputs)) + JSONObject inputParameters = new JSONObject(requestInputs) execution.setVariable(Prefix + "ServiceParameters", inputParameters) // CallSource is added only when ONAP SO calling 3rdONAP(External API) SO(Remote call) @@ -189,17 +189,16 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void preProcessRequest(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started preProcessRequest *****") + String msg = "" + try { ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") - String msg = "" String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error(msg) } //set local variable execution.setVariable("globalSubscriberId", globalSubscriberId) @@ -208,8 +207,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceType = resourceInputObj.getServiceType() if (isBlank(serviceType)) { msg = "Input serviceType is null" - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error(msg) } execution.setVariable("serviceType", serviceType) msoLogger.info("serviceType:" + serviceType) @@ -217,8 +215,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error(msg) } execution.setVariable("resourceName", resourceName) msoLogger.info("resourceName:" + resourceName) @@ -230,23 +227,45 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceInstanceId = resourceInputObj.getServiceInstanceId() if (isBlank(serviceInstanceId)) { msg = "Input serviceInstanceId is null" - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error(msg) } execution.setVariable(Prefix + "ServiceInstanceId", serviceInstanceId) msoLogger.info("serviceInstanceId:" + serviceInstanceId) + String resourceModelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid() + if (isBlank(resourceModelInvariantUuid)) { + msg = "Input resourceModelInvariantUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) + msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) + + String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + if (isBlank(resourceModelUuid)) { + msg = "Input resourceModelUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) + msoLogger.info("resourceModelUuid:" + resourceModelUuid) + + String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + if (isBlank(resourceModelCustomizationUuid)) { + msg = "Input resourceModelCustomizationUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid) + msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) + } catch (BpmnError e) { throw e } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() + msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateProgress(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started prepareUpdateProgress *****") ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String operType = resourceInputObj.getOperationType() @@ -280,7 +299,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void allocateCrossONAPResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started allocateCrossONAPResource *****") //get TP links from AAI for SOTN handoverMode only @@ -288,42 +306,45 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso if("SOTN".equalsIgnoreCase(handoverMode)) { // Put TP Link info into serviceParameters JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") - - Map<String, Object> crossTPs = new HashMap<String, Object>(); - crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id")); - crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id")); - crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id")); - crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id")); - crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id")); - crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id")); - crossTPs.put("remote-access-client-id", inputParameters.get("local-client-id")); - crossTPs.put("remote-access-topology-id", inputParameters.get("local-topology-id")); - crossTPs.put("remote-access-node-id", inputParameters.get("local-node-id")); - crossTPs.put("remote-access-ltp-id", inputParameters.get("local-ltp-id")); - - inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); - inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id")); - inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); - inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id")); - inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); - inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); - inputParameters.put("remote-access-client-id", crossTPs.get("remote-client-id")); - inputParameters.put("remote-access-topology-id", crossTPs.get("remote-topology-id")); - inputParameters.put("remote-access-node-id", crossTPs.get("remote-node-id")); - inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id")); - - execution.setVariable(Prefix + "ServiceParameters", inputParameters) + if(inputParameters.has("remote-access-provider-id")) { + Map<String, Object> crossTPs = new HashMap<String, Object>(); + crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id")); + crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id")); + crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id")); + crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id")); + crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id")); + crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id")); + crossTPs.put("remote-access-client-id", inputParameters.get("local-access-client-id")); + crossTPs.put("remote-access-topology-id", inputParameters.get("local-access-topology-id")); + crossTPs.put("remote-access-node-id", inputParameters.get("local-access-node-id")); + crossTPs.put("remote-access-ltp-id", inputParameters.get("local-access-ltp-id")); + + inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); + inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id")); + inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); + inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id")); + inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); + inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); + inputParameters.put("remote-access-client-id", crossTPs.get("remote-access-client-id")); + inputParameters.put("remote-access-topology-id", crossTPs.get("remote-access-topology-id")); + inputParameters.put("remote-access-node-id", crossTPs.get("remote-access-node-id")); + inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id")); + + execution.setVariable(Prefix + "ServiceParameters", inputParameters) + } + else { + msoLogger.error("No allocated CrossONAPResource found in ServiceParameters") + } } msoLogger.info("Exit " + allocateCrossONAPResource) } public void prepare3rdONAPRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started prepare3rdONAPRequest *****") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String extAPIPath = sppartnerUrl + 'serviceOrder' + String extAPIPath = sppartnerUrl + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) // ExternalAPI message format @@ -334,14 +355,14 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String requestedCompletionDate = utils.generateCurrentTimeInUtc() String priority = "1" // 0-4 0:highest String subscriberId = execution.getVariable("globalSubscriberId") - String customerRole = "" - String subscriberName = "" + String customerRole = "ONAPcustomer" + String subscriberName = subscriberId String referredType = "Consumer" String orderItemId = "1" String action = "add" //for create String serviceState = "active" String serviceName = execution.getVariable("serviceInstanceName") - String serviceUuId = execution.setVariable(Prefix + "SppartnerUUID") + String serviceUuId = execution.getVariable(Prefix + "SppartnerUUID") Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') @@ -357,29 +378,29 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("orderItemId", '"' + orderItemId + '"') valueMap.put("action", '"' + action + '"') valueMap.put("serviceState", '"' + serviceState + '"') - valueMap.put("serviceId", '""')//To be confirmed + valueMap.put("serviceId", "null") //null for add valueMap.put("serviceName", '"' + serviceName + '"') valueMap.put("serviceUuId", '"' + serviceUuId + '"') - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() // insert CallSource='ExternalAPI' to uuiRequest Map<String, String> requestInputsMap = new HashMap<>() - requestInputsMap.put("inputName", "CallSource") - requestInputsMap.put("inputValue", "ExternalAPI") + requestInputsMap.put("inputName", '"CallSource"') + requestInputsMap.put("inputValue", '"ExternalAPI"') String _requestInputs_ = externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) - requestInputsMap.clear() + requestInputsMap.clear() String serviceInstanceId = execution.getVariable(Prefix + "ServiceInstanceId") - requestInputsMap.put("inputName", "SppartnerServiceId") - requestInputsMap.put("inputValue", serviceInstanceId) + requestInputsMap.put("inputName", '"SppartnerServiceId"') + requestInputsMap.put("inputValue", '"' + serviceInstanceId + '"') _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) requestInputsMap.clear() String serviceType = execution.getVariable("serviceType") - requestInputsMap.put("inputName", "serviceType") - requestInputsMap.put("inputValue", serviceType) - _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) + requestInputsMap.put("inputName", '"serviceType"') + requestInputsMap.put("inputValue", '"' + serviceType + '"') + _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) // Transfer all uuiRequest incomeParameters to ExternalAPI format JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") @@ -390,7 +411,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso requestInputsMap.put("inputName", '"' + inputName+ '"') requestInputsMap.put("inputValue", '"' + inputValue + '"') _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) - } + } valueMap.put("_requestInputs_", _requestInputs_) String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) @@ -399,13 +420,14 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void doCreateE2ESIin3rdONAP(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started doCreateE2ESIin3rdONAP *****") String extAPIPath = execution.getVariable("ExternalAPIURL") String payload = execution.getVariable(Prefix + "Payload") + msoLogger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) + msoLogger.debug("doCreateE2ESIin3rdONAP payload is: " + payload) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) @@ -416,18 +438,22 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String extApiResponse = response.getResponseBodyAsString() JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) + + msoLogger.debug("doCreateE2ESIin3rdONAP response body is: " + extApiResponse) + //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { msoLogger.debug("Post ServiceOrder Received a Good Response") - String serviceOrderId = responseObj.get("ServiceOrderId") + String serviceOrderId = responseObj.get("id") execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable("serviceOrderId", serviceOrderId) + execution.setVariable("ServiceOrderId", serviceOrderId) + msoLogger.info("Post ServiceOrderid is: " + serviceOrderId) } else{ - msoLogger.debug("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") + msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") } msoLogger.info("Exit " + doCreateE2ESIin3rdONAP) @@ -435,13 +461,13 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") + utils.log("DEBUG", "getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath, isDebugEnabled) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) @@ -453,48 +479,72 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) + msoLogger.debug("getE2ESIProgressin3rdONAP create response body is: " + extApiResponse) + //Process Response //200 OK 201 CREATED 202 ACCEPTED - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { - msoLogger.debug("Get ServiceOrder Received a Good Response") - - String sppartnerServiceId = responseObj.get("orderIterm.service.id") + msoLogger.debug("Get Create ServiceOrder Received a Good Response") + + String orderState = responseObj.get("state") + if("REJECTED".equalsIgnoreCase(orderState)) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Create Service Order Status is REJECTED") + return + } + + JSONArray items = responseObj.getJSONArray("orderItem") + JSONObject item = items[0] + JSONObject service = item.get("service") + String sppartnerServiceId = service.get("id") + if(sppartnerServiceId == null || sppartnerServiceId.equals("null")) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Create Service Order Status get null sppartnerServiceId") + msoLogger.error("null sppartnerServiceId while getting progress from externalAPI") + return + } + execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId) - String serviceOrderState = responseObj.get("orderIterm.state") + String serviceOrderState = item.get("state") execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable("serviceOrderState", serviceOrderState) + execution.setVariable("ServiceOrderState", serviceOrderState) // Get serviceOrder State and process progress if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 15) - execution.setVariable("status", "processing") + execution.setVariable("status", "processing") + execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } - if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { + else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 40) execution.setVariable("status", "processing") + execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } - if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { + else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 100) execution.setVariable("status", "finished") + execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } - if("FAILED".equalsIgnoreCase(serviceOrderState)) { + else if("FAILED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 100) execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } else { execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Create Service Order Status is unknown") } - execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } else{ msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") - execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API") + execution.setVariable("statusDescription", "Get Create ServiceOrder Received a bad response") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Create ServiceOrder Received a bad response from 3rdONAP External API") } msoLogger.info("Exit " + getE2ESIProgressin3rdONAP) @@ -504,17 +554,15 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso * delay 5 sec */ public void timeDelay(DelegateExecution execution) { - def isDebugEnabled= execution.getVariable("isDebugLogEnabled") try { Thread.sleep(5000) } catch(InterruptedException e) { - utils.log("ERROR", "Time Delay exception" + e ) + msoLogger.error("Time Delay exception" + e) } } public void saveSPPartnerInAAI(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - msoLogger.info(" ***** Started postCreateE2ESIin3rdONAP *****") + msoLogger.info(" ***** Started saveSPPartnerInAAI *****") String sppartnerId = execution.getVariable(Prefix + "SppartnerServiceId") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") @@ -522,8 +570,11 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceInstanceId = execution.getVariable(Prefix + "ServiceInstanceId") String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") + String resourceModelInvariantUuid = execution.getVariable(Prefix + "ResourceModelInvariantUuid") + String resourceModelUuid = execution.getVariable(Prefix + "ResourceModelUuid") + String resourceModelCustomizationUuid = execution.getVariable(Prefix + "ResourceModelCustomizationUuid") - AaiUtil aaiUriUtil = new AaiUtil(this) + AaiUtil aaiUriUtil = new AaiUtil() String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) @@ -532,6 +583,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso <id>${sppartnerId}</id> <url>${sppartnerUrl}</url> <callsource>${callSource}</callsource> + <model-invariant-id>${resourceModelInvariantUuid}</model-invariant-id> + <model-version-id>${resourceModelUuid}</model-version-id> + <model-customization-id>${resourceModelCustomizationUuid}</model-customization-id> <relationship-list> <relationship> <related-to>service-instance</related-to> @@ -551,7 +605,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) int responseCode = response.getStatusCode() execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode) - msoLogger.debug(" Put sppartner response code is: " + responseCode) + msoLogger.debug("Put sppartner response code is: " + responseCode) String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) @@ -581,7 +635,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void postProcess(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started postProcess *****") String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode") String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse") @@ -591,7 +644,6 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.debug(" *** sendSyncResponse *** ") try { @@ -609,21 +661,4 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } msoLogger.debug(" ***** Exit sendSyncResopnse *****") } - - String customizeResourceParam(String inputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList() - JSONObject jsonObject = new JSONObject(inputParametersJson) - Iterator iterator = jsonObject.keys() - while (iterator.hasNext()) { - String key = iterator.next() - HashMap<String, String> hashMap = new HashMap() - hashMap.put("name", key) - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map<String, List<Map<String, Object>>> paramMap = new HashMap() - paramMap.put("param", paramList) - - return new JSONObject(paramMap).toString() - } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy index 15b63fb5ab..89a6239be7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy @@ -65,6 +65,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution){ msoLogger.info(" ***** Started preProcessRequest *****") + String msg = "" try { //get bpmn inputs from resource request. @@ -77,25 +78,52 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) - String resourceInputPrameters = resourceInputObj.getResourceParameters() - String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) - execution.setVariable(Prefix + "resourceRequestInputs", inputParameters) + execution.setVariable(Prefix + "ResourceInput", resourceInputObj) + + String resourceInputPrameters = resourceInputObj.getResourceParameters() + String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") + JSONObject inputParameters = new JSONObject(inputParametersJson) + execution.setVariable(Prefix + "ResourceRequestInputs", inputParameters) + +// String incomingRequest = resourceInputObj.getRequestsInputs() +// String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") +// String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") +// JSONObject serviceInputParameters = new JSONObject(requestInputs) +// execution.setVariable(Prefix + "ServiceParameters", serviceInputParameters) //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() - //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" - if(!StringUtils.isBlank(recipeParamsFromRequest)){ - //the operationType from worflow(first node) is second priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") + String resourceName = resourceInputObj.getResourceInstanceName() + if (isBlank(resourceName)) { + msg = "Input resourceName is null" + msoLogger.error(msg) } - if(!StringUtils.isBlank(recipeParamsFromWf)){ - //the operationType from worflow(first node) is highest priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") + execution.setVariable("resourceName", resourceName) + msoLogger.info("resourceName:" + resourceName) + + String resourceModelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid() + if (isBlank(resourceModelInvariantUuid)) { + msg = "Input resourceModelInvariantUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) + msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) + + String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + if (isBlank(resourceModelUuid)) { + msg = "Input resourceModelUuid is null" + msoLogger.error(msg) + } + execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) + msoLogger.info("resourceModelUuid:" + resourceModelUuid) + + String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + if (isBlank(resourceModelCustomizationUuid)) { + msg = "Input resourceModelCustomizationUuid is null" + msoLogger.error(msg) } + execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid) + msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) @@ -103,40 +131,26 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() + msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - String customizeResourceParam(String networkInputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList(); - JSONObject jsonObject = new JSONObject(networkInputParametersJson); - Iterator iterator = jsonObject.keys(); - while (iterator.hasNext()) { - String key = iterator.next(); - HashMap<String, String> hashMap = new HashMap(); - hashMap.put("name", key); - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map<String, List<Map<String, Object>>> paramMap = new HashMap(); - paramMap.put("param", paramList); - - return new JSONObject(paramMap).toString(); - } - public void checkDevType(DelegateExecution execution){ msoLogger.info(" ***** Started checkDevType *****") try { - - JSONObject inputParameters = execution.getVariable(Prefix + "resourceRequestInputs") - String devType = inputParameters.get("device_class") + JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs") + String devType = resourceInputParameters.get("device_class") if(StringUtils.isBlank(devType)) { devType = "OTHER" } + // support VNF as PNF, to modify + else if(StringUtils.equalsIgnoreCase(devType, "VNF")) { + devType = "PNF" + } execution.setVariable("device_class", devType) @@ -147,6 +161,45 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareUpdateProgress(DelegateExecution execution) { + msoLogger.info(" ***** Started prepareUpdateProgress *****") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = execution.getVariable("progress") + String status = execution.getVariable("status") + String statusDescription = execution.getVariable("statusDescription") + + String body = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateResourceOperationStatus> + <operType>${operType}</operType> + <operationId>${operationId}</operationId> + <progress>${progress}</progress> + <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> + <serviceId>${ServiceInstanceId}</serviceId> + <status>${status}</status> + <statusDescription>${statusDescription}</statusDescription> + </ns:updateResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + setProgressUpdateVariables(execution, body) + msoLogger.info(" ***** Exit prepareUpdateProgress *****") + } + public void getVNFTemplatefromSDC(DelegateExecution execution){ msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") try { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy index 4405718c57..968612301d 100644..100755 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy @@ -18,7 +18,10 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts + +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.VnfResource; import static org.apache.commons.lang3.StringUtils.*; @@ -43,315 +46,358 @@ import groovy.json.* * */ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class); - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - - try { - - String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - serviceInstanceId = UUID.randomUUID().toString() - msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId) - } else { - msoLogger.debug("Using provided Service Instance ID:" + 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 = null; - try { - productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") - } catch (JSONException e) { - productFamilyId = null; - } - if (isBlank(productFamilyId)) - { - msg = "Input productFamilyId is null" - msoLogger.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" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else - { - execution.setVariable("serviceModelInfo", serviceModelInfo) - } - - msoLogger.debug("modelInfo" + serviceModelInfo) - - //requestParameters - String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(siRequest) - - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map<String, String> inputMap = [:] - if (userParams) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value.toString()) - } - } - - msoLogger.debug("User Input Parameters map: " + userParams.toString()) - execution.setVariable("serviceInputParams", inputMap) - - //TODO - //execution.setVariable("failExists", true) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit preProcessRequest") - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncResponse") - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - // RESTResponse for API Handler (APIH) Reply Task - String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) - sendWorkflowResponse(execution, 202, createServiceRestRequest) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit sendSyncResopnse") - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.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>""" - - msoLogger.debug(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) - } - - } - - // ******************************* - // - // ******************************* - public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") - try { - String siRequest = execution.getVariable("bpmnRequest") - String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") - execution.setVariable("serviceModelInfo", serviceModelInfo) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") - } - - - // ******************************* - // - // ******************************* - public void prepareCreateServiceInstance(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class); + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + try { + + String siRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId) + } else { + msoLogger.debug("Using provided Service Instance ID:" + 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 = null; + try { + productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + } catch (JSONException e) { + productFamilyId = null; + } + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + msoLogger.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" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + msoLogger.debug("modelInfo" + serviceModelInfo) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + //TODO + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncResponse") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit sendSyncResopnse") + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.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>""" + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") + try { + String siRequest = execution.getVariable("bpmnRequest") + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") + } + + public void processDecomposition(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + msoLogger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ") + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // VNFs + List<VnfResource> vnfList = serviceDecomposition.getVnfResources() + filterVnfs(vnfList) + serviceDecomposition.setVnfResources(vnfList) + + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable(Prefix + "VNFsCount", vnfList.size()) + msoLogger.debug("vnfs to create: " + vnfList.size()) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable(Prefix + "VNFsCount", 0) + msoLogger.debug("no vnfs to create based upon serviceDecomposition content") + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + + msoLogger.trace("Completed processDecomposition() of CreateGenericALaCarteServiceInstance ") + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. processDecomposition() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - try { - msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") + try { + msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - def siRequest = execution.getVariable("bpmnRequest") - Map reqMap = jsonSlurper.parseText(siRequest) - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - Map<String, String> inputMap = [:] - if (userParams != null) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value) - } - } - - msoLogger.debug("User Input Parameters map: " + userParams.toString()) - execution.setVariable("serviceInputParams", inputMap) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) - - String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") - serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) - execution.setVariable("serviceInstanceName", serviceInstanceName) - execution.setVariable("serviceDecomposition", serviceDecomposition) - execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) - msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) - - msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("prepareCompletion *** ") - - 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) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit prepareCompletionRequest") - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("prepareFalloutRequest") - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """<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>""" - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) - String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:ns="http://org.onap/so/request/types/v1" - xmlns:wfsch="http://org.onap/so/workflow/schema/v1"> - <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> - <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> - <action>CREATE</action> - <source>VID</source> - </request-info> - <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> - <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorException)}</aetgt:ErrorMessage> - <aetgt:ErrorCode>7000</aetgt:ErrorCode> - </aetgt:WorkflowException> - </aetgt:FalloutHandlerRequest>""" - - execution.setVariable("falloutRequest", falloutRequest) - } - msoLogger.trace("Exit prepareFalloutRequest") - } + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + def siRequest = execution.getVariable("bpmnRequest") + Map reqMap = jsonSlurper.parseText(siRequest) + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + Map<String, String> inputMap = [:] + if (userParams != null) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) + + String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") + serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) + execution.setVariable("serviceInstanceName", serviceInstanceName) + execution.setVariable("serviceDecomposition", serviceDecomposition) + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) + msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) + + msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("prepareCompletion *** ") + + 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) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit prepareCompletionRequest") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("prepareFalloutRequest") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """<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>""" + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1" + xmlns:wfsch="http://org.onap/so/workflow/schema/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>CREATE</action> + <source>VID</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorException)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("Exit prepareFalloutRequest") + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index c819da4be4..5255b37bb0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -20,40 +20,54 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.json.JSONObject +import org.json.XML +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse; + import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AaiUtil -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject -import org.json.XML; -import org.onap.so.bpmn.common.recipe.ResourceInput; -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.apache.commons.lang3.* import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MsoLogger -import groovy.json.* - /** * This groovy class supports the <class>CreateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Create */ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); String Prefix="CRESDNCRES_" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - + + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution){ - msoLogger.trace("Started preProcessRequest ") - try { - + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") + try { + //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") @@ -65,12 +79,12 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) - + //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() + String resourceName = resourceInputObj.getResourceInstanceName() //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" + String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest)){ //the operationType from worflow(first node) is second priority. operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") @@ -79,27 +93,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - + + //For sdnc, generate svc_action and request_action String sdnc_svcAction = "create" - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){ - //This will be resolved in R3. - sdnc_svcAction ="activate" - operationType = "NCINetwork" + switch (resourceInputObj.getResourceInstanceName()) { + + case ~/[\w\s\W]*overlay[\w\s\W]*/ : + //This will be resolved in R3. + sdnc_svcAction ="activate" + operationType = "NCINetwork" + break + + case ~/[\w\s\W]*underlay[\w\s\W]*/ : + //This will be resolved in R3. + operationType ="Network" + break + + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + execution.setVariable("isActivateRequired", "true") + break + + default: + break } - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){ - //This will be resolved in R3. - operationType ="Network" - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - execution.setVariable(Prefix + "svcAction", sdnc_svcAction) + + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) //TODO Here build networkrequest - + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -108,7 +165,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + String customizeResourceParam(String networkInputParametersJson) { List<Map<String, Object>> paramList = new ArrayList(); JSONObject jsonObject = new JSONObject(networkInputParametersJson); @@ -125,7 +182,65 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { return new JSONObject(paramMap).toString(); } - + + /** + * This method updates the resource input by collecting required info from AAI + * @param execution + */ + public void updateResourceInput(DelegateExecution execution) { + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + + switch (modelName) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/: + + def resourceInput = resourceInputObj.getResourceParameters() + String incomingRequest = resourceInputObj.getRequestsInputs() + String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") + String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") + JSONObject inputParameters = new JSONObject(requestInputs) + if(inputParameters.has("local-access-provider-id")) { + String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.access-provider-id", inputParameters.get("local-access-provider-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-client-id", inputParameters.get("local-access-client-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-topology-id", inputParameters.get("local-access-topology-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-ltp-id", inputParameters.get("local-access-ltp-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-node-id", inputParameters.get("local-access-node-id")) + resourceInputObj.setResourceParameters(uResourceInput) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + } + + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + // fill attachment TP in networkInputParamJson + String customer = resourceInputObj.getGlobalSubscriberId() + String serviceType = resourceInputObj.getServiceType() + + def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName" + String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName) + + AaiUtil aaiUtil = new AaiUtil(this) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String customerUri = aaiUtil.getBusinessCustomerUri(execution) + "/" + customer + String aai_service_query_url = aai_endpoint + customerUri + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances?service-instance-name=" + parentServiceName + + APIResponse aaiResponse = aaiUtil.executeAAIGetCall(execution, aai_service_query_url) + def parentServiceInstanceId = getParentServiceInstnaceId(aaiResponse) + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + break + + default: + break + } + } + + private String getParentServiceInstnaceId(APIResponse aaiResponse) { + String response = aaiResponse.getResponseBodyAsString() + def xmlResp = new XmlParser().parseText(response) + return "${xmlResp?."service-instance"[0]?."service-instance-id"[0]?.text()}" + } + /** * Pre Process the BPMN Flow Request * Inclouds: @@ -133,15 +248,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsParameters */ public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.trace("Started prepareSDNCRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables - String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") + String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") String hdrRequestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") @@ -166,176 +283,173 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncTopologyCreateRequest = "" switch (modelName) { - case ~/^Site$/: + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> - <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name> <vnf-information> - <!-- TODO: to be filled as per the request input --> <vnf-id></vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> - </network-information> - <vnf-input-parameters> - <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters> - </vnf-input-parameters> + </vnf-information> <vnf-request-input> - <request-version></request-version> - <vnf-name></vnf-name> - <neutron-id></neutron-id> - <contrail-network-fqdn></contrail-network-fqdn> - <subnets-data> - <subnet-data> - <element> - <ip-version></ip-version> - <subnet-id></subnet-id> - </subnet-data> - </subnets-data> - </vnf-request-input> + <vnf-input-parameters> + $netowrkInputParameters + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> + </vnf-networks> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> - <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name> <allotted-resource-information> <!-- TODO: to be filled as per the request input --> + <allotted-resource-id></allotted-resource-id> <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id><parent-service-instance-id> + <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> - <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> + $netowrkInputParameters </connection-attachment-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <network-information> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> - <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters> + <network-input-parameters>$netowrkInputParameters</network-input-parameters> </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() } - + String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) - msoLogger.debug(sndcTopologyCreateRequesAsString) + utils.logAudit(sndcTopologyCreateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) @@ -345,8 +459,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Exit prepareSDNCRequest ") - } + msoLogger.info(" ***** Exit prepareSDNCRequest *****") + } private void setProgressUpdateVariables(DelegateExecution execution, String body) { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") @@ -368,17 +482,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -395,23 +509,23 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String operationId = resourceInputObj.getOperationId() String progress = "100" String status = "finished" - String statusDescription = "SDCN resource creation completed" + String statusDescription = "SDCN resource creation and activation completed" execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -419,32 +533,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { setProgressUpdateVariables(execution, body) } - public void postCreateSDNCCall(DelegateExecution execution){ - msoLogger.trace("Started prepareSDNCRequest ") + public void afterCreateSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - + + def isActivateRequried = execution.getVariable("isActivateRequired") + if (StringUtils.equalsIgnoreCase(isActivateRequried, "true")) { + def instnaceId = getInstnaceId(execution) + execution.setVariable("networkInstanceId", instnaceId) + } + msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) - msoLogger.trace("Exit prepareSDNCRequest ") + msoLogger.info(" ***** Exit prepareSDNCRequest *****") + } + + private def getInstnaceId(DelegateExecution execution) { + def responce = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse")) + def data = responce.toString() + data = data.substring(data.indexOf("<")) + + def resp = new XmlSlurper().parseText(data) + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + def val = "" + + switch (modelName) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + val = resp."network-response-information"."instance-id" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*Site[\w\s\W]*/: + val = resp."vnf-response-information"."instance-id" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: + val = resp."connection-attachment-response-information"."instance-id" + break + } + + return val.toString() + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug(" *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResopnse *****") } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index a63aad14a2..b6ea9f3fef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -32,14 +32,15 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger /** * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Activate */ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeActivateSDNCNetworkResource.class); String Prefix = "DEACTSDNCRES_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -48,21 +49,22 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution) { - msoLogger.info(" ***** started preProcessRequest*****") + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object - org.onap.so.bpmn.common.recipe.ResourceInput resourceInputObj = org.onap.so.bpmn.common.resource.ResourceRequestBuilder.getJsonObject(resourceInput, org.onap.so.bpmn.common.recipe.ResourceInput.class) + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) //Deal with recipeParams @@ -82,7 +84,40 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor // TODO: based on the resource type decide action and operation type String sdnc_svcAction = "deactivate" - operationType = "SOTNConnectivity" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + default: + break + } String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) @@ -102,7 +137,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void prepareSDNCRequest(DelegateExecution execution) { - msoLogger.info(" ***** started prepareSDNCRequest *****") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables @@ -115,7 +151,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - org.onap.so.bpmn.common.recipe.ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -127,175 +163,164 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid() // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sdncTopologyDeleteRequest = "" switch (modelName) { - case ~/^Site$/: + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - <subscriber-name></subscriber-name> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <!-- TODO: to be filled as per the request input --> - <vnf-id></vnf-id> + <vnf-id>$resourceInstnaceId</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> - </network-information> + </vnf-information> <vnf-request-input> - <request-version></request-version> - <vnf-name></vnf-name> - <vnf-networks> - <vnf-network> - <network-role></network-role> - <network-name></network-name> - <neutron-id></neutron-id> - <network-id></network-id> - <contrail-network-fqdn></contrail-network-fqdn> - <subnets-data> - <subnet-data> - <ip-version></ip-version> - <subnet-id></subnet-id> - </subnet-data> - </subnets-data> - </vnf-network> + <vnf-input-parameters> + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> </vnf-networks> - </vnf-request-input> - <vnf-input-parameters> - <param></param> - </vnf-input-parameters> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> <subscriber-name></subscriber-name> </service-information> <allotted-resource-information> - <!-- TODO: to be filled as per the request input --> - <allotted-resource-id></allotted-resource-id> + <allotted-resource-id>$resourceInstnaceId</allotted-resource-id> <allotted-resource-type></allotted-resource-type> <parent-service-instance-id></parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> - <param></param> </connection-attachment-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + default: sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <network-information> + <network-id>$resourceInstnaceId</network-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> @@ -305,10 +330,10 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor </aetgt:SDNCAdapterWorkflowRequest>""".trim() } - String sndcTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) + utils.logAudit(sdncTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) + msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() @@ -320,32 +345,30 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) { - msoLogger.info("***** started prepareUpdateAfterDeActivateSDNCResource *****") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String serviceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "SDCN resource delete completed" + String progress = "50" + String status = "deactivated" + String statusDescription = "SDCN resource deactivation completed" //String operationId = execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -353,9 +376,15 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor setProgressUpdateVariables(execution, body) } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + public void postDeactivateSDNCCall(DelegateExecution execution) { - msoLogger.info(" ***** started postDeactivateSDNCCall *****") - String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) @@ -363,8 +392,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void sendSyncResponse(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - msoLogger.info(" ***** started sendSyncResponse *****") + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" @@ -379,7 +408,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResopnse *****") + msoLogger("DEBUG"," ***** Exit sendSyncResopnse *****") } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index 37c7d4d29a..06346ea81e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -20,12 +20,12 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.json.JSONArray import org.json.JSONObject import org.json.XML import static org.apache.commons.lang3.StringUtils.* import groovy.xml.XmlUtil -import groovy.json.* import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil @@ -37,7 +37,6 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder import org.onap.so.rest.APIResponse -import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import java.util.UUID import org.onap.so.logger.MsoLogger @@ -77,26 +76,29 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String resourceInput = execution.getVariable("resourceInput") msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) // set local resourceInput execution.setVariable(Prefix + "ResourceInput", resourceInputObj) String resourceInstanceId = resourceInputObj.getResourceInstancenUuid() + String sppartnerId = resourceInstanceId + execution.setVariable(Prefix + "SppartnerId", sppartnerId) // Get Sppartner from AAI - AaiUtil aaiUriUtil = new AaiUtil(this) + AaiUtil aaiUriUtil = new AaiUtil() String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) String aai_endpoint = execution.getVariable("URN_aai_endpoint") String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(sppartnerId,"UTF-8") - execution.setVariable(Prefix + "serviceAaiPath", serviceAaiPath) + execution.setVariable(Prefix + "ServiceAaiPath", serviceAaiPath) getSPPartnerInAAI(execution) String callSource = "UUI" String sppartnerUrl = "" - if(execution.getVariable(Prefix + "SuccessIndicator")) { + if(execution.hasVariable(Prefix + "CallSource")) { callSource = execution.getVariable(Prefix + "CallSource") + sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") } boolean is3rdONAPExist = false @@ -131,15 +133,15 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void preProcessRequest(DelegateExecution execution){ msoLogger.info(" ***** Started preProcessRequest *****") + String msg = "" + try { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String msg = "" + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } //set local variable execution.setVariable("globalSubscriberId", globalSubscriberId) @@ -148,8 +150,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceType = resourceInputObj.getServiceType() if (isBlank(serviceType)) { msg = "Input serviceType is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } execution.setVariable("serviceType", serviceType) msoLogger.info( "serviceType:" + serviceType) @@ -157,26 +158,23 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String operationId = resourceInputObj.getOperationId() if (isBlank(operationId)) { msg = "Input operationId is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } execution.setVariable("operationId", operationId) msoLogger.info( "operationId:" + operationId) - String resourceName = resourceInputObj.getResourceInstanceName() + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } execution.setVariable("resourceName", resourceName) - msoLogger.info( "resourceInstanceId:" + resourceName) + msoLogger.info("resourceName:" + resourceName) String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceTemplateId)) { msg = "Input resourceTemplateId is null" - msoLogger.info( msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + msoLogger.error( msg) } execution.setVariable("resourceTemplateId", resourceTemplateId) msoLogger.info( "resourceTemplateId:" + resourceTemplateId) @@ -184,7 +182,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } catch (BpmnError e) { throw e } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() + msg = "Exception in preProcessRequest " + ex.getMessage() msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } @@ -227,7 +225,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso msoLogger.info(" ***** Started prepare3rdONAPRequest *****") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String extAPIPath = sppartnerUrl + 'serviceOrder' + String extAPIPath = sppartnerUrl + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) // ExternalAPI message format @@ -238,8 +236,8 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String requestedCompletionDate = utils.generateCurrentTimeInUtc() String priority = "1" // 0-4 0:highest String subscriberId = execution.getVariable("globalSubscriberId") - String customerRole = "" - String subscriberName = "" + String customerRole = "ONAPcustomer" + String subscriberName = subscriberId String referredType = "Consumer" String orderItemId = "1" String action = "delete" //for delete @@ -249,7 +247,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceId = execution.getVariable(Prefix + "SppartnerId") queryServicefrom3rdONAP(execution) - String serviceUuId = execution.getVariable(Prefix + "serviceSpecificationId") + String serviceSpecificationId = execution.getVariable(Prefix + "ServiceSpecificationId") Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') @@ -266,11 +264,10 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("action", '"' + action + '"') valueMap.put("serviceState", '"' + serviceState + '"') valueMap.put("serviceId", '"' + serviceId + '"') - valueMap.put("serviceName", '"' + serviceName + '"') - valueMap.put("serviceType", '"' + serviceType + '"') - valueMap.put("serviceUuId", '"' + serviceUuId + '"') + valueMap.put("serviceName", "null") + valueMap.put("serviceUuId", '"' + serviceSpecificationId + '"') - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() valueMap.put("_requestInputs_", "") @@ -283,32 +280,45 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso { msoLogger.info(" ***** Started queryServicefrom3rdONAP *****") - //https://{api_url}/nbi/api/v1/service/{serviceinstanceid} + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String SppartnerServiceId = execution.getVariable(Prefix + "SppartnerId") + + //https://{api_url}/nbi/api/v1/service?relatedParty.id=${globalSubscriberId} String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String extAPIPath = sppartnerUrl + "service/" + execution.setVariable(Prefix + "SppartnerId") - - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + String extAPIPath = sppartnerUrl + "/service?relatedParty.id=" + globalSubscriberId + msoLogger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath) + + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "getServiceResponseCode", responseCode) - utils.log("DEBUG", "Get Service response code is: " + responseCode) + execution.setVariable(Prefix + "GetServiceResponseCode", responseCode) + msoLogger.debug("Get Service response code is: " + responseCode) String extApiResponse = response.getResponseBodyAsString() - JSONObject responseObj = new JSONObject(extApiResponse) - execution.setVariable(Prefix + "getServiceResponse", extApiResponse) + + execution.setVariable(Prefix + "GetServiceResponse", extApiResponse) + msoLogger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse) //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { - utils.log("DEBUG", "Get Service Received a Good Response") - String serviceUuid = responseObj.get("serviceSpecification.id") - execution.setVariable(Prefix + "serviceSpecificationId", serviceUuid) + msoLogger.debug("Get Service Received a Good Response") + JSONArray responseList = new JSONArray(extApiResponse) + for(JSONObject obj : responseList) { + String svcId = obj.get("id") + if(StringUtils.equalsIgnoreCase(SppartnerServiceId, svcId)) { + JSONObject serviceSpecification = obj.get("serviceSpecification") + String serviceUuid = serviceSpecification.get("id") + execution.setVariable(Prefix + "ServiceSpecificationId", serviceUuid) + break + } + } } else{ - utils.log("DEBUG", "Get Service Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API") + msoLogger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode) +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API") } msoLogger.info( "Exit " + queryServicefrom3rdONAP) @@ -319,29 +329,35 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String extAPIPath = execution.getVariable("ExternalAPIURL") String payload = execution.getVariable(Prefix + "Payload") + msoLogger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) + msoLogger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "postServiceOrderResponseCode", responseCode) + execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) msoLogger.debug("Post ServiceOrder response code is: " + responseCode) String extApiResponse = response.getResponseBodyAsString() JSONObject responseObj = new JSONObject(extApiResponse) - execution.setVariable(Prefix + "postServiceOrderResponse", extApiResponse) + execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) + + msoLogger.debug("doDeleteE2ESIin3rdONAP response body is: " + extApiResponse) + //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { msoLogger.debug("Post ServiceOrder Received a Good Response") - String serviceOrderId = responseObj.get("ServiceOrderId") + String serviceOrderId = responseObj.get("id") execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable("serviceOrderId", serviceOrderId) + execution.setVariable("ServiceOrderId", serviceOrderId) + msoLogger.info("Post ServiceOrderid is: " + serviceOrderId) } else{ - msoLogger.debug("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) + msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") } @@ -354,57 +370,85 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") + msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath) - ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil() APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "getServiceOrderResponseCode", responseCode) + execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) msoLogger.debug("Get ServiceOrder response code is: " + responseCode) String extApiResponse = response.getResponseBodyAsString() JSONObject responseObj = new JSONObject(extApiResponse) - execution.setVariable(Prefix + "getServiceOrderResponse", extApiResponse) + execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) + utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse, isDebugEnabled) + //Process Response //200 OK 201 CREATED 202 ACCEPTED - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { msoLogger.debug("Get ServiceOrder Received a Good Response") - String serviceOrderState = responseObj.get("State") + + String orderState = responseObj.get("state") + if("REJECTED".equalsIgnoreCase(orderState)) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Delete Service Order Status is REJECTED") + return + } + + JSONArray items = responseObj.getJSONArray("orderItem") + JSONObject item = items[0] + JSONObject service = item.get("service") + String sppartnerServiceId = service.get("id") + if(sppartnerServiceId == null || sppartnerServiceId.equals("null")) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Delete Service Order Status get null sppartnerServiceId") + msoLogger.error("null sppartnerServiceId while getting progress from externalAPI") + return + } + execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId) + + String serviceOrderState = item.get("state") execution.setVariable(Prefix + "SuccessIndicator", true) - execution.setVariable("serviceOrderState", serviceOrderState) - + execution.setVariable("ServiceOrderState", serviceOrderState) + // Get serviceOrder State and process progress if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 15) - execution.setVariable("status", "processing") + execution.setVariable("status", "processing") + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } - if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { + else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 40) execution.setVariable("status", "processing") + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } - if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { + else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 100) execution.setVariable("status", "finished") + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } - if("FAILED".equalsIgnoreCase(serviceOrderState)) { + else if("FAILED".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("progress", 100) execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } else { execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Delete Service Order Status is unknown") } - execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) } else{ msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") - execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API") + execution.setVariable("statusDescription", "Get Delete ServiceOrder Received a bad response") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Delete ServiceOrder Received a bad response from 3rdONAP External API") } msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP) @@ -417,15 +461,15 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso try { Thread.sleep(5000) } catch(InterruptedException e) { - utils.log("ERROR", "Time Delay exception" + e ) + msoLogger.error("Time Delay exception" + e ) } } private void getSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started postDeleteE2ESIin3rdONAP *****") + msoLogger.info(" ***** Started getSPPartnerInAAI *****") - AaiUtil aaiUriUtil = new AaiUtil(this) - String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + AaiUtil aaiUriUtil = new AaiUtil() + String serviceAaiPath = execution.getVariable(Prefix + "ServiceAaiPath") APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) int responseCode = response.getStatusCode() execution.setVariable(Prefix + "GetSppartnerResponseCode", responseCode) @@ -444,13 +488,13 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable(Prefix + "FoundIndicator", true) - String sppartnerId = utils.getNodeText1(aaiResponse, "sppartner-id") + String sppartnerId = utils.getNodeText1(aaiResponse, "sp-partner-id") execution.setVariable(Prefix + "SppartnerId", sppartnerId) msoLogger.debug(" SppartnerId is: " + sppartnerId) - String sppartnerUrl = utils.getNodeText1(aaiResponse, "sppartner-url") + String sppartnerUrl = utils.getNodeText1(aaiResponse, "url") execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl) - String callSource = utils.getNodeText1(aaiResponse, "sppartner-callsource") + String callSource = utils.getNodeText1(aaiResponse, "callsource") execution.setVariable(Prefix + "CallSource", callSource) msoLogger.debug(" CallSource is: " + callSource) String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version") @@ -460,22 +504,22 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso else { msoLogger.debug("Get sppartner Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") +// exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) +// throw new BpmnError("MSOWorkflowException") } - msoLogger.info( "Exit " + deleteSPPartnerInAAI) + msoLogger.info( "Exit " + getSPPartnerInAAI) } public void deleteSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started postDeleteE2ESIin3rdONAP *****") + msoLogger.info(" ***** Started deleteSPPartnerInAAI *****") String sppartnerId = execution.getVariable(Prefix + "SppartnerId") - String sppartnerUrl = execution.getVariable(Prefix + "sppartnerUrl") - String sppartnerVersion = execution.getVariable(Prefix + "sppartnerVersion") + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") + String sppartnerVersion = execution.getVariable(Prefix + "SppartnerVersion") - AaiUtil aaiUriUtil = new AaiUtil(this) - String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + "?resource-version=${sppartnerVersion}" + AaiUtil aaiUriUtil = new AaiUtil() + String serviceAaiPath = execution.getVariable(Prefix + "ServiceAaiPath") + "?resource-version=${sppartnerVersion}" APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath) int responseCode = response.getStatusCode() execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode) @@ -486,8 +530,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse) //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 204 ) { msoLogger.debug("Delete sppartner Received a Good Response") execution.setVariable(Prefix + "SuccessIndicator", true) @@ -499,13 +542,13 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso else { msoLogger.debug("Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") +// exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) +// throw new BpmnError("MSOWorkflowException") } msoLogger.info( "Exit " + deleteSPPartnerInAAI) } - + private void setProgressUpdateVariables(DelegateExecution execution, String body) { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) @@ -514,8 +557,8 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void postProcess(DelegateExecution execution){ msoLogger.info(" ***** Started postProcess *****") - String responseCode = execution.getVariable(Prefix + "putSppartnerResponseCode") - String responseObj = execution.getVariable(Prefix + "putSppartnerResponse") + String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode") + String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse") msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj) msoLogger.info(" ***** Exit postProcess *****") @@ -535,7 +578,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } msoLogger.debug(" ***** Exit sendSyncResopnse *****") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy index 5a21fd7396..71ce28d7d3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -25,7 +25,6 @@ import org.json.XML; import static org.apache.commons.lang3.StringUtils.*; import groovy.xml.XmlUtil -import groovy.json.* import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.recipe.ResourceInput; @@ -50,8 +49,8 @@ import org.onap.so.rest.APIResponse; import org.onap.so.bpmn.common.scripts.AaiUtil /** - * This groovy class supports the <class>CreateDeviceResource.bpmn</class> process. - * flow for Device Resource Create + * This groovy class supports the <class>DeleteDeviceResource.bpmn</class> process. + * flow for Device Resource Delete */ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { @@ -77,25 +76,21 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) + execution.setVariable(Prefix + "ResourceInput", resourceInputObj) String resourceInputPrameters = resourceInputObj.getResourceParameters() String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) - execution.setVariable(Prefix + "resourceRequestInputs", inputParameters) + JSONObject inputParameters = new JSONObject(inputParametersJson) + execution.setVariable(Prefix + "ResourceRequestInputs", inputParameters) //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") String resourceName = resourceInputObj.getResourceInstanceName() - //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" - if(!StringUtils.isBlank(recipeParamsFromRequest)){ - //the operationType from worflow(first node) is second priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") - } - if(!StringUtils.isBlank(recipeParamsFromWf)){ - //the operationType from worflow(first node) is highest priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") - } + + String resourceInstanceId = resourceInputObj.getResourceInstancenUuid() + String deviceId = resourceInstanceId + execution.setVariable(Prefix + "DeviceId", deviceId) + + getDeviceInAAI(execution) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) @@ -104,35 +99,58 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug( msg) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - String customizeResourceParam(String networkInputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList(); - JSONObject jsonObject = new JSONObject(networkInputParametersJson); - Iterator iterator = jsonObject.keys(); - while (iterator.hasNext()) { - String key = iterator.next(); - HashMap<String, String> hashMap = new HashMap(); - hashMap.put("name", key); - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map<String, List<Map<String, Object>>> paramMap = new HashMap(); - paramMap.put("param", paramList); - - return new JSONObject(paramMap).toString(); - } + private void getDeviceInAAI(DelegateExecution execution) { + msoLogger.info(" ***** Started getDeviceInAAI *****") + + String deviceId = execution.getVariable(Prefix + "DeviceId") + AaiUtil aaiUriUtil = new AaiUtil() + String aai_uri = aaiUriUtil.getNetworkDeviceUri(execution) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(deviceId,"UTF-8") + execution.setVariable(Prefix + "ServiceAaiPath", serviceAaiPath) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "GetDeviceResponseCode", responseCode) + msoLogger.debug(" Get device response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + aaiResponse = aaiResponse.replaceAll("&", "&") + execution.setVariable(Prefix + "GetDeviceResponse", aaiResponse) + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + msoLogger.debug("GET Device Received a Good Response") + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable(Prefix + "FoundIndicator", true) + + String devClass = utils.getNodeText1(aaiResponse, "device_class") + execution.setVariable(Prefix + "DeviceClass", devClass) + msoLogger.debug(" DeviceClass is: " + devClass) + + } + else + { + msoLogger.debug("Get DeviceInAAI Received a Bad Response Code. Response Code is: " + responseCode) + + } + + msoLogger.info(" ***** Exit getDeviceInAAI *****") + } public void checkDevType(DelegateExecution execution){ - utils.log("INFO"," ***** Started checkDevType *****") + msoLogger.info(" ***** Started checkDevType *****") try { - JSONObject inputParameters = execution.getVariable(Prefix + "resourceRequestInputs") - - String devType = inputParameters.get("device_class") + String devType = execution.getVariable(Prefix + "DeviceClass") if(StringUtils.isBlank(devType)) { devType = "OTHER" @@ -147,8 +165,47 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void prepareUpdateProgress(DelegateExecution execution) { + msoLogger.info(" ***** Started prepareUpdateProgress *****") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = execution.getVariable("progress") + String status = execution.getVariable("status") + String statusDescription = execution.getVariable("statusDescription") + + String body = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateResourceOperationStatus> + <operType>${operType}</operType> + <operationId>${operationId}</operationId> + <progress>${progress}</progress> + <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> + <serviceId>${ServiceInstanceId}</serviceId> + <status>${status}</status> + <statusDescription>${statusDescription}</statusDescription> + </ns:updateResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + setProgressUpdateVariables(execution, body) + msoLogger.info(" ***** Exit prepareUpdateProgress *****") + } + public void getVNFTemplatefromSDC(DelegateExecution execution){ - utils.log("INFO"," ***** Started getVNFTemplatefromSDC *****") + msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") try { // To do @@ -161,7 +218,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } public void postVNFInfoProcess(DelegateExecution execution){ - utils.log("INFO"," ***** Started postVNFInfoProcess *****") + msoLogger.info(" ***** Started postVNFInfoProcess *****") try { // To do diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 04b62d7f73..192788a4ca 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -34,6 +34,8 @@ 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.json.JsonUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger import groovy.json.* @@ -42,21 +44,23 @@ import groovy.json.* * flow for SDNC Network Resource */ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteSDNCNetworkResource.class); String Prefix="DELSDNCRES_" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - + + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution){ - msoLogger.info("***** Started preProcessRequest *****") - try { - + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") + try { + //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") @@ -68,12 +72,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) - + //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() + String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() //For sdnc requestAction default is "NetworkInstance" - String operationType = "Network" + String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){ //the operationType from worflow(first node) is second priority. operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") @@ -82,36 +86,78 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - + + //For sdnc, generate svc_action and request_action String sdnc_svcAction = "delete" - if(StringUtils.containsIgnoreCase(resourceModelName, "overlay")){ - //This will be resolved in R3. - sdnc_svcAction ="deactivate" - operationType = "NCINetwork" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + + case ~/[\w\s\W]*overlay[\w\s\W]*/ : + ///This will be resolved in R3. + sdnc_svcAction ="deactivate" + operationType = "NCINetwork" + break + + case ~/[\w\s\W]*underlay[\w\s\W]*/ : + //This will be resolved in R3. + operationType ="Network" + break + + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + default: + break } - if(StringUtils.containsIgnoreCase(resourceModelName, "underlay")){ - //This will be resolved in R3. - operationType ="Network" - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - execution.setVariable(Prefix + "svcAction", sdnc_svcAction) + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) //TODO Here build networkrequest - + } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + /** * Pre Process the BPMN Flow Request * Inclouds: @@ -119,11 +165,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsParameters */ public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.info("***** Started prepareSDNCRequest *****") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables - String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") + String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") @@ -144,177 +191,164 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid() // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = "" + String sdncTopologyDeleteRequest = "" switch (modelName) { - case ~/^Site$/: - sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - <subscriber-name></subscriber-name> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <!-- TODO: to be filled as per the request input --> - <vnf-id></vnf-id> + <vnf-id>$resourceInstnaceId</vnf-id> <vnf-type></vnf-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </vnf-information> <vnf-request-input> - <request-version></request-version> - <vnf-name></vnf-name> - <vnf-networks> - <vnf-network> - <network-role></network-role> - <network-name></network-name> - <neutron-id></neutron-id> - <network-id></network-id> - <contrail-network-fqdn></contrail-network-fqdn> - <subnets-data> - <subnet-data> - <ip-version></ip-version> - <subnet-id></subnet-id> - </subnet-data> - </subnets-data> - </vnf-network> + <vnf-input-parameters> + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> </vnf-networks> - </vnf-request-input> - <vnf-input-parameters> - <param></param> - </vnf-input-parameters> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/^SOTNAttachment$/: - sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> <subscriber-name></subscriber-name> </service-information> <allotted-resource-information> - <allotted-resource-id></allotted-resource-id> + <allotted-resource-id>$resourceInstnaceId</allotted-resource-id> <allotted-resource-type></allotted-resource-type> <parent-service-instance-id></parent-service-instance-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </allotted-resource-information> <connection-attachment-request-input> - <param></param> </connection-attachment-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break default: - sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData> <request-information> - <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> + <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEncode(source)}</source> <notification-url></notification-url> <order-number></order-number> <order-version></order-version> </request-information> <service-information> - <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name> </onap-model-information> - <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id> </service-information> <network-information> - <!-- TODO: to be filled as per the request input --> - <network-id></network-id> + <network-id>$resourceInstnaceId</network-id> <onap-model-information> - <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEncode(modelName)}</model-name> </onap-model-information> </network-information> <network-request-input> @@ -324,19 +358,19 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() } - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) + utils.logAudit(sdncTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) + msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + msoLogger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } msoLogger.info(" ***** Exit prepareSDNCRequest *****") - } + } private void setProgressUpdateVariables(DelegateExecution execution, String body) { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") @@ -358,17 +392,17 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -385,23 +419,23 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String operationId = resourceInputObj.getOperationId() String progress = "100" String status = "finished" - String statusDescription = "SDCN resource delete completed" + String statusDescription = "SDCN resource delete and deactivation completed" //String operationId = execution.getVariable("operationId") String body = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> + xmlns:ns="http://org.openecomp.mso/requestsdb"> <soapenv:Header/> <soapenv:Body> <ns:updateResourceOperationStatus> - <operType>${MsoUtils.xmlEscape(operType)}</operType> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID> - <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId> - <status>${MsoUtils.xmlEscape(status)}</status> - <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription> + <operType>${msoUtils.xmlEncode(operType)}</operType> + <operationId>${msoUtils.xmlEncode(operationId)}</operationId> + <progress>${msoUtils.xmlEncode(progress)}</progress> + <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID> + <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId> + <status>${msoUtils.xmlEncode(status)}</status> + <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> </soapenv:Envelope>"""; @@ -410,6 +444,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void postDeleteSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") @@ -417,23 +452,24 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) msoLogger.info(" ***** Exit prepareSDNCRequest *****") } - - public void sendSyncResponse (DelegateExecution execution) { - msoLogger.info(" *** sendSyncResponse *** ") - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.info(" ***** Exit sendSyncResopnse *****") - } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug( " *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResopnse *****") + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 913970b051..4b848024d6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -42,9 +42,11 @@ 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.bpmn.infrastructure.workflow.service.ServicePluginFactory import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse import org.springframework.web.util.UriUtils; import groovy.json.* @@ -330,7 +332,6 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } } - public void postProcessAAIGET2(DelegateExecution execution) { msoLogger.trace("postProcessAAIGET2 ") String msg = "" @@ -469,15 +470,25 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { // if site location is in local Operator, create all resources in local ONAP; // if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP public void doProcessSiteLocation(DelegateExecution execution){ - msoLogger.trace("======== Start doProcessSiteLocation Process ======== ") ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") String uuiRequest = execution.getVariable("uuiRequest") - ServiceDecomposition serviceDecompositionforLocal = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest); - execution.setVariable("serviceDecomposition", serviceDecompositionforLocal) + uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest); + execution.setVariable("uuiRequest", uuiRequest) + execution.setVariable("serviceDecomposition", serviceDecomposition) msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ") } + + // Allocate cross link TPs(terminal points) for sotn network only + public void doTPResourcesAllocation(DelegateExecution execution){ + msoLogger.trace("======== Start doTPResourcesAllocation Process ======== ") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest); + execution.setVariable("uuiRequest", uuiRequest) + msoLogger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ") + } // prepare input param for using DoCreateResources.bpmn public void preProcessForAddResource(DelegateExecution execution) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 17dbe50cc5..482da23b33 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -104,7 +104,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ String serviceModelUUID = execution.getVariable("modelUuid") - List<Resource> addResourceList = execution.getVariable("addResourceList") + List<Resource> addResourceList = execution.getVariable("addResourceList") List<NetworkResource> networkResourceList = new ArrayList<NetworkResource>() @@ -149,17 +149,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ } String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true" + //if no networkResource, get SDNC config from properties file + if( "false".equals(isContainsWanResource)) { + String serviceNeedSDNC = "mso.workflow.custom." + serviceModelName + ".sdnc.need"; + isContainsWanResource = BPMNProperties.getProperty(serviceNeedSDNC, isContainsWanResource) + } + execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("sequencedResourceList", sequencedResourceList) msoLogger.info("sequencedResourceList: " + sequencedResourceList) msoLogger.trace("COMPLETED sequenceResoure Process ") - } - + } + public prepareServiceTopologyRequest(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start prepareServiceTopologyRequest Process ======== ", isDebugEnabled) + msoLogger.trace("======== Start prepareServiceTopologyRequest Process ======== ") String serviceDecompose = execution.getVariable("serviceDecomposition") @@ -174,7 +179,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ execution.setVariable("modelUuid", serviceUuid) execution.setVariable("serviceModelName", serviceModelName) - utils.log("INFO", "======== End prepareServiceTopologyRequest Process ======== ", isDebugEnabled) + msoLogger.trace("======== End prepareServiceTopologyRequest Process ======== ") } public void getCurrentResoure(DelegateExecution execution){ @@ -205,7 +210,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ msoLogger.trace("Start prepareResourceRecipeRequest Process ") ResourceInput resourceInput = new ResourceInput() String serviceInstanceName = execution.getVariable("serviceInstanceName") - String resourceType = execution.getVariable("resourceType") + String resourceType = execution.getVariable("resourceType") String resourceInstanceName = resourceType + "_" + serviceInstanceName resourceInput.setResourceInstanceName(resourceInstanceName) msoLogger.info("Prepare Resource Request resourceInstanceName:" + resourceInstanceName) @@ -252,19 +257,19 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ String requestAction = "createInstance" JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) - if (resourceRecipe != null) { - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") - int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - } else { - String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + + if (resourceRecipe != null) { + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") + int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + } else { + String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceInput.getResourceModelInfo().getModelUuid() - msoLogger.trace(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) - } + msoLogger.trace(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) + } - msoLogger.trace("======== end executeResourceRecipe Process ======== ") + msoLogger.trace("======== end executeResourceRecipe Process ======== ") }catch(BpmnError b){ msoLogger.debug("Rethrowing MSOWorkflowException") throw b @@ -273,7 +278,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoCreateResources executeResourceRecipe Catalog") } } - + public void postConfigRequest(DelegateExecution execution){ //now do noting } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 59d38bfe86..0f50ae6c27 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.scripts import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray @@ -38,7 +37,7 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase 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.CloudFlavor + import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.DecomposeJsonUtil import org.onap.so.bpmn.core.json.JsonUtils @@ -174,8 +173,8 @@ public class DoCreateVfModule extends VfModuleBase { execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) msoLogger.debug("serviceInstanceId: " + serviceInstanceId) - //flavorList - ArrayList<CloudFlavor> flavorList = execution.getVariable(cloudSiteId + "_flavorList") + //OofDirectives + String oofDirectives = execution.getVariable(cloudSiteId + "_oofDirectives") if (flavorList != null) { execution.setVariable("DCVFM_flavorList", flavorList) logDebug("flavorList is: " + flavorList, isDebugLogEnabled) @@ -921,8 +920,8 @@ public class DoCreateVfModule extends VfModuleBase { def serviceId = execution.getVariable("DCVFM_serviceId") //serviceInstanceId def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") - //flavorList - ArrayList<CloudFlavor> flavorList = execution.getVariable("DCVFM_flavorList") + //OofDirectives + String oofDirectives = execution.getVariable("DCVFM_oofDirectives") //backoutOnFailure def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure") //volumeGroupId diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 76dba27890..66bd1ece90 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -28,13 +28,15 @@ import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray -import org.json.JSONObject; +import org.json.JSONObject +import org.onap.so.bpmn.common.scripts.AaiUtil 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.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource -import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.rest.APIResponse import org.onap.so.bpmn.core.json.JsonUtils import org.springframework.web.util.UriUtils; import org.w3c.dom.Document @@ -314,9 +316,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { JSONObject jObj = new JSONObject() def relation = utils.nodeToString(node) - def rt = utils.getNodeText1(relation, "related-to") + def rt = utils.getNodeText(relation, "related-to") - def rl = utils.getNodeText1(relation, "related-link") + def rl = utils.getNodeText(relation, "related-link") utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) def rl_datas = utils.getIdenticalChildren(node, "relationship-data") @@ -331,16 +333,13 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { jObj.put("resourceInstanceId", eValue) } // for sp-partner and others - else if(eKey.equals(rt + ".id")){ - jObj.put("resourceInstanceId", eValue) - String resourceName = rt + eValue; - jObj.put("resourceType", resourceName) - } - else if(eKey.equals(rt + ".id")){ + else if(eKey.endsWith("-id")){ jObj.put("resourceInstanceId", eValue) String resourceName = rt + eValue; jObj.put("resourceType", resourceName) } + + jObj.put("resourceLinkUrl", rl) } def rl_props = utils.getIdenticalChildren(node, "related-to-property") @@ -398,6 +397,71 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } + private void generateRelatedResourceInfo(String response, JSONObject jObj){ + + def xml = new XmlSlurper().parseText(response) + def rtn = xml.childNodes() + while (rtn.hasNext()) { + groovy.util.slurpersupport.Node node = rtn.next() + def key = node.name() + def value = node.text() + jObj.put(key, value) + } + } + + private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj) + { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started getRelatedResourceInAAI *****", isDebugEnabled) + + AaiUtil aaiUriUtil = new AaiUtil() + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String urlLink = jObj.get("resourceLinkUrl") + String serviceAaiPath = "${aai_endpoint}${urlLink}" + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode) + utils.log("DEBUG", " Get RelatedResource code is: " + responseCode, isDebugEnabled) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + aaiResponse = aaiResponse.replaceAll("&", "&") + execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse) + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + utils.log("DEBUG", "GET RelatedResource Received a Good Response", isDebugEnabled) + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable(Prefix + "FoundIndicator", true) + + generateRelatedResourceInfo(aaiResponse, jObj) + + //get model-invariant-uuid and model-uuid + String modelInvariantId = "" + String modelUuid = "" + String modelCustomizationId = "" + if(jObj.has("model-invariant-id")) { + modelInvariantId = jObj.get("model-invariant-id") + modelUuid = jObj.get("model-version-id") + modelCustomizationId = jObj.get("model-customization-id") + } + + jObj.put("modelInvariantId", modelInvariantId) + jObj.put("modelVersionId", modelUuid) + jObj.put("modelCustomizationId", modelCustomizationId) + } + else + { + utils.log("ERROR", "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + } + + utils.log("INFO", " ***** Exit getRelatedResourceInAAI *****", isDebugEnabled) + return jObj; + + } + public void postDecomposeService(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") @@ -417,27 +481,38 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if (serviceRelationShip != null) { relationShipList = jsonSlurper.parseText(serviceRelationShip) } - - List<Resource> deleteRealResourceList = new ArrayList<Resource>(); + + List<Resource> deleteRealResourceList = new ArrayList<Resource>() //Set the real resource instance id to the decomosed resource list - for (Resource resource: deleteResourceList) { - //reset the resource instance id , because in the decompose flow ,its a random one. - resource.setResourceId(""); - //match the resource-instance-name and the model name - if (relationShipList != null) { - relationShipList.each { - if (StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())) { - resource.setResourceId(it.resourceInstanceId) + //reset the resource instance id , because in the decompose flow ,its a random one. + //match the resource-instance-name and the model name + if (relationShipList != null) { + relationShipList.each { + + JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it) + + for (Resource resource : deleteResourceList) { + + String modelName = resource.getModelInfo().getModelName() + + String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid() + if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) { + resource.setResourceId(obj.get("resourceInstanceId")) + deleteRealResourceList.add(resource) + } + else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) { + resource.setResourceId(obj.get("resourceInstanceId")) + resource.setResourceInstanceName(obj.get("resourceType")) deleteRealResourceList.add(resource) } } } - } - + } + // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) - + utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index a5a96f3bd3..cf0bd3f6fe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -150,8 +150,11 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { // get delete resource list and order list List<Resource> delResourceList = execution.getVariable("deleteResourceList") + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String serviceModelName = serviceDecomposition.getModelInfo().getModelName(); - def resourceSequence = BPMNProperties.getResourceSequenceProp() + def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName) if(resourceSequence != null) { for (resourceType in resourceSequence.reverse()) { @@ -186,6 +189,11 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { } String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" + //if no networkResource, get SDNC config from properties file + if( "false".equals(isContainsWanResource)) { + String serviceNeedSDNC = "mso.workflow.custom." + serviceModelName + ".sdnc.need"; + isContainsWanResource = BPMNProperties.getProperty(serviceNeedSDNC, isContainsWanResource) + } execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("sequencedResourceList", sequencedResourceList) @@ -244,7 +252,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) resourceInput.setResourceInstancenUuid(currentResource.getResourceId()) resourceInput.setOperationId(execution.getVariable("operationId")) - resourceInput.setOperationType(execution.getVariable("operationType")) + resourceInput.setOperationType(execution.getVariable("operationType")) String globalSubscriberId = execution.getVariable("globalSubscriberId") resourceInput.setGlobalSubscriberId(globalSubscriberId) resourceInput.setResourceModelInfo(currentResource.getModelInfo()); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 86c5f65e8c..dd135f3af5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -232,6 +232,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } if ("Homing_Solution".equals(userParam?.name)) { execution.setVariable("homingService", userParam.value) + execution.setVariable("callHoming", true) inputMap.put("Homing_Solution", userParam.value) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 7226feb552..5fe28b918b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -20,8 +20,8 @@ package org.onap.so.bpmn.infrastructure.workflow.service; -import org.json.JSONObject; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.HashMap; @@ -43,6 +43,7 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; +import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.runtime.Execution; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.domain.ServiceDecomposition; @@ -50,27 +51,26 @@ import org.onap.so.bpmn.core.domain.Resource; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; - +import org.onap.so.bpmn.common.scripts.AaiUtil; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.springframework.web.util.UriUtils; public class ServicePluginFactory { // SOTN calculate route - public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc"; + public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc"; - public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; + public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; - public static final String Inventory_OSS_Default_EndPoint = "http://192.168.1.199:8443/oss/inventory"; + public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory"; private static final int DEFAULT_TIME_OUT = 60000; static JsonUtils jsonUtil = new JsonUtils(); - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ServicePluginFactory.class); + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ServicePluginFactory.class); private static ServicePluginFactory instance; @@ -85,72 +85,257 @@ public class ServicePluginFactory { private ServicePluginFactory() { } - private String getInventoryOSSEndPoint(){ - return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", Inventory_OSS_Default_EndPoint); + return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", INVENTORY_OSS_DEFAULT_ENDPOINT); } + private String getThirdSPEndPoint(){ - return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", Third_SP_Default_EndPoint); + return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", THIRD_SP_DEFAULT_ENDPOINT); } private String getOOFCalcEndPoint(){ - return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_Default_EndPoint); + return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_DEFAULT_ENDPOINT); } + + @SuppressWarnings("unchecked") + public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) { + if(!isNeedProcessSite(uuiRequest)) { + return uuiRequest; + } - public ServiceDecomposition doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) { - ServiceDecomposition serviceDecompositionforLocal = serviceDecomposition; + Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class); + Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service"); + Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters"); + Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs"); + List<Object> resources = (List<Object>) serviceParametersObject.get("resources"); - if (isSiteLocationLocal(serviceDecomposition, uuiRequest)) { - return serviceDecomposition; + if (isSiteLocationLocal(serviceRequestInputs, resources)) { + // resources changed : added TP info + String newRequest = getJsonString(uuiObject); + return newRequest; } - List<Resource> addResourceList = serviceDecomposition.getServiceResources(); + List<Resource> addResourceList = new ArrayList<Resource>(); + addResourceList.addAll(serviceDecomposition.getServiceResources()); + + serviceDecomposition.setVnfResources(null); + serviceDecomposition.setAllottedResources(null); + serviceDecomposition.setNetworkResources(null); + serviceDecomposition.setConfigResources(null); for (Resource resource : addResourceList) { String resourcemodelName = resource.getModelInfo().getModelName(); - if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner")) { - serviceDecompositionforLocal.deleteResource(resource); + if (StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) { + // change serviceDecomposition + serviceDecomposition.addResource(resource); break; } - if (!StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) { - serviceDecompositionforLocal.deleteResource(resource); + } + + return uuiRequest; + } + + private boolean isNeedProcessSite(String uuiRequest) { + return uuiRequest.toLowerCase().contains("site_address") && uuiRequest.toLowerCase().contains("sotncondition_clientsignal"); + } + + @SuppressWarnings("unchecked") + private boolean isSiteLocationLocal(Map<String, Object> serviceRequestInputs, List<Object> resources) { + Map<String, Object> tpInfoMap = getTPforVPNAttachment(serviceRequestInputs); + + if(tpInfoMap.isEmpty()) { + return true; + } + String host = (String) tpInfoMap.get("host"); + // host is empty means TP is in local, not empty means TP is in remote ONAP + if (!host.isEmpty()) { + return false; + } + + Map<String, Object> accessTPInfo = new HashMap<String, Object>(); + accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id")); + accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id")); + accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id")); + accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id")); + accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id")); + + // change resources + String resourceName = (String) tpInfoMap.get("resourceName"); + for(Object curResource : resources) { + Map<String, Object> resource = (Map<String, Object>)curResource; + String curResourceName = (String) resource.get("resourceName"); + curResourceName = curResourceName.replaceAll(" ", ""); + if(resourceName.equalsIgnoreCase(curResourceName)) { + putResourceRequestInputs(resource, accessTPInfo); break; } } - return serviceDecompositionforLocal; + return true; } + + @SuppressWarnings("unchecked") + private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) { + Object location = null; + Object clientSignal = null; + String vpnAttachmentResourceName = null; - public boolean isSiteLocationLocal(ServiceDecomposition serviceDecomposition, String uuiRequest) { - boolean isSiteLocationLocal = true; - - String serviceModelName = serviceDecomposition.getModelInfo().getModelName(); - String serviceParameters = JsonUtils.getJsonValue(uuiRequest, "service.parameters"); - String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs"); - JSONObject inputParameters = new JSONObject(requestInputs); - - if(StringUtils.containsIgnoreCase(serviceModelName, "site") && inputParameters.has("location")) - { - Object location = inputParameters.get("location"); - JSONObject locationObj = new JSONObject(location); - String locationONAP = queryLocationFromInventoryOSS(locationObj); - if(StringUtils.containsIgnoreCase(locationONAP, "remote")) { - isSiteLocationLocal = false; + // support R2 uuiReq and R1 uuiReq + // logic for R2 uuiRequest params in service level + for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) { + String key = entry.getKey(); + if (key.toLowerCase().contains("site_address")) { + location = entry.getValue(); + } + if (key.toLowerCase().contains("sotncondition_clientsignal")) { + clientSignal = entry.getValue(); + vpnAttachmentResourceName = key.substring(0, key.indexOf("_")); } } - return isSiteLocationLocal; + Map<String, Object> tpInfoMap = new HashMap<String, Object>(); + + // Site resource has location param and SOTNAttachment resource has clientSignal param + if(location == null || clientSignal == null ) { + return tpInfoMap; + } + + // Query terminal points from InventoryOSS system by location. + String locationAddress = (String) location; + List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress); + if(locationTPList != null && !locationTPList.isEmpty()) { + for(Object tp: locationTPList) { + Map<String, Object> tpJson = (Map<String, Object>) tp; + String loc = (String)tpJson.get ("location"); + if(StringUtils.equalsIgnoreCase (locationAddress, loc)) { + tpInfoMap = tpJson; + // add resourceName + tpInfoMap.put("resourceName", vpnAttachmentResourceName); + break; + } + } + LOGGER.debug("Get Terminal TP from InventoryOSS"); + return tpInfoMap; + } + + return tpInfoMap; } - private String queryLocationFromInventoryOSS(JSONObject locationObj) { - String reqContent = getJsonString(locationObj); + @SuppressWarnings("unchecked") + private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) { String url = getInventoryOSSEndPoint(); - String responseContent = sendRequest(url, "POST", reqContent); - String locationONAP = ""; + try { + url += "/oss/inventory?location=" + UriUtils.encode(locationAddress,"UTF-8"); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + String responseContent = sendRequest(url, "GET", ""); + List<Object> accessTPs = new ArrayList<Object>(); if (null != responseContent) { - locationONAP = getJsonObject(responseContent, String.class); + accessTPs = getJsonObject(responseContent, List.class); + } + return accessTPs; + } + + @SuppressWarnings("unchecked") + private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) { + Map<String, Object> resourceParametersObject = new HashMap<String, Object>(); + Map<String, Object> resourceRequestInputs = new HashMap<String, Object>(); + resourceRequestInputs.put("requestInputs", resourceInputs); + resourceParametersObject.put("parameters", resourceRequestInputs); + + if(resource.containsKey("parameters")) { + Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters"); + if(resParametersObject.containsKey("requestInputs")) { + Map<String, Object> resRequestInputs = (Map<String, Object>) resourceRequestInputs.get("requestInputs"); + Map<String, Object> oldRequestInputs = (Map<String, Object>) resParametersObject.get("requestInputs"); + if(oldRequestInputs != null) { + oldRequestInputs.putAll(resRequestInputs); + } + else { + resParametersObject.put("requestInputs", resRequestInputs); + } + } + else { + resParametersObject.putAll(resourceRequestInputs); + } } - return locationONAP; + else { + resource.putAll(resourceParametersObject); + } + + return; + } + + + + @SuppressWarnings("unchecked") + public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) { + Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class); + Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service"); + Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters"); + Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs"); + + if(!isNeedAllocateCrossTPResources(serviceRequestInputs)) { + return uuiRequest; + } + + allocateCrossTPResources(execution, serviceRequestInputs); + String newRequest = getJsonString(uuiObject); + return newRequest; + } + + @SuppressWarnings("unchecked") + private boolean isNeedAllocateCrossTPResources(Map<String, Object> serviceRequestInputs) { + if(serviceRequestInputs.containsKey("CallSource")) + { + String callSource = (String) serviceRequestInputs.get("CallSource"); + if("ExternalAPI".equalsIgnoreCase(callSource)) { + return false; + } + } + for (String input : serviceRequestInputs.keySet()) + { + if(input.toLowerCase().contains("sotnconnectivity")) { + return true; + } + } + return false; + } + + @SuppressWarnings("unchecked") + private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) { + + AaiUtil aai = new AaiUtil(); + Map<String, Object> crossTPs = aai.getTPsfromAAI(execution); + + if(crossTPs == null || crossTPs.isEmpty()) { + serviceRequestInputs.put("local-access-provider-id", ""); + serviceRequestInputs.put("local-access-client-id", ""); + serviceRequestInputs.put("local-access-topology-id", ""); + serviceRequestInputs.put("local-access-node-id", ""); + serviceRequestInputs.put("local-access-ltp-id", ""); + serviceRequestInputs.put("remote-access-provider-id", ""); + serviceRequestInputs.put("remote-access-client-id", ""); + serviceRequestInputs.put("remote-access-topology-id", ""); + serviceRequestInputs.put("remote-access-node-id", ""); + serviceRequestInputs.put("remote-access-ltp-id", ""); + } + else { + serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); + serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id")); + serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); + serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id")); + serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); + serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); + serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id")); + serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id")); + serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id")); + serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id")); + } + + return; } public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) { @@ -211,8 +396,7 @@ public class ServicePluginFactory { for (Object resource : resources) { Map<String, Object> resourceObject = (Map<String, Object>) resource; Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters"); - Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject - .get("requestInputs"); + Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs"); for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) { if (entry.getKey().toLowerCase().contains("location")) { if ("".equals(srcLocation)) { @@ -233,8 +417,11 @@ public class ServicePluginFactory { Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources); // here we put client signal to vpn resource inputs - vpnRequestInputs.put("src-client-signal", srcClientSignal); - vpnRequestInputs.put("dst-client-signal", dstClientSignal); + if(null!=vpnRequestInputs) { + vpnRequestInputs.put("src-client-signal", srcClientSignal); + vpnRequestInputs.put("dst-client-signal", dstClientSignal); + } + // Now we need to query terminal points from SP resourcemgr system. List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation); @@ -258,14 +445,14 @@ public class ServicePluginFactory { } private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) { - Map<String, String> locationSrc = new HashMap<>(); + Map<String, String> locationSrc = new HashMap<String, String>(); locationSrc.put("location", srcLocation); - Map<String, String> locationDst = new HashMap<>(); + Map<String, String> locationDst = new HashMap<String, String>(); locationDst.put("location", dstLocation); - List<Map<String, String>> locations = new ArrayList<>(); + List<Map<String, String>> locations = new ArrayList<Map<String, String>>(); locations.add(locationSrc); locations.add(locationDst); - List<Object> returnList = new ArrayList<>(); + List<Object> returnList = new ArrayList<Object>(); String reqContent = getJsonString(locations); String url = getThirdSPEndPoint(); String responseContent = sendRequest(url, "POST", reqContent); @@ -275,12 +462,12 @@ public class ServicePluginFactory { return returnList; } + @SuppressWarnings("unchecked") private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) { for (Object resource : resources) { Map<String, Object> resourceObject = (Map<String, Object>) resource; Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters"); - Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject - .get("requestInputs"); + Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs"); for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) { if (entry.getKey().toLowerCase().contains("vpntype")) { return resourceRequestInputs; @@ -307,7 +494,7 @@ public class ServicePluginFactory { Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service"); Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters"); Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs"); - Map<String, Object> oofQueryObject = new HashMap<>(); + Map<String, Object> oofQueryObject = new HashMap<String, Object>(); List<Object> resources = (List<Object>) serviceParametersObject.get("resources"); oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id")); oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id")); @@ -323,7 +510,7 @@ public class ServicePluginFactory { String url = getOOFCalcEndPoint(); String responseContent = sendRequest(url, "POST", oofRequestReq); - List<Object> returnList = new ArrayList<>(); + List<Object> returnList = new ArrayList<Object>(); if (null != responseContent) { returnList = getJsonObject(responseContent, List.class); } @@ -336,7 +523,7 @@ public class ServicePluginFactory { } private Map<String, Object> getReturnRoute(List<Object> returnList){ - Map<String, Object> returnRoute = new HashMap<>(); + Map<String, Object> returnRoute = new HashMap<String,Object>(); for(Object returnVpn :returnList){ Map<String, Object> returnVpnInfo = (Map<String, Object>) returnVpn; String accessTopoId = (String)returnVpnInfo.get("access-topology-id"); @@ -399,7 +586,6 @@ public class ServicePluginFactory { jsonStr = mapper.writeValueAsString(srcObj); } catch (JsonProcessingException e) { LOGGER.debug("SdcToscaParserException", e); - e.printStackTrace(); } return jsonStr; } @@ -431,6 +617,8 @@ public class ServicePluginFactory { } else if ("GET".equals(methodType.toUpperCase())) { HttpGet httpGet = new HttpGet(msbUrl); httpGet.setConfig(requestConfig); + httpGet.addHeader("X-FromAppId", "MSO"); + httpGet.addHeader("Accept","application/json"); method = httpGet; } else if ("DELETE".equals(methodType.toUpperCase())) { HttpDelete httpDelete = new HttpDelete(msbUrl); @@ -452,9 +640,9 @@ public class ServicePluginFactory { try { responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); } catch (ParseException e) { - e.printStackTrace(); + LOGGER.debug("ParseException in sendrequest", e); } catch (IOException e) { - e.printStackTrace(); + LOGGER.debug("IOException in sendrequest", e); } } if (null != method) { diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index 4db7b3ff66..63b66cafe5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -168,11 +168,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - - </dependency> - <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>1.10.19</version> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn index 6b3641b235..fe2c8928d8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn @@ -1,51 +1,36 @@ <?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="1.16.2"> +<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.0.0"> <bpmn:process id="ActivateSDNCNetworkResource" name="ActivateSDNCNetworkResource" isExecutable="true"> - <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> - <bpmn:outgoing>SequenceFlow_1c92ks3</bpmn:outgoing> + <bpmn:startEvent id="createNS_StartEvent_activate" name="createNS_StartEvent"> + <bpmn:outgoing>SequenceFlow_1c92ks3_activate</bpmn:outgoing> </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_1x6k78c" name="create SDNC call end"> - <bpmn:incoming>SequenceFlow_17md60u</bpmn:incoming> + <bpmn:endEvent id="EndEvent_1x6k78c_activate" name="create SDNC call end"> + <bpmn:incoming>SequenceFlow_17md60u_activate</bpmn:incoming> </bpmn:endEvent> - <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC resource activate Adapter V1 " calledElement="sdncAdapter"> - <bpmn:extensionElements> - <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" /> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="sdncAdapterResponse" target="CRENWKI_activateSDNCResponse" /> - <camunda:out source="SDNCA_ResponseCode" target="CRESDNCRES_sdncCreateReturnCode" /> - <camunda:out source="SDNCA_SuccessIndicator" target="CRESDNCRES_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0sjrnv5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" /> - <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1g5zyi6" /> - <bpmn:scriptTask id="Task_023hred" name="post SDNC activate call"> - <bpmn:incoming>SequenceFlow_1vnx1pp</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_activate" sourceRef="Task_023hred_activate" targetRef="ScriptTask_1g5zyi6_activate" /> + <bpmn:scriptTask id="Task_023hred_activate" name="post SDNC activate call"> + <bpmn:incoming>SequenceFlow_1vnx1pp_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ow44q0_activate</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new ActivateSDNCNetworkResource() -dcsi.postCreateSDNCCall(execution)</bpmn:script> +dcsi.postActivateSDNCCall(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="ScriptTask_1gih50a" /> - <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1c92ks3</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb_activate" sourceRef="Task_13sx2bp_activate" targetRef="ScriptTask_1gih50a_activate" /> + <bpmn:scriptTask id="Task_13sx2bp_activate" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1c92ks3_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18l3crb_activate</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new ActivateSDNCNetworkResource() dcsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After create" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing> + <bpmn:scriptTask id="Task_0uwlr22_activate" name="Create progress update parameters After create" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_13ee4rf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jr6zi0_activate</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new ActivateSDNCNetworkResource() dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1cm8iwr_activate" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -64,113 +49,125 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1vnx1pp</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1jr6zi0_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vnx1pp_activate</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> - <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" /> - <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_17md60u</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0_activate" sourceRef="Task_0uwlr22_activate" targetRef="ServiceTask_1cm8iwr_activate" /> + <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp_activate" sourceRef="ServiceTask_1cm8iwr_activate" targetRef="Task_023hred_activate" /> + <bpmn:scriptTask id="ScriptTask_1g5zyi6_activate" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17md60u_activate</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new ActivateSDNCNetworkResource() csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_17md60u" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" /> - <bpmn:sequenceFlow id="SequenceFlow_1c92ks3" sourceRef="createNS_StartEvent" targetRef="Task_13sx2bp" /> - <bpmn:scriptTask id="ScriptTask_1gih50a" name="Prepare SDNC Actiate request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0sjrnv5</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:sequenceFlow id="SequenceFlow_17md60u_activate" sourceRef="ScriptTask_1g5zyi6_activate" targetRef="EndEvent_1x6k78c_activate" /> + <bpmn:sequenceFlow id="SequenceFlow_1c92ks3_activate" sourceRef="createNS_StartEvent_activate" targetRef="Task_13sx2bp_activate" /> + <bpmn:scriptTask id="ScriptTask_1gih50a_activate" name="Prepare SDNC Actiate request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_18l3crb_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0sjrnv5_activate</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new ActivateSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0sjrnv5" sourceRef="ScriptTask_1gih50a" targetRef="CallActivity_1600xlj" /> + <bpmn:sequenceFlow id="SequenceFlow_0sjrnv5_activate" sourceRef="ScriptTask_1gih50a_activate" targetRef="CallActivity_1241bmd_activate" /> + <bpmn:callActivity id="CallActivity_1241bmd_activate" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0sjrnv5_activate</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_13ee4rf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_13ee4rf" sourceRef="CallActivity_1241bmd_activate" targetRef="Task_0uwlr22_activate" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateSDNCNetworkResource"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent_activate"> <dc:Bounds x="-275" y="306" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-302" y="352" width="89" height="27" /> + <dc:Bounds x="-299" y="352" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_activate"> <dc:Bounds x="930" y="306" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="893" y="348" width="84" height="27" /> + <dc:Bounds x="893" y="348" width="85" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> - <dc:Bounds x="77" y="284" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed"> - <di:waypoint x="177" y="324" /> - <di:waypoint x="247" y="324" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="210.5" y="314" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> + <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_activate"> <di:waypoint x="694" y="324" /> <di:waypoint x="765" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="780.5" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_activate"> <dc:Bounds x="594" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> + <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb_activate"> <di:waypoint x="-105" y="324" /> <di:waypoint x="-63" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_activate"> <dc:Bounds x="-205" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> - <dc:Bounds x="247" y="284" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22_activate"> + <dc:Bounds x="246" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> + <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr_activate"> <dc:Bounds x="417" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0"> - <di:waypoint x="347" y="324" /> + <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0_activate"> + <di:waypoint x="346" y="324" /> <di:waypoint x="417" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="444.5" y="314" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp"> + <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp_activate"> <di:waypoint x="517" y="324" /> <di:waypoint x="594" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="641" y="314" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> + <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6_activate"> <dc:Bounds x="765" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u"> + <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u_activate"> <di:waypoint x="865" y="324" /> <di:waypoint x="930" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="998" y="313" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3"> + <bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3_activate"> <di:waypoint x="-239" y="324" /> <di:waypoint x="-205" y="324" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1gih50a_di" bpmnElement="ScriptTask_1gih50a"> + <bpmndi:BPMNShape id="ScriptTask_1gih50a_di" bpmnElement="ScriptTask_1gih50a_activate"> <dc:Bounds x="-63" y="284" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0sjrnv5_di" bpmnElement="SequenceFlow_0sjrnv5"> + <bpmndi:BPMNEdge id="SequenceFlow_0sjrnv5_di" bpmnElement="SequenceFlow_0sjrnv5_activate"> <di:waypoint x="37" y="324" /> - <di:waypoint x="77" y="324" /> + <di:waypoint x="80" y="324" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1241bmd_di" bpmnElement="CallActivity_1241bmd_activate"> + <dc:Bounds x="80" y="284" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13ee4rf_di" bpmnElement="SequenceFlow_13ee4rf"> + <di:waypoint x="180" y="324" /> + <di:waypoint x="246" y="324" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn index 21f18e9fa2..6a7cf8160a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn @@ -14,7 +14,7 @@ dcsi.prepare3rdONAPRequest(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_013449q" name="Create3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_0a8k9xi</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Save SPPartner In AAI"> + <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Save SPPartner In AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0y2g8mr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0znwu8z</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* @@ -93,7 +93,7 @@ dcsi.doCreateE2ESIin3rdONAP(execution)]]></bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:incoming>SequenceFlow_03ouq4m</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1luhljs</bpmn:outgoing> </bpmn:serviceTask> <bpmn:scriptTask id="ScriptTask_03xvdc8" name="Allocate connection resources for cross ONAP" scriptFormat="groovy"> @@ -167,7 +167,7 @@ dcsi.checkLocallCall(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_0o0n3fa" name="Create3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_131f1jj</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Save SPPartner In AAI"> + <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Save SPPartner In AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1wq9f5k</bpmn:incoming> <bpmn:outgoing>SequenceFlow_18gb81f</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* @@ -191,7 +191,7 @@ execution.setVariable("statusDescription", "Local Creation Only") def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="resource progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -276,9 +276,9 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_15mvx68" sourceRef="ScriptTask_0rs5t7w" targetRef="ScriptTask_0r2cxvb" /> <bpmn:sequenceFlow id="SequenceFlow_0wp73cw" sourceRef="ScriptTask_0r2cxvb" targetRef="ExclusiveGateway_1662gjm" /> <bpmn:sequenceFlow id="SequenceFlow_13s0mg5" name="yes" sourceRef="ExclusiveGateway_1662gjm" targetRef="ScriptTask_0yz8d8c"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("serviceOrderId" ) != null && execution.getVariable("serviceOrderId" ) != "" )}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("ServiceOrderId" ) != null && execution.getVariable("ServiceOrderId" ) != "" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ServiceTask_0p5029r" /> + <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ScriptTask_0lffwny" /> <bpmn:sequenceFlow id="SequenceFlow_1suwdgi" sourceRef="ServiceTask_039ju3f" targetRef="ScriptTask_03xvdc8" /> <bpmn:sequenceFlow id="SequenceFlow_0kkou66" sourceRef="ScriptTask_1pdhttw" targetRef="ScriptTask_0yz8d8c" /> <bpmn:sequenceFlow id="SequenceFlow_1luhljs" sourceRef="ServiceTask_0p5029r" targetRef="ExclusiveGateway_1we7izu" /> @@ -327,6 +327,14 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0i9iiuo" sourceRef="ScriptTask_07cq0pw" targetRef="ServiceTask_1ixmamy" /> <bpmn:sequenceFlow id="SequenceFlow_1mei7hu" sourceRef="ServiceTask_1ixmamy" targetRef="EndEvent_19joonf" /> + <bpmn:scriptTask id="ScriptTask_0lffwny" name="update resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_03ouq4m</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new Create3rdONAPE2EServiceInstance() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_03ouq4m" sourceRef="ScriptTask_0lffwny" targetRef="ServiceTask_0p5029r" /> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -365,7 +373,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="163" y="12" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0p5029r_di" bpmnElement="ServiceTask_0p5029r"> - <dc:Bounds x="798" y="12" width="100" height="80" /> + <dc:Bounds x="798" y="129" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_03xvdc8_di" bpmnElement="ScriptTask_03xvdc8"> <dc:Bounds x="798" y="-153" width="100" height="80" /> @@ -600,7 +608,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1pdhttw_di" bpmnElement="ScriptTask_1pdhttw"> - <dc:Bounds x="573" y="187" width="100" height="80" /> + <dc:Bounds x="573" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1662gjm_di" bpmnElement="ExclusiveGateway_1662gjm" isMarkerVisible="true"> <dc:Bounds x="386" y="27" width="50" height="50" /> @@ -609,9 +617,9 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1we7izu_di" bpmnElement="ExclusiveGateway_1we7izu" isMarkerVisible="true"> - <dc:Bounds x="823" y="202" width="50" height="50" /> + <dc:Bounds x="823" y="235" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="880" y="206" width="68" height="42" /> + <dc:Bounds x="878" y="239" width="72" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_18auy29_di" bpmnElement="ScriptTask_18auy29"> @@ -649,9 +657,11 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0fkfn70_di" bpmnElement="SequenceFlow_0fkfn70"> <di:waypoint xsi:type="dc:Point" x="673" y="52" /> + <di:waypoint xsi:type="dc:Point" x="736" y="52" /> + <di:waypoint xsi:type="dc:Point" x="736" y="52" /> <di:waypoint xsi:type="dc:Point" x="798" y="52" /> <bpmndi:BPMNLabel> - <dc:Bounds x="690.5" y="30" width="90" height="14" /> + <dc:Bounds x="706" y="45" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1suwdgi_di" bpmnElement="SequenceFlow_1suwdgi"> @@ -662,24 +672,24 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kkou66_di" bpmnElement="SequenceFlow_0kkou66"> - <di:waypoint xsi:type="dc:Point" x="623" y="187" /> + <di:waypoint xsi:type="dc:Point" x="623" y="220" /> <di:waypoint xsi:type="dc:Point" x="623" y="92" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="132.5" width="90" height="14" /> + <dc:Bounds x="593" y="149" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1luhljs_di" bpmnElement="SequenceFlow_1luhljs"> - <di:waypoint xsi:type="dc:Point" x="848" y="92" /> - <di:waypoint xsi:type="dc:Point" x="848" y="202" /> + <di:waypoint xsi:type="dc:Point" x="848" y="209" /> + <di:waypoint xsi:type="dc:Point" x="848" y="235" /> <bpmndi:BPMNLabel> - <dc:Bounds x="818" y="140" width="90" height="14" /> + <dc:Bounds x="818" y="215" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1udji9x_di" bpmnElement="SequenceFlow_1udji9x"> - <di:waypoint xsi:type="dc:Point" x="823" y="227" /> - <di:waypoint xsi:type="dc:Point" x="673" y="227" /> + <di:waypoint xsi:type="dc:Point" x="823" y="260" /> + <di:waypoint xsi:type="dc:Point" x="673" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="746" y="208" width="12" height="14" /> + <dc:Bounds x="746" y="241" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_19joonf_di" bpmnElement="EndEvent_19joonf"> @@ -698,12 +708,12 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0y2g8mr_di" bpmnElement="SequenceFlow_0y2g8mr"> - <di:waypoint xsi:type="dc:Point" x="848" y="252" /> + <di:waypoint xsi:type="dc:Point" x="848" y="285" /> <di:waypoint xsi:type="dc:Point" x="848" y="324" /> <di:waypoint xsi:type="dc:Point" x="9" y="324" /> <di:waypoint xsi:type="dc:Point" x="9" y="371" /> <bpmndi:BPMNLabel> - <dc:Bounds x="419.8991436726927" y="302" width="18" height="14" /> + <dc:Bounds x="419" y="302" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0mmu3kz_di" bpmnElement="SequenceFlow_0mmu3kz"> @@ -735,6 +745,16 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="326.5" y="193" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0lffwny_di" bpmnElement="ScriptTask_0lffwny"> + <dc:Bounds x="798" y="12" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_03ouq4m_di" bpmnElement="SequenceFlow_03ouq4m"> + <di:waypoint xsi:type="dc:Point" x="848" y="92" /> + <di:waypoint xsi:type="dc:Point" x="848" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="863" y="104.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn index 3e2c316ffc..3c7be0937f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn @@ -1,6 +1,6 @@ <?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="1.11.3"> - <bpmn:process id="CreateDeviceResource.bpmn" name="CreateDeviceResource.bpmn" isExecutable="true"> + <bpmn:process id="CreateDeviceResource" name="CreateDeviceResource" isExecutable="true"> <bpmn:endEvent id="EndEvent_1x6k78c" name="create Dev end"> <bpmn:incoming>SequenceFlow_0auvfvm</bpmn:incoming> </bpmn:endEvent> @@ -8,7 +8,7 @@ <bpmn:incoming>SequenceFlow_05niqbf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0auvfvm</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new CreateDeviceResource.bpmn() +def csi = new CreateDeviceResource() csi.sendSyncResponse(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_05niqbf" sourceRef="Task_0bga3e8" targetRef="ScriptTask_1g5zyi6" /> @@ -43,11 +43,11 @@ csi.sendSyncResponse(execution)]]></bpmn:script> def dcsi = new CreateDeviceResource() dcsi.checkDevType(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_076ma0v"> + <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_0b5nrig"> <bpmn:incoming>SequenceFlow_1hp2h5t</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ss02ik</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0h4378g</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_076ma0v</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0b5nrig</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1chnlq6" name="GoTo StartCreateDevinSDNC"> <bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming> @@ -91,10 +91,6 @@ dcsi.preProcessRequest(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" /> - <bpmn:endEvent id="EndEvent_0ymfq61"> - <bpmn:incoming>SequenceFlow_076ma0v</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_076ma0v" sourceRef="ExclusiveGateway_0kba700" targetRef="EndEvent_0ymfq61" /> <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF Template fom SDC" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing> @@ -111,9 +107,47 @@ def dcsi = new CreateDeviceResource() dcsi.postVNFInfoProcess(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" /> + <bpmn:scriptTask id="ScriptTask_0p4b5vu" name="Prepare Create resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0b5nrig</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09s5dfc</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("status", "finished") +execution.setVariable("statusDescription", "Finished for the devType") +def dcsi = new CreateDeviceResource() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0b5nrig" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_0p4b5vu" /> + <bpmn:serviceTask id="ServiceTask_08e6hpm" name="resource progress update"> + <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 QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</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_09s5dfc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kt3xbf</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_09s5dfc" sourceRef="ScriptTask_0p4b5vu" targetRef="ServiceTask_08e6hpm" /> + <bpmn:endEvent id="EndEvent_0ntv40y"> + <bpmn:incoming>SequenceFlow_0kt3xbf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0kt3xbf" sourceRef="ServiceTask_08e6hpm" targetRef="EndEvent_0ntv40y" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateDeviceResource.bpmn"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateDeviceResource"> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> <dc:Bounds x="1026" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -158,7 +192,7 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <bpmndi:BPMNShape id="ExclusiveGateway_0kba700_di" bpmnElement="ExclusiveGateway_0kba700" isMarkerVisible="true"> <dc:Bounds x="334" y="-152" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="309" y="-166" width="34" height="12" /> + <dc:Bounds x="302" y="-166" width="48" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1chnlq6_di" bpmnElement="IntermediateThrowEvent_1chnlq6"> @@ -228,19 +262,6 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <dc:Bounds x="760.5" y="-148" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0ymfq61_di" bpmnElement="EndEvent_0ymfq61"> - <dc:Bounds x="341" y="-251" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="359" y="-211" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_076ma0v_di" bpmnElement="SequenceFlow_076ma0v"> - <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> - <di:waypoint xsi:type="dc:Point" x="359" y="-215" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="374" y="-189.5" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65"> <dc:Bounds x="480" y="-167" width="100" height="80" /> </bpmndi:BPMNShape> @@ -261,6 +282,43 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <dc:Bounds x="987.5" y="-148" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0p4b5vu_di" bpmnElement="ScriptTask_0p4b5vu"> + <dc:Bounds x="309" y="-290" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0b5nrig_di" bpmnElement="SequenceFlow_0b5nrig"> + <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-181" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-181" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-210" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="374" y="-187" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_08e6hpm_di" bpmnElement="ServiceTask_08e6hpm"> + <dc:Bounds x="530" y="-290" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_09s5dfc_di" bpmnElement="SequenceFlow_09s5dfc"> + <di:waypoint xsi:type="dc:Point" x="409" y="-250" /> + <di:waypoint xsi:type="dc:Point" x="477" y="-250" /> + <di:waypoint xsi:type="dc:Point" x="477" y="-250" /> + <di:waypoint xsi:type="dc:Point" x="530" y="-250" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="492" y="-256" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0ntv40y_di" bpmnElement="EndEvent_0ntv40y"> + <dc:Bounds x="705" y="-268" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="723" y="-228" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0kt3xbf_di" bpmnElement="SequenceFlow_0kt3xbf"> + <di:waypoint xsi:type="dc:Point" x="630" y="-250" /> + <di:waypoint xsi:type="dc:Point" x="705" y="-250" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="667.5" y="-271" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn index 50e65dcaad..9e2049732a 100644..100755 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateGenericALaCarteServiceInstance" name="CreateGenericALaCarteServiceInstance" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Create SI Start Flow"> <bpmn2:outgoing>SequenceFlow_0lp2z7l</bpmn2:outgoing> @@ -39,7 +39,7 @@ ex.processJavaException(execution)]]></bpmn2:script> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> <camunda:in source="bpmnRequest" target="requestJson" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1hjh5zy</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1fv5tk6</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1lj31zp</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:endEvent id="EndEvent_0o440av" name="End"> @@ -174,17 +174,62 @@ csi.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_1o3ihrh</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:scriptTask id="ScriptTask_04zaa1o" name="Prepare Create Service " scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1o3ihrh</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_14ajbme</bpmn2:outgoing> + <bpmn2:incoming>SequenceFlow_1hjh5zy</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1fv5tk6</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def csi= new CreateGenericALaCarteServiceInstance() csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0xhu1k3" sourceRef="ScriptTask_1vr3ks5" targetRef="CallActivity_1oc1h9q" /> - <bpmn2:sequenceFlow id="SequenceFlow_1o3ihrh" sourceRef="CallActivity_1oc1h9q" targetRef="ScriptTask_04zaa1o" /> + <bpmn2:sequenceFlow id="SequenceFlow_1o3ihrh" sourceRef="CallActivity_1oc1h9q" targetRef="ExclusiveGateway_0h0cq5k" /> <bpmn2:sequenceFlow id="SequenceFlow_1tfe975" sourceRef="IntermediateCatchEvent_00tv706" targetRef="ScriptTask_1vr3ks5" /> - <bpmn2:sequenceFlow id="SequenceFlow_14ajbme" sourceRef="ScriptTask_04zaa1o" targetRef="IntermediateThrowEvent_1tbopzu" /> - <bpmn2:sequenceFlow id="SequenceFlow_1hjh5zy" sourceRef="IntermediateCatchEvent_1aouco1" targetRef="doCreateServiceInstance_CallActivity" /> + <bpmn2:sequenceFlow id="SequenceFlow_14ajbme" sourceRef="CallActivity_1y1p4bd" targetRef="IntermediateThrowEvent_1tbopzu" /> + <bpmn2:sequenceFlow id="SequenceFlow_1hjh5zy" sourceRef="IntermediateCatchEvent_1aouco1" targetRef="ScriptTask_04zaa1o" /> + <bpmn2:callActivity id="CallActivity_1y1p4bd" name="Call Homing Service" camunda:modelerTemplate="homingBlock" calledElement="Homing"> + <bpmn2:extensionElements> + <camunda:in source="true" target="isDebugLogEnabled" /> + <camunda:in source="null" target="timeout" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:out source="rollbackData" target="rollbackData" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:in source="subscriberInfo" target="subscriberInfo" /> + <camunda:in source="homingService" target="homingService" /> + <camunda:in source="customerLocation" target="customerLocation" /> + <camunda:in source="cloudOwner" target="cloudOwner" /> + <camunda:in source="cloudRegionId" target="cloudRegionId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="homingModelIds" target="homingModelIds" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0bng27u</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_14ajbme</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:scriptTask id="ScriptTask_1imcb54" name="PostProcess Decompose Service " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0vcumrm</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0bng27u</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CreateGenericALaCarteServiceInstance() +csi.processDecomposition(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_0bng27u" sourceRef="ScriptTask_1imcb54" targetRef="CallActivity_1y1p4bd" /> + <bpmn2:sequenceFlow id="SequenceFlow_1fv5tk6" sourceRef="ScriptTask_04zaa1o" targetRef="doCreateServiceInstance_CallActivity" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0h0cq5k" name="Home Service?"> + <bpmn2:incoming>SequenceFlow_1o3ihrh</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0vcumrm</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0xrox26</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0vcumrm" sourceRef="ExclusiveGateway_0h0cq5k" targetRef="ScriptTask_1imcb54"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "oof"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0hhmvlw" name="GoToCreateSI"> + <bpmn2:incoming>SequenceFlow_0xrox26</bpmn2:incoming> + <bpmn2:linkEventDefinition name="CreateSI" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0xrox26" sourceRef="ExclusiveGateway_0h0cq5k" targetRef="IntermediateThrowEvent_0hhmvlw" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -229,19 +274,19 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_CallActivity_72" bpmnElement="doCreateServiceInstance_CallActivity"> - <dc:Bounds x="112" y="452" width="100" height="80" /> + <dc:Bounds x="321" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0o440av_di" bpmnElement="EndEvent_0o440av"> - <dc:Bounds x="852" y="474" width="36" height="36" /> + <dc:Bounds x="1004" y="474" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="863" y="510" width="20" height="14" /> + <dc:Bounds x="1015" y="510" width="20" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lj31zp_di" bpmnElement="SequenceFlow_1lj31zp"> - <di:waypoint xsi:type="dc:Point" x="212" y="492" /> - <di:waypoint xsi:type="dc:Point" x="314" y="492" /> + <di:waypoint xsi:type="dc:Point" x="421" y="492" /> + <di:waypoint xsi:type="dc:Point" x="500" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="263" y="477" width="0" height="0" /> + <dc:Bounds x="415.5" y="477" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0pvcr6j_di" bpmnElement="ScriptTask_0pvcr6j"> @@ -255,16 +300,16 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0cihgpv_di" bpmnElement="ScriptTask_0cihgpv"> - <dc:Bounds x="449" y="452" width="100" height="80" /> + <dc:Bounds x="637" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0sevgre_di" bpmnElement="CallActivity_0sevgre"> - <dc:Bounds x="637" y="452" width="100" height="80" /> + <dc:Bounds x="820" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xxvjxq_di" bpmnElement="SequenceFlow_0xxvjxq"> - <di:waypoint xsi:type="dc:Point" x="549" y="492" /> - <di:waypoint xsi:type="dc:Point" x="637" y="492" /> + <di:waypoint xsi:type="dc:Point" x="737" y="492" /> + <di:waypoint xsi:type="dc:Point" x="820" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="477" width="0" height="0" /> + <dc:Bounds x="733.5" y="477" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1hql91g_di" bpmnElement="ScriptTask_1hql91g"> @@ -303,10 +348,10 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_095crcd_di" bpmnElement="SequenceFlow_095crcd"> - <di:waypoint xsi:type="dc:Point" x="737" y="492" /> - <di:waypoint xsi:type="dc:Point" x="852" y="492" /> + <di:waypoint xsi:type="dc:Point" x="920" y="492" /> + <di:waypoint xsi:type="dc:Point" x="1004" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="795" y="477" width="0" height="0" /> + <dc:Bounds x="917" y="477" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0n4umjf_di" bpmnElement="SequenceFlow_0n4umjf"> @@ -341,33 +386,31 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1x5i9c1_di" bpmnElement="ExclusiveGateway_1x5i9c1" isMarkerVisible="true"> - <dc:Bounds x="314" y="467" width="50" height="50" /> + <dc:Bounds x="500" y="467" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="314" y="439" width="50" height="14" /> + <dc:Bounds x="501" y="439" width="49" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_143akoz_di" bpmnElement="EndEvent_143akoz"> - <dc:Bounds x="321" y="580" width="36" height="36" /> + <dc:Bounds x="507" y="580" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="417" y="965" width="0" height="0" /> + <dc:Bounds x="558" y="965" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1o4wwba_di" bpmnElement="SequenceFlow_1o4wwba"> - <di:waypoint xsi:type="dc:Point" x="364" y="492" /> - <di:waypoint xsi:type="dc:Point" x="401" y="492" /> - <di:waypoint xsi:type="dc:Point" x="401" y="492" /> - <di:waypoint xsi:type="dc:Point" x="449" y="492" /> + <di:waypoint xsi:type="dc:Point" x="550" y="492" /> + <di:waypoint xsi:type="dc:Point" x="637" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="399" y="489" width="18" height="14" /> + <dc:Bounds x="554.09375" y="489" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1mdnv3l_di" bpmnElement="SequenceFlow_1mdnv3l"> - <di:waypoint xsi:type="dc:Point" x="339" y="517" /> - <di:waypoint xsi:type="dc:Point" x="339" y="544" /> - <di:waypoint xsi:type="dc:Point" x="339" y="544" /> - <di:waypoint xsi:type="dc:Point" x="339" y="580" /> + <di:waypoint xsi:type="dc:Point" x="525" y="517" /> + <di:waypoint xsi:type="dc:Point" x="525" y="549" /> + <di:waypoint xsi:type="dc:Point" x="525" y="549" /> + <di:waypoint xsi:type="dc:Point" x="525" y="580" /> <bpmndi:BPMNLabel> - <dc:Bounds x="313" y="522" width="12" height="14" /> + <dc:Bounds x="514" y="524.0370370370371" width="13" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0y5991s_di" bpmnElement="IntermediateThrowEvent_0y5991s"> @@ -396,9 +439,9 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1tbopzu_di" bpmnElement="IntermediateThrowEvent_1tbopzu"> - <dc:Bounds x="852" y="272" width="36" height="36" /> + <dc:Bounds x="1004" y="272" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="835" y="313" width="70" height="12" /> + <dc:Bounds x="986" y="313" width="72" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1vr3ks5_di" bpmnElement="ScriptTask_1vr3ks5"> @@ -408,7 +451,7 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> <dc:Bounds x="342" y="250" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_04zaa1o_di" bpmnElement="ScriptTask_04zaa1o"> - <dc:Bounds x="555" y="250" width="100" height="80" /> + <dc:Bounds x="112" y="452" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xhu1k3_di" bpmnElement="SequenceFlow_0xhu1k3"> <di:waypoint xsi:type="dc:Point" x="212" y="290" /> @@ -419,9 +462,9 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1o3ihrh_di" bpmnElement="SequenceFlow_1o3ihrh"> <di:waypoint xsi:type="dc:Point" x="442" y="290" /> - <di:waypoint xsi:type="dc:Point" x="555" y="290" /> + <di:waypoint xsi:type="dc:Point" x="500" y="290" /> <bpmndi:BPMNLabel> - <dc:Bounds x="499" y="275" width="0" height="0" /> + <dc:Bounds x="426" y="275" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1tfe975_di" bpmnElement="SequenceFlow_1tfe975"> @@ -434,17 +477,63 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14ajbme_di" bpmnElement="SequenceFlow_14ajbme"> - <di:waypoint xsi:type="dc:Point" x="655" y="290" /> - <di:waypoint xsi:type="dc:Point" x="852" y="290" /> + <di:waypoint xsi:type="dc:Point" x="930" y="290" /> + <di:waypoint xsi:type="dc:Point" x="1004" y="290" /> <bpmndi:BPMNLabel> - <dc:Bounds x="754" y="265" width="0" height="0" /> + <dc:Bounds x="922" y="275" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1hjh5zy_di" bpmnElement="SequenceFlow_1hjh5zy"> <di:waypoint xsi:type="dc:Point" x="30" y="492" /> <di:waypoint xsi:type="dc:Point" x="112" y="492" /> <bpmndi:BPMNLabel> - <dc:Bounds x="71" y="467" width="0" height="0" /> + <dc:Bounds x="26" y="477" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1y1p4bd_di" bpmnElement="CallActivity_1y1p4bd"> + <dc:Bounds x="830" y="250" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1imcb54_di" bpmnElement="ScriptTask_1imcb54"> + <dc:Bounds x="637" y="250" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0bng27u_di" bpmnElement="SequenceFlow_0bng27u"> + <di:waypoint xsi:type="dc:Point" x="737" y="290" /> + <di:waypoint xsi:type="dc:Point" x="830" y="290" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="783.5" y="269" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fv5tk6_di" bpmnElement="SequenceFlow_1fv5tk6"> + <di:waypoint xsi:type="dc:Point" x="212" y="492" /> + <di:waypoint xsi:type="dc:Point" x="321" y="492" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266.5" y="471" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0h0cq5k_di" bpmnElement="ExclusiveGateway_0h0cq5k" isMarkerVisible="true"> + <dc:Bounds x="499.52351097178683" y="265" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="488" y="319" width="77" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0vcumrm_di" bpmnElement="SequenceFlow_0vcumrm"> + <di:waypoint xsi:type="dc:Point" x="550" y="290" /> + <di:waypoint xsi:type="dc:Point" x="637" y="290" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="593.5" y="269" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0hhmvlw_di" bpmnElement="IntermediateThrowEvent_0hhmvlw"> + <dc:Bounds x="507" y="342" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="489" y="383" width="72" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xrox26_di" bpmnElement="SequenceFlow_0xrox26"> + <di:waypoint xsi:type="dc:Point" x="525" y="315" /> + <di:waypoint xsi:type="dc:Point" x="525" y="342" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540" y="322.5" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn index a4e7ae1b1a..a94569c29b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -1,5 +1,5 @@ <?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="1.16.2"> +<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.0.0"> <bpmn:process id="CreateSDNCNetworkResource" name="CreateSDNCNetworkResource" isExecutable="true"> <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> @@ -7,7 +7,7 @@ <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="Task_1dlrfiw" /> <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0tezqd4" /> <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0svppaq</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new CreateSDNCNetworkResource() @@ -18,27 +18,19 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:endEvent> <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC Create Adapter V1 " calledElement="sdncAdapter"> <bpmn:extensionElements> - <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="sdncAdapterResponse" target="CRENWKI_activateSDNCResponse" /> + <camunda:out source="sdncAdapterResponse" target="CRENWKI_createSDNCResponse" /> <camunda:out source="SDNCA_ResponseCode" target="CRESDNCRES_sdncCreateReturnCode" /> <camunda:out source="SDNCA_SuccessIndicator" target="CRESDNCRES_SuccessIndicator" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ex9ov6</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0u8d8j5</bpmn:outgoing> </bpmn:callActivity> - <bpmn:scriptTask id="Task_023hred" name="post SDNC create call"> - <bpmn:incoming>SequenceFlow_1ex9ov6</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1kzj1j5</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new CreateSDNCNetworkResource() -dcsi.postCreateSDNCCall(execution)</bpmn:script> - </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" /> - <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="Task_1mbzgl7" /> <bpmn:scriptTask id="Task_1dlrfiw" name="Set the Recipe DesignTimeParam" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0w2es8j</bpmn:outgoing> @@ -103,27 +95,24 @@ dcsi.prepareUpdateBeforeCreateSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1kzj1j5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0o7h0ag</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1cd8ujq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0drbyvd</bpmn:outgoing> </bpmn:serviceTask> <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1cd8ujq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0drbyvd</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0auvfvm</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateSDNCNetworkResource() csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0cdulnk" name="is activate required"> - <bpmn:incoming>SequenceFlow_0o7h0ag</bpmn:incoming> + <bpmn:exclusiveGateway id="ExclusiveGateway_0cdulnk" name="is deActivate required" default="SequenceFlow_05m2j56"> + <bpmn:incoming>SequenceFlow_0oqe2oa</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1dww8ye</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_05m2j56</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_1dww8ye" name="yes" sourceRef="ExclusiveGateway_0cdulnk" targetRef="Task_0bga3e8"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isActivateRequired") == "true")}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1ex9ov6" sourceRef="CallActivity_1600xlj" targetRef="Task_023hred" /> - <bpmn:sequenceFlow id="SequenceFlow_1kzj1j5" sourceRef="Task_023hred" targetRef="ServiceTask_1cm8iwr" /> - <bpmn:sequenceFlow id="SequenceFlow_0o7h0ag" sourceRef="ServiceTask_1cm8iwr" targetRef="ExclusiveGateway_0cdulnk" /> <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After create" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_05m2j56</bpmn:incoming> <bpmn:incoming>SequenceFlow_05niqbf</bpmn:incoming> @@ -134,7 +123,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_05m2j56" name="No" sourceRef="ExclusiveGateway_0cdulnk" targetRef="Task_0uwlr22" /> <bpmn:sequenceFlow id="SequenceFlow_05niqbf" sourceRef="Task_0bga3e8" targetRef="Task_0uwlr22" /> - <bpmn:sequenceFlow id="SequenceFlow_1cd8ujq" sourceRef="Task_0uwlr22" targetRef="ScriptTask_1g5zyi6" /> + <bpmn:sequenceFlow id="SequenceFlow_1cd8ujq" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> <bpmn:sequenceFlow id="SequenceFlow_0auvfvm" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" /> <bpmn:callActivity id="Task_0bga3e8" name="call Activate SDNC network Resource" calledElement="ActivateSDNCNetworkResource"> <bpmn:extensionElements> @@ -148,36 +137,55 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> <camunda:in source="requestAction" target="requestAction" /> <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> <camunda:in source="networkRequest" target="networkRequest" /> + <camunda:in source="networkInstanceId" target="networkInstanceId" /> + <camunda:in source="parentServiceInstanceId" target="parentServiceInstanceId" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1dww8ye</bpmn:incoming> <bpmn:outgoing>SequenceFlow_05niqbf</bpmn:outgoing> </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0svppaq" sourceRef="Task_1mbzgl7" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:scriptTask id="Task_1mbzgl7" name="Update resource input" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0svppaq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.updateResourceInput(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0drbyvd" sourceRef="ServiceTask_1cm8iwr" targetRef="ScriptTask_1g5zyi6" /> + <bpmn:sequenceFlow id="SequenceFlow_0u8d8j5" sourceRef="CallActivity_1600xlj" targetRef="Task_1czbh37" /> + <bpmn:sequenceFlow id="SequenceFlow_0oqe2oa" sourceRef="Task_1czbh37" targetRef="ExclusiveGateway_0cdulnk" /> + <bpmn:scriptTask id="Task_1czbh37" name="post SDNC create call" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0u8d8j5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0oqe2oa</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.afterCreateSDNCCall(execution)</bpmn:script> + </bpmn:scriptTask> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSDNCNetworkResource"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> - <dc:Bounds x="-111" y="111" width="36" height="36" /> + <dc:Bounds x="-188" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-135" y="147" width="85" height="24" /> + <dc:Bounds x="-214" y="147" width="89" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> - <di:waypoint x="-75" y="129" /> - <di:waypoint x="-10" y="129" /> + <di:waypoint x="-152" y="129" /> + <di:waypoint x="-96" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="-87.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> - <di:waypoint x="413" y="129" /> - <di:waypoint x="460" y="129" /> - <di:waypoint x="500" y="129" /> + <di:waypoint x="513" y="129" /> + <di:waypoint x="573" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="391.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> - <dc:Bounds x="313" y="89" width="100" height="80" /> + <dc:Bounds x="413" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> <dc:Bounds x="1046" y="317" width="36" height="36" /> @@ -188,33 +196,28 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> <dc:Bounds x="-10" y="295" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> - <dc:Bounds x="172" y="295" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j"> - <di:waypoint x="90" y="129" /> - <di:waypoint x="148" y="129" /> + <di:waypoint x="4" y="129" /> + <di:waypoint x="67" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="74" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> - <di:waypoint x="248" y="129" /> - <di:waypoint x="313" y="129" /> + <di:waypoint x="167" y="129" /> + <di:waypoint x="231" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw"> - <dc:Bounds x="-10" y="89" width="100" height="80" /> + <dc:Bounds x="-96" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> - <dc:Bounds x="148" y="89" width="100" height="80" /> + <dc:Bounds x="67" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> - <di:waypoint x="606" y="129" /> - <di:waypoint x="638" y="129" /> - <di:waypoint x="638" y="129" /> + <di:waypoint x="673" y="129" /> <di:waypoint x="738" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="608" y="123" width="90" height="12" /> @@ -225,75 +228,85 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> <di:waypoint x="788" y="218" /> <di:waypoint x="-89" y="218" /> <di:waypoint x="-89" y="335" /> - <di:waypoint x="-10" y="335" /> + <di:waypoint x="-17" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="349" y="197" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> - <dc:Bounds x="506" y="89" width="100" height="80" /> + <dc:Bounds x="573" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> <dc:Bounds x="738" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> - <dc:Bounds x="366" y="295" width="100" height="80" /> + <dc:Bounds x="720" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> <dc:Bounds x="890" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0cdulnk_di" bpmnElement="ExclusiveGateway_0cdulnk" isMarkerVisible="true"> - <dc:Bounds x="539" y="310" width="50" height="50" /> + <dc:Bounds x="371" y="310" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="539" y="273" width="49" height="27" /> + <dc:Bounds x="365" y="273" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1dww8ye_di" bpmnElement="SequenceFlow_1dww8ye"> - <di:waypoint x="564" y="360" /> - <di:waypoint x="564" y="471" /> - <di:waypoint x="608" y="471" /> + <di:waypoint x="396" y="360" /> + <di:waypoint x="396" y="471" /> + <di:waypoint x="440" y="471" /> <bpmndi:BPMNLabel> - <dc:Bounds x="571" y="391" width="18" height="14" /> + <dc:Bounds x="403" y="391" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ex9ov6_di" bpmnElement="SequenceFlow_1ex9ov6"> - <di:waypoint x="90" y="335" /> - <di:waypoint x="172" y="335" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1kzj1j5_di" bpmnElement="SequenceFlow_1kzj1j5"> - <di:waypoint x="272" y="335" /> - <di:waypoint x="366" y="335" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0o7h0ag_di" bpmnElement="SequenceFlow_0o7h0ag"> - <di:waypoint x="466" y="335" /> - <di:waypoint x="539" y="335" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> - <dc:Bounds x="721" y="295" width="100" height="80" /> + <dc:Bounds x="553" y="295" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_05m2j56_di" bpmnElement="SequenceFlow_05m2j56"> - <di:waypoint x="589" y="335" /> - <di:waypoint x="721" y="335" /> + <di:waypoint x="421" y="335" /> + <di:waypoint x="553" y="335" /> <bpmndi:BPMNLabel> - <dc:Bounds x="648" y="317" width="14" height="14" /> + <dc:Bounds x="480" y="317" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_05niqbf_di" bpmnElement="SequenceFlow_05niqbf"> - <di:waypoint x="708" y="471" /> - <di:waypoint x="771" y="471" /> - <di:waypoint x="771" y="375" /> + <di:waypoint x="540" y="471" /> + <di:waypoint x="603" y="471" /> + <di:waypoint x="603" y="375" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1cd8ujq_di" bpmnElement="SequenceFlow_1cd8ujq"> - <di:waypoint x="821" y="335" /> - <di:waypoint x="890" y="335" /> + <di:waypoint x="653" y="335" /> + <di:waypoint x="720" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0auvfvm_di" bpmnElement="SequenceFlow_0auvfvm"> <di:waypoint x="990" y="335" /> <di:waypoint x="1046" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0aywvn3_di" bpmnElement="Task_0bga3e8"> - <dc:Bounds x="608" y="431" width="100" height="80" /> + <dc:Bounds x="440" y="431" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0svppaq_di" bpmnElement="SequenceFlow_0svppaq"> + <di:waypoint x="331" y="129" /> + <di:waypoint x="413" y="129" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1kzr9lu_di" bpmnElement="Task_1mbzgl7"> + <dc:Bounds x="231" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0drbyvd_di" bpmnElement="SequenceFlow_0drbyvd"> + <di:waypoint x="820" y="335" /> + <di:waypoint x="890" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0u8d8j5_di" bpmnElement="SequenceFlow_0u8d8j5"> + <di:waypoint x="90" y="335" /> + <di:waypoint x="185" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0oqe2oa_di" bpmnElement="SequenceFlow_0oqe2oa"> + <di:waypoint x="285" y="335" /> + <di:waypoint x="371" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1njkyn8_di" bpmnElement="Task_1czbh37"> + <dc:Bounds x="185" y="295" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn index f975ffbcd6..3b1c56628e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn @@ -4,7 +4,7 @@ <bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() CreateVcpeResCustService.sendSyncResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -16,7 +16,7 @@ CreateVcpeResCustService.sendSyncResponse(execution)]]></bpmn2:script> <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() CreateVcpeResCustService.preProcessRequest(execution) ]]></bpmn2:script> @@ -29,7 +29,7 @@ CreateVcpeResCustService.preProcessRequest(execution) <bpmn2:scriptTask id="postProcessAndCompletionRequest_ScriptTask" name="Post Process & Completion Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0afe2pg</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() CreateVcpeResCustService.postProcessResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -72,7 +72,7 @@ execution.setVariable("CreateVcpeResCustServiceSuccessIndicator", true)]]></bpmn <bpmn2:scriptTask id="ScriptTask_1" name="Log / Print Unexpected Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processJavaException(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -124,7 +124,7 @@ ex.processJavaException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0yk02h3" name="Prepare FalloutHandler" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0jg47xm</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0807ukc</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() CreateVcpeResCustService.prepareFalloutRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -176,14 +176,14 @@ CreateVcpeResCustService.prepareFalloutRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_17doerz" name="Pre Process Rollback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_02o4yqx</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0ftzjjm</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService= new CreateVcpeResCustService() CreateVcpeResCustService.preProcessRollback(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_0wyub4x" name="Post Process Rollback" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0dvsqpp</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1rabks0</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService= new CreateVcpeResCustService() CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -332,7 +332,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0cdtchu" name="Prepare Decompose Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1eu60rt</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_00h6hmd</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() CreateVcpeResCustService.prepareDecomposeService(execution)]]></bpmn2:script> </bpmn2:scriptTask> @@ -350,7 +350,7 @@ CreateVcpeResCustService.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0lpv2da" name="PostProcess Decompose Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_17g05fd</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11efpvh</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() CreateVcpeResCustService.processDecomposition(execution)]]></bpmn2:script> </bpmn2:scriptTask> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DeActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn index 3442d68c45..eaf37191d5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DeActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn @@ -1,60 +1,60 @@ <?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="1.16.2"> +<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.0.0"> <bpmn:process id="DeActivateSDNCNetworkResource" name="DeActivateSDNCNetworkResource" isExecutable="true"> - <bpmn:startEvent id="deleteNetworkResource_StartEvent" name="deleteNetworkResource_StartEvent"> + <bpmn:startEvent id="deleteNetworkResource_StartEvent_deactivate" name="deleteNetworkResource_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNetworkResource_StartEvent" targetRef="Task_13sx2bp" /> - <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="CallActivity_1600xlj" /> - <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Deactivate Request" scriptFormat="groovy"> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNetworkResource_StartEvent_deactivate" targetRef="Task_13sx2bp_deactivate" /> + <bpmn:scriptTask id="PreprocessIncomingRequest_deactivate" name="prepare SDNC Deactivate Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:outgoing>SequenceFlow_1fjtgq7</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0nmt8ph</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeActivateSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1x6k78c" name="delete SDNC call end"> + <bpmn:endEvent id="EndEvent_1x6k78c_deactivate" name="delete SDNC call end"> <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming> </bpmn:endEvent> - <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC Adapter V1 " calledElement="sdncAdapter"> - <bpmn:extensionElements> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> - <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> - <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0uig0sx</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1emjxm2" /> - <bpmn:scriptTask id="Task_023hred" name="post SDNC deactivate call"> - <bpmn:incoming>SequenceFlow_0x5f1o7</bpmn:incoming> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred_deactivate" targetRef="ScriptTask_1emjxm2_deactivate" /> + <bpmn:scriptTask id="Task_023hred_deactivate" name="post SDNC deactivate call"> + <bpmn:incoming>SequenceFlow_13gl3wv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeActivateSDNCNetworkResource() dcsi.postDeactivateSDNCCall(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp_deactivate" targetRef="PreprocessIncomingRequest_deactivate" /> + <bpmn:scriptTask id="Task_13sx2bp_deactivate" name="Pre Process Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeleteSDNDeActivateSDNCNetworkResourceCNetworkResource() + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeActivateSDNCNetworkResource() dcsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" /> - <bpmn:scriptTask id="Task_0tezqd4" name="Delete progress update parameters after deactivate" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0uig0sx</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:scriptTask id="Task_0tezqd4_deactivate" name="Delete progress update parameters after deactivate" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0rn8vky</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1pzm7qx</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeActivateSDNCNetworkResource() dcsi.prepareUpdateAfterDeActivateSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="Task_18tomkl" name="update progress update"> + <bpmn:scriptTask id="ScriptTask_1emjxm2_deactivate" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeActivateSDNCNetworkResource() +csi.sendSyncResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2_deactivate" targetRef="EndEvent_1x6k78c_deactivate" /> + <bpmn:sequenceFlow id="SequenceFlow_1fjtgq7" sourceRef="PreprocessIncomingRequest_deactivate" targetRef="Task_0n0lj30_deactivate" /> + <bpmn:callActivity id="Task_0n0lj30_deactivate" name="Call SDNC Adapter V1" calledElement="SDNCAdapterRestV1"> + <bpmn:incoming>SequenceFlow_1fjtgq7</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0c58p9k</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0c58p9k" sourceRef="Task_0n0lj30_deactivate" targetRef="Task_0tezqd4_deactivate" /> + <bpmn:sequenceFlow id="SequenceFlow_1pzm7qx" sourceRef="Task_0tezqd4_deactivate" targetRef="Task_1a6f0p9_deactivate" /> + <bpmn:serviceTask id="Task_1a6f0p9_deactivate" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -73,26 +73,34 @@ dcsi.prepareUpdateAfterDeActivateSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1mz0vdx</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0x5f1o7</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1pzm7qx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_13gl3wv</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:scriptTask id="ScriptTask_1emjxm2" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DeActivateSDNCNetworkResource() -csi.sendSyncResponse(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2" targetRef="EndEvent_1x6k78c" /> - <bpmn:sequenceFlow id="SequenceFlow_0uig0sx" sourceRef="CallActivity_1600xlj" targetRef="Task_0tezqd4" /> - <bpmn:sequenceFlow id="SequenceFlow_0x5f1o7" sourceRef="Task_18tomkl" targetRef="Task_023hred" /> + <bpmn:sequenceFlow id="SequenceFlow_13gl3wv" sourceRef="Task_1a6f0p9_deactivate" targetRef="Task_023hred_deactivate" /> + <bpmn:callActivity id="CallActivity_0a0txik_DeActivate" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1fjtgq7</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0nmt8ph</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rn8vky</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0rn8vky" sourceRef="CallActivity_0a0txik_DeActivate" targetRef="Task_0tezqd4_deactivate" /> + <bpmn:sequenceFlow id="SequenceFlow_0nmt8ph" sourceRef="PreprocessIncomingRequest_deactivate" targetRef="CallActivity_0a0txik_DeActivate" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeActivateSDNCNetworkResource"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent_deactivate"> <dc:Bounds x="-111" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-136" y="147" width="89" height="28" /> + <dc:Bounds x="-135" y="147" width="88" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> @@ -102,25 +110,15 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="-87.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> - <di:waypoint x="278" y="129" /> - <di:waypoint x="333" y="129" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="391.5" y="108" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_deactivate"> <dc:Bounds x="178" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_deactivate"> <dc:Bounds x="964" y="327" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="928" y="369" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> - <dc:Bounds x="333" y="89" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> <di:waypoint x="735" y="345" /> <di:waypoint x="795" y="345" /> @@ -128,7 +126,7 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="719" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_deactivate"> <dc:Bounds x="635" y="305" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> @@ -138,23 +136,13 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_deactivate"> <dc:Bounds x="5" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> - <di:waypoint x="433" y="345" /> - <di:waypoint x="481" y="345" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="608" y="123" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> + <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4_deactivate"> <dc:Bounds x="333" y="305" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> - <dc:Bounds x="481" y="305" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2"> + <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2_deactivate"> <dc:Bounds x="795" y="305" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a"> @@ -164,13 +152,31 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="930" y="313" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0uig0sx_di" bpmnElement="SequenceFlow_0uig0sx"> + <bpmndi:BPMNEdge id="SequenceFlow_1fjtgq7_di" bpmnElement="SequenceFlow_1fjtgq7"> + <di:waypoint x="278" y="129" /> + <di:waypoint x="333" y="129" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pzm7qx_di" bpmnElement="SequenceFlow_1pzm7qx"> + <di:waypoint x="433" y="345" /> + <di:waypoint x="487" y="345" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0k4fp1d_di" bpmnElement="Task_1a6f0p9_deactivate"> + <dc:Bounds x="487" y="305" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13gl3wv_di" bpmnElement="SequenceFlow_13gl3wv"> + <di:waypoint x="587" y="345" /> + <di:waypoint x="635" y="345" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0a0txik_di" bpmnElement="CallActivity_0a0txik_DeActivate"> + <dc:Bounds x="333" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0rn8vky_di" bpmnElement="SequenceFlow_0rn8vky"> <di:waypoint x="383" y="169" /> <di:waypoint x="383" y="305" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0x5f1o7_di" bpmnElement="SequenceFlow_0x5f1o7"> - <di:waypoint x="581" y="345" /> - <di:waypoint x="635" y="345" /> + <bpmndi:BPMNEdge id="SequenceFlow_0nmt8ph_di" bpmnElement="SequenceFlow_0nmt8ph"> + <di:waypoint x="278" y="129" /> + <di:waypoint x="333" y="129" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn index 4b6f8d9b26..25fd6af574 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn @@ -14,7 +14,7 @@ dcsi.prepare3rdONAPRequest(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_013449q" name="Delete3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_0a8k9xi</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Delete SPPartner In AAI"> + <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Delete SPPartner In AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0y2g8mr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0znwu8z</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* @@ -93,7 +93,7 @@ dcsi.doDeleteE2ESIin3rdONAP(execution)]]></bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:incoming>SequenceFlow_122usz6</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1luhljs</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_190fewc" sourceRef="StartEvent_0hj12gh" targetRef="ScriptTask_160sboy" /> @@ -160,7 +160,7 @@ dcsi.checkLocallCall(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_0o0n3fa" name="Delete3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_131f1jj</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Delete SPPartner In AAI"> + <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Delete SPPartner In AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1wq9f5k</bpmn:incoming> <bpmn:outgoing>SequenceFlow_18gb81f</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* @@ -180,11 +180,11 @@ dcsi.preProcessRequest(execution)]]></bpmn:script> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("status", "finished") -execution.setVariable("statusDescription", "Local Creation Only") +execution.setVariable("statusDescription", "Local Deletion Only") def dcsi = new Delete3rdONAPE2EServiceInstance() dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="resource progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -269,9 +269,9 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_15mvx68" sourceRef="ScriptTask_0rs5t7w" targetRef="ScriptTask_0r2cxvb" /> <bpmn:sequenceFlow id="SequenceFlow_0wp73cw" sourceRef="ScriptTask_0r2cxvb" targetRef="ExclusiveGateway_1662gjm" /> <bpmn:sequenceFlow id="SequenceFlow_13s0mg5" name="yes" sourceRef="ExclusiveGateway_1662gjm" targetRef="ScriptTask_0yz8d8c"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("serviceOrderId" ) != null && execution.getVariable("serviceOrderId" ) != "" )}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("ServiceOrderId" ) != null && execution.getVariable("ServiceOrderId" ) != "" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ServiceTask_0p5029r" /> + <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ScriptTask_0yiew1d" /> <bpmn:sequenceFlow id="SequenceFlow_1suwdgi" sourceRef="ServiceTask_039ju3f" targetRef="ScriptTask_0rs5t7w" /> <bpmn:sequenceFlow id="SequenceFlow_0kkou66" sourceRef="ScriptTask_1pdhttw" targetRef="ScriptTask_0yz8d8c" /> <bpmn:sequenceFlow id="SequenceFlow_1luhljs" sourceRef="ServiceTask_0p5029r" targetRef="ExclusiveGateway_1we7izu" /> @@ -319,6 +319,14 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0i9iiuo" sourceRef="ScriptTask_07cq0pw" targetRef="ServiceTask_1ixmamy" /> <bpmn:sequenceFlow id="SequenceFlow_1mei7hu" sourceRef="ServiceTask_1ixmamy" targetRef="EndEvent_19joonf" /> + <bpmn:scriptTask id="ScriptTask_0yiew1d" name="update resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_122usz6</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new Create3rdONAPE2EServiceInstance() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_122usz6" sourceRef="ScriptTask_0yiew1d" targetRef="ServiceTask_0p5029r" /> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -357,7 +365,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="163" y="12" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0p5029r_di" bpmnElement="ServiceTask_0p5029r"> - <dc:Bounds x="798" y="12" width="100" height="80" /> + <dc:Bounds x="798" y="126" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_190fewc_di" bpmnElement="SequenceFlow_190fewc"> <di:waypoint xsi:type="dc:Point" x="27" y="-400" /> @@ -589,7 +597,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1pdhttw_di" bpmnElement="ScriptTask_1pdhttw"> - <dc:Bounds x="573" y="187" width="100" height="80" /> + <dc:Bounds x="573" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1662gjm_di" bpmnElement="ExclusiveGateway_1662gjm" isMarkerVisible="true"> <dc:Bounds x="386" y="27" width="50" height="50" /> @@ -598,9 +606,9 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1we7izu_di" bpmnElement="ExclusiveGateway_1we7izu" isMarkerVisible="true"> - <dc:Bounds x="823" y="202" width="50" height="50" /> + <dc:Bounds x="823" y="237" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="880" y="206" width="68" height="42" /> + <dc:Bounds x="878" y="241" width="72" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_18auy29_di" bpmnElement="ScriptTask_18auy29"> @@ -654,24 +662,24 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kkou66_di" bpmnElement="SequenceFlow_0kkou66"> - <di:waypoint xsi:type="dc:Point" x="623" y="187" /> + <di:waypoint xsi:type="dc:Point" x="623" y="222" /> <di:waypoint xsi:type="dc:Point" x="623" y="92" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="132.5" width="90" height="14" /> + <dc:Bounds x="593" y="150" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1luhljs_di" bpmnElement="SequenceFlow_1luhljs"> - <di:waypoint xsi:type="dc:Point" x="848" y="92" /> - <di:waypoint xsi:type="dc:Point" x="848" y="202" /> + <di:waypoint xsi:type="dc:Point" x="848" y="206" /> + <di:waypoint xsi:type="dc:Point" x="848" y="237" /> <bpmndi:BPMNLabel> - <dc:Bounds x="818" y="140" width="90" height="14" /> + <dc:Bounds x="818" y="214.5" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1udji9x_di" bpmnElement="SequenceFlow_1udji9x"> - <di:waypoint xsi:type="dc:Point" x="823" y="227" /> - <di:waypoint xsi:type="dc:Point" x="673" y="227" /> + <di:waypoint xsi:type="dc:Point" x="823" y="262" /> + <di:waypoint xsi:type="dc:Point" x="673" y="262" /> <bpmndi:BPMNLabel> - <dc:Bounds x="746" y="208" width="12" height="14" /> + <dc:Bounds x="746" y="243" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_19joonf_di" bpmnElement="EndEvent_19joonf"> @@ -690,12 +698,12 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0y2g8mr_di" bpmnElement="SequenceFlow_0y2g8mr"> - <di:waypoint xsi:type="dc:Point" x="848" y="252" /> + <di:waypoint xsi:type="dc:Point" x="848" y="287" /> <di:waypoint xsi:type="dc:Point" x="848" y="324" /> <di:waypoint xsi:type="dc:Point" x="9" y="324" /> <di:waypoint xsi:type="dc:Point" x="9" y="371" /> <bpmndi:BPMNLabel> - <dc:Bounds x="419.8991436726927" y="302" width="18" height="14" /> + <dc:Bounds x="419" y="302" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_07cq0pw_di" bpmnElement="ScriptTask_07cq0pw"> @@ -718,6 +726,16 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <dc:Bounds x="326.5" y="193" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0yiew1d_di" bpmnElement="ScriptTask_0yiew1d"> + <dc:Bounds x="798" y="12" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_122usz6_di" bpmnElement="SequenceFlow_122usz6"> + <di:waypoint xsi:type="dc:Point" x="848" y="92" /> + <di:waypoint xsi:type="dc:Point" x="848" y="126" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="863" y="103" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn index be15908697..f0baac0254 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn @@ -1,6 +1,6 @@ <?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="1.11.3"> - <bpmn:process id="DeleteDeviceResource.bpmn" name="DeleteDeviceResource.bpmn" isExecutable="true"> + <bpmn:process id="DeleteDeviceResource" name="DeleteDeviceResource" isExecutable="true"> <bpmn:endEvent id="EndEvent_1x6k78c" name="delete Dev end"> <bpmn:incoming>SequenceFlow_0auvfvm</bpmn:incoming> </bpmn:endEvent> @@ -8,7 +8,7 @@ <bpmn:incoming>SequenceFlow_05niqbf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0auvfvm</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new DeleteDeviceResource.bpmn() +def csi = new DeleteDeviceResource() csi.sendSyncResponse(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_05niqbf" sourceRef="Task_0bga3e8" targetRef="ScriptTask_1g5zyi6" /> @@ -43,11 +43,11 @@ csi.sendSyncResponse(execution)]]></bpmn:script> def dcsi = new DeleteDeviceResource() dcsi.checkDevType(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_076ma0v"> + <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_1g6azih"> <bpmn:incoming>SequenceFlow_1hp2h5t</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ss02ik</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0h4378g</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_076ma0v</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1g6azih</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1chnlq6" name="GoTo StartDeleteDevinSDNC"> <bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming> @@ -91,10 +91,6 @@ dcsi.preProcessRequest(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" /> - <bpmn:endEvent id="EndEvent_0ymfq61"> - <bpmn:incoming>SequenceFlow_076ma0v</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_076ma0v" sourceRef="ExclusiveGateway_0kba700" targetRef="EndEvent_0ymfq61" /> <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF ID" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing> @@ -111,9 +107,47 @@ def dcsi = new DeleteDeviceResource() dcsi.postVNFInfoProcess(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" /> + <bpmn:scriptTask id="ScriptTask_14oc86m" name="Prepare Create resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1g6azih</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_003svcq</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("status", "finished") +execution.setVariable("statusDescription", "Finished for the devType") +def dcsi = new DeleteDeviceResource() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_1b3omyh" name="resource progress update"> + <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 QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</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_003svcq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1donwoj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_003svcq" sourceRef="ScriptTask_14oc86m" targetRef="ServiceTask_1b3omyh" /> + <bpmn:sequenceFlow id="SequenceFlow_1g6azih" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_14oc86m" /> + <bpmn:endEvent id="EndEvent_1tn8i1e"> + <bpmn:incoming>SequenceFlow_1donwoj</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1donwoj" sourceRef="ServiceTask_1b3omyh" targetRef="EndEvent_1tn8i1e" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteDeviceResource.bpmn"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteDeviceResource"> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> <dc:Bounds x="1026" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -158,7 +192,7 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <bpmndi:BPMNShape id="ExclusiveGateway_0kba700_di" bpmnElement="ExclusiveGateway_0kba700" isMarkerVisible="true"> <dc:Bounds x="334" y="-152" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="309" y="-166" width="34" height="12" /> + <dc:Bounds x="302" y="-166" width="48" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1chnlq6_di" bpmnElement="IntermediateThrowEvent_1chnlq6"> @@ -228,19 +262,6 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <dc:Bounds x="760.5" y="-148" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0ymfq61_di" bpmnElement="EndEvent_0ymfq61"> - <dc:Bounds x="341" y="-251" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="359" y="-211" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_076ma0v_di" bpmnElement="SequenceFlow_076ma0v"> - <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> - <di:waypoint xsi:type="dc:Point" x="359" y="-215" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="374" y="-189.5" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65"> <dc:Bounds x="480" y="-167" width="100" height="80" /> </bpmndi:BPMNShape> @@ -261,6 +282,39 @@ dcsi.postVNFInfoProcess(execution)]]></bpmn:script> <dc:Bounds x="987.5" y="-148" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_14oc86m_di" bpmnElement="ScriptTask_14oc86m"> + <dc:Bounds x="309" y="-281" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1b3omyh_di" bpmnElement="ServiceTask_1b3omyh"> + <dc:Bounds x="480" y="-281" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_003svcq_di" bpmnElement="SequenceFlow_003svcq"> + <di:waypoint xsi:type="dc:Point" x="409" y="-241" /> + <di:waypoint xsi:type="dc:Point" x="480" y="-241" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="444.5" y="-262" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1g6azih_di" bpmnElement="SequenceFlow_1g6azih"> + <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-201" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="374" y="-182.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1tn8i1e_di" bpmnElement="EndEvent_1tn8i1e"> + <dc:Bounds x="663" y="-259" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="681" y="-219" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1donwoj_di" bpmnElement="SequenceFlow_1donwoj"> + <di:waypoint xsi:type="dc:Point" x="580" y="-241" /> + <di:waypoint xsi:type="dc:Point" x="663" y="-241" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="621.5" y="-262" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index 00c0288246..80fcc1762e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -1,78 +1,56 @@ <?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="1.16.2"> +<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.0.0"> <bpmn:process id="DeleteSDNCNetworkResource" name="DeleteSDNCNetworkResource" isExecutable="true"> - <bpmn:startEvent id="deleteNetworkResource_StartEvent" name="deleteNetworkResource_StartEvent"> - <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + <bpmn:startEvent id="deleteNetworkResource_StartEvent_delete" name="deleteNetworkResource_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln_delete</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNetworkResource_StartEvent" targetRef="Task_1dlrfiw" /> - <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0tezqd4" /> - <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0jh88qw</bpmn:incoming> - <bpmn:incoming>SequenceFlow_00vqgvt</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln_delete" sourceRef="deleteNetworkResource_StartEvent_delete" targetRef="Task_1dlrfiw_delete" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova_delete" sourceRef="PreprocessIncomingRequest_task_delete" targetRef="Task_0tfzqd4_delete" /> + <bpmn:scriptTask id="PreprocessIncomingRequest_task_delete" name="prepare SDNC Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0jh88qw_delete</bpmn:incoming> + <bpmn:incoming>SequenceFlow_00vqgvt_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1x6k78c" name="delete SDNC call end"> - <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming> + <bpmn:endEvent id="EndEvent_1x6k78c_delete" name="delete SDNC call end"> + <bpmn:incoming>SequenceFlow_15wux6a_delete</bpmn:incoming> </bpmn:endEvent> - <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> - <bpmn:extensionElements> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - <camunda:in source="mso-request-id" target="mso-request-id" /> - <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> - <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> - <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> - <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" /> - <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1emjxm2" /> - <bpmn:scriptTask id="Task_023hred" name="post SDNC delete call"> - <bpmn:incoming>SequenceFlow_0ds04u5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_delete" sourceRef="Task_023hred_delete" targetRef="ScriptTask_1emjxm2_delete" /> + <bpmn:scriptTask id="Task_023hred_delete" name="post SDNC delete call"> + <bpmn:incoming>SequenceFlow_0ds04u5_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ow44q0_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.postDeleteSDNCCall(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" /> - <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="ExclusiveGateway_0xrgeq3" /> - <bpmn:scriptTask id="Task_1dlrfiw" name="Set the Recipe DesignTimeParam" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0w2es8j</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0w2es8j_delete" sourceRef="Task_1dlrfiw_delete" targetRef="Task_13sx2bp_delete" /> + <bpmn:sequenceFlow id="SequenceFlow_18l3crb_delete" sourceRef="Task_13sx2bp_delete" targetRef="ExclusiveGateway_0xrgeq3_delete" /> + <bpmn:scriptTask id="Task_1dlrfiw_delete" name="Set the Recipe DesignTimeParam" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0w2es8j_delete</bpmn:outgoing> <bpmn:script>String recipeParamXsdDemo="""{"operationType":"GRE"}""" String recipeParamXsd="" execution.setVariable("recipeParamXsd", recipeParamXsd)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0w2es8j</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:scriptTask id="Task_13sx2bp_delete" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0w2es8j_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18l3crb_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" /> - <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="CallActivity_1600xlj" /> - <bpmn:scriptTask id="Task_0tezqd4" name="Delete progress update parameters before delete" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx_delete" sourceRef="Task_0tfzqd4_delete" targetRef="Task_18tomkl_delete" /> + <bpmn:sequenceFlow id="SequenceFlow_15mvedq_delete" sourceRef="Task_18tomkl_delete" targetRef="CallActivity_0bj0odq" /> + <bpmn:scriptTask id="Task_0tfzqd4_delete" name="Delete progress update parameters before delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1mz0vdx_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.prepareUpdateBeforeDeleteSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After delete" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeleteSDNCNetworkResource() -dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:serviceTask id="Task_18tomkl" name="update progress update"> + <bpmn:serviceTask id="Task_18tomkl_delete" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -91,10 +69,10 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1mz0vdx</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15mvedq</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1mz0vdx_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15mvedq_delete</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1cm8iwr_delete" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -113,178 +91,181 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ds04u5</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0yooswe_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ds04u5_delete</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" /> - <bpmn:scriptTask id="ScriptTask_1emjxm2" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing> - <bpmn:script>import org.openecomp.mso.bpmn.infrastructure.scripts.* + <bpmn:scriptTask id="ScriptTask_1emjxm2_delete" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ow44q0_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15wux6a_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DeleteSDNCNetworkResource() csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2" targetRef="EndEvent_1x6k78c" /> - <bpmn:sequenceFlow id="SequenceFlow_0ds04u5" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_0xrgeq3" name="is Deactivate Required"> - <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0jh88qw</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0h3klf0</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_15wux6a_delete" sourceRef="ScriptTask_1emjxm2_delete" targetRef="EndEvent_1x6k78c_delete" /> + <bpmn:sequenceFlow id="SequenceFlow_0ds04u5_delete" sourceRef="ServiceTask_1cm8iwr_delete" targetRef="Task_023hred_delete" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0xrgeq3_delete" name="is Deactivate Required"> + <bpmn:incoming>SequenceFlow_18l3crb_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jh88qw_delete</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0h3klf0_delete</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0jh88qw" name="No" sourceRef="ExclusiveGateway_0xrgeq3" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:sequenceFlow id="SequenceFlow_0h3klf0" name="Yes" sourceRef="ExclusiveGateway_0xrgeq3" targetRef="Task_1xychp0"> + <bpmn:sequenceFlow id="SequenceFlow_0jh88qw_delete" name="No" sourceRef="ExclusiveGateway_0xrgeq3_delete" targetRef="PreprocessIncomingRequest_task_delete"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isActivateRequired") != "true")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0h3klf0_delete" name="Yes" sourceRef="ExclusiveGateway_0xrgeq3_delete" targetRef="Task_1xychp0_delete"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isActivateRequired") == "true")}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_00vqgvt" sourceRef="Task_1xychp0" targetRef="PreprocessIncomingRequest_task" /> - <bpmn:callActivity id="Task_1xychp0" name="Call Deactivate SDNC Network Resource" calledElement="DeActivateSDNCNetworkResource"> + <bpmn:sequenceFlow id="SequenceFlow_00vqgvt_delete" sourceRef="Task_1xychp0_delete" targetRef="PreprocessIncomingRequest_task_delete" /> + <bpmn:callActivity id="Task_1xychp0_delete" name="Call Deactivate SDNC Network Resource" calledElement="DeActivateSDNCNetworkResource"> <bpmn:extensionElements> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:in source="requestAction" target="requestAction" /> <camunda:in source="recipeParams" target="recipeParams" /> - <camunda:in source="recipeParams" target="recipeParams" /> <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> <camunda:in source="resourceInput" target="resourceInput" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0h3klf0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00vqgvt</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0h3klf0_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00vqgvt_delete</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Task_1ikbt2h_delete" name="Create progress update parameters After delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0lplazm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yooswe_delete</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteSDNCNetworkResource() +dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0yooswe_delete" sourceRef="Task_1ikbt2h_delete" targetRef="ServiceTask_1cm8iwr_delete" /> + <bpmn:callActivity id="CallActivity_0bj0odq" name="Call SDNC RSRC Adapter V1 " calledElement="sdncAdapter"> + <bpmn:extensionElements> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" /> + <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" /> + <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_15mvedq_delete</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0lplazm</bpmn:outgoing> </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0lplazm" sourceRef="CallActivity_0bj0odq" targetRef="Task_1ikbt2h_delete" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSDNCNetworkResource"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent_delete"> <dc:Bounds x="-111" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-136" y="147" width="89" height="28" /> + <dc:Bounds x="-135" y="147" width="88" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln_delete"> <di:waypoint x="-75" y="129" /> <di:waypoint x="-10" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="-87.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova_delete"> <di:waypoint x="593" y="129" /> <di:waypoint x="684" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="391.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task_delete"> <dc:Bounds x="493" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_delete"> <dc:Bounds x="898" y="317" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="862" y="359" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj"> - <dc:Bounds x="42" y="295" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed"> - <di:waypoint x="142" y="335" /> - <di:waypoint x="200" y="335" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="210.5" y="314" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> + <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_delete"> <di:waypoint x="624" y="335" /> <di:waypoint x="709" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="719" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred"> + <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_delete"> <dc:Bounds x="524" y="295" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j"> + <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j_delete"> <di:waypoint x="90" y="129" /> <di:waypoint x="148" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="74" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> + <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb_delete"> <di:waypoint x="248" y="129" /> <di:waypoint x="325" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw"> + <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw_delete"> <dc:Bounds x="-10" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp"> + <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_delete"> <dc:Bounds x="148" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx"> + <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx_delete"> <di:waypoint x="784" y="129" /> <di:waypoint x="900" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="608" y="123" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq"> + <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq_delete"> <di:waypoint x="950" y="169" /> - <di:waypoint x="950" y="218" /> - <di:waypoint x="0" y="218" /> - <di:waypoint x="0" y="335" /> - <di:waypoint x="42" y="335" /> + <di:waypoint x="950" y="246" /> + <di:waypoint x="-106" y="246" /> + <di:waypoint x="-106" y="335" /> + <di:waypoint x="9" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="349" y="197" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4"> + <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tfzqd4_delete"> <dc:Bounds x="684" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22"> - <dc:Bounds x="200" y="295" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl"> + <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl_delete"> <dc:Bounds x="900" y="89" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr"> + <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr_delete"> <dc:Bounds x="355" y="295" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0"> - <di:waypoint x="300" y="335" /> - <di:waypoint x="355" y="335" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="444.5" y="314" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2"> + <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2_delete"> <dc:Bounds x="709" y="295" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a"> + <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a_delete"> <di:waypoint x="809" y="335" /> <di:waypoint x="898" y="335" /> <bpmndi:BPMNLabel> <dc:Bounds x="930" y="313" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ds04u5_di" bpmnElement="SequenceFlow_0ds04u5"> + <bpmndi:BPMNEdge id="SequenceFlow_0ds04u5_di" bpmnElement="SequenceFlow_0ds04u5_delete"> <di:waypoint x="455" y="335" /> <di:waypoint x="524" y="335" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0xrgeq3_di" bpmnElement="ExclusiveGateway_0xrgeq3" isMarkerVisible="true"> + <bpmndi:BPMNShape id="ExclusiveGateway_0xrgeq3_di" bpmnElement="ExclusiveGateway_0xrgeq3_delete" isMarkerVisible="true"> <dc:Bounds x="325" y="104" width="50" height="50" /> <bpmndi:BPMNLabel> <dc:Bounds x="320" y="161" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0jh88qw_di" bpmnElement="SequenceFlow_0jh88qw"> + <bpmndi:BPMNEdge id="SequenceFlow_0jh88qw_di" bpmnElement="SequenceFlow_0jh88qw_delete"> <di:waypoint x="375" y="129" /> <di:waypoint x="493" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="427" y="111" width="14" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0h3klf0_di" bpmnElement="SequenceFlow_0h3klf0"> + <bpmndi:BPMNEdge id="SequenceFlow_0h3klf0_di" bpmnElement="SequenceFlow_0h3klf0_delete"> <di:waypoint x="350" y="104" /> <di:waypoint x="350" y="-12" /> <di:waypoint x="493" y="-12" /> @@ -292,13 +273,27 @@ csi.sendSyncResponse(execution)</bpmn:script> <dc:Bounds x="356" y="43" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_00vqgvt_di" bpmnElement="SequenceFlow_00vqgvt"> + <bpmndi:BPMNEdge id="SequenceFlow_00vqgvt_di" bpmnElement="SequenceFlow_00vqgvt_delete"> <di:waypoint x="543" y="28" /> <di:waypoint x="543" y="89" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1lddjec_di" bpmnElement="Task_1xychp0"> + <bpmndi:BPMNShape id="CallActivity_1lddjec_di" bpmnElement="Task_1xychp0_delete"> <dc:Bounds x="493" y="-52" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1wj862v_di" bpmnElement="Task_1ikbt2h_delete"> + <dc:Bounds x="205" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0yooswe_di" bpmnElement="SequenceFlow_0yooswe_delete"> + <di:waypoint x="305" y="335" /> + <di:waypoint x="355" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0bj0odq_di" bpmnElement="CallActivity_0bj0odq"> + <dc:Bounds x="9" y="295" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0lplazm_di" bpmnElement="SequenceFlow_0lplazm"> + <di:waypoint x="109" y="335" /> + <di:waypoint x="205" y="335" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index 0b890d8573..9cf21ddc52 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -76,7 +76,7 @@ ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" /> <bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1m2tm19</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1e5j351</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1qctzm0</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateE2EServiceInstance() @@ -102,7 +102,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> </camunda:connector> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1qctzm0</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13xfsff</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1s5aas9</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service"> <bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming> @@ -158,16 +158,10 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EPutService" /> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource"> - <bpmn2:outgoing>SequenceFlow_1m2tm19</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartPrepareResource" /> </bpmn2:intermediateCatchEvent> - <bpmn2:scriptTask id="Task_0ush1g4" name="Process Site Location" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_13xfsff</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0y3i2k7</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi= new DoCreateE2EServiceInstance() -dcsi.doProcessSiteLocation(execution)]]></bpmn2:script> - </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="ScriptTask_0dpt36a" /> <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResourcesV3"> <bpmn2:extensionElements> <camunda:in source="nsServiceName" target="nsServiceName" /> @@ -190,7 +184,7 @@ dcsi.doProcessSiteLocation(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0d0c20n</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:scriptTask id="ScriptTask_04b21gb" name="PreProcess for Add Resources" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0y3i2k7</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0p6ba92</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0bf6bzp</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() @@ -203,7 +197,6 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script> def csi = new DoCreateE2EServiceInstance() csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="Task_0ush1g4" /> <bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" /> <bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" /> <bpmn2:endEvent id="EndEvent_0hzmoug"> @@ -211,8 +204,23 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" /> <bpmn2:sequenceFlow id="SequenceFlow_012h7yx" sourceRef="ScriptTask_1o01d7d" targetRef="IntermediateThrowEvent_1mlbhmt" /> - <bpmn2:sequenceFlow id="SequenceFlow_1m2tm19" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" /> - <bpmn2:sequenceFlow id="SequenceFlow_0y3i2k7" sourceRef="Task_0ush1g4" targetRef="ScriptTask_04b21gb" /> + <bpmn2:scriptTask id="ScriptTask_0dpt36a" name="Process Site Location" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1e5j351</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi= new DoCreateE2EServiceInstance() +dcsi.doProcessSiteLocation(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_1a5mdd6" name="Process Link TP Resource Allocation" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1s5aas9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0p6ba92</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi= new DoCreateE2EServiceInstance() +dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_0p6ba92" sourceRef="ScriptTask_1a5mdd6" targetRef="ScriptTask_04b21gb" /> + <bpmn2:sequenceFlow id="SequenceFlow_1s5aas9" sourceRef="Task_0raqlqc" targetRef="ScriptTask_1a5mdd6" /> + <bpmn2:sequenceFlow id="SequenceFlow_1e5j351" sourceRef="ScriptTask_0dpt36a" targetRef="Task_0uiekmn" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -228,15 +236,13 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <dc:Bounds x="126" y="-229" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="CustomE2EPutService"> - <dc:Bounds x="713" y="54" width="100" height="80" /> + <dc:Bounds x="478" y="54" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_129ih1g_di" bpmnElement="SequenceFlow_129ih1g"> - <di:waypoint xsi:type="dc:Point" x="813" y="94" /> - <di:waypoint xsi:type="dc:Point" x="941" y="94" /> - <di:waypoint xsi:type="dc:Point" x="941" y="94" /> - <di:waypoint xsi:type="dc:Point" x="1068" y="94" /> + <di:waypoint xsi:type="dc:Point" x="578" y="94" /> + <di:waypoint xsi:type="dc:Point" x="713" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="911" y="94" width="90" height="0" /> + <dc:Bounds x="600.5" y="79" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true"> @@ -272,7 +278,7 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9"> - <dc:Bounds x="1068" y="54" width="100" height="80" /> + <dc:Bounds x="713" y="54" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux"> <dc:Bounds x="246" y="920" width="100" height="80" /> @@ -297,17 +303,17 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qctzm0_di" bpmnElement="SequenceFlow_1qctzm0"> - <di:waypoint xsi:type="dc:Point" x="226" y="300" /> - <di:waypoint xsi:type="dc:Point" x="337" y="300" /> + <di:waypoint xsi:type="dc:Point" x="376" y="300" /> + <di:waypoint xsi:type="dc:Point" x="447" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="236.5" y="279" width="90" height="12" /> + <dc:Bounds x="367" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0v81r5h_di" bpmnElement="Task_0uiekmn"> - <dc:Bounds x="126" y="260" width="100" height="80" /> + <dc:Bounds x="276" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_14tnuxf_di" bpmnElement="Task_0raqlqc"> - <dc:Bounds x="337" y="260" width="100" height="80" /> + <dc:Bounds x="447" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs"> <dc:Bounds x="1315" y="-207" width="36" height="36" /> @@ -371,12 +377,10 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1tkgqu3_di" bpmnElement="SequenceFlow_1tkgqu3"> - <di:waypoint xsi:type="dc:Point" x="1168" y="94" /> - <di:waypoint xsi:type="dc:Point" x="1242" y="94" /> - <di:waypoint xsi:type="dc:Point" x="1242" y="94" /> + <di:waypoint xsi:type="dc:Point" x="813" y="94" /> <di:waypoint xsi:type="dc:Point" x="1315" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1257" y="88" width="0" height="12" /> + <dc:Bounds x="1019" y="73" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc"> @@ -389,19 +393,18 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_0jrb3xu_di" bpmnElement="IntermediateCatchEvent_0jrb3xu"> - <dc:Bounds x="18" y="79" width="36" height="36" /> + <dc:Bounds x="18" y="76" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="8" y="115" width="60" height="12" /> + <dc:Bounds x="8" y="112" width="60" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1i7t9hq_di" bpmnElement="SequenceFlow_1i7t9hq"> - <di:waypoint xsi:type="dc:Point" x="54" y="97" /> - <di:waypoint xsi:type="dc:Point" x="528" y="94" /> - <di:waypoint xsi:type="dc:Point" x="646" y="94" /> - <di:waypoint xsi:type="dc:Point" x="646" y="94" /> - <di:waypoint xsi:type="dc:Point" x="713" y="94" /> + <di:waypoint xsi:type="dc:Point" x="54" y="94" /> + <di:waypoint xsi:type="dc:Point" x="266" y="94" /> + <di:waypoint xsi:type="dc:Point" x="266" y="94" /> + <di:waypoint xsi:type="dc:Point" x="478" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="542" y="73" width="90" height="12" /> + <dc:Bounds x="236" y="88" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b"> @@ -410,30 +413,27 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <dc:Bounds x="-3" y="318" width="82" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4"> - <dc:Bounds x="554" y="260" width="100" height="80" /> - </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1hbesp9_di" bpmnElement="SequenceFlow_1hbesp9"> + <di:waypoint xsi:type="dc:Point" x="54" y="300" /> + <di:waypoint xsi:type="dc:Point" x="102" y="300" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="33" y="279" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1ojtwas_di" bpmnElement="CallActivity_1ojtwas"> <dc:Bounds x="971" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_04b21gb_di" bpmnElement="ScriptTask_04b21gb"> - <dc:Bounds x="774" y="260" width="100" height="80" /> + <dc:Bounds x="799" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1y7jr4t_di" bpmnElement="ScriptTask_1y7jr4t"> <dc:Bounds x="1145" y="260" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_13xfsff_di" bpmnElement="SequenceFlow_13xfsff"> - <di:waypoint xsi:type="dc:Point" x="437" y="300" /> - <di:waypoint xsi:type="dc:Point" x="554" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="450.5" y="279" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0bf6bzp_di" bpmnElement="SequenceFlow_0bf6bzp"> - <di:waypoint xsi:type="dc:Point" x="874" y="300" /> + <di:waypoint xsi:type="dc:Point" x="899" y="300" /> <di:waypoint xsi:type="dc:Point" x="971" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="877.5" y="279" width="90" height="12" /> + <dc:Bounds x="890" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0d0c20n_di" bpmnElement="SequenceFlow_0d0c20n"> @@ -463,18 +463,31 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <dc:Bounds x="1064" y="-61" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1m2tm19_di" bpmnElement="SequenceFlow_1m2tm19"> - <di:waypoint xsi:type="dc:Point" x="54" y="300" /> - <di:waypoint xsi:type="dc:Point" x="126" y="300" /> + <bpmndi:BPMNShape id="ScriptTask_0dpt36a_di" bpmnElement="ScriptTask_0dpt36a"> + <dc:Bounds x="102" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1a5mdd6_di" bpmnElement="ScriptTask_1a5mdd6"> + <dc:Bounds x="613" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0p6ba92_di" bpmnElement="SequenceFlow_0p6ba92"> + <di:waypoint xsi:type="dc:Point" x="713" y="300" /> + <di:waypoint xsi:type="dc:Point" x="799" y="300" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="756" y="279" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1s5aas9_di" bpmnElement="SequenceFlow_1s5aas9"> + <di:waypoint xsi:type="dc:Point" x="547" y="300" /> + <di:waypoint xsi:type="dc:Point" x="613" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="90" y="278" width="0" height="14" /> + <dc:Bounds x="580" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0y3i2k7_di" bpmnElement="SequenceFlow_0y3i2k7"> - <di:waypoint xsi:type="dc:Point" x="654" y="300" /> - <di:waypoint xsi:type="dc:Point" x="774" y="300" /> + <bpmndi:BPMNEdge id="SequenceFlow_1e5j351_di" bpmnElement="SequenceFlow_1e5j351"> + <di:waypoint xsi:type="dc:Point" x="202" y="300" /> + <di:waypoint xsi:type="dc:Point" x="276" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="714" y="278" width="0" height="14" /> + <dc:Bounds x="239" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java new file mode 100644 index 0000000000..f65dde1af5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java @@ -0,0 +1,615 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.buildingblock; + +import org.apache.commons.lang.SerializationUtils; +import org.camunda.bpm.engine.delegate.BpmnError; +import java.util.ArrayList; +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; +import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates; +import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoMetadata; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.oof.OofClient; +import org.onap.so.client.oof.OofValidator; +import org.onap.so.client.oof.beans.ModelInfo; +import org.onap.so.client.oof.beans.OofRequest; +import org.onap.so.client.oof.beans.OofRequestParameters; +import org.onap.so.client.oof.beans.PlacementDemand; +import org.onap.so.client.oof.beans.PlacementInfo; +import org.onap.so.client.oof.beans.RequestInfo; +import org.onap.so.client.oof.beans.ResourceModelInfo; +import org.onap.so.client.oof.beans.ServiceInfo; +import org.onap.so.client.oof.beans.SubscriberInfo; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriUtils; + +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + + +/** + * The oof homing building block obtains licensing and homing solutions for a given + * resource or set of resources. + * + */ +@Component("OofHoming") +public class OofHomingV2 { + + private static final Logger logger = LoggerFactory.getLogger(OofHomingV2.class); + private JsonUtils jsonUtils = new JsonUtils(); + @Autowired + private Environment env; + @Autowired + private OofClient client; + @Autowired + private OofValidator oofValidator; + @Autowired + private ExceptionBuilder exceptionUtil; + private static final String MODEL_NAME = "modelName"; + private static final String MODEL_INVARIANT_ID = "modelInvariantId"; + private static final String MODEL_VERSION_ID = "modelVersionId"; + private static final String MODEL_VERSION = "modelVersion"; + private static final String SERVICE_RESOURCE_ID = "serviceResourceId"; + private static final String RESOURCE_MODULE_NAME = "resourceModuleName"; + private static final String RESOURCE_MODEL_INFO = "resourceModelInfo"; + private static final String IDENTIFIER_TYPE = "identifierType"; + private static final String INVENTORY_TYPE = "inventoryType"; + private static final String SOLUTIONS = "solutions"; + private static final String RESOURCE_MISSING_DATA = "Resource does not contain: "; + private static final String SERVICE_MISSING_DATA = "Service Instance does not contain: "; + private static final String UNPROCESSABLE = "422"; + private static final int INTERNAL = 500; + + /** + * Generates the request payload then sends to Oof to perform homing and + * licensing for the provided demands + * + * @param execution + */ + public void callOof(BuildingBlockExecution execution){ + logger.trace("Started Sniro Homing Call Sniro"); + try{ + GeneralBuildingBlock bb = execution.getGeneralBuildingBlock(); + + RequestContext requestContext = bb.getRequestContext(); + RequestParameters requestParams = requestContext.getRequestParameters(); + String requestId = requestContext.getMsoRequestId(); + + ServiceInstance serviceInstance = bb.getCustomer().getServiceSubscription().getServiceInstances().get(0); + Customer customer = bb.getCustomer(); + + String timeout = execution.getVariable("timeout"); + if(isBlank(timeout)){ + timeout = env.getProperty("oof.timeout", "PT30M"); + } + + OofRequest request = new OofRequest(); + + RequestInfo requestInfo = (RequestInfo)buildRequestInfo(requestId, timeout); + request.setRequestInformation(requestInfo); + + ServiceInfo serviceInfo = buildServiceInfo(serviceInstance); + request.setServiceInformation(serviceInfo); + + PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams); + + ArrayList<PlacementDemand> placementDemands = buildPlacementDemands(serviceInstance); + placementInfo.setPlacementDemands(placementDemands); + request.setPlacementInformation(placementInfo); + + JSONObject licenseInfo = new JSONObject(); + + JSONArray licenseDemands = buildLicenseDemands(serviceInstance); + licenseInfo.put("licenseDemands", licenseDemands); + request.setLicenseInformation(licenseInfo.toString()); + + if(placementDemands.size() > 0 || licenseDemands.length() > 0){ + client.postDemands(request); + }else{ + logger.debug(SERVICE_MISSING_DATA + " resources eligible for homing or licensing"); + throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + " resources eligible for homing or licensing"); + } + + //Variables for ReceiveWorkflowMessage subflow + execution.setVariable("asyncCorrelator", requestId); + execution.setVariable("asyncMessageType", "OofResponse"); + execution.setVariable("asyncTimeout", timeout); + + logger.trace("Completed Oof Homing Call Oof"); + }catch(BpmnError e){ + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); + }catch(BadResponseException e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing oof request: " + e.getMessage()); + } + } + + /** + * Validates, processes, and sets the homing and licensing solutions that are returned by + * Oof + * + * @param execution + * @param asyncResponse + */ + public void processSolution(BuildingBlockExecution execution, String asyncResponse){ + logger.trace("Started Oof Homing Process Solution"); + try{ + oofValidator.validateSolution(asyncResponse); + ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); + + logger.debug("Processing Oof asyncronous response"); + JSONObject response = new JSONObject(asyncResponse); + if(response.has(SOLUTIONS)){ + JSONObject allSolutions = response.getJSONObject(SOLUTIONS); + if(allSolutions.has("placementSolutions")){ + JSONArray placementSolutions = allSolutions.getJSONArray("placementSolutions"); + for(int i = 0; i < placementSolutions.length(); i++){ + JSONArray placements = placementSolutions.getJSONArray(i); + processPlacementSolution(serviceInstance, placements, i); + } + } + if(allSolutions.has("licenseSolutions")){ + JSONArray licenseSolutions = allSolutions.getJSONArray("licenseSolutions"); + if(licenseSolutions.length() > 0){ + processLicenseSolution(serviceInstance, licenseSolutions); + } + } + }else{ + throw new BpmnError(UNPROCESSABLE, "Oof response does not contain: " + SOLUTIONS); + } + + execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock()); + + logger.trace("Completed Oof Homing Process Solution"); + }catch(BpmnError e){ + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); + }catch(BadResponseException e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing Oof asynchronous response: " + e.getMessage()); + } + } + + /** + * Builds the request information section for the homing/licensing request + * + * @throws Exception + */ + private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{ + logger.trace("Building request information"); + RequestInfo requestInfo = new RequestInfo(); + if(requestId != null){ + String host = env.getProperty("mso.workflow.message.endpoint"); + String callbackUrl = host + "/" + UriUtils.encodePathSegment("OofResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8"); + + Duration d = Duration.parse(timeout); + long timeoutSeconds = d.getSeconds(); + + requestInfo.setTransactionId(requestId); + requestInfo.setRequestId(requestId); + requestInfo.setCallbackUrl(callbackUrl); + requestInfo.setSourceId("mso"); + requestInfo.setRequestType("create"); + requestInfo.setTimeout(timeoutSeconds); + } else{ + throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId"); + } + return requestInfo; + } + + /** + * Builds the request information section for the homing/licensing request + * + */ + private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){ + logger.trace("Building service information"); + ServiceInfo info = new ServiceInfo(); + ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance(); + if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){ + info.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution + info.setServiceName(modelInfo.getServiceType()); + } + info.setModelInfo(buildModelInfo(serviceInstance.getModelInfoServiceInstance())); + }else{ + throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID); + } + return info; + } + + /** + * Builds initial section of placement info for the homing/licensing request + * + */ + private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){ + PlacementInfo placementInfo = new PlacementInfo(); + if(customer != null){ + logger.debug("Adding subscriber to placement information"); + SubscriberInfo subscriberInfo = new SubscriberInfo(); + subscriberInfo.setGlobalSubscriberId(customer.getGlobalCustomerId()); + subscriberInfo.setSubscriberName(customer.getSubscriberName()); + subscriberInfo.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId()); + placementInfo.setSubscriberInfo(subscriberInfo); + if(requestParams != null){ + logger.debug("Adding request parameters to placement information"); + OofRequestParameters oofRequestParams = new OofRequestParameters(); + for (Map requestParam : requestParams.getUserParams()){ + if (requestParam.containsKey("customerLatitude")){ + oofRequestParams.setCustomerLatitude(requestParam.get("customerLatitude").toString()); + } + if (requestParam.containsKey("customerLongitude")){ + oofRequestParams.setCustomerLongitude(requestParam.get("customerLongitude").toString()); + } + if (requestParam.containsKey("customerName")){ + oofRequestParams.setCustomerName(requestParam.get("customerName").toString()); + } + } + placementInfo.setRequestParameters(oofRequestParams); + } + }else{ + throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer"); + } + return placementInfo; + + } + + /** + * Builds the placement demand list for the homing/licensing request + * + */ + private ArrayList<PlacementDemand> buildPlacementDemands(ServiceInstance serviceInstance){ + logger.trace("Building placement information demands"); + ArrayList<PlacementDemand> placementDemands = new ArrayList(); + + List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources(); + if(!allottedResourceList.isEmpty()){ + logger.debug("Adding allotted resources to placement demands list"); + for(AllottedResource ar : allottedResourceList){ + if(isBlank(ar.getId())){ + ar.setId(UUID.randomUUID().toString()); + } + PlacementDemand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource()); + //addCandidates(ar, demand); + placementDemands.add(demand); + } + } + List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks(); + if(!vpnBondingLinkList.isEmpty()){ + logger.debug("Adding vpn bonding links to placement demands list"); + for(VpnBondingLink vbl:vpnBondingLinkList){ + List<ServiceProxy> serviceProxyList = vbl.getServiceProxies(); + for(ServiceProxy sp : serviceProxyList){ + if(isBlank(sp.getId())){ + sp.setId(UUID.randomUUID().toString()); + } + PlacementDemand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy()); + //addCandidates(sp, demand); + placementDemands.add(demand); + } + } + } + return placementDemands; + } + + /** + * Builds the license demand list for the homing/licensing request + * + */ + private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){ + logger.trace("Building license information"); + JSONArray licenseDemands = new JSONArray(); + List<GenericVnf> vnfList = serviceInstance.getVnfs(); + if(!vnfList.isEmpty()){ + logger.debug("Adding vnfs to license demands list"); + for(GenericVnf vnf : vnfList){ + JSONObject demand = buildLicenseDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf()); + licenseDemands.put(demand); + } + } + return licenseDemands; + } + + /** + * Builds a single license demand object + * + */ + private JSONObject buildLicenseDemand(String id, ModelInfoMetadata metadata){ + logger.debug("Building demand for service or resource: " + id); + JSONObject demand = new JSONObject(); + if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){ + demand.put(SERVICE_RESOURCE_ID, id); + demand.put(RESOURCE_MODULE_NAME, metadata.getModelInstanceName()); + demand.put(RESOURCE_MODEL_INFO, buildModelInfo(metadata)); + }else{ + throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName"); + } + return demand; + } + + /** + * Builds a single demand object + * + */ + private PlacementDemand buildDemand(String id, ModelInfoMetadata metadata){ + logger.debug("Building demand for service or resource: " + id); + PlacementDemand placementDemand = new PlacementDemand(); + if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){ + placementDemand.setServiceResourceId(id); + placementDemand.setResourceModuleName(metadata.getModelInstanceName()); + placementDemand.setResourceModelInfo((ResourceModelInfo) buildModelInfo(metadata)); + }else{ + throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName"); + } + return placementDemand; + } + + /** + * Builds the resource model info section + * + */ + private ModelInfo buildModelInfo(ModelInfoMetadata metadata){ + ModelInfo modelInfo = new ModelInfo(); + String invariantUuid = metadata.getModelInvariantUuid(); + String modelUuid = metadata.getModelUuid(); + if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){ + modelInfo.setModelInvariantId(invariantUuid); + modelInfo.setModelVersionId(modelUuid); + modelInfo.setModelName(metadata.getModelName()); + modelInfo.setModelVersion(metadata.getModelVersion()); + }else if(isNotBlank(invariantUuid)){ + throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID); + }else{ + throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_INVARIANT_ID); + } + return modelInfo; + } + + /** + * Adds required, excluded, and existing candidates to a demand + * + */ + private void addCandidates(SolutionCandidates candidates, JSONObject demand){ + List<Candidate> required = candidates.getRequiredCandidates(); + List<Candidate> excluded = candidates.getExcludedCandidates(); + if(!required.isEmpty()){ + demand.put("requiredCandidates", required); + } + if(!excluded.isEmpty()){ + demand.put("excludedCandidates", excluded); + } + //TODO support existing candidates + } + + /** + * Processes the license solutions and sets to the corresponding generic vnf + * + */ + private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){ + List<GenericVnf> vnfs = serviceInstance.getVnfs(); + + logger.debug("Processing the license solution"); + for(int i = 0; i < licenseSolutions.length(); i++){ + JSONObject licenseSolution = licenseSolutions.getJSONObject(i); + for(GenericVnf vnf:vnfs){ + if(licenseSolution.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){ + License license = new License(); + JSONArray entitlementPools = licenseSolution.getJSONArray("entitlementPoolUUID"); + List<String> entitlementPoolsList = jsonUtils.StringArrayToList(entitlementPools); + license.setEntitlementPoolUuids(entitlementPoolsList); + JSONArray licenseKeys = licenseSolution.getJSONArray("licenseKeyGroupUUID"); + List<String> licenseKeysList = jsonUtils.StringArrayToList(licenseKeys); + license.setLicenseKeyGroupUuids(licenseKeysList); + + vnf.setLicense(license); + } + } + } + } + + /** + * Processes a placement solution list then correlates and sets each placement solution + * to its corresponding resource + * + */ + private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i){ + List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks(); + List<AllottedResource> allottes = serviceInstance.getAllottedResources(); + List<GenericVnf> vnfs = serviceInstance.getVnfs(); + + logger.debug("Processing placement solution " + i+1); + for(int p = 0; p < placements.length(); p++){ + JSONObject placement = placements.getJSONObject(p); + SolutionInfo solutionInfo = new SolutionInfo(); + solutionInfo.setSolutionId(i + 1); + search: { + for(VpnBondingLink vbl:links){ + List<ServiceProxy> proxies = vbl.getServiceProxies(); + for(ServiceProxy sp:proxies){ + if(placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())){ + if(i > 0){ + if(p % 2 == 0){ + VpnBondingLink vblNew = (VpnBondingLink) SerializationUtils.clone(vbl); + vblNew.setVpnBondingLinkId(UUID.randomUUID().toString()); + links.add(vblNew); + } + links.get(links.size() - 1).getServiceProxy(sp.getId()).setServiceInstance(setSolution(solutionInfo, placement)); + }else{ + sp.setServiceInstance(setSolution(solutionInfo, placement)); + } + break search; + } + } + } + for(AllottedResource ar:allottes){ + if(placement.getString(SERVICE_RESOURCE_ID).equals(ar.getId())){ + ar.setParentServiceInstance(setSolution(solutionInfo, placement)); + break search; + } + } + for(GenericVnf vnf:vnfs){ + if(placement.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){ + ServiceInstance si = setSolution(solutionInfo, placement); + serviceInstance.setSolutionInfo(si.getSolutionInfo()); + serviceInstance.getVnfs().add(si.getVnfs().get(0)); + break search; + } + } + } + } + } + + + /** + * Creates and sets necessary pojos with placement solution data for a given demand + * + */ + private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement){ + logger.debug("Mapping placement solution"); + String invalidMessage = "Oof Response contains invalid: "; + + JSONObject solution = placement.getJSONObject("solution"); + String identifierType = solution.getString(IDENTIFIER_TYPE); + List<String> identifiersList = jsonUtils.StringArrayToList(solution.getJSONArray("identifiers").toString()); + String identifierValue = identifiersList.get(0); + + JSONArray assignments = placement.getJSONArray("assignmentInfo"); + Map<String, String> assignmentsMap = jsonUtils.entryArrayToMap(assignments.toString(), "key", "value"); + solutionInfo.setRehome(Boolean.parseBoolean(assignmentsMap.get("isRehome"))); + String type = placement.getString(INVENTORY_TYPE); + + ServiceInstance si = new ServiceInstance(); + CloudRegion cloud = setCloud(assignmentsMap); + if(type.equals("service")){ + if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){ + solutionInfo.setHomed(true); + si.setServiceInstanceId(identifierValue); + si.setOrchestrationStatus(OrchestrationStatus.CREATED); + cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId")); + if(assignmentsMap.containsKey("vnfHostName")){ + logger.debug("Resources has been homed to a vnf"); + GenericVnf vnf = setVnf(assignmentsMap); + vnf.setCloudRegion(cloud); + si.getVnfs().add(vnf); + + }else if(assignmentsMap.containsKey("primaryPnfName")){ + logger.debug("Resources has been homed to a pnf"); + Pnf priPnf = setPnf(assignmentsMap, "primary"); + priPnf.setCloudRegion(cloud); + si.getPnfs().add(priPnf); + if(assignmentsMap.containsKey("secondaryPnfName")){ + Pnf secPnf = setPnf(assignmentsMap, "secondary"); + secPnf.setCloudRegion(cloud); + si.getPnfs().add(secPnf); + } + } + }else{ + logger.debug(invalidMessage + IDENTIFIER_TYPE); + throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE); + } + }else if(type.equals("cloud")){ + if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){ + logger.debug("Resources has been homed to a cloud region"); + cloud.setLcpCloudRegionId(identifierValue); + solutionInfo.setHomed(false); + solutionInfo.setTargetedCloudRegion(cloud); + si.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + }else{ + logger.debug(invalidMessage + IDENTIFIER_TYPE); + throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE); + } + }else{ + logger.debug(invalidMessage + INVENTORY_TYPE); + throw new BpmnError(UNPROCESSABLE, invalidMessage + INVENTORY_TYPE); + } + si.setSolutionInfo(solutionInfo); + return si; + } + + /** + * Sets the cloud data to a cloud region object + * + */ + private CloudRegion setCloud(Map<String, String> assignmentsMap){ + CloudRegion cloud = new CloudRegion(); + cloud.setCloudOwner(assignmentsMap.get("cloudOwner")); + cloud.setCloudRegionVersion(assignmentsMap.get("aicVersion")); + cloud.setComplex(assignmentsMap.get("aicClli")); + return cloud; + } + + /** + * Sets the vnf data to a generic vnf object + * + */ + private GenericVnf setVnf(Map<String, String> assignmentsMap){ + GenericVnf vnf = new GenericVnf(); + vnf.setOrchestrationStatus(OrchestrationStatus.CREATED); + vnf.setVnfName(assignmentsMap.get("vnfHostName")); + vnf.setVnfId(assignmentsMap.get("vnfId")); + return vnf; + } + + /** + * Sets the pnf data to a pnf object + * + */ + private Pnf setPnf(Map<String, String> assignmentsMap, String role){ + Pnf pnf = new Pnf(); + pnf.setRole(role); + pnf.setOrchestrationStatus(OrchestrationStatus.CREATED); + pnf.setPnfName(assignmentsMap.get(role + "PnfName")); + return pnf; + } + + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index 66de6b389d..7bc48519b0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -244,8 +244,8 @@ public class SniroHomingV2 { ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance(); if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){ info.put("serviceInstanceId", serviceInstance.getServiceInstanceId()); - if(modelInfo.getServiceType() != null){ //temp solution - info.put("serviceName", serviceInstance.getModelInfoServiceInstance().getServiceType()); + if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution + info.put("serviceName", modelInfo.getServiceType()); } info.put("modelInfo", buildModelInfo(serviceInstance.getModelInfoServiceInstance())); }else{ diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java new file mode 100644 index 0000000000..94eead2d05 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.activity; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables; +import org.camunda.bpm.engine.variable.VariableMap; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component("ExecuteActivity") +public class ExecuteActivity implements JavaDelegate { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteActivity.class); + private static final String G_BPMN_REQUEST = "bpmnRequest"; + private static final String VNF_TYPE = "vnfType"; + private static final String G_ACTION = "requestAction"; + private static final String G_REQUEST_ID = "mso-request-id"; + private static final String VNF_ID = "vnfId"; + private static final String SERVICE_INSTANCE_ID = "serviceInstanceId"; + + private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation"; + private static final String ACTIVITY_PREFIX = "activity:"; + + private ObjectMapper mapper = new ObjectMapper(); + + @Autowired + private RuntimeService runtimeService; + @Autowired + private ExceptionBuilder exceptionBuilder; + + @Override + public void execute(DelegateExecution execution) throws Exception { + final String requestId = (String) execution.getVariable(G_REQUEST_ID); + + try { + final String implementationString = execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE); + msoLogger.debug("activity implementation String: " + implementationString); + if (!implementationString.startsWith(ACTIVITY_PREFIX)) { + buildAndThrowException(execution, "Implementation attribute has a wrong format"); + } + String activityName = implementationString.replaceFirst(ACTIVITY_PREFIX, ""); + msoLogger.info("activityName is: " + activityName); + + BuildingBlock buildingBlock = buildBuildingBlock(activityName); + ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock); + + Map<String, Object> variables = new HashMap<>(); + variables.put("buildingBlock", executeBuildingBlock); + variables.put("mso-request-id", requestId); + variables.put("retryCount", 1); + + ProcessInstanceWithVariables buildingBlockResult = runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables).executeWithVariablesInReturn(); + VariableMap variableMap = buildingBlockResult.getVariables(); + + WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException"); + if (workflowException != null) { + msoLogger.error("Workflow exception is: " + workflowException.getErrorMessage()); + } + execution.setVariable("WorkflowException", workflowException); + } + catch (Exception e) { + buildAndThrowException(execution, e.getMessage()); + } + } + + protected BuildingBlock buildBuildingBlock(String activityName) { + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName(activityName); + buildingBlock.setMsoId(UUID.randomUUID().toString()); + buildingBlock.setKey(""); + buildingBlock.setIsVirtualLink(false); + buildingBlock.setVirtualLinkKey(""); + return buildingBlock; + } + + protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId, + BuildingBlock buildingBlock) throws Exception { + ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); + String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST); + ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); + RequestDetails requestDetails = sIRequest.getRequestDetails(); + executeBuildingBlock.setaLaCarte(true); + executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION)); + executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID)); + executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE)); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID)); + workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID)); + executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds); + executeBuildingBlock.setRequestId(requestId); + executeBuildingBlock.setBuildingBlock(buildingBlock); + executeBuildingBlock.setRequestDetails(requestDetails); + return executeBuildingBlock; + } + + protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError, msg, ex); + execution.setVariable("ExecuteActivityErrorMessage", msg); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); + } + + protected void buildAndThrowException(DelegateExecution execution, String msg) { + msoLogger.error(msg); + execution.setVariable("ExecuteActuvityErrorMessage", msg); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index 554af37924..db54b219a9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils; import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; @@ -72,8 +73,8 @@ public class VnfAdapterImpl { } public void postProcessVnfAdapter(BuildingBlockExecution execution) { - try { - String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response"); + try { + String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response"); if (!StringUtils.isEmpty( vnfAdapterResponse)) { Object vnfRestResponse = unMarshal(vnfAdapterResponse); if(vnfRestResponse instanceof CreateVfModuleResponse) { @@ -98,8 +99,15 @@ public class VnfAdapterImpl { execution.setVariable("heatStackId", heatStackId); }else{ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response."); - } - } + } + } else if(vnfRestResponse instanceof DeleteVolumeGroupResponse) { + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted(); + if(null!= volumeGroupDelete && volumeGroupDelete) { + volumeGroup.setHeatStackId(null); + execution.setVariable("heatStackId", null); + } + } } } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -116,7 +124,7 @@ public class VnfAdapterImpl { XMLReader xmlReader = spf.newSAXParser().getXMLReader(); JAXBContext jaxbContext = JAXBContext.newInstance(CreateVfModuleResponse.class, - CreateVolumeGroupResponse.class,DeleteVfModuleResponse.class); + CreateVolumeGroupResponse.class,DeleteVfModuleResponse.class,DeleteVolumeGroupResponse.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); InputSource inputSource = new InputSource(new StringReader(input)); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java new file mode 100644 index 0000000000..798837fa7d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.appc.tasks; + +import java.util.HashMap; +import java.util.List; +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.client.appc.ApplicationControllerAction; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AppcRunTasks { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AppcRunTasks.class); + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private CatalogDbClient catalogDbClient; + @Autowired + private ApplicationControllerAction appCClient; + + public void preProcessActivity(BuildingBlockExecution execution) { + execution.setVariable("actionSnapshot", Action.Snapshot); + execution.setVariable("actionLock", Action.Lock); + execution.setVariable("actionUnlock", Action.Unlock); + execution.setVariable("actionUpgradePreCheck", Action.UpgradePreCheck); + execution.setVariable("actionUpgradePostCheck", Action.UpgradePostCheck); + execution.setVariable("actionQuiesceTraffic", Action.QuiesceTraffic); + execution.setVariable("actionUpgradeBackup", Action.UpgradeBackup); + execution.setVariable("actionUpgradeSoftware", Action.UpgradeSoftware); + execution.setVariable("actionResumeTraffic", Action.ResumeTraffic); + execution.setVariable("actionStop", Action.Stop); + execution.setVariable("actionStart", Action.Start); + execution.setVariable("rollbackVnfStop", false); + execution.setVariable("rollbackVnfLock", false); + execution.setVariable("rollbackQuiesceTraffic", false); + } + + public void runAppcCommand(BuildingBlockExecution execution, Action action) { + msoLogger.trace("Start runAppcCommand "); + String appcCode = "1002"; + String appcMessage = ""; + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + GenericVnf vnf = null; + try { + vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch (BBObjectNotFoundException e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists"); + } + String vnfId = vnf.getVnfId(); + String msoRequestId = gBBInput.getRequestContext().getMsoRequestId(); + String vnfName = vnf.getVnfName(); + String vnfType = vnf.getVnfType(); + + String aicIdentity = execution.getVariable("aicIdentity"); + String vnfHostIpAddress = vnf.getIpv4OamAddress(); + String vmIdList = execution.getVariable("vmIdList"); + String vserverIdList = execution.getVariable("vserverIdList"); + String identityUrl = execution.getVariable("identityUrl"); + + ControllerSelectionReference controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString()); + String controllerType = controllerSelectionReference.getControllerName(); + + String vfModuleId = null; + VfModule vfModule = null; + try { + vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + } catch (BBObjectNotFoundException e) { + } + if (vfModule != null) { + vfModuleId = vfModule.getVfModuleId(); + } + + HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList, vserverIdList, + identityUrl, vfModuleId); + Optional<String> payload = null; + RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters(); + if(requestParameters != null){ + String pay = requestParameters.getPayload(); + if (pay != null) { + payload = Optional.of(pay); + } + } + msoLogger.debug("Running APP-C action: " + action.toString()); + msoLogger.debug("VNFID: " + vnfId); + appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + appcCode = appCClient.getErrorCode(); + appcMessage = appCClient.getErrorMessage(); + mapRollbackVariables(execution, action, appcCode); + } + catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + appcMessage = e.getMessage(); + } + + msoLogger.error("Error Message: " + appcMessage); + msoLogger.error("ERROR CODE: " + appcCode); + msoLogger.trace("End of runAppCommand "); + if (appcCode != null && !appcCode.equals("0")) { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); + } + } + + protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) { + if (appcCode.equals("0") && action != null) { + if (action.equals(Action.Lock)) { + execution.setVariable("rollbackVnfLock", true); + } else if (action.equals(Action.Unlock)) { + execution.setVariable("rollbackVnfLock", false); + } else if (action.equals(Action.Start)) { + execution.setVariable("rollbackVnfStop", false); + } else if (action.equals(Action.Stop)) { + execution.setVariable("rollbackVnfStop", true); + } else if (action.equals(Action.QuiesceTraffic)) { + execution.setVariable("rollbackQuiesceTraffic", true); + } else if (action.equals(Action.ResumeTraffic)) { + execution.setVariable("rollbackQuiesceTraffic", false); + } + } + } + + private HashMap<String,String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress, + String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) { + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", vnfName); + payloadInfo.put("aicIdentity", aicIdentity); + payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress); + payloadInfo.put("vmIdList", vmIdList); + payloadInfo.put("vserverIdList", vserverIdList); + payloadInfo.put("identityUrl", identityUrl); + payloadInfo.put("vfModuleId",vfModuleId); + return payloadInfo; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index 39f4c7822a..5f263e8b4b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -7,9 +7,9 @@ * 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. @@ -73,7 +73,7 @@ public class SDNCAssignTasks { public void assignVnf(BuildingBlockExecution execution) { try { - GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + GeneralBuildingBlock gBBInput = execution.getVariable("generalBuildingBlock"); RequestContext requestContext = gBBInput.getRequestContext(); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); @@ -85,7 +85,7 @@ public class SDNCAssignTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } - + public void assignVfModule(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -101,14 +101,14 @@ public class SDNCAssignTasks { } Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - - String response = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext); + + String response = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext); execution.setVariable("SDNCAssignResponse_"+ vfModule.getVfModuleId(), response); - } catch (Exception ex) { + } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } - + /** * BPMN access method to perform Assign action on SDNC for L3Network * @param execution @@ -117,14 +117,14 @@ public class SDNCAssignTasks { public void assignNetwork(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - + Customer customer = gBBInput.getCustomer(); RequestContext requestContext = gBBInput.getRequestContext(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - + sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java new file mode 100644 index 0000000000..ec2ccdf202 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.serviceinstancebeans.RequestReferences; +import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class FlowCompletionTasks { + + private static final Logger logger = LoggerFactory.getLogger(FlowCompletionTasks.class); + + @Autowired + private RequestsDbClient requestDbclient; + + public void updateRequestDbStatus(BuildingBlockExecution execution) { + try { + String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId(); + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + if (workflowException == null) { + request.setStatusMessage("RequestCompletedSuccessfully"); + request.setRequestStatus("COMPLETE"); + + } + else { + request.setStatusMessage(workflowException.getErrorMessage()); + request.setRequestStatus("FAILED"); + } + request.setProgress(100L); + request.setLastModifiedBy("CamundaBPMN"); + + requestDbclient.updateInfraActiveRequests(request); + } catch (Exception e) { + logger.error("Unable to save the updated request status to the DB",e); + } + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index a998f6934f..2d5638c2b7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -35,6 +35,7 @@ import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; +import org.slf4j.LoggerFactory; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.Relationship; @@ -61,8 +62,6 @@ import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; @@ -71,6 +70,7 @@ import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.onap.so.serviceinstancebeans.VfModules; import org.onap.so.serviceinstancebeans.Vnfs; +import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -79,6 +79,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class WorkflowAction { + private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage"; + private static final String SERVICE_INSTANCES = "serviceInstances"; + private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = "WorkflowAction was unable to verify if the instance name already exist in AAI."; private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow"; private static final String G_ACTION = "requestAction"; private static final String G_CURRENT_SEQUENCE = "gCurrentSequence"; @@ -100,7 +103,8 @@ public class WorkflowAction { private static final String CREATEINSTANCE = "createInstance"; private static final String USERPARAMSERVICE = "service"; private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances"; - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowAction.class); + private static final String HOMINGSOLUTION = "Homing_Solution"; + private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class); @Autowired protected BBInputSetup bbInputSetup; @@ -157,6 +161,18 @@ public class WorkflowAction { execution.setVariable("resourceId", resourceId); execution.setVariable("resourceType", resourceType); + if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters() + .getUserParams(); + for (Map<String, Object> params : userParams) { + if (params.containsKey(HOMINGSOLUTION)) { + execution.setVariable("homing", true); + execution.setVariable("callHoming", true); + execution.setVariable("homingSolution", params.get(HOMINGSOLUTION)); + } + } + } + if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); @@ -239,7 +255,7 @@ public class WorkflowAction { for(WorkflowType type : WorkflowType.values()){ foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " "; } - msoLogger.info("Found " + foundObjects); + logger.info("Found {}", foundObjects); if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); @@ -247,7 +263,7 @@ public class WorkflowAction { flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId, resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails); if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) { - msoLogger.info("Sorting for Vlan Tagging"); + logger.info("Sorting for Vlan Tagging"); flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction); } if (resourceType == WorkflowType.SERVICE @@ -267,9 +283,9 @@ public class WorkflowAction { throw new IllegalStateException("Macro did not come up with a valid execution path."); } - msoLogger.info("List of BuildingBlocks to execute:"); + logger.info("List of BuildingBlocks to execute:"); for (ExecuteBuildingBlock ebb : flowsToExecute) { - msoLogger.info(ebb.getBuildingBlock().getBpmnFlowName()); + logger.info(ebb.getBuildingBlock().getBpmnFlowName()); } execution.setVariable(G_CURRENT_SEQUENCE, 0); @@ -296,7 +312,7 @@ public class WorkflowAction { private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) { for(Pair<WorkflowType,String> pair : aaiResourceIds){ - msoLogger.debug(pair.getValue0() + ", " + pair.getValue1()); + logger.debug(pair.getValue0() + ", " + pair.getValue1()); } Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { @@ -389,12 +405,12 @@ public class WorkflowAction { if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) { List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations(); if(customizations.isEmpty()) { - msoLogger.debug("No Collections found. CollectionResourceCustomization list is empty."); + logger.debug("No Collections found. CollectionResourceCustomization list is empty."); }else{ CollectionResourceCustomization collectionResourceCustomization = findCatalogNetworkCollection(execution, service); if(collectionResourceCustomization!=null){ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,collectionResourceCustomization.getModelCustomizationUUID(),false)); - msoLogger.debug("Found a network collection"); + logger.debug("Found a network collection"); if(collectionResourceCustomization.getCollectionResource()!=null){ if(collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null){ String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType(); @@ -413,7 +429,7 @@ public class WorkflowAction { minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity(); } } - msoLogger.debug("minNetworks: " + minNetworks); + logger.debug("minNetworks: {}" , minNetworks); CollectionNetworkResourceCustomization collectionNetworkResourceCust = null; for(CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup.getCollectionNetworkResourceCustomizations()) { if(collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) { @@ -429,21 +445,21 @@ public class WorkflowAction { } } } else { - msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType); + logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}" , toscaNodeType); } }else{ - msoLogger.debug("No Instance Group found for network collection."); + logger.debug("No Instance Group found for network collection."); } }else{ - msoLogger.debug("No Network Collection found. collectionResource is null"); + logger.debug("No Network Collection found. collectionResource is null"); } } else { - msoLogger.debug("No Network Collection Customization found"); + logger.debug("No Network Collection Customization found"); } } if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) { if (service.getNetworkCustomizations() == null) { - msoLogger.debug("No networks were found on this service model"); + logger.debug("No networks were found on this service model"); } else { for (int i = 0; i < service.getNetworkCustomizations().size(); i++) { resourceCounter.add(new Resource(WorkflowType.NETWORK,service.getNetworkCustomizations().get(i).getModelCustomizationUUID(),false)); @@ -491,7 +507,7 @@ public class WorkflowAction { } } if (serviceInstanceMSO.getCollection() != null) { - msoLogger.debug("found networkcollection"); + logger.debug("found networkcollection"); aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId())); resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false)); } @@ -613,9 +629,10 @@ public class WorkflowAction { } } } - msoLogger.debug("found " + configurations.size() + " configurations"); + logger.debug("found {} configurations" , configurations.size() ); return configurations; } catch (Exception ex){ + logger.error("Error in finding configurations", ex); return configurations; } } @@ -649,7 +666,7 @@ public class WorkflowAction { Boolean generated = false; if (m.find()) { - msoLogger.debug("found match on " + uri + ": " + m); + logger.debug("found match on {} : {} " , uri , m); String type = m.group("type"); String id = m.group("id"); String action = m.group("action"); @@ -657,7 +674,7 @@ public class WorkflowAction { throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri); } if (action == null) { - if (type.equals("serviceInstances") && (id == null || id.equals("assign"))) { + if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) { id = UUID.randomUUID().toString(); generated = true; } @@ -727,9 +744,9 @@ public class WorkflowAction { } return generatedResourceId; } catch (Exception ex) { - msoLogger.error(ex); + logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex); throw new IllegalStateException( - "WorkflowAction was unable to verify if the instance name already exist in AAI."); + WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI); } } @@ -737,7 +754,7 @@ public class WorkflowAction { if (!type.matches(supportedTypes)) { return type; } else { - if (type.equals("serviceInstances")) { + if (type.equals(SERVICE_INSTANCES)) { return SERVICE; } else { return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1); @@ -948,20 +965,19 @@ public class WorkflowAction { } protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, ex); - execution.setVariable("WorkflowActionErrorMessage", msg); + logger.error(msg, ex); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } protected void buildAndThrowException(DelegateExecution execution, String msg) { - msoLogger.error(msg); - execution.setVariable("WorkflowActionErrorMessage", msg); + logger.error(msg); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } public void handleRuntimeException (DelegateExecution execution){ - StringBuffer wfeExpMsg = new StringBuffer("Runtime error "); + StringBuilder wfeExpMsg = new StringBuilder("Runtime error "); String runtimeErrorMessage = null; try{ String javaExpMsg = (String) execution.getVariable("BPMN_javaExpMsg"); @@ -969,10 +985,10 @@ public class WorkflowAction { wfeExpMsg = wfeExpMsg.append(": ").append(javaExpMsg); } runtimeErrorMessage = wfeExpMsg.toString(); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, runtimeErrorMessage, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, runtimeErrorMessage); - execution.setVariable("WorkflowActionErrorMessage", runtimeErrorMessage); + logger.error(runtimeErrorMessage); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, runtimeErrorMessage); } catch (Exception e){ + logger.error("Runtime error", e); //if runtime message was mulformed runtimeErrorMessage = "Runtime error"; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index ab29e21dea..d3f817c2a5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -30,13 +30,13 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; - import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestReferences; import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -50,7 +50,7 @@ public class WorkflowActionBBTasks { private static final String G_REQUEST_ID = "mso-request-id"; private static final String G_ALACARTE = "aLaCarte"; private static final String G_ACTION = "requestAction"; - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowActionBBTasks.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @Autowired private RequestsDbClient requestDbclient; @@ -84,10 +84,14 @@ public class WorkflowActionBBTasks { } public void updateFlowStatistics(DelegateExecution execution) { - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); - if(currentSequence > 1) { - InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence); - requestDbclient.updateInfraActiveRequests(request); + try{ + int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + if(currentSequence > 1) { + InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence); + requestDbclient.updateInfraActiveRequests(request); + } + }catch (Exception ex){ + logger.warn("Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid."); } } @@ -146,7 +150,7 @@ public class WorkflowActionBBTasks { .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); WorkflowContextHolder.getInstance().processCallback(processKey, execution.getProcessInstanceId(), requestId, callbackResponse); - msoLogger.info("Successfully sent sync ack."); + logger.info("Successfully sent sync ack."); } public void sendErrorSyncAck(DelegateExecution execution) { @@ -169,7 +173,7 @@ public class WorkflowActionBBTasks { callbackResponse); execution.setVariable("sentSyncResponse", true); } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()); + logger.error(" Sending Sync Error Activity Failed. {}" , ex.getMessage(), ex); } } @@ -217,7 +221,7 @@ public class WorkflowActionBBTasks { } public void checkRetryStatus(DelegateExecution execution) { - if (execution.getVariable("handlingCode") == "Retry") { + if (execution.getVariable("handlingCode").equals("Retry")) { int currSequence = (int) execution.getVariable("gCurrentSequence"); currSequence--; execution.setVariable("gCurrentSequence", currSequence); @@ -235,8 +239,9 @@ public class WorkflowActionBBTasks { List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution .getVariable("flowsToExecute"); List<ExecuteBuildingBlock> rollbackFlows = new ArrayList(); - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE) - 1; - for (int i = flowsToExecute.size() - 1; i >= 0; i--) { + int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE) + 1; + int listSize = flowsToExecute.size(); + for (int i = listSize - 1; i >= 0; i--) { if (i >= currentSequence) { flowsToExecute.remove(i); } else { @@ -244,11 +249,13 @@ public class WorkflowActionBBTasks { BuildingBlock bb = flowsToExecute.get(i).getBuildingBlock(); String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName(); if (flowName.contains("Assign")) { - flowName = "Unassign" + flowName.substring(7, flowName.length()); + flowName = "Unassign" + flowName.substring(6, flowName.length()); } else if (flowName.contains("Create")) { flowName = "Delete" + flowName.substring(6, flowName.length()); } else if (flowName.contains("Activate")) { flowName = "Deactivate" + flowName.substring(8, flowName.length()); + }else{ + continue; } flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName); rollbackFlows.add(flowsToExecute.get(i)); @@ -258,15 +265,13 @@ public class WorkflowActionBBTasks { execution.setVariable("isRollbackNeeded", false); else execution.setVariable("isRollbackNeeded", true); - execution.setVariable("flowsToExecute", rollbackFlows); execution.setVariable("handlingCode", "PreformingRollback"); } public void abortCallErrorHandling(DelegateExecution execution) { String msg = "Flow has failed. Rainy day handler has decided to abort the process."; - Exception exception = new Exception(msg); - msoLogger.error(exception); + logger.error(msg); throw new BpmnError(msg); } @@ -280,14 +285,14 @@ public class WorkflowActionBBTasks { request.setStatusMessage(exception.getErrorMessage()); } catch (Exception ex) { //log error and attempt to extact WorkflowExceptionMessage - msoLogger.error(ex); + logger.error("Failed to extract workflow exception from execution.",ex); } if (errorMsg == null){ try { errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); request.setStatusMessage(errorMsg); } catch (Exception ex) { - msoLogger.error(ex); + logger.error("Failed to extract workflow exception message from WorkflowException",ex); request.setStatusMessage("Unexpected Error in BPMN"); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java index 67e7afb599..ec202b8a3f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java @@ -31,6 +31,7 @@ import javax.annotation.PostConstruct; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; @@ -108,8 +109,9 @@ public class VnfAdapterObjectMapper { final String USER_PARAM_NAME_KEY = "name"; final String USER_PARAM_VALUE_KEY = "value"; // sdncVfModuleQueryResponse will not be available in aLaCarte case - if (sdncVfModuleQueryResponse != null) { - GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class); + if (sdncVfModuleQueryResponse != null) { + GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class); + GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology(); buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters()); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 11a694140c..2b58b7bdd7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -31,11 +31,13 @@ import java.util.Map; import java.util.Optional; import javax.annotation.PostConstruct; +import javax.validation.Valid; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiSubInterfaceNetworkData; import org.onap.sdnc.northbound.client.model.GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleassignmentsVfModuleAssignments; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; @@ -52,6 +54,7 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmN import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmNetworks; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmnamesVnfcNames; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfNetworkData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfTopology; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcNetworkData; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcNetworkData; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts; @@ -157,11 +160,14 @@ public class VnfAdapterVfModuleObjectMapper { private Map<String,String> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { - GenericResourceApiVnftopologyVnfTopology vnfTopology = mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnftopologyVnfTopology.class); - GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class); + + GenericResourceApiVnfTopology vnfTop= mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnfTopology.class); + GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class); + GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfTop.getVnfTopology(); + GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology(); Map<String,String> paramsMap = new HashMap<>(); - if(vnfTopology.getSdncGeneratedCloudResources() && vfModuleTopology.getSdncGeneratedCloudResources()) { + if( vfModuleTopology.getSdncGeneratedCloudResources()) { buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, true); buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, null, true); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java new file mode 100644 index 0000000000..fa039c235c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof; + + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.so.bpmn.common.baseclient.BaseClient; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.oof.beans.OofProperties; +import org.onap.so.client.oof.beans.OofRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.LinkedHashMap; + +@Component +public class OofClient { + + private static final Logger logger = LoggerFactory.getLogger(OofClient.class); + public static final String X_MINOR_VERSION = "X-MinorVersion"; + public static final String X_PATCH_VERSION = "X-PatchVersion"; + public static final String X_LATEST_VERSION = "X-LatestVersion"; + + @Autowired + private OofProperties oofProperties; + + @Autowired + private OofValidator validator; + + + /** + * Makes a rest call to oof to perform homing and licensing for a + * list of demands + * + * @param homingRequest + * @return + * @throws JsonProcessingException + * @throws BpmnError + */ + public void postDemands(OofRequest homingRequest) throws BadResponseException, JsonProcessingException{ + logger.trace("Started oof Client Post Demands"); + String url = oofProperties.getHost() + oofProperties.getUri(); + logger.debug("Post demands url: " + url); + logger.debug("Post demands payload: " + homingRequest.toJsonString()); + + HttpHeaders header = new HttpHeaders(); + header.setContentType(MediaType.APPLICATION_JSON); + header.set(HttpHeaders.AUTHORIZATION, oofProperties.getHeaders().get("auth")); + header.set(X_PATCH_VERSION, oofProperties.getHeaders().get("patchVersion")); + header.set(X_MINOR_VERSION, oofProperties.getHeaders().get("minorVersion")); + header.set(X_LATEST_VERSION, oofProperties.getHeaders().get("latestVersion")); + BaseClient<String, LinkedHashMap<?, ?>> baseClient = new BaseClient<>(); + + baseClient.setTargetUrl(url); + baseClient.setHttpHeader(header); + + LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); + validator.validateDemandsResponse(response); + logger.trace("Completed OOF Client Post Demands"); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java new file mode 100644 index 0000000000..252ff0d6a6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof; + + +import org.json.JSONObject; +import org.onap.so.client.exception.BadResponseException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.util.LinkedHashMap; + +import static org.apache.commons.lang.StringUtils.isNotBlank; + + +@Component +public class OofValidator { + + private static final Logger logger = LoggerFactory.getLogger(OofValidator.class); + + /** + * Validates the synchronous homing response from oof + * + * @throws BadResponseException + */ + public void validateDemandsResponse(LinkedHashMap<?, ?> response) throws BadResponseException { + logger.debug("Validating oofs synchronous response"); + if(!response.isEmpty()){ + JSONObject jsonResponse = new JSONObject(response); + if(jsonResponse.has("requestStatus")){ + String status = jsonResponse.getString("requestStatus"); + if(status.equals("accepted")){ + logger.debug("oofs synchronous response indicates accepted"); + }else{ + String message = jsonResponse.getString("statusMessage"); + if(isNotBlank(message)){ + logger.debug("oofs response indicates failed: " + message); + }else{ + logger.debug("oofs response indicates failed: no status message provided"); + message = "error message not provided"; + } + throw new BadResponseException("oofs synchronous response indicates failed: " + message); + } + }else{ + logger.debug("oofs synchronous response does not contain: request status"); + throw new BadResponseException("oofs synchronous response does not contain: request status"); + } + }else{ + logger.debug("oofs synchronous response is empty"); + throw new BadResponseException("oofs synchronous response i is empty"); + } + } + + /** + * Validates the asynchronous/callback response from oof which + * contains the homing and licensing solutions + * + * @throws BadResponseException + */ + public void validateSolution(String response) throws BadResponseException{ + logger.debug("Validating oofs asynchronous callback response"); + if(isNotBlank(response)) { + JSONObject jsonResponse = new JSONObject(response); + if(!jsonResponse.has("serviceException")){ + logger.debug("oofs asynchronous response is valid"); + }else{ + String message = jsonResponse.getJSONObject("serviceException").getString("text"); + if(isNotBlank(message)){ + logger.debug("oofs response contains a service exception: " + message); + }else{ + logger.debug("oofs response contains a service exception: no service exception text provided"); + message = "error message not provided"; + } + throw new BadResponseException("oofs asynchronous response contains a service exception: " + message); + } + }else{ + logger.debug("oofs asynchronous response is empty"); + throw new BadResponseException("oofs asynchronous response is empty"); + } + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java new file mode 100644 index 0000000000..8e136e9f18 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.io.Serializable; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "modelType", + "modelInvariantId", + "modelVersionId", + "modelName", + "modelVersion", + "modelCustomizationName" +}) +@JsonRootName("modelInfo") +public class ModelInfo implements Serializable { + + private static final long serialVersionUID = -759180997599143791L; + + @JsonProperty("modelType") + private String modelType; + @JsonProperty("modelInvariantId") + private String modelInvariantId; + @JsonProperty("modelVersionId") + private String modelVersionId; + @JsonProperty("modelName") + private String modelName; + @JsonProperty("modelVersion") + private String modelVersion; + @JsonProperty("modelCustomizationName") + private String modelCustomizationName; + + @JsonProperty("modelType") + public String getModelType() { + return modelType; + } + + @JsonProperty("modelType") + public void setModelType(String modelType) { + this.modelType = modelType; + } + + @JsonProperty("modelInvariantId") + public String getModelInvariantId() { + return modelInvariantId; + } + + @JsonProperty("modelInvariantId") + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + @JsonProperty("modelVersionId") + public String getModelVersionId() { + return modelVersionId; + } + + @JsonProperty("modelVersionId") + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + @JsonProperty("modelName") + public String getModelName() { + return modelName; + } + + @JsonProperty("modelName") + public void setModelName(String modelName) { + this.modelName = modelName; + } + + @JsonProperty("modelVersion") + public String getModelVersion() { + return modelVersion; + } + + @JsonProperty("modelVersion") + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + @JsonProperty("modelCustomizationName") + public String getModelCustomizationName() { + return modelCustomizationName; + } + + @JsonProperty("modelCustomizationName") + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelType", modelType).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelName", modelName).append("modelVersion", modelVersion).append("modelCustomizationName", modelCustomizationName).toString(); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java new file mode 100644 index 0000000000..507eaeaf5e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import java.util.Map; + +@Configuration +@ConfigurationProperties(prefix = "oof") +public class OofProperties { + + private String host; + private String uri; + + private Map<String, String> headers; + + + public String getHost() { + return host; + } + public void setHost(String host) { + this.host = host; + } + public String getUri() { + return uri; + } + public void setUri(String uri) { + this.uri = uri; + } + public Map<String, String> getHeaders() { + return headers; + } + public void setHeaders(Map<String, String> headers) { + this.headers = headers; + } + + + + + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java new file mode 100644 index 0000000000..7dfd6849a6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.Serializable; + + +public class OofRequest implements Serializable{ + + private static final long serialVersionUID = -1541132882892163132L; + private static final Logger logger = LoggerFactory.getLogger(OofRequest.class); + + @JsonRawValue + @JsonProperty("requestInfo") + private RequestInfo requestInformation; + @JsonRawValue + @JsonProperty("serviceInfo") + private ServiceInfo serviceInformation; + @JsonRawValue + @JsonProperty("placementInfo") + private PlacementInfo placementInformation; + @JsonRawValue + @JsonProperty("licenseInfo") + private String licenseInformation; + + + public RequestInfo getRequestInformation() { + return requestInformation; + } + public void setRequestInformation(RequestInfo requestInformation) { + this.requestInformation = requestInformation; + } + public ServiceInfo getServiceInformation() { + return serviceInformation; + } + public void setServiceInformation(ServiceInfo serviceInformation) { + this.serviceInformation = serviceInformation; + } + public PlacementInfo getPlacementInformation() { + return placementInformation; + } + public void setPlacementInformation(PlacementInfo placementInformation) { + this.placementInformation = placementInformation; + } + public String getLicenseInformation() { + return licenseInformation; + } + public void setLicenseInformation(String licenseInformation) { + this.licenseInformation = licenseInformation; + } + + + @JsonInclude(Include.NON_NULL) + public String toJsonString(){ + String json = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); + try{ + json = ow.writeValueAsString(this); + }catch (Exception e){ + logger.error("Unable to convert oofRequest to string", e); + } + return json.replaceAll("\\\\", ""); + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java new file mode 100644 index 0000000000..34b05e2f0f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.io.Serializable; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "customerLatitude", + "customerLongitude", + "customerName" +}) +@JsonRootName("requestParameters") +public class OofRequestParameters implements Serializable { + + private static final long serialVersionUID = -759180997599143791L; + + + @JsonProperty("customerLatitude") + private String customerLatitude; + @JsonProperty("customerLongitude") + private String customerLongitude; + @JsonProperty("customerName") + private String customerName; + + @JsonProperty("customerLatitude") + public String getCustomerLatitude() { + return customerLatitude; + } + + @JsonProperty("customerLatitude") + public void setCustomerLatitude(String customerLatitude) { + this.customerLatitude = customerLatitude; + } + + @JsonProperty("customerLongitude") + public String getCustomerLongitude() { + return customerLongitude; + } + + @JsonProperty("customerLongitude") + public void setCustomerLongitude(String customerLongitude) { + this.customerLongitude = customerLongitude; + } + + @JsonProperty("customerName") + public String getCustomerName() { + return customerName; + } + + @JsonProperty("customerName") + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("customerLatitude", customerLatitude).append("customerLongitude", customerLongitude).append("customerName", customerName).toString(); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java new file mode 100644 index 0000000000..a213723f76 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.io.Serializable; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "resourceModuleName", + "serviceResourceId", + "tenantId", + "resourceModelInfo" +}) +@JsonRootName("placementDemand") +public class PlacementDemand implements Serializable { + + private static final long serialVersionUID = -759180997599143791L; + + @JsonProperty("resourceModuleName") + private String resourceModuleName; + @JsonProperty("serviceResourceId") + private String serviceResourceId; + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("resourceModelInfo") + private ResourceModelInfo resourceModelInfo; + + @JsonProperty("resourceModuleName") + public String getResourceModuleName() { + return resourceModuleName; + } + + @JsonProperty("resourceModuleName") + public void setResourceModuleName(String resourceModuleName) { + this.resourceModuleName = resourceModuleName; + } + + @JsonProperty("serviceResourceId") + public String getServiceResourceId() { + return serviceResourceId; + } + + @JsonProperty("serviceResourceId") + public void setServiceResourceId(String serviceResourceId) { + this.serviceResourceId = serviceResourceId; + } + + @JsonProperty("tenantId") + public String getTenantId() { + return tenantId; + } + + @JsonProperty("tenantId") + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + @JsonProperty("resourceModelInfo") + public ResourceModelInfo getResourceModelInfo() { + return resourceModelInfo; + } + + @JsonProperty("resourceModelInfo") + public void setResourceModelInfo(ResourceModelInfo resourceModelInfo) { + this.resourceModelInfo = resourceModelInfo; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("resourceModuleName", resourceModuleName).append("serviceResourceId", serviceResourceId).append("tenantId", tenantId).append("resourceModelInfo", resourceModelInfo).toString(); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java new file mode 100644 index 0000000000..5bda42fefe --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang.builder.ToStringBuilder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "requestParameters", + "subscriberInfo", + "placementDemands" +}) +@JsonRootName("placementInfo") +public class PlacementInfo implements Serializable { + + private static final long serialVersionUID = -759180997599143791L; + + @JsonProperty("requestParameters") + private OofRequestParameters requestParameters; + @JsonProperty("subscriberInfo") + private SubscriberInfo subscriberInfo; + @JsonProperty("placementDemands") + private ArrayList<PlacementDemand> placementDemands = null; + + @JsonProperty("requestParameters") + public OofRequestParameters getRequestParameters() { + return requestParameters; + } + + @JsonProperty("requestParameters") + public void setRequestParameters(OofRequestParameters requestParameters) { + this.requestParameters = requestParameters; + } + + @JsonProperty("subscriberInfo") + public SubscriberInfo getSubscriberInfo() { + return subscriberInfo; + } + + @JsonProperty("subscriberInfo") + public void setSubscriberInfo(SubscriberInfo subscriberInfo) { + this.subscriberInfo = subscriberInfo; + } + + @JsonProperty("placementDemands") + public ArrayList<PlacementDemand> getPlacementDemands() { + return placementDemands; + } + + @JsonProperty("placementDemands") + public void setPlacementDemands(ArrayList<PlacementDemand> placementDemands) { + this.placementDemands = placementDemands; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("requestParameters", requestParameters).append("subscriberInfo", subscriberInfo).append("placementDemands", placementDemands).toString(); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java new file mode 100644 index 0000000000..ea33a26672 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import java.io.Serializable; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang.builder.ToStringBuilder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "transactionId", + "requestId", + "callbackUrl", + "sourceId", + "requestType", + "numSolutions", + "optimizers", + "timeout" +}) +@JsonRootName("requestInfo") +public class RequestInfo implements Serializable { + + private static final long serialVersionUID = -759180997599143791L; + + @JsonProperty("transactionId") + private String transactionId; + @JsonProperty("requestId") + private String requestId; + @JsonProperty("callbackUrl") + private String callbackUrl; + @JsonProperty("sourceId") + private String sourceId; + @JsonProperty("requestType") + private String requestType; + @JsonProperty("numSolutions") + private Integer numSolutions; + @JsonProperty("optimizers") + private List<String> optimizers = null; + @JsonProperty("timeout") + private Long timeout; + + @JsonProperty("transactionId") + public String getTransactionId() { + return transactionId; + } + + @JsonProperty("transactionId") + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + @JsonProperty("requestId") + public String getRequestId() { + return requestId; + } + + @JsonProperty("requestId") + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + @JsonProperty("callbackUrl") + public String getCallbackUrl() { + return callbackUrl; + } + + @JsonProperty("callbackUrl") + public void setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + } + + @JsonProperty("sourceId") + public String getSourceId() { + return sourceId; + } + + @JsonProperty("sourceId") + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + @JsonProperty("requestType") + public String getRequestType() { + return requestType; + } + + @JsonProperty("requestType") + public void setRequestType(String requestType) { + this.requestType = requestType; + } + + @JsonProperty("numSolutions") + public Integer getNumSolutions() { + return numSolutions; + } + + @JsonProperty("numSolutions") + public void setNumSolutions(Integer numSolutions) { + this.numSolutions = numSolutions; + } + + @JsonProperty("optimizers") + public List<String> getOptimizers() { + return optimizers; + } + + @JsonProperty("optimizers") + public void setOptimizers(List<String> optimizers) { + this.optimizers = optimizers; + } + + @JsonProperty("timeout") + public Long getTimeout() { + return timeout; + } + + @JsonProperty("timeout") + public void setTimeout(Long timeout) { + this.timeout = timeout; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("transactionId", transactionId).append("requestId", requestId).append("callbackUrl", callbackUrl).append("sourceId", sourceId).append("requestType", requestType).append("numSolutions", numSolutions).append("optimizers", optimizers).append("timeout", timeout).toString(); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java index 7160a2f333..fea7437a93 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Intel Corp. Intellectual Property. All rights reserved. + * Copyright (C) 2018 Intel Corp. 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. @@ -18,40 +18,38 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.core.domain; +package org.onap.so.client.oof.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; -/** - * Stores Cloud Flavor information and is an attribute - * of a <class>HomingSolution</class> - * - */ -public class CloudFlavor extends JsonWrapper implements Serializable { +public class Resource implements Serializable{ - private static final long serialVersionUID = 8423934332773299577L; - private String flavorLabel; - private String flavor; + private static final long serialVersionUID = 5949861520571440421L; - public CloudFlavor (String flavorLabel, String flavor){ - this.flavorLabel = flavorLabel; - this.flavor = flavor; - } + @JsonProperty("service-resource-id") + private String serviceResourceId; + @JsonProperty("status") + private String status; - public String getFlavorLabel() { - return flavorLabel; + + public String getServiceResourceId(){ + return serviceResourceId; } - public void setFlavorLabel(String flavorLabel) { - this.flavorLabel = flavorLabel; + public void setServiceResourceId(String serviceResourceId){ + this.serviceResourceId = serviceResourceId; } - public String getFlavor() { - return flavor; + public String getStatus(){ + return status; } - public void setFlavor(String flavor) { - this.flavor = flavor; + public void setStatus(String status){ + this.status = status; } + + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java new file mode 100644 index 0000000000..63aec130ba --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.io.Serializable; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonRootName("resourceModelInfo") +public class ResourceModelInfo extends ModelInfo implements Serializable { + + private static final long serialVersionUID = -759180997599143791L; + + @JsonProperty("modelInvariantId") + private String modelInvariantId; + @JsonProperty("modelVersionId") + private String modelVersionId; + @JsonProperty("modelName") + private String modelName; + @JsonProperty("modelType") + private String modelType; + @JsonProperty("modelVersion") + private String modelVersion; + @JsonProperty("modelCustomizationName") + private String modelCustomizationName; + + @JsonProperty("modelInvariantId") + public String getModelInvariantId() { + return modelInvariantId; + } + + @JsonProperty("modelInvariantId") + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + @JsonProperty("modelVersionId") + public String getModelVersionId() { + return modelVersionId; + } + + @JsonProperty("modelVersionId") + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + @JsonProperty("modelName") + public String getModelName() { + return modelName; + } + + @JsonProperty("modelName") + public void setModelName(String modelName) { + this.modelName = modelName; + } + + @JsonProperty("modelType") + public String getModelType() { + return modelType; + } + + @JsonProperty("modelType") + public void setModelType(String modelType) { + this.modelType = modelType; + } + + @JsonProperty("modelVersion") + public String getModelVersion() { + return modelVersion; + } + + @JsonProperty("modelVersion") + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + @JsonProperty("modelCustomizationName") + public String getModelCustomizationName() { + return modelCustomizationName; + } + + @JsonProperty("modelCustomizationName") + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelName", modelName).append("modelType", modelType).append("modelVersion", modelVersion).append("modelCustomizationName", modelCustomizationName).toString(); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java new file mode 100644 index 0000000000..90443ce379 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.io.Serializable; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "serviceInstanceId", + "serviceName", + "modelInfo" +}) +@JsonRootName("serviceInfo") +public class ServiceInfo implements Serializable { + + private static final long serialVersionUID = -759180997599143791L; + + @JsonProperty("serviceInstanceId") + private String serviceInstanceId; + @JsonProperty("serviceName") + private String serviceName; + @JsonProperty("modelInfo") + private ModelInfo modelInfo; + + @JsonProperty("serviceInstanceId") + public String getServiceInstanceId() { + return serviceInstanceId; + } + + @JsonProperty("serviceInstanceId") + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + @JsonProperty("serviceName") + public String getServiceName() { + return serviceName; + } + + @JsonProperty("serviceName") + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + @JsonProperty("modelInfo") + public ModelInfo getModelInfo() { + return modelInfo; + } + + @JsonProperty("modelInfo") + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("serviceName", serviceName).append("modelInfo", modelInfo).toString(); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java new file mode 100644 index 0000000000..bc283c803c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.io.Serializable; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "globalSubscriberId", + "subscriberName", + "subscriberCommonSiteId" +}) +@JsonRootName("subscriberInfo") +public class SubscriberInfo implements Serializable { + + private static final long serialVersionUID = -759180997599143791L; + + @JsonProperty("globalSubscriberId") + private String globalSubscriberId; + @JsonProperty("subscriberName") + private String subscriberName; + @JsonProperty("subscriberCommonSiteId") + private String subscriberCommonSiteId; + + @JsonProperty("globalSubscriberId") + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + @JsonProperty("globalSubscriberId") + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + @JsonProperty("subscriberName") + public String getSubscriberName() { + return subscriberName; + } + + @JsonProperty("subscriberName") + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } + + @JsonProperty("subscriberCommonSiteId") + public String getSubscriberCommonSiteId() { + return subscriberCommonSiteId; + } + + @JsonProperty("subscriberCommonSiteId") + public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { + this.subscriberCommonSiteId = subscriberCommonSiteId; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("globalSubscriberId", globalSubscriberId).append("subscriberName", subscriberName).append("subscriberCommonSiteId", subscriberCommonSiteId).toString(); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index a4b40393a3..67843a7ef9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -64,28 +64,10 @@ public class SDNCClient { STOClient.setTargetUrl(targetUrl); HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); - msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl); LinkedHashMap<?, ?> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); - Optional<String> sdncResponse = logSDNCResponse(output); - if(sdncResponse.isPresent()){ - msoLogger.info(sdncResponse.get()); - } - msoLogger.info("Validating output..."); return sdnCommonTasks.validateSDNResponse(output); } - protected Optional<String> logSDNCResponse(LinkedHashMap<?, ?> output) { - ObjectMapper mapper = new ObjectMapper(); - String sdncOutput = ""; - try { - sdncOutput = mapper.writeValueAsString(output); - return Optional.of(sdncOutput); - } catch (JsonProcessingException e) { - msoLogger.debug("Failed to map response from sdnc to json string for logging purposes."); - } - return Optional.empty(); - } - /** * * @param queryLink @@ -102,12 +84,9 @@ public class SDNCClient { String jsonRequest = sdnCommonTasks.buildJsonRequest(request); String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString(); STOClient.setTargetUrl(targetUrl); - msoLogger.info("TargetUrl: " + targetUrl); HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); - msoLogger.info("Running SDNC CLIENT..."); LinkedHashMap<?, ?> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); - msoLogger.info("Validating output..."); return sdnCommonTasks.validateSDNGetResponse(output); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index d35296af9b..ee1d432b6f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -20,11 +20,12 @@ package org.onap.so.client.sdnc; +import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.http.HttpStatus; -import org.json.JSONObject; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.logger.MessageEnum; @@ -79,6 +80,9 @@ public class SdnCommonTasks { HttpHeaders httpHeader = new HttpHeaders(); httpHeader.set("Authorization", auth); httpHeader.setContentType(MediaType.APPLICATION_JSON); + List<MediaType> acceptMediaTypes = new ArrayList<MediaType>(); + acceptMediaTypes.add(MediaType.APPLICATION_JSON); + httpHeader.setAccept(acceptMediaTypes); return httpHeader; } @@ -88,24 +92,32 @@ public class SdnCommonTasks { * @return * @throws BadResponseException */ - public String validateSDNResponse(LinkedHashMap<?, ?> output) throws BadResponseException { - if (CollectionUtils.isEmpty(output)) { - msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC); - throw new BadResponseException(NO_RESPONSE_FROM_SDNC); + public String validateSDNResponse(LinkedHashMap<?, ?> output) throws BadResponseException { + if (CollectionUtils.isEmpty(output)) { + msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC); + throw new BadResponseException(NO_RESPONSE_FROM_SDNC); + } + LinkedHashMap<?, ?> embeddedResponse =(LinkedHashMap<?, ?>) output.get("output"); + String responseCode = ""; + String responseMessage = ""; + if (embeddedResponse != null) { + responseCode = (String) embeddedResponse.get(RESPONSE_CODE); + responseMessage = (String) embeddedResponse.get(RESPONSE_MESSAGE); } - String responseCode = (String) output.get(RESPONSE_CODE); - String responseMessage = (String) output.get(RESPONSE_MESSAGE); - msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage); - int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0; - if (isHttpCodeSuccess(code)) { - msoLogger.info("Successful Response from SDNC"); - return responseMessage; - } else { - String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); - msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, errorMessage); - throw new BadResponseException(errorMessage); - } - } + + msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage); + int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0; + if (isHttpCodeSuccess(code)) { + msoLogger.info("Successful Response from SDNC"); + return responseMessage; + } else { + String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); + msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, errorMessage); + throw new BadResponseException(errorMessage); + } + } /*** * diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java index 84f056dc4d..432399b1b8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java @@ -83,6 +83,8 @@ public class GeneralTopologyObjectMapper { onapModelInformation.setModelCustomizationUuid(network.getModelInfoNetwork().getModelCustomizationUUID()); networkInformation.setOnapModelInformation(onapModelInformation); } + + networkInformation.setFromPreload(null); networkInformation.setNetworkId(network.getNetworkId()); //TODO fix this after network type filed included in L3Network object type //networkInformation.setNetworkType(network.getNetwork); @@ -130,6 +132,7 @@ public class GeneralTopologyObjectMapper { vfModuleInformation.setVfModuleType(vfModule.getModelInfoVfModule().getModelName()); } vfModuleInformation.setVfModuleId(vfModule.getVfModuleId()); + vfModuleInformation.setFromPreload(null); return vfModuleInformation; } public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId){ diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index fb9533091b..b5bb0bed94 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -7,9 +7,9 @@ * 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. @@ -58,6 +58,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; @@ -88,20 +89,20 @@ public class TestDataSetup{ private int volumeGroupCounter; private int vpnBindingCounter; private int vpnBondingLinkCounter; - + protected BuildingBlockExecution execution; - + protected GeneralBuildingBlock gBBInput; - + protected HashMap<ResourceKey, String> lookupKeyMap; - + protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB(); - + @Rule public ExpectedException expectedException = ExpectedException.none(); - + protected DelegateExecution delegateExecution; - + @Before public void buildingBlockTestDataSetupBefore() { collectionCounter = 0; @@ -120,183 +121,183 @@ public class TestDataSetup{ volumeGroupCounter = 0; vpnBindingCounter = 0; vpnBondingLinkCounter = 0; - + execution = new DelegateExecutionImpl(new ExecutionImpl()); execution.setVariable("testProcessKey", "testProcessKeyValue"); - + gBBInput = new GeneralBuildingBlock(); execution.setVariable("gBBInput", gBBInput); - + lookupKeyMap = new HashMap<ResourceKey, String>(); execution.setVariable("lookupKeyMap", lookupKeyMap); - + ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class); doReturn("test").when(mockExecutionImpl).getProcessInstanceId(); - + ExecutionImpl executionImpl = new ExecutionImpl(); executionImpl.setProcessInstance(mockExecutionImpl); - + delegateExecution = (DelegateExecution) executionImpl; delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); } - + public Map<String, String> buildUserInput() { Map<String, String> userInput = new HashMap<>(); userInput.put("testUserInputKey", "testUserInputValue"); - + return userInput; } - + public Map<String, String> setUserInput() { Map<String, String> userInput = buildUserInput(); - + gBBInput.setUserInput(userInput); - + return userInput; } - + public RequestContext buildRequestContext() { RequestContext requestContext = new RequestContext(); requestContext.setMsoRequestId(UUID.randomUUID().toString()); requestContext.setProductFamilyId("testProductFamilyId"); requestContext.setRequestorId("testRequestorId"); - + requestContext.setUserParams(new HashMap<>()); - + Map<String,Object> dataMap = new HashMap<>(); dataMap.put("vpnId","testVpnId"); dataMap.put("vpnRegion","testVpnRegion"); dataMap.put("vpnRt","testVpnRt"); dataMap.put("vpnName","vpnName"); dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"})); - + HashMap<String,Object> userParams = new HashMap<>(); userParams.put("vpnData",dataMap); - + List<Map<String,Object>> userParamsList = new ArrayList<>(); userParamsList.add(userParams); - + RequestParameters requestParameters = new RequestParameters(); requestParameters.setUserParams(userParamsList); requestContext.setRequestParameters(requestParameters); - + return requestContext; } - + public RequestContext setRequestContext() { RequestContext requestContext = buildRequestContext(); - + gBBInput.setRequestContext(requestContext); - + return requestContext; } - + public CloudRegion buildCloudRegion() { CloudRegion cloudRegion = new CloudRegion(); cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId"); cloudRegion.setTenantId("testTenantId"); cloudRegion.setCloudOwner("testCloudOwner"); - + return cloudRegion; } - + public CloudRegion setCloudRegion() { CloudRegion cloudRegion = buildCloudRegion(); - + gBBInput.setCloudRegion(cloudRegion); - + return cloudRegion; } - + public OrchestrationContext buildOrchestrationContext() { OrchestrationContext orchestrationContext = new OrchestrationContext(); - + return orchestrationContext; } - + public OrchestrationContext setOrchestrationContext() { OrchestrationContext orchestrationContext = buildOrchestrationContext(); - + gBBInput.setOrchContext(orchestrationContext); - + return orchestrationContext; } - + public Collection buildCollection() { collectionCounter++; - + Collection collection = new Collection(); collection.setId("testId" + collectionCounter); collection.setInstanceGroup(buildInstanceGroup()); - + return collection; } - + public Configuration buildConfiguration() { configurationCounter++; - + Configuration configuration = new Configuration(); configuration.setConfigurationId("testConfigurationId" + configurationCounter); configuration.setConfigurationName("testConfigurationName" + configurationCounter); - + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter); modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter); modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter); - + configuration.setModelInfoConfiguration(modelInfoConfiguration); - + return configuration; } - + public OwningEntity buildOwningEntity() { owningEntityCounter++; - + OwningEntity owningEntity = new OwningEntity(); owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter); owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter); - + return owningEntity; } - + public Project buildProject() { projectCounter++; - + Project project = new Project(); project.setProjectName("testProjectName" + projectCounter); - + return project; } - + public ServiceSubscription buildServiceSubscription() { serviceSubscriptionCounter++; - + ServiceSubscription serviceSubscription = new ServiceSubscription(); serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter); serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter); - + return serviceSubscription; } - + public Customer buildCustomer() { customerCounter++; - + Customer customer = new Customer(); customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter); customer.setSubscriberType("testSubscriberType" + customerCounter); customer.setServiceSubscription(buildServiceSubscription()); - + return customer; } - + public ServiceInstance buildServiceInstance() { serviceInstanceCounter++; - + ServiceInstance serviceInstance = new ServiceInstance(); serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter); serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter); - + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter); modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter); @@ -304,30 +305,30 @@ public class TestDataSetup{ modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - + serviceInstance.setProject(buildProject()); - + serviceInstance.setOwningEntity(buildOwningEntity()); - + serviceInstance.setCollection(buildCollection()); - + serviceInstance.getConfigurations().add(buildConfiguration()); - + return serviceInstance; } - + public ServiceInstance setServiceInstance() { ServiceInstance serviceInstance = buildServiceInstance(); - + if(gBBInput.getCustomer() == null) { gBBInput.setCustomer(buildCustomer()); } gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); - + return serviceInstance; } - + public Customer setCustomer() { if(gBBInput.getCustomer() != null) return gBBInput.getCustomer(); Customer customer = new Customer(); @@ -337,64 +338,64 @@ public class TestDataSetup{ customer.setServiceSubscription(buildServiceSubscription()); gBBInput.setCustomer(customer); - + return customer; } - + public Collection setCollection() { Collection collection = new Collection(); collection.setId("testId"); - + ServiceInstance serviceInstance = null; - + try { serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } - + serviceInstance.setCollection(collection); - + return collection; } - + public InstanceGroup setInstanceGroup() { InstanceGroup instanceGroup = new InstanceGroup(); instanceGroup.setId("testId"); instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); - + Collection collection = null; - + try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); collection = serviceInstance.getCollection(); - + if (collection == null) { collection = setCollection(); } } catch(BBObjectNotFoundException e) { collection = setCollection(); } - + collection.setInstanceGroup(instanceGroup); - + return instanceGroup; } - + public VpnBinding buildVpnBinding() { vpnBindingCounter++; - + VpnBinding vpnBinding = new VpnBinding(); vpnBinding.setVpnId("testVpnId" + vpnBindingCounter); vpnBinding.setVpnName("testVpnName" + vpnBindingCounter); vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter); - + return vpnBinding; } - + public VpnBinding setVpnBinding() { VpnBinding vpnBinding = buildVpnBinding(); - + Customer customer = gBBInput.getCustomer(); if(customer == null){ @@ -403,72 +404,72 @@ public class TestDataSetup{ customer.getVpnBindings().add(vpnBinding); lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); - + return vpnBinding; } - + public InstanceGroup buildInstanceGroup() { instanceGroupCounter++; - + InstanceGroup instanceGroup = new InstanceGroup(); instanceGroup.setId("testId" + instanceGroupCounter); instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter); - + return instanceGroup; } - + public L3Network buildL3Network() { l3NetworkCounter++; - + L3Network network = new L3Network(); network.setNetworkId("testNetworkId" + l3NetworkCounter); network.setNetworkName("testNetworkName" + l3NetworkCounter); network.setNetworkType("testNetworkType" + l3NetworkCounter); - + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter); modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter); modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter); modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter); network.setModelInfoNetwork(modelInfoNetwork); - + return network; } - + public L3Network setL3Network() { L3Network network = buildL3Network(); - + ServiceInstance serviceInstance = null; - + try { serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } - + serviceInstance.getNetworks().add(network); lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); - + return network; } - + public GenericVnf buildGenericVnf() { genericVnfCounter++; - + GenericVnf genericVnf = new GenericVnf(); genericVnf.setVnfId("testVnfId" + genericVnfCounter); genericVnf.setVnfName("testVnfName" + genericVnfCounter); genericVnf.setVnfType("testVnfType" + genericVnfCounter); genericVnf.setIpv4OamAddress("10.222.22.2"); - + Platform platform = new Platform(); platform.setPlatformName("testPlatformName"); genericVnf.setPlatform(platform); - + LineOfBusiness lob = new LineOfBusiness(); lob.setLineOfBusinessName("testLineOfBusinessName"); genericVnf.setLineOfBusiness(lob); - + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter); modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter); @@ -476,34 +477,40 @@ public class TestDataSetup{ modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter); modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter); genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); - + + License license = new License(); + List<String> array = new ArrayList<String>(); + array.add("testPoolUuid"); + license.setEntitlementPoolUuids(array); + genericVnf.setLicense(license); + return genericVnf; } - + public GenericVnf setGenericVnf() { GenericVnf genericVnf = buildGenericVnf(); - + ServiceInstance serviceInstance = null; - + try { serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } - + serviceInstance.getVnfs().add(genericVnf); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); - + return genericVnf; } - + public VfModule buildVfModule() { vfModuleCounter++; - + VfModule vfModule = new VfModule(); vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); - + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); @@ -511,128 +518,128 @@ public class TestDataSetup{ modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); vfModule.setModelInfoVfModule(modelInfoVfModule); - + return vfModule; } - + public VfModule setVfModule() { VfModule vfModule = buildVfModule(); - + GenericVnf genericVnf = null; - + try { genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); } catch(BBObjectNotFoundException e) { genericVnf = setGenericVnf(); } - + genericVnf.getVfModules().add(vfModule); lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); - + return vfModule; } - + public VolumeGroup buildVolumeGroup() { volumeGroupCounter++; - + VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter); volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter); volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter); - + return volumeGroup; } - + public VolumeGroup setVolumeGroup() { VolumeGroup volumeGroup = buildVolumeGroup(); - + GenericVnf genericVnf = null; - + try { genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); } catch(BBObjectNotFoundException e) { genericVnf = setGenericVnf(); } - + genericVnf.getVolumeGroups().add(volumeGroup); lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); - + return volumeGroup; } - + public Pnf buildPnf() { pnfCounter++; - + Pnf pnf = new Pnf(); pnf.setPnfId("testPnfId" + pnfCounter); pnf.setPnfName("testPnfName" + pnfCounter); - + return pnf; } - + public ServiceProxy buildServiceProxy() { serviceProxyCounter++; - + ServiceProxy serviceProxy = new ServiceProxy(); serviceProxy.setServiceInstance(buildServiceInstance()); serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf()); - + Pnf primaryPnf = buildPnf(); primaryPnf.setRole("Primary"); serviceProxy.getServiceInstance().getPnfs().add(primaryPnf); - + Pnf secondaryPnf = buildPnf(); secondaryPnf.setRole("Secondary"); serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf); - + return serviceProxy; } - + public VpnBondingLink buildVpnBondingLink() { vpnBondingLinkCounter++; - + VpnBondingLink vpnBondingLink = new VpnBondingLink(); vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter); - + Configuration vnrConfiguration = buildConfiguration(); - vnrConfiguration.setNetwork(buildL3Network()); + vnrConfiguration.setNetwork(buildL3Network()); vpnBondingLink.setVnrConfiguration(vnrConfiguration); vpnBondingLink.setVrfConfiguration(buildConfiguration()); - + vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy()); - + vpnBondingLink.setTransportServiceProxy(buildServiceProxy()); - + return vpnBondingLink; } - + public VpnBondingLink setVpnBondingLink() { VpnBondingLink vpnBondingLink = buildVpnBondingLink(); - + ServiceInstance serviceInstance = null; - + try { serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } - + serviceInstance.getVpnBondingLinks().add(vpnBondingLink); lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId()); return vpnBondingLink; } - + public Customer setAvpnCustomer() { Customer customer = buildCustomer(); - + gBBInput.setCustomer(customer); - + return customer; } - + public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) { ServiceProxy serviceProxy = new ServiceProxy(); serviceProxy.setId("testProxyId" + uniqueIdentifier); @@ -658,12 +665,12 @@ public class TestDataSetup{ modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); - + ar.setModelInfoAllottedResource(modelInfo); - + return ar; } - + public Configuration setConfiguration () { Configuration config = new Configuration(); config.setConfigurationId("testConfigurationId"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java new file mode 100644 index 0000000000..d4956f9349 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.activity; + + +import static org.junit.Assert.assertEquals; + +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; + +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.springframework.beans.factory.annotation.Autowired; + +public class ExecuteActivityTest extends BaseTaskTest { + @Autowired + protected ExecuteActivity executeActivity; + + private DelegateExecution execution; + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + execution.setVariable("vnfType", "testVnfType"); + execution.setVariable("requestAction", "testRequestAction"); + execution.setVariable("mso-request-id", "testMsoRequestId"); + execution.setVariable("vnfId", "testVnfId"); + execution.setVariable("serviceInstanceId", "testServiceInstanceId"); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + } + + @Test + public void buildBuildingBlock_Test(){ + BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName"); + assertEquals(bb.getBpmnFlowName(), "testActivityName"); + assertEquals(bb.getKey(), ""); + } + + @Test + public void executeBuildingBlock_Test() throws Exception { + BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName"); + ExecuteBuildingBlock ebb = executeActivity.buildExecuteBuildingBlock(execution, "testMsoRequestId", bb); + assertEquals(ebb.getVnfType(), "testVnfType"); + assertEquals(ebb.getRequestAction(), "testRequestAction"); + assertEquals(ebb.getRequestId(), "testMsoRequestId"); + assertEquals(ebb.getWorkflowResourceIds().getVnfId(), "testVnfId"); + assertEquals(ebb.getWorkflowResourceIds().getServiceInstanceId(), "testServiceInstanceId"); + assertEquals(ebb.getBuildingBlock(), bb); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java index 24a99c97f4..2a8046b1be 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -46,8 +46,9 @@ public class VnfAdapterImplTest extends BaseTaskTest { private static final String VNF_ADAPTER_REST_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestDeleteResponse.xml"); private static final String VNF_ADAPTER_REST_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml"); private static final String VNF_ADAPTER_VOLUME_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml"); + private static final String VNF_ADAPTER_VOLUME_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml"); private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn"; - private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1"; + private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1"; @Before public void before() { @@ -56,6 +57,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { vfModule = setVfModule(); volumeGroup = setVolumeGroup(); vfModule.setHeatStackId(null); + volumeGroup.setHeatStackId(null); } @Test @@ -98,13 +100,14 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest() { + vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); } @Test - public void postProcessVnfAdapter_ResponseNullTest() { + public void postProcessVnfAdapter_ResponseNullTest() { execution.setVariable("vnfAdapterRestV1Response", null); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); @@ -119,9 +122,10 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() { + vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); - assertNull(vfModule.getHeatStackId()); + assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); } @Test @@ -133,9 +137,10 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() { + vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); - assertNull(vfModule.getHeatStackId()); + assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); } @Test @@ -157,10 +162,43 @@ public class VnfAdapterImplTest extends BaseTaskTest { expectedException.expect(BpmnError.class); execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(volumeGroup.getHeatStackId()); } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() { + volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(volumeGroup.getHeatStackId()); + } + + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() { + volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); + execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() { + expectedException.expect(BpmnError.class); + execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() { + volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); + execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); + } @Test - public void postProcessVnfAdapterExceptionTest() { + public void postProcessVnfAdapterExceptionTest() { execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); expectedException.expect(BpmnError.class); lookupKeyMap.clear(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java new file mode 100644 index 0000000000..9e1dac69e0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.appc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.HashMap; +import java.util.Optional; +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.springframework.beans.factory.annotation.Autowired; + +public class AppcRunTasksITTest extends BaseTaskTest { + + @Autowired + private AppcRunTasks appcRunTasks; + + private GenericVnf genericVnf; + private RequestContext requestContext; + private String msoRequestId; + + @Before + public void before() { + genericVnf = setGenericVnf(); + msoRequestId = UUID.randomUUID().toString(); + requestContext = setRequestContext(); + requestContext.setMsoRequestId(msoRequestId); + gBBInput.setRequestContext(requestContext); + } + + @Test + public void preProcessActivityTest() throws Exception { + appcRunTasks.preProcessActivity(execution); + assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic); + assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false); + } + + @Test + public void runAppcCommandTest() throws Exception { + Action action = Action.QuiesceTraffic; + ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference(); + controllerSelectionReference.setControllerName("testName"); + controllerSelectionReference.setActionCategory(action.toString()); + controllerSelectionReference.setVnfType("testVnfType"); + + doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.QuiesceTraffic.toString()); + + execution.setVariable("aicIdentity", "testAicIdentity"); + + String vnfId = genericVnf.getVnfId(); + genericVnf.setIpv4OamAddress("testOamIpAddress"); + String payload = "{\"testName\":\"testValue\",}"; + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setPayload(payload); + gBBInput.getRequestContext().setRequestParameters(requestParameters); + + String controllerType = "testName"; + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName1"); + payloadInfo.put("aicIdentity", "testAicIdentity"); + payloadInfo.put("vnfHostIpAddress", "testOamIpAddress"); + payloadInfo.put("vserverIdList", null); + payloadInfo.put("vfModuleId", null); + payloadInfo.put("identityUrl", null); + payloadInfo.put("vmIdList", null); + + doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + + appcRunTasks.runAppcCommand(execution, action); + verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java new file mode 100644 index 0000000000..7cade7703a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java @@ -0,0 +1,36 @@ +package org.onap.so.bpmn.infrastructure.appc.tasks; + +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; + +import org.junit.Test; +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public class AppcRunTasksTest { + + + private AppcRunTasks appcRunTasks = new AppcRunTasks(); + @Test + public void mapRollbackVariablesTest() { + + BuildingBlockExecution mock = mock(BuildingBlockExecution.class); + + appcRunTasks.mapRollbackVariables(mock, Action.Lock, "1"); + verify(mock, times(0)).setVariable(any(String.class), any()); + appcRunTasks.mapRollbackVariables(mock, Action.Lock, "0"); + verify(mock, times(1)).setVariable("rollbackVnfLock", true); + appcRunTasks.mapRollbackVariables(mock, Action.Unlock, "0"); + verify(mock, times(1)).setVariable("rollbackVnfLock", false); + appcRunTasks.mapRollbackVariables(mock, Action.Start, "0"); + verify(mock, times(1)).setVariable("rollbackVnfStop", false); + appcRunTasks.mapRollbackVariables(mock, Action.Stop, "0"); + verify(mock, times(1)).setVariable("rollbackVnfStop", true); + appcRunTasks.mapRollbackVariables(mock, Action.QuiesceTraffic, "0"); + verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", true); + appcRunTasks.mapRollbackVariables(mock, Action.ResumeTraffic, "0"); + verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", false); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java index 6a40db3eaa..cc96326563 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java @@ -7,9 +7,9 @@ * 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. @@ -44,7 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired; public class SDNCAssignTasksTest extends BaseTaskTest{ @Autowired private SDNCAssignTasks sdncAssignTasks; - + private L3Network network; private ServiceInstance serviceInstance; private RequestContext requestContext; @@ -53,7 +53,7 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ private VfModule vfModule; private VolumeGroup volumeGroup; private Customer customer; - + @Before public void before() { customer = setCustomer(); @@ -66,7 +66,7 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ volumeGroup = setVolumeGroup(); } - + @Test public void assignServiceInstanceTest() throws Exception { doReturn("response").when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); @@ -76,35 +76,36 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ verify(sdncServiceInstanceResources, times(1)).assignServiceInstance(serviceInstance, customer, requestContext); assertTrue(execution.getVariable("SDNCResponse").equals("response")); } - + @Test public void assignServiceInstanceExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - + doThrow(Exception.class).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); sdncAssignTasks.assignServiceInstance(execution); } - + @Test public void assignVnfTest() throws Exception { doReturn("response").when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + execution.setVariable("generalBuildingBlock", gBBInput); sdncAssignTasks.assignVnf(execution); verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance,customer, cloudRegion, requestContext, false); assertTrue(execution.getVariable("SDNCResponse").equals("response")); } - + @Test public void assignVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - + doThrow(Exception.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); - + sdncAssignTasks.assignVnf(execution); } - + @Test public void assignVfModuleTest() throws Exception { doReturn("response").when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); @@ -114,16 +115,16 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ verify(sdncVfModuleResources, times(1)).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); assertTrue(execution.getVariable("SDNCAssignResponse_" + vfModule.getVfModuleId()).equals("response")); } - + @Test public void assignVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - + doThrow(Exception.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); sdncAssignTasks.assignVfModule(execution); } - + @Test public void assignNetworkTest() throws Exception { doReturn("response").when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); @@ -132,11 +133,11 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ verify(sdncNetworkResources, times(1)).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); } - + @Test public void assignNetworkExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - + doThrow(Exception.class).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); sdncAssignTasks.assignNetwork(execution); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java new file mode 100644 index 0000000000..03ed2cb4d4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasksTest.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.springframework.beans.factory.annotation.Autowired; + +public class FlowCompletionTasksTest extends BaseTaskTest { + + @Autowired + protected FlowCompletionTasks flowCompletionTasks; + + @Before + public void before() { + setRequestContext(); + } + + @Test + public void updateRequestDbStatusComplete_Test() throws Exception{ + InfraActiveRequests mockedRequest = new InfraActiveRequests(); + when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest); + doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class)); + flowCompletionTasks.updateRequestDbStatus(execution); + verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class)); + assertEquals(mockedRequest.getRequestStatus(), "COMPLETE"); + } + + @Test + public void updateRequestDbStatusFailed_Test() throws Exception{ + WorkflowException workflowException = new WorkflowException("testProcessKey", 7000, "Error"); + execution.setVariable("WorkflowException", workflowException); + InfraActiveRequests mockedRequest = new InfraActiveRequests(); + when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest); + doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class)); + flowCompletionTasks.updateRequestDbStatus(execution); + verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class)); + assertEquals(mockedRequest.getRequestStatus(), "FAILED"); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java index 27173b7502..6cac238482 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -153,55 +153,56 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); BuildingBlock bb1 = new BuildingBlock(); - bb1.setBpmnFlowName("CreateNetworkBB"); + bb1.setBpmnFlowName("AssignVfModuleBB"); flowsToExecute.add(ebb1); ebb1.setBuildingBlock(bb1); ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("ActivateNetworkBB"); + bb2.setBpmnFlowName("CreateVfModuleBB"); + flowsToExecute.add(ebb2); + ebb2.setBuildingBlock(bb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("ActivateVfModuleBB"); + flowsToExecute.add(ebb3); + ebb3.setBuildingBlock(bb3); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 2); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + } + + @Test + public void rollbackExecutionPathUnfinishedFlowTest(){ + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); + BuildingBlock bb1 = new BuildingBlock(); + bb1.setBpmnFlowName("AssignVfModuleBB"); + flowsToExecute.add(ebb1); + ebb1.setBuildingBlock(bb1); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("CreateVfModuleBB"); flowsToExecute.add(ebb2); ebb2.setBuildingBlock(bb2); ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("CreateVolumeGroupBB"); + bb3.setBpmnFlowName("ActivateVfModuleBB"); flowsToExecute.add(ebb3); ebb3.setBuildingBlock(bb3); - ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); - BuildingBlock bb4 = new BuildingBlock(); - bb4.setBpmnFlowName("ActivateVolumeGroupBB"); - flowsToExecute.add(ebb4); - ebb4.setBuildingBlock(bb4); - ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); - BuildingBlock bb5 = new BuildingBlock(); - bb5.setBpmnFlowName("CreateVfModuleBB"); - flowsToExecute.add(ebb5); - ebb5.setBuildingBlock(bb5); - ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); - BuildingBlock bb6 = new BuildingBlock(); - bb6.setBpmnFlowName("ActivateVfModuleBB"); - flowsToExecute.add(ebb6); - ebb6.setBuildingBlock(bb6); - ExecuteBuildingBlock ebb7 = new ExecuteBuildingBlock(); - BuildingBlock bb7 = new BuildingBlock(); - bb7.setBpmnFlowName("ActivateVnfBB"); - ebb7.setBuildingBlock(bb7); - flowsToExecute.add(ebb7); - ExecuteBuildingBlock ebb8 = new ExecuteBuildingBlock(); - BuildingBlock bb8 = new BuildingBlock(); - bb8.setBpmnFlowName("ActivateServiceInstance"); - ebb8.setBuildingBlock(bb8); - flowsToExecute.add(ebb8); execution.setVariable("flowsToExecute", flowsToExecute); - execution.setVariable("gCurrentSequence", 6); + execution.setVariable("gCurrentSequence", 1); workflowActionBBTasks.rollbackExecutionPath(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); - assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeactivateVolumeGroupBB"); - assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"DeleteVolumeGroupBB"); - assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); - assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java new file mode 100644 index 0000000000..149417d89b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Intel Corp. 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.oof; + +import com.fasterxml.jackson.core.JsonProcessingException; +import org.junit.Test; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.oof.OofClient; +import org.onap.so.client.oof.beans.OofRequest; +import org.springframework.beans.factory.annotation.Autowired; + +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.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + + +public class OofClientTestIT { + + @Autowired + private OofClient client; + + + @Test(expected = Test.None.class) + public void testPostDemands_success() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}"; + + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postDemands(new OofRequest()); + } + + @Test(expected = Test.None.class) + public void testAsyncResponse_success() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}"; + + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postDemands(new OofRequest()); + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}"; + + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new OofRequest()); + + //TODO assertEquals("missing data", ); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; + + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new OofRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}"; + + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new OofRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException { + String mockResponse = "{ }"; + + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new OofRequest()); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java index eb17ad0ff9..e30fe660c3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java @@ -20,6 +20,8 @@ package org.onap.so.client.sdn.common; +import static org.junit.Assert.assertEquals; + import java.util.LinkedHashMap; import org.junit.Assert; @@ -58,10 +60,12 @@ public class SdnCommonTasksTest{ @Test public void validateSDNResponseTest() throws BadResponseException { - LinkedHashMap responseMap = new LinkedHashMap(); - responseMap.put("response-code", "0"); - responseMap.put("response-message", "success"); - Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap)); + LinkedHashMap<String, Object> responseMap = new LinkedHashMap<>(); + LinkedHashMap<String, Object> output = new LinkedHashMap<>(); + output.put("response-code", "0"); + output.put("response-message", "success"); + responseMap.put("output", output); + assertEquals("success", sdnCommonTasks.validateSDNResponse(responseMap)); } @Test @@ -74,10 +78,12 @@ public class SdnCommonTasksTest{ @Test public void validateSDNResponseTestRespCodeNot200() throws BadResponseException { expectedException.expect(BadResponseException.class); - LinkedHashMap responseMap = new LinkedHashMap(); - responseMap.put("response-code", "300"); - responseMap.put("response-message", "Failed"); - Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap)); + LinkedHashMap<String, Object> responseMap = new LinkedHashMap<>(); + LinkedHashMap<String, Object> output = new LinkedHashMap<>(); + output.put("response-code", "300"); + output.put("response-message", "Failed"); + responseMap.put("output", output); + sdnCommonTasks.validateSDNResponse(responseMap); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java index 2492638520..e24ca339a3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java @@ -22,7 +22,9 @@ package org.onap.so.client.sdnc; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; import java.io.IOException; @@ -34,6 +36,7 @@ import org.junit.Test; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.skyscreamer.jsonassert.JSONAssert; import com.github.tomakehurst.wiremock.junit.WireMockRule; @@ -55,4 +58,31 @@ public class SDNCClientTest extends BaseTaskTest { String response = SPY_sdncClient.get(queryLink); JSONAssert.assertEquals(responseJson, response, false); } + + @Test(expected = BadResponseException.class) + public void post404Test() throws BadResponseException, MapperException, IOException { + String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut404Response.json"))); + + String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/"; + + wireMockRule.stubFor(post(urlMatching(queryLink)) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json").withBody(responseJson))); + + SPY_sdncClient.post("", SDNCTopology.NETWORK); + } + + @Test + public void post200Test() throws BadResponseException, MapperException, IOException { + String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut200Response.json"))); + + String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/"; + + wireMockRule.stubFor(post(urlMatching(queryLink)) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json").withBody(responseJson))); + + String response = SPY_sdncClient.post("", SDNCTopology.NETWORK); + JSONAssert.assertEquals("", response, false); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/OofHoming/oofCallbackInfraVnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/OofHoming/oofCallbackInfraVnf.json new file mode 100644 index 0000000000..15e601bae8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/OofHoming/oofCallbackInfraVnf.json @@ -0,0 +1,50 @@ +{ + "transactionId": "xxx-xxx-xxxx", + "requestId": "yyy-yyy-yyyy", + "requestStatus": "completed", + "statusMessage": "success", + "solutions": { + "placementSolutions": [ + [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "vnfHostName", "value": "ahr344gh" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } + ] + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "amazon", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, + { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} + ] + } + ] + ], + "licenseSolutions": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json index a24f8bf125..8e43f2a1e5 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json @@ -1,4 +1,5 @@ { +"vf-module-topology":{ "vf-module-assignments": { "vms": { "vm": [ @@ -175,4 +176,4 @@ } ] } -}
\ No newline at end of file +}}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json index eaedb92281..2036501572 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json @@ -1,4 +1,5 @@ { +"vf-module-topology":{ "vf-module-assignments": { "vms": { "vm": [ @@ -176,4 +177,4 @@ ] }, "sdnc-generated-cloud-resources": "true" -}
\ No newline at end of file +}}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json index 39c6708631..5a5b2febbd 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json @@ -1,4 +1,5 @@ { +"vnf-topology":{ "vnf-resource-assignments": { "availability-zones": { "availability-zone": [ @@ -45,4 +46,5 @@ "vnf-topology-identifier-structure": {}, "onap-model-information": {}, "aic-cloud-region": "" +} }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json index 21ba0876f5..73e36758fc 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json @@ -1,4 +1,5 @@ { +"vnf-topology":{ "vnf-resource-assignments": { "availability-zones": { "availability-zone": [ @@ -45,4 +46,4 @@ "vnf-topology-identifier-structure": {}, "onap-model-information": {}, "aic-cloud-region": "" -}
\ No newline at end of file +}}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json index 5062a06117..e6ea0b2e5c 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json @@ -1,4 +1,5 @@ { +"vnf-topology":{ "vnf-resource-assignments": { "availability-zones": { "availability-zone": [ @@ -65,4 +66,4 @@ "vnf-topology-identifier-structure": {}, "onap-model-information": {}, "aic-cloud-region": "" -}
\ No newline at end of file +}}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json index fedee49609..3ca3403d47 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json @@ -1,4 +1,5 @@ { +"vnf-topology":{ "vnf-resource-assignments": { "availability-zones": { "availability-zone": [ @@ -44,4 +45,4 @@ "onap-model-information": {}, "aic-cloud-region": "", "sdnc-generated-cloud-resources": "true" -}
\ No newline at end of file +}}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json index a6964a323f..7690c6bf54 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json @@ -1,4 +1,5 @@ { +"vnf-topology":{ "vnf-resource-assignments": { "availability-zones": { "availability-zone": "zone0" @@ -41,4 +42,4 @@ "vnf-topology-identifier-structure": {}, "onap-model-information": {}, "aic-cloud-region": "" -}
\ No newline at end of file +}}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json index cc32040f38..91d64b98ca 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json @@ -47,6 +47,7 @@ "model-uuid" : "modelUuid", "model-invariant-uuid" : "modelInvariantUuid" }, + "from-preload": null, "network-id" : "TEST_NETWORK_ID", "network-type" : null } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json index 40946725d9..95a2af3880 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json @@ -46,6 +46,7 @@ "model-uuid" : "modelUuid", "model-invariant-uuid" : "modelInvariantUuid" }, + "from-preload": null, "network-id" : "TEST_NETWORK_ID", "network-type" : null } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json index 7ca8153def..a7cf1e1434 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json @@ -47,6 +47,7 @@ "model-uuid" : "modelUuid", "model-invariant-uuid" : "modelInvariantUuid" }, + "from-preload": null, "network-id" : "TEST_NETWORK_ID", "network-type" : null } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json index 50d5642fee..a344e8081e 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json @@ -55,6 +55,7 @@ "model-invariant-uuid" : "vfModuleModelInvariantUuid" }, "vf-module-id" : "testVfModuleId", + "from-preload" : null, "vf-module-type": "vfModuleModelName" }, diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json index 64192ff8d0..f06d72a806 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json @@ -21,8 +21,9 @@ "svc-action" : "unassign" }, "vf-module-information" : { - "vf-module-id" : "testVfModuleId" - }, + "vf-module-id" : "testVfModuleId", + "from-preload": null + }, "vnf-information" : { "vnf-id" : "testVnfId", "vnf-type" : "testVnfType" diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPut200Response.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPut200Response.json new file mode 100644 index 0000000000..286ce4c844 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPut200Response.json @@ -0,0 +1,15 @@ +{ + "output": { + "svc-request-id": "5d24d40e-4c77-4c06-94a3-6d168c47a57c", + "network-response-information": { + "instance-id": "4063e0aa-af13-4872-8473-b40c94f9316b", + "object-path": "restconf/config/GENERIC-RESOURCE-API:services/service/2c9c7996-75a7-4f92-becc-9e13e8bd288a/service-data/networks/network/4063e0aa-af13-4872-8473-b40c94f9316b/network-data/network-topology/" + }, + "response-code": "200", + "service-response-information": { + "instance-id": "2c9c7996-75a7-4f92-becc-9e13e8bd288a" + }, + "response-message": "", + "ack-final-indicator": "Y" + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPut404Response.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPut404Response.json new file mode 100644 index 0000000000..cf0254886d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPut404Response.json @@ -0,0 +1,8 @@ +{ + "output": { + "svc-request-id": "086a7a09-1470-4977-8b3e-307488b8811a", + "response-code": "404", + "response-message": "invalid input: the service-instance does not have any service data in SDNC", + "ack-final-indicator": "Y" + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..feb7ede50b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<createVolumeGroupResponse> + <messageId>{{MESSAGE-ID}}</messageId> + <volumeGroupCreated>true</volumeGroupCreated> + <volumeGroupId>d485ecee-957c-4a0a-8b95-27a22b90103f</volumeGroupId> + <volumeGroupOutputs> + <entry> + <key>mmsc_vol_1</key> + <value>a73e0fe9-1ce8-49c2-8fef-e2788605be29</value> + </entry> + <entry> + <key>mmsc_vol_2</key> + <value>37b6455a-5ea8-463a-89e3-0efeaf7b7c6d</value> + </entry> + <entry> + <key>nemsfe_vol_1</key> + <value>b7ff1c21-d138-49a3-bf13-4cfd91efaf48</value> + </entry> + <entry> + <key>nemsbe_vol_1</key> + <value>a5988471-cd42-44d8-b078-64f2f13d3d4c</value> + </entry> + <entry> + <key>mmsc_vol_5</key> + <value>f7b91c1e-ab8c-413a-a850-ba80a246c7e0</value> + </entry> + <entry> + <key>nemsfe_vol_2</key> + <value>957ea3f3-2d4a-4707-bfd2-ba66f42037c2</value> + </entry> + <entry> + <key>mmsc_vol_3</key> + <value>de6fccfe-d61a-48b0-b03b-87bf1bf749b3</value> + </entry> + <entry> + <key>mmsc_vol_4</key> + <value>76162310-2c38-4c32-981c-5c2880190077</value> + </entry> + </volumeGroupOutputs> + <volumeGroupRollback> + <cloudSiteId>RDM2WAGPLCP</cloudSiteId> + <messageId>e585e4f4-9452-437a-b294-45a2d6d3b7a3</messageId> + <msoRequest> + <requestId>c30b9453-4b68-4c2e-aacf-58a5ba648bf5</requestId> + <serviceInstanceId>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</serviceInstanceId> + </msoRequest> + <tenantId>1bbab536a19b4756926e7d0ec1eb543c</tenantId> + <volumeGroupCreated>true</volumeGroupCreated> + <volumeGroupId>78987</volumeGroupId> + <volumeGroupStackId>ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef</volumeGroupStackId> + </volumeGroupRollback> + <volumeGroupStackId>testHeatStackId1</volumeGroupStackId> +</createVolumeGroupResponse> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..25aa45afd9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<deleteVolumeGroupResponse> + <messageId>{{MESSAGE-ID}}</messageId> + <volumeGroupDeleted>true</volumeGroupDeleted> +</deleteVolumeGroupResponse> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml new file mode 100644 index 0000000000..b5b61192f7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml @@ -0,0 +1,56 @@ +<deleteVfModuleResponse> + <messageId>testMessageId</messageId> + <vfModuleDeleted>true</vfModuleDeleted> + <vfModuleId>testVfModuleId</vfModuleId> + <vfModuleOutputs> + <entry> + <key>key1</key> + <value>value1</value> + </entry> + <entry> + <key>key2</key> + <value>value2</value> + </entry> + <entry> + <key>server1_private_ip</key> + <value>192.168.28.3</value> + </entry> + <entry> + <key>contrail-service-instance-fqdn</key> + <value>default-domain:MSOTest:MsoNW-RA</value> + </entry> + <entry> + <key>policyKey1_contrail_network_policy_fqdn</key> + <value>MSOTest:DefaultPolicyFQDN1</value> + </entry> + <entry> + <key>policyKey2_contrail_network_policy_fqdn</key> + <value>MSOTest:DefaultPolicyFQDN2</value> + </entry> + <entry> + <key>oam_management_v6_address</key> + <value>2000:abc:bce:1111</value> + </entry> + <entry> + <key>oam_management_v4_address</key> + <value>127.0.0.1</value> + </entry> + <entry> + <key>internal_security_group</key> + <value>test_internal_security_group</value> + </entry> + <entry> + <key>int_internal_net_id</key> + <value>test_int_internal_net_id</value> + </entry> + <entry> + <key>dsx_server_group_id</key> + <value>test_dsx_server_group_id</value> + </entry> + <entry> + <key>mcas_host_key</key> + <value>test_mcas_host_key</value> + </entry> + </vfModuleOutputs> + <vnfId>testVnfId</vnfId> +</deleteVfModuleResponse>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml index 8a3ce7f099..4562ebdaea 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml @@ -190,6 +190,12 @@ sniro: headers.patchVersion: 1 headers.minorVersion: 1 headers.latestVersion: 2 +oof: + timeout: PT30M + host: http://localhost:${wiremock.server.port} + uri.v1: /api/oof/v1/placement + uri.v2: /api/oof/v2/placement + headers.auth: Basic dGVzdDp0ZXN0cHdk spring: datasource: url: jdbc:mariadb://localhost:3307/camundabpmn diff --git a/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java b/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java index bfe7f164b2..9a05602b34 100644 --- a/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java +++ b/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java @@ -20,7 +20,15 @@ package org.onap.so.cloudify.connector.http; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.mock; +import java.net.URI; +import java.net.URISyntaxException; +import org.apache.http.HttpRequest; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolException; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; @@ -29,6 +37,8 @@ import org.apache.http.client.methods.HttpPatch; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpTrace; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.protocol.HttpContext; import org.junit.Test; public class HttpClientRedirectStrategyTest { @@ -50,4 +60,44 @@ public class HttpClientRedirectStrategyTest { assertThat(httpClientRedirectStrategy.isRedirectable(HttpDelete.METHOD_NAME)).isTrue(); assertThat(httpClientRedirectStrategy.isRedirectable(HttpHead.METHOD_NAME)).isTrue(); } + + @Test + public void getRedirect_shouldReturnHttpHeadUriRequest() throws URISyntaxException, ProtocolException { + assertHttpUriRequestFor(HttpHead.METHOD_NAME, HttpHead.class); + } + + @Test + public void getRedirect_shouldReturnHttpGetUriRequest() throws URISyntaxException, ProtocolException { + assertHttpUriRequestFor(HttpGet.METHOD_NAME, HttpGet.class); + } + + private void assertHttpUriRequestFor(String methodName, Class<? extends HttpUriRequest> expectedHttpMethodClass) + throws URISyntaxException, ProtocolException { + // GIVEN + HttpRequest request = mock(HttpRequest.class, RETURNS_DEEP_STUBS); + given(request.getRequestLine().getMethod()).willReturn(methodName); + HttpResponse response = null; + HttpContext context = null; + URI expectedUri = new URI("http://localhost/host"); + // WHEN + HttpUriRequest httpUriRequest = new TestableHttpClientRedirectStrategy(expectedUri) + .getRedirect(request, response, context); + // THEN + assertThat(httpUriRequest).isInstanceOf(expectedHttpMethodClass); + assertThat(httpUriRequest.getURI()).isEqualTo(expectedUri); + } + + private static class TestableHttpClientRedirectStrategy extends HttpClientRedirectStrategy { + + private final URI expectedUri; + + public TestableHttpClientRedirectStrategy(URI expectedUri) { + this.expectedUri = expectedUri; + } + + @Override + public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) { + return expectedUri; + } + } }
\ No newline at end of file diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java index 631850a01f..1a453c6b2f 100644 --- a/common/src/main/java/org/onap/so/client/RestClient.java +++ b/common/src/main/java/org/onap/so/client/RestClient.java @@ -271,7 +271,7 @@ public abstract class RestClient { return format(method("DELETE", obj), resultClass).orElse(null); } - private Response method(String method, Object entity) { + public Response method(String method, Object entity) { RetryPolicy policy = new RetryPolicy(); List<Predicate<Throwable>> items = retryOn(); diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java index cb2839ae1f..ac4a8d1a7c 100644 --- a/common/src/main/java/org/onap/so/client/RestClientSSL.java +++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java @@ -56,7 +56,7 @@ public abstract class RestClientSSL extends RestClient { KeyStore ks = getKeyStore(); if(ks != null) { client = ClientBuilder.newBuilder().keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build(); - logger.debug("RestClientSSL not using default SSL context - setting keystore here."); + logger.info("RestClientSSL not using default SSL context - setting keystore here."); return client; } } diff --git a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java index ad833208dc..14556f1211 100644 --- a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java +++ b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java @@ -20,8 +20,10 @@ package org.onap.so.client; +import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.BufferingClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; @@ -30,6 +32,9 @@ public class RestTemplateConfig { @Bean public RestTemplate restTemplate() { - return new RestTemplate( new HttpComponentsClientHttpRequestFactory()); + RestTemplate restTemplate = new RestTemplate(); + restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); + restTemplate.getInterceptors().add(new SpringClientFilter()); + return restTemplate; } } diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java index c50653a203..553c1e0db0 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java @@ -33,7 +33,8 @@ public enum AAIObjectPlurals implements GraphInventoryObjectPlurals { SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions"), SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances"), OWNING_ENTITIES(AAINamespaceConstants.BUSINESS, "/owning-entities"), - VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/"); + VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/"), + AVAILIBILITY_ZONE(AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones/"); private final String uriTemplate; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java index a5d8f12e83..4b646f9ed7 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java @@ -27,6 +27,7 @@ import org.onap.aai.annotations.Metadata; import org.onap.aai.domain.yang.AllottedResource; import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.Collection; +import org.onap.aai.domain.yang.Complex; import org.onap.aai.domain.yang.Configuration; import org.onap.aai.domain.yang.Customer; import org.onap.aai.domain.yang.GenericVnf; @@ -64,6 +65,7 @@ public enum AAIObjectType implements GraphInventoryObjectType { CUSTOMER(AAINamespaceConstants.BUSINESS, Customer.class), GENERIC_QUERY("/search", "/generic-query"), BULK_PROCESS("/bulkprocess", ""), + SINGLE_TRANSACTION("/bulk/single-transaction", ""), GENERIC_VNF(AAINamespaceConstants.NETWORK, GenericVnf.class), VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class), L3_NETWORK(AAINamespaceConstants.NETWORK, L3Network.class), @@ -98,6 +100,7 @@ public enum AAIObjectType implements GraphInventoryObjectType { COLLECTION(AAINamespaceConstants.NETWORK, Collection.class), VNFC(AAINamespaceConstants.NETWORK, Vnfc.class), VLAN_TAG(AAINamespaceConstants.NETWORK, VlanTag.class), + COMPLEX(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Complex.class), UNKNOWN("", ""); private final String uriTemplate; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIPatchConverter.java b/common/src/main/java/org/onap/so/client/aai/AAIPatchConverter.java new file mode 100644 index 0000000000..6ccb592409 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/aai/AAIPatchConverter.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai; + +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException; +import org.onap.so.jsonpath.JsonPathUtil; + +import com.fasterxml.jackson.core.JsonProcessingException; + +public class AAIPatchConverter { + + private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider(); + private static final AAICommonObjectMapperPatchProvider patchProvider = new AAICommonObjectMapperPatchProvider(); + private static final Pattern LOCATE_COMPLEX_OBJECT = Pattern.compile("^((?!relationship-list).)+?\\['[^\\[\\]]+?'\\]$"); + + + protected String convertPatchFormat(Object obj) { + return validatePatchObject(marshallObjectToPatchFormat(obj)); + } + + protected String validatePatchObject(String payload) { + if (hasComplexObject(payload)) { + throw new GraphInventoryPatchDepthExceededException(payload); + } + + return payload; + } + + /** validates client side that json does not include any complex objects + * relationship-list is omitted from this validation + */ + protected boolean hasComplexObject(String json) { + if (json.isEmpty()) { + return false; + } + String complex = "$.*.*"; + String array = "$.*.*.*"; + List<String> result = JsonPathUtil.getInstance().getPathList(json, complex); + List<String> result2 = JsonPathUtil.getInstance().getPathList(json, array); + + result.addAll(result2); + return result.stream().anyMatch(item -> LOCATE_COMPLEX_OBJECT.matcher(item).find()); + } + + protected String marshallObjectToPatchFormat(Object obj) { + Object value = obj; + try { + if (!(obj instanceof Map || obj instanceof String)) { + value = patchProvider.getMapper().writeValueAsString(obj); + } else if (obj instanceof Map) { + value = standardProvider.getMapper().writeValueAsString(obj); + } + } catch (JsonProcessingException e) { + value = "{}"; + } + + return (String)value; + } +} diff --git a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java index 072534d6f6..7e4397ec29 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java @@ -309,6 +309,15 @@ public class AAIResourcesClient extends AAIClient { return new AAITransactionalClient(this.getVersion()); } + /** + * Starts a transaction groups multiple A&AI mutations + * + * @return + */ + public AAISingleTransactionClient beginSingleTransaction() { + return new AAISingleTransactionClient(this.getVersion()); + } + private AAIUri addParams(Optional<Depth> depth, boolean nodesOnly, AAIUri uri) { AAIUri clone = uri.clone(); if (depth.isPresent()) { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java index 2bd5f118c0..ac6e939e9e 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java @@ -20,6 +20,8 @@ package org.onap.so.client.aai; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; + import java.net.URI; import java.util.List; import java.util.Map; @@ -41,9 +43,9 @@ public class AAIRestClient extends RestClientSSL { private final AAIProperties aaiProperties; private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider(); - private static final AAICommonObjectMapperPatchProvider patchProvider = new AAICommonObjectMapperPatchProvider(); - private static final Pattern LOCATE_COMPLEX_OBJECT = Pattern.compile("^((?!relationship-list).)+?\\['[^\\[\\]]+?'\\]$"); + private final AAIPatchConverter patchConverter = new AAIPatchConverter(); + protected AAIRestClient(AAIProperties props, URI uri) { super(props, Optional.of(uri)); this.aaiProperties = props; @@ -79,53 +81,20 @@ public class AAIRestClient extends RestClientSSL { @Override public Response patch(Object obj) { - String value = convertObjectToPatchFormat(obj); - validatePatchObject(value); - return super.patch(value); + return super.patch(convertToPatchFormat(obj)); } @Override public <T> T patch(Object obj, Class<T> resultClass) { - String value = convertObjectToPatchFormat(obj); - validatePatchObject(value); - return super.patch(value, resultClass); + return super.patch(convertToPatchFormat(obj), resultClass); } - protected String convertObjectToPatchFormat(Object obj) { - Object value = obj; - try { - if (!(obj instanceof Map || obj instanceof String)) { - value = patchProvider.getMapper().writeValueAsString(obj); - } else if (obj instanceof Map) { - value = standardProvider.getMapper().writeValueAsString(obj); - } - } catch (JsonProcessingException e) { - value = "{}"; - } - - return (String)value; + protected AAIPatchConverter getPatchConverter() { + return this.patchConverter; } - - protected void validatePatchObject(String payload) { - if (hasComplexObject(payload)) { - throw new GraphInventoryPatchDepthExceededException(payload); - } - } - - /** validates client side that json does not include any complex objects - * relationship-list is omitted from this validation - */ - protected boolean hasComplexObject(String json) { - if (json.isEmpty()) { - return false; - } - String complex = "$.*.*"; - String array = "$.*.*.*"; - List<String> result = JsonPathUtil.getInstance().getPathList(json, complex); - List<String> result2 = JsonPathUtil.getInstance().getPathList(json, array); - - result.addAll(result2); - return result.stream().anyMatch(item -> LOCATE_COMPLEX_OBJECT.matcher(item).find()); + protected String convertToPatchFormat(Object obj) { + return getPatchConverter().convertPatchFormat(obj); } + } diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java new file mode 100644 index 0000000000..2ecdb7c480 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java @@ -0,0 +1,267 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; + +import javax.ws.rs.NotFoundException; +import javax.ws.rs.core.GenericType; + +import org.onap.aai.domain.yang.Relationship; +import org.onap.so.client.RestClient; +import org.onap.so.client.aai.entities.AAIEdgeLabel; +import org.onap.so.client.aai.entities.AAIError; +import org.onap.so.client.aai.entities.bulkprocess.Transactions; +import org.onap.so.client.aai.entities.singletransaction.OperationBodyRequest; +import org.onap.so.client.aai.entities.singletransaction.OperationBodyResponse; +import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest; +import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse; +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.onap.so.client.graphinventory.exceptions.BulkProcessFailed; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Joiner; + +public class AAISingleTransactionClient extends AAIClient { + + private final SingleTransactionRequest request; + private final AAIVersion version; + private int actionCount = 0; + + private final AAIPatchConverter patchConverter = new AAIPatchConverter(); + + protected AAISingleTransactionClient(AAIVersion version) { + super(); + this.version = version; + this.request = new SingleTransactionRequest(); + } + + /** + * creates a new object in A&AI + * + * @param obj - can be any object which will marshal into a valid A&AI payload + * @param uri + * @return + */ + public AAISingleTransactionClient create(AAIResourceUri uri, Object obj) { + request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri.build().toString()).withBody(obj)); + incrementActionAmount(); + return this; + } + + /** + * creates a new object in A&AI with no payload body + * + * @param uri + * @return + */ + public AAISingleTransactionClient createEmpty(AAIResourceUri uri) { + request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri.build().toString()).withBody(new HashMap<String, String>())); + incrementActionAmount(); + return this; + } + + /** + * Adds a relationship between two objects in A&AI + * @param uriA + * @param uriB + * @return + */ + public AAISingleTransactionClient connect(AAIResourceUri uriA, AAIResourceUri uriB) { + AAIResourceUri uriAClone = uriA.clone(); + request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uriAClone.relationshipAPI().build().toString()).withBody(this.buildRelationship(uriB))); + incrementActionAmount(); + return this; + } + + /** + * relationship between multiple objects in A&AI - connects A to all objects specified in list + * + * @param uriA + * @param uris + * @return + */ + public AAISingleTransactionClient connect(AAIResourceUri uriA, List<AAIResourceUri> uris) { + for (AAIResourceUri uri : uris) { + this.connect(uriA, uri); + } + return this; + } + + public AAISingleTransactionClient connect(AAIResourceUri uriA, AAIResourceUri uriB, AAIEdgeLabel label) { + AAIResourceUri uriAClone = uriA.clone(); + RestClient aaiRC = this.createClient(uriAClone.relationshipAPI()); + aaiRC.put(this.buildRelationship(uriB, label)); + return this; + } + + public AAISingleTransactionClient connect(AAIResourceUri uriA, List<AAIResourceUri> uris, AAIEdgeLabel label) { + for (AAIResourceUri uri : uris) { + this.connect(uriA, uri, label); + } + return this; + } + + /** + * Removes relationship from two objects in A&AI + * + * @param uriA + * @param uriB + * @return + */ + public AAISingleTransactionClient disconnect(AAIResourceUri uriA, AAIResourceUri uriB) { + AAIResourceUri uriAClone = uriA.clone(); + request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uriAClone.relationshipAPI().build().toString()).withBody(this.buildRelationship(uriB))); + incrementActionAmount(); + return this; + } + + /** + * Removes relationship from multiple objects - disconnects A from all objects specified in list + * @param uriA + * @param uris + * @return + */ + public AAISingleTransactionClient disconnect(AAIResourceUri uriA, List<AAIResourceUri> uris) { + for (AAIResourceUri uri : uris) { + this.disconnect(uriA, uri); + } + return this; + } + /** + * Deletes object from A&AI. Automatically handles resource-version. + * + * @param uri + * @return + */ + public AAISingleTransactionClient delete(AAIResourceUri uri) { + AAIResourcesClient client = new AAIResourcesClient(); + AAIResourceUri clone = uri.clone(); + Map<String, Object> result = client.get(new GenericType<Map<String, Object>>(){}, clone) + .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in A&AI")); + String resourceVersion = (String) result.get("resource-version"); + request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(clone.resourceVersion(resourceVersion).build().toString()).withBody("")); + incrementActionAmount(); + return this; + } + + /** + * @param obj - can be any object which will marshal into a valid A&AI payload + * @param uri + * @return + */ + public AAISingleTransactionClient update(AAIResourceUri uri, Object obj) { + + final String payload = getPatchConverter().convertPatchFormat(obj); + request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri.build().toString()).withBody(payload)); + incrementActionAmount(); + return this; + } + + private void incrementActionAmount() { + actionCount++; + } + /** + * Executes all created transactions in A&AI + * @throws BulkProcessFailed + */ + public void execute() throws BulkProcessFailed { + RestClient client = this.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION)); + try { + SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class); + if (response != null) { + final Optional<String> errorMessage = this.locateErrorMessages(response); + if (errorMessage.isPresent()) { + throw new BulkProcessFailed("One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + errorMessage.get()); + } + } else { + throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result."); + } + } finally { + this.request.getOperations().clear(); + this.actionCount = 0; + } + } + + protected Optional<String> locateErrorMessages(SingleTransactionResponse response) { + final List<String> errorMessages = new ArrayList<>(); + final ObjectMapper mapper = new ObjectMapper(); + + for (OperationBodyResponse body : response.getOperationResponses()) { + if (Optional.ofNullable(body.getResponseStatusCode()).orElse(400) > 300) { + AAIError error; + try { + error = mapper.readValue(mapper.writeValueAsString(body.getResponseBody()), AAIError.class); + } catch (IOException e) { + logger.error("could not parse error object from A&AI", e); + error = new AAIError(); + } + AAIErrorFormatter formatter = new AAIErrorFormatter(error); + String outputMessage = formatter.getMessage(); + errorMessages.add(outputMessage); + } + } + + if (!errorMessages.isEmpty()) { + return Optional.of(Joiner.on("\n").join(errorMessages)); + } else { + return Optional.empty(); + } + } + + private Relationship buildRelationship(AAIResourceUri uri) { + return buildRelationship(uri, Optional.empty()); + } + + private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) { + return buildRelationship(uri, Optional.of(label)); + } + private Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) { + final Relationship result = new Relationship(); + result.setRelatedLink(uri.build().toString()); + if (label.isPresent()) { + result.setRelationshipLabel(label.toString()); + } + return result; + } + + @Override + protected AAIVersion getVersion() { + return this.version; + } + + protected SingleTransactionRequest getRequest() { + return this.request; + } + + protected AAIPatchConverter getPatchConverter() { + return this.patchConverter; + } +} diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java index 884d2aaec6..118a3edf1c 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java @@ -20,6 +20,8 @@ package org.onap.so.client.aai; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; + import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -34,6 +36,7 @@ import javax.ws.rs.core.Response; import org.onap.aai.domain.yang.Relationship; import org.onap.so.client.RestClient; +import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.aai.entities.AAIError; import org.onap.so.client.aai.entities.bulkprocess.OperationBody; import org.onap.so.client.aai.entities.bulkprocess.Transaction; @@ -54,6 +57,9 @@ public class AAITransactionalClient extends AAIClient { private Transaction currentTransaction; private final AAIVersion version; private int actionCount = 0; + + private final AAIPatchConverter patchConverter = new AAIPatchConverter(); + protected AAITransactionalClient(AAIVersion version) { super(); this.version = version; @@ -129,6 +135,20 @@ public class AAITransactionalClient extends AAIClient { return this; } + public AAITransactionalClient connect(AAIResourceUri uriA, AAIResourceUri uriB, AAIEdgeLabel label) { + AAIResourceUri uriAClone = uriA.clone(); + RestClient aaiRC = this.createClient(uriAClone.relationshipAPI()); + aaiRC.put(this.buildRelationship(uriB, label)); + return this; + } + + public AAITransactionalClient connect(AAIResourceUri uriA, List<AAIResourceUri> uris, AAIEdgeLabel label) { + for (AAIResourceUri uri : uris) { + this.connect(uriA, uri, label); + } + return this; + } + /** * Removes relationship from two objects in A&AI * @@ -178,7 +198,8 @@ public class AAITransactionalClient extends AAIClient { * @return */ public AAITransactionalClient update(AAIResourceUri uri, Object obj) { - currentTransaction.getPatch().add(new OperationBody().withUri(uri.build().toString()).withBody(obj)); + final String payload = getPatchConverter().convertPatchFormat(obj); + currentTransaction.getPatch().add(new OperationBody().withUri(uri.build().toString()).withBody(payload)); incrementActionAmount(); return this; } @@ -247,9 +268,19 @@ public class AAITransactionalClient extends AAIClient { return Optional.empty(); } } - private Relationship buildRelationship(AAIUri uri) { + private Relationship buildRelationship(AAIResourceUri uri) { + return buildRelationship(uri, Optional.empty()); + } + + private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) { + return buildRelationship(uri, Optional.of(label)); + } + private Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) { final Relationship result = new Relationship(); result.setRelatedLink(uri.build().toString()); + if (label.isPresent()) { + result.setRelationshipLabel(label.toString()); + } return result; } @@ -261,4 +292,8 @@ public class AAITransactionalClient extends AAIClient { protected Transactions getTransactions() { return this.transactions; } + + protected AAIPatchConverter getPatchConverter() { + return this.patchConverter; + } } diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java index 1803440edd..4b2aac1364 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java @@ -23,6 +23,8 @@ package org.onap.so.client.aai.entities.bulkprocess; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ @@ -34,6 +36,7 @@ public class OperationBody { @JsonProperty("uri") private String uri; @JsonProperty("body") +@JsonSerialize(using = OperationBodySerializer.class) private Object body; @JsonProperty("uri") diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java new file mode 100644 index 0000000000..2981e0deef --- /dev/null +++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai.entities.bulkprocess; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class OperationBodySerializer extends StdSerializer<Object> { + + private static final long serialVersionUID = 5367385969270400106L; + + public OperationBodySerializer() { + this(null); + } + public OperationBodySerializer(Class<Object> t) { + super(t); + } + + @Override + public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) + throws IOException, JsonProcessingException { + + if (value instanceof String) { + gen.writeRawValue((String)value); + } else { + gen.writeObject(value); + } + + } + +} + diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java new file mode 100644 index 0000000000..f2626e9e43 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai.entities.singletransaction; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"action", +"uri", +"body" +}) +public class OperationBodyRequest { + +@JsonProperty("action") +private String action; +@JsonProperty("uri") +private String uri; +@JsonProperty("body") +@JsonSerialize(using = OperationBodyRequestSerializer.class) +private Object body; + + +public String getAction() { + return action; +} + +public void setAction(String action) { + this.action = action; +} + +public OperationBodyRequest withAction(String action) { + this.action = action; + return this; +} +@JsonProperty("uri") +public String getUri() { +return uri; +} + +@JsonProperty("uri") +public void setUri(String uri) { +this.uri = uri; +} + +public OperationBodyRequest withUri(String uri) { +this.uri = uri; +return this; +} + +@JsonProperty("body") +public Object getBody() { +return body; +} + +@JsonProperty("body") +public void setBody(Object body) { +this.body = body; +} + +public OperationBodyRequest withBody(Object body) { +this.body = body; +return this; +} + +} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java new file mode 100644 index 0000000000..170719962e --- /dev/null +++ b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai.entities.singletransaction; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class OperationBodyRequestSerializer extends StdSerializer<Object> { + + private static final long serialVersionUID = 5367385969270400106L; + + public OperationBodyRequestSerializer() { + this(null); + } + public OperationBodyRequestSerializer(Class<Object> t) { + super(t); + } + + @Override + public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) + throws IOException, JsonProcessingException { + + if (value instanceof String) { + gen.writeRawValue((String)value); + } else { + gen.writeObject(value); + } + + } + +} + diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java new file mode 100644 index 0000000000..71f65b50db --- /dev/null +++ b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai.entities.singletransaction; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonPropertyOrder({ +"action", +"uri", +"response-status-code", +"response-body" +}) +public class OperationBodyResponse { + + @JsonProperty("action") + public String action; + @JsonProperty("uri") + public String uri; + @JsonProperty("response-status-code") + public Integer responseStatusCode; + @JsonProperty("response-body") + public Object responseBody; + + public String getAction() { + return action; + } + public void setAction(String action) { + this.action = action; + } + public String getUri() { + return uri; + } + public void setUri(String uri) { + this.uri = uri; + } + @JsonProperty("response-status-code") + public Integer getResponseStatusCode() { + return responseStatusCode; + } + @JsonProperty("response-status-code") + public void setResponseStatusCode(Integer responseStatusCode) { + this.responseStatusCode = responseStatusCode; + } + @JsonProperty("response-body") + public Object getResponseBody() { + return responseBody; + } + @JsonProperty("response-body") + public void getResponseBody(Object responseBody) { + this.responseBody = responseBody; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java index e28c465437..0d392c453f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java @@ -18,26 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.client.sdnc; +package org.onap.so.client.aai.entities.singletransaction; -import static org.junit.Assert.*; +import java.util.ArrayList; +import java.util.List; -import java.util.LinkedHashMap; -import java.util.Optional; +import com.fasterxml.jackson.annotation.JsonProperty; -import org.junit.Test; +public class SingleTransactionRequest { -public class SDNCClientLogResponseTest { - - private SDNCClient sdncClient = new SDNCClient(); - - @Test - public void logSDNCResponseTest() { - LinkedHashMap<String, String> output = new LinkedHashMap<>(); - output.put("response-code", "404"); - output.put("response-message", "not found"); - Optional<String> response = sdncClient.logSDNCResponse(output); - assertEquals(true, response.isPresent()); - assertEquals("{\"response-code\":\"404\",\"response-message\":\"not found\"}",response.get()); - } + @JsonProperty("operations") + public List<OperationBodyRequest> operations; + + public List<OperationBodyRequest> getOperations() { + + if (operations == null) { + operations = new ArrayList<>(); + } + + return operations; + } + + public void setOperations(List<OperationBodyRequest> operations) { + this.operations = operations; + } } diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java new file mode 100644 index 0000000000..db251b5b3b --- /dev/null +++ b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai.entities.singletransaction; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SingleTransactionResponse { + + @JsonProperty("operation-responses") + public List<OperationBodyResponse> operationResponses; + + @JsonProperty("operation-responses") + public List<OperationBodyResponse> getOperationResponses() { + if (operationResponses == null) { + operationResponses = new ArrayList<>(); + } + return operationResponses; + } + + @JsonProperty("operation-responses") + public void setOperationResponses(List<OperationBodyResponse> operationResponses) { + this.operationResponses = operationResponses; + } + + +} diff --git a/common/src/main/java/org/onap/so/logger/LogConstants.java b/common/src/main/java/org/onap/so/logger/LogConstants.java new file mode 100644 index 0000000000..ea3c8e2c4a --- /dev/null +++ b/common/src/main/java/org/onap/so/logger/LogConstants.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 ONAP - SO + * ================================================================================ + * 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.logger; + +public class LogConstants { + public static final String TARGET_ENTITY_HEADER="X-Target-Entity"; + public static final String UNKNOWN_TARGET_ENTITY="Unknown-Target-Entity"; +} diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java index 94ffa71169..c4fba671bb 100644 --- a/common/src/main/java/org/onap/so/logger/MsoLogger.java +++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java @@ -207,30 +207,9 @@ public class MsoLogger { private MsoLogger(MsoLogger.Catalog cat, Class<?> clazz) { this.logger = LoggerFactory.getLogger(clazz); this.auditLogger = LoggerFactory.getLogger("AUDIT"); - this.metricsLogger = LoggerFactory.getLogger("METRIC"); - MsoLogger.initialization(); + this.metricsLogger = LoggerFactory.getLogger("METRIC"); setDefaultLogCatalog(cat); } - - private static synchronized void initialization() { - if (instanceUUID == null || ("").equals(instanceUUID)) { - instanceUUID = getInstanceUUID(); - } - - if (serverIP == null || serverName == null || ("").equals(serverIP) || ("").equals(serverName)) { - try { - InetAddress server = InetAddress.getLocalHost(); - serverIP = server.getHostAddress(); - serverName = server.getHostName(); - } catch (UnknownHostException e) { - initLOGGER.error("Could not get local hostname", e); - serverIP = ""; - serverName = ""; - } - } - } - - public static MsoLogger getMsoLogger(MsoLogger.Catalog cat, Class<?> clazz) { return new MsoLogger(cat,clazz); diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java index 49dc71e773..6c2a96c87d 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java @@ -64,7 +64,7 @@ public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFil private static Logger logger = LoggerFactory.getLogger(JaxRsClientLogging.class); public void setTargetService(TargetEntity targetEntity){ - MDC.put("TargetEntity", targetEntity.toString()); + MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, targetEntity.toString()); } @Override @@ -90,7 +90,7 @@ public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFil MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getUri().toString()); MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); setInvocationId(); - MDC.put("TargetEntity",MDC.get("TargetEntity")); + MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY,MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY)); } private String extractRequestID(ClientRequestContext clientRequest) { @@ -123,7 +123,7 @@ public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFil MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus())); MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,getStringFromInputStream(responseContext)); MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); - logger.info(MarkerFactory.getMarker("INVOKE_RETURN"), "InvokeReturn"); + logger.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn"); clearClientMDCs(); } catch ( Exception e) { logger.warn("Error in outgoing JAX-RS Inteceptor", e); @@ -136,6 +136,10 @@ public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFil MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE); + MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY); + MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME); + MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME); + MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP); } private static String getStringFromInputStream(ClientResponseContext clientResponseContext) { diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java index 7d02136860..85a6498748 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java @@ -76,7 +76,7 @@ public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerRespo mdcSetup.setClientIPAddress(httpServletRequest); mdcSetup.setInstanceUUID(); mdcSetup.setEntryTimeStamp(); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS"); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); } catch (Exception e) { logger.warn("Error in incoming JAX-RS Inteceptor", e); @@ -163,6 +163,16 @@ public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerRespo MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, containerRequest.getUriInfo().getPath()); } + private void clearClientMDCs() { + MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE); + MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY); + MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME); + MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME); + } diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java new file mode 100644 index 0000000000..cc2ccb5c2e --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.logging.jaxrs.filter; + +import java.util.Map; + +import org.slf4j.MDC; +import org.springframework.core.task.TaskDecorator; + +public class MDCTaskDecorator implements TaskDecorator { + + @Override + public Runnable decorate(Runnable runnable) { + Map<String, String> contextMap = MDC.getCopyOfContextMap(); + return () -> { + try { + MDC.setContextMap(contextMap); + runnable.run(); + } finally { + MDC.clear(); + } + }; + } +}
\ No newline at end of file diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java index 6af7a916d0..cecef1945b 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java @@ -20,8 +20,12 @@ package org.onap.so.logging.jaxrs.filter; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.LogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -30,20 +34,31 @@ import org.springframework.util.StreamUtils; import java.io.IOException; import java.nio.charset.Charset; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.UUID; +import javax.ws.rs.core.Response; public class SpringClientFilter implements ClientHttpRequestInterceptor { private final Logger log = LoggerFactory.getLogger(this.getClass()); + + private static final String TRACE = "trace-#"; + private static final String SO = "SO"; @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { - logRequest(request, body); + processRequest(request, body); ClientHttpResponse response = execution.execute(request, body); - logResponse(response); + processResponse(response); return response; } - private void logRequest(HttpRequest request, byte[] body) throws IOException { + private void processRequest(HttpRequest request, byte[] body) throws IOException { + setupHeaders(request); + setupMDC(request); if (log.isDebugEnabled()) { log.debug("===========================request begin================================================"); log.debug("URI : {}", request.getURI()); @@ -53,8 +68,60 @@ public class SpringClientFilter implements ClientHttpRequestInterceptor { log.debug("==========================request end================================================"); } } + + private void setupHeaders(HttpRequest clientRequest) { + HttpHeaders headers = clientRequest.getHeaders(); + headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest)); + headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO); + } + + private String extractRequestID(HttpRequest clientRequest) { + String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); + if(requestId == null || requestId.isEmpty() || requestId.equals(TRACE)){ + requestId = UUID.randomUUID().toString(); + log.warn("Could not Find Request ID Generating New One: {}",clientRequest.getURI()); + } + return requestId; + } + + private void setupMDC(HttpRequest clientRequest) { + MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getURI().toString()); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); + setInvocationId(); + MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY,extractTargetEntity(clientRequest)); + } + + private String extractTargetEntity(HttpRequest clientRequest) { + HttpHeaders headers = clientRequest.getHeaders(); + String headerTargetEntity = null; + List<String> headerTargetEntityList = headers.get(LogConstants.TARGET_ENTITY_HEADER); + if(headerTargetEntityList!= null && !headerTargetEntityList.isEmpty()) + headerTargetEntity = headerTargetEntityList.get(0); + String targetEntity = MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY); + if(targetEntity != null && + !targetEntity.isEmpty() ){ + return targetEntity; + }else if(headerTargetEntity != null && + !headerTargetEntity.isEmpty()){ + targetEntity = headerTargetEntity; + }else{ + targetEntity = LogConstants.UNKNOWN_TARGET_ENTITY; + log.warn("Could not Target Entity: {}",clientRequest.getURI()); + } + return targetEntity; + } + + private void setInvocationId() { + String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID); + if(invocationId == null || invocationId.isEmpty()) + invocationId =UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); + } + - private void logResponse(ClientHttpResponse response) throws IOException { + private void processResponse(ClientHttpResponse response) throws IOException { if (log.isDebugEnabled()) { log.debug("============================response begin=========================================="); log.debug("Status code : {}", response.getStatusCode()); @@ -63,5 +130,28 @@ public class SpringClientFilter implements ClientHttpRequestInterceptor { log.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset())); log.debug("=======================response end================================================="); } + String statusCode; + if(Response.Status.Family.familyOf(response.getRawStatusCode()).equals(Response.Status.Family.SUCCESSFUL)){ + statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString(); + }else{ + statusCode=ONAPLogConstants.ResponseStatus.ERROR.toString(); + } + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getRawStatusCode())); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,""); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); + log.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn"); + clearClientMDCs(); + } + + private void clearClientMDCs() { + MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE); + MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY); + MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME); + MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME); + MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP); } } diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java index 194a445ce2..4084ad3ff0 100644 --- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java +++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java @@ -45,7 +45,7 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { Logger logger = LoggerFactory.getLogger(LoggingInterceptor.class); @Autowired - MDCSetup mdcSetup; + private MDCSetup mdcSetup; @Context private Providers providers; @@ -53,7 +53,8 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - Map<String, String> headers = Collections.list(((HttpServletRequest) request).getHeaderNames()) + + Map<String, String> headers = Collections.list((request).getHeaderNames()) .stream() .collect(Collectors.toMap(h -> h, request::getHeader)); setRequestId(headers); @@ -64,12 +65,27 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { mdcSetup.setEntryTimeStamp(); mdcSetup.setInstanceUUID(); mdcSetup.setServerFQDN(); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS"); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); + if (logger.isDebugEnabled()) + logRequestInformation(request); return true; } - @Override + protected void logRequestInformation(HttpServletRequest request) { + Map<String, String> headers = Collections.list((request).getHeaderNames()) + .stream() + .collect(Collectors.toMap(h -> h, request::getHeader)); + + logger.debug("===========================request begin================================================"); + logger.debug("URI : {}", request.getRequestURI()); + logger.debug("Method : {}", request.getMethod()); + logger.debug("Headers : {}", headers); + logger.debug("==========================request end================================================"); + + } + + @Override public void postHandle( HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { @@ -80,7 +96,7 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { MDC.clear(); } - private void setResponseStatusCode(HttpServletResponse response) { + protected void setResponseStatusCode(HttpServletResponse response) { String statusCode; if(Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString(); @@ -90,26 +106,26 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); } - private void setServiceName(HttpServletRequest request) { + protected void setServiceName(HttpServletRequest request) { MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI()); } - private void setRequestId(Map<String, String> headers) { - String requestId=headers.get(ONAPLogConstants.Headers.REQUEST_ID); + protected void setRequestId(Map<String, String> headers) { + String requestId=headers.get(ONAPLogConstants.Headers.REQUEST_ID.toLowerCase()); if(requestId == null || requestId.isEmpty()) - requestId = UUID.randomUUID().toString(); + requestId = UUID.randomUUID().toString(); MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId); } - private void setInvocationId(Map<String, String> headers) { - String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID); + protected void setInvocationId(Map<String, String> headers) { + String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase()); if(invocationId == null || invocationId.isEmpty()) invocationId =UUID.randomUUID().toString(); MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); } - private void setMDCPartnerName(Map<String, String> headers) { - String partnerName=headers.get(ONAPLogConstants.Headers.PARTNER_NAME); + protected void setMDCPartnerName(Map<String, String> headers) { + String partnerName=headers.get(ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase()); if(partnerName == null || partnerName.isEmpty()) partnerName = ""; MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName); diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java index 1697a4eb5f..e89c5c7e6a 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java @@ -43,6 +43,8 @@ public class RequestParameters implements Serializable { private List<Map<String, Object>> userParams = new ArrayList<>(); @JsonProperty("aLaCarte") private Boolean aLaCarte; + @JsonProperty("payload") + private String payload; // DONOT USE. It is intended to handle older VID requests(prior to 1802) @Deprecated @@ -57,9 +59,7 @@ public class RequestParameters implements Serializable { @JsonProperty("usePreload") private Boolean usePreload; // usePreload would always be true for Update @JsonProperty("rebuildVolumeGroups") - private Boolean rebuildVolumeGroups; - @JsonProperty("payload") - private String payload; + private Boolean rebuildVolumeGroups; public String getSubscriptionServiceType() { return subscriptionServiceType; @@ -80,6 +80,13 @@ public class RequestParameters implements Serializable { public Boolean isaLaCarte() { return aLaCarte; } + + public String getPayload(){ + return payload; + } + public void setPayload(String value){ + this.payload = value; + } @Deprecated @Transient @@ -151,13 +158,7 @@ public class RequestParameters implements Serializable { public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) { this.rebuildVolumeGroups = rebuildVolumeGroups; - } - public String getPayload(){ - return payload; - } - public void setPayload(String value){ - this.payload = value; - } + } @Override public String toString() { diff --git a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java b/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java new file mode 100644 index 0000000000..008b612cd8 --- /dev/null +++ b/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aai.domain.yang.GenericVnf; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + + +@RunWith(MockitoJUnitRunner.class) +public class AAIPatchConverterTest { + + private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); + + @Test + public void convertObjectToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException { + AAIPatchConverter validator = new AAIPatchConverter(); + GenericVnf vnf = new GenericVnf(); + vnf.setIpv4Loopback0Address(""); + String result = validator.marshallObjectToPatchFormat(vnf); + GenericVnf resultObj = mapper.readValue(result.toString(), GenericVnf.class); + assertTrue("expect object to become a String to prevent double marshalling", result instanceof String); + assertNull("expect null because of custom mapper", resultObj.getIpv4Loopback0Address()); + + } + + @Test + public void convertStringToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException { + AAIPatchConverter validator = new AAIPatchConverter(); + String payload = "{\"ipv4-loopback0-address\":\"\"}"; + String result = validator.marshallObjectToPatchFormat(payload); + + assertEquals("expect no change", payload, result); + } + + @Test + public void convertMapToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException { + AAIPatchConverter validator = new AAIPatchConverter(); + HashMap<String, String> map = new HashMap<>(); + map.put("ipv4-loopback0-address", ""); + String result = validator.marshallObjectToPatchFormat(map); + + assertEquals("expect string", "{\"ipv4-loopback0-address\":\"\"}", result); + } + + @Test + public void hasComplexObjectTest() { + AAIPatchConverter validator = new AAIPatchConverter(); + String hasNesting = "{ \"hello\" : \"world\", \"nested\" : { \"key\" : \"value\" } }"; + String noNesting = "{ \"hello\" : \"world\" }"; + String arrayCase = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"nestedComplex\" : [{\"key\" : \"value\"}]}"; + String empty = "{}"; + String arrayCaseSimpleOnly = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"]}"; + String relationshipListCaseNesting = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}"; + String relationshipListCase = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}]}"; + String nothing = ""; + + assertTrue("expect has nesting", validator.hasComplexObject(hasNesting)); + assertFalse("expect no nesting", validator.hasComplexObject(noNesting)); + assertTrue("expect has nesting", validator.hasComplexObject(arrayCase)); + assertFalse("expect no nesting", validator.hasComplexObject(empty)); + assertFalse("expect no nesting", validator.hasComplexObject(arrayCaseSimpleOnly)); + assertFalse("expect no nesting", validator.hasComplexObject(relationshipListCase)); + assertTrue("expect has nesting", validator.hasComplexObject(relationshipListCaseNesting)); + assertFalse("expect no nesting", validator.hasComplexObject(nothing)); + } + +} diff --git a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java index f2e371c999..752c49eb5b 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java @@ -21,18 +21,16 @@ package org.onap.so.client.aai; import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; -import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.util.HashMap; import javax.ws.rs.core.Response; @@ -42,11 +40,9 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.aai.domain.yang.GenericVnf; +import org.onap.so.client.RestClientSSL; import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(MockitoJUnitRunner.class) @@ -61,64 +57,22 @@ public class AAIRestClientTest { public ExpectedException thrown = ExpectedException.none(); @Test - public void convertObjectToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException { - AAIRestClient client = new AAIRestClient(props, new URI("")); - GenericVnf vnf = new GenericVnf(); - vnf.setIpv4Loopback0Address(""); - String result = client.convertObjectToPatchFormat(vnf); - GenericVnf resultObj = mapper.readValue(result.toString(), GenericVnf.class); - assertTrue("expect object to become a String to prevent double marshalling", result instanceof String); - assertNull("expect null because of custom mapper", resultObj.getIpv4Loopback0Address()); - - } - - @Test - public void convertStringToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException { - AAIRestClient client = new AAIRestClient(props, new URI("")); - String payload = "{\"ipv4-loopback0-address\":\"\"}"; - String result = client.convertObjectToPatchFormat(payload); - - assertEquals("expect no change", payload, result); - } - - @Test - public void convertMapToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException { - AAIRestClient client = new AAIRestClient(props, new URI("")); - HashMap<String, String> map = new HashMap<>(); - map.put("ipv4-loopback0-address", ""); - String result = client.convertObjectToPatchFormat(map); - - assertEquals("expect string", "{\"ipv4-loopback0-address\":\"\"}", result); - } - - @Test public void failPatchOnComplexObject() throws URISyntaxException { AAIRestClient client = new AAIRestClient(props, new URI("")); this.thrown.expect(GraphInventoryPatchDepthExceededException.class); this.thrown.expectMessage(containsString("Object exceeds allowed depth for update action")); client.patch("{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}"); - } @Test - public void hasComplexObjectTest() throws URISyntaxException { + public void verifyPatchValidation() throws URISyntaxException { AAIRestClient client = new AAIRestClient(props, new URI("")); - String hasNesting = "{ \"hello\" : \"world\", \"nested\" : { \"key\" : \"value\" } }"; - String noNesting = "{ \"hello\" : \"world\" }"; - String arrayCase = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"nestedComplex\" : [{\"key\" : \"value\"}]}"; - String empty = "{}"; - String arrayCaseSimpleOnly = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"]}"; - String relationshipListCaseNesting = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}"; - String relationshipListCase = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}]}"; - String nothing = ""; - - assertTrue("expect has nesting", client.hasComplexObject(hasNesting)); - assertFalse("expect no nesting", client.hasComplexObject(noNesting)); - assertTrue("expect has nesting", client.hasComplexObject(arrayCase)); - assertFalse("expect no nesting", client.hasComplexObject(empty)); - assertFalse("expect no nesting", client.hasComplexObject(arrayCaseSimpleOnly)); - assertFalse("expect no nesting", client.hasComplexObject(relationshipListCase)); - assertTrue("expect has nesting", client.hasComplexObject(relationshipListCaseNesting)); - assertFalse("expect no nesting", client.hasComplexObject(nothing)); + AAIRestClient spy = spy(client); + AAIPatchConverter patchValidatorMock = mock(AAIPatchConverter.class); + doReturn(patchValidatorMock).when(spy).getPatchConverter(); + String payload = "{}"; + doReturn(Response.ok().build()).when(spy).method(eq("PATCH"), any()); + spy.patch(payload); + verify(patchValidatorMock, times(1)).convertPatchFormat(eq((Object)payload)); } } diff --git a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java new file mode 100644 index 0000000000..8c42686e5f --- /dev/null +++ b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.aai; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.onap.aai.domain.yang.Pserver; +import org.onap.aai.domain.yang.v9.Complex; +import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest; +import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; +import org.skyscreamer.jsonassert.JSONAssert; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class AAISingleTransactionClientTest { + + private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/"; + AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "pserver-hostname"); + AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex"); + + ObjectMapper mapper; + + @Before + public void before() throws JsonParseException, JsonMappingException, IOException { + mapper = new AAICommonObjectMapperProvider().getMapper(); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + } + + @Test + public void testRequest() throws IOException { + AAIResourcesClient client = createClient(); + Pserver pserver = new Pserver(); + pserver.setHostname("pserver-hostname"); + pserver.setFqdn("pserver-bulk-process-single-transactions-multiple-actions-1-fqdn"); + Pserver pserver2 = new Pserver(); + pserver2.setFqdn("patched-fqdn"); + Complex complex = new Complex(); + complex.setCity("my-city"); + AAISingleTransactionClient singleTransaction = + client.beginSingleTransaction() + .create(uriA, pserver) + .update(uriA, pserver2) + .create(uriB, complex); + + + SingleTransactionRequest actual = singleTransaction.getRequest(); + + SingleTransactionRequest expected = mapper.readValue(this.getJson("sample-request.json"), SingleTransactionRequest.class); + + JSONAssert.assertEquals(mapper.writeValueAsString(expected),mapper.writeValueAsString(actual), false); + } + + @Test + public void testFailure() throws IOException { + AAIResourcesClient client = createClient(); + AAISingleTransactionClient singleTransaction = client.beginSingleTransaction(); + SingleTransactionResponse expected = mapper.readValue(this.getJson("sample-response-failure.json"), SingleTransactionResponse.class); + Optional<String> errorMessage = singleTransaction.locateErrorMessages(expected); + + assertThat(expected.getOperationResponses().size(), greaterThan(0)); + assertThat(errorMessage.isPresent(), equalTo(true)); + + } + + @Test + public void testSuccessResponse() throws IOException { + AAIResourcesClient client = createClient(); + AAISingleTransactionClient singleTransaction = client.beginSingleTransaction(); + SingleTransactionResponse expected = mapper.readValue(this.getJson("sample-response.json"), SingleTransactionResponse.class); + Optional<String> errorMessage = singleTransaction.locateErrorMessages(expected); + + assertThat(expected.getOperationResponses().size(), greaterThan(0)); + assertThat(errorMessage.isPresent(), equalTo(false)); + + } + + @Test + public void confirmPatchFormat() { + AAISingleTransactionClient singleTransaction = spy(new AAISingleTransactionClient(AAIVersion.LATEST)); + AAIPatchConverter mock = mock(AAIPatchConverter.class); + doReturn(mock).when(singleTransaction).getPatchConverter(); + singleTransaction.update(uriA, "{}"); + verify(mock, times(1)).convertPatchFormat(any()); + } + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); + } + + private AAIResourcesClient createClient() { + AAIResourcesClient client = spy(new AAIResourcesClient()); + doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties(); + return client; + } +} diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java index f6ee826a78..cbf8d67a82 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java @@ -21,8 +21,12 @@ package org.onap.so.client.aai; import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import java.io.IOException; import java.nio.file.Files; @@ -136,6 +140,15 @@ public class AAITransactionalClientTest { assertEquals(transactions.locateErrorMessages(getJson("response-failure.json")).get(), "another error message\nmy great error"); } + @Test + public void confirmPatchFormat() { + AAITransactionalClient client = spy(new AAITransactionalClient(AAIVersion.LATEST)); + AAIPatchConverter mock = mock(AAIPatchConverter.class); + doReturn(mock).when(client).getPatchConverter(); + client.update(uriA, "{}"); + verify(mock, times(1)).convertPatchFormat(any()); + } + private String getJson(String filename) throws IOException { return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); } diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-request.json b/common/src/test/resources/__files/aai/singletransaction/sample-request.json new file mode 100644 index 0000000000..f0761a07b6 --- /dev/null +++ b/common/src/test/resources/__files/aai/singletransaction/sample-request.json @@ -0,0 +1,26 @@ +{ + "operations": [ + { + "action": "put", + "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname", + "body": { + "hostname": "pserver-hostname", + "fqdn": "pserver-bulk-process-single-transactions-multiple-actions-1-fqdn" + } + }, + { + "action": "patch", + "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname", + "body": { + "fqdn": "patched-fqdn" + } + }, + { + "action": "put", + "uri": "/cloud-infrastructure/complexes/complex/my-complex", + "body": { + "city": "my-city" + } + } + ] +}
\ No newline at end of file diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-response-failure.json b/common/src/test/resources/__files/aai/singletransaction/sample-response-failure.json new file mode 100644 index 0000000000..d0b0e39924 --- /dev/null +++ b/common/src/test/resources/__files/aai/singletransaction/sample-response-failure.json @@ -0,0 +1,30 @@ +{ + "operation-responses": [ + { + "action": "put", + "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname", + "response-status-code": 201, + "response-body": null + }, + { + "action": "patch", + "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname", + "response-status-code": 200, + "response-body": null + }, + { + "action": "put", + "uri": "/cloud-infrastructure/complexes/complex/my-complex", + "response-status-code": 400, + "response-body": { + "requestError": { + "serviceException": { + "messageId": "SVC3003", + "text": "another error message", + "variables": [] + } + } + } + } + ] +}
\ No newline at end of file diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-response.json b/common/src/test/resources/__files/aai/singletransaction/sample-response.json new file mode 100644 index 0000000000..a5b322ee2e --- /dev/null +++ b/common/src/test/resources/__files/aai/singletransaction/sample-response.json @@ -0,0 +1,22 @@ +{ + "operation-responses": [ + { + "action": "put", + "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname", + "response-status-code": 201, + "response-body": null + }, + { + "action": "patch", + "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname", + "response-status-code": 200, + "response-body": null + }, + { + "action": "put", + "uri": "/cloud-infrastructure/complexes/complex/my-complex", + "response-status-code": 201, + "response-body": null + } + ] +}
\ No newline at end of file diff --git a/docs/release_notes/release-notes.rst b/docs/release_notes/release-notes.rst index b27b2a3eca..d3448497cf 100644 --- a/docs/release_notes/release-notes.rst +++ b/docs/release_notes/release-notes.rst @@ -8,6 +8,22 @@ Service Orchestrator Release Notes The SO provides the highest level of service orchestration in the ONAP architecture. +Version: 1.3.1 +-------------- + +:Release Date: 2018-09-23 + +Temp release for Casablanca at M4. +**New Features** + +* Support PNF resource type. +* Extend the support of homing to vFW, VDNS usecases. +* Workflow Designer Integration. +* Monitoring BPMN worflow capabiliities through UI. +* Support to the CCVPN Usecase. +* SO internal architecture improvements + + Version: 1.2.2 -------------- @@ -17,7 +33,7 @@ The Beijing release is the second release of the Service Orchestrator (SO) proje **New Features** -* Enhance Platform maturity by improving CLAMP maturity matrix see `Wiki <https://wiki.onap.org/display/DW/Beijing+Release+Platform+Maturity>`_. +* Enhance Platform maturity by improving SO maturity matrix see `Wiki <https://wiki.onap.org/display/DW/Beijing+Release+Platform+Maturity>`_. * Manual scaling of network services and VNFs. * Homing and placement capabiliities through OOF interaction. * Ability to perform change management. diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index 78e8a44163..b20d64c5f1 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -18,8 +18,6 @@ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <swagger-version>1.3.0</swagger-version> <jax-rs-version>1.1.1</jax-rs-version> - <json4s-jackson-version>3.2.4</json4s-jackson-version> - <json4s-core-version>3.0.0</json4s-core-version> <reflections-version>0.9.9-RC1</reflections-version> <paranamer-version>2.5.2</paranamer-version> <scannotation-version>1.0.3</scannotation-version> @@ -63,13 +61,11 @@ </dependency> <dependency> <groupId>org.json4s</groupId> - <artifactId>json4s-jackson_2.9.1-1</artifactId> - <version>${json4s-jackson-version}</version> + <artifactId>json4s-jackson_2.12</artifactId> </dependency> <dependency> <groupId>org.json4s</groupId> - <artifactId>json4s-core_2.9.2</artifactId> - <version>${json4s-core-version}</version> + <artifactId>json4s-core_2.12</artifactId> </dependency> <dependency> <groupId>javax.servlet</groupId> @@ -90,10 +86,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - </dependency> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index e9062effad..3ebad8b02c 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -24,6 +24,7 @@ package org.onap.so.apihandler.common; import java.io.IOException; +import java.util.UUID; import javax.xml.bind.DatatypeConverter; @@ -32,6 +33,7 @@ import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandler.camundabeans.CamundaBooleanInput; import org.onap.so.apihandler.camundabeans.CamundaInput; import org.onap.so.apihandler.camundabeans.CamundaIntegerInput; @@ -39,6 +41,7 @@ import org.onap.so.apihandler.camundabeans.CamundaRequest; import org.onap.so.apihandler.camundabeans.CamundaVIDRequest; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -63,6 +66,22 @@ public class CamundaClient extends RequestClient{ StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); msoLogger.info("Camunda Request Content: " + jsonReq); + + + post.setEntity(input); + setupHeaders(post); + + HttpResponse response = client.execute(post); + msoLogger.debug("Response is: " + response); + + return response; + } + + + private void setupHeaders(HttpPost post) { + post.addHeader(ONAPLogConstants.Headers.REQUEST_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + post.addHeader(ONAPLogConstants.Headers.INVOCATION_ID, UUID.randomUUID().toString()); + String encryptedCredentials = null; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); @@ -73,12 +92,6 @@ public class CamundaClient extends RequestClient{ } } } - - post.setEntity(input); - HttpResponse response = client.execute(post); - msoLogger.debug("Response is: " + response); - - return response; } @Override @@ -86,10 +99,10 @@ public class CamundaClient extends RequestClient{ throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); - //String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + setupHeaders(post); String encryptedCredentials = null; if(props!=null){ @@ -102,6 +115,7 @@ public class CamundaClient extends RequestClient{ } } + post.setEntity(input); HttpResponse response = client.execute(post); msoLogger.debug("Response is: " + response); @@ -120,6 +134,9 @@ public class CamundaClient extends RequestClient{ StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + + setupHeaders(post); + String encryptedCredentials = null; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java index 8dba63b44b..3a35c23a86 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java @@ -43,5 +43,6 @@ public enum Action { compareModel, scaleInstance, deactivateAndCloudDelete, - scaleOut + scaleOut, + recreateInstance } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java index 0e581cb48a..7c49eeadcc 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java @@ -20,11 +20,21 @@ package org.onap.so.apihandlerinfra.exceptions; +import java.io.StringWriter; +import java.util.ArrayList; import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; @@ -34,7 +44,6 @@ import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -45,6 +54,22 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ApiExceptionMapper.class); private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + + private final JAXBContext context; + private final Marshaller marshaller; + + @Context + private HttpHeaders headers; + + public ApiExceptionMapper() { + try { + context = JAXBContext.newInstance(RequestError.class); + marshaller = context.createMarshaller(); + } catch (JAXBException e) { + logger.debug("could not create JAXB marshaller"); + throw new IllegalStateException(e); + } + } @Override public Response toResponse(ApiException exception) { @@ -64,12 +89,23 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { } writeErrorLog(exception, errorText, errorLoggerInfo, alarmLoggerInfo); + + List<MediaType> typeList = Optional.ofNullable(headers.getAcceptableMediaTypes()).orElse(new ArrayList<>()); + List<String> typeListString = typeList.stream().map(item -> item.toString()).collect(Collectors.toList()); + MediaType type; + if (typeListString.stream().anyMatch(item -> item.contains(MediaType.APPLICATION_XML))) { + type = MediaType.APPLICATION_XML_TYPE; + } else if (typeListString.stream().anyMatch(item -> typeListString.contains(MediaType.APPLICATION_JSON))) { + type = MediaType.APPLICATION_JSON_TYPE; + } else { + type = MediaType.APPLICATION_JSON_TYPE; + } - return buildServiceErrorResponse(errorText,messageId,variables); + return buildServiceErrorResponse(errorText,messageId,variables, type); } - protected String buildServiceErrorResponse(String errorText, String messageId, List<String> variables){ + protected String buildServiceErrorResponse(String errorText, String messageId, List<String> variables, MediaType type){ RequestError re = new RequestError(); ServiceException se = new ServiceException(); se.setMessageId(messageId); @@ -83,11 +119,18 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { String requestErrorStr; ObjectMapper mapper = createObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); try { - requestErrorStr = mapper.writeValueAsString(re); - } catch (JsonProcessingException e) { + if (MediaType.APPLICATION_JSON_TYPE.equals(type)) { + requestErrorStr = mapper.writeValueAsString(re); + } else { + StringWriter sw = new StringWriter(); + this.getMarshaller().marshal(re, sw); + requestErrorStr = sw.toString(); + } + } catch (JsonProcessingException | JAXBException e) { String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage(); logger.error(MessageEnum.GENERAL_EXCEPTION, "BuildServiceErrorResponse", "", "", MsoLogger.ErrorCode.DataError, errorMsg, e); return errorMsg; @@ -109,4 +152,9 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { public ObjectMapper createObjectMapper(){ return new ObjectMapper(); } + + public Marshaller getMarshaller() { + return marshaller; + } + } diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java index d7052762ab..7a4b587fd2 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -22,6 +24,7 @@ package org.onap.so.apihandler.common; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.io.IOException; import java.nio.file.Files; @@ -122,45 +125,60 @@ public class CamundaClientTest{ } public String inputStream(String JsonInput)throws IOException{ - JsonInput = "src/test/resources/CamundaClientTest" + JsonInput; - String input = new String(Files.readAllBytes(Paths.get(JsonInput))); - return input; - } + JsonInput = "src/test/resources/CamundaClientTest" + JsonInput; + String input = new String(Files.readAllBytes(Paths.get(JsonInput))); + return input; + } @Test public void wrapVIDRequestTest() throws IOException{ - CamundaClient testClient = new CamundaClient(); - testClient.setUrl("/mso/async/services/CreateGenericALaCarteServiceInstance"); - - String requestId = "f7ce78bb-423b-11e7-93f8-0050569a796"; - boolean isBaseVfModule = true; - int recipeTimeout = 10000; - String requestAction = "createInstance"; - String serviceInstanceId = "12345679"; - String correlationId = "12345679"; - String vnfId = "234567891"; - String vfModuleId = "345678912"; - String volumeGroupId = "456789123"; - String networkId = "567891234"; - String configurationId = "678912345"; - String serviceType = "testService"; - String vnfType = "testVnf"; - String vfModuleType = "vfModuleType"; - String networkType = "networkType"; - String requestDetails = "{requestDetails: }"; - String apiVersion = "6"; - boolean aLaCarte = true; - String requestUri = "v7/serviceInstances/assign"; - - String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId, - vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType, - vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, ""); - String expected = inputStream("/WrappedVIDRequest.json"); - - assertEquals(expected, testResult); + CamundaClient testClient = new CamundaClient(); + testClient.setUrl("/mso/async/services/CreateGenericALaCarteServiceInstance"); + + String requestId = "f7ce78bb-423b-11e7-93f8-0050569a796"; + boolean isBaseVfModule = true; + int recipeTimeout = 10000; + String requestAction = "createInstance"; + String serviceInstanceId = "12345679"; + String correlationId = "12345679"; + String vnfId = "234567891"; + String vfModuleId = "345678912"; + String volumeGroupId = "456789123"; + String networkId = "567891234"; + String configurationId = "678912345"; + String serviceType = "testService"; + String vnfType = "testVnf"; + String vfModuleType = "vfModuleType"; + String networkType = "networkType"; + String requestDetails = "{requestDetails: }"; + String apiVersion = "6"; + boolean aLaCarte = true; + String requestUri = "v7/serviceInstances/assign"; + + String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId, + vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType, + vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, ""); + String expected = inputStream("/WrappedVIDRequest.json"); + + assertEquals(expected, testResult); } - + @Test + public void testPost() throws Exception{ + CamundaClient testClient = new CamundaClient(); + String orchestrationURI = "/engine-rest/process-definition/key/dummy/start"; + MockEnvironment environment = new MockEnvironment(); + + environment.setProperty("mso.camundaUR", "yourValue1"); + testClient.setProps(environment); + testClient.setClient(mockHttpClient); + + testClient.setUrl(orchestrationURI); + + String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; + assertNull(testClient.post(responseBody)); + + } } diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java index 117c8a2c27..0d4778b5b6 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -17,7 +19,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - + package org.onap.so.apihandler.common; @@ -27,8 +29,6 @@ import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.IOException; - import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.ProtocolVersion; @@ -38,13 +38,7 @@ import org.apache.http.message.BasicStatusLine; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.onap.so.apihandler.common.ErrorNumbers; -import org.onap.so.apihandler.common.ResponseHandler; - -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; import org.onap.so.apihandlerinfra.exceptions.ApiException; -import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; /** @@ -68,13 +62,27 @@ public class ResponseHandlerTest{ HttpResponse response = createResponse (200, body, "application/json"); ResponseHandler respHandler = new ResponseHandler (response, 1); - + int status = respHandler.getStatus (); assertEquals (status, HttpStatus.SC_ACCEPTED); assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process"); } + + @Test + public void tesParseCamundaResponseForCamundaTaskType () throws ApiException { + String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200," + + "\"message\": \"Successfully started the process\"}"; + HttpResponse response = createResponse (200, body, "application/json"); + + ResponseHandler respHandler = new ResponseHandler (response, 2); + + int status = respHandler.getStatus (); + assertEquals (status, HttpStatus.SC_ACCEPTED); + assertEquals (respHandler.getResponseBody(), body); + + } @Test public void tesParseBpelResponse () throws ApiException{ String body = "<test:service-response xmlns:test=\"http://org.onap/so/test\">" @@ -99,7 +107,7 @@ public class ResponseHandlerTest{ thrown.expectMessage(startsWith("Cannot parse Camunda Response")); thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_BAD_REQUEST))); thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); - + HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html"); ResponseHandler respHandler = new ResponseHandler (response, 1); diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java deleted file mode 100644 index b98c47490a..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra; - - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.junit.Test; -import org.mockito.Mockito; -import org.onap.so.apihandler.common.ErrorNumbers; -import org.onap.so.apihandlerinfra.exceptions.*; - -import org.apache.http.HttpStatus; -import javax.ws.rs.core.Response; - - -import java.io.IOException; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyObject; -import static org.hamcrest.core.StringStartsWith.startsWith; - -public class ApiExceptionMapperTest { - - ApiExceptionMapper mapper = new ApiExceptionMapper(); - - - @Test - public void testObjectMapperError() throws JsonProcessingException { - ObjectMapper mockedMapper = Mockito.mock(ObjectMapper.class); - Mockito.when(mockedMapper.writeValueAsString(anyObject())).thenThrow(JsonProcessingException.class); - ValidateException validateException = new ValidateException.Builder("Test", 0 , null).build(); - ApiExceptionMapper mockedException = Mockito.spy(new ApiExceptionMapper()); - Mockito.doReturn(mockedMapper).when(mockedException).createObjectMapper(); - Response resp = mockedException.toResponse((ApiException) validateException); - - /// assertEquals(resp.getStatus(), HttpStatus.SC_BAD_REQUEST); - assertThat(resp.getEntity().toString(),startsWith("Exception in buildServiceErrorResponse writing exceptionType to string")); - } - - @Test - public void testValidateResponse(){ - ValidateException validateException = new ValidateException.Builder("Test Message", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).build(); - Response resp = mapper.toResponse((ApiException) validateException); - - assertEquals(resp.getStatus(), HttpStatus.SC_BAD_REQUEST); - } - - @Test - public void testBPMNFailureResponse(){ - BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).build(); - Response resp = mapper.toResponse((ApiException) bpmnException); - - assertEquals(resp.getStatus(), HttpStatus.SC_NOT_FOUND); - } - @Test - public void testClientConnectionResponse(){ - ClientConnectionException clientConnectionException = new ClientConnectionException.Builder("test", HttpStatus.SC_INTERNAL_SERVER_ERROR,ErrorNumbers.SVC_BAD_PARAMETER).build(); - Response resp = mapper.toResponse((ApiException) clientConnectionException); - - assertEquals(resp.getStatus(), HttpStatus.SC_INTERNAL_SERVER_ERROR); - } - @Test - public void testVFModuleResponse() { - VfModuleNotFoundException vfModuleException = new VfModuleNotFoundException.Builder("Test Message", HttpStatus.SC_CONFLICT,ErrorNumbers.SVC_BAD_PARAMETER).build(); - Response resp = mapper.toResponse((ApiException) vfModuleException); - - assertEquals(resp.getStatus(), HttpStatus.SC_CONFLICT); - } - @Test - public void testDuplicateRequestResponse() throws IOException { - DuplicateRequestException duplicateRequestException = new DuplicateRequestException.Builder("Test1", "Test2","Test3","Test4", HttpStatus.SC_BAD_GATEWAY,ErrorNumbers.SVC_BAD_PARAMETER).build(); - Response resp = mapper.toResponse((ApiException) duplicateRequestException); - - assertEquals(resp.getStatus(), HttpStatus.SC_BAD_GATEWAY); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java index 95daf2e501..e666df34f9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java @@ -18,21 +18,40 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.apihandlerinfra; +package org.onap.so.apihandlerinfra.exceptions; +import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.StringStartsWith.startsWith; import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import java.io.IOException; +import java.io.Writer; +import java.util.Arrays; +import java.util.List; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; import org.apache.http.HttpStatus; +import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper; @@ -45,17 +64,29 @@ import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -public class ApiExceptionMapperTest extends BaseTest { +@RunWith(MockitoJUnitRunner.class) +public class ApiExceptionMapperTest { + + @Mock + private HttpHeaders headers; + @Mock + private Marshaller marshaller; + + @InjectMocks ApiExceptionMapper mapper = new ApiExceptionMapper(); + @Before + public void setUp() { + when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_JSON_TYPE)); + } @Test public void testObjectMapperError() throws JsonProcessingException { ObjectMapper mockedMapper = Mockito.mock(ObjectMapper.class); Mockito.when(mockedMapper.writeValueAsString(anyObject())).thenThrow(JsonProcessingException.class); ValidateException validateException = new ValidateException.Builder("Test", 0 , null).build(); - ApiExceptionMapper mockedException = Mockito.spy(new ApiExceptionMapper()); + ApiExceptionMapper mockedException = Mockito.spy(mapper); Mockito.doReturn(mockedMapper).when(mockedException).createObjectMapper(); Response resp = mockedException.toResponse((ApiException) validateException); @@ -99,4 +130,31 @@ public class ApiExceptionMapperTest extends BaseTest { assertEquals(resp.getStatus(), HttpStatus.SC_BAD_GATEWAY); } + + @Test + public void verifyXMLPath() throws JAXBException { + when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_XML_TYPE)); + BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).build(); + ApiExceptionMapper mapperSpy = Mockito.spy(mapper); + doReturn(marshaller).when(mapperSpy).getMarshaller(); + Response resp = mapperSpy.toResponse((ApiException) bpmnException); + verify(marshaller, times(1)).marshal(any(Object.class), any(Writer.class)); + } + + @Test + public void verifyMediaType() { + ApiExceptionMapper mapperSpy = Mockito.spy(mapper); + BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).build(); + when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_XML_TYPE.withCharset("UTF-8"))); + mapperSpy.toResponse(bpmnException); + verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class), any(List.class), eq(MediaType.APPLICATION_XML_TYPE)); + when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_JSON_TYPE.withCharset("UTF-8"))); + mapperSpy = Mockito.spy(mapper); + mapperSpy.toResponse(bpmnException); + verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class), any(List.class), eq(MediaType.APPLICATION_JSON_TYPE)); + when(headers.getAcceptableMediaTypes()).thenReturn(null); + mapperSpy = Mockito.spy(mapper); + mapperSpy.toResponse(bpmnException); + verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class), any(List.class), eq(MediaType.APPLICATION_JSON_TYPE)); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 49590d3460..aaa9b41448 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -18,8 +18,6 @@ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <swagger-version>1.3.0</swagger-version> <jax-rs-version>1.1.1</jax-rs-version> - <json4s-jackson-version>3.2.4</json4s-jackson-version> - <json4s-core-version>3.0.0</json4s-core-version> <reflections-version>0.9.9-RC1</reflections-version> <paranamer-version>2.5.2</paranamer-version> <scannotation-version>1.0.3</scannotation-version> @@ -98,13 +96,11 @@ </dependency> <dependency> <groupId>org.json4s</groupId> - <artifactId>json4s-jackson_2.9.1-1</artifactId> - <version>${json4s-jackson-version}</version> + <artifactId>json4s-jackson_2.12</artifactId> </dependency> <dependency> <groupId>org.json4s</groupId> - <artifactId>json4s-core_2.9.2</artifactId> - <version>${json4s-core-version}</version> + <artifactId>json4s-core_2.12</artifactId> </dependency> <dependency> <groupId>javax.servlet</groupId> @@ -195,10 +191,6 @@ <artifactId>h2</artifactId> </dependency> <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - </dependency> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java index 5b08cc1b17..6013677684 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java @@ -43,5 +43,6 @@ public enum Action implements Actions{ compareModel, scaleInstance, deactivateAndCloudDelete, - scaleOut + scaleOut, + recreateInstance } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java index afe55a23a7..f3f98f3f2a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java @@ -22,17 +22,19 @@ package org.onap.so.apihandlerinfra; import java.util.concurrent.Executor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; @SpringBootApplication(scanBasePackages = { "org.onap"}) @EnableAsync public class ApiHandlerApplication { - + @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -64,6 +66,7 @@ public class ApiHandlerApplication { executor.setMaxPoolSize(maxPoolSize); executor.setQueueCapacity(queueCapacity); executor.setThreadNamePrefix("mso-apihandler-infra-"); + executor.setTaskDecorator(new MDCTaskDecorator()); executor.initialize(); return executor; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index 1a95aa0e09..2a6764831d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -80,8 +80,8 @@ import io.swagger.annotations.ApiOperation; @Component -@Path("/e2eServiceInstances") -@Api(value = "/e2eServiceInstances", description = "API Requests for E2E Service Instances") +@Path("/onap/so/infra/e2eServiceInstances") +@Api(value = "/onap/so/infra/e2eServiceInstances", description = "API Requests for E2E Service Instances") public class E2EServiceInstances { private HashMap<String, String> instanceIdMap = new HashMap<>(); @@ -371,7 +371,7 @@ public class E2EServiceInstances { } - e2eServiceResponse.setOperationStatus(operationStatus); + e2eServiceResponse.setOperation(operationStatus); return builder.buildResponse(HttpStatus.SC_OK, null, e2eServiceResponse, apiVersion); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index 5d9ad767bf..bb7df4b7be 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -372,6 +372,20 @@ public class ServiceInstances { instanceIdMap.put("vnfInstanceId", vnfInstanceId); return serviceInstances(request, Action.applyUpdatedConfig, instanceIdMap, version, requestId, getRequestUri(requestContext)); } + + @POST + @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/recreate") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="Recreate VNF Instance",response=Response.class) + public Response recreateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, + @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException { + String requestId = getRequestId(requestContext); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + instanceIdMap.put("vnfInstanceId", vnfInstanceId); + return serviceInstances(request, Action.recreateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext)); + } @DELETE diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java index 45aa5e24db..5c958ad2a3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java @@ -30,13 +30,13 @@ public class GetE2EServiceInstanceResponse { protected OperationStatus operation; - public OperationStatus getOperationStatus() { - return operation; - } - - public void setOperationStatus(OperationStatus requestDB) { - this.operation = requestDB; - } +// public OperationStatus getOperationStatus() { +// return operation; +// } +// +// public void setOperationStatus(OperationStatus requestDB) { +// this.operation = requestDB; +// } public OperationStatus getOperation() { return operation; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java index 2427dd2734..7ad7e6626d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java @@ -35,6 +35,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.scheduling.annotation.Async; @@ -61,6 +62,7 @@ public class TenantIsolationRunnable { @Async public void run(Action action, String operationalEnvType, CloudOrchestrationRequest cor, String requestId) throws ApiException { + msoLogger.debug ("Starting threadExecution in TenantIsolationRunnable for Action " + action.name() + " and OperationalEnvType: " + operationalEnvType); try { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java index f366c7e74b..b0ea85779c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java @@ -56,6 +56,9 @@ public class CloudConfigurationValidation implements ValidationRule{ if(requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && (action == Action.deactivateAndCloudDelete || action == Action.scaleOut)){ throw new ValidationException("cloudConfiguration"); } + if(requestScope.equals(ModelType.vnf.name()) && action == Action.recreateInstance){ + throw new ValidationException("cloudConfiguration", true); + } } if (cloudConfiguration == null && ((aLaCarteFlag != null && !aLaCarteFlag) && requestScope.equalsIgnoreCase (ModelType.service.name ()) && reqVersion < 5)) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java index aa98d2abf2..c6fae6e872 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java @@ -60,7 +60,7 @@ public class ModelInfoValidation implements ValidationRule{ } // modelCustomizationId or modelCustomizationName are required for VNF Replace - if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.replaceInstance) { + if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.replaceInstance || action == Action.recreateInstance) { if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId()) && modelInfo.getModelCustomizationName() == null) { throw new ValidationException("modelCustomizationId or modelCustomizationName"); } @@ -77,14 +77,16 @@ public class ModelInfoValidation implements ValidationRule{ if(empty(modelInfo.getModelInvariantId()) && (requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.scaleOut)){ throw new ValidationException("modelInvariantId"); } - + if(empty(modelInfo.getModelInvariantId()) && (requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.recreateInstance)){ + throw new ValidationException("modelInvariantId", true); + } if (!empty (modelInfo.getModelInvariantId ()) && !UUIDChecker.isValidUUID (modelInfo.getModelInvariantId ())) { throw new ValidationException ("modelInvariantId format"); } if(reqVersion >= 4 && !(requestScope.equalsIgnoreCase(ModelType.configuration.name())) && empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || - action == Action.addRelationships || action == Action.removeRelationships || ((action == Action.deleteInstance || action == Action.scaleOut) && (requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))){ - throw new ValidationException ("modelName"); + action == Action.addRelationships || action == Action.removeRelationships || action == Action.recreateInstance || ((action == Action.deleteInstance || action == Action.scaleOut) && (requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))){ + throw new ValidationException ("modelName", true); } if (empty (modelInfo.getModelVersion ()) && !(requestScope.equalsIgnoreCase(ModelType.configuration.name())) && @@ -92,6 +94,10 @@ public class ModelInfoValidation implements ValidationRule{ && (action == Action.createInstance || action == Action.updateInstance || action == Action.addRelationships || action == Action.removeRelationships || action == Action.scaleOut))) { throw new ValidationException ("modelVersion"); } + + if(empty(modelInfo.getModelVersion()) && (requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.recreateInstance)){ + throw new ValidationException("modelVersion", true); + } // is required for serviceInstance delete macro when aLaCarte=false in v4 if (reqVersion >= 4 && empty (modelInfo.getModelVersionId()) && (((aLaCarteFlag != null && !aLaCarteFlag) && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || @@ -99,6 +105,9 @@ public class ModelInfoValidation implements ValidationRule{ (requestScope.equalsIgnoreCase(ModelType.configuration.name()) && (action == Action.activateInstance || action == Action.deactivateInstance))))) { throw new ValidationException ("modelVersionId"); } + if(empty(modelInfo.getModelVersionId()) && (requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.recreateInstance)){ + throw new ValidationException("modelVersionId", true); + } if(empty(modelInfo.getModelVersionId()) && (requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.scaleOut)){ throw new ValidationException("modelVersionId"); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java index 52ed34ac3f..4072613d09 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java @@ -59,8 +59,6 @@ public abstract class BaseTest { protected MsoLogger logger = MsoLogger.getMsoLogger(Catalog.GENERAL, BaseTest.class); protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); - protected HttpHeaders headers = new HttpHeaders(); - @Autowired protected Environment env; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java index f634057449..a3d388a5c6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java @@ -20,7 +20,12 @@ package org.onap.so.apihandlerinfra; -import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; @@ -30,11 +35,9 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import com.fasterxml.jackson.core.JsonProcessingException; import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -44,17 +47,19 @@ import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.http.Fault; public class E2EServiceInstancesTest extends BaseTest { private final ObjectMapper mapper = new ObjectMapper(); - private final String e2eServInstancesUri = "/e2eServiceInstances/"; + private final String e2eServInstancesUri = "/onap/so/infra/e2eServiceInstances/"; @Before @@ -87,7 +92,8 @@ private final ObjectMapper mapper = new ObjectMapper(); JsonInput = "src/test/resources/E2EServiceInstancesTest" + JsonInput; return new String(Files.readAllBytes(Paths.get(JsonInput))); } - public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod){ + public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod){ + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type",MediaType.APPLICATION_JSON); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/HealthCheckHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/HealthCheckHandlerTest.java index e16f265a2e..8b4d353a56 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/HealthCheckHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/HealthCheckHandlerTest.java @@ -39,7 +39,7 @@ public class HealthCheckHandlerTest extends BaseTest{ @Test public void testHealthcheckGet() throws JSONException { - + HttpHeaders headers = new HttpHeaders(); HttpEntity<String> entity = new HttpEntity<String>(null, headers); ResponseEntity<String> response = restTemplate.exchange( diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index 76d4b48a36..f4fede15e1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -32,12 +32,10 @@ import static org.junit.Assert.assertThat; import java.io.IOException; import java.util.Map; -import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; -import org.apache.log4j.MDC; import org.junit.Test; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandlerinfra.tasksbeans.RequestDetails; @@ -47,6 +45,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest; import org.onap.so.apihandlerinfra.tasksbeans.ValidResponses; import org.onap.so.logger.MsoLogger; import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; @@ -82,7 +81,7 @@ public class ManualTasksTest extends BaseTest{ //expected response TaskRequestReference expectedResponse = new TaskRequestReference(); expectedResponse.setTaskId(taskId); - + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); @@ -108,7 +107,7 @@ public class ManualTasksTest extends BaseTest{ for(ILoggingEvent logEvent : TestAppender.events) if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && - logEvent.getMarker().getName().equals("ENTRY") + logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY") ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); @@ -118,7 +117,7 @@ public class ManualTasksTest extends BaseTest{ assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME)); assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE)); }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && - logEvent.getMarker().getName().equals("EXIT")){ + logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(MsoLogger.ENDTIME)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java index 63dc96f485..fa3ce07d70 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java @@ -193,6 +193,7 @@ public class MsoRequestTest extends BaseTest { {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, 6}, {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration/DeactivateAndCloudDeleteCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateAndCloudDelete, 7}, {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration/ScaleOutNoCloudConfig.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, + {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration/VnfRecreateCloudConfig.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.recreateInstance, 7}, {"No valid lcpCloudRegionId is specified", mapper.readValue(inputStream("/CloudConfiguration/EmptyLcpCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid lcpCloudRegionId is specified", mapper.readValue(inputStream("/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, 6}, {"No valid tenantId is specified", mapper.readValue(inputStream("/CloudConfiguration/EmptyTenantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, @@ -207,6 +208,7 @@ public class MsoRequestTest extends BaseTest { {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/ModelInfo/ModelCustomization.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, 6}, {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/ModelInfo/ModelCustomization.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, 6}, {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/ModelInfo/VnfModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, 5}, + {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/ModelInfo/VnfRecreateNoModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.recreateInstance, 7}, {"No valid modelCustomizationId is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid model-info is specified", mapper.readValue(inputStream("/ModelInfo/ModelInfoNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid modelInvariantId format is specified", mapper.readValue(inputStream("/ModelInfo/InvalidModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 2}, @@ -218,13 +220,16 @@ public class MsoRequestTest extends BaseTest { {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/v5DeactivateModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateInstance, 5}, {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/v3UpdateNetworkBad.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, 4}, {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, + {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/VnfRecreateModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.recreateInstance, 7}, {"No valid modelName is specified", mapper.readValue(inputStream("/ModelInfo/VfModuleModelName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, 4}, {"No valid modelName is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, + {"No valid modelName is specified", mapper.readValue(inputStream("/ModelInfo/VnfRecreateModelName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.recreateInstance, 7}, {"No valid modelType is specified", mapper.readValue(inputStream("/ModelInfo/ModelTypeNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, 3}, {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionVfModule.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 3}, {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionServiceCreate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 3}, {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelVersion.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, + {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/VnfRecreateModelVersion.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.recreateInstance, 7}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ConfigurationModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/v2ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 4}, @@ -235,6 +240,7 @@ public class MsoRequestTest extends BaseTest { {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionIdCreate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/v5ActivateModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, + {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/VnfRecreateModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.recreateInstance, 7}, //ValidationException for Platform and LineOfBusiness {"No valid lineOfBusinessName is specified", mapper.readValue(inputStream("/PlatformAndLineOfBusiness/EmptyLineOfBusiness.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid platform is specified", mapper.readValue(inputStream("/PlatformAndLineOfBusiness/Platform.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 6}, diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java index 0af9826020..ea2261a94a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java @@ -41,7 +41,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -60,6 +59,7 @@ import org.onap.so.serviceinstancebeans.RequestProcessingData; import org.onap.so.serviceinstancebeans.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; @@ -105,7 +105,7 @@ public class OrchestrationRequestsTest extends BaseTest { Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest(); testResponse.setRequest(request); String testRequestId = request.getRequestId(); - + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); @@ -136,6 +136,7 @@ public class OrchestrationRequestsTest extends BaseTest { testResponse.setRequest(request); String testRequestId = request.getRequestId(); + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); @@ -158,9 +159,10 @@ public class OrchestrationRequestsTest extends BaseTest { @Test public void testGetOrchestrationRequestNoRequestID() { + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", "application/json; charset=UTF-8"); + headers.set("Content-Type", "application/json; charset=UTF-8"); HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); - headers.set("Accept", MediaType.APPLICATION_JSON); - UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v6/")); @@ -185,9 +187,10 @@ public class OrchestrationRequestsTest extends BaseTest { List<GetOrchestrationResponse> testResponses = new ArrayList<>(); List<InfraActiveRequests> requests = requestsDbClient.getOrchestrationFiltersFromInfraActive(orchestrationMap); - HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); - + HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); + UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v6?filter=modelType:EQUALS:vfModule")); @@ -206,7 +209,7 @@ public class OrchestrationRequestsTest extends BaseTest { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json"))); - + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers); @@ -240,7 +243,7 @@ public class OrchestrationRequestsTest extends BaseTest { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json"))); - + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers); @@ -274,7 +277,7 @@ public class OrchestrationRequestsTest extends BaseTest { setupTestUnlockOrchestrationRequest_Valid_Status("5ffbabd6-b793-4377-a1ab-082670fbc7ac", "PENDING"); ObjectMapper mapper = new ObjectMapper(); String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json"))); - + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers); @@ -305,7 +308,7 @@ public class OrchestrationRequestsTest extends BaseTest { String json = mapper.writeValueAsString(requests); requestsDbClient.save(requests); - + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); @@ -337,7 +340,7 @@ public class OrchestrationRequestsTest extends BaseTest { requests.setRequestScope("service"); requests.setRequestType("createInstance"); // iar.save(requests); - + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index cdb4c40981..464d5e6bba 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -21,11 +21,28 @@ package org.onap.so.apihandlerinfra; -import ch.qos.logback.classic.spi.ILoggingEvent; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.tomakehurst.wiremock.http.Fault; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -44,32 +61,18 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.util.ResourceUtils; import org.springframework.web.util.UriComponentsBuilder; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import java.util.Map; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.http.Fault; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import ch.qos.logback.classic.spi.ILoggingEvent; public class ServiceInstancesTest extends BaseTest{ @@ -109,10 +112,14 @@ public class ServiceInstancesTest extends BaseTest{ } - - public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod){ - headers.set("Accept", MediaType.APPLICATION_JSON); - headers.set(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON); + public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod, HttpHeaders headers){ + + if (!headers.containsKey(HttpHeaders.ACCEPT)) { + headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + } + if (!headers.containsKey(HttpHeaders.CONTENT_TYPE)) { + headers.set(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON); + } UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath)); @@ -121,6 +128,10 @@ public class ServiceInstancesTest extends BaseTest{ return restTemplate.exchange(builder.toUriString(), reqMethod, request, String.class); } + + public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod){ + return sendRequest(requestJson, uriPath, reqMethod, new HttpHeaders()); + } @Test public void test_mapJSONtoMSOStyle() throws IOException{ @@ -163,7 +174,7 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); - + HttpHeaders headers = new HttpHeaders(); headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(MsoLogger.CLIENT_ID, "VID"); //expect @@ -172,7 +183,7 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -186,7 +197,7 @@ public class ServiceInstancesTest extends BaseTest{ for(ILoggingEvent logEvent : TestAppender.events) if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && - logEvent.getMarker().getName().equals("ENTRY") + logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY") ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); @@ -196,7 +207,7 @@ public class ServiceInstancesTest extends BaseTest{ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME)); assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE)); }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && - logEvent.getMarker().getName().equals("EXIT")){ + logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(MsoLogger.ENDTIME)); @@ -347,8 +358,9 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void activateServiceInstanceNoRecipeALaCarte() throws IOException{ uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; + HttpHeaders headers = new HttpHeaders(); headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"), uri, HttpMethod.POST, headers); Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); @@ -407,7 +419,7 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); - + HttpHeaders headers = new HttpHeaders(); headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); @@ -415,7 +427,7 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivate.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivate.json"), uri, HttpMethod.POST, headers); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -608,6 +620,7 @@ public class ServiceInstancesTest extends BaseTest{ stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + HttpHeaders headers = new HttpHeaders(); headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); @@ -615,7 +628,7 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePortConfiguration.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePortConfiguration.json"), uri, HttpMethod.POST, headers); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -638,6 +651,7 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + HttpHeaders headers = new HttpHeaders(); headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); @@ -645,7 +659,7 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstance.json"), uri, HttpMethod.DELETE); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstance.json"), uri, HttpMethod.DELETE, headers); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -840,6 +854,7 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(org.apache.http.HttpStatus.SC_OK))); String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c3"; + HttpHeaders headers = new HttpHeaders(); headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); @@ -847,7 +862,7 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs"; - ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstance.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstance.json"), uri, HttpMethod.POST, headers); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -949,6 +964,42 @@ public class ServiceInstancesTest extends BaseTest{ assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); } @Test + public void recreateVnfInstance() throws IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_Response")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("vnfResources_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=recreateInstance")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("vnfRecipe_ResponseWorkflowAction.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/recreate"; + ResponseEntity<String> response = sendRequest(inputStream("/VnfRecreate.json"), uri, HttpMethod.POST); + logger.debug(response.getBody()); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test public void updateVnfInstance() throws IOException { stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) @@ -999,6 +1050,7 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(org.apache.http.HttpStatus.SC_OK))); String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c5"; + HttpHeaders headers = new HttpHeaders(); headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); @@ -1006,7 +1058,7 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/applyUpdatedConfig"; - ResponseEntity<String> response = sendRequest(inputStream("/ApplyUpdatedConfig.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ApplyUpdatedConfig.json"), uri, HttpMethod.POST, headers); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -1307,6 +1359,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createVfModuleNoModelType() throws IOException{ + HttpHeaders headers = new HttpHeaders(); headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); InfraActiveRequests expectedRecord = new InfraActiveRequests(); expectedRecord.setRequestStatus("FAILED"); @@ -1326,7 +1379,7 @@ public class ServiceInstancesTest extends BaseTest{ expectedRecord.setVnfType(""); uri = servInstanceuri + "v5/serviceInstances/32807a28-1a14-4b88-b7b3-2950918aa76d/vnfs/32807a28-1a14-4b88-b7b3-2950918aa76d/vfModules"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelType.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelType.json"), uri, HttpMethod.POST, headers); //ActualRecord assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); } @@ -1590,6 +1643,7 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(org.apache.http.HttpStatus.SC_OK))); String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c4"; + HttpHeaders headers = new HttpHeaders(); headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); @@ -1597,7 +1651,7 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreate.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreate.json"), uri, HttpMethod.POST, headers); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -1710,6 +1764,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void convertJsonToServiceInstanceRequestFail() throws IOException { + HttpHeaders headers = new HttpHeaders(); headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); //ExpectedRecord InfraActiveRequests expectedRecord = new InfraActiveRequests(); @@ -1723,7 +1778,7 @@ public class ServiceInstancesTest extends BaseTest{ expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); uri = servInstanceuri + "v6" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.DELETE); + ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.DELETE, headers); //ActualRecord @@ -1931,6 +1986,7 @@ public class ServiceInstancesTest extends BaseTest{ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + HttpHeaders headers = new HttpHeaders(); headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); stubFor(get(urlMatching(".*/service/.*")) @@ -1949,7 +2005,7 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7999/activate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev8.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev8.json"), uri, HttpMethod.POST, headers); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -1962,10 +2018,11 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void invalidRequestId() throws IOException { String illegalRequestId = "1234"; + HttpHeaders headers = new HttpHeaders(); headers.set(ONAPLogConstants.Headers.REQUEST_ID, illegalRequestId); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); assertTrue(response.getBody().contains("Request Id " + illegalRequestId + " is not a valid UUID")); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java index 459214b4ce..fa323a12c2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java @@ -34,7 +34,6 @@ import java.text.ParseException; import java.util.ArrayList; import java.util.List; -import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -45,6 +44,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskList; import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse; import org.onap.so.apihandlerinfra.tasksbeans.ValidResponses; import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; @@ -93,7 +93,7 @@ public class TasksHandlerTest extends BaseTest{ taskList.add(taskList1); expectedResponse.setTaskList(taskList); - + HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<String>(null, headers); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java index 9a5334081f..29fa1a34b3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java @@ -76,8 +76,8 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ private final int retryCountThree = 3; private final int retryCountTwo = 2; private final int retryCountZero = 0; + private final String sdcDistributionId1 = "TEST_distributionId1"; private final String sdcDistributionId = "TEST_distributionId"; - private final String sdcDistributionId1 = "TEST_distributionId1"; private final String statusOk = Status.DISTRIBUTION_COMPLETE_OK.toString(); private final String statusError = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString(); private final String statusSent = "SENT"; @@ -221,12 +221,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) - .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}")) + .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) - .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}")) + .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); @@ -290,12 +290,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) - .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId1\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"SENT\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) - .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}")) + .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); @@ -491,12 +490,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) - .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}")) + .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) - .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}")) + .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/DeactivateAndCloudDeleteCloudConfiguration.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/DeactivateAndCloudDeleteCloudConfiguration.json index 47b2e309d3..18d03f1472 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/DeactivateAndCloudDeleteCloudConfiguration.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/DeactivateAndCloudDeleteCloudConfiguration.json @@ -5,7 +5,7 @@ }, "requestInfo": { "source": "VID", - "requestorId": "az2016" + "requestorId": "xxxxxx" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/VnfRecreateCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/VnfRecreateCloudConfig.json new file mode 100644 index 0000000000..5d64500e10 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/VnfRecreateCloudConfig.json @@ -0,0 +1,21 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vnf", + "modelInvariantId":"ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"254583ad-b38c-498b-bdbd-b8de5e07541b", + "modelName":"vSAMP12", + "modelVersion":"2.0", + "modelCustomizationName":"vSAMP12 1", + "modelCustomizationId":"c539433a-84a6-4082-a12e-5c9b00c3b960" + }, + "requestInfo":{ + "source":"source", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "rebuildVolumeGroups":false + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelInvariantId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelInvariantId.json new file mode 100644 index 0000000000..15ec1a006f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelInvariantId.json @@ -0,0 +1,24 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vnf", + "modelVersionId":"254583ad-b38c-498b-bdbd-b8de5e07541b", + "modelName":"vSAMP12", + "modelVersion":"2.0", + "modelCustomizationName":"vSAMP12 1", + "modelCustomizationId":"c539433a-84a6-4082-a12e-5c9b00c3b960" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"mdt1", + "tenantId":"88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo":{ + "source":"source", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "rebuildVolumeGroups":false + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelName.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelName.json new file mode 100644 index 0000000000..caa7458f9f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelName.json @@ -0,0 +1,24 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vnf", + "modelInvariantId":"ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"254583ad-b38c-498b-bdbd-b8de5e07541b", + "modelVersion":"2.0", + "modelCustomizationName":"vSAMP12 1", + "modelCustomizationId":"c539433a-84a6-4082-a12e-5c9b00c3b960" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"mdt1", + "tenantId":"88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo":{ + "source":"source", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "rebuildVolumeGroups":false + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelVersion.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelVersion.json new file mode 100644 index 0000000000..5049be6bca --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelVersion.json @@ -0,0 +1,24 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vnf", + "modelInvariantId":"ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"254583ad-b38c-498b-bdbd-b8de5e07541b", + "modelName":"vSAMP12", + "modelCustomizationName":"vSAMP12 1", + "modelCustomizationId":"c539433a-84a6-4082-a12e-5c9b00c3b960" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"mdt1", + "tenantId":"88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo":{ + "source":"source", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "rebuildVolumeGroups":false + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelVersionId.json new file mode 100644 index 0000000000..99ee762da1 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateModelVersionId.json @@ -0,0 +1,24 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vnf", + "modelInvariantId":"ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelName":"vSAMP12", + "modelVersion":"2.0", + "modelCustomizationName":"vSAMP12 1", + "modelCustomizationId":"c539433a-84a6-4082-a12e-5c9b00c3b960" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"mdt1", + "tenantId":"88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo":{ + "source":"source", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "rebuildVolumeGroups":false + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateNoModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateNoModelCustomizationId.json new file mode 100644 index 0000000000..d98a9bc30b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfRecreateNoModelCustomizationId.json @@ -0,0 +1,23 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vnf", + "modelInvariantId":"ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"254583ad-b38c-498b-bdbd-b8de5e07541b", + "modelName":"vSAMP12", + "modelVersion":"2.0" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"mdt1", + "tenantId":"88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo":{ + "source":"source", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "rebuildVolumeGroups":false + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json index 3d293d522b..b721583d29 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json @@ -11,7 +11,7 @@ }, "requestInfo": { "source": "VID", - "requestorId": "az2016" + "requestorId": "xxxxxx" } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfRecreate.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfRecreate.json new file mode 100644 index 0000000000..7a76c6bfee --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfRecreate.json @@ -0,0 +1,25 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vnf", + "modelInvariantId":"ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"254583ad-b38c-498b-bdbd-b8de5e07541b", + "modelName":"vSAMP12", + "modelVersion":"2.0", + "modelCustomizationName":"vSAMP12 1", + "modelCustomizationId":"c539433a-84a6-4082-a12e-5c9b00c3b960" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"mdt1", + "tenantId":"88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo":{ + "source":"source", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "rebuildVolumeGroups":false + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipe_ResponseWorkflowAction.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipe_ResponseWorkflowAction.json new file mode 100644 index 0000000000..c755714633 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipe_ResponseWorkflowAction.json @@ -0,0 +1,20 @@ +{ + "id": 21, + "nfRole": "GR-API-DEFAULT", + "paramXsd": "", + "vfModuleId": "1882934", + "action": "recreateInstance", + "description": "gr-api-default for vnf recreate", + "orchestrationUri": "/mso/async/services/WorkflowActionBB", + "recipeTimeout": 180, + "serviceType": "GR-API-DEFAULT", + "created": "2016-06-03T04:44:10.000+0000", + "_links": { + "self": { + "href": "http://localhost:8090/vnfRecipe/21" + }, + "vnfRecipe": { + "href": "http://localhost:8090/vnfRecipe/21" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql index 70c0791055..afcd7330f3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql @@ -275,7 +275,16 @@ VALUES ('vfModule', 'replaceInstance', '1', 'Gr api recipe to replace vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), ('vfModule', 'deactivateAndCloudDelete', '1', 'Gr api recipe to deactivateAndCloudDelete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), ('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT'); +INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) +VALUES +('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59'); +INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) +VALUES +('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59'); +INSERT INTO requestdb.activate_operational_env_per_distributionid_status (DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID) +VALUES +('111', 'TEST', 'ERROR', '2018-09-12 19:29:24', '2018-09-12 19:29:25', '1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017'); UPDATE vnf_components_recipe SET vf_module_model_uuid = 'VNF-API-DEFAULT' diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index 6ab92853d1..e68bdb3772 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -36,36 +36,29 @@ import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest; import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; -import org.springframework.http.HttpRequest; import org.springframework.http.client.BufferingClientHttpRequestFactory; -import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestFactory; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; -import uk.co.blackpepper.bowman.Client; import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; -import uk.co.blackpepper.bowman.RestTemplateConfigurer; import javax.annotation.PostConstruct; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; -import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Iterator; @Component("RequestsDbClient") @Primary @@ -74,14 +67,10 @@ public class RequestsDbClient { private static final String SERVICE_ID = "SERVICE_ID"; private static final String OPERATION_ID = "OPERATION_ID"; private static final String SO_REQUEST_ID = "SO_REQUEST_ID"; - private static final String GROUPING_ID = "GROUPING_ID"; private static final String REQUEST_ID = "REQUEST_ID"; - private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENVIRONMENT_ID"; + private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENV_ID"; private static final String SERVICE_MODEL_VERSION_ID = "SERVICE_MODEL_VERSION_ID"; - private static final String NAME = "NAME"; - private static final String VALUE = "VALUE"; - private static final String TAG = "TAG"; - + @Value("${mso.adapters.requestDb.endpoint}") protected String endpoint; @@ -112,9 +101,7 @@ public class RequestsDbClient { private String requestProcessingDataURI = "/requestProcessingData"; - private String findOneBySoRequestIdAndGroupingIdAndNameAndTagURI = "/requestProcessingData/search/findOneBySoRequestIdAndGroupingIdAndNameAndTag/"; - - private String findBySoRequestIdOrderByGroupingIdDesc = "/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"; + private final String findBySoRequestIdOrderByGroupingIdDesc = "/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc"; @Autowired @@ -137,8 +124,8 @@ public class RequestsDbClient { findAllByOperationalEnvIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI; } - public ClientFactory getClientFactory(){ - URI baseUri = UriBuilder.fromUri(endpoint).build(); + private ClientFactory getClientFactory(){ + URI baseUri = UriBuilder.fromUri(endpoint).build(); ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()); return Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> { @@ -152,11 +139,10 @@ public class RequestsDbClient { }).build().buildClientFactory(); } - + public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap){ URI uri = getUri(cloudOrchestrationFiltersFromInfraActive); - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); + HttpHeaders headers = getHttpHeaders(); HttpEntity<Map> entity = new HttpEntity<>(orchestrationMap, headers); try{ return restTemplate.exchange(uri, HttpMethod.POST, entity, new ParameterizedTypeReference<List<InfraActiveRequests>>() {}).getBody(); @@ -170,10 +156,8 @@ public class RequestsDbClient { public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) { try { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); - HttpEntity<?> entity = new HttpEntity<>(headers); - InfraActiveRequests infraActiveRequests = restTemplate.exchange(getUri(endpoint + "/infraActiveRequests/" + requestId), HttpMethod.GET, entity, InfraActiveRequests.class).getBody(); + HttpEntity<?> entity = getHttpEntity(); + InfraActiveRequests infraActiveRequests = restTemplate.exchange(getUri(endpoint + "/infraActiveRequests/" + requestId), HttpMethod.GET, entity, InfraActiveRequests.class).getBody(); if (infraActiveRequests != null) { infraActiveRequests.setRequestId(requestId); } @@ -187,24 +171,20 @@ public class RequestsDbClient { } public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap) { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); + HttpHeaders headers = getHttpHeaders(); URI uri = getUri(getOrchestrationFilterURI); HttpEntity<Map<String, List<String>>> entity = new HttpEntity<>(orchestrationMap, headers); return restTemplate.exchange(uri, HttpMethod.POST, entity, new ParameterizedTypeReference<List<InfraActiveRequests>>() {}).getBody(); } public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); - HttpEntity<?> entity = new HttpEntity<>(headers); + HttpEntity<?> entity = getHttpEntity(); URI uri = getUri(checkVnfIdStatus + operationalEnvironmentId); return restTemplate.exchange(uri, HttpMethod.GET, entity, InfraActiveRequests.class).getBody(); } public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); + HttpHeaders headers = getHttpHeaders(); URI uri = getUri(checkInstanceNameDuplicate); HttpEntity<InstanceNameDuplicateCheckRequest> entity = new HttpEntity<>(new InstanceNameDuplicateCheckRequest(instanceIdMap, instanceName, requestScope), headers); try{ @@ -220,13 +200,11 @@ public class RequestsDbClient { public OperationStatus getOneByServiceIdAndOperationId(String serviceId, String operationId) { try { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); - HttpEntity<?> entity = new HttpEntity<>(headers); - OperationStatus operationStatus = restTemplate.exchange(UriBuilder.fromUri(getUri(findOneByServiceIdAndOperationIdURI)) + HttpEntity<?> entity = getHttpEntity(); + OperationStatus operationStatus = restTemplate.exchange(getUri(UriBuilder.fromUri(getUri(findOneByServiceIdAndOperationIdURI)) .queryParam(SERVICE_ID, serviceId) .queryParam(OPERATION_ID, operationId) - .build(), HttpMethod.GET, entity, OperationStatus.class).getBody(); + .build().toString()), HttpMethod.GET, entity, OperationStatus.class).getBody(); if (operationStatus != null) { operationStatus.setServiceId(serviceId); operationStatus.setOperationId(operationId); @@ -240,27 +218,49 @@ public class RequestsDbClient { throw e; } } - + public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvironmentId, String serviceModelVersionId) { - return this.getSingleOperationalEnvServiceModelStatus(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdURI) - .queryParam(OPERATIONAL_ENVIRONMENT_ID,operationalEnvironmentId) - .queryParam(SERVICE_MODEL_VERSION_ID,serviceModelVersionId) - .build()); + try { + HttpEntity<?> entity = getHttpEntity(); + OperationalEnvServiceModelStatus modelStatus = restTemplate.exchange(getUri(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdURI) + .queryParam(OPERATIONAL_ENVIRONMENT_ID, operationalEnvironmentId) + .queryParam(SERVICE_MODEL_VERSION_ID, serviceModelVersionId) + .build().toString()), HttpMethod.GET, entity, OperationalEnvServiceModelStatus.class).getBody(); + if (null != modelStatus) { + modelStatus.setOperationalEnvId(operationalEnvironmentId); + modelStatus.setServiceModelVersionId(serviceModelVersionId); + } + return modelStatus; + }catch(HttpClientErrorException e){ + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + return null; + } + throw e; + } } public List<OperationalEnvServiceModelStatus> getAllByOperationalEnvIdAndRequestId(String operationalEnvironmentId, String requestId){ - return this.getMultipleOperationalEnvServiceModelStatus(UriBuilder.fromUri(findAllByOperationalEnvIdAndRequestIdURI) + return this.getMultipleOperationalEnvServiceModelStatus(getUri(UriBuilder.fromUri(findAllByOperationalEnvIdAndRequestIdURI) .queryParam(OPERATIONAL_ENVIRONMENT_ID,operationalEnvironmentId) .queryParam(REQUEST_ID,requestId) - .build()); + .build().toString())); } public OperationalEnvDistributionStatus getDistributionStatusById(String distributionId){ - return this.getSingleOperationalEnvDistributionStatus(UriBuilder.fromUri(operationalEnvDistributionStatusURI+distributionId).build()); - } - - private OperationalEnvServiceModelStatus getSingleOperationalEnvServiceModelStatus(URI uri){ - return getClientFactory().create(OperationalEnvServiceModelStatus.class).get(uri); + try { + HttpEntity<?> entity = getHttpEntity(); + OperationalEnvDistributionStatus distributionStatus = restTemplate.exchange(getUri(operationalEnvDistributionStatusURI + distributionId), + HttpMethod.GET, entity, OperationalEnvDistributionStatus.class).getBody(); + if(null != distributionStatus){ + distributionStatus.setDistributionId(distributionId); + } + return distributionStatus; + }catch(HttpClientErrorException e){ + if(HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()){ + return null; + } + throw e; + } } private List<OperationalEnvServiceModelStatus> getMultipleOperationalEnvServiceModelStatus(URI uri){ @@ -270,32 +270,23 @@ public class RequestsDbClient { statusIterator.forEachRemaining(serviceModelStatuses::add); return serviceModelStatuses; } - + public void save(InfraActiveRequests infraActiveRequests) { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); + HttpHeaders headers = getHttpHeaders(); URI uri = getUri(infraActiveRequestURI); HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(infraActiveRequests, headers); restTemplate.postForLocation(uri, entity); } public <T> void save(T object){ - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); + HttpHeaders headers = getHttpHeaders(); URI uri = getUri(endpoint+classURLMapper.getURI(object.getClass())); HttpEntity<T> entity = new HttpEntity<>(object, headers); restTemplate.postForLocation(uri, entity); } - private OperationalEnvDistributionStatus getSingleOperationalEnvDistributionStatus(URI uri){ - return getClientFactory().create(OperationalEnvDistributionStatus.class).get(uri); - } - - public void updateInfraActiveRequests(InfraActiveRequests request) { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); - headers.set(HttpHeaders.CONTENT_TYPE,"application/json"); - headers.set(HttpHeaders.ACCEPT, "application/json"); + public void updateInfraActiveRequests(InfraActiveRequests request) { + HttpHeaders headers = getHttpHeaders(); URI uri = getUri(infraActiveRequestURI+request.getRequestId()); HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(request, headers); restTemplate.put(uri, entity); @@ -306,32 +297,18 @@ public class RequestsDbClient { } public void saveRequestProcessingData(RequestProcessingData requestProcessingData) { - HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", msoAdaptersAuth); + HttpHeaders headers = getHttpHeaders(); URI uri = getUri(endpoint + requestProcessingDataURI); HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers); restTemplate.postForLocation(uri, entity); } - - public RequestProcessingData getRequestProcessingDataBySoRequestIdAndGroupingIdAndNameAndTag(String soRequestId, - String groupingId, String name, String tag) { - return this.getSingleRequestProcessingData(UriBuilder.fromUri(endpoint + findOneBySoRequestIdAndGroupingIdAndNameAndTagURI) - .queryParam(SO_REQUEST_ID,soRequestId) - .queryParam(GROUPING_ID,groupingId) - .queryParam(NAME,name) - .queryParam(TAG,tag) - .build()); - } + public List<RequestProcessingData> getRequestProcessingDataBySoRequestId(String soRequestId) { - return this.getRequestProcessingData(UriBuilder.fromUri(endpoint + findBySoRequestIdOrderByGroupingIdDesc) + return this.getRequestProcessingData(getUri(UriBuilder.fromUri(endpoint + findBySoRequestIdOrderByGroupingIdDesc) .queryParam(SO_REQUEST_ID,soRequestId) - .build()); + .build().toString())); } - - public RequestProcessingData getSingleRequestProcessingData(URI uri){ - return getClientFactory().create(RequestProcessingData.class).get(uri); - } - + private List<RequestProcessingData> getRequestProcessingData(URI uri) { Iterable<RequestProcessingData> requestProcessingDataIterator = getClientFactory().create(RequestProcessingData.class).getAll(uri); List<RequestProcessingData> requestProcessingDataList = new ArrayList<>(); @@ -339,15 +316,6 @@ public class RequestsDbClient { it.forEachRemaining(requestProcessingDataList::add); return requestProcessingDataList; } - - public List<RequestProcessingData> getAllRequestProcessingData() { - - return (List<RequestProcessingData>) this.getAllRequestProcessingData(UriBuilder.fromUri(endpoint + "/requestProcessingData").build()); - } - - private Iterable<RequestProcessingData> getAllRequestProcessingData(URI uri) { - return getClientFactory().create(RequestProcessingData.class).getAll(uri); - } @Component static class ClassURLMapper { @@ -385,4 +353,18 @@ public class RequestsDbClient { public void removePortFromEndpoint() { endpoint = endpoint.substring(0, endpoint.lastIndexOf(':') + 1); } + + private HttpHeaders getHttpHeaders() { + HttpHeaders headers = new HttpHeaders(); + headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); + headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + return headers; + } + + private HttpEntity<?> getHttpEntity() { + HttpHeaders headers = getHttpHeaders(); + return new HttpEntity<>(headers); + } + } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index e29d88cb89..9a03f8fb07 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -27,6 +27,7 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkRecipe; @@ -47,6 +48,7 @@ import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; +import org.onap.so.logger.LogConstants; import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; @@ -118,6 +120,8 @@ public class CatalogDbClient { private static final String WORK_STEP = "workStep"; private static final String CLLI = "clli"; private static final String CLOUD_VERSION = "cloudVersion"; + + private static final String TARGET_ENTITY = "SO:CatalogDB"; private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc"; private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction"; @@ -255,6 +259,7 @@ public class CatalogDbClient { restTemplate.getInterceptors().add((request, body, execution) -> { request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); + request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER,TARGET_ENTITY); return execution.execute(request, body); }); }).build().buildClientFactory(); @@ -417,11 +422,11 @@ public class CatalogDbClient { public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( String flowName, String serviceType, String vnfType, String errorCode, String workStep) { - return this.getSingleResource(rainyDayHandlerStatusClient, UriBuilder + return this.getSingleResource(rainyDayHandlerStatusClient, getUri(UriBuilder .fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep) .queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType) .queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep) - .build()); + .build().toString())); } public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action){ diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepository.java index 79efe644bd..d27dce161e 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepository.java @@ -26,4 +26,7 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "collectionNetworkResourceCustomization", path = "collectionNetworkResourceCustomization") public interface CollectionNetworkResourceCustomizationRepository extends JpaRepository<CollectionNetworkResourceCustomization, String> { + + CollectionNetworkResourceCustomization findOneByModelCustomizationUUID(String modelCustomizationUUID); + }
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepositoryTest.java new file mode 100644 index 0000000000..90ec07f154 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepositoryTest.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.db.catalog.BaseTest; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; + +public class CollectionNetworkResourceCustomizationRepositoryTest extends BaseTest { + @Autowired + private CollectionNetworkResourceCustomizationRepository cnrcRepo; + + @Test + public void findAllTest() throws Exception { + List<CollectionNetworkResourceCustomization> cnrcList = cnrcRepo.findAll(); + Assert.assertFalse(CollectionUtils.isEmpty(cnrcList)); + } + + @Test + public void findOneByUuidTest() throws Exception { + CollectionNetworkResourceCustomization cnrc = cnrcRepo.findOneByModelCustomizationUUID("3bdbb104-ffff-483e-9f8b-c095b3d3068c"); + Assert.assertTrue(cnrc != null); + Assert.assertTrue("ExtVL 01".equals(cnrc.getModelInstanceName())); + } +} diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql index 097cd1ecd0..3f3aabb17e 100644 --- a/mso-catalog-db/src/test/resources/data.sql +++ b/mso-catalog-db/src/test/resources/data.sql @@ -88,6 +88,19 @@ insert into network_resource(model_uuid, model_name, model_invariant_uuid, descr insert into network_resource_customization(model_customization_uuid, model_instance_name, network_technology, network_type, network_role, network_scope, creation_timestamp, network_resource_model_uuid) values ('3bdbb104-476c-483e-9f8b-c095b3d308ac', 'CONTRAIL30_GNDIRECT 9', '', '', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c47fc'); +insert into instance_group(model_uuid, model_name, model_invariant_uuid, model_version, tosca_node_type, role, object_type, cr_model_uuid, instance_group_type) values +('21e43a7c-d823-4f5b-a427-5235f63035ff', 'dror_cr_network_resource_1806..NetworkCollection..0', '81c94263-c01e-4046-b0c7-51878d658eab', '1', 'org.openecomp.groups.NetworkCollection', 'SUB_INTERFACE', 'L3_NETWORK', '5e3fca45-e2d8-4987-bef1-016d9bda1a8c', 'L3_NETWORK'); + +insert into collection_resource(model_uuid, model_name, model_invariant_uuid, model_version, tosca_node_type, description) values +('5e3fca45-e2d8-4987-bef1-016d9bda1a8c', 'Dror_CR_Network_Resource_1806', 'fe243154-ac18-405f-94c2-ef629d26b8bb', '2.0', 'org.openecomp.resource.cr.DrorCrNetworkResource1806', 'Creation date: 07/25/18'); + +insert into collection_resource_customization(model_customization_uuid, model_instance_name, role, object_type, function, collection_resource_type, cr_model_uuid) values +('c51096a4-6081-41f4-a540-3ed015a8064a', 'Dror_CR_Network_Resource_1806', 'Dror2', 'NetworkCollection', 'Dror1', 'Dror3', '5e3fca45-e2d8-4987-bef1-016d9bda1a8c'); + +insert into collection_network_resource_customization(model_customization_uuid, model_instance_name, network_technology, network_type, network_role, network_scope, network_resource_model_uuid, instance_group_model_uuid, crc_model_customization_uuid) values +('3bdbb104-ffff-483e-9f8b-c095b3d30844', 'ExtVL 0', 'CONTRAIL', 'L3-NETWORK', '', '', '10b36f65-f4e6-4be6-ae49-9596dc1c47fz', '21e43a7c-d823-4f5b-a427-5235f63035ff', 'c51096a4-6081-41f4-a540-3ed015a8064a'), +('3bdbb104-ffff-483e-9f8b-c095b3d3068c', 'ExtVL 01', 'CONTRAIL', 'L3-NETWORK', '', '', '10b36f65-f4e6-4be6-ae49-9596dc1c47fz', '21e43a7c-d823-4f5b-a427-5235f63035ff', 'c51096a4-6081-41f4-a540-3ed015a8064a'); + insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values ('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002672', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '2.0', 'vSAMP10a', 'VF', null); diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index a8f8ee5f5a..3147c0206d 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -279,6 +279,31 @@ </assembly> </build> </image> + <image> + <name>onap/so/so-monitoring</name> + <build> + <cleanup>try</cleanup> + <dockerFileDir>docker-files</dockerFileDir> + <dockerFile>Dockerfile.so-app</dockerFile> + <tags> + <tag>${project.version}</tag> + <tag>${project.version}-${maven.build.timestamp}</tag> + <tag>${project.docker.latesttag.version}</tag> + </tags> + <assembly> + <inline> + <dependencySets> + <dependencySet> + <includes> + <include>org.onap.so.monitoring:so-monitoring-service</include> + </includes> + <outputFileNameMapping>app.jar</outputFileNameMapping> + </dependencySet> + </dependencySets> + </inline> + </assembly> + </build> + </image> </images> </configuration> @@ -310,7 +335,7 @@ <goal>push</goal> </goals> <configuration> - <image>onap/so/catalog-db-adapter,onap/so/request-db-adapter,onap/so/sdnc-adapter,onap/so/openstack-adapter,onap/so/vfc-adapter,onap/so/sdc-controller,onap/so/bpmn-infra,onap/so/api-handler-infra</image> + <image>onap/so/catalog-db-adapter,onap/so/request-db-adapter,onap/so/sdnc-adapter,onap/so/openstack-adapter,onap/so/vfc-adapter,onap/so/sdc-controller,onap/so/bpmn-infra,onap/so/api-handler-infra,onap/so/so-monitoring</image> </configuration> </execution> </executions> @@ -368,5 +393,10 @@ <artifactId>mso-api-handler-infra</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.onap.so-monitoring</groupId> + <artifactId>so-monitoring-service</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project> diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml index 5c8894300f..89482fdcda 100644 --- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml +++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -10,32 +10,36 @@ language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> <configuration scan="true" debug="false"> - <contextListener class="org.onap.so.logger.LoggerStartupListener" /> - <include resource="org/springframework/boot/logging/logback/base.xml" /> + <contextListener class="org.onap.so.logger.LoggerStartupListener" /> + <include resource="org/springframework/boot/logging/logback/defaults.xml" /> - <property name="queueSize" value="256" /> - <property name="maxFileSize" value="200MB" /> - <property name="maxHistory" value="30" /> - <property name="totalSizeCap" value="10GB" /> + <property name="queueSize" value="256" /> + <property name="maxFileSize" value="200MB" /> + <property name="maxHistory" value="30" /> + <property name="totalSizeCap" value="10GB" /> - <!-- log file names --> - <property name="errorLogName" value="error" /> - <property name="metricsLogName" value="metrics" /> - <property name="auditLogName" value="audit" /> - <property name="debugLogName" value="debug" /> - <property name="saneLogName" value="sane" /> + <!-- log file names --> + <property name="errorLogName" value="error" /> + <property name="metricsLogName" value="metrics" /> + <property name="auditLogName" value="audit" /> + <property name="debugLogName" value="debug" /> + + <property name="currentTimeStamp" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",UTC}"/> - <property name="errorPattern" - value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> + <property name="errorPattern" + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> - <property name="auditPattern" - value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" /> + <property name="debugPattern" + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}| %logger{50} - %msg%n" /> - <property name="metricPattern" - value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|||||%msg%n" /> + <property name="auditPattern" + value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" /> - <property name="defaultPattern" - value="%nopexception%logger + <property name="metricPattern" + value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|||||%msg%n" /> + + <property name="defaultPattern" + value="%nopexception%logger \t%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC} \t%level \t%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'} @@ -45,123 +49,151 @@ \t%thread \t%n" /> - <appender name="Audit" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logs_dir:-.}/${auditLogName}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logs_dir:-.}/${auditLogName}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>${maxFileSize}</maxFileSize> - <maxHistory>${maxHistory}</maxHistory> - <totalSizeCap>${totalSizeCap}</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${auditPattern}</pattern> - </encoder> - </appender> - - <appender name="asyncAudit" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="Audit" /> - </appender> - - <appender name="Metric" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logs_dir:-.}/${metricsLogName}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logs_dir:-.}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>${maxFileSize}</maxFileSize> - <maxHistory>${maxHistory}</maxHistory> - <totalSizeCap>${totalSizeCap}</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${metricPattern}</pattern> - </encoder> - </appender> - - - <appender name="asyncMetric" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="Metric" /> - </appender> - - <appender name="Error" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <level>ERROR</level> - <onMatch>ACCEPT</onMatch> - <onMismatch>DENY</onMismatch> - </filter> - <file>${logs_dir:-.}/${errorLogName}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logs_dir:-.}/${errorLogName}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>${maxFileSize}</maxFileSize> - <maxHistory>${maxHistory}</maxHistory> - <totalSizeCap>${totalSizeCap}</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${errorPattern}</pattern> - </encoder> - </appender> - - <appender name="asyncError" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="Error" /> - </appender> - - <appender name="Debug" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logs_dir:-.}/${debugLogName}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logs_dir:-.}/${debugLogName}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>${maxFileSize}</maxFileSize> - <maxHistory>${maxHistory}</maxHistory> - <totalSizeCap>${totalSizeCap}</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${defaultPattern}</pattern> - </encoder> - </appender> - - <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="Debug" /> - <includeCallerData>true</includeCallerData> - </appender> - - <!-- Spring related loggers --> - <logger name="org.springframework" level="WARN" /> - - <!-- Camunda related loggers --> - <logger name="org.camunda.bpm.engine.jobexecutor.level" level="WARN" /> - <logger - name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level" - level="WARN" /> - - <logger name="db.migration" level="DEBUG" /> - <logger name="org.apache.wire" level="DEBUG" /> - <logger name="org.onap" level="DEBUG" /> - <logger name="com.att.ecomp" level="DEBUG" /> - <logger name="org.apache.cxf" level="INFO" /> - - <logger name="AUDIT" level="INFO" additivity="false"> - <appender-ref ref="asyncAudit" /> - </logger> - - <logger name="METRIC" level="INFO" additivity="false"> - <appender-ref ref="asyncMetric" /> - </logger> - - <root level="WARN"> - <appender-ref ref="asyncDebug" /> - <appender-ref ref="asyncError" /> - </root> - -</configuration> + <appender name="Audit" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>EXIT</marker> + </evaluator> + <onMismatch>DENY</onMismatch> + <onMatch>ACCEPT</onMatch> + </filter> + <file>${logs_dir:-.}/${auditLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${auditLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${auditPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncAudit" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Audit" /> + </appender> + + <appender name="Metric" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>INVOKE_RETURN</marker> + </evaluator> + <onMismatch>DENY</onMismatch> + <onMatch>ACCEPT</onMatch> + </filter> + <file>${logs_dir:-.}/${metricsLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${metricPattern}</pattern> + </encoder> + </appender> + + + <appender name="asyncMetric" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Metric" /> + </appender> + + <appender name="Error" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>ERROR</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <file>${logs_dir:-.}/${errorLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${errorLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${errorPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncError" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Error" /> + </appender> + + <appender name="Debug" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>INVOKE</marker> + <marker>INVOKE_RETURN</marker> + <marker>ENTRY</marker> + <marker>EXIT</marker> + </evaluator> + <onMismatch>ACCEPT</onMismatch> + <onMatch>DENY</onMatch> + </filter> + <file>${logs_dir:-.}/${debugLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logs_dir:-.}/${debugLogName}.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>${maxFileSize}</maxFileSize> + <maxHistory>${maxHistory}</maxHistory> + <totalSizeCap>${totalSizeCap}</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>${debugPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="Debug" /> + <includeCallerData>true</includeCallerData> + </appender> + + <!-- Spring related loggers --> + <logger name="org.springframework" level="WARN" /> + <logger + name="org.springframework.security.authentication.dao.DaoAuthenticationProvider" + level="DEBUG" /> + + <!-- Camunda related loggers --> + <logger name="org.camunda.bpm.engine.jobexecutor.level" level="WARN" /> + <logger + name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level" + level="WARN" /> + + <logger name="org.apache.wire" level="DEBUG" /> + <logger name="org.onap" level="DEBUG" /> + <logger name="com.att.ecomp" level="DEBUG" /> + <logger name="org.apache.cxf.interceptor" level="DEBUG" /> + + <logger name="AUDIT" level="INFO" additivity="false"> + <appender-ref ref="asyncAudit" /> + </logger> + + <logger name="METRIC" level="INFO" additivity="false"> + <appender-ref ref="asyncMetric" /> + </logger> + + <root level="WARN"> + <appender-ref ref="asyncDebug" /> + <appender-ref ref="asyncError" /> + <appender-ref ref="asyncAudit" /> + <appender-ref ref="asyncMetric" /> + </root> + +</configuration>
\ No newline at end of file diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh index 7db4319195..143b1cf0b6 100644 --- a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh +++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh @@ -48,6 +48,10 @@ if [ ${APP} = "bpmn-infra" ]; then ln -s ${LOG_PATH} BPMN fi +if [ ${APP} = "so-monitoring" ]; then + ln -s ${LOG_PATH} MONITORING +fi + if [ ${APP} = "openstack-adapter" ]; then export DISABLE_SNI="-Djsse.enableSNIExtension=false" fi diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh b/packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh deleted file mode 100755 index 1a38fff899..0000000000 --- a/packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# Copyright 2015 AT&T Intellectual Properties -############################################################################## -# Script to initialize the chef-repo branch and.chef -# -############################################################################## -# Copy the certificates -echo 'Copying the *.crt provided in /shared folder' -cp --verbose /shared/*.crt /usr/local/share/ca-certificates -update-ca-certificates --fresh - -echo 'Running in JBOSS' -su - jboss - -#Start the chef-solo if mso-docker.json contains some data. -if [ -s /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json ] -then - echo "mso-docker.json has some configuration, replay the recipes." - chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra] -else - echo "mso-docker.json is empty, do not replay the recipes." -fi - -JBOSS_PIDFILE=/tmp/jboss-standalone.pid -$JBOSS_HOME/bin/standalone.sh -c standalone-full-ha-mso.xml & -JBOSS_PID=$! -# Trap common signals and relay them to the jboss process -trap "kill -HUP $JBOSS_PID" HUP -trap "kill -TERM $JBOSS_PID" INT -trap "kill -QUIT $JBOSS_PID" QUIT -trap "kill -PIPE $JBOSS_PID" PIPE -trap "kill -TERM $JBOSS_PID" TERM -if [ "x$JBOSS_PIDFILE" != "x" ]; then - echo $JBOSS_PID > $JBOSS_PIDFILE -fi -# Wait until the background process exits -WAIT_STATUS=128 -while [ "$WAIT_STATUS" -ge 128 ]; do - wait $JBOSS_PID 2>/dev/null - WAIT_STATUS=$? - if [ "$WAIT_STATUS" -gt 128 ]; then - SIGNAL=`expr $WAIT_STATUS - 128` - SIGNAL_NAME=`kill -l $SIGNAL` - echo "*** JBossAS process ($JBOSS_PID) received $SIGNAL_NAME signal ***" >&2 - fi -done -if [ "$WAIT_STATUS" -lt 127 ]; then - JBOSS_STATUS=$WAIT_STATUS -else - JBOSS_STATUS=0 -fi -if [ "$JBOSS_STATUS" -ne 10 ]; then - # Wait for a complete shudown - wait $JBOSS_PID 2>/dev/null -fi -if [ "x$JBOSS_PIDFILE" != "x" ]; then - grep "$JBOSS_PID" $JBOSS_PIDFILE && rm $JBOSS_PIDFILE -fi @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> - <version>1.2.0</version> + <version>1.2.1</version> <relativePath/> </parent> <groupId>org.onap.so</groupId> @@ -47,9 +47,12 @@ <sonar.cpd.exclusions>**/*</sonar.cpd.exclusions> <jacoco.version>0.7.5.201505241946</jacoco.version> <org.apache.maven.user-settings/> - <openstack.version>1.2.2</openstack.version> + <openstack.version>1.3.0</openstack.version> <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format> <springboot.version>1.5.13.RELEASE</springboot.version> + <springframework.version>5.0.8.RELEASE</springframework.version> + <tomcat.version>8.5.33</tomcat.version> + <h2.version>1.4.196</h2.version> <originalClassifier>original</originalClassifier> <docker.skip>true</docker.skip> <docker.skip.build>true</docker.skip.build> @@ -508,7 +511,6 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> - <version>2.8.10</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.module</groupId> @@ -678,12 +680,6 @@ WildFly 10 version --> <dependency> <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.5.5</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4.4</version> <scope>compile</scope> @@ -728,7 +724,7 @@ <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> - <version>1.15</version> + <version>1.23</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -761,6 +757,55 @@ <artifactId>flyway-core</artifactId> <version>4.2.0</version> </dependency> + <dependency> + <groupId>org.apache.tomcat.embed</groupId> + <artifactId>tomcat-embed-core</artifactId> + <version>${tomcat.version}</version> + </dependency> + <dependency> + <groupId>org.apache.tomcat.embed</groupId> + <artifactId>tomcat-embed-el</artifactId> + <version>${tomcat.version}</version> + </dependency> + <dependency> + <groupId>org.apache.tomcat.embed</groupId> + <artifactId>tomcat-embed-websocket</artifactId> + <version>${tomcat.version}</version> + </dependency> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>tomcat-annotations-api</artifactId> + <version>${tomcat.version}</version> + </dependency> + <dependency> + <groupId>org.json4s</groupId> + <artifactId>json4s-jackson_2.12</artifactId> + <version>3.6.0</version> + </dependency> + <dependency> + <groupId>org.json4s</groupId> + <artifactId>json4s-core_2.12</artifactId> + <version>3.6.0</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-email</artifactId> + <version>1.5</version> + </dependency> + <dependency> + <groupId>org.immutables</groupId> + <artifactId>value</artifactId> + <version>2.7.1</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>${h2.version}</version> + </dependency> </dependencies> </dependencyManagement> <profiles> diff --git a/so-monitoring/so-monitoring-handler/pom.xml b/so-monitoring/so-monitoring-handler/pom.xml index a535d408f7..ae900ba422 100644 --- a/so-monitoring/so-monitoring-handler/pom.xml +++ b/so-monitoring/so-monitoring-handler/pom.xml @@ -33,7 +33,6 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> - <guava.version>22.0</guava.version> <openpojo.version>0.8.6</openpojo.version> </properties> @@ -42,7 +41,6 @@ <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> - <version>${guava.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -92,4 +90,4 @@ <version>${project.version}</version> </dependency> </dependencies> -</project>
\ No newline at end of file +</project> diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java index b1815b5350..2515c8f79b 100644 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java @@ -35,21 +35,21 @@ import org.onap.so.montoring.model.ProcessDefinitionDetail; import org.onap.so.montoring.model.ProcessInstanceDetail; import org.onap.so.montoring.model.ProcessInstanceIdDetail; import org.onap.so.montoring.model.ProcessInstanceVariableDetail; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import com.google.common.base.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * @author waqas.ikram@ericsson.com */ @Service public class CamundaProcessDataServiceProviderImpl implements CamundaProcessDataServiceProvider { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(CamundaProcessDataServiceProviderImpl.class); - + private static final Logger LOGGER = LoggerFactory.getLogger(CamundaProcessDataServiceProviderImpl.class); private final CamundaRestUrlProvider urlProvider; private final HttpRestServiceProvider httpRestServiceProvider; @@ -69,7 +69,9 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData if (processInstances.isPresent()) { final ProcessInstance[] instances = processInstances.get(); - LOGGER.debug("found process instance for request id: {}, result size: {}", requestId, instances.length); + final String message = "found process instance for request id: " + requestId + + ", result size: " + instances.length; + LOGGER.debug(message); if (instances.length > 0) { for (int index = 0; index < instances.length; index++) { @@ -77,12 +79,12 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData if (processInstance.getSuperProcessInstanceId() == null) { return Optional.of(new ProcessInstanceIdDetail(processInstance.getId())); } - LOGGER.debug("found sub process instance id with super process instanceId: {}", + LOGGER.debug("found sub process instance id with super process instanceId: " + processInstance.getSuperProcessInstanceId()); } } } - LOGGER.error("Unable to find process intance for request id: {}", requestId); + LOGGER.error("Unable to find process intance for request id: " + requestId); return Optional.absent(); } @@ -101,7 +103,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData return Optional.of(instanceDetail); } - LOGGER.error("Unable to find process intance for id: {}", processInstanceId); + LOGGER.error("Unable to find process intance for id: " + processInstanceId); return Optional.absent(); } @@ -118,7 +120,8 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData return Optional.of(new ProcessDefinitionDetail(processDefinitionId, xmlDefinition)); } } - LOGGER.error("Unable to find process definition for processDefinitionId: {}", processDefinitionId); + LOGGER.error("Unable to find process definition for processDefinitionId: " + + processDefinitionId); return Optional.absent(); } @@ -145,7 +148,8 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData } return activityInstanceDetails; } - LOGGER.error("Unable to find activity intance detail for process instance id: {}", processInstanceId); + LOGGER.error("Unable to find activity intance detail for process instance id: " + + processInstanceId); return Collections.emptyList(); } @@ -167,7 +171,8 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData } return instanceVariableDetails; } - LOGGER.error("Unable to find process intance variable details for process instance id: {}", processInstanceId); + LOGGER.error("Unable to find process intance variable details for process instance id: " + + processInstanceId); return Collections.emptyList(); } diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java index 35e6038a86..b5cafcf1ed 100644 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java @@ -21,8 +21,6 @@ package org.onap.so.montoring.rest.service; import org.onap.so.montoring.exception.InvalidRestRequestException; import org.onap.so.montoring.exception.RestProcessingException; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; @@ -33,13 +31,15 @@ import org.springframework.web.client.RestTemplate; import com.google.common.base.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * @author waqas.ikram@ericsson.com */ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(HttpRestServiceProviderImpl.class); - + private static final Logger LOGGER = LoggerFactory.getLogger(HttpRestServiceProviderImpl.class); private final RestTemplate restTemplate; public HttpRestServiceProviderImpl(final RestTemplate restTemplate) { @@ -48,12 +48,13 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { @Override public <T> Optional<T> getHttpResponse(final String url, final Class<T> clazz) { - LOGGER.trace("Will invoke HTTP GET using URL: {}", url); + LOGGER.trace("Will invoke HTTP GET using URL: " + url); try { final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.GET, null, clazz); if (!response.getStatusCode().equals(HttpStatus.OK)) { - LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: {}", url, - response.getStatusCode()); + final String message = "Unable to invoke HTTP GET using URL: " + url + + ", Response Code: " + response.getStatusCode(); + LOGGER.error(message); return Optional.absent(); } @@ -61,8 +62,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { return Optional.of(response.getBody()); } } catch (final HttpClientErrorException httpClientErrorException) { - LOGGER.error("Unable to invoke HTTP GET using url: {}, Response: {}", url, - httpClientErrorException.getRawStatusCode(), httpClientErrorException); + final String message = "Unable to invoke HTTP GET using url: " + url + ", Response: " + + httpClientErrorException.getRawStatusCode(); + LOGGER.error(message, httpClientErrorException); final int rawStatusCode = httpClientErrorException.getRawStatusCode(); if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) { throw new InvalidRestRequestException("No result found for given url: " + url); @@ -70,8 +72,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url); } catch (final RestClientException restClientException) { - LOGGER.error("Unable to invoke HTTP GET using url: {}", url, restClientException); - throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url, restClientException); + LOGGER.error("Unable to invoke HTTP GET using url: " + url, restClientException); + throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + + url, restClientException); } return Optional.absent(); @@ -83,8 +86,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { final HttpEntity<?> request = new HttpEntity<>(object); final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.POST, request, clazz); if (!response.getStatusCode().equals(HttpStatus.OK)) { - LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: {}", url, - response.getStatusCode()); + final String message = "Unable to invoke HTTP GET using URL: " + url + + ", Response Code: " + response.getStatusCode(); + LOGGER.error(message); return Optional.absent(); } @@ -93,8 +97,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { } } catch (final HttpClientErrorException httpClientErrorException) { - LOGGER.error("Unable to invoke HTTP POST using url: {}, Response: {}", url, - httpClientErrorException.getRawStatusCode(), httpClientErrorException); + final String message = "Unable to invoke HTTP POST using url: " + url + + ", Response: " + httpClientErrorException.getRawStatusCode(); + LOGGER.error(message, httpClientErrorException); final int rawStatusCode = httpClientErrorException.getRawStatusCode(); if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) { throw new InvalidRestRequestException("No result found for given url: " + url); @@ -102,8 +107,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + url); } catch (final RestClientException restClientException) { - LOGGER.error("Unable to invoke HTTP POST using url: {}", url, restClientException); - throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + url, restClientException); + LOGGER.error("Unable to invoke HTTP POST using url: " + url, restClientException); + throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + + url, restClientException); } return Optional.absent(); diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java index 913fb3f934..de2263be3f 100644 --- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java +++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java @@ -42,13 +42,14 @@ import org.onap.so.montoring.model.ProcessInstanceIdDetail; import org.onap.so.montoring.model.ProcessInstanceVariableDetail; import org.onap.so.montoring.model.SoInfraRequest; import org.onap.so.montoring.rest.service.CamundaProcessDataServiceProvider; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.google.common.base.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * @author waqas.ikram@ericsson.com */ @@ -58,7 +59,7 @@ public class SoMonitoringController { private static final String INVALID_PROCESS_INSTANCE_ERROR_MESSAGE = "Invalid process instance id: "; - private static final XLogger LOGGER = XLoggerFactory.getXLogger(SoMonitoringController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SoMonitoringController.class); private final DatabaseServiceProvider databaseServiceProvider; @@ -85,7 +86,7 @@ public class SoMonitoringController { return Response.status(Status.OK).entity(processInstanceId.get()).build(); } - LOGGER.error("Unable to find process instance id for : {}", requestId); + LOGGER.error("Unable to find process instance id for : " + requestId); return Response.status(Status.NO_CONTENT).build(); } catch (final InvalidRestRequestException extensions) { @@ -114,7 +115,7 @@ public class SoMonitoringController { return Response.status(Status.OK).entity(processInstanceDetail.get()).build(); } - LOGGER.error("Unable to find process instance id for : {}", processInstanceId); + LOGGER.error("Unable to find process instance id for : " + processInstanceId); return Response.status(Status.NO_CONTENT).build(); } catch (final InvalidRestRequestException extensions) { @@ -133,7 +134,8 @@ public class SoMonitoringController { @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getProcessDefinitionXml(final @PathParam("processDefinitionId") String processDefinitionId) { if (processDefinitionId == null || processDefinitionId.isEmpty()) { - return Response.status(Status.BAD_REQUEST).entity("Invalid process definition id: " + processDefinitionId) + return Response.status(Status.BAD_REQUEST).entity("Invalid process definition id: " + + processDefinitionId) .build(); } try { @@ -143,15 +145,18 @@ public class SoMonitoringController { final ProcessDefinitionDetail definitionDetail = response.get(); return Response.status(Status.OK).entity(definitionDetail).build(); } - LOGGER.error("Unable to find process definition xml for processDefinitionId: {}", processDefinitionId); + LOGGER.error("Unable to find process definition xml for processDefinitionId: " + + processDefinitionId); return Response.status(Status.NO_CONTENT).build(); } catch (final InvalidRestRequestException extensions) { final String message = - "Unable to find process definition xml for processDefinitionId: {}" + processDefinitionId; + "Unable to find process definition xml for processDefinitionId: {}" + + processDefinitionId; return Response.status(Status.BAD_REQUEST).entity(message).build(); } catch (final RestProcessingException restProcessingException) { - final String message = "Unable to get process definition xml for id: " + processDefinitionId; + final String message = "Unable to get process definition xml for id: " + + processDefinitionId; LOGGER.error(message); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); } @@ -170,11 +175,13 @@ public class SoMonitoringController { camundaProcessDataServiceProvider.getActivityInstance(processInstanceId); return Response.status(Status.OK).entity(activityInstanceDetails).build(); } catch (final InvalidRestRequestException extensions) { - final String message = "Unable to find activity instance for processInstanceId: " + processInstanceId; + final String message = "Unable to find activity instance for processInstanceId: " + + processInstanceId; LOGGER.error(message); return Response.status(Status.BAD_REQUEST).entity(message).build(); } catch (final RestProcessingException restProcessingException) { - final String message = "Unable to get activity instance detail for id: " + processInstanceId; + final String message = "Unable to get activity instance detail for id: " + + processInstanceId; LOGGER.error(message); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); } @@ -194,11 +201,13 @@ public class SoMonitoringController { return Response.status(Status.OK).entity(processInstanceVariable).build(); } catch (final InvalidRestRequestException extensions) { final String message = - "Unable to find process instance variables for processInstanceId: " + processInstanceId; + "Unable to find process instance variables for processInstanceId: " + + processInstanceId; LOGGER.error(message); return Response.status(Status.BAD_REQUEST).entity(message).build(); } catch (final RestProcessingException restProcessingException) { - final String message = "Unable to get process instance variables for id: " + processInstanceId; + final String message = "Unable to get process instance variables for id: " + + processInstanceId; LOGGER.error(message); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); } @@ -217,17 +226,17 @@ public class SoMonitoringController { try { final List<SoInfraRequest> requests = databaseServiceProvider.getSoInfraRequest(filters, startTime, endTime, maxResult); - LOGGER.info("result size: {}", requests.size()); + LOGGER.info("result size: " + requests.size()); return Response.status(Status.OK).entity(requests).build(); } catch (final InvalidRestRequestException extensions) { - final String message = "Unable to search request for filters: " + filters + ", from: " + startTime - + ", to: " + endTime + ", maxResult: " + maxResult; + final String message = "Unable to search request for filters: " + filters + ", from: " + + startTime + ", to: " + endTime + ", maxResult: " + maxResult; LOGGER.error(message); return Response.status(Status.BAD_REQUEST).entity(message).build(); } catch (final RestProcessingException restProcessingException) { - final String message = "Unable to search request for filters: " + filters + ", from: " + startTime - + ", to: " + endTime + ", maxResult: " + maxResult; + final String message = "Unable to search request for filters: " + filters + ", from: " + + startTime + ", to: " + endTime + ", maxResult: " + maxResult; LOGGER.error(message); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); } diff --git a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml index f21207474a..d1d2d00e94 100644 --- a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml +++ b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml @@ -13,5 +13,5 @@ mso: database: rest: api: - url: http://request-db-adapter:8083/infraActiveRequests/ - auth: Basic YnBlbDpwYXNzd29yZDEk
\ No newline at end of file + url: http://so-request-db-adapter:8083/infraActiveRequests/ + auth: Basic YnBlbDpwYXNzd29yZDEk diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json b/so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json index d9ec649f2e..78642155b4 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json @@ -6717,6 +6717,14 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, + "ngx-spinner": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/ngx-spinner/-/ngx-spinner-6.1.2.tgz", + "integrity": "sha512-j/R8T5vKvsLLib1pTxKLYK3GYAFXw5VoUJmaTlcocO6Yi4qIypfhmw9PX9triy7hWVGPu6cUzVs7g9cEG9OYBA==", + "requires": { + "tslib": "^1.9.0" + } + }, "no-case": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/package.json b/so-monitoring/so-monitoring-ui/src/main/frontend/package.json index c6f6f14dea..c793264e99 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/package.json +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/package.json @@ -26,6 +26,7 @@ "bpmn-js": "^2.4.1", "core-js": "^2.5.4", "jquery": "^3.3.1", + "ngx-spinner": "^6.1.2", "rxjs": "^6.0.0", "toastr": "^2.1.4", "zone.js": "^0.8.26" diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts index c3a02b90f3..b9437ccb75 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts @@ -40,6 +40,7 @@ import { MatFormFieldModule, MatInputModule } from '@angular/material'; import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material';
import { MatCardModule } from '@angular/material/card';
+import { NgxSpinnerModule } from 'ngx-spinner';
@NgModule({
declarations: [
@@ -62,7 +63,8 @@ import { MatCardModule } from '@angular/material/card'; MatInputModule,
MatDatepickerModule,
MatNativeDateModule,
- MatCardModule
+ MatCardModule,
+ NgxSpinnerModule
],
providers: [ToastrNotificationService],
bootstrap: [AppComponent]
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html index fc682acb61..45301c7945 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html @@ -97,3 +97,5 @@ SPDX-License-Identifier: Apache-2.0 </mat-tab-group>
</div>
</div>
+
+<ngx-spinner bdColor="rgba(51, 51, 51, 0.8)" size="large" color="#00285f" type="ball-spin-clockwise-fade-rotating"></ngx-spinner>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts index 9561e9abf7..4c19ba1039 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts @@ -33,6 +33,7 @@ import { ViewEncapsulation } from '@angular/core'; import { MatTabsModule } from '@angular/material/tabs';
import { VarInstance } from '../model/variableInstance.model';
import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { NgxSpinnerService } from 'ngx-spinner';
@Component({
selector: 'app-details',
@@ -63,7 +64,8 @@ export class DetailsComponent implements OnInit { displayedColumnsVariable = ['name', 'type', 'value'];
- constructor(private route: ActivatedRoute, private data: DataService, private popup: ToastrNotificationService, private router: Router) { }
+ constructor(private route: ActivatedRoute, private data: DataService, private popup: ToastrNotificationService,
+ private router: Router, private spinner: NgxSpinnerService) { }
getActInst(procInstId: string) {
this.data.getActivityInstance(procInstId).subscribe(
@@ -104,12 +106,15 @@ export class DetailsComponent implements OnInit { }
displayCamundaflow(bpmnXml, activities: ACTINST[], r: Router) {
+ this.spinner.show();
this.bpmnViewer.importXML(bpmnXml, (error) => {
if (error) {
console.error('Unable to load BPMN flow ', error);
this.popup.error('Unable to load BPMN flow ');
+ this.spinner.hide();
} else {
+ this.spinner.hide();
let canvas = this.bpmnViewer.get('canvas');
var eventBus = this.bpmnViewer.get('eventBus');
eventBus.on('element.click', function(e) {
@@ -118,6 +123,7 @@ export class DetailsComponent implements OnInit { if (a.activityId == e.element.id && a.calledProcessInstanceId !== null) {
console.log("will drill down to : " + a.calledProcessInstanceId);
r.navigate(['/details/' + a.calledProcessInstanceId]);
+ this.spinner.show();
}
});
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html index 6adea3b357..2b580e26a1 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html @@ -50,26 +50,26 @@ SPDX-License-Identifier: Apache-2.0 <input matInput #searchValueRI type="text" [(ngModel)]="searchData.requestId" placeholder="Request Id">
</mat-form-field>
- <!-- Angular Start Date Picker -->
- <mat-form-field class="startDate">
- <input matInput #startDate [matDatepicker]="picker" [(ngModel)]="searchData.startDate" placeholder="Choose a start date">
- <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
- <mat-datepicker #picker></mat-datepicker>
- </mat-form-field>
-
- <!-- Dropdown box for Start Hour selection -->
- <mat-form-field class="selectHour">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartHour" name="hourFrom" placeholder="Select Hour">
- <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
- </mat-select>
- </mat-form-field>
-
- <!-- Dropdown box for Start Minute selection -->
- <mat-form-field class="selectMinute">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartMinute" name="minuteFrom" placeholder="Select Minute">
- <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
- </mat-select>
- </mat-form-field>
+ <!-- Angular Start Date Picker -->
+ <mat-form-field class="startDate">
+ <input matInput #startDate [matDatepicker]="picker" [(ngModel)]="searchData.startDate" placeholder="Choose a start date">
+ <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
+ <mat-datepicker #picker></mat-datepicker>
+ </mat-form-field>
+
+ <!-- Dropdown box for Start Hour selection -->
+ <mat-form-field class="selectHour">
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartHour" name="hourFrom" placeholder="Select Hour">
+ <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
+ </mat-select>
+ </mat-form-field>
+
+ <!-- Dropdown box for Start Minute selection -->
+ <mat-form-field class="selectMinute">
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartMinute" name="minuteFrom" placeholder="Select Minute">
+ <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
+ </mat-select>
+ </mat-form-field>
</div>
<!-- Dropdown Filter and TextBox for Service Name -->
@@ -83,26 +83,26 @@ SPDX-License-Identifier: Apache-2.0 <input matInput #searchValueSN type="text" [(ngModel)]="searchData.serviceInstanceName" placeholder="Service Name">
</mat-form-field>
- <!-- Angular End Date Picker -->
- <mat-form-field class="endDate">
- <input matInput #endDate [matDatepicker]="endpicker" [(ngModel)]="searchData.endDate" placeholder="Choose an end date">
- <mat-datepicker-toggle matSuffix [for]="endpicker"></mat-datepicker-toggle>
- <mat-datepicker #endpicker></mat-datepicker>
- </mat-form-field>
-
- <!-- Dropdown box for End Hour selection -->
- <mat-form-field class="selectHour">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndHour" name="hourTo" placeholder="Select Hour">
- <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
- </mat-select>
- </mat-form-field>
-
- <!-- Dropdown box for End Minute selection -->
- <mat-form-field class="selectMinute">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndMinute" name="minuteTo" placeholder="Select Minute">
- <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
- </mat-select>
- </mat-form-field>
+ <!-- Angular End Date Picker -->
+ <mat-form-field class="endDate">
+ <input matInput #endDate [matDatepicker]="endpicker" [(ngModel)]="searchData.endDate" placeholder="Choose an end date">
+ <mat-datepicker-toggle matSuffix [for]="endpicker"></mat-datepicker-toggle>
+ <mat-datepicker #endpicker></mat-datepicker>
+ </mat-form-field>
+
+ <!-- Dropdown box for End Hour selection -->
+ <mat-form-field class="selectHour">
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndHour" name="hourTo" placeholder="Select Hour">
+ <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
+ </mat-select>
+ </mat-form-field>
+
+ <!-- Dropdown box for End Minute selection -->
+ <mat-form-field class="selectMinute">
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndMinute" name="minuteTo" placeholder="Select Minute">
+ <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
+ </mat-select>
+ </mat-form-field>
</div>
<!-- Dropdown Filter for Status -->
@@ -165,23 +165,39 @@ SPDX-License-Identifier: Apache-2.0 <mat-tab label="Service Statistics">
<div id="servStats">
- <p>Total: {{ totalVal }}</p>
- <hr/>
- <p>Complete: {{ completeVal }}</p>
- <p><b> {{ percentageComplete }}%</b></p>
- <hr/>
- <p>Failed: {{ failedVal }}</p>
- <p><b> {{ percentageFailed }}%</b></p>
- <hr/>
- <p>In Progress: {{ inProgressVal }}</p>
- <hr/>
- <p>Pending: {{ pendingVal }}</p>
- <hr/>
- <p>Unlocked: {{ unlockedVal }}</p>
+ <table class="statsTable">
+ <tbody>
+ <tr>
+ <td>Total: {{ totalVal }}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>Complete: {{ completeVal }}</td>
+ <td> {{ percentageComplete }}%</td>
+ </tr>
+ <tr>
+ <td>Failed: {{ failedVal }}</td>
+ <td> {{ percentageFailed }}%</td>
+ </tr>
+ <tr>
+ <td>In Progress: {{ inProgressVal }}</td>
+ <td> {{ percentageInProg }}%</td>
+ </tr>
+ <tr>
+ <td>Pending: {{ pendingVal }}</td>
+ <td> {{ percentagePending }}%</td>
+ </tr>
+ <tr>
+ <td>Unlocked: {{ unlockedVal }}</td>
+ <td> {{ percentageUnlocked }}%</td>
+ </tr>
+ </tbody>
+ </table>
</div>
</mat-tab>
</mat-tab-group>
</div>
</div>
+<ngx-spinner bdColor="rgba(51, 51, 51, 0.8)" size="large" color="#00285f" type="ball-spin-clockwise-fade-rotating"></ngx-spinner>
<router-outlet></router-outlet>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.scss b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.scss index d475c52cb8..923066face 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.scss +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.scss @@ -19,7 +19,6 @@ SPDX-License-Identifier: Apache-2.0 @authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
*/
-
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
.searchArea {
@@ -77,7 +76,7 @@ SPDX-License-Identifier: Apache-2.0 }
.fa {
- float: left;
+ float: left;
width: 120px;
padding: 10px;
background: #2196F3;
@@ -103,28 +102,29 @@ form.example::after { display: inline-flex;
}
-.startDate, .endDate{
+.endDate,
+.startDate {
margin-left: 90px;
width: 140px;
}
-.selectHour, .selectMinute{
+.selectHour,
+.selectMinute {
margin-left: 30px;
- width: 100px
+ width: 100px;
}
-#servStats{
+#servStats {
background-color: white;
padding: 10px;
font-size: 17px;
font-family: 'Montserrat', sans-serif;
}
-hr {
- display: block;
- height: 1px;
- border: 0;
- border-top: 1px solid #ccc;
- margin: 1em 0;
- padding: 0;
+.statsTable {
+ td {
+ padding: 12px 80px 12px 12px;
+ text-align: left;
+ border-bottom: 1px solid #ccc;
+ }
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts index dd08bb4ae5..b8fac61adf 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts @@ -35,9 +35,9 @@ import { SearchData } from '../model/searchData.model'; import { MatDatepickerModule } from '@angular/material/datepicker'; import { FormControl } from '@angular/forms'; import { SearchRequest } from '../model/SearchRequest.model'; -import { ViewChild } from '@angular/core'; import { ElementRef } from '@angular/core'; import { Input } from '@angular/core'; +import { NgxSpinnerService } from 'ngx-spinner'; @Component({ selector: 'app-home', @@ -56,6 +56,9 @@ export class HomeComponent implements OnInit { unlockedVal = 0; percentageComplete = 0; percentageFailed = 0; + percentageInProg = 0; + percentagePending = 0; + percentageUnlocked = 0; options = [{ name: "EQUAL", value: "EQ" }, { name: "NOT EQUAL", value: "NEQ" }, { name: "LIKE", value: "LIKE" }]; statusOptions = [{ name: "ALL", value: "ALL" }, { name: "COMPLETE", value: "COMPLETE" }, { name: "IN_PROGRESS", value: "IN_PROGRESS" }, @@ -77,17 +80,22 @@ export class HomeComponent implements OnInit { displayedColumns = ['requestId', 'serviceInstanceId', 'serviceIstanceName', 'networkId', 'requestStatus', 'serviceType', 'startTime', 'endTime']; constructor(private route: ActivatedRoute, private data: DataService, - private router: Router, private popup: ToastrNotificationService) { + private router: Router, private popup: ToastrNotificationService, + private spinner: NgxSpinnerService) { this.searchData = new SearchData(); } makeCall() { + this.spinner.show(); + var search = this.searchData.getSearchRequest().subscribe((result: SearchRequest) => { this.data.retrieveInstance(result.getFilters(), result.getStartTimeInMilliseconds(), result.getEndTimeInMilliseconds()) .subscribe((data: Process[]) => { + this.spinner.hide(); this.processData = data; - this.popup.info("Number of records found: " + data.length); + this.popup.info("Number of records found: " + data.length) + // Calculate Statistics for Service Statistics tab this.completeVal = this.processData.filter(i => i.requestStatus === "COMPLETE").length; this.inProgressVal = this.processData.filter(i => i.requestStatus === "IN_PROGRESS").length; @@ -95,28 +103,40 @@ export class HomeComponent implements OnInit { this.pendingVal = this.processData.filter(i => i.requestStatus === "PENDING").length; this.unlockedVal = this.processData.filter(i => i.requestStatus === "UNLOCKED").length; this.totalVal = this.processData.length; - this.percentageComplete = Math.round(((this.completeVal / this.totalVal) * 100) * 100) / 100; - this.percentageFailed = Math.round(((this.failedVal / this.totalVal) * 100) * 100) / 100; + // Calculate percentages to 2 decimal places and compare to 0 to avoid NaN error + if (this.totalVal != 0) { + this.percentageComplete = Math.round(((this.completeVal / this.totalVal) * 100) * 100) / 100; + this.percentageFailed = Math.round(((this.failedVal / this.totalVal) * 100) * 100) / 100; + this.percentageInProg = Math.round(((this.inProgressVal / this.totalVal) * 100) * 100) / 100; + this.percentagePending = Math.round(((this.pendingVal / this.totalVal) * 100) * 100) / 100; + this.percentageUnlocked = Math.round(((this.unlockedVal / this.totalVal) * 100) * 100) / 100; + } console.log("COMPLETE: " + this.completeVal); console.log("FAILED: " + this.failedVal); }, error => { console.log(error); this.popup.error("Unable to perform search Error code:" + error.status); + this.spinner.hide(); }); }, error => { console.log("Data validation error " + error); this.popup.error(error); + this.spinner.hide(); }); } getProcessIsntanceId(requestId: string) { + this.spinner.show(); + var response = this.data.getProcessInstanceId(requestId).subscribe((data) => { if (data.status == 200) { + this.spinner.hide(); var processInstanceId = (data.body as ProcessInstanceId).processInstanceId; this.router.navigate(['/details/' + processInstanceId]); } else { this.popup.error('No process instance id found: ' + requestId); + this.spinner.hide(); console.log('No process instance id found: ' + requestId); } }); diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock b/so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock index f6fade9614..7ecbb03ae7 100644 --- a/so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock +++ b/so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock @@ -4098,6 +4098,12 @@ next-tick@1: version "1.0.0" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" +ngx-spinner@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/ngx-spinner/-/ngx-spinner-6.1.2.tgz#9778dbffbd17b27a7a90c4f0d9d8a7817e6ffb76" + dependencies: + tslib "^1.9.0" + no-case@^2.2.0: version "2.3.2" resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" |