Python | Crear archivo .csv con datos obtenidos mediante libreria NAPALM
import napalm # Create a hosts file to include all the target IPs/hostnames that will be SSH'd. f = open ("/home/eve/hosts") # Create a .csv file and define all of the columns matching with NAPALM's "get_facts" output. csv_columns=("FQDN;HOSTNAME;MODEL;OS VERSION;SERIAL NUMBER;UPTIME;VENDOR\n") file= open("napalm.csv","w") file.write(csv_columns) # Create a python loop where it perform the following actions: # 1. Create the "host" variable where we will extract each line of code on every iteration using strip() # 2. Define the NAPALM's driver + SSH Username and Password # 3. Connect to each target host (via SSH) using device.open() # 4. Perform NAPAM's "get_facts" on the target host in order to get general data from the Cisco device in an "structured" way. This data is stored as a "Dictionary". # 5. Take each key data (fqdn, hostname, serial_number...) from "g...