[P4-dev] Error when running openflow_l2.py in switch repo

Brivaldo Junior brivaldojr at gmail.com
Fri Aug 18 11:04:04 EDT 2017


Hey guys,

   When I try to run the docker image I have this error:

# ./openflow_l2.py --controller-ip 127.0.0.1
['docker', 'run', '-ti', '--rm', '--privileged=true', '--hostname=sw1',
'--name=mininet-sw1', '-e', 'DISPLAY', '-v',
'/tmp/.X11-unix:/tmp/.X11-unix', 'p4openflowswitch', '/bin/bash']
Traceback (most recent call last):
  File "./openflow_l2.py", line 100, in <module>
    main()
  File "./openflow_l2.py", line 53, in main
    start_program="/bin/bash")
  File "build/bdist.linux-x86_64/egg/mininet/net.py", line 240, in addSwitch
  File "/home/mininet/switch/docker/p4_mininet.py", line 148, in __init__
    Switch.__init__( self, name, **kwargs )
  File "build/bdist.linux-x86_64/egg/mininet/node.py", line 862, in __init__
  File "build/bdist.linux-x86_64/egg/mininet/node.py", line 106, in __init__
  File "/home/mininet/switch/docker/p4_mininet.py", line 265, in startShell
    self.pid = int(ps_out[0])
ValueError: invalid literal for int() with base 10: 'Error: No such image
or container: mininet-sw1\n'



   The system not down the image or container mininet-sw1. I compile the
docker image with success:

# docker images
REPOSITORY          TAG                 IMAGE ID
CREATED             VIRTUAL SIZE
p4dockerswitch      latest              519c2981ec47        50 minutes
ago      1.49 GB
ubuntu              14.04               37a9c4a8276c        7 days
ago          188 MB


   And see if the correct info was on openflow_l2.py:

   ...
   def main():
    net = Mininet( controller=None )
    sw1 = net.addSwitch( 'sw1', cls=P4DockerSwitch,
                        target_name="p4openflowswitch",
<====
                        start_program="/bin/bash")
    ..

   Any clues that could help me?

Thanks,
Brivaldo


2017-03-21 2:57 GMT-04:00 Chengyu Fan <chengy.fan at gmail.com>:

