Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jafingerhut opened this issue Jan 8, 2023 · 1 comment
Open

Comments

@jafingerhut
Copy link
Collaborator

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.?

@antoninbas
Copy link
Member

From looking at the code, it doesn't seem that this functionality is available at the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants