Wednesday, January 10, 2018

Python script to download and install EXOS image multiple times

Below Python script and UPM configuration could be used to try upgrade on the switch multiple times.
This script used to make switch download and install EXOS image multiple times.


[upgrade.py]
import time
import re
import sys


def upgrade():
for loop in range(1, 51):
upgradeCMD = 'download image x.x.x.x summitX-16.2.3.5-patch1-3.xos vr
"VR-Mgmt" primary'
result = open('/usr/local/tmp/upgraderesult.txt', 'a')
cmdOutput = exsh.clicmd(upgradeCMD,capture=True)
result.write(cmdOutput)
time.sleep(10)
result.close()


if __name__ == '__main__':
   try:
       upgrade()
   except SystemExit:
       pass


[configuration]
create upm profile testprofile
load script upgrade.py
.
configure upm profile testprofile maximum execution-time 590
create upm timer testtimer
configure upm timer testtimer profile testprofile
configure upm timer testtimer after 10 every 900

No comments:

Post a Comment