[P4-dev] counter example

Antonin Bas antonin at barefootnetworks.com
Tue Aug 1 14:36:20 EDT 2017


I don't really have further advice. It is well known that this is caused by
a version mismatch (see for example:
https://issues-test.apache.org/jira/browse/THRIFT-4089).
AFAIK TFrozenDict didn't exist in thrift 0.9.3. The fact that the file you
are generating (/home/flowvisor/bmv2/tools/bm_runtime/standard/Standard.py)
uses TFrozenDict means it was generated with an incompatible version of the
thrift compiler. You can look at the build logs to make sure that this file
was indeed re-generated and that the correct thrift binary was used. Look
at the logs for invocations of the thrift compiler.

On Tue, Aug 1, 2017 at 11:30 AM, mostafa <mostafaammar at aast.edu> wrote:

> Dear Antonin,
>
>
>
> I adjusted thrift version and python thrift library installed to be 0.9.3
> and rebuilt the bmv2 switch , however I am having the below error of not
> finding a library and switch is running.
>
> What is your advice?
>
>
>
> pip freeze | grep thrift
>
> thrift==0.9.3
>
>
>
> thrift --version
>
> Thrift version 0.9.3
>
>
>
> Thrift port was not specified, will use 9090
>
> Calling target program-options parser
>
> Adding interface veth0 as port 0
>
> Adding interface veth2 as port 1
>
> Adding interface veth4 as port 2
>
> Adding interface veth6 as port 3
>
> Adding interface veth8 as port 4
>
> Thrift server was started
>
> Using JSON input counter.json
>
> No Thrift port specified, using CLI default
>
> Traceback (most recent call last):
>
>   File "/home/flowvisor/bmv2/targets/simple_switch/sswitch_CLI.py", line
> 23, in <module>
>
>     import runtime_CLI
>
>   File "/home/flowvisor/bmv2/tools/runtime_CLI.py", line 32, in <module>
>
>     from bm_runtime.standard import Standard
>
>   File "/home/flowvisor/bmv2/tools/bm_runtime/standard/Standard.py", line
> 9, in <module>
>
>     from thrift.Thrift import TType, TMessageType, TFrozenDict,
> TException, TApplicationException
>
> ImportError: cannot import name TFrozenDict
>
> READY!!!
>
> sudo $SWITCH_PATH counter.json -i 0 at veth0 -i 1 at veth2 -i 2 at veth4 -i 3 at veth6
> -i 4 at veth8 --nanolog ipc:///tmp/bm-0-log.ipc --pcap
>
>
>
>
>
> *From:* Antonin Bas [mailto:antonin at barefootnetworks.com]
> *Sent:* Monday, July 31, 2017 7:43 PM
>
> *To:* mostafa <mostafaammar at aast.edu>
> *Cc:* p4-dev <p4-dev at lists.p4.org>
> *Subject:* Re: [P4-dev] counter example
>
>
>
> This is the same kind of error again, i.e. a version mismatch between the
> files generated by the thrift compiler and the thrift python package.
> Assuming you do have the correct versions now, did you re-build the
> behavioral-model after re-installing thrift?
>
>
>
> On Mon, Jul 31, 2017 at 4:57 AM, mostafa <mostafaammar at aast.edu> wrote:
>
> Dear Antonin,
>
>
>
> Thanks for your reply, I installed thrift version 0.9.3.
>
>
>
> I tried the counter example when running ./run_switch I have the following
> error
>
>
>
> No Thrift port specified, using CLI default
>
> Traceback (most recent call last):
>
>   File "/home/flowvisor/bmv2/targets/simple_switch/sswitch_CLI.py", line
> 23, in              <module>
>
>     import runtime_CLI
>
>   File "/home/flowvisor/bmv2/tools/runtime_CLI.py", line 32, in <module>
>
>     from bm_runtime.standard import Standard
>
>   File "/home/flowvisor/bmv2/tools/bm_runtime/standard/Standard.py", line
> 9, in              <module>
>
>     from thrift.Thrift import TType, TMessageType, TFrozenDict,
> TException, TApp             licationException
>
> ImportError: cannot import name TFrozenDict
>
> READY!!!
>
>
>
>
>
>
>
> *From:* Antonin Bas [mailto:antonin at barefootnetworks.com]
> *Sent:* Friday, July 28, 2017 9:24 PM
> *To:* mostafa <mostafaammar at aast.edu>
> *Cc:* p4-dev <p4-dev at lists.p4.org>
> *Subject:* Re: [P4-dev] counter example
>
>
>
> This generally indicates that your Thrift compiler version does not match
> your Thrift Python package version.
>
> You can confirm this by comparing the outputs of "thrift --version" and
> "pip freeze | grep thrift". Also note that we only support versions 0.9.2
> and 0.9.3. We recommend that you use 0.9.3.
>
>
>
> On Thu, Jul 27, 2017 at 9:08 PM, mostafa <mostafaammar at aast.edu> wrote:
>
> Dear All,
>
>
>
> I am newbie to P4 development,I followed instructions and installed
> mininet, bmv2 switch and p4c compiler.
>
> I was testing the counter example in https://github.com/p4lang/
> tutorials/tree/master/examples/counter , I am having the following error
>
>
>
> Traceback (most recent call last):
>
>   File "/home/flowvisor/bmv2/targets/simple_switch/sswitch_CLI.py", line
> 23, in <module>
>
>     import runtime_CLI
>
>   File "/home/flowvisor/bmv2/tools/runtime_CLI.py", line 32, in <module>
>
>     from bm_runtime.standard import Standard
>
>   File "/home/flowvisor/bmv2/tools/bm_runtime/standard/Standard.py", line
> 11, in <module>
>
>     from thrift.TRecursive import fix_spec
>
> ImportError: No module named TRecursive
>
>
>
>
>
> Also what is the best way to learn P4 .
>
>
>
> BR,
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
>
>
>
>
> --
>
> Antonin
>
>
>
>
>
> --
>
> Antonin
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170801/28fe680a/attachment-0002.html>


More information about the P4-dev mailing list