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 org.opendaylight.controller.configuration.ConfigurationObject;
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 import java.io.Serializable;
18 import java.util.Iterator;
19 import java.util.List;
22 * OpenStack Neutron v2.0 Load Balancer as a service
23 * (LBaaS) bindings. See OpenStack Network API
24 * v2.0 Reference for description of the fields:
25 * Implemented fields are as follows:
32 * vip_address IP address
34 * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf
38 @XmlAccessorType(XmlAccessType.NONE)
40 public class NeutronLoadBalancer extends ConfigurationObject implements Serializable {
41 private static final long serialVersionUID = 1L;
43 @XmlElement(name="id")
44 String loadBalancerID;
46 @XmlElement (name="tenant_id")
47 String loadBalancerTenantID;
49 @XmlElement (name="name")
50 String loadBalancerName;
52 @XmlElement (name="description")
53 String loadBalancerDescription;
55 @XmlElement (name="status")
56 String loadBalancerStatus;
58 @XmlElement (name="vip_address")
59 String loadBalancerVipAddress;
61 @XmlElement (name="vip_subnet_id")
62 String loadBalancerVipSubnetID;
64 public String getLoadBalancerID() {
65 return loadBalancerID;
68 public void setLoadBalancerID(String loadBalancerID) {
69 this.loadBalancerID = loadBalancerID;
72 public String getLoadBalancerTenantID() {
73 return loadBalancerTenantID;
76 public void setLoadBalancerTenantID(String loadBalancerTenantID) {
77 this.loadBalancerTenantID = loadBalancerTenantID;
80 public String getLoadBalancerName() {
81 return loadBalancerName;
84 public void setLoadBalancerName(String loadBalancerName) {
85 this.loadBalancerName = loadBalancerName;
88 public String getLoadBalancerDescription() {
89 return loadBalancerDescription;
92 public void setLoadBalancerDescription(String loadBalancerDescription) {
93 this.loadBalancerDescription = loadBalancerDescription;
96 public String getLoadBalancerStatus() {
97 return loadBalancerStatus;
100 public void setLoadBalancerStatus(String loadBalancerStatus) {
101 this.loadBalancerStatus = loadBalancerStatus;
104 public String getLoadBalancerVipAddress() {
105 return loadBalancerVipAddress;
108 public void setLoadBalancerVipAddress(String loadBalancerVipAddress) {
109 this.loadBalancerVipAddress = loadBalancerVipAddress;
112 public String getLoadBalancerVipSubnetID() {
113 return loadBalancerVipSubnetID;
116 public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) {
117 this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
120 public NeutronLoadBalancer extractFields(List<String> fields) {
121 NeutronLoadBalancer ans = new NeutronLoadBalancer();
122 Iterator<String> i = fields.iterator();
123 while (i.hasNext()) {
125 if (s.equals("id")) {
126 ans.setLoadBalancerID(this.getLoadBalancerID());
128 if (s.equals("tenant_id")) {
129 ans.setLoadBalancerTenantID(this.getLoadBalancerTenantID());
131 if (s.equals("name")) {
132 ans.setLoadBalancerName(this.getLoadBalancerName());
134 if(s.equals("description")) {
135 ans.setLoadBalancerDescription(this.getLoadBalancerDescription());
137 if (s.equals("vip_address")) {
138 ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
140 if (s.equals("vip_subnet_id")) {
141 ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
143 if (s.equals("status")) {
144 ans.setLoadBalancerStatus(this.getLoadBalancerStatus());
150 @Override public String toString() {
151 return "NeutronLoadBalancer{" +
152 "loadBalancerID='" + loadBalancerID + '\'' +
153 ", loadBalancerTenantID='" + loadBalancerTenantID + '\'' +
154 ", loadBalancerName='" + loadBalancerName + '\'' +
155 ", loadBalancerDescription='" + loadBalancerDescription + '\'' +
156 ", loadBalancerStatus='" + loadBalancerStatus + '\'' +
157 ", loadBalancerVipAddress='" + loadBalancerVipAddress + '\'' +
158 ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' +