NAPALM | Script básico para obtener información general de un Cisco switch
1- Creación del script
root@angel-pc:/home/angel/scripts/napalm# nano napalm-script1.py
import napalm
from pprint import pprint as pp
driver = napalm.get_network_driver('ios')
device = driver(hostname='192.168.1.10', username='usuario', password='contraseña')
device.open()
pp(device.get_facts())
device.close()
2- Ejecución del script
root@angel-pc:/home/angel/scripts/napalm# python3 napalm-script1.py
root@angel-pc:/home/angel/scripts/napalm# python3 napalm-script1.py
{'fqdn': 'SW1-lab.local',
'hostname': 'SW1',
'interface_list': ['Vlan1',
'Vlan10',
'GigabitEthernet0/0',
'GigabitEthernet1/0/1',
'GigabitEthernet1/0/2',
'GigabitEthernet1/0/3',
'GigabitEthernet1/0/4',
'GigabitEthernet1/0/5',
'GigabitEthernet1/0/6',
'GigabitEthernet1/0/7',
'GigabitEthernet1/0/8',
'GigabitEthernet1/0/9',
'GigabitEthernet1/0/10',
'GigabitEthernet1/0/11',
'GigabitEthernet1/0/12',
'GigabitEthernet1/0/13',
'GigabitEthernet1/0/14',
'GigabitEthernet1/0/15',
'GigabitEthernet1/0/16',
'GigabitEthernet1/0/17',
'GigabitEthernet1/0/18',
'GigabitEthernet1/0/19',
'GigabitEthernet1/0/20',
'GigabitEthernet1/0/21',
'GigabitEthernet1/0/22',
'GigabitEthernet1/0/23',
'GigabitEthernet1/0/24',
'GigabitEthernet1/0/25',
'GigabitEthernet1/0/26',
'GigabitEthernet1/0/27',
'GigabitEthernet1/0/28',
'GigabitEthernet1/0/29',
'GigabitEthernet1/0/30',
'GigabitEthernet1/0/31',
'GigabitEthernet1/0/32',
'GigabitEthernet1/0/33',
'GigabitEthernet1/0/34',
'GigabitEthernet1/0/35',
'GigabitEthernet1/0/36',
'GigabitEthernet1/0/37',
'GigabitEthernet1/0/38',
'GigabitEthernet1/0/39',
'GigabitEthernet1/0/40',
'GigabitEthernet1/0/41',
'GigabitEthernet1/0/42',
'GigabitEthernet1/0/43',
'GigabitEthernet1/0/44',
'GigabitEthernet1/0/45',
'GigabitEthernet1/0/46',
'GigabitEthernet1/0/47',
'GigabitEthernet1/0/48',
'GigabitEthernet1/1/1',
'GigabitEthernet1/1/2',
'GigabitEthernet1/1/3',
'GigabitEthernet1/1/4',
'Port-channel5'],
'model': 'WS-C3650-48PS',
'os_version': 'IOS-XE Software, Catalyst L3 Switch Software '
'(CAT3K_CAA-UNIVERSALK9-M), Version 03.06.06E RELEASE SOFTWARE '
'(fc1)',
'serial_number': 'XXXYYYZZZ',
'uptime': 3023404,
'vendor': 'Cisco'}
Comentarios
Publicar un comentario