introduce Controller model
diff --git a/planetstack/core/models/__init__.py b/planetstack/core/models/__init__.py
index 2070e16..ae5c89b 100644
--- a/planetstack/core/models/__init__.py
+++ b/planetstack/core/models/__init__.py
@@ -5,15 +5,14 @@
 from .service import ServiceAttribute
 from .tag import Tag
 from .role import Role
-from .site import Site,Deployment, DeploymentRole, DeploymentPrivilege, SiteDeployments
+from .site import Site,Deployment, DeploymentRole, DeploymentPrivilege, SiteDeployments, ControllerSites
 from .dashboard import DashboardView
 from .user import User, UserDashboardView
 from .serviceclass import ServiceClass
-from .site import DeploymentLinkManager,DeploymentLinkDeletionManager
-from .slice import Slice, SliceDeployments
-from .site import SitePrivilege, SiteDeployments
-from .userdeployments import UserDeployments
-from .image import Image, ImageDeployments
+from .site import ControllerLinkManager,ControllerLinkDeletionManager
+from .slice import Slice, ControllerSlices
+from .controllerusers import ControllerUsers
+from .image import Image, ControllerImages
 from .node import Node
 from .serviceresource import ServiceResource
 from .slice import SliceRole
@@ -27,6 +26,6 @@
 from .sliver import Sliver
 from .reservation import ReservedResource
 from .reservation import Reservation
-from .network import Network, NetworkParameterType, NetworkParameter, NetworkSliver, NetworkTemplate, Router, NetworkSlice, NetworkDeployments
+from .network import Network, NetworkParameterType, NetworkParameter, NetworkSliver, NetworkTemplate, Router, NetworkSlice, ControllerNetworks
 from .billing import Account, Invoice, Charge, UsableObject, Payment
 
diff --git a/planetstack/core/models/controlleruser.py b/planetstack/core/models/controlleruser.py
new file mode 100644
index 0000000..5a3568a
--- /dev/null
+++ b/planetstack/core/models/controlleruser.py
@@ -0,0 +1,26 @@
+import os
+import datetime
+from collections import defaultdict
+from django.db import models
+from django.db.models import F, Q
+from core.models import PlCoreBase,User,Controller
+from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
+
+class ControllerUsers(PlCoreBase):
+    objects = ControllerLinkManager()
+    deleted_objects = ControllerLinkDeletionManager()
+
+    user = models.ForeignKey(User,related_name='controllerusers')
+    controller = models.ForeignKey(Controller,related_name='controllersusers')
+    kuser_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone user id")
+
+    def __unicode__(self):  return u'%s %s' % (self.controller, self.user)
+
+    @staticmethod
+    def select_by_user(user):
+        if user.is_admin:
+            qs = ControllerUsers.objects.all()
+        else:
+            users = Users.select_by_user(user)
+            qs = ControllerUsers.objects.filter(user__in=users)
+        return qs
diff --git a/planetstack/core/models/image.py b/planetstack/core/models/image.py
index fdeb2cc..a7b63b6 100644
--- a/planetstack/core/models/image.py
+++ b/planetstack/core/models/image.py
@@ -1,8 +1,7 @@
 import os
 from django.db import models
 from core.models import PlCoreBase
-from core.models import Deployment
-from core.models import Deployment,DeploymentLinkManager,DeploymentLinkDeletionManager
+from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
 
 # Create your models here.
 
@@ -14,13 +13,13 @@
 
     def __unicode__(self):  return u'%s' % (self.name)
 
-class ImageDeployments(PlCoreBase):
-    objects = DeploymentLinkManager()
-    deleted_objects = DeploymentLinkDeletionManager()
-    image = models.ForeignKey(Image,related_name='imagedeployments')
-    deployment = models.ForeignKey(Deployment,related_name='imagedeployments')
+class ControllerImages(PlCoreBase):
+    objects = ControllerLinkManager()
+    deleted_objects = ControllerLinkDeletionManager()
+    image = models.ForeignKey(Image,related_name='controllerimages')
+    controller = models.ForeignKey(Controller,related_name='controllerimages')
     glance_image_id = models.CharField(null=True, blank=True, max_length=200, help_text="Glance image id") 
 
-    def __unicode__(self):  return u'%s %s' % (self.image, self.deployment)
+    def __unicode__(self):  return u'%s %s' % (self.image, self.controller)
 
     
diff --git a/planetstack/core/models/network.py b/planetstack/core/models/network.py
index 0b3400a..d2e6411 100644
--- a/planetstack/core/models/network.py
+++ b/planetstack/core/models/network.py
@@ -1,8 +1,8 @@
 import os
 import socket
 from django.db import models
-from core.models import PlCoreBase, Site, Slice, Sliver, Deployment
-from core.models import DeploymentLinkManager,DeploymentLinkDeletionManager
+from core.models import PlCoreBase, Site, Slice, Sliver, Controller
+from core.models import ControllerLinkManager,ControllerLinkDeletionManager
 from django.contrib.contenttypes.models import ContentType
 from django.contrib.contenttypes import generic
 from django.core.exceptions import ValidationError
@@ -128,13 +128,13 @@
             qs = Network.objects.filter(owner__in=slices)
         return qs
 
-class NetworkDeployments(PlCoreBase):
-    objects = DeploymentLinkManager()
-    deleted_objects = DeploymentLinkDeletionManager()
+class ControllerNetworks(PlCoreBase):
+    objects = ControllerLinkManager()
+    deleted_objects = ControllerLinkDeletionManager()
 
-    # Stores the openstack ids at various deployments
-    network = models.ForeignKey(Network, related_name='networkdeployments')
-    deployment = models.ForeignKey(Deployment, related_name='networkdeployments')
+    # Stores the openstack ids at various controllers
+    network = models.ForeignKey(Network, related_name='controllernetworks')
+    controller = models.ForeignKey(Controller, related_name='controllernetworks')
     net_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum network")
     router_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum router id")
     subnet_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum subnet id")
@@ -146,11 +146,11 @@
     @staticmethod
     def select_by_user(user):
         if user.is_admin:
-            qs = NetworkDeployments.objects.all()
+            qs = NetworkControllers.objects.all()
         else:
             slices = Slice.select_by_user(user)
             networks = Network.objects.filter(owner__in=slices)
-            qs = NetworkDeployments.objects.filter(network__in=networks)
+            qs = NetworkControllers.objects.filter(network__in=networks)
         return qs
 
 class NetworkSlice(PlCoreBase):
diff --git a/planetstack/core/models/node.py b/planetstack/core/models/node.py
index 9271268..903c25f 100644
--- a/planetstack/core/models/node.py
+++ b/planetstack/core/models/node.py
@@ -1,7 +1,7 @@
 import os
 from django.db import models
 from core.models import PlCoreBase
-from core.models import Site,Deployment
+from core.models import SiteDeployment, Controller
 from core.models import Tag
 from django.contrib.contenttypes import generic
 
@@ -9,8 +9,7 @@
 
 class Node(PlCoreBase):
     name = models.CharField(max_length=200, unique=True, help_text="Name of the Node")
-    site  = models.ForeignKey(Site, related_name='nodes')
-    deployment = models.ForeignKey(Deployment, related_name='nodes')
+    site_deployment = models.ForeignKey(SiteDeployment, related_name='nodes')
     tags = generic.GenericRelation(Tag)
 
     def __unicode__(self):  return u'%s' % (self.name)
diff --git a/planetstack/core/models/serviceclass.py b/planetstack/core/models/serviceclass.py
index c339b67..4268568 100644
--- a/planetstack/core/models/serviceclass.py
+++ b/planetstack/core/models/serviceclass.py
@@ -1,8 +1,6 @@
 import os
 from django.db import models
 from core.models import PlCoreBase
-from core.models import Site
-from core.models import Deployment
 
 def get_default_serviceclass():
     try:
diff --git a/planetstack/core/models/serviceresource.py b/planetstack/core/models/serviceresource.py
index 2f88dc9..d5c86cd 100644
--- a/planetstack/core/models/serviceresource.py
+++ b/planetstack/core/models/serviceresource.py
@@ -1,8 +1,6 @@
 import os
 from django.db import models
 from core.models import PlCoreBase
-from core.models import Site
-from core.models import Deployment
 from core.models import ServiceClass
 
 # Create your models here.
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index 2404e34..5381a08 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -10,7 +10,7 @@
 
 config = Config()
 
