Merge "Fix most sonar issues"
[vfc/nfvo/driver/vnfm/svnfm.git] / nokiav2 / driver / src / main / java / org / onap / vfc / nfvo / driver / vnfm / svnfm / nokia / vnfm / AdditionalParameters.java
1 /*
2  * Copyright 2016-2017, Nokia Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
17
18 import com.nokia.cbam.lcm.v32.model.*;
19 import com.nokia.cbam.lcm.v32.model.VimInfo.VimInfoTypeEnum;
20
21 import java.util.*;
22
23 /**
24  * Represents the additional parameters to be sent during instantiation from VF-C to the driver
25  */
26 public class AdditionalParameters {
27     private VimInfoTypeEnum vimType;
28     private String domain;
29     private String instantiationLevel;
30     private List<VimComputeResourceFlavour> computeResourceFlavours = new ArrayList<>();
31     private List<ZoneInfo> zones = new ArrayList<>();
32     private List<VimSoftwareImage> softwareImages = new ArrayList<>();
33     private List<ExtManagedVirtualLinkData> extManagedVirtualLinks = new ArrayList<>();
34     private Map<String, List<NetworkAddress>> externalConnectionPointAddresses = new HashMap<>();
35     private List<ExtVirtualLinkData> extVirtualLinks = new ArrayList<>();
36     private Object additionalParams;
37
38     AdditionalParameters() {
39         //only used through reflection (gson)
40     }
41
42     /**
43      * @return the additional parameters of the instantiation
44      */
45     public Object getAdditionalParams() {
46         return additionalParams;
47     }
48
49     /**
50      * @param additionalParams the additional parameters of the instantiation
51      */
52     public void setAdditionalParams(Object additionalParams) {
53         this.additionalParams = additionalParams;
54     }
55
56     /**
57      * @return the type of the VIM
58      */
59     public VimInfoTypeEnum getVimType() {
60         return vimType;
61     }
62
63     /**
64      * @param vimType the type of the VIM
65      */
66     public void setVimType(VimInfoTypeEnum vimType) {
67         this.vimType = vimType;
68     }
69
70     /**
71      * @return the domain of the OpenStack (required for v3 API)
72      */
73     public String getDomain() {
74         return domain;
75     }
76
77     /**
78      * @param domain the domain of the OpenStack (required for v3 API)
79      */
80     public void setDomain(String domain) {
81         this.domain = domain;
82     }
83
84     /**
85      * @return the flavours to be used for the VNF
86      */
87     public List<VimComputeResourceFlavour> getComputeResourceFlavours() {
88         return computeResourceFlavours;
89     }
90
91     /**
92      * @param computeResourceFlavours the flavours to be used for the VNF
93      */
94     public void setComputeResourceFlavours(List<VimComputeResourceFlavour> computeResourceFlavours) {
95         this.computeResourceFlavours = computeResourceFlavours;
96     }
97
98     /**
99      * @return the images to be used
100      */
101     public List<VimSoftwareImage> getSoftwareImages() {
102         return softwareImages;
103     }
104
105     /**
106      * @param softwareImages the images to be used
107      */
108     public void setSoftwareImages(List<VimSoftwareImage> softwareImages) {
109         this.softwareImages = softwareImages;
110     }
111
112     /**
113      * @return the zones to be used for the VNF
114      */
115     public List<ZoneInfo> getZones() {
116         return zones;
117     }
118
119     /**
120      * @param zones the zones to be used for the VNF
121      */
122     public void setZones(List<ZoneInfo> zones) {
123         this.zones = zones;
124     }
125
126     /**
127      * @return the instantiation level of the VNF
128      */
129     public String getInstantiationLevel() {
130         return instantiationLevel;
131     }
132
133     /**
134      * @param instantiationLevel the instantiation level of the VNF
135      */
136     public void setInstantiationLevel(String instantiationLevel) {
137         this.instantiationLevel = instantiationLevel;
138     }
139
140     /**
141      * @return the externally managed internal virtual links
142      */
143     public List<ExtManagedVirtualLinkData> getExtManagedVirtualLinks() {
144         return extManagedVirtualLinks;
145     }
146
147     /**
148      * @param extManagedVirtualLinks the externally managed internal virtual links
149      */
150     public void setExtManagedVirtualLinks(List<ExtManagedVirtualLinkData> extManagedVirtualLinks) {
151         this.extManagedVirtualLinks = extManagedVirtualLinks;
152     }
153
154     /**
155      * @return a binding of the extenal connection points by identifier to it's network addresses to be used
156      */
157     public Map<String, List<NetworkAddress>> getExternalConnectionPointAddresses() {
158         return externalConnectionPointAddresses;
159     }
160
161     /**
162      * @param externalConnectionPointAddresses a binding of the extenal connection points by identifier to it's network addresses to be used
163      */
164     public void setExternalConnectionPointAddresses(Map<String, List<NetworkAddress>> externalConnectionPointAddresses) {
165         this.externalConnectionPointAddresses = externalConnectionPointAddresses;
166     }
167
168     public List<ExtVirtualLinkData> getExtVirtualLinks() {
169         return extVirtualLinks;
170     }
171
172     public void setExtVirtualLinks(List<ExtVirtualLinkData> extVirtualLinks) {
173         this.extVirtualLinks = extVirtualLinks;
174     }
175
176     @Override
177     //generated code. This is the recommended way to formulate equals
178     @SuppressWarnings({"squid:S00122", "squid:S1067"})
179     public boolean equals(Object o) {
180         if (this == o) return true;
181         if (o == null || getClass() != o.getClass()) return false;
182         AdditionalParameters that = (AdditionalParameters) o;
183         return vimType == that.vimType &&
184                 Objects.equals(domain, that.domain) &&
185                 Objects.equals(instantiationLevel, that.instantiationLevel) &&
186                 Objects.equals(computeResourceFlavours, that.computeResourceFlavours) &&
187                 Objects.equals(zones, that.zones) &&
188                 Objects.equals(softwareImages, that.softwareImages) &&
189                 Objects.equals(extManagedVirtualLinks, that.extManagedVirtualLinks) &&
190                 Objects.equals(externalConnectionPointAddresses, that.externalConnectionPointAddresses) &&
191                 Objects.equals(extVirtualLinks, that.extVirtualLinks) &&
192                 Objects.equals(additionalParams, that.additionalParams);
193     }
194
195     @Override
196     public int hashCode() {
197
198         return Objects.hash(vimType, domain, instantiationLevel, computeResourceFlavours, zones, softwareImages, extManagedVirtualLinks, externalConnectionPointAddresses, extVirtualLinks, additionalParams);
199     }
200
201     @Override
202     public String toString() {
203         return "AdditionalParameters{" +
204                 "vimType=" + vimType +
205                 ", domain='" + domain + '\'' +
206                 ", instantiationLevel='" + instantiationLevel + '\'' +
207                 ", computeResourceFlavours=" + computeResourceFlavours +
208                 ", zones=" + zones +
209                 ", softwareImages=" + softwareImages +
210                 ", extManagedVirtualLinks=" + extManagedVirtualLinks +
211                 ", externalConnectionPointAddresses=" + externalConnectionPointAddresses +
212                 ", extVirtualLinks=" + extVirtualLinks +
213                 ", additionalParams=" + additionalParams +
214                 '}';
215     }
216 }