LoadBalancer implements IFloodlightModule,
    ILoadBalancerService, IOFMessageListener { @Override public int removeMember(String memberId) { LBMember member; member = members.get(memberId); if(member != null){ if (member.poolId != null) pools.get(member.poolId).members.remove(memberId); members.remove(memberId); return 0; } else { return -1; } }  @Override String getName(); @Override boolean isCallbackOrderingPrereq(OFType type, String name); @Override boolean isCallbackOrderingPostreq(OFType type, String name); @Override net.floodlightcontroller.core.IListener.Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx); void pushPacket(IPacket packet, 
                           IOFSwitch sw,
                           OFBufferId bufferId,
                           OFPort inPort,
                           OFPort outPort, 
                           FloodlightContext cntx,
                           boolean flush); void pushStaticVipRoute(boolean inBound, Route route, IPClient client, LBMember member, IOFSwitch pinSwitch); @Override Collection<LBVip> listVips(); @Override Collection<LBVip> listVip(String vipId); @Override LBVip createVip(LBVip vip); @Override LBVip updateVip(LBVip vip); @Override int removeVip(String vipId); @Override Collection<LBPool> listPools(); @Override Collection<LBPool> listPool(String poolId); @Override LBPool createPool(LBPool pool); @Override LBPool updatePool(LBPool pool); @Override int removePool(String poolId); @Override Collection<LBMember> listMembers(); @Override Collection<LBMember> listMember(String memberId); @Override Collection<LBMember> listMembersByPool(String poolId); @Override LBMember createMember(LBMember member); @Override LBMember updateMember(LBMember member); @Override int removeMember(String memberId); @Override Collection<LBMonitor> listMonitors(); @Override Collection<LBMonitor> listMonitor(String monitorId); @Override LBMonitor createMonitor(LBMonitor monitor); @Override LBMonitor updateMonitor(LBMonitor monitor); @Override int removeMonitor(String monitorId); @Override Collection<Class<? extends IFloodlightService>> getModuleServices(); @Override Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls(); @Override Collection<Class<? extends IFloodlightService>> getModuleDependencies(); @Override void init(FloodlightModuleContext context); @Override void startUp(FloodlightModuleContext context); public Comparator<SwitchPort> clusterIdComparator; }
@Test public void testRemoveMember() { testCreateVip(); testCreatePool(); testCreateMember(); assertFalse(vip1==null); assertFalse(vip2==null); assertFalse(pool1==null); assertFalse(pool2==null); assertFalse(pool3==null); assertFalse(member1==null); assertFalse(member2==null); assertFalse(member3==null); assertFalse(member4==null); lb.removeMember(member1.id); lb.removeMember(member2.id); lb.removeMember(member3.id); lb.removeMember(member4.id); assertFalse(lb.members.containsKey(member1.id)); assertFalse(lb.members.containsKey(member2.id)); assertFalse(lb.members.containsKey(member3.id)); assertFalse(lb.members.containsKey(member4.id)); assertFalse(lb.pools.get(member1.poolId).members.contains(member1.id)); assertFalse(lb.pools.get(member2.poolId).members.contains(member2.id)); assertFalse(lb.pools.get(member3.poolId).members.contains(member3.id)); assertFalse(lb.pools.get(member4.poolId).members.contains(member4.id)); }