diff options
Diffstat (limited to 'bpmn')
24 files changed, 579 insertions, 152 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java index 6b3ad1d528..554e987fc8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -100,6 +100,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { private List<AggregateRoute> aggregateRoutes = new ArrayList<>(); @JsonProperty("vpn-binding") private List<VpnBinding> vpnBindings = new ArrayList<>(); + @JsonProperty("line-of-business") + private LineOfBusiness lineOfBusiness; + @JsonProperty("platform") + private Platform platform; public ModelInfoNetwork getModelInfoNetwork() { return modelInfoNetwork; @@ -313,6 +317,22 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { return vpnBindings; } + public LineOfBusiness getLineOfBusiness() { + return lineOfBusiness; + } + + public void setLineOfBusiness(LineOfBusiness lineOfBusiness) { + this.lineOfBusiness = lineOfBusiness; + } + + public Platform getPlatform() { + return platform; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + @Override public boolean equals(final Object other) { if (!(other instanceof L3Network)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java index 772c61e48b..1953ba410b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java @@ -24,6 +24,7 @@ import java.io.Serializable; import javax.persistence.Id; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.db.catalog.beans.OrchestrationStatus; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -41,7 +42,7 @@ public class Pnf implements Serializable, ShallowCopy<Pnf> { @JsonProperty("pnf-name") private String pnfName; - @JsonProperty("role") + @JsonProperty("nf-role") private String role; @JsonProperty("orchestration-status") @@ -50,6 +51,8 @@ public class Pnf implements Serializable, ShallowCopy<Pnf> { @JsonProperty("cloud-region") private CloudRegion cloudRegion; + @JsonProperty("model-info-pnf") + private ModelInfoPnf modelInfoPnf; public String getPnfId() { return pnfId; @@ -97,6 +100,14 @@ public class Pnf implements Serializable, ShallowCopy<Pnf> { this.cloudRegion = cloudRegion; } + public ModelInfoPnf getModelInfoPnf() { + return modelInfoPnf; + } + + public void setModelInfoPnf(ModelInfoPnf modelInfoPnf) { + this.modelInfoPnf = modelInfoPnf; + } + @Override public boolean equals(final Object other) { if (!(other instanceof Pnf)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java new file mode 100644 index 0000000000..a01fa9698b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Nokia 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.servicedecomposition.modelinfo; + +import java.io.Serializable; + +public class ModelInfoPnf extends ModelInfoMetadata implements Serializable { + private static final long serialVersionUID = 50687109134317615L; +} 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 a4793476e4..e7e51bba77 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 @@ -6,7 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ - * Modifications Copyright (c) 2019 Nokia + * Modifications Copyright (c) 2020 Nokia * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -815,13 +815,6 @@ public class BBInputSetup implements JavaDelegate { } } - private void populatePnf(Pnfs pnf, String pnfId, ServiceInstance serviceInstance) { - Pnf genericPnf = new Pnf(); - genericPnf.setPnfId(pnfId); - genericPnf.setPnfName(pnf.getInstanceName()); - serviceInstance.getPnfs().add(genericPnf); - } - protected boolean instanceGroupInList(GenericVnf vnf, String instanceGroupId) { for (InstanceGroup instanceGroup : vnf.getInstanceGroups()) { if (instanceGroup.getId() != null && instanceGroup.getId().equalsIgnoreCase(instanceGroupId)) { @@ -915,7 +908,7 @@ public class BBInputSetup implements JavaDelegate { if (network == null && (parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { network = createNetwork(parameter.getLookupKeyMap(), parameter.getInstanceName(), parameter.getResourceId(), - parameter.getInstanceParams()); + parameter.getInstanceParams(), parameter); parameter.getServiceInstance().getNetworks().add(network); } if (network != null) { @@ -924,12 +917,20 @@ public class BBInputSetup implements JavaDelegate { } protected L3Network createNetwork(Map<ResourceKey, String> lookupKeyMap, String instanceName, String networkId, - List<Map<String, String>> instanceParams) { + List<Map<String, String>> instanceParams, BBInputSetupParameter parameter) { lookupKeyMap.put(ResourceKey.NETWORK_ID, networkId); L3Network network = new L3Network(); network.setNetworkId(networkId); network.setNetworkName(instanceName); network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if (parameter != null) { + if (parameter.getLineOfBusiness() != null) { + network.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(parameter.getLineOfBusiness())); + } + if (parameter.getLineOfBusiness() != null) { + network.setPlatform(this.mapperLayer.mapRequestPlatform(parameter.getPlatform())); + } + } if (instanceParams != null) { for (Map<String, String> params : instanceParams) { network.getCloudParams().putAll(params); @@ -1284,7 +1285,7 @@ public class BBInputSetup implements JavaDelegate { if (collectionNetworkResourceCust != null) { if ((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - L3Network network = createNetwork(lookupKeyMap, null, networkId, null); + L3Network network = createNetwork(lookupKeyMap, null, networkId, null, null); serviceInstance.getNetworks().add(network); return network; } else { @@ -1495,8 +1496,8 @@ public class BBInputSetup implements JavaDelegate { } else if (bbName.contains(PNF)) { String pnfId = lookupKeyMap.get(ResourceKey.PNF); resources.getPnfs().stream() - .filter(pnf -> Objects.equals(key, pnf.getModelInfo().getModelCustomizationId())).findFirst() - .ifPresent(pnf -> this.populatePnf(pnf, pnfId, serviceInstance)); + .filter(pnfs -> Objects.equals(key, pnfs.getModelInfo().getModelCustomizationId())).findFirst() + .ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance)); } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); if (vnfsAndVfModules != null) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java new file mode 100644 index 0000000000..68161a8dd5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Nokia 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.servicedecomposition.tasks; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.serviceinstancebeans.Pnfs; + +final class BBInputSetupPnf { + + private BBInputSetupPnf() { + throw new IllegalStateException("Utility class"); + } + + static void populatePnfToServiceInstance(Pnfs pnfs, String pnfId, ServiceInstance serviceInstance) { + Pnf pnf = new Pnf(); + pnf.setPnfId(pnfId); + pnf.setPnfName(pnfs.getInstanceName()); + pnf.setModelInfoPnf(new ModelInfoPnf()); + pnf.getModelInfoPnf().setModelCustomizationUuid(pnfs.getModelInfo().getModelCustomizationId()); + pnf.getModelInfoPnf().setModelInvariantUuid(pnfs.getModelInfo().getModelInvariantId()); + pnf.getModelInfoPnf().setModelUuid(pnfs.getModelInfo().getModelVersionId()); + pnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + serviceInstance.getPnfs().add(pnf); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java new file mode 100644 index 0000000000..aa9943b9b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Nokia 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.servicedecomposition.tasks; + +import static org.junit.Assert.*; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.Pnfs; +import static org.mockito.Mockito.doReturn; + +@RunWith(MockitoJUnitRunner.class) +public class BBInputSetupPnfTest { + + @Mock + private Pnfs pnfs; + + @Mock + private ModelInfo modelInfo; + + @Test + public void populatePnfShouldSetRequiredFields() { + final String pnfId = "PNF_id1"; + final String pnfName = "PNF_name1"; + final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb031"; + final String modelInvariantId = "3360a2a5-22ff-44c7-8935-08c8e5ecbd06"; + final String modelVersionId = "b80c3a52-abd4-436c-a22e-9c5da768781a"; + + doReturn(modelCustomizationId).when(modelInfo).getModelCustomizationId(); + doReturn(modelInvariantId).when(modelInfo).getModelInvariantId(); + doReturn(modelVersionId).when(modelInfo).getModelVersionId(); + doReturn(pnfName).when(pnfs).getInstanceName(); + doReturn(modelInfo).when(pnfs).getModelInfo(); + + ServiceInstance serviceInstance = new ServiceInstance(); + BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance); + + assertEquals(1, serviceInstance.getPnfs().size()); + + Pnf pnf = serviceInstance.getPnfs().get(0); + + assertEquals(pnfId, pnf.getPnfId()); + assertEquals(pnfName, pnf.getPnfName()); + assertEquals(modelCustomizationId, pnf.getModelInfoPnf().getModelCustomizationUuid()); + assertEquals(modelInvariantId, pnf.getModelInfoPnf().getModelInvariantUuid()); + assertEquals(modelVersionId, pnf.getModelInfoPnf().getModelUuid()); + assertEquals(OrchestrationStatus.PRECREATED, pnf.getOrchestrationStatus()); + } +} 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 a45e803cf0..1acf4edb4a 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 @@ -1262,7 +1262,7 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network, modelInfo, service); instanceName = "networkName2"; - L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null); + L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null, parameter); SPY_bbInputSetup.populateL3Network(parameter); verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network2, modelInfo, service); } @@ -2832,17 +2832,32 @@ public class BBInputSetupTest { expected.setNetworkId(networkId); expected.setNetworkName(instanceName); expected.setCloudParams(cloudParams); + Platform platform = new Platform(); + platform.setPlatformName("platformName"); + expected.setPlatform(platform); + LineOfBusiness lineOfBusiness = new LineOfBusiness(); + lineOfBusiness.setLineOfBusinessName("lineOfBusiness"); + expected.setLineOfBusiness(lineOfBusiness); expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); List<Map<String, String>> instanceParams = new ArrayList<>(); instanceParams.add(cloudParams); - L3Network actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams); + org.onap.so.serviceinstancebeans.Platform platformRequest = new org.onap.so.serviceinstancebeans.Platform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusinessRequest = + new org.onap.so.serviceinstancebeans.LineOfBusiness(); + lineOfBusinessRequest.setLineOfBusinessName("lineOfBusiness"); + platformRequest.setPlatformName("platformName"); + BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID) + .setPlatform(platformRequest).setLineOfBusiness(lineOfBusinessRequest).build(); + L3Network actual = + SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams, parameter); assertThat(actual, sameBeanAs(expected)); assertEquals("LookupKeyMap is populated", networkId, lookupKeyMap.get(ResourceKey.NETWORK_ID)); expected.getCloudParams().clear(); - actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null); + + actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null, parameter); assertThat(actual, sameBeanAs(expected)); } 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 70365b744c..25f7c4b93f 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 @@ -75,9 +75,8 @@ public class WorkflowProcessor extends ProcessEngineAwareService { } } - // Note: the business key is used to identify the process in unit tests protected static String getBusinessKey(Map<String, Object> inputVariables) { - return getOrCreate(inputVariables, "mso-business-key"); + return getOrCreate(inputVariables, "mso-request-id"); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java new file mode 100644 index 0000000000..80d86ad009 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java @@ -0,0 +1,30 @@ +package org.onap.so.bpmn.core.plugins; + +import org.camunda.bpm.engine.impl.bpmn.behavior.CallableElementActivityBehavior; +import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; +import org.camunda.bpm.engine.impl.context.Context; +import org.camunda.bpm.engine.impl.core.model.CallableElement; +import org.camunda.bpm.engine.impl.el.ElValueProvider; +import org.camunda.bpm.engine.impl.el.Expression; +import org.camunda.bpm.engine.impl.el.ExpressionManager; +import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; +import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; +import org.camunda.bpm.engine.impl.util.xml.Element; +import org.springframework.stereotype.Component; + + +@Component +public class CallActivityBusinessKeyParseListener extends AbstractBpmnParseListener { + + @Override + public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) { + ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); + Expression expression = expressionManager.createExpression("#{execution.processBusinessKey}"); + ElValueProvider p = new ElValueProvider(expression); + CallableElementActivityBehavior callableElementActivityBehavior = + (CallableElementActivityBehavior) activity.getActivityBehavior(); + CallableElement callableElement = (CallableElement) callableElementActivityBehavior.getCallableElement(); + callableElement.setBusinessKeyValueProvider(p); + callableElementActivityBehavior.setCallableElement(callableElement); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java new file mode 100644 index 0000000000..a2d897e367 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java @@ -0,0 +1,24 @@ +package org.onap.so.bpmn.core.plugins; + +import java.util.ArrayList; +import java.util.List; +import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.springframework.stereotype.Component; + + +@Component +public class CallActivityBusinessKeyParseListenerPlugin extends AbstractProcessEnginePlugin { + + @Override + public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners(); + if (preParseListeners == null) { + preParseListeners = new ArrayList<>(); + processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); + } + preParseListeners.add(new CallActivityBusinessKeyParseListener()); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 93f98a34a6..0161422b64 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -1534,6 +1534,18 @@ public abstract class WorkflowTest { } } + protected Object getVariableFromHistoryByProcessInstanceId(String processInstanceId, String variableName) { + try { + HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery() + .processInstanceId(processInstanceId).variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + logger.debug("Error retrieving variable {} from historical process with processInstanceId {}: ", + variableName, processInstanceId, e); + return null; + } + } + /** * Gets a variable value from a process instance based on businessKey and process name. Must be used when multiple * instances exist with the same business key such as when business key is passed to subflows or shared across 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 7c86e964ec..c48f8b4d10 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,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.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="3.1.2" 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"> <bpmn2:outgoing>SequenceFlow_11op1ih</bpmn2:outgoing> @@ -21,7 +21,7 @@ <bpmn2:outgoing>SequenceFlow_0988gld</bpmn2:outgoing> </bpmn2:serviceTask> <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:conditionExpression xsi:type="bpmn2:tFormalExpression">#{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"> @@ -36,11 +36,11 @@ <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_1ctpnpe" sourceRef="ServiceTask_put_network_in_AAI" targetRef="ExclusiveGateway_0g85lk7" /> <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="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:incoming>SequenceFlow_0lj5jj1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0fwcvep</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:serviceTask id="ServiceTask_connect_to_CloudRegion" name=" AAI Connect (cloud region) " camunda:expression="${AAICreateTasks.connectNetworkToCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -54,11 +54,6 @@ <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_0988gld" sourceRef="ServiceTask_assign_network_aai" targetRef="AssignNetworkBB_end" /> @@ -74,11 +69,36 @@ </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_0rt36co" sourceRef="ServiceTask_assign_network_sdnc" targetRef="CallActivity_sdncHandlerCall" /> <bpmn2:sequenceFlow id="SequenceFlow_1mvf7b9" sourceRef="CallActivity_sdncHandlerCall" targetRef="ServiceTask_assign_network_aai" /> - <bpmn2:textAnnotation id="TextAnnotation_0dnksb2"> <bpmn2:text>sets Cloud Region on BB execution for SDNC assign</bpmn2:text> -</bpmn2:textAnnotation> + <bpmn2:serviceTask id="Task_0mu8391" name="Create Platform" camunda:expression="${AAICreateTasks.createPlatformForNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_1kslfgw</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0j7rpm9</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:serviceTask id="ServiceTask_0e2crgd" name="Create Lob" camunda:expression="${AAICreateTasks.createLineOfBusinessForNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_0j7rpm9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0ugp99e</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_0lj5jj1" sourceRef="ExclusiveGateway_0g85lk7" targetRef="ServiceTask_connect_to_Tenant" /> + <bpmn2:sequenceFlow id="SequenceFlow_1kslfgw" sourceRef="ExclusiveGateway_0g85lk7" targetRef="Task_0mu8391" /> + <bpmn2:sequenceFlow id="SequenceFlow_0j7rpm9" sourceRef="Task_0mu8391" targetRef="ServiceTask_0e2crgd" /> + <bpmn2:sequenceFlow id="SequenceFlow_0ugp99e" sourceRef="ServiceTask_0e2crgd" targetRef="ExclusiveGateway_0vtj8n8" /> + <bpmn2:parallelGateway id="ExclusiveGateway_0g85lk7"> + <bpmn2:incoming>SequenceFlow_1ctpnpe</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0lj5jj1</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1kslfgw</bpmn2:outgoing> + </bpmn2:parallelGateway> + <bpmn2:inclusiveGateway id="ExclusiveGateway_0vtj8n8"> + <bpmn2:incoming>SequenceFlow_017131q</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0mxc4ri</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0ugp99e</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0jm95hf</bpmn2:outgoing> + </bpmn2:inclusiveGateway> + <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" /> - <bpmn2:textAnnotation id="TextAnnotation_17jb2vn"> <bpmn2:text>conditionally executed if Network Collection Instance Group exists</bpmn2:text> -</bpmn2:textAnnotation> + <bpmn2:textAnnotation id="TextAnnotation_17jb2vn"> + <bpmn2:text>conditionally executed if Network Collection Instance Group exists</bpmn2:text> + </bpmn2:textAnnotation> <bpmn2:association id="Association_15ppe1t" sourceRef="ServiceTask_connect_to_NCIG" targetRef="TextAnnotation_17jb2vn" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -86,165 +106,190 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignNetworkBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="AssignNetworkBB_start"> - <dc:Bounds x="746" y="-105" width="36" height="36" /> + <dc:Bounds x="156" y="137" width="36" height="36" /> <bpmndi:BPMNLabel> <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="1632" y="-127" width="100" height="80" /> + <dc:Bounds x="1042" y="115" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1ofnl0p_di" bpmnElement="ServiceTask_assign_network_sdnc"> - <dc:Bounds x="1769" y="-127" width="100" height="80" /> + <dc:Bounds x="1179" y="115" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_0dnksb2_di" bpmnElement="TextAnnotation_0dnksb2"> - <dc:Bounds x="1576" y="35" width="212" height="30" /> + <dc:Bounds x="986" y="242" width="212" height="30" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1rsqd3z_di" bpmnElement="Association_1rsqd3z"> - <di:waypoint xsi:type="dc:Point" x="1682" y="-47" /> - <di:waypoint xsi:type="dc:Point" x="1682" y="35" /> + <di:waypoint x="1092" y="195" /> + <di:waypoint x="1092" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1dm3ngd_di" bpmnElement="ServiceTask_put_network_in_AAI"> - <dc:Bounds x="906" y="-49" width="100" height="80" /> + <dc:Bounds x="316" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_18yks1p_di" bpmnElement="ServiceTask_assign_network_aai"> - <dc:Bounds x="2106" y="-127" width="100" height="80" /> + <dc:Bounds x="1516" y="115" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_017131q_di" bpmnElement="SequenceFlow_017131q"> - <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" /> + <di:waypoint x="273" y="130" /> + <di:waypoint x="273" y="81" /> + <di:waypoint x="972" y="81" /> + <di:waypoint x="972" y="130" /> <bpmndi:BPMNLabel> - <dc:Bounds x="871.5" y="-151.96931534232883" width="19" height="12" /> + <dc:Bounds x="282" y="90" width="18" height="14" /> </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="-9" /> - <di:waypoint xsi:type="dc:Point" x="906" y="-9" /> + <di:waypoint x="273" y="180" /> + <di:waypoint x="273" y="233" /> + <di:waypoint x="316" y="233" /> <bpmndi:BPMNLabel> - <dc:Bounds x="872.125" y="-36.06410256410257" width="14" height="12" /> + <dc:Bounds x="282" y="206" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_083u1a5_di" bpmnElement="AssignNetworkBB_end"> - <dc:Bounds x="2241" y="-105" width="36" height="36" /> + <dc:Bounds x="1651" y="137" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="2214" y="-65" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11op1ih_di" bpmnElement="SequenceFlow_11op1ih"> - <di:waypoint xsi:type="dc:Point" x="782" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="838" y="-87" /> + <di:waypoint x="192" y="155" /> + <di:waypoint x="248" y="155" /> <bpmndi:BPMNLabel> <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="1286" y="-49" width="100" height="80" /> + <dc:Bounds x="743" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0mauyto_di" bpmnElement="ServiceTask_connect_to_NCSI"> - <dc:Bounds x="1422" y="-49" width="100" height="80" /> + <dc:Bounds x="867" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ctpnpe_di" bpmnElement="SequenceFlow_1ctpnpe"> - <di:waypoint xsi:type="dc:Point" x="1006" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1036" y="-9" /> + <di:waypoint x="416" y="232" /> + <di:waypoint x="421" y="232" /> <bpmndi:BPMNLabel> <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="1386" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1422" y="-9" /> + <di:waypoint x="843" y="233" /> + <di:waypoint x="867" y="233" /> <bpmndi:BPMNLabel> <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="1522" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1562" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1562" y="-62" /> + <di:waypoint x="917" y="193" /> + <di:waypoint x="956" y="164" /> <bpmndi:BPMNLabel> <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="1036" y="-49" width="100" height="80" /> + <dc:Bounds x="515" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1alvmym_di" bpmnElement="ServiceTask_connect_to_CloudRegion"> - <dc:Bounds x="1162" y="-49" width="100" height="80" /> + <dc:Bounds x="622" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0fwcvep_di" bpmnElement="SequenceFlow_0fwcvep"> - <di:waypoint xsi:type="dc:Point" x="1136" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1162" y="-9" /> + <di:waypoint x="565" y="193" /> + <di:waypoint x="565" y="173" /> + <di:waypoint x="672" y="173" /> + <di:waypoint x="672" y="193" /> <bpmndi:BPMNLabel> <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="1262" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1286" y="-9" /> + <di:waypoint x="722" y="233" /> + <di:waypoint x="743" y="233" /> <bpmndi:BPMNLabel> <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="1232" y="86" width="158" height="54" /> + <dc:Bounds x="777" y="288" width="158" height="54" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_15ppe1t_di" bpmnElement="Association_15ppe1t"> - <di:waypoint xsi:type="dc:Point" x="1306" y="31" /> - <di:waypoint xsi:type="dc:Point" x="1267" y="86" /> + <di:waypoint x="793" y="273" /> + <di:waypoint x="793" y="288" /> </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" /> + <dc:Bounds x="248" y="130" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1562" y="-58" width="0" height="12" /> + <dc:Bounds x="308" y="138" width="73" height="27" /> </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" /> + <di:waypoint x="997" y="155" /> + <di:waypoint x="1042" y="155" /> <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" /> + <di:waypoint x="1142" y="155" /> + <di:waypoint x="1179" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="1750.5" 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="2206" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="2241" y="-87" /> + <di:waypoint x="1616" y="155" /> + <di:waypoint x="1651" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="2178.5" y="-108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0h7upeg_di" bpmnElement="CallActivity_sdncHandlerCall"> - <dc:Bounds x="1927" y="-127" width="100" height="80" /> + <dc:Bounds x="1337" y="115" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0rt36co_di" bpmnElement="SequenceFlow_0rt36co"> - <di:waypoint xsi:type="dc:Point" x="1869" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="1927" y="-87" /> + <di:waypoint x="1279" y="155" /> + <di:waypoint x="1337" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="1898" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1mvf7b9_di" bpmnElement="SequenceFlow_1mvf7b9"> - <di:waypoint xsi:type="dc:Point" x="2027" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="2106" y="-87" /> + <di:waypoint x="1437" y="155" /> + <di:waypoint x="1516" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="2066.5" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0z9uk3m_di" bpmnElement="Task_0mu8391"> + <dc:Bounds x="471" y="305" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0e2crgd_di" bpmnElement="ServiceTask_0e2crgd"> + <dc:Bounds x="631" y="305" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0lj5jj1_di" bpmnElement="SequenceFlow_0lj5jj1"> + <di:waypoint x="471" y="232" /> + <di:waypoint x="515" y="233" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1kslfgw_di" bpmnElement="SequenceFlow_1kslfgw"> + <di:waypoint x="446" y="257" /> + <di:waypoint x="446" y="345" /> + <di:waypoint x="471" y="345" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0j7rpm9_di" bpmnElement="SequenceFlow_0j7rpm9"> + <di:waypoint x="571" y="343" /> + <di:waypoint x="631" y="341" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ugp99e_di" bpmnElement="SequenceFlow_0ugp99e"> + <di:waypoint x="731" y="345" /> + <di:waypoint x="972" y="345" /> + <di:waypoint x="972" y="180" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ParallelGateway_02lmom2_di" bpmnElement="ExclusiveGateway_0g85lk7"> + <dc:Bounds x="421" y="207" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_1cof7a3_di" bpmnElement="ExclusiveGateway_0vtj8n8"> + <dc:Bounds x="947" y="130" width="50" height="50" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> 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 index c223d3ff11..de6b75bd03 100644 --- 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 @@ -28,9 +28,9 @@ import org.springframework.stereotype.Component; @Component public class HomingV2 { - static final String HOMING_SNIRO = "sniro"; - static final String HOMING_OOF = "oof"; - static final String HOMING_SOLUTION = "Homing_Solution"; + public static final String HOMING_SNIRO = "sniro"; + public static final String HOMING_OOF = "oof"; + public static final String HOMING_SOLUTION = "Homing_Solution"; private SniroHomingV2 sniroHomingV2; private OofHomingV2 oofHomingV2; @@ -59,6 +59,6 @@ public class HomingV2 { private boolean isSniro(BuildingBlockExecution execution) { return execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams().stream() - .anyMatch(params -> HOMING_SNIRO.equals(params.get(HOMING_SOLUTION))); + .anyMatch(params -> HomingV2.HOMING_SNIRO.equals(params.get(HomingV2.HOMING_SOLUTION))); } } 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 22089dae1f..dab5102efd 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 @@ -31,8 +31,6 @@ import java.util.TreeSet; import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.onap.so.client.orchestration.AAIPnfResources; -import org.onap.so.logger.LoggingAnchor; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -62,12 +60,14 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIInstanceGroupResources; import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.AAIPnfResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.client.orchestration.AAIVpnBindingResources; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -274,18 +274,28 @@ public class AAICreateTasks { * @param str * @throws @return */ + public void createPlatformForNetwork(BuildingBlockExecution execution) { + try { + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + if (network != null) { + createPlatformNetwork(network); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * This method is used for separating (,) from the string. + * + * @param str + * @throws @return + */ public void createPlatform(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - Platform platform = vnf.getPlatform(); - if (platform != null) { - if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) { - logger.debug("PlatformName is null in input. Skipping create platform..."); - } else { - List<String> platforms = splitCDL(platform.getPlatformName()); - platforms.stream().forEach(platformName -> aaiVnfResources - .createPlatformandConnectVnf(new Platform(platformName), vnf)); - } + if (vnf != null) { + createPlatformVnf(vnf); } } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -293,6 +303,30 @@ public class AAICreateTasks { } + protected void createPlatformVnf(GenericVnf vnf) { + Platform platform = vnf.getPlatform(); + if (Strings.isNullOrEmpty(platform.getPlatformName())) { + logger.debug("PlatformName is null in input. Skipping create platform..."); + } else { + List<String> platforms = splitCDL(platform.getPlatformName()); + platforms.stream().forEach( + platformName -> aaiVnfResources.createPlatformandConnectVnf(new Platform(platformName), vnf)); + } + } + + protected void createPlatformNetwork(L3Network network) { + Platform platform = network.getPlatform(); + if (platform != null) { + if (Strings.isNullOrEmpty(platform.getPlatformName())) { + logger.debug("PlatformName is null in input. Skipping create platform..."); + } else { + List<String> platforms = splitCDL(platform.getPlatformName()); + platforms.stream().forEach( + platformName -> aaiNetworkResources.createPlatformAndConnectNetwork(platform, network)); + } + } + } + /** * This method is used for separating (,) from the string. * @@ -312,22 +346,51 @@ public class AAICreateTasks { public void createLineOfBusiness(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness(); - if (lineOfBusiness != null) { - if (lineOfBusiness.getLineOfBusinessName() == null - || "".equals(lineOfBusiness.getLineOfBusinessName())) { - logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); - } else { - List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName()); - lineOfBussinesses.stream().forEach(lobName -> aaiVnfResources - .createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName), vnf)); - } + if (vnf != null) { + createLineOfBusinessVnf(vnf); } } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + public void createLineOfBusinessForNetwork(BuildingBlockExecution execution) { + try { + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + if (network != null) { + createLineOfBusinessNetwork(network); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + protected void createLineOfBusinessVnf(GenericVnf vnf) { + LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness(); + if (lineOfBusiness != null) { + if (Strings.isNullOrEmpty(lineOfBusiness.getLineOfBusinessName())) { + logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); + } else { + List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName()); + lineOfBussinesses.stream().forEach( + lobName -> aaiVnfResources.createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName), vnf)); + } + } + } + + protected void createLineOfBusinessNetwork(L3Network network) { + LineOfBusiness lineOfBusiness = network.getLineOfBusiness(); + if (lineOfBusiness != null) { + if (Strings.isNullOrEmpty(lineOfBusiness.getLineOfBusinessName())) { + logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); + } else { + List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName()); + lineOfBussinesses.stream().forEach(lobName -> aaiNetworkResources + .createLineOfBusinessAndConnectNetwork(new LineOfBusiness(lobName), network)); + } + } + } + /** * This method is used for creating the volume group in A&AI. * 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 index 533dd89276..4522f7f2e7 100644 --- 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 @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.activity; +import java.io.IOException; import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -89,8 +90,8 @@ public class ExecuteActivity implements JavaDelegate { @Override public void execute(DelegateExecution execution) throws Exception { final String requestId = (String) execution.getVariable(G_REQUEST_ID); - WorkflowException workflowException = null; - String handlingCode = null; + WorkflowException workflowException; + String handlingCode; try { Boolean workflowSyncAckSent = (Boolean) execution.getVariable(WORKFLOW_SYNC_ACK_SENT); if (workflowSyncAckSent == null || workflowSyncAckSent == false) { @@ -114,7 +115,7 @@ public class ExecuteActivity implements JavaDelegate { if (execution.getVariables() != null) { execution.getVariables().forEach((key, value) -> { if (value instanceof Serializable) { - variables.put(key, (Serializable) value); + variables.put(key, value); } }); } @@ -153,25 +154,22 @@ public class ExecuteActivity implements JavaDelegate { } protected BuildingBlock buildBuildingBlock(String activityName) { - BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(activityName) - .setMsoId(UUID.randomUUID().toString()).setKey("").setIsVirtualLink(false).setVirtualLinkKey(""); - return buildingBlock; + return new BuildingBlock().setBpmnFlowName(activityName).setMsoId(UUID.randomUUID().toString()).setKey("") + .setIsVirtualLink(false).setVirtualLinkKey(""); } protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId, - BuildingBlock buildingBlock) throws Exception { + BuildingBlock buildingBlock) throws IOException { WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID)); workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID)); String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST); ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); RequestDetails requestDetails = sIRequest.getRequestDetails(); - ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setaLaCarte(true) - .setRequestAction((String) execution.getVariable(G_ACTION)) + return new ExecuteBuildingBlock().setaLaCarte(true).setRequestAction((String) execution.getVariable(G_ACTION)) .setResourceId((String) execution.getVariable(VNF_ID)) .setVnfType((String) execution.getVariable(VNF_TYPE)).setWorkflowResourceIds(workflowResourceIds) .setRequestId(requestId).setBuildingBlock(buildingBlock).setRequestDetails(requestDetails); - return executeBuildingBlock; } protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java index 164480d7c7..ff0f9e76a3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -46,17 +48,16 @@ public class AssignNetwork { * @return */ public boolean networkFoundByName(BuildingBlockExecution execution) { - boolean networkFound = false; try { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())) { - networkFound = true; logger.debug("network found in NOT PRECREATED status"); + return true; } } catch (Exception ex) { - // return false if no network present + return false; } - return networkFound; + return false; } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java index 36eab8f981..5e925bf9c6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -29,8 +31,6 @@ 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.AAINetworkResources; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java index ea0b408e41..ccbce2de6a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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,25 +22,16 @@ package org.onap.so.bpmn.infrastructure.namingservice.tasks; -import java.util.List; -import java.util.Optional; -import org.onap.aai.domain.yang.Zone; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.InjectionHelper; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; -import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.namingservice.NamingRequestObject; import org.onap.so.client.namingservice.NamingServiceConstants; @@ -65,7 +58,7 @@ public class NamingServiceCreateTasks { this.bbInputSetupUtils = bbInputSetupUtils; } - public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception { + public void createInstanceGroupName(BuildingBlockExecution execution) throws BBObjectNotFoundException { InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); String policyInstanceName = execution.getVariable("policyInstanceName"); String nfNamingCode = execution.getVariable("nfNamingCode"); @@ -79,7 +72,7 @@ public class NamingServiceCreateTasks { instanceGroup.setInstanceGroupName(generatedInstanceGroupName); } - public void createWanTransportServiceName(BuildingBlockExecution execution) throws Exception { + public void createWanTransportServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); NamingRequestObject namingRequestObject = new NamingRequestObject(); namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId()); @@ -98,7 +91,7 @@ public class NamingServiceCreateTasks { serviceInstance.setServiceInstanceName(generatedWanTransportServiceName); } - public void createVpnBondingServiceName(BuildingBlockExecution execution) throws Exception { + public void createVpnBondingServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); VpnBinding vpnBinding = extractPojosForBB.extractByKey(execution, ResourceKey.VPN_ID); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java index 507e14e42a..8d14bd3e89 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -26,6 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; 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.namingservice.NamingRequestObject; import org.onap.so.client.orchestration.NamingServiceResources; @@ -43,7 +46,7 @@ public class NamingServiceDeleteTasks { @Autowired private NamingServiceResources namingServiceResources; - public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception { + public void deleteInstanceGroupName(BuildingBlockExecution execution) throws BBObjectNotFoundException { InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); try { @@ -53,7 +56,7 @@ public class NamingServiceDeleteTasks { } } - public void deleteServiceInstanceName(BuildingBlockExecution execution) throws Exception { + public void deleteServiceInstanceName(BuildingBlockExecution execution) throws BBObjectNotFoundException { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); NamingRequestObject namingRequestObject = new NamingRequestObject(); namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 192cb3fc90..89d62e0752 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -64,7 +66,7 @@ public class SDNCQueryTasks { * @param execution * @throws Exception */ - public void queryVnf(BuildingBlockExecution execution) throws Exception { + public void queryVnf(BuildingBlockExecution execution) throws BBObjectNotFoundException { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -99,7 +101,7 @@ public class SDNCQueryTasks { * @param execution * @throws Exception */ - public void queryVfModule(BuildingBlockExecution execution) throws Exception { + public void queryVfModule(BuildingBlockExecution execution) throws BBObjectNotFoundException { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); 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 11a7b83259..cf56964af3 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 @@ -90,6 +90,17 @@ public class AAIObjectMapper { } public org.onap.aai.domain.yang.Pnf mapPnf(Pnf pnf) { + if (modelMapper.getTypeMap(Pnf.class, org.onap.aai.domain.yang.Pnf.class) == null) { + modelMapper.addMappings(new PropertyMap<Pnf, org.onap.aai.domain.yang.Pnf>() { + @Override + protected void configure() { + map().setModelCustomizationId(source.getModelInfoPnf().getModelCustomizationUuid()); + map().setModelInvariantId(source.getModelInfoPnf().getModelInvariantUuid()); + map().setModelVersionId(source.getModelInfoPnf().getModelUuid()); + } + }); + } + return modelMapper.map(pnf, org.onap.aai.domain.yang.Pnf.class); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index bc702c9fb4..3af65815a6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -30,6 +30,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.client.aai.AAIObjectPlurals; @@ -38,8 +40,8 @@ import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -76,6 +78,22 @@ public class AAINetworkResources { serviceInstanceURI); } + public void createLineOfBusinessAndConnectNetwork(LineOfBusiness lineOfBusiness, L3Network network) { + AAIResourceUri lineOfBusinessURI = + AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName()); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)) + .connect(networkURI, lineOfBusinessURI); + } + + public void createPlatformAndConnectNetwork(Platform platform, L3Network network) { + AAIResourceUri platformURI = + AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName()); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(networkURI, + platformURI); + } + public void deleteNetwork(L3Network network) { AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); injectionHelper.getAaiClient().delete(networkURI); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java index 2ec63182a0..35e08563d1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -32,10 +34,9 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl; import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.io.IOException; @Component public class VnfAdapterVolumeGroupResources { @@ -48,13 +49,13 @@ public class VnfAdapterVolumeGroupResources { public CreateVolumeGroupRequest createVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, - VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws Exception { + VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws IOException { return vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); } public DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion, - ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception { + ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws IOException { return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java index 821e70a8c8..dc64e4ee48 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -41,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; @@ -55,6 +58,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -233,6 +237,34 @@ public class AAIObjectMapperTest { } @Test + public void pnfMap() { + final String pnfId = "PNF_id1"; + final String pnfName = "PNF_name1"; + final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb03e"; + final String modelInvariantId = "341a6f84-2cf9-4942-8f9e-2472ffe4e1d8"; + final String modelVersionId = "b13a0706-46b9-4a98-a9f9-5b28431235e7"; + final OrchestrationStatus orchestrationStatus = OrchestrationStatus.PRECREATED; + + Pnf pnf = new Pnf(); + pnf.setPnfId(pnfId); + pnf.setPnfName(pnfName); + pnf.setModelInfoPnf(new ModelInfoPnf()); + pnf.getModelInfoPnf().setModelCustomizationUuid(modelCustomizationId); + pnf.getModelInfoPnf().setModelInvariantUuid(modelInvariantId); + pnf.getModelInfoPnf().setModelUuid(modelVersionId); + pnf.setOrchestrationStatus(orchestrationStatus); + + org.onap.aai.domain.yang.Pnf aaiPnf = aaiObjectMapper.mapPnf(pnf); + + assertEquals(aaiPnf.getPnfId(), pnfId); + assertEquals(aaiPnf.getPnfName(), pnfName); + assertEquals(aaiPnf.getModelCustomizationId(), modelCustomizationId); + assertEquals(aaiPnf.getModelInvariantId(), modelInvariantId); + assertEquals(aaiPnf.getModelVersionId(), modelVersionId); + assertEquals(aaiPnf.getOrchestrationStatus(), orchestrationStatus.toString()); + } + + @Test public void vfModuleMap() throws Exception { VfModule vfModule = new VfModule(); vfModule.setVfModuleId("a"); |