Skip to content

Is there "parsing" of PacketIn packets into Python data structs? #107

@jafingerhut

Description

@jafingerhut

I see in https://github.com/p4lang/p4runtime-shell/blob/main/usage/packet_io.md that one can use Pythonic syntax to fill in the controller packet metadata fields:

P4Runtime sh >>> p = packet_out()
P4Runtime sh >>> p.payload = b'AAAA'  # Note that the payload must be a byte string
P4Runtime sh >>> p.metadata['egress_port'] = '1'  # Note that the value must be a string
P4Runtime sh >>> p.send  # send the packet-out message

But I did not see any way to take a PacketIn message and access its payload and metadata fields in a similar style. I only found that one could use the PacketIn class to receive packets as Python Protobuf data structures.

Did I miss some feature to take the PacketIn's and make them readable using syntax like mypktin.payload, mypktin.metadata['egress_port'], etc.?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions