标签:host send bsp invoke div style name for save
1 #!/usr/bin/python3 2 # -*- coding:utf-8 -*- 3 import paramiko 4 import time 5 6 ssh = paramiko.SSHClient() 7 key = paramiko.AutoAddPolicy() 8 ssh.set_missing_host_key_policy(key) 9 10 11 def execute(addr): 12 13 ssh.connect(addr, 22, ‘test‘, ‘123456‘, timeout=200) 14 ssh_shell = ssh.invoke_shell() 15 16 for script in scripts: 17 ssh_shell.send(script) 18 time.sleep(0.1) 19 20 21 if __name__ == ‘__main__‘: 22 23 # 要批量执行脚本的设备 24 devices = [‘10.1.3.161‘, ‘10.1.3.162‘, ‘10.1.3.163‘] 25 26 # 要批量执行的脚本 27 scripts = [‘sys\n‘, ‘sys sw\n‘, ‘q\n‘, ‘save\n‘, ‘Y\n‘] 28 29 for device in devices: 30 execute(device)
标签:host send bsp invoke div style name for save
原文地址:https://www.cnblogs.com/heqiuyong/p/11405725.html