Add Switch Node
On the top menu, click in "Add Node"
The "Add Node" window will appear, select the "Switch" option
All the fields are mandatory:
Name: name of the switch that will be used to create the container
P4 Code name: name of the compiled P4 Code compiled with the P4 Compiler with the .json extension
API Port: port where the API of the BMv2 switch will be listening for openflow commands
Ports: number of ports
SW Entries: commands to be passed to the API at the start of the container. All the commands must be separated by ";".
Example:
The entry below inform the table "ipv4_lpm" to apply the function "ipv4_forward" when the destiny IP is 10.0.1.2, and then, to send this packet to the port 1 with the destine to the MAC Address 00:00:00:00:01:02. There is no limit of commands that can be provided in this field, as long as they are separeted by ";"
table_add MyIngress.ipv4_lpm ipv4_forward 10.0.1.2 => 00:00:00:00:01:02 1

When creating P4 switches, the order of the ports is important, since we must specify the input and output ports. By default, the P4D-GUI will set the ports, starting at 1, in thcd noe order that they appear on the canvas.

In this example, port "sw1-p1" will be set as port 1 in the bmv2 switch and port sw1-p2 as port 2. If you want to change the port numbering, just drag the port to change the order:

In this scenario, we change the order of the ports by just dragging the port sw1-p2 before the port sw1-p1. The BMv2 switch will then start with the port sw1-p2 as port 1 and sw1-p1 as port 2.
Last updated