first time using iox guestshell and I've just gone into python and tried to use the cli module and am being returned the error below: I'm using 16.10.1 on a catalyst 9500 has anyone come across this before and know the fix?
[guestshell@guestshell ~]$ python Python 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from cli import * >>> ios_version = cli("show version") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/cli/__init__.py", line 253, in cli response = pnp.listener.cli_exec_request(command) File "/usr/lib/python2.7/site-packages/pnp/_pnp.py", line 511, in cli_exec_request log(PNP_LOG_LEVEL_ERROR) NameError: global name 'log' is not defined >>>
Solved! Go to Solution.
If you want to use https, I recommend using "ip http secure-server" and it might be worth looking into "ip http authentication local" or something similar before secure-server command. Here is a link to a guide for more information.
Hi ktuffent ,
Thank you so much for your help!!
I tried using this configuration.
ip http authentication local
ip http secure-server
But it doesn't work.
# guestshell run python /flash/BACKUPS.py
Traceback (most recent call last):
File "/flash/BACKUPS.py", line 13, in <module>
print cli ('write')
File "/usr/lib/python2.7/site-packages/cli/__init__.py", line 253, in cli
response = pnp.listener.cli_exec_request(command)
File "/usr/lib/python2.7/site-packages/pnp/_pnp.py", line 502, in cli_exec_request
pnp._pnp.PnPParseError: ParseError: Response is not xml parsable. mismatched tag: line 6, column 2
I mean when i use ip http server, it works.!! but we need to be secure and use https instead http.
Thank you very much!
Guestshell needs the http server to be configured to communicate with IOS and execute the cli commands. Thats is why the error is seen when http server is not configured.
Currently https is not supported for communication