summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-09-19 09:44:51 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-19 09:44:51 +0000
commit497e040b5569b0b0139a5cbc8115a63bc7f99244 (patch)
tree4e2a8c3a09bfb7d3a0bbbdc773c0e9ec702d8e4a /vid-app-common/src/main/java
parent421fd2a498707d5844e9a99eed039ddcb8b52e06 (diff)
parent804882648e0c7c4bc8016870017ec43a6156253c (diff)
Merge "Disable homing_solution"6.0.0
Diffstat (limited to 'vid-app-common/src/main/java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt32
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java13
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java1
3 files changed, 37 insertions, 9 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 c8502b1e5..b35deb892 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
@@ -13,6 +13,7 @@ import org.onap.vid.mso.model.*
import org.onap.vid.mso.model.BaseResourceInstantiationRequestDetails.*
import org.onap.vid.mso.model.VfModuleInstantiationRequestDetails.UserParamMap
import org.onap.vid.mso.rest.SubscriberInfo
+import org.onap.vid.properties.Features
import org.onap.vid.services.AsyncInstantiationBusinessLogic
import org.onap.vid.services.CloudOwnerService
import org.onap.vid.utils.JACKSON_OBJECT_MAPPER
@@ -33,6 +34,7 @@ class MsoRequestBuilder
companion object {
private val LOGGER = EELFLoggerDelegate.getLogger(MsoRequestBuilder::class.java)
private const val VID_SOURCE = "VID"
+ private const val DISABLED_HOMING_VALUE = "none"
}
fun generateALaCarteServiceInstantiationRequest(payload: ServiceInstantiation, optimisticUniqueServiceInstanceName: String, userId: String): RequestDetailsWrapper<ServiceInstantiationRequestDetails> {
@@ -61,7 +63,8 @@ class MsoRequestBuilder
fun generateMacroServiceInstantiationRequest(jobId: UUID?, payload: ServiceInstantiation, optimisticUniqueServiceInstanceName: String, userId: String): RequestDetailsWrapper<ServiceInstantiationRequestDetails> {
val serviceInstanceName = generateServiceName(jobId, payload, optimisticUniqueServiceInstanceName)
- val serviceInstantiationServiceList = generateServiceInstantiationServicesList(payload, serviceInstanceName, createServiceInstantiationVnfList(jobId, payload))
+ val serviceInstantiationServiceList = generateMacroServiceInstantiationRequestParams(payload, serviceInstanceName, jobId)
+
val requestParameters = ServiceInstantiationRequestDetails.RequestParameters(payload.subscriptionServiceType, false, serviceInstantiationServiceList)
@@ -213,9 +216,9 @@ class MsoRequestBuilder
}
}
- val result : MutableMap<String, String> = instanceParams[0].entries.stream()
+ val result: MutableMap<String, String> = instanceParams[0].entries.stream()
.filter { entry -> !keysToRemove.contains(entry.key) }
- .collect(Collectors.toMap({it.key}, {it.value}))
+ .collect(Collectors.toMap({ it.key }, { it.value }))
return if (result.isEmpty()) emptyList() else listOf(result)
}
@@ -330,7 +333,7 @@ class MsoRequestBuilder
private fun generateCloudConfiguration(lcpCloudRegionId: String?, tenantId: String?): CloudConfiguration {
val cloudConfiguration = CloudConfiguration(lcpCloudRegionId, tenantId)
- if(lcpCloudRegionId != null){
+ if (lcpCloudRegionId != null) {
cloudOwnerService.enrichCloudConfigurationWithCloudOwner(cloudConfiguration, lcpCloudRegionId)
}
return cloudConfiguration
@@ -342,7 +345,7 @@ class MsoRequestBuilder
.collect(Collectors.toList())
}
- private fun generateRequestInfo(instanceName: String?, resourceType: ResourceType?, rollbackOnFailure: Boolean?, productFamilyId: String?, userId: String) : BaseResourceInstantiationRequestDetails.RequestInfo {
+ private fun generateRequestInfo(instanceName: String?, resourceType: ResourceType?, rollbackOnFailure: Boolean?, productFamilyId: String?, userId: String): BaseResourceInstantiationRequestDetails.RequestInfo {
return BaseResourceInstantiationRequestDetails.RequestInfo(
if (resourceType == null) null else getUniqueNameIfNeeded(instanceName, resourceType, false),
productFamilyId,
@@ -386,10 +389,7 @@ class MsoRequestBuilder
}
private fun generateUserParamsNameAndValue(instanceParams: List<Map<String, String>>): List<ServiceInstantiationRequestDetails.UserParamNameAndValue> {
- if (instanceParams == null){
- return emptyList()
- }
- return instanceParams.getOrElse(0, {emptyMap()}).map{x-> ServiceInstantiationRequestDetails.UserParamNameAndValue(x.key, x.value)}
+ return instanceParams.getOrElse(0) {emptyMap()}.map{ x-> ServiceInstantiationRequestDetails.UserParamNameAndValue(x.key, x.value)}
}
private fun generateSubscriberInfoPre1806(payload: ServiceInstantiation): SubscriberInfo {
@@ -408,4 +408,18 @@ class MsoRequestBuilder
listOf(vpn, network).map { RelatedInstance(it.modelInfo, it.instanceId, it.instanceName) }
}
}
+
+ private fun generateMacroServiceInstantiationRequestParams(payload: ServiceInstantiation, serviceInstanceName: String?, jobId: UUID?): List<UserParamTypes> {
+ val userParams = generateServiceInstantiationServicesList(payload, serviceInstanceName, createServiceInstantiationVnfList(jobId, payload))
+
+ return userParams.plus(homingSolution())
+ }
+
+ private fun homingSolution(): List<UserParamTypes> {
+ return if (featureManager.isActive(Features.FLAG_DISABLE_HOMING)) {
+ listOf(ServiceInstantiationRequestDetails.HomingSolution(DISABLED_HOMING_VALUE))
+ } else {
+ listOf()
+ }
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java
index 8f8dd681a..e610d6c40 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java
@@ -136,6 +136,19 @@ public class ServiceInstantiationRequestDetails {
}
}
+ public static class HomingSolution implements UserParamTypes {
+ private final String homingSolution;
+
+ public HomingSolution(String homingSolution) {
+ this.homingSolution = homingSolution;
+ }
+
+ @JsonProperty("Homing_Solution")
+ public String getHomingSolution() {
+ return homingSolution;
+ }
+ }
+
public static class ServiceInstantiationService implements UserParamTypes {
private final ServiceInstantiationServiceInner serviceInstantiationServiceInner;
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index 5ec0e253e..7384c97e2 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -74,6 +74,7 @@ public enum Features implements Feature {
FLAG_PNP_INSTANTIATION,
FLAG_HANDLE_SO_WORKFLOWS,
FLAG_CREATE_ERROR_REPORTS,
+ FLAG_DISABLE_HOMING,
FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG,
FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT,
FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH,