diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/models/nodeModel.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/models/nodeModel.ts | 66 |
1 files changed, 65 insertions, 1 deletions
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"; + }; +} |