Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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() -> 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()
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
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",
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:
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)