Header Only - DO NOT REMOVE - Extreme Networks
Question

How to answer Yes and No question using paramiko (scripting)

  • 5 November 2019
  • 1 reply
  • 392 views

I need to save configuration on switch extreme. The command is :

save configuration "File Name"

After of command's execution i need to answer 2 question.

First:

Do you want to save configuration ? (y/N) -> I have to say Yes

Second:

Do you want to make "File Name".cfg the default database? (y/N) -> I have to say No

I am using paramiko for command execution.

Below is a piece of my code:

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(server, username=username, password=password)
stdin, stdout, stderr = ssh.exec_command('save configuration '+ backupFileName)
#Now i need to say first Yes and then NO

Someone could help me?

Thanks


1 reply

Userlevel 7

Hi,

 

I never used paramiko, but if you happen to have XMC, you should consider porting your script to it. XMC would take care of all of that for you and you could more easily manage these questions.

Reply