2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.core.domain;
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.UUID;
27 import com.fasterxml.jackson.annotation.JsonIgnore;
28 import com.fasterxml.jackson.annotation.JsonProperty;
29 import com.fasterxml.jackson.annotation.JsonRootName;
32 * Encapsulates VNF resource data set
35 @JsonRootName("vnfResource")
36 public class VnfResource extends Resource {
38 private static final long serialVersionUID = 1L;
41 * set resourceType for this object
44 resourceType = ResourceType.VNF;
45 setResourceId(UUID.randomUUID().toString());
49 * fields specific to VNF resource type
51 @JsonProperty("vfModules")
52 private List <ModuleResource> vfModules;
53 private String vnfHostname;
54 private String vnfType;
55 private String nfFunction;
56 private String nfType;
57 private String nfRole;
58 private String nfNamingCode;
59 private String multiStageDesign;
60 private String orchestrationStatus;
65 public List<ModuleResource> getVfModules() {
68 public void setModules(List<ModuleResource> moduleResources) {
69 this.vfModules = moduleResources;
71 public String getVnfHostname() {
74 public void setVnfHostname(String vnfHostname) {
75 this.vnfHostname = vnfHostname;
78 public void setVnfType(String vnfType) {
79 this.vnfType = vnfType;
81 public String getVnfType() {
84 public String getNfFunction() {
87 public void setNfFunction(String nfFunction) {
88 this.nfFunction = nfFunction;
90 public String getNfType() {
93 public void setNfType(String nfType) {
96 public String getNfRole() {
99 public void setNfRole(String nfRole) {
100 this.nfRole = nfRole;
102 public String getNfNamingCode() {
105 public void setNfNamingCode(String nfNamingCode) {
106 this.nfNamingCode = nfNamingCode;
108 public String getMultiStageDesign() {
109 return multiStageDesign;
111 public void setMultiStageDesign(String multiStageDesign) {
112 this.multiStageDesign = multiStageDesign;
115 * GET accessors per design requirements
119 public String getOrchestrationStatus(){
120 return orchestrationStatus;
123 public void setOrchestrationStatus(String orchestrationStatus){
124 this.orchestrationStatus = orchestrationStatus;
127 * Returns a list of all VfModule objects.
128 * Base module is first entry in the list
129 * @return ordered list of ModuleResources objects
132 public List<ModuleResource> getAllVfModuleObjects(){
133 if (vfModules == null) {
137 for (int i = 0; i < vfModules.size(); i++) {
138 ModuleResource moduleResource = vfModules.get(i);
139 if (moduleResource.getIsBase()){
140 vfModules.remove(moduleResource);
141 vfModules.add(0,moduleResource);
149 * @return Returns JSON list of all VfModule structures.
152 public String getAllVfModulesJson(){
154 return listToJson(vfModules);
157 // methods to add to the list
158 public void addVfModule(ModuleResource moduleResource) {
159 if (vfModules == null){
160 vfModules = new ArrayList<>();
162 this.vfModules.add(moduleResource);
167 * Utility method to allow construction of the filed in the form of
168 * <serviceResources.modelInfo.modelName>/<serviceVnfs.modelInfo.modelInstanceName>
170 * default setter for this field deprecated
171 * @param modelName << serviceResources.modelInfo.modelName
173 public void constructVnfType(String modelName) {
174 this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName());