selfuryon / netdev

Asynchronous multi-vendor library for interacting with network devices
http://netdev.readthedocs.io/
Apache License 2.0
213 stars 44 forks source link

Small issue with Ubiquity_edge - probably my fault. #39

Closed SobieskiCodes closed 5 years ago

SobieskiCodes commented 5 years ago

Question

Turned debugging on and added $ to the pattern, its finding it, but timing out after the command.

DEBUG:netdev:Host 192.168.16.1: Reading pattern '>|\#|\$' was found: '\r\nmyname@rtr0:~$ \r\n'
DEBUG:netdev:Host 192.168.16.1: Found Prompt: 'myname@rtr0:~$'
DEBUG:netdev:Host 192.168.16.1: Base Prompt: myname@rtr0
DEBUG:netdev:Host 192.168.16.1: Base Pattern: \(myname@rtr.*?\) (\(.*?\))?[>|\#|\$]
INFO:netdev:Host 192.168.16.1: Entering to privilege exec
INFO:netdev:Host 192.168.16.1: Checking privilege exec
INFO:netdev:Host 192.168.16.1: Reading until pattern
DEBUG:netdev:Host 192.168.16.1: Reading pattern: \(myname@rtr.*?\) (\(.*?\))?[>|\#|\$]
ERROR:asyncio:Task exception was never retrieved
netdev.exceptions.TimeoutError: Host 192.168.16.1 Timeout Error

Any insight? (running the command in ssh/cli works fine so i know its the command thats the issue. (let me know what you need) It looks like it finds the prompt fine but can't seem to read the pattern.

import asyncio
import netdev
import logging

logging.basicConfig(level=logging.INFO)
netdev.logger.setLevel(logging.DEBUG)

async def task(param):
    async with netdev.create(**param) as ubi:
        out = await ubi.send_command("?")
        print(out)

async def run():
    dev = {'username': 'admin',
            'password': 'password',
            'device_type': 'ubiquity_edge',
            'host': '192.168.16.1',
            }
    devices = [dev]
    tasks = [task(dev) for dev in devices]
    await asyncio.wait(tasks)

loop = asyncio.get_event_loop()
loop.run_until_complete(run())
SobieskiCodes commented 5 years ago

No idea - its working today. Must be something on my end.