2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.bpmn.core.domain;
\r
23 import java.util.ArrayList;
\r
24 import java.util.List;
\r
25 import java.util.UUID;
\r
27 import com.fasterxml.jackson.annotation.JsonIgnore;
\r
28 import com.fasterxml.jackson.annotation.JsonProperty;
\r
29 import com.fasterxml.jackson.annotation.JsonRootName;
\r
32 * Encapsulates VNF resource data set
\r
35 @JsonRootName("vnfResource")
\r
36 public class VnfResource extends Resource {
\r
38 private static final long serialVersionUID = 1L;
\r
41 * set resourceType for this object
\r
43 public VnfResource(){
\r
44 resourceType = ResourceType.VNF;
\r
45 setResourceId(UUID.randomUUID().toString());
\r
49 * fields specific to VNF resource type
\r
51 @JsonProperty("vfModules")
\r
52 private List <ModuleResource> vfModules;
\r
53 private String vnfHostname;
\r
54 private String vnfType;
\r
55 private String nfFunction;
\r
56 private String nfType;
\r
57 private String nfRole;
\r
58 private String nfNamingCode;
\r
59 private String multiStageDesign;
\r
64 public List<ModuleResource> getVfModules() {
\r
67 public void setModules(List<ModuleResource> moduleResources) {
\r
68 this.vfModules = moduleResources;
\r
70 public String getVnfHostname() {
\r
73 public void setVnfHostname(String vnfHostname) {
\r
74 this.vnfHostname = vnfHostname;
\r
77 public void setVnfType(String vnfType) {
\r
78 this.vnfType = vnfType;
\r
80 public String getVnfType() {
\r
83 public String getNfFunction() {
\r
86 public void setNfFunction(String nfFunction) {
\r
87 this.nfFunction = nfFunction;
\r
89 public String getNfType() {
\r
92 public void setNfType(String nfType) {
\r
93 this.nfType = nfType;
\r
95 public String getNfRole() {
\r
98 public void setNfRole(String nfRole) {
\r
99 this.nfRole = nfRole;
\r
101 public String getNfNamingCode() {
\r
102 return nfNamingCode;
\r
104 public void setNfNamingCode(String nfNamingCode) {
\r
105 this.nfNamingCode = nfNamingCode;
\r
107 public String getMultiStageDesign() {
\r
108 return multiStageDesign;
\r
110 public void setMultiStageDesign(String multiStageDesign) {
\r
111 this.multiStageDesign = multiStageDesign;
\r
114 * GET accessors per design requirements
\r
118 * Returns a list of all VfModule objects.
\r
119 * Base module is first entry in the list
\r
120 * @return ordered list of ModuleResources objects
\r
123 public List<ModuleResource> getAllVfModuleObjects(){
\r
124 if (vfModules == null) {
\r
128 for (int i = 0; i < vfModules.size(); i++) {
\r
129 ModuleResource moduleResource = vfModules.get(i);
\r
130 if (moduleResource.getIsBase()){
\r
131 vfModules.remove(moduleResource);
\r
132 vfModules.add(0,moduleResource);
\r
140 * @return Returns JSON list of all VfModule structures.
\r
143 public String getAllVfModulesJson(){
\r
145 return listToJson(vfModules);
\r
148 // methods to add to the list
\r
149 public void addVfModule(ModuleResource moduleResource) {
\r
150 if (vfModules == null){
\r
151 vfModules = new ArrayList<>();
\r
153 this.vfModules.add(moduleResource);
\r
158 * Utility method to allow construction of the filed in the form of
\r
159 * <serviceResources.modelInfo.modelName>/<serviceVnfs.modelInfo.modelInstanceName>
\r
161 * default setter for this field deprecated
\r
162 * @param modelName << serviceResources.modelInfo.modelName
\r
164 public void constructVnfType(String modelName) {
\r
165 this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName());
\r