aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/java/org
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-10-12 15:11:07 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-12 15:11:07 +0000
commitd6c21ac6f38474841d3b9ced0524fe7671ae8682 (patch)
treeac5a12fd0acdc5e0f07fe5089637b7da279e37bc /bpmn/MSOCommonBPMN/src/main/java/org
parentea7f1ce7584deb1e4896ffcddb8c45e64422a9d0 (diff)
parent6ba0a22bc952232d14d2d24c5f73a42aae2791a9 (diff)
Merge "Dynamic Cloud Owner Support"
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java2
6 files changed, 37 insertions, 24 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java
index 01846681db..91cd2ad791 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,6 +35,8 @@ public class Candidate implements Serializable {
private CandidateType candidateType;
@JsonProperty("candidates")
private List<String> candidates;
+ @JsonProperty("cloudOwner")
+ private String cloudOwner;
/**
* list of candidates
@@ -68,4 +70,20 @@ public class Candidate implements Serializable {
this.candidateType = candidateType;
}
+ /**
+ * The name of the cloud owner. Required if candidateType is cloudRegionId
+ */
+ public String getCloudOwner(){
+ return cloudOwner;
+ }
+
+ /**
+ * The name of the cloud owner. Required if candidateType is cloudRegionId
+ */
+ public void setCloudOwner(String cloudOwner){
+ this.cloudOwner = cloudOwner;
+ }
+
+
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
index 9540b9148e..40c76a3c92 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,6 @@ public enum CandidateType {
return name;
}
- //TODO added to get PojoTest to work
public String getName(){
return name;
}
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 eb4f4ca0d5..769d3e4e89 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
@@ -101,7 +101,6 @@ public class BBInputSetup implements JavaDelegate {
private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap";
private static final String GBB_INPUT_VAR_NAME = "gBBInput";
private static final String EXECUTE_BB_VAR_NAME = "buildingBlock";
- private static final String CLOUD_OWNER = "att-aic";
private static final String VOLUME_GROUP = "VolumeGroup";
private static final String VF_MODULE = "VfModule";
private static final String NETWORK = "Network";
@@ -384,7 +383,7 @@ public class BBInputSetup implements JavaDelegate {
if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) {
for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) {
String volumeGroupCustId =
- this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER,
+ this.bbInputSetupUtils.getAAIVolumeGroup(cloudConfiguration.getCloudOwner(),
cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId();
if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
@@ -801,9 +800,8 @@ public class BBInputSetup implements JavaDelegate {
requestContext.setAction(requestAction);
requestContext.setMsoRequestId(executeBB.getRequestId());
org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils
- .getCloudRegion(requestDetails.getCloudConfiguration(), CLOUD_OWNER);
- CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion,
- CLOUD_OWNER);
+ .getCloudRegion(requestDetails.getCloudConfiguration());
+ CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion);
outputBB.setOrchContext(orchContext);
outputBB.setRequestContext(requestContext);
outputBB.setCloudRegion(cloudRegion);
@@ -981,9 +979,8 @@ public class BBInputSetup implements JavaDelegate {
String requestAction, CloudConfiguration cloudConfiguration) throws Exception {
ServiceInstance serviceInstance = gBB.getServiceInstance();
if (cloudConfiguration != null && requestAction.equalsIgnoreCase("deleteInstance")) {
- org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration,
- CLOUD_OWNER);
- CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER);
+ org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
+ CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
gBB.setCloudRegion(cloudRegion);
}
if (bbName.contains(VNF)) {
@@ -1030,7 +1027,7 @@ public class BBInputSetup implements JavaDelegate {
this.mapCatalogVnf(vnf, vnfModelInfo, service);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId());
if (cloudConfiguration != null) {
- String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER,
+ String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudConfiguration.getCloudOwner(),
cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId())
.getModelCustomizationId();
ModelInfo volumeGroupModelInfo = new ModelInfo();
@@ -1116,6 +1113,7 @@ public class BBInputSetup implements JavaDelegate {
String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID);
CloudConfiguration cloudConfig = new CloudConfiguration();
cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId());
+ cloudConfig.setCloudOwner(cloudRegion.getCloudOwner());
this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null,
vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig);
}
@@ -1193,9 +1191,8 @@ public class BBInputSetup implements JavaDelegate {
}
}
if(cloudConfiguration != null) {
- org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration,
- CLOUD_OWNER);
- return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER);
+ org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
+ return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
} else {
msoLogger.debug("Could not find any cloud configuration for this request.");
return null;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 0c7eb0973f..6c399ddbbb 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -351,14 +351,12 @@ public class BBInputSetupMapperLayer {
return context;
}
- protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion, String cloudOwner) {
+ protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) {
CloudRegion cloudRegion = new CloudRegion();
if(cloudConfiguration != null)
cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class);
if(aaiCloudRegion != null)
modelMapper.map(aaiCloudRegion, cloudRegion);
- if(cloudOwner != null)
- cloudRegion.setCloudOwner(cloudOwner);
return cloudRegion;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index 84ecfc7576..4617fc4710 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -163,13 +163,14 @@ public class BBInputSetupUtils {
}
}
- protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration, String cloudOwner) {
+ protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration) {
if (cloudConfiguration != null) {
String cloudRegionId = cloudConfiguration.getLcpCloudRegionId();
- if (cloudRegionId != null && !cloudRegionId.isEmpty()) {
+ String cloudOwner = cloudConfiguration.getCloudOwner();
+ if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) {
return injectionHelper.getAaiClient().get(CloudRegion.class,
AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner,
- cloudConfiguration.getLcpCloudRegionId())).orElse(null);
+ cloudRegionId)).orElse(null);
} else {
return null;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java
index f87ec91440..89eff5f65a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java
@@ -182,7 +182,7 @@ public class ApplicationControllerClient {
commonHeader.setApiVer(API_VER);
commonHeader.setOriginatorId(ORIGINATOR_ID);
commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId);
- commonHeader.setSubRequestId(requestId);
+ commonHeader.setSubRequestId(UUID.randomUUID().toString());
Flags flags = new Flags();
String flagsMode = "NORMAL";
Mode mode = Mode.valueOf(flagsMode);