I 'm new in python. I try to connect and get configuration using python. it work fine. I use paramiko and netmiko library as beloow
from paramiko import SSHClient, AutoAddPolicy
from time import sleep
=====paramiko=====
with SSHClient() as client:
client.set_missing_host_key_policy(AutoAddPolicy())
client.connect(
hostname='192.168.1.45',
username='testuser',
password='testpassword',
look_for_keys=False
)
session = client.invoke_shell()
session.send('enable' + '\n')
session.send('test' + '\n')
session.send('terminal length 0' + '\n')
session.send('show ip interface brief' + '\n')
session.send('exit' + '\n')
sleep(2)
output = session.recv(65535).decode('utf-8')
print(output.strip())
=====netmiko=====
from netmiko import ConnectHandler
device = {
'host': '192.168.1.44',
'username': 'testuser',
'password': 'testpassword',
'secret': 'test',
'device_type': 'cisco_ios',
'fast_cli': True
}
with ConnectHandler(**device) as net_connect:
output = net_connect.send_command('show ip interface brief')
print(output.strip())
but when I use code like both above it will not work on the alcatel switch 6850 version 6.3.4.265.R01. my code that I try following
=====paramiko=====
from paramiko import SSHClient, AutoAddPolicy
from time import sleep
with SSHClient() as client:
client.set_missing_host_key_policy(AutoAddPolicy())
client.connect(
hostname='xx.xx.xx.xx',
username='xxxxx',
password='xxxxx',
look_for_keys=False
)
session = client.invoke_shell()
session.send('show configuration snapshot' + '\n')
sleep(2)
output = session.recv(65535).decode('utf-8')
print(output.strip())
I get error about "Unknown exception: p must be exactly 1024, 2048, 3072, or 4096 bits long"
=====netmiko=====
from netmiko import ConnectHandler
device = {
'host': 'xx.xx.xx.xx',
'username': 'xxxxx',
'password': 'xxxxx',
'device_type': 'alcatel_aos',
'fast_cli': True
}
with ConnectHandler(**device) as net_connect:
output = net_connect.send_command('show configuration snapshot')
print(output.strip())
I get error about "Unknown exception: module 'cryptography.utils' has no attribute 'bit_length'"
please advise me.
anyone know how to get configuration to show in python on alcatel switch 6850?
Re: anyone know how to get configuration to show in python on alcatel switch 6850?
Hi,
did you check at the github site for Netmiko, a quick search and seems someone hit same issue couple months back:
https://github.com/ktbyers/netmiko/issues/2057
Worth checking over the responses there, couple of different suggestions.
Paramount
did you check at the github site for Netmiko, a quick search and seems someone hit same issue couple months back:
https://github.com/ktbyers/netmiko/issues/2057
Worth checking over the responses there, couple of different suggestions.
Paramount
Re: anyone know how to get configuration to show in python on alcatel switch 6850?
Paramount
thank you for your advice and your answer. I followed your link. now I solved
thank you for your advice and your answer. I followed your link. now I solved
Re: anyone know how to get configuration to show in python on alcatel switch 6850?
Excellent, glad to hear you got it sorted