A NetBox Plugin that gives a UI for generating, comparing and deploying configurations to devices.

Overview

netbox_config_plugin - A plugin to generate, compare and deploy configurations

This plugin allows you to execute your code to generate a config for a device, compare it to the current config of that device and replace configuration with the generated config.

Status of this Plugin

This plugin is compatible with NetBox 3.0.0 to v3.0.7. It is not compatible with versions older than 3.0.0

A basic understanding of python, objects, python modules and the NetBox Django models is required to install this plugin as you have to provide some code on your own that will interact with NetBox.

This plugin is in an early development stage. This features, requirements, UI and workflows of this plugin may change often. Use at your own risk. Please report bugs as a Github issue.

All interactions with the device are done with NAPALM so this should work with any device supported by NAPALM. Although currently only IOS-XE is tested. The general caveats for NAPALM still apply.

Things not included in this plugin

You need to provide on your own:

  • code for generating configs
  • code for wether a device should be configured using this plugin
  • code for gathering the required NAPALM connection data like
    • hostnames
    • usernames
    • passwords and secrets
    • further options that might be required

Details regarding those can be found in the config section.

Installation

First you need to install this python module into your NetBox virtualenv. For a regular NetBox install this can be done by adding it to the local_requirements.txt file.

> /opt/netbox/local_requirements.txt ">
echo "git+https://github.com/991jo/netbox_config_plugin#egg=netbox_config_plugin" >> /opt/netbox/local_requirements.txt

After that you have to add it and the netbox-plugin-extensions the netbox configuration.

, "CONFIG_GENERATOR": , "CONNECTION_OPTIONS": } } } ">
# /opt/netbox/netbox/netbox/configuraton.py

...

PLUGINS = [
	"netbox_config_plugin",
	"netbox_plugin_extensions"
	]
PLUGINS_CONFIG = {
	"netbox_config_plugin" : {
    default_settings = {"CONFIGJOB_AVAILABLE": 
      
       ,
                        "CONFIG_GENERATOR": 
       
        ,
                        "CONNECTION_OPTIONS": 
        
         }
	}
}

        
       
      

The parts with needs to be replaced with a python function. Details on what these functions habe to do can be found in the "Your own functions" section.

After that you can run the NetBox upgrade.sh script to regenerate the venv. If everything works you have to restart your netbox and netbox-rq services.

Your own functions

This Plugin relies on 3 pieces of code that you have to provide. You should be somewhat familiar with the NetBox python models to

CONFIGJOB_AVAILABLE

This function takes a NetBox device instance and returns True when this device should be configurable by this plugin.

To enable the functionallity for all devices you could just return True.

def configjob_available(device) -> bool:
    return True

But this can be restricted. E.g. to only be able to configure the device with the name foo you could use something like:

def configjob_available(device) -> bool:
    return device.name == "foo"

Matching on device types, tags, custom fields, and everything else the NetBox Django Models offer is also possible.

CONFIG_GENERATOR

