@Test public void testDeleteHost() { testAddHost(); String host1Guid = vns.macToGuid.get(mac1); vns.deleteHost(mac1, null); assertFalse(vns.macToGuid.containsKey(mac1)); assertFalse(vns.portToMac.containsKey(hostPort1)); assertFalse(vns.vNetsByGuid.get(host1Guid).hosts.contains(mac1)); String host2Guid = vns.macToGuid.get(vns.portToMac.get(hostPort2)); vns.deleteHost(null, hostPort2); assertFalse(vns.macToGuid.containsKey(mac2)); assertFalse(vns.portToMac.containsKey(hostPort2)); assertFalse(vns.vNetsByGuid.get(host2Guid).hosts.contains(mac2)); String host3Guid = vns.macToGuid.get(mac3); vns.deleteHost(mac3, hostPort3); assertFalse(vns.macToGuid.containsKey(mac3)); assertFalse(vns.portToMac.containsKey(hostPort3)); assertFalse(vns.vNetsByGuid.get(host3Guid).hosts.contains(mac3)); }
@Override public void deleteHost(MACAddress mac, String port) { if (log.isDebugEnabled()) { log.debug("Removing host {} from port {}", mac, port); } if (mac == null && port == null) return; if (port != null) { MACAddress host = portToMac.remove(port); if(vNetsByGuid.get(macToGuid.get(host)) != null) vNetsByGuid.get(macToGuid.get(host)).removeHost(host); macToGuid.remove(host); } else if (mac != null) { if (!portToMac.isEmpty()) { for (Entry<String, MACAddress> entry : portToMac.entrySet()) { if (entry.getValue().equals(mac)) { if(vNetsByGuid.get(macToGuid.get(entry.getValue())) != null) vNetsByGuid.get(macToGuid.get(entry.getValue())).removeHost(entry.getValue()); portToMac.remove(entry.getKey()); macToGuid.remove(entry.getValue()); return; } } } } }
VirtualNetworkFilter implements IFloodlightModule, IVirtualNetworkService, IOFMessageListener { @Override public void deleteHost(MACAddress mac, String port) { if (log.isDebugEnabled()) { log.debug("Removing host {} from port {}", mac, port); } if (mac == null && port == null) return; if (port != null) { MACAddress host = portToMac.remove(port); if(vNetsByGuid.get(macToGuid.get(host)) != null) vNetsByGuid.get(macToGuid.get(host)).removeHost(host); macToGuid.remove(host); } else if (mac != null) { if (!portToMac.isEmpty()) { for (Entry<String, MACAddress> entry : portToMac.entrySet()) { if (entry.getValue().equals(mac)) { if(vNetsByGuid.get(macToGuid.get(entry.getValue())) != null) vNetsByGuid.get(macToGuid.get(entry.getValue())).removeHost(entry.getValue()); portToMac.remove(entry.getKey()); macToGuid.remove(entry.getValue()); return; } } } } } }
VirtualNetworkFilter implements IFloodlightModule, IVirtualNetworkService, IOFMessageListener { @Override public void deleteHost(MACAddress mac, String port) { if (log.isDebugEnabled()) { log.debug("Removing host {} from port {}", mac, port); } if (mac == null && port == null) return; if (port != null) { MACAddress host = portToMac.remove(port); if(vNetsByGuid.get(macToGuid.get(host)) != null) vNetsByGuid.get(macToGuid.get(host)).removeHost(host); macToGuid.remove(host); } else if (mac != null) { if (!portToMac.isEmpty()) { for (Entry<String, MACAddress> entry : portToMac.entrySet()) { if (entry.getValue().equals(mac)) { if(vNetsByGuid.get(macToGuid.get(entry.getValue())) != null) vNetsByGuid.get(macToGuid.get(entry.getValue())).removeHost(entry.getValue()); portToMac.remove(entry.getKey()); macToGuid.remove(entry.getValue()); return; } } } } }  }
VirtualNetworkFilter implements IFloodlightModule, IVirtualNetworkService, IOFMessageListener { @Override public void deleteHost(MACAddress mac, String port) { if (log.isDebugEnabled()) { log.debug("Removing host {} from port {}", mac, port); } if (mac == null && port == null) return; if (port != null) { MACAddress host = portToMac.remove(port); if(vNetsByGuid.get(macToGuid.get(host)) != null) vNetsByGuid.get(macToGuid.get(host)).removeHost(host); macToGuid.remove(host); } else if (mac != null) { if (!portToMac.isEmpty()) { for (Entry<String, MACAddress> entry : portToMac.entrySet()) { if (entry.getValue().equals(mac)) { if(vNetsByGuid.get(macToGuid.get(entry.getValue())) != null) vNetsByGuid.get(macToGuid.get(entry.getValue())).removeHost(entry.getValue()); portToMac.remove(entry.getKey()); macToGuid.remove(entry.getValue()); return; } } } } }  @Override void createNetwork(String guid, String network, Integer gateway); @Override void deleteNetwork(String guid); @Override void addHost(MACAddress mac, String guid, String port); @Override void deleteHost(MACAddress mac, String port); @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); @Override String getName(); @Override boolean isCallbackOrderingPrereq(OFType type, String name); @Override boolean isCallbackOrderingPostreq(OFType type, String name); @Override Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx); @Override Collection <VirtualNetwork> listNetworks(); }
VirtualNetworkFilter implements IFloodlightModule, IVirtualNetworkService, IOFMessageListener { @Override public void deleteHost(MACAddress mac, String port) { if (log.isDebugEnabled()) { log.debug("Removing host {} from port {}", mac, port); } if (mac == null && port == null) return; if (port != null) { MACAddress host = portToMac.remove(port); if(vNetsByGuid.get(macToGuid.get(host)) != null) vNetsByGuid.get(macToGuid.get(host)).removeHost(host); macToGuid.remove(host); } else if (mac != null) { if (!portToMac.isEmpty()) { for (Entry<String, MACAddress> entry : portToMac.entrySet()) { if (entry.getValue().equals(mac)) { if(vNetsByGuid.get(macToGuid.get(entry.getValue())) != null) vNetsByGuid.get(macToGuid.get(entry.getValue())).removeHost(entry.getValue()); portToMac.remove(entry.getKey()); macToGuid.remove(entry.getValue()); return; } } } } }  @Override void createNetwork(String guid, String network, Integer gateway); @Override void deleteNetwork(String guid); @Override void addHost(MACAddress mac, String guid, String port); @Override void deleteHost(MACAddress mac, String port); @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); @Override String getName(); @Override boolean isCallbackOrderingPrereq(OFType type, String name); @Override boolean isCallbackOrderingPostreq(OFType type, String name); @Override Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx); @Override Collection <VirtualNetwork> listNetworks();  }