Closed naved001 closed 6 years ago
enable
, rather than just en
, as it's a bit more clear. We should do this for driver code in general, though I suspect we aren't in a number of places.(.venv) naved:~/n3000-ssh/hil$ py.test tests/deployment/*_networks.py
========================================= test session starts =========================================
platform linux2 -- Python 2.7.12, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /home/naved/n3000-ssh/hil, inifile: setup.cfg
plugins: cov-2.5.1, catchlog-1.2.2, forked-0.2, xdist-1.20.1
collected 2 items
tests/deployment/native_networks.py .
tests/deployment/vlan_networks.py .
===================================== 2 passed in 279.64 seconds ======================================
@mosayyebzadeh could you review this?
Few things.
I wanted to get public key authentication to work. But I have a few thoughts.
if we have pub key authentication enabled for this switch. It wouldn't expect a password and will directly match '>' and then we send 'en' and we are all happy. But in the case of the nexus switch, or the powerconnect switches that we have, there's no need to get into privilege mode; so the switch matches with '#'. And after that we call
_get_prompts
which doesconsole.expect('some regex match for #')
which fails because the previous call toexpect
modifies thebefore
andafter
property ofconsole
. I am thinking of some ways to workaround this issue, I might have to poke the _get_prompts method.connect
methods for console switches are hardcoded to follow only one path. We should either document this or handle all the possible cases of a switch login.A switch can be configured to enable/disable step ii and iii.