Python : Read Device IPs and Config lines from CSV file and send config over SSH |Network Automation

preview_player
ะŸะพะบะฐะทะฐั‚ัŒ ะพะฟะธัะฐะฝะธะต
#networkautomation #pythoncisco #csvreader
๐—™๐—ผ๐—ฟ ๐—–๐—ผ๐—บ๐—ฝ๐—น๐—ฒ๐˜๐—ฒ ๐—ฃ๐˜†๐˜๐—ต๐—ผ๐—ป ๐—ณ๐—ผ๐—ฟ ๐—ก๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐˜€ ๐—ง๐˜‚๐˜๐—ผ๐—ฟ๐—ถ๐—ฎ๐—น๐˜€:
๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—ถ๐—ป ๐˜๐—ต๐—ฒ ๐—ฏ๐—ฒ๐—น๐—ผ๐˜„ ๐—จ๐—ฑ๐—ฒ๐—บ๐˜† ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ:

๐‘ณ๐’†๐’‚๐’“๐’ ๐’•๐’ ๐‘จ๐’–๐’•๐’๐’Ž๐’‚๐’•๐’† ๐’š๐’๐’–๐’“ ๐‘ต๐’†๐’•๐’˜๐’๐’“๐’Œ ๐‘ฐ๐’๐’‡๐’“๐’‚๐’”๐’•๐’“๐’–๐’„๐’•๐’–๐’“๐’† ๐’‡๐’“๐’๐’Ž ๐‘บ๐’„๐’“๐’‚๐’•๐’„๐’‰:

๐‘ต๐’†๐’•๐’Ž๐’Š๐’Œ๐’, ๐‘ท๐’‚๐’“๐’‚๐’Ž๐’Š๐’Œ๐’, ๐‘บ๐‘บ๐‘ฏ, ๐‘ต๐’๐’“๐’๐’Š๐’“, ๐‘ท๐’š๐‘จ๐‘ป๐‘บ, ๐‘ต๐‘จ๐‘ท๐‘จ๐‘ณ๐‘ด, ๐‘ต๐‘ฌ๐‘ป๐‘ช๐‘ถ๐‘ต๐‘ญ, ๐‘น๐‘ฌ๐‘บ๐‘ป๐‘ช๐‘ถ๐‘ต๐‘ญ, ๐’€๐‘จ๐‘ต๐‘ฎ ๐‘ด๐’๐’…๐’†๐’, ๐‘น๐‘ฌ๐‘บ๐‘ป-๐‘จ๐‘ท๐‘ฐ, ๐‘ต๐‘ฟ-๐‘จ๐‘ท๐‘ฐ ๐‘จ๐’–๐’•๐’๐’Ž๐’‚๐’•๐’Š๐’๐’๐’”.

๐—ฃ๐—น๐—ฎ๐˜†๐—น๐—ถ๐˜€๐˜: ๐—ฃ๐˜†๐˜๐—ต๐—ผ๐—ป ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ก๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐˜€(๐Ÿญ๐Ÿฎ๐Ÿฌ+ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ๐˜€)

โ˜ธ๐—ฃ๐—น๐—ฒ๐—ฎ๐˜€๐—ฒ ๐—ณ๐—ผ๐—น๐—น๐—ผ๐˜„ ๐—ฏ๐—ฒ๐—น๐—ผ๐˜„ ๐—š๐—ถ๐˜๐—›๐˜‚๐—ฏ ๐—ฃ๐—ฎ๐—ด๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐˜๐—ต๐—ฒ ๐—น๐—ฎ๐˜๐—ฒ๐˜€๐˜ ๐—ฐ๐—ผ๐—ฑ๐—ฒ๐˜€:

๐—ฃ๐—น๐—ฎ๐˜†๐—น๐—ถ๐˜€๐˜: ๐—–๐—ถ๐˜€๐—ฐ๐—ผ ๐—ก๐—ซ๐—”๐—ฃ๐—œ-๐—–๐—Ÿ๐—œ ๐—ฃ๐˜†๐˜๐—ต๐—ผ๐—ป ๐—”๐˜‚๐˜๐—ผ๐—บ๐—ฎ๐˜๐—ถ๐—ผ๐—ป: ๐—ก๐—ฒ๐˜…๐˜‚๐˜€ ๐Ÿต๐—ธ :๐—ฃ๐—ฎ๐—ฟ๐˜€๐—ฒ ๐—ท๐˜€๐—ผ๐—ป ๐—ซ๐— ๐—Ÿ ๐—–๐—ผ๐—ป๐—ณ๐—ถ๐—ด๐˜‚๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐——๐—ฎ๐˜๐—ฎ

๐—ฃ๐—น๐—ฎ๐˜†๐—น๐—ถ๐˜€๐˜: ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐˜๐—ผ ๐—ฃ๐—ฎ๐—ฟ๐˜€๐—ฒ ๐—–๐—ถ๐˜€๐—ฐ๐—ผ ๐—–๐—ผ๐—ป๐—ณ๐—ถ๐—ด๐˜‚๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐˜‚๐˜€๐—ถ๐—ป๐—ด ๐—ฃ๐˜†๐˜๐—ต๐—ผ๐—ป ๐—ฅ๐—ฒ๐—ด๐—˜๐˜…:๐—ฟ๐—ฒ ๐—ง๐˜‚๐˜๐—ผ๐—ฟ๐—ถ๐—ฎ๐—น(๐Ÿญ๐Ÿฑ+ ๐—ฉ๐—ถ๐—ฑ๐—ฒ๐—ผ๐˜€)

In this tutorial we will see how to read or write csv files using python
how to use csv odule in python
import csv how to use reader, dictreader, writer and dictwriter in csv
comma separated value
how to send network device configuration from csv file using python script
how to send configuration in row format using python
with device IP and respective configuration
how to send cisco device configuration in column format using python script
how to remove empty fileds in csv using python
multiple functions for reading and writing
csv dialect exmplained
dialect is a parameter which will define the format of a csv file
unix_dialect
get the parameters of a dialect
['excel', 'excel_tab', 'unix']
print(delimeter) default delimeter is comma in csv
csv class excel delimeter = ','
quotechar = '"'
escapechar = None
doublequote = True
convert csv data in python data structure list or dictionaries
network python automation using csv file
read csv file and send configuration
ะ ะตะบะพะผะตะฝะดะฐั†ะธะธ ะฟะพ ั‚ะตะผะต
ะšะพะผะผะตะฝั‚ะฐั€ะธะธ
ะะฒั‚ะพั€

๐—™๐—ผ๐—ฟ ๐—–๐—ผ๐—บ๐—ฝ๐—น๐—ฒ๐˜๐—ฒ ๐—ฃ๐˜†๐˜๐—ต๐—ผ๐—ป ๐—ณ๐—ผ๐—ฟ ๐—ก๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐˜€ ๐—ง๐˜‚๐˜๐—ผ๐—ฟ๐—ถ๐—ฎ๐—น๐˜€:
๐—˜๐—ป๐—ฟ๐—ผ๐—น๐—น ๐—ถ๐—ป ๐˜๐—ต๐—ฒ ๐—ฏ๐—ฒ๐—น๐—ผ๐˜„ ๐—จ๐—ฑ๐—ฒ๐—บ๐˜† ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ:

NetworkEvolution
ะะฒั‚ะพั€

nice! how can I add a delay in between 2 commands? like a 3 mins delay after running first command and after 3mins it run 2nd command. Is there any way to reference delay time in excel file?

MsHardland
ะะฒั‚ะพั€

Hello I need to change the enable password of my lan devices as we are not using aaa server so manually we are logging in to device and changing the enable credentials so can u plz provide the example, the devices are having ssh and telnet, as some device is logging through telnet and some aemre through ssh

sushilshree