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)
23 public final class NeutronSFCPortPair extends NeutronObject<NeutronSFCPortPair>
24 implements Serializable, INeutronObject<NeutronSFCPortPair> {
26 private static final long serialVersionUID = 1L;
28 // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
29 // for description of annotated attributes
30 @XmlElement(name = "name")
33 @XmlElement(name = "ingress")
34 String ingressPortUUID;
36 @XmlElement(name = "egress")
37 String egressPortUUID;
39 @XmlElement(name = "service_function_parameters")
40 @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
41 Map<String, String> serviceFunctionParameters;
43 public NeutronSFCPortPair() {
46 public String getName() {
50 public void setName(String name) {
54 public String getIngressPortUUID() {
55 return ingressPortUUID;
58 public void setIngressPortUUID(String ingressPortUUID) {
59 this.ingressPortUUID = ingressPortUUID;
62 public String getEgressPortUUID() {
63 return egressPortUUID;
66 public void setEgressPortUUID(String egressPortUUID) {
67 this.egressPortUUID = egressPortUUID;
70 public Map<String, String> getServiceFunctionParameters() {
71 return serviceFunctionParameters;
74 public void setServiceFunctionParameters(Map<String, String> serviceFunctionParameters) {
75 this.serviceFunctionParameters = serviceFunctionParameters;
79 * This method copies selected fields from the object and returns them
80 * as a new object, suitable for marshaling.
82 * @param fields List of attributes to be extracted
83 * @return an OpenStack Neutron SFC Port Pair object with only the selected fields
87 public NeutronSFCPortPair extractFields(List<String> fields) {
88 NeutronSFCPortPair ans = new NeutronSFCPortPair();
89 Iterator<String> i = fields.iterator();
93 ans.setID(this.getID());
95 if (s.equals("tenant_id")) {
96 ans.setTenantID(this.getTenantID());
98 if (s.equals("name")) {
99 ans.setName(this.getName());
101 if (s.equals("ingress")) {
102 ans.setIngressPortUUID(this.getIngressPortUUID());
104 if (s.equals("egress")) {
105 ans.setEgressPortUUID(this.getEgressPortUUID());
107 if (s.equals("service_function_parameters")) {
108 ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
115 public String toString() {
116 return "NeutronSFCPortPair[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\'' + ", ingressPortUUID='"
117 + ingressPortUUID + '\'' + ", egressPortUUID='" + egressPortUUID + '\'' + ", serviceFunctionParameters="
118 + serviceFunctionParameters + ']';