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 NeutronSFCPortPair extends NeutronBaseAttributes<NeutronSFCPortPair> implements Serializable {
24 private static final long serialVersionUID = 1L;
26 // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
27 // for description of annotated attributes
28 @XmlElement(name = "ingress")
29 String ingressPortUUID;
31 @XmlElement(name = "egress")
32 String egressPortUUID;
34 @XmlElement(name = "service_function_parameters")
35 @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
36 Map<String, String> serviceFunctionParameters;
38 public NeutronSFCPortPair() {
41 public String getIngressPortUUID() {
42 return ingressPortUUID;
45 public void setIngressPortUUID(String ingressPortUUID) {
46 this.ingressPortUUID = ingressPortUUID;
49 public String getEgressPortUUID() {
50 return egressPortUUID;
53 public void setEgressPortUUID(String egressPortUUID) {
54 this.egressPortUUID = egressPortUUID;
57 public Map<String, String> getServiceFunctionParameters() {
58 return serviceFunctionParameters;
61 public void setServiceFunctionParameters(Map<String, String> serviceFunctionParameters) {
62 this.serviceFunctionParameters = serviceFunctionParameters;
66 * This method copies selected fields from the object and returns them
67 * as a new object, suitable for marshaling.
69 * @param fields List of attributes to be extracted
70 * @return an OpenStack Neutron SFC Port Pair object with only the selected fields
74 public NeutronSFCPortPair extractFields(List<String> fields) {
75 NeutronSFCPortPair ans = new NeutronSFCPortPair();
76 for (String s : fields) {
78 if (s.equals("ingress")) {
79 ans.setIngressPortUUID(this.getIngressPortUUID());
81 if (s.equals("egress")) {
82 ans.setEgressPortUUID(this.getEgressPortUUID());
84 if (s.equals("service_function_parameters")) {
85 ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
92 public String toString() {
93 return "NeutronSFCPortPair[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\'' + ", ingressPortUUID='"
94 + ingressPortUUID + '\'' + ", egressPortUUID='" + egressPortUUID + '\'' + ", serviceFunctionParameters="
95 + serviceFunctionParameters + ']';