-
Notifications
You must be signed in to change notification settings - Fork 444
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
[P4Testgen] Add a DPDK-PTF P4Testgen back end and the corresponding test runner #4173
Conversation
.github/workflows/PTF-TEST.yml
Outdated
on: | ||
push: | ||
branches: | ||
- ptf-test-pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test needs to be updated. I would recommend replacing the existing Github action workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it will replace the existing dpdk ptf ci.
4b9393e
to
de0a499
Compare
@Hoooao @fruffy Question about the goal of this PR: When I compile the latest version of p4testgen, install it, and then try running a command like this:
Is the purpose of this PR to somehow use p4testgen to auto-generate PTF tests and execute them? What p4testgen command line do you use to accomplish the generation of the PTF tests? |
Yes, the goal is be able to generate PTF tests for the DPDK PNA architecture using the command you described. |
@Hoooao It is obviously up to you when you want to consider this feedback relative to other changes you are making on this PR, but note that there are currently unresolved conflicts in a couple of files between your changes, and some files that have had commits merged in that change them. You can see the "This branch has conflicts that must be resolved" messages on the Github PR page for details. |
Thanks for the heads up |
@Hoooao Do you consider this read for review now, and then merging if reviews are OK? Or you expect to make more commits before review? |
The PR is not ready yet, there are some comments which are not addressed. @Hoooao is also investigating a problem with infrap4d. Sometimes it simply does not start in CI and the reason is unclear. |
FYI, in case it might be related to the reason you are seeing P4-DPDK fail to start, if you have a number of ports that is not a power of 2, it fails when you try to load a P4 program into it (not when it starts up, but when you try to do the SetForwardingPipelineConfig to load the P4 program). If you are having issues where infrap4d fails completely to start up at all, not even to the point that it should be waiting for a SetForwardingPipelineConfig request, then I do not have any guesses why that may be. |
It appears to be crashing when trying to launch |
My belief is that there should be no reason to run both infrap4d and bf_switchd. bf_switchd gives TDI access to table add/modify/delete operations in the P4-DPDK data plane. infrap4d contains a P4Runtime API server based on the Stratum code that listens for incoming TCP connection requests from P4Runtime API clients, and translates request messages into the appropriate TDI add/modify/delete operations. Running both at the same time would likely only lead to problems, would be my guess. |
|
I was unaware of that. Thanks for the info. My statement is still correct, I think, from the perspective that there is no reason if you are manually running commands in sequence, to start both infrap4d and bf_switchd from the command line. You pick one. |
In our case we are calling |
b4d502a
to
9068f58
Compare
@jafingerhut In this run https://github.com/p4lang/p4c/actions/runs/6501241470/job/17658197303?pr=4173 infrap4d fails to start (and appears to crash). This seemingly only happens in CI. Do you know anyone we could poke about this? |
@bharticemk @5abeel @satish153 @swaroopsarma Would one of you know why @fruffy (Fabian) might be experiencing the problems described in this comment: #4173 (comment) ? I have run infrap4d within an IPDK Networking docker container before, but I have not yet attempted to do so outside of a Docker container, which I believe Fabian is trying to do here. I do not have a good summary of exactly how he has built and runs these tests, but I believe all of the details are available in this PR and the code it is based upon. |
Test whole before modifing ptf tests Added new ptf.cpp and base_test.py Fix typo Added to CMake Fix option var Pkt size start fro 4096 CI for ptf-test-pr Show tests Add all dpdk tests to pna xFail updat lint&test ci added; reference file added Infrap4d failed
changed log_dir to default for collection add_on_miss only testgen on Add logs ci to main
@jafingerhut We identified two issues. First, Github CI uses transparent hugepages which apparently can interfere with Second, and more importantly, we are running all tests sequentially now. Both of these fixes lets us run DPDK PTF tests reliably. This PR is now ready. It enables a pipeline to run P4Testgen on all available P4 DPDK programs, generate 10 tests for each program, then execute them. It also adds a PTF DPDK testing library which does not rely on p4runtime shell and instead uses Protobuf messages directly. @Hoooao implemented all of this. The generated tests are still very basic of course, but we can make them more complex over time. |
backends/dpdk/base_test.py
Outdated
@@ -0,0 +1,1142 @@ | |||
# This file was copied and then modified from the file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of redundancy here. We can likely make this a shared library for both BMv2 and DPDK.
if returncode != testutils.SUCCESS: | ||
testutils.log.error("Failed to load pipeline") | ||
return returncode | ||
# NOTE: in generated PTF tests, the pipelines are loaded in individual test cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should be removed. Fewer moving parts is good.
Is there any difference between the Python code in this PR for creating/parsing Protobuf messages, and that used for any target, e.g. BMv2, other than DPDK? It seems beneficial to have as few different Python libraries for this as we can get down to. |
@Hoooao Github reports that this branch is out-of-date with the base branch. Can you resolve any conflicts, please? |
There are subtle differences in the two libraries, largely revolving around election id and device id. We could fix this in a separate PR and add a common P4Runtime communication library?
This is a Github feature. The branch does not have conflicts, but HEAD moved on. It is a benign mismatch I'd say. |
The changes were easy enough to do them here. We now have one single P4Runtime Python library that we can use for both BMv2 and DPDK. Will do some more cleanup for this PR. We will also have to fix the deprecated add-on-miss test. |
backends/dpdk/run-dpdk-ptf-test.py
Outdated
# 9559 is the default P4Runtime API server port | ||
GRPC_PORT: int = 9559 | ||
# 28000 is the default P4Runtime API server port | ||
GRPC_PORT: int = 28000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no personal issue if you want to use a non-default port number for the P4Runtime API connection, but this change to the comment is definitely incorrect. 9559 is the default port, as mentioned in the P4Runtime API spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for my latest minor comment about a comment that was changed to now be factually incorrect, this looks good to me.
Fixed. I believe 28000 was the old port. I have created an issue (#4204) for the remaining TODOs. This will be done in a new PR. |
Improved based on #4072 to use Testgen to generate PTF tests for pna/dpdk p4 programs.