use of net.floodlightcontroller.packet.LLDP in project open-kilda by telstra.
the class ConnectedDevicesService method deserializeLldp.
@VisibleForTesting
LldpPacketData deserializeLldp(Ethernet eth, SwitchId switchId, long cookie) {
try {
List<Integer> vlans = new ArrayList<>();
IPacket payload = EthernetPacketToolbox.extractPayload(eth, vlans);
if (payload instanceof LLDP) {
LldpPacket lldpPacket = new LldpPacket((LLDP) payload);
return new LldpPacketData(lldpPacket, vlans);
}
} catch (Exception exception) {
logger.info("Could not deserialize LLDP packet {} on switch {}. Cookie {}. Deserialization failure: {}", eth, switchId, Cookie.toString(cookie), exception.getMessage(), exception);
return null;
}
logger.info("Got invalid lldp packet: {} on switch {}. Cookie {}", eth, switchId, cookie);
return null;
}
use of net.floodlightcontroller.packet.LLDP in project open-kilda by telstra.
the class LldpPacketTest method buildLldpPacket.
static LldpPacket buildLldpPacket(byte[] packet) {
LLDP lldp = new LLDP();
lldp.deserialize(packet, 0, packet.length);
return new LldpPacket(lldp);
}
Aggregations