class 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 (host != null && vNetsByGuid.get(macToGuid.get(host)) != null)
				vNetsByGuid.get(macToGuid.get(host)).removeHost(host);
			if (host != null)
				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;
					}
				}
			}
		}
	}

}