There seems to be a problem when I run calc.p4
hugo0819 opened this issue · 10 comments
As a beginner I was able to run the first two basic sketches smoothly, but when I ran this one there were some issues that couldn't be solved. The following is the relevant error information...
hugo@hugovm:~/P4/tutorials/exercises/calc$ make
mkdir -p build pcaps logs
p4c-bm2-ss --p4v 16 --p4runtime-files build/calc.p4.p4info.txt -o build/calc.json calc.p4
[--Wwarn=deprecated] warning: .txt format is being deprecated; use .txtpb instead
sudo python3 ../../utils/run_exercise.py -t topology.json -j build/calc.json -b simple_switch_grpc
Reading topology file.
Building mininet topology.
simple_switch_grpc -i 1@s1-eth1 -i 2@s1-eth2 --pcap /home/hugo/P4/tutorials/exercises/calc/pcaps --nanolog ipc:///tmp/bm-0-log.ipc --device-id 0 build/calc.json --log-console --thrift-port 9090 -- --grpc-server-addr 0.0.0.0:50051
Configuring switch s1 using P4Runtime with file s1-runtime.json
- Using P4Info file build/calc.p4.p4info.txt...
Traceback (most recent call last):
File "/home/hugo/P4/tutorials/exercises/calc/../../utils/run_exercise.py", line 393, in
exercise.run_exercise()
File "/home/hugo/P4/tutorials/exercises/calc/../../utils/run_exercise.py", line 204, in run_exercise
self.program_switches()
File "/home/hugo/P4/tutorials/exercises/calc/../../utils/run_exercise.py", line 314, in program_switches
self.program_switch_p4runtime(sw_name, sw_dict)
File "/home/hugo/P4/tutorials/exercises/calc/../../utils/run_exercise.py", line 276, in program_switch_p4runtime
p4runtime_lib.simple_controller.program_switch(
File "/home/hugo/P4/tutorials/utils/p4runtime_lib/simple_controller.py", line 112, in program_switch
p4info_helper = helper.P4InfoHelper(p4info_fpath)
File "/home/hugo/P4/tutorials/utils/p4runtime_lib/helper.py", line 29, in init
google.protobuf.text_format.Merge(p4info_f.read(), p4info)
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/text_format.py", line 719, in Merge
return MergeLines(
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/text_format.py", line 793, in MergeLines
return parser.MergeLines(lines, message)
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/text_format.py", line 818, in MergeLines
self._ParseOrMerge(lines, message)
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/text_format.py", line 837, in _ParseOrMerge
self._MergeField(tokenizer, message)
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/text_format.py", line 967, in _MergeField
merger(tokenizer, message, field)
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/text_format.py", line 1042, in _MergeMessageField
self._MergeField(tokenizer, sub_message)
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/text_format.py", line 932, in _MergeField
raise tokenizer.ParseErrorPreviousToken(
google.protobuf.text_format.ParseError: 40:3 : Message type "p4.config.v1.Table" has no field named "has_initial_entries".
make: *** [../../utils/Makefile:35: run] Error 1
This error may occur when either your version of P4Runtime or the compiler is out of date.
@jafingerhut This seems to happen a lot, maybe because https://pypi.org/project/p4runtime/ is out of date?
I am doing my monthly test of builds using my install-p4dev-v6, -v7, and a newer -v8 buidl script in my p4-guide repo to test that they still all work with the latest versions of p4lang repo source code, and will try out the ecn tutorials exercise on each of them to see what happens, and report back the results in a comment here.
I am doing my monthly test of builds using my install-p4dev-v6, -v7, and a newer -v8 buidl script in my p4-guide repo to test that they still all work with the latest versions of p4lang repo source code, and will try out the ecn tutorials exercise on each of them to see what happens, and report back the results in a comment here.
I used install-p4dev-v6 to build my p4 project in 22.04LST. Looking forward to your test
@hugo0819 Do you recall when it was that you used install-p4dev-v6 to install the open source P4 tools?
With the latest version of the source that I tested with yesterday, on 22.04 and also 20.04, I saw no such error message when running the ecn exercise.
@hugo0819 Do you recall when it was that you used install-p4dev-v6 to install the open source P4 tools?
With the latest version of the source that I tested with yesterday, on 22.04 and also 20.04, I saw no such error message when running the ecn exercise.
Yes, I found install-p4dev-v6 updated, do I just need git new p4/guide to run it again?
Unfortunately, I am fairly certain that trying to run my install script twice on the same system will either (a) not install anything new, or worse (b) mess up the installation so that it no longer works. I do not regularly test what happens if you try to do this. That is why you find the following statement on this page of instructions https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md#quick-instructions-for-successful-install-script-run
- "Start with: an unmodified fresh installation of one of these supported operating systems: ..."
Yes, that means that it takes longer to achieve an updated system. I typically only do this once every month or two, but once you have one you like, there is rarely any strong reason to update again.
Another option is to download a recent Virtual Machine image that can be loaded into VirtualBox (and maybe also other VM player systems, but I have not tested on others) from here: https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md
This error may occur when either your version of P4Runtime or the compiler is out of date.
@jafingerhut This seems to happen a lot, maybe because https://pypi.org/project/p4runtime/ is out of date?
Fabian, I believe that my p4-guide install scripts do not use that p4runtime package at all, instead installing it from recent source code. If someone does not use my install scripts, then perhaps that might be leading to the problem asked about in this issue -- I have not tried it to confirm.
I am sure there was something like a 1 month or so window of time where using my scripts would also lead to this problem, because of differences in when different repos were updated to add this new P4Info message field.
In fact, when I ran install-p4dev-v6 again from a new virtual machine, I encountered installation errors again. It seems to be an issue with displaying Python related packages, where one package was supposed to be found but two were found, resulting in the inability to continue the installation.
Fortunately, when I adopted install-p4dev-v7, the installation was successfully completed and ran on two new virtual machines.
@hugo0819 Please feel free to close this issue if you believe it has been solved.