def main(): norn = InitNornir(config_file="./nornir.yml") nornir_set_creds(norn) result = norn.run(task=napalm_get, getters=["facts"]) std_print(result)
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)
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)
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)
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)
def main(): norn = InitNornir(config_file="./nornir.yml") f = F(groups__contains="ios") napalm_hosts = norn.filter(f) result = napalm_hosts.run(task=napalm_get, getters=["facts"]) std_print(result) netmiko_hosts = norn.filter(F(groups__contains="nxos")) result = netmiko_hosts.run( netmiko_send_command, num_workers=60, command_string="show lldp neighbors", use_textfsm=True, ) std_print(result)
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")
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)
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)