CORD-1286 remove legacy admin and API
Change-Id: I32c95d6b82357960c6897aa2a29a9ce179f91405
diff --git a/xos/core/admin.py b/xos/core/admin.py
deleted file mode 100644
index 167d159..0000000
--- a/xos/core/admin.py
+++ /dev/null
@@ -1,1945 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import threading
-from cgi import escape as html_escape
-
-from core.models import *
-from core.models import Site
-from django import forms
-from django.contrib import admin, messages
-from django.contrib.admin.widgets import (AdminTextareaWidget,
- FilteredSelectMultiple)
-from django.contrib.auth.admin import UserAdmin
-from django.contrib.auth.forms import (AdminPasswordChangeForm,
- ReadOnlyPasswordHashField)
-from django.contrib.auth.models import Group
-from django.contrib.auth.signals import user_logged_in
-from django.contrib.contenttypes.admin import GenericTabularInline
-from django.core.exceptions import PermissionDenied, ValidationError
-from django.core.urlresolvers import NoReverseMatch, resolve, reverse
-from django.forms.utils import flatatt, to_current_timezone
-from django.utils import timezone
-from django.utils.encoding import force_text, python_2_unicode_compatible
-from django.utils.html import conditional_escape, format_html
-from django.utils.safestring import mark_safe
-from django.utils.text import capfirst
-from django.utils.translation import ugettext, ugettext_lazy
-from django.contrib.admin.actions import delete_selected
-from suit.widgets import LinkedSelect
-
-# thread locals necessary to work around a django-suit issue
-_thread_locals = threading.local()
-
-ICON_URLS = {"success": "/static/admin/img/icon_success.gif",
- "clock": "/static/admin/img/icon_clock.gif",
- "error": "/static/admin/img/icon_error.gif"}
-
-
-def backend_icon(obj):
- (icon, tooltip) = obj.get_backend_icon()
-
- icon_url = ICON_URLS.get(icon, "unknown")
-
- (exponent, last_success, last_failure, failures) = obj.get_backend_details()
-
- # FIXME: Need to clean this up by separating Javascript from Python
- if (obj.pk):
- script = """
- <script type="text/javascript">$(document).ready(function () {$("#show_details_%d").click(function () {$("#status%d").dialog({modal: true, height: 200, width: 200 });});});</script>
- """ % (obj.pk, obj.pk)
-
- div = """
- <div style="display:none;" id="status%d" title="Details">
- <p>Backoff Exponent: %r</p>
- <p>Last Success: %r</p>
- <p>Failures: %r</p>
- <p>Last Failure: %r</p>
- </div>
- """ % (obj.pk, exponent, last_success, failures, last_failure)
- a = '<a id="show_details_%d" href="#">' % obj.pk
- astop = '</a>'
- else:
- div = ''
- script = ''
- a = ''
- astop = ''
-
- if tooltip:
- return '%s %s <span style="min-width:16px;" title="%s">%s<img src="%s">%s</span>' % (script, div, tooltip, a, icon_url, astop)
- else:
- return '<span style="min-width:16px;"><img src="%s"></span>' % icon_url
-
-
-def backend_text(obj):
- (icon, tooltip) = obj.get_backend_icon()
- icon_url = ICON_URLS.get(icon, "unknown")
-
- return '<img src="%s"> POLICY=%s SYNC=%s' % (icon_url, obj.policy_status, tooltip)
-
-
-class UploadTextareaWidget(AdminTextareaWidget):
-
- def render(self, name, value, attrs=None):
- if value is None:
- value = ''
- final_attrs = self.build_attrs(attrs, name=name)
- return format_html('<input type="file" style="width: 0; height: 0" id="btn_upload_%s" onChange="uploadTextarea(event,\'%s\');">'
- '<button onClick="$(\'#btn_upload_%s\').click(); return false;">Upload</button>'
- '<br><textarea{0}>\r\n{1}</textarea>' % (
- attrs["id"], attrs["id"], attrs["id"]),
- flatatt(final_attrs),
- force_text(value))
-
-
-class SliderWidget(forms.HiddenInput):
-
- def render(self, name, value, attrs=None):
- if value is None:
- value = '0'
- final_attrs = self.build_attrs(attrs, name=name)
- attrs = attrs or attrs[:]
- attrs["name"] = name
- attrs["value"] = value
- html = """<div style="width:640px"><span id="%(id)s_label">%(value)s</span><div id="%(id)s_slider" style="float:right;width:610px;margin-top:5px"></div></div>
- <script>
- $(function() {
- $("#%(id)s_slider").slider({
- value: %(value)s,
- slide: function(event, ui) { $("#%(id)s").val( ui.value ); $("#%(id)s_label").html(ui.value); },
- });
- });
- </script>
- <input type="hidden" id="%(id)s" name="%(name)s" value="%(value)s"></input>
- """ % attrs
- html = html.replace("{", "{{").replace("}", "}}")
- return format_html(html,
- flatatt(final_attrs),
- force_text(value))
-
-
-class PlainTextWidget(forms.HiddenInput):
- input_type = 'hidden'
-
- def render(self, name, value, attrs=None):
- if value is None:
- value = ''
- return mark_safe(str(value) + super(PlainTextWidget, self).render(name, value, attrs))
-
-
-class XOSAdminMixin(object):
- # call save_by_user and delete_by_user instead of save and delete
-
- def has_add_permission(self, request, obj=None):
- return (not self.__user_is_readonly(request))
-
- def has_delete_permission(self, request, obj=None):
- return (not self.__user_is_readonly(request))
-
- def save_model(self, request, obj, form, change):
- if self.__user_is_readonly(request):
- # this 'if' might be redundant if save_by_user is implemented right
- raise PermissionDenied
-
- # reset exponential backoff
- if hasattr(obj, "backend_register"):
- obj.backend_register = "{}"
-
- obj.caller = request.user
- # update openstack connection to use this site/tenant
- obj.save()
-
- def delete_model(self, request, obj):
- obj.delete()
-
- def save_formset(self, request, form, formset, change):
- instances = formset.save(commit=False)
- for instance in instances:
- instance.caller = request.user
- instance.save()
-
- # BUG in django 1.7? Objects are not deleted by formset.save if
- # commit is False. So let's delete them ourselves.
- #
- # code from forms/models.py save_existing_objects()
- try:
- forms_to_delete = formset.deleted_forms
- except AttributeError:
- forms_to_delete = []
- if formset.initial_forms:
- for form in formset.initial_forms:
- obj = form.instance
- if form in forms_to_delete:
- if obj.pk is None:
- continue
- formset.deleted_objects.append(obj)
- obj.delete()
-
- formset.save_m2m()
-
- def get_actions(self, request):
- actions = super(XOSAdminMixin, self).get_actions(request)
-
- if self.__user_is_readonly(request):
- if 'delete_selected' in actions:
- del actions['delete_selected']
-
- return actions
-
- def url_for_model_changelist(self, request, model):
- # used in add_extra_context
- return reverse('admin:%s_%s_changelist' % (model._meta.app_label, model._meta.model_name), current_app=model._meta.app_label)
-
- def add_extra_context(self, request, extra_context):
- # allow custom application breadcrumb url and name
- extra_context["custom_app_breadcrumb_url"] = getattr(
- self, "custom_app_breadcrumb_url", None)
- extra_context["custom_app_breadcrumb_name"] = getattr(
- self, "custom_app_breadcrumb_name", None)
- extra_context["custom_changelist_breadcrumb_url"] = getattr(
- self, "custom_changelist_breadcrumb_url", None)
-
- # for Service admins to render their Administration page
- if getattr(self, "extracontext_registered_admins", False):
- admins = []
- for model, model_admin in admin.site._registry.items():
- if model == self.model:
- continue
- if model._meta.app_label == self.model._meta.app_label:
- info = {"app": model._meta.app_label,
- "model": model._meta.model_name,
- "name": capfirst(model._meta.verbose_name_plural),
- "url": self.url_for_model_changelist(request, model)}
- admins.append(info)
- extra_context["registered_admins"] = admins
-
- def change_view(self, request, object_id, extra_context=None):
- extra_context = extra_context or {}
-
- if self.__user_is_readonly(request):
- if not hasattr(self, "readonly_save"):
- # save the original readonly fields
- self.readonly_save = self.readonly_fields
- self.inlines_save = self.inlines
- if hasattr(self, "user_readonly_fields"):
- self.readonly_fields = self.user_readonly_fields
- if hasattr(self, "user_readonly_inlines"):
- self.inlines = self.user_readonly_inlines
- else:
- if hasattr(self, "readonly_save"):
- # restore the original readonly fields
- self.readonly_fields = self.readonly_save
- if hasattr(self, "inlines_save"):
- self.inlines = self.inlines_save
-
- self.add_extra_context(request, extra_context)
-
- try:
- return super(XOSAdminMixin, self).change_view(request, object_id, extra_context=extra_context)
- except PermissionDenied:
- pass
- except ValidationError as e:
- if (e.params is None):
- # Validation errors that don't reference a specific field will
- # often throw a non-descriptive 500 page to the user. The code
- # below will cause an error message to be printed and the
- # page refreshed instead.
- # As a side-effect it turns the request back into a 'GET' which
- # may wipe anything the user had changed on the page. But, at
- # least the user gets a real error message.
- # TODO: revisit this and display some kind of error view
- request.method = 'GET'
- messages.error(request, e.message)
- return super(XOSAdminMixin, self).change_view(request, object_id, extra_context=extra_context)
- else:
- raise
- if request.method == 'POST':
- raise PermissionDenied
- request.readonly = True
- return super(XOSAdminMixin, self).change_view(request, object_id, extra_context=extra_context)
-
- def changelist_view(self, request, extra_context=None):
- extra_context = extra_context or {}
-
- self.add_extra_context(request, extra_context)
-
- return super(XOSAdminMixin, self).changelist_view(request, extra_context=extra_context)
-
- def add_view(self, request, form_url='', extra_context=None):
- extra_context = extra_context or {}
-
- self.add_extra_context(request, extra_context)
-
- return super(XOSAdminMixin, self).add_view(request, form_url, extra_context=extra_context)
-
- def __user_is_readonly(self, request):
- return request.user.isReadOnlyUser()
-
- def backend_status_text(self, obj):
- return mark_safe(backend_text(obj))
-
- def backend_status_icon(self, obj):
- return mark_safe(backend_icon(obj))
- backend_status_icon.short_description = ""
-
- def get_form(self, request, obj=None, **kwargs):
- # Save obj and request in thread-local storage, so suit_form_tabs can
- # use it to determine whether we're in edit or add mode, and can
- # determine whether the user is an admin.
- _thread_locals.request = request
- _thread_locals.obj = obj
- return super(XOSAdminMixin, self).get_form(request, obj, **kwargs)
-
- def get_inline_instances(self, request, obj=None):
- inlines = super(XOSAdminMixin, self).get_inline_instances(request, obj)
-
- # inlines that should only be shown to an admin user
- if request.user.is_admin:
- for inline_class in getattr(self, "admin_inlines", []):
- inlines.append(inline_class(self.model, self.admin_site))
-
- return inlines
-
- # see http://stackoverflow.com/questions/1471909/django-model-delete-not-triggered
- class SafeDeleteQuerysetWrapper(object):
- def __init__(self, wrapped_queryset):
- self.wrapped_queryset = wrapped_queryset
-
- def _safe_delete(self):
- for obj in list(self.wrapped_queryset):
- obj.delete()
-
- def __getattr__(self, attr):
- if attr == 'delete':
- return self._safe_delete
- else:
- return getattr(self.wrapped_queryset, attr)
-
- def __iter__(self):
- for obj in list(self.wrapped_queryset):
- yield obj
-
- def __getitem__(self, index):
- return self.wrapped_queryset[index]
-
- def __len__(self):
- return len(self.wrapped_queryset)
-
- def get_actions(self, request):
- actions = super(XOSAdminMixin, self).get_actions(request)
- actions['delete_selected'] = (XOSAdminMixin.action_safe_bulk_delete, 'delete_selected', ugettext_lazy("Delete selected %(verbose_name_plural)s"))
- return actions
-
- def action_safe_bulk_delete(self, request, queryset):
- wrapped_queryset = XOSAdminMixin.SafeDeleteQuerysetWrapper(queryset)
- return delete_selected(self, request, wrapped_queryset)
-
-
-class ReadOnlyAwareAdmin(XOSAdminMixin, admin.ModelAdmin):
- # Note: Make sure XOSAdminMixin is listed before
- # admin.ModelAdmin in the class declaration.
-
- pass
-
-
-class XOSBaseAdmin(ReadOnlyAwareAdmin):
- save_on_top = False
-
-
-class SingletonAdmin (ReadOnlyAwareAdmin):
-
- def has_add_permission(self, request):
- if not super(SingletonAdmin, self).has_add_permission(request):
- return False
-
- num_objects = self.model.objects.count()
- if num_objects >= 1:
- return False
- else:
- return True
-
-
-class ServiceAppAdmin (SingletonAdmin):
- extracontext_registered_admins = True
-
-
-class XOSTabularInline(admin.TabularInline):
-
- def __init__(self, *args, **kwargs):
- super(XOSTabularInline, self).__init__(*args, **kwargs)
-
- # InlineModelAdmin as no get_fields() method, so in order to add
- # the selflink field, we override __init__ to modify self.fields and
- # self.readonly_fields.
-
- self.setup_selflink()
-
- @property
- def selflink_model(self):
- if hasattr(self, "selflink_fieldname"):
- """ self.selflink_model can be defined to punch through a relation
- to its target object. For example, in SliceNetworkInline, set
- selflink_model = "network", and the URL will lead to the Network
- object instead of trying to bring up a change view of the
- SliceNetwork object.
- """
- return getattr(self.model, self.selflink_fieldname).field.rel.to
- else:
- return self.model
-
- @property
- def selflink_reverse_path(self):
- return "admin:%s_change" % (self.selflink_model._meta.db_table)
-
- def get_change_url(self, id):
- """ Get the URL to a change form in the admin for this model """
- reverse_path = self.selflink_reverse_path # "admin:%s_change" % (self.selflink_model._meta.db_table)
- try:
- url = reverse(reverse_path, args=(id,))
- except NoReverseMatch:
- return None
-
- return url
-
- def setup_selflink(self):
- url = self.get_change_url(0)
-
- # We don't have an admin for this object, so don't create the
- # selflink.
- if (url == None):
- return
-
- # Since we need to add "selflink" to the field list, we need to create
- # self.fields if it is None.
- if (self.fields is None):
- self.fields = []
- for f in self.model._meta.fields:
- if f.editable and f.name != "id":
- self.fields.append(f.name)
-
- self.fields = tuple(self.fields) + ("selflink", )
-
- if self.readonly_fields is None:
- self.readonly_fields = ()
-
- self.readonly_fields = tuple(self.readonly_fields) + ("selflink", )
-
- def selflink(self, obj):
- if hasattr(self, "selflink_fieldname"):
- obj = getattr(obj, self.selflink_fieldname)
-
- if obj.id:
- url = self.get_change_url(obj.id)
- return "<a href='%s'>Details</a>" % str(url)
- else:
- return "Not present"
-
- selflink.allow_tags = True
- selflink.short_description = "Details"
-
- def has_add_permission(self, request):
- return not request.user.isReadOnlyUser()
-
- def get_readonly_fields(self, request, obj=None):
- readonly_fields = list(self.readonly_fields)[:]
- if request.user.isReadOnlyUser():
- for field in self.fields:
- if not field in readonly_fields:
- readonly_fields.append(field)
- return readonly_fields
-
- def backend_status_icon(self, obj):
- return mark_safe(backend_icon(obj))
- backend_status_icon.short_description = ""
-
-
-class PlStackGenericTabularInline(GenericTabularInline):
-
- def has_add_permission(self, request):
- return not request.user.isReadOnlyUser()
-
- def get_readonly_fields(self, request, obj=None):
- readonly_fields = list(self.readonly_fields)[:]
- if request.user.isReadOnlyUser():
- for field in self.fields:
- if not field in readonly_fields:
- readonly_fields.append(field)
- return readonly_fields
-
- def backend_status_icon(self, obj):
- return mark_safe(backend_icon(obj))
- backend_status_icon.short_description = ""
-
-
-
-class TagInline(PlStackGenericTabularInline):
- model = Tag
- extra = 0
- suit_classes = 'suit-tab suit-tab-tags'
- fields = ['service', 'name', 'value']
-
- def queryset(self, request):
- return Tag.select_by_user(request.user)
-
-
-class InstanceInline(XOSTabularInline):
- model = Instance
- fields = ['backend_status_icon', 'all_ips_string', 'instance_id',
- 'instance_name', 'slice', 'deployment', 'flavor', 'image', 'node']
- extra = 0
- max_num = 0
- readonly_fields = ['backend_status_icon', 'all_ips_string', 'instance_id',
- 'instance_name', 'slice', 'deployment', 'flavor', 'image', 'node']
- suit_classes = 'suit-tab suit-tab-instances'
-
- def queryset(self, request):
- return Instance.select_by_user(request.user)
-
- def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
- if db_field.name == 'deployment':
-# kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(
-# sitedeployments__nodes__isnull=False).distinct()
- kwargs['widget'] = forms.Select(
- attrs={'onChange': "instance_deployment_changed(this);"})
- if db_field.name == 'flavor':
- kwargs['widget'] = forms.Select(
- attrs={'onChange': "instance_flavor_changed(this);"})
-
- field = super(InstanceInline, self).formfield_for_foreignkey(
- db_field, request, **kwargs)
-
- return field
-
-
-class CordInstanceInline(XOSTabularInline):
- model = Instance
- fields = ['backend_status_icon', 'all_ips_string', 'instance_id',
- 'instance_name', 'slice', 'flavor', 'image', 'node']
- extra = 0
- readonly_fields = ['backend_status_icon',
- 'all_ips_string', 'instance_id', 'instance_name']
- suit_classes = 'suit-tab suit-tab-instances'
-
- def queryset(self, request):
- return Instance.select_by_user(request.user)
-
- def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
- if db_field.name == 'deployment':
-
-# kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(
-# sitedeployments__nodes__isnull=False).distinct()
- kwargs['widget'] = forms.Select(
- attrs={'onChange': "instance_deployment_changed(this);"})
- if db_field.name == 'flavor':
- kwargs['widget'] = forms.Select(
- attrs={'onChange': "instance_flavor_changed(this);"})
-
- field = super(CordInstanceInline, self).formfield_for_foreignkey(
- db_field, request, **kwargs)
-
- return field
-
-
-class SiteInline(XOSTabularInline):
- model = Site
- extra = 0
- suit_classes = 'suit-tab suit-tab-sites'
-
- def queryset(self, request):
- return Site.select_by_user(request.user)
-
-
-class SiteHostsNodesInline(SiteInline):
-
- def queryset(self, request):
- return Site.select_by_user(request.user).filter(hosts_nodes=True)
-
-
-class SiteHostsUsersInline(SiteInline):
-
- def queryset(self, request):
- return Site.select_by_user(request.user).filter(hosts_users=True)
-
-
-class UserInline(XOSTabularInline):
- model = User
- fields = ['backend_status_icon', 'email', 'firstname', 'lastname']
- readonly_fields = ('backend_status_icon', )
- extra = 0
- suit_classes = 'suit-tab suit-tab-users'
-
- def queryset(self, request):
- return User.select_by_user(request.user)
-
-
-class SliceInline(XOSTabularInline):
- model = Slice
- fields = ['backend_status_icon', 'name', 'site', 'service']
- readonly_fields = ('backend_status_icon', )
- extra = 0
- suit_classes = 'suit-tab suit-tab-slices'
-
- def queryset(self, request):
- return Slice.select_by_user(request.user)
-
-
-class NodeInline(XOSTabularInline):
- model = Node
- extra = 0
- suit_classes = 'suit-tab suit-tab-nodes'
- fields = ['backend_status_icon', 'name', 'site_deployment']
- readonly_fields = ('backend_status_icon', )
-
-
-class DeploymentPrivilegeInline(XOSTabularInline):
- model = DeploymentPrivilege
- extra = 0
- suit_classes = 'suit-tab suit-tab-deploymentprivileges'
- fields = ['backend_status_icon', 'user', 'role', 'deployment']
- readonly_fields = ('backend_status_icon', )
-
- def queryset(self, request):
- return DeploymentPrivilege.select_by_user(request.user)
-
-
-class ControllerSiteInline(XOSTabularInline):
- model = ControllerSite
- extra = 0
- suit_classes = 'suit-tab suit-tab-admin-only'
- fields = ['controller', 'site', 'tenant_id']
-
-
-class SitePrivilegeInline(XOSTabularInline):
- model = SitePrivilege
- extra = 0
- suit_classes = 'suit-tab suit-tab-siteprivileges'
- fields = ['backend_status_icon', 'user', 'site', 'role']
- readonly_fields = ('backend_status_icon', )
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'site':
- kwargs['queryset'] = Site.select_by_user(request.user)
-
- if db_field.name == 'user':
- kwargs['queryset'] = User.select_by_user(request.user)
- return super(SitePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- return SitePrivilege.select_by_user(request.user)
-
-
-class ServicePrivilegeInline(XOSTabularInline):
- model = ServicePrivilege
- extra = 0
- suit_classes = 'suit-tab suit-tab-serviceprivileges'
- fields = ['backend_status_icon', 'user', 'service', 'role']
- readonly_fields = ('backend_status_icon', )
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'service':
- kwargs['queryset'] = Service.select_by_user(request.user)
- if db_field.name == 'user':
- kwargs['queryset'] = User.select_by_user(request.user)
- return super(ServicePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- return ServicePrivilege.select_by_user(request.user)
-
-
-class SiteDeploymentInline(XOSTabularInline):
- model = SiteDeployment
- extra = 0
- suit_classes = 'suit-tab suit-tab-sitedeployments'
- fields = ['backend_status_icon', 'deployment', 'site', 'controller']
- readonly_fields = ('backend_status_icon', )
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'site':
- kwargs['queryset'] = Site.select_by_user(request.user)
-
- if db_field.name == 'deployment':
- kwargs['queryset'] = Deployment.select_by_user(request.user)
-
- if db_field.name == 'controller':
- if len(resolve(request.path).args) > 0:
- kwargs['queryset'] = Controller.select_by_user(request.user).filter(
- deployment__id=int(resolve(request.path).args[0]))
-
- return super(SiteDeploymentInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- return SiteDeployment.select_by_user(request.user)
-
-
-class SlicePrivilegeInline(XOSTabularInline):
- model = SlicePrivilege
- suit_classes = 'suit-tab suit-tab-sliceprivileges'
- extra = 0
- fields = ('backend_status_icon', 'user', 'slice', 'role')
- readonly_fields = ('backend_status_icon', )
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'slice':
- kwargs['queryset'] = Slice.select_by_user(request.user)
- if db_field.name == 'user':
- # all users are available to be granted SlicePrivilege
- kwargs['queryset'] = User.objects.all()
-
- return super(SlicePrivilegeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- return SlicePrivilege.select_by_user(request.user)
-
-
-class SliceNetworkInline(XOSTabularInline):
- model = Network.slices.through
- selflink_fieldname = "network"
- extra = 0
- verbose_name = "Network Connection"
- verbose_name_plural = "Network Connections"
- suit_classes = 'suit-tab suit-tab-slicenetworks'
- fields = ['backend_status_icon', 'network']
- readonly_fields = ('backend_status_icon', )
-
-
-class ImageDeploymentsInline(XOSTabularInline):
- model = ImageDeployments
- extra = 0
- verbose_name = "Image Deployments"
- verbose_name_plural = "Image Deployments"
- suit_classes = 'suit-tab suit-tab-imagedeployments'
- fields = ['backend_status_icon', 'image', 'deployment']
- readonly_fields = ['backend_status_icon']
-
-
-class ControllerImagesInline(XOSTabularInline):
- model = ControllerImages
- extra = 0
- verbose_name = "Controller Images"
- verbose_name_plural = "Controller Images"
- suit_classes = 'suit-tab suit-tab-admin-only'
- fields = ['backend_status_icon', 'image', 'controller', 'glance_image_id']
- readonly_fields = ['backend_status_icon', 'glance_image_id']
-
-
-class SliceRoleAdmin(XOSBaseAdmin):
- model = SliceRole
- pass
-
-
-class SiteRoleAdmin(XOSBaseAdmin):
- model = SiteRole
- pass
-
-
-class DeploymentAdminForm(forms.ModelForm):
- class Meta:
- model = Deployment
- fields = '__all__'
-
- def __init__(self, *args, **kwargs):
- request = kwargs.pop('request', None)
- super(DeploymentAdminForm, self).__init__(*args, **kwargs)
-
- self.fields['accessControl'].initial = "allow site " + \
- request.user.site.name
-
-class DeploymentAdminROForm(DeploymentAdminForm):
-
- def save(self, commit=True):
- raise PermissionDenied
-
-
-class SiteAssocInline(XOSTabularInline):
- model = Site.deployments.through
- extra = 0
- suit_classes = 'suit-tab suit-tab-sites'
-
-
-class DeploymentAdmin(XOSBaseAdmin):
- model = Deployment
- fieldList = ['backend_status_text', 'name', 'accessControl']
- fieldsets = [
- (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]
- # node no longer directly connected to deployment
- inlines = [DeploymentPrivilegeInline,
- ImageDeploymentsInline, SiteDeploymentInline]
- list_display = ['backend_status_icon', 'name']
- list_display_links = ('backend_status_icon', 'name', )
- readonly_fields = ('backend_status_text', )
-
- user_readonly_fields = ['name']
-
- # nodes no longer direclty connected to deployments
- suit_form_tabs = (('general', 'Deployment Details'),
- ('deploymentprivileges', 'Privileges'), ('sitedeployments', 'Sites'))
-
- def get_form(self, request, obj=None, **kwargs):
- if request.user.isReadOnlyUser() or not request.user.is_admin:
- kwargs["form"] = DeploymentAdminROForm
- else:
- kwargs["form"] = DeploymentAdminForm
- adminForm = super(DeploymentAdmin, self).get_form(
- request, obj, **kwargs)
-
- # from stackexchange: pass the request object into the form
-
- class AdminFormMetaClass(adminForm):
-
- def __new__(cls, *args, **kwargs):
- kwargs['request'] = request
- return adminForm(*args, **kwargs)
-
- return AdminFormMetaClass
-
-
-class ControllerAdminForm(forms.ModelForm):
- backend_disabled = forms.BooleanField(required=False)
-
- class Meta:
- model = Controller
- fields = '__all__'
-
- def __init__(self, *args, **kwargs):
- request = kwargs.pop('request', None)
- super(ControllerAdminForm, self).__init__(*args, **kwargs)
-
- if self.instance and self.instance.pk:
- self.fields['backend_disabled'].initial = self.instance.get_backend_register(
- 'disabled', False)
- else:
- # defaults when adding new controller
- self.fields['backend_disabled'].initial = False
-
- def save(self, commit=True):
- self.instance.set_backend_register(
- "disabled", self.cleaned_data["backend_disabled"])
- return super(ControllerAdminForm, self).save(commit=commit)
-
-
-class ControllerAdmin(XOSBaseAdmin):
- model = Controller
- fieldList = ['deployment', 'name', 'backend_type', 'backend_disabled', 'version', 'auth_url', 'admin_user',
- 'admin_tenant', 'admin_password', 'domain', 'rabbit_host', 'rabbit_user', 'rabbit_password']
- fieldsets = [
- (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]
- inlines = [ControllerSiteInline] # ,ControllerImagesInline]
- list_display = ['backend_status_icon', 'name', 'version', 'backend_type']
- list_display_links = ('backend_status_icon', 'name', )
- readonly_fields = ('backend_status_text',)
- form = ControllerAdminForm
-
- user_readonly_fields = []
-
- def save_model(self, request, obj, form, change):
- # update openstack connection to use this site/tenant
- obj.save()
-
- def delete_model(self, request, obj):
- obj.delete()
-
- def queryset(self, request):
- return Controller.select_by_user(request.user)
-
- @property
- def suit_form_tabs(self):
- tabs = [('general', 'Controller Details'),
- ]
-
- request = getattr(_thread_locals, "request", None)
- if request and request.user.is_admin:
- tabs.append(('admin-only', 'Admin-Only'))
-
- return tabs
-
-
-class ServiceInstanceAttributeAdmin(XOSBaseAdmin):
- model = ServiceInstanceAttribute
- list_display = ('backend_status_icon', 'tenant', 'name', 'value')
- list_display_links = ('backend_status_icon', 'name')
- fieldList = ('backend_status_text', 'tenant', 'name', 'value', )
- fieldsets = [
- (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text', )
-
- suit_form_tabs = (('general', 'Tenant Root Details'),
- )
-class ProviderLinkInline(XOSTabularInline):
- model = ServiceInstanceLink
- fields = ['provider_service_instance', 'subscriber_service_instance', 'subscriber_service']
- extra = 0
- suit_classes = 'suit-tab suit-tab-servicelinks'
- fk_name = 'provider_service_instance'
- verbose_name = 'provided links'
- verbose_name_plural = 'provided links'
-
-class SubscriberLinkInline(XOSTabularInline):
- model = ServiceInstanceLink
- fields = ['provider_service_instance', 'subscriber_service_instance', 'subscriber_service']
- extra = 0
- suit_classes = 'suit-tab suit-tab-servicelinks'
- fk_name = 'subscriber_service_instance'
- verbose_name = 'subscribed links'
- verbose_name_plural = 'subscribed links'
-
-
-class ServiceInstanceAttrAsTabInline(XOSTabularInline):
- model = ServiceInstanceAttribute
- fields = ['name', 'value']
- extra = 0
- suit_classes = 'suit-tab suit-tab-serviceinstanceattrs'
-
-class ProviderDependencyInline(XOSTabularInline):
- model = ServiceDependency
- fields = ['provider_service', 'subscriber_service', 'connect_method']
- extra = 0
- suit_classes = 'suit-tab suit-tab-servicetenants'
- fk_name = 'provider_service'
- verbose_name = 'provided dependency'
- verbose_name_plural = 'provided dependencies'
-
-
-class SubscriberDependencyInline(XOSTabularInline):
- model = ServiceDependency
- fields = ['provider_service', 'subscriber_service', 'connect_method']
- extra = 0
- suit_classes = 'suit-tab suit-tab-servicetenants'
- fk_name = 'subscriber_service'
- verbose_name = 'subscribed dependency'
- verbose_name_plural = 'subscribed dependencies'
-
-class ServiceAttrAsTabInline(XOSTabularInline):
- model = ServiceAttribute
- fields = ['name', 'value']
- extra = 0
- suit_classes = 'suit-tab suit-tab-serviceattrs'
-
-class ServiceInterfaceAsTabInline(XOSTabularInline):
- model = ServiceInterface
- fields = ['interface_type']
- extra = 0
- suit_classes = 'suit-tab suit-tab-serviceinterfaces'
-
-class ServiceMonitoringAgentInfoInline(XOSTabularInline):
- model = ServiceMonitoringAgentInfo
- fields = ['name', 'target_uri']
- extra = 0
- suit_classes = 'suit-tab suit-tab-servicemonitoringagents'
- verbose_name = 'Monitoring agent info for this service'
- verbose_name_plural = 'Monitoring agent info for this service'
-
-
-class ServiceAdmin(XOSBaseAdmin):
- list_display = ("backend_status_icon", "name", "kind", "enabled", "published")
- list_display_links = ('backend_status_icon', 'name', )
- fieldList = ["backend_status_text", "name", "kind", "description", "enabled", "published",
- "view_url", "icon_url", "public_key", "private_key_fn", "service_specific_attribute", "service_specific_id"]
- fieldsets = [
- (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]
- inlines = [ServiceAttrAsTabInline, SliceInline, ProviderDependencyInline,
- SubscriberDependencyInline, ServicePrivilegeInline, ServiceMonitoringAgentInfoInline, ServiceInterfaceAsTabInline]
- readonly_fields = ('backend_status_text', )
-
- user_readonly_fields = fieldList
-
- suit_form_tabs = (('general', 'Service Details'),
- ('slices', 'Slices'),
- ('serviceattrs', 'Additional Attributes'),
- ('servicetenants', 'Dependencies'),
- ('serviceprivileges', 'Privileges'),
- ('serviceinterfaces', 'Interfaces'),
- ('servicemonitoringagents', 'Monitoring Agents')
- )
-
-class XosModelAdmin(XOSBaseAdmin):
- list_display = ("backend_status_icon", "name",)
- list_display_links = ('backend_status_icon', 'name',)
- fieldList = ["name",]
- fieldsets = [
- (None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text', )
-
- user_readonly_fields = fieldList
-
- suit_form_tabs = (('general', 'XOS Details'),
- ('volumes', 'Volume Mounts'),
- )
-
-
-class SiteNodeInline(XOSTabularInline):
- model = Node
- fields = ['name', 'site_deployment']
- extra = 0
- suit_classes = 'suit-tab suit-tab-nodes'
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- # only display site deployments associated with this site
- if db_field.name == 'site_deployment':
- kwargs['queryset'] = SiteDeployment.objects.filter(
- site__id=int(request.path.split('/')[-2]))
-
- return super(SiteNodeInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
-
-class SiteAdmin(XOSBaseAdmin):
- #fieldList = ['backend_status_text', 'name', 'site_url', 'enabled', 'is_public', 'login_base', 'accountLink','location']
- fieldList = ['backend_status_text', 'name', 'site_url', 'enabled',
- 'login_base', 'is_public', 'hosts_nodes', 'hosts_users', 'latitude', 'longitude']
- fieldsets = [
- (None, {'fields': fieldList, 'classes': [
- 'suit-tab suit-tab-general']}),
- #('Deployment Networks', {'fields': ['deployments'], 'classes':['suit-tab suit-tab-deployments']}),
- ]
- #readonly_fields = ['backend_status_text', 'accountLink']
- readonly_fields = ['backend_status_text']
-
- #user_readonly_fields = ['name', 'deployments','site_url', 'enabled', 'is_public', 'login_base', 'accountLink']
- user_readonly_fields = ['name', 'deployments', 'site_url',
- 'enabled', 'is_public', 'login_base', 'hosts_nodes', 'hosts_users']
-
- list_display = ('backend_status_icon', 'name',
- 'login_base', 'site_url', 'enabled')
- list_display_links = ('backend_status_icon', 'name', )
- filter_horizontal = ('deployments',)
- inlines = [SliceInline, UserInline,
- SitePrivilegeInline, SiteNodeInline]
- admin_inlines = [ControllerSiteInline]
- search_fields = ['name']
-
- suit_form_includes = (
- ('../templates/admin/core/site/location_map.html', 'middle'),
- )
-
- @property
- def suit_form_tabs(self):
- tabs = [('general', 'Site Details'),
- ('users', 'Users'),
- ('siteprivileges', 'Privileges'),
- ('slices', 'Slices'),
- ('nodes', 'Nodes'),
- ]
-
- request = getattr(_thread_locals, "request", None)
- if request and request.user.is_admin:
- tabs.append(('admin-only', 'Admin-Only'))
-
- return tabs
-
- def queryset(self, request):
- return Site.select_by_user(request.user)
-
- def get_formsets(self, request, obj=None):
- for inline in self.get_inline_instances(request, obj):
- # hide MyInline in the add view
- if obj is None:
- continue
- if isinstance(inline, InstanceInline):
- inline.model.caller = request.user
- yield inline.get_formset(request, obj)
-
- def accountLink(self, obj):
- link_obj = obj.accounts.all()
- if link_obj:
- reverse_path = "admin:core_account_change"
- url = reverse(reverse_path, args=(link_obj[0].id,))
- return "<a href='%s'>%s</a>" % (url, "view billing details")
- else:
- return "no billing data for this site"
- accountLink.allow_tags = True
- accountLink.short_description = "Billing"
-
- def save_model(self, request, obj, form, change):
- # update openstack connection to use this site/tenant
- obj.save()
-
- def delete_model(self, request, obj):
- obj.delete()
-
-
-class SitePrivilegeAdmin(XOSBaseAdmin):
- fieldList = ['backend_status_text', 'user', 'site', 'role']
- fieldsets = [
- (None, {'fields': fieldList, 'classes': ['collapse']})
- ]
- readonly_fields = ('backend_status_text', )
- list_display = ('backend_status_icon', 'user', 'site', 'role')
- list_display_links = list_display
- user_readonly_fields = fieldList
- user_readonly_inlines = []
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'site':
- if not request.user.is_admin:
- # only show sites where user is an admin or pi
- sites = set()
- for site_privilege in SitePrivilege.objects.filer(user=request.user):
- if site_privilege.role.role_type in ['admin', 'pi']:
- sites.add(site_privilege.site)
- kwargs['queryset'] = Site.objects.filter(site__in=list(sites))
-
- if db_field.name == 'user':
- if not request.user.is_admin:
- # only show users from sites where caller has admin or pi role
- roles = Role.objects.filter(role_type__in=['admin', 'pi'])
- site_privileges = SitePrivilege.objects.filter(
- user=request.user).filter(role__in=roles)
- sites = [site_privilege.site for site_privilege in site_privileges]
- site_privileges = SitePrivilege.objects.filter(site__in=sites)
- emails = [
- site_privilege.user.email for site_privilege in site_privileges]
- users = User.objects.filter(email__in=emails)
- kwargs['queryset'] = users
-
- return super(SitePrivilegeAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- # admins can see all privileges. Users can only see privileges at sites
- # where they have the admin role or pi role.
- qs = super(SitePrivilegeAdmin, self).queryset(request)
- # if not request.user.is_admin:
- # roles = Role.objects.filter(role_type__in=['admin', 'pi'])
- # site_privileges = SitePrivilege.objects.filter(user=request.user).filter(role__in=roles)
- # login_bases = [site_privilege.site.login_base for site_privilege in site_privileges]
- # sites = Site.objects.filter(login_base__in=login_bases)
- # qs = qs.filter(site__in=sites)
- return qs
-
-
-class SliceForm(forms.ModelForm):
-
- class Meta:
- model = Slice
- widgets = {
- 'service': LinkedSelect
- }
- fields = '__all__'
-
- def clean(self):
- cleaned_data = super(SliceForm, self).clean()
- name = cleaned_data.get('name')
- site = cleaned_data.get('site')
- slice_id = self.instance.id
- if not site and slice_id:
- site = Slice.objects.get(id=slice_id).site
- if (not isinstance(site, Site)):
- # previous code indicates 'site' could be a site_id and not a site?
- site = Slice.objects.get(id=site.id)
- if not name.startswith(site.login_base):
- raise forms.ValidationError(
- 'slice name must begin with %s' % site.login_base)
- return cleaned_data
-
-
-class ControllerSliceInline(XOSTabularInline):
- model = ControllerSlice
- extra = 0
- verbose_name = "Controller Slices"
- verbose_name_plural = "Controller Slices"
- suit_classes = 'suit-tab suit-tab-admin-only'
- fields = ['backend_status_icon', 'controller', 'tenant_id']
- readonly_fields = ('backend_status_icon', 'controller')
-
-
-class SliceAdmin(XOSBaseAdmin):
- form = SliceForm
- fieldList = ['backend_status_text', 'site', 'name', 'enabled',
- 'description', 'service', 'slice_url', 'max_instances', "default_isolation", "default_image", "network"]
- fieldsets = [('Slice Details', {'fields': fieldList, 'classes': [
- 'suit-tab suit-tab-general']}), ]
- readonly_fields = ('backend_status_text', )
- list_display = ('backend_status_icon', 'name', 'site',
- 'slice_url', 'max_instances')
- list_display_links = ('backend_status_icon', 'name', )
- normal_inlines = [SlicePrivilegeInline, InstanceInline,
- SliceNetworkInline]
- inlines = normal_inlines
- admin_inlines = [ControllerSliceInline]
- suit_form_includes = (('slice_instance_tab.html', 'bottom', 'instances'),)
-
- user_readonly_fields = fieldList
-
- @property
- def suit_form_tabs(self):
- tabs = [('general', 'Slice Details'),
- ('slicenetworks', 'Networks'),
- ('sliceprivileges', 'Privileges'),
- ('instances', 'Instances'),
- ]
-
- request = getattr(_thread_locals, "request", None)
- if request and request.user.is_admin:
- tabs.append(('admin-only', 'Admin-Only'))
-
- return tabs
-
- def add_view(self, request, form_url='', extra_context=None):
- # Ugly hack for CORD
- self.inlines = self.normal_inlines
- # revert to default read-only fields
- self.readonly_fields = ('backend_status_text',)
- return super(SliceAdmin, self).add_view(request, form_url, extra_context=extra_context)
-
- def change_view(self, request, object_id, form_url='', extra_context=None):
- # cannot change the site of an existing slice so make the site field
- # read only
- if object_id:
- self.readonly_fields = ('backend_status_text', 'site')
-
- return super(SliceAdmin, self).change_view(request, object_id, form_url)
-
- def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
- deployment_nodes = []
- for node in Node.objects.all():
- deployment_nodes.append(
- (node.site_deployment.deployment.id, node.id, node.name))
-
- # Limiting flavors/images by deployment is no longer supported, so assume every deployment supports
- # everything.
- deployment_flavors = []
- deployment_images = []
- for deployment in Deployment.objects.all():
- for flavor in Flavor.objects.all():
- deployment_flavors.append(
- (deployment.id, flavor.id, flavor.name))
- for image in Image.objects.all():
- deployment_images.append(
- (deployment.id, image.id, image.name))
-
- site_login_bases = []
- for site in Site.objects.all():
- site_login_bases.append((site.id, site.login_base))
-
- context["deployment_nodes"] = deployment_nodes
- context["deployment_flavors"] = deployment_flavors
- context["deployment_images"] = deployment_images
- context["site_login_bases"] = site_login_bases
- return super(SliceAdmin, self).render_change_form(request, context, add, change, form_url, obj)
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'site':
- kwargs['queryset'] = Site.select_by_user(
- request.user).filter(hosts_users=True)
- kwargs['widget'] = forms.Select(
- attrs={'onChange': "update_slice_prefix(this, $($(this).closest('fieldset')[0]).find('.field-name input')[0].id)"})
-
- return super(SliceAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- # admins can see all keys. Users can only see slices they belong to.
- return Slice.select_by_user(request.user)
-
- def get_formsets(self, request, obj=None):
- for inline in self.get_inline_instances(request, obj):
- # hide MyInline in the add view
- if obj is None:
- continue
- if isinstance(inline, InstanceInline):
- inline.model.caller = request.user
- yield inline.get_formset(request, obj)
-
- def add_extra_context(self, request, extra_context):
- super(SliceAdmin, self).add_extra_context(request, extra_context)
- # set context["slice_id"] to the PK passed in the URL to this view
- if len(request.resolver_match.args) > 0:
- extra_context["slice_id"] = request.resolver_match.args[0]
-
- def UNUSED_get_inline_instances(self, request, obj=None):
- # HACK for CORD to do something special on vcpe slice page
- # this was a good idea, but failed miserably, as something still
- # expects there to be a deployment field.
- # XXX this approach is better than clobbering self.inlines, so
- # try to make this work post-demo.
- if (obj is not None) and (obj.name == "mysite_vcpe"):
- cord_vcpe_inlines = [SlicePrivilegeInline, CordInstanceInline,
- SliceNetworkInline]
-
- inlines = []
- for inline_class in cord_vcpe_inlines:
- inlines.append(inline_class(self.model, self.admin_site))
- else:
- inlines = super(SliceAdmin, self).get_inline_instances(
- request, obj)
-
- return inlines
-
-
-class SlicePrivilegeAdmin(XOSBaseAdmin):
- fieldsets = [
- (None, {'fields': ['backend_status_text', 'user', 'slice', 'role']})
- ]
- readonly_fields = ('backend_status_text', )
- list_display = ('backend_status_icon', 'user', 'slice', 'role')
- list_display_links = list_display
-
- user_readonly_fields = ['user', 'slice', 'role']
- user_readonly_inlines = []
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'slice':
- kwargs['queryset'] = Slice.select_by_user(request.user)
-
- if db_field.name == 'user':
- kwargs['queryset'] = User.select_by_user(request.user)
-
- return super(SlicePrivilegeAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- # admins can see all memberships. Users can only see memberships of
- # slices where they have the admin role.
- return SlicePrivilege.select_by_user(request.user)
-
- def save_model(self, request, obj, form, change):
- # update openstack connection to use this site/tenant
- auth = request.session.get('auth', {})
- auth['tenant'] = obj.slice.slicename
- obj.save()
-
- def delete_model(self, request, obj):
- # update openstack connection to use this site/tenant
- auth = request.session.get('auth', {})
- auth['tenant'] = obj.slice.slicename
- obj.delete()
-
-
-class ImageAdmin(XOSBaseAdmin):
-
- fieldsets = [('Image Details',
- {'fields': ['backend_status_text', 'name', 'kind', 'disk_format', 'container_format', 'tag', 'path'],
- 'classes': ['suit-tab suit-tab-general']})
- ]
- readonly_fields = ('backend_status_text', )
-
- suit_form_tabs = (('general', 'Image Details'), ('instances', 'Instances'),
- ('imagedeployments', 'Deployments'), ('admin-only', 'Admin-Only'))
-
- inlines = [InstanceInline, ControllerImagesInline]
-
- user_readonly_fields = ['name', 'disk_format',
- 'container_format', 'tag', 'path']
-
- list_display = ['backend_status_icon', 'name', 'kind']
- list_display_links = ('backend_status_icon', 'name', )
-
-
-class NodeForm(forms.ModelForm):
- nodelabels = forms.ModelMultipleChoiceField(
- queryset=NodeLabel.objects.all(),
- required=False,
- help_text="Select which labels apply to this node",
- widget=FilteredSelectMultiple(
- verbose_name=('Labels'), is_stacked=False
- )
- )
-
- class Meta:
- model = Node
- fields = '__all__'
-
- def __init__(self, *args, **kwargs):
- request = kwargs.pop('request', None)
- super(NodeForm, self).__init__(*args, **kwargs)
-
- if self.instance and self.instance.pk:
- self.fields['nodelabels'].initial = self.instance.nodelabels.all()
-
- def save(self, commit=True):
- node = super(NodeForm, self).save(commit=False)
-
- node.nodelabels = self.cleaned_data['nodelabels']
-
- if commit:
- node.save()
-
- return node
-
-
-class NodeLabelAdmin(XOSBaseAdmin):
- list_display = ('name',)
- list_display_links = ('name', )
-
- fields = ('name', )
-
-
-class NodeAdmin(XOSBaseAdmin):
- form = NodeForm
- list_display = ('backend_status_icon', 'name', 'site_deployment')
- list_display_links = ('backend_status_icon', 'name', )
- list_filter = ('site_deployment',)
-
- inlines = [InstanceInline]
- fieldsets = [('Node Details', {'fields': ['backend_status_text', 'name', 'site_deployment'], 'classes':['suit-tab suit-tab-details']}),
- ('Labels', {'fields': ['nodelabels'], 'classes':['suit-tab suit-tab-labels']})]
- readonly_fields = ('backend_status_text', )
-
- user_readonly_fields = ['name', 'site_deployment']
- user_readonly_inlines = [InstanceInline]
-
- suit_form_tabs = (('details', 'Node Details'), ('instances',
- 'Instances'), ('labels', 'Labels'))
-
-
-class InstanceForm(forms.ModelForm):
-
- class Meta:
- model = Instance
- ip = forms.CharField(widget=PlainTextWidget)
- instance_name = forms.CharField(widget=PlainTextWidget)
- widgets = {
- 'ip': PlainTextWidget(),
- 'instance_name': PlainTextWidget(),
- 'instance_id': PlainTextWidget(),
- 'slice': LinkedSelect,
- 'deployment': LinkedSelect,
- 'node': LinkedSelect,
- 'image': LinkedSelect
- }
- fields = '__all__'
-
-class TagAdmin(XOSBaseAdmin):
- list_display = ['backend_status_icon', 'service',
- 'name', 'value', 'content_type', 'object_id', ]
- list_display_links = list_display
- user_readonly_fields = ['service', 'name',
- 'value', 'content_type', 'object_id', ]
- user_readonly_inlines = []
-
-
-class InstancePortInline(XOSTabularInline):
- fields = ['backend_status_icon', 'network', 'instance', 'ip', 'mac']
- readonly_fields = ("backend_status_icon", "ip", "mac")
- model = Port
- #selflink_fieldname = "network"
- extra = 0
- verbose_name_plural = "Ports"
- verbose_name = "Port"
- suit_classes = 'suit-tab suit-tab-ports'
-
-
-class InstanceAdmin(XOSBaseAdmin):
- form = InstanceForm
- fieldsets = [
- ('Instance Details', {'fields': ['backend_status_text', 'slice', 'deployment', 'isolation', 'flavor', 'image', 'node',
- 'parent', 'all_ips_string', 'instance_id', 'instance_name', 'ssh_command', ], 'classes': ['suit-tab suit-tab-general'], }),
- ('Container Settings', {'fields': ['volumes'], 'classes': [
- 'suit-tab suit-tab-container'], }),
- ]
- readonly_fields = ('backend_status_text', 'ssh_command', 'all_ips_string')
- list_display = ['backend_status_icon', 'all_ips_string', 'instance_id',
- 'instance_name', 'isolation', 'slice', 'flavor', 'image', 'node', 'deployment']
- list_display_links = ('backend_status_icon',
- 'all_ips_string', 'instance_id', )
-
- suit_form_tabs = (('general', 'Instance Details'), ('ports', 'Ports'),
- ('container', 'Container Settings'),)
-
- inlines = [InstancePortInline]
-
- user_readonly_fields = ['slice', 'deployment',
- 'node', 'ip', 'instance_name', 'flavor', 'image']
-
- def ssh_command(self, obj):
- ssh_command = obj.get_ssh_command()
- if ssh_command:
- return ssh_command
- else:
- return "(not available)"
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'slice':
- kwargs['queryset'] = Slice.select_by_user(request.user)
-
- return super(InstanceAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- # admins can see all instances. Users can only see instances of
- # the slices they belong to.
- return Instance.select_by_user(request.user)
-
- def add_view(self, request, form_url='', extra_context=None):
- self.readonly_fields = ('backend_status_text',
- 'ssh_command', 'all_ips_string')
- return super(InstanceAdmin, self).add_view(request, form_url, extra_context)
-
- def change_view(self, request, object_id, extra_context=None):
- self.readonly_fields = ('backend_status_text', 'ssh_command',
- 'all_ips_string', 'deployment', 'slice', 'flavor', 'image', 'node')
- # for XOSAdminMixin.change_view's user_readonly_fields switching code
- self.readonly_save = self.readonly_fields
- return super(InstanceAdmin, self).change_view(request, object_id, extra_context)
-
- def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
- deployment_nodes = []
- for node in Node.objects.order_by("name"):
- deployment_nodes.append(
- (node.site_deployment.deployment.id, node.id, node.name))
-
- # Limiting flavors/images by deployment is no longer supported, so assume every deployment supports
- # everything.
- deployment_flavors = []
- deployment_images = []
- for deployment in Deployment.objects.all():
- for flavor in Flavor.objects.all():
- deployment_flavors.append(
- (deployment.id, flavor.id, flavor.name))
- for image in Image.objects.all():
- deployment_images.append(
- (deployment.id, image.id, image.name))
-
- site_login_bases = []
- for site in Site.objects.all():
- site_login_bases.append((site.id, site.login_base))
-
- context["deployment_nodes"] = deployment_nodes
- context["deployment_flavors"] = deployment_flavors
- context["deployment_images"] = deployment_images
- context["site_login_bases"] = site_login_bases
- return super(InstanceAdmin, self).render_change_form(request, context, add, change, form_url, obj)
-
- def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
- if db_field.name == 'deployment':
-# kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(
-# sitedeployments__nodes__isnull=False).distinct()
- kwargs['widget'] = forms.Select(
- attrs={'onChange': "instance_deployment_changed(this);"})
- if db_field.name == 'flavor':
- kwargs['widget'] = forms.Select(
- attrs={'onChange': "instance_flavor_changed(this);"})
-
- field = super(InstanceAdmin, self).formfield_for_foreignkey(
- db_field, request, **kwargs)
-
- return field
-
-class UserCreationForm(forms.ModelForm):
- """A form for creating new users. Includes all the required
- fields, plus a repeated password."""
- password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
- password2 = forms.CharField(
- label='Password confirmation', widget=forms.PasswordInput)
-
- class Meta:
- model = User
- fields = ('email', 'firstname', 'lastname', 'phone', 'public_key')
-
- def clean_password2(self):
- # Check that the two password entries match
- password1 = self.cleaned_data.get("password1")
- password2 = self.cleaned_data.get("password2")
- if password1 and password2 and password1 != password2:
- raise forms.ValidationError("Passwords don't match")
- return password2
-
- def save(self, commit=True):
- # Save the provided password in hashed format
- user = super(UserCreationForm, self).save(commit=False)
- user.password = self.cleaned_data["password1"]
- # user.set_password(self.cleaned_data["password1"])
- if commit:
- user.save()
- return user
-
-
-class UserChangeForm(forms.ModelForm):
- """A form for updating users. Includes all the fields on
- the user, but replaces the password field with admin's
- password hash display field.
- """
- password = ReadOnlyPasswordHashField(label='Password',
- help_text='<a href=\"password/\">Change Password</a>.')
-
- PROFILE_CHOICES = ((None, '------'), ('regular',
- 'Regular user'), ('cp', 'Content Provider'))
- profile = forms.ChoiceField(
- choices=PROFILE_CHOICES, required=False, label="Quick Profile")
-
- class Meta:
- model = User
- widgets = {'public_key': UploadTextareaWidget, }
- fields = '__all__'
-
- def clean_password(self):
- # Regardless of what the user provides, return the initial value.
- # This is done here, rather than on the field, because the
- # field does not have access to the initial value
- return self.initial["password"]
-
- def save(self, *args, **kwargs):
- if self.cleaned_data['profile']:
- self.instance.apply_profile(self.cleaned_data['profile'])
-
- return super(UserChangeForm, self).save(*args, **kwargs)
-
-
-class UserDashboardViewInline(XOSTabularInline):
- model = UserDashboardView
- extra = 0
- suit_classes = 'suit-tab suit-tab-dashboards'
- fields = ['user', 'dashboardView', 'order']
-
-
-class ControllerUserInline(XOSTabularInline):
- model = ControllerUser
- extra = 0
- suit_classes = 'suit-tab suit-tab-admin-only'
- fields = ['controller', 'user', 'kuser_id']
-
-
-class UserAdmin(XOSAdminMixin, UserAdmin):
- # Note: Make sure XOSAdminMixin is listed before
- # admin.ModelAdmin in the class declaration.
-
- class Meta:
- app_label = "core"
- fields = '__all__'
-
- # The forms to add and change user instances
- form = UserChangeForm
- add_form = UserCreationForm
-
- # The fields to be used in displaying the User model.
- # These override the definitions on the base UserAdmin
- # that reference specific fields on auth.User.
- list_display = ('backend_status_icon', 'email',
- 'firstname', 'lastname', 'site', 'last_login')
- list_display_links = ("email",)
- list_filter = ('site',)
- inlines = [SlicePrivilegeInline, SitePrivilegeInline]
- admin_inlines = [ControllerUserInline]
- fieldListLoginDetails = ['backend_status_text', 'email', 'site', 'password', 'is_active',
- 'is_readonly', 'is_admin', 'is_appuser', 'public_key', 'login_page', 'profile']
- fieldListContactInfo = ['firstname', 'lastname', 'phone', 'timezone']
-
- fieldsets = (
- ('Login Details', {'fields': ['backend_status_text', 'email', 'site', 'password', 'is_active',
- 'is_readonly', 'is_admin', 'is_appuser', 'public_key'], 'classes': ['suit-tab suit-tab-general']}),
- ('Contact Information', {'fields': (
- 'firstname', 'lastname', 'phone', 'timezone'), 'classes': ['suit-tab suit-tab-contact']}),
- #('Important dates', {'fields': ('last_login',)}),
- )
- add_fieldsets = (
- (None, {
- 'classes': ('wide',),
- 'fields': ('site', 'email', 'firstname', 'lastname', 'is_admin', 'is_readonly', 'is_appuser', 'phone', 'public_key', 'password1', 'password2')},
- ),
- )
- readonly_fields = ('backend_status_text', )
- search_fields = ('email',)
- ordering = ('email',)
- filter_horizontal = ()
-
- user_readonly_fields = fieldListLoginDetails + fieldListContactInfo
-
- @property
- def suit_form_tabs(self):
- if getattr(_thread_locals, "obj", None) is None:
- return []
- else:
- tabs = [('general', 'Login Details'),
- ('contact', 'Contact Information'),
- ('sliceprivileges', 'Slice Privileges'),
- ('siteprivileges', 'Site Privileges')]
-
- request = getattr(_thread_locals, "request", None)
- if request and request.user.is_admin:
- tabs.append(('admin-only', 'Admin-Only'))
-
- return tabs
-
- def formfield_for_foreignkey(self, db_field, request, **kwargs):
- if db_field.name == 'site':
- kwargs['queryset'] = Site.select_by_user(
- request.user).filter(hosts_users=True)
-
- return super(UserAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
-
- def queryset(self, request):
- return User.select_by_user(request.user)
-
- def get_form(self, request, obj=None, **kwargs):
- # copy login details list
- login_details_fields = list(self.fieldListLoginDetails)
- if not request.user.is_admin:
- # only admins can see 'is_admin' and 'is_readonly' fields
- if 'is_admin' in login_details_fields:
- login_details_fields.remove('is_admin')
- if 'is_readonly' in login_details_fields:
- login_details_fields.remove('is_readonly')
- if 'is_appuser' in login_details_fields:
- login_details_fields.remove('is_admin')
- if 'profile' in login_details_fields:
- login_details_fields.remove('profile')
- # if len(request.user.siteprivileges.filter(role__role = 'pi')) > 0:
- # only admins and pis can change a user's site
- # self.readonly_fields = ('backend_status_text', 'site')
- self.fieldsets = (
- ('Login Details', {'fields': login_details_fields,
- 'classes': ['suit-tab suit-tab-general']}),
- ('Contact Information', {
- 'fields': self.fieldListContactInfo, 'classes': ['suit-tab suit-tab-contact']}),
- )
- return super(UserAdmin, self).get_form(request, obj, **kwargs)
-
-
-class ControllerDashboardViewInline(XOSTabularInline):
- model = ControllerDashboardView
- extra = 0
- fields = ["controller", "url"]
- suit_classes = 'suit-tab suit-tab-controllers'
-
-
-class DashboardViewAdmin(XOSBaseAdmin):
- fieldsets = [('Dashboard View Details',
- {'fields': ['backend_status_text', 'name', 'url', 'enabled', 'deployments',"icon","icon_active"],
- 'classes': ['suit-tab suit-tab-general']})
- ]
- list_display = ["name", "enabled", "url","icon","icon_active"]
- readonly_fields = ('backend_status_text', )
- inlines = [ControllerDashboardViewInline]
-
- suit_form_tabs = (('general', 'Dashboard View Details'),
- ('controllers', 'Per-controller Dashboard Details'))
-
-
-class NetworkParameterTypeAdmin(XOSBaseAdmin):
- list_display = ("backend_status_icon", "name", )
- list_display_links = ('backend_status_icon', 'name', )
- user_readonly_fields = ['name']
- user_readonly_inlines = []
-
-
-class NetworkParameterInline(PlStackGenericTabularInline):
- model = NetworkParameter
- extra = 0
- verbose_name_plural = "Parameters"
- verbose_name = "Parameter"
- suit_classes = 'suit-tab suit-tab-netparams'
- fields = ['backend_status_icon', 'parameter', 'value']
- readonly_fields = ('backend_status_icon', )
-
-
-class NetworkPortInline(XOSTabularInline):
- fields = ['backend_status_icon', 'network', 'instance', 'ip', 'mac']
- readonly_fields = ("backend_status_icon", "ip", "mac")
- model = Port
- #selflink_fieldname = "instance"
- extra = 0
- verbose_name_plural = "Ports"
- verbose_name = "Port"
- suit_classes = 'suit-tab suit-tab-ports'
-
-
-class NetworkSlicesInline(XOSTabularInline):
- model = NetworkSlice
- selflink_fieldname = "slice"
- extra = 0
- verbose_name_plural = "Slices"
- verbose_name = "Slice"
- suit_classes = 'suit-tab suit-tab-networkslices'
- fields = ['backend_status_icon', 'network', 'slice']
- readonly_fields = ('backend_status_icon', )
-
-
-class ControllerNetworkInline(XOSTabularInline):
- model = ControllerNetwork
- extra = 0
- verbose_name_plural = "Controller Networks"
- verbose_name = "Controller Network"
- suit_classes = 'suit-tab suit-tab-admin-only'
- fields = ['backend_status_icon', 'controller',
- 'net_id', 'subnet_id', 'subnet']
- readonly_fields = ('backend_status_icon', )
-
-
-class NetworkForm(forms.ModelForm):
-
- class Meta:
- model = Network
- widgets = {
- 'topologyParameters': UploadTextareaWidget,
- 'controllerParameters': UploadTextareaWidget,
- }
- fields = '__all__'
-
-
-class NetworkAdmin(XOSBaseAdmin):
- list_display = ("backend_status_icon", "name", "subnet", "ports", "labels")
- list_display_links = ('backend_status_icon', 'name', )
- readonly_fields = ("subnet", )
- inlines = [NetworkPortInline, NetworkSlicesInline] # NetworkParameterInline,
- admin_inlines = [ControllerNetworkInline]
-
- form = NetworkForm
-
- fieldsets = [
- (None, {'fields': ['backend_status_text', 'name', 'template', 'ports', 'labels',
- 'owner', 'permit_all_slices',
- 'permitted_slices',
- 'subnet', 'autoconnect'],
- 'classes':['suit-tab suit-tab-general']}),
- ]
-
- readonly_fields = ('backend_status_text', )
- user_readonly_fields = ['name', 'template', 'ports', 'labels', 'owner',
- 'permit_all_slices', 'permitted_slices',
- 'subnet', 'autoconnect']
-
- @property
- def suit_form_tabs(self):
- tabs = [('general', 'Network Details'),
- ('netparams', 'Parameters'),
- ('ports', 'Ports'),
- ('networkslices', 'Slices'),
- ]
-
- request = getattr(_thread_locals, "request", None)
- if request and request.user.is_admin:
- tabs.append(('admin-only', 'Admin-Only'))
-
- return tabs
-
-
-class NetworkTemplateAdmin(XOSBaseAdmin):
- list_display = ("backend_status_icon", "name", "visibility")
- list_display_links = ('backend_status_icon', 'name', )
- user_readonly_fields = ["name", "visibility"]
- user_readonly_inlines = []
- # inlines = [NetworkParameterInline, ]
- fieldsets = [
- (None, {'fields': ['name', 'description', 'visibility', 'translation', 'access', 'shared_network_name', 'shared_network_id', 'topology_kind', 'controller_kind', 'vtn_kind'],
- 'classes':['suit-tab suit-tab-general']}), ]
- suit_form_tabs = (('general', 'Network Template Details'), ('netparams', 'Parameters'))
-
-
-class PortAdmin(XOSBaseAdmin):
- list_display = ("backend_status_icon", "id", "ip")
- list_display_links = ('backend_status_icon', 'id')
- readonly_fields = ("subnet", )
- #inlines = [NetworkParameterInline]
-
- fieldsets = [
- (None, {'fields': ['backend_status_text', 'network', 'instance', 'ip', 'port_id', 'mac'],
- 'classes':['suit-tab suit-tab-general']}),
- ]
-
- readonly_fields = ('backend_status_text', )
- suit_form_tabs = (('general', 'Port Details'), ('netparams', 'Parameters'))
-
-
-class FlavorAdmin(XOSBaseAdmin):
- list_display = ("backend_status_icon", "name",
- "flavor", "order", "default")
- list_display_links = ("backend_status_icon", "name")
- user_readonly_fields = ("name", "flavor")
- fields = ("name", "description", "flavor", "order", "default")
-
-# register a signal that caches the user's credentials when they log in
-
-
-def cache_credentials(sender, user, request, **kwds):
- auth = {'username': request.POST['username'],
- 'password': request.POST['password']}
- request.session['auth'] = auth
-user_logged_in.connect(cache_credentials)
-
-
-class AddressPoolForm(forms.ModelForm):
-
- class Meta:
- model = AddressPool
- widgets = {
- 'addresses': UploadTextareaWidget(attrs={'rows': 20, 'cols': 80, 'class': "input-xxlarge"}),
- }
- fields = '__all__'
-
-
-class AddressPoolAdmin(XOSBaseAdmin):
- list_display = ("name", "cidr")
- list_display_links = ('name',)
-
- form = AddressPoolForm
-
- fieldsets = [
- (None, {'fields': ['name', 'cidr', 'gateway_ip', 'gateway_mac', 'addresses', 'inuse', 'service'],
- 'classes':['suit-tab suit-tab-general']}),
- ]
-
- readonly_fields = ("status",)
-
- @property
- def suit_form_tabs(self):
- tabs = [('general', 'Address Pool Details'),
- ]
-
- return tabs
-
-class AddressPoolInline(XOSTabularInline):
- model = AddressPool
- extra = 0
- suit_classes = 'suit-tab suit-tab-addresspools'
- fields = ['cidr', 'gateway_ip', 'gateway_mac']
- readonly_fields = ['cidr',]
-
- # disable the add link
- def has_add_permission(self, request):
- return False
-
-class DiagAdmin(XOSBaseAdmin):
- list_display = ("name", "backend_status", "backend_register")
- list_display_links = ('name',)
-
- fieldsets = [
- (None, {'fields': ['name', 'backend_status', 'backend_register'],
- 'classes':['suit-tab suit-tab-general']}),
- ]
-
-
-# Now register the new UserAdmin...
-admin.site.register(User, UserAdmin)
-# ... and, since we're not using Django's builtin permissions,
-# unregister the Group model from admin.
-# admin.site.unregister(Group)
-
-# When debugging it is often easier to see all the classes, but for regular use
-# only the top-levels should be displayed
-showAll = False
-
-admin.site.register(Deployment, DeploymentAdmin)
-admin.site.register(Controller, ControllerAdmin)
-admin.site.register(Site, SiteAdmin)
-admin.site.register(Slice, SliceAdmin)
-admin.site.register(Service, ServiceAdmin)
-admin.site.register(XOS, XosModelAdmin)
-admin.site.register(Network, NetworkAdmin)
-admin.site.register(Port, PortAdmin)
-admin.site.register(NetworkTemplate, NetworkTemplateAdmin)
-
-if True:
- admin.site.register(NetworkParameterType, NetworkParameterTypeAdmin)
- admin.site.register(Tag, TagAdmin)
- admin.site.register(ControllerRole)
- admin.site.register(SiteRole)
- admin.site.register(SliceRole)
- admin.site.register(Node, NodeAdmin)
- admin.site.register(NodeLabel, NodeLabelAdmin)
- admin.site.register(Instance, InstanceAdmin)
- admin.site.register(Image, ImageAdmin)
- admin.site.register(DashboardView, DashboardViewAdmin)
- admin.site.register(Flavor, FlavorAdmin)
- admin.site.register(ServiceInstanceAttribute, ServiceInstanceAttributeAdmin)
- admin.site.register(AddressPool, AddressPoolAdmin)
- admin.site.register(Diag, DiagAdmin)
-
-
diff --git a/xos/tools/apigen/api.template.py b/xos/tools/apigen/api.template.py
deleted file mode 100644
index ae35c36..0000000
--- a/xos/tools/apigen/api.template.py
+++ /dev/null
@@ -1,243 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from rest_framework.decorators import api_view
-from rest_framework.response import Response
-from rest_framework.reverse import reverse
-from rest_framework import serializers
-from rest_framework import generics
-from rest_framework import status
-from rest_framework.generics import GenericAPIView
-from core.models import *
-from django.forms import widgets
-from rest_framework import filters
-from django.conf.urls import patterns, url
-from rest_framework.exceptions import PermissionDenied as RestFrameworkPermissionDenied
-from django.core.exceptions import PermissionDenied as DjangoPermissionDenied
-from apibase import XOSRetrieveUpdateDestroyAPIView, XOSListCreateAPIView, XOSNotAuthenticated
-
-if hasattr(serializers, "ReadOnlyField"):
- # rest_framework 3.x
- IdField = serializers.ReadOnlyField
-else:
- # rest_framework 2.x
- IdField = serializers.Field
-
-"""
- Schema of the generator object:
- all: Set of all Model objects
- all_if(regex): Set of Model objects that match regex
-
- Model object:
- plural: English plural of object name
- camel: CamelCase version of object name
- refs: list of references to other Model objects
- props: list of properties minus refs
-
- TODO: Deal with subnets
-"""
-
-def get_REST_patterns():
- return patterns('',
- # legacy - deprecated
- url(r'^xos/$', api_root),
- {% for object in generator.all() %}
- url(r'xos/{{ object.rest_name() }}/$', {{ object.camel() }}List.as_view(), name='{{ object.singular() }}-list-legacy'),
- url(r'xos/{{ object.rest_name() }}/(?P<pk>[a-zA-Z0-9\-]+)/$', {{ object.camel() }}Detail.as_view(), name ='{{ object.singular() }}-detail-legacy'),
- {% endfor %}
- ) + patterns('',
- # new - use these instead of the above
- url(r'^api/core/$', api_root),
- {% for object in generator.all() %}
- url(r'api/core/{{ object.rest_name() }}/$', {{ object.camel() }}List.as_view(), name='{{ object.singular() }}-list'),
- url(r'api/core/{{ object.rest_name() }}/(?P<pk>[a-zA-Z0-9\-]+)/$', {{ object.camel() }}Detail.as_view(), name ='{{ object.singular() }}-detail'),
- {% endfor %}
- )
-
-@api_view(['GET'])
-def api_root_legacy(request, format=None):
- return Response({
- {% for object in generator.all() %}'{{ object.plural() }}': reverse('{{ object }}-list-legacy', request=request, format=format),
- {% endfor %}
- })
-
-@api_view(['GET'])
-def api_root(request, format=None):
- return Response({
- {% for object in generator.all() %}'{{ object.plural() }}': reverse('{{ object }}-list', request=request, format=format),
- {% endfor %}
- })
-
-# Based on serializers.py
-
-class XOSModelSerializer(serializers.ModelSerializer):
- # TODO: Rest Framework 3.x doesn't support save_object()
- def NEED_TO_UPDATE_save_object(self, obj, **kwargs):
-
- """ rest_framework can't deal with ManyToMany relations that have a
- through table. In xos, 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()
-
-{% for object in generator.all() %}
-
-class {{ object.camel() }}Serializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
- {% for ref in object.refs %}
- {% if ref.multi %}
- {{ ref.plural() }} = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='{{ ref }}-detail')
- {% else %}
- {{ ref }} = serializers.HyperlinkedRelatedField(read_only=True, view_name='{{ ref }}-detail')
- {% endif %}
- {% endfor %}
- 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 = {{ object.camel() }}
- fields = ('humanReadableName', 'validators', {% for prop in object.props %}'{{ prop }}',{% endfor %}{% for ref in object.refs %}{%if ref.multi %}'{{ ref.plural() }}'{% else %}'{{ ref }}'{% endif %},{% endfor %})
-
-class {{ object.camel() }}IdSerializer(XOSModelSerializer):
- id = IdField()
- {% for ref in object.refs %}
- {% if ref.multi %}
- {{ ref.plural() }} = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = {{ ref.camel() }}.objects.all())
- {% else %}
- {{ ref }} = serializers.PrimaryKeyRelatedField( queryset = {{ ref.camel() }}.objects.all())
- {% endif %}
- {% endfor %}
- 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 = {{ object.camel() }}
- fields = ('humanReadableName', 'validators', {% for prop in object.props %}'{{ prop }}',{% endfor %}{% for ref in object.refs %}{%if ref.multi %}'{{ ref.plural() }}'{% else %}'{{ ref }}'{% endif %},{% endfor %})
-
-
-{% endfor %}
-
-serializerLookUp = {
-{% for object in generator.all() %}
- {{ object.camel() }}: {{ object.camel() }}Serializer,
-{% endfor %}
- None: None,
- }
-
-# Based on core/views/*.py
-{% for object in generator.all() %}
-
-class {{ object.camel() }}List(XOSListCreateAPIView):
- queryset = {{ object.camel() }}.objects.select_related().all()
- serializer_class = {{ object.camel() }}Serializer
- id_serializer_class = {{ object.camel() }}IdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ({% for prop in object.props %}'{{ prop }}',{% endfor %}{% for ref in object.refs %}{%if ref.multi %}'{{ ref.plural() }}'{% else %}'{{ ref }}'{% endif %},{% endfor %})
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return {{ object.camel() }}.select_by_user(self.request.user)
-
-
-class {{ object.camel() }}Detail(XOSRetrieveUpdateDestroyAPIView):
- queryset = {{ object.camel() }}.objects.select_related().all()
- serializer_class = {{ object.camel() }}Serializer
- id_serializer_class = {{ object.camel() }}IdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return {{ object.camel() }}.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-{% endfor %}
diff --git a/xos/xos/urls.py b/xos/xos/urls.py
index f06f2d2..dd6ca87 100644
--- a/xos/xos/urls.py
+++ b/xos/xos/urls.py
@@ -17,23 +17,10 @@
import importlib
from django.conf.urls import patterns, include, url
-# Uncomment the next two lines to enable the admin:
-from django.contrib import admin
-
-# This is the generated API
-from xosapi import *
-
-# from services.vbbu.view import *
-from core.views.mcordview import *
-# from core.views.analytics import AnalyticsAjaxView
-
from core.models import *
from rest_framework import generics
-from core.dashboard.sites import SitePlus
from django.http import HttpResponseRedirect
-# from core.xoslib import XOSLibDataView
-
def load_class(full_class_string):
"""
dynamically load a class from a string
@@ -47,12 +34,6 @@
# Finally, we retrieve the Class
return getattr(module, class_str)
-# from api import import_api_methods
-
-admin.site = SitePlus()
-admin.autodiscover()
-
-
def redirect_to_apache(request):
""" bounce a request back to the apache server that is running on the machine """
apache_url = "http://%s%s" % (request.META['HOSTNAME'], request.path)
@@ -60,29 +41,14 @@
urlpatterns = patterns(
'',
-
- # url(r'^docs/', include('rest_framework_swagger.urls')),
-
- # Uncomment the admin/doc line below to enable admin documentation:
- url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
- # Uncomment the next line to enable the admin:
- url(r'^admin/', include(admin.site.urls)),
- url(r'^', include(admin.site.urls)),
- # url(r'^profile/home', 'core.views.home'),
-
- # url(r'^admin/xoslib/(?P<name>\w+)/$', XOSLibDataView.as_view(), name="xoslib"),
-
- # url(r'^analytics/(?P<name>\w+)/$', AnalyticsAjaxView.as_view(), name="analytics"),
-
+ # Is this necessary?
url(r'^files/', redirect_to_apache),
# Adding in rest_framework urls
url(r'^xos/', include('rest_framework.urls', namespace='rest_framework')),
- # XOSLib rest methods [deprecated]
- url(r'^xoslib/', include('core.xoslib.methods', namespace='xoslib')),
-
+ # handcrafted API methods
+ # NOTE: Needs to stay until Tosca switchover is complete
url(r'^', include('api.import_methods', namespace='api')),
+ )
- ) + get_REST_patterns()
diff --git a/xos/xos/xosapi.py b/xos/xos/xosapi.py
deleted file mode 100644
index 68f7580..0000000
--- a/xos/xos/xosapi.py
+++ /dev/null
@@ -1,5310 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from rest_framework.decorators import api_view
-from rest_framework.response import Response
-from rest_framework.reverse import reverse
-from rest_framework import serializers
-from rest_framework import generics
-from rest_framework import status
-from rest_framework.generics import GenericAPIView
-from core.models import *
-from django.forms import widgets
-from rest_framework import filters
-from django.conf.urls import patterns, url
-from rest_framework.exceptions import PermissionDenied as RestFrameworkPermissionDenied
-from django.core.exceptions import PermissionDenied as DjangoPermissionDenied
-from apibase import XOSRetrieveUpdateDestroyAPIView, XOSListCreateAPIView, XOSNotAuthenticated
-
-if hasattr(serializers, "ReadOnlyField"):
- # rest_framework 3.x
- IdField = serializers.ReadOnlyField
-else:
- # rest_framework 2.x
- IdField = serializers.Field
-
-"""
- Schema of the generator object:
- all: Set of all Model objects
- all_if(regex): Set of Model objects that match regex
-
- Model object:
- plural: English plural of object name
- camel: CamelCase version of object name
- refs: list of references to other Model objects
- props: list of properties minus refs
-
- TODO: Deal with subnets
-"""
-
-def get_REST_patterns():
- return patterns('',
- # legacy - deprecated
- url(r'^xos/$', api_root),
-
- url(r'xos/serviceattributes/$', ServiceAttributeList.as_view(), name='serviceattribute-list-legacy'),
- url(r'xos/serviceattributes/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceAttributeDetail.as_view(), name ='serviceattribute-detail-legacy'),
-
- url(r'xos/controllerimages/$', ControllerImagesList.as_view(), name='controllerimages-list-legacy'),
- url(r'xos/controllerimages/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerImagesDetail.as_view(), name ='controllerimages-detail-legacy'),
-
- url(r'xos/controllersiteprivileges/$', ControllerSitePrivilegeList.as_view(), name='controllersiteprivilege-list-legacy'),
- url(r'xos/controllersiteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSitePrivilegeDetail.as_view(), name ='controllersiteprivilege-detail-legacy'),
-
- url(r'xos/images/$', ImageList.as_view(), name='image-list-legacy'),
- url(r'xos/images/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDetail.as_view(), name ='image-detail-legacy'),
-
- url(r'xos/controllernetworks/$', ControllerNetworkList.as_view(), name='controllernetwork-list-legacy'),
- url(r'xos/controllernetworks/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerNetworkDetail.as_view(), name ='controllernetwork-detail-legacy'),
-
- url(r'xos/sites/$', SiteList.as_view(), name='site-list-legacy'),
- url(r'xos/sites/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDetail.as_view(), name ='site-detail-legacy'),
-
- url(r'xos/slice_roles/$', SliceRoleList.as_view(), name='slicerole-list-legacy'),
- url(r'xos/slice_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceRoleDetail.as_view(), name ='slicerole-detail-legacy'),
-
- url(r'xos/xosguiextensions/$', XOSGuiExtensionList.as_view(), name='xosguiextension-list-legacy'),
- url(r'xos/xosguiextensions/(?P<pk>[a-zA-Z0-9\-]+)/$', XOSGuiExtensionDetail.as_view(), name ='xosguiextension-detail-legacy'),
-
- url(r'xos/serviceinstancelinks/$', ServiceInstanceLinkList.as_view(), name='serviceinstancelink-list-legacy'),
- url(r'xos/serviceinstancelinks/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceInstanceLinkDetail.as_view(), name ='serviceinstancelink-detail-legacy'),
-
- url(r'xos/slice_privileges/$', SlicePrivilegeList.as_view(), name='sliceprivilege-list-legacy'),
- url(r'xos/slice_privileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SlicePrivilegeDetail.as_view(), name ='sliceprivilege-detail-legacy'),
-
- url(r'xos/controllerprivileges/$', ControllerPrivilegeList.as_view(), name='controllerprivilege-list-legacy'),
- url(r'xos/controllerprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerPrivilegeDetail.as_view(), name ='controllerprivilege-detail-legacy'),
-
- url(r'xos/flavors/$', FlavorList.as_view(), name='flavor-list-legacy'),
- url(r'xos/flavors/(?P<pk>[a-zA-Z0-9\-]+)/$', FlavorDetail.as_view(), name ='flavor-detail-legacy'),
-
- url(r'xos/serviceroles/$', ServiceRoleList.as_view(), name='servicerole-list-legacy'),
- url(r'xos/serviceroles/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceRoleDetail.as_view(), name ='servicerole-detail-legacy'),
-
- url(r'xos/controllersites/$', ControllerSiteList.as_view(), name='controllersite-list-legacy'),
- url(r'xos/controllersites/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSiteDetail.as_view(), name ='controllersite-detail-legacy'),
-
- url(r'xos/controllerslices/$', ControllerSliceList.as_view(), name='controllerslice-list-legacy'),
- url(r'xos/controllerslices/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSliceDetail.as_view(), name ='controllerslice-detail-legacy'),
-
- url(r'xos/servicedependencys/$', ServiceDependencyList.as_view(), name='servicedependency-list-legacy'),
- url(r'xos/servicedependencys/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceDependencyDetail.as_view(), name ='servicedependency-detail-legacy'),
-
- url(r'xos/networks/$', NetworkList.as_view(), name='network-list-legacy'),
- url(r'xos/networks/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkDetail.as_view(), name ='network-detail-legacy'),
-
- url(r'xos/controllerroles/$', ControllerRoleList.as_view(), name='controllerrole-list-legacy'),
- url(r'xos/controllerroles/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerRoleDetail.as_view(), name ='controllerrole-detail-legacy'),
-
- url(r'xos/diags/$', DiagList.as_view(), name='diag-list-legacy'),
- url(r'xos/diags/(?P<pk>[a-zA-Z0-9\-]+)/$', DiagDetail.as_view(), name ='diag-detail-legacy'),
-
- url(r'xos/ports/$', PortList.as_view(), name='port-list-legacy'),
- url(r'xos/ports/(?P<pk>[a-zA-Z0-9\-]+)/$', PortDetail.as_view(), name ='port-detail-legacy'),
-
- url(r'xos/instances/$', InstanceList.as_view(), name='instance-list-legacy'),
- url(r'xos/instances/(?P<pk>[a-zA-Z0-9\-]+)/$', InstanceDetail.as_view(), name ='instance-detail-legacy'),
-
- url(r'xos/roles/$', RoleList.as_view(), name='role-list-legacy'),
- url(r'xos/roles/(?P<pk>[a-zA-Z0-9\-]+)/$', RoleDetail.as_view(), name ='role-detail-legacy'),
-
- url(r'xos/serviceinterfaces/$', ServiceInterfaceList.as_view(), name='serviceinterface-list-legacy'),
- url(r'xos/serviceinterfaces/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceInterfaceDetail.as_view(), name ='serviceinterface-detail-legacy'),
-
- url(r'xos/nodelabels/$', NodeLabelList.as_view(), name='nodelabel-list-legacy'),
- url(r'xos/nodelabels/(?P<pk>[a-zA-Z0-9\-]+)/$', NodeLabelDetail.as_view(), name ='nodelabel-detail-legacy'),
-
- url(r'xos/privileges/$', PrivilegeList.as_view(), name='privilege-list-legacy'),
- url(r'xos/privileges/(?P<pk>[a-zA-Z0-9\-]+)/$', PrivilegeDetail.as_view(), name ='privilege-detail-legacy'),
-
- url(r'xos/nodes/$', NodeList.as_view(), name='node-list-legacy'),
- url(r'xos/nodes/(?P<pk>[a-zA-Z0-9\-]+)/$', NodeDetail.as_view(), name ='node-detail-legacy'),
-
- url(r'xos/addresspools/$', AddressPoolList.as_view(), name='addresspool-list-legacy'),
- url(r'xos/addresspools/(?P<pk>[a-zA-Z0-9\-]+)/$', AddressPoolDetail.as_view(), name ='addresspool-detail-legacy'),
-
- url(r'xos/dashboardviews/$', DashboardViewList.as_view(), name='dashboardview-list-legacy'),
- url(r'xos/dashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', DashboardViewDetail.as_view(), name ='dashboardview-detail-legacy'),
-
- url(r'xos/networkparameters/$', NetworkParameterList.as_view(), name='networkparameter-list-legacy'),
- url(r'xos/networkparameters/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterDetail.as_view(), name ='networkparameter-detail-legacy'),
-
- url(r'xos/imagedeploymentses/$', ImageDeploymentsList.as_view(), name='imagedeployments-list-legacy'),
- url(r'xos/imagedeploymentses/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentsDetail.as_view(), name ='imagedeployments-detail-legacy'),
-
- url(r'xos/controllerusers/$', ControllerUserList.as_view(), name='controlleruser-list-legacy'),
- url(r'xos/controllerusers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerUserDetail.as_view(), name ='controlleruser-detail-legacy'),
-
- url(r'xos/servicemonitoringagentinfos/$', ServiceMonitoringAgentInfoList.as_view(), name='servicemonitoringagentinfo-list-legacy'),
- url(r'xos/servicemonitoringagentinfos/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceMonitoringAgentInfoDetail.as_view(), name ='servicemonitoringagentinfo-detail-legacy'),
-
- url(r'xos/controllerdashboardviews/$', ControllerDashboardViewList.as_view(), name='controllerdashboardview-list-legacy'),
- url(r'xos/controllerdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDashboardViewDetail.as_view(), name ='controllerdashboardview-detail-legacy'),
-
- url(r'xos/userdashboardviews/$', UserDashboardViewList.as_view(), name='userdashboardview-list-legacy'),
- url(r'xos/userdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDashboardViewDetail.as_view(), name ='userdashboardview-detail-legacy'),
-
- url(r'xos/controllers/$', ControllerList.as_view(), name='controller-list-legacy'),
- url(r'xos/controllers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDetail.as_view(), name ='controller-detail-legacy'),
-
- url(r'xos/slices/$', SliceList.as_view(), name='slice-list-legacy'),
- url(r'xos/slices/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDetail.as_view(), name ='slice-detail-legacy'),
-
- url(r'xos/users/$', UserList.as_view(), name='user-list-legacy'),
- url(r'xos/users/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDetail.as_view(), name ='user-detail-legacy'),
-
- url(r'xos/deployments/$', DeploymentList.as_view(), name='deployment-list-legacy'),
- url(r'xos/deployments/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentDetail.as_view(), name ='deployment-detail-legacy'),
-
- url(r'xos/siteprivileges/$', SitePrivilegeList.as_view(), name='siteprivilege-list-legacy'),
- url(r'xos/siteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SitePrivilegeDetail.as_view(), name ='siteprivilege-detail-legacy'),
-
- url(r'xos/site_roles/$', SiteRoleList.as_view(), name='siterole-list-legacy'),
- url(r'xos/site_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteRoleDetail.as_view(), name ='siterole-detail-legacy'),
-
- url(r'xos/xoses/$', XOSList.as_view(), name='xos-list-legacy'),
- url(r'xos/xoses/(?P<pk>[a-zA-Z0-9\-]+)/$', XOSDetail.as_view(), name ='xos-detail-legacy'),
-
- url(r'xos/networkslices/$', NetworkSliceList.as_view(), name='networkslice-list-legacy'),
- url(r'xos/networkslices/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliceDetail.as_view(), name ='networkslice-detail-legacy'),
-
- url(r'xos/services/$', ServiceList.as_view(), name='service-list-legacy'),
- url(r'xos/services/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceDetail.as_view(), name ='service-detail-legacy'),
-
- url(r'xos/controllersliceprivileges/$', ControllerSlicePrivilegeList.as_view(), name='controllersliceprivilege-list-legacy'),
- url(r'xos/controllersliceprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSlicePrivilegeDetail.as_view(), name ='controllersliceprivilege-detail-legacy'),
-
- url(r'xos/serviceinstanceattributes/$', ServiceInstanceAttributeList.as_view(), name='serviceinstanceattribute-list-legacy'),
- url(r'xos/serviceinstanceattributes/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceInstanceAttributeDetail.as_view(), name ='serviceinstanceattribute-detail-legacy'),
-
- url(r'xos/deploymentprivileges/$', DeploymentPrivilegeList.as_view(), name='deploymentprivilege-list-legacy'),
- url(r'xos/deploymentprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentPrivilegeDetail.as_view(), name ='deploymentprivilege-detail-legacy'),
-
- url(r'xos/networkparametertypes/$', NetworkParameterTypeList.as_view(), name='networkparametertype-list-legacy'),
- url(r'xos/networkparametertypes/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterTypeDetail.as_view(), name ='networkparametertype-detail-legacy'),
-
- url(r'xos/sitedeployments/$', SiteDeploymentList.as_view(), name='sitedeployment-list-legacy'),
- url(r'xos/sitedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDeploymentDetail.as_view(), name ='sitedeployment-detail-legacy'),
-
- url(r'xos/tenantwithcontainers/$', TenantWithContainerList.as_view(), name='tenantwithcontainer-list-legacy'),
- url(r'xos/tenantwithcontainers/(?P<pk>[a-zA-Z0-9\-]+)/$', TenantWithContainerDetail.as_view(), name ='tenantwithcontainer-detail-legacy'),
-
- url(r'xos/deploymentroles/$', DeploymentRoleList.as_view(), name='deploymentrole-list-legacy'),
- url(r'xos/deploymentroles/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentRoleDetail.as_view(), name ='deploymentrole-detail-legacy'),
-
- url(r'xos/tags/$', TagList.as_view(), name='tag-list-legacy'),
- url(r'xos/tags/(?P<pk>[a-zA-Z0-9\-]+)/$', TagDetail.as_view(), name ='tag-detail-legacy'),
-
- url(r'xos/interfacetypes/$', InterfaceTypeList.as_view(), name='interfacetype-list-legacy'),
- url(r'xos/interfacetypes/(?P<pk>[a-zA-Z0-9\-]+)/$', InterfaceTypeDetail.as_view(), name ='interfacetype-detail-legacy'),
-
- url(r'xos/networktemplates/$', NetworkTemplateList.as_view(), name='networktemplate-list-legacy'),
- url(r'xos/networktemplates/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkTemplateDetail.as_view(), name ='networktemplate-detail-legacy'),
-
- url(r'xos/serviceprivileges/$', ServicePrivilegeList.as_view(), name='serviceprivilege-list-legacy'),
- url(r'xos/serviceprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ServicePrivilegeDetail.as_view(), name ='serviceprivilege-detail-legacy'),
-
- url(r'xos/serviceinstances/$', ServiceInstanceList.as_view(), name='serviceinstance-list-legacy'),
- url(r'xos/serviceinstances/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceInstanceDetail.as_view(), name ='serviceinstance-detail-legacy'),
-
- ) + patterns('',
- # new - use these instead of the above
- url(r'^api/core/$', api_root),
-
- url(r'api/core/serviceattributes/$', ServiceAttributeList.as_view(), name='serviceattribute-list'),
- url(r'api/core/serviceattributes/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceAttributeDetail.as_view(), name ='serviceattribute-detail'),
-
- url(r'api/core/controllerimages/$', ControllerImagesList.as_view(), name='controllerimages-list'),
- url(r'api/core/controllerimages/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerImagesDetail.as_view(), name ='controllerimages-detail'),
-
- url(r'api/core/controllersiteprivileges/$', ControllerSitePrivilegeList.as_view(), name='controllersiteprivilege-list'),
- url(r'api/core/controllersiteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSitePrivilegeDetail.as_view(), name ='controllersiteprivilege-detail'),
-
- url(r'api/core/images/$', ImageList.as_view(), name='image-list'),
- url(r'api/core/images/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDetail.as_view(), name ='image-detail'),
-
- url(r'api/core/controllernetworks/$', ControllerNetworkList.as_view(), name='controllernetwork-list'),
- url(r'api/core/controllernetworks/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerNetworkDetail.as_view(), name ='controllernetwork-detail'),
-
- url(r'api/core/sites/$', SiteList.as_view(), name='site-list'),
- url(r'api/core/sites/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDetail.as_view(), name ='site-detail'),
-
- url(r'api/core/slice_roles/$', SliceRoleList.as_view(), name='slicerole-list'),
- url(r'api/core/slice_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceRoleDetail.as_view(), name ='slicerole-detail'),
-
- url(r'api/core/xosguiextensions/$', XOSGuiExtensionList.as_view(), name='xosguiextension-list'),
- url(r'api/core/xosguiextensions/(?P<pk>[a-zA-Z0-9\-]+)/$', XOSGuiExtensionDetail.as_view(), name ='xosguiextension-detail'),
-
- url(r'api/core/serviceinstancelinks/$', ServiceInstanceLinkList.as_view(), name='serviceinstancelink-list'),
- url(r'api/core/serviceinstancelinks/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceInstanceLinkDetail.as_view(), name ='serviceinstancelink-detail'),
-
- url(r'api/core/slice_privileges/$', SlicePrivilegeList.as_view(), name='sliceprivilege-list'),
- url(r'api/core/slice_privileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SlicePrivilegeDetail.as_view(), name ='sliceprivilege-detail'),
-
- url(r'api/core/controllerprivileges/$', ControllerPrivilegeList.as_view(), name='controllerprivilege-list'),
- url(r'api/core/controllerprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerPrivilegeDetail.as_view(), name ='controllerprivilege-detail'),
-
- url(r'api/core/flavors/$', FlavorList.as_view(), name='flavor-list'),
- url(r'api/core/flavors/(?P<pk>[a-zA-Z0-9\-]+)/$', FlavorDetail.as_view(), name ='flavor-detail'),
-
- url(r'api/core/serviceroles/$', ServiceRoleList.as_view(), name='servicerole-list'),
- url(r'api/core/serviceroles/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceRoleDetail.as_view(), name ='servicerole-detail'),
-
- url(r'api/core/controllersites/$', ControllerSiteList.as_view(), name='controllersite-list'),
- url(r'api/core/controllersites/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSiteDetail.as_view(), name ='controllersite-detail'),
-
- url(r'api/core/controllerslices/$', ControllerSliceList.as_view(), name='controllerslice-list'),
- url(r'api/core/controllerslices/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSliceDetail.as_view(), name ='controllerslice-detail'),
-
- url(r'api/core/servicedependencys/$', ServiceDependencyList.as_view(), name='servicedependency-list'),
- url(r'api/core/servicedependencys/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceDependencyDetail.as_view(), name ='servicedependency-detail'),
-
- url(r'api/core/networks/$', NetworkList.as_view(), name='network-list'),
- url(r'api/core/networks/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkDetail.as_view(), name ='network-detail'),
-
- url(r'api/core/controllerroles/$', ControllerRoleList.as_view(), name='controllerrole-list'),
- url(r'api/core/controllerroles/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerRoleDetail.as_view(), name ='controllerrole-detail'),
-
- url(r'api/core/diags/$', DiagList.as_view(), name='diag-list'),
- url(r'api/core/diags/(?P<pk>[a-zA-Z0-9\-]+)/$', DiagDetail.as_view(), name ='diag-detail'),
-
- url(r'api/core/ports/$', PortList.as_view(), name='port-list'),
- url(r'api/core/ports/(?P<pk>[a-zA-Z0-9\-]+)/$', PortDetail.as_view(), name ='port-detail'),
-
- url(r'api/core/instances/$', InstanceList.as_view(), name='instance-list'),
- url(r'api/core/instances/(?P<pk>[a-zA-Z0-9\-]+)/$', InstanceDetail.as_view(), name ='instance-detail'),
-
- url(r'api/core/roles/$', RoleList.as_view(), name='role-list'),
- url(r'api/core/roles/(?P<pk>[a-zA-Z0-9\-]+)/$', RoleDetail.as_view(), name ='role-detail'),
-
- url(r'api/core/serviceinterfaces/$', ServiceInterfaceList.as_view(), name='serviceinterface-list'),
- url(r'api/core/serviceinterfaces/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceInterfaceDetail.as_view(), name ='serviceinterface-detail'),
-
- url(r'api/core/nodelabels/$', NodeLabelList.as_view(), name='nodelabel-list'),
- url(r'api/core/nodelabels/(?P<pk>[a-zA-Z0-9\-]+)/$', NodeLabelDetail.as_view(), name ='nodelabel-detail'),
-
- url(r'api/core/privileges/$', PrivilegeList.as_view(), name='privilege-list'),
- url(r'api/core/privileges/(?P<pk>[a-zA-Z0-9\-]+)/$', PrivilegeDetail.as_view(), name ='privilege-detail'),
-
- url(r'api/core/nodes/$', NodeList.as_view(), name='node-list'),
- url(r'api/core/nodes/(?P<pk>[a-zA-Z0-9\-]+)/$', NodeDetail.as_view(), name ='node-detail'),
-
- url(r'api/core/addresspools/$', AddressPoolList.as_view(), name='addresspool-list'),
- url(r'api/core/addresspools/(?P<pk>[a-zA-Z0-9\-]+)/$', AddressPoolDetail.as_view(), name ='addresspool-detail'),
-
- url(r'api/core/dashboardviews/$', DashboardViewList.as_view(), name='dashboardview-list'),
- url(r'api/core/dashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', DashboardViewDetail.as_view(), name ='dashboardview-detail'),
-
- url(r'api/core/networkparameters/$', NetworkParameterList.as_view(), name='networkparameter-list'),
- url(r'api/core/networkparameters/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterDetail.as_view(), name ='networkparameter-detail'),
-
- url(r'api/core/imagedeploymentses/$', ImageDeploymentsList.as_view(), name='imagedeployments-list'),
- url(r'api/core/imagedeploymentses/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentsDetail.as_view(), name ='imagedeployments-detail'),
-
- url(r'api/core/controllerusers/$', ControllerUserList.as_view(), name='controlleruser-list'),
- url(r'api/core/controllerusers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerUserDetail.as_view(), name ='controlleruser-detail'),
-
- url(r'api/core/servicemonitoringagentinfos/$', ServiceMonitoringAgentInfoList.as_view(), name='servicemonitoringagentinfo-list'),
- url(r'api/core/servicemonitoringagentinfos/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceMonitoringAgentInfoDetail.as_view(), name ='servicemonitoringagentinfo-detail'),
-
- url(r'api/core/controllerdashboardviews/$', ControllerDashboardViewList.as_view(), name='controllerdashboardview-list'),
- url(r'api/core/controllerdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDashboardViewDetail.as_view(), name ='controllerdashboardview-detail'),
-
- url(r'api/core/userdashboardviews/$', UserDashboardViewList.as_view(), name='userdashboardview-list'),
- url(r'api/core/userdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDashboardViewDetail.as_view(), name ='userdashboardview-detail'),
-
- url(r'api/core/controllers/$', ControllerList.as_view(), name='controller-list'),
- url(r'api/core/controllers/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerDetail.as_view(), name ='controller-detail'),
-
- url(r'api/core/slices/$', SliceList.as_view(), name='slice-list'),
- url(r'api/core/slices/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDetail.as_view(), name ='slice-detail'),
-
- url(r'api/core/users/$', UserList.as_view(), name='user-list'),
- url(r'api/core/users/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDetail.as_view(), name ='user-detail'),
-
- url(r'api/core/deployments/$', DeploymentList.as_view(), name='deployment-list'),
- url(r'api/core/deployments/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentDetail.as_view(), name ='deployment-detail'),
-
- url(r'api/core/siteprivileges/$', SitePrivilegeList.as_view(), name='siteprivilege-list'),
- url(r'api/core/siteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SitePrivilegeDetail.as_view(), name ='siteprivilege-detail'),
-
- url(r'api/core/site_roles/$', SiteRoleList.as_view(), name='siterole-list'),
- url(r'api/core/site_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteRoleDetail.as_view(), name ='siterole-detail'),
-
- url(r'api/core/xoses/$', XOSList.as_view(), name='xos-list'),
- url(r'api/core/xoses/(?P<pk>[a-zA-Z0-9\-]+)/$', XOSDetail.as_view(), name ='xos-detail'),
-
- url(r'api/core/networkslices/$', NetworkSliceList.as_view(), name='networkslice-list'),
- url(r'api/core/networkslices/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliceDetail.as_view(), name ='networkslice-detail'),
-
- url(r'api/core/services/$', ServiceList.as_view(), name='service-list'),
- url(r'api/core/services/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceDetail.as_view(), name ='service-detail'),
-
- url(r'api/core/controllersliceprivileges/$', ControllerSlicePrivilegeList.as_view(), name='controllersliceprivilege-list'),
- url(r'api/core/controllersliceprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ControllerSlicePrivilegeDetail.as_view(), name ='controllersliceprivilege-detail'),
-
- url(r'api/core/serviceinstanceattributes/$', ServiceInstanceAttributeList.as_view(), name='serviceinstanceattribute-list'),
- url(r'api/core/serviceinstanceattributes/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceInstanceAttributeDetail.as_view(), name ='serviceinstanceattribute-detail'),
-
- url(r'api/core/deploymentprivileges/$', DeploymentPrivilegeList.as_view(), name='deploymentprivilege-list'),
- url(r'api/core/deploymentprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentPrivilegeDetail.as_view(), name ='deploymentprivilege-detail'),
-
- url(r'api/core/networkparametertypes/$', NetworkParameterTypeList.as_view(), name='networkparametertype-list'),
- url(r'api/core/networkparametertypes/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterTypeDetail.as_view(), name ='networkparametertype-detail'),
-
- url(r'api/core/sitedeployments/$', SiteDeploymentList.as_view(), name='sitedeployment-list'),
- url(r'api/core/sitedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDeploymentDetail.as_view(), name ='sitedeployment-detail'),
-
- url(r'api/core/tenantwithcontainers/$', TenantWithContainerList.as_view(), name='tenantwithcontainer-list'),
- url(r'api/core/tenantwithcontainers/(?P<pk>[a-zA-Z0-9\-]+)/$', TenantWithContainerDetail.as_view(), name ='tenantwithcontainer-detail'),
-
- url(r'api/core/deploymentroles/$', DeploymentRoleList.as_view(), name='deploymentrole-list'),
- url(r'api/core/deploymentroles/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentRoleDetail.as_view(), name ='deploymentrole-detail'),
-
- url(r'api/core/tags/$', TagList.as_view(), name='tag-list'),
- url(r'api/core/tags/(?P<pk>[a-zA-Z0-9\-]+)/$', TagDetail.as_view(), name ='tag-detail'),
-
- url(r'api/core/interfacetypes/$', InterfaceTypeList.as_view(), name='interfacetype-list'),
- url(r'api/core/interfacetypes/(?P<pk>[a-zA-Z0-9\-]+)/$', InterfaceTypeDetail.as_view(), name ='interfacetype-detail'),
-
- url(r'api/core/networktemplates/$', NetworkTemplateList.as_view(), name='networktemplate-list'),
- url(r'api/core/networktemplates/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkTemplateDetail.as_view(), name ='networktemplate-detail'),
-
- url(r'api/core/serviceprivileges/$', ServicePrivilegeList.as_view(), name='serviceprivilege-list'),
- url(r'api/core/serviceprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', ServicePrivilegeDetail.as_view(), name ='serviceprivilege-detail'),
-
- url(r'api/core/serviceinstances/$', ServiceInstanceList.as_view(), name='serviceinstance-list'),
- url(r'api/core/serviceinstances/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceInstanceDetail.as_view(), name ='serviceinstance-detail'),
-
- )
-
-@api_view(['GET'])
-def api_root_legacy(request, format=None):
- return Response({
- 'serviceattributes': reverse('serviceattribute-list-legacy', request=request, format=format),
- 'controllerimageses': reverse('controllerimages-list-legacy', request=request, format=format),
- 'controllersiteprivileges': reverse('controllersiteprivilege-list-legacy', request=request, format=format),
- 'images': reverse('image-list-legacy', request=request, format=format),
- 'controllernetworks': reverse('controllernetwork-list-legacy', request=request, format=format),
- 'sites': reverse('site-list-legacy', request=request, format=format),
- 'sliceroles': reverse('slicerole-list-legacy', request=request, format=format),
- 'xosguiextensions': reverse('xosguiextension-list-legacy', request=request, format=format),
- 'serviceinstancelinks': reverse('serviceinstancelink-list-legacy', request=request, format=format),
- 'sliceprivileges': reverse('sliceprivilege-list-legacy', request=request, format=format),
- 'controllerprivileges': reverse('controllerprivilege-list-legacy', request=request, format=format),
- 'flavors': reverse('flavor-list-legacy', request=request, format=format),
- 'serviceroles': reverse('servicerole-list-legacy', request=request, format=format),
- 'controllersites': reverse('controllersite-list-legacy', request=request, format=format),
- 'controllerslices': reverse('controllerslice-list-legacy', request=request, format=format),
- 'servicedependencys': reverse('servicedependency-list-legacy', request=request, format=format),
- 'networks': reverse('network-list-legacy', request=request, format=format),
- 'controllerroles': reverse('controllerrole-list-legacy', request=request, format=format),
- 'diags': reverse('diag-list-legacy', request=request, format=format),
- 'ports': reverse('port-list-legacy', request=request, format=format),
- 'instances': reverse('instance-list-legacy', request=request, format=format),
- 'roles': reverse('role-list-legacy', request=request, format=format),
- 'serviceinterfaces': reverse('serviceinterface-list-legacy', request=request, format=format),
- 'nodelabels': reverse('nodelabel-list-legacy', request=request, format=format),
- 'privileges': reverse('privilege-list-legacy', request=request, format=format),
- 'nodes': reverse('node-list-legacy', request=request, format=format),
- 'addresspools': reverse('addresspool-list-legacy', request=request, format=format),
- 'dashboardviews': reverse('dashboardview-list-legacy', request=request, format=format),
- 'networkparameters': reverse('networkparameter-list-legacy', request=request, format=format),
- 'imagedeploymentses': reverse('imagedeployments-list-legacy', request=request, format=format),
- 'controllerusers': reverse('controlleruser-list-legacy', request=request, format=format),
- 'servicemonitoringagentinfos': reverse('servicemonitoringagentinfo-list-legacy', request=request, format=format),
- 'controllerdashboardviews': reverse('controllerdashboardview-list-legacy', request=request, format=format),
- 'userdashboardviews': reverse('userdashboardview-list-legacy', request=request, format=format),
- 'controllers': reverse('controller-list-legacy', request=request, format=format),
- 'slices': reverse('slice-list-legacy', request=request, format=format),
- 'users': reverse('user-list-legacy', request=request, format=format),
- 'deployments': reverse('deployment-list-legacy', request=request, format=format),
- 'siteprivileges': reverse('siteprivilege-list-legacy', request=request, format=format),
- 'siteroles': reverse('siterole-list-legacy', request=request, format=format),
- 'xoses': reverse('xos-list-legacy', request=request, format=format),
- 'networkslices': reverse('networkslice-list-legacy', request=request, format=format),
- 'services': reverse('service-list-legacy', request=request, format=format),
- 'controllersliceprivileges': reverse('controllersliceprivilege-list-legacy', request=request, format=format),
- 'serviceinstanceattributes': reverse('serviceinstanceattribute-list-legacy', request=request, format=format),
- 'deploymentprivileges': reverse('deploymentprivilege-list-legacy', request=request, format=format),
- 'networkparametertypes': reverse('networkparametertype-list-legacy', request=request, format=format),
- 'sitedeployments': reverse('sitedeployment-list-legacy', request=request, format=format),
- 'tenantwithcontainers': reverse('tenantwithcontainer-list-legacy', request=request, format=format),
- 'deploymentroles': reverse('deploymentrole-list-legacy', request=request, format=format),
- 'tags': reverse('tag-list-legacy', request=request, format=format),
- 'interfacetypes': reverse('interfacetype-list-legacy', request=request, format=format),
- 'networktemplates': reverse('networktemplate-list-legacy', request=request, format=format),
- 'serviceprivileges': reverse('serviceprivilege-list-legacy', request=request, format=format),
- 'serviceinstances': reverse('serviceinstance-list-legacy', request=request, format=format),
-
- })
-
-@api_view(['GET'])
-def api_root(request, format=None):
- return Response({
- 'serviceattributes': reverse('serviceattribute-list', request=request, format=format),
- 'controllerimageses': reverse('controllerimages-list', request=request, format=format),
- 'controllersiteprivileges': reverse('controllersiteprivilege-list', request=request, format=format),
- 'images': reverse('image-list', request=request, format=format),
- 'controllernetworks': reverse('controllernetwork-list', request=request, format=format),
- 'sites': reverse('site-list', request=request, format=format),
- 'sliceroles': reverse('slicerole-list', request=request, format=format),
- 'xosguiextensions': reverse('xosguiextension-list', request=request, format=format),
- 'serviceinstancelinks': reverse('serviceinstancelink-list', request=request, format=format),
- 'sliceprivileges': reverse('sliceprivilege-list', request=request, format=format),
- 'controllerprivileges': reverse('controllerprivilege-list', request=request, format=format),
- 'flavors': reverse('flavor-list', request=request, format=format),
- 'serviceroles': reverse('servicerole-list', request=request, format=format),
- 'controllersites': reverse('controllersite-list', request=request, format=format),
- 'controllerslices': reverse('controllerslice-list', request=request, format=format),
- 'servicedependencys': reverse('servicedependency-list', request=request, format=format),
- 'networks': reverse('network-list', request=request, format=format),
- 'controllerroles': reverse('controllerrole-list', request=request, format=format),
- 'diags': reverse('diag-list', request=request, format=format),
- 'ports': reverse('port-list', request=request, format=format),
- 'instances': reverse('instance-list', request=request, format=format),
- 'roles': reverse('role-list', request=request, format=format),
- 'serviceinterfaces': reverse('serviceinterface-list', request=request, format=format),
- 'nodelabels': reverse('nodelabel-list', request=request, format=format),
- 'privileges': reverse('privilege-list', request=request, format=format),
- 'nodes': reverse('node-list', request=request, format=format),
- 'addresspools': reverse('addresspool-list', request=request, format=format),
- 'dashboardviews': reverse('dashboardview-list', request=request, format=format),
- 'networkparameters': reverse('networkparameter-list', request=request, format=format),
- 'imagedeploymentses': reverse('imagedeployments-list', request=request, format=format),
- 'controllerusers': reverse('controlleruser-list', request=request, format=format),
- 'servicemonitoringagentinfos': reverse('servicemonitoringagentinfo-list', request=request, format=format),
- 'controllerdashboardviews': reverse('controllerdashboardview-list', request=request, format=format),
- 'userdashboardviews': reverse('userdashboardview-list', request=request, format=format),
- 'controllers': reverse('controller-list', request=request, format=format),
- 'slices': reverse('slice-list', request=request, format=format),
- 'users': reverse('user-list', request=request, format=format),
- 'deployments': reverse('deployment-list', request=request, format=format),
- 'siteprivileges': reverse('siteprivilege-list', request=request, format=format),
- 'siteroles': reverse('siterole-list', request=request, format=format),
- 'xoses': reverse('xos-list', request=request, format=format),
- 'networkslices': reverse('networkslice-list', request=request, format=format),
- 'services': reverse('service-list', request=request, format=format),
- 'controllersliceprivileges': reverse('controllersliceprivilege-list', request=request, format=format),
- 'serviceinstanceattributes': reverse('serviceinstanceattribute-list', request=request, format=format),
- 'deploymentprivileges': reverse('deploymentprivilege-list', request=request, format=format),
- 'networkparametertypes': reverse('networkparametertype-list', request=request, format=format),
- 'sitedeployments': reverse('sitedeployment-list', request=request, format=format),
- 'tenantwithcontainers': reverse('tenantwithcontainer-list', request=request, format=format),
- 'deploymentroles': reverse('deploymentrole-list', request=request, format=format),
- 'tags': reverse('tag-list', request=request, format=format),
- 'interfacetypes': reverse('interfacetype-list', request=request, format=format),
- 'networktemplates': reverse('networktemplate-list', request=request, format=format),
- 'serviceprivileges': reverse('serviceprivilege-list', request=request, format=format),
- 'serviceinstances': reverse('serviceinstance-list', request=request, format=format),
-
- })
-
-# Based on serializers.py
-
-class XOSModelSerializer(serializers.ModelSerializer):
- # TODO: Rest Framework 3.x doesn't support save_object()
- def NEED_TO_UPDATE_save_object(self, obj, **kwargs):
-
- """ rest_framework can't deal with ManyToMany relations that have a
- through table. In xos, 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 ServiceAttributeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServiceAttribute
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','service',)
-
-class ServiceAttributeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServiceAttribute
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','service',)
-
-
-
-
-class ControllerImagesSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','glance_image_id','image','controller',)
-
-class ControllerImagesIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','glance_image_id','image','controller',)
-
-
-
-
-class ControllerSitePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ControllerSitePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','site_privilege',)
-
-class ControllerSitePrivilegeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ControllerSitePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','site_privilege',)
-
-
-
-
-class ImageSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = Image
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','kind','disk_format','container_format','path','tag',)
-
-class ImageIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = Image
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','kind','disk_format','container_format','path','tag',)
-
-
-
-
-class ControllerNetworkSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ControllerNetwork
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','subnet','start_ip','stop_ip','net_id','router_id','subnet_id','gateway','segmentation_id','network','controller',)
-
-class ControllerNetworkIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ControllerNetwork
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','subnet','start_ip','stop_ip','net_id','router_id','subnet_id','gateway','segmentation_id','network','controller',)
-
-
-
-
-class SiteSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- 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 = Site
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','site_url','enabled','hosts_nodes','hosts_users','longitude','latitude','login_base','is_public','abbreviated_name','deployments',)
-
-class SiteIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- deployments = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Deployment.objects.all())
-
-
- 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 = Site
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','site_url','enabled','hosts_nodes','hosts_users','longitude','latitude','login_base','is_public','abbreviated_name','deployments',)
-
-
-
-
-class SliceRoleSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = SliceRole
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-class SliceRoleIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = SliceRole
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-
-
-
-class XOSGuiExtensionSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = XOSGuiExtension
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','files',)
-
-class XOSGuiExtensionIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = XOSGuiExtension
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','files',)
-
-
-
-
-class ServiceInstanceLinkSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServiceInstanceLink
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','provider_service_instance','subscriber_service_instance','subscriber_service','subscriber_network',)
-
-class ServiceInstanceLinkIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServiceInstanceLink
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','provider_service_instance','subscriber_service_instance','subscriber_service','subscriber_network',)
-
-
-
-
-class SlicePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = SlicePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','slice','role',)
-
-class SlicePrivilegeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = SlicePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','slice','role',)
-
-
-
-
-class ControllerPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','privilege',)
-
-class ControllerPrivilegeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','privilege',)
-
-
-
-
-class FlavorSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description','flavor',)
-
-class FlavorIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description','flavor',)
-
-
-
-
-class ServiceRoleSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServiceRole
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-class ServiceRoleIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServiceRole
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-
-
-
-class ControllerSiteSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ControllerSite
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','tenant_id','site','controller',)
-
-class ControllerSiteIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ControllerSite
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','tenant_id','site','controller',)
-
-
-
-
-class ControllerSliceSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ControllerSlice
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','tenant_id','controller','slice',)
-
-class ControllerSliceIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ControllerSlice
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','tenant_id','controller','slice',)
-
-
-
-
-class ServiceDependencySerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServiceDependency
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','connect_method','provider_service','subscriber_service',)
-
-class ServiceDependencyIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServiceDependency
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','connect_method','provider_service','subscriber_service',)
-
-
-
-
-class NetworkSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail')
-
-
-
- slices = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='slice-detail')
-
-
-
- instances = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='instance-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 = Network
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','subnet','start_ip','end_ip','ports','labels','permit_all_slices','autoconnect','template','owner','slices','slices','instances',)
-
-class NetworkIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- slices = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Slice.objects.all())
-
-
-
- slices = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Slice.objects.all())
-
-
-
- instances = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Instance.objects.all())
-
-
- 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 = Network
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','subnet','start_ip','end_ip','ports','labels','permit_all_slices','autoconnect','template','owner','slices','slices','instances',)
-
-
-
-
-class ControllerRoleSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-class ControllerRoleIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-
-
-
-class DiagSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = Diag
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name',)
-
-class DiagIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = Diag
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name',)
-
-
-
-
-class PortSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = Port
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','ip','port_id','mac','xos_created','network','instance',)
-
-class PortIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = Port
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','ip','port_id','mac','xos_created','network','instance',)
-
-
-
-
-class InstanceSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- networks = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='network-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 = Instance
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','instance_id','instance_uuid','name','instance_name','ip','numberCores','userData','isolation','volumes','image','creator','slice','deployment','node','flavor','parent','networks',)
-
-class InstanceIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- networks = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Network.objects.all())
-
-
- 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 = Instance
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','instance_id','instance_uuid','name','instance_name','ip','numberCores','userData','isolation','volumes','image','creator','slice','deployment','node','flavor','parent','networks',)
-
-
-
-
-class RoleSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = Role
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_type','role','description',)
-
-class RoleIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = Role
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_type','role','description',)
-
-
-
-
-class ServiceInterfaceSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServiceInterface
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','service','interface_type',)
-
-class ServiceInterfaceIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServiceInterface
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','service','interface_type',)
-
-
-
-
-class NodeLabelSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- nodes = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='node-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 = NodeLabel
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','nodes',)
-
-class NodeLabelIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- nodes = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Node.objects.all())
-
-
- 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 = NodeLabel
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','nodes',)
-
-
-
-
-class PrivilegeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = Privilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','accessor_id','accessor_type','object_id','object_type','permission','granted','expires',)
-
-class PrivilegeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = Privilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','accessor_id','accessor_type','object_id','object_type','permission','granted','expires',)
-
-
-
-
-class NodeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- nodelabels = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='nodelabel-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 = Node
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','site_deployment','nodelabels',)
-
-class NodeIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- nodelabels = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = NodeLabel.objects.all())
-
-
- 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 = Node
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','site_deployment','nodelabels',)
-
-
-
-
-class AddressPoolSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = AddressPool
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','addresses','gateway_ip','gateway_mac','cidr','inuse','service',)
-
-class AddressPoolIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = AddressPool
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','addresses','gateway_ip','gateway_mac','cidr','inuse','service',)
-
-
-
-
-class DashboardViewSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- controllers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='controller-detail')
-
-
-
- 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 = DashboardView
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','url','enabled','icon','icon_active','controllers','deployments',)
-
-class DashboardViewIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- controllers = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Controller.objects.all())
-
-
-
- deployments = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Deployment.objects.all())
-
-
- 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 = DashboardView
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','url','enabled','icon','icon_active','controllers','deployments',)
-
-
-
-
-class NetworkParameterSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = NetworkParameter
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','value','content_type','object_id','parameter',)
-
-class NetworkParameterIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = NetworkParameter
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','value','content_type','object_id','parameter',)
-
-
-
-
-class ImageDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ImageDeployments
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','image','deployment',)
-
-class ImageDeploymentsIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ImageDeployments
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','image','deployment',)
-
-
-
-
-class ControllerUserSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ControllerUser
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','kuser_id','user','controller',)
-
-class ControllerUserIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ControllerUser
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','kuser_id','user','controller',)
-
-
-
-
-class ServiceMonitoringAgentInfoSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServiceMonitoringAgentInfo
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','target_uri','service',)
-
-class ServiceMonitoringAgentInfoIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServiceMonitoringAgentInfo
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','target_uri','service',)
-
-
-
-
-class ControllerDashboardViewSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ControllerDashboardView
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','enabled','url','controller','dashboardView',)
-
-class ControllerDashboardViewIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ControllerDashboardView
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','enabled','url','controller','dashboardView',)
-
-
-
-
-class UserDashboardViewSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = UserDashboardView
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','dashboardView','order',)
-
-class UserDashboardViewIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = UserDashboardView
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','dashboardView','order',)
-
-
-
-
-class ControllerSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- dashboardviews = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='dashboardview-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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','backend_type','version','auth_url','admin_user','admin_password','admin_tenant','domain','rabbit_host','rabbit_user','rabbit_password','deployment','dashboardviews',)
-
-class ControllerIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- dashboardviews = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = DashboardView.objects.all())
-
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','backend_type','version','auth_url','admin_user','admin_password','admin_tenant','domain','rabbit_host','rabbit_user','rabbit_password','deployment','dashboardviews',)
-
-
-
-
-class SliceSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- 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):
- return str(obj)
- def getValidators(self, obj):
- try:
- return obj.getValidators()
- except:
- return None
- class Meta:
- model = Slice
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','enabled','description','slice_url','max_instances','network','exposed_ports','mount_data_sets','default_isolation','site','service','creator','default_flavor','default_image','default_node','networks','networks',)
-
-class SliceIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- networks = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Network.objects.all())
-
-
-
- networks = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Network.objects.all())
-
-
- 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 = Slice
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','enabled','description','slice_url','max_instances','network','exposed_ports','mount_data_sets','default_isolation','site','service','creator','default_flavor','default_image','default_node','networks','networks',)
-
-
-
-
-class UserSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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','is_registering','is_appuser','login_page','created','updated','enacted','policed','backend_status','backend_need_delete','backend_need_reap','deleted','write_protect','lazy_blocked','no_sync','no_policy','timezone','policy_status',)
-
-class UserIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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','is_registering','is_appuser','login_page','created','updated','enacted','policed','backend_status','backend_need_delete','backend_need_reap','deleted','write_protect','lazy_blocked','no_sync','no_policy','timezone','policy_status',)
-
-
-
-
-class DeploymentSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- sites = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='site-detail')
-
-
-
- dashboardviews = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='dashboardview-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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','accessControl','sites','dashboardviews',)
-
-class DeploymentIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- sites = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = Site.objects.all())
-
-
-
- dashboardviews = serializers.PrimaryKeyRelatedField(many=True, required=False, queryset = DashboardView.objects.all())
-
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','accessControl','sites','dashboardviews',)
-
-
-
-
-class SitePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = SitePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','site','role',)
-
-class SitePrivilegeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = SitePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','site','role',)
-
-
-
-
-class SiteRoleSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = SiteRole
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-class SiteRoleIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = SiteRole
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-
-
-
-class XOSSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = XOS
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name',)
-
-class XOSIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = XOS
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name',)
-
-
-
-
-class NetworkSliceSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = NetworkSlice
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','network','slice',)
-
-class NetworkSliceIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = NetworkSlice
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','network','slice',)
-
-
-
-
-class ServiceSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = Service
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','private_key_fn','service_specific_id','service_specific_attribute',)
-
-class ServiceIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = Service
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','private_key_fn','service_specific_id','service_specific_attribute',)
-
-
-
-
-class ControllerSlicePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ControllerSlicePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','slice_privilege',)
-
-class ControllerSlicePrivilegeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ControllerSlicePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','slice_privilege',)
-
-
-
-
-class ServiceInstanceAttributeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServiceInstanceAttribute
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','service_instance',)
-
-class ServiceInstanceAttributeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServiceInstanceAttribute
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','service_instance',)
-
-
-
-
-class DeploymentPrivilegeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = DeploymentPrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','deployment','role',)
-
-class DeploymentPrivilegeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = DeploymentPrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','deployment','role',)
-
-
-
-
-class NetworkParameterTypeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = NetworkParameterType
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description',)
-
-class NetworkParameterTypeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = NetworkParameterType
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description',)
-
-
-
-
-class SiteDeploymentSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = SiteDeployment
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','availability_zone','site','deployment','controller',)
-
-class SiteDeploymentIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = SiteDeployment
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','availability_zone','site','deployment','controller',)
-
-
-
-
-class TenantWithContainerSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = TenantWithContainer
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','service_specific_id','service_specific_attribute','owner','external_hostname','external_container','instance','creator',)
-
-class TenantWithContainerIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = TenantWithContainer
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','service_specific_id','service_specific_attribute','owner','external_hostname','external_container','instance','creator',)
-
-
-
-
-class DeploymentRoleSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-class DeploymentRoleIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
-
-
-
-class TagSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = Tag
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','content_type','object_id','service',)
-
-class TagIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = Tag
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','content_type','object_id','service',)
-
-
-
-
-class InterfaceTypeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = InterfaceType
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','direction',)
-
-class InterfaceTypeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = InterfaceType
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','direction',)
-
-
-
-
-class NetworkTemplateSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description','visibility','translation','access','shared_network_name','shared_network_id','topology_kind','controller_kind','vtn_kind',)
-
-class NetworkTemplateIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description','visibility','translation','access','shared_network_name','shared_network_id','topology_kind','controller_kind','vtn_kind',)
-
-
-
-
-class ServicePrivilegeSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServicePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','service','role',)
-
-class ServicePrivilegeIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServicePrivilege
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','service','role',)
-
-
-
-
-class ServiceInstanceSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- 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 = ServiceInstance
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','service_specific_id','service_specific_attribute','owner',)
-
-class ServiceInstanceIdSerializer(XOSModelSerializer):
- id = IdField()
-
- 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 = ServiceInstance
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','service_specific_id','service_specific_attribute','owner',)
-
-
-
-
-serializerLookUp = {
-
- ServiceAttribute: ServiceAttributeSerializer,
-
- ControllerImages: ControllerImagesSerializer,
-
- ControllerSitePrivilege: ControllerSitePrivilegeSerializer,
-
- Image: ImageSerializer,
-
- ControllerNetwork: ControllerNetworkSerializer,
-
- Site: SiteSerializer,
-
- SliceRole: SliceRoleSerializer,
-
- XOSGuiExtension: XOSGuiExtensionSerializer,
-
- ServiceInstanceLink: ServiceInstanceLinkSerializer,
-
- SlicePrivilege: SlicePrivilegeSerializer,
-
- ControllerPrivilege: ControllerPrivilegeSerializer,
-
- Flavor: FlavorSerializer,
-
- ServiceRole: ServiceRoleSerializer,
-
- ControllerSite: ControllerSiteSerializer,
-
- ControllerSlice: ControllerSliceSerializer,
-
- ServiceDependency: ServiceDependencySerializer,
-
- Network: NetworkSerializer,
-
- ControllerRole: ControllerRoleSerializer,
-
- Diag: DiagSerializer,
-
- Port: PortSerializer,
-
- Instance: InstanceSerializer,
-
- Role: RoleSerializer,
-
- ServiceInterface: ServiceInterfaceSerializer,
-
- NodeLabel: NodeLabelSerializer,
-
- Privilege: PrivilegeSerializer,
-
- Node: NodeSerializer,
-
- AddressPool: AddressPoolSerializer,
-
- DashboardView: DashboardViewSerializer,
-
- NetworkParameter: NetworkParameterSerializer,
-
- ImageDeployments: ImageDeploymentsSerializer,
-
- ControllerUser: ControllerUserSerializer,
-
- ServiceMonitoringAgentInfo: ServiceMonitoringAgentInfoSerializer,
-
- ControllerDashboardView: ControllerDashboardViewSerializer,
-
- UserDashboardView: UserDashboardViewSerializer,
-
- Controller: ControllerSerializer,
-
- Slice: SliceSerializer,
-
- User: UserSerializer,
-
- Deployment: DeploymentSerializer,
-
- SitePrivilege: SitePrivilegeSerializer,
-
- SiteRole: SiteRoleSerializer,
-
- XOS: XOSSerializer,
-
- NetworkSlice: NetworkSliceSerializer,
-
- Service: ServiceSerializer,
-
- ControllerSlicePrivilege: ControllerSlicePrivilegeSerializer,
-
- ServiceInstanceAttribute: ServiceInstanceAttributeSerializer,
-
- DeploymentPrivilege: DeploymentPrivilegeSerializer,
-
- NetworkParameterType: NetworkParameterTypeSerializer,
-
- SiteDeployment: SiteDeploymentSerializer,
-
- TenantWithContainer: TenantWithContainerSerializer,
-
- DeploymentRole: DeploymentRoleSerializer,
-
- Tag: TagSerializer,
-
- InterfaceType: InterfaceTypeSerializer,
-
- NetworkTemplate: NetworkTemplateSerializer,
-
- ServicePrivilege: ServicePrivilegeSerializer,
-
- ServiceInstance: ServiceInstanceSerializer,
-
- None: None,
- }
-
-# Based on core/views/*.py
-
-
-class ServiceAttributeList(XOSListCreateAPIView):
- queryset = ServiceAttribute.objects.select_related().all()
- serializer_class = ServiceAttributeSerializer
- id_serializer_class = ServiceAttributeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','service',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceAttribute.select_by_user(self.request.user)
-
-
-class ServiceAttributeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServiceAttribute.objects.select_related().all()
- serializer_class = ServiceAttributeSerializer
- id_serializer_class = ServiceAttributeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceAttribute.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerImagesList(XOSListCreateAPIView):
- queryset = ControllerImages.objects.select_related().all()
- serializer_class = ControllerImagesSerializer
- id_serializer_class = ControllerImagesIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','glance_image_id','image','controller',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerImages.select_by_user(self.request.user)
-
-
-class ControllerImagesDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerImages.objects.select_related().all()
- serializer_class = ControllerImagesSerializer
- id_serializer_class = ControllerImagesIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerImages.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerSitePrivilegeList(XOSListCreateAPIView):
- queryset = ControllerSitePrivilege.objects.select_related().all()
- serializer_class = ControllerSitePrivilegeSerializer
- id_serializer_class = ControllerSitePrivilegeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','site_privilege',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerSitePrivilege.select_by_user(self.request.user)
-
-
-class ControllerSitePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerSitePrivilege.objects.select_related().all()
- serializer_class = ControllerSitePrivilegeSerializer
- id_serializer_class = ControllerSitePrivilegeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerSitePrivilege.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ImageList(XOSListCreateAPIView):
- queryset = Image.objects.select_related().all()
- serializer_class = ImageSerializer
- id_serializer_class = ImageIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','kind','disk_format','container_format','path','tag',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Image.select_by_user(self.request.user)
-
-
-class ImageDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Image.objects.select_related().all()
- serializer_class = ImageSerializer
- id_serializer_class = ImageIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Image.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerNetworkList(XOSListCreateAPIView):
- queryset = ControllerNetwork.objects.select_related().all()
- serializer_class = ControllerNetworkSerializer
- id_serializer_class = ControllerNetworkIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','subnet','start_ip','stop_ip','net_id','router_id','subnet_id','gateway','segmentation_id','network','controller',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerNetwork.select_by_user(self.request.user)
-
-
-class ControllerNetworkDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerNetwork.objects.select_related().all()
- serializer_class = ControllerNetworkSerializer
- id_serializer_class = ControllerNetworkIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerNetwork.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class SiteList(XOSListCreateAPIView):
- queryset = Site.objects.select_related().all()
- serializer_class = SiteSerializer
- id_serializer_class = SiteIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','site_url','enabled','hosts_nodes','hosts_users','longitude','latitude','login_base','is_public','abbreviated_name','deployments',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Site.select_by_user(self.request.user)
-
-
-class SiteDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Site.objects.select_related().all()
- serializer_class = SiteSerializer
- id_serializer_class = SiteIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Site.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class SliceRoleList(XOSListCreateAPIView):
- queryset = SliceRole.objects.select_related().all()
- serializer_class = SliceRoleSerializer
- id_serializer_class = SliceRoleIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SliceRole.select_by_user(self.request.user)
-
-
-class SliceRoleDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = SliceRole.objects.select_related().all()
- serializer_class = SliceRoleSerializer
- id_serializer_class = SliceRoleIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SliceRole.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class XOSGuiExtensionList(XOSListCreateAPIView):
- queryset = XOSGuiExtension.objects.select_related().all()
- serializer_class = XOSGuiExtensionSerializer
- id_serializer_class = XOSGuiExtensionIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','files',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return XOSGuiExtension.select_by_user(self.request.user)
-
-
-class XOSGuiExtensionDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = XOSGuiExtension.objects.select_related().all()
- serializer_class = XOSGuiExtensionSerializer
- id_serializer_class = XOSGuiExtensionIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return XOSGuiExtension.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceInstanceLinkList(XOSListCreateAPIView):
- queryset = ServiceInstanceLink.objects.select_related().all()
- serializer_class = ServiceInstanceLinkSerializer
- id_serializer_class = ServiceInstanceLinkIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','provider_service_instance','subscriber_service_instance','subscriber_service','subscriber_network',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceInstanceLink.select_by_user(self.request.user)
-
-
-class ServiceInstanceLinkDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServiceInstanceLink.objects.select_related().all()
- serializer_class = ServiceInstanceLinkSerializer
- id_serializer_class = ServiceInstanceLinkIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceInstanceLink.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class SlicePrivilegeList(XOSListCreateAPIView):
- queryset = SlicePrivilege.objects.select_related().all()
- serializer_class = SlicePrivilegeSerializer
- id_serializer_class = SlicePrivilegeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','slice','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SlicePrivilege.select_by_user(self.request.user)
-
-
-class SlicePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = SlicePrivilege.objects.select_related().all()
- serializer_class = SlicePrivilegeSerializer
- id_serializer_class = SlicePrivilegeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SlicePrivilege.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerPrivilegeList(XOSListCreateAPIView):
- queryset = ControllerPrivilege.objects.select_related().all()
- serializer_class = ControllerPrivilegeSerializer
- id_serializer_class = ControllerPrivilegeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','privilege',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerPrivilege.select_by_user(self.request.user)
-
-
-class ControllerPrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerPrivilege.objects.select_related().all()
- serializer_class = ControllerPrivilegeSerializer
- id_serializer_class = ControllerPrivilegeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerPrivilege.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class FlavorList(XOSListCreateAPIView):
- queryset = Flavor.objects.select_related().all()
- serializer_class = FlavorSerializer
- id_serializer_class = FlavorIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description','flavor',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Flavor.select_by_user(self.request.user)
-
-
-class FlavorDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Flavor.objects.select_related().all()
- serializer_class = FlavorSerializer
- id_serializer_class = FlavorIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Flavor.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceRoleList(XOSListCreateAPIView):
- queryset = ServiceRole.objects.select_related().all()
- serializer_class = ServiceRoleSerializer
- id_serializer_class = ServiceRoleIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceRole.select_by_user(self.request.user)
-
-
-class ServiceRoleDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServiceRole.objects.select_related().all()
- serializer_class = ServiceRoleSerializer
- id_serializer_class = ServiceRoleIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceRole.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerSiteList(XOSListCreateAPIView):
- queryset = ControllerSite.objects.select_related().all()
- serializer_class = ControllerSiteSerializer
- id_serializer_class = ControllerSiteIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','tenant_id','site','controller',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerSite.select_by_user(self.request.user)
-
-
-class ControllerSiteDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerSite.objects.select_related().all()
- serializer_class = ControllerSiteSerializer
- id_serializer_class = ControllerSiteIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerSite.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerSliceList(XOSListCreateAPIView):
- queryset = ControllerSlice.objects.select_related().all()
- serializer_class = ControllerSliceSerializer
- id_serializer_class = ControllerSliceIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','tenant_id','controller','slice',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerSlice.select_by_user(self.request.user)
-
-
-class ControllerSliceDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerSlice.objects.select_related().all()
- serializer_class = ControllerSliceSerializer
- id_serializer_class = ControllerSliceIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerSlice.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceDependencyList(XOSListCreateAPIView):
- queryset = ServiceDependency.objects.select_related().all()
- serializer_class = ServiceDependencySerializer
- id_serializer_class = ServiceDependencyIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','connect_method','provider_service','subscriber_service',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceDependency.select_by_user(self.request.user)
-
-
-class ServiceDependencyDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServiceDependency.objects.select_related().all()
- serializer_class = ServiceDependencySerializer
- id_serializer_class = ServiceDependencyIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceDependency.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class NetworkList(XOSListCreateAPIView):
- queryset = Network.objects.select_related().all()
- serializer_class = NetworkSerializer
- id_serializer_class = NetworkIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','subnet','start_ip','end_ip','ports','labels','permit_all_slices','autoconnect','template','owner','slices','slices','instances',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Network.select_by_user(self.request.user)
-
-
-class NetworkDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Network.objects.select_related().all()
- serializer_class = NetworkSerializer
- id_serializer_class = NetworkIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Network.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerRoleList(XOSListCreateAPIView):
- queryset = ControllerRole.objects.select_related().all()
- serializer_class = ControllerRoleSerializer
- id_serializer_class = ControllerRoleIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerRole.select_by_user(self.request.user)
-
-
-class ControllerRoleDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerRole.objects.select_related().all()
- serializer_class = ControllerRoleSerializer
- id_serializer_class = ControllerRoleIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerRole.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class DiagList(XOSListCreateAPIView):
- queryset = Diag.objects.select_related().all()
- serializer_class = DiagSerializer
- id_serializer_class = DiagIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Diag.select_by_user(self.request.user)
-
-
-class DiagDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Diag.objects.select_related().all()
- serializer_class = DiagSerializer
- id_serializer_class = DiagIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Diag.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class PortList(XOSListCreateAPIView):
- queryset = Port.objects.select_related().all()
- serializer_class = PortSerializer
- id_serializer_class = PortIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','ip','port_id','mac','xos_created','network','instance',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Port.select_by_user(self.request.user)
-
-
-class PortDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Port.objects.select_related().all()
- serializer_class = PortSerializer
- id_serializer_class = PortIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Port.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class InstanceList(XOSListCreateAPIView):
- queryset = Instance.objects.select_related().all()
- serializer_class = InstanceSerializer
- id_serializer_class = InstanceIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','instance_id','instance_uuid','name','instance_name','ip','numberCores','userData','isolation','volumes','image','creator','slice','deployment','node','flavor','parent','networks',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Instance.select_by_user(self.request.user)
-
-
-class InstanceDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Instance.objects.select_related().all()
- serializer_class = InstanceSerializer
- id_serializer_class = InstanceIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Instance.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class RoleList(XOSListCreateAPIView):
- queryset = Role.objects.select_related().all()
- serializer_class = RoleSerializer
- id_serializer_class = RoleIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_type','role','description',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Role.select_by_user(self.request.user)
-
-
-class RoleDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Role.objects.select_related().all()
- serializer_class = RoleSerializer
- id_serializer_class = RoleIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Role.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceInterfaceList(XOSListCreateAPIView):
- queryset = ServiceInterface.objects.select_related().all()
- serializer_class = ServiceInterfaceSerializer
- id_serializer_class = ServiceInterfaceIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','service','interface_type',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceInterface.select_by_user(self.request.user)
-
-
-class ServiceInterfaceDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServiceInterface.objects.select_related().all()
- serializer_class = ServiceInterfaceSerializer
- id_serializer_class = ServiceInterfaceIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceInterface.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class NodeLabelList(XOSListCreateAPIView):
- queryset = NodeLabel.objects.select_related().all()
- serializer_class = NodeLabelSerializer
- id_serializer_class = NodeLabelIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','nodes',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NodeLabel.select_by_user(self.request.user)
-
-
-class NodeLabelDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = NodeLabel.objects.select_related().all()
- serializer_class = NodeLabelSerializer
- id_serializer_class = NodeLabelIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NodeLabel.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class PrivilegeList(XOSListCreateAPIView):
- queryset = Privilege.objects.select_related().all()
- serializer_class = PrivilegeSerializer
- id_serializer_class = PrivilegeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','accessor_id','accessor_type','object_id','object_type','permission','granted','expires',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Privilege.select_by_user(self.request.user)
-
-
-class PrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Privilege.objects.select_related().all()
- serializer_class = PrivilegeSerializer
- id_serializer_class = PrivilegeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Privilege.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class NodeList(XOSListCreateAPIView):
- queryset = Node.objects.select_related().all()
- serializer_class = NodeSerializer
- id_serializer_class = NodeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','site_deployment','nodelabels',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Node.select_by_user(self.request.user)
-
-
-class NodeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Node.objects.select_related().all()
- serializer_class = NodeSerializer
- id_serializer_class = NodeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Node.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class AddressPoolList(XOSListCreateAPIView):
- queryset = AddressPool.objects.select_related().all()
- serializer_class = AddressPoolSerializer
- id_serializer_class = AddressPoolIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','addresses','gateway_ip','gateway_mac','cidr','inuse','service',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return AddressPool.select_by_user(self.request.user)
-
-
-class AddressPoolDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = AddressPool.objects.select_related().all()
- serializer_class = AddressPoolSerializer
- id_serializer_class = AddressPoolIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return AddressPool.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class DashboardViewList(XOSListCreateAPIView):
- queryset = DashboardView.objects.select_related().all()
- serializer_class = DashboardViewSerializer
- id_serializer_class = DashboardViewIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','url','enabled','icon','icon_active','controllers','deployments',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return DashboardView.select_by_user(self.request.user)
-
-
-class DashboardViewDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = DashboardView.objects.select_related().all()
- serializer_class = DashboardViewSerializer
- id_serializer_class = DashboardViewIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return DashboardView.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class NetworkParameterList(XOSListCreateAPIView):
- queryset = NetworkParameter.objects.select_related().all()
- serializer_class = NetworkParameterSerializer
- id_serializer_class = NetworkParameterIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','value','content_type','object_id','parameter',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NetworkParameter.select_by_user(self.request.user)
-
-
-class NetworkParameterDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = NetworkParameter.objects.select_related().all()
- serializer_class = NetworkParameterSerializer
- id_serializer_class = NetworkParameterIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NetworkParameter.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ImageDeploymentsList(XOSListCreateAPIView):
- queryset = ImageDeployments.objects.select_related().all()
- serializer_class = ImageDeploymentsSerializer
- id_serializer_class = ImageDeploymentsIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','image','deployment',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ImageDeployments.select_by_user(self.request.user)
-
-
-class ImageDeploymentsDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ImageDeployments.objects.select_related().all()
- serializer_class = ImageDeploymentsSerializer
- id_serializer_class = ImageDeploymentsIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ImageDeployments.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerUserList(XOSListCreateAPIView):
- queryset = ControllerUser.objects.select_related().all()
- serializer_class = ControllerUserSerializer
- id_serializer_class = ControllerUserIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','kuser_id','user','controller',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerUser.select_by_user(self.request.user)
-
-
-class ControllerUserDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerUser.objects.select_related().all()
- serializer_class = ControllerUserSerializer
- id_serializer_class = ControllerUserIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerUser.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceMonitoringAgentInfoList(XOSListCreateAPIView):
- queryset = ServiceMonitoringAgentInfo.objects.select_related().all()
- serializer_class = ServiceMonitoringAgentInfoSerializer
- id_serializer_class = ServiceMonitoringAgentInfoIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','target_uri','service',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceMonitoringAgentInfo.select_by_user(self.request.user)
-
-
-class ServiceMonitoringAgentInfoDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServiceMonitoringAgentInfo.objects.select_related().all()
- serializer_class = ServiceMonitoringAgentInfoSerializer
- id_serializer_class = ServiceMonitoringAgentInfoIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceMonitoringAgentInfo.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerDashboardViewList(XOSListCreateAPIView):
- queryset = ControllerDashboardView.objects.select_related().all()
- serializer_class = ControllerDashboardViewSerializer
- id_serializer_class = ControllerDashboardViewIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','enabled','url','controller','dashboardView',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerDashboardView.select_by_user(self.request.user)
-
-
-class ControllerDashboardViewDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerDashboardView.objects.select_related().all()
- serializer_class = ControllerDashboardViewSerializer
- id_serializer_class = ControllerDashboardViewIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerDashboardView.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class UserDashboardViewList(XOSListCreateAPIView):
- queryset = UserDashboardView.objects.select_related().all()
- serializer_class = UserDashboardViewSerializer
- id_serializer_class = UserDashboardViewIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','dashboardView','order',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return UserDashboardView.select_by_user(self.request.user)
-
-
-class UserDashboardViewDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = UserDashboardView.objects.select_related().all()
- serializer_class = UserDashboardViewSerializer
- id_serializer_class = UserDashboardViewIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return UserDashboardView.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerList(XOSListCreateAPIView):
- queryset = Controller.objects.select_related().all()
- serializer_class = ControllerSerializer
- id_serializer_class = ControllerIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','backend_type','version','auth_url','admin_user','admin_password','admin_tenant','domain','rabbit_host','rabbit_user','rabbit_password','deployment','dashboardviews',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Controller.select_by_user(self.request.user)
-
-
-class ControllerDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Controller.objects.select_related().all()
- serializer_class = ControllerSerializer
- id_serializer_class = ControllerIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Controller.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class SliceList(XOSListCreateAPIView):
- queryset = Slice.objects.select_related().all()
- serializer_class = SliceSerializer
- id_serializer_class = SliceIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','enabled','description','slice_url','max_instances','network','exposed_ports','mount_data_sets','default_isolation','site','service','creator','default_flavor','default_image','default_node','networks','networks',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Slice.select_by_user(self.request.user)
-
-
-class SliceDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Slice.objects.select_related().all()
- serializer_class = SliceSerializer
- id_serializer_class = SliceIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Slice.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class UserList(XOSListCreateAPIView):
- queryset = User.objects.select_related().all()
- serializer_class = UserSerializer
- id_serializer_class = UserIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','is_registering','is_appuser','login_page','created','updated','enacted','policed','backend_status','backend_need_delete','backend_need_reap','deleted','write_protect','lazy_blocked','no_sync','no_policy','timezone','policy_status',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return User.select_by_user(self.request.user)
-
-
-class UserDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = User.objects.select_related().all()
- serializer_class = UserSerializer
- id_serializer_class = UserIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return User.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class DeploymentList(XOSListCreateAPIView):
- queryset = Deployment.objects.select_related().all()
- serializer_class = DeploymentSerializer
- id_serializer_class = DeploymentIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','accessControl','sites','dashboardviews',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Deployment.select_by_user(self.request.user)
-
-
-class DeploymentDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Deployment.objects.select_related().all()
- serializer_class = DeploymentSerializer
- id_serializer_class = DeploymentIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Deployment.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class SitePrivilegeList(XOSListCreateAPIView):
- queryset = SitePrivilege.objects.select_related().all()
- serializer_class = SitePrivilegeSerializer
- id_serializer_class = SitePrivilegeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','site','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SitePrivilege.select_by_user(self.request.user)
-
-
-class SitePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = SitePrivilege.objects.select_related().all()
- serializer_class = SitePrivilegeSerializer
- id_serializer_class = SitePrivilegeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SitePrivilege.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class SiteRoleList(XOSListCreateAPIView):
- queryset = SiteRole.objects.select_related().all()
- serializer_class = SiteRoleSerializer
- id_serializer_class = SiteRoleIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SiteRole.select_by_user(self.request.user)
-
-
-class SiteRoleDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = SiteRole.objects.select_related().all()
- serializer_class = SiteRoleSerializer
- id_serializer_class = SiteRoleIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SiteRole.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class XOSList(XOSListCreateAPIView):
- queryset = XOS.objects.select_related().all()
- serializer_class = XOSSerializer
- id_serializer_class = XOSIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return XOS.select_by_user(self.request.user)
-
-
-class XOSDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = XOS.objects.select_related().all()
- serializer_class = XOSSerializer
- id_serializer_class = XOSIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return XOS.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class NetworkSliceList(XOSListCreateAPIView):
- queryset = NetworkSlice.objects.select_related().all()
- serializer_class = NetworkSliceSerializer
- id_serializer_class = NetworkSliceIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','network','slice',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NetworkSlice.select_by_user(self.request.user)
-
-
-class NetworkSliceDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = NetworkSlice.objects.select_related().all()
- serializer_class = NetworkSliceSerializer
- id_serializer_class = NetworkSliceIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NetworkSlice.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceList(XOSListCreateAPIView):
- queryset = Service.objects.select_related().all()
- serializer_class = ServiceSerializer
- id_serializer_class = ServiceIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','private_key_fn','service_specific_id','service_specific_attribute',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Service.select_by_user(self.request.user)
-
-
-class ServiceDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Service.objects.select_related().all()
- serializer_class = ServiceSerializer
- id_serializer_class = ServiceIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Service.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ControllerSlicePrivilegeList(XOSListCreateAPIView):
- queryset = ControllerSlicePrivilege.objects.select_related().all()
- serializer_class = ControllerSlicePrivilegeSerializer
- id_serializer_class = ControllerSlicePrivilegeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role_id','controller','slice_privilege',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerSlicePrivilege.select_by_user(self.request.user)
-
-
-class ControllerSlicePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ControllerSlicePrivilege.objects.select_related().all()
- serializer_class = ControllerSlicePrivilegeSerializer
- id_serializer_class = ControllerSlicePrivilegeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ControllerSlicePrivilege.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceInstanceAttributeList(XOSListCreateAPIView):
- queryset = ServiceInstanceAttribute.objects.select_related().all()
- serializer_class = ServiceInstanceAttributeSerializer
- id_serializer_class = ServiceInstanceAttributeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','service_instance',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceInstanceAttribute.select_by_user(self.request.user)
-
-
-class ServiceInstanceAttributeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServiceInstanceAttribute.objects.select_related().all()
- serializer_class = ServiceInstanceAttributeSerializer
- id_serializer_class = ServiceInstanceAttributeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceInstanceAttribute.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class DeploymentPrivilegeList(XOSListCreateAPIView):
- queryset = DeploymentPrivilege.objects.select_related().all()
- serializer_class = DeploymentPrivilegeSerializer
- id_serializer_class = DeploymentPrivilegeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','deployment','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return DeploymentPrivilege.select_by_user(self.request.user)
-
-
-class DeploymentPrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = DeploymentPrivilege.objects.select_related().all()
- serializer_class = DeploymentPrivilegeSerializer
- id_serializer_class = DeploymentPrivilegeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return DeploymentPrivilege.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class NetworkParameterTypeList(XOSListCreateAPIView):
- queryset = NetworkParameterType.objects.select_related().all()
- serializer_class = NetworkParameterTypeSerializer
- id_serializer_class = NetworkParameterTypeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NetworkParameterType.select_by_user(self.request.user)
-
-
-class NetworkParameterTypeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = NetworkParameterType.objects.select_related().all()
- serializer_class = NetworkParameterTypeSerializer
- id_serializer_class = NetworkParameterTypeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NetworkParameterType.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class SiteDeploymentList(XOSListCreateAPIView):
- queryset = SiteDeployment.objects.select_related().all()
- serializer_class = SiteDeploymentSerializer
- id_serializer_class = SiteDeploymentIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','availability_zone','site','deployment','controller',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SiteDeployment.select_by_user(self.request.user)
-
-
-class SiteDeploymentDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = SiteDeployment.objects.select_related().all()
- serializer_class = SiteDeploymentSerializer
- id_serializer_class = SiteDeploymentIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return SiteDeployment.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class TenantWithContainerList(XOSListCreateAPIView):
- queryset = TenantWithContainer.objects.select_related().all()
- serializer_class = TenantWithContainerSerializer
- id_serializer_class = TenantWithContainerIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','service_specific_id','service_specific_attribute','owner','external_hostname','external_container','instance','creator',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return TenantWithContainer.select_by_user(self.request.user)
-
-
-class TenantWithContainerDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = TenantWithContainer.objects.select_related().all()
- serializer_class = TenantWithContainerSerializer
- id_serializer_class = TenantWithContainerIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return TenantWithContainer.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class DeploymentRoleList(XOSListCreateAPIView):
- queryset = DeploymentRole.objects.select_related().all()
- serializer_class = DeploymentRoleSerializer
- id_serializer_class = DeploymentRoleIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return DeploymentRole.select_by_user(self.request.user)
-
-
-class DeploymentRoleDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = DeploymentRole.objects.select_related().all()
- serializer_class = DeploymentRoleSerializer
- id_serializer_class = DeploymentRoleIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return DeploymentRole.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class TagList(XOSListCreateAPIView):
- queryset = Tag.objects.select_related().all()
- serializer_class = TagSerializer
- id_serializer_class = TagIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','value','content_type','object_id','service',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Tag.select_by_user(self.request.user)
-
-
-class TagDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Tag.objects.select_related().all()
- serializer_class = TagSerializer
- id_serializer_class = TagIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Tag.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class InterfaceTypeList(XOSListCreateAPIView):
- queryset = InterfaceType.objects.select_related().all()
- serializer_class = InterfaceTypeSerializer
- id_serializer_class = InterfaceTypeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','direction',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return InterfaceType.select_by_user(self.request.user)
-
-
-class InterfaceTypeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = InterfaceType.objects.select_related().all()
- serializer_class = InterfaceTypeSerializer
- id_serializer_class = InterfaceTypeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return InterfaceType.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class NetworkTemplateList(XOSListCreateAPIView):
- queryset = NetworkTemplate.objects.select_related().all()
- serializer_class = NetworkTemplateSerializer
- id_serializer_class = NetworkTemplateIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','description','visibility','translation','access','shared_network_name','shared_network_id','topology_kind','controller_kind','vtn_kind',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NetworkTemplate.select_by_user(self.request.user)
-
-
-class NetworkTemplateDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = NetworkTemplate.objects.select_related().all()
- serializer_class = NetworkTemplateSerializer
- id_serializer_class = NetworkTemplateIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return NetworkTemplate.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServicePrivilegeList(XOSListCreateAPIView):
- queryset = ServicePrivilege.objects.select_related().all()
- serializer_class = ServicePrivilegeSerializer
- id_serializer_class = ServicePrivilegeIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','user','service','role',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServicePrivilege.select_by_user(self.request.user)
-
-
-class ServicePrivilegeDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServicePrivilege.objects.select_related().all()
- serializer_class = ServicePrivilegeSerializer
- id_serializer_class = ServicePrivilegeIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServicePrivilege.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceInstanceList(XOSListCreateAPIView):
- queryset = ServiceInstance.objects.select_related().all()
- serializer_class = ServiceInstanceSerializer
- id_serializer_class = ServiceInstanceIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_need_delete','backend_need_reap','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','policy_status','name','service_specific_id','service_specific_attribute','owner',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceInstance.select_by_user(self.request.user)
-
-
-class ServiceInstanceDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = ServiceInstance.objects.select_related().all()
- serializer_class = ServiceInstanceSerializer
- id_serializer_class = ServiceInstanceIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"query_params"):
- 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):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return ServiceInstance.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-