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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s