diff --git a/xos/attic/header.py b/xos/attic/header.py
new file mode 100644
index 0000000..0f04064
--- /dev/null
+++ b/xos/attic/header.py
@@ -0,0 +1,27 @@
+from django.db import models
+from core.models import Service, PlCoreBase, Slice, Instance, Tenant, TenantWithContainer, Node, Image, User, Flavor, NetworkParameter, NetworkParameterType, Port, AddressPool
+from core.models.plcorebase import StrippedCharField
+import os
+from django.db import models, transaction
+from django.forms.models import model_to_dict
+from django.db.models import *
+from operator import itemgetter, attrgetter, methodcaller
+from core.models import Tag
+from core.models.service import LeastLoadedNodeScheduler
+import traceback
+from xos.exceptions import *
+from xos.config import Config
+
+
+class ConfigurationError(Exception):
+    pass
+
+
+VROUTER_KIND = "vROUTER"
+APP_LABEL = "vrouter"
+
+# NOTE: don't change VROUTER_KIND unless you also change the reference to it
+#   in tosca/resources/network.py
+
+CORD_USE_VTN = getattr(Config(), "networking_use_vtn", False)
+
diff --git a/xos/attic/vrouterapp_model.py b/xos/attic/vrouterapp_model.py
new file mode 100644
index 0000000..aef51e9
--- /dev/null
+++ b/xos/attic/vrouterapp_model.py
@@ -0,0 +1,11 @@
+def _get_interfaces(self):
+    app_interfaces = []
+    devices = VRouterDevice.objects.filter(vrouter_service=self.vrouter_service)
+    for device in devices:
+        ports = VRouterPort.objects.filter(vrouter_device=device.id)
+        for port in ports:
+            interfaces = VRouterInterface.objects.filter(vrouter_port=port.id)
+            for iface in interfaces:
+                app_interfaces.append(iface.name)
+    return app_interfaces
+
diff --git a/xos/attic/vrouterservice_model.py b/xos/attic/vrouterservice_model.py
new file mode 100644
index 0000000..82d2b15
--- /dev/null
+++ b/xos/attic/vrouterservice_model.py
@@ -0,0 +1,36 @@
+def ip_to_mac(self, ip):
+    (a, b, c, d) = ip.split('.')
+    return "02:42:%02x:%02x:%02x:%02x" % (int(a), int(b), int(c), int(d))
+
+def get_gateways(self):
+    gateways = []
+
+    aps = self.addresspools.all()
+    for ap in aps:
+        gateways.append({"gateway_ip": ap.gateway_ip, "gateway_mac": ap.gateway_mac})
+
+    return gateways
+
+def get_address_pool(self, name):
+    ap = AddressPool.objects.filter(name=name, service=self)
+    if not ap:
+        raise Exception("vRouter unable to find addresspool %s" % name)
+    return ap[0]
+
+def get_tenant(self, **kwargs):
+    address_pool_name = kwargs.pop("address_pool_name")
+
+    ap = self.get_address_pool(address_pool_name)
+
+    ip = ap.get_address()
+    if not ip:
+        raise Exception("AddressPool '%s' has run out of addresses." % ap.name)
+
+    t = VRouterTenant(provider_service=self, **kwargs)
+    t.public_ip = ip
+    t.public_mac = self.ip_to_mac(ip)
+    t.address_pool_id = ap.id
+    t.save()
+
+    return t
+
diff --git a/xos/attic/vroutertenant_model.py b/xos/attic/vroutertenant_model.py
new file mode 100644
index 0000000..7fde19d
--- /dev/null
+++ b/xos/attic/vroutertenant_model.py
@@ -0,0 +1,38 @@
+@property
+def gateway_ip(self):
+    if not self.address_pool:
+        return None
+    return self.address_pool.gateway_ip
+
+@property
+def gateway_mac(self):
+    if not self.address_pool:
+        return None
+    return self.address_pool.gateway_mac
+
+@property
+def cidr(self):
+    if not self.address_pool:
+        return None
+    return self.address_pool.cidr
+
+@property
+def netbits(self):
+    # return number of bits in the network portion of the cidr
+    if self.cidr:
+        parts = self.cidr.split("/")
+        if len(parts) == 2:
+            return int(parts[1].strip())
+    return None
+
+def cleanup_addresspool(self):
+    if self.address_pool:
+        ap = self.address_pool
+        if ap:
+            ap[0].put_address(self.public_ip)
+            self.public_ip = None
+
+def delete(self, *args, **kwargs):
+    self.cleanup_addresspool()
+    super(VRouterTenant, self).delete(*args, **kwargs)
+
diff --git a/xos/header.py b/xos/header.py
new file mode 120000
index 0000000..721b5c0
--- /dev/null
+++ b/xos/header.py
@@ -0,0 +1 @@
+attic/header.py
\ No newline at end of file
diff --git a/xos/models.py b/xos/models.py
index 98faaad..09ef583 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -1,200 +1,290 @@
-from django.db import models
-from core.models import Service, PlCoreBase, Slice, Instance, Tenant, TenantWithContainer, Node, Image, User, Flavor, NetworkParameter, NetworkParameterType, Port, AddressPool
-from core.models.plcorebase import StrippedCharField
-import os
-from django.db import models, transaction
-from django.forms.models import model_to_dict
-from django.db.models import Q
-from operator import itemgetter, attrgetter, methodcaller
-from core.models import Tag
-from core.models.service import LeastLoadedNodeScheduler
-import traceback
-from xos.exceptions import *
-from xos.config import Config
+from header import *
 
 
-class ConfigurationError(Exception):
-    pass
 
 
-VROUTER_KIND = "vROUTER"
-APP_LABEL = "vrouter"
-
-# NOTE: don't change VROUTER_KIND unless you also change the reference to it
-#   in tosca/resources/network.py
-
-CORD_USE_VTN = getattr(Config(), "networking_use_vtn", False)
 
 
-class VRouterService(Service):
-    KIND = VROUTER_KIND
-
-    class Meta:
-        app_label = APP_LABEL
-        verbose_name = "vRouter Service"
-
-    # Are rest_hostname and rest_port redundant with ONOS service?
-    # Should ONOSService be augmented with rest_user and rest_pass?
-
-    rest_hostname = StrippedCharField(max_length=255, null=True, blank=True)
-    rest_port = models.IntegerField(default=8181)
-    rest_user = StrippedCharField(max_length=255, default="onos")
-    rest_pass = StrippedCharField(max_length=255, default="rocks")
-
-    def ip_to_mac(self, ip):
-        (a, b, c, d) = ip.split('.')
-        return "02:42:%02x:%02x:%02x:%02x" % (int(a), int(b), int(c), int(d))
-
-    def get_gateways(self):
-        gateways = []
-
-        aps = self.addresspools.all()
-        for ap in aps:
-            gateways.append({"gateway_ip": ap.gateway_ip, "gateway_mac": ap.gateway_mac})
-
-        return gateways
-
-    def get_address_pool(self, name):
-        ap = AddressPool.objects.filter(name=name, service=self)
-        if not ap:
-            raise Exception("vRouter unable to find addresspool %s" % name)
-        return ap[0]
-
-    def get_tenant(self, **kwargs):
-        address_pool_name = kwargs.pop("address_pool_name")
-
-        ap = self.get_address_pool(address_pool_name)
-
-        ip = ap.get_address()
-        if not ip:
-            raise Exception("AddressPool '%s' has run out of addresses." % ap.name)
-
-        t = VRouterTenant(provider_service=self, **kwargs)
-        t.public_ip = ip
-        t.public_mac = self.ip_to_mac(ip)
-        t.address_pool_id = ap.id
-        t.save()
-
-        return t
 
 
-class VRouterTenant(Tenant):
-    class Meta:
-        verbose_name = "vRouter Tenant"
-
-    KIND = VROUTER_KIND
-
-    public_ip = StrippedCharField(max_length = 30, null=True, blank=True)
-    public_mac = StrippedCharField(max_length = 30, null=True, blank=True)
-    address_pool = models.ForeignKey(AddressPool, related_name='vrouter_tenants', blank=True, null=True)
-
-    @property
-    def gateway_ip(self):
-        if not self.address_pool:
-            return None
-        return self.address_pool.gateway_ip
-
-    @property
-    def gateway_mac(self):
-        if not self.address_pool:
-            return None
-        return self.address_pool.gateway_mac
-
-    @property
-    def cidr(self):
-        if not self.address_pool:
-            return None
-        return self.address_pool.cidr
-
-    @property
-    def netbits(self):
-        # return number of bits in the network portion of the cidr
-        if self.cidr:
-            parts = self.cidr.split("/")
-            if len(parts) == 2:
-                return int(parts[1].strip())
-        return None
-
-    def cleanup_addresspool(self):
-        if self.address_pool:
-            ap = self.address_pool
-            if ap:
-                ap[0].put_address(self.public_ip)
-                self.public_ip = None
-
-    def delete(self, *args, **kwargs):
-        self.cleanup_addresspool()
-        super(VRouterTenant, self).delete(*args, **kwargs)
 
 
-# DEVICES
+
+
+
+
+
+
+
+
+
+
+
+
+
+#from core.models.service import Service
+from core.models import Service
+
+
+
+from core.models import AddressPool#from core.models.tenant import Tenant
+from core.models import Tenant
+
+
+
+
+
+class VRouterApp(PlCoreBase):
+
+  KIND = "vROUTER"
+
+  class Meta:
+      app_label = "vrouter"
+      name = "vrouter"
+      verbose_name = "vRouter Service"
+
+  # Primitive Fields (Not Relations)
+  name = CharField( help_text = "application name", max_length = 50, null = False, db_index = False, blank = False )
+  control_plane_connect_point = CharField( help_text = "port identifier in ONOS", max_length = 21, null = False, db_index = False, blank = False )
+  ospf_enabled = BooleanField( default = True, help_text = "ospf enabled", null = False, db_index = False, blank = True )
+  
+
+  # Relations
+  
+  vrouter_service = ForeignKey(VRouterService, db_index = True, related_name = 'apps', null = False, blank = False )
+
+  def _get_interfaces(self):
+      app_interfaces = []
+      devices = VRouterDevice.objects.filter(vrouter_service=self.vrouter_service)
+      for device in devices:
+          ports = VRouterPort.objects.filter(vrouter_device=device.id)
+          for port in ports:
+              interfaces = VRouterInterface.objects.filter(vrouter_port=port.id)
+              for iface in interfaces:
+                  app_interfaces.append(iface.name)
+      return app_interfaces
+  
+  pass
+
+
+
+
 class VRouterDevice(PlCoreBase):
