Python learning for Network Engineers | Part 17 |Netmiko introduction for Cisco SSH configuration

Published: 29 March 2019
on channel: NetworkEvolution
7,028
56

𝗙𝗼𝗿 𝗖𝗼𝗺𝗽𝗹𝗲𝘁𝗲 𝗣𝘆𝘁𝗵𝗼𝗻 𝗙𝗼𝗿 𝗡𝗲𝘁𝘄𝗼𝗿𝗸 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿𝘀 𝗖𝗼𝘂𝗿𝘀𝗲:
𝗘𝗻𝗿𝗼𝗹𝗹 𝗳𝗼𝗿 𝗯𝗲𝗹𝗼𝘄 𝗨𝗱𝗲𝗺𝘆 𝗖𝗹𝗮𝘀𝘀: 𝟐𝟎𝟐𝟐 𝐕𝐞𝐫𝐬𝐢𝐨𝐧
𝑫𝒊𝒔𝒄𝒐𝒖𝒏𝒕𝒆𝒅 𝑹𝒆𝒇𝒆𝒓𝒓𝒂𝒍 𝑳𝒊𝒏𝒌:
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  

Introduction to Netmiko.
Simplifies SSH to the networking device
Simplifies execution of show command as well as configuration in to the device

textfsm:can extract the date from output and give it in a structured way.
Installation Command:
pip install netmiko

Netmiko commonly-used methods:
net_connect.send_command() - Send command down the channel, return output back (pattern based)
net_connect.send_command_timing() - Send command down the channel, return output back (timing based)
net_connect.send_config_set() - Send configuration commands to remote device
net_connect.send_config_from_file() - Send configuration commands loaded from a file
net_connect.save_config() - Save the running-config to the startup-config
net_connect.enable() - Enter enable mode

need to import the ConnectHandler function from Netmiko.
then define a network device dictionary which contains device_type, ip, username, and password.
verbose in for detailed logging.
Dictionaries:
will have mapping between key and value
Order is not mandatory here
Script sample:

from netmiko import ConnectHandler
from getpass import getpass
password = getpass()
RTR_10 = {
'ip': '10.10.10.10',
'username': 'admin',
'password': 'admin',
'device_type': 'cisco_ios',
}

net_connect = ConnectHandler(**RTR_10)

config_commands = [ 'int lo0',
'ip add 1.1.1.1 255.255.255.0',
'no shut' ]
output = net_connect.send_config_set(config_commands)
print(output)

output = net_connect.send_command('show ip int brief')
print(output)
#NetmikoCiscoSSH
#CiscoPythonConfiguration
#NetmikoCiscoConfiguration


Watch video Python learning for Network Engineers | Part 17 |Netmiko introduction for Cisco SSH configuration online, duration hours minute second in high quality that is uploaded to the channel NetworkEvolution 29 March 2019. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 7,028 times and liked it 56 visitors.