2 * Copyright IBM Corporation, 2013. All rights reserved.
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
9 package org.opendaylight.controller.networkconfig.neutron;
11 import java.io.Serializable;
12 import java.util.Iterator;
13 import java.util.List;
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;
20 import org.opendaylight.controller.configuration.ConfigurationObject;
23 @XmlAccessorType(XmlAccessType.NONE)
25 public class NeutronFloatingIP extends ConfigurationObject implements Serializable {
26 private static final long serialVersionUID = 1L;
28 // See OpenStack Network API v2.0 Reference for description of
29 // annotated attributes
31 @XmlElement (name="id")
32 String floatingIPUUID;
34 @XmlElement (name="floating_network_id")
35 String floatingNetworkUUID;
37 @XmlElement (name="port_id")
40 @XmlElement (name="fixed_ip_address")
41 String fixedIPAddress;
43 @XmlElement (name="floating_ip_address")
44 String floatingIPAddress;
46 @XmlElement (name="tenant_id")
49 public NeutronFloatingIP() {
52 public String getID() { return floatingIPUUID; }
54 public String getFloatingIPUUID() {
55 return floatingIPUUID;
58 public void setFloatingIPUUID(String floatingIPUUID) {
59 this.floatingIPUUID = floatingIPUUID;
62 public String getFloatingNetworkUUID() {
63 return floatingNetworkUUID;
66 public void setFloatingNetworkUUID(String floatingNetworkUUID) {
67 this.floatingNetworkUUID = floatingNetworkUUID;
70 public String getPortUUID() {
74 public void setPortUUID(String portUUID) {
75 this.portUUID = portUUID;
78 public String getFixedIPAddress() {
79 return fixedIPAddress;
82 public void setFixedIPAddress(String fixedIPAddress) {
83 this.fixedIPAddress = fixedIPAddress;
86 public String getFloatingIPAddress() {
87 return floatingIPAddress;
90 public void setFloatingIPAddress(String floatingIPAddress) {
91 this.floatingIPAddress = floatingIPAddress;
94 public String getTenantUUID() {
98 public void setTenantUUID(String tenantUUID) {
99 this.tenantUUID = tenantUUID;
103 * This method copies selected fields from the object and returns them
104 * as a new object, suitable for marshaling.
107 * List of attributes to be extracted
108 * @return an OpenStackFloatingIPs object with only the selected fields
112 public NeutronFloatingIP extractFields(List<String> fields) {
113 NeutronFloatingIP ans = new NeutronFloatingIP();
114 Iterator<String> i = fields.iterator();
115 while (i.hasNext()) {
117 if (s.equals("id")) {
118 ans.setFloatingIPUUID(this.getFloatingIPUUID());
120 if (s.equals("floating_network_id")) {
121 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
123 if (s.equals("port_id")) {
124 ans.setPortUUID(this.getPortUUID());
126 if (s.equals("fixed_ip_address")) {
127 ans.setFixedIPAddress(this.getFixedIPAddress());
129 if (s.equals("floating_ip_address")) {
130 ans.setFloatingIPAddress(this.getFloatingIPAddress());
132 if (s.equals("tenant_id")) {
133 ans.setTenantUUID(this.getTenantUUID());
139 public void initDefaults() {