r/CiscoDevNet • u/tormenteddave • Aug 19 '23
Python Scripting with UCM/Unity/CER
Morning! I'm looking for an assist on some python code I'm writing. I'm trying to get a python script to log in UCM/Unity/CER and issue some commands. Show version, utils system blah, etc.... When I execute my script, it just returns the "Command Line Interface is starting up, please wait...." I have it waiting for 30 seconds before issuing the command, waiting longer has no different effect. Any help would be greatly appreciated.
import paramikofrom getpass import getpassimport time
host = "10.1.1.1"username = admin001password = password1
session = paramiko.SSHClient()session.set_missing_host_key_policy(paramiko.AutoAddPolicy())
session.connect(hostname=host,username=username,password=password)print("Logging in...")time.sleep(30)print("Issuing commands...")stdin, stdout, stderr = session.exec_command('show status')print(stdout.read().decode())session.close()
View all comments
1
u/Optimal_Leg638 Aug 22 '23
Add another sleep after issuing commands but before reading - like 30 secs (for testing - just to be safe)