summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/models/vnfModel.ts
blob: e1302f1d04fd058a8e5207cd06756c61c5ebe4bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import {NodeModel, NodeModelResponseInterface} from "./nodeModel";
import {VfcInstanceGroupMap} from "./vfcInstanceGroupMap";


export interface VnfProperties {
  ecomp_generated_naming: string
}

export interface VNFModelResponseInterface extends NodeModelResponseInterface{

  serviceType: string;
  serviceRole: string;
  subCategory: string;
  customizationUuid: string;
  serviceEcompNaming: boolean;
  type: string;
  modelCustomizationName: string;
  properties: VnfProperties;
  vfcInstanceGroups: VfcInstanceGroupMap;
}

export class VNFModel extends NodeModel{

  serviceType: string;
  serviceRole: string;
  subCategory: string;
  customizationUuid: string;
  isUserProvidedNaming: boolean;
  type: string;
  modelCustomizationName: string;
  vfcInstanceGroups: VfcInstanceGroupMap;

  constructor(vnfJson?: VNFModelResponseInterface){
    super(vnfJson);
    if (vnfJson) {
      this.serviceType = vnfJson.serviceType;
      this.serviceRole = vnfJson.serviceRole;
      this.subCategory = vnfJson.subCategory;
      this.customizationUuid = vnfJson.customizationUuid;
      this.isUserProvidedNaming = this.getIsUserProvidedName(vnfJson);
      this.type = vnfJson.type;
      this.modelCustomizationName = vnfJson.modelCustomizationName;
      this.vfcInstanceGroups = vnfJson.vfcInstanceGroups;

    }
  }

  private getIsUserProvidedName(vnfJson) {
    const ecompGeneratedNaming = vnfJson.properties.ecomp_generated_naming;
    return ecompGeneratedNaming !== undefined && ecompGeneratedNaming === "false";
  };
}