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.Iterator;
13 import java.util.List;
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlElement;
18 import javax.xml.bind.annotation.XmlRootElement;
19 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
22 @XmlAccessorType(XmlAccessType.NONE)
24 public class NeutronSFCFlowClassifier extends NeutronObject implements Serializable, INeutronObject {
25 private static final long serialVersionUID = 1L;
27 // See OpenStack Networking SFC (networking-sfc) API v1.0 Reference for description of
28 // annotated attributes
29 @XmlElement(name = "name")
32 @XmlElement(defaultValue = "IPv4", name = "ethertype")
35 @XmlElement(name = "protocol")
38 @XmlElement(name = "source_port_range_min")
39 Integer sourcePortRangeMin;
41 @XmlElement(name = "source_port_range_max")
42 Integer sourcePortRangeMax;
44 @XmlElement(name = "destination_port_range_min")
45 Integer destinationPortRangeMin;
47 @XmlElement(name = "destination_port_range_max")
48 Integer destinationPortRangeMax;
50 @XmlElement(name = "source_ip_prefix")
51 String sourceIpPrefix;
53 @XmlElement(name = "destination_ip_prefix")
54 String destinationIpPrefix;
56 @XmlElement(name = "logical_source_port")
57 String logicalSourcePortUUID;
59 @XmlElement(name = "logical_destination_port")
60 String logicalDestinationPortUUID;
62 @XmlElement(name = "l7_parameters")
63 @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
64 Map<String, String> l7Parameters;
66 public NeutronSFCFlowClassifier() {
69 public String getName() {
73 public void setName(String name) {
77 public String getEthertype() {
81 public void setEthertype(String ethertype) {
82 this.ethertype = ethertype;
85 public String getProtocol() {
89 public void setProtocol(String protocol) {
90 this.protocol = protocol;
93 public Integer getSourcePortRangeMin() {
94 return sourcePortRangeMin;
97 public void setSourcePortRangeMin(Integer sourcePortRangeMin) {
98 this.sourcePortRangeMin = sourcePortRangeMin;
101 public Integer getSourcePortRangeMax() {
102 return sourcePortRangeMax;
105 public void setSourcePortRangeMax(Integer sourcePortRangeMax) {
106 this.sourcePortRangeMax = sourcePortRangeMax;
109 public Integer getDestinationPortRangeMin() {
110 return destinationPortRangeMin;
113 public void setDestinationPortRangeMin(Integer destinationPortRangeMin) {
114 this.destinationPortRangeMin = destinationPortRangeMin;
117 public Integer getDestinationPortRangeMax() {
118 return destinationPortRangeMax;
121 public void setDestinationPortRangeMax(Integer destinationPortRangeMax) {
122 this.destinationPortRangeMax = destinationPortRangeMax;
125 public String getSourceIpPrefix() {
126 return sourceIpPrefix;
129 public void setSourceIpPrefix(String sourceIpPrefix) {
130 this.sourceIpPrefix = sourceIpPrefix;
133 public String getLogicalSourcePortUUID() {
134 return logicalSourcePortUUID;
137 public void setLogicalSourcePortUUID(String logicalSourcePortUUID) {
138 this.logicalSourcePortUUID = logicalSourcePortUUID;
141 public String getDestinationIpPrefix() {
142 return destinationIpPrefix;
145 public void setDestinationIpPrefix(String destinationIpPrefix) {
146 this.destinationIpPrefix = destinationIpPrefix;
149 public String getLogicalDestinationPortUUID() {
150 return logicalDestinationPortUUID;
153 public void setLogicalDestinationPortUUID(String logicalDestinationPortUUID) {
154 this.logicalDestinationPortUUID = logicalDestinationPortUUID;
157 public Map<String, String> getL7Parameters() {
161 public void setL7Parameters(Map<String, String> l7Parameters) {
162 this.l7Parameters = l7Parameters;
166 * This method copies selected fields from the object and returns them
167 * as a new object, suitable for marshaling.
169 * @param fields List of attributes to be extracted
170 * @return an OpenStack NeutronSFCFlowClassifier object with only the selected fields
174 public NeutronSFCFlowClassifier extractFields(List<String> fields) {
175 NeutronSFCFlowClassifier ans = new NeutronSFCFlowClassifier();
176 Iterator<String> i = fields.iterator();
177 while (i.hasNext()) {
179 if (s.equals("id")) {
180 ans.setID(this.getID());
182 if (s.equals("tenant_id")) {
183 ans.setTenantID(this.getTenantID());
185 if (s.equals("name")) {
186 ans.setName(this.getName());
188 if (s.equals("ethertype")) {
189 ans.setEthertype(this.getEthertype());
191 if (s.equals("source_port_range_min")) {
192 ans.setSourcePortRangeMin(this.getSourcePortRangeMin());
194 if (s.equals("source_port_range_max")) {
195 ans.setSourcePortRangeMax(this.getSourcePortRangeMax());
197 if (s.equals("destination_port_range_min")) {
198 ans.setDestinationPortRangeMin(this.getDestinationPortRangeMin());
200 if (s.equals("destination_port_range_max")) {
201 ans.setDestinationPortRangeMax(this.getDestinationPortRangeMax());
203 if (s.equals("source_ip_prefix")) {
204 ans.setSourceIpPrefix(this.getSourceIpPrefix());
206 if (s.equals("destination_ip_prefix")) {
207 ans.setDestinationIpPrefix(this.getDestinationIpPrefix());
209 if (s.equals("logical_source_port")) {
210 ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
212 if (s.equals("logical_destination_port")) {
213 ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
215 if (s.equals("l7_parameters")) {
216 ans.setL7Parameters(new HashMap<String, String>(this.getL7Parameters()));
223 public String toString() {
224 return "NeutronSFCFlowClassifier[" +
225 "name='" + name + '\'' +
226 ", ethertype='" + ethertype + '\'' +
227 ", protocol='" + protocol + '\'' +
228 ", sourcePortRangeMin=" + sourcePortRangeMin +
229 ", sourcePortRangeMax=" + sourcePortRangeMax +
230 ", destinationPortRangeMin=" + destinationPortRangeMin +
231 ", destinationPortRangeMax=" + destinationPortRangeMax +
232 ", sourceIpPrefix='" + sourceIpPrefix + '\'' +
233 ", destinationIpPrefix='" + destinationIpPrefix + '\'' +
234 ", logicalSourcePortUUID='" + logicalSourcePortUUID + '\'' +
235 ", logicalDestinationPortUUID='" + logicalDestinationPortUUID + '\'' +
236 ", l7Parameters=" + l7Parameters +