[P4-dev] bmv2: "Error when requesting config md5 sum from switch"

Vladimir Gurevich vladimir.gurevich at barefootnetworks.com
Sun Sep 16 19:14:50 EDT 2018


Hello David,

Another option is to continue to use thrift-0.9.2. The only thing you need
to do on Ubuntu-18.04 is to remove libssl-dev and replace it with
libssl1.0-dev. That will allow you to compile thrift-0.9.2

Happy hacking,
Vladimir

*Vladimir Gurevich*

*Barefoot Networks*
*Technical Lead, Customer Engineering*
Email: vag at barefootnetworks.com
Phone: (408) 833-4505



On Sun, Sep 16, 2018 at 3:43 PM Andy Fingerhut <andy.fingerhut at gmail.com>
wrote:

> Thanks for the detailed reports, David.  I suspect you are an Ubuntu
> 18.04 + P4 tools "early adopter" and may be one of the first to investigate
> this deeply into these issues.
>
> I had tried Thrift 0.11.0 on Ubuntu 18.04 as well, but did not try
> mininet, nor multiple physical devices each running their own bmv2
> simple_switch connected by physical Ethernet ports.  There is an issue here
> suggesting perhaps updating Thrift to version 0.11.0 for behavioral-model,
> but I have added a comment to that issue linking to your message:
> https://github.com/p4lang/behavioral-model/issues/597
>
> I believe one long term answer is that Thrift will become no-longer-used
> at some point, once the P4Runtime API using Google Protobufs instead of
> Thrift becomes more tested and used.
>
> That said, if someone does figure out a way to get existing Thrift-based
> APIs working on Ubuntu 18.04, that would be nice to have.
>
> Andy Fingerhut
>
> On Sun, Sep 16, 2018 at 2:36 PM David Hancock <dhancock at cs.utah.edu>
> wrote:
>
>> I have confirmed that Thrift 0.9.2 on Ubuntu 14.04 works in my
>> environment.
>>
>> I was trying 0.11.0 on Ubuntu 18.04 because during installation of 0.9.2
>> I got an error claiming libcrypto was missing, which is supposed to be
>> included with libssl-dev but installing libssl-dev didn't fix the
>> problem.  Googling reveals this is a known problem but I couldn't tell
>> what the best solution was of many suggested.
>>
>> Hence 0.11.0, which presented no errors during installation, but when I
>> call runtime_CLI.load_json_config eventually it ends up in Thrift's
>> recv_bm_get_config_md5() -> read(), which has that extra check on
>> sys.version_info triggering iprot.readString().decode('utf-8'), which
>> fails with UnicodeDecodeError.
>>
>> To me this seems like a bug with Thrift but I'm no Thrift expert.
>> 'iprot' in my case is of type
>> thrift.protocol.TBinaryProtocol.TBinaryProtocol.  I don't know what
>> message is being sent that starts with 0xed and I don't understand the
>> logic for why Thrift wants to decode it as utf-8.
>>
>> So I downgraded to Ubuntu 14.04 and Thrift 0.9.2 because that was my
>> setup when doing experiments in mininet.
>>
>> --David
>>
>>
>> On 09/16/2018 12:15 AM, David Hancock wrote:
>> > It appears the issue is with Thrift.  I am running version 0.11.0.  I
>> > traced the error to std_client.bm_get_config_md5() -> ... ->
>> > recv_bm_get_config_md5 -> ...; here's the full stack trace:
>> >
>> > bm_md5sum = std_client.bm_get_config_md5()
>> > Traceback (most recent call last):
>> >   File "<console>", line 1, in <module>
>> >   File
>> >
>> "/usr/local/lib/python2.7/dist-packages/bm_runtime/standard/Standard.py",
>> > line 2864, in bm_get_config_md5
>> >     return self.recv_bm_get_config_md5()
>> >   File
>> >
>> "/usr/local/lib/python2.7/dist-packages/bm_runtime/standard/Standard.py",
>> > line 2882, in recv_bm_get_config_md5
>> >     result.read(iprot)
>> >   File
>> >
>> "/usr/local/lib/python2.7/dist-packages/bm_runtime/standard/Standard.py",
>> > line 14572, in read
>> >     self.success = iprot.readString().decode('utf-8') if
>> > sys.version_info[0] == 2 else iprot.readString()
>> >   File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
>> >     return codecs.utf_8_decode(input, errors, True)
>> > UnicodeDecodeError: 'utf8' codec can't decode byte 0xed in position 0:
>> > invalid continuation byte
>> >
>> > --David
>> >
>> >
>> > On 09/15/2018 09:23 PM, David Hancock wrote:
>> >> Hello,
>> >>
>> >> I get "Error when requesting config md5 sum from switch" when
>> executing:
>> >>
>> >> runtime_CLI.load_json_config(<bm_runtime.standard.Standard.Client
>> >> object>, <JSON path>)
>> >>
>> >> in my python-based controller that connects to a bmv2 simple_switch.
>> >> I did not get this error in mininet experiments; I'm only getting it
>> >> now that I'm trying to experiment on a physical cluster.
>> >>
>> >> Is there a common reason for that error?
>> >>
>> >> Here is some of the code preceding the statement that results in the
>> >> error:
>> >>
>> >>     ip = 'localhost'
>> >>     port = 9090
>> >>
>> >>     services =
>> >>
>> runtime_CLI.RuntimeAPI.get_thrift_services(runtime_CLI.PreType.SimplePre)
>> >>     services.extend(SimpleSwitchAPI.get_thrift_services())
>> >>
>> >>     try:
>> >>       std_client, mc_client, sswitch_client =
>> >> runtime_CLI.thrift_connect(ip, port, services)
>> >>     except:
>> >>         return "Error - create_device(" + dev_name + "): " +
>> >> str(sys.exc_info()[0])
>> >>
>> >>     json = <path to JSON>
>> >>     runtime_CLI.load_json_config(std_client, json)
>> >>
>> >> I can break right before the load_json_config call and everything
>> >> looks in order - in particular, get_thrift_services and
>> >> thrift_connect executed successfully.
>> >>
>> >> Thank you for any ideas you may have,
>> >>
>> >> David
>> >>
>> >>
>> >> _______________________________________________
>> >> P4-dev mailing list
>> >> P4-dev at lists.p4.org
>> >> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>> >
>> >
>> > _______________________________________________
>> > P4-dev mailing list
>> > P4-dev at lists.p4.org
>> > http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>
>>
>> _______________________________________________
>> P4-dev mailing list
>> P4-dev at lists.p4.org
>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20180916/09b2b7e3/attachment-0001.html>


More information about the P4-dev mailing list