I'm currently having an issue where I need to reboot a PoE device. As we don't have access to the "cycle power" button via the API, I am disabling and re-enabling PoE on the device. The problem I'm having is that if I don't wait long enough, between turning off the PoE and turning it back on, then nothing happens. Is there a way to check if a change has been pushed to the device? Since these are security cameras, I don't want them all going down at the same time.
for myport in myswitch:
print(myport['number'])
if((myport['tags'] == tag) and (myport['enabled'] == True) ):
print("Cycling port tagged " + myport['tags'] + " on " + mydevice['name'] + " port: ", myport['number'])
meraki.updateswitchport(apikey, serialnum, myport['number'], name=None, tags=None, enabled=None, porttype=None, vlan=None,voicevlan=None, allowedvlans=None, poe=False, isolation=None, rstp=None, stpguard=None, accesspolicynum=None, suppressprint=True)
print("\tTuring off")
status=meraki.getswitchportdetail(apikey, serialnum, myport['number'], suppressprint=True)
time.sleep(pause) # because loop below doesn't work as intended
while (meraki.getswitchportdetail(apikey, serialnum, myport['number'], suppressprint=True))['poeEnabled']:
print(".", end = '') # visual queue that script hasn't hung
time.sleep(pause)
meraki.updateswitchport(apikey, serialnum, myport['number'], name=None, tags=None, enabled=None, porttype=None, vlan=None,voicevlan=None, allowedvlans=None, poe=True, isolation=None, rstp=None, stpguard=None, accesspolicynum=None, suppressprint=True)
print("\n\tTurning back on")
time.sleep(pause * 2) # because loop below doesn't work as intended
while (meraki.getswitchportdetail(apikey, serialnum, portnum, suppressprint=True))['poeEnabled'] == False:
time.sleep(pause)
print(".", end = '') # visual queue that script hasn't hung
As you can see, I tried to have the wait time based on checking if the status had changed via the API, but as this is just checking what the config in Meraki Dashboard says, it immediately reports that the criteria is met, so I had to throw pauses in before the loop. Is there a way to see how long ago the last change was pushed to the device or if config changes are still in queue? It's something the dashboard reports, so I'm hopeful its in the API and I just overlooked it.
I'm trying to minimize downtime, but it;s starting to look like I might have deal with a fixed amount of downtime. Not the end of the world, but I figured if any of you had solved this issue, it'd be good to know how you did it.