summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-12-20 16:07:31 +0000
committerGerrit Code Review <gerrit@onap.org>2019-12-20 16:07:31 +0000
commit91116f3bd34da7d7b7d125b993dcea959ceb9375 (patch)
tree3e6eafa656374118bb3971166f6fa549b9be321b /bpmn
parent6a407a9d3c3b6b2e02c1dcfa6219df31ecece013 (diff)
parent481350fb01fdc5375dc10479990e07bd7921a241 (diff)
Merge "Add pnfs resources handling in service macro create"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java21
6 files changed, 55 insertions, 32 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
index 8608fee244..30a6e1fe35 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 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
@@ -31,5 +33,6 @@ public enum ResourceKey {
NETWORK_COLLECTION_ID,
VPN_ID,
VPN_BONDING_LINK_ID,
- INSTANCE_GROUP_ID;
+ INSTANCE_GROUP_ID,
+ PNF
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
index dc07d13acb..e8be2734cc 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 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
@@ -30,6 +32,7 @@ public class WorkflowResourceIds implements Serializable {
*/
private static final long serialVersionUID = 8591599114353940105L;
private String serviceInstanceId;
+ private String pnfId;
private String vnfId;
private String networkId;
private String volumeGroupId;
@@ -40,10 +43,10 @@ public class WorkflowResourceIds implements Serializable {
@Override
public String toString() {
- return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("vnfId", vnfId)
- .append("networkId", networkId).append("volumeGroupId", volumeGroupId).append("vfModuleId", vfModuleId)
- .append("networkCollectionId", networkCollectionId).append("configurationId", configurationId)
- .toString();
+ return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("pnfId", pnfId)
+ .append("vnfId", vnfId).append("networkId", networkId).append("volumeGroupId", volumeGroupId)
+ .append("vfModuleId", vfModuleId).append("networkCollectionId", networkCollectionId)
+ .append("configurationId", configurationId).toString();
}
public String getServiceInstanceId() {
@@ -54,6 +57,14 @@ public class WorkflowResourceIds implements Serializable {
this.serviceInstanceId = serviceInstanceId;
}
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
public String getVnfId() {
return vnfId;
}
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 88c36bec3a..6b96bc384a 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,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2019 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 java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -33,27 +36,12 @@ import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.javatuples.Pair;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
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;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -89,6 +77,7 @@ import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.Networks;
+import org.onap.so.serviceinstancebeans.Pnfs;
import org.onap.so.serviceinstancebeans.RelatedInstance;
import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -115,6 +104,7 @@ public class BBInputSetup implements JavaDelegate {
private static final String VF_MODULE = "VfModule";
private static final String NETWORK = "Network";
private static final String VNF = "Vnf";
+ private static final String PNF = "Pnf";
private static final String NETWORK_COLLECTION = "NetworkCollection";
private static final String PREPROV = "PREPROV";
private static final String CREATEVOLUME = "CreateVolume";
@@ -243,6 +233,7 @@ public class BBInputSetup implements JavaDelegate {
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId());
lookupKeyMap.put(ResourceKey.NETWORK_ID, workflowResourceIds.getNetworkId());
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, workflowResourceIds.getVnfId());
+ lookupKeyMap.put(ResourceKey.PNF, workflowResourceIds.getPnfId());
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, workflowResourceIds.getVfModuleId());
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId());
@@ -806,6 +797,13 @@ 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)) {
@@ -1456,6 +1454,11 @@ public class BBInputSetup implements JavaDelegate {
this.populateGenericVnf(executeBB.getRequestId(), vnfs.getModelInfo(), vnfs.getInstanceName(),
vnfs.getPlatform(), vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null,
vnfId, vnfType, vnfs.getInstanceParams(), productFamilyId, applicationId);
+ } 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));
} 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/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index aa71ee540f..bb70853bbb 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -59,6 +59,10 @@ public class ExtractPojosForBB {
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getVnfs(), value);
break;
+ case PNF:
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ result = lookupObjectInList(serviceInstance.getPnfs(), value);
+ break;
case NETWORK_ID:
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getNetworks(), value);
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 483b626f95..8ee3979386 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
@@ -1934,6 +1934,7 @@ public class BBInputSetupTest {
String serviceInstanceId = "serviceInstanceId";
String networkId = "networkId";
String vnfId = "vnfId";
+ String pnfId = "pnfId";
String vfModuleId = "vfModuleId";
String volumeGroupId = "volumeGroupId";
String configurationId = "configurationId";
@@ -1942,6 +1943,7 @@ public class BBInputSetupTest {
expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
expected.put(ResourceKey.NETWORK_ID, networkId);
expected.put(ResourceKey.GENERIC_VNF_ID, vnfId);
+ expected.put(ResourceKey.PNF, pnfId);
expected.put(ResourceKey.VF_MODULE_ID, vfModuleId);
expected.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId);
expected.put(ResourceKey.CONFIGURATION_ID, configurationId);
@@ -1951,6 +1953,7 @@ public class BBInputSetupTest {
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
workflowResourceIds.setNetworkId(networkId);
workflowResourceIds.setVnfId(vnfId);
+ workflowResourceIds.setPnfId(pnfId);
workflowResourceIds.setVfModuleId(vfModuleId);
workflowResourceIds.setVolumeGroupId(volumeGroupId);
workflowResourceIds.setConfigurationId(configurationId);
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 68f33c18a8..99ba35232c 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
@@ -75,17 +75,7 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.serviceinstancebeans.CloudConfiguration;
-import org.onap.so.serviceinstancebeans.ModelInfo;
-import org.onap.so.serviceinstancebeans.ModelType;
-import org.onap.so.serviceinstancebeans.Networks;
-import org.onap.so.serviceinstancebeans.RelatedInstance;
-import org.onap.so.serviceinstancebeans.RequestDetails;
-import org.onap.so.serviceinstancebeans.RequestInfo;
-import org.onap.so.serviceinstancebeans.Service;
-import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
-import org.onap.so.serviceinstancebeans.VfModules;
-import org.onap.so.serviceinstancebeans.Vnfs;
+import org.onap.so.serviceinstancebeans.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -730,6 +720,8 @@ public class WorkflowAction {
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
if (resource == WorkflowType.VNF) {
workflowResourceIds.setVnfId(resourceId);
+ } else if (resource == WorkflowType.PNF) {
+ workflowResourceIds.setPnfId(resourceId);
} else if (resource == WorkflowType.VFMODULE) {
workflowResourceIds.setVfModuleId(resourceId);
} else if (resource == WorkflowType.VOLUMEGROUP) {
@@ -1173,6 +1165,13 @@ public class WorkflowAction {
}
}
}
+ if (validate.getResources().getPnfs() != null) {
+ for (Pnfs pnf : validate.getResources().getPnfs()) {
+ resourceCounter.add(new Resource(WorkflowType.PNF,
+ pnf.getModelInfo().getModelCustomizationId(), false));
+ foundRelated = true;
+ }
+ }
if (validate.getResources().getNetworks() != null) {
for (Networks network : validate.getResources().getNetworks()) {
resourceCounter.add(new Resource(WorkflowType.NETWORK,