Skip to content

rpc

nornir_scrapli.tasks.netconf_rpc

netconf_rpc(task: Task, filter_: str) -> Result

Send a "bare" rcp to the device with scrapli_netconf

Parameters:

Name Type Description Default
task Task

nornir task object

required
filter_ str

filter/rpc to execute

required

Returns:

Name Type Description
Result Result

nornir result object with Result.result value set the string result of the rpc operation

Source code in tasks/netconf/rpc.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def netconf_rpc(
    task: Task,
    filter_: str,
) -> Result:
    """
    Send a "bare" rcp to the device with scrapli_netconf

    Args:
        task: nornir task object
        filter_: filter/rpc to execute

    Returns:
        Result: nornir result object with Result.result value set the string result of the
            rpc operation

    Raises:
        N/A

    """
    scrapli_conn = task.host.get_connection("scrapli_netconf", task.nornir.config)
    scrapli_response = scrapli_conn.rpc(filter_=filter_)

    result = ScrapliResult(
        host=task.host,
        result=process_command_result(scrapli_response=scrapli_response),
        scrapli_response=scrapli_response,
        changed=True,
    )
    return result