How to use the nornir.core.InitNornir function in nornir

To help you get started, we’ve selected a few nornir examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ktbyers / pynet / nornir / os_upgrade / part2 / expanded_file_transfer / nornir_os_upgrade.py View on Github external
def main():
    # Initialize Nornir object using default "SimpleInventory" plugin
    nr = InitNornir()
    nornir_set_creds(nr)
    result = nr.run(
        task=os_upgrade,
        num_workers=20,
    )
    std_print(result)
github dmfigol / network-programmability-stream / nornir / lab-system / main.py View on Github external
def main() -> None:
    args = parse_arguments()
    nr = InitNornir("config.yaml")
    update_host_vars(nr.inventory)
    update_description(nr.inventory)
    deployment = Deployment(args.topologies, nr.inventory)
    import ipdb;
    ipdb.set_trace()
github ktbyers / pynet / nornir / os_upgrade / part2 / netmiko_file_transfer_2.py View on Github external
def main():

    # Initialize Nornir object using hosts.yaml and groups.yaml
    brg = InitNornir(config_file="nornir.yml")
    nornir_set_creds(brg)
    test_file = 'test_file9.txt'

    result = brg.run(
        task=os_upgrade,
        num_workers=20,
    )
    std_print(result)
github ktbyers / pynet / nornir / os_upgrade / part2 / netmiko_file_transfer_3.py View on Github external
def main():

    # Initialize Nornir object using hosts.yaml and groups.yaml
    brg = InitNornir(config_file="nornir.yml")
    nornir_set_creds(brg)

    print("Transferring files")
    result = brg.run(
        task=os_upgrade,
        num_workers=20,
    )
    std_print(result)

    # Filter to only a single device
    brg_ios = brg.filter(hostname="cisco1.twb-tech.com")

    # Verify the boot variable
    result = brg_ios.run(
        netmiko_send_command,
        command_string="show run | section boot",
github ktbyers / pynet / nornir / os_upgrade / part2 / netmiko_file_transfer_4.py View on Github external
def main():

    # Initialize Nornir object using hosts.yaml and groups.yaml
    brg = InitNornir(config_file="nornir.yml")
    nornir_set_creds(brg)

    print("Transferring files")
    # result = brg.run(
    #    task=os_upgrade,
    #    num_workers=20,
    # )
    # std_print(result)

    # Filter to only a single device
    brg_ios = brg.filter(hostname="cisco2.twb-tech.com")
    aggr_result = brg_ios.run(task=set_boot_var)

    # If setting the boot variable failed (assumes single device at this point)
    for hostname, val in aggr_result.items():
        if val[0].result is False:
github twr14152 / Network-Automation-Scripts_Python3 / Nornir / using_napalm_plugin / archive / script1.py View on Github external
from nornir.core import InitNornir
from nornir.plugins.tasks.networking import napalm_get
from nornir.plugins.functions.text import print_result

nr = InitNornir()

result = nr.run(
              napalm_get,
              getters=['get_facts', 'get_config',])              

print_result(result)