I wanted to come up with a simple way of storing and manipulating data regarding IP addresses on the network, so I used Sinatra to create a simple REST api. The idea here is to make this as flexible as possible for easy integration with any other application. Currently the frontend views are limited in what they can do and have no styling. This is the very start of the project, so a lot of functionality may be missing or incomplete.
There is no authentication implemented just yet, but LDAP will likely be used as the main authentication mechanism.
I chose to use mongoid to create models for VLANs, IP Addresses, and Devices. This allows for easy data validation and since it's mongo, I can make the schema pretty flexible. This was mainly chosen since Devices will have an additional attributes section with user-defined keyword=>values.
A VLAN contains many IP addresses which are one to one mapped to devices.
curl -i -X PUT -d '{ "vlan": 2, "cidr": "10.0.1.1/24", "description": "database servers" }' localhost:4567/api/vlan
curl localhost:4567/api/vlan/2
curl -i -X POST -d '{ "gateway": "10.0.1.2" }' localhost:4567/api/vlan/2
curl -i -X DELETE localhost:4567/api/vlan/2
This is not implemented yet, but eventually a device will require a hostname, and have any amount of additional attributes tacked on, things like physical location, MAC addresses, etc can be added to the additional attributes field.