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.util.Iterator;
12 import java.util.List;
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;
20 @XmlAccessorType(XmlAccessType.NONE)
22 public class NeutronFloatingIP {
23 // See OpenStack Network API v2.0 Reference for description of
24 // annotated attributes
26 @XmlElement (name="id")
27 String floatingIPUUID;
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="tenant_id")
44 public NeutronFloatingIP() {
47 public String getID() { return floatingIPUUID; }
49 public String getFloatingIPUUID() {
50 return floatingIPUUID;
53 public void setFloatingIPUUID(String floatingIPUUID) {
54 this.floatingIPUUID = floatingIPUUID;
57 public String getFloatingNetworkUUID() {
58 return floatingNetworkUUID;
61 public void setFloatingNetworkUUID(String floatingNetworkUUID) {
62 this.floatingNetworkUUID = floatingNetworkUUID;
65 public String getPortUUID() {
69 public void setPortUUID(String portUUID) {
70 this.portUUID = portUUID;
73 public String getFixedIPAddress() {
74 return fixedIPAddress;
77 public void setFixedIPAddress(String fixedIPAddress) {
78 this.fixedIPAddress = fixedIPAddress;
81 public String getFloatingIPAddress() {
82 return floatingIPAddress;
85 public void setFloatingIPAddress(String floatingIPAddress) {
86 this.floatingIPAddress = floatingIPAddress;
89 public String getTenantUUID() {
93 public void setTenantUUID(String tenantUUID) {
94 this.tenantUUID = tenantUUID;
98 * This method copies selected fields from the object and returns them
99 * as a new object, suitable for marshaling.
102 * List of attributes to be extracted
103 * @return an OpenStackFloatingIPs object with only the selected fields
107 public NeutronFloatingIP extractFields(List<String> fields) {
108 NeutronFloatingIP ans = new NeutronFloatingIP();
109 Iterator<String> i = fields.iterator();
110 while (i.hasNext()) {
112 if (s.equals("id")) {
113 ans.setFloatingIPUUID(this.getFloatingIPUUID());
115 if (s.equals("floating_network_id")) {
116 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
118 if (s.equals("port_id")) {
119 ans.setPortUUID(this.getPortUUID());
121 if (s.equals("fixed_ip_address")) {
122 ans.setFixedIPAddress(this.getFixedIPAddress());
124 if (s.equals("floating_ip_address")) {
125 ans.setFloatingIPAddress(this.getFloatingIPAddress());
127 if (s.equals("tenant_id")) {
128 ans.setTenantUUID(this.getTenantUUID());
134 public void initDefaults() {