blob: ee57ec0384d0ac96e064bd641af10914dac41c25 [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001import {VfcInstanceGroupMap} from "./vfcInstanceGroupMap";
2
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03003export interface NodeModelResponseInterface {
Ittay Stern6f900cc2018-08-29 17:01:32 +03004 customizationUuid: string;
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03005 name: string;
6 version: string;
7 description: string;
8 category: string;
9 uuid: string;
10 invariantUuid: string;
Ittay Stern6f900cc2018-08-29 17:01:32 +030011 max: number;
12 min:number;
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030013}
Ittay Stern6f900cc2018-08-29 17:01:32 +030014export interface Level1ModelResponseInterface extends NodeModelResponseInterface{
15 serviceType: string;
16 serviceRole: string;
17 subCategory: string;
18 customizationUuid: string;
19 serviceEcompNaming: boolean;
20 type: string;
21 modelCustomizationName: string;
22 vfcInstanceGroups: VfcInstanceGroupMap;
23 properties: Level1ModelProperties;
24}
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030025export class NodeModel {
26 name: string;
27 version: string;
28 description: string;
29 category: string;
30 uuid: string;
31 invariantUuid: string;
Ittay Stern6f900cc2018-08-29 17:01:32 +030032 max: number;
33 min: number;
34 customizationUuid?: string;
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030035
36 constructor(serviceJson?: NodeModelResponseInterface) {
37 if (serviceJson) {
Ittay Stern6f900cc2018-08-29 17:01:32 +030038 this.customizationUuid = serviceJson.customizationUuid;
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030039 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;
Ittay Stern6f900cc2018-08-29 17:01:32 +030045 this.max = serviceJson.max;
46 this.min = serviceJson.min;
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030047 }
48 }
49
50}
Ittay Stern6f900cc2018-08-29 17:01:32 +030051export class Level1ModelProperties {
52 max_instances : number;
53 min_instances : number;
54}
55
56
57
58export class Level1Model extends NodeModel{
59 serviceType: string;
60 serviceRole: string;
61 subCategory: string;
62 customizationUuid: string;
63 serviceEcompNaming: boolean;
64 type: string;
65 modelCustomizationName: string;
66 vfcInstanceGroups: VfcInstanceGroupMap;
67 isEcompGeneratedNaming: boolean;
68 constructor(nodeJson?: Level1ModelResponseInterface) {
69 super(nodeJson);
70 if (nodeJson) {
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;
79 this.max = 1;
80 this.min = 0;
81 if (nodeJson.properties) {
82 this.min = nodeJson.properties.min_instances || 0;
83 this.max = nodeJson.properties.max_instances || 1;
84 }
85
86
87 }
88 }
89 private getIsEcompGeneratedNaming(vnfJson) {
90 const ecompGeneratedNaming = vnfJson.properties.ecomp_generated_naming;
91 return ecompGeneratedNaming === "true";
92 };
93}