aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-12-11 10:26:04 +0200
committerEylon Malin <eylon.malin@intl.att.com>2019-12-11 10:26:04 +0200
commit2ed2a1a61fe0bccf215a8dc9cecbf4fdf55fd454 (patch)
treede6c98308d25348c9eb20093bf3f9501a7c7e92d /vid-webpack-master/src
parent0b4cdc4ab5740f9a1a4e308a0dee6ab9bcf8c6c4 (diff)
change default max instances of VfModule to unlimited
Issue-ID: VID-726 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com> Change-Id: Id7ee4f62593ad0f70dc9ba95b286fa7a44455f6b
Diffstat (limited to 'vid-webpack-master/src')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts40
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts27
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.ts2
-rw-r--r--vid-webpack-master/src/app/shared/models/vfModule.ts5
4 files changed, 50 insertions, 24 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts
index 225d84b4c..276c0aeb2 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts
@@ -17,6 +17,8 @@ import {AaiService} from "../../../../../shared/services/aaiService/aai.service"
import {HttpClient, HttpHandler} from "@angular/common/http";
import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service";
import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service";
+import {instance, mock, when} from "ts-mockito";
+import each from "jest-each";
class MockAppStore<T> {
getState() {
@@ -44,7 +46,8 @@ describe('VFModule Model Info', () => {
let _vfModuleUpgradePopupService : VfModuleUpgradePopupService;
let _iframeService : IframeService;
let _componentInfoService : ComponentInfoService;
- let _featureFlagsService : FeatureFlagsService;
+ let mockFeatureFlagsService: FeatureFlagsService = mock(FeatureFlagsService);
+ let mockFeatureFlagsServiceInstance: FeatureFlagsService = instance(mockFeatureFlagsService);
beforeAll(done => (async () => {
@@ -62,7 +65,7 @@ describe('VFModule Model Info', () => {
AaiService,
HttpClient,
HttpHandler,
- {provide: FeatureFlagsService, useClass: MockFeatureFlagsService},
+ {provide: FeatureFlagsService, useValue: mockFeatureFlagsServiceInstance},
ComponentInfoService
]
});
@@ -70,9 +73,9 @@ describe('VFModule Model Info', () => {
injector = getTestBed();
_sharedTreeService = injector.get(SharedTreeService);
- _componentInfoService = injector.get(ComponentInfoService)
- _featureFlagsService = injector.get(FeatureFlagsService);
- vfModuleModel = new VFModuleModelInfo(_dynamicInputsService, _sharedTreeService, _dialogService, _vfModulePopupService, _vfModuleUpgradePopupService, _iframeService,_featureFlagsService, MockNgRedux.getInstance(),_componentInfoService);
+ _componentInfoService = injector.get(ComponentInfoService);
+ vfModuleModel = new VFModuleModelInfo(_dynamicInputsService, _sharedTreeService, _dialogService, _vfModulePopupService, _vfModuleUpgradePopupService,
+ _iframeService, mockFeatureFlagsServiceInstance, MockNgRedux.getInstance(),_componentInfoService);
})().then(done).catch(done.fail));
@@ -480,6 +483,33 @@ describe('VFModule Model Info', () => {
expect(actualVNFInfo).toEqual(expectedVNFInfo);
});
+ each([
+ ["maxCountInstances 3, currentNodeCount 1, flag on",{maxCountInstances:3}, 1, {FLAG_2002_UNLIMITED_MAX: true}, false],
+ ["maxCountInstances 3, currentNodeCount 3, flag on",{maxCountInstances:3}, 3, {FLAG_2002_UNLIMITED_MAX: true}, true],
+ ["no maxCountInstances, currentNodeCount 0, flag off",{}, 0, {FLAG_2002_UNLIMITED_MAX: false}, false],
+ ["no maxCountInstances, currentNodeCount 1, flag off",{}, 1, {FLAG_2002_UNLIMITED_MAX: false}, true],
+ ["no maxCountInstances, currentNodeCount 1, no flags",{}, 1, null, true],
+ ["no maxCountInstances, currentNodeCount 0, flag on",{}, 0, {FLAG_2002_UNLIMITED_MAX: true}, false],
+ ["no maxCountInstances, currentNodeCount 1, flag on",{}, 1, {FLAG_2002_UNLIMITED_MAX: true}, false],
+ ["no maxCountInstances, currentNodeCount 1000, flag on",{}, 1000, {FLAG_2002_UNLIMITED_MAX: true}, false],
+ ]).test('isVFModuleReachedLimit: %s', (desc, properties, currentNodeCount, flags, expected) => {
+
+ const node = { data: {
+ name : 'vfModuleName'
+ }};
+
+ const serviceHierarchy = {
+ servicedId :{
+ vfModules : {
+ vfModuleName : {
+ properties
+ }}}};
+
+ when(mockFeatureFlagsService.getAllFlags()).thenReturn(flags);
+
+ expect(vfModuleModel.isVFModuleReachedLimit(node, serviceHierarchy, 'servicedId', currentNodeCount)).toEqual(expected);
+ });
+
function getVFModule(){
return {
"uuid":"522159d5-d6e0-4c2a-aa44-5a542a12a830",
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
index e182b8a6f..1ce452793 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
@@ -8,10 +8,7 @@ import {VfModuleInstance} from "../../../../../shared/models/vfModuleInstance";
import {VfModule} from "../../../../../shared/models/vfModule";
import {NgRedux} from "@angular-redux/store";
import {ITreeNode} from "angular-tree-component/dist/defs/api";
-import {
- GenericFormPopupComponent,
- PopupType
-} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component";
+import {GenericFormPopupComponent, PopupType} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component";
import {DialogService} from "ng2-bootstrap-modal";
import {VfModulePopuopService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service";
import {AppState} from "../../../../../shared/store/reducers";
@@ -19,19 +16,13 @@ import {MessageBoxData} from "../../../../../shared/components/messageBox/messag
import {MessageBoxService} from "../../../../../shared/components/messageBox/messageBox.service";
import {AvailableNodeIcons} from "../../../available-models-tree/available-models-tree.service";
import {IframeService} from "../../../../../shared/utils/iframe.service";
-import {
- deleteActionVfModuleInstance, deleteVFModuleField,
- removeVfModuleInstance,
- undoDeleteVfModuleInstance,
- undoUgradeVFModule, updateVFModuleField,
- updateVFModulePosition,
- upgradeVFModule
-} from "../../../../../shared/storeUtil/utils/vfModule/vfModule.actions";
+import {deleteActionVfModuleInstance, deleteVFModuleField, removeVfModuleInstance, undoDeleteVfModuleInstance, undoUgradeVFModule, updateVFModulePosition, upgradeVFModule} from "../../../../../shared/storeUtil/utils/vfModule/vfModule.actions";
import {ComponentInfoService} from "../../../component-info/component-info.service";
import {ComponentInfoType} from "../../../component-info/component-info-model";
import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component";
import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service";
import {FeatureFlagsService, Features} from "../../../../../shared/services/featureFlag/feature-flags.service";
+import {Utils} from "../../../../../shared/utils/utils";
export class VFModuleModelInfo implements ILevelNodeInfo {
constructor(private _dynamicInputsService: DynamicInputsService,
@@ -301,12 +292,16 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
}
isVFModuleReachedLimit(node: any, serviceHierarchy: any, serviceModelId: string, currentNodeCount: number): boolean {
- let maxNodes: number = 1;
+ const flags = this._featureFlagsService.getAllFlags();
let vnfModules = serviceHierarchy[serviceModelId].vfModules;
- if (vnfModules[node.data.name]) {
- maxNodes = vnfModules[node.data.name].properties.maxCountInstances || 1;
+ const maxInstances = vnfModules[node.data.name]
+ ? Utils.getMaxVfModule(vnfModules[node.data.name].properties, flags)
+ : null;
+ if (_.isNil(maxInstances)) {
+ return false;
}
- return !(maxNodes > currentNodeCount);
+
+ return !(maxInstances > currentNodeCount);
}
getMenuAction(node: ITreeNode, serviceModelId: string): { [methodName: string]: { method: Function, visible: Function, enable: Function } } {
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.ts
index c18b20d7e..1d44a9e5e 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.ts
@@ -38,7 +38,7 @@ export class BasicPopupService {
return new VNFModel(rawModel, flags);
}
case 'vfModules' : {
- return new VfModule(rawModel);
+ return new VfModule(rawModel, flags);
}
case 'networks' : {
return new NetworkModel(rawModel, flags);
diff --git a/vid-webpack-master/src/app/shared/models/vfModule.ts b/vid-webpack-master/src/app/shared/models/vfModule.ts
index c75202124..8f92ba428 100644
--- a/vid-webpack-master/src/app/shared/models/vfModule.ts
+++ b/vid-webpack-master/src/app/shared/models/vfModule.ts
@@ -1,4 +1,5 @@
import {NodeModel, NodeModelResponseInterface} from "./nodeModel";
+import {Utils} from "../utils/utils";
export interface Properties{
@@ -23,7 +24,7 @@ export class VfModule extends NodeModel {
modelCustomizationName: string;
volumeGroupAllowed : boolean;
- constructor(vf?: VFModuleResponseInterface) {
+ constructor(vf?: VFModuleResponseInterface, flags?: { [key: string]: boolean }) {
super(vf);
if(vf){
this.customizationUuid = vf.customizationUuid;
@@ -32,7 +33,7 @@ export class VfModule extends NodeModel {
}
if (vf && vf.properties) {
this.min = vf.properties.minCountInstances;
- this.max = vf.properties.maxCountInstances;
+ this.max = Utils.getMaxVfModule(vf.properties, flags);
this.initial = vf.properties.initialCount;
this.rollbackOnFailure = true
}