behavioral-model
behavioral-model copied to clipboard
--use-files should create files for outputs even if the interface is not provided
Currently, --use-files
seems to generate a .pcap
file per interface provided via -i
. The problem with this approach is that packets that are emitted on ports which are not provided via -i
are not written to a file. This makes testing harder since you can not make sure that a particular packet is dropped unless you pass all 511 ports as arguments.
Is there a way to easily fix this and just generate an output file? Since no name is provided we can freely choose a basename.
I can think of a couple of options:
-
Introduce a new command line option that, when present, means "for any port number for which
-i
is not given, still have--use-files
create a file for it". You probably want to specify a directory for those files, since there can be so many of them. -
Change the default behavior so that
--use-files
, with no additional command line options, creates all of those files.
I guess for v1model there is a well-defined maximum port of 511 because of the bit<9>
for the egress_spec field size? I ask mainly because I half-recall someone maybe wanting to specify a drop port value larger than that at one point, but maybe that was only a control plane API port number, not a v1model data plane port number.
I think it's ok if someone wants to change that behavior: https://github.com/p4lang/behavioral-model/blob/6ee70b5eff7f510b32c074aaa4f00358f594fecb/src/bm_sim/pcap_file.cpp#L381-L392
A command-line option to toggle that behavior (and maybe specify a basename for the files) would be a good idea.
That being said, when it comes to testing simple_switch_grpc, using the gRPC service to read / write packets should pretty much always be a better idea: https://github.com/p4lang/behavioral-model/blob/main/services/p4/bm/dataplane_interface.proto. And you should always be getting the packets, no matter whether the egress port number matches a valid "front panel" port.
That being said, when it comes to testing simple_switch_grpc, using the gRPC service to read / write packets should pretty much always be a better idea: https://github.com/p4lang/behavioral-model/blob/main/services/p4/bm/dataplane_interface.proto. And you should always be getting the packets, no matter whether the egress port number matches a valid "front panel" port.
This is definitely something I am considering for the PTF tests, but I have not written the PTF extension for it yet sadly.
In this particularly case I am hitting the limitations with the Thrift-based version, so it might make more sense to augment options there. Seems like it should be straightforward, thanks!
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or this will be closed in 180 days