diff options
author | 2020-08-07 15:49:11 -0400 | |
---|---|---|
committer | 2020-08-10 19:21:30 +0000 | |
commit | 32af6479c686d217204de3a86940ac1256da4b9f (patch) | |
tree | 98eb5135887c5bf5943099a783c9cd3d7dbbd8a4 /vid-webpack-master/src/app/shared/services/defaultDataServiceGenerator | |
parent | 09a6562a16715a2b89be11c941486be783c72364 (diff) |
Visualization of the VF Module Sequencing
Issue-ID: VID-860
More scenarios covered in VID-860 for vf-module sequencing.
Signed-off-by: ikram <ikram@research.att.com>
Change-Id: Ie138ba2616961fba7856eaaf5f17b5dc63a08e6e
Diffstat (limited to 'vid-webpack-master/src/app/shared/services/defaultDataServiceGenerator')
-rw-r--r-- | vid-webpack-master/src/app/shared/services/defaultDataServiceGenerator/default.data.generator.service.ts | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/vid-webpack-master/src/app/shared/services/defaultDataServiceGenerator/default.data.generator.service.ts b/vid-webpack-master/src/app/shared/services/defaultDataServiceGenerator/default.data.generator.service.ts index 79cd0682e..e00b259a0 100644 --- a/vid-webpack-master/src/app/shared/services/defaultDataServiceGenerator/default.data.generator.service.ts +++ b/vid-webpack-master/src/app/shared/services/defaultDataServiceGenerator/default.data.generator.service.ts @@ -15,7 +15,7 @@ import {NetworkTreeNode} from "../../models/networkTreeNode"; import {createVNFInstance} from "../../storeUtil/utils/vnf/vnf.actions"; import {changeInstanceCounter} from "../../storeUtil/utils/general/general.actions"; import {createNetworkInstance} from "../../storeUtil/utils/network/network.actions"; -import {createVFModuleInstance} from "../../storeUtil/utils/vfModule/vfModule.actions"; +import {createVFModuleInstance, updateVFModulePosition} from "../../storeUtil/utils/vfModule/vfModule.actions"; import {createVnfGroupInstance} from "../../storeUtil/utils/vnfGroup/vnfGroup.actions"; import {VnfGroupTreeNode} from "../../models/vnfGroupTreeNode"; import {ModelInfo} from "../../models/modelInfo"; @@ -234,6 +234,7 @@ export class DefaultDataGeneratorService { this.addDefaultVfModulesInRedux( serviceId, vfModuleModel.properties.initialCount, + vfModuleModel.properties.baseModule, vfModule, vnfModuleUUID, vnfUUID @@ -282,9 +283,14 @@ export class DefaultDataGeneratorService { } } - addDefaultVfModulesInRedux(serviceId: string, numberOfVfModules: number, vfModuleData: any, vfModuleName: string, vnfUUID : string){ + addDefaultVfModulesInRedux(serviceId: string, numberOfVfModules: number,baseModule:boolean, vfModuleData: any, vfModuleName: string, vnfUUID : string){ for (let i = 0; i < numberOfVfModules; i++) { - this.store.dispatch(createVFModuleInstance(vfModuleData, vfModuleName, serviceId, null, vnfUUID)); + if(baseModule) { + this.store.dispatch(createVFModuleInstance(vfModuleData, vfModuleName, serviceId, 1, vnfUUID)); + } else { + this.store.dispatch(createVFModuleInstance(vfModuleData, vfModuleName, serviceId, i+1, vnfUUID)); + } + } } @@ -460,4 +466,55 @@ export class DefaultDataGeneratorService { return newVfModule; } + calculatePositionOfVfmodule(serviceModelId:string) { + const serviceInstance = this.store.getState().service.serviceInstance[serviceModelId]; + const serviceHierarchy = this.store.getState().service.serviceHierarchy[serviceModelId]; + + const vnfList = serviceInstance.vnfs; + let totalSecondListLength =1; + if (!_.isEmpty(vnfList)) { + for (let vnfStoreKey in vnfList) { + const firstVfModuleInstanceList = vnfList[vnfStoreKey].vfModules; + if (!_.isEmpty(firstVfModuleInstanceList)) { + for (let vfModuleInstanceKey in firstVfModuleInstanceList) { + let secondVfModuleInstanceList = firstVfModuleInstanceList[vfModuleInstanceKey]; + let numSecondVfModuleInstanceList = Object.keys(secondVfModuleInstanceList).length; + totalSecondListLength = totalSecondListLength + numSecondVfModuleInstanceList; + + } + } else { + //No instances added yet , hence start from 1 + totalSecondListLength = 1; + } + + } + } + + return totalSecondListLength; + } + + + updatePositionForRemainingVfModules(serviceModelId: string) { + + const serviceInstance = this.store.getState().service.serviceInstance[serviceModelId]; + const vnfList = serviceInstance.vnfs; + if (!_.isEmpty(vnfList)) { + for (let vnfStoreKey in vnfList) { + const firstVfModuleInstanceList = vnfList[vnfStoreKey].vfModules; + if (!_.isEmpty(firstVfModuleInstanceList)) { + for (let vfModuleInstanceKey in firstVfModuleInstanceList) { + let secondVfModuleInstanceList = firstVfModuleInstanceList[vfModuleInstanceKey]; + for(let secondVfModuleInstanceKey in secondVfModuleInstanceList) { + let secondVfModuleObj = secondVfModuleInstanceList[secondVfModuleInstanceKey]; + if(!_.isNil(secondVfModuleObj.position)) { + this.store.dispatch(updateVFModulePosition(vfModuleInstanceKey,secondVfModuleInstanceKey, secondVfModuleObj.position+1,serviceModelId, vnfStoreKey)); + } + } + + } + } + + } + } + } } |