summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2020-03-25 00:01:55 +0200
committerAlexey Sandler <alexey.sandler@intl.att.com>2020-03-25 10:39:42 +0200
commite53d09ea02e5f1cfcff0b7614a5e69effaa707a7 (patch)
tree840b3c9ec3620d599c977f1299a0bcae04bcdb11 /vid-webpack-master/src
parentb897e70b94e645068fa0e9031637a8a26c3b2e70 (diff)
add tenantId and lcpCloudRegion to vfm instance during delete vfm
during delete vfm get tenantId and lcpCloudRegion from parent vnf and them to vfm instance Issue-ID: VID-795 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com> Change-Id: I66969f936e8cd5fa4e9867decebadd28186a1851 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src')
-rw-r--r--vid-webpack-master/src/app/shared/models/vfModuleInstance.ts2
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts124
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts8
3 files changed, 60 insertions, 74 deletions
diff --git a/vid-webpack-master/src/app/shared/models/vfModuleInstance.ts b/vid-webpack-master/src/app/shared/models/vfModuleInstance.ts
index 566c913ae..ed5a07212 100644
--- a/vid-webpack-master/src/app/shared/models/vfModuleInstance.ts
+++ b/vid-webpack-master/src/app/shared/models/vfModuleInstance.ts
@@ -5,6 +5,8 @@ export class VfModuleInstance extends ChildNodeInstance{
instanceParams: { [key: string] : string; };
position: any;
statusMessage?: string;
+ tenantId? :string;
+ lcpCloudRegionId?: string;
constructor() {
super();
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 91b749e0d..9ef440fc5 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
@@ -106,28 +106,7 @@ describe('vfModuleReducer', () => {
test('#UPDATE_VFMODULE_FEILD: should update field with some value', () => {
const newFieldName = 'newFieldName';
const newFieldValue = 'newFieldValue';
- let oldState = {
- serviceHierarchy: {
- 'serviceModelId': {}
- },
- serviceInstance: {
- 'serviceModelId': {
- vnfs: {
- 'vnfStoreKey': {
- vfModules: {
- 'modelName': {
- 'dynamicModelName1': {
- isMissingData: true,
- action: 'None'
- },
- 'dynamicModelName2': {},
- }
- }
- }
- }
- }
- }
- };
+ let oldState = getReduxState();
let newState = vfModuleReducer(<any>oldState,
<UpdateVFModuleField>{
@@ -222,40 +201,24 @@ test('#UPDATE_VFMODULE_POSITION: should update position', () => {
});
test('#DELETE_ACTION_VF_MODULE_INSTANCE', () => {
- let vfModule = vfModuleReducer(<any>{
- serviceHierarchy: {
- 'serviceModelId': {}
- },
- serviceInstance: {
- 'serviceModelId': {
- vnfs: {
- 'vnfStoreKey': {
- vfModules: {
- 'modelName': {
- 'dynamicModelName1': {
- isMissingData: true,
- action: 'None'
- },
- 'dynamicModelName2': {},
- }
- }
- }
- }
- }
- }
- },
- <DeleteActionVfModuleInstanceAction>{
- type: VfModuleActions.DELETE_ACTION_VF_MODULE_INSTANCE,
- dynamicModelName: 'dynamicModelName1',
- vnfStoreKey: 'vnfStoreKey',
- serviceId: 'serviceModelId'
- }).serviceInstance['serviceModelId'].vnfs['vnfStoreKey'].vfModules['modelName']['dynamicModelName1'];
+ let vfModule = vfModuleReducer(<any>getReduxState(), getDeleteActionVfModule())
+ .serviceInstance['serviceModelId'].vnfs['vnfStoreKey'].vfModules['modelName']['dynamicModelName1'];
expect(vfModule).toBeDefined();
expect(vfModule.isMissingData).toBeTruthy();
expect(vfModule.action).toEqual(ServiceInstanceActions.None_Delete);
});
+test('#DELETE_ACTION_VF_MODULE_INSTANCE set tenantId and lcpCloudRegion to VFM', () => {
+ let vfModule = vfModuleReducer(<any>getReduxState(), getDeleteActionVfModule())
+ .serviceInstance['serviceModelId'].vnfs['vnfStoreKey'].vfModules['modelName']['dynamicModelName1'];
+
+ expect(vfModule).toBeDefined();
+ expect(vfModule.tenantId).toEqual('tenantId');
+ expect(vfModule.lcpCloudRegionId).toEqual('lcpCloudRegionId');
+
+});
+
test('#UNDO_DELETE_ACTION_VF_MODULE_INSTANCE', () => {
let vfModule = vfModuleReducer(<any>{
serviceHierarchy: {
@@ -291,28 +254,7 @@ test('#UNDO_DELETE_ACTION_VF_MODULE_INSTANCE', () => {
});
test('#UPGRADE_VFMODULE', () => {
- let vfModule = vfModuleReducer(<any>{
- serviceHierarchy: {
- 'serviceModelId': {}
- },
- serviceInstance: {
- 'serviceModelId': {
- vnfs: {
- 'vnfStoreKey': {
- vfModules: {
- 'modelName': {
- 'dynamicModelName1': {
- isMissingData: true,
- action: 'None'
- },
- 'dynamicModelName2': {},
- }
- }
- }
- }
- }
- }
- },
+ let vfModule = vfModuleReducer(<any>getReduxState(),
<UpgradeVfModuleInstanceAction>{
type: VfModuleActions.UPGRADE_VFMODULE,
dynamicModelName: 'dynamicModelName1',
@@ -358,5 +300,39 @@ test('#UNDO_UPGRADE_VFMODULE', () => {
expect(vfModule.action).toEqual(ServiceInstanceActions.None);
});
-})
-;
+function getReduxState() {
+ return {
+ serviceHierarchy: {
+ 'serviceModelId': {}
+ },
+ serviceInstance: {
+ 'serviceModelId': {
+ vnfs: {
+ 'vnfStoreKey': {
+ tenantId: 'tenantId',
+ lcpCloudRegionId: 'lcpCloudRegionId',
+ vfModules: {
+ 'modelName': {
+ 'dynamicModelName1': {
+ isMissingData: true,
+ action: 'None',
+ },
+ 'dynamicModelName2': {},
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+function getDeleteActionVfModule() {
+ return <DeleteActionVfModuleInstanceAction>{
+ type: VfModuleActions.DELETE_ACTION_VF_MODULE_INSTANCE,
+ dynamicModelName: 'dynamicModelName1',
+ vnfStoreKey: 'vnfStoreKey',
+ serviceId: 'serviceModelId'
+ }
+}
+});
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 2e91f8771..1ab275e05 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
@@ -79,6 +79,7 @@ export function vfModuleReducer(state: ServiceState , action: Action) : ServiceS
let oldAction = newState.serviceInstance[(<DeleteActionVfModuleInstanceAction>action).serviceId].vnfs[(<DeleteActionVfModuleInstanceAction>action).vnfStoreKey].vfModules[key][firstKey].action;
if(oldAction === ServiceInstanceActions.None_Delete || oldAction === ServiceInstanceActions.Update_Delete) return newState;
newState.serviceInstance[(<DeleteActionVfModuleInstanceAction>action).serviceId].vnfs[(<DeleteActionVfModuleInstanceAction>action).vnfStoreKey].vfModules[key][firstKey].action = (oldAction + '_Delete') as ServiceInstanceActions;
+ setLcpCloudRegionIdAndTenantIdFromVnf(newState, (<DeleteActionVfModuleInstanceAction>action).serviceId, (<DeleteActionVfModuleInstanceAction>action).vnfStoreKey, key, firstKey);
updateIsMissingDataOnDeleteVFModule(newState, (<UndoDeleteActionVfModuleInstanceAction>action).serviceId, (<UndoDeleteActionVfModuleInstanceAction>action).vnfStoreKey, key);
return newState;
}
@@ -177,6 +178,13 @@ const updateIsMissingDataOnDeleteVFModule = (state: any, serviceModelId: string,
});
};
+const setLcpCloudRegionIdAndTenantIdFromVnf = (state: any, serviceModelId: string, vnfStoreKey: string, key: string, firstKey: string) :void => {
+ let tenantId = state.serviceInstance[serviceModelId].vnfs[vnfStoreKey].tenantId;
+ let lcpCloudRegion = state.serviceInstance[serviceModelId].vnfs[vnfStoreKey].lcpCloudRegionId;
+
+ state.serviceInstance[serviceModelId].vnfs[vnfStoreKey].vfModules[key][firstKey].tenantId = tenantId;
+ state.serviceInstance[serviceModelId].vnfs[vnfStoreKey].vfModules[key][firstKey].lcpCloudRegionId = lcpCloudRegion;
+}
const updateUniqueNames = (oldName : string, newName : string, serviceInstance : ServiceInstance) : void => {
let existingNames = serviceInstance.existingNames;