This is a function that returns a ConfigGenerator object. This ConfigGenerator object has only one method called `generate_config:

# netbox_config_plugin/config_generators.py
class ConfigGenerator(ABC):

    @abstractmethod
    def generate(self, device) -> str:
        """
        Generates a Config for the given Device.
        """
        pass

you have to make a function that returns a subclass of that ConfigGenerator.


class DummyConfigGenerator(ConfigGenerator):

    def generate(self, device) -> str:
        # here goes the code that generates your config
		return "my fancy config"


def config_generator_wrapper(device):
    """
    Returns a ConfigGenerator Object for a Device.

    Raises a NoConfigGenerator Exception if no config generator is available
    for the Device.
    """

    return DummyConfigGenerator()

You could build multiple ConfigGenerator subclasses, e.g. one per vendor, platform, device type or device role, and depending on the device return the apropriate one.

CONNECTION_OPTIONS

This function has to return the driver name, and positional and keyword arguments for the NAPALM Driver. These are passed directly to the NAPALM Driver.

def get_connection_options(device) -> Tuple[str, List, Dict]:
    """
    This function takes the device and returns the required options for
    NAPALM to connect to that device

    The options are:
      - the driver to use (e.g. "ios" or "junos")
      - args and kwargs that are passed to the driver. These depend on the
        driver but usually are:
        - hostname
        - username
        - password
        - timeout (optional)
        - optional_args (optional)
    """
    driver_name = "ios"
    hostname = "2001:db8::42"
    username = "root"
    password = "supersecretpassword"
    args = [hostname, username, password]

    optional_args = {"secret": "supersecretsecret"}
    kwargs = {"optional_args": optional_args}

    return driver_name, args, kwargs

Details on the NAPALM Documentation has details on the Driver and the optional arguments

Job Handling and Job Queues

This plugin uses redis to send jobs to the netbox-rq workers. Currently all jobs are sent to the default queue so no changes should be required for a regular NetBox installation.

Minecraft Multi-Server Pinger Discord Embed

Minecraft Network Pinger Minecraft Multi-Server Pinger Discord Embed What does this bot do? It sends an embed and uses mcsrvstat API and checks if the

YungHub 2 Jan 05, 2022
Download and archive entire usenet newsgroups over NNTP.

Usenet Archiving Tool This code is for archiving Usenet discussions, not downloading files. Newsgroup posts are saved under the authors name and email

Corey White 2 Dec 23, 2021
A collection of online resources to help you on your Tech journey.

Everything Tech Resources & Projects About The Project Coming from an engineering background and looking to up skill yourself on a new field can be di

Mohamed A 396 Dec 31, 2022
Python module for creating the circuit simulation definitions for Elmer FEM

elmer_circuitbuilder Python module for creating the circuit simulation definitions for Elmer FEM. The circuit definitions enable easy setup of coils (

5 Oct 03, 2022
Change ACLs for QNAP LXD unprivileged container.

qnaplxdunpriv If Advanced Folder Permissions is enabled in QNAP NAS, unprivileged LXD containers won't start. qnaplxdunpriv changes ACLs of some Conta

1 Jan 10, 2022
Tucan Discord Token Generator - Remastered

TucanGEN-SRC Tucan Discord Token Generator - Remastered Tucan source made better by me. -- idk if it works anymore Includes: hCaptcha Bypass Automatic

Vast 8 Nov 04, 2022
Canim1 - Simple python tool to search for packages without m1 wheels in poetry lockfiles

canim1 Usage Clone the repo. Run poetry install. Then you can use the tool: ❯ po

Korijn van Golen 1 Jan 25, 2022
Python template for Advent of Code event

Advent of Code Python Starter A tamplate for Advent of Code write in Python. Usage The project use poetry for project manager. Clone this repository a

Leonardo Gago 6 Dec 31, 2022
Сервис служит прокси между cервисом регистрации ошибок платформы и системой сбора ошибок Sentry

Sentry Reg Service Сервис служит прокси между Cервисом регистрации ошибок платформы и системой сбора ошибок Sentry. Как развернуть Sentry onpremise. С

Ingvar Vilkman 13 May 24, 2022
Keyboard Layout Change - Extension for Ulauncher

Keyboard Layout Change - Extension for Ulauncher

Marco Borchi 4 Aug 26, 2022
Ningyu Jia(nj2459)/Mengyin Ma(mm5937) Call Analysis group project(Group 36)

Group and Section Group 36 Section 001 name and UNI Name UNI Ningyu Jia nj2459 Mengyin Ma mm5937 code explanation Parking.py (1) Calculate the rate of

1 Dec 04, 2021
Nesse repositório serão armazenados os conteúdos de aula

Lets_Code_DS_Degree_Alunos Nesse repositório serão armazenados os conteúdos de aula Formato das aulas: Notebook de aula já vem comentado para reduzir

Patricia Bongiovanni Catandi 6 Jan 21, 2022
Simple tools to make/dump CPC+ CPR cartridge files

Simple tools to make/dump CPC+ CPR cartridge files mkcpr.py: make a CPR file from files (one chunk per file); see notes cprdump.py: dump the chunks of

Juan J. Martínez 3 May 30, 2022
Shell Trality API for local development.

Trality Simulator Intro This package is a work in progress. It allows local development of Trality bots in an IDE such as VS Code. The package provide

CrypTrality 1 Nov 17, 2021
My attempt at this years Advent of Code!

Advent-of-code-2021 My attempt at this years Advent of Code! day 1: ** day 2: ** day 3: ** day 4: ** day 5: ** day 6: ** day 7: ** day 8: * day 9: day

1 Jul 06, 2022
A hackerank problems, solution repository

This is a repository for all hackerank challenges kindly note this is for learning purposes and if you wish to contribute, dont hesitate all submision

Tyler Mwalo Kenneth's 1 Dec 20, 2021
The ROS package for Airbotics.

airbotics The ROS package for Airbotics: Developed for ROS 1 and Python 3.8. The package has not been officially released on ROS yet so manual install

Airbotics 19 Dec 25, 2022
Um sistema de llogin feito em uma interface grafica.

Interface-para-login Um sistema de login feito com JSON. Utilizando a biblioteca Tkinter, eu criei um sistema de login, onde guarda a informações de l

Mobben 1 Nov 28, 2021
KiCad bus length matching script.

KiBus length matching script This script implements way to monitor multiple nets, combined into a bus that needs to be length matched

Piotr Esden-Tempski 22 Mar 17, 2022
プレヤフHackUチーム「キャット・タン」が作成したアプリ「illustection」

cat_tongue_illustection プレヤフHackUチーム「キャット・タン」が作成した, プライバシー保護アプリ「illustection」です! デモ動画 https://youtu.be/z3I7LuB_i58 機能 アップロードされた画像をいい感じのイラストやの素材に置き換える(

4 Jul 03, 2021