aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt49
-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.java23
-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)66
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java2
-rw-r--r--vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties3
-rw-r--r--vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties2
-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
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java10
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java46
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json5
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json1
15 files changed, 145 insertions, 83 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..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,15 +98,17 @@ 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> {
+ protected fun generateVfModuleRequestWithRequestParams(
+ vfModuleDetails: VfModule, serviceModelInfo: ModelInfo,
+ 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)
//related instance list
val relatedInstanceList = generateRelatedInstances(mapOf(serviceInstanceId to serviceModelInfo, vnfInstanceId to vnfModelInfo))
@@ -116,14 +117,44 @@ 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()
+
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 = RequestParametersVfModuleOrVolumeGroupInstantiation(userParams, vfModuleDetails.isUsePreload, testApi)
val relatedInstances = generateRelatedInstances(mapOf(serviceInstanceId to serviceModelInfo, vnfInstanceId to vnfModelInfo))
vfModuleDetails.modelInfo.modelType = "volumeGroup"
@@ -151,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? {
@@ -264,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 41da85e35..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
@@ -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,12 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
@JsonInclude(NON_NULL) private Boolean usePreload;
private Map<String, String> supplementaryParams;
+ @JsonInclude(NON_NULL)
+ private final Boolean retainVolumeGroups;
+
+ @JsonInclude(NON_NULL)
+ private Boolean retainAssignments;
+
public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo,
@JsonProperty("instanceName") String instanceName,
@JsonProperty("volumeGroupName") String volumeGroupInstanceName,
@@ -57,12 +64,16 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
@JsonProperty("trackById") String trackById,
@JsonProperty("isFailed") Boolean isFailed,
@JsonProperty("statusMessage") String statusMessage,
+ @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;
}
public String getVolumeGroupInstanceName() {
@@ -93,6 +104,16 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
return JobType.VfmoduleInstantiation;
}
+ @Nullable
+ public Boolean isRetainAssignments() {
+ return retainAssignments;
+ }
+
+ @Nullable
+ public Boolean isRetainVolumeGroups() {
+ return retainVolumeGroups;
+ }
+
public VfModule cloneWith(ModelInfo modelInfo) {
return new VfModule(
modelInfo,
@@ -110,6 +131,8 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
this.getTrackById(),
this.getIsFailed(),
this.getStatusMessage(),
+ this.isRetainAssignments(),
+ 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/VfModuleOrVolumeGroupRequestDetails.kt
index 3b6cd1d3d..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,36 +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);
- }
+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)
- public static class RequestParametersVfModule extends BaseResourceInstantiationRequestDetails.RequestParameters {
- @JsonInclude(NON_NULL) private final Boolean usePreload;
+open class RequestParametersVfModuleOrVolumeGroup internal constructor(
+ userParams: List<UserParamTypes>,
+ @get:JsonInclude(NON_NULL) val isUsePreload: Boolean?,
+ testApi: String?
+) : BaseResourceInstantiationRequestDetails.RequestParameters(userParams, testApi)
- public RequestParametersVfModule(List<? extends UserParamTypes> userParams, Boolean usePreload, String testApi) {
- super(userParams, testApi);
- this.usePreload = usePreload;
- }
+class RequestParametersVfModuleOrVolumeGroupInstantiation(
+ userParams: List<UserParamTypes>,
+ usePreload: Boolean?,
+ testApi: String?
+) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi)
- public Boolean isUsePreload() {
- return usePreload;
- }
- }
+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)
- public static class UserParamMap<K,V> extends HashMap<K,V> implements UserParamTypes, Map<K,V> {
-
- public UserParamMap() {
- super();
- }
- }
-}
+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/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index b53ddbe2f..d6d7a6aa2 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
@@ -29,8 +29,6 @@ public enum Features implements Feature {
* Use /docs/feature-flags.md for details
*/
- CREATE_INSTANCE_TEST,
- EMPTY_DRAWING_BOARD_TEST,
FLAG_ADD_MSO_TESTAPI_FIELD,
FLAG_SERVICE_MODEL_CACHE,
FLAG_NETWORK_TO_ASYNC_INSTANTIATION,
diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
index 7152d91d7..7baa08690 100644
--- a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
+++ b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
@@ -1,7 +1,5 @@
FLAG_ENABLE_WEBPACK_MODERN_UI = true
FLAG_ASYNC_JOBS = true
-CREATE_INSTANCE_TEST = false
-EMPTY_DRAWING_BOARD_TEST = false
FLAG_ADD_MSO_TESTAPI_FIELD = true
FLAG_UNASSIGN_SERVICE = true
FLAG_COLLECTION_RESOURCE_SUPPORT = true
@@ -10,7 +8,6 @@ FLAG_SERVICE_MODEL_CACHE = true
FLAG_SHOW_ASSIGNMENTS = true
FLAG_HANDLE_SO_WORKFLOWS = true
FLAG_CREATE_ERROR_REPORTS = true
-
FLAG_SHOW_VERIFY_SERVICE = true
FLAG_DUPLICATE_VNF = true
FLAG_DEFAULT_VNF = true
diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
index 709de9566..1f7244c3d 100644
--- a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
+++ b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
@@ -1,6 +1,5 @@
FLAG_PNP_INSTANTIATION = true
-CREATE_INSTANCE_TEST = false
FLAG_ADD_MSO_TESTAPI_FIELD = true
FLAG_UNASSIGN_SERVICE = true
FLAG_SERVICE_MODEL_CACHE = true
@@ -22,7 +21,6 @@ FLAG_SHOW_ORCHESTRATION_TYPE = false
FLAG_COLLECTION_RESOURCE_SUPPORT = false
FLAG_ENABLE_WEBPACK_MODERN_UI = false
FLAG_ASYNC_JOBS = false
-EMPTY_DRAWING_BOARD_TEST = false
FLAG_NETWORK_TO_ASYNC_INSTANTIATION = false
FLAG_DUPLICATE_VNF = false
FLAG_DEFAULT_VNF = false
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;
};
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
index 986f5d0f5..db856d757 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
@@ -319,8 +319,8 @@ public class ResourceCommandTest {
}
static VfModule createVfModule(Action action) {
- return new VfModule(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, false, false, null, null, null, null,
- null);
+ return new VfModule(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null,
+ false, false, null, null, null, null, null, null, null);
}
static Network createNetwork(Action action) {
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
index 9c0260e85..d1b76df77 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
@@ -172,20 +172,22 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
vfModuleInfo.setModelVersion("10.0");
return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), "mdt1", null,
"88a6ca3ee0394ade9403f075db23167e", instanceParams, supplementaryParams, false, true, null, UUID.randomUUID().toString(), null, null,
- null);
+ null, null, null);
}
return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), null, null, null,
- instanceParams, supplementaryParams, false, false, null, UUID.randomUUID().toString(), null, null, null);
+ instanceParams, supplementaryParams, false, false, null, UUID.randomUUID().toString(), null,
+ null, null, null, null);
}
protected ModelInfo createVfModuleModelInfo(String modelName, String modelVersion, String modelVersionId, String modelInvariantId, String modelCustomizationId, String modelCustomizationName) {
return createModelInfo("vfModule", modelName, modelVersion, modelVersionId, modelInvariantId, modelCustomizationId, modelCustomizationName);
}
- protected VfModule createVfModuleForReplace(ModelInfo vfModuleModelInfo, String instanceName, String lcpCloudRegionId, String tenantId) {
+ protected VfModule createVfModuleForReplace(ModelInfo vfModuleModelInfo, String instanceName,
+ String lcpCloudRegionId, String tenantId, Boolean retainAssignments, Boolean retainVolumeGroups) {
return new VfModule( vfModuleModelInfo, instanceName, null, Action.Upgrade.name(), lcpCloudRegionId, null, tenantId,
- null, null, true, null, null, UUID.randomUUID().toString(), null, null, null);
+ null, null, true, null, null, UUID.randomUUID().toString(), null, null, retainAssignments, retainVolumeGroups, null);
}
protected ModelInfo createVnfModelInfo(boolean isAlacarte) {
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
index a7e2d553d..d2370af5e 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
@@ -22,6 +22,7 @@ package org.onap.vid.services;
import static com.google.common.collect.Maps.newHashMap;
import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals;
import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
@@ -74,8 +75,9 @@ import org.onap.vid.mso.model.ModelInfo;
import org.onap.vid.mso.model.NetworkInstantiationRequestDetails;
import org.onap.vid.mso.model.ServiceDeletionRequestDetails;
import org.onap.vid.mso.model.ServiceInstantiationRequestDetails;
-import org.onap.vid.mso.model.VfModuleInstantiationRequestDetails;
+import org.onap.vid.mso.model.UserParamMap;
import org.onap.vid.mso.model.VfModuleMacro;
+import org.onap.vid.mso.model.VfModuleOrVolumeGroupRequestDetails;
import org.onap.vid.mso.model.VnfInstantiationRequestDetails;
import org.onap.vid.mso.model.VolumeGroupRequestDetails;
import org.onap.vid.properties.Features;
@@ -370,7 +372,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
when(aaiClient.isNodeTypeExistsByName(eq("vmxnjr001_AVPN_base_vRE_BV_expansion"), eq(ResourceType.VF_MODULE))).thenReturn(false);
String expected = IOUtils.toString(this.getClass().getResource(fileName), "UTF-8");
- final RequestDetailsWrapper<VfModuleInstantiationRequestDetails> result = msoRequestBuilder.generateVfModuleInstantiationRequest(
+ final RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> result = msoRequestBuilder.generateVfModuleInstantiationRequest(
vfModule, siModelInfo, serviceInstanceId,
vnfModelInfo, vnfInstanceId, volumeGroupInstanceId, "pa0916", "VNF_API");
MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
@@ -390,8 +392,8 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
}
@Test(dataProvider = "expectedAggregatedParams")
- public void testAggregateInstanceParamsAndSuppFile(Map<String, String> instanceParams, Map<String, String> suppParams, List<VfModuleInstantiationRequestDetails.UserParamMap<String, String>> expected) {
- List<VfModuleInstantiationRequestDetails.UserParamMap<String, String>> aggParams = msoRequestBuilder.aggregateAllInstanceParams(instanceParams, suppParams);
+ public void testAggregateInstanceParamsAndSuppFile(Map<String, String> instanceParams, Map<String, String> suppParams, List<UserParamMap<String, String>> expected) {
+ List<UserParamMap<String, String>> aggParams = msoRequestBuilder.aggregateAllInstanceParams(instanceParams, suppParams);
assertThat("Aggregated params are not as expected", aggParams, equalTo(expected));
}
@@ -565,7 +567,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
" }" +
"}";
VfModule vfModuleDetails = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME, null, new HashMap<>(), "vmxnjr001_AVPN_base_vPE_BV_base", null, true);
- RequestDetailsWrapper<VfModuleInstantiationRequestDetails> result =
+ RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> result =
msoRequestBuilder.generateDeleteVfModuleRequest(vfModuleDetails, "az2018");
MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
}
@@ -609,24 +611,48 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
assertThat(result, jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
}
+ @Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
+ public void generateReplaceVfModuleRequest_whenRetainAssignmentsProvidedFromFrontend_retainAssignmentsToMsoIsTheSame(boolean retainAssignments) {
+
+ assertThat(generatedVfModuleReplaceRequest(retainAssignments, null),
+ jsonPartEquals("requestDetails.requestParameters.retainAssignments", retainAssignments));
+ }
+
+ @Test
+ public void generateReplaceVfModuleRequest_whenRetainVolumeGroupIsTrue_rebuildVolumeGroupIsFalse() {
+ boolean retainVolumeGroups = true;
+
+ assertThat(generatedVfModuleReplaceRequest(null, retainVolumeGroups),
+ jsonPartEquals("requestDetails.requestParameters.rebuildVolumeGroups", false));
+ }
+
@Test
public void generateReplaceVfModuleRequest_verifyResultAsExpected() {
+ Boolean retainVolumeGroups = null;
+ Boolean retainAssignments = null;
+
String expected = TestUtils.readFileAsString("/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json");
+ assertThat(generatedVfModuleReplaceRequest(retainAssignments, retainVolumeGroups), jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
+ }
+
+ private RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> generatedVfModuleReplaceRequest(
+ Boolean retainAssignments, Boolean retainVolumeGroups) {
when(featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(true);
when(aaiClient.getCloudOwnerByCloudRegionId("regionOne")).thenReturn("irma-aic");
ModelInfo vfModuleModelInfo = createVfModuleModelInfo("newest-model-name-vfm", "newest-model-version-vfm", "newest-model-uuid-vfm",
"f7a867f2-596b-4f4a-a128-421e825a6190", "newest-model-customization-uuid-vfm","newest-model-customization-name-vfm" );
- VfModule vfModuleDetails = createVfModuleForReplace(vfModuleModelInfo, "replace_module", "regionOne", "0422ffb57ba042c0800a29dc85ca70f8");
+ VfModule vfModuleDetails = createVfModuleForReplace(vfModuleModelInfo, "replace_module", "regionOne", "0422ffb57ba042c0800a29dc85ca70f8",
+ retainAssignments, retainVolumeGroups);
ModelInfo serviceModelInfo = createServiceModelInfo("newest-model-name-service", "newest-model-version-service", "newest-model-uuid-service", "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", null, null );
ModelInfo vnfModelInfo = createVnfModelInfo("newest-model-name-vnf", "newest-model-version-vnf", "newest-model-uuid-vnf", "23122c9b-dd7f-483f-bf0a-e069303db2f7", "newest-model-customization-uuid-vnf", "newest-model-customization-name-vnf" );
- RequestDetailsWrapper<VfModuleInstantiationRequestDetails> result =
- msoRequestBuilder.generateVfModuleInstantiationRequest(vfModuleDetails, serviceModelInfo, "e9993045-cc96-4f3f-bf9a-71b2a400a956", vnfModelInfo, "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null,"az2016", "GR_API");
-
- assertThat(result, jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
+ return msoRequestBuilder.generateVfModuleReplaceRequest(vfModuleDetails, serviceModelInfo,
+ "e9993045-cc96-4f3f-bf9a-71b2a400a956", vnfModelInfo,
+ "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null, "az2016", "GR_API"
+ );
}
} \ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
index 9571a2d13..46c99e77c 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
@@ -1,6 +1,6 @@
{
"action": "None_Upgrade",
- "isDirty": true,
+ "isDirty": false,
"vnfs": {
"d520268f-7489-4662-be59-f81495b3a069": {
"action": "None_Upgrade",
@@ -33,6 +33,7 @@
"xbitestmodulereplace0..XbiTestModuleReplace..base_ocg..module-0": {
"b0732bed-3ddf-43cc-b193-7f18db84e476": {
"action": "None_Upgrade",
+ "retainAssignments" : false,
"instanceName": "PST-VfMod-Replace-5-Vfmod",
"instanceId": "b0732bed-3ddf-43cc-b193-7f18db84e476",
"orchStatus": "Active",
@@ -113,4 +114,4 @@
"viewEditUI": "legacy",
"instantiationType": "ALaCarte"
}
-} \ No newline at end of file
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
index a9a9eda7d..98ba26c18 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
@@ -33,6 +33,7 @@
}
],
"requestParameters": {
+ "retainAssignments": false,
"userParams": [],
"testApi": "VNF_API"
},