filmov
tv
Python learning for Network Engineers | Part 12 | Open file for cisco configuration

ะะพะบะฐะทะฐัั ะพะฟะธัะฐะฝะธะต
๐๐ผ๐ฟ ๐๐ผ๐บ๐ฝ๐น๐ฒ๐๐ฒ ๐ฃ๐๐๐ต๐ผ๐ป ๐๐ผ๐ฟ ๐ก๐ฒ๐๐๐ผ๐ฟ๐ธ ๐๐ป๐ด๐ถ๐ป๐ฒ๐ฒ๐ฟ๐ ๐๐ผ๐๐ฟ๐๐ฒ:
๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐ฏ๐ฒ๐น๐ผ๐ ๐จ๐ฑ๐ฒ๐บ๐ ๐๐น๐ฎ๐๐: ๐๐๐๐ ๐๐๐ซ๐ฌ๐ข๐จ๐ง
๐ซ๐๐๐๐๐๐๐๐๐ ๐น๐๐๐๐๐๐๐ ๐ณ๐๐๐:
To stay updated with my latest videos Please subscribe to my channel by clicking below
This video demnstrates how to read a file to get list of devices .
Open file to read/write /append get the configuration of cisco.
Explains about 'with' statement.
import paramiko
import time
from getpass import getpass
username = 'admin'
password = 'admin'
DEVICE_LIST = open ('09_devices')
for RTR in DEVICE_LIST:
print ('\n #### Connecting to the device ' + RTR.strip() + '####\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()
COMMANDS = open ('09_config')
for LINES in COMMANDS:
DEVICE_ACCESS.send(str(LINES))
output = DEVICE_ACCESS.recv(65000)
SESSION.close
#PythonOpenfile
#PythonOpenReadWriteAppend
#PythonCiscoConfiguration
๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐ฏ๐ฒ๐น๐ผ๐ ๐จ๐ฑ๐ฒ๐บ๐ ๐๐น๐ฎ๐๐: ๐๐๐๐ ๐๐๐ซ๐ฌ๐ข๐จ๐ง
๐ซ๐๐๐๐๐๐๐๐๐ ๐น๐๐๐๐๐๐๐ ๐ณ๐๐๐:
To stay updated with my latest videos Please subscribe to my channel by clicking below
This video demnstrates how to read a file to get list of devices .
Open file to read/write /append get the configuration of cisco.
Explains about 'with' statement.
import paramiko
import time
from getpass import getpass
username = 'admin'
password = 'admin'
DEVICE_LIST = open ('09_devices')
for RTR in DEVICE_LIST:
print ('\n #### Connecting to the device ' + RTR.strip() + '####\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()
COMMANDS = open ('09_config')
for LINES in COMMANDS:
DEVICE_ACCESS.send(str(LINES))
output = DEVICE_ACCESS.recv(65000)
SESSION.close
#PythonOpenfile
#PythonOpenReadWriteAppend
#PythonCiscoConfiguration
ะะพะผะผะตะฝัะฐัะธะธ