Skip to content

2) Running P7

Fabricio Rodríguez edited this page Jan 31, 2024 · 3 revisions

About

After setting up your topology, we need to run P7. On this page, you will find the steps needed to run your experiments.

Running P7 with (recommended)

After setting the topology generation script, we can run the file to create the necessary P7 files.

# cd /home/user/p7
# python3 main.py

Now, we need to set the files in the correct location.

# ./set_files.sh

In a different terminal, we can compile the P7 P4 code, the user P4 code, and run the switch.

# ../tools/p4_build.sh /home/user/p7/p4src/p7calc_mod.p4
# ../tools/p4_build.sh /home/user/p7/p4src/p7_default.p4
# ./run_switchd.sh -p p7_default p7calc_mod -c /home/user/p7/p4src/multiprogram_custom_bfrt.conf

Having the switch running, we can configure the ports and the tables.

# bfshell -b ~/user/p7/files/bfrt.py
# bfshell -f ~/user/p7/files/ports_config.txt -i

With everything set, we can start testing the network.

Running P7 with Stratum (old method)

After setting the topology generation script, we can run the file to create the necessary P7 files.

# cd /home/user/p7
# python3 main.py

Now, we need to set the files in the correct location.

# ./set_files.sh

Start Stratum. First, we set the generated CHASSIS_CONFIG file: Please refer to the official documentation to build and run stratum (https://github.com/stratum/stratum/blob/main/stratum/hal/bin/barefoot/README.build.md)

# export CHASSIS_CONFIG="/home/admin12/p7/p7_rnp/files/chassis_config.pb.txt"
# ./start-stratum.sh

In a different terminal, we can compile the P4 code and start the P4 runtime connection to fill the tables and send the P4.

The P4 code is in p4src/p7_default. Please compile and set all the json, conf, and binaries in p4src/output_dir/

Having all the files ready, we can start the p4runtime to send the P4 code and the configuration of the tables to the switch.

# cd /home/user/p7/p4src
# ./p4rt/start_p4runtime.sh

With everything set, we can start testing the network.

Clone this wiki locally