-class DeploymentLinkDeletionManager(PlCoreBaseDeletionManager):
+class ControllerLinkDeletionManager(PlCoreBaseDeletionManager):
     def get_queryset(self):
         parent=super(DeploymentLinkDeletionManager, self)
         try:
@@ -20,7 +20,7 @@
 
         parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
         if (backend_type):
-            return parent_queryset.filter(Q(deployment__backend_type=backend_type))
+            return parent_queryset.filter(Q(controller__backend_type=backend_type))
         else:
             return parent_queryset
 
@@ -29,9 +29,9 @@
         return self.get_queryset()
 
 
-class DeploymentDeletionManager(PlCoreBaseDeletionManager):
+class ControllerDeletionManager(PlCoreBaseDeletionManager):
     def get_queryset(self):
-        parent=super(DeploymentDeletionManager, self)
+        parent=super(ControllerDeletionManager, self)
 
         try:
             backend_type = config.observer_backend_type
@@ -49,9 +49,9 @@
     def get_query_set(self):
         return self.get_queryset()
 
-class DeploymentLinkManager(PlCoreBaseManager):
+class ControllerLinkManager(PlCoreBaseManager):
     def get_queryset(self):
-        parent=super(DeploymentLinkManager, self)
+        parent=super(ControllerLinkManager, self)
 
         try:
             backend_type = config.observer_backend_type
@@ -61,7 +61,7 @@
         parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
 
         if backend_type:
-            return parent_queryset.filter(Q(deployment__backend_type=backend_type))
+            return parent_queryset.filter(Q(controller__backend_type=backend_type))
         else:
             return parent_queryset
 
@@ -70,7 +70,7 @@
         return self.get_queryset()
 
 
-class DeploymentManager(PlCoreBaseManager):
+class ControllerManager(PlCoreBaseManager):
     def get_queryset(self):
         parent=super(DeploymentManager, self)
 
@@ -166,15 +166,15 @@
         return qs
 
 class Deployment(PlCoreBase):
-    objects = DeploymentManager()
-    deleted_objects = DeploymentDeletionManager()
+    #objects = DeploymentManager()
+    #deleted_objects = DeploymentDeletionManager()
     name = models.CharField(max_length=200, unique=True, help_text="Name of the Deployment")
-    admin_user = models.CharField(max_length=200, null=True, blank=True, help_text="Username of an admin user at this deployment")
-    admin_password = models.CharField(max_length=200, null=True, blank=True, help_text="Password of theadmin user at this deployment")

-    admin_tenant = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to")

-    auth_url = models.CharField(max_length=200, null=True, blank=True, help_text="Auth url for the deployment")
-    backend_type = models.CharField(max_length=200, null=True, blank=True, help_text="Type of deployment, e.g. EC2, OpenStack, or OpenStack version")
-    availability_zone = models.CharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone")
+    #admin_user = models.CharField(max_length=200, null=True, blank=True, help_text="Username of an admin user at this deployment")
+    #admin_password = models.CharField(max_length=200, null=True, blank=True, help_text="Password of theadmin user at this deployment")

+    #admin_tenant = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to")

+    #auth_url = models.CharField(max_length=200, null=True, blank=True, help_text="Auth url for the deployment")
+    #backend_type = models.CharField(max_length=200, null=True, blank=True, help_text="Type of deployment, e.g. EC2, OpenStack, or OpenStack version")
+    #availability_zone = models.CharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone")
 
     # smbaker: the default of 'allow all' is intended for evolutions of existing
     #    deployments. When new deployments are created via the GUI, they are
@@ -216,7 +216,7 @@
 
     def __unicode__(self):  return u'%s' % (self.name)
 
-class DeploymentRole(PlCoreBase):
+class ControllerRole(PlCoreBase):
     #objects = DeploymentLinkManager()
     #deleted_objects = DeploymentLinkDeletionManager()
 
@@ -225,45 +225,63 @@
 
     def __unicode__(self):  return u'%s' % (self.role)
 
-class DeploymentPrivilege(PlCoreBase):
-    objects = DeploymentLinkManager()
-    deleted_objects = DeploymentLinkDeletionManager()
+class ControllerPrivilege(PlCoreBase):
+    objects = ControllerLinkManager()
+    deleted_objects = ControllerLinkDeletionManager()
 
