GithubHelp home page GithubHelp logo

tobiasge / netbox-initializers Goto Github PK

View Code? Open in Web Editor NEW
36.0 3.0 12.0 173 KB

Plugin to load predefined data into Netbox

License: Apache License 2.0

Python 97.90% Dockerfile 0.23% Shell 1.87%
netbox-plugin

netbox-initializers's Introduction

Netbox Initializers Plugin

Load data from YAML files into Netbox

Installation

First activate your virtual environment where Netbox is installed, the install the plugin version correspondig to your Netbox version.

pip install "netbox-initializers==4.0.*"

Then you need to add the plugin to the PLUGINS array in the Netbox configuration.

PLUGINS = [
    'netbox_initializers',
]

Getting started

At first you need to start with writing the YAML files that contain the initial data. To make that easier the plugin includes example files for all supported initializers. To access those examples you can copy them into a directory of your choosing and edit them there. To copy the files run the following command (in your Netbox directory):

./manage.py copy_initializers_examples --path /path/for/example/files

After you filled in the data you want to import, the import can be started with this command:

./manage.py load_initializer_data --path /path/for/example/files

Netbox Docker image

The initializers where a part of the Docker image and where then extracted into a Netbox plugin. This was done to split the release cycle of the initializers and the image. To use the new plugin in a the Netbox Docker image, it musst be installad into the image. To this, the following example can be used as a starting point:

FROM netboxcommunity/netbox:v4.0
RUN /opt/netbox/venv/bin/pip install "netbox-initializers==4.0.*"

netbox-initializers's People

Contributors

dependabot[bot] avatar hpreston avatar matejv avatar mmguero avatar obedouet avatar omripresent avatar palmersample avatar ryanmerolle avatar tobiasge avatar yanndegat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

netbox-initializers's Issues

support netbox v3.7.0

Proposed functionality

NetBox v3.7.0 has been released. Currently running netbox-initializers fails with:

django.core.exceptions.ImproperlyConfigured: Plugin netbox_initializers requires NetBox maximum version 3.6.99.

Use case

Use with NetBox v3.7.0

support service templates

Proposed functionality

netbox-initializers can import services, but as far as I can see it can't do service templates.

Service Templates
Service templates can be used to instantiate services on devices and virtual machines. A template defines a name, protocol, and port number(s), and may optionally include a description. Services can be instantiated from templates and applied to devices and/or virtual machines, and may be associated with specific IP addresses.

Use case

To allow the import of service templates on initialization.

Add SiteGroups

Proposed functionality

Add support for SiteGroups

Use case

Add support for SiteGroups

Plugin Support NetBox v3.3

Proposed functionality

Now that NetBox v3.3 is available I was curious when this plug-in might be updated to support this latest version? I haven't done any plug-in development myself yet so I don't know how complicated updating the plugin to the latest version of NetBox would be.

Looking at the release notes for NetBox v3.3 I don't notice any breaking changes in the plugins support, so hopefully this could be as simple as just testing and updating the max version supported by the plugin.

Use case

Now that initializers are no longer part of netbox-docker, this plugin is required to support initializing instances of NetBox with data for development.

files missing in package

Hi

Looks like the files from management/commands are missing in the pip package:

ls -la ../venv/lib/python3.10/site-packages/netbox_initializers
total 20
drwxr-xr-x 4 root root 4096 Sep  6 10:09 .
drwxr-xr-x 1 root root 4096 Sep  6 10:09 ..
-rw-r--r-- 1 root root  353 Sep  6 10:09 __init__.py
drwxr-xr-x 2 root root 4096 Sep  6 10:09 __pycache__
drwxr-xr-x 4 root root 4096 Sep  6 10:09 initializers

this causes manage.py to give an error: Unknown command: 'load_initializer_data'

Prepare support for netbox v4.0

Proposed functionality

Netbox v4.0-beta1 is out, this means that plugins, such as this one, should be upgraded to support the new updated version of netbox :)

I use nebox-initializers in my dev environment toolkit and now I can't work on the new beta and this makes me sad :(

Haha keep up the good work and thanks in advance !

Use case

I'm using nebox-initializers in my dev environment and I cannot use it against the new netbox v4.0 beta.

Problem with initializing device type and using anchors/alias

Reposted from: netbox-community/netbox-docker#826

Current Behavior
I was using a definition of a current device type to initialize another one, basically two versions of a switch one with front to rear airflow and another with rear to front airflow. So i aliased the default model added the unique prop model, .. and noticed that components such as interfaces and power ports were being populated by only one element without a name for all but the first device declaration.

Expected Behavior
When using an alias to not have to recreate components that are the same between type for it to work.

Issue seems seems to come from using pop to get the name for a property, as the yaml loader seems to share the common object when aliasing is used.
Poossible solution that work for me is doing a copy.deepcopy of params, to create new object and for the pop not to affect other device types.
Other possible solution would be not to pop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.