2 * Copyright (c) 2013, 2015 IBM Corporation and others. 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.neutron.spi;
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;
21 @XmlAccessorType(XmlAccessType.NONE)
23 public class NeutronFloatingIP extends NeutronObject implements Serializable, INeutronObject {
24 private static final long serialVersionUID = 1L;
26 // See OpenStack Network API v2.0 Reference for description of
27 // annotated attributes
29 @XmlElement (name = "floating_network_id")
30 String floatingNetworkUUID;
32 @XmlElement (name = "port_id")
35 @XmlElement (name = "fixed_ip_address")
36 String fixedIPAddress;
38 @XmlElement (name = "floating_ip_address")
39 String floatingIPAddress;
41 @XmlElement (name="router_id")
44 @XmlElement (name="status")
47 public NeutronFloatingIP() {
50 // @deprecated use getID()
51 public String getFloatingIPUUID() {
55 // @deprecated use setID()
56 public void setFloatingIPUUID(String uuid) {
60 public String getFloatingNetworkUUID() {
61 return floatingNetworkUUID;
64 public void setFloatingNetworkUUID(String floatingNetworkUUID) {
65 this.floatingNetworkUUID = floatingNetworkUUID;
68 public String getPortUUID() {
72 public String getRouterUUID() {
76 public void setPortUUID(String portUUID) {
77 this.portUUID = portUUID;
80 public String getFixedIPAddress() {
81 return fixedIPAddress;
84 public void setFixedIPAddress(String fixedIPAddress) {
85 this.fixedIPAddress = fixedIPAddress;
88 public String getFloatingIPAddress() {
89 return floatingIPAddress;
92 public void setFloatingIPAddress(String floatingIPAddress) {
93 this.floatingIPAddress = floatingIPAddress;
97 public String getTenantUUID() {
102 public void setTenantUUID(String tenantID) {
103 setTenantID(tenantID);
106 public void setRouterUUID(String routerUUID) {
107 this.routerUUID = routerUUID;
110 public String getStatus() {
114 public void setStatus(String status) {
115 this.status = status;
119 * This method copies selected fields from the object and returns them
120 * as a new object, suitable for marshaling.
123 * List of attributes to be extracted
124 * @return an OpenStackFloatingIPs object with only the selected fields
128 public NeutronFloatingIP extractFields(List<String> fields) {
129 NeutronFloatingIP ans = new NeutronFloatingIP();
130 Iterator<String> i = fields.iterator();
131 while (i.hasNext()) {
133 if (s.equals("id")) {
134 ans.setID(this.getID());
136 if (s.equals("floating_network_id")) {
137 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
139 if (s.equals("port_id")) {
140 ans.setPortUUID(this.getPortUUID());
142 if (s.equals("fixed_ip_address")) {
143 ans.setFixedIPAddress(this.getFixedIPAddress());
145 if (s.equals("floating_ip_address")) {
146 ans.setFloatingIPAddress(this.getFloatingIPAddress());
148 if (s.equals("tenant_id")) {
149 ans.setTenantID(this.getTenantID());
151 if (s.equals("router_id")) {
152 ans.setRouterUUID(this.getRouterUUID());
154 if (s.equals("status")) {
155 ans.setStatus(this.getStatus());
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 + '\'' +
175 public void initDefaults() {