Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''Grabs WWN's for Dell M1000e chassis blades via CMC
- 2016 Will P
- '''
- import paramiko
- import getpass
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- cmc = raw_input('Enter chassis to query: ')
- whoami = raw_input("Enter your username: ")
- passwd = getpass.getpass('Enter Chassis Password: ')
- slots = range(1,17)
- slotinfo = []
- ssh.connect(hostname=cmc,username=whoami,password=passwd,look_for_keys=False)
- print('\n Getting WWNs for ' + cmc + '... ')
- for slot in slots:
- comm = 'getflexaddr -i %s' % slot
- stdin, stdout, stderr = ssh.exec_command(comm)
- slotinfo.append(stdout.read())
- output = ''.join(slotinfo)
- lines = output.split('\n')
- print(lines[4])
- for line in lines:
- if 'Fibre Channel' in line:
- print(line)
- stdin.flush()
- ssh.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement