Skip to content

sync_driver

scrapli_community.scrapli.genericdriver.sync_driver

default_sync_on_close(conn: GenericDriver) -> None

scrapli_genericdriver default on_close callable

Parameters:

Name Type Description Default
conn GenericDriver

GenericDriver object

required

Returns:

Type Description
None

N/A

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

    Args:
        conn: GenericDriver object

    Returns:
        N/A

    Raises:
        N/A

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

default_sync_on_open(conn: GenericDriver) -> None

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 GenericDriver

GenericDriver object

required

Returns:

Type Description
None

N/A

Source code in scrapli/genericdriver/sync_driver.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def default_sync_on_open(conn: GenericDriver) -> None:
    """
    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: GenericDriver object

    Returns:
        N/A

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