Python learning for Network Engineers | Part 14 | Cisco device config backup to file using Python 3

Publicado el: 17 marzo 2019
en el canal de: NetworkEvolution
11,221
84

𝗙𝗼𝗿 𝗖𝗼𝗺𝗽𝗹𝗲𝘁𝗲 𝗣𝘆𝘁𝗵𝗼𝗻 𝗙𝗼𝗿 𝗡𝗲𝘁𝘄𝗼𝗿𝗸 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿𝘀 𝗖𝗼𝘂𝗿𝘀𝗲:
𝗘𝗻𝗿𝗼𝗹𝗹 𝗳𝗼𝗿 𝗯𝗲𝗹𝗼𝘄 𝗨𝗱𝗲𝗺𝘆 𝗖𝗹𝗮𝘀𝘀: 𝟐𝟎𝟐𝟐 𝐕𝐞𝐫𝐬𝐢𝐨𝐧
𝑫𝒊𝒔𝒄𝒐𝒖𝒏𝒕𝒆𝒅 𝑹𝒆𝒇𝒆𝒓𝒓𝒂𝒍 𝑳𝒊𝒏𝒌:
https://www.udemy.com/course/python-f... Python Series Complete video Playlist URL :   • Python learning for Network Engineers...  
To stay updated with my latest videos Please subscribe to my channel by clicking below
   / @networkevolution  

This video demonstrates how to take cisco routers / switches terminalbackup to file using Python 3

Using Open method in python


import paramiko
import time
from getpass import getpass
import datetime

TNOW = datetime.datetime.now().replace(microsecond=0)

username = 'admin'
password = 'admin'


DEVICE_LIST = open ('09_devices')
for RTR in DEVICE_LIST:
RTR = RTR.strip()
print ('\n #### Connecting to the device ' + RTR + '####\n' )
SESSION = paramiko.SSHClient()
SESSION.set_missing_host_key_policy(paramiko.AutoAddPolicy())
SESSION.connect(RTR,port=22,
username=username,
password=password,
look_for_keys=False,
allow_agent=False)

DEVICE_ACCESS = SESSION.invoke_shell()
DEVICE_ACCESS.send(b'terminal len 0\n')
DEVICE_ACCESS.send(b'show run\n')

time.sleep(5)
output = DEVICE_ACCESS.recv(65000)
print (output.decode('ascii'))
SAVE_FILE = open('ROUTER_' + RTR + str(TNOW), 'w')
SAVE_FILE.write(output.decode('ascii'))
SAVE_FILE.close

SESSION.close


En esta página del sitio puede ver el video en línea Python learning for Network Engineers | Part 14 | Cisco device config backup to file using Python 3 de Duración hora minuto segunda en buena calidad , que subió el usuario NetworkEvolution 17 marzo 2019, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 11,221 veces y le gustó 84 a los espectadores. Disfruta viendo!