Wednesday, January 10, 2018

python communication from 3850 guestshell

Hi all, I'm using ZTP to configure many Cisco 3850's. I have the DHCP and TFTP server running and when i erase the startup config and reload the file given in option 67 in the DHCP offer is downloaded and run. so no problems there, which is good!

Now the thing that makes my environment different is the order in which the network devices receive their config. it's hard for me to explain why but try to take my word for it that the devices must be configured in a specific order. so, with the nature of DHCP i can't control what devices receives their config first(i don't think?), so i'm trying a different approach.

Instead of sending a .sh script at the point of DHCP i've created a .py that creates a socket to a server that will request it's config i.e. "i am 3850, serial 123456789, config request". The server will either reply with the 3850's config or it will get ignored. In the case that the request is ignored the .py script on the 3850 will time out and request again every 10 seconds. when the server is ready for the network device to apply its config it will reply with it and the device will apply it.

This way the network gets to the point where every network device is requesting their own specific configs and the server can pass out their configs 1 at a time.

Now the problem i'm running into is that the python script that's running inside the guestshell is not able to create a connection back to the server. Do you know if there is something in place to prevent this from happening? Do i need to use a specific protocol/port?

I realise what i'm trying to do is quite unique because i'm finding it hard to find the information that i need. Maybe there is another way of issuing out configs to each device in order?

many thanks in advance.



No comments:

Post a Comment