X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fadsal%2Fsamples%2Floadbalancer%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsamples%2Floadbalancer%2Fentities%2FPool.java;fp=opendaylight%2Fadsal%2Fsamples%2Floadbalancer%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsamples%2Floadbalancer%2Fentities%2FPool.java;h=0000000000000000000000000000000000000000;hb=50f88249a65c52ba56a48852b71ce432fed2bbeb;hp=86e6a360dd50c67d38fc70cf4147bc328f3d4274;hpb=abfa9a03550cbe9fccc4420684dced175dd6d119;p=controller.git diff --git a/opendaylight/adsal/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Pool.java b/opendaylight/adsal/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Pool.java deleted file mode 100644 index 86e6a360dd..0000000000 --- a/opendaylight/adsal/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/entities/Pool.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright IBM Corporation, 2013. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.samples.loadbalancer.entities; - -import java.util.ArrayList; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * This class represents the pool of hosts among which incoming traffic - * will be load balanced. Each pool will load balance the traffic among its pool members - * based on the loadbalancing policy set for the pool. - * Currently, the pool supports two load balancing policies: - * 1. Round Robin Policy{@link org.opendaylight.controller.samples.loadbalancer.policies.RoundRobinLBPolicy} - * 2. Random Policy {@link org.opendaylight.controller.samples.loadbalancer.policies.RandomLBPolicy} - * - * NOTE: After creation of the pool, user can't update (change) its load balancing policy. - * NOTE: Each Pool should have a unique name. - */ - -@XmlRootElement(name="pool") -@XmlAccessorType(XmlAccessType.NONE) -public class Pool { - - /* - * Unique name of the pool - */ - @XmlElement - private String name; - - /* - * Associated load balancing policy - */ - @XmlElement(name="lbmethod") - private String lbMethod; - - /* - * Status of the pool (active/inactive) - */ - @XmlElement - private String status; - - /* - * List of all the VIPs using this pool for load balancing their traffic - more than - * one VIP can be mapped to each pool. - */ - @XmlElement - private ArrayList vips = new ArrayList(); - - /* - * List of all the pool members used for load balancing the traffic - */ - @XmlElement - private ArrayList members = new ArrayList(); - - /* - * Private constructor used for JAXB mapping - */ - @SuppressWarnings("unused") - private Pool() {} - - /** - * Getter/ Setter methods - */ - - public Pool(String name, - String lbMethod) { - this.name = name; - this.lbMethod = lbMethod; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the lbMethod - */ - public String getLbMethod() { - return lbMethod; - } - - /** - * @param lbMethod the lbMethod to set - */ - public void setLbMethod(String lbMethod) { - this.lbMethod = lbMethod; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @param status the status to set - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * @return the vip - */ - public ArrayList getAllVip() { - return vips; - } - - /** - * @param vip the vip to set - */ - public void setVips(ArrayList vips) { - this.vips = vips; - } - - /** - * @return the members - */ - public ArrayList getAllMembers() { - return members; - } - - /** - * @param members the members to set - */ - public void setMembers(ArrayList members) { - this.members = members; - } - - /** - * Add new VIP to the VIP list - * @param vip new VIP to add - */ - public void addVIP(VIP vip){ - this.vips.add(vip); - } - - /** - * Remove VIP with given name from the VIP list of the pool - * @param name Name of the VIP - * @return true If VIP was using this pool and removed - * false IF VIP is not using this pool - */ - public boolean removeVIP(String name){ - for(VIP vip: this.vips){ - if(vip.getName().equals(name)){ - this.vips.remove(vip); - return true; - } - } - return false; - } - - /** - * Check if the given pool member is part of this pool - * @param pm Search for this pool member - * @return true If pool member is attached to this pool - * false else - */ - public boolean poolMemberExists(PoolMember pm){ - return this.members.contains(pm); - } - - /** - * Returns the pool member with the given name - * @param name Search for this pool member - * @return PoolMember If pool member is attached to this pool - * null else - */ - public PoolMember getMember(String name){ - - for(PoolMember pm: this.members){ - if(pm.getName().equals(name)){ - return pm; - } - } - return null; - } - - /** - * Add new pool member to the pool - * @param pm Add this new pool - */ - public void addMember(PoolMember pm){ - this.members.add(pm); - } - - /** - * Remove pool member from the pool list - * @param name Remove this pool member - * @return true If pool member was attached to this pool and successfully removed - * false If pool member is not attached to this pool - */ - public boolean removeMember(String name){ - for(PoolMember pm: this.members){ - if(pm.getName().equals(name)){ - this.members.remove(pm); - return true; - } - } - return false; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result+ ((lbMethod == null) ? 0 : lbMethod.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof Pool)) { - return false; - } - Pool other = (Pool) obj; - if (lbMethod == null) { - if (other.lbMethod != null) { - return false; - } - }else if (!lbMethod.equals(other.lbMethod)) { - return false; - } - if (name == null) { - if (other.name != null) { - return false; - } - }else if (!name.equals(other.name)) { - return false; - } - return true; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Pool [name=" + name + ", lbMethod=" + lbMethod + ", status=" - + status + ", vips=" + vips + ", members=" + members + "]"; - } -} \ No newline at end of file