-    """define the information related to an device used by vRouter"""
-    class Meta:
-        app_label = APP_LABEL
-        verbose_name = "vRouter Device"
 
-    name = models.CharField(max_length=20, help_text="device friendly name", null=True, blank=True)
-    openflow_id = models.CharField(max_length=20, help_text="device identifier in ONOS", null=False, blank=False)
-    config_key = models.CharField(max_length=32, help_text="configuration key", null=False, blank=False, default="basic")
-    driver = models.CharField(max_length=32, help_text="driver type", null=False, blank=False)
-    vrouter_service = models.ForeignKey(VRouterService, related_name='devices')
+  KIND = "vROUTER"
+
+  class Meta:
+      app_label = "vrouter"
+      name = "vrouter"
+      verbose_name = "vRouter Service"
+
+  # Primitive Fields (Not Relations)
+  name = CharField( help_text = "device friendly name", max_length = 20, null = True, db_index = False, blank = True )
+  openflow_id = CharField( help_text = "device identifier in ONOS", max_length = 20, null = False, db_index = False, blank = False )
+  config_key = CharField( default = "basic", max_length = 32, blank = False, help_text = "configuration key", null = False, db_index = False )
+  driver = CharField( help_text = "driver type", max_length = 32, null = False, db_index = False, blank = False )
+  
+
+  # Relations
+  
+  vrouter_service = ForeignKey(VRouterService, db_index = True, related_name = 'devices', null = False, blank = False )
+
+  
+  pass
 
 
-# PORTS
-class VRouterPort(PlCoreBase):
-    class Meta:
-        app_label = APP_LABEL
-        verbose_name = "vRouter Port"
-
-    name = models.CharField(max_length=20, help_text="port friendly name", null=True, blank=True)
-    openflow_id = models.CharField(max_length=21, help_text="port identifier in ONOS", null=False, blank=False)
-    vrouter_device = models.ForeignKey(VRouterDevice, related_name='ports')
-    # NOTE probably is not meaningful to relate a port to a service
-    vrouter_service = models.ForeignKey(VRouterService, related_name='device_ports')
 
 
 class VRouterInterface(PlCoreBase):
