summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt50
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt (renamed from vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java)80
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java3
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js4
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js8
7 files changed, 87 insertions, 74 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 a03d62d68..c392d0758 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
@@ -11,7 +11,6 @@ import org.onap.vid.changeManagement.RequestDetailsWrapper
import org.onap.vid.model.serviceInstantiation.*
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
@@ -99,20 +98,17 @@ class MsoRequestBuilder
return RequestDetailsWrapper(VnfInstantiationRequestDetails(vnfDetails.modelInfo, cloudConfiguration, requestInfo, null, null, null, null))
}
- fun generateVfModuleInstantiationRequest(
+ protected fun generateVfModuleRequestWithRequestParams(
vfModuleDetails: VfModule, serviceModelInfo: ModelInfo,
- serviceInstanceId: String, vnfModelInfo: ModelInfo, vnfInstanceId: String,
- vgInstanceId: String?, userId: String, testApi: String?
- ): RequestDetailsWrapper<VfModuleInstantiationRequestDetails> {
+ serviceInstanceId: String, vnfModelInfo: ModelInfo, vnfInstanceId: String, vgInstanceId: String?, userId: String,
+ requestParameters: (userParams: List<UserParamTypes>) -> RequestParametersVfModuleOrVolumeGroup
+ ): RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> {
val requestInfo = generateRequestInfo(vfModuleDetails.instanceName, ResourceType.VF_MODULE, vfModuleDetails.isRollbackOnFailure, null, userId)
//cloud configuration
val cloudConfiguration = generateCloudConfiguration(vfModuleDetails.lcpCloudRegionId, vfModuleDetails.tenantId)
- //request parameters
val userParams = aggregateAllInstanceParams(extractActualInstanceParams(vfModuleDetails.instanceParams), vfModuleDetails.supplementaryParams)
- val requestParameters = VfModuleInstantiationRequestDetails.RequestParametersVfModule(
- userParams, vfModuleDetails.isUsePreload, testApi, nullSafeNegate(vfModuleDetails.isRetainVolumeGroups))
//related instance list
val relatedInstanceList = generateRelatedInstances(mapOf(serviceInstanceId to serviceModelInfo, vnfInstanceId to vnfModelInfo))
@@ -121,7 +117,35 @@ class MsoRequestBuilder
volumeGroupModel.modelType = "volumeGroup"
relatedInstanceList.add(RelatedInstance(volumeGroupModel, vgInstanceId, vfModuleDetails.volumeGroupInstanceName))
}
- return RequestDetailsWrapper(VfModuleInstantiationRequestDetails(vfModuleDetails.modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters))
+
+ return RequestDetailsWrapper(VfModuleOrVolumeGroupRequestDetails(vfModuleDetails.modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters(userParams)))
+ }
+
+ fun generateVfModuleInstantiationRequest(
+ vfModuleDetails: VfModule, serviceModelInfo: ModelInfo,
+ serviceInstanceId: String, vnfModelInfo: ModelInfo, vnfInstanceId: String,
+ vgInstanceId: String?, userId: String, testApi: String?
+ ): RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> {
+ val requestParameters = { userParams: List<UserParamTypes> ->
+ RequestParametersVfModuleOrVolumeGroupInstantiation(userParams, vfModuleDetails.isUsePreload, testApi)
+ }
+
+ return generateVfModuleRequestWithRequestParams(vfModuleDetails, serviceModelInfo, serviceInstanceId,
+ vnfModelInfo, vnfInstanceId, vgInstanceId, userId, requestParameters)
+ }
+
+ fun generateVfModuleReplaceRequest(
+ vfModuleDetails: VfModule, serviceModelInfo: ModelInfo,
+ serviceInstanceId: String, vnfModelInfo: ModelInfo, vnfInstanceId: String,
+ vgInstanceId: String?, userId: String, testApi: String?
+ ): RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> {
+ val requestParameters = { userParams: List<UserParamTypes> ->
+ RequestParametersVfModuleUpgrade(userParams, vfModuleDetails.isUsePreload, testApi,
+ vfModuleDetails.isRetainAssignments, nullSafeNegate(vfModuleDetails.isRetainVolumeGroups))
+ }
+
+ return generateVfModuleRequestWithRequestParams(vfModuleDetails, serviceModelInfo, serviceInstanceId,
+ vnfModelInfo, vnfInstanceId, vgInstanceId, userId, requestParameters)
}
private fun nullSafeNegate(booleanValue: Boolean?): Boolean? = booleanValue?.not()
@@ -130,7 +154,7 @@ class MsoRequestBuilder
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, null)
+ val requestParameters = RequestParametersVfModuleOrVolumeGroupInstantiation(userParams, vfModuleDetails.isUsePreload, testApi)
val relatedInstances = generateRelatedInstances(mapOf(serviceInstanceId to serviceModelInfo, vnfInstanceId to vnfModelInfo))
vfModuleDetails.modelInfo.modelType = "volumeGroup"
@@ -158,10 +182,10 @@ class MsoRequestBuilder
return RequestDetailsWrapper(NetworkInstantiationRequestDetails(networkDetails.modelInfo, cloudConfiguration, requestInfo, null, null, null, null))
}
- fun generateDeleteVfModuleRequest(vfModuleDetails: VfModule, userId: String): RequestDetailsWrapper<VfModuleInstantiationRequestDetails> {
+ fun generateDeleteVfModuleRequest(vfModuleDetails: VfModule, userId: String): RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> {
val requestInfo = generateRequestInfo(null, null, null, null, userId)
val cloudConfiguration = generateCloudConfiguration(vfModuleDetails.lcpCloudRegionId, vfModuleDetails.tenantId)
- return RequestDetailsWrapper(VfModuleInstantiationRequestDetails(vfModuleDetails.modelInfo, cloudConfiguration, requestInfo, null, null))
+ return RequestDetailsWrapper(VfModuleOrVolumeGroupRequestDetails(vfModuleDetails.modelInfo, cloudConfiguration, requestInfo, null, null))
}
private fun generateServiceName(jobId: UUID?, payload: ServiceInstantiation, optimisticUniqueServiceInstanceName: String): String? {
@@ -271,7 +295,7 @@ class MsoRequestBuilder
}.collect(Collectors.toList<VfModuleMacro>())
}
- fun aggregateAllInstanceParams(instanceParams: Map<String, String>?, supplementaryParams: Map<String, String>?): List<VfModuleInstantiationRequestDetails.UserParamMap<String, String>> {
+ fun aggregateAllInstanceParams(instanceParams: Map<String, String>?, supplementaryParams: Map<String, String>?): List<UserParamMap<String, String>> {
var instanceParamsFinal: Map<String, String> = instanceParams ?: emptyMap()
val supplementaryParamsFinal: Map<String, String> = supplementaryParams ?: emptyMap()
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt
index bee42fbd4..6c499079f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt
@@ -90,7 +90,7 @@ class VfmoduleCommand @Autowired constructor(
val originalRequestWithNewestVfmModelInfo = getRequest().cloneWith(vfmModelInfo)
- val requestDetailsWrapper = msoRequestBuilder.generateVfModuleInstantiationRequest(
+ val requestDetailsWrapper = msoRequestBuilder.generateVfModuleReplaceRequest(
originalRequestWithNewestVfmModelInfo, serviceModelInfo, serviceInstanceId,
vnfModelInfo, vnfInstanceId, null, sharedData.userId, sharedData.testApi)
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 5c847b87c..ad5b39e28 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
@@ -44,9 +44,11 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
private Map<String, String> supplementaryParams;
@JsonInclude(NON_NULL)
- @Nullable
private final Boolean retainVolumeGroups;
+ @JsonInclude(NON_NULL)
+ private Boolean retainAssignments;
+
public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo,
@JsonProperty("instanceName") String instanceName,
@JsonProperty("volumeGroupName") String volumeGroupInstanceName,
@@ -62,13 +64,15 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
@JsonProperty("trackById") String trackById,
@JsonProperty("isFailed") Boolean isFailed,
@JsonProperty("statusMessage") String statusMessage,
- @JsonProperty("retainVolumeGroups") Boolean retainVolumeGroups,
+ @Nullable @JsonProperty("retainAssignments") Boolean retainAssignments,
+ @Nullable @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.retainAssignments = retainAssignments;
this.retainVolumeGroups = retainVolumeGroups;
}
@@ -101,6 +105,11 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
}
@Nullable
+ public Boolean isRetainAssignments() {
+ return retainAssignments;
+ }
+
+ @Nullable
public Boolean isRetainVolumeGroups() {
return retainVolumeGroups;
}
@@ -122,6 +131,7 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
this.getTrackById(),
this.getIsFailed(),
this.getStatusMessage(),
+ this.isRetainAssignments(),
this.isRetainVolumeGroups(),
this.getPosition());
}
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/VfModuleOrVolumeGroupRequestDetails.kt
index d54fe7c53..bba4081dd 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/VfModuleOrVolumeGroupRequestDetails.kt
@@ -17,16 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+package org.onap.vid.mso.model
-package org.onap.vid.mso.model;
-
-import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonInclude
+import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
+import java.util.*
/* Based on this model:
@@ -98,42 +93,33 @@ import java.util.Map;
*/
-public class VfModuleInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails {
-
- public VfModuleInstantiationRequestDetails(
- @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
- @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
- @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
- @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
- @JsonProperty(value = "requestParameters", required = true) RequestParametersVfModule requestParameters)
- {
- super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters);
- }
-
- 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, 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> {
-
- public UserParamMap() {
- super();
- }
- }
-}
+data class VfModuleOrVolumeGroupRequestDetails(
+ val modelInfo: ModelInfo,
+ val cloudConfiguration: CloudConfiguration,
+ val requestInfo: RequestInfo,
+ val relatedInstanceList: List<RelatedInstance>?,
+ val requestParameters: RequestParametersVfModuleOrVolumeGroup?)
+ : BaseResourceInstantiationRequestDetails(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters)
+
+open class RequestParametersVfModuleOrVolumeGroup internal constructor(
+ userParams: List<UserParamTypes>,
+ @get:JsonInclude(NON_NULL) val isUsePreload: Boolean?,
+ testApi: String?
+) : BaseResourceInstantiationRequestDetails.RequestParameters(userParams, testApi)
+
+class RequestParametersVfModuleOrVolumeGroupInstantiation(
+ userParams: List<UserParamTypes>,
+ usePreload: Boolean?,
+ testApi: String?
+) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi)
+
+class RequestParametersVfModuleUpgrade(
+ userParams: List<UserParamTypes>,
+ usePreload: Boolean?,
+ testApi: String?,
+ @get:JsonInclude(NON_NULL) val retainAssignments: Boolean?,
+ @get:JsonInclude(NON_NULL) val rebuildVolumeGroups: Boolean?
+) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi)
+
+class UserParamMap<K, V> : HashMap<K, V>(), UserParamTypes, MutableMap<K, V>
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java
index e1a5e56dd..a637f85dc 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java
@@ -21,7 +21,6 @@
package org.onap.vid.mso.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.List;
public class VolumeGroupRequestDetails extends BaseResourceInstantiationRequestDetails {
@@ -31,7 +30,7 @@ public class VolumeGroupRequestDetails extends BaseResourceInstantiationRequestD
@JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
@JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
@JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
- @JsonProperty(value = "requestParameters", required = true) VfModuleInstantiationRequestDetails.RequestParametersVfModule requestParameters)
+ @JsonProperty(value = "requestParameters", required = true) RequestParametersVfModuleOrVolumeGroup requestParameters)
{
super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters);
}
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js
index 6d8dde844..4b6b0f47a 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js
@@ -1016,8 +1016,7 @@
var isVfc = false;
_.map($scope.service.model.vnfs, function (value, key) {
- if (value.uuid == vnf.uuid) {
- if (!_.isEmpty(value.vfcInstanceGroups)) {
+ if (value.uuid == vnf.uuid && !_.isEmpty(value.vfcInstanceGroups)) {
isVfc = true;
var queryData = {
serviceModelId: $scope.service.model.service.uuid,
@@ -1033,7 +1032,6 @@
$scope.$broadcast(COMPONENT.IFRAME_DIALOG, queryData);
return;
}
- }
});
DataService.setSubscriberName($scope.service.instance.subscriberName);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
index bf3d54af0..110f24ec6 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
@@ -489,8 +489,7 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER",
if (model && model.vnfs && !_.isEmpty(model.vnfs)) {
Object.keys(model.vnfs).forEach(function (key) {
var vnf = model.vnfs[key];
- if (vnf.vfcInstanceGroups && !_.isEmpty(vnf.vfcInstanceGroups)) {
- if (vnf.uuid === genericVnf.modelVersionId) {
+ if (vnf.vfcInstanceGroups && !_.isEmpty(vnf.vfcInstanceGroups) && vnf.uuid === genericVnf.modelVersionId) {
AaiService.getInstanceGroupsByVNFInstanceId(genericVnf.nodeId,
function (response) { //success
handleGetRelatedInstanceGroupsResponseForVnf(response, genericVnf);
@@ -502,7 +501,6 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER",
}
)
}
- }
});
}
}
@@ -797,11 +795,9 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER",
};
$scope.isShowAssignmentsEnabled = function () {
- if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_ASSIGNMENTS)) {
- if ($scope.serviceOrchestrationStatus) {
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_ASSIGNMENTS) && $scope.serviceOrchestrationStatus) {
return $scope.serviceOrchestrationStatus.toLowerCase() === 'assigned';
}
- }
return false;
};