4d029dccf31c642a7fd8ca790570e8764bcbebb2
[controller.git] / opendaylight / networkconfiguration / neutron / src / main / java / org / opendaylight / controller / networkconfig / neutron / NeutronFloatingIP.java
1 /*
2  * Copyright IBM Corporation, 2013.  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.controller.networkconfig.neutron;
10
11 import java.util.Iterator;
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 {
23     // See OpenStack Network API v2.0 Reference for description of
24     // annotated attributes
25
26     @XmlElement (name="id")
27     String floatingIPUUID;
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="tenant_id")
42     String tenantUUID;
43
44     public NeutronFloatingIP() {
45     }
46
47     public String getID() { return floatingIPUUID; }
48
49     public String getFloatingIPUUID() {
50         return floatingIPUUID;
51     }
52
53     public void setFloatingIPUUID(String floatingIPUUID) {
54         this.floatingIPUUID = floatingIPUUID;
55     }
56
57     public String getFloatingNetworkUUID() {
58         return floatingNetworkUUID;
59     }
60
61     public void setFloatingNetworkUUID(String floatingNetworkUUID) {
62         this.floatingNetworkUUID = floatingNetworkUUID;
63     }
64
65     public String getPortUUID() {
66         return portUUID;
67     }
68
69     public void setPortUUID(String portUUID) {
70         this.portUUID = portUUID;
71     }
72
73     public String getFixedIPAddress() {
74         return fixedIPAddress;
75     }
76
77     public void setFixedIPAddress(String fixedIPAddress) {
78         this.fixedIPAddress = fixedIPAddress;
79     }
80
81     public String getFloatingIPAddress() {
82         return floatingIPAddress;
83     }
84
85     public void setFloatingIPAddress(String floatingIPAddress) {
86         this.floatingIPAddress = floatingIPAddress;
87     }
88
89     public String getTenantUUID() {
90         return tenantUUID;
91     }
92
93     public void setTenantUUID(String tenantUUID) {
94         this.tenantUUID = tenantUUID;
95     }
96
97     /**
98      * This method copies selected fields from the object and returns them
99      * as a new object, suitable for marshaling.
100      *
101      * @param fields
102      *            List of attributes to be extracted
103      * @return an OpenStackFloatingIPs object with only the selected fields
104      * populated
105      */
106
107     public NeutronFloatingIP extractFields(List<String> fields) {
108         NeutronFloatingIP ans = new NeutronFloatingIP();
109         Iterator<String> i = fields.iterator();
110         while (i.hasNext()) {
111             String s = i.next();
112             if (s.equals("id")) {
113                 ans.setFloatingIPUUID(this.getFloatingIPUUID());
114             }
115             if (s.equals("floating_network_id")) {
116                 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
117             }
118             if (s.equals("port_id")) {
119                 ans.setPortUUID(this.getPortUUID());
120             }
121             if (s.equals("fixed_ip_address")) {
122                 ans.setFixedIPAddress(this.getFixedIPAddress());
123             }
124             if (s.equals("floating_ip_address")) {
125                 ans.setFloatingIPAddress(this.getFloatingIPAddress());
126             }
127             if (s.equals("tenant_id")) {
128                 ans.setTenantUUID(this.getTenantUUID());
129             }
130         }
131         return ans;
132     }
133
134     public void initDefaults() {
135     }
136 }