diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-11-21 14:37:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-11-21 14:37:58 +0000 |
commit | dbd97a1dd39e0fa3a587b00cb8f42616ef59a2f6 (patch) | |
tree | bed440f27a6b60764ac3f5fa94b746158b341a37 /vid-app-common/src/main | |
parent | c1777f478aa421c35667a99fd2199569bc9e4a8a (diff) | |
parent | 42c41dc30db2d2604a7d6743bd47138b0af521ff (diff) |
Merge "Replace vfmodule: expect optional retainVolumeGroups param"
Diffstat (limited to 'vid-app-common/src/main')
3 files changed, 30 insertions, 4 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt index b35deb892..a03d62d68 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt @@ -99,7 +99,11 @@ class MsoRequestBuilder return RequestDetailsWrapper(VnfInstantiationRequestDetails(vnfDetails.modelInfo, cloudConfiguration, requestInfo, null, null, null, null)) } - fun generateVfModuleInstantiationRequest(vfModuleDetails: VfModule, serviceModelInfo: ModelInfo, serviceInstanceId: String, vnfModelInfo: ModelInfo, vnfInstanceId: String, vgInstanceId: String?, userId: String, testApi: String?): RequestDetailsWrapper<VfModuleInstantiationRequestDetails> { + fun generateVfModuleInstantiationRequest( + vfModuleDetails: VfModule, serviceModelInfo: ModelInfo, + serviceInstanceId: String, vnfModelInfo: ModelInfo, vnfInstanceId: String, + vgInstanceId: String?, userId: String, testApi: String? + ): RequestDetailsWrapper<VfModuleInstantiationRequestDetails> { val requestInfo = generateRequestInfo(vfModuleDetails.instanceName, ResourceType.VF_MODULE, vfModuleDetails.isRollbackOnFailure, null, userId) //cloud configuration @@ -107,7 +111,8 @@ class MsoRequestBuilder //request parameters val userParams = aggregateAllInstanceParams(extractActualInstanceParams(vfModuleDetails.instanceParams), vfModuleDetails.supplementaryParams) - val requestParameters = VfModuleInstantiationRequestDetails.RequestParametersVfModule(userParams, vfModuleDetails.isUsePreload, testApi) + val requestParameters = VfModuleInstantiationRequestDetails.RequestParametersVfModule( + userParams, vfModuleDetails.isUsePreload, testApi, nullSafeNegate(vfModuleDetails.isRetainVolumeGroups)) //related instance list val relatedInstanceList = generateRelatedInstances(mapOf(serviceInstanceId to serviceModelInfo, vnfInstanceId to vnfModelInfo)) @@ -119,11 +124,13 @@ class MsoRequestBuilder return RequestDetailsWrapper(VfModuleInstantiationRequestDetails(vfModuleDetails.modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters)) } + private fun nullSafeNegate(booleanValue: Boolean?): Boolean? = booleanValue?.not() + fun generateVolumeGroupInstantiationRequest(vfModuleDetails: VfModule, serviceModelInfo: ModelInfo, serviceInstanceId: String, vnfModelInfo: ModelInfo, vnfInstanceId: String, userId: String, testApi: String?): RequestDetailsWrapper<VolumeGroupRequestDetails> { val requestInfo = generateRequestInfo(vfModuleDetails.volumeGroupInstanceName, ResourceType.VOLUME_GROUP, vfModuleDetails.isRollbackOnFailure, null, userId) val cloudConfiguration = generateCloudConfiguration(vfModuleDetails.lcpCloudRegionId, vfModuleDetails.tenantId) val userParams = aggregateAllInstanceParams(extractActualInstanceParams(vfModuleDetails.instanceParams), vfModuleDetails.supplementaryParams) - val requestParameters = VfModuleInstantiationRequestDetails.RequestParametersVfModule(userParams, vfModuleDetails.isUsePreload, testApi) + val requestParameters = VfModuleInstantiationRequestDetails.RequestParametersVfModule(userParams, vfModuleDetails.isUsePreload, testApi, null) val relatedInstances = generateRelatedInstances(mapOf(serviceInstanceId to serviceModelInfo, vnfInstanceId to vnfModelInfo)) vfModuleDetails.modelInfo.modelType = "volumeGroup" diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java index 41da85e35..5c847b87c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java @@ -28,6 +28,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; +import javax.annotation.Nullable; import org.onap.vid.job.JobAdapter; import org.onap.vid.job.JobType; import org.onap.vid.mso.model.ModelInfo; @@ -42,6 +43,10 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest @JsonInclude(NON_NULL) private Boolean usePreload; private Map<String, String> supplementaryParams; + @JsonInclude(NON_NULL) + @Nullable + private final Boolean retainVolumeGroups; + public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo, @JsonProperty("instanceName") String instanceName, @JsonProperty("volumeGroupName") String volumeGroupInstanceName, @@ -57,12 +62,14 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest @JsonProperty("trackById") String trackById, @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("retainVolumeGroups") Boolean retainVolumeGroups, @JsonProperty("position") Integer position) { super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, position); this.volumeGroupInstanceName = volumeGroupInstanceName; this.usePreload = usePreload; this.supplementaryParams = supplementaryParams; + this.retainVolumeGroups = retainVolumeGroups; } public String getVolumeGroupInstanceName() { @@ -93,6 +100,11 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest return JobType.VfmoduleInstantiation; } + @Nullable + public Boolean isRetainVolumeGroups() { + return retainVolumeGroups; + } + public VfModule cloneWith(ModelInfo modelInfo) { return new VfModule( modelInfo, @@ -110,6 +122,7 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest this.getTrackById(), this.getIsFailed(), this.getStatusMessage(), + this.isRetainVolumeGroups(), this.getPosition()); } }
\ No newline at end of file diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java index 3b6cd1d3d..d54fe7c53 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java @@ -112,15 +112,21 @@ public class VfModuleInstantiationRequestDetails extends BaseResourceInstantiati public static class RequestParametersVfModule extends BaseResourceInstantiationRequestDetails.RequestParameters { @JsonInclude(NON_NULL) private final Boolean usePreload; + @JsonInclude(NON_NULL) private final Boolean rebuildVolumeGroups; - public RequestParametersVfModule(List<? extends UserParamTypes> userParams, Boolean usePreload, String testApi) { + public RequestParametersVfModule(List<? extends UserParamTypes> userParams, Boolean usePreload, String testApi, Boolean rebuildVolumeGroups) { super(userParams, testApi); this.usePreload = usePreload; + this.rebuildVolumeGroups = rebuildVolumeGroups; } public Boolean isUsePreload() { return usePreload; } + + public Boolean getRebuildVolumeGroups() { + return rebuildVolumeGroups; + } } public static class UserParamMap<K,V> extends HashMap<K,V> implements UserParamTypes, Map<K,V> { |