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.JsonIgnoreProperties;
29 import com.fasterxml.jackson.annotation.JsonProperty;
30 import com.fasterxml.jackson.annotation.JsonRootName;
33 * Encapsulates VNF resource data set
36 @JsonRootName("vnfResource")
37 public class VnfResource extends Resource {
39 private static final long serialVersionUID = 1L;
42 * set resourceType for this object
45 resourceType = ResourceType.VNF;
46 setResourceId(UUID.randomUUID().toString());
50 * fields specific to VNF resource type
52 @JsonProperty("vfModules")
53 private List <ModuleResource> vfModules;
54 private String vnfHostname;
55 private String vnfType;
56 private String nfFunction;
57 private String nfType;
58 private String nfRole;
59 private String nfNamingCode;
60 private String multiStageDesign;
61 private String orchestrationStatus;
64 private String resourceInput;
69 public List<ModuleResource> getVfModules() {
72 public void setModules(List<ModuleResource> moduleResources) {
73 this.vfModules = moduleResources;
75 public String getVnfHostname() {
78 public void setVnfHostname(String vnfHostname) {
79 this.vnfHostname = vnfHostname;
82 public void setVnfType(String vnfType) {
83 this.vnfType = vnfType;
85 public String getVnfType() {
88 public String getNfFunction() {
91 public void setNfFunction(String nfFunction) {
92 this.nfFunction = nfFunction;
94 public String getNfType() {
97 public void setNfType(String nfType) {
100 public String getNfRole() {
103 public void setNfRole(String nfRole) {
104 this.nfRole = nfRole;
106 public String getNfNamingCode() {
109 public void setNfNamingCode(String nfNamingCode) {
110 this.nfNamingCode = nfNamingCode;
112 public String getMultiStageDesign() {
113 return multiStageDesign;
115 public void setMultiStageDesign(String multiStageDesign) {
116 this.multiStageDesign = multiStageDesign;
119 * GET accessors per design requirements
123 public String getOrchestrationStatus(){
124 return orchestrationStatus;
127 public void setOrchestrationStatus(String orchestrationStatus){
128 this.orchestrationStatus = orchestrationStatus;
131 public String getResourceInput() {
132 return resourceInput;
135 public void setResourceInput(String resourceInput) {
136 this.resourceInput = resourceInput;
140 * Returns a list of all VfModule objects.
141 * Base module is first entry in the list
142 * @return ordered list of ModuleResources objects
145 public List<ModuleResource> getAllVfModuleObjects(){
146 if (vfModules == null) {
150 for (int i = 0; i < vfModules.size(); i++) {
151 ModuleResource moduleResource = vfModules.get(i);
152 if (moduleResource.getIsBase()){
153 vfModules.remove(moduleResource);
154 vfModules.add(0,moduleResource);
162 * @return Returns JSON list of all VfModule structures.
165 public String getAllVfModulesJson(){
167 return listToJson(vfModules);
170 // methods to add to the list
171 public void addVfModule(ModuleResource moduleResource) {
172 if (vfModules == null){
173 vfModules = new ArrayList<>();
175 this.vfModules.add(moduleResource);
180 * Utility method to allow construction of the filed in the form of
181 * <serviceResources.modelInfo.modelName>/<serviceVnfs.modelInfo.modelInstanceName>
183 * default setter for this field deprecated
184 * @param modelName << serviceResources.modelInfo.modelName
186 public void constructVnfType(String modelName) {
187 this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName());