Index: django_apps/wndb/admin.py
===================================================================
--- django_apps/wndb/admin.py	(revision 340)
+++ django_apps/wndb/admin.py	(revision 340)
@@ -0,0 +1,37 @@
+from wndb.models import *
+from django.contrib import admin
+from django.db.models import get_models, get_app
+from django.contrib.admin.sites import AlreadyRegistered
+from django import forms
+from django.db.models import Q
+
+class InterfaceInline(admin.TabularInline):
+  extra = 3
+  model = Interface
+
+class NodeAdmin(admin.ModelAdmin):
+  inlines = [
+    InterfaceInline,
+  ]
+
+admin.site.register(Node,NodeAdmin)
+
+class LinkForm(forms.ModelForm):
+  def __init__(self, *args, **kwargs):
+    super(LinkForm, self).__init__(*args, **kwargs)
+    if 'initial' in kwargs:
+      self.fields['ip_block'].queryset = IPBlock.objects.filter(Q(link__isnull=True))
+    else:
+      self.fields['ip_block'].queryset = IPBlock.objects.filter(Q(link__isnull=True)|Q(pk=self.instance.ip_block.id))
+
+class LinkAdmin(admin.ModelAdmin):
+  form = LinkForm
+
+admin.site.register(Link,LinkAdmin)
+
+
+for model in get_models(get_app('wndb')):
+  try:
+    admin.site.register(model)
+  except AlreadyRegistered:
+    pass
Index: django_apps/wndb/fixtures/initial_data.json
===================================================================
--- django_apps/wndb/fixtures/initial_data.json	(revision 340)
+++ django_apps/wndb/fixtures/initial_data.json	(revision 340)
@@ -0,0 +1,495 @@
+[
+  {
+    "pk": 22, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_logentry", 
+      "name": "Can add log entry", 
+      "content_type": 8
+    }
+  }, 
+  {
+    "pk": 23, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_logentry", 
+      "name": "Can change log entry", 
+      "content_type": 8
+    }
+  }, 
+  {
+    "pk": 24, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_logentry", 
+      "name": "Can delete log entry", 
+      "content_type": 8
+    }
+  }, 
+  {
+    "pk": 4, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_group", 
+      "name": "Can add group", 
+      "content_type": 2
+    }
+  }, 
+  {
+    "pk": 5, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_group", 
+      "name": "Can change group", 
+      "content_type": 2
+    }
+  }, 
+  {
+    "pk": 6, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_group", 
+      "name": "Can delete group", 
+      "content_type": 2
+    }
+  }, 
+  {
+    "pk": 10, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_message", 
+      "name": "Can add message", 
+      "content_type": 4
+    }
+  }, 
+  {
+    "pk": 11, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_message", 
+      "name": "Can change message", 
+      "content_type": 4
+    }
+  }, 
+  {
+    "pk": 12, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_message", 
+      "name": "Can delete message", 
+      "content_type": 4
+    }
+  }, 
+  {
+    "pk": 1, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_permission", 
+      "name": "Can add permission", 
+      "content_type": 1
+    }
+  }, 
+  {
+    "pk": 2, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_permission", 
+      "name": "Can change permission", 
+      "content_type": 1
+    }
+  }, 
+  {
+    "pk": 3, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_permission", 
+      "name": "Can delete permission", 
+      "content_type": 1
+    }
+  }, 
+  {
+    "pk": 25, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_runninguser", 
+      "name": "Can add running user", 
+      "content_type": 3
+    }
+  }, 
+  {
+    "pk": 7, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_user", 
+      "name": "Can add user", 
+      "content_type": 3
+    }
+  }, 
+  {
+    "pk": 26, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_runninguser", 
+      "name": "Can change running user", 
+      "content_type": 3
+    }
+  }, 
+  {
+    "pk": 8, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_user", 
+      "name": "Can change user", 
+      "content_type": 3
+    }
+  }, 
+  {
+    "pk": 27, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_runninguser", 
+      "name": "Can delete running user", 
+      "content_type": 3
+    }
+  }, 
+  {
+    "pk": 9, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_user", 
+      "name": "Can delete user", 
+      "content_type": 3
+    }
+  }, 
+  {
+    "pk": 13, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_contenttype", 
+      "name": "Can add content type", 
+      "content_type": 5
+    }
+  }, 
+  {
+    "pk": 14, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_contenttype", 
+      "name": "Can change content type", 
+      "content_type": 5
+    }
+  }, 
+  {
+    "pk": 15, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_contenttype", 
+      "name": "Can delete content type", 
+      "content_type": 5
+    }
+  }, 
+  {
+    "pk": 37, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_alert", 
+      "name": "Can add alert", 
+      "content_type": 13
+    }
+  }, 
+  {
+    "pk": 38, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_alert", 
+      "name": "Can change alert", 
+      "content_type": 13
+    }
+  }, 
+  {
+    "pk": 39, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_alert", 
+      "name": "Can delete alert", 
+      "content_type": 13
+    }
+  }, 
+  {
+    "pk": 31, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_role", 
+      "name": "Can add role", 
+      "content_type": 11
+    }
+  }, 
+  {
+    "pk": 32, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_role", 
+      "name": "Can change role", 
+      "content_type": 11
+    }
+  }, 
+  {
+    "pk": 33, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_role", 
+      "name": "Can delete role", 
+      "content_type": 11
+    }
+  }, 
+  {
+    "pk": 34, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_service", 
+      "name": "Can add service", 
+      "content_type": 12
+    }
+  }, 
+  {
+    "pk": 35, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_service", 
+      "name": "Can change service", 
+      "content_type": 12
+    }
+  }, 
+  {
+    "pk": 36, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_service", 
+      "name": "Can delete service", 
+      "content_type": 12
+    }
+  }, 
+  {
+    "pk": 28, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_result", 
+      "name": "Can add result", 
+      "content_type": 9
+    }
+  }, 
+  {
+    "pk": 29, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_result", 
+      "name": "Can change result", 
+      "content_type": 9
+    }
+  }, 
+  {
+    "pk": 30, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_result", 
+      "name": "Can delete result", 
+      "content_type": 9
+    }
+  }, 
+  {
+    "pk": 16, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_session", 
+      "name": "Can add session", 
+      "content_type": 6
+    }
+  }, 
+  {
+    "pk": 17, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_session", 
+      "name": "Can change session", 
+      "content_type": 6
+    }
+  }, 
+  {
+    "pk": 18, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_session", 
+      "name": "Can delete session", 
+      "content_type": 6
+    }
+  }, 
+  {
+    "pk": 19, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_site", 
+      "name": "Can add site", 
+      "content_type": 7
+    }
+  }, 
+  {
+    "pk": 20, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_site", 
+      "name": "Can change site", 
+      "content_type": 7
+    }
+  }, 
+  {
+    "pk": 21, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_site", 
+      "name": "Can delete site", 
+      "content_type": 7
+    }
+  }, 
+  {
+    "pk": 46, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_interface", 
+      "name": "Can add interface", 
+      "content_type": 16
+    }
+  }, 
+  {
+    "pk": 47, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_interface", 
+      "name": "Can change interface", 
+      "content_type": 16
+    }
+  }, 
+  {
+    "pk": 48, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_interface", 
+      "name": "Can delete interface", 
+      "content_type": 16
+    }
+  }, 
+  {
+    "pk": 40, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_ipblock", 
+      "name": "Can add ip block", 
+      "content_type": 14
+    }
+  }, 
+  {
+    "pk": 41, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_ipblock", 
+      "name": "Can change ip block", 
+      "content_type": 14
+    }
+  }, 
+  {
+    "pk": 42, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_ipblock", 
+      "name": "Can delete ip block", 
+      "content_type": 14
+    }
+  }, 
+  {
+    "pk": 49, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_link", 
+      "name": "Can add link", 
+      "content_type": 17
+    }
+  }, 
+  {
+    "pk": 50, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_link", 
+      "name": "Can change link", 
+      "content_type": 17
+    }
+  }, 
+  {
+    "pk": 51, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_link", 
+      "name": "Can delete link", 
+      "content_type": 17
+    }
+  }, 
+  {
+    "pk": 43, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "add_node", 
+      "name": "Can add node", 
+      "content_type": 15
+    }
+  }, 
+  {
+    "pk": 44, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "change_node", 
+      "name": "Can change node", 
+      "content_type": 15
+    }
+  }, 
+  {
+    "pk": 45, 
+    "model": "auth.permission", 
+    "fields": {
+      "codename": "delete_node", 
+      "name": "Can delete node", 
+      "content_type": 15
+    }
+  }, 
+  {
+    "pk": 1, 
+    "model": "auth.user", 
+    "fields": {
+      "username": "rvdzwet", 
+      "first_name": "", 
+      "last_name": "", 
+      "is_active": true, 
+      "is_superuser": true, 
+      "is_staff": true, 
+      "last_login": "2011-08-02 13:27:50", 
+      "groups": [], 
+      "user_permissions": [], 
+      "password": "sha1$97e55$c85f2b9a0faf72a1f48d21db96a55537a06c7226", 
+      "email": "info@rickvanderzwet.nl", 
+      "date_joined": "2011-08-02 11:22:44"
+    }
+  }, 
+  {
+    "pk": "8bb6c3efe34335c4393daefa39bb2515", 
+    "model": "sessions.session", 
+    "fields": {
+      "expire_date": "2015-08-16 11:23:58", 
+      "session_data": "MGQ5MWZiZGZkNzI5Nzc4OGE4YjUzYTZkNzQzZTQ4Y2U5ZjJiYTljNjqAAn1xAShVEl9hdXRoX3Vz\nZXJfYmFja2VuZHECVSlkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZHED\nVQ1fYXV0aF91c2VyX2lkcQRLAXUu\n"
+    }
+  }, 
+  {
+    "pk": "f7c67c7de0f7bfa4d1b180efaf98d8e4", 
+    "model": "sessions.session", 
+    "fields": {
+      "expire_date": "2015-08-16 13:27:50", 
+      "session_data": "MGQ5MWZiZGZkNzI5Nzc4OGE4YjUzYTZkNzQzZTQ4Y2U5ZjJiYTljNjqAAn1xAShVEl9hdXRoX3Vz\nZXJfYmFja2VuZHECVSlkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZHED\nVQ1fYXV0aF91c2VyX2lkcQRLAXUu\n"
+    }
+  }
+]
Index: django_apps/wndb/forms.py
===================================================================
--- django_apps/wndb/forms.py	(revision 340)
+++ django_apps/wndb/forms.py	(revision 340)
@@ -0,0 +1,3 @@
+from django import forms
+
+# place form definition here
Index: django_apps/wndb/models.py
===================================================================
--- django_apps/wndb/models.py	(revision 340)
+++ django_apps/wndb/models.py	(revision 340)
@@ -0,0 +1,59 @@
+from django.db import models
+from django.db.models import Q
+
+# Create your models here.
+
+MODE_CHOICES = (
+ ('master', 'master'),
+ ('managed','managed'),
+)
+
+PORT_CHOICES = (
+  ('vr0','vr0'),
+  ('vr1','vr1'),
+  ('vr2','vr2'),
+  ('ue0','ue0'),
+  ('ue1','ue1'),
+  ('sis0','sis0'),
+  ('sis1','sis1'),
+)
+
+MODEL_CHOICES = (
+  ('Ethernet', 'Ethernet'),
+  ('Bullet2', 'NanoStation2'),
+  ('NanoStation2', 'NanoStation2'),
+  ('NanoStationM2', 'NanoStationM2'),
+  ('NanoStation5', 'NanoStation5'),
+  ('NanoStationM5', 'NanoStationM5'),
+)
+
+NETMASK_CHOICES = zip(range(12,31),range(12,31))
+class IPBlock(models.Model):
+  network = models.IPAddressField(default="172.16.",unique=True)
+  netmask = models.IntegerField(choices=NETMASK_CHOICES,default=29)
+  def __unicode__(self):
+    return "%s/%s" % (self.network, self.netmask)
+
+DEFAULT_IPBLOCK = lambda: IPBlock.objects.get_or_create(network='0.0.0.0',netmask=0)[0].id
+
+class Node(models.Model):
+  name = models.CharField(max_length="100")
+  def __unicode__(self):
+    return self.name
+
+
+class Interface(models.Model):
+  node = models.ForeignKey(Node)
+  port = models.CharField(max_length="100", choices=PORT_CHOICES, default="vr0")
+  model = models.CharField(max_length="100", choices=MODEL_CHOICES, default="Ethernet")
+  mode = models.CharField(max_length="100", choices=MODE_CHOICES, default="master")
+  def __unicode__(self):
+    return "%s - %s - %s - %s" % (self.node, self.port, self.model, self.mode)
+
+class Link(models.Model):
+  ip_block = models.ForeignKey(IPBlock,unique=True,default=DEFAULT_IPBLOCK)
+  interfaces = models.ManyToManyField(Interface)
+  def __unicode__(self):
+     return "%s : %s" % (self.ip_block, '|'.join(map(str,self.interfaces.all())))
+
+
Index: django_apps/wndb/urls.py
===================================================================
--- django_apps/wndb/urls.py	(revision 340)
+++ django_apps/wndb/urls.py	(revision 340)
@@ -0,0 +1,4 @@
+from django.conf.urls.defaults import *
+
+# place app url patterns here
+urlpatterns = patterns('')
Index: django_apps/wndb/views.py
===================================================================
--- django_apps/wndb/views.py	(revision 340)
+++ django_apps/wndb/views.py	(revision 340)
@@ -0,0 +1,1 @@
+# Create your views here.
