Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

int_ref_topology.py failed at docker_node.py self.pid = int(ps_out[0]) #193

Open
jeromesun14 opened this issue May 8, 2017 · 0 comments

Comments

@jeromesun14
Copy link

Error log

sunyongfeng@openswitch-OptiPlex-380:~/workshop/p4factory/mininet$ sudo ./int_ref_topology.py --model-dir=$P4HOME/install               
Adding switch spine1
Traceback (most recent call last):
  File "./int_ref_topology.py", line 131, in <module>
    run_cfg(model_dir)
  File "./int_ref_topology.py", line 91, in run_cfg
    net = mgr.setupAndStartNetwork()
  File "/home/sunyongfeng/workshop/p4factory/mininet/int_cfg.py", line 140, in setupAndStartNetwork
    self.addSwitches()
  File "/home/sunyongfeng/workshop/p4factory/mininet/int_cfg.py", line 177, in addSwitches
    pps = s.pps, qdepth = s.qdepth )
  File "/usr/lib/python2.7/dist-packages/mininet/net.py", line 240, in addSwitch
    sw = cls( name, **defaults )
  File "/home/sunyongfeng/workshop/p4factory/mininet/docker/p4model.py", line 55, in __init__
    DockerSwitch.__init__( self, name, **kwargs )
  File "/home/sunyongfeng/workshop/p4factory/mininet/docker/docker_node.py", line 30, in __init__
    Node.__init__( self, name, **kwargs )
  File "/usr/lib/python2.7/dist-packages/mininet/node.py", line 106, in __init__
    self.startShell()
  File "/home/sunyongfeng/workshop/p4factory/mininet/docker/docker_node.py", line 119, in startShell
    self.pid = int(ps_out[0])
ValueError: invalid literal for int() with base 10: "'21431'\n"
sunyongfeng@openswitch-OptiPlex-380:~/workshop/p4factory/mininet$

Reason

docker_node.py, L119 self.pid = int(ps_out[0]), ps_out[0] is not a pure decimal string, but also including a \n which should be strip first.

Solution

change docker_node.py L119 to:

self.pid = int((ps_out[0].strip()).strip('\''))

System Information

 sunyongfeng  ~  cat /etc/issue
Ubuntu 16.04 LTS \n \l

 sunyongfeng  ~  uname -a
Linux openswitch-OptiPlex-380 3.19.8-031908-generic #201505110938 SMP Mon May 11 13:39:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant