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

Replace unnecessary use of Scapy with ptf.pcap_writer in p4tc tests #5165

Conversation

jafingerhut
Copy link
Contributor

This replacement allows the resulting test program to be licensed under Apache 2.0 license.

This replacement allows the resulting test program to be licensed
under Apache 2.0 license.

Signed-off-by: Andy Fingerhut <andy.fingerhut@gmail.com>
@jafingerhut
Copy link
Contributor Author

@vbnogueira Please take a look at these changes, which are nearly identical to ones that I have made to bmv2 back end testing Python code in order to eliminate unnecessary uses of Scapy. If we do not do this, the Python files that import scapy must be licnesed as GPL-2.0-only. With these changes (assuming the tests still work -- waiting for CI test results now), the Python program can be licensed as Apache-2.0.

Regarding the standalone program named send_packet: as far as I can tell, it is not used anywhere. Would you be OK if we removed it? Or is it useful in your unit testing on your local development system, perhaps? I am OK if we keep it, as long as we license it as GPL-2.0-only, as proposed in this PR.

@vbnogueira
Copy link
Contributor

@vbnogueira Please take a look at these changes, which are nearly identical to ones that I have made to bmv2 back end testing Python code in order to eliminate unnecessary uses of Scapy. If we do not do this, the Python files that import scapy must be licnesed as GPL-2.0-only. With these changes (assuming the tests still work -- waiting for CI test results now), the Python program can be licensed as Apache-2.0.

Thank you for the heads up.
I'll run the test locally today or tomorrow.
Everything seems to be fine, but just want to double check.

Regarding the standalone program named send_packet: as far as I can tell, it is not used anywhere.

It is, but it's not very explicit.
We assign it as send_script here [1] and run it inside the VM here [2]

Would you be OK if we removed it? Or is it useful in your unit testing on your local development system, perhaps? I am OK if we keep it, as long as we license it as GPL-2.0-only, as proposed in this PR.

Yes, we need to keep it, but I have no problem in changing the licence.

[1] https://github.com/jafingerhut/p4c/blob/replace-scapy-with-apache-code-in-p4tc-tests/backends/tc/test_infra.py#L232
[2] https://github.com/jafingerhut/p4c/blob/replace-scapy-with-apache-code-in-p4tc-tests/backends/tc/test_infra.py#L285

@jafingerhut
Copy link
Contributor Author

@vbnogueira Please take a look at these changes, which are nearly identical to ones that I have made to bmv2 back end testing Python code in order to eliminate unnecessary uses of Scapy. If we do not do this, the Python files that import scapy must be licnesed as GPL-2.0-only. With these changes (assuming the tests still work -- waiting for CI test results now), the Python program can be licensed as Apache-2.0.

Thank you for the heads up. I'll run the test locally today or tomorrow. Everything seems to be fine, but just want to double check.

Running it locally will require using the latest version of the ptf package installed from https://github.com/p4lang/ptf source code. Using pip install ptf will get an older version.

@jafingerhut
Copy link
Contributor Author

@vbnogueira Looks like all tests are passing in CI with these changes, except the Python formatter, which I will fix soon. If you get good local test results with the latest version of https://github.com/p4lang/ptf code, please approve the PR (unless you have other suggestions for changes).

jafingerhut and others added 2 commits March 5, 2025 17:58
Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Signed-off-by: Andy Fingerhut <andy.fingerhut@gmail.com>
@jafingerhut jafingerhut added the p4tc Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run. label Mar 6, 2025
Signed-off-by: Andy Fingerhut <andy.fingerhut@gmail.com>
….com:jafingerhut/p4c into replace-scapy-with-apache-code-in-p4tc-tests
@jafingerhut
Copy link
Contributor Author

@vbnogueira Thanks for trying this out and approving. I will go ahead and merge given your approval and my testing.

FYI, I have found a small enhancement to the ptf package that should enable even your send_packet script to be licensed Apache-2.0, which I have tested with this PR: #5145

but given that it has a few other PRs that must be approved and merged before we can merge that one, it might be a while before that gets in.

@jafingerhut jafingerhut enabled auto-merge March 6, 2025 15:02
@jafingerhut
Copy link
Contributor Author

I jumped the gun on my previous comment -- merging this must wait for an approval from a reviewer with write access.

@jafingerhut jafingerhut added this pull request to the merge queue Mar 6, 2025
@@ -1,15 +1,7 @@
#!/usr/bin/env python3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this still needed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@vbnogueira Can we replace this code with the other utilities we are using?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fruffy It is currently used by the p4tc tests.

I have a way to update ptf and bf-pktpy with a few extra lines of code, such that we can relicense this send_packet file as Apache-2.0. I have those changes in this PR, but there are a couple of other PRs that must be approved and merged first before it can be merged: #5145

Merged via the queue into p4lang:main with commit 3e8b8c9 Mar 6, 2025
21 checks passed
@jafingerhut jafingerhut deleted the replace-scapy-with-apache-code-in-p4tc-tests branch March 6, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4tc Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants