Delete watchers and other unused code

Change-Id: Ie4a365ace7c77499bcede7e3d232d9a3816e42ab
diff --git a/VERSION b/VERSION
index 7d2ed7c..cd57a8b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.4
+2.1.5
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index f7ba11b..09db322 100644
--- a/containers/chameleon/Dockerfile.chameleon
+++ b/containers/chameleon/Dockerfile.chameleon
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/chameleon
-FROM xosproject/xos-base:2.1.4
+FROM xosproject/xos-base:2.1.5
 
 # xos-base already has protoc and dependencies installed
 
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index 9aa9f1b..27c5d21 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-client
-FROM xosproject/xos-libraries:2.1.4
+FROM xosproject/xos-libraries:2.1.5
 
 # Install XOS client
 COPY xos/xos_client /tmp/xos_client
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index dfe651b..ff99c9a 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM xosproject/xos-base:2.1.4
+FROM xosproject/xos-base:2.1.5
 
 # Add libraries
 COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index fad65c4..fc3d417 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-synchronizer-base
-FROM xosproject/xos-client:2.1.4
+FROM xosproject/xos-client:2.1.5
 
 COPY xos/synchronizers/new_base /opt/xos/synchronizers/new_base
 COPY xos/xos/logger.py /opt/xos/xos/logger.py
diff --git a/containers/xos/Dockerfile.xos-core b/containers/xos/Dockerfile.xos-core
index 2d6909d..c7df46a 100644
--- a/containers/xos/Dockerfile.xos-core
+++ b/containers/xos/Dockerfile.xos-core
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-core
-FROM xosproject/xos-libraries:2.1.4
+FROM xosproject/xos-libraries:2.1.5
 
 # Install XOS
 ADD xos /opt/xos
diff --git a/lib/xos-config/xosconfig/default.py b/lib/xos-config/xosconfig/default.py
index 2c4e6d9..2c73b26 100644
--- a/lib/xos-config/xosconfig/default.py
+++ b/lib/xos-config/xosconfig/default.py
@@ -47,7 +47,6 @@
         'kind': 'grpcapi',
     },
     'keep_temp_files': False,
