2 * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.neutron.spi;
10 import java.io.Serializable;
11 import java.util.HashMap;
12 import java.util.List;
14 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElement;
17 import javax.xml.bind.annotation.XmlRootElement;
18 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
21 @XmlAccessorType(XmlAccessType.NONE)
22 public final class NeutronSFCFlowClassifier extends NeutronBaseAttributes<NeutronSFCFlowClassifier>
23 implements Serializable {
24 private static final long serialVersionUID = 1L;
26 // See OpenStack Networking SFC (networking-sfc) API v1.0 Reference for description of
27 // annotated attributes
28 @XmlElement(defaultValue = "IPv4", name = "ethertype")
31 @XmlElement(name = "protocol")
34 @XmlElement(name = "source_port_range_min")
35 Integer sourcePortRangeMin;
37 @XmlElement(name = "source_port_range_max")
38 Integer sourcePortRangeMax;
40 @XmlElement(name = "destination_port_range_min")
41 Integer destinationPortRangeMin;
43 @XmlElement(name = "destination_port_range_max")
44 Integer destinationPortRangeMax;
46 @XmlElement(name = "source_ip_prefix")
47 String sourceIpPrefix;
49 @XmlElement(name = "destination_ip_prefix")
50 String destinationIpPrefix;
52 @XmlElement(name = "logical_source_port")
53 String logicalSourcePortUUID;
55 @XmlElement(name = "logical_destination_port")
56 String logicalDestinationPortUUID;
58 @XmlElement(name = "l7_parameters")
59 @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
60 Map<String, String> l7Parameters;
62 public NeutronSFCFlowClassifier() {
65 public String getEthertype() {
69 public void setEthertype(String ethertype) {
70 this.ethertype = ethertype;
73 public String getProtocol() {
77 public void setProtocol(String protocol) {
78 this.protocol = protocol;
81 public Integer getSourcePortRangeMin() {
82 return sourcePortRangeMin;
85 public void setSourcePortRangeMin(Integer sourcePortRangeMin) {
86 this.sourcePortRangeMin = sourcePortRangeMin;
89 public Integer getSourcePortRangeMax() {
90 return sourcePortRangeMax;
93 public void setSourcePortRangeMax(Integer sourcePortRangeMax) {
94 this.sourcePortRangeMax = sourcePortRangeMax;
97 public Integer getDestinationPortRangeMin() {
98 return destinationPortRangeMin;
101 public void setDestinationPortRangeMin(Integer destinationPortRangeMin) {
102 this.destinationPortRangeMin = destinationPortRangeMin;
105 public Integer getDestinationPortRangeMax() {
106 return destinationPortRangeMax;
109 public void setDestinationPortRangeMax(Integer destinationPortRangeMax) {
110 this.destinationPortRangeMax = destinationPortRangeMax;
113 public String getSourceIpPrefix() {
114 return sourceIpPrefix;
117 public void setSourceIpPrefix(String sourceIpPrefix) {
118 this.sourceIpPrefix = sourceIpPrefix;
121 public String getLogicalSourcePortUUID() {
122 return logicalSourcePortUUID;
125 public void setLogicalSourcePortUUID(String logicalSourcePortUUID) {
126 this.logicalSourcePortUUID = logicalSourcePortUUID;
129 public String getDestinationIpPrefix() {
130 return destinationIpPrefix;
133 public void setDestinationIpPrefix(String destinationIpPrefix) {
134 this.destinationIpPrefix = destinationIpPrefix;
137 public String getLogicalDestinationPortUUID() {
138 return logicalDestinationPortUUID;
141 public void setLogicalDestinationPortUUID(String logicalDestinationPortUUID) {
142 this.logicalDestinationPortUUID = logicalDestinationPortUUID;
145 public Map<String, String> getL7Parameters() {
149 public void setL7Parameters(Map<String, String> l7Parameters) {
150 this.l7Parameters = l7Parameters;
154 * This method copies selected fields from the object and returns them
155 * as a new object, suitable for marshaling.
157 * @param fields List of attributes to be extracted
158 * @return an OpenStack NeutronSFCFlowClassifier object with only the selected fields
162 public NeutronSFCFlowClassifier extractFields(List<String> fields) {
163 NeutronSFCFlowClassifier ans = new NeutronSFCFlowClassifier();
164 for (String s : fields) {
165 extractField(s, ans);
166 if (s.equals("ethertype")) {
167 ans.setEthertype(this.getEthertype());
169 if (s.equals("source_port_range_min")) {
170 ans.setSourcePortRangeMin(this.getSourcePortRangeMin());
172 if (s.equals("source_port_range_max")) {
173 ans.setSourcePortRangeMax(this.getSourcePortRangeMax());
175 if (s.equals("destination_port_range_min")) {
176 ans.setDestinationPortRangeMin(this.getDestinationPortRangeMin());
178 if (s.equals("destination_port_range_max")) {
179 ans.setDestinationPortRangeMax(this.getDestinationPortRangeMax());
181 if (s.equals("source_ip_prefix")) {
182 ans.setSourceIpPrefix(this.getSourceIpPrefix());
184 if (s.equals("destination_ip_prefix")) {
185 ans.setDestinationIpPrefix(this.getDestinationIpPrefix());
187 if (s.equals("logical_source_port")) {
188 ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
190 if (s.equals("logical_destination_port")) {
191 ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
193 if (s.equals("l7_parameters")) {
194 ans.setL7Parameters(new HashMap<String, String>(this.getL7Parameters()));
201 public String toString() {
202 return "NeutronSFCFlowClassifier[" + "name='" + name + '\'' + ", ethertype='" + ethertype + '\''
203 + ", protocol='" + protocol + '\'' + ", sourcePortRangeMin=" + sourcePortRangeMin
204 + ", sourcePortRangeMax=" + sourcePortRangeMax + ", destinationPortRangeMin=" + destinationPortRangeMin
205 + ", destinationPortRangeMax=" + destinationPortRangeMax + ", sourceIpPrefix='" + sourceIpPrefix + '\''
206 + ", destinationIpPrefix='" + destinationIpPrefix + '\'' + ", logicalSourcePortUUID='"
207 + logicalSourcePortUUID + '\'' + ", logicalDestinationPortUUID='" + logicalDestinationPortUUID + '\''
208 + ", l7Parameters=" + l7Parameters + ']';