Code Monkey home page Code Monkey logo

send-config-from-file-to-devices's Introduction

Tested on Python 3.9.4 Contributions Welcome License Code style: black

Send Cisco Commands to Multiple Network Devices

This program is designed to send a set of Cisco commands to multiple network devices from text files.

This Python script was tested in a physical lab environment and on IOS XE on CSR Latest AlwaysOn v17.3.1 Cisco DevNet Sandbox.

Table of Contents

  1. Installation
  2. Usage
  3. Best Case Scenario
  4. TODO

Installation

$ git clone https://github.com/Tes3awy/Send-Config-From-File-To-Devices.git
$ cd Send-Config-From-File-To-Devices
$ pip install -r requirements.txt

Usage

python main.py

The Python script runs as following:

  1. Reads IP addresses in data/device_ip_list.txt.
  2. Checks if those IP addresses are valid IPv4 addresses using built-in Python3 ipaddress module.
  3. Pings those IP addresses using Ping3 to check reachability.
    • If an IP address is UNREACHABLE for whatever reason, then this IP is added to data/failure.txt with its error message.
    • If an IP address is REACHABLE, then this IP is added to data/success.txt.
  4. Reads each IP addresse in data/success.txt one by one.
  5. Prompts the user to enter a username and a password.

These username and password will be used for all network devices of those IP addresses in data/device_ip_list.txt.

  1. Initiates a Telnet session to each device one by one using Netmiko.
  2. Sends commands from data/config.txt to the device of that IP address.
  3. Saves the configuration on the device.
  4. Terminates the session.

Best Case Scenario

  1. You want to add the same exact set of commands to all the devices in your network. Then this script is the best option for this task.
  2. Username you are logging in with has privilege 15 in it. i.e.
username cisco privilege 15 algorithm-type scrypt secret cisco

This Python script does not check for enable mode. It's left to the user to add the (en)able command at the very top in the data/config.txt file and not set an enable secret command.

TODO

  1. Enable MultiThreading.

send-config-from-file-to-devices's People

Contributors

tes3awy avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hasanmohammed96

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.