Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
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
+
+
+