-
Notifications
You must be signed in to change notification settings - Fork 31
Enabling Bmv2
If you use the web interface to launch your P4 program, you only needs to select Bmv2 as target. All these steps can be skipped in this case.
If you use P4Pi from a terminal (either ssh or web terminal), you can switch from T4P4S to Bmv2 with the following commands:
systemctl stop t4p4s.service
systemctl disable t4p4s.service
systemctl enable bmv2.service
These commands first stop T4P4S, then disable the related service to prevent any conflicts with Bmv2. Finally, the Bmv2 service is enabled.
After that, you can run examples with Bmv2 via the bmv2.service. For example, l2switch example program (in folder "/root/bmv2/examples/l2switch") can be launched with two commands:
echo "l2switch" > /root/t4p4s-switch
systemctl restart bmv2.service
Note that the name of the P4 project to be compiled should be placed in /root/t4p4s-switch file (the same file works for both t4p4s and bmv2 backends).
You can stop the P4 program with stopping the Bmv2 service:
systemctl stop bmv2.service
P4Runtime API is available on port 50051. P4Pi comes with a preinstalled P4Runtime Shell (p4rtshell). To make its usage easier, we also created a helper script that fills the parameters and connect to the switch (running l2switch program in the example):
bmv2-p4rtshell l2switch
This command will hand p4info and json files of the P4 project given as a cmdline argument (l2switch in this case).
The service runs '/usr/bin/bmv2-start' scripts. If you need different networking settings, you can easily modify this script (e.g., adding --debugger option to the call of simple_switch_grpc).
-
Bmv2 Exercises