-    class Meta:
-        app_label = APP_LABEL
-        verbose_name = "vRouter Interface"
 
-    name = models.CharField(max_length=20, help_text="interface friendly name", null=True, blank=True)
-    vrouter_port = models.ForeignKey(VRouterPort, related_name='interfaces')
-    name = models.CharField(max_length=10, help_text="interface name", null=False, blank=False)
-    mac = models.CharField(max_length=17, help_text="interface mac", null=False, blank=False)
-    vlan = models.CharField(max_length=10, help_text="interface vlan id", null=True, blank=True)
+  KIND = "vROUTER"
+
+  class Meta:
+      app_label = "vrouter"
+      name = "vrouter"
+      verbose_name = "vRouter Service"
+
+  # Primitive Fields (Not Relations)
+  name = CharField( help_text = "interface name", max_length = 10, null = False, db_index = False, blank = False )
+  mac = CharField( help_text = "interface mac", max_length = 17, null = False, db_index = False, blank = False )
+  vlan = CharField( help_text = "interface vlan id", max_length = 10, null = True, db_index = False, blank = True )
+  
+
+  # Relations
+  
+  vrouter_port = ForeignKey(VRouterPort, db_index = True, related_name = 'interfaces', null = False, blank = False )
+
+  
+  pass
+
+
 
 
 class VRouterIp(PlCoreBase):
