From 0814238f615f3e3b855a53add72730b957f6c790 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Sun, 2 Feb 2020 18:09:40 +0200 Subject: NodeInfo::getModel expects the instance-model Now callers (objectToInstanceTree, objectToModelTree, etc.) pass the hierarchy itself, instead of providing only the service hierarchy and keys. Issue-ID: VID-724 Change-Id: I80cde29887d86b2cc986d96b220ff769562f38b8 Signed-off-by: Ittay Stern --- .../vnfGrouping/vnfGrouping.model.info.spec.ts | 157 +-------------------- .../models/vnfGrouping/vnfGrouping.model.info.ts | 5 +- 2 files changed, 4 insertions(+), 158 deletions(-) (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping') diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.spec.ts index 802047cb9..057cdd349 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.spec.ts @@ -14,6 +14,7 @@ import {DrawingBoardModes} from "../../../drawing-board.modes"; import {AaiService} from "../../../../../shared/services/aaiService/aai.service"; import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service"; import {ITableContent} from "../../../../../shared/components/searchMembersModal/members-table/element-table-row.model"; +import {VNFModel} from "../../../../../shared/models/vnfModel"; describe('VnfGroupingModelInfo Model Info', () => { let injector; @@ -171,10 +172,7 @@ describe('VnfGroupingModelInfo Model Info', () => { }); test('getModel should return VnfGroup model', () => { - let model: VnfGroupModel = vnfGroupModel.getModel('ResourceGroup0', { - originalName : 'ResourceGroup0' - }, getServiceHierarchy()); - expect(model.type).toEqual('VnfGroup'); + expect(vnfGroupModel.getModel({})).toBeInstanceOf(VnfGroupModel); }); test('getMenuAction: showAuditInfoVnfGroup', ()=>{ @@ -266,156 +264,5 @@ describe('VnfGroupingModelInfo Model Info', () => { ]); }); - function getServiceHierarchy(){ - return { - "service": { - "uuid": "6b528779-44a3-4472-bdff-9cd15ec93450", - "invariantUuid": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", - "name": "action-data", - "version": "1.0", - "toscaModelURL": null, - "category": "", - "serviceType": "", - "serviceRole": "", - "description": "", - "serviceEcompNaming": "false", - "instantiationType": "Macro", - "inputs": { - "2017488_pasqualevpe0_ASN": { - "type": "string", - "description": "AV/PE", - "entry_schema": null, - "inputProperties": null, - "constraints": [], - "required": true, - "default": "AV_vPE" - } - }, - "vidNotions": { - "instantiationUI": "legacy", - "modelCategory": "other" - } - }, - "vnfGroups": { - "ResourceGroup0": { - "type": "VnfGroup", - "uuid": "0903e1c0-8e03-4936-b5c2-260653b96413", - "invariantUuid": "00beb8f9-6d39-452f-816d-c709b9cbb87d", - "version": "1", - "name": "ResourceGroup0", - "modelCustomizationName": "ResourceGroup0", - "properties": { - "contained_resource_type": "VF", - "role": "SERVICE-ACCESS", - "function": "DATA", - "description": "DDD0", - "type": "LOAD-GROUP" - }, - "members": { - "vdorothea_svc_vprs_proxy 0": { - "uuid": "65fadfa8-a0d9-443f-95ad-836cd044e26c", - "invariantUuid": "f4baae0c-b3a5-4ca1-a777-afbffe7010bc", - "description": "A Proxy for Service vDOROTHEA_Svc_vPRS", - "name": "vDOROTHEA_Svc_vPRS Service Proxy", - "version": "1.0", - "customizationUuid": "bdb63d23-e132-4ce7-af2c-a493b4cafac9", - "inputs": {}, - "commands": {}, - "properties": {}, - "type": "Service Proxy", - "sourceModelUuid": "da7827a2-366d-4be6-8c68-a69153c61274", - "sourceModelInvariant": "24632e6b-584b-4f45-80d4-fefd75fd9f14", - "sourceModelName": "vDOROTHEA_Svc_vPRS" - }, - "vdorothea_svc_vprs_proxy 1": { - "uuid": "111dfa8-a0d9-443f-95ad-836cd044e26c", - "invariantUuid": "111ae0c-b3a5-4ca1-a777-afbffe7010bc", - "description": "A Proxy for Service vDOROTHEA_Svc_vPRS", - "name": "111_Svc_vPRS Service Proxy", - "version": "1.0", - "customizationUuid": "1113d23-e132-4ce7-af2c-a493b4cafac9", - "inputs": {}, - "commands": {}, - "properties": {}, - "type": "Service Proxy", - "sourceModelUuid": "11127a2-366d-4be6-8c68-a69153c61274", - "sourceModelInvariant": "1112e6b-584b-4f45-80d4-fefd75fd9f14", - "sourceModelName": "111_Svc_vPRS" - } - } - } - }, - "networks": {}, - "collectionResources": {}, - "configurations": {}, - "fabricConfigurations": {}, - "serviceProxies": {}, - "vfModules": {}, - "volumeGroups": {}, - "pnfs": {} - } - } - - function loadMockMembers(): any[] { - return [ - { - "action": "None", - "instanceName": "VNF1_INSTANCE_NAME", - "instanceId": "VNF1_INSTANCE_ID", - "orchStatus": null, - "productFamilyId": null, - "lcpCloudRegionId": "hvf23b", - "tenantId": "3e9a20a3e89e45f884e09df0cc2d2d2a", - "tenantName": "APPC-24595-T-IST-02C", - "modelInfo": { - "modelInvariantId": "vnf-instance-model-invariant-id", - "modelVersionId": "7a6ee536-f052-46fa-aa7e-2fca9d674c44", - "modelVersion": "2.0", - "modelName": "vf_vEPDG", - "modelType": "vnf" - }, - "instanceType": "VNF1_INSTANCE_TYPE", - "provStatus": null, - "inMaint": false, - "uuid": "7a6ee536-f052-46fa-aa7e-2fca9d674c44", - "originalName": null, - "legacyRegion": null, - "lineOfBusiness": null, - "platformName": null, - "trackById": "7a6ee536-f052-46fa-aa7e-2fca9d674c44:002", - "serviceInstanceId": "service-instance-id1", - "serviceInstanceName": "service-instance-name" - }, - { - "action": "None", - "instanceName": "VNF2_INSTANCE_NAME", - "instanceId": "VNF2_INSTANCE_ID", - "orchStatus": null, - "productFamilyId": null, - "lcpCloudRegionId": "hvf23b", - "tenantId": "3e9a20a3e89e45f884e09df0cc2d2d2a", - "tenantName": "APPC-24595-T-IST-02C", - "modelInfo": { - "modelInvariantId": "vnf-instance-model-invariant-id", - "modelVersionId": "eb5f56bf-5855-4e61-bd00-3e19a953bf02", - "modelVersion": "1.0", - "modelName": "vf_vEPDG", - "modelType": "vnf" - }, - "instanceType": "VNF2_INSTANCE_TYPE", - "provStatus": null, - "inMaint": true, - "uuid": "eb5f56bf-5855-4e61-bd00-3e19a953bf02", - "originalName": null, - "legacyRegion": null, - "lineOfBusiness": null, - "platformName": null, - "trackById": "eb5f56bf-5855-4e61-bd00-3e19a953bf02:003", - "serviceInstanceId": "service-instance-id2", - "serviceInstanceName": "service-instance-name" - } - ]; - } - }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts index d89f307d9..2787c6174 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts @@ -95,9 +95,8 @@ export class VnfGroupingModelInfo implements ILevelNodeInfo { return node; } - getModel(modelId: string, instance: any, serviceHierarchy): any { - const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance); - return new VnfGroupModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, modelId)); + getModel(instanceModel: any): any { + return new VnfGroupModel(instanceModel); } hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean): boolean { -- cgit 1.2.3-korg