aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
authorBonkur, Venkat <venkat.bonkur@att.com>2019-12-11 10:50:04 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-12-11 14:02:57 -0500
commita0431290fa7b9365ac878353853ef79ac3e1353f (patch)
treeac68baa486d825aaa3f1cc181ca8d52994f45e5d /bpmn/MSOCommonBPMN/src
parent02c068ce771ee4522936f2d15f41c2b631e965a8 (diff)
add application id support to so
add application id support to so api Issue-ID: SO-2561 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ifc8c4dd5e178b68347a7df01ab1942a59baca9b0
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java17
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java42
4 files changed, 57 insertions, 23 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
index ebf722ef74..0bce305f1d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
@@ -144,6 +144,8 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
private String blueprintName;
@JsonProperty("CDS_BLUEPRINT_VERSION")
private String blueprintVersion;
+ @JsonProperty("application-id")
+ private String applicationId;
public String getBlueprintName() {
@@ -530,6 +532,15 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
this.callHoming = callHoming;
}
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof GenericVnf)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java
index 632e61b85c..0193469d93 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java
@@ -55,6 +55,8 @@ public class RequestContext implements Serializable {
private RequestParameters requestParameters;
@JsonProperty("configurationParameters")
private List<Map<String, String>> configurationParameters = new ArrayList<>();
+ @JsonProperty("application-id")
+ private String applicationId;
public String getServiceURI() {
return serviceURI;
@@ -143,4 +145,12 @@ public class RequestContext implements Serializable {
public void setConfigurationParameters(List<Map<String, String>> configurationParameters) {
this.configurationParameters = configurationParameters;
}
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
}
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 3f664cb821..b4c5ca9a7e 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
@@ -361,6 +361,10 @@ public class BBInputSetup implements JavaDelegate {
org.onap.so.serviceinstancebeans.Platform platform = requestDetails.getPlatform();
org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness();
+ String applicationId = "";
+ if (requestDetails.getRequestInfo().getApplicationId() != null) {
+ applicationId = requestDetails.getRequestInfo().getApplicationId();
+ }
if (modelType.equals(ModelType.network)) {
lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId);
@@ -369,7 +373,8 @@ public class BBInputSetup implements JavaDelegate {
} else if (modelType.equals(ModelType.vnf)) {
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId);
this.populateGenericVnf(requestId, modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
- serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId);
+ serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId,
+ applicationId);
} else if (modelType.equals(ModelType.volumeGroup)) {
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId);
this.populateVolumeGroup(requestId, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
@@ -748,7 +753,7 @@ public class BBInputSetup implements JavaDelegate {
org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap,
RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType,
- List<Map<String, String>> instanceParams, String productFamilyId) {
+ List<Map<String, String>> instanceParams, String productFamilyId, String applicationId) {
GenericVnf vnf = null;
ModelInfo instanceGroupModelInfo = null;
String instanceGroupId = null;
@@ -777,7 +782,7 @@ public class BBInputSetup implements JavaDelegate {
}
if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) {
vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, generatedVnfType,
- instanceParams, productFamilyId);
+ instanceParams, productFamilyId, applicationId);
serviceInstance.getVnfs().add(vnf);
mapVnfcCollectionInstanceGroup(vnf, modelInfo, service);
}
@@ -831,7 +836,7 @@ public class BBInputSetup implements JavaDelegate {
protected GenericVnf createGenericVnf(Map<ResourceKey, String> lookupKeyMap, String instanceName,
org.onap.so.serviceinstancebeans.Platform platform,
org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType,
- List<Map<String, String>> instanceParams, String productFamilyId) {
+ List<Map<String, String>> instanceParams, String productFamilyId, String applicationId) {
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId(vnfId);
@@ -840,6 +845,7 @@ public class BBInputSetup implements JavaDelegate {
genericVnf.setVnfType(vnfType);
genericVnf.setProvStatus(PREPROV);
genericVnf.setServiceId(productFamilyId);
+ genericVnf.setApplicationId(applicationId);
if (platform != null) {
genericVnf.setPlatform(this.mapperLayer.mapRequestPlatform(platform));
}
@@ -1431,9 +1437,10 @@ public class BBInputSetup implements JavaDelegate {
this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId);
}
String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
+ String applicationId = "";
this.populateGenericVnf(executeBB.getRequestId(), vnfs.getModelInfo(), vnfs.getInstanceName(),
vnfs.getPlatform(), vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null,
- vnfId, vnfType, vnfs.getInstanceParams(), productFamilyId);
+ vnfId, vnfType, vnfs.getInstanceParams(), productFamilyId, applicationId);
} 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/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 955cf94618..26e4771021 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
@@ -780,6 +780,7 @@ public class BBInputSetupTest {
String vnfType = "vnfType";
String resourceId = "networkId";
String productFamilyId = "productFamilyId";
+ String applicationId = "applicationId";
Service service = Mockito.mock(Service.class);
ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class);
RequestDetails requestDetails = Mockito.mock(RequestDetails.class);
@@ -803,6 +804,7 @@ public class BBInputSetupTest {
doReturn(lineOfBusiness).when(requestDetails).getLineOfBusiness();
doReturn(relatedInstanceList).when(requestDetails).getRelatedInstanceList();
doReturn(cloudConfiguration).when(requestDetails).getCloudConfiguration();
+ doReturn(applicationId).when(requestInfo).getApplicationId();
doReturn(ModelType.network).when(modelInfo).getModelType();
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName,
@@ -814,14 +816,16 @@ public class BBInputSetupTest {
doReturn(ModelType.vnf).when(modelInfo).getModelType();
resourceId = "vnfId";
+
doNothing().when(SPY_bbInputSetup).populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform,
lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId,
- vnfType, null, productFamilyId);
+ vnfType, null, productFamilyId, applicationId);
+
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName,
serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
verify(SPY_bbInputSetup, times(1)).populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform,
lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId,
- vnfType, null, productFamilyId);
+ vnfType, null, productFamilyId, applicationId);
assertEquals("VnfId populated", true,
lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId));
@@ -1354,6 +1358,7 @@ public class BBInputSetupTest {
vnf.setVnfName("vnfName");
serviceInstance.getVnfs().add(vnf);
String vnfType = "vnfType";
+ String applicationId = "applicationId";
RequestDetails requestDetails =
mapper.readValue(new File(RESOURCE_PATH + "RequestDetails_CreateVnf.json"), RequestDetails.class);
@@ -1380,20 +1385,20 @@ public class BBInputSetupTest {
SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId());
+ null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId());
+ null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
instanceName = "vnfName2";
GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
- resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
+ resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
- resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
+ resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
@@ -1401,7 +1406,7 @@ public class BBInputSetupTest {
SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId());
+ null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);
verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
@@ -1463,6 +1468,7 @@ public class BBInputSetupTest {
Platform expectedPlatform = new Platform();
LineOfBusiness expectedLineOfBusiness = new LineOfBusiness();
String resourceId = "123";
+ String applicationId = "applicationId";
doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform);
doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness);
org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
@@ -1477,18 +1483,18 @@ public class BBInputSetupTest {
SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId());
+ null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId());
+ null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
instanceName = "vnfName2";
GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
- resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId());
+ resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
org.onap.aai.domain.yang.GenericVnf vnf2AAI = new org.onap.aai.domain.yang.GenericVnf();
vnfAAI.setModelCustomizationId("modelCustId2");
@@ -1497,7 +1503,7 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId());
+ null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);
verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
@@ -1933,7 +1939,6 @@ public class BBInputSetupTest {
configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
executeBB.setConfigurationResourceKeys(configResourceKeys);
-
executeBB.setRequestDetails(requestDetails);
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
@@ -1959,7 +1964,7 @@ public class BBInputSetupTest {
any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class),
isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class),
isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any(),
- any(String.class));
+ any(String.class), any(String.class));
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString());
@@ -2218,7 +2223,6 @@ public class BBInputSetupTest {
Service service = Mockito.mock(Service.class);
String requestAction = "createInstance";
-
executeBB.setRequestDetails(requestDetails);
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
@@ -2243,7 +2247,7 @@ public class BBInputSetupTest {
any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class),
isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class),
isA(ServiceInstance.class), any(), ArgumentMatchers.isNull(), any(String.class),
- ArgumentMatchers.isNull(), any(), any(String.class));
+ ArgumentMatchers.isNull(), any(), any(String.class), any());
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString());
@@ -2308,7 +2312,7 @@ public class BBInputSetupTest {
any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class),
isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class),
isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any(),
- any(String.class));
+ any(String.class), any(String.class));
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString());
@@ -2767,6 +2771,7 @@ public class BBInputSetupTest {
String platformName = "platformName";
String lineOfBusinessName = "lineOfBusinessName";
String productFamilyId = "productFamilyId";
+ String applicationId = "applicationId";
Platform platform = new Platform();
platform.setPlatformName(platformName);
LineOfBusiness lineOfBusiness = new LineOfBusiness();
@@ -2783,6 +2788,7 @@ public class BBInputSetupTest {
expected.setLineOfBusiness(lineOfBusiness);
expected.setProvStatus("PREPROV");
expected.setServiceId(productFamilyId);
+ expected.setApplicationId(applicationId);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
List<Map<String, String>> instanceParams = new ArrayList<>();
instanceParams.add(cloudParams);
@@ -2796,14 +2802,14 @@ public class BBInputSetupTest {
doReturn(lineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(requestLineOfBusiness);
GenericVnf actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform,
- requestLineOfBusiness, vnfId, vnfType, instanceParams, productFamilyId);
+ requestLineOfBusiness, vnfId, vnfType, instanceParams, productFamilyId, applicationId);
assertThat(actual, sameBeanAs(expected));
assertEquals("LookupKeyMap is populated", vnfId, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
expected.getCloudParams().clear();
actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness,
- vnfId, vnfType, null, productFamilyId);
+ vnfId, vnfType, null, productFamilyId, applicationId);
assertThat(actual, sameBeanAs(expected));
}