-    class Meta:
-        app_label = APP_LABEL
-        verbose_name = "vRouter Ip"
 
-    name = models.CharField(max_length=20, help_text="ip friendly name", null=True, blank=True)
-    vrouter_interface = models.ForeignKey(VRouterInterface, related_name='ips')
-    ip = models.CharField(max_length=19, help_text="interface ips", null=False, blank=False)
+  KIND = "vROUTER"
+
+  class Meta:
+      app_label = "vrouter"
+      name = "vrouter"
+      verbose_name = "vRouter Service"
+
+  # Primitive Fields (Not Relations)
+  name = CharField( help_text = "ip friendly name", max_length = 20, null = True, db_index = False, blank = True )
+  ip = CharField( help_text = "interface ips", max_length = 19, null = False, db_index = False, blank = False )
+  
+
+  # Relations
+  
+  vrouter_interface = ForeignKey(VRouterInterface, db_index = True, related_name = 'ips', null = False, blank = False )
+
+  
+  pass
 
 
-# APPS
-class VRouterApp(PlCoreBase):
-    class Meta:
-        app_label = "vrouter"
-        verbose_name = "vRouter App"
 
-    def _get_interfaces(self):
-        app_interfaces = []
-        devices = VRouterDevice.objects.filter(vrouter_service=self.vrouter_service)
-        for device in devices:
-            ports = VRouterPort.objects.filter(vrouter_device=device.id)
-            for port in ports:
-                interfaces = VRouterInterface.objects.filter(vrouter_port=port.id)
-                for iface in interfaces:
-                    app_interfaces.append(iface.name)
-        return app_interfaces
 
