CORD-1092: Ported ONOS over to xproto

Change-Id: I416957ddb1431de41d1103210a2ba651e4e012b4
diff --git a/xos/models.py b/xos/models.py
index abec34a..085dbf9 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -1,59 +1,79 @@
-from django.db import models
-from core.models import Service, PlCoreBase, Slice, Instance, Tenant, TenantWithContainer, Node, Image, User, Flavor
-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
-import traceback
-from xos.exceptions import *
-from core.models import SlicePrivilege, SitePrivilege
-from sets import Set
+from header import *
 
-ONOS_KIND = "onos"
+
+
+from core.models import User#from core.models.tenant import Tenant
+from core.models import Tenant
+
+
+
+#from core.models.service import Service
+from core.models import Service
+
+
+
+
+
+class ONOSApp(Tenant):
+
+  KIND = "onos"
+
+  class Meta:
+      app_label = "onos"
+      name = "onos"
+      verbose_name = "ONOS Service"
+
+  # Primitive Fields (Not Relations)
+  install_dependencies = TextField( blank = True, null = True, db_index = False )
+  dependencies = TextField( blank = True, null = True, db_index = False )
+  
+
+  # Relations
+  
+  creator = ForeignKey(User, db_index = True, related_name = 'onos_apps', null = True, blank = True )
+
+  def __init__(self, *args, **kwargs):
+      onos_services = ONOSService.get_service_objects().all()
+      if onos_services:
+          self._meta.get_field("provider_service").default = onos_services[0].id
+      super(ONOSApp, self).__init__(*args, **kwargs)
+  
+  def save(self, *args, **kwargs):
+      if not self.creator:
+          if not getattr(self, "caller", None):
+              # caller must be set when creating a vCPE since it creates a slice
+              raise XOSProgrammingError("ONOSApp's self.caller was not set")
+          self.creator = self.caller
+          if not self.creator:
+              raise XOSProgrammingError("ONOSApp's self.creator was not set")
+  
+      super(ONOSApp, self).save(*args, **kwargs)
+  
+  pass
+
+
+
 
 class ONOSService(Service):
-    KIND = ONOS_KIND
 
-    class Meta:
-        app_label = "onos"
-        verbose_name = "ONOS Service"
+  KIND = "onos"
 
-    rest_hostname = StrippedCharField(max_length=255, null=True, blank=True)
-    rest_port = models.IntegerField(default=8181)
-    no_container = models.BooleanField(default=False)
-    node_key = StrippedCharField(max_length=1024, null=True, blank=True)
+  class Meta:
+      app_label = "onos"
+      name = "onos"
+      verbose_name = "ONOS Service"
 
-class ONOSApp(Tenant):   # aka 'ONOSTenant'
-    class Meta:
-        app_label = "onos"
+  # 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 )
+  no_container = BooleanField( default = False, null = False, blank = True, db_index = False )
+  node_key = StrippedCharField( db_index = False, max_length = 1024, null = True, blank = True )
+  
 
-    KIND = ONOS_KIND
+  # Relations
+  
 
-    install_dependencies = models.TextField(null=True, blank=True)
-    dependencies = models.TextField(null=True, blank=True)
-
-    # why is this necessary?
-    creator = models.ForeignKey(User, related_name='onos_apps', blank=True, null=True)
-
-    def __init__(self, *args, **kwargs):
-        onos_services = ONOSService.get_service_objects().all()
-        if onos_services:
-            self._meta.get_field("provider_service").default = onos_services[0].id
-        super(ONOSApp, self).__init__(*args, **kwargs)
-
-    def save(self, *args, **kwargs):
-        if not self.creator:
-            if not getattr(self, "caller", None):
-                # caller must be set when creating a vCPE since it creates a slice
-                raise XOSProgrammingError("ONOSApp's self.caller was not set")
-            self.creator = self.caller
-            if not self.creator:
-                raise XOSProgrammingError("ONOSApp's self.creator was not set")
-
-        super(ONOSApp, self).save(*args, **kwargs)
-
-
+  
+  pass