2 * Copyright (C) 2014 Red Hat, Inc. All rights reserved.
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
9 package org.opendaylight.neutron.spi;
11 import java.io.Serializable;
12 import java.util.Iterator;
13 import java.util.List;
14 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElement;
17 import javax.xml.bind.annotation.XmlRootElement;
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:
29 * vip_address IP address
31 * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf
35 @XmlAccessorType(XmlAccessType.NONE)
36 public class NeutronLoadBalancer extends NeutronObject<NeutronLoadBalancer>
37 implements Serializable, INeutronObject<NeutronLoadBalancer> {
38 private static final long serialVersionUID = 1L;
40 @XmlElement(name = "name")
41 String loadBalancerName;
43 @XmlElement(name = "status")
44 String loadBalancerStatus;
46 @XmlElement(name = "admin_state_up")
47 Boolean loadBalancerAdminStateUp;
49 @XmlElement(name = "vip_address")
50 String loadBalancerVipAddress;
52 @XmlElement(name = "vip_subnet_id")
53 String loadBalancerVipSubnetID;
55 public String getLoadBalancerName() {
56 return loadBalancerName;
59 public void setLoadBalancerName(String loadBalancerName) {
60 this.loadBalancerName = loadBalancerName;
63 public String getLoadBalancerStatus() {
64 return loadBalancerStatus;
67 public void setLoadBalancerStatus(String loadBalancerStatus) {
68 this.loadBalancerStatus = loadBalancerStatus;
71 public Boolean getLoadBalancerAdminStateUp() {
72 return loadBalancerAdminStateUp;
75 public void setLoadBalancerAdminStateUp(Boolean loadBalancerAdminStateUp) {
76 this.loadBalancerAdminStateUp = loadBalancerAdminStateUp;
79 public String getLoadBalancerVipAddress() {
80 return loadBalancerVipAddress;
83 public void setLoadBalancerVipAddress(String loadBalancerVipAddress) {
84 this.loadBalancerVipAddress = loadBalancerVipAddress;
87 public String getLoadBalancerVipSubnetID() {
88 return loadBalancerVipSubnetID;
91 public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) {
92 this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
95 public NeutronLoadBalancer extractFields(List<String> fields) {
96 NeutronLoadBalancer ans = new NeutronLoadBalancer();
97 Iterator<String> i = fields.iterator();
100 if (s.equals("id")) {
101 ans.setID(this.getID());
103 if (s.equals("tenant_id")) {
104 ans.setTenantID(this.getTenantID());
106 if (s.equals("name")) {
107 ans.setLoadBalancerName(this.getLoadBalancerName());
109 if (s.equals("vip_address")) {
110 ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
112 if (s.equals("vip_subnet_id")) {
113 ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
115 if (s.equals("status")) {
116 ans.setLoadBalancerStatus(this.getLoadBalancerStatus());
118 if (s.equals("admin_state_up")) {
119 ans.setLoadBalancerAdminStateUp(this.getLoadBalancerAdminStateUp());
126 public String toString() {
127 return "NeutronLoadBalancer{" + "loadBalancerID='" + uuid + '\'' + ", loadBalancerTenantID='" + tenantID + '\''
128 + ", loadBalancerName='" + loadBalancerName + '\'' + ", loadBalancerStatus='" + loadBalancerStatus
129 + '\'' + ", loadBalancerAdminStateUp='" + loadBalancerAdminStateUp + '\'' + ", loadBalancerVipAddress='"
130 + loadBalancerVipAddress + '\'' + ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' + '}';