-    vrouter_service = models.ForeignKey(VRouterService, related_name='apps')
-    name = models.CharField(max_length=50, help_text="application name", null=False, blank=False)
-    control_plane_connect_point = models.CharField(max_length=21, help_text="port identifier in ONOS", null=False, blank=False)
-    ospf_enabled = models.BooleanField(default=True, help_text="ospf enabled")
-    interfaces = property(_get_interfaces)
+class VRouterPort(PlCoreBase):
+
+  KIND = "vROUTER"
+
+  class Meta:
+      app_label = "vrouter"
+      name = "vrouter"
+      verbose_name = "vRouter Service"
+
+  # Primitive Fields (Not Relations)
+  name = CharField( help_text = "port friendly name", max_length = 20, null = True, db_index = False, blank = True )
+  openflow_id = CharField( help_text = "port identifier in ONOS", max_length = 21, null = False, db_index = False, blank = False )
+  
+
+  # Relations
+  
+  vrouter_device = ForeignKey(VRouterDevice, db_index = True, related_name = 'ports', null = False, blank = False )
+  vrouter_service = ForeignKey(VRouterService, db_index = True, related_name = 'device_ports', null = False, blank = False )
+
+  
+  pass
+
+
+
+
+class VRouterService(Service):
+
+  KIND = "vROUTER"
+
+  class Meta:
+      app_label = "vrouter"
+      name = "vrouter"
+      verbose_name = "vRouter Service"
+
+  # Primitive Fields (Not Relations)
+  rest_hostname = StrippedCharField( db_index = False, max_length = 255, null = True, blank = True )
+  rest_port = IntegerField( default = 8181, null = False, blank = False, db_index = False )
+  rest_user = StrippedCharField( default = "onos", max_length = 255, null = False, db_index = False, blank = False )
+  rest_pass = StrippedCharField( default = "rocks", max_length = 255, null = False, db_index = False, blank = False )
+  
+
+  # Relations
+  
+
+  def ip_to_mac(self, ip):
+      (a, b, c, d) = ip.split('.')
+      return "02:42:%02x:%02x:%02x:%02x" % (int(a), int(b), int(c), int(d))
+  
+  def get_gateways(self):
+      gateways = []
+  
+      aps = self.addresspools.all()
+      for ap in aps:
+          gateways.append({"gateway_ip": ap.gateway_ip, "gateway_mac": ap.gateway_mac})
+  
+      return gateways
+  
+  def get_address_pool(self, name):
+      ap = AddressPool.objects.filter(name=name, service=self)
+      if not ap:
+          raise Exception("vRouter unable to find addresspool %s" % name)
+      return ap[0]
+  
+  def get_tenant(self, **kwargs):
+      address_pool_name = kwargs.pop("address_pool_name")
+  
+      ap = self.get_address_pool(address_pool_name)
+  
+      ip = ap.get_address()
+      if not ip:
+          raise Exception("AddressPool '%s' has run out of addresses." % ap.name)
+  
+      t = VRouterTenant(provider_service=self, **kwargs)
+      t.public_ip = ip
+      t.public_mac = self.ip_to_mac(ip)
+      t.address_pool_id = ap.id
+      t.save()
+  
+      return t
+  
+  pass
+
+
+
+
+class VRouterTenant(Tenant):
+
+  KIND = "vROUTER"
+
+  class Meta:
+      app_label = "vrouter"
+      name = "vrouter"
+      verbose_name = "vRouter Service"
+
+  # Primitive Fields (Not Relations)
+  public_ip = StrippedCharField( db_index = False, max_length = 30, null = True, blank = True )
+  public_mac = StrippedCharField( db_index = False, max_length = 30, null = True, blank = True )
+  
+
+  # Relations
+  
+  address_pool = ForeignKey(AddressPool, db_index = True, related_name = 'vrouter_tenants', null = True, blank = True )
+
+  @property
+  def gateway_ip(self):
+      if not self.address_pool:
+          return None
+      return self.address_pool.gateway_ip
+  
+  @property
+  def gateway_mac(self):
+      if not self.address_pool:
+          return None
+      return self.address_pool.gateway_mac
+  
+  @property
+  def cidr(self):
+      if not self.address_pool:
+          return None
+      return self.address_pool.cidr
+  
+  @property
+  def netbits(self):
+      # return number of bits in the network portion of the cidr
+      if self.cidr:
+          parts = self.cidr.split("/")
+          if len(parts) == 2:
+              return int(parts[1].strip())
+      return None
+  
+  def cleanup_addresspool(self):
+      if self.address_pool:
+          ap = self.address_pool
+          if ap:
+              ap[0].put_address(self.public_ip)
+              self.public_ip = None
+  
+  def delete(self, *args, **kwargs):
+      self.cleanup_addresspool()
+      super(VRouterTenant, self).delete(*args, **kwargs)
+  
+  pass
+
+
diff --git a/xos/vrouter-onboard.yaml b/xos/vrouter-onboard.yaml
index f53c212..98316ab 100644
--- a/xos/vrouter-onboard.yaml
+++ b/xos/vrouter-onboard.yaml
@@ -13,7 +13,7 @@
           base_url: file:///opt/xos_services/vrouter/xos/
           # The following will concatenate with base_url automatically, if
           # base_url is non-null.
