VSphere Client and Windows 10

VSphere Client installation requires NetFx3 but unable to find and install this feature.

Solution:

Check if feature NetFx3 is enabled by opening command prompt as administrator:

C:\Windows\system32>dism /online /get-features

Mount Windows 10 enterprise ISO and use command line DISM command to add NetFx3:

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:installationMediaDrive:\sources\sxs

How to get configuration text file of a device

Objective

How to Get a Text File (*.txt) of a Device Configuration

Environment

Extreme Management Center v8.0 and above

Procedure

  1. Extreme Management Center -> “Network” -> “Archives” Tab
  2. Select the name of the Archive in which the desired Devices reside
  3. Under the Archive name, select the most recent date
  4. Under the most recent date, select the IP Address of the desired Device
  5. Right-click on the desired Device, and select “Download Configuration to Client”

Reading from EMC’s Database

Use the emc_vars dictionary API

myVar = emc_vars[‘<key>’]

Where <key> can be any of these:

serverIP    server IP address
serverVersion   server version
serverName    server host name
time     current date at server (yyyy-MM-dd)
date     current time at server (HH:mm:ss z)
username    EMC user name
userDomain    EMC user domain name
auditLogEnabled   true/false if audit log is supported
scriptTimeout   max script timeout in secs
scriptOwner    scripts owner
deviceName    DNS name of selected device
deviceIP    IP address of the selected device
deviceId    device DB ID
deviceLogin    login user for the selected device
devicePwd    logon password for the selected device
deviceSoftwareVer  software image version number on the device
deviceType    device type of the selected device
deviceSysOid   device system object id
deviceVR    device virtual router name
cliPort     telnet/ssh port
isExos     true/false. Is this device an EXOS device?
family     device family name
vendor     vendor name
deviceASN    AS number of the selected device port selected ports
vrName     selected port(s) VR name ports all device ports
accessPorts    all ports which have config role access
interSwitchPorts  all ports which have config role interswitch
managementPorts   all ports which have config role management

Lab4 EMC Python: Take Action

from jsonrpc import JsonRPC

def remote_cli(jsonrpc, cmd):
# ###################################################################
# Use the jsonrpc.cli() method to send CLI commands to an IP address
# cmd = a single CLI command string or a list of CLI command strings
# ###################################################################
response = jsonrpc.cli(cmd)

#print json.dumps(response, indent=2, sort_keys=True) # Uncomment for debugging

if isinstance(response, dict):
result = response.get(‘result’)
for entry in result:
#print “Debug: Entry = “, entry # Uncomment for debugging
if ‘status’ in entry and entry.get(‘status’) == ‘ERROR’:
raise RuntimeError(“Command generated error on switch”)

return result

def main():

familyType = emc_vars[‘family’]
switchIpaddress = emc_vars[‘deviceIP’]
switchUsername = emc_vars[‘deviceLogin’]
switchPassword = emc_vars[‘devicePwd’]

if familyType == ‘VSP Series’:
print “This script uses JSON and can only be used with XOS”
raise RuntimeError(“This script will only work on XOS switches”)

# create a JSONRPC interface object with any defaults
jsonrpcObj = JsonRPC(ipaddress=switchIpaddress, username=switchUsername, password=switchPassword)

cmd = ‘show ports description’
result = remote_cli(jsonrpcObj, cmd)

burnPorts = []
for entry in result:
#print “Debug: Entry = “, entry # Uncomment for debugging
if ‘show_ports_description’ in entry:
port = entry.get(‘show_ports_description’).get(‘port’)
name = entry.get(‘show_ports_description’).get(‘displayString’)
print “Debug: Got port {} with name = {}”.format(port, name)
if name == ‘Burn-now’:
burnPorts.append(port)

if burnPorts:
portList = ‘,’.join(str(x) for x in burnPorts)

cmd = ‘disable ports ‘ + portList
remote_cli(jsonrpcObj, cmd)

cmd = ‘unconfigure ports ‘ + portList + ‘ display-string’
remote_cli(jsonrpcObj, cmd)

cmd = ‘enable ports ‘ + portList
remote_cli(jsonrpcObj, cmd)

print “Successfully burned ports: “, portList

else:
print “No ports to burn!”

main()

Lab3 EMC Python: Edit Ports

#@MetaDataStart
#@VariableFieldLabel (description = “Name of action to perform on (s)Witch port ?”,
#                     type = string,
#                     required = yes,
#                     validValues = [Burn-now, Burn-today, Burn-tomorrow, Burn-anyway],
#                     readOnly = no
#                     )
set var witchPort Burn-tomorrow
#@MetaDataEnd

def main():

try:
selectedPorts = emc_vars[‘port’]
except:
selectedPorts = None

if selectedPorts == None:
print “Performed no action as no ports selected on this switch”
return

assignName = emc_vars[‘witchPort’]

familyType = emc_vars[‘family’]

if familyType == ‘VSP Series’:
emc_cli.send(‘enable’)
emc_cli.send(‘config term’)
cmd = ‘interface gigabitEthernet ‘+selectedPorts
emc_cli.send(cmd)
cmd = ‘name “‘+assignName+'”‘
emc_cli.send(cmd)

elif familyType == ‘Summit Series’:
cmd = ‘configure ports ‘+selectedPorts+’ display-string “‘+assignName+'”‘
emc_cli.send(cmd)

else:
raise RuntimeError(“Unexpected switch family type!!”)

print “Successfully configured ports {} with name ‘{}'”.format(selectedPorts, assignName)

main()

Lab2 EMC Python: Contact

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()

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()

Netmiko

This script can be used to apply different configuration to groups of switch types:

from netmiko import ConnectHandler

s1 = {
‘device_type’: ‘avaya_vsp’,
‘ip’: ‘192.168.1.1’,
‘username’: ‘rwa’,
‘password’: ‘rwa’,
}

with open(‘core_config.txt’) as f:
lines = f.read().splitlines()
print(lines)

all_devices = [s1]

for devices in all_devices:
net_connect = ConnectHandler(**devices)
print(net_connect.find_prompt())
net_connect.enable()
print(net_connect.find_prompt())
net_connect.config_mode()
net_connect.send_config_set(lines)
print(net_connect.find_prompt())

net_connect.disconnect()

https://github.com/ktbyers/netmiko