opennetworkinglab / ngsdn-tutorial

Hands-on tutorial to learn the building blocks of the Next-Gen SDN architecture
https://www.opennetworking.org/ng-sdn/
Apache License 2.0
321 stars 187 forks source link

P4runtime table entry insert error on Exercise 1 #77

Closed JoaquinChung closed 3 years ago

JoaquinChung commented 3 years ago

Hi,

I'm going through Exercise 1 and I'm having problems inserting a table entry using the P4runtime shell. I'm getting the following error:

P4Runtime sh >>> te.insert()
---------------------------------------------------------------------------
P4RuntimeWriteException                   Traceback (most recent call last)
<ipython-input-7-415530895906> in <module>
----> 1 te.insert()

/p4runtime-sh/venv/lib/python3.8/site-packages/p4runtime_shell-0.0.1-py3.8.egg/p4runtime_sh/shell.py in insert(self)
    649             raise NotImplementedError("Insert not supported for {}".format(self._entity_type.name))
    650         logging.debug("Inserting entry")
--> 651         self._write(p4runtime_pb2.Update.INSERT)
    652 
    653     def delete(self):

/p4runtime-sh/venv/lib/python3.8/site-packages/p4runtime_shell-0.0.1-py3.8.egg/p4runtime_sh/shell.py in _write(self, type_)
    643         update.type = type_
    644         getattr(update.entity, self._entity_type.name).CopyFrom(self._entry)
--> 645         client.write_update(update)
    646 
    647     def insert(self):

/p4runtime-sh/venv/lib/python3.8/site-packages/p4runtime_shell-0.0.1-py3.8.egg/p4runtime_sh/p4runtime.py in handle(*args, **kwargs)
    122             if e.code() != grpc.StatusCode.UNKNOWN:
    123                 raise e
--> 124             raise P4RuntimeWriteException(e) from None
    125     return handle
    126 

P4RuntimeWriteException: Error(s) during Write:
    * At index 0: INVALID_ARGUMENT, 'Invalid bytestring format'

Just to clarify, I'm running directly on my Ubuntu 20.04 laptop instead of the VM. Docker compose creates the network ngsdn-tutorial_default when I issue make start. So I changed your script to attach the P4 runtime to that network instead of the host network. Finally, I open the P4runtime shell as follows:

util/p4rt-sh --grpc-addr mininet:50001 --config p4src/build/p4info.txt,p4src/build/bmv2.json --election-id 0,1

I made sure I'm using the latest docker image for the P4runtime shell. I don't know if my changes have messed with something in the setup.

Thanks,

Joaquin

JoaquinChung commented 3 years ago

I reinstalled Ubuntu 20.04 in my laptop (for other reasons) and I'm running the following Docker versions:

Docker version 20.10.6, build 370c289
docker-compose version 1.29.2, build 5becea4c

I was able to complete the exercise. I'm not really sure what fixed the problem as I kept using the same changes described in my previous post.

Xiaodao-chen commented 2 years ago

sir cloud you please tell me how to solve this problem ,i have meet this one

JoaquinChung commented 2 years ago

Sorry, I'm not sure what solved my problem. Maybe you can create a new issue and hopefully some of the developers will reply to you