Skip to content

get_version

nornir_scrapli.tasks.cfg.get_version

cfg_get_version(task: Task) -> Result

Get device version with scrapli-cfg

Parameters:

Name Type Description Default
task Task

nornir task object

required

Returns:

Name Type Description
Result Result

nornir result object with Result.result value set to current version of device

Source code in tasks/cfg/get_version.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def cfg_get_version(task: Task) -> Result:
    """
    Get device version with scrapli-cfg

    Args:
        task: nornir task object

    Returns:
        Result: nornir result object with Result.result value set to current version of device

    Raises:
        N/A

    """
    scrapli_cfg_conn = ScrapliConfig.get_connection(task=task)

    version = scrapli_cfg_conn.get_version()

    return Result(host=task.host, result=version.result, failed=False, changed=False)