In addition to input packet data (and optional input meta data), all of the
example designs have an input cli_commands.txt
file. This file must, at a minimum, contain the run_traffic
command. For example, run_traffic
<packetname>
. (Refer to the previous section,
p4bm-vitisnet-cli application, for more information on the run_traffic
command).
It is also recommended that the command exit
be included at the end of every cli_commands.txt file, although this is not mandatory.
The cli_commands.txt file can contain the following commands:
- table_add
- Add an entry to the specified table
- table_modify
- Modify an existing entry on the specified table
- table_delete
- Delete an entry from the specified table
- table_clear
- Delete all entries from the specified table
- reset_state
- Delete all entries from all tables
- counter_read
- Read a counter value from a specified counter extern
- counter_write
- Update a counter value of a specified counter extern
- counter_reset
- Reset all counter values of a specified counter extern
- run_traffic
- Load traffic and metadata for the example
The format of each of the commands is as follows:
- table_add <table name> <action name> <match fields> => <action parameters> [priority]
- table_modify <table name> <entry handle> [action parameters]
- table_delete <table name> <entry handle>
- table_clear <table name>
- reset_state
- counter_read <counter name> <counter index>
- counter_write <counter name> <counter index> <byte count> <packet count>
- counter_reset <counter name>
-
run_traffic
<filename>
For the run_traffic command, the filename parameter specifies the input stimulus packet data and optional metadata files, where packet data is stored in the <filename>_in.pcap|user text file and metadata is stored in the <filename>_in.meta file. The command parameters are defined as follows:
- table_name
- The name given to the table in the P4 program. It is case sensitive.
- entry_handle
- The value given to reference an entry when it is added to the table
- action_name
- The name given to the action in the P4 program. It is case-sensitive.
- match_fields
- A space-separated list that appears in the same order as the table search key fields as specified in the P4 program. The format of the individual field depends on the match kind used for the field:
- action parameters
- A space-separated list of values that provides the parameters for the specified action. They must appear in the same order as they appear in the P4 program.
- priority
- In CAMs where multiple entries can match, the lowest priority value of the entry determines the winning response. It must only be specified when the table mode/type is STCAM or TCAM, otherwise it is omitted.
An example of a table_add for the following table with exact, lpm, and field_mask match_fields is as follows:
table test_table {
key = {meta.port : exact;
hdr.eth.dmac : lpm;
hdr.eth.smac : field_mask;
...}
table_add test_table update_flow 0x5 0x296f5d24202a/48 0xeebb6da832d8&&&0xffffffffffff...
Other examples of cli_commands.txt file entries are further explained in the following sections describing the individual example designs.