Merge "Remove port concurrent hash map"
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronFloatingIP.java
1 /*
2  * Copyright (c) 2013, 2015 IBM Corporation 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
9 package org.opendaylight.neutron.spi;
10
11 import java.io.Serializable;
12 import java.util.Iterator;
13 import java.util.List;
14
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
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22
23 public class NeutronFloatingIP implements Serializable, INeutronObject {
24     private static final long serialVersionUID = 1L;
25
26     // See OpenStack Network API v2.0 Reference for description of
27     // annotated attributes
28
29     @XmlElement (name = "id")
30     String floatingIPUUID;
31
32     @XmlElement (name = "floating_network_id")
33     String floatingNetworkUUID;
34
35     @XmlElement (name = "port_id")
36     String portUUID;
37
38     @XmlElement (name = "fixed_ip_address")
39     String fixedIPAddress;
40
41     @XmlElement (name = "floating_ip_address")
42     String floatingIPAddress;
43
44     @XmlElement (name = "tenant_id")
45     String tenantUUID;
46
47     @XmlElement (name="router_id")
48     String routerUUID;
49
50     @XmlElement (name="status")
51     String status;
52
53     public NeutronFloatingIP() {
54     }
55
56     public String getID() {
57         return floatingIPUUID;
58     }
59
60     public void setID(String id) {
61         floatingIPUUID = id;
62     }
63
64     // @deprecated use getID()
65     public String getFloatingIPUUID() {
66         return floatingIPUUID;
67     }
68
69     // @deprecated use setID()
70     public void setFloatingIPUUID(String floatingIPUUID) {
71         this.floatingIPUUID = floatingIPUUID;
72     }
73
74     public String getFloatingNetworkUUID() {
75         return floatingNetworkUUID;
76     }
77
78     public void setFloatingNetworkUUID(String floatingNetworkUUID) {
79         this.floatingNetworkUUID = floatingNetworkUUID;
80     }
81
82     public String getPortUUID() {
83         return portUUID;
84     }
85
86     public String getRouterUUID() {
87         return routerUUID;
88     }
89
90     public void setPortUUID(String portUUID) {
91         this.portUUID = portUUID;
92     }
93
94     public String getFixedIPAddress() {
95         return fixedIPAddress;
96     }
97
98     public void setFixedIPAddress(String fixedIPAddress) {
99         this.fixedIPAddress = fixedIPAddress;
100     }
101
102     public String getFloatingIPAddress() {
103         return floatingIPAddress;
104     }
105
106     public void setFloatingIPAddress(String floatingIPAddress) {
107         this.floatingIPAddress = floatingIPAddress;
108     }
109
110     public String getTenantUUID() {
111         return tenantUUID;
112     }
113
114     public void setTenantUUID(String tenantUUID) {
115         this.tenantUUID = tenantUUID;
116     }
117
118     public void setRouterUUID(String routerUUID) {
119         this.routerUUID = routerUUID;
120     }
121
122     public String getStatus() {
123         return status;
124     }
125
126     public void setStatus(String status) {
127         this.status = status;
128     }
129
130     /**
131      * This method copies selected fields from the object and returns them
132      * as a new object, suitable for marshaling.
133      *
134      * @param fields
135      *            List of attributes to be extracted
136      * @return an OpenStackFloatingIPs object with only the selected fields
137      * populated
138      */
139
140     public NeutronFloatingIP extractFields(List<String> fields) {
141         NeutronFloatingIP ans = new NeutronFloatingIP();
142         Iterator<String> i = fields.iterator();
143         while (i.hasNext()) {
144             String s = i.next();
145             if (s.equals("id")) {
146                 ans.setID(this.getID());
147             }
148             if (s.equals("floating_network_id")) {
149                 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
150             }
151             if (s.equals("port_id")) {
152                 ans.setPortUUID(this.getPortUUID());
153             }
154             if (s.equals("fixed_ip_address")) {
155                 ans.setFixedIPAddress(this.getFixedIPAddress());
156             }
157             if (s.equals("floating_ip_address")) {
158                 ans.setFloatingIPAddress(this.getFloatingIPAddress());
159             }
160             if (s.equals("tenant_id")) {
161                 ans.setTenantUUID(this.getTenantUUID());
162             }
163             if (s.equals("router_id")) {
164                 ans.setRouterUUID(this.getRouterUUID());
165             }
166             if (s.equals("status")) {
167                 ans.setStatus(this.getStatus());
168             }
169         }
170         return ans;
171     }
172
173     @Override
174     public String toString() {
175         return "NeutronFloatingIP{" +
176             "fipUUID='" + floatingIPUUID + '\'' +
177             ", fipFloatingNetworkId='" + floatingNetworkUUID + '\'' +
178             ", fipPortUUID='" + portUUID + '\'' +
179             ", fipFixedIPAddress='" + fixedIPAddress + '\'' +
180             ", fipFloatingIPAddress=" + floatingIPAddress +
181             ", fipTenantId='" + tenantUUID + '\'' +
182             ", fipRouterId='" + routerUUID + '\'' +
183             ", fipStatus='" + status + '\'' +
184             '}';
185     }
186
187     public void initDefaults() {
188     }
189 }