From 879ed7a6358e920595010f8c915e0df8fd2dba0e Mon Sep 17 00:00:00 2001 From: Yoav Schneiderman Date: Mon, 23 Dec 2019 09:54:07 +0200 Subject: When remove VND with existing VFModules - should update Validation counter Issue-ID: VID-734 Signed-off-by: Yoav Schneiderman Change-Id: I41cb2f010fc1aee4638f4f1b7c49af2be97ed2f3 --- .../utils/general/general.reducers.spec.ts | 41 ++++++++++++++++++++-- .../storeUtil/utils/general/general.reducers.ts | 1 + 2 files changed, 40 insertions(+), 2 deletions(-) (limited to 'vid-webpack-master/src/app/shared/storeUtil/utils') diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts index 952a92842..4bad61326 100644 --- a/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts +++ b/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts @@ -178,7 +178,7 @@ describe('generalReducer', () => { expect(userState).toEqual(userId); }); - test('#DELETE_VNF_INSTANCE : should delete existing vnf', () => { + test('#REMOVE_INSTANCE : should delete existing vnf', () => { let state = generalReducer({serviceInstance : { 'serviceModelId' : { vnfs : { @@ -202,7 +202,7 @@ describe('generalReducer', () => { expect(state.serviceInstance[ 'serviceModelId'].vnfs['modelName']).not.toBeDefined(); }); - test('#DELETE_VNF_INSTANCE : should delete existing network', () => { + test('#REMOVE_INSTANCE : should delete existing network', () => { let state = generalReducer({serviceInstance : { 'serviceModelId' : { 'networks' : { @@ -226,6 +226,43 @@ describe('generalReducer', () => { expect(state.serviceInstance['serviceModelId'].networks['modelName']).not.toBeDefined(); }); + test('#REMOVE_INSTANCE : remove VNF should remove VFModules ', () => { + let state = generalReducer( + {serviceInstance : { + 'serviceModelId' : { + 'validationCounter' : 2, + 'vnfs' : { + 'SDC_Automation_15Aug 0' : { + 'isMissingData' :true, + 'modelName' : {}, + 'vfModules' : { + 'vfModule_1' : { + 'vfModule_1_1' : { + 'isMissingData' :true + } + } + } + } + } + } + }}, + { + type: GeneralActions.REMOVE_INSTANCE, + modelName : 'modelName', + serviceModelId : 'serviceModelId', + storeKey : 'SDC_Automation_15Aug 0', + node : { + data : { + type : 'VF' + } + } + }); + + expect(state).toBeDefined(); + expect(state.serviceInstance['serviceModelId'].vnfs['modelName']).not.toBeDefined(); + expect(state.serviceInstance['serviceModelId'].validationCounter).toEqual(0); + }); + test('#CHANGE_VNF_INSTANCE_COUNTER : should init existingVNFCounterMap to 1', () => { let state = generalReducer({serviceInstance : { 'serviceModelId' : { diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts index f87a97397..924d58a8a 100644 --- a/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts +++ b/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts @@ -55,6 +55,7 @@ export function generalReducer(state: ServiceState, action: Action) : ServiceSta _.forOwn(state.serviceInstance[actionData.serviceModelId][typeNodeInformation.hierarchyName][actionData.storeKey].vfModules, (vfModuleMap) => { _.forOwn(vfModuleMap, (vfModuleInstance) => { updateUniqueNames(vfModuleInstance.instanceName, null, state.serviceInstance[actionData.serviceModelId]); + updateServiceValidationCounter(state, vfModuleInstance.isMissingData, false, actionData.serviceModelId); }) }); } -- cgit 1.2.3-korg