Thursday, January 30, 2020

Cisco ZTP Python Script Not Importing CLI Module

We're doing some testing with zero touch provisioning on Cisco 9300 switches, and a switch that used to correctly run the ZTP script doesn't anymore.There's been no changes to the IOS version or anything, other that "write erase" between testing and reloading.

Basically, the ZTP script doesn't seem to be loading the CLI module at the start of the sample script:

print "\n\n *** Sample ZTP Day0 Python Script *** \n\n" # Importing cli module import cli 

When the script runs it throws the same error as when the CLI module is not imported (yes the HTTP server is running):

SocketError: Socket /cisco/nginx_shared/pnp_python.sock not present. Make sure to enable http server 

After the script fails; if you go into python through the guest shell, import the CLI module, exit, then run the downloaded ZTP script everything works fine...

Switch#guestshell run python Python 2.7.5 (default, Jun 17 2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import cli >>> Switch#guestshell run python flash:downloaded_script.py 

Has anyone else had this issue before? It doesn't make sense to me.

Inb4 "call TAC" ^_^



No comments:

Post a Comment