jafingerhut / p4-guide

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

Error running rundemo.sh & rundemo_TAP_IO.sh for IPDK_Native #58

Closed justinkong0623 closed 2 months ago

justinkong0623 commented 1 year ago

Can anyone help? I already upgrade protoc >= 3.19.0.

Wrong Message for rundemo_TAP_IO.sh:

root@justin-virtual-machine:~# /root/clone/ipdk/build/networking/scripts/rundemo_TAP_IO.sh --workdir=/root |& tee $HOME/out-rundemo_TAP_IO.sh

WORKING_DIR: /root SCRIPTS_DIR: /root/scripts DEPS_INSTALL_DIR: /root/networking-recipe/deps_install P4C_INSTALL_DIR: /root/p4c/install SDE_INSTALL_DIR: /root/p4-sde/install NR_INSTALL_DIR: /root/networking-recipe/install

Cleaning from previous run

Setting hugepages up and starting networking-recipe processes

~ ~

DEPS_INSTALL_DIR: /root/networking-recipe/deps_install SDE_INSTALL_DIR: /root/p4-sde/install NR_INSTALL_DIR: /root/networking-recipe/install P4C_INSTALL_DIR: /root/p4c/install

Updated Environment Variables ... SDE_INSTALL_DIR: /root/p4-sde/install LIBRARY_PATH: /root/networking-recipe/deps_install/lib:/root/networking-recipe/deps_install/lib64: LD_LIBRARY_PATH: /root/networking-recipe/deps_install/lib:/root/networking-recipe/deps_install/lib64:/root/networking-recipe/install/lib:/root/networking-recipe/install/lib64::/root/p4-sde/install/lib:/root/p4-sde/install/lib64:/root/p4-sde/install/lib/x86_64-linux-gnu:/usr/local/lib:/usr/local/lib64 PATH: /root/p4c/install/bin:/root/networking-recipe/deps_install/bin:/root/networking-recipe/deps_install/sbin:/root/networking-recipe/install/bin:/root/networking-recipe/install/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

1024 1024

SDE_INSTALL_DIR: /root/p4-sde/install NR_INSTALL_DIR: /root/networking-recipe/install

NR_INSTALL_DIR: /root/networking-recipe/install DEAMON_MODE_ARGS:

~

Creating TAP ports

~ ~ setting vhost_dev = true.Set request, successful...!!! I20230810 07:40:41.120030 146877 gnmi_ctl.cc:103] Client context cancelled. setting vhost_dev = true.Set request, successful...!!! I20230810 07:40:41.557056 146902 gnmi_ctl.cc:103] Client context cancelled. ~

Generating dependent files from P4C and pipeline builder

~/examples/simple_l3 ~ I20230810 07:40:45.816721 146940 tdi_pipeline_builder.cc:116] Found P4 program: simple_l3 I20230810 07:40:45.816859 146940 tdi_pipeline_builder.cc:123] Found pipeline: pipe ~

Create two Namespaces

Move TAP ports to respective namespaces and bringup the ports

Assign IP addresses to the TAP ports

Add ARP table for neighbor TAP port

Add Route to reach neighbor TAP port

Programming P4 pipeline

Traceback (most recent call last): File "/root/networking-recipe/install/bin/p4rt-ctl", line 45, in from p4.v1 import p4runtime_pb2 File "/usr/local/lib/python3.8/dist-packages/p4/v1/p4runtime_pb2.py", line 18, in from p4.config.v1 import p4info_pb2 as p4_dot_config_dot_v1_dot_p4infopb2 File "/usr/local/lib/python3.8/dist-packages/p4/config/v1/p4info_pb2.py", line 16, in from p4.config.v1 import p4types_pb2 as p4_dot_config_dot_v1_dot_p4typespb2 File "/usr/local/lib/python3.8/dist-packages/p4/config/v1/p4types_pb2.py", line 35, in _descriptor.FieldDescriptor( File "/usr/local/lib/python3.8/dist-packages/google/protobuf/descriptor.py", line 561, in new _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are:

Downgrade the protobuf package to 3.20.x or lower. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower). More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

Wrong Message for rundemo.sh: 沒有此一檔案或目錄=Files can't find 命令找不到=Can't find command

root@justin-virtual-machine:~# /root/clone/ipdk/build/networking/scripts/rundemo.sh --workdir=/root |& tee $HOME/out-rundemo_TAP_IO.sh

WORKING_DIR: /root SCRIPTS_DIR: /root/scripts DEPS_INSTALL_DIR: /root/networking-recipe/deps_install P4C_INSTALL_DIR: /root/p4c/install SDE_INSTALL_DIR: /root/p4-sde/install NR_INSTALL_DIR: /root/networking-recipe/install

