[P4-dev] [Simple Switch GRPC] Send packet to switch

Antonin Bas antonin at barefootnetworks.com
Mon Sep 24 09:05:30 EDT 2018

That may not be your issue here, but the Python code looks strange to me. I
believe that the StreamChannel RPC takes an iterator as a parameter. As per
the P4Runtime specification, the stream is also supposed to stay open for
the lifetime of the client, you are not supposed to open a new stream for
every PacketIn request. See here for a correct Python example:

On Mon, Sep 24, 2018 at 5:36 AM Steffen Lindner <
steffen.lindner at student.uni-tuebingen.de> wrote:

> Hi all,
> i’m trying to send a packet generated at the controller to a switch. I’m
> using the setup from the p4lang tutorial (mininet and P4 runtime), adjusted
> the target (simple switch grpc) and added the cpu port in the cli
> simple_switch_grpc -i 1 at s1-eth1 -i 2 at s1-eth2 --pcap
> /media/sf_Implementation/P4-Implementation/pcaps --nanolog
> ipc:///tmp/bm-0-log.ipc --device-id 0 --no-p4 --log-console --thrift-port
> 9090 -- --grpc-server-addr --cpu-port 16
> I managed to add table entries on the switch via the controller (so
> connection shouldn’t be the problem)
> However, when trying to send a packet from the controller to the switch
> using
> def WritePacketOut(self, payload):
>     request = p4runtime_pb2.StreamMessageRequest()
>     request.packet.payload = payload
>     try:
>         self.client_stub.StreamChannel(request)
>     except Exception as e:
>         Log.error(e)
> i don’t get the message at the switch. I even don’t see a packet in at the
> port 16.
> I’m using the V1Model and have no idea how to proceed. I didn’t find any
> explanation on how to send packets from the controller to the switch. Could
> someone give me a hint?
> Kind regards.
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20180924/c0519677/attachment.html>

More information about the P4-dev mailing list