p4lang / p4c

P4_16 reference compiler
https://p4.org/
Apache License 2.0
665 stars 440 forks source link

Port v1model testcases to dpdk #3407

Open kamleshbhalui opened 2 years ago

kamleshbhalui commented 2 years ago

Hi All, we are trying to port v1model testcases for dpdk(PSA) essentially for more coverage and make it part of p4c repo. I see there are two way to achieve it 1) Copy the v1model testcases in new file and modify it so it compiles with p4c-dpdk 2) Modify same testcase with some if def preprocessor directives, so it compiles with both compiler bmv and dpdk.

Before going ahead and putting effort I would to know communities thoughts on above or any new suggestions also welcomed.

@mbudiu-vmw @hanw @jafingerhut

mihaibudiu commented 2 years ago

There isn't really an easy way to convert programs between different target models. For adding new test cases I would probably just copy each file and modify it manually.

jafingerhut commented 2 years ago

I also do not know of any automated way to convert programs written for the v1model architecture into programs for the PSA architecture that have equivalent behavior. Manual conversion should not be difficult, although it could take a while.

If your goal is coverage of features, I would make a list of PSA features in the data plane, and ensure that each one of them is tested by at least one test program, ideally with packets flowing through in an automated test case in a way that you can tell from the output packets whether that data plane feature is at least basically working, or not. For example, unicast, multicast, drop, recirculate, clone, with extra user-defined metadata carried with the packets on those paths, digest, counter, register, (meter can be a bit tricky to get an automated test for if you don't have careful control over timing of arriving packets, so maybe best to skip those except for a basic test that the first packet updating most meters should give a green color back), action profile, action selector, etc.

There is a list of test cases that we developed PSA programs for the BMv2 psa_switch program here, that is obviously not complete because psa_switch and its p4c back end for PSA are not complete, but it might give you ideas for what kinds of test cases to write, and also PSA programs that you can use for the DPDK back end without modification, if you have not already taken advantage of them in your testing: https://github.com/jafingerhut/p4-guide/tree/master/psa-test-info