allow_unknown_field Error 1
Hello,
I'm trying to run make run for this tutorial on Ubuntu 24.04 using Vagrant 2.4.1. I tested it on Ubuntu 20.04, and Ubuntu 24.04, but I get the same error on both versions. Does anyone know how to fix this error?
`p4@p4:~/tutorials/exercises/basic$ cp solution/basic.p4 basic.p4 p4@p4:~/tutorials/exercises/basic$ make run mkdir -p build pcaps logs p4c-bm2-ss --p4v 16 --p4runtime-files build/basic.p4.p4info.txt -o build/basic.json basic.p4 sudo python3 ../../utils/run_exercise.py -t pod-topo/topology.json -j build/basic.json -b simple_switch_grpc Reading topology file. Building mininet topology. simple_switch_grpc -i 1@s1-eth1 -i 2@s1-eth2 -i 3@s1-eth3 -i 4@s1-eth4 --pcap /home/p4/tutorials/exercises/basic/pcaps --nanolog ipc:///tmp/bm-0-log.ipc --device-id 0 build/basic.json --log-console --thrift-port 9090 -- --grpc-server-addr 0.0.0.0:50051
simple_switch_grpc -i 1@s2-eth1 -i 2@s2-eth2 -i 4@s2-eth4 -i 3@s2-eth3 --pcap /home/p4/tutorials/exercises/basic/pcaps --nanolog ipc:///tmp/bm-1-log.ipc --device-id 1 build/basic.json --log-console --thrift-port 9091 -- --grpc-server-addr 0.0.0.0:50052
simple_switch_grpc -i 1@s3-eth1 -i 2@s3-eth2 --pcap /home/p4/tutorials/exercises/basic/pcaps --nanolog ipc:///tmp/bm-2-log.ipc --device-id 2 build/basic.json --log-console --thrift-port 9092 -- --grpc-server-addr 0.0.0.0:50053
simple_switch_grpc -i 2@s4-eth2 -i 1@s4-eth1 --pcap /home/p4/tutorials/exercises/basic/pcaps --nanolog ipc:///tmp/bm-3-log.ipc --device-id 3 build/basic.json --log-console --thrift-port 9093 -- --grpc-server-addr 0.0.0.0:50054
Configuring switch s1 using P4Runtime with file pod-topo/s1-runtime.json
- Using P4Info file build/basic.p4.p4info.txt...
Traceback (most recent call last):
File "../../utils/run_exercise.py", line 393, in
exercise.run_exercise() File "../../utils/run_exercise.py", line 204, in run_exercise self.program_switches() File "../../utils/run_exercise.py", line 314, in program_switches self.program_switch_p4runtime(sw_name, sw_dict) File "../../utils/run_exercise.py", line 276, in program_switch_p4runtime p4runtime_lib.simple_controller.program_switch( File "/home/p4/tutorials/utils/p4runtime_lib/simple_controller.py", line 112, in program_switch p4info_helper = helper.P4InfoHelper(p4info_fpath) File "/home/p4/tutorials/utils/p4runtime_lib/helper.py", line 29, in init google.protobuf.text_format.Merge(p4info_f.read(), p4info, TypeError: Merge() got an unexpected keyword argument 'allow_unknown_field' make: *** [../../utils/Makefile:35: run] Error 1`
Unfortunately there was about a 1-week period where building your own tutorials VM from the instructions would result in a system where this will happen. The root cause is because p4c added a new field to the P4Info files it creates, but other tools that read it are not yet updated to recognize it.
I believe that if you restart the steps to create a tutorials VM today (or any time in the last 3-4 days, when this was fixed), it should result in a system where this does not happen any more.
After running the install-p4dev-v5.sh script on Ubuntu 20.04 as per the instructions in the p4-guide, I encountered the same error while testing with basic exercise.
The install-p4dev-v5.sh script installs already-compiled binaries, compiled from a version of the source code of the P4 development tools that I do not control. If it is not working for you, I would recommend trying an installation method that lets you control which version of source code that is used, e.g. the install-p4dev-v8.sh script in the p4-guide repository, which by default uses the latest version of source code for most P4 development tools, or the vagrant up dev command in the vm-ubuntu-20.04 or vm-ubuntu-24.04 directories in this tutorials repository.
install-p4dev-v8.sh script requires too large space, I wonder if there are other ways to fix this probem, thx.
The install-p4dev-v5.sh script installs already-compiled binaries, compiled from a version of the source code of the P4 development tools that I do not control. If it is not working for you, I would recommend trying an installation method that lets you control which version of source code that is used, e.g. the install-p4dev-v8.sh script in the p4-guide repository, which by default uses the latest version of source code for most P4 development tools, or the
vagrant up devcommand in thevm-ubuntu-20.04orvm-ubuntu-24.04directories in this tutorials repository.
FYI, while install-p4de-v8.sh requires a lot of space when first installing to build it, you can delete the p4c/build directory and all of its subdirectories after running it, which reduces the disk utilization by about 14 GBytes, leaving the VM usually around 13-14 GBytes of total used space. Not sure if that makes it acceptable for you.
If you (or anyone) finds another way to fix the problem with install-p4dev-v5.sh, I'd love to learn about it.
If you have an Intel or AMD 64-bit processor system where you can run VirtualBox (e.g. Windows or Intel-based macOS), you can download a VM image where all of the open source P4 development tools have already been built for you, and the image size has already been reduced by deleting unneeded files like the ones in p4c/build mentioned above. You can find links to where you can download those images here: https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md
Closing this issue now, as there have been no follow-up questions for a while. Feel free to reopen it if the same problem persists, or create a new issue.