Lab1 EMC Python: Location

def main():

sysName = emc_vars[‘deviceName’]

if sysName == ‘VSP-1’:
location = ‘Castle of Aarrgh’
elif sysName == ‘VSP-2’:
location = ‘Bridge of Death’
elif sysName == ‘XOS-1’:
location = ‘Castle Anthrax’
elif sysName == ‘XOS-2’:
location = ‘Swamp Castle’
else:
raise RuntimeError(“Unexpected switch!!”)

familyType = emc_vars[‘family’]

if familyType == ‘VSP Series’:
emc_cli.send(‘enable’)
emc_cli.send(‘config term’)
cmd = ‘snmp-server location “‘+location+'”‘
elif familyType == ‘Summit Series’:
cmd = ‘configure snmp sysLocation “‘+location+'”‘
else:
raise RuntimeError(“Unexpected switch family type!!”)

emc_cli.send(cmd)

print “Successfully set switch location to:”, location

main()

Leave a comment