You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Dear Experts,
I'm a new user of Netmiko, I'd like to use it instead of Paramiko in order to get the result of my commands.
My Python script is working fine with less than around 40 characters.
e.g. ssh.send_command("set address toto") --> It is working fine,
But, ssh.send_command(" set address-group "tototootototototoototototo") --> It blocks for around 1 minute and finish with a Timeout message error (entire message below)
My pieces of codes and some explanations
I use a code to get the commands lines to push to the firewall, all the command lines are included in a list
At the end, all the short commands works fine, toto, tata, titi, the security rule "Offload Skype" are correctly created because they are all under 40 characters, but as soon as a command with more than 40 characters is sent (e.g. set address-group "tototootototototoototototo" => 46 characters, the entry is created within the firewall but the script stops with the error described below.
I hope there is an option to fix it in Netmiko, I saw some posts with a "cmd_verify = False" but I can't use it with the paloalto_panos it looks ...
Thank you by advance for your support.
paloalto = {
'device_type': "paloalto_panos",
'ip': hostname,
'username': username,
'password': password,
'session_log': "output.txt",
}
ssh = ConnectHandler(**paloalto)
confmode = ssh.send_command("configure\n", expect_string=r"#")
print(confmode)
for conf in listconf:
print(conf)
error = ssh.send_command(conf)
sleep(1)
if error != "":
print("".center(100, "!"))
print(f"ERROR: The previous command finished with the message:{error}")
print("".center(100, "!"))
Please see below the result of my script from the Python shell
Please enter the admin usersame to connect to the Palo Alto >>>>> toto-admin
Warning (from warnings module):
File "C:\Program Files (x86)\Python37-32\lib\getpass.py", line 100
return fallback_getpass(prompt, stream)
GetPassWarning: Can not control echo on the terminal.
Warning: Password input may be echoed.
Please enter the password >>>>> passwordtoto
********************* Start the connection to the firewall fw-toto*********************
You are connected to the firewall fw-toto
Entering configuration mode
set address toto
set address tata
set address titi
set rulebase security rules "Offload Skype"
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: The previous command finished with the message:
�
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
set address-group "tototootototototoototototo"
Traceback (most recent call last):
File "C:\Program Files (x86)\Python37-32\lib\site-packages\paramiko\channel.py", line 699, in recv
out = self.in_buffer.read(nbytes, self.timeout)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\paramiko\buffered_pipe.py", line 164, in read
raise PipeTimeout()
paramiko.buffered_pipe.PipeTimeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\base_connection.py", line 541, in _read_channel_expect
new_data = self.remote_conn.recv(MAX_BUFFER)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\paramiko\channel.py", line 701, in recv
raise socket.timeout()
socket.timeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Temp\Script-to-check.py", line 123, in
pushconf(connect, listFW)
File "C:\Temp\Script-to-check.py", line 94, in pushconf
error = ssh.send_command(conf)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\paloalto\paloalto_panos.py", line 160, in send_command
return super().send_command(*args, **kwargs)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\base_connection.py", line 1366, in send_command
new_data = self.read_until_pattern(pattern=re.escape(cmd))
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\base_connection.py", line 618, in read_until_pattern
return self._read_channel_expect(*args, **kwargs)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\base_connection.py", line 552, in _read_channel_expect
"Timed-out reading channel, data not available."
netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, data not available.
The text was updated successfully, but these errors were encountered:
Hello Dear Experts,
I'm a new user of Netmiko, I'd like to use it instead of Paramiko in order to get the result of my commands.
My Python script is working fine with less than around 40 characters.
e.g. ssh.send_command("set address toto") --> It is working fine,
But, ssh.send_command(" set address-group "tototootototototoototototo") --> It blocks for around 1 minute and finish with a Timeout message error (entire message below)
My pieces of codes and some explanations
I use a code to get the commands lines to push to the firewall, all the command lines are included in a list
At the end, all the short commands works fine, toto, tata, titi, the security rule "Offload Skype" are correctly created because they are all under 40 characters, but as soon as a command with more than 40 characters is sent (e.g. set address-group "tototootototototoototototo" => 46 characters, the entry is created within the firewall but the script stops with the error described below.
I hope there is an option to fix it in Netmiko, I saw some posts with a "cmd_verify = False" but I can't use it with the paloalto_panos it looks ...
Thank you by advance for your support.
Please see below the result of my script from the Python shell
Please enter the admin usersame to connect to the Palo Alto >>>>> toto-admin
Warning (from warnings module):
File "C:\Program Files (x86)\Python37-32\lib\getpass.py", line 100
return fallback_getpass(prompt, stream)
GetPassWarning: Can not control echo on the terminal.
Warning: Password input may be echoed.
Please enter the password >>>>> passwordtoto
********************* Start the connection to the firewall fw-toto*********************
You are connected to the firewall fw-toto
Entering configuration mode
set address toto
set address tata
set address titi
set rulebase security rules "Offload Skype"
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: The previous command finished with the message:
�
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
set address-group "tototootototototoototototo"
Traceback (most recent call last):
File "C:\Program Files (x86)\Python37-32\lib\site-packages\paramiko\channel.py", line 699, in recv
out = self.in_buffer.read(nbytes, self.timeout)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\paramiko\buffered_pipe.py", line 164, in read
raise PipeTimeout()
paramiko.buffered_pipe.PipeTimeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\base_connection.py", line 541, in _read_channel_expect
new_data = self.remote_conn.recv(MAX_BUFFER)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\paramiko\channel.py", line 701, in recv
raise socket.timeout()
socket.timeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Temp\Script-to-check.py", line 123, in
pushconf(connect, listFW)
File "C:\Temp\Script-to-check.py", line 94, in pushconf
error = ssh.send_command(conf)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\paloalto\paloalto_panos.py", line 160, in send_command
return super().send_command(*args, **kwargs)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\base_connection.py", line 1366, in send_command
new_data = self.read_until_pattern(pattern=re.escape(cmd))
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\base_connection.py", line 618, in read_until_pattern
return self._read_channel_expect(*args, **kwargs)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\netmiko\base_connection.py", line 552, in _read_channel_expect
"Timed-out reading channel, data not available."
netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, data not available.
The text was updated successfully, but these errors were encountered: