03-28-2019 05:53 AM
Hi all,
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.
03-29-2019 08:28 AM - edited 03-29-2019 08:28 AM
Anyone coming across this issue, it was resolved by enabling http server on the switch
conf t ip http server
03-29-2019 08:28 AM - edited 03-29-2019 08:28 AM
Anyone coming across this issue, it was resolved by enabling http server on the switch
conf t ip http server
10-01-2019 08:26 AM
Hi,
Just a doubt, instead http can i have https?
I mean just for security policies.
10-02-2019 11:45 AM
Carlosormon,
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.
Regards,
Kyle
10-31-2019 09:32 AM
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
raise PnPParseError(str(perr))
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!
10-31-2019 10:33 PM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide