Below is the code:
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect("1.1.1.1", username=username, password=password)
stdin, stdout, stderr = client.exec_command("set -units GB")
stdin, stdout, stderr = client.exec_command("vol show -vserver vs1 -volume test_volume -fields size")
return stdout.read()
Output getting from code:
vserver volume size
------------------------ ------------------ ------
vs1 test_volume 1.07TB
Output from device:
test01::> set -units GB
test01::> vol show -vserver vs1 -volume test_volume -fields size
vserver volume size
------------------------ ------------------ ------
vs1 test_volume 1100GB
Looks like paramiko not executing commands in same channel. How do i get value "1100GB" in python script also?
Hint: Both command should execute in same session so that i will get expected output like in device