diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
9 files changed, 78 insertions, 19 deletions
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 7bc48519b0..0190f3df56 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 @@ -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. @@ -29,6 +29,7 @@ import java.util.UUID; import org.apache.commons.lang.SerializationUtils; import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; import org.json.JSONArray; import org.json.JSONObject; import org.onap.so.bpmn.common.BuildingBlockExecution; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java index bf429ee4fc..534e93637a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java @@ -29,6 +29,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIInstanceGroupResources; import org.springframework.beans.factory.annotation.Autowired; @@ -55,10 +56,10 @@ public class AssignVnf { if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { instanceGroup.setInstanceGroupName(aaiObjectInstanceNameGenerator.generateInstanceGroupName(instanceGroup, vnf)); aaiInstanceGroupResources.createInstanceGroup(instanceGroup); - aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf); + aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO); } else if(ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { - aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf); + aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.USES); } } } 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 e7d09f83e0..724dea6cf5 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 @@ -104,6 +104,7 @@ public class WorkflowAction { private static final String USERPARAMSERVICE = "service"; private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances"; private static final String HOMINGSOLUTION = "Homing_Solution"; + private static final String FABRIC_CONFIGURATION = "FabricConfiguration"; private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class); @Autowired @@ -177,6 +178,7 @@ public class WorkflowAction { if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); } + orchFlows = filterOrchFlows(orchFlows, resourceType, execution); String key = ""; ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo(); if(modelInfo.getModelType().equals(ModelType.service)) { @@ -238,7 +240,7 @@ public class WorkflowAction { && (requestAction.equalsIgnoreCase("activateInstance") || requestAction.equalsIgnoreCase("unassignInstance") || requestAction.equalsIgnoreCase("deleteInstance") - || requestAction.equalsIgnoreCase("activateFabricConfiguration"))) { + || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) { // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and // SERVICE-MACRO-DELETE // Will never get user params with service, macro will have @@ -619,13 +621,13 @@ public class WorkflowAction { } - private List<String> traverseCatalogDbForConfiguration(String vnfCustomizationUUID, String vfModuleCustomizationUUID) { + protected 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")){ + if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){ configurations.add(customization.getConfigurationResource().getModelUUID()); } } @@ -964,6 +966,17 @@ public class WorkflowAction { } return listToExecute; } + + protected List<OrchestrationFlow> filterOrchFlows(List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) { + List<OrchestrationFlow> result = new ArrayList<>(orchFlows); + if (resourceType.equals(WorkflowType.VFMODULE)) { + List<String> fabricCustomizations = traverseCatalogDbForConfiguration((String)execution.getVariable("vnfId"), (String)execution.getVariable("vfModuleId")); + if (fabricCustomizations.isEmpty()) { + result = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList()); + } + } + return result; + } protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { logger.error(msg, ex); 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 2b58b7bdd7..81c2107328 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 @@ -23,15 +23,18 @@ package org.onap.so.client.adapter.vnf.mapper; import static java.util.Arrays.asList; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Map.Entry; 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; @@ -303,6 +306,9 @@ public class VnfAdapterVfModuleObjectMapper { buildVfModuleSriovParameters(paramsMap, network, networkKey); // IPV4 and IPV6 Addresses buildVfModuleNetworkInformation(paramsMap, network, key, networkKey); + + buildVlanInformation(paramsMap, network, key, networkKey); + } } } @@ -315,6 +321,36 @@ public class VnfAdapterVfModuleObjectMapper { } } + protected void buildVlanInformation(Map<String, String> paramsMap, + GenericResourceApiVmNetworkData network, String key, String networkKey) { + + String networkString = convertToString(network); + String vlanFilterKey = key + UNDERSCORE + networkKey + UNDERSCORE + "vlan_filter"; + String privateVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "private_vlans"; + String publicVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "public_vlans"; + String guestVlansKey = key + UNDERSCORE + networkKey + UNDERSCORE + "guest_vlans"; + + if (network.getSegmentationId() != null) { + paramsMap.put(vlanFilterKey, network.getSegmentationId()); + } + + List<String> privateVlans = jsonPath.locateResultList(networkString, "$.related-networks.related-network[?(@.vlan-tags.is-private == true)].vlan-tags.upper-tag-id"); + List<String> publicVlans = jsonPath.locateResultList(networkString, "$.related-networks.related-network[?(@.vlan-tags.is-private == false)].vlan-tags.upper-tag-id"); + List<String> concat = new ArrayList<>(privateVlans); + concat.addAll(publicVlans); + Collection<String> guestVlans = new HashSet<>(concat); + + if (!privateVlans.isEmpty()) { + paramsMap.put(privateVlansKey, Joiner.on(",").join(privateVlans)); + } + if (!publicVlans.isEmpty()) { + paramsMap.put(publicVlansKey, Joiner.on(",").join(publicVlans)); + } + if (!guestVlans.isEmpty()) { + paramsMap.put(guestVlansKey, Joiner.on(",").join(guestVlans)); + } + } + private void buildVfModuleVmNames(Map<String,String> paramsMap, GenericResourceApiVmTopologyData vm, String key) { String values = ""; GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java index 4c4edb7fe9..68f6e8ffa2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java @@ -26,6 +26,7 @@ import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; @@ -57,6 +58,12 @@ public class AAIInstanceGroupResources { injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI); } + public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) { + AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()); + injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel); + } + public boolean exists(InstanceGroup instanceGroup) { AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()); return injectionHelper.getAaiClient().exists(instanceGroupUri); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java index b5738dcb40..86dd22b65c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java @@ -107,7 +107,7 @@ public class AAIServiceInstanceResources { } public boolean existsOwningEntityName(String owningEntityName) { - AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITIES).queryParam("owning-entity-name", owningEntityName); + AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY).queryParam("owning-entity-name", owningEntityName); AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); return aaiRC.exists(owningEntityUri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java index 8bd55f0f90..092af30558 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.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. @@ -28,6 +28,7 @@ import org.onap.aai.domain.yang.VpnBindings; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; @@ -39,10 +40,10 @@ import org.springframework.stereotype.Component; public class AAIVpnBindingResources { @Autowired private InjectionHelper injectionHelper; - + @Autowired private AAIObjectMapper aaiObjectMapper; - + /** * @param customer */ @@ -56,10 +57,10 @@ public class AAIVpnBindingResources { * @return */ public Optional<VpnBindings> getVpnBindingByCustomerVpnId (String customerVpnId) { - AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDINGS) + AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING) .queryParam("customer-vpn-id",customerVpnId); - return injectionHelper.getAaiClient().get(VpnBindings.class,aaiVpnBindingsResourceUri); - + return injectionHelper.getAaiClient().get(VpnBindings.class,aaiVpnBindingsResourceUri); + } /** 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 432399b1b8..3975b25356 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 @@ -86,8 +86,8 @@ public class GeneralTopologyObjectMapper { networkInformation.setFromPreload(null); networkInformation.setNetworkId(network.getNetworkId()); - //TODO fix this after network type filed included in L3Network object type - //networkInformation.setNetworkType(network.getNetwork); + networkInformation.setNetworkType(network.getNetworkType()); + networkInformation.setNetworkTechnology(network.getNetworkTechnology()); return networkInformation; } /* diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java index 8944d1eaa4..1355151919 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -71,7 +71,7 @@ public class VnfTopologyOperationRequestMapper { vnfRequestInput.setTenant(cloudRegion.getTenantId()); vnfRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId()); - + if (StringUtils.isNotBlank(vnf.getVnfName())) { vnfRequestInput.setVnfName(vnf.getVnfName()); } |