-    user = models.ForeignKey('User', related_name='deploymentprivileges')
-    deployment = models.ForeignKey('Deployment', related_name='deploymentprivileges')
-    role = models.ForeignKey('DeploymentRole',related_name='deploymentprivileges')
+    user = models.ForeignKey('User', related_name='controllerprivileges')
+    controller = models.ForeignKey('Controller', related_name='controllerprivileges')
+    role = models.ForeignKey('ControllerRole',related_name='controllerprivileges')
 
-    def __unicode__(self):  return u'%s %s %s' % (self.deployment, self.user, self.role)
+    def __unicode__(self):  return u'%s %s %s' % (self.controller, self.user, self.role)
 
     def can_update(self, user):
         if user.is_readonly:
             return False
         if user.is_admin:
             return True
-        dprivs = DeploymentPrivilege.objects.filter(user=user)
-        for dpriv in dprivs:
-            if dpriv.role.role == 'admin':
+        cprivs = ControllerPrivilege.objects.filter(user=user)
+        for cpriv in dprivs:
+            if cpriv.role.role == 'admin':
                 return True
         return False
 
     @staticmethod
     def select_by_user(user):
         if user.is_admin:
-            qs = DeploymentPrivilege.objects.all()
+            qs = ControllerPrivilege.objects.all()
         else:
-            dpriv_ids = [dp.id for dp in DeploymentPrivilege.objects.filter(user=user)]
-            qs = DeploymentPrivilege.objects.filter(id__in=dpriv_ids)
+            cpriv_ids = [cp.id for cp in ControllerPrivilege.objects.filter(user=user)]
+            qs = ControllerPrivilege.objects.filter(id__in=cpriv_ids)
         return qs 
 
 class SiteDeployments(PlCoreBase):
-    objects = DeploymentLinkManager()
-    deleted_objects = DeploymentLinkDeletionManager()
+    #objects = DeploymentLinkManager()
+    #deleted_objects = DeploymentLinkDeletionManager()
+    objects = ControllerManager()
+    deleted_objects = ControllerDeletionManager()
 
     site = models.ForeignKey(Site,related_name='sitedeployments')
     deployment = models.ForeignKey(Deployment,related_name='sitedeployments')
-    tenant_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone tenant id")    
+    availability_zone = models.CharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone")
+    #tenant_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone tenant id")    
+    def __unicode__(self):  return u'%s %s' % (self.deployment, self.site)
 
-    #class Meta:
-    #    db_table = 'core_site_deployments'
-    #    #auto_created = Site
+class Controller(PlCoreBase):
+    site_deployment = models.ForeignKey(SiteDeployments,related_name='controller')
 
+    backend_type = models.CharField(max_length=200, null=True, blank=True, help_text="Type of compute controller, e.g. EC2, OpenStack, or OpenStack version")
+    auth_url = models.CharField(max_length=200, null=True, blank=True, help_text="Auth url for the compute controller")
+    admin_user = models.CharField(max_length=200, null=True, blank=True, help_text="Username of an admin user at this controller")
+    admin_password = models.CharField(max_length=200, null=True, blank=True, help_text="Password of theadmin user at this controller")
+    admin_tenant = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to")
+
+    def __unicode__(self):  return u'%s %s' % (self.site_deployment, self.backend_type)
+
+class ControllerSites(PlCoreBase):
+    objects = ControllerLinkManager()
+    deleted_objects = ControllerLinkDeletionManager() 
+
+    controller = models.ForeignKey(Controller, related_name='controllersites')
+    site_deployment = models.ForeignKey(SiteDeployments, related_name='controllersites')
+    tenant_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone tenant id")
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index 6e1d163..8854a75 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -5,13 +5,13 @@
 from core.models.site import SitePrivilege
 from core.models import User
 from core.models import Role
-from core.models import Deployment,DeploymentLinkManager,DeploymentLinkDeletionManager
+from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
 from core.models import ServiceClass
 from core.models.serviceclass import get_default_serviceclass
 from core.models import Tag
 from django.contrib.contenttypes import generic
 from core.models import Service
-from core.models import Deployment
+from core.models import Controller
 from django.core.exceptions import ValidationError
 
 # Create your models here.
@@ -92,9 +92,9 @@
         from core.models.network import Network
         nets = Network.objects.filter(slices=self)
         nets.delete() 
