import re
def main():
familyType = emc_vars[‘family’]
if familyType == ‘VSP Series’:
showCmd = ‘show sys-info’
result = emc_cli.send(showCmd)
output = result.getOutput()
match = re.search(‘SysLocation : (.+)’, output)
location = match.group(1)
elif familyType == ‘Summit Series’:
showCmd = ‘show system’
result = emc_cli.send(showCmd)
output = result.getOutput()
match = re.search(‘SysLocation: (.+)’, output)
location = match.group(1)
else:
raise RuntimeError(“Unexpected switch family type!!”)
print “Switch has location set to :”, location
if location == ‘Castle of Aarrgh’:
manager = ‘King Arthur’
elif location == ‘Bridge of Death’:
manager = ‘Lancelot’
elif location == ‘Castle Anthrax’:
manager = ‘Patsy’
elif location == ‘Swamp Castle’:
manager = ‘Sir Galahad’
else:
raise RuntimeError(“Unexpected location!!”)
if familyType == ‘VSP Series’:
emc_cli.send(‘enable’)
emc_cli.send(‘config term’)
cmd = ‘snmp-server contact “‘+manager+'”‘
elif familyType == ‘Summit Series’:
cmd = ‘configure snmp sysContact “‘+manager+'”‘
else:
raise RuntimeError(“Unexpected switch family type!!”)
emc_cli.send(cmd)
print “Successfully set switch manager to:”, manager
main()