Merge "BGPVPN: Added yang, api and transcriber for BGPVPN"
[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 extends NeutronObject 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 = "floating_network_id")
30     String floatingNetworkUUID;
31
32     @XmlElement (name = "port_id")
33     String portUUID;
34
35     @XmlElement (name = "fixed_ip_address")
36     String fixedIPAddress;
37
38     @XmlElement (name = "floating_ip_address")
39     String floatingIPAddress;
40
41     @XmlElement (name="router_id")
42     String routerUUID;
43
44     @XmlElement (name="status")
45     String status;
46
47     public NeutronFloatingIP() {
48     }
49
50     // @deprecated use getID()
51     public String getFloatingIPUUID() {
52         return getID();
53     }
54
55     // @deprecated use setID()
56     public void setFloatingIPUUID(String uuid) {
57         setID(uuid);
58     }
59
60     public String getFloatingNetworkUUID() {
61         return floatingNetworkUUID;
62     }
63
64     public void setFloatingNetworkUUID(String floatingNetworkUUID) {
65         this.floatingNetworkUUID = floatingNetworkUUID;
66     }
67
68     public String getPortUUID() {
69         return portUUID;
70     }
71
72     public String getRouterUUID() {
73         return routerUUID;
74     }
75
76     public void setPortUUID(String portUUID) {
77         this.portUUID = portUUID;
78     }
79
80     public String getFixedIPAddress() {
81         return fixedIPAddress;
82     }
83
84     public void setFixedIPAddress(String fixedIPAddress) {
85         this.fixedIPAddress = fixedIPAddress;
86     }
87
88     public String getFloatingIPAddress() {
89         return floatingIPAddress;
90     }
91
92     public void setFloatingIPAddress(String floatingIPAddress) {
93         this.floatingIPAddress = floatingIPAddress;
94     }
95
96     @Deprecated
97     public String getTenantUUID() {
98         return getTenantID();
99     }
100
101     @Deprecated
102     public void setTenantUUID(String tenantID) {
103         setTenantID(tenantID);
104     }
105
106     public void setRouterUUID(String routerUUID) {
107         this.routerUUID = routerUUID;
108     }
109
110     public String getStatus() {
111         return status;
112     }
113
114     public void setStatus(String status) {
115         this.status = status;
116     }
117
118     /**
119      * This method copies selected fields from the object and returns them
120      * as a new object, suitable for marshaling.
121      *
122      * @param fields
123      *            List of attributes to be extracted
124      * @return an OpenStackFloatingIPs object with only the selected fields
125      * populated
126      */
127
128     public NeutronFloatingIP extractFields(List<String> fields) {
129         NeutronFloatingIP ans = new NeutronFloatingIP();
130         Iterator<String> i = fields.iterator();
131         while (i.hasNext()) {
132             String s = i.next();
133             if (s.equals("id")) {
134                 ans.setID(this.getID());
135             }
136             if (s.equals("floating_network_id")) {
137                 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
138             }
139             if (s.equals("port_id")) {
140                 ans.setPortUUID(this.getPortUUID());
141             }
142             if (s.equals("fixed_ip_address")) {
143                 ans.setFixedIPAddress(this.getFixedIPAddress());
144             }
145             if (s.equals("floating_ip_address")) {
146                 ans.setFloatingIPAddress(this.getFloatingIPAddress());
147             }
148             if (s.equals("tenant_id")) {
149                 ans.setTenantID(this.getTenantID());
150             }
151             if (s.equals("router_id")) {
152                 ans.setRouterUUID(this.getRouterUUID());
153             }
154             if (s.equals("status")) {
155                 ans.setStatus(this.getStatus());
156             }
157         }
158         return ans;
159     }
160
161     @Override
162     public String toString() {
163         return "NeutronFloatingIP{" +
164             "fipUUID='" + uuid + '\'' +
165             ", fipFloatingNetworkId='" + floatingNetworkUUID + '\'' +
166             ", fipPortUUID='" + portUUID + '\'' +
167             ", fipFixedIPAddress='" + fixedIPAddress + '\'' +
168             ", fipFloatingIPAddress=" + floatingIPAddress +
169             ", fipTenantId='" + tenantID + '\'' +
170             ", fipRouterId='" + routerUUID + '\'' +
171             ", fipStatus='" + status + '\'' +
172             '}';
173     }
174 }