DPL applications are deployed to the NVIDIA® BlueField® networking platform (DPU or SuperNIC) via the P4Runtime API.
Since DPL is derived from the P4-16 language, it is compatible with the P4Runtime specification, enabling standard runtime interaction with the compiled DPL pipeline.
Introduction
The P4 Runtime shell (p4runtime_sh) is an open-source CLI tool that provides an interface to the P4Runtime API. It is especially useful for:
-
Loading simple DPL programs
-
Testing match-action tables
-
Debugging pipeline behavior
The shell can be invoked using the launch script provided in the DPL Development container.
For detailed instructions, refer to Loading DPL Applications.
p4runtime_sh Usage
The following are example commands for using the p4runtime_sh P4 Controller after loading a program.
P4 info
|
Operation |
Command |
|---|---|
|
Retrieves the content of |
Python
|
P4 Table
|
Operation |
Command |
|---|---|
|
Lists all P4 tables |
Python
|
|
Displays information about a specific P4 table |
Python
|
Working with P4 Table Entries
|
Operation |
Command |
||||||||
|---|---|---|---|---|---|---|---|---|---|
|
Default Entry |
|||||||||
|
Reads P4 table's default entry without counter's value |
Python
|
||||||||
|
Reads P4 table's default entry with counter's value Supported only if a direct counter is enabled on the P4 table. |
Python
|
||||||||
|
Modifies P4 table's default entry action A default entry cannot be removed or inserted. It can only be modified to perform a different P4 action. |
Python
|
||||||||
|
Regular Entries |
|||||||||
|
Note: In the following examples, some commands require specifying the match key of the desired regular P4 table key. The syntax for specifying a match key varies according to the defined match method for each key (per the DPL source code where the keys are defined on the P4 table).
For simplicity, the following examples are written using |
|||||||||
|
Reading Entries |
|||||||||
|
Reads a specific regular P4 table entry |
Python
|
||||||||
|
Reads all regular entries from a P4 table |
Python
|
||||||||
|
Reads all regular entries from all P4 tables in the P4 program |
Python
|
||||||||
|
Adding Entries |
|||||||||
|
Adds a regular P4 table entry |
Python
|
||||||||
|
Deleting Entries |
|||||||||
|
Deletes a specific regular P4 table entry |
Python
|
||||||||
|
Deletes all regular entries from a P4 table |
Python
|
||||||||
Working with Direct Counters
This allows working with Direct Counter directly without getting the whole Table Entry info.
|
Operation |
Command |
|---|---|
|
Lists all defined Direct Counters |
Python
|
|
Default Entry |
|
|
Reads counter data of a default entry in a Direct Counter |
Python
|
|
Clears counter data of a default entry in a Direct Counter |
Python
|
|
Regular Entries |
|
|
Reads counter data of a a specific P4 table entry in a Direct Counter |
Python
|
|
Reads all counter data of specific Direct Counter This will also read the default entry counter data. |
Python
|
|
Clears counter data of a a specific P4 table entry in a Direct Counter |
Python
|
|
Clears all counter data of specific Direct Counter This also clears the default entry counter data. |
Python
|
|
Clears all direct counters from all table |
Python
|
Working with Indirect Counters
|
Operation |
Command |
|---|---|
|
Lists all defined Indirect Counters |
Python
|
|
Shows info about a specific Indirect Counter |
Python
|
|
Reads a specific value from a specific indirect counter |
Python
|
|
Reads all values from a specific indirect counter |
Python
|
|
Clears a specific value from a specific indirect counter |
Python
|
|
Clears all values from a specific indirect counter |
Python
|
P4 Actions
|
Operation |
Command |
|---|---|
|
Lists all defined P4 actions |
Python
|
|
Shows info about a specific P4 actions This includes its parameters' names and sizes. |
Python
|
Packet IO
To use packet IO, it must be enabled in the P4 program source code.
|
Operation |
Command |
|---|---|
|
Packet In – For receiving packets sent from the DPL Runtime daemon to the P4 Controller (according to defined rules in the DPL program) |
|
|
Captures packets for 10 second, then displays them |
Python
|
|
Captures packets for 10 second, then displays them parsed as well as their metadata info |
This example command uses the Bash
Then, from the Python
|
|
Packet Out – For sending a packet from the |
|
|
Syntax of sending a packet |
Python
Repeat the |
|
Example of building and sending a packet |
Using Python
Then send it using the Python
|
Idle Timeout Notifications
To receive idle timeout notifications in the controller, the DPL program must specify the table attribute nv_support_timeout in the source code.
|
Operation |
Command |
|---|---|
|
idle_timeout_notification – For receiving notifications sent from the DPL Runtime daemon to the P4 Controller (according to defined tables in the DPL program) |
|
|
Captures notifications for 10 second, then displays them |
Python
|
Last updated: