• Stars
    star
    201
  • Rank 194,491 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 3 months ago

Reviews

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

Repository Details

NetBox Plugin for generate QR Codes

Netbox QR Code Plugin

Netbox plugin for generate QR codes for objects: Rack, Device, Cable.

This plugin depends on qrcode and Pillow python library

Compatibility

This plugin in compatible with NetBox 2.8 and later.

Installation

If Netbox was installed according to the standard installation instructions. It may be necessary to activate the virtual environment.

source /opt/netbox/venv/bin/activate

The plugin is available as a Python package in pypi and can be installed with pip

pip install netbox-qrcode

Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:

PLUGINS = ['netbox_qrcode']

Restart NetBox and add netbox-qrcode to your local_requirements.txt

Configuration

The following options are available:

  • with_text: Boolean (default True). Text label will be added to QR code image if enabled.

  • text_template: Jinja2 template with {{ obj }} as context, using it ignores text_fields and custom_text

  • text_fields: List of String (default ['name']). Text fields of an object that will be added as text label to QR image. It's possible to use custom field values.

  • font: String (default TahomaBold) Font name for text label ( Some font include in package, see fonts dir).

  • text_location: Where to render the text, relative to the QR code. Valid values are "right" (default), "left"", "up", and "down".

  • custom_text: String or None (default None) additional text label to QR code image (will be added after text_fields).

  • qr_version: Integer (default 1) parameter is an integer from 1 to 40 that controls the size of the QR Code (the smallest, version 1, is a 21x21 matrix).

  • qr_error_correction: Integer (default 0), controls the error correction used for the QR Code. The following values are available:

    1 - About 7% or less errors can be corrected. 0 - About 15% or less errors can be corrected. 2 - About 30% or less errors can be corrected. 3 - About 25% or less errors can be corrected.

  • qr_box_size: Integer (default 6), controls how many pixels each "box" of the QR code is.

  • qr_border: Integer (default 4), controls how many boxes thick the border should be (the default is 4, which is the minimum according to the specs).

Per object options

Per object options override default options. Per object options dictionary can contains any of default options inside.

  • device: Dict or None (default {'text_fields': ['name', 'serial']}), set None to disble QR code
  • rack: Dict or None (default {'text_fields': ['name']}) , set None to disble QR code
  • cable: Dict or None ( defaul {'text_fields': ['_termination_a_device', 'termination_a', '_termination_b_device', 'termination_b',]}), set None to disble QR code

Configuration example:

PLUGINS_CONFIG = {
    'netbox_qrcode': {
        'with_text': True,
        'text_fields': ['name', 'serial'],
        'font': 'ArialMT',
        'custom_text': 'Property of SomeCompany\ntel.8.800333554-CALL',
        'text_location': 'up',
        'qr_version': 1,
        'qr_error_correction': 0,
        'qr_box_size': 4,
        'qr_border': 4,
        # per object options
        'cable': None,  # disable QR code for Cable object
        'rack': {
            'text_fields': [
                'site',
                'name',
                'facility_id',
                'tenant',
                'cf.cf_name'
            ]
        },
        'device': {
            'qr_box_size': 6,
            'custom_text': None,
        }
    }
}

Contributing

Developing tools for this project based on ntc-netbox-plugin-onboarding repo.

Issues and pull requests are welcomed.

Screenshots

Device QR code with text label Device QR Code

Rack QR code Rack QR Code

Cable QR code Cable QR Code

More Repositories

1

netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
Python
15,828
star
2

netbox-docker

๐Ÿณ Docker Image of NetBox
Python
1,800
star
3

devicetype-library

A collection of community-sourced DeviceType definitions for import to NetBox
Python
899
star
4

netbox-topology-views

A netbox plugin that draws topology views
Python
753
star
5

pynetbox

Python API client library for Netbox.
Python
563
star
6

ansible_modules

NetBox modules for Ansible using Ansible Collections
Python
327
star
7

Device-Type-Library-Import

This library is intended to assist with importing device and module types into NetBox from the NetBox Community DeviceType-Library
Python
262
star
8

netbox-chart

A Helm chart for NetBox
Mustache
247
star
9

netbox-bgp

NetBox plugin for BGP related objects documentation
Python
242
star
10

customizations

A collection of community submitted and maintained customizations including reports, scripts, validators and export templates
Python
205
star
11

go-netbox

The official Go API client for Netbox IPAM and DCIM service.
Shell
197
star
12

awesome-netbox

A curated list of awesome NetBox resources
186
star
13

netbox-zero-to-hero

A short course designed to take new NetBox users from โ€˜Zero to Heroโ€™.
Python
149
star
14

netbox-plugin-tutorial

A tutorial on building custom plugins for NetBox v3.2+
89
star
15

netbox-acls

A NetBox plugin for Access Lists based off of the NetBox Plugin Demo
Python
86
star
16

netbox-napalm-plugin

NetBox Napalm plugin
JavaScript
49
star
17

netbox-reorder-rack

NetBox plugin to allow users to reorder devices within a rack using a drag and drop UI.
Python
45
star
18

netbox-python

Python NetBox API Client
Python
37
star
19

netbox-operator

[INCUBATING] A Kubernetes operator to manage NetBox resources directly through Kubernetes.
Go
33
star
20

cookiecutter-netbox-plugin

Cookiecutter template for easy building NetBox plugins
Python
22
star
21

netbox-healthcheck-plugin

HTML
20
star
22

netbox-demo-data

Demo data useful for populating demo instances of NetBox
19
star
23

migration-scripts

Python
10
star
24

netbox-plugin-demo

Python
7
star
25

netbox.dev-old

netbox.dev website
HTML
1
star
26

netbox-demo

A plugin for NetBox demo instances
Python
1
star