我正在尝试通过Paramiko使用ssh连接Cisco UCSM。我的命令失败了。当我手动输入相同的命令时,工作正常。请任何人都能指导我如何解决这个问题。你知道吗
代码:
import time
import paramiko
import getpass
host = "10.10.10.10"
username = "admin"
password = getpass.getpass("Please enter Password:")
c=paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(host,username=username,password=password)
print "connection to %s established" %host
time.sleep(1)
stdin, stdout, stderr = c.exec_command("scope org db")
output = stdout.read()
print output
time.sleep(2)
stdin, stdout, stderr = c.exec_command('show service-profile')
output = stdout.read()
print output
输出:
Please enter Password:
connection to 10.10.10.10 established
^
% Incomplete Command at '^' marker
在UCSM中手动输入的命令:
ucsm1# scope org db
ucsm1 /org # show service-profile
Service Profile:
Service Profile Name Type Server Assignment Association
-------------------- ----------------- ------- ---------- -----------
db/SP-DB1
Instance 8/7 Assigned Associated
ucsm1 /org #
谢谢你
您可以尝试执行以下命令,而不是执行命令:
相关问题 更多 >
编程相关推荐