Merge "Update Neutron Port attributes to match OS Kilo model"
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronLoadBalancer.java
1 /*
2  * Copyright (C) 2014 Red Hat, Inc.  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 javax.xml.bind.annotation.XmlAccessType;
12 import javax.xml.bind.annotation.XmlAccessorType;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15 import java.io.Serializable;
16 import java.util.Iterator;
17 import java.util.List;
18
19 /**
20  * OpenStack Neutron v2.0 Load Balancer as a service
21  * (LBaaS) bindings. See OpenStack Network API
22  * v2.0 Reference for description of  the fields:
23  * Implemented fields are as follows:
24  *
25  * id                 uuid-str
26  * tenant_id          uuid-str
27  * name               String
28  * description        String
29  * status             String
30  * vip_address        IP address
31  * vip_subnet         uuid-str
32  * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf
33  */
34
35 @XmlRootElement
36 @XmlAccessorType(XmlAccessType.NONE)
37
38 public class NeutronLoadBalancer implements Serializable {
39     private static final long serialVersionUID = 1L;
40
41     @XmlElement(name = "id")
42     String loadBalancerID;
43
44     @XmlElement (name = "tenant_id")
45     String loadBalancerTenantID;
46
47     @XmlElement (name = "name")
48     String loadBalancerName;
49
50     @XmlElement (name = "description")
51     String loadBalancerDescription;
52
53     @XmlElement (name = "status")
54     String loadBalancerStatus;
55
56     @XmlElement (name = "admin_state_up")
57     Boolean loadBalancerAdminStateUp;
58
59     @XmlElement (name = "vip_address")
60     String loadBalancerVipAddress;
61
62     @XmlElement (name = "vip_subnet_id")
63     String loadBalancerVipSubnetID;
64
65     public String getLoadBalancerID() {
66         return loadBalancerID;
67     }
68
69     public void setLoadBalancerID(String loadBalancerID) {
70         this.loadBalancerID = loadBalancerID;
71     }
72
73     public String getLoadBalancerTenantID() {
74         return loadBalancerTenantID;
75     }
76
77     public void setLoadBalancerTenantID(String loadBalancerTenantID) {
78         this.loadBalancerTenantID = loadBalancerTenantID;
79     }
80
81     public String getLoadBalancerName() {
82         return loadBalancerName;
83     }
84
85     public void setLoadBalancerName(String loadBalancerName) {
86         this.loadBalancerName = loadBalancerName;
87     }
88
89     public String getLoadBalancerDescription() {
90         return loadBalancerDescription;
91     }
92
93     public void setLoadBalancerDescription(String loadBalancerDescription) {
94         this.loadBalancerDescription = loadBalancerDescription;
95     }
96
97     public String getLoadBalancerStatus() {
98         return loadBalancerStatus;
99     }
100
101     public void setLoadBalancerStatus(String loadBalancerStatus) {
102         this.loadBalancerStatus = loadBalancerStatus;
103     }
104
105     public Boolean getLoadBalancerAdminStateUp() {
106         return loadBalancerAdminStateUp;
107     }
108
109     public void setLoadBalancerAdminStateUp(Boolean loadBalancerAdminStateUp) {
110         this.loadBalancerAdminStateUp = loadBalancerAdminStateUp;
111     }
112
113     public String getLoadBalancerVipAddress() {
114         return loadBalancerVipAddress;
115     }
116
117     public void setLoadBalancerVipAddress(String loadBalancerVipAddress) {
118         this.loadBalancerVipAddress = loadBalancerVipAddress;
119     }
120
121     public String getLoadBalancerVipSubnetID() {
122         return loadBalancerVipSubnetID;
123     }
124
125     public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) {
126         this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
127     }
128
129     public NeutronLoadBalancer extractFields(List<String> fields) {
130         NeutronLoadBalancer ans = new NeutronLoadBalancer();
131         Iterator<String> i = fields.iterator();
132         while (i.hasNext()) {
133             String s = i.next();
134             if (s.equals("id")) {
135                 ans.setLoadBalancerID(this.getLoadBalancerID());
136             }
137             if (s.equals("tenant_id")) {
138                 ans.setLoadBalancerTenantID(this.getLoadBalancerTenantID());
139             }
140             if (s.equals("name")) {
141                 ans.setLoadBalancerName(this.getLoadBalancerName());
142             }
143             if(s.equals("description")) {
144                 ans.setLoadBalancerDescription(this.getLoadBalancerDescription());
145             }
146             if (s.equals("vip_address")) {
147                 ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
148             }
149             if (s.equals("vip_subnet_id")) {
150                 ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
151             }
152             if (s.equals("status")) {
153                 ans.setLoadBalancerStatus(this.getLoadBalancerStatus());
154             }
155             if (s.equals("admin_state_up")) {
156                 ans.setLoadBalancerAdminStateUp(this.getLoadBalancerAdminStateUp());
157             }
158         }
159         return ans;
160     }
161
162     @Override public String toString() {
163         return "NeutronLoadBalancer{" +
164                 "loadBalancerID='" + loadBalancerID + '\'' +
165                 ", loadBalancerTenantID='" + loadBalancerTenantID + '\'' +
166                 ", loadBalancerName='" + loadBalancerName + '\'' +
167                 ", loadBalancerDescription='" + loadBalancerDescription + '\'' +
168                 ", loadBalancerStatus='" + loadBalancerStatus + '\'' +
169                 ", loadBalancerAdminStateUp='" + loadBalancerAdminStateUp + '\'' +
170                 ", loadBalancerVipAddress='" + loadBalancerVipAddress + '\'' +
171                 ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' +
172                 '}';
173     }
174 }