Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Issue with asyncio stuck at task #53

@calvinrobson

Description

@calvinrobson

Hello,

I am trying netdev with the following code:

import asyncio
import netdev
import logging
import netdev

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

async def task(param):
    async with netdev.create(**param) as ios:
        # Testing sending simple command
        out = await ios.send_command("show ip int br")
        print(out)
       

async def run():
    dev1 = { 'username' : 'calvin',
             'password' : 'password',
             'device_type': 'cisco_ios',
             'host': '192.168.129.132',
    }
    devices = [dev1]
    tasks = [task(dev) for dev in devices]
    await asyncio.wait(tasks)


loop = asyncio.get_event_loop()
loop.run_until_complete(run())

I seem to getting an error where it is not executing, I have enabled logging and I am receiving the following error:


INFO:netdev:Host 192.168.129.132: Trying to connect to the device
INFO:netdev:Host 192.168.129.132: Establishing connection to port 22
INFO:asyncssh:Opening SSH connection to 192.168.129.132, port 22
INFO:asyncssh:[conn=0] Connection to 192.168.129.132, port 22 succeeded
INFO:asyncssh:[conn=0]   Local address: 192.168.129.1, port 52907
INFO:asyncssh:[conn=0] Beginning auth for user calvin
INFO:asyncssh:[conn=0] Auth for user calvin succeeded
INFO:asyncssh:[conn=0, chan=0] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=0]   Interactive shell requested
INFO:netdev:Host 192.168.129.132: Connection is established
INFO:netdev:Host 192.168.129.132: Reading until pattern
DEBUG:netdev:Host 192.168.129.132: Reading pattern: >|\#
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-2' coro=<task() done, defined 

Can I please receive help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions