Search in sources :

Example 1 with MacChangedBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.arputil.rev160406.MacChangedBuilder in project genius by opendaylight.

the class ArpUtilImpl method checkAndFireMacChangedNotification.

private void checkAndFireMacChangedNotification(String interfaceName, InetAddress inetAddr, byte[] macAddressBytes) throws InterruptedException {
    IpAddress ip = new IpAddress(inetAddr.getHostAddress().toCharArray());
    String macAddress = NWUtil.toStringMacAddress(macAddressBytes);
    PhysAddress mac = new PhysAddress(macAddress);
    if (!macAddress.equals(macsDB.get(interfaceName + "-" + inetAddr.getHostAddress()))) {
        if (LOG.isTraceEnabled()) {
            LOG.trace("mac address changed for {}", inetAddr);
        }
        MacChangedBuilder builder = new MacChangedBuilder();
        builder.setInterface(interfaceName);
        builder.setIpaddress(ip);
        builder.setMacaddress(mac);
        notificationPublishService.putNotification(builder.build());
    }
}
Also used : MacChangedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.arputil.rev160406.MacChangedBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Aggregations

IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)1 MacChangedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.arputil.rev160406.MacChangedBuilder)1