9da189c52a8b96ca2ac3636fd67a80b660c33e33
[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 java.io.Serializable;
12 import java.util.List;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17
18 /**
19  * OpenStack Neutron v2.0 Load Balancer as a service
20  * (LBaaS) bindings. See OpenStack Network API
21  * v2.0 Reference for description of  the fields:
22  * Implemented fields are as follows:
23  *
24  * id                 uuid-str
25  * tenant_id          uuid-str
26  * name               String
27  * status             String
28  * vip_address        IP address
29  * vip_subnet         uuid-str
30  * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf
31  */
32
33 @XmlRootElement
34 @XmlAccessorType(XmlAccessType.NONE)
35 public final class NeutronLoadBalancer extends NeutronObject<NeutronLoadBalancer>
36         implements Serializable, INeutronObject<NeutronLoadBalancer> {
37     private static final long serialVersionUID = 1L;
38
39     @XmlElement(name = "name")
40     String loadBalancerName;
41
42     @XmlElement(name = "status")
43     String loadBalancerStatus;
44
45     @XmlElement(name = "admin_state_up")
46     Boolean loadBalancerAdminStateUp;
47
48     @XmlElement(name = "vip_address")
49     String loadBalancerVipAddress;
50
51     @XmlElement(name = "vip_subnet_id")
52     String loadBalancerVipSubnetID;
53
54     public String getLoadBalancerName() {
55         return loadBalancerName;
56     }
57
58     public void setLoadBalancerName(String loadBalancerName) {
59         this.loadBalancerName = loadBalancerName;
60     }
61
62     public String getLoadBalancerStatus() {
63         return loadBalancerStatus;
64     }
65
66     public void setLoadBalancerStatus(String loadBalancerStatus) {
67         this.loadBalancerStatus = loadBalancerStatus;
68     }
69
70     public Boolean getLoadBalancerAdminStateUp() {
71         return loadBalancerAdminStateUp;
72     }
73
74     public void setLoadBalancerAdminStateUp(Boolean loadBalancerAdminStateUp) {
75         this.loadBalancerAdminStateUp = loadBalancerAdminStateUp;
76     }
77
78     public String getLoadBalancerVipAddress() {
79         return loadBalancerVipAddress;
80     }
81
82     public void setLoadBalancerVipAddress(String loadBalancerVipAddress) {
83         this.loadBalancerVipAddress = loadBalancerVipAddress;
84     }
85
86     public String getLoadBalancerVipSubnetID() {
87         return loadBalancerVipSubnetID;
88     }
89
90     public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) {
91         this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
92     }
93
94     public NeutronLoadBalancer extractFields(List<String> fields) {
95         NeutronLoadBalancer ans = new NeutronLoadBalancer();
96         for (String s : fields) {
97             extractField(s, ans);
98             if (s.equals("name")) {
99                 ans.setLoadBalancerName(this.getLoadBalancerName());
100             }
101             if (s.equals("vip_address")) {
102                 ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
103             }
104             if (s.equals("vip_subnet_id")) {
105                 ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
106             }
107             if (s.equals("status")) {
108                 ans.setLoadBalancerStatus(this.getLoadBalancerStatus());
109             }
110             if (s.equals("admin_state_up")) {
111                 ans.setLoadBalancerAdminStateUp(this.getLoadBalancerAdminStateUp());
112             }
113         }
114         return ans;
115     }
116
117     @Override
118     public String toString() {
119         return "NeutronLoadBalancer{" + "loadBalancerID='" + uuid + '\'' + ", loadBalancerTenantID='" + tenantID + '\''
120                 + ", loadBalancerName='" + loadBalancerName + '\'' + ", loadBalancerStatus='" + loadBalancerStatus
121                 + '\'' + ", loadBalancerAdminStateUp='" + loadBalancerAdminStateUp + '\'' + ", loadBalancerVipAddress='"
122                 + loadBalancerVipAddress + '\'' + ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' + '}';
123     }
124 }