Nokia_SROS adding backspace characters to output
See original GitHub issueI’m using the textfsm processing to pull command output tables, and I noticed that on some devices it wasn’t returning the expected output but on others it was. Further examination from the Netmiko debug logs I found that the return seemed to be including backspace control characters that were messing up the output spacing and throwing off the textfsm parse.
The code doesn’t seem to matter, as I get the same result from an interactive python env as I do in a built script, so here’s what I’m doing and the output I’m seeing.
Not working:
>>> net_connect = Netmiko(host='10.187.165.188', username='ipmetro-script', password='*******', device_type='nokia_sros')
>>> output = net_connect.send_command('show router ospf neighbor')
>>> print(output)
===============================================================================
Rtr Base OSPFv2 Instance 0 Neighbors
===============================================================================
Interface-Name Rtr Id State Pri RetxQ TTL
Area-Id
-------------------------------------------------------------------------------
x-ge1/1/25 10.187.165.155 Full 1 0 39
0.0.0.0
ge1/1/20 10.186.16.2 Full 1 2 38
0.0.0.0
-------------------------------------------------------------------------------
No. of Neighbors: 2
===============================================================================
>>> net_connect.disconnect()
Each of the interface names should be right against the left margin, but they are spaced away. Here’s one that works properly, with the exact same command, though the device is a different type of hardware:
Working
>>> net_connect = Netmiko(host='10.187.166.141', username='ipmetro-script', password='*******', device_type='nokia_sros')
>>> output = net_connect.send_command('show router ospf neighbor')
>>> print(output)
===============================================================================
Rtr Base OSPFv2 Instance 0 Neighbors
===============================================================================
Interface-Name Rtr Id State Pri RetxQ TTL
Area-Id
-------------------------------------------------------------------------------
x-ge1/1/1 10.187.166.134 Full 1 0 37
0.0.0.0
x-ge2/1/1 10.187.166.135 Full 1 0 31
0.0.0.0
x-ge1/2/1 10.187.166.191 Full 1 0 35
0.0.0.0
-------------------------------------------------------------------------------
No. of Neighbors: 3
===============================================================================
>>> net_connect.disconnect()
Attached the relevant Netmiko logs as well. I’ve tried post-processing with the strip_backspace() method, but it doesn’t seem to work, and defeats the purpose of doing textfsm inline with the send_command(unless of course I’m using it incorrectly, which I’ll admit is as likely as anything else since I’m a network engineer first and reasonably new to this automation journey). backspace control logs.txt
Thanks in advance for any insight you can provide.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (10 by maintainers)
Top GitHub Comments
@ktbyers yes, I am reading it the same. The software version OP is running is way too old (10yrs back) to even ask “wtf is happening” internally.
the only thing that comes to my mind is to make an additional function for such old releases that will count the number of backspace chars per line and will remove the same number of spaces from the left for such lines.
I would name that func the_old_software_strikes_back()
Yeah, I think it should just be in the TextFSM template. It is just whitespace so really shouldn’t be a problem in the template (in general).
Okay, I am going to close this as I don’t think there is anything to do on the Netmiko side.