Search in sources :

Example 1 with PacketEvent

use of org.onosproject.net.packet.PacketEvent in project onos by opennetworkinglab.

the class DistributedPacketStore method emit.

@Override
public void emit(OutboundPacket packet) {
    NodeId myId = clusterService.getLocalNode().id();
    NodeId master = mastershipService.getMasterFor(packet.sendThrough());
    if (master == null) {
        return;
    }
    if (myId.equals(master)) {
        notifyDelegate(new PacketEvent(Type.EMIT, packet));
        return;
    }
    communicationService.unicast(packet, PACKET_OUT_SUBJECT, SERIALIZER::encode, master).whenComplete((r, error) -> {
        if (error != null) {
            log.warn("Failed to send packet-out to {}", master, error);
        }
    });
}
Also used : NodeId(org.onosproject.cluster.NodeId) PacketEvent(org.onosproject.net.packet.PacketEvent)

Aggregations

NodeId (org.onosproject.cluster.NodeId)1 PacketEvent (org.onosproject.net.packet.PacketEvent)1