frenetic-lang / frenetic

The Frenetic Programming Language and Runtime System
http://www.frenetic-lang.org/
Other
222 stars 52 forks source link

ImportError: No module named ryu.lib.packet #655

Open zfloat opened 1 year ago

zfloat commented 1 year ago

I am now able to use French for simple network orchestration, but I still generate errors when compiling the learning. py file. Could you please help me solve this problem?

图片

jnfoster commented 1 year ago

I think you want frenetic.examples.repeater.

zfloat commented 1 year ago

I am now able to use French for simple network orchestration, but I still generate errors when compiling the learning. py file. Could you please help me solve this problem?

图片

jnfoster commented 1 year ago

Oops.

Install Ryu like this,

pip install ryu

and then try again?

zfloat commented 1 year ago

I have tried installing ryu using the code pip install ryu, but an error occurred during the installation process, as shown in the following figure. 图片 This may mean that installing ryu requires Python 3, so in the end, I had to use pip3 to install ryu. Although ryu was successfully installed, errors will still be reported when compiling the learning. py file with Python 2. I'm at a loss what to do next.

jnfoster commented 1 year ago

I think you need to use the version of Ryu with Python 2.7.

Maybe try the from-source instructions here? https://osrg.github.io/ryu-book/en/html/installation_guide.html

zfloat commented 1 year ago

I have successfully solved the above problem by installing version 2.14.0 of Ovs before installing ryu. This is because the latest version of Ovs will generate errors when installed in the Python 2 environment.

Recently, I have been following the guide manual to further learn and use frenetic, but I have encountered errors when compiling the vlan2. py file. How can I solve this problem? The following is my experimental process. Copy the network_information_base_dynamic.py, network_information_base_static.py, and vlan2.py files into the examples folder. frenetic http-controller --verbosity debug sudo python2 mn_custom_topo.py python2 -m frenetic.examples.vlan2

At this point, compilation generates the following error. 图片

jnfoster commented 1 year ago

I assume this is from Chapter 5 of the manual. Can you share the content of mn_custom_topo.py?

zfloat commented 1 year ago

Yes, this is indeed the content of Chapter 5 of the manual. The mn_custom_topo.py file was also obtained from https://github.com/frenetic-lang/manual/blob/master/programmers_guide/code/handling_vlans/mn_custom_topo.py

After I run this topology file, the following information is displayed. sudo python2 mn_custom_topo.py 图片

jnfoster commented 1 year ago

This seems to be a bug with the way VLAN'd packets are being created. I'm afraid I don't have the cycles to debug it now. I mention that in case you want to dig in. The Python code should create packets on the right VLAN. But apparently it's not. You could use TCPdump or Wireshark to see what packets are hitting the wire, and then debug from there.