Skip to content

async_driver

scrapli_community.scrapli.genericdriver.ansync_driver

default_async_on_close(conn: AsyncGenericDriver) -> None async

Async scrapli_genericdriver default on_close callable

Parameters:

Name Type Description Default
conn AsyncGenericDriver

AsyncGenericDriver object

required

Returns:

Type Description
None

N/A

Source code in scrapli/genericdriver/async_driver.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
async def default_async_on_close(conn: AsyncGenericDriver) -> None:
    """
    Async scrapli_genericdriver default on_close callable

    Args:
        conn: AsyncGenericDriver object

    Returns:
        N/A

    Raises:
        N/A

    """
    conn.channel.write(channel_input="logout")
    conn.channel.send_return()

default_async_on_open(conn: AsyncGenericDriver) -> None async

Async scrapli_genericdriver default on_open callable

This is tested with a cisco wlc using auth_bypass so we have to send creds during on open

Parameters:

Name Type Description Default
conn AsyncGenericDriver

AsyncGenericDriver object

required

Returns:

Type Description
None

N/A

Source code in scrapli/genericdriver/async_driver.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
async def default_async_on_open(conn: AsyncGenericDriver) -> None:
    """
    Async scrapli_genericdriver default on_open callable

    This is tested with a cisco wlc using auth_bypass so we have to send creds during on open

    Args:
        conn: AsyncGenericDriver object

    Returns:
        N/A

    Raises:
        N/A
    """
    await asyncio.sleep(0.25)
    conn.channel.write(channel_input=conn.transport.auth_username)
    conn.channel.send_return()
    await asyncio.sleep(0.25)
    conn.channel.write(channel_input=conn.transport.auth_password)
    conn.channel.send_return()