/** * Sets service network gateway MAC address and sends out gratuitous ARP to all VMs to update the * gateway MAC address. * * @param mac mac address */ private void setServiceGatewayMac(MacAddress mac) { if (mac != null && !mac.equals(gatewayMac)) { gatewayMac = mac; log.debug("Set service gateway MAC address to {}", gatewayMac.toString()); } // TODO get existing service list from XOS and replace the loop below Set<String> vNets = Sets.newHashSet(); hostService.getHosts().forEach(host -> vNets.add(host.annotations().value(SERVICE_ID))); vNets.remove(null); vNets .stream() .forEach( vNet -> { CordService service = getCordService(CordServiceId.of(vNet)); if (service != null) { arpProxy.sendGratuitousArp( service.serviceIp(), gatewayMac, service.hosts().keySet()); } }); }