[P4-dev] counter example

Antonin Bas antonin at barefootnetworks.com
Mon Aug 7 13:31:27 EDT 2017


- did you create the veth interfaces as indicated in the README (
https://github.com/p4lang/tutorials/tree/master/examples)?
- are you running run-demo.sh as root?

On Sun, Aug 6, 2017 at 1:20 AM, mostafa <mostafaammar at aast.edu> wrote:

> Dear Antonin,
>
>
>
> I started a new installation and after running the switch(./run_switch) I
> have the following output:
>
>
>
> ubuntu:~/tutorials/examples/counter$ sudo ./run_switch.sh
>
> [sudo] password for mininet:
>
> parsing successful
>
> Semantic warning: header instance 'meta' is not reachable and will be
> removed
>
> Semantic warning: action '_drop' is not reachable and will be removed
>
> Semantic warning: header type 'meta_t' is not reachable and will be removed
>
> semantic checking successful
>
> Header type standard_metadata_t not byte-aligned, adding padding
>
> Generating json output to /home/mininet/tutorials/
> examples/counter/counter.json
>
> 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
>
> Control utility for runtime P4 table manipulation
>
> RuntimeCmd: Error: Action m_action needs 1 parameters
>
> RuntimeCmd: Adding entry to exact match table m_table
>
> match key:           EXACT-aa:bb:cc:dd:ee:ff
>
> action:              m_action
>
> runtime data:        00:00:00:00
>
> Entry has been added with handle 0
>
> RuntimeCmd:
>
> 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
>
>
>
>
>
> However, when running the ./run_demo.sh I have the following error:
>
>
>
> sending 1 packet of size 70
>
> WARNING: No route found for IPv6 destination :: (no default route?)
>
> Traceback (most recent call last):
>
>   File "send_one.py", line 4, in <module>
>
>     sendp(p, iface = "veth2", verbose = 0)
>
>   File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 259, in
> sendp
>
>     __gen_send(conf.L2socket(iface=iface, *args, **kargs), x,
> inter=inter, loop=loop, count=count, verbose=verbose, realtime=realtime)
>
>   File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 417,
> in __init__
>
>     self.ins.bind((iface, type))
>
>   File "/usr/lib/python2.7/socket.py", line 224, in meth
>
>     return getattr(self._sock,name)(*args)
>
> socket.error: [Errno 19] No such device
>
>
>
>
>
> displaying counters [0]
>
> Using JSON input counter.json
>
> No Thrift port specified, using CLI default
>
> Control utility for runtime P4 table manipulation
>
> RuntimeCmd: my_indirect_counter[0]=  BmCounterValue(packets=0, bytes=0)
>
> RuntimeCmd:
>
> Using JSON input counter.json
>
> No Thrift port specified, using CLI default
>
> Control utility for runtime P4 table manipulation
>
> RuntimeCmd: this is the direct counter for table m_table
>
> my_direct_counter[0]=  BmCounterValue(packets=0, bytes=0)
>
> RuntimeCmd:
>
>
>
>
>
>
>
> sending 3 packets of size 70
>
> WARNING: No route found for IPv6 destination :: (no default route?)
>
> Traceback (most recent call last):
>
>   File "send_one.py", line 4, in <module>
>
>     sendp(p, iface = "veth2", verbose = 0)
>
>   File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 259, in
> sendp
>
>     __gen_send(conf.L2socket(iface=iface, *args, **kargs), x,
> inter=inter, loop=loop, count=count, verbose=verbose, realtime=realtime)
>
>   File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 417,
> in __init__
>
>     self.ins.bind((iface, type))
>
>   File "/usr/lib/python2.7/socket.py", line 224, in meth
>
>     return getattr(self._sock,name)(*args)
>
> socket.error: [Errno 19] No such device
>
> WARNING: No route found for IPv6 destination :: (no default route?)
>
> Traceback (most recent call last):
>
>   File "send_one.py", line 4, in <module>
>
>     sendp(p, iface = "veth2", verbose = 0)
>
>   File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 259, in
> sendp
>
>     __gen_send(conf.L2socket(iface=iface, *args, **kargs), x,
> inter=inter, loop=loop, count=count, verbose=verbose, realtime=realtime)
>
>   File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 417,
> in __init__
>
>     self.ins.bind((iface, type))
>
>   File "/usr/lib/python2.7/socket.py", line 224, in meth
>
>     return getattr(self._sock,name)(*args)
>
> socket.error: [Errno 19] No such device
>
> WARNING: No route found for IPv6 destination :: (no default route?)
>
> Traceback (most recent call last):
>
>   File "send_one.py", line 4, in <module>
>
>     sendp(p, iface = "veth2", verbose = 0)
>
>   File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 259, in
> sendp
>
>     __gen_send(conf.L2socket(iface=iface, *args, **kargs), x,
> inter=inter, loop=loop, count=count, verbose=verbose, realtime=realtime)
>
>   File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 417,
> in __init__
>
>     self.ins.bind((iface, type))
>
>   File "/usr/lib/python2.7/socket.py", line 224, in meth
>
>     return getattr(self._sock,name)(*args)
>
> socket.error: [Errno 19] No such device
>
>
>
>
>
>
>
> *From:* Antonin Bas [mailto:antonin at barefootnetworks.com]
> *Sent:* Tuesday, August 01, 2017 8:36 PM
>
> *To:* mostafa <mostafaammar at aast.edu>
> *Cc:* p4-dev <p4-dev at lists.p4.org>
> *Subject:* Re: [P4-dev] counter example
>
>
>
> 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
>



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


More information about the P4-dev mailing list