Cleaning from previous run

Creating Ubuntu focal image

~ ~ dist: focal-server-cloudimg-amd64.img ~

Configuring VM networking and creating cloud-init images

/root/clone/ipdk/build/networking/scripts/rundemo.sh: 列 130: cloud-localds:命令找不到 /root/clone/ipdk/build/networking/scripts/rundemo.sh: 列 166: cloud-localds:命令找不到

Setting hugepages up and starting networking-recipe processes

~ ~

DEPS_INSTALL_DIR: /root/networking-recipe/deps_install SDE_INSTALL_DIR: /root/p4-sde/install NR_INSTALL_DIR: /root/networking-recipe/install P4C_INSTALL_DIR: /root/p4c/install

Updated Environment Variables ... SDE_INSTALL_DIR: /root/p4-sde/install LIBRARY_PATH: /root/networking-recipe/deps_install/lib:/root/networking-recipe/deps_install/lib64: LD_LIBRARY_PATH: /root/networking-recipe/deps_install/lib:/root/networking-recipe/deps_install/lib64:/root/networking-recipe/install/lib:/root/networking-recipe/install/lib64::/root/p4-sde/install/lib:/root/p4-sde/install/lib64:/root/p4-sde/install/lib/x86_64-linux-gnu:/usr/local/lib:/usr/local/lib64 PATH: /root/p4c/install/bin:/root/networking-recipe/deps_install/bin:/root/networking-recipe/deps_install/sbin:/root/networking-recipe/install/bin:/root/networking-recipe/install/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

1024 1024

SDE_INSTALL_DIR: /root/p4-sde/install NR_INSTALL_DIR: /root/networking-recipe/install

NR_INSTALL_DIR: /root/networking-recipe/install DEAMON_MODE_ARGS:

~

Creating TAP ports

~ ~ setting vhost_dev = true.Set request, successful...!!! I20230810 07:45:07.882185 147076 gnmi_ctl.cc:103] Client context cancelled. setting vhost_dev = true.Set request, successful...!!! I20230810 07:45:09.063472 147098 gnmi_ctl.cc:103] Client context cancelled. ~

Generating dependent files from P4C and pipeline builder

~/examples/simple_l3 ~ I20230810 07:45:15.952613 147128 tdi_pipeline_builder.cc:116] Found P4 program: simple_l3 I20230810 07:45:15.952816 147128 tdi_pipeline_builder.cc:123] Found pipeline: pipe ~

Starting VM1_TAP_DEV

Using QEMU: ~/scripts ~ /root/clone/ipdk/build/networking/scripts/rundemo.sh: 列 248: /usr/bin/qemu-kvm: 沒有此一檔案或目錄

Waiting 10 seconds before starting second VM

.......... Starting VM2_TAP_DEV

~

Programming target pipelines

/root/clone/ipdk/build/networking/scripts/rundemo.sh: 列 279: /usr/bin/qemu-kvm: 沒有此一檔案或目錄 Traceback (most recent call last): File "/root/networking-recipe/install/bin/p4rt-ctl", line 45, in from p4.v1 import p4runtime_pb2 File "/usr/local/lib/python3.8/dist-packages/p4/v1/p4runtime_pb2.py", line 18, in from p4.config.v1 import p4info_pb2 as p4_dot_config_dot_v1_dot_p4infopb2 File "/usr/local/lib/python3.8/dist-packages/p4/config/v1/p4info_pb2.py", line 16, in from p4.config.v1 import p4types_pb2 as p4_dot_config_dot_v1_dot_p4typespb2 File "/usr/local/lib/python3.8/dist-packages/p4/config/v1/p4types_pb2.py", line 35, in _descriptor.FieldDescriptor( File "/usr/local/lib/python3.8/dist-packages/google/protobuf/descriptor.py", line 561, in new _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are:

Downgrade the protobuf package to 3.20.x or lower. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower). More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

jafingerhut commented 1 year ago

So I have seen error messages like that before, but are you willing to answer questions about exactly what Linux distribution and version you started from, and every command you ran on that system since it was freshly installed, that led you to the current state of your system? Because without knowing that, I doubt I can help you. Even if I did know that, I probably won't know why that happened, or how to update the system to make it work.

What I do know is that if you follow these instructions to the letter, with no deviations ever, starting from a freshly installed Ubuntu 20.04 system, they should work: https://github.com/jafingerhut/p4-guide/blob/master/ipdk/23.01/README-install-ipdk-networking-container-ubuntu-20.04-and-test.md

justinkong0623 commented 1 year ago

I have completed building IPDK using your provided link. Thanks a lot! But I have two questions.

