Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added P4AP and P4RuntimeAP classes + Examples ( p4 branch ) #302

Open
wants to merge 12 commits into
base: p4
Choose a base branch
from

Conversation

davidcawork
Copy link
Contributor

Hi @ramonfontes ,

I leave a pull-request with the generic classes we were talking about to control the BMV2. The P4AP class is intended to contain all the common configuration parameters of the BMV2, and the P4RuntimeAP class, which is a class that inherits from the previous one and adds configuration support via P4Runtime through the gRPC port.

Additionally I have added a class ( Netns_mgmt) to manage the execution of python code at runtime in different Netns. This means that the BMV2 managed by the P4RuntimeAP class, can be launched in its own Network namespace 😄. I have also developed some unit tests for the class Netns_mgmt, you can see them here (github.com/davidcawork/TFG/blob/master/src/netns_mgmt/unit_test.py), I have not added them because I did not know very well where I could do it.

Finally, I have added two extra P4 examples under the /mininet-wifi/examples/p4/ directory where you can see more clearly the use and operation of the classes mentioned above.

Best,

@ramonfontes
Copy link
Member

Hi @davidcawork,

I think the code does not work with Python 3. I encountered problems with indentation and urllib2. I managed to solve the problem of urllib2 with https://github.com/intrig-unicamp/mininet-wifi/blob/master/mn_wifi/bmv2.py#L26.

Both basic-runtime and bmv2-netns didn't work too (python2 and python3). I'm encountering this problem:

from google.protobuf.internal import enum_type_wrapper
ImportError: No module named protobuf.internal

I think the error might be related to the protobuf version. However, I didn't find a reason for that. What is your protobuf version? Mine is 3.6.1.

~$ protoc --version
libprotoc 3.6.1

@davidcawork davidcawork reopened this May 14, 2020
@davidcawork
Copy link
Contributor Author

Hi @ramonfontes 😃,

It is very likely that it will not work for Python 3, I was currently working on Python2 (2.7.12
). Thank you very much for letting me know and for the solution with urllib2.

At first I tried to work with the latest version of PI, but there were use cases in P4 that didn't work properly, I came to this issue because of similar problems, and I dropped the version because of that, so probably the operation depends on the difference of versions.

Currently I'm using the versions that are listed in the installation of P4 tutorials, are these:

BMV2_COMMIT="b447ac4c0cfd83e5e72a3cc6120251c1e91128ab"  # August 10, 2019
PI_COMMIT="41358da0ff32c94fa13179b9cee0ab597c9ccbcc"    # August 10, 2019
P4C_COMMIT="69e132d0d663e3408d740aaf8ed534ecefc88810"   # August 10, 2019
PROTOBUF_COMMIT="v3.2.0"
GRPC_COMMIT="v1.3.2"

Just out of curiosity, you've done a mininet-wifi make install again to add the new p4runtime_lib component?

Best,

@ramonfontes
Copy link
Member

ramonfontes commented May 14, 2020

I'm following the installation steps described in https://github.com/jafingerhut/p4-guide/blob/master/bin/install-p4dev-v2.sh.

install-p4dev-v2.shinstalls the versions listed below:

BMV2_COMMIT=latest version
PI_COMMIT=latest version
P4C_COMMIT=latest version
PROTOBUF_COMMIT="v3.6.1"
GRPC_COMMIT="v1.17.2"

However, as Mininet is included in install-p4dev-v2.sh I had to create a patch to remove mininet from install-p4dev-v2.sh. Hence, I can successfully install all dependencies by issuing util/install.sh -P.

Yes, I did a make install to add the new component.

install-p4dev-v2.sh works fine with Ubuntu 18.04 and they are working in a second version for Ubuntu 20.04.

@davidcawork
Copy link
Contributor Author

Perfect @ramonfontes ,

Here's what I'll do, I'll use the patch to get those versions and find out why it doesn't work there!

Thanks a lot Ramon for the feedback. I leave this pull-request open to solve it :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants