cff693525db7a38f1d28fa88338387bc49cdef2b
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronFloatingIp.java
1 /*
2  * Copyright (c) 2013, 2015 IBM Corporation and others.  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.neutron.spi;
10
11 import java.io.Serializable;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 @XmlRootElement
18 @XmlAccessorType(XmlAccessType.NONE)
19 public final class NeutronFloatingIp
20         extends NeutronObject<NeutronFloatingIp> implements Serializable, INeutronObject<NeutronFloatingIp> {
21     private static final long serialVersionUID = 1L;
22
23     // See OpenStack Network API v2.0 Reference for description of
24     // annotated attributes
25
26     @XmlElement(name = "floating_network_id")
27     String floatingNetworkUUID;
28
29     @XmlElement(name = "port_id")
30     String portUUID;
31
32     @XmlElement(name = "fixed_ip_address")
33     String fixedIpAddress;
34
35     @XmlElement(name = "floating_ip_address")
36     String floatingIpAddress;
37
38     @XmlElement(name = "router_id")
39     String routerUUID;
40
41     @XmlElement(name = "status")
42     String status;
43
44     public NeutronFloatingIp() {
45     }
46
47     public String getFloatingNetworkUUID() {
48         return floatingNetworkUUID;
49     }
50
51     public void setFloatingNetworkUUID(String floatingNetworkUUID) {
52         this.floatingNetworkUUID = floatingNetworkUUID;
53     }
54
55     public String getPortUUID() {
56         return portUUID;
57     }
58
59     public String getRouterUUID() {
60         return routerUUID;
61     }
62
63     public void setPortUUID(String portUUID) {
64         this.portUUID = portUUID;
65     }
66
67     public String getFixedIpAddress() {
68         return fixedIpAddress;
69     }
70
71     public void setFixedIpAddress(String fixedIpAddress) {
72         this.fixedIpAddress = fixedIpAddress;
73     }
74
75     public String getFloatingIpAddress() {
76         return floatingIpAddress;
77     }
78
79     public void setFloatingIpAddress(String floatingIpAddress) {
80         this.floatingIpAddress = floatingIpAddress;
81     }
82
83     public void setRouterUUID(String routerUUID) {
84         this.routerUUID = routerUUID;
85     }
86
87     public String getStatus() {
88         return status;
89     }
90
91     public void setStatus(String status) {
92         this.status = status;
93     }
94
95     @Override
96     protected boolean extractField(String field, NeutronFloatingIp ans) {
97         switch (field) {
98             case "floating_network_id":
99                 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
100                 break;
101             case "port_id":
102                 ans.setPortUUID(this.getPortUUID());
103                 break;
104             case "fixed_ip_address":
105                 ans.setFixedIpAddress(this.getFixedIpAddress());
106                 break;
107             case "floating_ip_address":
108                 ans.setFloatingIpAddress(this.getFloatingIpAddress());
109                 break;
110             case "router_id":
111                 ans.setRouterUUID(this.getRouterUUID());
112                 break;
113             case "status":
114                 ans.setStatus(this.getStatus());
115                 break;
116             default:
117                 return super.extractField(field, ans);
118         }
119         return true;
120     }
121
122     @Override
123     public String toString() {
124         return "NeutronFloatingIp{" + "fipUUID='" + uuid + '\'' + ", fipFloatingNetworkId='" + floatingNetworkUUID
125                 + '\'' + ", fipPortUUID='" + portUUID + '\'' + ", fipFixedIpAddress='" + fixedIpAddress + '\''
126                 + ", fipFloatingIpAddress=" + floatingIpAddress + ", fipTenantId='" + tenantID + '\''
127                 + ", fipRouterId='" + routerUUID + '\'' + ", fipStatus='" + status + '\'' + '}';
128     }
129 }