Set Adtran terminal width to at least 132
See original GitHub issueHi, sorry if this has been solved previously.
I get the following error whenever I try to connect to an ADTRAN device since upgrading to 4.0 and 4.1:
Traceback (most recent call last):
File "C:\Users\jhodie\pinemedia.net\NOC Team - Documents\Automation-testing\Netmiko testing\ttp-test-01\ttp-test-05.py", line 101, in <module>
ssp()
File "C:\Users\jhodie\pinemedia.net\NOC Team - Documents\Automation-testing\Netmiko testing\ttp-test-01\ttp-test-05.py", line 39, in ssp
output = net_connect.send_command(cfg, cmd_verify=False) #Send command
File "C:\Users\jhodie\AppData\Local\Programs\Python\Python310\lib\site-packages\netmiko\utilities.py", line 596, in wrapper_decorator
return func(self, *args, **kwargs)
File "C:\Users\jhodie\AppData\Local\Programs\Python\Python310\lib\site-packages\netmiko\base_connection.py", line 1694, in send_command
raise ReadTimeout(msg)
netmiko.exceptions.ReadTimeout:
Pattern not detected: 'terminal\\ width\\ 132' in output.
Things you might try to fix this:
1. Explicitly set your pattern using the expect_string argument.
2. Increase the read_timeout to a larger value.
You can also look at the Netmiko session_log or debug log for more information.
Is there something with the update that I can do differently to stop this?
My code is:
from ttp import ttp
from netmiko import ConnectHandler
import pprint
import json
import argparse
#########################################################################################################################################################################
def setup_args():
parser = argparse.ArgumentParser(description='Gather data from a OLT')
parser.add_argument('serial', help='Serial number of the ONT')
parser.add_argument('olt_hostname', help='Hostname of OLT in "quotes"')
return parser.parse_args()
#########################################################################################################################################################################
def ssp():
global ont_id
global olt_shelf
global olt_slot
global olt_port
global ont_state
global distance_to_ont
global light_rx
global light_tx
global rdi
template_01 = """
{{ ont_id }}@{{ olt_shelf }}/{{ olt_slot }}/{{ olt_port }}.gpon IS {{ state }} {{ ignore }} {{ distance }} {{ light_rx }}|{{ light_tx }} {{ ignore }} {{ rdi }} {{ ignore }}
"""
if olt_type == 1:
cfg = f'show table remote ont | include ' + str(args.serial)
all_devices = [testolt]
with open('adtran_ssp_output.txt', 'w') as o: #Output processes to a text file for debugging
for devices in all_devices: #Repeat the below for each device
net_connect = ConnectHandler(**devices) #Tells netmiko to connect to all devices in the devices list
net_connect.enable() #Enter enable mode
net_connect.send_command('terminal width 132', cmd_verify=False) #Set large terminal width else netmiko gets verrry confused
output = net_connect.send_command(cfg, cmd_verify=False) #Send command
o.write(output)
if output != "" or output != 'None':
parser = ttp('adtran_ssp_output.txt', template_01)
parser.parse()
#put result in JSON format
results_0 = parser.result(format='json')[0]
#str to list **convert with json.loads
result_0 = json.loads(results_0)
ont_id = result_0[0]['ont_id']
olt_shelf = result_0[0]['olt_shelf']
olt_slot = result_0[0]['olt_slot']
olt_port = result_0[0]['olt_port']
ont_state = result_0[0]['state']
distance_to_ont = result_0[0]['distance']
light_rx = result_0[0]['light_rx']
light_tx = result_0[0]['light_tx']
rdi = result_0[0]['rdi']
else:
print('\033[2;31;43mWARNING: The specified serial number does not exist')
print('Exiting...\033[0;0m')
exit()
#########################################################################################################################################################################
global args
global testolt
global olt_type
olt_type = None
args = setup_args()
#Define device connection details based on the selected OLT
if args.olt_hostname == 'olt-01.testing':
testolt = { 'device_type': 'adtran_os',
'ip': '10.0.10.10',
'username': 'user',
'password': 'pass',
'port': '22',
'session_log': 'adtran_output.txt'
}
olt_type = 1
elif args.olt_hostname == 'olt-02.testing':
testolt = { 'device_type': 'adtran_os',
'ip': '10.0.1.10',
'username': 'user',
'password': 'pass',
'port': '22',
'session_log': 'adtran_output.txt'
}
olt_type = 1
else:
print('\033[2;31;43mWARNING: Incorrect OLT specified.')
print('Exiting...\033[0;0m')
exit()
print(f'\nTest displaying passed information \n Serial: {args.serial} \n OLT Hostname: {args.olt_hostname} \n')
print('\n=== 1. Finding ONT information ===\n')
ssp()
print('ONT ID: ' + str(ont_id) + '\n OLT Shelf: ' + str(olt_shelf) + '\n OLT Slot: ' + str(olt_slot) + '\n OLT Port: ' + str(olt_port) + '\n ONT State: ' + str(ont_state) + '\n Distance to ONT: ' + str(distance_to_ont) + '\n Rx Light levels: ' + str(light_rx) + '\n Tx Light levels: ' + str(light_tx) + 'RDI: ' + str(rdi) + '\n')
The session log is:
Last Login Date : Jun 9 2022 09:31:46
Last Login Type : IP Session(CLI)
Login Failures : 0 (Since Last Login)
: 0 (Total for Account)
olt-02.testing>
olt-02.testing>terminal length 0
olt-02.testing>
olt-02.testing>enable
olt-02.testing#
olt-02.testing#
olt-02.testing#
olt-02.testing#terminal width 132
olt-02.testing#
show table remote ont | include ADTN12345678
5@1/1/2.gpon IS up ADTN12345678 2045 -17.0|2.9 0|11 0 En
olt-02.testing#
Once again sorry if this has been answered and I’m just being blind
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
ADTRAN Operating System (AOS) Command Reference Guide
Specifies a minimum time to wait between sending test packets. Valid range is 100 to 60000 milliseconds. Default Values. By default, the data...
Read more >ASE Command Reference Guide - Adtran Support Community
Enable Mode Command Set. Command Reference Guide. 132. Volume 1. 6AMC0CRG-35C. 2.91 show ip verify source. Use the show ip verify source command...
Read more >ADTRAN OPERATING SYSTEM (AOS)
This Agreement covers all software installed on the system as well as any software available on the ADTRAN website. In addition, certain ADTRAN...
Read more >ADTRAN Operating System SNMP in AOS
Octet 5 is set to 03 to indicate that the engine ID uses a MAC address as the unique identifier. The last six...
Read more >Configuring the 814-v6 Gateway | Adtran Support Community
Add Network Traffic Class Rule section. Traffic Class Name. Enter a descriptive name for this rule. Rule Order. This option is set to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ktbyers Max terminal width is 132
Fixed here:
https://github.com/ktbyers/netmiko/pull/2927