9b4dff1741792ac207ab0a42a0472b1021c16bf1
[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 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 /**
18  * OpenStack Neutron v2.0 Load Balancer as a service
19  * (LBaaS) bindings. See OpenStack Network API
20  * v2.0 Reference for description of  the fields:
21  * Implemented fields are as follows:
22  *
23  * <p>
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 NeutronAdminAttributes<NeutronLoadBalancer> implements Serializable {
36     private static final long serialVersionUID = 1L;
37
38     @XmlElement(name = "vip_address")
39     String loadBalancerVipAddress;
40
41     @XmlElement(name = "vip_subnet_id")
42     String loadBalancerVipSubnetID;
43
44     public String getLoadBalancerVipAddress() {
45         return loadBalancerVipAddress;
46     }
47
48     public void setLoadBalancerVipAddress(String loadBalancerVipAddress) {
49         this.loadBalancerVipAddress = loadBalancerVipAddress;
50     }
51
52     public String getLoadBalancerVipSubnetID() {
53         return loadBalancerVipSubnetID;
54     }
55
56     public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) {
57         this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
58     }
59
60     @Override
61     protected boolean extractField(String field, NeutronLoadBalancer ans) {
62         switch (field) {
63             case "vip_address":
64                 ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
65                 break;
66             case "vip_subnet_id":
67                 ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
68                 break;
69             default:
70                 return super.extractField(field, ans);
71         }
72         return true;
73     }
74
75     @Override
76     public String toString() {
77         return "NeutronLoadBalancer{" + "loadBalancerID='" + uuid + '\'' + ", loadBalancerTenantID='" + tenantID + '\''
78                 + ", loadBalancerName='" + name + '\'' + ", loadBalancerStatus='" + status
79                 + '\'' + ", loadBalancerAdminStateUp='" + adminStateUp + '\'' + ", loadBalancerVipAddress='"
80                 + loadBalancerVipAddress + '\'' + ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' + '}';
81     }
82 }