1 import {VfcInstanceGroupMap} from "./vfcInstanceGroupMap";
3 export interface NodeModelResponseInterface {
4 customizationUuid: string;
10 invariantUuid: string;
14 export interface Level1ModelResponseInterface extends NodeModelResponseInterface{
18 customizationUuid: string;
19 serviceEcompNaming: boolean;
21 modelCustomizationName: string;
22 vfcInstanceGroups: VfcInstanceGroupMap;
23 properties: Level1ModelProperties;
25 export class NodeModel {
31 invariantUuid: string;
34 customizationUuid?: string;
36 constructor(serviceJson?: NodeModelResponseInterface) {
38 this.customizationUuid = serviceJson.customizationUuid;
39 this.name = serviceJson.name;
40 this.version = serviceJson.version;
41 this.description = serviceJson.description;
42 this.category = serviceJson.category;
43 this.uuid = serviceJson.uuid;
44 this.invariantUuid = serviceJson.invariantUuid;
45 this.max = serviceJson.max;
46 this.min = serviceJson.min;
51 export class Level1ModelProperties {
52 max_instances : number;
53 min_instances : number;
58 export class Level1Model extends NodeModel{
62 customizationUuid: string;
63 serviceEcompNaming: boolean;
65 modelCustomizationName: string;
66 vfcInstanceGroups: VfcInstanceGroupMap;
67 isEcompGeneratedNaming: boolean;
68 constructor(nodeJson?: Level1ModelResponseInterface) {
71 this.serviceType = nodeJson.serviceType;
72 this.serviceRole = nodeJson.serviceRole;
73 this.subCategory = nodeJson.subCategory;
74 this.customizationUuid = nodeJson.customizationUuid;
75 this.isEcompGeneratedNaming = this.getIsEcompGeneratedNaming(nodeJson);
76 this.type = nodeJson.type;
77 this.modelCustomizationName = nodeJson.modelCustomizationName;
78 this.vfcInstanceGroups = nodeJson.vfcInstanceGroups;
81 if (nodeJson.properties) {
82 this.min = nodeJson.properties.min_instances || 0;
83 this.max = nodeJson.properties.max_instances || 1;
89 private getIsEcompGeneratedNaming(vnfJson) {
90 let ecompGeneratedNaming;
91 if (vnfJson.properties) {
92 ecompGeneratedNaming = vnfJson.properties.ecomp_generated_naming;
94 return ecompGeneratedNaming === "true";