aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2020-04-30 13:31:30 +0300
committerAlexey Sandler <alexey.sandler@intl.att.com>2020-05-03 13:52:41 +0300
commit89050ec38eb9b61cd3ce4283f0bc910c5e414624 (patch)
treeac3ecdad854e213f60cbbac29c5dc49cdd69e170 /vid-webpack-master/src/app/shared/storeUtil/utils
parent4464942ccab08ce2c562c7b27451d0f2c48cc1ff (diff)
Add action and reducer for vfModule pause instantiation.
Issue-ID: VID-821 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com> Change-Id: Ia7735aa147752dd8bcd5cca820585324f14988ed Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/storeUtil/utils')
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts16
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts55
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts25
3 files changed, 91 insertions, 5 deletions
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts
index 40c1ea9e4..82e24091b 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts
@@ -11,6 +11,7 @@ export enum VfModuleActions {
UNDO_UPGRADE_VFMODULE_ACTION = "UNDO_UPGRADE_VFMODULE_ACTION",
UPDATE_VFMODULE_FEILD = "UPDATE_VFMODULE_FEILD",
DELETE_VFMODULE_FIELD = "DELETE_VFMODULE_FEILD",
+ PAUSE_ACTION_VFMODULE_INSTANCE = "PAUSE_ACTION_VFMODULE_INSTANCE",
}
@@ -89,6 +90,13 @@ export interface UndoDeleteActionVfModuleInstanceAction extends Action {
vfModuleModelName: string;
}
+export interface PauseVFModuleInstanciationAction extends Action {
+ dynamicModelName: string;
+ vnfStoreKey : string;
+ serviceId: string;
+ vfModuleModelName : string;
+}
+
export const removeVfModuleInstance: ActionCreator<DeleteVfModuleInstanceAction> = (modelName, serviceModelId, vfName, vnfStoreKey, dynamicModelName) => ({
type: VfModuleActions.REMOVE_VNF_MODULE_INSTANCE,
modelName: modelName,
@@ -174,3 +182,11 @@ export const deleteVFModuleField: ActionCreator<DeleteVFModuleField> = (modelNam
serviceId,
deleteFieldName
});
+
+export const pauseActionVFModuleInstance: ActionCreator<PauseVFModuleInstanciationAction> = (dynamicModelName, vnfStoreKey, serviceId, vfModuleModelName) => ({
+ type: VfModuleActions.PAUSE_ACTION_VFMODULE_INSTANCE,
+ dynamicModelName,
+ vnfStoreKey,
+ serviceId,
+ vfModuleModelName
+});
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts
index 7ec221a02..e73fe0c48 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts
@@ -2,7 +2,7 @@ import {
CreateVFModuleInstanceAction,
DeleteActionVfModuleInstanceAction,
DeleteVFModuleField,
- DeleteVfModuleInstanceAction,
+ DeleteVfModuleInstanceAction, PauseVFModuleInstanciationAction,
UndoDeleteActionVfModuleInstanceAction,
UpdateVFModluePosition,
UpdateVFModuleField,
@@ -238,6 +238,19 @@ test('#UNDO_DELETE_ACTION_VF_MODULE_INSTANCE %s', (description, dynamicModelName
expect(vfModule.action).toEqual(ServiceInstanceActions.None);
});
+ each([
+ ['for the first vfModule', 'dynamicModelName1', 'afterCompletion'],
+ ['for the third vfModule', 'dynamicModelName3', 'afterCompletion'],
+ ['for the last vfModule', 'dynamicModelName5', 'afterCompletion'],
+ ]).
+test('#PAUSE_ACTION_VF_MODULE_INSTANTIATION %s', (description: string, dynamicModelName:string, pauseInstantiation: string) => {
+ let vfModule = vfModuleReducer(<any>getPausedRedux(), getPausedActionVfModule(dynamicModelName))
+ .serviceInstance['serviceModelId'].vnfs['vnfStoreKey'].vfModules['vfModuleModelName'][dynamicModelName];
+
+ expect(vfModule).toBeDefined();
+ expect(vfModule.pauseInstantiation).toEqual(pauseInstantiation);
+});
+
test('#UPGRADE_VFMODULE', () => {
let vfModule = vfModuleReducer(<any>getReduxState(),
<UpgradeVfModuleInstanceAction>{
@@ -362,4 +375,44 @@ function getDeleteRedux() {
}
}
}
+
+function getPausedRedux() {
+ return {
+ serviceHierarchy: {
+ 'serviceModelId': {}
+ },
+ serviceInstance: {
+ 'serviceModelId': {
+ vnfs: {
+ 'vnfStoreKey': {
+ vfModules: {
+ 'vfModuleModelName': {
+ 'dynamicModelName1': {
+ },
+ 'dynamicModelName2': {
+ },
+ 'dynamicModelName3': {
+ },
+ 'dynamicModelName4': {
+ },
+ 'dynamicModelName5': {
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+function getPausedActionVfModule(dynamicModelName: string) {
+ return <PauseVFModuleInstanciationAction>{
+ type: VfModuleActions.PAUSE_ACTION_VFMODULE_INSTANCE,
+ dynamicModelName: dynamicModelName,
+ vnfStoreKey: 'vnfStoreKey',
+ serviceId: 'serviceModelId',
+ vfModuleModelName: 'vfModuleModelName'
+ }
+}
});
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts
index 8efecf2ca..294536de6 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts
@@ -1,15 +1,22 @@
import {Action} from "redux";
import * as _ from "lodash";
import {
- CreateVFModuleInstanceAction, DeleteActionVfModuleInstanceAction, DeleteVFModuleField,
- DeleteVfModuleInstanceAction, UndoDeleteActionVfModuleInstanceAction, UpdateVFModluePosition, UpdateVFModuleField,
- UpdateVFModuleInstanceAction, UpgradeVfModuleInstanceAction,
+ CreateVFModuleInstanceAction,
+ DeleteActionVfModuleInstanceAction,
+ DeleteVFModuleField,
+ DeleteVfModuleInstanceAction,
+ PauseVFModuleInstanciationAction,
+ UndoDeleteActionVfModuleInstanceAction,
+ UpdateVFModluePosition,
+ UpdateVFModuleField,
+ UpdateVFModuleInstanceAction,
+ UpgradeVfModuleInstanceAction,
VfModuleActions,
} from "./vfModule.actions";
import {ServiceInstance} from "../../../models/serviceInstance";
import {VfModuleMap} from "../../../models/vfModulesMap";
import {ServiceState} from "../main.reducer";
-import {ServiceInstanceActions} from "../../../models/serviceInstanceActions";
+import {PauseStatus, ServiceInstanceActions} from "../../../models/serviceInstanceActions";
import {updateServiceValidationCounter} from "../reducersHelper";
@@ -69,6 +76,16 @@ export function vfModuleReducer(state: ServiceState , action: Action) : ServiceS
}
return Object.assign({}, state);
}
+ case VfModuleActions.PAUSE_ACTION_VFMODULE_INSTANCE : {
+ const pauseVfModuleAction = (<PauseVFModuleInstanciationAction>action);
+ let newState = _.cloneDeep(state);
+
+ newState.serviceInstance[pauseVfModuleAction.serviceId].vnfs[pauseVfModuleAction.vnfStoreKey]
+ .vfModules[pauseVfModuleAction.vfModuleModelName][pauseVfModuleAction.dynamicModelName]
+ .pauseInstantiation = PauseStatus.AFTER_COMPLETION;
+ return newState;
+ }
+
case VfModuleActions.DELETE_ACTION_VF_MODULE_INSTANCE : {
const deleteAction = (<DeleteActionVfModuleInstanceAction>action);
let newState = _.cloneDeep(state);