GSoC @ OpenWISP: Raspbian backend for OpenWISP 2

Ritwick DSouza
4 min readAug 27, 2017

Project Name: Raspbian backend for OpenWISP 2
Student: Ritwick DSouza
Mentors: Federico Capoano and Marco Cappellacci

The past three months have been an excellent learning experience for me. I can surely call myself a better developer than what I was 3 months ago. Google Summer of Code gave me the opportunity to contribute to an open-source project in the best possible way. I gained a lot of technical skills throughout the program and learnt a lot about how open-source organisations work. The past 3 months have definitely been the most productive summer I have ever had. It has increased my confidence as a developer and as a person that I can actually pull off a project like this.

Project Description:

The project will add support for Raspbian Jessie to netjsonconfig. netjsonconfig is a network configuration management and automation library written in python that converts NetJSON Device Configurations objects to linux configurations packages that can be installed on systems like OpenWRT/LEDE, OpenWISP Firmware and now Raspbian Jessie too.

The library has interesting features like configuration templates, which allow to use the same templates for any number of devices, configuration variables and template overrides.

This means that netjsonconfig now allows to mass manage configurations of a number of Raspberry Pi’s more easily, soon it will be possible to do this directly from OpenWISP 2.

Following is a sample code snippet to render configurations to setup IPv4 and IPv6 Static Interfaces on Raspbian.

from netjsonconfig import Raspbiano = Raspbian({
"interfaces": [
"name": "eth0",
"type": "ethernet",
"addresses": [
"address": "",
"mask": 24,
"proto": "static",
"family": "ipv4"
"address": "fd87::1",
"mask": 128,
"proto": "static",
"family": "ipv6"

The above block of code will give the following output

# config: /etc/network/interfacesauto eth0
iface eth0 inet static
iface eth0 inet6 static
address fd87::1
netmask 128

For more detailed configurations please see the documentations page linked below.

The write() function generates a tar.gz file containing all the configurations.

>>> import tarfile
>>> from netjsonconfig import Raspbian
>>> o = Raspbian({
... "interfaces": [
... {
... "name": "eth0",
... "type": "ethernet",
... "addresses": [
... {
... "proto": "dhcp",
... "family": "ipv4"
... }
... ]
... }
... ]
... })
>>> o.write('dhcp-pi', path='/tmp/')

The above snippet creates writes the configuration archive in /tmp/dhcp-pi.tar.gz .

The backend also support django-netjsonconfig which is a Django based configurations manager for netjsonconfig.

The project as at the time of writing the post is complete as per the proposal. However there are many features that can still be added to the backend. There many advanced features that can still be added to the backend as a Raspberry Pi is nothing but a computer running Linux which means any possible NetworkConfiguration can be implemented on the device. These features will be added as we get feedback for the backend.

Future Work:

  1. Adding support for Backward Conversion (
  2. SSH deployment of configurations to the device

Important Links:

Project Repository-
Organization Website-
Organization Github Page-
Final Pull Request-

A Final Word

I’m absolutely thrilled to be given the opportunity to be a part of this adventure ! I’d like to thank Google for this amazing platform and lastly I want to thank all the mentors and the OpenWISP community for being helpful and patient with me. Federico Capoano (@nemesisdesign) and Marco Cappellacci (@cappe87). Thank You all :) !