-        # delete slice deployments
-        slice_deployments = SliceDeployments.objects.filter(slice=self)
-        slice_deployments.delete()
+        # delete slice controllers
+        slice_controllers = ControllerSlices.objects.filter(slice=self)
+        slice_controllers.delete()
         # delete slice privilege
         slice_privileges = SlicePrivilege.objects.filter(slice=self)
         slice_privileges.delete() 
@@ -128,26 +128,23 @@
             qs = SlicePrivilege.objects.filter(id__in=sp_ids)
         return qs
 
-class SliceDeployments(PlCoreBase):
-    objects = DeploymentLinkManager()
-    deleted_objects = DeploymentLinkDeletionManager()
+class ControllerSlices(PlCoreBase):
+    objects = ControllerLinkManager()
+    deleted_objects = ControllerLinkDeletionManager()
 
-    slice = models.ForeignKey(Slice, related_name='slicedeployments')
-    deployment = models.ForeignKey(Deployment, related_name='slicedeployments')
+    controller = models.ForeignKey(Controller, related_name='controllerslices')
+    slice = models.ForeignKey(Slice, related_name='controllerslices')
     tenant_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone tenant id")
-    network_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum network")
-    router_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum router id")
-    subnet_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum subnet id")
 
-    def __unicode__(self):  return u'%s %s'  % (self.slice, self.deployment)
+    def __unicode__(self):  return u'%s %s'  % (self.slice, self.controller)
 
     @staticmethod
     def select_by_user(user):
         if user.is_admin:
-            qs = SliceDeployments.objects.all()
+            qs = ControllerSlices.objects.all()
         else:
             slices = Slice.select_by_user(user)
-            qs = SliceDeployments.objects.filter(slice__in=slices)
+            qs = ControllerSlices.objects.filter(slice__in=slices)
         return qs    
 
     def get_cpu_stats(self):
diff --git a/planetstack/core/models/sliver.py b/planetstack/core/models/sliver.py
index 601afbb..c4789d6 100644
--- a/planetstack/core/models/sliver.py
+++ b/planetstack/core/models/sliver.py
@@ -46,7 +46,7 @@
 
         parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
         if (backend_type):
-            return parent_queryset.filter(Q(node__deployment__backend_type=backend_type))
+            return parent_queryset.filter(Q(node__controller__backend_type=backend_type))
         else:
             return parent_queryset
 
@@ -67,7 +67,7 @@
         parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
 
         if backend_type:
-            return parent_queryset.filter(Q(node__deployment__backend_type=backend_type))
+            return parent_queryset.filter(Q(node__controller__backend_type=backend_type))
         else:
             return parent_queryset
 
diff --git a/planetstack/core/models/user.py b/planetstack/core/models/user.py
index 7063f4f..42ea652 100644
--- a/planetstack/core/models/user.py
+++ b/planetstack/core/models/user.py
@@ -4,7 +4,6 @@
 from django.db import models
 from django.db.models import F, Q
 from core.models import PlCoreBase,Site, DashboardView, DiffModelMixIn
-from core.models.site import Deployment
 from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
 from timezones.fields import TimeZoneField
 from operator import itemgetter, attrgetter
diff --git a/planetstack/core/models/userdeployments.py b/planetstack/core/models/userdeployments.py
deleted file mode 100644
index d8051bf..0000000
--- a/planetstack/core/models/userdeployments.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import os
-import datetime
-from collections import defaultdict
-from django.db import models
-from django.db.models import F, Q
-from core.models import PlCoreBase,Site,User,Deployment
-from core.models import Deployment,DeploymentLinkManager,DeploymentLinkDeletionManager
-
-class UserDeployments(PlCoreBase):
-    objects = DeploymentLinkManager()
-    deleted_objects = DeploymentLinkDeletionManager()
-
-    user = models.ForeignKey(User,related_name='userdeployments')
-    deployment = models.ForeignKey(Deployment,related_name='userdeployments')
-    kuser_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone user id")
-
-    def __unicode__(self):  return u'%s %s' % (self.user, self.deployment.name)
-
-    @staticmethod
-    def select_by_user(user):
-        if user.is_admin:
-            qs = UserDeployments.objects.all()
-        else:
-            users = Users.select_by_user(user)
-            qs = Usereployments.objects.filter(user__in=slices)
-        return qs