diff --git a/planetstack/apigen/modelgen b/planetstack/apigen/modelgen
old mode 100644
new mode 100755
diff --git a/planetstack/genapi.py b/planetstack/genapi.py
index 880587c..3e6f7b0 100644
--- a/planetstack/genapi.py
+++ b/planetstack/genapi.py
@@ -28,9 +28,15 @@
     return patterns('',
         url(r'^plstackapi/$', api_root),
     
+        url(r'plstackapi/flavors/$', FlavorList.as_view(), name='flavor-list'),
+        url(r'plstackapi/flavors/(?P<pk>[a-zA-Z0-9\-]+)/$', FlavorDetail.as_view(), name ='flavor-detail'),
+    
         url(r'plstackapi/serviceattributes/$', ServiceAttributeList.as_view(), name='serviceattribute-list'),
         url(r'plstackapi/serviceattributes/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceAttributeDetail.as_view(), name ='serviceattribute-detail'),
     
+        url(r'plstackapi/controllerimages/$', ControllerImagesList.as_view(), name='controllerimages-list'),
+        url(r'plstackapi/controllerimages/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerImagesDetail.as_view(), name ='controllerimages-detail'),
+    
         url(r'plstackapi/images/$', ImageList.as_view(), name='image-list'),
         url(r'plstackapi/images/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDetail.as_view(), name ='image-detail'),
     
@@ -55,15 +61,12 @@
         url(r'plstackapi/planetstackroles/$', PlanetStackRoleList.as_view(), name='planetstackrole-list'),
         url(r'plstackapi/planetstackroles/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackRoleDetail.as_view(), name ='planetstackrole-detail'),
     
+        url(r'plstackapi/controllerprivileges/$', ControllerPrivilegeList.as_view(), name='controllerprivilege-list'),
+        url(r'plstackapi/controllerprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerPrivilegeDetail.as_view(), name ='controllerprivilege-detail'),
+    
         url(r'plstackapi/networkslivers/$', NetworkSliverList.as_view(), name='networksliver-list'),
         url(r'plstackapi/networkslivers/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliverDetail.as_view(), name ='networksliver-detail'),
     
-        url(r'plstackapi/controllernetworks/$', ControllerNetworksList.as_view(), name='controllernetworks-list'),
-        url(r'plstackapi/controllernetworks/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerNetworksDetail.as_view(), name ='controllernetworks-detail'),
-    
-        url(r'plstackapi/flavors/$', FlavorList.as_view(), name='flavor-list'),
-        url(r'plstackapi/flavors/(?P<pk>[a-zA-Z0-9\-]+)/$', FlavorDetail.as_view(), name ='flavor-detail'),
-    
         url(r'plstackapi/projects/$', ProjectList.as_view(), name='project-list'),
         url(r'plstackapi/projects/(?P<pk>[a-zA-Z0-9\-]+)/$', ProjectDetail.as_view(), name ='project-detail'),
     
@@ -79,8 +82,8 @@
         url(r'plstackapi/serviceclasses/$', ServiceClassList.as_view(), name='serviceclass-list'),
         url(r'plstackapi/serviceclasses/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceClassDetail.as_view(), name ='serviceclass-detail'),
     
-        url(r'plstackapi/payments/$', PaymentList.as_view(), name='payment-list'),
-        url(r'plstackapi/payments/(?P<pk>[a-zA-Z0-9\-]+)/$', PaymentDetail.as_view(), name ='payment-detail'),
+        url(r'plstackapi/controllernetworks/$', ControllerNetworksList.as_view(), name='controllernetworks-list'),
+        url(r'plstackapi/controllernetworks/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerNetworksDetail.as_view(), name ='controllernetworks-detail'),
     
         url(r'plstackapi/charges/$', ChargeList.as_view(), name='charge-list'),
         url(r'plstackapi/charges/(?P<pk>[a-zA-Z0-9\-]+)/$', ChargeDetail.as_view(), name ='charge-detail'),
@@ -91,6 +94,9 @@
         url(r'plstackapi/usableobjects/$', UsableObjectList.as_view(), name='usableobject-list'),
         url(r'plstackapi/usableobjects/(?P<pk>[a-zA-Z0-9\-]+)/$', UsableObjectDetail.as_view(), name ='usableobject-detail'),
     
+        url(r'plstackapi/controllersitedeploymentses/$', ControllerSiteDeploymentsList.as_view(), name='controllersitedeployments-list'),
+        url(r'plstackapi/controllersitedeploymentses/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSiteDeploymentsDetail.as_view(), name ='controllersitedeployments-detail'),
+    
         url(r'plstackapi/site_roles/$', SiteRoleList.as_view(), name='siterole-list'),
         url(r'plstackapi/site_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteRoleDetail.as_view(), name ='siterole-detail'),
     
@@ -106,18 +112,27 @@
         url(r'plstackapi/dashboardviews/$', DashboardViewList.as_view(), name='dashboardview-list'),
         url(r'plstackapi/dashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', DashboardViewDetail.as_view(), name ='dashboardview-detail'),
     
-        url(r'plstackapi/controllerimages/$', ControllerImagesList.as_view(), name='controllerimages-list'),
-        url(r'plstackapi/controllerimages/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerImagesDetail.as_view(), name ='controllerimages-detail'),
+        url(r'plstackapi/imagedeploymentses/$', ImageDeploymentsList.as_view(), name='imagedeployments-list'),
+        url(r'plstackapi/imagedeploymentses/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentsDetail.as_view(), name ='imagedeployments-detail'),
     
         url(r'plstackapi/reservedresources/$', ReservedResourceList.as_view(), name='reservedresource-list'),
         url(r'plstackapi/reservedresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservedResourceDetail.as_view(), name ='reservedresource-detail'),
     
+        url(r'plstackapi/payments/$', PaymentList.as_view(), name='payment-list'),
+        url(r'plstackapi/payments/(?P<pk>[a-zA-Z0-9\-]+)/$', PaymentDetail.as_view(), name ='payment-detail'),
+    
+        url(r'plstackapi/networktemplates/$', NetworkTemplateList.as_view(), name='networktemplate-list'),
+        url(r'plstackapi/networktemplates/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkTemplateDetail.as_view(), name ='networktemplate-detail'),
+    
         url(r'plstackapi/networkslices/$', NetworkSliceList.as_view(), name='networkslice-list'),
         url(r'plstackapi/networkslices/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliceDetail.as_view(), name ='networkslice-detail'),
     
         url(r'plstackapi/userdashboardviews/$', UserDashboardViewList.as_view(), name='userdashboardview-list'),
         url(r'plstackapi/userdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDashboardViewDetail.as_view(), name ='userdashboardview-detail'),
     
+        url(r'plstackapi/controllers/$', ControllerList.as_view(), name='controller-list'),
+        url(r'plstackapi/controllers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDetail.as_view(), name ='controller-detail'),
+    
         url(r'plstackapi/planetstackprivileges/$', PlanetStackPrivilegeList.as_view(), name='planetstackprivilege-list'),
         url(r'plstackapi/planetstackprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackPrivilegeDetail.as_view(), name ='planetstackprivilege-detail'),
     
@@ -126,38 +141,36 @@
     
         url(r'plstackapi/deployments/$', DeploymentList.as_view(), name='deployment-list'),
         url(r'plstackapi/deployments/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentDetail.as_view(), name ='deployment-detail'),
-        url(r'plstackapi/Controller/$', ControllerList.as_view(), name='controller-list'),
-        url(r'plstackapi/Controller/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDetail.as_view(), name ='controller-detail'),
     
         url(r'plstackapi/reservations/$', ReservationList.as_view(), name='reservation-list'),
         url(r'plstackapi/reservations/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservationDetail.as_view(), name ='reservation-detail'),
     
-        url(r'plstackapi/controllerslices/$', ControllerSlicesList.as_view(), name='controllerslices-list'),
-        url(r'plstackapi/controllerslices/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSlicesDetail.as_view(), name ='controllerslices-detail'),
-    
         url(r'plstackapi/siteprivileges/$', SitePrivilegeList.as_view(), name='siteprivilege-list'),
         url(r'plstackapi/siteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SitePrivilegeDetail.as_view(), name ='siteprivilege-detail'),
     
         url(r'plstackapi/planetstacks/$', PlanetStackList.as_view(), name='planetstack-list'),
         url(r'plstackapi/planetstacks/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackDetail.as_view(), name ='planetstack-detail'),
     
-        url(r'plstackapi/controllerusers/$', ControllerUsersList.as_view(), name='controllerusers-list'),
-        url(r'plstackapi/controllerusers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerUsersDetail.as_view(), name ='controllerusers-detail'),
-    
         url(r'plstackapi/accounts/$', AccountList.as_view(), name='account-list'),
         url(r'plstackapi/accounts/(?P<pk>[a-zA-Z0-9\-]+)/$', AccountDetail.as_view(), name ='account-detail'),
     
+        url(r'plstackapi/controllerroles/$', ControllerRoleList.as_view(), name='controllerrole-list'),
+        url(r'plstackapi/controllerroles/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerRoleDetail.as_view(), name ='controllerrole-detail'),
+    
         url(r'plstackapi/networkparametertypes/$', NetworkParameterTypeList.as_view(), name='networkparametertype-list'),
         url(r'plstackapi/networkparametertypes/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterTypeDetail.as_view(), name ='networkparametertype-detail'),
     
         url(r'plstackapi/sitecredentials/$', SiteCredentialList.as_view(), name='sitecredential-list'),
         url(r'plstackapi/sitecredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteCredentialDetail.as_view(), name ='sitecredential-detail'),
     
-        url(r'plstackapi/controllerprivileges/$', ControllerPrivilegeList.as_view(), name='controllerprivilege-list'),
-        url(r'plstackapi/controllerprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerPrivilegeDetail.as_view(), name ='controllerprivilege-detail'),
+        url(r'plstackapi/deploymentprivileges/$', DeploymentPrivilegeList.as_view(), name='deploymentprivilege-list'),
+        url(r'plstackapi/deploymentprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentPrivilegeDetail.as_view(), name ='deploymentprivilege-detail'),
     
-        url(r'plstackapi/controllerroles/$', ControllerRoleList.as_view(), name='controllerrole-list'),
-        url(r'plstackapi/controllerroles/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerRoleDetail.as_view(), name ='controllerrole-detail'),
+        url(r'plstackapi/controllerusers/$', ControllerUsersList.as_view(), name='controllerusers-list'),
+        url(r'plstackapi/controllerusers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerUsersDetail.as_view(), name ='controllerusers-detail'),
+    
+        url(r'plstackapi/deploymentroles/$', DeploymentRoleList.as_view(), name='deploymentrole-list'),
+        url(r'plstackapi/deploymentroles/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentRoleDetail.as_view(), name ='deploymentrole-detail'),
     
         url(r'plstackapi/usercredentials/$', UserCredentialList.as_view(), name='usercredential-list'),
         url(r'plstackapi/usercredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', UserCredentialDetail.as_view(), name ='usercredential-detail'),
@@ -168,8 +181,8 @@
         url(r'plstackapi/slicetags/$', SliceTagList.as_view(), name='slicetag-list'),
         url(r'plstackapi/slicetags/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceTagDetail.as_view(), name ='slicetag-detail'),
     
-        url(r'plstackapi/networktemplates/$', NetworkTemplateList.as_view(), name='networktemplate-list'),
-        url(r'plstackapi/networktemplates/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkTemplateDetail.as_view(), name ='networktemplate-detail'),
+        url(r'plstackapi/controllerdashboards/$', ControllerDashboardList.as_view(), name='controllerdashboard-list'),
+        url(r'plstackapi/controllerdashboards/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDashboardDetail.as_view(), name ='controllerdashboard-detail'),
     
         url(r'plstackapi/routers/$', RouterList.as_view(), name='router-list'),
         url(r'plstackapi/routers/(?P<pk>[a-zA-Z0-9\-]+)/$', RouterDetail.as_view(), name ='router-detail'),
@@ -177,12 +190,17 @@
         url(r'plstackapi/serviceresources/$', ServiceResourceList.as_view(), name='serviceresource-list'),
         url(r'plstackapi/serviceresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceResourceDetail.as_view(), name ='serviceresource-detail'),
     
+        url(r'plstackapi/controllerslices/$', ControllerSlicesList.as_view(), name='controllerslices-list'),
+        url(r'plstackapi/controllerslices/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSlicesDetail.as_view(), name ='controllerslices-detail'),
+    
     )
 
 @api_view(['GET'])
 def api_root(request, format=None):
     return Response({
+        'flavors': reverse('flavor-list', request=request, format=format),
         'serviceattributes': reverse('serviceattribute-list', request=request, format=format),
+        'controllerimageses': reverse('controllerimages-list', request=request, format=format),
         'images': reverse('image-list', request=request, format=format),
         'networkparameters': reverse('networkparameter-list', request=request, format=format),
         'sites': reverse('site-list', request=request, format=format),
@@ -191,53 +209,150 @@
         'invoices': reverse('invoice-list', request=request, format=format),
         'sliceprivileges': reverse('sliceprivilege-list', request=request, format=format),
         'planetstackroles': reverse('planetstackrole-list', request=request, format=format),
+        'controllerprivileges': reverse('controllerprivilege-list', request=request, format=format),
         'networkslivers': reverse('networksliver-list', request=request, format=format),
-        'controllernetworkses': reverse('controllernetworks-list', request=request, format=format),
-        'flavors': reverse('flavor-list', request=request, format=format),
         'projects': reverse('project-list', request=request, format=format),
         'slices': reverse('slice-list', request=request, format=format),
         'networks': reverse('network-list', request=request, format=format),
         'services': reverse('service-list', request=request, format=format),
         'serviceclasses': reverse('serviceclass-list', request=request, format=format),
-        'payments': reverse('payment-list', request=request, format=format),
+        'controllernetworkses': reverse('controllernetworks-list', request=request, format=format),
         'charges': reverse('charge-list', request=request, format=format),
         'roles': reverse('role-list', request=request, format=format),
         'usableobjects': reverse('usableobject-list', request=request, format=format),
+        'controllersitedeploymentses': reverse('controllersitedeployments-list', request=request, format=format),
         'siteroles': reverse('siterole-list', request=request, format=format),
         'slicecredentials': reverse('slicecredential-list', request=request, format=format),
         'slivers': reverse('sliver-list', request=request, format=format),
         'nodes': reverse('node-list', request=request, format=format),
         'dashboardviews': reverse('dashboardview-list', request=request, format=format),
-        'controllerimageses': reverse('controllerimages-list', request=request, format=format),
+        'imagedeploymentses': reverse('imagedeployments-list', request=request, format=format),
         'reservedresources': reverse('reservedresource-list', request=request, format=format),
+        'payments': reverse('payment-list', request=request, format=format),
+        'networktemplates': reverse('networktemplate-list', request=request, format=format),
         'networkslices': reverse('networkslice-list', request=request, format=format),
         'userdashboardviews': reverse('userdashboardview-list', request=request, format=format),
+        'controllers': reverse('controller-list', request=request, format=format),
         'planetstackprivileges': reverse('planetstackprivilege-list', request=request, format=format),
         'users': reverse('user-list', request=request, format=format),
         'deployments': reverse('deployment-list', request=request, format=format),
-        'controllers': reverse('controller-list', request=request, format=format),
         'reservations': reverse('reservation-list', request=request, format=format),
-        'controllersliceses': reverse('controllerslices-list', request=request, format=format),
         'siteprivileges': reverse('siteprivilege-list', request=request, format=format),
         'planetstacks': reverse('planetstack-list', request=request, format=format),
-        'controlleruserses': reverse('controllerusers-list', request=request, format=format),
         'accounts': reverse('account-list', request=request, format=format),
+        'controllerroles': reverse('controllerrole-list', request=request, format=format),
         'networkparametertypes': reverse('networkparametertype-list', request=request, format=format),
         'sitecredentials': reverse('sitecredential-list', request=request, format=format),
-        'controllerprivileges': reverse('controllerprivilege-list', request=request, format=format),
-        'controllerroles': reverse('controllerrole-list', request=request, format=format),
+        'deploymentprivileges': reverse('deploymentprivilege-list', request=request, format=format),
+        'controlleruserses': reverse('controllerusers-list', request=request, format=format),
+        'deploymentroles': reverse('deploymentrole-list', request=request, format=format),
         'usercredentials': reverse('usercredential-list', request=request, format=format),
         'sitedeploymentses': reverse('sitedeployments-list', request=request, format=format),
-        'controllersiteses': reverse('controllersites-list', request=request, format=format),
         'slicetags': reverse('slicetag-list', request=request, format=format),
-        'networktemplates': reverse('networktemplate-list', request=request, format=format),
+        'controllerdashboards': reverse('controllerdashboard-list', request=request, format=format),
         'routers': reverse('router-list', request=request, format=format),
         'serviceresources': reverse('serviceresource-list', request=request, format=format),
+        'controllersliceses': reverse('controllerslices-list', request=request, format=format),
         
     })
 
 # Based on serializers.py
 
+class XOSModelSerializer(serializers.ModelSerializer):
+    def save_object(self, obj, **kwargs):
+
+        """ rest_framework can't deal with ManyToMany relations that have a
+            through table. In plstackapi, most of the through tables we have
+            use defaults or blank fields, so there's no reason why we shouldn't
+            be able to save these objects.
+
+            So, let's strip out these m2m relations, and deal with them ourself.
+        """
+        obj._complex_m2m_data={};
+        if getattr(obj, '_m2m_data', None):
+            for relatedObject in obj._meta.get_all_related_many_to_many_objects():
+                if (relatedObject.field.rel.through._meta.auto_created):
+                    # These are non-trough ManyToMany relations and
+                    # can be updated just fine
+                    continue
+                fieldName = relatedObject.get_accessor_name()
+                if fieldName in obj._m2m_data.keys():
+                    obj._complex_m2m_data[fieldName] = (relatedObject, obj._m2m_data[fieldName])
+                    del obj._m2m_data[fieldName]
+
+        serializers.ModelSerializer.save_object(self, obj, **kwargs);
+
+        for (accessor, stuff) in obj._complex_m2m_data.items():
+            (relatedObject, data) = stuff
+            through = relatedObject.field.rel.through
+            local_fieldName = relatedObject.field.m2m_reverse_field_name()
+            remote_fieldName = relatedObject.field.m2m_field_name()
+
+            # get the current set of existing relations
+            existing = through.objects.filter(**{local_fieldName: obj});
+
+            data_ids = [item.id for item in data]
+            existing_ids = [getattr(item,remote_fieldName).id for item in existing]
+
+            #print "data_ids", data_ids
+            #print "existing_ids", existing_ids
+
+            # remove relations that are in 'existing' but not in 'data'
+            for item in list(existing):
+               if (getattr(item,remote_fieldName).id not in data_ids):
+                   print "delete", getattr(item,remote_fieldName)
+                   item.delete() #(purge=True)
+
+            # add relations that are in 'data' but not in 'existing'
+            for item in data:
+               if (item.id not in existing_ids):
+                   #print "add", item
+                   newModel = through(**{local_fieldName: obj, remote_fieldName: item})
+                   newModel.save()
+
+
+
+class FlavorSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    
+    deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail')
+    
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = Flavor
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default','deployments',)
+
+class FlavorIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    
+    deployments = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='deployment-detail')
+    
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = Flavor
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default','deployments',)
+
+
 
 
 class ServiceAttributeSerializer(serializers.HyperlinkedModelSerializer):
@@ -256,7 +371,7 @@
         model = ServiceAttribute
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','value','service',)
 
-class ServiceAttributeIdSerializer(serializers.ModelSerializer):
+class ServiceAttributeIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -268,13 +383,48 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = ServiceAttribute
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','value','service',)
 
 
 
 
+class ControllerImagesSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerImages
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','image','controller','glance_image_id',)
+
+class ControllerImagesIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerImages
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','image','controller','glance_image_id',)
+
+
+
+
 class ImageSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
@@ -291,7 +441,7 @@
         model = Image
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','disk_format','container_format','path',)
 
-class ImageIdSerializer(serializers.ModelSerializer):
+class ImageIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -303,7 +453,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Image
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','disk_format','container_format','path',)
 
@@ -326,7 +476,7 @@
         model = NetworkParameter
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','parameter','value','content_type','object_id',)
 
-class NetworkParameterIdSerializer(serializers.ModelSerializer):
+class NetworkParameterIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -338,7 +488,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = NetworkParameter
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','parameter','value','content_type','object_id',)
 
@@ -348,6 +498,10 @@
 class SiteSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
+    
+    deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='deployment-detail')
+    
+    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
     def getHumanReadableName(self, obj):
@@ -359,11 +513,15 @@
             return None
     class Meta:
         model = Site
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name','deployments',)
 
-class SiteIdSerializer(serializers.ModelSerializer):
+class SiteIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
+    
+    deployments = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='deployment-detail')
+    
+    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
     def getHumanReadableName(self, obj):
@@ -373,9 +531,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Site
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name','deployments',)
 
 
 
@@ -396,7 +554,7 @@
         model = SliceRole
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
 
-class SliceRoleIdSerializer(serializers.ModelSerializer):
+class SliceRoleIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -408,7 +566,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = SliceRole
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
 
@@ -431,7 +589,7 @@
         model = Tag
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','service','name','value','content_type','object_id',)
 
-class TagIdSerializer(serializers.ModelSerializer):
+class TagIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -443,7 +601,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Tag
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','service','name','value','content_type','object_id',)
 
@@ -466,7 +624,7 @@
         model = Invoice
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','date','account',)
 
-class InvoiceIdSerializer(serializers.ModelSerializer):
+class InvoiceIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -478,7 +636,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Invoice
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','date','account',)
 
@@ -501,7 +659,7 @@
         model = SlicePrivilege
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','slice','role',)
 
-class SlicePrivilegeIdSerializer(serializers.ModelSerializer):
+class SlicePrivilegeIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -513,7 +671,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = SlicePrivilege
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','slice','role',)
 
@@ -536,7 +694,7 @@
         model = PlanetStackRole
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
 
-class PlanetStackRoleIdSerializer(serializers.ModelSerializer):
+class PlanetStackRoleIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -548,13 +706,48 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = PlanetStackRole
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
 
 
 
 
+class ControllerPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerPrivilege
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','controller','role',)
+
+class ControllerPrivilegeIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerPrivilege
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','controller','role',)
+
+
+
+
 class NetworkSliverSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
@@ -571,7 +764,7 @@
         model = NetworkSliver
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','sliver','ip','port_id',)
 
-class NetworkSliverIdSerializer(serializers.ModelSerializer):
+class NetworkSliverIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -583,83 +776,13 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = NetworkSliver
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','sliver','ip','port_id',)
 
 
 
 
-class ControllerNetworksSerializer(serializers.HyperlinkedModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = ControllerNetworks
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','deployment','net_id','router_id','subnet_id','subnet',)
-
-class ControllerNetworksIdSerializer(serializers.ModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = ControllerNetworks
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','deployment','net_id','router_id','subnet_id','subnet',)
-
-
-
-
-class FlavorSerializer(serializers.HyperlinkedModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = Flavor
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default',)
-
-class FlavorIdSerializer(serializers.ModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = Flavor
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default',)
-
-
-
-
 class ProjectSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
@@ -676,7 +799,7 @@
         model = Project
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name',)
 
-class ProjectIdSerializer(serializers.ModelSerializer):
+class ProjectIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -688,7 +811,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Project
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name',)
 
@@ -703,14 +826,6 @@
     
     
     
-    availableNetworks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
-    
-    
-    
-    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
-    
-    
-    
     networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
     
     
@@ -725,25 +840,17 @@
             return None
     class Meta:
         model = Slice
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','availableNetworks','networks','networks',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','networks',)
 
-class SliceIdSerializer(serializers.ModelSerializer):
+class SliceIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     
-    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
+    networks = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='network-detail')
     
     
     
-    availableNetworks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
-    
-    
-    
-    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
-    
-    
-    
-    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
+    networks = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='network-detail')
     
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -755,9 +862,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Slice
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','availableNetworks','networks','networks',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','networks',)
 
 
 
@@ -766,11 +873,15 @@
     id = serializers.Field()
     
     
-    routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail')
+    slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail')
     
     
     
-    availableRouters = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail')
+    slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail')
+    
+    
+    
+    slivers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='sliver-detail')
     
     
     
@@ -792,25 +903,29 @@
             return None
     class Meta:
         model = Network
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','routers','availableRouters','routers','routers',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','slices','slices','slivers','routers','routers',)
 
-class NetworkIdSerializer(serializers.ModelSerializer):
+class NetworkIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     
-    routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail')
+    slices = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='slice-detail')
     
     
     
-    availableRouters = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail')
+    slices = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='slice-detail')
     
     
     
-    routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail')
+    slivers = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='sliver-detail')
     
     
     
-    routers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='router-detail')
+    routers = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='router-detail')
+    
+    
+    
+    routers = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='router-detail')
     
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -822,9 +937,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Network
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','routers','availableRouters','routers','routers',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','slices','slices','slivers','routers','routers',)
 
 
 
@@ -845,7 +960,7 @@
         model = Service
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','description','enabled','name','versionNumber','published',)
 
-class ServiceIdSerializer(serializers.ModelSerializer):
+class ServiceIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -857,7 +972,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Service
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','description','enabled','name','versionNumber','published',)
 
@@ -880,7 +995,7 @@
         model = ServiceClass
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
 
-class ServiceClassIdSerializer(serializers.ModelSerializer):
+class ServiceClassIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -892,14 +1007,14 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = ServiceClass
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
 
 
 
 
-class PaymentSerializer(serializers.HyperlinkedModelSerializer):
+class ControllerNetworksSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -912,10 +1027,10 @@
         except:
             return None
     class Meta:
-        model = Payment
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','amount','date',)
+        model = ControllerNetworks
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',)
 
-class PaymentIdSerializer(serializers.ModelSerializer):
+class ControllerNetworksIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -927,9 +1042,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
-        model = Payment
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','amount','date',)
+    class Meta:
+        model = ControllerNetworks
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',)
 
 
 
@@ -950,7 +1065,7 @@
         model = Charge
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
 
-class ChargeIdSerializer(serializers.ModelSerializer):
+class ChargeIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -962,7 +1077,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Charge
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
 
@@ -985,7 +1100,7 @@
         model = Role
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role_type','role','description','content_type',)
 
-class RoleIdSerializer(serializers.ModelSerializer):
+class RoleIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -997,7 +1112,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Role
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role_type','role','description','content_type',)
 
@@ -1020,7 +1135,7 @@
         model = UsableObject
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name',)
 
-class UsableObjectIdSerializer(serializers.ModelSerializer):
+class UsableObjectIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1032,13 +1147,48 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = UsableObject
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name',)
 
 
 
 
+class ControllerSiteDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerSiteDeployments
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','controller','site_deployment','tenant_id',)
+
+class ControllerSiteDeploymentsIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerSiteDeployments
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','controller','site_deployment','tenant_id',)
+
+
+
+
 class SiteRoleSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
@@ -1055,7 +1205,7 @@
         model = SiteRole
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
 
-class SiteRoleIdSerializer(serializers.ModelSerializer):
+class SiteRoleIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1067,7 +1217,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = SiteRole
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
 
@@ -1090,7 +1240,7 @@
         model = SliceCredential
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','name','key_id','enc_value',)
 
-class SliceCredentialIdSerializer(serializers.ModelSerializer):
+class SliceCredentialIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1102,7 +1252,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = SliceCredential
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','name','key_id','enc_value',)
 
@@ -1116,10 +1266,6 @@
     networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
     
     
-    
-    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
-    
-    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
     def getHumanReadableName(self, obj):
@@ -1131,17 +1277,13 @@
             return None
     class Meta:
         model = Sliver
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','deploymentNetwork','numberCores','flavor','userData','networks','networks',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','controllerNetwork','numberCores','flavor','userData','networks',)
 
-class SliverIdSerializer(serializers.ModelSerializer):
+class SliverIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     
-    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
-    
-    
-    
-    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
+    networks = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='network-detail')
     
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1153,9 +1295,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Sliver
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','deploymentNetwork','numberCores','flavor','userData','networks','networks',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','controllerNetwork','numberCores','flavor','userData','networks',)
 
 
 
@@ -1174,9 +1316,9 @@
             return None
     class Meta:
         model = Node
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site','deployment',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site_deployment',)
 
-class NodeIdSerializer(serializers.ModelSerializer):
+class NodeIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1188,9 +1330,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Node
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site','deployment',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site_deployment',)
 
 
 
@@ -1198,6 +1340,10 @@
 class DashboardViewSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
+    
+    controllers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='controller-detail')
+    
+    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
     def getHumanReadableName(self, obj):
@@ -1209,11 +1355,15 @@
             return None
     class Meta:
         model = DashboardView
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','url',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','url','controllers',)
 
-class DashboardViewIdSerializer(serializers.ModelSerializer):
+class DashboardViewIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
+    
+    controllers = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='controller-detail')
+    
+    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
     def getHumanReadableName(self, obj):
@@ -1223,14 +1373,14 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = DashboardView
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','url',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','url','controllers',)
 
 
 
 
-class ControllerImagesSerializer(serializers.HyperlinkedModelSerializer):
+class ImageDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1243,10 +1393,10 @@
         except:
             return None
     class Meta:
-        model = ControllerImages
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
+        model = ImageDeployments
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','image','deployment',)
 
-class ControllerImagesIdSerializer(serializers.ModelSerializer):
+class ImageDeploymentsIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1258,9 +1408,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
-        model = ControllerImages
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
+    class Meta:
+        model = ImageDeployments
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','image','deployment',)
 
 
 
@@ -1281,7 +1431,7 @@
         model = ReservedResource
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','sliver','resource','quantity','reservationSet',)
 
-class ReservedResourceIdSerializer(serializers.ModelSerializer):
+class ReservedResourceIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1293,13 +1443,83 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = ReservedResource
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','sliver','resource','quantity','reservationSet',)
 
 
 
 
+class PaymentSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = Payment
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','amount','date',)
+
+class PaymentIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = Payment
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','amount','date',)
+
+
+
+
+class NetworkTemplateSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = NetworkTemplate
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
+
+class NetworkTemplateIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = NetworkTemplate
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
+
+
+
+
 class NetworkSliceSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
@@ -1316,7 +1536,7 @@
         model = NetworkSlice
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','slice',)
 
-class NetworkSliceIdSerializer(serializers.ModelSerializer):
+class NetworkSliceIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1328,7 +1548,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = NetworkSlice
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','slice',)
 
@@ -1351,7 +1571,7 @@
         model = UserDashboardView
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','dashboardView','order',)
 
-class UserDashboardViewIdSerializer(serializers.ModelSerializer):
+class UserDashboardViewIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1362,20 +1582,24 @@
         try:
             return obj.getValidators()
         except:
-            return None
-    class Meta:
+            return None
+    class Meta:
         model = UserDashboardView
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','dashboardView','order',)
 
 
 
 
-class PlanetStackPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
+class ControllerSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
+    
+    dashboardviews = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='dashboardview-detail')
+    
+    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
+    def getHumanReadableName(self, obj):
         return str(obj)
     def getValidators(self, obj):
         try:
@@ -1383,112 +1607,14 @@
         except:
             return None
     class Meta:
-        model = PlanetStackPrivilege
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','planetstack','role',)
+        model = Controller
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','version','backend_type','auth_url','admin_user','admin_password','admin_tenant','dashboardviews',)
 
-class PlanetStackPrivilegeIdSerializer(serializers.ModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = PlanetStackPrivilege
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','planetstack','role',)
-
-
-
-
-class UserSerializer(serializers.HyperlinkedModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = User
-        fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','backend_status','deleted','timezone',)
-
-class UserIdSerializer(serializers.ModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = User
-        fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','backend_status','deleted','timezone',)
-
-
-
-
-class DeploymentSerializer(serializers.HyperlinkedModelSerializer):
+class ControllerIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     
-    sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail')
-    
-    
-    
-    sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail')
-    
-    
-    
-    flavors = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='flavor-detail')
-    
-    
-    
-    flavors = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='flavor-detail')
-    
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = Deployment
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','accessControl','sites','sites','flavors','flavors',)
-
-class DeploymentIdSerializer(serializers.ModelSerializer):
-    id = serializers.Field()
-    
-    
-    sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail')
-    
-    
-    
-    sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail')
-    
-    
-    
-    flavors = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='flavor-detail')
-    
-    
-    
-    flavors = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='flavor-detail')
+    dashboardviews = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='dashboardview-detail')
     
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1500,43 +1626,132 @@
             return obj.getValidators()
         except:
             return None
+    class Meta:
+        model = Controller
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','version','backend_type','auth_url','admin_user','admin_password','admin_tenant','dashboardviews',)
+
+
+
+
+class PlanetStackPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = PlanetStackPrivilege
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','planetstack','role',)
+
+class PlanetStackPrivilegeIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = PlanetStackPrivilege
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','planetstack','role',)
+
+
+
+
+class UserSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = User
+        fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','backend_status','deleted','timezone',)
+
+class UserIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = User
+        fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','backend_status','deleted','timezone',)
+
+
+
+
+class DeploymentSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    
+    flavors = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='flavor-detail')
+    
+    
+    
+    sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail')
+    
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
     class Meta:
         model = Deployment
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','admin_user','admin_password','admin_tenant','auth_url','backend_type','availability_zone','accessControl','sites','sites','flavors','flavors',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','accessControl','flavors','sites',)
 
-
-class ControllerSerializer(serializers.HyperlinkedModelSerializer):
+class DeploymentIdSerializer(XOSModelSerializer):
     id = serializers.Field()
-    site_deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='sitedeployment-detail')
+    
+    
+    flavors = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='flavor-detail')
+    
+    
+    
+    sites = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='site-detail')
+    
+    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
         try:
             return obj.getValidators()
         except:
-            return None
-    class Meta:
-        model = Controller
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','admin_user','admin_password','admin_tenant','auth_url','backend_type')
+            return None
+    class Meta:
+        model = Deployment
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','accessControl','flavors','sites',)
 
 
-class ControllerIdSerializer(serializers.ModelSerializer):
-    id = serializers.Field()
-    site_deployments = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='sitedeployment-detail')
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = Controller 
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','admin_user','admin_password','admin_tenant','auth_url','backend_type')
 
 
 class ReservationSerializer(serializers.HyperlinkedModelSerializer):
@@ -1555,7 +1770,7 @@
         model = Reservation
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','startTime','slice','duration',)
 
-class ReservationIdSerializer(serializers.ModelSerializer):
+class ReservationIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1567,48 +1782,13 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Reservation
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','startTime','slice','duration',)
 
 
 
 
-class ControllerSlicesSerializer(serializers.HyperlinkedModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = ControllerSlices
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
-
-class ControllerSlicesIdSerializer(serializers.ModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = ControllerSlices
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
-
-
-
-
 class SitePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
@@ -1625,7 +1805,7 @@
         model = SitePrivilege
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','site','role',)
 
-class SitePrivilegeIdSerializer(serializers.ModelSerializer):
+class SitePrivilegeIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1637,7 +1817,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = SitePrivilege
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','site','role',)
 
@@ -1660,7 +1840,7 @@
         model = PlanetStack
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','description',)
 
-class PlanetStackIdSerializer(serializers.ModelSerializer):
+class PlanetStackIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1672,48 +1852,13 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = PlanetStack
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','description',)
 
 
 
 
-class ControllerUsersSerializer(serializers.HyperlinkedModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = ControllerUsers
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','deployment','kuser_id',)
-
-class ControllerUsersIdSerializer(serializers.ModelSerializer):
-    id = serializers.Field()
-    
-    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
-    validators = serializers.SerializerMethodField("getValidators")
-    def getHumanReadableName(self, obj):
-        return str(obj)
-    def getValidators(self, obj):
-        try:
-            return obj.getValidators()
-        except:
-            return None
-    class Meta:
-        model = ControllerUsers
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','deployment','kuser_id',)
-
-
-
-
 class AccountSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
@@ -1730,7 +1875,7 @@
         model = Account
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site',)
 
-class AccountIdSerializer(serializers.ModelSerializer):
+class AccountIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1742,13 +1887,48 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Account
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site',)
 
 
 
 
+class ControllerRoleSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerRole
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
+
+class ControllerRoleIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerRole
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
+
+
+
+
 class NetworkParameterTypeSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
@@ -1765,7 +1945,7 @@
         model = NetworkParameterType
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description',)
 
-class NetworkParameterTypeIdSerializer(serializers.ModelSerializer):
+class NetworkParameterTypeIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1777,7 +1957,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = NetworkParameterType
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description',)
 
@@ -1800,7 +1980,7 @@
         model = SiteCredential
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','name','key_id','enc_value',)
 
-class SiteCredentialIdSerializer(serializers.ModelSerializer):
+class SiteCredentialIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1812,14 +1992,14 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = SiteCredential
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','name','key_id','enc_value',)
 
 
 
 
-class ControllerPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
+class DeploymentPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1832,10 +2012,10 @@
         except:
             return None
     class Meta:
-        model = ControllerPrivilege
+        model = DeploymentPrivilege
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','deployment','role',)
 
-class ControllerPrivilegeIdSerializer(serializers.ModelSerializer):
+class DeploymentPrivilegeIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1847,14 +2027,14 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
-        model = ControllerPrivilege
+    class Meta:
+        model = DeploymentPrivilege
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','deployment','role',)
 
 
 
 
-class ControllerRoleSerializer(serializers.HyperlinkedModelSerializer):
+class ControllerUsersSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1867,10 +2047,45 @@
         except:
             return None
     class Meta:
-        model = ControllerRole
+        model = ControllerUsers
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','controller','kuser_id',)
+
+class ControllerUsersIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerUsers
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','controller','kuser_id',)
+
+
+
+
+class DeploymentRoleSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = DeploymentRole
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
 
-class ControllerRoleIdSerializer(serializers.ModelSerializer):
+class DeploymentRoleIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1882,8 +2097,8 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
-        model = ControllerRole
+    class Meta:
+        model = DeploymentRole
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
 
 
@@ -1905,7 +2120,7 @@
         model = UserCredential
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','name','key_id','enc_value',)
 
-class UserCredentialIdSerializer(serializers.ModelSerializer):
+class UserCredentialIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1917,7 +2132,7 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = UserCredential
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','name','key_id','enc_value',)
 
@@ -1938,9 +2153,9 @@
             return None
     class Meta:
         model = SiteDeployments
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','deployment','tenant_id',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','deployment','controller','availability_zone',)
 
-class SiteDeploymentsIdSerializer(serializers.ModelSerializer):
+class SiteDeploymentsIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1952,9 +2167,11 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = SiteDeployments
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','deployment')
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','deployment','controller','availability_zone',)
+
+
 
 
 class SliceTagSerializer(serializers.HyperlinkedModelSerializer):
@@ -1973,7 +2190,7 @@
         model = SliceTag
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','name','value',)
 
-class SliceTagIdSerializer(serializers.ModelSerializer):
+class SliceTagIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -1985,14 +2202,14 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = SliceTag
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','name','value',)
 
 
 
 
-class NetworkTemplateSerializer(serializers.HyperlinkedModelSerializer):
+class ControllerDashboardSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -2005,10 +2222,10 @@
         except:
             return None
     class Meta:
-        model = NetworkTemplate
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
+        model = ControllerDashboard
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','controller','dashboardView','url',)
 
-class NetworkTemplateIdSerializer(serializers.ModelSerializer):
+class ControllerDashboardIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -2020,9 +2237,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
-        model = NetworkTemplate
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
+    class Meta:
+        model = ControllerDashboard
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','controller','dashboardView','url',)
 
 
 
@@ -2030,6 +2247,14 @@
 class RouterSerializer(serializers.HyperlinkedModelSerializer):
     id = serializers.Field()
     
+    
+    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
+    
+    
+    
+    networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-detail')
+    
+    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
     def getHumanReadableName(self, obj):
@@ -2041,11 +2266,19 @@
             return None
     class Meta:
         model = Router
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','owner',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','owner','networks','networks',)
 
-class RouterIdSerializer(serializers.ModelSerializer):
+class RouterIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
+    
+    networks = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='network-detail')
+    
+    
+    
+    networks = serializers.PrimaryKeyRelatedField(many=True) #, read_only=True) #, view_name='network-detail')
+    
+    
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
     validators = serializers.SerializerMethodField("getValidators")
     def getHumanReadableName(self, obj):
@@ -2055,9 +2288,9 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = Router
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','owner',)
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','owner','networks','networks',)
 
 
 
@@ -2078,7 +2311,7 @@
         model = ServiceResource
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
 
-class ServiceResourceIdSerializer(serializers.ModelSerializer):
+class ServiceResourceIdSerializer(XOSModelSerializer):
     id = serializers.Field()
     
     humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -2090,17 +2323,56 @@
             return obj.getValidators()
         except:
             return None
-    class Meta:
+    class Meta:
         model = ServiceResource
         fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
 
 
 
 
+class ControllerSlicesSerializer(serializers.HyperlinkedModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerSlices
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','controller','slice','tenant_id',)
+
+class ControllerSlicesIdSerializer(XOSModelSerializer):
+    id = serializers.Field()
+    
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    validators = serializers.SerializerMethodField("getValidators")
+    def getHumanReadableName(self, obj):
+        return str(obj)
+    def getValidators(self, obj):
+        try:
+            return obj.getValidators()
+        except:
+            return None
+    class Meta:
+        model = ControllerSlices
+        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','controller','slice','tenant_id',)
+
+
+
+
 serializerLookUp = { 
 
+                 Flavor: FlavorSerializer,
+
                  ServiceAttribute: ServiceAttributeSerializer,
 
+                 ControllerImages: ControllerImagesSerializer,
+
                  Image: ImageSerializer,
 
                  NetworkParameter: NetworkParameterSerializer,
@@ -2117,12 +2389,10 @@
 
                  PlanetStackRole: PlanetStackRoleSerializer,
 
+                 ControllerPrivilege: ControllerPrivilegeSerializer,
+
                  NetworkSliver: NetworkSliverSerializer,
 
-                 ControllerNetworks: ControllerNetworksSerializer,
-
-                 Flavor: FlavorSerializer,
-
                  Project: ProjectSerializer,
 
                  Slice: SliceSerializer,
@@ -2133,7 +2403,7 @@
 
                  ServiceClass: ServiceClassSerializer,
 
-                 Payment: PaymentSerializer,
+                 ControllerNetworks: ControllerNetworksSerializer,
 
                  Charge: ChargeSerializer,
 
@@ -2141,6 +2411,8 @@
 
                  UsableObject: UsableObjectSerializer,
 
+                 ControllerSiteDeployments: ControllerSiteDeploymentsSerializer,
+
                  SiteRole: SiteRoleSerializer,
 
                  SliceCredential: SliceCredentialSerializer,
@@ -2151,14 +2423,20 @@
 
                  DashboardView: DashboardViewSerializer,
 
-                 ControllerImages: ControllerImagesSerializer,
+                 ImageDeployments: ImageDeploymentsSerializer,
 
                  ReservedResource: ReservedResourceSerializer,
 
+                 Payment: PaymentSerializer,
+
+                 NetworkTemplate: NetworkTemplateSerializer,
+
                  NetworkSlice: NetworkSliceSerializer,
 
                  UserDashboardView: UserDashboardViewSerializer,
 
+                 Controller: ControllerSerializer,
+
                  PlanetStackPrivilege: PlanetStackPrivilegeSerializer,
 
                  User: UserSerializer,
@@ -2167,23 +2445,23 @@
 
                  Reservation: ReservationSerializer,
 
-                 ControllerSlices: ControllerSlicesSerializer,
-
                  SitePrivilege: SitePrivilegeSerializer,
 
                  PlanetStack: PlanetStackSerializer,
 
-                 ControllerUsers: ControllerUsersSerializer,
-
                  Account: AccountSerializer,
 
+                 ControllerRole: ControllerRoleSerializer,
+
                  NetworkParameterType: NetworkParameterTypeSerializer,
 
                  SiteCredential: SiteCredentialSerializer,
 
-                 ControllerPrivilege: ControllerPrivilegeSerializer,
+                 DeploymentPrivilege: DeploymentPrivilegeSerializer,
 
-                 ControllerRole: ControllerRoleSerializer,
+                 ControllerUsers: ControllerUsersSerializer,
+
+                 DeploymentRole: DeploymentRoleSerializer,
 
                  UserCredential: UserCredentialSerializer,
 
@@ -2191,12 +2469,14 @@
 
                  SliceTag: SliceTagSerializer,
 
-                 NetworkTemplate: NetworkTemplateSerializer,
+                 ControllerDashboard: ControllerDashboardSerializer,
 
                  Router: RouterSerializer,
 
                  ServiceResource: ServiceResourceSerializer,
 
+                 ControllerSlices: ControllerSlicesSerializer,
+
                  None: None,
                 }
 
@@ -2252,6 +2532,65 @@
 # Based on core/views/*.py
 
 
+class FlavorList(generics.ListCreateAPIView):
+    queryset = Flavor.objects.select_related().all()
+    serializer_class = FlavorSerializer
+    id_serializer_class = FlavorIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default','deployments',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return Flavor.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(FlavorList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(FlavorList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class FlavorDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = Flavor.objects.select_related().all()
+    serializer_class = FlavorSerializer
+    id_serializer_class = FlavorIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return Flavor.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
 class ServiceAttributeList(generics.ListCreateAPIView):
     queryset = ServiceAttribute.objects.select_related().all()
     serializer_class = ServiceAttributeSerializer
@@ -2311,6 +2650,65 @@
 
 
 
+class ControllerImagesList(generics.ListCreateAPIView):
+    queryset = ControllerImages.objects.select_related().all()
+    serializer_class = ControllerImagesSerializer
+    id_serializer_class = ControllerImagesIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','image','controller','glance_image_id',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return ControllerImages.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(ControllerImagesList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(ControllerImagesList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class ControllerImagesDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ControllerImages.objects.select_related().all()
+    serializer_class = ControllerImagesSerializer
+    id_serializer_class = ControllerImagesIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return ControllerImages.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
 class ImageList(generics.ListCreateAPIView):
     queryset = Image.objects.select_related().all()
     serializer_class = ImageSerializer
@@ -2434,7 +2832,7 @@
     serializer_class = SiteSerializer
     id_serializer_class = SiteIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name','deployments',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -2783,6 +3181,65 @@
 
 
 
+class ControllerPrivilegeList(generics.ListCreateAPIView):
+    queryset = ControllerPrivilege.objects.select_related().all()
+    serializer_class = ControllerPrivilegeSerializer
+    id_serializer_class = ControllerPrivilegeIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','user','controller','role',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return ControllerPrivilege.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(ControllerPrivilegeList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(ControllerPrivilegeList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class ControllerPrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ControllerPrivilege.objects.select_related().all()
+    serializer_class = ControllerPrivilegeSerializer
+    id_serializer_class = ControllerPrivilegeIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return ControllerPrivilege.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
 class NetworkSliverList(generics.ListCreateAPIView):
     queryset = NetworkSliver.objects.select_related().all()
     serializer_class = NetworkSliverSerializer
@@ -2842,124 +3299,6 @@
 
 
 
-class ControllerNetworksList(generics.ListCreateAPIView):
-    queryset = ControllerNetworks.objects.select_related().all()
-    serializer_class = ControllerNetworksSerializer
-    id_serializer_class = ControllerNetworksIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','network','deployment','net_id','router_id','subnet_id','subnet',)
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-
-    def get_queryset(self):
-        return ControllerNetworks.select_by_user(self.request.user)
-
-    def create(self, request, *args, **kwargs):
-        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
-        if not (serializer.is_valid()):
-            response = {"error": "validation",
-                        "specific_error": "not serializer.is_valid()",
-                        "reasons": serializer.errors}
-            return Response(response, status=status.HTTP_400_BAD_REQUEST)
-        obj = serializer.object
-        obj.caller = request.user
-        if obj.can_update(request.user):
-            return super(ControllerNetworksList, self).create(request, *args, **kwargs)
-        else:
-            raise Exception("failed obj.can_update")
-
-        ret = super(ControllerNetworksList, self).create(request, *args, **kwargs)
-        if (ret.status_code%100 != 200):
-            raise Exception(ret.data)
-
-        return ret
-
-
-class ControllerNetworksDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = ControllerNetworks.objects.select_related().all()
-    serializer_class = ControllerNetworksSerializer
-    id_serializer_class = ControllerNetworksIdSerializer
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-    
-    def get_queryset(self):
-        return ControllerNetworks.select_by_user(self.request.user)
-
-    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-
-
-
-class FlavorList(generics.ListCreateAPIView):
-    queryset = Flavor.objects.select_related().all()
-    serializer_class = FlavorSerializer
-    id_serializer_class = FlavorIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default',)
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-
-    def get_queryset(self):
-        return Flavor.select_by_user(self.request.user)
-
-    def create(self, request, *args, **kwargs):
-        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
-        if not (serializer.is_valid()):
-            response = {"error": "validation",
-                        "specific_error": "not serializer.is_valid()",
-                        "reasons": serializer.errors}
-            return Response(response, status=status.HTTP_400_BAD_REQUEST)
-        obj = serializer.object
-        obj.caller = request.user
-        if obj.can_update(request.user):
-            return super(FlavorList, self).create(request, *args, **kwargs)
-        else:
-            raise Exception("failed obj.can_update")
-
-        ret = super(FlavorList, self).create(request, *args, **kwargs)
-        if (ret.status_code%100 != 200):
-            raise Exception(ret.data)
-
-        return ret
-
-
-class FlavorDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = Flavor.objects.select_related().all()
-    serializer_class = FlavorSerializer
-    id_serializer_class = FlavorIdSerializer
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-    
-    def get_queryset(self):
-        return Flavor.select_by_user(self.request.user)
-
-    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-
-
-
 class ProjectList(generics.ListCreateAPIView):
     queryset = Project.objects.select_related().all()
     serializer_class = ProjectSerializer
@@ -3024,7 +3363,7 @@
     serializer_class = SliceSerializer
     id_serializer_class = SliceIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','availableNetworks','networks','networks',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','networks',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3083,7 +3422,7 @@
     serializer_class = NetworkSerializer
     id_serializer_class = NetworkIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','routers','availableRouters','routers','routers',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','slices','slices','slivers','routers','routers',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3255,12 +3594,12 @@
 
 
 
-class PaymentList(generics.ListCreateAPIView):
-    queryset = Payment.objects.select_related().all()
-    serializer_class = PaymentSerializer
-    id_serializer_class = PaymentIdSerializer
+class ControllerNetworksList(generics.ListCreateAPIView):
+    queryset = ControllerNetworks.objects.select_related().all()
+    serializer_class = ControllerNetworksSerializer
+    id_serializer_class = ControllerNetworksIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','account','amount','date',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','network','controller','net_id','router_id','subnet_id','subnet',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3270,7 +3609,7 @@
             return self.serializer_class
 
     def get_queryset(self):
-        return Payment.select_by_user(self.request.user)
+        return ControllerNetworks.select_by_user(self.request.user)
 
     def create(self, request, *args, **kwargs):
         serializer = self.get_serializer(data=request.DATA, files=request.FILES)
@@ -3282,21 +3621,21 @@
         obj = serializer.object
         obj.caller = request.user
         if obj.can_update(request.user):
-            return super(PaymentList, self).create(request, *args, **kwargs)
+            return super(ControllerNetworksList, self).create(request, *args, **kwargs)
         else:
             raise Exception("failed obj.can_update")
 
-        ret = super(PaymentList, self).create(request, *args, **kwargs)
+        ret = super(ControllerNetworksList, self).create(request, *args, **kwargs)
         if (ret.status_code%100 != 200):
             raise Exception(ret.data)
 
         return ret
 
 
-class PaymentDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = Payment.objects.select_related().all()
-    serializer_class = PaymentSerializer
-    id_serializer_class = PaymentIdSerializer
+class ControllerNetworksDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ControllerNetworks.objects.select_related().all()
+    serializer_class = ControllerNetworksSerializer
+    id_serializer_class = ControllerNetworksIdSerializer
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3306,7 +3645,7 @@
             return self.serializer_class
     
     def get_queryset(self):
-        return Payment.select_by_user(self.request.user)
+        return ControllerNetworks.select_by_user(self.request.user)
 
     # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
 
@@ -3491,6 +3830,65 @@
 
 
 
+class ControllerSiteDeploymentsList(generics.ListCreateAPIView):
+    queryset = ControllerSiteDeployments.objects.select_related().all()
+    serializer_class = ControllerSiteDeploymentsSerializer
+    id_serializer_class = ControllerSiteDeploymentsIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','controller','site_deployment','tenant_id',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return ControllerSiteDeployments.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(ControllerSiteDeploymentsList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(ControllerSiteDeploymentsList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class ControllerSiteDeploymentsDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ControllerSiteDeployments.objects.select_related().all()
+    serializer_class = ControllerSiteDeploymentsSerializer
+    id_serializer_class = ControllerSiteDeploymentsIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return ControllerSiteDeployments.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
 class SiteRoleList(generics.ListCreateAPIView):
     queryset = SiteRole.objects.select_related().all()
     serializer_class = SiteRoleSerializer
@@ -3614,7 +4012,7 @@
     serializer_class = SliverSerializer
     id_serializer_class = SliverIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','deploymentNetwork','numberCores','flavor','userData','networks','networks',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','controllerNetwork','numberCores','flavor','userData','networks',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3673,7 +4071,7 @@
     serializer_class = NodeSerializer
     id_serializer_class = NodeIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','site','deployment',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','site_deployment',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3732,7 +4130,7 @@
     serializer_class = DashboardViewSerializer
     id_serializer_class = DashboardViewIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','url',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','url','controllers',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3786,12 +4184,12 @@
 
 
 
-class ControllerImagesList(generics.ListCreateAPIView):
-    queryset = ControllerImages.objects.select_related().all()
-    serializer_class = ControllerImagesSerializer
-    id_serializer_class = ControllerImagesIdSerializer
+class ImageDeploymentsList(generics.ListCreateAPIView):
+    queryset = ImageDeployments.objects.select_related().all()
+    serializer_class = ImageDeploymentsSerializer
+    id_serializer_class = ImageDeploymentsIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','image','deployment',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3801,7 +4199,7 @@
             return self.serializer_class
 
     def get_queryset(self):
-        return ControllerImages.select_by_user(self.request.user)
+        return ImageDeployments.select_by_user(self.request.user)
 
     def create(self, request, *args, **kwargs):
         serializer = self.get_serializer(data=request.DATA, files=request.FILES)
@@ -3813,21 +4211,21 @@
         obj = serializer.object
         obj.caller = request.user
         if obj.can_update(request.user):
-            return super(ControllerImagesList, self).create(request, *args, **kwargs)
+            return super(ImageDeploymentsList, self).create(request, *args, **kwargs)
         else:
             raise Exception("failed obj.can_update")
 
-        ret = super(ControllerImagesList, self).create(request, *args, **kwargs)
+        ret = super(ImageDeploymentsList, self).create(request, *args, **kwargs)
         if (ret.status_code%100 != 200):
             raise Exception(ret.data)
 
         return ret
 
 
-class ControllerImagesDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = ControllerImages.objects.select_related().all()
-    serializer_class = ControllerImagesSerializer
-    id_serializer_class = ControllerImagesIdSerializer
+class ImageDeploymentsDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ImageDeployments.objects.select_related().all()
+    serializer_class = ImageDeploymentsSerializer
+    id_serializer_class = ImageDeploymentsIdSerializer
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3837,7 +4235,7 @@
             return self.serializer_class
     
     def get_queryset(self):
-        return ControllerImages.select_by_user(self.request.user)
+        return ImageDeployments.select_by_user(self.request.user)
 
     # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
 
@@ -3904,6 +4302,124 @@
 
 
 
+class PaymentList(generics.ListCreateAPIView):
+    queryset = Payment.objects.select_related().all()
+    serializer_class = PaymentSerializer
+    id_serializer_class = PaymentIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','account','amount','date',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return Payment.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(PaymentList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(PaymentList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class PaymentDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = Payment.objects.select_related().all()
+    serializer_class = PaymentSerializer
+    id_serializer_class = PaymentIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return Payment.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
+class NetworkTemplateList(generics.ListCreateAPIView):
+    queryset = NetworkTemplate.objects.select_related().all()
+    serializer_class = NetworkTemplateSerializer
+    id_serializer_class = NetworkTemplateIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return NetworkTemplate.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(NetworkTemplateList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(NetworkTemplateList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class NetworkTemplateDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = NetworkTemplate.objects.select_related().all()
+    serializer_class = NetworkTemplateSerializer
+    id_serializer_class = NetworkTemplateIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return NetworkTemplate.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
 class NetworkSliceList(generics.ListCreateAPIView):
     queryset = NetworkSlice.objects.select_related().all()
     serializer_class = NetworkSliceSerializer
@@ -4022,6 +4538,65 @@
 
 
 
+class ControllerList(generics.ListCreateAPIView):
+    queryset = Controller.objects.select_related().all()
+    serializer_class = ControllerSerializer
+    id_serializer_class = ControllerIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','version','backend_type','auth_url','admin_user','admin_password','admin_tenant','dashboardviews',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return Controller.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(ControllerList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(ControllerList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class ControllerDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = Controller.objects.select_related().all()
+    serializer_class = ControllerSerializer
+    id_serializer_class = ControllerIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return Controller.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
 class PlanetStackPrivilegeList(generics.ListCreateAPIView):
     queryset = PlanetStackPrivilege.objects.select_related().all()
     serializer_class = PlanetStackPrivilegeSerializer
@@ -4145,7 +4720,7 @@
     serializer_class = DeploymentSerializer
     id_serializer_class = DeploymentIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','accessControl','sites','sites','flavors','flavors',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','accessControl','flavors','sites',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -4197,57 +4772,7 @@
 
     # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
 
-class ControllerList(generics.ListCreateAPIView):
-    queryset = Controller.objects.select_related().all()
-    serializer_class = ControllerSerializer
-    id_serializer_class = ControllerIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','site_deployment','admin_user','admin_password','admin_tenant','auth_url','backend_type')
 
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-
-    def get_queryset(self):
-        return Controller.select_by_user(self.request.user)
-
-    def create(self, request, *args, **kwargs):
-        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
-        if not (serializer.is_valid()):
-            response = {"error": "validation",
-                        "specific_error": "not serializer.is_valid()",
-                        "reasons": serializer.errors}
-            return Response(response, status=status.HTTP_400_BAD_REQUEST)
-        obj = serializer.object
-        obj.caller = request.user
-        if obj.can_update(request.user):
-            return super(ControllerList, self).create(request, *args, **kwargs)
-        else:
-            raise Exception("failed obj.can_update")
-
-        ret = super(ControllerList, self).create(request, *args, **kwargs)
-        if (ret.status_code%100 != 200):
-            raise Exception(ret.data)
-
-        return ret
-
-class ControllerDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = Controller.objects.select_related().all()
-    serializer_class = ControllerSerializer
-    id_serializer_class = ControllerIdSerializer
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-
-    def get_queryset(self):
-        return Controller.select_by_user(self.request.user)
 
 class ReservationList(generics.ListCreateAPIView):
     queryset = Reservation.objects.select_related().all()
@@ -4308,65 +4833,6 @@
 
 
 
-class ControllerSlicesList(generics.ListCreateAPIView):
-    queryset = ControllerSlices.objects.select_related().all()
-    serializer_class = ControllerSlicesSerializer
-    id_serializer_class = ControllerSlicesIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-
-    def get_queryset(self):
-        return ControllerSlices.select_by_user(self.request.user)
-
-    def create(self, request, *args, **kwargs):
-        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
-        if not (serializer.is_valid()):
-            response = {"error": "validation",
-                        "specific_error": "not serializer.is_valid()",
-                        "reasons": serializer.errors}
-            return Response(response, status=status.HTTP_400_BAD_REQUEST)
-        obj = serializer.object
-        obj.caller = request.user
-        if obj.can_update(request.user):
-            return super(ControllerSlicesList, self).create(request, *args, **kwargs)
-        else:
-            raise Exception("failed obj.can_update")
-
-        ret = super(ControllerSlicesList, self).create(request, *args, **kwargs)
-        if (ret.status_code%100 != 200):
-            raise Exception(ret.data)
-
-        return ret
-
-
-class ControllerSlicesDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = ControllerSlices.objects.select_related().all()
-    serializer_class = ControllerSlicesSerializer
-    id_serializer_class = ControllerSlicesIdSerializer
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-    
-    def get_queryset(self):
-        return ControllerSlices.select_by_user(self.request.user)
-
-    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-
-
-
 class SitePrivilegeList(generics.ListCreateAPIView):
     queryset = SitePrivilege.objects.select_related().all()
     serializer_class = SitePrivilegeSerializer
@@ -4485,65 +4951,6 @@
 
 
 
-class ControllerUsersList(generics.ListCreateAPIView):
-    queryset = ControllerUsers.objects.select_related().all()
-    serializer_class = ControllerUsersSerializer
-    id_serializer_class = ControllerUsersIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','user','deployment','kuser_id',)
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-
-    def get_queryset(self):
-        return ControllerUsers.select_by_user(self.request.user)
-
-    def create(self, request, *args, **kwargs):
-        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
-        if not (serializer.is_valid()):
-            response = {"error": "validation",
-                        "specific_error": "not serializer.is_valid()",
-                        "reasons": serializer.errors}
-            return Response(response, status=status.HTTP_400_BAD_REQUEST)
-        obj = serializer.object
-        obj.caller = request.user
-        if obj.can_update(request.user):
-            return super(ControllerUsersList, self).create(request, *args, **kwargs)
-        else:
-            raise Exception("failed obj.can_update")
-
-        ret = super(ControllerUsersList, self).create(request, *args, **kwargs)
-        if (ret.status_code%100 != 200):
-            raise Exception(ret.data)
-
-        return ret
-
-
-class ControllerUsersDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = ControllerUsers.objects.select_related().all()
-    serializer_class = ControllerUsersSerializer
-    id_serializer_class = ControllerUsersIdSerializer
-
-    def get_serializer_class(self):
-        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
-        if (no_hyperlinks):
-            return self.id_serializer_class
-        else:
-            return self.serializer_class
-    
-    def get_queryset(self):
-        return ControllerUsers.select_by_user(self.request.user)
-
-    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-
-
-
 class AccountList(generics.ListCreateAPIView):
     queryset = Account.objects.select_related().all()
     serializer_class = AccountSerializer
@@ -4603,6 +5010,65 @@
 
 
 
+class ControllerRoleList(generics.ListCreateAPIView):
+    queryset = ControllerRole.objects.select_related().all()
+    serializer_class = ControllerRoleSerializer
+    id_serializer_class = ControllerRoleIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','role',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return ControllerRole.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(ControllerRoleList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(ControllerRoleList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class ControllerRoleDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ControllerRole.objects.select_related().all()
+    serializer_class = ControllerRoleSerializer
+    id_serializer_class = ControllerRoleIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return ControllerRole.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
 class NetworkParameterTypeList(generics.ListCreateAPIView):
     queryset = NetworkParameterType.objects.select_related().all()
     serializer_class = NetworkParameterTypeSerializer
@@ -4721,10 +5187,10 @@
 
 
 
-class ControllerPrivilegeList(generics.ListCreateAPIView):
-    queryset = ControllerPrivilege.objects.select_related().all()
-    serializer_class = ControllerPrivilegeSerializer
-    id_serializer_class = ControllerPrivilegeIdSerializer
+class DeploymentPrivilegeList(generics.ListCreateAPIView):
+    queryset = DeploymentPrivilege.objects.select_related().all()
+    serializer_class = DeploymentPrivilegeSerializer
+    id_serializer_class = DeploymentPrivilegeIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
     filter_fields = ('id','created','updated','enacted','backend_status','deleted','user','deployment','role',)
 
@@ -4736,7 +5202,7 @@
             return self.serializer_class
 
     def get_queryset(self):
-        return ControllerPrivilege.select_by_user(self.request.user)
+        return DeploymentPrivilege.select_by_user(self.request.user)
 
     def create(self, request, *args, **kwargs):
         serializer = self.get_serializer(data=request.DATA, files=request.FILES)
@@ -4748,21 +5214,21 @@
         obj = serializer.object
         obj.caller = request.user
         if obj.can_update(request.user):
-            return super(ControllerPrivilegeList, self).create(request, *args, **kwargs)
+            return super(DeploymentPrivilegeList, self).create(request, *args, **kwargs)
         else:
             raise Exception("failed obj.can_update")
 
-        ret = super(ControllerPrivilegeList, self).create(request, *args, **kwargs)
+        ret = super(DeploymentPrivilegeList, self).create(request, *args, **kwargs)
         if (ret.status_code%100 != 200):
             raise Exception(ret.data)
 
         return ret
 
 
-class ControllerPrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = ControllerPrivilege.objects.select_related().all()
-    serializer_class = ControllerPrivilegeSerializer
-    id_serializer_class = ControllerPrivilegeIdSerializer
+class DeploymentPrivilegeDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = DeploymentPrivilege.objects.select_related().all()
+    serializer_class = DeploymentPrivilegeSerializer
+    id_serializer_class = DeploymentPrivilegeIdSerializer
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -4772,7 +5238,7 @@
             return self.serializer_class
     
     def get_queryset(self):
-        return ControllerPrivilege.select_by_user(self.request.user)
+        return DeploymentPrivilege.select_by_user(self.request.user)
 
     # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
 
@@ -4780,10 +5246,69 @@
 
 
 
-class ControllerRoleList(generics.ListCreateAPIView):
-    queryset = ControllerRole.objects.select_related().all()
-    serializer_class = ControllerRoleSerializer
-    id_serializer_class = ControllerRoleIdSerializer
+class ControllerUsersList(generics.ListCreateAPIView):
+    queryset = ControllerUsers.objects.select_related().all()
+    serializer_class = ControllerUsersSerializer
+    id_serializer_class = ControllerUsersIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','user','controller','kuser_id',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return ControllerUsers.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(ControllerUsersList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(ControllerUsersList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class ControllerUsersDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ControllerUsers.objects.select_related().all()
+    serializer_class = ControllerUsersSerializer
+    id_serializer_class = ControllerUsersIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return ControllerUsers.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
+class DeploymentRoleList(generics.ListCreateAPIView):
+    queryset = DeploymentRole.objects.select_related().all()
+    serializer_class = DeploymentRoleSerializer
+    id_serializer_class = DeploymentRoleIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
     filter_fields = ('id','created','updated','enacted','backend_status','deleted','role',)
 
@@ -4795,7 +5320,7 @@
             return self.serializer_class
 
     def get_queryset(self):
-        return ControllerRole.select_by_user(self.request.user)
+        return DeploymentRole.select_by_user(self.request.user)
 
     def create(self, request, *args, **kwargs):
         serializer = self.get_serializer(data=request.DATA, files=request.FILES)
@@ -4807,21 +5332,21 @@
         obj = serializer.object
         obj.caller = request.user
         if obj.can_update(request.user):
-            return super(ControllerRoleList, self).create(request, *args, **kwargs)
+            return super(DeploymentRoleList, self).create(request, *args, **kwargs)
         else:
             raise Exception("failed obj.can_update")
 
-        ret = super(ControllerRoleList, self).create(request, *args, **kwargs)
+        ret = super(DeploymentRoleList, self).create(request, *args, **kwargs)
         if (ret.status_code%100 != 200):
             raise Exception(ret.data)
 
         return ret
 
 
-class ControllerRoleDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = ControllerRole.objects.select_related().all()
-    serializer_class = ControllerRoleSerializer
-    id_serializer_class = ControllerRoleIdSerializer
+class DeploymentRoleDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = DeploymentRole.objects.select_related().all()
+    serializer_class = DeploymentRoleSerializer
+    id_serializer_class = DeploymentRoleIdSerializer
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -4831,7 +5356,7 @@
             return self.serializer_class
     
     def get_queryset(self):
-        return ControllerRole.select_by_user(self.request.user)
+        return DeploymentRole.select_by_user(self.request.user)
 
     # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
 
@@ -4903,7 +5428,7 @@
     serializer_class = SiteDeploymentsSerializer
     id_serializer_class = SiteDeploymentsIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','site','deployment')
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','site','deployment','controller','availability_zone',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -4955,6 +5480,8 @@
 
     # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
 
+
+
 class SliceTagList(generics.ListCreateAPIView):
     queryset = SliceTag.objects.select_related().all()
     serializer_class = SliceTagSerializer
@@ -5014,12 +5541,12 @@
 
 
 
-class NetworkTemplateList(generics.ListCreateAPIView):
-    queryset = NetworkTemplate.objects.select_related().all()
-    serializer_class = NetworkTemplateSerializer
-    id_serializer_class = NetworkTemplateIdSerializer
+class ControllerDashboardList(generics.ListCreateAPIView):
+    queryset = ControllerDashboard.objects.select_related().all()
+    serializer_class = ControllerDashboardSerializer
+    id_serializer_class = ControllerDashboardIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','controller','dashboardView','url',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -5029,7 +5556,7 @@
             return self.serializer_class
 
     def get_queryset(self):
-        return NetworkTemplate.select_by_user(self.request.user)
+        return ControllerDashboard.select_by_user(self.request.user)
 
     def create(self, request, *args, **kwargs):
         serializer = self.get_serializer(data=request.DATA, files=request.FILES)
@@ -5041,21 +5568,21 @@
         obj = serializer.object
         obj.caller = request.user
         if obj.can_update(request.user):
-            return super(NetworkTemplateList, self).create(request, *args, **kwargs)
+            return super(ControllerDashboardList, self).create(request, *args, **kwargs)
         else:
             raise Exception("failed obj.can_update")
 
-        ret = super(NetworkTemplateList, self).create(request, *args, **kwargs)
+        ret = super(ControllerDashboardList, self).create(request, *args, **kwargs)
         if (ret.status_code%100 != 200):
             raise Exception(ret.data)
 
         return ret
 
 
-class NetworkTemplateDetail(PlanetStackRetrieveUpdateDestroyAPIView):
-    queryset = NetworkTemplate.objects.select_related().all()
-    serializer_class = NetworkTemplateSerializer
-    id_serializer_class = NetworkTemplateIdSerializer
+class ControllerDashboardDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ControllerDashboard.objects.select_related().all()
+    serializer_class = ControllerDashboardSerializer
+    id_serializer_class = ControllerDashboardIdSerializer
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -5065,7 +5592,7 @@
             return self.serializer_class
     
     def get_queryset(self):
-        return NetworkTemplate.select_by_user(self.request.user)
+        return ControllerDashboard.select_by_user(self.request.user)
 
     # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
 
@@ -5078,7 +5605,7 @@
     serializer_class = RouterSerializer
     id_serializer_class = RouterIdSerializer
     filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','owner',)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','name','owner','networks','networks',)
 
     def get_serializer_class(self):
         no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -5191,3 +5718,62 @@
 
 
 
+class ControllerSlicesList(generics.ListCreateAPIView):
+    queryset = ControllerSlices.objects.select_related().all()
+    serializer_class = ControllerSlicesSerializer
+    id_serializer_class = ControllerSlicesIdSerializer
+    filter_backends = (filters.DjangoFilterBackend,)
+    filter_fields = ('id','created','updated','enacted','backend_status','deleted','controller','slice','tenant_id',)
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+
+    def get_queryset(self):
+        return ControllerSlices.select_by_user(self.request.user)
+
+    def create(self, request, *args, **kwargs):
+        serializer = self.get_serializer(data=request.DATA, files=request.FILES)
+        if not (serializer.is_valid()):
+            response = {"error": "validation",
+                        "specific_error": "not serializer.is_valid()",
+                        "reasons": serializer.errors}
+            return Response(response, status=status.HTTP_400_BAD_REQUEST)
+        obj = serializer.object
+        obj.caller = request.user
+        if obj.can_update(request.user):
+            return super(ControllerSlicesList, self).create(request, *args, **kwargs)
+        else:
+            raise Exception("failed obj.can_update")
+
+        ret = super(ControllerSlicesList, self).create(request, *args, **kwargs)
+        if (ret.status_code%100 != 200):
+            raise Exception(ret.data)
+
+        return ret
+
+
+class ControllerSlicesDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+    queryset = ControllerSlices.objects.select_related().all()
+    serializer_class = ControllerSlicesSerializer
+    id_serializer_class = ControllerSlicesIdSerializer
+
+    def get_serializer_class(self):
+        no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
+        if (no_hyperlinks):
+            return self.id_serializer_class
+        else:
+            return self.serializer_class
+    
+    def get_queryset(self):
+        return ControllerSlices.select_by_user(self.request.user)
+
+    # update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+    # destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
+
+
+
