From fb6ab40a64e74876ba1f08c4d3bdb6a040c21b94 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 5 Nov 2018 19:12:02 -0500 Subject: Bug fixes November 5th building block validator test now passes added buildingblockvalidator process instance test Retrieve actual error from WorkflowExceptionErrorMessage when the error message is empty, not only when null. Propagate orchestrationStatusValidationResult values from BB to BB. corrected use of constructor for AaiUtil use AaiUtil method to create path for get call modified how allotted resource urls are constructed - Removed the findExistingVnfcInstanceGroup method. It is not required to check this because the vnfResourceCustomization is always a new object at this location. Enable multiStage VF Module Create processing only when aLaCarte flag is on. Change-Id: If8cf397a84abc290e67e287d5b2264dd226398bc Issue-ID: SO-1188 Signed-off-by: Benjamin, Max (mb388a) --- .../main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bpmn/so-bpmn-building-blocks/src/main/resources/subprocess') diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 8cda1d7c7b..3b24ba390b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_15s0okp @@ -17,6 +17,9 @@ + + + SequenceFlow_0mew9im SequenceFlow_07h9d4y -- cgit 1.2.3-korg From 5ca364a5e975877244ee51796602043a4b078a23 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Fri, 26 Oct 2018 09:54:46 -0400 Subject: Make homingBB optinal and fix homing process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Properly defined whether or not to call homing at AssignVnfBB where by default homing doesn't get called, but if a homing solution is provided, then we resolve the solutions. The goal is to change the BPMN definition to use serviceTask rather than a scriptTask, allowing to use the Srping component to inject logic. Also we create a new HomingV2 component that is agnostic of the homing implementation, which goal is to route the homing request to the proper bbackend implementation; e.g. oof vs homing. Finally, we remove the un-needed variables set in the execution context. Change-Id: Ic9fb2a599c6375617c92a6d3462b62921ee47a6f Issue-ID: SO-1168 Signed-off-by: Alexis de Talhouët --- .../onap/so/bpmn/common/scripts/OofHoming.groovy | 5 +- .../subprocess/BuildingBlock/AssignVnfBB.bpmn | 12 +- .../subprocess/BuildingBlock/HomingBB.bpmn | 124 +++++++++------------ .../org/onap/so/bpmn/buildingblock/HomingV2.java | 59 ++++++++++ .../workflow/tasks/WorkflowAction.java | 32 +++--- 5 files changed, 138 insertions(+), 94 deletions(-) create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java (limited to 'bpmn/so-bpmn-building-blocks/src/main/resources/subprocess') 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 c8736b8f0e..806a144a48 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 @@ -18,13 +18,11 @@ * ============LICENSE_END========================================================= */ package org.onap.so.bpmn.common.scripts + import org.onap.so.bpmn.core.UrnPropertiesReader import org.camunda.bpm.engine.delegate.BpmnError 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.core.domain.InventoryType import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ResourceType @@ -37,7 +35,6 @@ 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.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.json.JSONArray import org.json.JSONObject 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 3355e627c3..9118b0ab5e 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 @@ -28,9 +28,11 @@ - + + + - + @@ -65,7 +67,7 @@ - + SequenceFlow_1nle8kc SequenceFlow_11jum90 SequenceFlow_1uiok7v @@ -218,7 +220,7 @@ - + @@ -229,4 +231,4 @@ - + \ No newline at end of file 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 index 344b7d8761..f775c96db0 100644 --- 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 @@ -1,22 +1,10 @@ - + SequenceFlow_1x9usa6 - - SequenceFlow_1x9usa6 - SequenceFlow_0lc15i7 - 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"))) -} - - + SequenceFlow_1rf4vs8 @@ -29,9 +17,9 @@ if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecu SequenceFlow_00nlh7l SequenceFlow_1rf4vs8 - import org.onap.so.bpmn.common.scripts.* + +ex.processSubflowsBPMNException(execution)]]> @@ -40,9 +28,9 @@ ex.processSubflowsBPMNException(execution) SequenceFlow_0kamg53 SequenceFlow_1o7154s - import org.onap.so.bpmn.common.scripts.* + +ex.processJavaException(execution)]]> SequenceFlow_0kamg53 @@ -55,18 +43,6 @@ ex.processJavaException(execution) - - SequenceFlow_1fipbmk - SequenceFlow_01apjvo - 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) -} - @@ -76,32 +52,37 @@ if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecu - SequenceFlow_0lc15i7 + SequenceFlow_1a2sya6 SequenceFlow_1fipbmk - - + - SequenceFlow_01apjvo + SequenceFlow_1yfelf5 - + + SequenceFlow_1x9usa6 + SequenceFlow_1a2sya6 + + + + SequenceFlow_1fipbmk + SequenceFlow_1yfelf5 + + - + - - - - - + + - + @@ -141,53 +122,43 @@ if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecu - - + + - - - - + + + + - - + + - - + + - - - - - - - - - - - - + + - + @@ -196,13 +167,26 @@ if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecu - - - + + + + + + + + + + + + + + + + - + - + \ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java new file mode 100644 index 0000000000..612051f903 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2018 Bell Canada. + * + * 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. + */ +package org.onap.so.bpmn.buildingblock; + +import java.util.Map; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class HomingV2 { + + @Autowired + private OofHomingV2 oofHomingV2; + @Autowired + private SniroHomingV2 sniroHomingV2; + + private static final String HOMINGSOLUTION = "Homing_Solution"; + + public void callHoming(BuildingBlockExecution execution) { + if (isOof(execution)) { + oofHomingV2.callOof(execution); + } else { + sniroHomingV2.callSniro(execution); + } + } + + public void processSolution(BuildingBlockExecution execution, String asyncResponse) { + if (isOof(execution)) { + oofHomingV2.processSolution(execution, asyncResponse); + } else { + sniroHomingV2.processSolution(execution, asyncResponse); + } + } + + // Default solution is SNIRO. OOF gets called only if specified. + private boolean isOof(BuildingBlockExecution execution) { + for (Map params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters() + .getUserParams()) { + if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) { + return true; + } + } + return false; + } +} 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 d8a6fc2e1d..e9dcdade9f 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 @@ -163,19 +163,6 @@ public class WorkflowAction { execution.setVariable("resourceId", resourceId); execution.setVariable("resourceType", resourceType); - if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { - List> userParams = sIRequest.getRequestDetails().getRequestParameters() - .getUserParams(); - for (Map params : userParams) { - if (params.containsKey(HOMINGSOLUTION)) { - execution.setVariable("homing", true); - execution.setVariable("callHoming", true); - execution.setVariable("homingSolution", params.get(HOMINGSOLUTION)); - execution.setVariable("homingService", params.get(HOMINGSOLUTION)); - } - } - } - if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); @@ -270,9 +257,10 @@ public class WorkflowAction { logger.info("Sorting for Vlan Tagging"); flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction); } + // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE if (resourceType == WorkflowType.SERVICE - && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)) - && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) { + && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)) + && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) { execution.setVariable("homing", true); execution.setVariable("calledHoming", false); } @@ -283,6 +271,20 @@ public class WorkflowAction { } } + // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it. + if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + List> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); + for (Map params : userParams) { + if (params.containsKey(HOMINGSOLUTION)) { + if (params.get(HOMINGSOLUTION).equals("none")) { + execution.setVariable("homing", false); + } else { + execution.setVariable("homing", true); + } + } + } + } + if (flowsToExecute.isEmpty()) { throw new IllegalStateException("Macro did not come up with a valid execution path."); } -- cgit 1.2.3-korg