aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-12-17 12:07:32 +0200
committerEylon Malin <eylon.malin@intl.att.com>2019-12-18 05:59:38 +0000
commit273a84924f846f27fd7475c715ee708de2d8d144 (patch)
tree6040dc542226c2aeff31969cdc85008af85fea9e /vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule
parenta9f9a844ec795058a1867614b88284c3b324af7f (diff)
vfModule.model.info getModel use vfModule constructor
Fix bug of show wrong value in Component Info for VfModule with maxCountInstances Issue-ID: VID-726 Change-Id: I909218c9c7bb4121bcbfdb9f4f436571f1e83ebe Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts178
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts14
2 files changed, 29 insertions, 163 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 b62794ff8..54bc77877 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
@@ -19,6 +19,7 @@ import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/fe
import {VfModuleUpgradePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service";
import {instance, mock, when} from "ts-mockito";
import each from "jest-each";
+import {VfModule} from "../../../../../shared/models/vfModule";
class MockAppStore<T> {
getState() {
@@ -30,12 +31,6 @@ class MockAppStore<T> {
}
}
-class MockFeatureFlagsService extends FeatureFlagsService{
- getAllFlags(): { [p: string]: boolean } {
- return {};
- }
-}
-
describe('VFModule Model Info', () => {
let injector;
let _dynamicInputsService : DynamicInputsService;
@@ -133,8 +128,16 @@ describe('VFModule Model Info', () => {
});
test('getModel should return Module model', () => {
- let model = vfModuleModel.getModel('2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1',{}, getServiceHierarchy());
+ let model = vfModuleModel.getModel('2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1',null, getServiceHierarchy());
expect(model.uuid).toEqual('25284168-24bb-4698-8cb4-3f509146eca5');
+ expect(model.min).toBe(2);
+ expect(model.max).toBe(3);
+ expect(model.baseModule).toBeFalsy();
+ expect(model.inputs).toEqual(
+ {"vnf_config_template_version": {
+ "type": "string"
+ }});
+ expect(model.volumeGroupAllowed).toBeTruthy();
});
test('showNodeIcons should return false false if reachLimit of max', ()=>{
@@ -510,7 +513,7 @@ describe('VFModule Model Info', () => {
expect(vfModuleModel.isVFModuleReachedLimit(node, serviceHierarchy, 'servicedId', currentNodeCount)).toEqual(expected);
});
- function getVFModule(){
+ function getVFModule(): Partial<VfModule>{
return {
"uuid":"522159d5-d6e0-4c2a-aa44-5a542a12a830",
"invariantUuid":"98a7c88b-b577-476a-90e4-e25a5871e02b",
@@ -519,13 +522,10 @@ describe('VFModule Model Info', () => {
"name":"VfVgeraldine..vflorence_vlc..module-1",
"version":"2",
"modelCustomizationName":"VfVgeraldine..vflorence_vlc..module-1",
- "properties":{
- "minCountInstances":0,
- "maxCountInstances":null,
- "initialCount":0,
- "vfModuleLabel":"vflorence_vlc",
- "baseModule":false
- },
+ "min":0,
+ "max":null,
+ "initial":0,
+ "baseModule":false,
"inputs":{},
"volumeGroupAllowed":false
};
@@ -1151,7 +1151,7 @@ describe('VFModule Model Info', () => {
"type": "VF",
"modelCustomizationName": "2017-488_PASQUALE-vPE 0",
"vfModules": {
- "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1":{
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
@@ -1160,82 +1160,15 @@ describe('VFModule Model Info', () => {
"version": "6",
"modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
- "minCountInstances": 0,
- "maxCountInstances": null,
+ "minCountInstances": 2,
+ "maxCountInstances": 3,
"initialCount": 0,
"vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule": false
},
"inputs": {
"vnf_config_template_version": {
- "type": "string",
- "description": "VPE Software Version",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "vnf_config_template_version"
- },
- "fromInputName": "2017488_pasqualevpe0_vnf_config_template_version",
- "constraints": null,
- "required": true,
- "default": "17.2"
- },
- "bandwidth_units": {
- "type": "string",
- "description": "Units of bandwidth",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "bandwidth_units"
- },
- "fromInputName": "pasqualevpe0_bandwidth_units",
- "constraints": null,
- "required": true,
- "default": "Gbps"
- },
- "bandwidth": {
- "type": "string",
- "description": "Requested VPE bandwidth",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "bandwidth"
- },
- "fromInputName": "pasqualevpe0_bandwidth",
- "constraints": null,
- "required": true,
- "default": "10"
- },
- "AIC_CLLI": {
- "type": "string",
- "description": "AIC Site CLLI",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "AIC_CLLI"
- },
- "fromInputName": "2017488_pasqualevpe0_AIC_CLLI",
- "constraints": null,
- "required": true,
- "default": "ATLMY8GA"
- },
- "vnf_instance_name": {
- "type": "string",
- "description": "The hostname assigned to the vpe.",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "vnf_instance_name"
- },
- "fromInputName": "2017488_pasqualevpe0_vnf_instance_name",
- "constraints": null,
- "required": true,
- "default": "mtnj309me6"
+ "type": "string"
}
},
"volumeGroupAllowed": true
@@ -1402,82 +1335,15 @@ describe('VFModule Model Info', () => {
"version": "6",
"modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
- "minCountInstances": 0,
- "maxCountInstances": null,
+ "minCountInstances": 2,
+ "maxCountInstances": 3,
"initialCount": 0,
"vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule": false
},
"inputs": {
"vnf_config_template_version": {
- "type": "string",
- "description": "VPE Software Version",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "vnf_config_template_version"
- },
- "fromInputName": "2017488_pasqualevpe0_vnf_config_template_version",
- "constraints": null,
- "required": true,
- "default": "17.2"
- },
- "bandwidth_units": {
- "type": "string",
- "description": "Units of bandwidth",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "bandwidth_units"
- },
- "fromInputName": "pasqualevpe0_bandwidth_units",
- "constraints": null,
- "required": true,
- "default": "Gbps"
- },
- "bandwidth": {
- "type": "string",
- "description": "Requested VPE bandwidth",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "bandwidth"
- },
- "fromInputName": "pasqualevpe0_bandwidth",
- "constraints": null,
- "required": true,
- "default": "10"
- },
- "AIC_CLLI": {
- "type": "string",
- "description": "AIC Site CLLI",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "AIC_CLLI"
- },
- "fromInputName": "2017488_pasqualevpe0_AIC_CLLI",
- "constraints": null,
- "required": true,
- "default": "ATLMY8GA"
- },
- "vnf_instance_name": {
- "type": "string",
- "description": "The hostname assigned to the vpe.",
- "entry_schema": null,
- "inputProperties": {
- "sourceType": "HEAT",
- "vfModuleLabel": "PASQUALE_vRE_BV",
- "paramName": "vnf_instance_name"
- },
- "fromInputName": "2017488_pasqualevpe0_vnf_instance_name",
- "constraints": null,
- "required": true,
- "default": "mtnj309me6"
+ "type": "string"
}
},
"volumeGroupAllowed": true
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 bb56b14d0..a82cd49d7 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
@@ -67,10 +67,10 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
* @param instance
* @param serviceHierarchy - serviceHierarchy
************************************************************/
- getModel = (vfModuleModelId: string, instance, serviceHierarchy): any => {
+ getModel = (vfModuleModelId: string, instance, serviceHierarchy): Partial<VfModule> => {
if (!_.isNil(serviceHierarchy)) {
if (!_.isNil(serviceHierarchy[this.name]) && !_.isNil(serviceHierarchy[this.name][vfModuleModelId])) {
- return serviceHierarchy[this.name][vfModuleModelId];
+ return new VfModule(serviceHierarchy[this.name][vfModuleModelId], this._featureFlagsService.getAllFlags());
}
}
return {};
@@ -414,12 +414,12 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
return (!_.isNil(instance) && !_.isNil(instance[deepDynamicName])) ? instance[deepDynamicName].position : null;
}
- getInfo(model, instance): ModelInformationItem[] {
- const modelInformation = !_.isEmpty(model) && !_.isEmpty(model.properties) ? [
- ModelInformationItem.createInstance("Base module", model.properties.baseModule),
- ModelInformationItem.createInstance("Min instances", !_.isNull(model.properties.minCountInstances) ? String(model.properties.minCountInstances) : null),
+ getInfo(model:Partial<VfModule>, instance): ModelInformationItem[] {
+ const modelInformation = !_.isEmpty(model) ? [
+ ModelInformationItem.createInstance("Base module", model.baseModule),
+ ModelInformationItem.createInstance("Min instances", !_.isNull(model.min) ? String(model.min) : null),
this._sharedTreeService.createMaximumToInstantiateModelInformationItem(model),
- ModelInformationItem.createInstance("Initial instances count", !_.isNull(model.properties.initialCount) ? String(model.properties.initialCount) : null)
+ ModelInformationItem.createInstance("Initial instances count", !_.isNull(model.initial) ? String(model.initial) : null)
] : [];
const instanceInfo = [];