Learn to Parse CSV file using Python for Cisco Configuration : CSV DictReader Tutorial |Part 4

Learn to Parse CSV file using Python for Cisco Configuration : CSV DictReader Tutorial |Part 4

#PythonCSV #CSVDictReader #CSVCisco Playlist: Learn to Read Data From CSV Using Python    • Learn to Read Data from CSV (IP/Config): P...   Playlist: Paramiko detailed explanation with Example for Network Engineers    • Paramiko Tutorial :Part1  How SSH Host key...   Playlist: Python Learning for Network Engineers    • Python learning for Network Engineers | Pa...   This video demonstrates how to parse csv file for Cisco device configuration. Add device IP adnc configuration in row and column format and create python dictionary key value pairs from the csv data using python library csv DictReader methos Difference between csv reader and csv dict reader how to configure cisco devices from csv file, initiate ssh using paramiko libbrary Fetch IP address and configuration from csv Script ------------- from csv import DictReader from pprint import pprint import paramiko import time conf_dict ={} with open("02_config_in_column.csv", "r") as csv_file: csv_content = DictReader(csv_file) column_names = csv_content.fieldnames for row in csv_content: for column_name in column_names: if not column_name: continue if not row[column_name]: continue if column_name not in conf_dict.keys(): conf_dict[column_name] = [] conf_dict[column_name].append(row[column_name]) session = paramiko.SSHClient() session.load_system_host_keys() key_file = paramiko.RSAKey.from_private_key_file("/home/evolve/.ssh/id_rsa") for ip in conf_dict.keys(): try: print(f"\n{'#' * 50}\nConnecting to the Device {ip}\n{'#' * 50} ") session.connect(hostname=ip, username='admin1', password='admin', pkey=key_file, ) DEVICE_ACCESS = session.invoke_shell() print(f"\nExecuting Commands are\n{'~'*22}\n{conf_dict[ip]}") for conf in conf_dict[ip]: DEVICE_ACCESS.send(conf+'\n') time.sleep(1) output = DEVICE_ACCESS.recv(65000) print (output.decode('ascii'),end='') time.sleep(.5) session.close() except : print('Can not connect to the device') print (f"\n{'#' * 50}\nCOMMAND EXECUTION COMPLETED\n{'#' * 50}\n") ------------------ csv dict reader python tutorial,csv key value in dict,csv readert python example,python csv parsing tutorial, how to read csv row column in python,create key value pair from csv python,exvel read python csv reader,row colum parsing dictionary and list python,cisco configuration from csv,device ip from csv python example,config demo csv python paramiko csv,paramiko ssh using csv,field names in dictreader,python cisco automation example,scv script example python