Skip to main content

Network Configuration Backup

Project description

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.

Supported Devices
The netcfgbu tool was built specifically to backup network operating system (NOS) configurations that are monolithic in nature. That is to say the entire configuration can be captured using a command such as "show running-config". Any NOS that provides a monolithic configuration should be supported by netcfgbu.

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 credentials. 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.

Read the Documenttion here.
Read the Quick Start here
Example netcfgbu.toml configuration

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  Inventory subcommands.
  login      Verify SSH login to devices.
  probe      Probe device for SSH reachablility.
  vcs        Version Control System subcommands.

Setup

The netcfgbu tool does not require you to create a configuration file, but for practical purposes you will generally need one. The file is TOML format. The default file is netcfgbu.toml and netcfgbu searches 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 CSV 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 defaults.configs_dir option. The configuration-file supports the use of environment variables.

Example:

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

The netcfgbu defines the use of specific Environment Variables. Their use is the equivalent of the following configuration file. That is to say, if you did not provide netcfgbu a configuration file, this would be used:

[defaults]
    inventory = "$NETCFBU_INVENTORY"
    configs_dir = "$NETCFGBU_CONFIGSDIR"
    credentials.username = "$NETCFGBU_DEFAULT_USERNAME"
    credentials.password = "$NETCFGBU_DEFAULT_PASSWORD"

System Requirements and Installation

This tool requires the use of Python3.8.
Installation available via PyPI:

$ pip install netcfgbu

Questions or Suggestions?

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

Thank you!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netcfgbu-0.8.0.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

netcfgbu-0.8.0-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file netcfgbu-0.8.0.tar.gz.

File metadata

  • Download URL: netcfgbu-0.8.0.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.3

File hashes

Hashes for netcfgbu-0.8.0.tar.gz
Algorithm Hash digest
SHA256 5041848f9a7afd3f625da0c7db1dc026b62702b395bfb6e384cf64a7d7933fb5
MD5 d89660a54eca8a788095c28eb0d88634
BLAKE2b-256 cac87451e7d3632fef74af60adaccbd17c6f9ab24f8e7f78104b3163b1936f6e

See more details on using hashes here.

File details

Details for the file netcfgbu-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: netcfgbu-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 54.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.3

File hashes

Hashes for netcfgbu-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e73cc9eeb4b8a07d13c28cf6831dcd518cf53d3beec8c7031d46bfb24f0cc9c
MD5 0fdfd048f74f81a6ee0050c4834e2752
BLAKE2b-256 f3cafd7abfe222958239c03bc09e97c74a2cb18f905ed34c8143c1b69d7ac929

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page