1.What is "infrap4d"? Is it a P4-OVS? Can it be used to construct numerous infrap4d instances to simulate real networks?

2.Why did you mention "You may skip this section. It is NOT required for installing IPDK." in regard to running rundemo_TAP_IO.sh? How does it differ from the example "Compiling a P4 program, loading it into infrap4d, sending packets in, and capturing packets out"? What is IPDK used for this example?

jafingerhut commented 1 year ago
  1. You can find documentation for infrap4d that gives way more details, but for the purposes that I use it in the steps and script given in this repository, I use it because it includes (a) a DPDK software switch into which you can load P4 programs compiled with p4c-dpdk, and it will process future packets according to that P4 program, and (b) a P4Runtime API server, where it listens on TCP port 9559 for incoming connections, and if a client connects, that client can send P4Runtime API messages to request actions such as add/delete/modify table entries, read counters, etc. I am sure that infrap4d includes other capabilities as well, but at this time I don't use any other capabilities. (OK, technically, I must be using the gNMI server that is part of infrap4d, too, because I use gnmi-ctl commands to create interfaces.)

  2. I say that because it is true, and if you want to run PTF tests as described later, or write your own P4 programs and controller software using P4Runtime API, that section is unnecessary for you to do any of the steps in there. rundemo_TAP_IO.sh is just one "hello world" kind of exercise you can run to test if your installation is working, and perhaps to learn from, if you wish.

The steps for "Compiling a P4 program, loading it into infrap4d, sending packets in, and capturing packets out" walks you through each of those steps, and they are much easier to learn from, in my opinion, how to modify those steps when you want to write your own P4 program.

I do not have a good mental map of all of the parts of IPDK, and which parts I am using in these instructions vs. which parts I am not. I am pretty sure I am not using any of the storage API portions of IPDK, only the networking part, but after that I would recommend finding good documentation and/or talks on IPDK if you want to know more.

justinkong0623 commented 1 year ago
  1. You can find documentation for infrap4d that gives way more details, but for the purposes that I use it in the steps and script given in this repository, I use it because it includes (a) a DPDK software switch into which you can load P4 programs compiled with p4c-dpdk, and it will process future packets according to that P4 program, and (b) a P4Runtime API server, where it listens on TCP port 9559 for incoming connections, and if a client connects, that client can send P4Runtime API messages to request actions such as add/delete/modify table entries, read counters, etc. I am sure that infrap4d includes other capabilities as well, but at this time I don't use any other capabilities. (OK, technically, I must be using the gNMI server that is part of infrap4d, too, because I use gnmi-ctl commands to create interfaces.)
  2. I say that because it is true, and if you want to run PTF tests as described later, or write your own P4 programs and controller software using P4Runtime API, that section is unnecessary for you to do any of the steps in there. rundemo_TAP_IO.sh is just one "hello world" kind of exercise you can run to test if your installation is working, and perhaps to learn from, if you wish.

The steps for "Compiling a P4 program, loading it into infrap4d, sending packets in, and capturing packets out" walks you through each of those steps, and they are much easier to learn from, in my opinion, how to modify those steps when you want to write your own P4 program.

I do not have a good mental map of all of the parts of IPDK, and which parts I am using in these instructions vs. which parts I am not. I am pretty sure I am not using any of the storage API portions of IPDK, only the networking part, but after that I would recommend finding good documentation and/or talks on IPDK if you want to know more.

Thank you for your reply! I tried your dpdk-target-notes from https://github.com/jafingerhut/p4-dpdk-target-notes, but I encountered some issues. Since I couldn't open an issue there, I decided to ask here. I needed to add the following configuration inside 'p4_devices' to make it work: "mempools": [ { "name": "MEMPOOL0", "buffer_size": 2048, "pool_size": 1024, "cache_size": 256, "numa_node": 0 } ], However, after running it in bfshell, I encountered the following problem: bfrt> l1switch.enable ----> l1switch.enable() 2023-09-05 16:59:33.364389 BF_PIPE ERROR - error: thread pipeline enable 2023-09-05 16:59:33.364540 BF_PIPE ERROR - Failed to Build Pipeline pipe 2023-09-05 16:59:33.364576 BF_BFRT ERROR - bf_rt_enable_pipeline:120 failed Have you encountered this problem before?

jafingerhut commented 2 months ago

Sorry I did not answer earlier, but I am not sure that I ever encountered that error before, no. I am closing this issue, but feel free to open another if you think I may know the answer. I would also recommend https://p4lang.zulipchat.com for asking questions related to P4, although not everyone uses P4-DPDK so not sure how many people may know the answer to such questions.