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;
21 @XmlAccessorType(XmlAccessType.NONE)
23 public class NeutronFloatingIP implements Serializable {
24 private static final long serialVersionUID = 1L;
26 // See OpenStack Network API v2.0 Reference for description of
27 // annotated attributes
29 @XmlElement (name="id")
30 String floatingIPUUID;
32 @XmlElement (name="floating_network_id")
33 String floatingNetworkUUID;
35 @XmlElement (name="port_id")
38 @XmlElement (name="fixed_ip_address")
39 String fixedIPAddress;
41 @XmlElement (name="floating_ip_address")
42 String floatingIPAddress;
44 @XmlElement (name="tenant_id")
47 public NeutronFloatingIP() {
50 public String getID() { return floatingIPUUID; }
52 public String getFloatingIPUUID() {
53 return floatingIPUUID;
56 public void setFloatingIPUUID(String floatingIPUUID) {
57 this.floatingIPUUID = floatingIPUUID;
60 public String getFloatingNetworkUUID() {
61 return floatingNetworkUUID;
64 public void setFloatingNetworkUUID(String floatingNetworkUUID) {
65 this.floatingNetworkUUID = floatingNetworkUUID;
68 public String getPortUUID() {
72 public void setPortUUID(String portUUID) {
73 this.portUUID = portUUID;
76 public String getFixedIPAddress() {
77 return fixedIPAddress;
80 public void setFixedIPAddress(String fixedIPAddress) {
81 this.fixedIPAddress = fixedIPAddress;
84 public String getFloatingIPAddress() {
85 return floatingIPAddress;
88 public void setFloatingIPAddress(String floatingIPAddress) {
89 this.floatingIPAddress = floatingIPAddress;
92 public String getTenantUUID() {
96 public void setTenantUUID(String tenantUUID) {
97 this.tenantUUID = tenantUUID;
101 * This method copies selected fields from the object and returns them
102 * as a new object, suitable for marshaling.
105 * List of attributes to be extracted
106 * @return an OpenStackFloatingIPs object with only the selected fields
110 public NeutronFloatingIP extractFields(List<String> fields) {
111 NeutronFloatingIP ans = new NeutronFloatingIP();
112 Iterator<String> i = fields.iterator();
113 while (i.hasNext()) {
115 if (s.equals("id")) {
116 ans.setFloatingIPUUID(this.getFloatingIPUUID());
118 if (s.equals("floating_network_id")) {
119 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
121 if (s.equals("port_id")) {
122 ans.setPortUUID(this.getPortUUID());
124 if (s.equals("fixed_ip_address")) {
125 ans.setFixedIPAddress(this.getFixedIPAddress());
127 if (s.equals("floating_ip_address")) {
128 ans.setFloatingIPAddress(this.getFloatingIPAddress());
130 if (s.equals("tenant_id")) {
131 ans.setTenantUUID(this.getTenantUUID());
137 public void initDefaults() {