def main(): devices = yaml_load_devices() password = os.getenv("PYNET_PASSWORD") if os.getenv("PYNET_PASSWORD") else getpass() for name, device_dict in devices.items(): device_dict["password"] = password connection = pyeapi.client.connect(**device_dict) device = pyeapi.client.Node(connection) output = device.enable("show ip arp") arp_list = output[0]["result"]["ipV4Neighbors"] output_printer(arp_list)
def main(): devices = yaml_load_devices() password = getpass() # Loop through each device, connect with passowrd and sh ip arp. for name, device_dict in devices.items(): device_dict["password"] = password # add the password to device_dict connection = pyeapi.client.connect(**device_dict) device = pyeapi.client.Node(connection) output = device.enable("show ip arp") # Pull out the dictionary contents arp_list = output[0]["result"]["ipV4Neighbors"] output_printer(name, arp_list)