2 * Copyright (C) 2014 Red Hat, Inc.
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.controller.networkconfig.neutron;
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;
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:
30 * vip_address IP address
32 * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf
36 @XmlAccessorType(XmlAccessType.NONE)
38 public class NeutronLoadBalancer implements Serializable {
39 private static final long serialVersionUID = 1L;
41 @XmlElement(name="id")
42 String loadBalancerID;
44 @XmlElement (name="tenant_id")
45 String loadBalancerTenantID;
47 @XmlElement (name="name")
48 String loadBalancerName;
50 @XmlElement (name="description")
51 String loadBalancerDescription;
53 @XmlElement (name="status")
54 String loadBalancerStatus;
56 @XmlElement (name="vip_address")
57 String loadBalancerVipAddress;
59 @XmlElement (name="vip_subnet_id")
60 String loadBalancerVipSubnetID;
62 public String getLoadBalancerID() {
63 return loadBalancerID;
66 public void setLoadBalancerID(String loadBalancerID) {
67 this.loadBalancerID = loadBalancerID;
70 public String getLoadBalancerTenantID() {
71 return loadBalancerTenantID;
74 public void setLoadBalancerTenantID(String loadBalancerTenantID) {
75 this.loadBalancerTenantID = loadBalancerTenantID;
78 public String getLoadBalancerName() {
79 return loadBalancerName;
82 public void setLoadBalancerName(String loadBalancerName) {
83 this.loadBalancerName = loadBalancerName;
86 public String getLoadBalancerDescription() {
87 return loadBalancerDescription;
90 public void setLoadBalancerDescription(String loadBalancerDescription) {
91 this.loadBalancerDescription = loadBalancerDescription;
94 public String getLoadBalancerStatus() {
95 return loadBalancerStatus;
98 public void setLoadBalancerStatus(String loadBalancerStatus) {
99 this.loadBalancerStatus = loadBalancerStatus;
102 public String getLoadBalancerVipAddress() {
103 return loadBalancerVipAddress;
106 public void setLoadBalancerVipAddress(String loadBalancerVipAddress) {
107 this.loadBalancerVipAddress = loadBalancerVipAddress;
110 public String getLoadBalancerVipSubnetID() {
111 return loadBalancerVipSubnetID;
114 public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) {
115 this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
118 public NeutronLoadBalancer extractFields(List<String> fields) {
119 NeutronLoadBalancer ans = new NeutronLoadBalancer();
120 Iterator<String> i = fields.iterator();
121 while (i.hasNext()) {
123 if (s.equals("id")) {
124 ans.setLoadBalancerID(this.getLoadBalancerID());
126 if (s.equals("tenant_id")) {
127 ans.setLoadBalancerTenantID(this.getLoadBalancerTenantID());
129 if (s.equals("name")) {
130 ans.setLoadBalancerName(this.getLoadBalancerName());
132 if(s.equals("description")) {
133 ans.setLoadBalancerDescription(this.getLoadBalancerDescription());
135 if (s.equals("vip_address")) {
136 ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
138 if (s.equals("vip_subnet_id")) {
139 ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
141 if (s.equals("status")) {
142 ans.setLoadBalancerStatus(this.getLoadBalancerStatus());
148 @Override public String toString() {
149 return "NeutronLoadBalancer{" +
150 "loadBalancerID='" + loadBalancerID + '\'' +
151 ", loadBalancerTenantID='" + loadBalancerTenantID + '\'' +
152 ", loadBalancerName='" + loadBalancerName + '\'' +
153 ", loadBalancerDescription='" + loadBalancerDescription + '\'' +
154 ", loadBalancerStatus='" + loadBalancerStatus + '\'' +
155 ", loadBalancerVipAddress='" + loadBalancerVipAddress + '\'' +
156 ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' +