jafingerhut / p4-guide

Guide to p4lang repositories and some other public info about P4
530 stars 155 forks source link

Not able to run tutorial exercises #47

Closed hkaur-hsc closed 2 years ago

hkaur-hsc commented 2 years ago

Recently started working on P4, I tried the following:

sudo apt install git git clone https://github.com/jafingerhut/p4-guide ./p4-guide/bin/install-p4dev-v4.sh |& tee log.txt

And then to start working on tutorials, I did the following: $ git clone https://github.com/p4lang/tutorials $ cd tutorials/exercises/basic $ cp solution/basic.p4 basic.p4 $ make run

I get the following error message: root@GGNLABDTE00059:~/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 Traceback (most recent call last): File "../../utils/run_exercise.py", line 28, in import p4runtime_lib.simple_controller File "/root/tutorials/utils/p4runtime_lib/simple_controller.py", line 22, in from p4.config.v1 import p4info_pb2 ModuleNotFoundError: No module named 'p4.config' ../../utils/Makefile:35: recipe for target 'run' failed make: *** [run] Error 1

What am I missing?

hkaur-hsc commented 2 years ago

Also what if i run install-p4dev-p4runtime.sh after using install-p4dev-v4.sh on an ubuntu 18.04 machine. My original intent is to use P4 runtime.

jafingerhut commented 2 years ago

What operating system did you try that on? Was it a freshly installed system? Meaning, you added no packages and installed no software after installing the OS? I know, for example, that if you install Python2 and then try to run my install scripts, it is unlikely to end with working P4 tools.

jafingerhut commented 2 years ago

FYI, I tried taking a freshly installed Ubuntu 18.04 system, installing Python2, and then running the install-p4dev-v4.sh script, and I got very similar error messages when attempting to run the basic exercise in the tutorials repo.

jafingerhut commented 2 years ago

I have attempted to update the install-p4dev-v4.sh and install-p4dev-v6.sh scripts so that early on they detect if a system has Python2 installed on it, and if so, they fail quickly with an appropriate error message, rather than attempting but failing to install working P4 development tools.

Note that this might not be the reason why your system does not work. There could by other packages besides Python2 that, if they are installed, cause my scripts to result in a non-working system. I only test these scripts on freshly installed Ubuntu Linux systems WITH NO OTHER PACKAGES INSTALLED ON THEM. I cannot hope to test all possible combinations of packages on a system for my scripts -- there are simply too many combinations of them.

hkaur-hsc commented 2 years ago

I am repeating the install script on a fresh ubuntu 18.04 VM. Will post an update soon. Thanks for the responses.

Just one quick question. I am trying install-p4dev-v4.sh and intent to run the P4 runtime tutorial eventually. Hope this script will work for P4 runtime environment. there was one table in the documentation that showed it should work. But just confirming.

jafingerhut commented 2 years ago

On a freshly installed supported OS, I test these scripts every month, and verify that the basic exercise in the tutorials repository works every time, or fix the script if that does not work. That basic exercise, and I believe all of the tutorials exercises, use the P4Runtime API for adding table entries to the bmv2 software switch.

hkaur-hsc commented 2 years ago

With a fresh installed OS, I could run the basic exercise. Thanks for the support!