Search in sources :

Example 6 with ONOSLLDP

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;
}
Also used : Ethernet(org.onlab.packet.Ethernet) ONOSLLDP(org.onlab.packet.ONOSLLDP)

Example 7 with ONOSLLDP

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()));
}
Also used : ONOSLLDP(org.onlab.packet.ONOSLLDP) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket)

Aggregations

ONOSLLDP (org.onlab.packet.ONOSLLDP)7 Ethernet (org.onlab.packet.Ethernet)3 ConnectPoint (org.onosproject.net.ConnectPoint)3 DeviceId (org.onosproject.net.DeviceId)3 PortNumber (org.onosproject.net.PortNumber)3 Type (org.onosproject.net.Link.Type)2 DefaultLinkDescription (org.onosproject.net.link.DefaultLinkDescription)2 LinkDescription (org.onosproject.net.link.LinkDescription)2 DefaultOutboundPacket (org.onosproject.net.packet.DefaultOutboundPacket)2 MacAddress (org.onlab.packet.MacAddress)1 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)1 Device (org.onosproject.net.Device)1 Port (org.onosproject.net.Port)1 DeviceService (org.onosproject.net.device.DeviceService)1