use of org.onlab.packet.ONOSLLDP in project onos by opennetworkinglab.
the class NetworkConfigLinksProvider method verify.
private boolean verify(PacketContext packetContext) {
Ethernet eth = packetContext.inPacket().parsed();
if (eth == null) {
return false;
}
ONOSLLDP onoslldp = ONOSLLDP.parseONOSLLDP(eth);
if (onoslldp != null) {
if (!isOthercluster(eth.getSourceMAC().toString())) {
return false;
}
if (!ONOSLLDP.verify(onoslldp, context.lldpSecret(), context.maxDiscoveryDelay())) {
log.warn("LLDP Packet failed to validate!");
return false;
}
return true;
}
return false;
}
use of org.onlab.packet.ONOSLLDP in project onos by opennetworkinglab.
the class LinkDiscovery method createOutBoundLldp.
/**
* Creates packet_out LLDP for specified output port.
*
* @param portNumber the port
* @param portDesc the port description
* @return Packet_out message with LLDP data
*/
private OutboundPacket createOutBoundLldp(Long portNumber, String portDesc) {
if (portNumber == null) {
return null;
}
ONOSLLDP lldp = getLinkProbe(portNumber, portDesc);
if (lldp == null) {
log.warn("Cannot get link probe with portNumber {} and portDesc {} for {} at LLDP packet creation.", portNumber, portDesc, deviceId);
return null;
}
ethPacket.setSourceMACAddress(context.fingerprint()).setPayload(lldp);
return new DefaultOutboundPacket(deviceId, builder().setOutput(portNumber(portNumber)).build(), ByteBuffer.wrap(ethPacket.serialize()));
}
Aggregations