• Stars
    star
    101
  • Rank 336,177 (Top 7 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Network Configuration Backup

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!

More Repositories

1

netbox-plugin-auth-saml2

Netbox plugin for SSO using SAML2
Python
107
star
2

nanog77-nrfu-tutorial

NANOG77 NRFU Tutorial
Python
34
star
3

demo-beginner-concurrency

Demo repo for PyCharm Webcast 2022-Feb-22
Python
26
star
4

ansible-csv2hosts

Demo - CSV to Ansible 'hosts' and 'host_vars'
Python
21
star
5

netcadcam

Network Configuration Database
Python
20
star
6

netbox-pyswagger

Python Swagger client for Netbox
Python
18
star
7

genie-quickstart

Cisco pyATS Genie Quickstart Example
Python
17
star
8

iterm2-colors2rgb

Convert an iTerm2 profile color settings to RGB values
Python
10
star
9

demo_host_csv_template_render

Demonstrate taking a CSV data file and producing multiple host-specific configs
Python
9
star
10

slack-scim-rbac

Role Based Access Control for Slack-Bolt Applications
Python
8
star
11

netcfg-grep

Network Device Configuration Grep Tool
Python
8
star
12

halutz

Halutz is a python library for Swagger, inspired by working with network engineers that are getting started with Python.
Python
8
star
13

django3-auth-saml2

Django3 SSO using SAML 2.0
Python
8
star
14

nwkautomaniac

network automation package of utilities and libraries
Python
8
star
15

slackapp-pyez

For when you want to create a slack app
Python
7
star
16

ipf-netbox

IP Fabric - Netbox Toolkit
Python
7
star
17

bracket_expansion

Generator for bracket-expansion function
Python
7
star
18

idreamofgenie

Toolbox of modules and scripts using pyATS Genie
Python
6
star
19

aio-ipfabric

Python 3.8 asycnio client for IP Fabric
Python
6
star
20

xml-tutorial

XML/XPath tutorial for Network Engineers
Python
6
star
21

genie-parser-extension

Cisco pyATS Genie parser example - dynamically adding new parsers
Python
5
star
22

slack-click

Click support for Slack-Bolt Applications
Python
5
star
23

ipf-netcfgbu

Network Config Backups from IP Fabric
Python
4
star
24

netcad-netbox

NetBox integration with NetCAD/CAM system
Python
4
star
25

demo-ztpserver

Arista EOS ZTPServer demo setup
Shell
4
star
26

slackapptk

Create Slack apps using slackclient 2.0
Python
4
star
27

netcad-demo-clabs1

NetCadCam demo using ContainerLabs - Basic Switching Topology of 3 cEOS devices
Python
4
star
28

aio-eapi

Arista EOS API asyncio client
Python
4
star
29

cvp-pyez

Arista Cloud Vision PyEZ Toolbox
Python
4
star
30

aio-nxapi

Cisco NX-API asyncio client
Python
3
star
31

macaddr

For working with MAC address values
Python
3
star
32

junospyez-ossh-server

Library to provide an Outbound SSH server for use with Junos-PyEZ
Python
2
star
33

py-demo-simple-template

Demonstrating simple template render using Python or Ansible
Python
2
star
34

pydantic-env

Pydantic Models for use with System and Environment Variables
Python
1
star
35

lxml-xpath-ipaddress

IP address extension library for LXML
Python
1
star
36

pyzayo

Python 3.8 asyncio client for the Zayo API
Python
1
star
37

netcam-aioeos

Python
1
star
38

rich-consoleimager

Create PNG image from Rich Console output
Python
1
star