Search in sources :

Example 1 with ARP

use of net.floodlightcontroller.packet.ARP in project open-kilda by telstra.

the class ConnectedDevicesServiceTest method buildArpPacket.

private ARP buildArpPacket(byte[] data) throws PacketParsingException {
    ARP arp = new ARP();
    arp.deserialize(data, 0, data.length);
    return arp;
}
Also used : ARP(net.floodlightcontroller.packet.ARP)

Example 2 with ARP

use of net.floodlightcontroller.packet.ARP in project open-kilda by telstra.

the class ConnectedDevicesService method deserializeArp.

@VisibleForTesting
ArpPacketData deserializeArp(Ethernet eth, SwitchId switchId, long cookie) {
    try {
        List<Integer> vlans = new ArrayList<>();
        IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans);
        if (payload instanceof ARP) {
            return new ArpPacketData((ARP) payload, vlans);
        }
    } catch (Exception exception) {
        logger.info("Could not deserialize ARP packet {} on switch {}. Cookie {}. Deserialization failure: {}", eth, switchId, Cookie.toString(cookie), exception.getMessage(), exception);
        return null;
    }
    logger.info("Got invalid ARP packet: {} on switch {}. Cookie {}", eth, switchId, cookie);
    return null;
}
Also used : IPacket(net.floodlightcontroller.packet.IPacket) ArrayList(java.util.ArrayList) ARP(net.floodlightcontroller.packet.ARP) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

ARP (net.floodlightcontroller.packet.ARP)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ArrayList (java.util.ArrayList)1 IPacket (net.floodlightcontroller.packet.IPacket)1