question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mikrotik_routeros incomplete output

See original GitHub issue

Hi, I’m working on automating a mixture of devices and ran into issues. Using a minimal testscript I found the mikrotik to behave differently. I tried:

def testcmd(ipaddr, devicetype, MyCmd):
   DeviceInfo = {
            'device_type': devicetype,
            'host':       ipaddr,
            'username':   "admin",
            'password':   "admin",
            'global_cmd_verify':False
    }         
    net_connect = ConnectHandler(**DeviceInfo)
    output = net_connect.send_command(MyCmd)
    net_connect.disconnect()
    print("{" + output + "}\n")


testcmd("192.168.73.20", "mikrotik_routeros", "export")
testcmd("192.168.37.30", "hp_procurve",       "sh run")

which gave an incomplete result for routeros (yes, tried against multiple devices)

{port

# sep/23/2020 15:12:36 by RouterOS 6.46.7 # # model = RB750Gr3 /interface wireless security-profiles set [ find default=yes ] supplicant-identity=MikroTik /ip hotspot profile set [ find default=yes ] html-directory=flash/hotspot }

{ Running configuration:

; J9019B Configuration Editor; Created on release #Q.11.74

hostname “ProCurve Switch 2510B-24” snmp-server contact “helpdesk” snmp-server location “Lab” trunk 23-24 Trk1 LACP vlan 1 name “DEFAULT_VLAN” untagged 1-22,25-26,Trk1 ip address dhcp-bootp exit ip authorized-managers 192.168.1.0 255.255.255.0 aaa authentication login privilege-mode aaa authentication console login radius local aaa authentication telnet login radius local aaa authentication telnet enable radius local aaa authentication web login radius local aaa authentication ssh login radius local aaa authentication ssh enable radius local radius-server timeout 2 spanning-tree spanning-tree Trk1 priority 4 ip ssh password manager password operator }

Next step I tried:

def testcmd(ipaddr, devicetype, MyCmd):
   DeviceInfo = {
            'device_type': devicetype,
            'host':       ipaddr,
            'username':   "admin",
            'password':   "admin",
            'global_cmd_verify':False
    }         
    net_connect = ConnectHandler(**DeviceInfo)
    if devicetype == "mikrotik_routeros":    
        output = net_connect.send_command_timing(MyCmd)
    else:
        output = net_connect.send_command(MyCmd)
    net_connect.disconnect()
    print("{" + output + "}\n")


testcmd("192.168.73.20", "mikrotik_routeros", "export")
testcmd("192.168.37.30", "hp_procurve",       "sh run")

which gave the result I expected in the first place

{# sep/23/2020 15:13:33 by RouterOS 6.46.7 # # model = RB750Gr3 /interface wireless security-profiles set [ find default=yes ] supplicant-identity=MikroTik /ip hotspot profile set [ find default=yes ] html-directory=flash/hotspot /ip neighbor discovery-settings set discover-interface-list=!dynamic /ip dhcp-client add disabled=no interface=ether5 /ip service set telnet disabled=yes set ftp disabled=yes set api disabled=yes set api-ssl disabled=yes /ip ssh set forwarding-enabled=remote strong-crypto=yes /snmp set enabled=yes /system clock set time-zone-name=Europe/Stockholm /system logging add action=remote topics=critical add action=remote topics=error add action=remote topics=info add action=remote topics=warning /system routerboard settings set silent-boot=yes /tool graphing interface add /tool graphing queue add /tool graphing resource add /tool romon set enabled=yes /user aaa set use-radius=yes

}

{ Running configuration:

; J9019B Configuration Editor; Created on release #Q.11.74

hostname “ProCurve Switch 2510B-24” snmp-server contact “helpdesk” snmp-server location “Lab” trunk 23-24 Trk1 LACP vlan 1 name “DEFAULT_VLAN” untagged 1-22,25-26,Trk1 ip address dhcp-bootp exit ip authorized-managers 192.168.1.0 255.255.255.0 aaa authentication login privilege-mode aaa authentication console login radius local aaa authentication telnet login radius local aaa authentication telnet enable radius local aaa authentication web login radius local aaa authentication ssh login radius local aaa authentication ssh enable radius local radius-server timeout 2 spanning-tree spanning-tree Trk1 priority 4 ip ssh password manager password operator }

Is this expected? a bug? programmer error? Any suggestions or ideas?

//Tonny

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Fleegle61commented, Nov 16, 2020

Keeping an eye out for the next update. Still cant get a good output from my MT router with the changes above and in other threads. Getting partial output from commands.

0reactions
ktbyerscommented, Jul 9, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing RouterOS configuration after a reboot on very rare ...
Provide supout file (generated when the configuration is lost) and if it is a possibility backup file (before the configuration was lost). If ......
Read more >
Manual:Interface/Ethernet - MikroTik Wiki
Through RouterOS, it is possible to control different Ethernet related properties like link speed, auto-negotiation, duplex mode, etc, monitor a ...
Read more >
Output of "/routing bgp advertisements print" is truncated
When dealing with IPv6 routes, the output of the command "/routing bgp advertisements print" is truncated: "PEER", "PREFIX" and "NEXTHOP" ...
Read more >
Packet Flow in RouterOS - Support - MikroTik
RouterOS packet flow diagram and flow examples will try to answer these questions. ... Or when a packet is originated from the router...
Read more >
v7.6 [stable] is released! - MikroTik - Forum
RouterOS version 7.6 is released in the "v7 stable" channel! ... wireless - fixed missing wireless interface on some RB921GS-5HPacD devices;
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found