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.

Este projeto se trata de uma análise de campanhas de marketing de uma empresa que vende acessórios para veículos.

Marketing Campaigns Este projeto se trata de uma análise de campanhas de marketing de uma empresa que vende acessórios para veículos. 1. Problema A em

Bibiana Prevedello 1 Jan 12, 2022
An example project which contains the Unity components necessary to complete Navigation2's SLAM tutorial with a Turtlebot3, using a custom Unity environment in place of Gazebo.

Navigation 2 SLAM Example This example provides a Unity Project and a colcon workspace that, when used together, allows a user to substitute Unity as

Unity Technologies 183 Jan 04, 2023
Mata kuliah Bahasa Pemrograman

praktikum2 MENGHITUNG LUAS DAN KELILING LINGKARAN FLOWCHART : OUTPUT PROGRAM : PENJELASAN : Tetapkan nilai pada variabel sesuai inputan dari user :

2 Nov 09, 2021
💘 Write any Python with 9 Characters: e,x,c,h,r,(,+,1,)

💘 PyFuck exchr(+1) PyFuck is a strange playful code. It uses only nine different characters to write Python3 code. Inspired by aemkei/jsfuck Example

Satoki 10 Dec 25, 2022
SHF TEST BACKEND

➰ SHF TEST BACKEND ➿ 🐙 Goals Dada una matriz de números enteros. Obtenga el elemento máximo en la matriz que produce la suma más pequeña al agregar t

Wilmer Rodríguez S 1 Dec 19, 2021
Vaksina - Vaksina COVID QR Validation Checker With Python

Vaksina COVID QR Validation Checker Vaksina is a general purpose library intende

Michael Casadevall 33 Aug 20, 2022
Plock : A stack based programming language

Plock : A stack based programming language

1 Oct 25, 2021
List of resources for learning Category Theory

A curated list of resources for studying category theory. As resources aimed at mathematicians are abundant, this list is aimed at materials whose target audience is not people with a graduate-level

Bruno Gavranović 100 Jan 01, 2023
Scripts used in the RayStation medical radiation dosimetry treatment planning system

Med Phys Scripts These are scripts that I, the medical physics assistant at Cookeville Regional Medical Center, wrote for use in our radiation therapy

Kaley White 2 Oct 19, 2022
An interactive course to git

OperatorEquals' Sandbox Git Course! Preface This Git course is an ongoing project containing use cases that I've met (and still meet) while working in

John Torakis 62 Sep 19, 2022
An extension module to make reaction based menus with disnake

disnake-ext-menus An experimental extension menu that makes working with reaction menus a bit easier. Installing python -m pip install -U disnake-ext-

1 Nov 25, 2021
tetrados is a tool to generate a density of states using the linear tetrahedron method from a band structure.

tetrados tetrados is a tool to generate a density of states using the linear tetrahedron method from a band structure. Currently, only VASP calculatio

Alex Ganose 1 Dec 21, 2021
IOP Support for Python (Experimental)

TAGS Experimental IOP Framework for Python WARNING: Currently, this project has NO EXCEPTION HANDLING. USE AT YOUR OWN RISK! I. Introduction to Interf

1 Oct 22, 2021
Py4J enables Python programs to dynamically access arbitrary Java objects

Py4J Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine. Methods are called as

Barthelemy Dagenais 1k Jan 02, 2023
ASCII-Wordle - A port of the game Wordle to terminal emulators/CMD

ASCII-Wordle A 'port' of Wordle to text-based interfaces A near-feature complete

32 Jun 11, 2022
Antchain-MPC is a library of MPC (Multi-Parties Computation)

Antchain-MPC Antchain-MPC is a library of MPC (Multi-Parties Computation). It include Morse-STF: A tool for machine learning using MPC. Others: Commin

Alipay 37 Nov 22, 2022
A repository for all ZenML projects that are specific production use-cases.

ZenFiles Original Image source: https://www.goodfon.com/wallpaper/x-files-sekretnye-materialy.html And naturally, all credits to the awesome X-Files s

ZenML 66 Jan 06, 2023
Code needed for hybrid land cover change analysis for NASA IDS project

Documentation for the NASA IDS change analysis Poley 10/21/2021 Required python packages: whitebox numpy rasterio rasterio.mask os glob math itertools

Andrew Poley 2 Nov 12, 2021
Gives criticality score for an open source project

Open Source Project Criticality Score (Beta) This project is maintained by members of the Securing Critical Projects WG. Goals Generate a criticality

Open Source Security Foundation (OpenSSF) 1.1k Dec 23, 2022
Blender Addon for Snapping a UV to a specific part of a Tilemap

UVGridSnapper A simple Blender Addon for easier texturing. A menu in the UV editor allows a square UV to be snapped to an Atlas texture, or Tilemap. P

2 Jul 17, 2022