Skip to main content

django-netjsonconfig

https://travis-ci.org/openwisp/django-netjsonconfig.svg https://coveralls.io/repos/openwisp/django-netjsonconfig/badge.svg Requirements Status https://badge.fury.io/py/django-netjsonconfig.svg https://img.shields.io/pypi/dm/django-netjsonconfig.svg

Configuration manager for embedded devices, implemented as a reusable django-app.

Based on the NetJSON format and the netjsonconfig library.

adhoc interface
preview

Current features

  • configuration management for embedded devices supporting different firmwares:
  • configuration editor based on JSON-Schema editor

  • advanced edit mode: edit NetJSON DeviceConfiguration objects for maximum flexibility

  • configuration templates: reduce repetition to the minimum

  • configuration context: reference ansible-like variables in the configuration

  • simple HTTP resources: allow devices to automatically download configuration updates

Project goals

  • automate configuration management for embedded devices

  • allow to minimize repetition by using templates

  • make it easy to integrate in larger django projects to improve reusability

  • make it easy to extend its models by providing abstract models

  • provide ways to support more firmwares by adding custom backends

  • keep the core as simple as possible

  • provide ways to extend the default behaviour

  • encourage new features to be published as extensions

Install stable version from pypi

Install from pypi:

pip install django-netjsonconfig

Install development version

Install tarball:

pip install https://github.com/openwisp/django-netjsonconfig/tarball/master

Alternatively you can install via pip using git:

pip install -e git+git://github.com/openwisp/django-netjsonconfig#egg=django-netjsonconfig

If you want to contribute, install your cloned fork:

git clone git@github.com:<your_fork>/django-netjsonconfig.git
cd django-netjsonconfig
python setup.py develop

Setup (integrate in an existing django project)

Add django_netjsonconfig, sortedm2m and reversion to INSTALLED_APPS:

INSTALLED_APPS = [
    # other apps
    'django_netjsonconfig',
    'sortedm2m',
    'reversion'  # optional, can be removed if not needed
    # ...
]

Add the controller URLs to your main urls.py:

urlpatterns = [
    # ... other urls in your project ...

    # controller URLs
    # used by devices to download/update their configuration
    # keep the namespace argument unchanged
    url(r'^', include('django_netjsonconfig.controller.urls', namespace='controller')),
    # common URLs
    # shared among django-netjsonconfig components
    # keep the namespace argument unchanged
    url(r'^', include('django_netjsonconfig.urls', namespace='netjsonconfig')),
]

Then run:

./manage.py migrate

Deploy it in production

If you need to deploy django-netjsonconfig by itself (that is without including it in a larger project), you may want to check out the ansible-openwisp2 role.

Installing for development

Install sqlite:

sudo apt-get install sqlite3 libsqlite3-dev

Install your forked repo:

git clone git://github.com/<your_fork>/django-netjsonconfig
cd django-netjsonconfig/
python setup.py develop

Install test requirements:

pip install -r requirements-test.txt

Create database:

cd tests/
./manage.py migrate
./manage.py createsuperuser

Launch development server:

./manage.py runserver

You can access the admin interface at http://127.0.0.1:8000/admin/.

Run tests with:

./runtests.py

Settings

NETJSONCONFIG_BACKENDS

type:

list

default:

[]

Additional custom netjsonconfig backends.

NETJSONCONFIG_REGISTRATION_ENABLED

type:

bool

default:

True

Whether devices can automatically register through the controller or not.

This feature is enabled by default.

Autoregistration must be supported on the devices in order to work, see openwisp-config automatic registration for more information.

NETJSONCONFIG_CONSISTENT_REGISTRATION

type:

bool

default:

True

Whether devices that are already registered are recognized when reflashed or reset, hence keeping the existing configuration without creating a new one.

This feature is enabled by default.

Autoregistration must be enabled also on the devices in order to work, see openwisp-config consistent key generation for more information.

NETJSONCONFIG_SHARED_SECRET

type:

str

default:

""

A secret key which must be used by devices to perform automatic registration.

This key MUST be explicitly set in production (if settings.DEBUG is False), otherwise an ImproperlyConfigured exception will be raised on startup.

NETJSONCONFIG_CONTEXT

type:

dict

default:

{}

Additional context that is passed to the default context of each Config object.

Each Config object gets the following attributes passed as configuration variables:

  • id

  • key

  • name

NETJSONCONFIG_CONTEXT can be used to define system-wide configuration variables.

For more information, see netjsonconfig context: configuration variables.

NETJSONCONFIG_DEFAULT_BACKEND

type:

str

default:

netjsonconfig.OpenWrt

The preferred backend that will be used as initial value when adding new Config or Template objects in the admin.

Set it to None in order to force the user to choose explicitly.

Screenshots

configuration item
bridge
radio
wpa enterprise
preview
adhoc interface

Contributing

  1. Announce your intentions in the OpenWISP Mailing List

  2. Fork this repo and install it

  3. Follow PEP8, Style Guide for Python Code

  4. Write code

  5. Write tests for your code

  6. Ensure all tests pass

  7. Ensure test coverage does not decrease

  8. Document your changes

  9. Send pull request

Changelog

See CHANGES.

License

See LICENSE.

Release files for django-netjsonconfig 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-netjsonconfig 0.3.2
File Size Uploaded
django-netjsonconfig-0.3.2.tar.gz 483.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-netjsonconfig 0.3.2
File Interpreter ABI Platform
django_netjsonconfig-0.3.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 561.6 kB

Release files / django-netjsonconfig-0.3.2.tar.gz

Download URL django-netjsonconfig-0.3.2.tar.gz
Size 483.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9498c5114bd9a2f24cfec3a2eaedb6340e61af5229a0279c59f73d4579416b4c
BLAKE2b-256 checksum
How to use checksums
463d8eb66b478749623314f69a37794492076372b99e037c1f324feff225468f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_netjsonconfig-0.3.2-py2.py3-none-any.whl

Download URL django_netjsonconfig-0.3.2-py2.py3-none-any.whl
Size 77.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
076b36239f00d90e9648df739181d046b7062f7265fe263f87ff01d113d042ac
BLAKE2b-256 checksum
How to use checksums
6be22aaf8ce31703c6c19fbd3ceeca91a3e02ed4f941eab4aac5ec9f0b41e9c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.12

2 release files

0.11

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10

2 release files

0.9

2 release files

0.8.1

2 release files

0.8

2 release files

0.7.1

2 release files

0.7

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4

2 release files

0.3.3

2 release files

This release

0.3.2 This release

2 release files

0.3.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page