Merge branch 'topic/master/neutron-yang-migration' to branch 'master'
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / translator / NeutronLoadBalancer.java
1 /*
2  * Copyright (C) 2014 Red Hat, Inc. 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.ovsdb.openstack.netvirt.translator;
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, INeutronObject {
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 getID() {
66         return loadBalancerID;
67     }
68
69     public void setID(String id) {
70         loadBalancerID = id;
71     }
72
73     // @deprecated use getID()
74     public String getLoadBalancerID() {
75         return loadBalancerID;
76     }
77
78     // @deprecated use setID()
79     public void setLoadBalancerID(String loadBalancerID) {
80         this.loadBalancerID = loadBalancerID;
81     }
82
83     public String getLoadBalancerTenantID() {
84         return loadBalancerTenantID;
85     }
86
87     public void setLoadBalancerTenantID(String loadBalancerTenantID) {
88         this.loadBalancerTenantID = loadBalancerTenantID;
89     }
90
91     public String getLoadBalancerName() {
92         return loadBalancerName;
93     }
94
95     public void setLoadBalancerName(String loadBalancerName) {
96         this.loadBalancerName = loadBalancerName;
97     }
98
99     public String getLoadBalancerDescription() {
100         return loadBalancerDescription;
101     }
102
103     public void setLoadBalancerDescription(String loadBalancerDescription) {
104         this.loadBalancerDescription = loadBalancerDescription;
105     }
106
107     public String getLoadBalancerStatus() {
108         return loadBalancerStatus;
109     }
110
111     public void setLoadBalancerStatus(String loadBalancerStatus) {
112         this.loadBalancerStatus = loadBalancerStatus;
113     }
114
115     public Boolean getLoadBalancerAdminStateUp() {
116         return loadBalancerAdminStateUp;
117     }
118
119     public void setLoadBalancerAdminStateUp(Boolean loadBalancerAdminStateUp) {
120         this.loadBalancerAdminStateUp = loadBalancerAdminStateUp;
121     }
122
123     public String getLoadBalancerVipAddress() {
124         return loadBalancerVipAddress;
125     }
126
127     public void setLoadBalancerVipAddress(String loadBalancerVipAddress) {
128         this.loadBalancerVipAddress = loadBalancerVipAddress;
129     }
130
131     public String getLoadBalancerVipSubnetID() {
132         return loadBalancerVipSubnetID;
133     }
134
135     public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) {
136         this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
137     }
138
139     public NeutronLoadBalancer extractFields(List<String> fields) {
140         NeutronLoadBalancer ans = new NeutronLoadBalancer();
141         Iterator<String> i = fields.iterator();
142         while (i.hasNext()) {
143             String s = i.next();
144             if (s.equals("id")) {
145                 ans.setID(this.getID());
146             }
147             if (s.equals("tenant_id")) {
148                 ans.setLoadBalancerTenantID(this.getLoadBalancerTenantID());
149             }
150             if (s.equals("name")) {
151                 ans.setLoadBalancerName(this.getLoadBalancerName());
152             }
153             if(s.equals("description")) {
154                 ans.setLoadBalancerDescription(this.getLoadBalancerDescription());
155             }
156             if (s.equals("vip_address")) {
157                 ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
158             }
159             if (s.equals("vip_subnet_id")) {
160                 ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
161             }
162             if (s.equals("status")) {
163                 ans.setLoadBalancerStatus(this.getLoadBalancerStatus());
164             }
165             if (s.equals("admin_state_up")) {
166                 ans.setLoadBalancerAdminStateUp(this.getLoadBalancerAdminStateUp());
167             }
168         }
169         return ans;
170     }
171
172     @Override public String toString() {
173         return "NeutronLoadBalancer{" +
174                 "loadBalancerID='" + loadBalancerID + '\'' +
175                 ", loadBalancerTenantID='" + loadBalancerTenantID + '\'' +
176                 ", loadBalancerName='" + loadBalancerName + '\'' +
177                 ", loadBalancerDescription='" + loadBalancerDescription + '\'' +
178                 ", loadBalancerStatus='" + loadBalancerStatus + '\'' +
179                 ", loadBalancerAdminStateUp='" + loadBalancerAdminStateUp + '\'' +
180                 ", loadBalancerVipAddress='" + loadBalancerVipAddress + '\'' +
181                 ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' +
182                 '}';
183     }
184 }