From 6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Wed, 29 Aug 2018 17:01:32 +0300 Subject: merge from ecomp a88f0072 - Modern UI Issue-ID: VID-378 Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6 Signed-off-by: Ittay Stern --- .../src/app/shared/models/nodeModel.ts | 66 +++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) (limited to 'vid-webpack-master/src/app/shared/models/nodeModel.ts') diff --git a/vid-webpack-master/src/app/shared/models/nodeModel.ts b/vid-webpack-master/src/app/shared/models/nodeModel.ts index 4b22b8d91..ee57ec038 100644 --- a/vid-webpack-master/src/app/shared/models/nodeModel.ts +++ b/vid-webpack-master/src/app/shared/models/nodeModel.ts @@ -1,12 +1,27 @@ +import {VfcInstanceGroupMap} from "./vfcInstanceGroupMap"; + export interface NodeModelResponseInterface { + customizationUuid: string; name: string; version: string; description: string; category: string; uuid: string; invariantUuid: string; + max: number; + min:number; +} +export interface Level1ModelResponseInterface extends NodeModelResponseInterface{ + serviceType: string; + serviceRole: string; + subCategory: string; + customizationUuid: string; + serviceEcompNaming: boolean; + type: string; + modelCustomizationName: string; + vfcInstanceGroups: VfcInstanceGroupMap; + properties: Level1ModelProperties; } - export class NodeModel { name: string; version: string; @@ -14,16 +29,65 @@ export class NodeModel { category: string; uuid: string; invariantUuid: string; + max: number; + min: number; + customizationUuid?: string; constructor(serviceJson?: NodeModelResponseInterface) { if (serviceJson) { + this.customizationUuid = serviceJson.customizationUuid; this.name = serviceJson.name; this.version = serviceJson.version; this.description = serviceJson.description; this.category = serviceJson.category; this.uuid = serviceJson.uuid; this.invariantUuid = serviceJson.invariantUuid; + this.max = serviceJson.max; + this.min = serviceJson.min; } } } +export class Level1ModelProperties { + max_instances : number; + min_instances : number; +} + + + +export class Level1Model extends NodeModel{ + serviceType: string; + serviceRole: string; + subCategory: string; + customizationUuid: string; + serviceEcompNaming: boolean; + type: string; + modelCustomizationName: string; + vfcInstanceGroups: VfcInstanceGroupMap; + isEcompGeneratedNaming: boolean; + constructor(nodeJson?: Level1ModelResponseInterface) { + super(nodeJson); + if (nodeJson) { + this.serviceType = nodeJson.serviceType; + this.serviceRole = nodeJson.serviceRole; + this.subCategory = nodeJson.subCategory; + this.customizationUuid = nodeJson.customizationUuid; + this.isEcompGeneratedNaming = this.getIsEcompGeneratedNaming(nodeJson); + this.type = nodeJson.type; + this.modelCustomizationName = nodeJson.modelCustomizationName; + this.vfcInstanceGroups = nodeJson.vfcInstanceGroups; + this.max = 1; + this.min = 0; + if (nodeJson.properties) { + this.min = nodeJson.properties.min_instances || 0; + this.max = nodeJson.properties.max_instances || 1; + } + + + } + } + private getIsEcompGeneratedNaming(vnfJson) { + const ecompGeneratedNaming = vnfJson.properties.ecomp_generated_naming; + return ecompGeneratedNaming === "true"; + }; +} -- cgit 1.2.3-korg