faucetsdn / faucetagent

gNMI agent for faucet configuration
5 stars 2 forks source link

PATH error with agenttest.py #27

Closed alshaboti closed 5 years ago

alshaboti commented 5 years ago

I couldn't run agenttest.py. I used the following commands, which run just fine.

# using ubuntu 18.04
# install Faucet
apt-get install python3-dev python3-pip -y \
    && pip3 install setuptools \
    && pip3 install wheel \
    && apt-get install wget git -y 
pip3 install faucet

# Install faucetagent
git clone https://github.com/faucetsdn/faucetagent.git 
cd faucetagent 
sed -i "s/sudo//g" dependencies.sh && ./dependencies.sh && make
sed -i "s/sudo//g" test-dependencies.sh && ./test-dependencies.sh

However, I got the following errors when I tried to run ./agenttest.py 1- PATH and GOPATH env variables are not updated, although I am running previous commands in the same shell.

root@7d39ed85b0de:/faucetagent# ./agenttest.py 
E
=======================================================================
ERROR: setUpClass (__main__.EndToEndTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./agenttest.py", line 437, in setUpClass
    assert which(dep), ("cannot find '%s' in $PATH" % dep)
AssertionError: cannot find 'gnmi_capabilities' in $PATH

----------------------------------------------------------------------
Ran 0 tests in 0.000s

FAILED (errors=1)

So, I re-exported PATH and GOPATH

export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH

2- cannot find ping in $PATH

root@7d39ed85b0de:/faucetagent# ./agenttest.py 
E
======================================================================
ERROR: setUpClass (__main__.EndToEndTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./agenttest.py", line 437, in setUpClass
    assert which(dep), ("cannot find '%s' in $PATH" % dep)
AssertionError: cannot find 'ping' in $PATH

----------------------------------------------------------------------
Ran 0 tests in 0.001s

FAILED (errors=1)

As iputils-ping is missing, I installed it and I run it again. 3- Mininet error Cannot find required executable ifconfig.

root@7d39ed85b0de:/faucetagent# ./agenttest.py 

* Generating certificates
* Generating fake CA cert
* Generating and signing fake server cert
* Generating fake client cert (self-signed)
* Starting network
/usr/local/lib/python3.6/dist-packages/mininet/log.py:162: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  return fn( *args )
*** Error setting resource limits. Mininet's performance may be affected.
*** Creating network
*** Adding controller
Cannot find required executable ifconfig.
Please make sure that Mininet is installed and available in your $PATH:
(/root/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
E
======================================================================
ERROR: test_end_to_end (__main__.EndToEndTest)
Run end to end ping test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./agenttest.py", line 441, in test_end_to_end
    failures = end_to_end_test()
  File "./agenttest.py", line 349, in end_to_end_test
    net = Mininet(topo=TestTopo(), controller=FAUCET, autoSetMacs=True)
  File "/usr/local/lib/python3.6/dist-packages/mininet/net.py", line 174, in __init__
    self.build()
  File "/usr/local/lib/python3.6/dist-packages/mininet/net.py", line 502, in build
    self.buildFromTopo( self.topo )
  File "/usr/local/lib/python3.6/dist-packages/mininet/net.py", line 469, in buildFromTopo
    self.addController( 'c%d' % i, cls )
  File "/usr/local/lib/python3.6/dist-packages/mininet/net.py", line 285, in addController
    controller_new = controller( name, **params )
  File "/usr/local/lib/python3.6/dist-packages/mininet/node.py", line 1395, in __init__
    ip=ip, **params  )
  File "/usr/local/lib/python3.6/dist-packages/mininet/node.py", line 85, in __init__
    self.checkSetup()
  File "/usr/local/lib/python3.6/dist-packages/mininet/node.py", line 654, in checkSetup
    cls.setup()
  File "/usr/local/lib/python3.6/dist-packages/mininet/node.py", line 662, in setup
    pathCheck( 'mnexec', 'ifconfig', moduleName='Mininet')
  File "/usr/local/lib/python3.6/dist-packages/mininet/moduledeps.py", line 68, in pathCheck
    exit( 1 )
  File "/usr/lib/python3.6/_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: 1

----------------------------------------------------------------------
Ran 1 test in 0.342s

FAILED (errors=1)

It works if I installed net-tools package

4- Seems as Mininet can't find Faucet! Faucet is already installed (version 1.9.7.dev9)

root@7d39ed85b0de:/faucetagent# ./agenttest.py 

* Generating certificates
* Generating fake CA cert
* Generating and signing fake server cert
* Generating fake client cert (self-signed)
* Starting network
/usr/local/lib/python3.6/dist-packages/mininet/log.py:162: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  return fn( *args )
*** Error setting resource limits. Mininet's performance may be affected.
*** Creating network
*** Adding controller
E
======================================================================
ERROR: test_end_to_end (__main__.EndToEndTest)
Run end to end ping test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./agenttest.py", line 441, in test_end_to_end
    failures = end_to_end_test()
  File "./agenttest.py", line 349, in end_to_end_test
    net = Mininet(topo=TestTopo(), controller=FAUCET, autoSetMacs=True)
  File "/usr/local/lib/python3.6/dist-packages/mininet/net.py", line 174, in __init__
    self.build()
  File "/usr/local/lib/python3.6/dist-packages/mininet/net.py", line 502, in build
    self.buildFromTopo( self.topo )
  File "/usr/local/lib/python3.6/dist-packages/mininet/net.py", line 469, in buildFromTopo
    self.addController( 'c%d' % i, cls )
  File "/usr/local/lib/python3.6/dist-packages/mininet/net.py", line 285, in addController
    controller_new = controller( name, **params )
  File "/usr/local/lib/python3.6/dist-packages/mininet/node.py", line 1396, in __init__
    self.checkListening()
  File "/usr/local/lib/python3.6/dist-packages/mininet/node.py", line 1403, in checkListening
    raise Exception( "Error running telnet to check for listening "
Exception: Error running telnet to check for listening controllers; please check that it is installed.

----------------------------------------------------------------------
Ran 1 test in 0.601s

FAILED (errors=1)
/usr/lib/python3.6/subprocess.py:766: ResourceWarning: subprocess 2910 is still running
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=3 mode='r' encoding='ANSI_X3.4-1968'>
root@7d39ed85b0de:/faucetagent# faucet --version
Faucet 1.9.7.dev9
alshaboti commented 5 years ago

Same error also occurs when using make

root@bd70488ad5bb:/faucetagent# make test
* Using GOPATH=/root/go
GOPATH=/root/go PATH=/root/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ./agenttest.py -v
ERROR

======================================================================
ERROR: setUpClass (__main__.EndToEndTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./agenttest.py", line 437, in setUpClass
    assert which(dep), ("cannot find '%s' in $PATH" % dep)
AssertionError: cannot find 'ping' in $PATH

----------------------------------------------------------------------
Ran 0 tests in 0.019s

FAILED (errors=1)
makefile:35: recipe for target 'test' failed
make: *** [test] Error 1
lantz commented 5 years ago
  1. Hmm, since it works in Travis, there must be some difference in your environment.

  2. Can you confirm that the same GOPATH error occurs if you don't change makefile and instead run sudo make test so that GOPATH is set properly?

  3. Can you confirm that the same PATH issues occur if you add telnet and net-tools after openvswitch-switch in test-dependencies.sh? If so, then perhaps it's not a dependency issue but an issue of telnet and ping not being in the PATH that sudo is resetting to.

lantz commented 5 years ago

@alshaboti Were you able to look at this? Thanks for testing it out btw.

lantz commented 5 years ago

@alshaboti added #31 which should address the dependencies