Python + NAPALM | Script para mostrar inventario de Hosts con su serial number
ARCHIVO DE HOSTS
192.168.1.17
nano /home/eve/hosts
192.168.1.17
SCRIPT
import napalm
import json
f = open ("/home/eve/hosts")
for line in f:
host = line.strip()
driver = napalm.get_network_driver('ios')
device = driver(hostname=host, username='cisco', password='cisco')
device.open()
getfacts = device.get_facts()
get_serialnumber = getfacts["serial_number"]
print (host + " " + get_serialnumber)
device.close()
RESULTADO (OUTPUT)
eve@Linux-Desktop:~$ python3 test1_6.py
192.168.1.100 FTX0945W0MY
192.168.1.17 FTX0945W0MY
Comentarios
Publicar un comentario