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.

netmiko constant feed

See original GitHub issue

mikrotik_issue.txt

I am having this issue with mikrotiks, i used in multiple ones with RouterOS 6.49.6. netmiko==4.1.2

Code:

 for cmds in cmds:
            net_connect.write_channel(cmds)
        output = net_connect.read_channel_timing()
        output = net_connect.strip_ansi_escape_codes(output)
        print(output)

Also when i use the find_prompt() it doesn’t detect anything

def testCPE(self, user, pswd, ip):
        try:
            self.vm_conn.write_channel('ssh -o StrictHostKeyChecking=no -l ' + user + ' ' + ip + '\r')
            time.sleep(11)
            print("1")
            self.vm_conn.write_channel(pswd.format(self.vm_conn.password))
            print("2")
            time.sleep(10)
            output = self.vm_conn.find_prompt()
            print(output)

in this case output = “”

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
joaosousa997commented, Dec 14, 2022
def testCPE(self, user, pswd, ip):
        try:
            self.vm_conn.write_channel('ssh -o StrictHostKeyChecking=no -l ' + user + ' ' + ip + '\r')
            time.sleep(11)
            print(self.vm_conn.find_prompt())
            self.vm_conn.write_channel(pswd.format(self.vm_conn.password))
            output = self.vm_conn.find_prompt()
            if "#" in output and "*" not in output and "A:" not in output:
                redispatch(self.vm_conn, device_type='cisco_ios')
            elif "<" in output:
                redispatch(self.vm_conn, device_type='huawei')
            elif ">" in output:
                redispatch(self.vm_conn, device_type='mikrotik_routeros')
            else:
                redispatch(self.vm_conn, device_type='mikrotik_routeros')#alcatel_sros
            return output
        except Exception as ex:
            print(ex.args[0])

Sure!

Sorry about the delay.

0reactions
joaosousa997commented, Dec 19, 2022

test.log

There we go, log file!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Netmiko - Problems Connecting to Multiple Devices at a Time
I made a script that accepts an IP address as input and checks all of the ARP tables across all our layer three...
Read more >
Multithreading with Python and Netmiko
In this segment we: Create the queue; Populate the queue with our devices settings; Start our threads. ResultsPermalink. Now that we've got our ......
Read more >
Managing JUNOS device using Netmiko - Devang Patel
Documenting the way I learned to use Netmiko with JUNOS device.
Read more >
Python script throws error ("Socket exception
Hi, I am new to python and have written a script based on my experience so far with python to automate the process...
Read more >
Testing your network with Nornir TestsProcessor
... follow github account and twitter feed for latest updates. ... why not we all already running automated tests suits on a constant...
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