-          models: models.py
+          xproto: ./
           admin: admin.py
           admin_template: templates/vrouteradmin.html
           tosca_custom_types: vrouter.yaml
diff --git a/xos/vrouter.xproto b/xos/vrouter.xproto
new file mode 100644
index 0000000..b79b30c
--- /dev/null
+++ b/xos/vrouter.xproto
@@ -0,0 +1,51 @@
+option kind="vROUTER";
+option name="vrouter";
+option verbose_name="vRouter Service";
+
+message VRouterService (Service){
+     optional string rest_hostname = 1 [db_index = False, max_length = 255, null = True, content_type = "stripped", blank = True];
+     required int32 rest_port = 2 [default = 8181, null = False, db_index = False, blank = False];
+     required string rest_user = 3 [default = "onos", max_length = 255, content_type = "stripped", blank = False, null = False, db_index = False];
+     required string rest_pass = 4 [default = "rocks", max_length = 255, content_type = "stripped", blank = False, null = False, db_index = False];
+}
+
+message VRouterDevice (PlCoreBase){
+     optional string name = 1 [help_text = "device friendly name", max_length = 20, null = True, db_index = False, blank = True];
+     required string openflow_id = 2 [help_text = "device identifier in ONOS", max_length = 20, null = False, db_index = False, blank = False];
+     required string config_key = 3 [default = "basic", max_length = 32, blank = False, help_text = "configuration key", null = False, db_index = False];
+     required string driver = 4 [help_text = "driver type", max_length = 32, null = False, db_index = False, blank = False];
+     required manytoone vrouter_service->VRouterService:devices = 5 [db_index = True, null = False, blank = False];
+}
+
+message VRouterPort (PlCoreBase){
+     optional string name = 1 [help_text = "port friendly name", max_length = 20, null = True, db_index = False, blank = True];
+     required string openflow_id = 2 [help_text = "port identifier in ONOS", max_length = 21, null = False, db_index = False, blank = False];
+     required manytoone vrouter_device->VRouterDevice:ports = 3 [db_index = True, null = False, blank = False];
+     required manytoone vrouter_service->VRouterService:device_ports = 4 [db_index = True, null = False, blank = False];
+}
+
+message VRouterApp (PlCoreBase){
+     required manytoone vrouter_service->VRouterService:apps = 1 [db_index = True, null = False, blank = False];
+     required string name = 2 [help_text = "application name", max_length = 50, null = False, db_index = False, blank = False];
+     required string control_plane_connect_point = 3 [help_text = "port identifier in ONOS", max_length = 21, null = False, db_index = False, blank = False];
+     required bool ospf_enabled = 4 [help_text = "ospf enabled", default = True, null = False, db_index = False, blank = True];
+}
+
+message VRouterInterface (PlCoreBase) {
+     required manytoone vrouter_port->VRouterPort:interfaces = 1 [db_index = True, null = False, blank = False];
+     required string name = 2 [help_text = "interface name", max_length = 10, null = False, db_index = False, blank = False];
+     required string mac = 3 [help_text = "interface mac", max_length = 17, null = False, db_index = False, blank = False];
+     optional string vlan = 4 [help_text = "interface vlan id", max_length = 10, null = True, db_index = False, blank = True];
+}
+
+message VRouterIp (PlCoreBase){
+     optional string name = 1 [help_text = "ip friendly name", max_length = 20, null = True, db_index = False, blank = True];
+     required manytoone vrouter_interface->VRouterInterface:ips = 2 [db_index = True, null = False, blank = False];
+     required string ip = 3 [help_text = "interface ips", max_length = 19, null = False, db_index = False, blank = False];
+}
+
+message VRouterTenant (Tenant){
+     optional string public_ip = 1 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True];
+     optional string public_mac = 2 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True];
+     optional manytoone address_pool->AddressPool:vrouter_tenants = 3 [db_index = True, null = True, blank = True];
+}
