nsg-ethz / p4-utils

Extension to Mininet that makes P4 networks easier to build
GNU General Public License v2.0
183 stars 67 forks source link

I cannot find out p4net and Topology #26

Closed caopeirui closed 2 years ago

caopeirui commented 2 years ago

When I download the source code and run it (https://github.com/Harvard-CS145/cs145-21-project1), cannot import "p4utils.mininetlib.p4net" and cannot import "from p4utils.utils.topology import Topology". And I ensure your p4-utils does not contain p4net and topology.Topology.

Isn't it using your p4-utils?

edgar-costa commented 2 years ago

Hi!

I believe this is because we did a big update to the entire codebase some months ago and several things are not backwards compatible.

For example to load the topology you can use: https://github.com/nsg-ethz/p4-learning/blob/master/exercises/08-Simple_Routing/thrift/solution/routing-controller.py#L8

If you check the helper, right now the topology object is called different.

https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/utils/helper.py#L279 NetworkGraph

Looks like that github you sent me is using the old version of p4-utils.

https://github.com/nsg-ethz/p4-utils/releases/tag/v0.0 Here you can find the old version. But be careful, it will only work if python is python2.

Otherwise you can check what are the differences, now everything is way more documented. You will only have to change some small things in the controller and maybe p4app.json but it will be minimal.(and use the new vm). For reference, check all the exercises in p4-learning

caopeirui commented 2 years ago

Oh, Thanks for your useful help. It works well after I follow your advice. And I am looking at p4-learning which is a good course. Wonderful !