> Sorry about my mistake above. The error above is the code does not
> correctly convert the string to pid.
> I corrected the error above to convert the pid string to integer now.
> But the openflow_l2.py still does not work. I have run the ryu controller
> in another terminal on the same VM (ryu-manager --verbose
> ryu/app/simple_switch_13.py). It seems that the controller does not get any
> messages.
>
> vagrant at vagrant-ubuntu-trusty-64:~/switch/docker$ sudo ./openflow_l2.py --controller-ip 127.0.0.1
> trying to init docker ...
> ['docker', 'run', '-ti', '--rm', '--privileged=true', '--hostname=sw1', '--name=mininet-sw1', '-e', 'DISPLAY', '-v', '/tmp/.X11-unix:/tmp/.X11-unix', 'p4dockerswitch', '/bin/bash']
> *** Configuring hosts
> h1 h2
> *** Starting controller
> *** Starting 1 switches
> sw1 Starting P4 docker switch sw1
>
> Ready !
> [<Host h1: h1-eth0:10.0.0.1 pid=30021> , <Host h2: h2-eth0:10.0.0.2 pid=30022> , <P4DockerSwitch sw1: lo:127.0.0.1,sw1-eth1:None,sw1-eth2:None pid=29971> ]
> [<Host h1: h1-eth0:10.0.0.1 pid=30021> , <Host h2: h2-eth0:10.0.0.2 pid=30022> ]
> PING BETWEEN THE HOSTS
> h1 -> X
> h2 -> X
> *** Results: 100% dropped (0/2 received)
> PING FAILED BETWEEN HOSTS [<Host h1: h1-eth0:10.0.0.1 pid=30021> , <Host h2: h2-eth0:10.0.0.2 pid=30022> ]
> *** Stopping 1 switches
> sw1
> *** Stopping 2 hosts
> h1 h2
> *** Stopping 0 controllers
>
> *** Done
>
>
>
>
> On Mon, Mar 20, 2017 at 2:53 PM, Chengyu Fan <chengy.fan at gmail.com> wrote:
>
>> Hi Antonin,
>>
>> Thanks for the reply.
>> Simply using p4dockerswitch does not work for me.
>>
>> vagrant at vagrant-ubuntu-trusty-64:~/switch/docker$ sudo ./openflow_l2.py --controller-ip 127.0.0.1
>> ['docker', 'run', '-ti', '--rm', '--privileged=true', '--hostname=sw1', '--name=mininet-sw1', '-e', 'DISPLAY', '-v', '/tmp/.X11-unix:/tmp/.X11-unix', 'p4dockerswitch', '/bin/bash']
>> Traceback (most recent call last):
>>   File "./openflow_l2.py", line 100, in <module>
>>     main()
>>   File "./openflow_l2.py", line 53, in main
>>     start_program="/bin/bash")
>>   File "/usr/lib/python2.7/dist-packages/mininet/net.py", line 202, in addSwitch
>>     sw = cls( name, **defaults )
>>   File "/home/vagrant/switch/docker/p4_mininet.py", line 148, in __init__
>>     Switch.__init__( self, name, **kwargs )
>>   File "/usr/lib/python2.7/dist-packages/mininet/node.py", line 758, in __init__
>>     Node.__init__( self, name, **params )
>>   File "/usr/lib/python2.7/dist-packages/mininet/node.py", line 94, in __init__
>>     self.startShell()
>>   File "/home/vagrant/switch/docker/p4_mininet.py", line 265, in startShell
>>     self.pid = int(ps_out[0])
>> ValueError: invalid literal for int() with base 10: "'16570'\n"
>>
>> The original example (http://techandtrains.com/2014
>> /08/21/docker-container-as-mininet-host/ ) is not working for me either.
>> However, I found that the authors had fixed it here:
>> https://github.com/containernet/containernet.git
>> I will look into it.
>>
>>
>>
>> On Mon, Mar 20, 2017 at 11:17 AM, Antonin Bas <
>> antonin at barefootnetworks.com> wrote:
>>
>>> Hi,
>>>
>>> It seems that the script is trying to run the "p4openflowswitch" docker
>>> image. I can't find where this image is supposed to be built... Maybe it is
>>> just a typo and if your replace p4openflowswitch with p4dockerswitch (
>>> https://github.com/p4lang/switch/blob/master/docker/openflow_l2.py#L52)
>>> it will work as expected. Please let us know if it does. I'm not very
>>> familiar with the Openflow stuff in p4lang, so I may be missing something.
>>>
>>> Best,
>>>
>>> Antonin
>>>
>>> On Fri, Mar 17, 2017 at 11:35 PM, Chengyu Fan <chengy.fan at gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to run the openflow_l2.py in docker dir of switch repo.
>>>> I have compiled the switch with P4ofagent, and built the docker image
>>>> successfully as follows.
>>>>
>>>> cd switch/docker/bmv2
>>>> make -f docker.mk base-docker-image
>>>>
>>>> However, after I ran openflow_l2.py, it gave the following error
>>>> messages:
>>>>
>>>> cd switch/docker/bmv2
>>>> vagrant at vagrant-ubuntu-trusty-64:~/switch/docker$ sudo ./openflow_l2.py --controller-ip 127.0.0.1
>>>> trying to init docker ...
>>>> ['docker', 'run', '-ti', '--rm', '--privileged=true', '--hostname=sw1', '--name=mininet-sw1', '-e', 'DISPLAY', '-v', '/tmp/.X11-unix:/tmp/.X11-unix', 'p4openflowswitch', '/bin/bash']
>>>> Traceback (most recent call last):
>>>>   File "./openflow_l2.py", line 100, in <module>
>>>>     main()
>>>>   File "./openflow_l2.py", line 53, in main
>>>>     start_program="/bin/bash")
>>>>   File "/usr/lib/python2.7/dist-packages/mininet/net.py", line 202, in addSwitch
>>>>     sw = cls( name, **defaults )
>>>>   File "/home/vagrant/switch/docker/p4_mininet.py", line 149, in __init__
>>>>     Switch.__init__( self, name, **kwargs )
>>>>   File "/usr/lib/python2.7/dist-packages/mininet/node.py", line 758, in __init__
>>>>     Node.__init__( self, name, **params )
>>>>   File "/usr/lib/python2.7/dist-packages/mininet/node.py", line 94, in __init__
>>>>     self.startShell()
>>>>   File "/home/vagrant/switch/docker/p4_mininet.py", line 267, in startShell
>>>>     self.pid = int(ps_out[0])
>>>> ValueError: invalid literal for int() with base 10: ''
>>>>
>>>> I have checked the Docker log, and here it is ...
>>>>
>>>> vagrant at vagrant-ubuntu-trusty-64:~/switch/docker$ sudo tail -f /var/log/upstart/docker.log
>>>> time="2017-03-18T05:44:29.853058887Z" level=error msg="Handler for POST /v1.26/containers/create returned error: No such image: p4openflowswitch:latest"
>>>> time="2017-03-18T05:44:30.547159201Z" level=error msg="Not continuing with pull after error: errors:\ndenied: requested access to the resource is denied\nunauthorized: authentication required\n"
>>>> time="2017-03-18T05:44:30.547397925Z" level=info msg="Ignoring extra error returned from registry: unauthorized: authentication required"
>>>> time="2017-03-18T05:44:30.547577750Z" level=info msg="Translating \"denied: requested access to the resource is denied\" to \"repository p4openflowswitch not found: does not exist or no pull access\""
>>>> time="2017-03-18T05:44:30.547787696Z" level=error msg="Handler for POST /v1.26/images/create returned error: repository p4openflowswitch not found: does not exist or no pull access"
>>>> time="2017-03-18T05:44:30.871526251Z" level=error msg="Handler for GET /v1.26/containers/mininet-sw1/json returned error: No such container: mininet-sw1"
>>>> time="2017-03-18T05:44:30.874327998Z" level=error msg="Handler for GET /v1.26/images/mininet-sw1/json returned error: No such image: mininet-sw1"
>>>> time="2017-03-18T05:44:30.877535963Z" level=error msg="Handler for GET /v1.26/networks/mininet-sw1 returned error: network mininet-sw1 not found"
>>>> time="2017-03-18T05:44:30.878884149Z" level=error msg="Handler for GET /v1.26/volumes/mininet-sw1 returned error: get mininet-sw1: no such volume"
>>>> time="2017-03-18T05:44:30.921010580Z" level=error msg="Handler for GET /v1.26/plugins/mininet-sw1/json returned error: plugin \"mininet-sw1\" not found"
>>>>
>>>> Basically, I think it fails when the switch is initialized,  Switch.
>>>> __init__( self, name, **kwargs ). BTW, I can manually run bash on
>>>> container p4dockerswitch. And p4dockerswitch is used as the target_name
>>>>  for P4DockerSwitch in p4_mininet.py...
>>>>
>>>> Anyone has ideas?
>>>>
>>>> --
>>>> Thanks,
>>>>
>>>> Chengyu
>>>>
>>>> _______________________________________________
>>>> P4-dev mailing list
>>>> P4-dev at lists.p4.org
>>>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>>>
>>>
>>>
>>>
>>> --
>>> Antonin
>>>
>>
>>
>>
>> --
>> Thanks,
>>
>> Chengyu
>>
>
>
>
> --
> Thanks,
>
> Chengyu
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
Brivaldo Junior
Faculdade de Computação - FACOM
Universidade Federal de Mato Grosso do Sul - UFMS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170818/4df3ae3d/attachment-0002.html>


More information about the P4-dev mailing list