[P4-dev] Thrift Connection failure while running p4 program in a container

Antonin Bas antonin at barefootnetworks.com
Thu Nov 2 14:45:00 EDT 2017


Hi,

I suspect an incompatibility between the Thrift Python module version and
the Thrift library version.
I suggest you try adding the following lines here:
https://github.com/p4lang/behavioral-model/blob/master/tools/bmpy_utils.py#L31
import logging
logging.basicConfig()

Then try running the CLI again. Hopefully Thrift will give you a better
error message.

On Wed, Nov 1, 2017 at 10:22 PM, aditya dogra <dogra.aditya at gmail.com>
wrote:

> Hi ,
>      We are trying to run a p4 program in a linux container. However we
> are not able to connect to the thrift server after starting the
> simple_switch program within the container.
>
> bash-4.3# *simple_switch -i 1 at l_S11 -i 2 at l_S12 --pcap --thrift-port 9090
> --nanolog ipc:///tmp/bm-0-log.ipc ioam.p4.json --log-console –debugger  **<==
> Started Simple switch *
>
> Calling target program-options parser
>
> [04:58:57.430] [bmv2] [D] [thread 66] Set default entry for table
> 'ipv6_lpm': NoAction -
>
> [04:58:57.430] [bmv2] [D] [thread 66] Set default entry for table
> 'tbl_add_ioam_option': add_ioam_option -
>
> [04:58:57.430] [bmv2] [D] [thread 66] Set default entry for table
> 'ioam_trace': NoAction -
>
> Adding interface l_S11 as port 1
>
> [04:58:57.430] [bmv2] [D] [thread 66] Adding interface l_S11 as port 1
>
> Adding interface l_S12 as port 2
>
> [04:58:57.466] [bmv2] [D] [thread 66] Adding interface l_S12 as port 2
>
> Thrift server was started
>
> [05:00:50.962] [bmv2] [D] [thread 73] [0.0] [cxt 0] Processing packet
> received on port 1
>
> [05:00:50.962] [bmv2] [D] [thread 73] [0.0] [cxt 0] Parser 'parser': start
>
> [05:00:50.962] [bmv2] [D] [thread 73] [0.0] [cxt 0] Extracting header
> 'ethernet'
>
> [05:00:50.962] [bmv2] [D] [thread 73] [0.0] [cxt 0] Parser state 'start':
> key is 86dd
>
> [05:00:50.962] [bmv2] [T] [thread 73] [0.0] [cxt 0] Bytes parsed: 14
>
> [05:00:50.962] [bmv2] [D] [thread 73] [0.0] [cxt 0] Extracting header
> 'ipv6'
>
> [05:00:50.962] [bmv2] [D] [thread 73] [0.0] [cxt 0] Parser set: setting
> field 'parser_metadata.ipv6_nextproto' from field 'ipv6.nextHdr' (17)
>
> [05:00:50.962] [bmv2] [D] [thread 73] [0.0] [cxt 0] Parser state
> 'parse_ipv6': key is 11
>
>
>
>
>
>
>
>
>
>
>
> bash-4.3# *nc -zv 0.0.0.0 9090*
>
> *Connection to 0.0.0.0 9090 port [tcp/*] succeeded!*
>
> bash-4.3# netstat -anp
>
> Active Internet connections (servers and established)
>
> Proto Recv-Q Send-Q Local Address           Foreign Address         State
> PID/Program name
>
> tcp        0      0 127.0.0.1:56998         127.0.0.1:9090
> TIME_WAIT   -
>
> *tcp6       0      0 :::9090                 :::*
> LISTEN      66/simple_switch   *
>
> Active UNIX domain sockets (servers and established)
>
> Proto RefCnt Flags       Type       State         I-Node   PID/Program
> name    Path
>
> unix  2      [ ACC ]     STREAM     LISTENING     54502
> 66/simple_switch    /tmp/bm-0-log.ipc
>
> unix  2      [ ACC ]     STREAM     LISTENING     54505
> 66/simple_switch    /tmp/bmv2-0-notifications.ipc
>
> unix  2      [ ACC ]     STREAM     LISTENING     54508
> 66/simple_switch    /tmp/bmv2-0-debug.ipc
>
> unix  3      [ ]         DGRAM                    51810    1/init
> /run/systemd/notify
>
> unix  2      [ ACC ]     STREAM     LISTENING     51812    1/init
> /run/systemd/private
>
> unix  2      [ ACC ]     STREAM     LISTENING     51820    1/init
> /run/systemd/journal/stdout
>
> unix  3      [ ]         DGRAM                    51823    1/init
> /run/systemd/journal/socket
>
> unix  2      [ ]         DGRAM                    51825    1/init
> /run/systemd/journal/dev-log
>
> unix  2      [ ACC ]     STREAM     LISTENING     52023    1/init
> /var/run/dbus/system_bus_socket
>
> unix  3      [ ]         STREAM     CONNECTED     52026    1/init
>
>
> unix  2      [ ]         STREAM     CONNECTING    0        -
> /var/run/dbus/system_bus_socket
>
> unix  2      [ ]         DGRAM                    52906    17/systemd-journald
>
>
> unix  3      [ ]         STREAM     CONNECTED     56957
> 66/simple_switch
>
> unix  2      [ ]         DGRAM                    51918    1/init
>
>
> unix  3      [ ]         STREAM     CONNECTED     56958
> 66/simple_switch
>
> unix  3      [ ]         STREAM     CONNECTING    0        -
> /var/run/dbus/system_bus_socket
>
> bash-4.3# nc -zv 127.0.0.1 9090
>
> Connection to 127.0.0.1 9090 port [tcp/*] succeeded!
>
> bash-4.3#
>
> bash-4.3# ls /tmp
>
> bm-0-log.ipc  bmv2-0-debug.ipc bmv2-0-notifications.ipc
>
> /home/osboxes/p4git/behavioral-model/tools
>
> bash-4.3# *python p4dbg.py --socket /tmp/bmv2-0-debug.ipc*
>
> No handlers could be found for logger "thrift.transport.TSocket"
>
> *Could not connect to thrift client on port 9090*
>
> *Make sure the switch is running and that you have the right port*
>
> bash-4.3#
>
>
>
> bash-4.3# *simple_switch_CLI --json
> /home/osboxes/p4git/p4_tutorials/tutorials/my_exercises/ipv6_examples/ioam/build/ioam.p4.json
> --thrift-port 9090*
>
> No handlers could be found for logger "thrift.transport.TSocket"
>
> *Could not connect to thrift client on port 9090*
>
> *Make sure the switch is running and that you have the right port*
>
> bash-4.3#
>
> bash-4.3# simple_switch_CLI --json /home/osboxes/p4git/p4_
> tutorials/tutorials/my_exercises/ipv6_examples/ioam/build/ioam.p4.json
> --thrift-port 56998
>
> No handlers could be found for logger "thrift.transport.TSocket"
>
> Could not connect to thrift client on port 56998
>
> Make sure the switch is running and that you have the right port
>
> bash-4.3#
>
>
>
> Are there any debugs which we can look to find out the reasons for such
> failures ?
>
> *Same program and same steps work perfectly fine when we run it outside
> the container.*
>
> Regards,
> Aditya Dogra
> "When the going gets tough, the tough get going"
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



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


More information about the P4-dev mailing list