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.

Created a Python Keylogger script.

Python Script Simple Keylogger Script WHAT IS IT? Created a Python Keylogger script. HOW IT WORKS Once the script has been executed, it will automatic

AC 0 Dec 12, 2021
Semester Project on Signal Processing @CS UCU 2021

Blur Detection with Haar Wavelet Transform Requirements Python3 opencv-python PyWavelets Install these using the following command: $ pip install -r r

ButynetsD 2 Oct 15, 2022
A program for calculating the divisor function

DivisorsFunctionCalculator A program for calculating the divisor function A script to find the "Sigma" (divisors function) of any number. To find the

1 Oct 31, 2021
Patch PL to disable LK verification. Patch LK to disable boot/recovery verification.

Simple Python(3) script to disable LK verification in Amazon Preloader images and boot/recovery image verification in Amazon LK ("Little Kernel") images.

Roger Ortiz 18 Mar 17, 2022
Participants of Bertelsmann Technology Scholarship created an awesome list of resources and they want to share it with the world, if you find illegal resources please report to us and we will remove.

Participants of Bertelsmann Technology Scholarship created an awesome list of resources and they want to share it with the world, if you find illegal

Wissem Marzouki 29 Nov 28, 2022
This is a multi-app executor that it used when we have some different task in a our applications and want to run them at the same time

This is a multi-app executor that it used when we have some different task in a our applications and want to run them at the same time. It uses SQLAlchemy for ORM and Alembic for database migrations.

Majid Iranpour 5 Apr 16, 2022
Site de gestion de cave à vin utilisant une BDD manipulée avec SQLite3 via Python

cave-vin Site de gestion de cave à vin utilisant une bdd manipulée avec MySQL ACCEDER AU SITE : Pour accéder à votre cave vous aurez besoin de lancer

Elouann Lucas 0 Jul 05, 2022
Intelligent Systems Project In Python

Intelligent Systems Project In Python

RLLAB 3 May 16, 2022
A wrapper around the python Tkinter library for customizable and modern ui-elements in Tkinter

CustomTkinter With CustomTkinter you can create modern looking user interfaces in python with tkinter. CustomTkinter is a tkinter extension which prov

4.9k Jan 02, 2023
An awesome list of AI for art and design - resources, and popular datasets and how we may apply computer vision tasks to art and design.

Awesome AI for Art & Design An awesome list of AI for art and design - resources, and popular datasets and how we may apply computer vision tasks to a

Margaret Maynard-Reid 20 Dec 21, 2022
navigation_commander is a ROS package to command the robot to navigate autonomously to each table for food delivery inside a hotel.

navigation_commander navigation_commander is a ROS package to command the robot to navigate autonomously to each table for food delivery inside a hote

ALEENA LENTIN 9 Nov 08, 2021
Geodesic Dome Math

dome Geodesic Dome Math Python dome tool dome.py calculates an icosahedron or 2v geodesic dome and creates 3d printable hubs as OpenSCAD sources. usag

Brian Olson 2 Feb 09, 2022
A collection of Python library code for building Python applications.

Abseil Python Common Libraries This repository is a collection of Python library code for building Python applications. The code is collected from Goo

Abseil 2k Jan 07, 2023
Hopefully it'll become a very annoying desktop pet

AnnoyingPet Basic Tutorial: https://seebass22.github.io/python-desktop-pet-tutorial/ Handling Mouse Input: https://pythonhosted.org/pynput/mouse.html

1 Jun 08, 2022
MiniJVM is simple java virtual machine written by python language, it can load class file from file system and run it.

MiniJVM MiniJVM是一款使用python编写的简易JVM,能够从本地加载class文件并且执行绝大多数指令。 支持的功能 1.从本地磁盘加载class并解析 2.支持绝大多数指令集的执行 3.支持虚拟机内存分区以及对象的创建 4.支持方法的调用和参数传递 5.支持静态代码块的初始化 不支

keguoyu 60 Apr 01, 2022
carrier.py is a Python package/module that's used to save time when programming

carrier.py is a Python package/module that's used to save time when programming, it helps with functions such as 24 and 12 hour time, Discord webhooks, etc

Zacky2613 2 Mar 20, 2022
Python Common things by Problem Fighter Library, (Exception, Debug Log, etc.)

In the name of God, the Most Gracious, the Most Merciful. PF-PY-Common Documentation Install and update using pip: pip install -U xxxx Please find the

Problem Fighter 3 Jan 15, 2022
Script to change official Kali repository to mirrors

Script to change official Kali repository to mirrors. This helps increase packages update and downloading for some user.

Vineet Bhavsar 2 Nov 29, 2021
使用clash核心,对服务器进行Netflix解锁批量测试。

注意事项 测速及解锁测试仅供参考,不代表实际使用情况,由于网络情况变化、Netflix封锁及ip更换,测速具有时效性 本项目使用 Python 编写,使用前请完成环境安装 首次运行前请安装pip及相关依赖,也可使用 pip install -r requirements.txt 命令自行安装 Net

11 Dec 07, 2022
Example of my qtile config using the gruvbox colorscheme.

QTILE config Example of my qtile config using the gruvbox colorscheme. unicodes.py unicodes.py returns a widget.TextBox with a unicode. Currently it c

Imanuel Febie 31 Jan 02, 2023