'Cisco Nexus 9K POAP (Power On Auto Provisioning)/ZTP (Zero Touch Provisioning) Issue
I have been scratching my head for three days without a solution. I'd like the help of the greater StackOverflow community.
The Cisco Nexus switches have a POAP feature where they can be commissioned remotely using a DHCP server and a TFTP server.
The process goes like this:
- The switch boots up, picks up its IP address information from the DHCP server along with a DHCP suboption which points at the TFTP server address and the Python file.
- The Python file is downloaded by switch and executed using its built-in Pyhon intepreter (so far so good).
- The Python file has enough configuration to get the switch network connection and SSH operational. The file also saves those configuration into as startup-config and as scheduler-config (so they can be executed in the next boot).
Here is where the problem is:
When the switch reboots (and this is the Cisco 9300v on ESXi), it always goes into the loader mode and I have to set the Nexus image to boot from. It shouldn't do this because the Python script tells it already what to do.
The second option is the password never works! When I try to SSH (I can see that its IP address is reachable and it prompts me for the password), but it doesn't work. It doesn't also work via the console.
Can anybody explain what can be the reason?
The following is my Python script:
#!/bin/env python
#md5sum="fdcc67e518f1cd317c0e94b8d4089b7d"
from cli import *
import sys
cli('copy tftp://10.10.10.254/ztp.hostname.cfg bootflash:ztp.cfg vrf management ; end')
cli('copy bootflash:ztp.cfg scheduled-config ; end')
cli('copy bootflash:ztp.cfg running-config ; end')
cli('copy running-config startup-config ; end')
The following my configuration file (which is almost identical to the Python sctipt):
#md5sum="9befa447448be7bbb1d4af13dddac9b1"
!
boot nxos bootflash:/nxos.9.3.9.bin
!
hostname NEXUS-SWITCH
!
feature ssh
interface mgmt0
ip address 10.10.10.111/24
description DOWNLOADED-FILE
!
vrf context management
ip route 0.0.0.0/0 10.10.10.254
!
ip ssh source-interface mgmt 0
!
username admin password 0 Password123#
I have a feeling that it has something to do with how I'm ending the script (mind you that I tested the script on the Nexus switch and all of its parameters work - no errors whatsoever).
Your help is much appreciated.
Thank you.
Solution 1:[1]
In case someone else is going through the same thing.
I used a real switch to test this and updated the script in the question.
All what you need in the POAP script file is those lines along with a valid MD5 value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Karl |
