diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
10 files changed, 158 insertions, 110 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index e534142471..887c51e179 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -24,6 +24,7 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; @@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; @@ -74,6 +76,8 @@ public class AAICreateTasks { private AAINetworkResources aaiNetworkResources; @Autowired private AAIVpnBindingResources aaiVpnBindingResources; + @Autowired + private AAIConfigurationResources aaiConfigurationResources; public void createServiceInstance(BuildingBlockExecution execution) { try { @@ -376,4 +380,13 @@ public class AAICreateTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + + public void createConfiguration(BuildingBlockExecution execution){ + try{ + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + aaiConfigurationResources.createConfiguration(configuration); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index cb265b6e41..a00806a19c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -31,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; @@ -56,6 +58,8 @@ public class AAIDeleteTasks { private AAINetworkResources aaiNetworkResources; @Autowired private AAIVolumeGroupResources aaiVolumeGroupResources; + @Autowired + private AAIConfigurationResources aaiConfigurationResources; public void deleteVfModule(BuildingBlockExecution execution) throws Exception { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); @@ -133,4 +137,12 @@ public class AAIDeleteTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + public void deleteConfiguration(BuildingBlockExecution execution) { + try { + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + aaiConfigurationResources.deleteConfiguration(configuration); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index b059a77641..58c51f6223 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -24,6 +24,7 @@ import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -35,6 +36,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAICollectionResources; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; @@ -64,6 +66,8 @@ public class AAIUpdateTasks { private AAINetworkResources aaiNetworkResources; @Autowired private AAICollectionResources aaiCollectionResources; + @Autowired + private AAIConfigurationResources aaiConfigurationResources; public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) { try { @@ -394,4 +398,21 @@ public class AAIUpdateTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) { + try { + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) { + try { + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } }
\ No newline at end of file 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 b2b071e1ee..57d097e87a 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 @@ -27,6 +27,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -36,21 +37,26 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; 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.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; -import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; +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; @@ -103,6 +109,8 @@ public class WorkflowAction { private ExceptionBuilder exceptionBuilder; @Autowired private CatalogDbClient catalogDbClient; + @Autowired + private AAIConfigurationResources aaiConfigurationResources; public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { this.bbInputSetupUtils = bbInputSetupUtils; @@ -125,7 +133,6 @@ public class WorkflowAction { WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>(); List<Resource> resourceCounter = new ArrayList<>(); - execution.setVariable("sentSyncResponse", false); execution.setVariable("homing", false); execution.setVariable("calledHoming", false); @@ -212,7 +219,8 @@ public class WorkflowAction { } else if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase("activateInstance") || requestAction.equalsIgnoreCase("unassignInstance") - || requestAction.equalsIgnoreCase("deleteInstance"))) { + || requestAction.equalsIgnoreCase("deleteInstance") + || requestAction.equalsIgnoreCase("activateFabricConfiguration"))) { // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and // SERVICE-MACRO-DELETE // Will never get user params with service, macro will have @@ -230,7 +238,7 @@ public class WorkflowAction { foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " "; } msoLogger.info("Found " + foundObjects); - + if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); } @@ -267,7 +275,6 @@ public class WorkflowAction { execution.setVariable("flowsToExecute", flowsToExecute); } catch (Exception ex) { - msoLogger.error(ex); buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex); } } @@ -278,7 +285,7 @@ public class WorkflowAction { if(resource.isBaseVfModule()){ Collections.swap(vfModuleResources, 0, count); break; - } + } count++; } return vfModuleResources; @@ -294,7 +301,7 @@ public class WorkflowAction { List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); for(int i = 0; i < resources.size(); i++){ updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null); - } + } }); } @@ -317,7 +324,7 @@ public class WorkflowAction { .collect(Collectors.toList()).get(i); updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); } }); - } + } protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){ String resourceId = id; @@ -337,6 +344,8 @@ public class WorkflowAction { workflowResourceIds.setNetworkId(resourceId); }else if(resource == WorkflowType.NETWORKCOLLECTION){ workflowResourceIds.setNetworkCollectionId(resourceId); + }else if(resource == WorkflowType.CONFIGURATION){ + workflowResourceIds.setConfigurationId(resourceId); } ebb.setWorkflowResourceIds(workflowResourceIds); } @@ -389,7 +398,7 @@ public class WorkflowAction { String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType(); if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) { int minNetworks = 0; - InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup(); + org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup(); CollectionResourceInstanceGroupCustomization collectionInstCust = null; if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) { for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) { @@ -418,14 +427,14 @@ public class WorkflowAction { } } } else { - msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType); + msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType); + } + }else{ + msoLogger.debug("No Instance Group found for network collection."); } }else{ - msoLogger.debug("No Instance Group found for network collection."); + msoLogger.debug("No Network Collection found. collectionResource is null"); } - }else{ - msoLogger.debug("No Network Collection found. collectionResource is null"); - } } else { msoLogger.debug("No Network Collection Customization found"); } @@ -484,6 +493,20 @@ public class WorkflowAction { aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId())); resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false)); } + if (serviceInstanceMSO.getConfigurations() !=null) { + for(Configuration config : serviceInstanceMSO.getConfigurations()){ + Optional<org.onap.aai.domain.yang.Configuration> aaiConfig = aaiConfigurationResources.getConfiguration(config.getConfigurationId()); + if(aaiConfig.isPresent() && aaiConfig.get().getRelationshipList()!=null){ + for(Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()){ + if(relationship.getRelatedTo().contains("vnfc")){ + aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.getConfigurationId())); + resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config.getConfigurationId(),false)); + break; + } + } + } + } + } } catch (Exception ex) { buildAndThrowException(execution, "Could not find existing Service Instance or related Instances to execute the request on."); @@ -495,6 +518,8 @@ public class WorkflowAction { throws IOException { boolean foundRelated = false; boolean foundVfModuleOrVG = false; + String vnfCustomizationUUID = ""; + String vfModuleCustomizationUUID = ""; if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); for (Map<String, Object> params : userParams) { @@ -507,18 +532,23 @@ public class WorkflowAction { for (Vnfs vnf : validate.getResources().getVnfs()) { resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getModelInfo().getModelCustomizationId(),false)); foundRelated = true; + if(vnf.getModelInfo()!=null && vnf.getModelInfo().getModelCustomizationUuid()!=null){ + vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid(); + } if (vnf.getVfModules() != null) { for (VfModules vfModule : vnf.getVfModules()) { VfModuleCustomization vfModuleCustomization = catalogDbClient .getVfModuleCustomizationByModelCuztomizationUUID( vfModule.getModelInfo().getModelCustomizationUuid()); if (vfModuleCustomization != null) { - if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate()!=null &&vfModuleCustomization.getVolumeHeatEnv() != null) { + + if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null && vfModuleCustomization.getVolumeHeatEnv() != null) { resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,vfModuleCustomization.getModelCustomizationUUID(),false)); foundRelated = true; foundVfModuleOrVG = true; } - if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getModuleHeatTemplate()!=null && vfModuleCustomization.getHeatEnvironment()!=null){ + + if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null && vfModuleCustomization.getHeatEnvironment() != null){ foundRelated = true; foundVfModuleOrVG = true; Resource resource = new Resource(WorkflowType.VFMODULE,vfModuleCustomization.getModelCustomizationUUID(),false); @@ -528,6 +558,15 @@ public class WorkflowAction { resource.setBaseVfModule(false); } resourceCounter.add(resource); + if(vfModule.getModelInfo()!=null && vfModule.getModelInfo().getModelCustomizationUuid()!=null){ + vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid(); + } + if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){ + List<String> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID); + for(String config : configs){ + resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config,false)); + } + } } if(!foundVfModuleOrVG){ buildAndThrowException(execution, "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null"); @@ -556,6 +595,25 @@ public class WorkflowAction { } return foundRelated; } + + + private List<String> traverseCatalogDbForConfiguration(String vnfCustomizationUUID, String vfModuleCustomizationUUID) { + List<String> configurations = new ArrayList<>(); + try{ + List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID); + for(CvnfcCustomization cvnfc : cvnfcCustomizations){ + for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfc.getVnfVfmoduleCvnfcConfigurationCustomization()){ + if(customization.getConfigurationResource().getToscaNodeType().contains("FabricConfiguration")){ + configurations.add(customization.getConfigurationResource().getModelUUID()); + } + } + } + msoLogger.debug("found " + configurations.size() + " configurations"); + return configurations; + } catch (Exception ex){ + return configurations; + } + } protected String queryCatalogDBforNetworkCollection(DelegateExecution execution, ServiceInstancesRequest sIRequest) { org.onap.so.db.catalog.beans.Service service = catalogDbClient @@ -664,7 +722,6 @@ public class WorkflowAction { } return generatedResourceId; } catch (Exception ex) { - msoLogger.error(ex); throw new IllegalStateException( "WorkflowAction was unable to verify if the instance name already exist in AAI."); } @@ -810,7 +867,7 @@ public class WorkflowAction { .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } - } else { + }else { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } @@ -852,24 +909,24 @@ public class WorkflowAction { buildAndThrowException(execution,"The request: Macro " + resourceName + " " + requestAction + " is not supported by GR_API."); } } else { - if(northBoundRequest.getIsToplevelflow()!=null){ - execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow()); - } - List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList(); - if (flows == null) - flows = new ArrayList<>(); - for (OrchestrationFlow flow : flows) { - if (!flow.getFlowName().contains("BB")) { - List<OrchestrationFlow> macroQueryFlows = catalogDbClient - .getOrchestrationFlowByAction(flow.getFlowName()); - for (OrchestrationFlow macroFlow : macroQueryFlows) { - listToExecute.add(macroFlow); - } - } else { - listToExecute.add(flow); + if(northBoundRequest.getIsToplevelflow()!=null){ + execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow()); + } + List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList(); + if (flows == null) + flows = new ArrayList<>(); + for (OrchestrationFlow flow : flows) { + if (!flow.getFlowName().contains("BB")) { + List<OrchestrationFlow> macroQueryFlows = catalogDbClient + .getOrchestrationFlowByAction(flow.getFlowName()); + for (OrchestrationFlow macroFlow : macroQueryFlows) { + listToExecute.add(macroFlow); } + } else { + listToExecute.add(flow); } } + } return listToExecute; } 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 101a355c2f..ab29e21dea 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,9 +30,10 @@ 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.db.request.RequestsDbClient; + 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; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java index be19f25cca..4a1c3f512c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java @@ -7,15 +7,14 @@ * 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. - * Modifications Copyright (C) 2018 IBM * ============LICENSE_END========================================================= */ diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index b84f8b6459..e9dc3742f5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -157,6 +157,15 @@ public class AAIConfigurationResources { AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); injectionHelper.getAaiClient().delete(aaiResourceUri); } + /** + * method to delete Configuration details in A&AI + * + * @param configuration + */ + public void deleteConfiguration(Configuration configuration) { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + injectionHelper.getAaiClient().delete(aaiResourceUri); + } /** * Get Configuration from AAI using related Link @@ -167,4 +176,11 @@ public class AAIConfigurationResources { return injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build())); } + + public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + configuration.setOrchestrationStatus(orchestrationStatus); + org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); + injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java deleted file mode 100644 index 50137cf985..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java +++ /dev/null @@ -1,72 +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.client.sdnc; - -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.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; - -//TODO move to common location -public class BaseClient<I,O> { - - private HttpHeaders httpHeader; - private String targetUrl; - - public HttpHeaders getHttpHeader() { - return httpHeader; - } - - public void setHttpHeader(HttpHeaders httpHeader) { - this.httpHeader = httpHeader; - } - - public String getTargetUrl() { - return targetUrl; - } - - public void setTargetUrl(String targetUrl) { - this.targetUrl = targetUrl; - } - - public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.GET, typeRef, uriVariables); - } - - 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())); - ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, - uriVariables); - return responseEntity.getBody(); - } - -}
\ No newline at end of file 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 9e60196426..0061f50ba8 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 @@ -24,6 +24,7 @@ import java.util.LinkedHashMap; import javax.ws.rs.core.UriBuilder; +import org.onap.so.bpmn.common.baseclient.BaseClient; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCProperties; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java index cee94e28bd..eb12278528 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java @@ -23,9 +23,9 @@ package org.onap.so.client.sniro; import java.util.LinkedHashMap; 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.sdnc.BaseClient; import org.onap.so.client.sniro.beans.ManagerProperties; import org.onap.so.client.sniro.beans.SniroConductorRequest; import org.onap.so.client.sniro.beans.SniroManagerRequest; |