cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
94
Views
0
Helpful
0
Replies

Accessing a remote server from a ZTP script

p.weeks
Level 1
Level 1

I have successfully downloaded a python script as part of the plug and play process.  The script runs however when I try to use a urllib.request statement it complains that there is no route to the server.

Here is part of my script.

url = 'http://{}:{}/{}'.format('10.10.10.10'',8080', 'ztp/configsvc/v1/file')
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = {'User-Agent': user_agent,'X-cisco-serial*': sn}
req = urllib.request.Request(url, None, headers=headers)
try:
response =urllib.request.urlopen(req)
except:
raise Exception('Unable to get config!\n')
config = response.read().decode('utf-8')

I have done some tests from the guestshell on a Cat 9300 switch and the script can download the configuration.  Basically this request is sending the serial number to a script on the 10.10.10.10 which, in then gets the script from Netbox.  An additional, possibly relevant bit of information is that the pnp process is running on vlan 600 and not the default vlan.  The routing on the vlan 600 is correct.  Do I need to configure anything else with inthe ztp.py script to enable that access to a remote server?

 

0 Replies 0

Review Cisco Networking for a $25 gift card