Search in sources :

Example 1 with ArpResponseReceivedBuilder

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

the class ArpUtilImpl method fireArpRespRecvdNotification.

private void fireArpRespRecvdNotification(String interfaceName, InetAddress srcInetAddr, byte[] srcMacAddressBytes, int tableId, BigInteger metadata, InetAddress dstInetAddr, byte[] dstMacAddressBytes) throws InterruptedException {
    arpRespRecvd.mark();
    IpAddress srcIp = new IpAddress(srcInetAddr.getHostAddress().toCharArray());
    IpAddress dstIp = new IpAddress(dstInetAddr.getHostAddress().toCharArray());
    String srcMacAddress = NWUtil.toStringMacAddress(srcMacAddressBytes);
    PhysAddress srcMac = new PhysAddress(srcMacAddress);
    String dstMacAddress = NWUtil.toStringMacAddress(dstMacAddressBytes);
    PhysAddress dstMac = new PhysAddress(dstMacAddress);
    ArpResponseReceivedBuilder builder = new ArpResponseReceivedBuilder();
    builder.setInterface(interfaceName);
    builder.setSrcIpaddress(srcIp);
    builder.setOfTableId((long) tableId);
    builder.setSrcMac(srcMac);
    builder.setMetadata(metadata);
    builder.setDstIpaddress(dstIp);
    builder.setDstMac(dstMac);
    ListenableFuture<?> offerNotification = notificationPublishService.offerNotification(builder.build());
    if (offerNotification != null && offerNotification.equals(NotificationPublishService.REJECTED)) {
        arpRespRecvdNotificationRejected.mark();
    } else {
        arpRespRecvdNotification.mark();
    }
}
Also used : IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) ArpResponseReceivedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.arputil.rev160406.ArpResponseReceivedBuilder) 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 ArpResponseReceivedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.arputil.rev160406.ArpResponseReceivedBuilder)1