Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import paramiko
- import os,sys
- sys.stderr = open('/dev/null') # Silence silly warnings from paramiko
- sys.stderr = sys.__stderr__
- pm = paramiko.SSHClient()
- pm.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- pm.connect('test-cls-mgt',
- username='admin',
- password='admin')
- cmd1 = ['vol show']
- cmd2 = ['quota show -vserver noitest_vs0 -volume ansibleVolume']
- cmd3 = ['network interface show']
- cmd = [ cmd1, cmd2, cmd3 ]
- def run_command(command):
- stdin,stdout,stderr = pm.exec_command(command)
- print('*** ' + command + ' ***')
- print('')
- for line in iter(stdout.readline, ''):
- print line.rstrip()
- print('')
- for commands in cmd:
- run_command(commands)
- pm.close()
- bash-4.1$ ./testing_ONTAP2.py
- *** vol show ***
- Vserver Volume Aggregate State Type Size Available Used%
- --------- ------------ ------------ ---------- ---- ---------- ---------- -----
- vs0 TestVolume01 aggr1 online RW 500MB 474.7MB 5%
- vs0 ansibleVolume aggr1 online RW 20MB 18.81MB 5%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement