Giter Club home page Giter Club logo

netcfgbu's Introduction

Python 3.8 Code Style

version

Network Configuration Backup

As a network engineer I need to backup my network configuration files into a version control system, and I need a tool to automate this process. My primary means of accessing the devices is SSH.

Primary Considerations

  • I have a multi-vendor environment. I need to account for the different commands that are used to obtain the running configuration and disable paging if required.

  • I want to provide my network inventory in a simple CSV format. I want to create this inventory dynamically from one or more sources, for example Netbox. I want the ability to filter this inventory with limit and exclude constraints.

  • I may need to try multiple SSH credendials. I must not store my passwords in any configuration file, so this tool must acquire passwords via environment variables.

  • I will have a large number of devices (>1000) so I want this tool to take advantage of any and all techniques that reduce the total amount of time.

The general approach to netcfgbu is a configuration based methodology so as to not hardcode the tool to work with specific network device drivers and avoid the complexity and dependency of including a collection of 3rd-party libraries specific to network devices.

See example netcfgbu.toml configuration.
Read the document here.

Introduction

Once you've setup the configuration file and inventory file you can backup all of your configurations using the command:

$ netcfgbu backup

At the end of the run, you will see a report, for example:

# ------------------------------------------------------------------------------
Summary: TOTAL=1482, OK=1482, FAIL=0
         START=2020-Jun-05 01:48:55 PM, STOP=2020-Jun-05 01:50:08 PM
         DURATION=72.566s
# ------------------------------------------------------------------------------

There are a number of other commands provided as shown via --help:

Usage: netcfgbu [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  backup     Backup network configurations.
  inventory  [ls, build, ...]
  login      Verify SSH login to devices.
  probe      Probe device for SSH reachablility.

Setup

The netcfgbu tool requires you to setup a TOML configuration file, by default is called netcfgbu.toml and is searched for in the current working directory. You can override this location using the -C <filepath> option or using the environment variable NETCFGBU_CONFIG

At a minimum you need to designate the inventory file and a default set of SSH login credentials. The network device configs will be stored in the current working directory, or as specified in the configs_dir option. The configuration-file supports the use of enviornment variables.

Example:

[defaults]
    inventory = "$PROJ_DIR/inventory.csv"
    configs_dir = "$PROJ_DIR/configs"
    credentials.username = "$NETWORK_USERNAME"
    credentials.password = "$NETWORK_PASSWORD"

System Requirements and Installation

This tool requires the use of Python3.8. You will need to git-clone this repository and run python setup.py to install it into your environment.

Questions or Suggestions?

Please open a github issue if you have any questions or suggestions.

Thank you!

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.