-    'enable_watchers': False,
     'dependency_graph': None,
     'error_map_path': '/opt/xos/error_map.txt',
     'feefie': {
diff --git a/lib/xos-config/xosconfig/synchronizer-config-schema.yaml b/lib/xos-config/xosconfig/synchronizer-config-schema.yaml
index a9ae095..532ca3c 100644
--- a/lib/xos-config/xosconfig/synchronizer-config-schema.yaml
+++ b/lib/xos-config/xosconfig/synchronizer-config-schema.yaml
@@ -105,8 +105,6 @@
         type: str
       user:
         type: str
-  enable_watchers:
-    type: bool
   model_policies_dir:
     type: str
   error_map_path:
diff --git a/xos/synchronizers/new_base/SyncInstanceUsingAnsible.py b/xos/synchronizers/new_base/SyncInstanceUsingAnsible.py
index 5690b93..2120e0e 100644
--- a/xos/synchronizers/new_base/SyncInstanceUsingAnsible.py
+++ b/xos/synchronizers/new_base/SyncInstanceUsingAnsible.py
@@ -293,92 +293,3 @@
         if hasattr(self, "map_delete_outputs"):
             self.map_delete_outputs(o, res)
 
-    # In order to enable the XOS watcher functionality for a synchronizer, define the 'watches' attribute
-    # in the derived class: eg. watches = [ModelLink(ServiceDependency,via='servicedependency')]
-    # This base class implements the notification handler for handling ServiceDependency model notifications
-    # If a synchronizer need to watch on multiple objects, the additional handlers need to be implemented
-    # in the derived class and override the below handle_watched_object() method to route the notifications
-    # accordingly
-    def handle_watched_object(self, o):
-        log.info("handle_watched_object is invoked for object",object = str(o), **o.tologdict())
-        if (model_accessor.is_type(o, "ServiceDependency")):
-            self.handle_service_composition_watch_notification(o)
-        elif (model_accessor.is_type(o, "ServiceMonitoringAgentInfo")):
-            self.handle_service_monitoringagentinfo_watch_notification(o)
-        pass
-
-    def handle_service_composition_watch_notification(self, coarse_tenant):
-        cls_obj = self.observes
-        if (type(cls_obj) is list):
-            cls_obj = cls_obj[0]
-        log.info("handle_watched_object observed model", model = cls_obj)
-
-        objs = cls_obj.objects.filter(kind=cls_obj.KIND)
-
-        for obj in objs:
-            self.handle_service_composition_for_object(obj, coarse_tenant)
-
-    def handle_service_monitoringagentinfo_watch_notification(self, monitoring_agent_info):
-        pass
-
-    def handle_service_composition_for_object(self, obj, coarse_tenant):
-        try:
-            instance = self.get_instance(obj)
-            valid_instance = True
-        except:
-            valid_instance = False
-
-        if not valid_instance:
-            log.warn("handle_watched_object: No valid instance found for object", object =str(obj))
-            return
-
-        provider_service = coarse_tenant.provider_service
-        subscriber_service = coarse_tenant.subscriber_service
-
-        if model_accessor.is_instance(obj, "Service"):
-            if obj.id == provider_service.id:
-                matched_service = provider_service
-                other_service = subscriber_service
-            elif obj.id == subscriber_service.id:
-                matched_service = subscriber_service
-                other_service = provider_service
-            else:
-                log.info("handle_watched_object: Service object does not match with any of composed services", 
-                object = str(obj))
-                return
-        elif model_accessor.is_instance(obj, "Tenant"):
-            if obj.provider_service.id == provider_service.id:
-                matched_service = provider_service
-                other_service = subscriber_service
-            elif obj.provider_service.id == subscriber_service.id:
-                matched_service = subscriber_service
-                other_service = provider_service
-            else:
-                log.info(
-                    "handle_watched_object: Tenant object does not match with any of composed services", object = str(obj))
-                return
-        else:
-            log.warn("handle_watched_object: Model object is of neither Service nor Tenant type", object = str(obj))
-
-        src_networks = matched_service.get_composable_networks()
-        target_networks = other_service.get_composable_networks()
-        if src_networks and target_networks:
-            src_network = src_networks[0]  # Only one composable network should present per service
-            target_network = target_networks[0]
-            src_ip = instance.get_network_ip(src_network.name)
-            target_subnet = target_network.controllernetworks.all()[0].subnet
-
-            # Run ansible playbook to update the routing table entries in the instance
-            fields = self.get_ansible_fields(instance)
-            fields["ansible_tag"] = getattr(obj, "ansible_tag",
-                                            obj.__class__.__name__ + "_" + str(obj.id)) + "_service_composition"
-            fields["src_intf_ip"] = src_ip
-            fields["target_subnet"] = target_subnet
-            # Template file is available under .../synchronizers/shared_templates
-            service_composition_template_name = "sync_service_composition.yaml"
-            log.info(
-                "handle_watched_object: Updating routing tables in the instance associated with object. target_subnet:%s src_ip:%s",
-                object = str(obj), subnet = target_subnet, ip = src_ip)
-            SyncInstanceUsingAnsible.run_playbook(self, obj, fields, service_composition_template_name)
-        else:
-            log.info("handle_watched_object: No intersection of composable networks between composed services", object = str(coarse_tenant))
diff --git a/xos/synchronizers/new_base/backend.py b/xos/synchronizers/new_base/backend.py
index dd312fb..1d8df0f 100644
--- a/xos/synchronizers/new_base/backend.py
+++ b/xos/synchronizers/new_base/backend.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 import os
 import inspect
 import imp
@@ -32,11 +30,6 @@
 
 log = create_logger(Config().get('logging'))
 
-watchers_enabled = Config.get("enable_watchers")
-
-if (watchers_enabled):
-    from synchronizers.new_base.watchers import XOSWatcher
-
 
 class Backend:
 
@@ -82,7 +75,6 @@
 
     def run(self):
         observer_thread = None
-        watcher_thread = None
         model_policy_thread = None
         event_engine = None
 
@@ -102,14 +94,8 @@
                 observer_thread = threading.Thread(target=observer.run,name='synchronizer')
                 observer_thread.start()
 
-                # start the watcher thread
-                if (watchers_enabled):
-                    self.log.info("Starting XOSWatcher", sync_steps=sync_steps)
-                    watcher = XOSWatcher(sync_steps)
-                    watcher_thread = threading.Thread(target=watcher.run,name='watcher')
-                    watcher_thread.start()
         else:
-            self.log.info("Skipping observer and watcher threads due to no steps dir.")
+            self.log.info("Skipping observer thread due to no steps dir.")
 
         pull_steps_dir = Config.get("pull_steps_dir")
         if pull_steps_dir:
@@ -140,7 +126,7 @@
         else:
             self.log.info("Skipping model policies thread due to no model_policies dir.")
 
-        if (not observer_thread) and (not watcher_thread) and (not model_policy_thread) and (not event_engine):
+        if (not observer_thread) and (not model_policy_thread) and (not event_engine):
             self.log.info("No sync steps, no policies, and no event steps. Synchronizer exiting.")
             # the caller will exit with status 0
             return
@@ -153,8 +139,6 @@
                 # TODO: See about setting the threads as daemons
                 if observer_thread:
                     observer_thread._Thread__stop()
-                if watcher_thread:
-                    watcher_thread._Thread__stop()
                 if model_policy_thread:
                     model_policy_thread._Thread__stop()
                 sys.exit(1)
diff --git a/xos/synchronizers/new_base/backend_modelpolicy.py b/xos/synchronizers/new_base/backend_modelpolicy.py
index 58ef32f..792730c 100644
--- a/xos/synchronizers/new_base/backend_modelpolicy.py
+++ b/xos/synchronizers/new_base/backend_modelpolicy.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 import os
 import inspect
 import imp
@@ -28,11 +26,6 @@
 
 log = create_logger(Config().get('logging'))
 
-watchers_enabled = Config.get("enable_watchers")
-
-# NOTE is this used or can be removed?
-if (watchers_enabled):
-    from synchronizers.new_base.watchers import XOSWatcher
 
 class Backend:
     def run(self):
diff --git a/xos/synchronizers/new_base/watchers.py b/xos/synchronizers/new_base/watchers.py
deleted file mode 100644
index 5794f83..0000000
--- a/xos/synchronizers/new_base/watchers.py
+++ /dev/null
@@ -1,99 +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 os
-import inspect
-import imp
-import time
-import sys
-import traceback
-import commands
-import threading
-import json
-import pprint
-import traceback
-
-from datetime import datetime
-from collections import defaultdict
-
-from syncstep import SyncStep
-from synchronizers.new_base.error_mapper import *
-import redis
-
-from xosconfig import Config
-from multistructlog import create_logger
-
-log = create_logger(Config().get('logging'))
-
-class XOSWatcher:
-    def load_sync_step_modules(self, step_dir=None):
-        if step_dir is None:
-            step_dir = Config.get("steps_dir")
-
-        for fn in os.listdir(step_dir):
-            pathname = os.path.join(step_dir, fn)
-            if os.path.isfile(pathname) and fn.endswith(".py") and (fn != "__init__.py"):
-                module = imp.load_source(fn[:-3], pathname)
-                for classname in dir(module):
-                    c = getattr(module, classname, None)
-
-                    # make sure 'c' is a descendent of SyncStep and has a
-                    # provides field (this eliminates the abstract base classes
-                    # since they don't have a provides)
-
-                    if inspect.isclass(c) and issubclass(c, SyncStep) and hasattr(c, "provides") and (
-                        c not in self.sync_steps):
-                        self.sync_steps.append(c)
-
-    def load_sync_steps(self):
-        for s in self.sync_steps:
-            if hasattr(s, 'watches'):
-                for w in s.watches:
-                    w.source = s
-                    try:
-                        self.watch_map[w.dest.__name__].append(w)
-                    except:
-                        self.watch_map[w.dest.__name__] = [w]
-
-    def __init__(self, sync_steps):
-        self.watch_map = {}
-        self.sync_steps = sync_steps
-        # self.load_sync_step_modules()
-        self.load_sync_steps()
-        r = redis.Redis("redis")
-        channels = self.watch_map.keys()
-        self.redis = r
-        self.pubsub = self.redis.pubsub()
-        self.pubsub.subscribe(channels)
-        log.info("XOS watcher initialized")
-
-    def run(self):
-        for item in self.pubsub.listen():
-            channel = item['channel']
-            try:
-                entry = self.watch_map[channel]
-                data = json.loads(item['data'])
-                pk = data['pk']
-                changed_fields = data['changed_fields']
-                for w in entry:
-                    if w.into in changed_fields or not w.into:
-                        if (hasattr(w.source, 'handle_watched_object')):
-                            o = w.dest.objects.get(pk=data['pk'])
-                            step = w.source()
-                            step.handle_watched_object(o)
-            except Exception as e:
-                log.exception("XOS watcher: exception while processing object", e = e)
-                pass
diff --git a/xos/tools/wait_for_object_creation.py b/xos/tools/wait_for_object_creation.py
deleted file mode 100755
index f98f626..0000000
--- a/xos/tools/wait_for_object_creation.py
+++ /dev/null
@@ -1,51 +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 os
-import sys
-sys.path.append("/opt/xos")
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
-from core.models import *
-from services.hpc.models import *
-from services.volt.models import *
-from services.vsg.models import *
-import time
-django.setup()
-
-def main():
-    printed = False
-
-    if len(sys.argv)!=4:
-        print >> sys.stderr, "syntax: wait_for_object_creation.py <class> <filter_field_name> <filter_field_value>"
-        print >> sys.stderr, "example: wait_for_object_creation.py Image name vsg-1.0"
-        sys.exit(-1)
-
-    cls = globals()[sys.argv[1]]
-
-    while True:
-        objs = cls.objects.filter(**{sys.argv[2]: sys.argv[3]})
-        if objs:
-            print "Object", objs[0], "is ready"
-            return
-        if not printed:
-            print "Waiting for %s with field %s=%s to be created" % (sys.argv[1], sys.argv[2], sys.argv[3])
-            printed=True
-        time.sleep(1)
-
-if __name__ == "__main__":
-   main()
-
diff --git a/xos/xos/hpcapi.py b/xos/xos/hpcapi.py
deleted file mode 100644
index 3e10955..0000000
--- a/xos/xos/hpcapi.py
+++ /dev/null
@@ -1,873 +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 services.hpc.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_hpc_REST_patterns():
-    return patterns('',
-        url(r'^hpcapi/$', hpc_api_root_legacy),
-    # legacy - deprecated
-    
-        url(r'hpcapi/hpchealthchecks/$', HpcHealthCheckList.as_view(), name='hpchealthcheck-list-legacy'),
-        url(r'hpcapi/hpchealthchecks/(?P<pk>[a-zA-Z0-9\-]+)/$', HpcHealthCheckDetail.as_view(), name ='hpchealthcheck-detail-legacy'),
-    
-        url(r'hpcapi/hpcservices/$', HpcServiceList.as_view(), name='hpcservice-list-legacy'),
-        url(r'hpcapi/hpcservices/(?P<pk>[a-zA-Z0-9\-]+)/$', HpcServiceDetail.as_view(), name ='hpcservice-detail-legacy'),
-    
-        url(r'hpcapi/originservers/$', OriginServerList.as_view(), name='originserver-list-legacy'),
-        url(r'hpcapi/originservers/(?P<pk>[a-zA-Z0-9\-]+)/$', OriginServerDetail.as_view(), name ='originserver-detail-legacy'),
-    
-        url(r'hpcapi/cdnprefixs/$', CDNPrefixList.as_view(), name='cdnprefix-list-legacy'),
-        url(r'hpcapi/cdnprefixs/(?P<pk>[a-zA-Z0-9\-]+)/$', CDNPrefixDetail.as_view(), name ='cdnprefix-detail-legacy'),
-    
-        url(r'hpcapi/serviceproviders/$', ServiceProviderList.as_view(), name='serviceprovider-list-legacy'),
-        url(r'hpcapi/serviceproviders/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceProviderDetail.as_view(), name ='serviceprovider-detail-legacy'),
-    
-        url(r'hpcapi/contentproviders/$', ContentProviderList.as_view(), name='contentprovider-list-legacy'),
-        url(r'hpcapi/contentproviders/(?P<pk>[a-zA-Z0-9\-]+)/$', ContentProviderDetail.as_view(), name ='contentprovider-detail-legacy'),
-    
-        url(r'hpcapi/accessmaps/$', AccessMapList.as_view(), name='accessmap-list-legacy'),
-        url(r'hpcapi/accessmaps/(?P<pk>[a-zA-Z0-9\-]+)/$', AccessMapDetail.as_view(), name ='accessmap-detail-legacy'),
-    
-        url(r'hpcapi/sitemaps/$', SiteMapList.as_view(), name='sitemap-list-legacy'),
-        url(r'hpcapi/sitemaps/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteMapDetail.as_view(), name ='sitemap-detail-legacy'),
-    
-    # new api - use these
-        url(r'^api/service/hpc/$', hpc_api_root),
-    
-        url(r'api/service/hpc/hpchealthchecks/$', HpcHealthCheckList.as_view(), name='hpchealthcheck-list'),
-        url(r'api/service/hpc/hpchealthchecks/(?P<pk>[a-zA-Z0-9\-]+)/$', HpcHealthCheckDetail.as_view(), name ='hpchealthcheck-detail'),
-    
-        url(r'api/service/hpc/hpcservices/$', HpcServiceList.as_view(), name='hpcservice-list'),
-        url(r'api/service/hpc/hpcservices/(?P<pk>[a-zA-Z0-9\-]+)/$', HpcServiceDetail.as_view(), name ='hpcservice-detail'),
-    
-        url(r'api/service/hpc/originservers/$', OriginServerList.as_view(), name='originserver-list'),
-        url(r'api/service/hpc/originservers/(?P<pk>[a-zA-Z0-9\-]+)/$', OriginServerDetail.as_view(), name ='originserver-detail'),
-    
-        url(r'api/service/hpc/cdnprefixs/$', CDNPrefixList.as_view(), name='cdnprefix-list'),
-        url(r'api/service/hpc/cdnprefixs/(?P<pk>[a-zA-Z0-9\-]+)/$', CDNPrefixDetail.as_view(), name ='cdnprefix-detail'),
-    
-        url(r'api/service/hpc/serviceproviders/$', ServiceProviderList.as_view(), name='serviceprovider-list'),
-        url(r'api/service/hpc/serviceproviders/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceProviderDetail.as_view(), name ='serviceprovider-detail'),
-    
-        url(r'api/service/hpc/contentproviders/$', ContentProviderList.as_view(), name='contentprovider-list'),
-        url(r'api/service/hpc/contentproviders/(?P<pk>[a-zA-Z0-9\-]+)/$', ContentProviderDetail.as_view(), name ='contentprovider-detail'),
-    
-        url(r'api/service/hpc/accessmaps/$', AccessMapList.as_view(), name='accessmap-list'),
-        url(r'api/service/hpc/accessmaps/(?P<pk>[a-zA-Z0-9\-]+)/$', AccessMapDetail.as_view(), name ='accessmap-detail'),
-    
-        url(r'api/service/hpc/sitemaps/$', SiteMapList.as_view(), name='sitemap-list'),
-        url(r'api/service/hpc/sitemaps/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteMapDetail.as_view(), name ='sitemap-detail'),
-    
-    )
-
-@api_view(['GET'])
-def hpc_api_root_legacy(request, format=None):
-    return Response({
-        'hpchealthchecks': reverse('hpchealthcheck-list-legacy', request=request, format=format),
-        'hpcservices': reverse('hpcservice-list-legacy', request=request, format=format),
-        'originservers': reverse('originserver-list-legacy', request=request, format=format),
-        'cdnprefixs': reverse('cdnprefix-list-legacy', request=request, format=format),
-        'serviceproviders': reverse('serviceprovider-list-legacy', request=request, format=format),
-        'contentproviders': reverse('contentprovider-list-legacy', request=request, format=format),
-        'accessmaps': reverse('accessmap-list-legacy', request=request, format=format),
-        'sitemaps': reverse('sitemap-list-legacy', request=request, format=format),
-        
-    })
-
-@api_view(['GET'])
-def hpc_api_root(request, format=None):
-    return Response({
-        'hpchealthchecks': reverse('hpchealthcheck-list', request=request, format=format),
-        'hpcservices': reverse('hpcservice-list', request=request, format=format),
-        'originservers': reverse('originserver-list', request=request, format=format),
-        'cdnprefixs': reverse('cdnprefix-list', request=request, format=format),
-        'serviceproviders': reverse('serviceprovider-list', request=request, format=format),
-        'contentproviders': reverse('contentprovider-list', request=request, format=format),
-        'accessmaps': reverse('accessmap-list', request=request, format=format),
-        'sitemaps': reverse('sitemap-list', request=request, format=format),
-        
-    })
-
-# Based on serializers.py
-
-class XOSModelSerializer(serializers.ModelSerializer):
-    def save_object(self, obj, **kwargs):
-
-        """ rest_framework can't deal with ManyToMany relations that have a
-            through table. In 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 HpcHealthCheckSerializer(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 = HpcHealthCheck
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','hpcService','kind','resource_name','result_contains','result_min_size','result_max_size',)
-
-class HpcHealthCheckIdSerializer(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 = HpcHealthCheck
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','hpcService','kind','resource_name','result_contains','result_min_size','result_max_size',)
-
-
-
-
-class HpcServiceSerializer(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 = HpcService
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','private_key_fn','service_specific_id','service_specific_attribute','cmi_hostname','hpc_port80','watcher_hpc_network','watcher_dnsdemux_network','watcher_dnsredir_network',)
-
-class HpcServiceIdSerializer(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 = HpcService
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','private_key_fn','service_specific_id','service_specific_attribute','cmi_hostname','hpc_port80','watcher_hpc_network','watcher_dnsdemux_network','watcher_dnsredir_network',)
-
-
-
-
-class OriginServerSerializer(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 = OriginServer
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','origin_server_id','url','contentProvider','authenticated','enabled','protocol','redirects','description',)
-
-class OriginServerIdSerializer(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 = OriginServer
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','origin_server_id','url','contentProvider','authenticated','enabled','protocol','redirects','description',)
-
-
-
-
-class CDNPrefixSerializer(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 = CDNPrefix
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','cdn_prefix_id','prefix','contentProvider','description','defaultOriginServer','enabled',)
-
-class CDNPrefixIdSerializer(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 = CDNPrefix
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','cdn_prefix_id','prefix','contentProvider','description','defaultOriginServer','enabled',)
-
-
-
-
-class ServiceProviderSerializer(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 = ServiceProvider
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','hpcService','service_provider_id','name','description','enabled',)
-
-class ServiceProviderIdSerializer(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 = ServiceProvider
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','hpcService','service_provider_id','name','description','enabled',)
-
-
-
-
-class ContentProviderSerializer(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 = ContentProvider
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','content_provider_id','name','enabled','description','serviceProvider',)
-
-class ContentProviderIdSerializer(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 = ContentProvider
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','content_provider_id','name','enabled','description','serviceProvider',)
-
-
-
-
-class AccessMapSerializer(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 = AccessMap
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','contentProvider','name','description','map',)
-
-class AccessMapIdSerializer(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 = AccessMap
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','contentProvider','name','description','map',)
-
-
-
-
-class SiteMapSerializer(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 = SiteMap
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','contentProvider','serviceProvider','cdnPrefix','hpcService','name','description','map','map_id',)
-
-class SiteMapIdSerializer(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 = SiteMap
-        fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','contentProvider','serviceProvider','cdnPrefix','hpcService','name','description','map','map_id',)
-
-
-
-
-serializerLookUp = {
-
-                 HpcHealthCheck: HpcHealthCheckSerializer,
-
-                 HpcService: HpcServiceSerializer,
-
-                 OriginServer: OriginServerSerializer,
-
-                 CDNPrefix: CDNPrefixSerializer,
-
-                 ServiceProvider: ServiceProviderSerializer,
-
-                 ContentProvider: ContentProviderSerializer,
-
-                 AccessMap: AccessMapSerializer,
-
-                 SiteMap: SiteMapSerializer,
-
-                 None: None,
-                }
-
-# Based on core/views/*.py
-
-
-class HpcHealthCheckList(XOSListCreateAPIView):
-    queryset = HpcHealthCheck.objects.select_related().all()
-    serializer_class = HpcHealthCheckSerializer
-    id_serializer_class = HpcHealthCheckIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','hpcService','kind','resource_name','result_contains','result_min_size','result_max_size',)
-
-    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 HpcHealthCheck.select_by_user(self.request.user)
-
-
-class HpcHealthCheckDetail(XOSRetrieveUpdateDestroyAPIView):
-    queryset = HpcHealthCheck.objects.select_related().all()
-    serializer_class = HpcHealthCheckSerializer
-    id_serializer_class = HpcHealthCheckIdSerializer
-
-    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 HpcHealthCheck.select_by_user(self.request.user)
-
-    # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class HpcServiceList(XOSListCreateAPIView):
-    queryset = HpcService.objects.select_related().all()
-    serializer_class = HpcServiceSerializer
-    id_serializer_class = HpcServiceIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','private_key_fn','service_specific_id','service_specific_attribute','cmi_hostname','hpc_port80','watcher_hpc_network','watcher_dnsdemux_network','watcher_dnsredir_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 HpcService.select_by_user(self.request.user)
-
-
-class HpcServiceDetail(XOSRetrieveUpdateDestroyAPIView):
-    queryset = HpcService.objects.select_related().all()
-    serializer_class = HpcServiceSerializer
-    id_serializer_class = HpcServiceIdSerializer
-
-    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 HpcService.select_by_user(self.request.user)
-
-    # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class OriginServerList(XOSListCreateAPIView):
-    queryset = OriginServer.objects.select_related().all()
-    serializer_class = OriginServerSerializer
-    id_serializer_class = OriginServerIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','origin_server_id','url','contentProvider','authenticated','enabled','protocol','redirects','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 OriginServer.select_by_user(self.request.user)
-
-
-class OriginServerDetail(XOSRetrieveUpdateDestroyAPIView):
-    queryset = OriginServer.objects.select_related().all()
-    serializer_class = OriginServerSerializer
-    id_serializer_class = OriginServerIdSerializer
-
-    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 OriginServer.select_by_user(self.request.user)
-
-    # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class CDNPrefixList(XOSListCreateAPIView):
-    queryset = CDNPrefix.objects.select_related().all()
-    serializer_class = CDNPrefixSerializer
-    id_serializer_class = CDNPrefixIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','cdn_prefix_id','prefix','contentProvider','description','defaultOriginServer','enabled',)
-
-    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 CDNPrefix.select_by_user(self.request.user)
-
-
-class CDNPrefixDetail(XOSRetrieveUpdateDestroyAPIView):
-    queryset = CDNPrefix.objects.select_related().all()
-    serializer_class = CDNPrefixSerializer
-    id_serializer_class = CDNPrefixIdSerializer
-
-    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 CDNPrefix.select_by_user(self.request.user)
-
-    # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ServiceProviderList(XOSListCreateAPIView):
-    queryset = ServiceProvider.objects.select_related().all()
-    serializer_class = ServiceProviderSerializer
-    id_serializer_class = ServiceProviderIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','hpcService','service_provider_id','name','description','enabled',)
-
-    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 ServiceProvider.select_by_user(self.request.user)
-
-
-class ServiceProviderDetail(XOSRetrieveUpdateDestroyAPIView):
-    queryset = ServiceProvider.objects.select_related().all()
-    serializer_class = ServiceProviderSerializer
-    id_serializer_class = ServiceProviderIdSerializer
-
-    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 ServiceProvider.select_by_user(self.request.user)
-
-    # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class ContentProviderList(XOSListCreateAPIView):
-    queryset = ContentProvider.objects.select_related().all()
-    serializer_class = ContentProviderSerializer
-    id_serializer_class = ContentProviderIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','content_provider_id','name','enabled','description','serviceProvider',)
-
-    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 ContentProvider.select_by_user(self.request.user)
-
-
-class ContentProviderDetail(XOSRetrieveUpdateDestroyAPIView):
-    queryset = ContentProvider.objects.select_related().all()
-    serializer_class = ContentProviderSerializer
-    id_serializer_class = ContentProviderIdSerializer
-
-    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 ContentProvider.select_by_user(self.request.user)
-
-    # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class AccessMapList(XOSListCreateAPIView):
-    queryset = AccessMap.objects.select_related().all()
-    serializer_class = AccessMapSerializer
-    id_serializer_class = AccessMapIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','contentProvider','name','description','map',)
-
-    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 AccessMap.select_by_user(self.request.user)
-
-
-class AccessMapDetail(XOSRetrieveUpdateDestroyAPIView):
-    queryset = AccessMap.objects.select_related().all()
-    serializer_class = AccessMapSerializer
-    id_serializer_class = AccessMapIdSerializer
-
-    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 AccessMap.select_by_user(self.request.user)
-
-    # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
-class SiteMapList(XOSListCreateAPIView):
-    queryset = SiteMap.objects.select_related().all()
-    serializer_class = SiteMapSerializer
-    id_serializer_class = SiteMapIdSerializer
-    filter_backends = (filters.DjangoFilterBackend,)
-    filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','no_policy','contentProvider','serviceProvider','cdnPrefix','hpcService','name','description','map','map_id',)
-
-    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 SiteMap.select_by_user(self.request.user)
-
-
-class SiteMapDetail(XOSRetrieveUpdateDestroyAPIView):
-    queryset = SiteMap.objects.select_related().all()
-    serializer_class = SiteMapSerializer
-    id_serializer_class = SiteMapIdSerializer
-
-    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 SiteMap.select_by_user(self.request.user)
-
-    # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
-    # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-