Python and Comware 7 - Rebooting switch using script
11-27-2017 10:51 PM
Doing my own ZTP implementation and bumped into trouble on a quite simple topic, rebooting the switch via code.
I have a generic configuration file that get's executed during provisioning.
Successfully downloaded file ztp-comware.cfg. Executing the configuration file. Please wait... Automatic configuration successfully completed. Line aux0 is available. Press ENTER to get started.
Part of that configurationfile is to enable ssh and netconf and setup a ssh user (as network-admin).
If I from my ZTP server tries to reboot the switch using the pyhpecw7 lib nothing happens (looking at the switch console).
If i then, on the switch side press ENTER and get to prompt... AND THEN tries a new python script reboot from the ZTP server. It reboots.
But I cannot figure out why this hapens. When the switch is newly booted to the "Press ENTER" prompt, I tried using nmap on both ssh and netconf ports and they are open.
ANY ideas or tips is highly appreciated!
I have tried using ssh with "force reboot" but that yeilds a Y/N/ question ( which byitself is kind of strange), I said FORCE because i meant IT!
I think this is related to the switchconfig not being saved at this stage (which is what I want).
Maybe using paramiko/netmiko or similar but would like to stay with the pyhpecw7 lib. My ZTP server is docker-based and dont want to bloat it futher.