Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCFlowClassifier.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.neutron.spi;
9
10 import java.util.HashMap;
11 import java.util.Map;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
17
18 @XmlRootElement
19 @XmlAccessorType(XmlAccessType.NONE)
20 public final class NeutronSFCFlowClassifier extends NeutronBaseAttributes<NeutronSFCFlowClassifier> {
21     private static final long serialVersionUID = 1L;
22
23     // See OpenStack Networking SFC (networking-sfc) API v1.0 Reference for description of
24     // annotated attributes
25     @XmlElement(defaultValue = "IPv4", name = "ethertype")
26     String ethertype;
27
28     @XmlElement(name = "protocol")
29     String protocol;
30
31     @XmlElement(name = "source_port_range_min")
32     Integer sourcePortRangeMin;
33
34     @XmlElement(name = "source_port_range_max")
35     Integer sourcePortRangeMax;
36
37     @XmlElement(name = "destination_port_range_min")
38     Integer destinationPortRangeMin;
39
40     @XmlElement(name = "destination_port_range_max")
41     Integer destinationPortRangeMax;
42
43     @XmlElement(name = "source_ip_prefix")
44     String sourceIpPrefix;
45
46     @XmlElement(name = "destination_ip_prefix")
47     String destinationIpPrefix;
48
49     @XmlElement(name = "logical_source_port")
50     String logicalSourcePortUUID;
51
52     @XmlElement(name = "logical_destination_port")
53     String logicalDestinationPortUUID;
54
55     @XmlElement(name = "l7_parameters")
56     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
57     Map<String, String> l7Parameters;
58
59     public NeutronSFCFlowClassifier() {
60     }
61
62     public String getEthertype() {
63         return ethertype;
64     }
65
66     public void setEthertype(String ethertype) {
67         this.ethertype = ethertype;
68     }
69
70     public String getProtocol() {
71         return protocol;
72     }
73
74     public void setProtocol(String protocol) {
75         this.protocol = protocol;
76     }
77
78     public Integer getSourcePortRangeMin() {
79         return sourcePortRangeMin;
80     }
81
82     public void setSourcePortRangeMin(Integer sourcePortRangeMin) {
83         this.sourcePortRangeMin = sourcePortRangeMin;
84     }
85
86     public Integer getSourcePortRangeMax() {
87         return sourcePortRangeMax;
88     }
89
90     public void setSourcePortRangeMax(Integer sourcePortRangeMax) {
91         this.sourcePortRangeMax = sourcePortRangeMax;
92     }
93
94     public Integer getDestinationPortRangeMin() {
95         return destinationPortRangeMin;
96     }
97
98     public void setDestinationPortRangeMin(Integer destinationPortRangeMin) {
99         this.destinationPortRangeMin = destinationPortRangeMin;
100     }
101
102     public Integer getDestinationPortRangeMax() {
103         return destinationPortRangeMax;
104     }
105
106     public void setDestinationPortRangeMax(Integer destinationPortRangeMax) {
107         this.destinationPortRangeMax = destinationPortRangeMax;
108     }
109
110     public String getSourceIpPrefix() {
111         return sourceIpPrefix;
112     }
113
114     public void setSourceIpPrefix(String sourceIpPrefix) {
115         this.sourceIpPrefix = sourceIpPrefix;
116     }
117
118     public String getLogicalSourcePortUUID() {
119         return logicalSourcePortUUID;
120     }
121
122     public void setLogicalSourcePortUUID(String logicalSourcePortUUID) {
123         this.logicalSourcePortUUID = logicalSourcePortUUID;
124     }
125
126     public String getDestinationIpPrefix() {
127         return destinationIpPrefix;
128     }
129
130     public void setDestinationIpPrefix(String destinationIpPrefix) {
131         this.destinationIpPrefix = destinationIpPrefix;
132     }
133
134     public String getLogicalDestinationPortUUID() {
135         return logicalDestinationPortUUID;
136     }
137
138     public void setLogicalDestinationPortUUID(String logicalDestinationPortUUID) {
139         this.logicalDestinationPortUUID = logicalDestinationPortUUID;
140     }
141
142     public Map<String, String> getL7Parameters() {
143         return l7Parameters;
144     }
145
146     public void setL7Parameters(Map<String, String> l7Parameters) {
147         this.l7Parameters = l7Parameters;
148     }
149
150     @Override
151     protected boolean extractField(String field, NeutronSFCFlowClassifier ans) {
152         switch (field) {
153             case "ethertype":
154                 ans.setEthertype(this.getEthertype());
155                 break;
156             case "source_port_range_min":
157                 ans.setSourcePortRangeMin(this.getSourcePortRangeMin());
158                 break;
159             case "source_port_range_max":
160                 ans.setSourcePortRangeMax(this.getSourcePortRangeMax());
161                 break;
162             case "destination_port_range_min":
163                 ans.setDestinationPortRangeMin(this.getDestinationPortRangeMin());
164                 break;
165             case "destination_port_range_max":
166                 ans.setDestinationPortRangeMax(this.getDestinationPortRangeMax());
167                 break;
168             case "source_ip_prefix":
169                 ans.setSourceIpPrefix(this.getSourceIpPrefix());
170                 break;
171             case "destination_ip_prefix":
172                 ans.setDestinationIpPrefix(this.getDestinationIpPrefix());
173                 break;
174             case "logical_source_port":
175                 ans.setLogicalSourcePortUUID(this.getLogicalSourcePortUUID());
176                 break;
177             case "logical_destination_port":
178                 ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
179                 break;
180             case "l7_parameters":
181                 ans.setL7Parameters(new HashMap<>(this.getL7Parameters()));
182                 break;
183             default:
184                 return super.extractField(field, ans);
185         }
186         return true;
187     }
188
189     @Override
190     public String toString() {
191         return "NeutronSFCFlowClassifier[" + "name='" + name + '\'' + ", ethertype='" + ethertype + '\''
192                 + ", protocol='" + protocol + '\'' + ", sourcePortRangeMin=" + sourcePortRangeMin
193                 + ", sourcePortRangeMax=" + sourcePortRangeMax + ", destinationPortRangeMin=" + destinationPortRangeMin
194                 + ", destinationPortRangeMax=" + destinationPortRangeMax + ", sourceIpPrefix='" + sourceIpPrefix + '\''
195                 + ", destinationIpPrefix='" + destinationIpPrefix + '\'' + ", logicalSourcePortUUID='"
196                 + logicalSourcePortUUID + '\'' + ", logicalDestinationPortUUID='" + logicalDestinationPortUUID + '\''
197                 + ", l7Parameters=" + l7Parameters + ']';
198     }
199 }