The run-p4bm-vitisnet application is a helper utility included to improve the ease of use of both p4bm-vitisnet and p4bm-vitisnet-cli applications by abstracting the user from launching both processes and providing the ability to apply a set of commands automatically from a file.
The program accepts two mandatory parameters - the .json file (used by p4bm-vitisnet) and a test-case text file containing the CLI commands (passed into p4bm-vitisnet-cli). When invoked, the application launches both p4bm-vitisnet and p4bm-vitisnet-cli as sub-processes. Once both processes have started and their connection has been established, run-p4bm-vitisnet opens the specified test-case text file and reads its contents line by line. Blank lines and comment lines (those which start with the '#') character are ignored. All other lines are passed into the p4bm-vitisnet-cli sub-process. When the end of the test-case file is reached, run-p4bm-vitisnet sends the exit command to p4bm-vitisnet-cli, causing both sub-processes to terminate gracefully.
The application supports the command line parameters described in the following table. The following snippit shows an example of the help command line parameter.
run-p4bm-vitisnet --help
usage: run-p4bm-vitisnet [-h] [-p THRIFT_PORT] [-l LOG_FILE] -j JSON
[-s SCRIPT[ [-m LOAD_MODULES] [-d] [-c CONNECT_COUNT]
Parameter | Description |
---|---|
-h, --help | Shows this help message response (see above example) |
-p THRIFT_PORT, --thrift-port THRIFT_PORT | Thrift server port for simulation |
-l LOG_FILE, --log-file LOG_FILE | Name for simulation output logs |
-j JSON, --json JSON | JSON description of P4 program to simulate |
-s SCRIPT, --script SCRIPT | File containing commands to run through simulator |
-d, --drop-zero-length | Emit dropped packets as zero length packets |
-c CONNECT_COUNT, --connect-count CONNECT_COUNT | Number of times to attempt thrift connection (0 => unlimited) |
-m LOAD_MODULES, --load-modules LOAD_MODULES | Comma separated list of runtime loadable modules (such as extern modeling) |