ktbyers / netmiko

Multi-vendor library to simplify Paramiko SSH connections to network devices
MIT License
3.59k stars 1.3k forks source link

Extreme VSP - not able to send the command with rwa access #2484

Closed seyedfazil900 closed 1 year ago

seyedfazil900 commented 3 years ago

from netmiko import ConnectHandler

EXTREME = { "device_type": "extreme_vsp", "ip": "192.168.1.1", "username": input("Enter the password:") "password": input("Enter the password:") }

ssh_connect = ConnectHandler(**EXTREME) output = ssh_connect.send_command("show ip int bri") print(output)

seyedfazil900 commented 3 years ago

^ % Invalid input detected at '^' marker.

Getting above error

ktbyers commented 3 years ago

@seyedfazil900 You should probably look at the Netmiko session_log and look at more details regarding what is happening:

EXTREME = {
"device_type": "extreme_vsp",
"ip": "192.168.1.1",
"username": input("Enter the password:"),
"password": input("Enter the password:"),
"session_log": "my_output.txt",         # Will create a file named "my_output.txt" with details about the session.
}
seyedfazil900 commented 3 years ago

I have tried and found the problem. But not able to save the output as a .txt file. In the seesion log the running config reach upto line 1300 and breaks and futher not able to fethc the running configution.

from netmiko import ConnectHandler

EXTREME = { "device_type": "extreme_vsp", "ip": "172.165.89.32", "username": "sfazil.isl", "password": input("Enter the password:"), "session_log": "my_output.txt" }

ssh_connect = ConnectHandler(**EXTREME) ssh_connect.enable() output = ssh_connect.send_command("show running-config") print(output)

file_location = "D:\AVAYA IMAGE\BACKUP\backup" open_device = open(file_location + ".txt", "w") open_device.write(output)

seyedfazil900 commented 3 years ago

Traceback (most recent call last): File "C:\Users\freeza\Desktop\PYTHON CODE\back2.py", line 14, in output = ssh_connect.send_command("show running-config") File "C:\Users\freeza\PycharmProjects\pythonProject1\venv\lib\site-packages\netmiko\utilities.py", line 500, in wrapper_decorator return func(self, *args, **kwargs) File "C:\Users\freeza\PycharmProjects\pythonProject1\venv\lib\site-packages\netmiko\base_connection.py", line 1533, in send_command new_data = self.read_channel() File "C:\Users\freeza\PycharmProjects\pythonProject1\venv\lib\site-packages\netmiko\base_connection.py", line 526, in read_channel output = self._read_channel() File "C:\Users\freeza\PycharmProjects\pythonProject1\venv\lib\site-packages\netmiko\base_connection.py", line 518, in _read_channel self._write_session_log(output) File "C:\Users\freeza\PycharmProjects\pythonProject1\venv\lib\site-packages\netmiko\base_connection.py", line 448, in _write_session_log self.session_log.write(self.normalize_linefeeds(data)) UnicodeEncodeError: 'ascii' codec can't encode character '\u2013' in position 11498: ordinal not in range(128)

ktbyers commented 3 years ago

Hmmm, do you have non-ascii characters in your show running-config?

ktbyers commented 3 years ago

So did you find the original problem or is this still broken?

seyedfazil900 commented 3 years ago

It has only ASCII. It is is breaking not able to see the full out running config i

ktbyers commented 1 year ago

I am going to close this issue as it is old/stale. If anyone is still working on this, feel free to re-open it.