Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A summary about my gsoc 2018 project work with OpenWISP.

openwisp-ipam: IP Address Management module for OpenWISP 2

Aim - This project idea was to create a new OpenWISP 2 IPAM module with the basic features for IP Address Management.

The project is divided into two phases -

  • Phase 1 - Developing django-ipam from scratch
  • Phase 2 - Extending django-ipam into openwisp-ipam which can be used in the openwisp 2 systems.

Phase 1 - django-ipam

Github repo - https://github.com/openwisp/django-ipam

We developed an django reusable app with basic features of IP Address Management.

A total of 21 PRs, 57 commits were merged on to the django-ipam repo during the coding period of GSOC 2018.

Imgur

Features Implemented -

  • IPv4 and IPv6 IP address management
  • IPv4 and IPv6 Subnet management
  • Automatic free space display for all subnets
  • Visual display for a specific subnet
  • IP request module
  • RESTful API to for CRUD operations
  • Possibility to search for an IP or subnet
  • CSV Import and Export of subnets and their IPs

Additional features -

  • Abstract classes for IpAddress and Subnet models.
  • Reusable test classes and API views.
  • Reusable Admin classes.

Some of the features have been described below, all these were implemented during the GSOC 2018 coding period.

IPv4 and IPv6 IP address management -

Django-ipam supports management of IPv4 and IPv6 IP address data. All the basic CRUD (Create, Read, Update, Delete) operations are supported in django-ipam.

Related PR - #11

Imgur

IPv4 and IPv6 Subnet management -

Django-ipam supports management of IPv4 and IPv6 IP networks data. All the basic CRUD (Create, Read, Update, Delete) operations are supported in django-ipam.

Related PR - #11

Imgur

Automatic free space display for Subnets

The user can easily check the free space available under any particular subnet in django-ipam. The graph is generated by using the Ploly.js library.

Related PR - #15

image

Visual Display of subnets -

Django-ipam provides a graphical representation of a subnet. The user can view the total number of IP addresses currently being used and the ones that are free under any subnet.

Related PR - #15 Imgur

In the above image, the ones that are already being used are represented with red disabled buttons while the ones that are free are represented by green colored buttons. The user can add an IP Address to the subnet by just clicking on these buttons as well.

IP Request

The main aim of this feature is to provide the user with the next available IP address under any subnet, while creating an IP address record.

Related PRs -

Imgur

The user can select a subnet and the first available IP address will be automatically suggested in the ip address field.

Imgur

Apart from this, we have API enpoints which make use of IP request functionality.

RESTful API

We implemented a RESTful API in django-ipam using the django-rest-framework. The API suite has session management and paginations implemented.
The list of API endpoints have been documented on the main repo of django-ipam - API docs

Related PR - #30

Possibility to search for an IP under a Subnet

The user can search for any IP address under any selected subnet. This was an easy to implement feature, thanks to Django admin framework. The user can also filter for IP addresses with respect to any subnet.

Related PR - #37

CSV Import and Export of Subnet data

The user can easily import and export data from django-ipam. The importing format is described in the README of the github repo. As of now we can use .csv, .xls and .xlsx file types. The exporting is done in .csv file type format.

This I believe is one of the most important feature as we are planning to shift from phpipam to django-ipam, so exporting and importing data was essential to be implemented for the ease of this transition.

Related PR - #31


Phase 2 - openwisp-ipam

In this phase we had to extend the django-ipam app into openwisp-ipam. The main aim was to integrate django-ipam into the OpenWISP 2 ecosystem.

Github Repo - https://github.com/openwisp/openwisp-ipam

  • We basically extended the models and used openwisp-users for multi-tenancy in openwisp-ipam.
  • The main effort went into refactoring some of the code in django-ipam, as we realized that some of them were not extensible.
  • Most of test cases were extended from django-ipam, while a few required some modifications.
  • We also had to modify the CSV Import/Export feature in order to support the customized model structure in openwisp-ipam.

Work Left -

Django-ipam

Nested Subnet management - https://github.com/openwisp/django-ipam/issues/21

This involves implementing the master subnet feature for Subnet models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment