Пример #1
0
def main():
    norn = InitNornir(config_file="./nornir.yml")
    nornir_set_creds(norn)

    result = norn.run(task=napalm_get, getters=["facts"])

    std_print(result)
Пример #2
0
def main():

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

    result = norn.run(task=os_upgrade, num_workers=20)
    std_print(result)
Пример #3
0
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)
Пример #4
0
def main():

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

    result = brg.run(
        netmiko_send_config, num_workers=60, config_commands=["logging buffered 20000"]
    )

    print_result(result)
Пример #5
0
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)
Пример #6
0
def main():

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

    result = norn.run(
        netmiko_send_command,
        num_workers=1,
        command_string="show ip int brief",
        use_textfsm=True,
    )
    print_result(result)
Пример #7
0
def main():

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

    result = norn.run(
        netmiko_file_transfer,
        source_file=test_file,
        dest_file=test_file,
        direction="put",
        num_workers=20,
    )
    std_print(result)
Пример #8
0
def main():

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

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

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

    # Verify the boot variable
    result = norn_ios.run(netmiko_send_command,
                          command_string="show run | section boot",
                          num_workers=20)
    std_print(result)
    continue_func()

    # Save the config
    result = norn_ios.run(netmiko_send_command,
                          command_string="write mem",
                          num_workers=20)
    std_print(result)

    # Reload
    continue_func(msg="Do you want to reload the device (y/n)? ")
    result = norn_ios.run(netmiko_send_command,
                          use_timing=True,
                          command_string="reload",
                          num_workers=1)

    # Confirm the reload (if 'confirm' is in the output)
    for device_name, multi_result in result.items():
        if "confirm" in multi_result[0].result:
            result = norn_ios.run(netmiko_send_command,
                                  use_timing=True,
                                  command_string="y")

    print("Devices reloaded")
Пример #9
0
def main():
    norn = InitNornir(config_file="./nornir.yml")
    nornir_set_creds(norn)
    result = norn.run(netmiko_test, num_workers=20)
    print_result(result)
Пример #10
0
def main():
    norn = InitNornir(config_file="./nornir.yml")
    nornir_set_creds(norn)
    result = norn.run(task=get_and_close, num_workers=20)
    std_print(result)
Пример #11
0
def main():
    with InitNornir(config_file="./nornir.yml") as norn:
        nornir_set_creds(norn)
        result = norn.run(task=napalm_get, num_workers=1, getters=["facts"])
    std_print(result)