aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app
diff options
context:
space:
mode:
authorYoav Schneiderman <yoav.schneiderman@intl.att.com>2020-02-02 20:00:00 +0200
committerYoav Schneiderman <yoav.schneiderman@intl.att.com>2020-02-03 14:38:14 +0200
commita3e54c3e36156bccea5293f87b3e2d9caad2e025 (patch)
tree79fa6e3fe5a8146046cc8dc4b15b14091af2850b /vid-webpack-master/src/app
parent74e6271d3c9a5f0f2f471c607ca7bc9b8f3d5fc0 (diff)
upgrade VFM is not enable when other VFM in the same VNF is already upgraded.
Issue-ID: VID-771 Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com> Change-Id: Ia5eca719c50d47c77919a82c2306605da4d2a1c0 Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts45
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts22
2 files changed, 64 insertions, 3 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
index b4c58364b..2ff729d61 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
@@ -196,7 +196,7 @@ describe('Shared Tree Service', () => {
.toBeUndefined();
});
- test('openAuditInfoModal should open modal for failed instance', () => {
+ test('openAuditInfoModalInsideIframe should open modal for failed instance', () => {
jest.spyOn(AuditInfoModalComponent.openInstanceAuditInfoModal, 'next');
let modelInfoServiceMock: ILevelNodeInfo = new VnfModelInfo(null, null,
@@ -339,6 +339,49 @@ describe('Shared Tree Service', () => {
expect(res).toBe(enabled);
});
+
+ const isDiffCustomizationUuidProvider = [
+ ['currentVfModule customizationUuid and customizationUuid vfModuleHierarchy are diff' ,true, 'mDNS 01222020 0', 'mdns012220200..Mdns01222020..base_dns..module-0', '82160e6e-d9c4-45ef-bd19-01573ab11b61'],
+ ['currentVfModule customizationUuid and customizationUuid vfModuleHierarchy are same' , false, 'mDNS 01222020 0', 'mdns012220200..Mdns01222020..base_dns..module-0', 'c9b32003-febc-44e0-a97f-7630fa7fa4a0'],
+ ['vnfHierarchy is not part of the current model' , true, 'VNF_NOT_PART_OF_THE_MODEL', 'mdns012220200..Mdns01222020..base_dns..module-0', 'c9b32003-febc-44e0-a97f-7630fa7fa4a0'],
+ ['vfModuleHierarchy is not part of the current model', true, 'mDNS 01222020 1', 'VFM_NOT_PART_OF_THE_MODEL', 'c9b32003-febc-44e0-a97f-7630fa7fa4a0']];
+
+ each(isDiffCustomizationUuidProvider).test('isDiffCustomizationUuid: when %s should return %s', (description, expected, vnfModelName, vfModuleModelName, customizationUuid) => {
+ const serviceModelId : string = 'a243da28-c11e-45a8-9f26-0284a9a789bc';
+ spyOn(store, 'getState').and.returnValue({
+ service : {
+ serviceHierarchy : {
+ [serviceModelId] : {
+ vnfs : {
+ [vnfModelName] : {
+ vfModules : {
+ [vfModuleModelName] : {
+ customizationUuid : customizationUuid
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+
+ const node = <any>{
+ data:{
+ modelCustomizationId : 'c9b32003-febc-44e0-a97f-7630fa7fa4a0',
+ modelName : vfModuleModelName
+ },
+ parent : {
+ data : {
+ modelName : "mDNS 01222020 0"
+ }
+ }
+ };
+
+ const isDiffCustomizationUuidResponse : boolean = service.isDiffCustomizationUuid(node, serviceModelId);
+ expect(isDiffCustomizationUuidResponse).toEqual(expected);
+ });
+
});
function getStore() {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
index d60bbd3c9..83691cfa2 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
@@ -208,7 +208,7 @@ export class SharedTreeService {
****************************************************/
shouldShowUpgrade(node, serviceModelId): boolean {
if (FeatureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE, this._store) &&
- this.isThereAnUpdatedLatestVersion(serviceModelId)) {
+ (this.isThereAnUpdatedLatestVersion(serviceModelId)) || this.isDiffCustomizationUuid(node, serviceModelId)) {
return this.shouldShowButtonGeneric(node, VNFMethods.UPGRADE, serviceModelId);
}
else {
@@ -216,7 +216,25 @@ export class SharedTreeService {
}
}
- private isThereAnUpdatedLatestVersion(serviceModelId) : boolean{
+
+ isDiffCustomizationUuid(node, serviceModelId) : boolean {
+ const vfModuleServiceHierarchy = this.getVfModuleHierarchyThroughParentModelName(node, serviceModelId);
+ if(_.isNil(vfModuleServiceHierarchy)){
+ return true;
+ }
+ return node.data && !_.isNil(vfModuleServiceHierarchy) && vfModuleServiceHierarchy.customizationUuid && (vfModuleServiceHierarchy.customizationUuid !== node.data.modelCustomizationId);
+ }
+
+ getVfModuleHierarchyThroughParentModelName(node, serviceModelId) {
+ if(node.parent && node.parent.data && node.data){
+ const vnfHierarchy = this._store.getState().service.serviceHierarchy[serviceModelId].vnfs[node.parent.data.modelName];
+ return vnfHierarchy ? vnfHierarchy.vfModules[node.data.modelName] : null;
+ }
+ return null;
+ }
+
+
+ isThereAnUpdatedLatestVersion(serviceModelId) : boolean{
let serviceInstance = this.getServiceInstance(serviceModelId);
return !_.isNil(serviceInstance.latestAvailableVersion) && (Number(serviceInstance.modelInfo.modelVersion) < serviceInstance.latestAvailableVersion);
}