Network CLI



Install



pip install netmiko


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When CLI is the Only Option - netmiko



• If no other API is available
• Builds on paramiko library for SSH connectivity
• Support for a range of vendors network devices and operating systems
• Send and receive clear text
◇ Post processing of data will be key

#! /usr/bin/env python
"""
api_netmiko_example.py
Illustrate the following concepts:
- Making CLI calls using netmiko library
- Intended to be entered into an interactive
  interpreter
"""


from netmiko import ConnectHandler
from pprint import pprint

router = {"device_type""cisco_ios",
          "host""10.10.20.48",
          "user""cisco",
          "pass""cisco_1234!"}

net_connect = ConnectHandler(ip=router["host"],
                             username=router["user"],
                             password=router["pass"],
                             device_type=router["device_type"])

# Send command
interface_cli = net_connect.send_command("show run int Gig1")

pprint(interface_cli)


Index