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

Add docs on using pmm (packet manipulation module) bf_pktpy, and option to select pmm by env variable #213

Merged
merged 24 commits into from
Mar 14, 2025

Conversation

jafingerhut
Copy link
Collaborator

@jafingerhut jafingerhut commented Feb 16, 2025

It is expected that these PRs are approved and merged before this one:

Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
@jafingerhut
Copy link
Collaborator Author

The CI failures here cannot have anything to do with the changes, since they are only fixing a typo in a comment and top-level README doc changes. See #212 for one way to update CI to pass.

Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
@jafingerhut jafingerhut changed the title Add documentation on using packet manipulation module bf_pktpy Add docs on using pmm (packet manipulation module) bf_pktpy, and option to select pmm by env variable Feb 24, 2025
@jafingerhut
Copy link
Collaborator Author

These changes have been tested by passing all p4c tests, with some additional changes to p4c that cause it to use bf-pktpy as the ptf's packet manipulation module, instead of the default scapy.

See here: p4lang/p4c#5145

Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
…capy

Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
jafingerhut and others added 7 commits March 6, 2025 02:34
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Copy link
Contributor

@fruffy fruffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider making bf_pktpy the default with the next release?

ptf
if getattr(args, pmm_key):
# Then use the value from the command line option.
config[pmm_key] = getattr(args, pmm_key)
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elif?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in commit 23

@@ -72,6 +72,94 @@ yum install tcpdump
apt-get install tcpdump
```

### Using `bf_pktpy` as an alternate packet manipulation module

The Python module `bf_pktpy` is included as part of the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider making that module standalone or upstreaming it to PTF.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a temporary repo with only the bf_pkpy code by itself here, and it does allow one to pip install it just fine in my testing: https://github.com/jafingerhut/bf-pktpy

I don't have a big opinion on whether open-p4studio should be modified to install it from a new https://github.com/p4lang/bf-pktpy repo, or if we end up with 2 copies of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is easiest to vendor it as part of ptf, because it is specially built for this use case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you thinking an arrangement where pip install ptf installs code such that you can then do import ptf and/or import bf_pktpy?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, partially for convenience. Partially because bf_pktpy is specialized towards PTF and this coupling makes sure its functionality is scoped for PTF-style use cases.

jafingerhut and others added 2 commits March 13, 2025 21:30
Signed-off-by: Andy Fingerhut <andy.fingerhut@gmail.com>
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
@jafingerhut jafingerhut merged commit 0fbd248 into p4lang:main Mar 14, 2025
9 checks passed
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

Successfully merging this pull request may close these issues.

2 participants