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