Merge "Fixed for bug : 1171 - issue while creating subnet"
[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.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 import org.opendaylight.controller.configuration.ConfigurationObject;
21
22 @XmlRootElement
23 @XmlAccessorType(XmlAccessType.NONE)
24
25 public class NeutronFloatingIP extends ConfigurationObject implements Serializable {
26     private static final long serialVersionUID = 1L;
27
28     // See OpenStack Network API v2.0 Reference for description of
29     // annotated attributes
30
31     @XmlElement (name="id")
32     String floatingIPUUID;
33
34     @XmlElement (name="floating_network_id")
35     String floatingNetworkUUID;
36
37     @XmlElement (name="port_id")
38     String portUUID;
39
40     @XmlElement (name="fixed_ip_address")
41     String fixedIPAddress;
42
43     @XmlElement (name="floating_ip_address")
44     String floatingIPAddress;
45
46     @XmlElement (name="tenant_id")
47     String tenantUUID;
48
49     public NeutronFloatingIP() {
50     }
51
52     public String getID() { return floatingIPUUID; }
53
54     public String getFloatingIPUUID() {
55         return floatingIPUUID;
56     }
57
58     public void setFloatingIPUUID(String floatingIPUUID) {
59         this.floatingIPUUID = floatingIPUUID;
60     }
61
62     public String getFloatingNetworkUUID() {
63         return floatingNetworkUUID;
64     }
65
66     public void setFloatingNetworkUUID(String floatingNetworkUUID) {
67         this.floatingNetworkUUID = floatingNetworkUUID;
68     }
69
70     public String getPortUUID() {
71         return portUUID;
72     }
73
74     public void setPortUUID(String portUUID) {
75         this.portUUID = portUUID;
76     }
77
78     public String getFixedIPAddress() {
79         return fixedIPAddress;
80     }
81
82     public void setFixedIPAddress(String fixedIPAddress) {
83         this.fixedIPAddress = fixedIPAddress;
84     }
85
86     public String getFloatingIPAddress() {
87         return floatingIPAddress;
88     }
89
90     public void setFloatingIPAddress(String floatingIPAddress) {
91         this.floatingIPAddress = floatingIPAddress;
92     }
93
94     public String getTenantUUID() {
95         return tenantUUID;
96     }
97
98     public void setTenantUUID(String tenantUUID) {
99         this.tenantUUID = tenantUUID;
100     }
101
102     /**
103      * This method copies selected fields from the object and returns them
104      * as a new object, suitable for marshaling.
105      *
106      * @param fields
107      *            List of attributes to be extracted
108      * @return an OpenStackFloatingIPs object with only the selected fields
109      * populated
110      */
111
112     public NeutronFloatingIP extractFields(List<String> fields) {
113         NeutronFloatingIP ans = new NeutronFloatingIP();
114         Iterator<String> i = fields.iterator();
115         while (i.hasNext()) {
116             String s = i.next();
117             if (s.equals("id")) {
118                 ans.setFloatingIPUUID(this.getFloatingIPUUID());
119             }
120             if (s.equals("floating_network_id")) {
121                 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
122             }
123             if (s.equals("port_id")) {
124                 ans.setPortUUID(this.getPortUUID());
125             }
126             if (s.equals("fixed_ip_address")) {
127                 ans.setFixedIPAddress(this.getFixedIPAddress());
128             }
129             if (s.equals("floating_ip_address")) {
130                 ans.setFloatingIPAddress(this.getFloatingIPAddress());
131             }
132             if (s.equals("tenant_id")) {
133                 ans.setTenantUUID(this.getTenantUUID());
134             }
135         }
136         return ans;
137     }
138
139     public void initDefaults() {
140     }
141 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.