Search in sources :

Example 1 with StreamMessageRequest

use of p4.v1.P4RuntimeOuterClass.StreamMessageRequest in project onos by opennetworkinglab.

the class StreamClientImpl method packetOut.

@Override
public void packetOut(long p4DeviceId, PiPacketOperation packet, PiPipeconf pipeconf) {
    checkArgument(this.p4DeviceId == p4DeviceId);
    if (!isSessionOpen(p4DeviceId)) {
        log.warn("Dropping packet-out request for {}, session is closed", deviceId);
        return;
    }
    if (log.isTraceEnabled()) {
        log.trace("Sending packet-out to {}: {}", deviceId, packet);
    }
    try {
        // Encode the PiPacketOperation into a PacketOut
        final P4RuntimeOuterClass.PacketOut packetOut = CODECS.packetOut().encode(packet, null, pipeconf);
        // Build the request
        final StreamMessageRequest packetOutRequest = StreamMessageRequest.newBuilder().setPacket(packetOut).build();
        // Send.
        streamChannelManager.send(packetOutRequest);
    } catch (CodecException e) {
        log.error("Unable to send packet-out: {}", e.getMessage());
    }
}
Also used : P4RuntimeOuterClass(p4.v1.P4RuntimeOuterClass) CodecException(org.onosproject.p4runtime.ctl.codec.CodecException) StreamMessageRequest(p4.v1.P4RuntimeOuterClass.StreamMessageRequest)

Aggregations

CodecException (org.onosproject.p4runtime.ctl.codec.CodecException)1 P4RuntimeOuterClass (p4.v1.P4RuntimeOuterClass)1 StreamMessageRequest (p4.v1.P4RuntimeOuterClass.StreamMessageRequest)1