diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org')
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); |