2 * Copyright IBM Corporation, 2013. 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
8 package org.opendaylight.controller.samples.loadbalancer.entities;
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;
17 * This class represents the host where load balancing service will
18 * redirect VIP traffic for load balancing. All these hosts have to
19 * register with a pool to be a part of traffic load balancing.
20 * This entity is referred to as a 'PoolMember'.
21 * Load balancer service differentiates each pool member based on its
22 * two properties { ip address, attached pool }.
23 * A host (IP) can be attached to two different pools through creation of two
24 * different pool member objects.
26 * NOTE: Each pool member should have a unique name.
29 @XmlRootElement(name="poolmember")
30 @XmlAccessorType(XmlAccessType.NONE)
31 public class PoolMember {
34 * Unique name of the pool member
40 * IP address of the pool member
46 * Name of the pool this member is attached to.
48 @XmlElement(name="poolname")
49 private String poolName;
52 * Status (active/inactive)
55 private String status;
58 * Private constructor used for JAXB mapping
60 @SuppressWarnings("unused")
61 private PoolMember() {}
63 public PoolMember(String name, String memberIP, String poolName){
66 this.poolName = poolName;
72 public String getName() {
77 * @param name the name to set
79 public void setName(String name) {
86 public String getIp() {
91 * @param ip the ip to set
93 public void setIp(String ip) {
98 * @return the poolName
100 public String getPoolName() {
105 * @param poolName the poolName to set
107 public void setPoolName(String poolName) {
108 this.poolName = poolName;
114 public String getStatus() {
119 * @param status the status to set
121 public void setStatus(String status) {
122 this.status = status;
126 * @see java.lang.Object#hashCode()
129 public int hashCode() {
130 final int prime = 31;
132 result = prime * result + ((ip == null) ? 0 : ip.hashCode());
133 result = prime * result
134 + ((poolName == null) ? 0 : poolName.hashCode());
139 * @see java.lang.Object#equals(java.lang.Object)
142 public boolean equals(Object obj) {
149 if (!(obj instanceof PoolMember)) {
152 PoolMember other = (PoolMember) obj;
154 if (other.ip != null) {
157 }else if (!ip.equals(other.ip)) {
160 if (poolName == null) {
161 if (other.poolName != null) {
164 }else if (!poolName.equals(other.poolName)) {
171 * @see java.lang.Object#toString()
174 public String toString() {
175 return "PoolMember [name=" + name + ", ip=" + ip + ", poolName="
176 + poolName + ", status=" + status + "]";