diff --git a/xos/core/xoslib/README b/xos/core/xoslib/README
deleted file mode 100644
index 6d69629..0000000
--- a/xos/core/xoslib/README
+++ /dev/null
@@ -1,7 +0,0 @@
-Add to the following in settings.py
-
-    STATICFILES_DIRS=
-	XOS_DIR + "/core/xoslib/static/",
-
-    TEMPLATE_DIRS=
-        XOS_DIR + "/xoslib/templates",
\ No newline at end of file
diff --git a/xos/core/xoslib/methods/ceilometerview._unused b/xos/core/xoslib/methods/ceilometerview._unused
deleted file mode 100644
index 9c87e40..0000000
--- a/xos/core/xoslib/methods/ceilometerview._unused
+++ /dev/null
@@ -1,1451 +0,0 @@
-import requests
-from six.moves import urllib
-import urllib2
-import pytz
-import datetime
-import time
-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.views import APIView
-from core.models import *
-from services.ceilometer.models import *
-from django.forms import widgets
-from django.utils import datastructures
-from django.utils.translation import ugettext_lazy as _
-from django.utils import timezone
-from django.core.exceptions import PermissionDenied
-from xos.logger import observer_logger as logger
-
-# This REST API endpoint provides information that the ceilometer view needs to display
-
-def getTenantCeilometerProxyURL(user):
-    monitoring_channel = None
-    for obj in MonitoringChannel.get_tenant_objects().all():
-        if (obj.creator.username == user.username):
-            monitoring_channel = obj
-            break
-    if not monitoring_channel:
-        raise XOSMissingField("Monitoring channel is missing for this tenant...Create one and invoke this REST API")
-    #TODO: Wait until URL is completely UP
-    MAX_ATTEMPTS = 5
-    attempts = 0
-    while True:
-        try:
-            response = urllib2.urlopen(monitoring_channel.ceilometer_url)
-            break
-        except urllib2.HTTPError, e:
-            logger.info('HTTP error %(reason)s' % {'reason':e.reason})
-            break
-        except urllib2.URLError, e:
-            attempts += 1
-            if attempts >= MAX_ATTEMPTS:
-                raise XOSServiceUnavailable("Ceilometer channel is not ready yet...Try again later")
-            logger.info('URL error %(reason)s' % {'reason':e.reason})
-            time.sleep(1)
-            pass
-    logger.info("Ceilometer proxy URL for user %(user)s is %(url)s" % {'user':user.username,'url':monitoring_channel.ceilometer_url})
-    return monitoring_channel.ceilometer_url
-
-def getTenantControllerTenantMap(user, slice=None):
-    tenantmap={}
-    if not slice:
-        slices = Slice.objects.filter(creator=user)
-    else:
-        slices = [slice]
-    for s in slices:
-        for cs in s.controllerslices.all():
-            if cs.tenant_id:
-                tenantmap[cs.tenant_id] = {"slice": cs.slice.name}
-                if cs.slice.service:
-                    tenantmap[cs.tenant_id]["service"] = cs.slice.service.name
-                else:
-                    logger.warn("SRIKANTH: Slice %(slice)s is not associated with any service" % {'slice':cs.slice.name})
-                    tenantmap[cs.tenant_id]["service"] = "Other"
-    if not slice:
-        #TEMPORARY WORK AROUND: There are some resource in network like whitebox switches does not belong to a specific tenant.
-        #They are all associated with "default_admin_tenant" tenant
-        tenantmap["default_admin_tenant"] = {"slice": "default_admin_tenant", "service": "Other"}
-    return tenantmap
-
-def build_url(path, q, params=None):
-    """Convert list of dicts and a list of params to query url format.
-
-    This will convert the following:
-        "[{field=this,op=le,value=34},
-          {field=that,op=eq,value=foo,type=string}],
-         ['foo=bar','sna=fu']"
-    to:
-        "?q.field=this&q.field=that&
-          q.op=le&q.op=eq&
-          q.type=&q.type=string&
-          q.value=34&q.value=foo&
-          foo=bar&sna=fu"
-    """
-    if q:
-        query_params = {'q.field': [],
-                        'q.value': [],
-                        'q.op': [],
-                        'q.type': []}
-
-        for query in q:
-            for name in ['field', 'op', 'value', 'type']:
-                query_params['q.%s' % name].append(query.get(name, ''))
-
-        # Transform the dict to a sequence of two-element tuples in fixed
-        # order, then the encoded string will be consistent in Python 2&3.
-        new_qparams = sorted(query_params.items(), key=lambda x: x[0])
-        path += "?" + urllib.parse.urlencode(new_qparams, doseq=True)
-
-        if params:
-            for p in params:
-                path += '&%s' % p
-    elif params:
-        path += '?%s' % params[0]
-        for p in params[1:]:
-            path += '&%s' % p
-    return path
-
-def concat_url(endpoint, url):
-    """Concatenate endpoint and final URL.
-
-    E.g., "http://keystone/v2.0/" and "/tokens" are concatenated to
-    "http://keystone/v2.0/tokens".
-
-    :param endpoint: the base URL
-    :param url: the final URL
-    """
-    return "%s/%s" % (endpoint.rstrip("/"), url.strip("/"))
-
-def resource_list(request, query=None, ceilometer_url=None, ceilometer_usage_object=None):
-    """List the resources."""
-    url = concat_url(ceilometer_url, build_url('/v2/resources', query))
-    try:
-        response = requests.get(url)
-    except requests.exceptions.RequestException as e:
-        raise e
-    return response.json()
-
-def sample_list(request, meter_name, ceilometer_url=None, query=None, limit=None):
-    """List the samples for this meters."""
-    params = ['limit=%s' % limit] if limit else []
-    url = concat_url(ceilometer_url, build_url('/v2/samples', query, params))
-    try:
-        response = requests.get(url)
-    except requests.exceptions.RequestException as e:
-        raise e
-    return response.json()
-
-def meter_list(request, ceilometer_url=None, query=None):
-    """List the user's meters."""
-    url = concat_url(ceilometer_url, build_url('/v2/meters', query))
-    try:
-        response = requests.get(url)
-    except requests.exceptions.RequestException as e:
-        raise e
-    return response.json()
-
-
-def statistic_list(request, meter_name, ceilometer_url=None, query=None, period=None):
-    """List of statistics."""
-    p = ['period=%s' % period] if period else []
-    url = concat_url(ceilometer_url, build_url('/v2/meters/' + meter_name + '/statistics', query, p))
-    try:
-        response = requests.get(url)
-    except requests.exceptions.RequestException as e:
-        raise e
-    return response.json()
-
-def diff_lists(a, b):
-    if not a:
-        return []
-    elif not b:
-        return a
-    else:
-        return list(set(a) - set(b))
-
-def get_resource_map(request, ceilometer_url, query=None):
-    resource_map = {}
-    try:
-        resources = resource_list(request, ceilometer_url=ceilometer_url, query=query)
-        for r in resources:
-            if 'display_name' in r['metadata']:
-                name = r['metadata']['display_name']
-            elif 'name' in r['metadata']:
-                name = r['metadata']['name']
-            else:
-                name = r['resource_id']
-            resource_map[r['resource_id']] = name
-    except requests.exceptions.RequestException as e:
-        raise e
-
-    return resource_map
-
-class Meters(object):
-    """Class for listing of available meters.
-
-    It is listing meters defined in this class that are available
-    in Ceilometer meter_list.
-
-    It is storing information that is not available in Ceilometer, i.e.
-    label, description.
-
-    """
-
-    def __init__(self, request=None, ceilometer_meter_list=None, ceilometer_url=None, query=None, tenant_map=None, resource_map=None):
-        # Storing the request.
-        self._request = request
-        self.ceilometer_url = ceilometer_url
-        self.tenant_map = tenant_map
-        self.resource_map = resource_map
-
-        # Storing the Ceilometer meter list
-        if ceilometer_meter_list:
-            self._ceilometer_meter_list = ceilometer_meter_list
-        else:
-            try:
-                meter_query=[]
-                if query:
-                    meter_query = query
-                self._ceilometer_meter_list = meter_list(request, self.ceilometer_url, meter_query)
-            except requests.exceptions.RequestException as e:
-                self._ceilometer_meter_list = []
-                raise e
-
-        # Storing the meters info categorized by their services.
-        self._nova_meters_info = self._get_nova_meters_info()
-        self._neutron_meters_info = self._get_neutron_meters_info()
-        self._glance_meters_info = self._get_glance_meters_info()
-        self._cinder_meters_info = self._get_cinder_meters_info()
-        self._swift_meters_info = self._get_swift_meters_info()
-        self._kwapi_meters_info = self._get_kwapi_meters_info()
-        self._ipmi_meters_info = self._get_ipmi_meters_info()
-        self._vcpe_meters_info = self._get_vcpe_meters_info()
-        self._volt_meters_info = self._get_volt_meters_info()
-        self._sdn_meters_info = self._get_sdn_meters_info()
-
-        # Storing the meters info of all services together.
-        all_services_meters = (self._nova_meters_info,
-                               self._neutron_meters_info,
-                               self._glance_meters_info,
-                               self._cinder_meters_info,
-                               self._swift_meters_info,
-                               self._kwapi_meters_info,
-                               self._ipmi_meters_info,
-                               self._vcpe_meters_info,
-                               self._volt_meters_info,
-                               self._sdn_meters_info)
-        self._all_meters_info = {}
-        for service_meters in all_services_meters:
-            self._all_meters_info.update(dict([(meter_name, meter_info)
-                                               for meter_name, meter_info
-                                               in service_meters.items()]))
-
-        # Here will be the cached Meter objects, that will be reused for
-        # repeated listing.
-        self._cached_meters = {}
-
-    def list_all(self, only_meters=None, except_meters=None):
-        """Returns a list of meters based on the meters names.
-
-        :Parameters:
-          - `only_meters`: The list of meter names we want to show.
-          - `except_meters`: The list of meter names we don't want to show.
-        """
-
-        return self._list(only_meters=only_meters,
-                          except_meters=except_meters)
-
-    def list_nova(self, except_meters=None):
-        """Returns a list of meters tied to nova.
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show.
-        """
-
-        return self._list(only_meters=self._nova_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_neutron(self, except_meters=None):
-        """Returns a list of meters tied to neutron.
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show.
-        """
-
-        return self._list(only_meters=self._neutron_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_glance(self, except_meters=None):
-        """Returns a list of meters tied to glance.
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show.
-        """
-
-        return self._list(only_meters=self._glance_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_cinder(self, except_meters=None):
-        """Returns a list of meters tied to cinder.
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show.
-        """
-
-        return self._list(only_meters=self._cinder_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_swift(self, except_meters=None):
-        """Returns a list of meters tied to swift.
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show.
-        """
-
-        return self._list(only_meters=self._swift_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_kwapi(self, except_meters=None):
-        """Returns a list of meters tied to kwapi.
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show.
-        """
-
-        return self._list(only_meters=self._kwapi_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_ipmi(self, except_meters=None):
-        """Returns a list of meters tied to ipmi
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show
-        """
-
-        return self._list(only_meters=self._ipmi_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_vcpe(self, except_meters=None):
-        """Returns a list of meters tied to vcpe service
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show
-        """
-
-        return self._list(only_meters=self._vcpe_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_volt(self, except_meters=None):
-        """Returns a list of meters tied to volt service
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show
-        """
-
-        return self._list(only_meters=self._volt_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_sdn(self, except_meters=None):
-        """Returns a list of meters tied to sdn service
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show
-        """
-
-        return self._list(only_meters=self._sdn_meters_info.keys(),
-                          except_meters=except_meters)
-
-    def list_other_services(self, except_meters=None):
-        """Returns a list of meters tied to ipmi
-
-        :Parameters:
-          - `except_meters`: The list of meter names we don't want to show
-        """
-        other_service_meters = [m for m in self._ceilometer_meter_list
-                                if m.name not in self._all_meters_info.keys()]
-        other_service_meters = diff_lists(other_service_meters, except_meters)
-
-        meters = []
-        for meter in other_service_meters:
-            self._cached_meters[meter.name] = meter
-            meters.append(meter)
-        return meters
-
-    def _list(self, only_meters=None, except_meters=None):
-        """Returns a list of meters based on the meters names.
-
-        :Parameters:
-          - `only_meters`: The list of meter names we want to show.
-          - `except_meters`: The list of meter names we don't want to show.
-        """
-
-        # Get all wanted meter names.
-        if only_meters:
-            meter_names = only_meters
-        else:
-            meter_names = [meter_name for meter_name
-                           in self._all_meters_info.keys()]
-
-        meter_names = diff_lists(meter_names, except_meters)
-        # Collect meters for wanted meter names.
-        return self._get_meters(meter_names)
-
-    def _get_meters(self, meter_names):
-        """Obtain meters based on meter_names.
-
-        The meters that do not exist in Ceilometer meter list are left out.
-
-        :Parameters:
-          - `meter_names`: A list of meter names we want to fetch.
-        """
-
-        meters = []
-        for meter_name in meter_names:
-            meter_candidates = self._get_meter(meter_name)
-            if meter_candidates:
-                meters.extend(meter_candidates)
-        return meters
-
-    def _get_meter(self, meter_name):
-        """Obtains a meter.
-
-        Obtains meter either from cache or from Ceilometer meter list
-        joined with statically defined meter info like label and description.
-
-        :Parameters:
-          - `meter_name`: A meter name we want to fetch.
-        """
-        meter_candidates = self._cached_meters.get(meter_name, None)
-        if not meter_candidates:
-            meter_candidates = [m for m in self._ceilometer_meter_list
-                                if m["name"] == meter_name]
-
-            if meter_candidates:
-                meter_info = self._all_meters_info.get(meter_name, None)
-                if meter_info:
-                    label = meter_info["label"]
-                    description = meter_info["description"]
-                    meter_category = meter_info["type"]
-                else:
-                    label = ""
-                    description = ""
-                    meter_category = "Other"
-                for meter in meter_candidates:
-                    meter["label"] = label
-                    meter["description"] = description
-                    meter["category"] = meter_category
-                    if meter["project_id"] in self.tenant_map.keys():
-                        meter["slice"] = self.tenant_map[meter["project_id"]]["slice"]
-                        meter["service"] = self.tenant_map[meter["project_id"]]["service"]
-                    else:
-                        meter["slice"] = meter["project_id"]
-                        meter["service"] = "Other"
-                    if meter["resource_id"] in self.resource_map.keys():
-                        meter["resource_name"] = self.resource_map[meter["resource_id"]]
-
-                self._cached_meters[meter_name] = meter_candidates
-
-        return meter_candidates
-
-    def _get_nova_meters_info(self):
-        """Returns additional info for each meter.
-
-        That will be used for augmenting the Ceilometer meter.
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        meters_info = datastructures.SortedDict([
-            ("instance", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Existence of instance"),
-            }),
-            ("instance:<type>", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Existence of instance <type> "
-                                 "(openstack types)"),
-            }),
-            ("memory", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Volume of RAM"),
-            }),
-            ("memory.usage", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Volume of RAM used"),
-            }),
-            ("cpu", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("CPU time used"),
-            }),
-            ("cpu_util", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average CPU utilization"),
-            }),
-            ("vcpus", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Number of VCPUs"),
-            }),
-            ("disk.read.requests", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Number of read requests"),
-            }),
-            ("disk.write.requests", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Number of write requests"),
-            }),
-            ("disk.read.bytes", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Volume of reads"),
-            }),
-            ("disk.write.bytes", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Volume of writes"),
-            }),
-            ("disk.read.requests.rate", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average rate of read requests"),
-            }),
-            ("disk.write.requests.rate", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average rate of write requests"),
-            }),
-            ("disk.read.bytes.rate", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average rate of reads"),
-            }),
-            ("disk.write.bytes.rate", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average volume of writes"),
-            }),
-            ("disk.root.size", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Size of root disk"),
-            }),
-            ("disk.ephemeral.size", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Size of ephemeral disk"),
-            }),
-            ("network.incoming.bytes", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Number of incoming bytes "
-                                 "on the network for a VM interface"),
-            }),
-            ("network.outgoing.bytes", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Number of outgoing bytes "
-                                 "on the network for a VM interface"),
-            }),
-            ("network.incoming.packets", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Number of incoming "
-                                 "packets for a VM interface"),
-            }),
-            ("network.outgoing.packets", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Number of outgoing "
-                                 "packets for a VM interface"),
-            }),
-            ("network.incoming.bytes.rate", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average rate per sec of incoming "
-                                 "bytes on a VM network interface"),
-            }),
-            ("network.outgoing.bytes.rate", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average rate per sec of outgoing "
-                                 "bytes on a VM network interface"),
-            }),
-            ("network.incoming.packets.rate", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average rate per sec of incoming "
-                                 "packets on a VM network interface"),
-            }),
-            ("network.outgoing.packets.rate", {
-                'type': _("Nova"),
-                'label': '',
-                'description': _("Average rate per sec of outgoing "
-                                 "packets on a VM network interface"),
-            }),
-        ])
-        # Adding flavor based meters into meters_info dict
-        # TODO(lsmola) this kind of meter will be probably deprecated
-        # https://bugs.launchpad.net/ceilometer/+bug/1208365 . Delete it then.
-        #for flavor in get_flavor_names(self._request):
-        #    name = 'instance:%s' % flavor
-        #    meters_info[name] = dict(meters_info["instance:<type>"])
-
-        #    meters_info[name]['description'] = (
-        #        _('Duration of instance type %s (openstack flavor)') %
-        #        flavor)
-
-        # TODO(lsmola) allow to set specific in local_settings. For all meters
-        # because users can have their own agents and meters.
-        return meters_info
-
-    def _get_neutron_meters_info(self):
-        """Returns additional info for each meter.
-
-        That will be used for augmenting the Ceilometer meter.
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('network', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Existence of network"),
-            }),
-            ('network.create', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Creation requests for this network"),
-            }),
-            ('network.update', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Update requests for this network"),
-            }),
-            ('subnet', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Existence of subnet"),
-            }),
-            ('subnet.create', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Creation requests for this subnet"),
-            }),
-            ('subnet.update', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Update requests for this subnet"),
-            }),
-            ('port', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Existence of port"),
-            }),
-            ('port.create', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Creation requests for this port"),
-            }),
-            ('port.update', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Update requests for this port"),
-            }),
-            ('router', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Existence of router"),
-            }),
-            ('router.create', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Creation requests for this router"),
-            }),
-            ('router.update', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Update requests for this router"),
-            }),
-            ('ip.floating', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Existence of floating ip"),
-            }),
-            ('ip.floating.create', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Creation requests for this floating ip"),
-            }),
-            ('ip.floating.update', {
-                'type': _("Neutron"),
-                'label': '',
-                'description': _("Update requests for this floating ip"),
-            }),
-        ])
-
-    def _get_glance_meters_info(self):
-        """Returns additional info for each meter.
-
-        That will be used for augmenting the Ceilometer meter.
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('image', {
-                'type': _("Glance"),
-                'label': '',
-                'description': _("Image existence check"),
-            }),
-            ('image.size', {
-                'type': _("Glance"),
-                'label': '',
-                'description': _("Uploaded image size"),
-            }),
-            ('image.update', {
-                'type': _("Glance"),
-                'label': '',
-                'description': _("Number of image updates"),
-            }),
-            ('image.upload', {
-                'type': _("Glance"),
-                'label': '',
-                'description': _("Number of image uploads"),
-            }),
-            ('image.delete', {
-                'type': _("Glance"),
-                'label': '',
-                'description': _("Number of image deletions"),
-            }),
-            ('image.download', {
-                'type': _("Glance"),
-                'label': '',
-                'description': _("Image is downloaded"),
-            }),
-            ('image.serve', {
-                'type': _("Glance"),
-                'label': '',
-                'description': _("Image is served out"),
-            }),
-        ])
-
-    def _get_cinder_meters_info(self):
-        """Returns additional info for each meter.
-
-        That will be used for augmenting the Ceilometer meter.
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('volume', {
-                'type': _("Cinder"),
-                'label': '',
-                'description': _("Existence of volume"),
-            }),
-            ('volume.size', {
-                'type': _("Cinder"),
-                'label': '',
-                'description': _("Size of volume"),
-            }),
-        ])
-
-    def _get_swift_meters_info(self):
-        """Returns additional info for each meter.
-
-        That will be used for augmenting the Ceilometer meter.
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('storage.objects', {
-                'type': _("Swift"),
-                'label': '',
-                'description': _("Number of objects"),
-            }),
-            ('storage.objects.size', {
-                'type': _("Swift"),
-                'label': '',
-                'description': _("Total size of stored objects"),
-            }),
-            ('storage.objects.containers', {
-                'type': _("Swift"),
-                'label': '',
-                'description': _("Number of containers"),
-            }),
-            ('storage.objects.incoming.bytes', {
-                'type': _("Swift"),
-                'label': '',
-                'description': _("Number of incoming bytes"),
-            }),
-            ('storage.objects.outgoing.bytes', {
-                'type': _("Swift"),
-                'label': '',
-                'description': _("Number of outgoing bytes"),
-            }),
-            ('storage.api.request', {
-                'type': _("Swift"),
-                'label': '',
-                'description': _("Number of API requests against swift"),
-            }),
-        ])
-
-    def _get_kwapi_meters_info(self):
-        """Returns additional info for each meter.
-
-        That will be used for augmenting the Ceilometer meter.
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('energy', {
-                'type': _("Kwapi"),
-                'label': '',
-                'description': _("Amount of energy"),
-            }),
-            ('power', {
-                'type': _("Kwapi"),
-                'label': '',
-                'description': _("Power consumption"),
-            }),
-        ])
-
-    def _get_ipmi_meters_info(self):
-        """Returns additional info for each meter
-
-        That will be used for augmenting the Ceilometer meter
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('hardware.ipmi.node.power', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("System Current Power"),
-            }),
-            ('hardware.ipmi.fan', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("Fan RPM"),
-            }),
-            ('hardware.ipmi.temperature', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("Sensor Temperature Reading"),
-            }),
-            ('hardware.ipmi.current', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("Sensor Current Reading"),
-            }),
-            ('hardware.ipmi.voltage', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("Sensor Voltage Reading"),
-            }),
-            ('hardware.ipmi.node.inlet_temperature', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("System Inlet Temperature Reading"),
-            }),
-            ('hardware.ipmi.node.outlet_temperature', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("System Outlet Temperature Reading"),
-            }),
-            ('hardware.ipmi.node.airflow', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("System Airflow Reading"),
-            }),
-            ('hardware.ipmi.node.cups', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("System CUPS Reading"),
-            }),
-            ('hardware.ipmi.node.cpu_util', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("System CPU Utility Reading"),
-            }),
-            ('hardware.ipmi.node.mem_util', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("System Memory Utility Reading"),
-            }),
-            ('hardware.ipmi.node.io_util', {
-                'type': _("IPMI"),
-                'label': '',
-                'description': _("System IO Utility Reading"),
-            }),
-        ])
-
-    def _get_vcpe_meters_info(self):
-        """Returns additional info for each meter
-
-        That will be used for augmenting the Ceilometer meter
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('vsg', {
-                'type': _("VSG"),
-                'label': '',
-                'description': _("Existence of vsg instance"),
-            }),
-            ('vsg.dns.cache.size', {
-                'type': _("VSG"),
-                'label': '',
-                'description': _("Number of entries in DNS cache"),
-            }),
-            ('vsg.dns.total_instered_entries', {
-                'type': _("VSG"),
-                'label': '',
-                'description': _("Total number of inserted entries into the cache"),
-            }),
-            ('vsg.dns.replaced_unexpired_entries', {
-                'type': _("VSG"),
-                'label': '',
-                'description': _("Unexpired entries that were thrown out of cache"),
-            }),
-            ('vsg.dns.queries_answered_locally', {
-                'type': _("VSG"),
-                'label': '',
-                'description': _("Number of cache hits"),
-            }),
-            ('vsg.dns.queries_forwarded', {
-                'type': _("VSG"),
-                'label': '',
-                'description': _("Number of cache misses"),
-            }),
-            ('vsg.dns.server.queries_sent', {
-                'type': _("VSG"),
-                'label': '',
-                'description': _("For each upstream server, the number of queries sent"),
-            }),
-            ('vsg.dns.server.queries_failed', {
-                'type': _("VSG"),
-                'label': '',
-                'description': _("For each upstream server, the number of queries failed"),
-            }),
-        ])
-
-    def _get_volt_meters_info(self):
-        """Returns additional info for each meter
-
-        That will be used for augmenting the Ceilometer meter
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('volt.device', {
-                'type': _("VOLT"),
-                'label': '',
-                'description': _("Existence of olt device"),
-            }),
-            ('volt.device.disconnect', {
-                'type': _("VOLT"),
-                'label': '',
-                'description': _("Olt device disconnected"),
-            }),
-            ('volt.device.subscriber', {
-                'type': _("VOLT"),
-                'label': '',
-                'description': _("Existence of olt subscriber"),
-            }),
-            ('volt.device.subscriber.unregister', {
-                'type': _("VOLT"),
-                'label': '',
-                'description': _("Olt subscriber unregistered"),
-            }),
-        ])
-
-    def _get_sdn_meters_info(self):
-        """Returns additional info for each meter
-
-        That will be used for augmenting the Ceilometer meter
-        """
-
-        # TODO(lsmola) Unless the Ceilometer will provide the information
-        # below, I need to define it as a static here. I will be joining this
-        # to info that I am able to obtain from Ceilometer meters, hopefully
-        # some day it will be supported all.
-        return datastructures.SortedDict([
-            ('switch', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Existence of switch"),
-            }),
-            ('switch.port', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Existence of port"),
-            }),
-            ('switch.port.receive.packets', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Packets received on port"),
-            }),
-            ('switch.port.transmit.packets', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Packets transmitted on port"),
-            }),
-            ('switch.port.receive.drops', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Drops received on port"),
-            }),
-            ('switch.port.transmit.drops', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Drops transmitted on port"),
-            }),
-            ('switch.port.receive.errors', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Errors received on port"),
-            }),
-            ('switch.port.transmit.errors', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Errors transmitted on port"),
-            }),
-            ('switch.flow', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Duration of flow"),
-            }),
-            ('switch.flow.packets', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Packets received"),
-            }),
-            ('switch.table', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Existence of table"),
-            }),
-            ('switch.table.active.entries', {
-                'type': _("SDN"),
-                'label': '',
-                'description': _("Active entries in table"),
-            }),
-        ])
-
-def make_query(user_id=None, tenant_id=None, resource_id=None,
-               user_ids=None, tenant_ids=None, resource_ids=None):
-    """Returns query built from given parameters.
-
-    This query can be then used for querying resources, meters and
-    statistics.
-
-    :Parameters:
-      - `user_id`: user_id, has a priority over list of ids
-      - `tenant_id`: tenant_id, has a priority over list of ids
-      - `resource_id`: resource_id, has a priority over list of ids
-      - `user_ids`: list of user_ids
-      - `tenant_ids`: list of tenant_ids
-      - `resource_ids`: list of resource_ids
-    """
-    user_ids = user_ids or []
-    tenant_ids = tenant_ids or []
-    resource_ids = resource_ids or []
-
-    query = []
-    if user_id:
-        user_ids = [user_id]
-    for u_id in user_ids:
-        query.append({"field": "user_id", "op": "eq", "value": u_id})
-
-    if tenant_id:
-        tenant_ids = [tenant_id]
-    for t_id in tenant_ids:
-        query.append({"field": "project_id", "op": "eq", "value": t_id})
-
-    if resource_id:
-        resource_ids = [resource_id]
-    for r_id in resource_ids:
-        query.append({"field": "resource_id", "op": "eq", "value": r_id})
-
-    return query
-
-def calc_date_args(date_from, date_to, date_options):
-    # TODO(lsmola) all timestamps should probably work with
-    # current timezone. And also show the current timezone in chart.
-    if date_options == "other":
-        try:
-            if date_from:
-                date_from = pytz.utc.localize(
-                    datetime.datetime.strptime(str(date_from), "%Y-%m-%d"))
-            else:
-                # TODO(lsmola) there should be probably the date
-                # of the first sample as default, so it correctly
-                # counts the time window. Though I need ordering
-                # and limit of samples to obtain that.
-                pass
-            if date_to:
-                date_to = pytz.utc.localize(
-                    datetime.datetime.strptime(str(date_to), "%Y-%m-%d"))
-                # It returns the beginning of the day, I want the end of
-                # the day, so I add one day without a second.
-                date_to = (date_to + datetime.timedelta(days=1) -
-                           datetime.timedelta(seconds=1))
-            else:
-                date_to = timezone.now()
-        except Exception:
-            raise ValueError(_("The dates haven't been recognized"))
-    else:
-        try:
-            date_to = timezone.now()
-            date_from = date_to - datetime.timedelta(days=float(date_options))
-        except Exception as e:
-            raise e
-            #raise ValueError(_("The time delta must be a number representing "
-            #                   "the time span in days"))
-    return date_from, date_to
-
-class MetersList(APIView):
-    method_kind = "list"
-    method_name = "meters"
-
-    def get(self, request, format=None):
-        if (not request.user.is_authenticated()):
-            raise PermissionDenied("You must be authenticated in order to use this API")
-        tenant_ceilometer_url = getTenantCeilometerProxyURL(request.user)
-        if (not tenant_ceilometer_url):
-            raise XOSMissingField("Tenant ceilometer URL is missing")
-
-        tenant_id = request.query_params.get('tenant', None)
-        resource_id = request.query_params.get('resource', None)
-
-        query = []
-        if tenant_id:
-            query.extend(make_query(tenant_id=tenant_id))
-        if resource_id:
-            query.extend(make_query(resource_id=resource_id))
-
-        tenant_map = getTenantControllerTenantMap(request.user)
-        resource_map = get_resource_map(request, ceilometer_url=tenant_ceilometer_url, query=query)
-        meters = Meters(request, ceilometer_url=tenant_ceilometer_url, query=query, tenant_map=tenant_map, resource_map=resource_map)
-        services = {
-            _('Nova'): meters.list_nova(),
-            _('Neutron'): meters.list_neutron(),
-            _('VSG'): meters.list_vcpe(),
-            _('VOLT'): meters.list_volt(),
-            _('SDN'): meters.list_sdn(),
-        }
-        meters = []
-        for service,smeters in services.iteritems():
-             meters.extend(smeters)
-        return Response(meters)
-
-class MeterStatisticsList(APIView):
-    method_kind = "list"
-    method_name = "meterstatistics"
-
-    def get(self, request, format=None):
-        if (not request.user.is_authenticated()):
-            raise PermissionDenied("You must be authenticated in order to use this API")
-        tenant_ceilometer_url = getTenantCeilometerProxyURL(request.user)
-        if (not tenant_ceilometer_url):
-            raise XOSMissingField("Tenant ceilometer URL is missing")
-        tenant_map = getTenantControllerTenantMap(request.user)
-        
-        date_options = request.query_params.get('period', 1)
-        date_from = request.query_params.get('date_from', '')
-        date_to = request.query_params.get('date_to', '')
-
-        try:
-            date_from, date_to = calc_date_args(date_from,
-                                                date_to,
-                                                date_options)
-        except Exception as e:
-           raise e 
-
-        additional_query = []
-        if date_from:
-            additional_query.append({'field': 'timestamp',
-                                     'op': 'ge',
-                                     'value': date_from})
-        if date_to:
-            additional_query.append({'field': 'timestamp',
-                                     'op': 'le',
-                                     'value': date_to})
-
-        meter_name = request.query_params.get('meter', None)
-        tenant_id = request.query_params.get('tenant', None)
-        resource_id = request.query_params.get('resource', None)
-
-        query = []
-        if tenant_id:
-            query.extend(make_query(tenant_id=tenant_id))
-        if resource_id:
-            query.extend(make_query(resource_id=resource_id))
-
-        if meter_name:
-            #Statistics query for one meter
-            if additional_query:
-                query = query + additional_query
-            statistics = statistic_list(request, meter_name,
-                                        ceilometer_url=tenant_ceilometer_url, query=query, period=3600*24)
-            statistic = statistics[-1]
-            row = {"name": 'none',
-                   "meter": meter_name,
-                   "time": statistic["period_end"],
-                   "value": statistic["avg"]}
-            return Response(row)
-
-        #Statistics query for all meter
-        resource_map = get_resource_map(request, ceilometer_url=tenant_ceilometer_url, query=query)
-        meters = Meters(request, ceilometer_url=tenant_ceilometer_url, query=query, tenant_map=tenant_map, resource_map=resource_map)
-        services = {
-            _('Nova'): meters.list_nova(),
-            _('Neutron'): meters.list_neutron(),
-            _('VSG'): meters.list_vcpe(),
-            _('VOLT'): meters.list_volt(),
-            _('SDN'): meters.list_sdn(),
-        }
-        report_rows = []
-        for service,meters in services.items():
-            for meter in meters:
-                query = make_query(tenant_id=meter["project_id"],resource_id=meter["resource_id"])
-                if additional_query:
-                    query = query + additional_query
-                try:
-                    statistics = statistic_list(request, meter["name"],
-                                        ceilometer_url=tenant_ceilometer_url, query=query, period=3600*24)
-                except Exception as e:
-                    logger.error('Exception during statistics query for meter %(meter)s and reason:%(reason)s' % {'meter':meter["name"], 'reason':str(e)})
-                    statistics = None
-
-                if not statistics:
-                    continue
-                statistic = statistics[-1]
-                row = {"name": 'none',
-                       "slice": meter["slice"],
-                       "project_id": meter["project_id"],
-                       "service": meter["service"],
-                       "resource_id": meter["resource_id"],
-                       "resource_name": meter["resource_name"],
-                       "meter": meter["name"],
-                       "description": meter["description"],
-                       "category": service,
-                       "time": statistic["period_end"],
-                       "value": statistic["avg"],
-                       "unit": meter["unit"]}
-                report_rows.append(row)
-
-        return Response(report_rows)
-
-
-class MeterSamplesList(APIView):
-    method_kind = "list"
-    method_name = "metersamples"
-
-    def get(self, request, format=None):
-        if (not request.user.is_authenticated()):
-            raise PermissionDenied("You must be authenticated in order to use this API")
-        tenant_ceilometer_url = getTenantCeilometerProxyURL(request.user)
-        if (not tenant_ceilometer_url):
-            raise XOSMissingField("Tenant ceilometer URL is missing")
-        meter_name = request.query_params.get('meter', None)
-        if not meter_name:
-            raise XOSMissingField("Meter name in query params is missing")
-        limit = request.query_params.get('limit', 10)
-        tenant_id = request.query_params.get('tenant', None)
-        resource_id = request.query_params.get('resource', None)
-        query = []
-        if tenant_id:
-            query.extend(make_query(tenant_id=tenant_id))
-        if resource_id:
-            query.extend(make_query(resource_id=resource_id))
-        query.append({"field": "meter", "op": "eq", "value": meter_name})
-        samples = sample_list(request, meter_name,
-                           ceilometer_url=tenant_ceilometer_url, query=query, limit=limit) 
-        if samples:
-            tenant_map = getTenantControllerTenantMap(request.user)
-            resource_map = get_resource_map(request, ceilometer_url=tenant_ceilometer_url)
-            for sample in samples:
-                 if sample["project_id"] in tenant_map.keys():
-                     sample["slice"] = tenant_map[sample["project_id"]]["slice"]
-                 else:
-                     sample["slice"] = sample["project_id"]
-                 if sample["resource_id"] in resource_map.keys():
-                     sample["resource_name"] = resource_map[sample["resource_id"]]
-                 else:
-                     sample["resource_name"] = sample["resource_id"]
-        return Response(samples)
-
-class XOSSliceServiceList(APIView):
-    method_kind = "list"
-    method_name = "xos-slice-service-mapping"
-
-    def get(self, request, format=None):
-        if (not request.user.is_authenticated()):
-            raise PermissionDenied("You must be authenticated in order to use this API")
-        tenant_map = getTenantControllerTenantMap(request.user)
-        service_map={}
-        for k,v in tenant_map.iteritems():
-            if not (v['service'] in service_map.keys()):
-                service_map[v['service']] = {}
-                service_map[v['service']]['service'] = v['service']
-                service_map[v['service']]['slices'] = []
-            slice_details = {'slice':v['slice'], 'project_id':k}
-            service_map[v['service']]['slices'].append(slice_details)
-        return Response(service_map.values())
-
-class XOSInstanceStatisticsList(APIView):
-    method_kind = "list"
-    method_name = "xos-instance-statistics"
-
-    def get(self, request, format=None):
-        if (not request.user.is_authenticated()):
-            raise PermissionDenied("You must be authenticated in order to use this API")
-        tenant_ceilometer_url = getTenantCeilometerProxyURL(request.user)
-        if (not tenant_ceilometer_url):
-            raise XOSMissingField("Tenant ceilometer URL is missing")
-        instance_uuid = request.query_params.get('instance-uuid', None)
-        if not instance_uuid:
-            raise XOSMissingField("Instance UUID in query params is missing")
-        if not Instance.objects.filter(instance_uuid=instance_uuid):
-            raise XOSMissingField("XOS Instance object is missing for this uuid")
-        xos_instance = Instance.objects.filter(instance_uuid=instance_uuid)[0]
-        tenant_map = getTenantControllerTenantMap(request.user, xos_instance.slice)
-        tenant_id = tenant_map.keys()[0]
-        resource_ids = []
-        resource_ids.append(instance_uuid)
-        for p in xos_instance.ports.all():
-            #neutron port resource id is represented in ceilometer as "nova instance-name"+"-"+"nova instance-id"+"-"+"tap"+first 11 characters of port-id
-            resource_ids.append(xos_instance.instance_id+"-"+instance_uuid+"-tap"+p.port_id[:11])
-        
-        date_options = request.query_params.get('period', 1)
-        date_from = request.query_params.get('date_from', '')
-        date_to = request.query_params.get('date_to', '')
-
-        try:
-            date_from, date_to = calc_date_args(date_from,
-                                                date_to,
-                                                date_options)
-        except Exception as e:
-           raise e 
-
-        additional_query = []
-        if date_from:
-            additional_query.append({'field': 'timestamp',
-                                     'op': 'ge',
-                                     'value': date_from})
-        if date_to:
-            additional_query.append({'field': 'timestamp',
-                                     'op': 'le',
-                                     'value': date_to})
-
-        report_rows = []
-        for resource_id in resource_ids:
-            query = []
-            if tenant_id:
-                query.extend(make_query(tenant_id=tenant_id))
-            if resource_id:
-                query.extend(make_query(resource_id=resource_id))
-
-            #Statistics query for all meter
-            resource_map = get_resource_map(request, ceilometer_url=tenant_ceilometer_url, query=query)
-            meters = Meters(request, ceilometer_url=tenant_ceilometer_url, query=query, tenant_map=tenant_map, resource_map=resource_map)
-            exclude_nova_meters_info = [ "instance", "instance:<type>", "disk.read.requests", "disk.write.requests",
-                "disk.read.bytes", "disk.write.bytes", "disk.read.requests.rate", "disk.write.requests.rate", "disk.read.bytes.rate",
-                "disk.write.bytes.rate", "disk.root.size", "disk.ephemeral.size"]
-            exclude_neutron_meters_info = [ 'network.create', 'network.update', 'subnet.create',
-                'subnet.update', 'port.create', 'port.update', 'router.create', 'router.update',
-                'ip.floating.create', 'ip.floating.update']
-            services = {
-                _('Nova'): meters.list_nova(except_meters=exclude_nova_meters_info),
-                _('Neutron'): meters.list_neutron(except_meters=exclude_neutron_meters_info),
-                _('VSG'): meters.list_vcpe(),
-                _('VOLT'): meters.list_volt(),
-                _('SDN'): meters.list_sdn(),
-            }
-            for service,meters in services.items():
-                for meter in meters:
-                    query = make_query(tenant_id=meter["project_id"],resource_id=meter["resource_id"])
-                    if additional_query:
-                        query = query + additional_query
-                    try:
-                        statistics = statistic_list(request, meter["name"],
-                                            ceilometer_url=tenant_ceilometer_url, query=query, period=3600*24)
-                    except Exception as e:
-                        logger.error('Exception during statistics query for meter %(meter)s and reason:%(reason)s' % {'meter':meter["name"], 'reason':str(e)})
-                        statistics = None
-
-                    if not statistics:
-                        continue
-                    statistic = statistics[-1]
-                    row = {"name": 'none',
-                           "slice": meter["slice"],
-                           "project_id": meter["project_id"],
-                           "service": meter["service"],
-                           "resource_id": meter["resource_id"],
-                           "resource_name": meter["resource_name"],
-                           "meter": meter["name"],
-                           "description": meter["description"],
-                           "category": service,
-                           "time": statistic["period_end"],
-                           "value": statistic["avg"],
-                           "unit": meter["unit"]}
-                    report_rows.append(row)
-
-        return Response(report_rows)
-
-class ServiceAdjustScale(APIView):
-    method_kind = "list"
-    method_name = "serviceadjustscale"
-
-    def get(self, request, format=None):
-        if (not request.user.is_authenticated()) or (not request.user.is_admin):
-            raise PermissionDenied("You must be authenticated admin user in order to use this API")
-        service = request.query_params.get('service', None)
-        slice_hint = request.query_params.get('slice_hint', None)
-        scale = request.query_params.get('scale', None)
-        if not service or not slice_hint or not scale:
-            raise XOSMissingField("Mandatory fields missing")
-        services = Service.select_by_user(request.user)
-        logger.info('SRIKANTH: Services for this user %(services)s' % {'services':services})
-        if not services or (not services.get(name=service)):
-            raise XOSMissingField("Service not found")
-        service = services.get(name=service)
-        service.adjust_scale(slice_hint, int(scale))
-        return Response("Success")
diff --git a/xos/core/xoslib/templates/mustache/detailApp.mustache b/xos/core/xoslib/templates/mustache/detailApp.mustache
deleted file mode 100644
index a178d5a..0000000
--- a/xos/core/xoslib/templates/mustache/detailApp.mustache
+++ /dev/null
@@ -1,8 +0,0 @@
-<h2>
-  <a class="home" href="/">All Instances</a>
-</h2>
-<ul id="instances">
-  <li class="instance"
-      {{>instanceTemplate}}
-  </li>
-</ul>
diff --git a/xos/core/xoslib/templates/mustache/listApp.mustache b/xos/core/xoslib/templates/mustache/listApp.mustache
deleted file mode 100644
index 79721ce..0000000
--- a/xos/core/xoslib/templates/mustache/listApp.mustache
+++ /dev/null
@@ -1,3 +0,0 @@
-<h2>All Instances</h2>
-<ul id="instances">
-</ul>
diff --git a/xos/core/xoslib/templates/mustache/sliverTemplate.mustache b/xos/core/xoslib/templates/mustache/sliverTemplate.mustache
deleted file mode 100644
index 9959a19..0000000
--- a/xos/core/xoslib/templates/mustache/sliverTemplate.mustache
+++ /dev/null
@@ -1 +0,0 @@
-<a class="permalink" href="/{{id}}/">{{ name }}</a>
diff --git a/xos/core/xoslib/templates/xosAdmin.html b/xos/core/xoslib/templates/xosAdmin.html
deleted file mode 100644
index 2ff4954..0000000
--- a/xos/core/xoslib/templates/xosAdmin.html
+++ /dev/null
@@ -1,339 +0,0 @@
-<!-- Error and Success templates -->
-
-<script type="text/template" id="xos-error-response">
-  <h5>Error</h5>
-  <table>
-  <tr><td>error:</td><td><%= error %></td></tr>
-  <tr><td>check:</td><td><%= specific_error %></td></tr>
-  </table>
-  <h5>Details:</h5>
-      <table>
-      <tbody>
-      <% _.each(reasons, function(element, index) { %>
-          <tr><td><%= index %></td><td><%= element %></td></tr>
-      <% }); %>
-      </tbody>
-      </table>
-</script>
-
-<script type="text/template" id="xos-error-rawresponse">
-  <h5>Error</h5>
-  <pre>The server returned:
-"<%= responseText %>"</pre>
-</script>
-
-<script type="text/template" id="xos-error-template">
-  <button id="close-error-box">Close Error Message</button>
-  <h3>An error has occurred.</h3>
-  <table class="test-error-table">
-  <tr><td>Code:</td><td><%= status %></td></tr>
-  <tr><td>Message:</td><td><%= statusText %></td></tr>
-  </table>
-</script>
-
-<script type="text/template" id="xos-success-template">
-  <button id="close-success-box">Close Success Message</button>
-  <h3>Success!</h3>
-  <table class="test-success-table">
-  <tr><td>Code:</td><td><%= status %></td></tr>
-  <tr><td>Message:</td><td><%= statusText %></td></tr>
-  </table>
-</script>
-
-<script type="text/template" id="xos-navbutton-old">
-  <button class="btn btn-default btn-xosnav" onclick="<%= router %>.navigate('<%= routeUrl %>', {trigger: true})"><%= name %></button><br>
-</script>
-
-<script type="text/template" id="xos-status-template">
-  <div class="xos-status xos-<%= statusclass %>"><%= what %>: <%= statusText %> (<%= status %>)</div>
-</script>
-
-<script type="text/template" id="xos-tabs-template">
-  <ul class="xos-nav-list">
-  <% _.each(tabs, function(tab) { %>
-      <li class="xos-nav-item" id="xos-nav-<%= tab["region"] %>"><%= tab["name"] %></li>
-  <% }); %>
-  </ul>
-</script>
-
-<script type="text/template" id="xos-title-list">
-  <h3><img src="/static/img/brokencircle.gif" height=16 width=16 id="xos-list-title-spinner"> <%= title %></h3>
-</script>
-
-<script type="text/template" id="xos-title-detail">
-  <h3><%= title %></h3>
-</script>
-
-<script type="text/template" id="xos-navbutton">
-  <li>
-      <a href="<%= routeUrl %>">
-          <i class="<%= iconClass %>"></i>
-          <%= name %>
-      </a>
-  </li>
-</script>
-
-<script type="text/template" id="xos-inline-detail-buttons-template">
-    <tr>
-       <td colspan=2><button class="btn js-submit btn-xos-detail btn-xos-save-leave">Save</button>
-           <button class="btn js-submit btn-xos-detail btn-xos-save-continue">Save and Continue Editing</button>
-           <button class="btn js-submit btn-xos-detail btn-xos-save-another">Save and Add Another</button>
-           <button class="btn js-submit btn-xos-detail btn-xos-delete">Delete</button>
-       </td>
-    </tr>
-</script>
-
-<script type="text/template" id="xos-backend-status-icon-template">
-    <% if (! ("enacted" in arguments) ) { %>
-        <!-- enacted is undefined; this must be a new object -->
-    <% } else if ((enacted) && (enacted >= updated)) { %>
-        <span style="min-width:16px;"><img src="/static/admin/img/icon_success.gif"></span>
-    <% } else { %>
-        <% if ((backend_status == "Provisioning in progress") || (!backend_status)) { %>
-            <span style="min-width:16px;" title="<%= _.escape(backend_status) %>"><img src="/static/admin/img/icon_clock.gif"></span>
-        <% } else { %>
-            <span style="min-width:16px;" title="<%= _.escape(backend_status) %>"><img src="/static/admin/img/icon_error.gif"></span>
-        <% } %>
-    <% } %>
-</script>
-
-<script type="text/template" id="xos-backend-status-text-template">
-    <%= xosBackendStatusIconTemplate.apply(this,arguments) %>
-    <% if (model.attributes.enacted === undefined) { %>
-        <!-- enacted is undefined; this must be a new object -->
-    <% } else if ((enacted) && (enacted >= updated)) { %>
-        Successfully enacted
-    <% } else { %>
-        <%= _.escape(backend_status) %>
-    <% } %>
-</script>
-
-<script type="text/template" id="xos-list-header-template">
-    <button class="btn js-submit btn-xos-list btn-xos-add">Add</button>
-    <button class="btn js-submit btn-xos-list btn-xos-refresh">Refresh</button>
-</script>
-
-<script type="text/template" id="xos-list-footer-template">
-    <% if (addChildHash) { %>
-        <a href="<%= addChildHash %>">Add...</a>
-    <% } %>
-</script>
-
-<script type="text/template" id="xos-delete-button-template">
-    <a href="#delete<%= firstCharUpper(modelName) %>/<%= id %>">delete</a>
-</script>
-
-<script type="text/template" id="xos-detail-link-template">
-    <a href="#<%= collectionName %>/<%= id %>"><%= text %></a>
-</script>
-
-<script type="text/template" id="xos-add-template">
-  <h3 class="xos-detail-title">Add Object: <%= modelName %></h3>
-  <form>
-  <table>
-  <% args = arguments; %>
-  <% _.each(addFields, function(fieldName) { %>
-     <tr><td><%= fieldNameToHumanReadable(fieldName) %>:</td>
-        <% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : "";  %>
-        <% if (fieldName in foreignFields) { %>
-            <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName", readOnly) %></td>
-        <% } else if (inputType[fieldName] == "checkbox") { %>
-            <td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %><%= readOnly %>></td>
-        <% } else if (fieldName=="backend_status") { %>
-            <td><%= xosBackendStatusTextTemplate.apply(this, args) %></td>
-        <% } else { %>
-            <td><input type="text" name="<%= fieldName %>" value="<%= model.attributes[fieldName] %>"<%= readOnly %>></td>
-        <% } %>
-     </tr>
-  <% }); %>
-  <%= xosInlineDetailButtonsTemplate() %>
-  </table>
-  </form>
-</script>
-
-<script type="text/template" id="xos-detail-template">
-  <h3 class="xos-detail-title">Edit Object: <%= modelName %></h3>
-  <form class="inline-form">
-  <table class="xos-detail-table">
-  <% args = arguments; %>
-  <% _.each(detailFields, function(fieldName) { %>
-     <tr>
-      <td class="xos-label-cell">
-        <label><%= fieldName in fieldDisplayNames ? fieldDisplayNames[fieldName] : fieldNameToHumanReadable(fieldName) %>:</label>
-      </td>
-        <% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : "";  %>
-        <% if (fieldName in choices) { %>
-            <td>
-              <%= choicesToSelect(fieldName, model.attributes[fieldName], choices[fieldName]) %>
-            </td>
-        <% } else if (fieldName in foreignFields) { %>
-            <td>
-              <%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName", readOnly) %>
-            </td>
-        <% } else if (inputType[fieldName] == "spinner") { %>
-            <!-- note: I never finished working on this spinner stuff! -->
-            <td>
-              <%= xosSpinnerTemplate({id: "spinner_" + fieldName, fieldName: fieldName, value: model.attributes[fieldName]}) %>
-            </td>
-        <% } else if (inputType[fieldName] == "checkbox") { %>
-            <td>
-              <input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %><%= readOnly %>>
-            </td>
-        <% } else if (inputType[fieldName] == "picker") { %>
-            <% lookupFunc = makeIdToName(model.m2mFields[fieldName], "humanReadableName"); %>
-            <td>
-              <%= xosPickerTemplate({pickedItems: model.attributes[fieldName], unpickedItems: model.getChoices(fieldName,true), id: "picker_" + fieldName, fieldName: fieldName, detailView: detailView, lookupFunc: lookupFunc}) %>
-            </td>
-        <% } else if (fieldName=="backend_status") { %>
-            <td>
-              <%= xosBackendStatusTextTemplate.apply(this, args) %>
-            </td>
-        <% } else { %>
-            <td>
-              <input class="form-control" type="text" name="<%= fieldName %>" value="<%= escapeForFormField(model.attributes[fieldName]) %>"<%= readOnly %>>
-            </td>
-        <% } %>
-        <td  class="xos-help-cell"><%= helpText[fieldName] %></td>
-     </tr>
-  <% }); %>
-  <%= xosInlineDetailButtonsTemplate() %>
-  </table>
-  </form>
-</script>
-
-<script type="text/template" id="xos-list-template">
-  <h3 class="xos-list-title"><%= title %></h3>
-  <%= xosListHeaderTemplate() %>
-  <table class="test-table">
-  <thead>
-  <tr>
-  <% _.each(listFields, function(fieldName) { %>
-      <th><%= fieldNameToHumanReadable(fieldName) %></th>
-  <% }); %>
-  <th>delete</th>
-  </tr></thead>
-  <tbody></tbody>
-  </table>
-  <%= xosListFooterTemplate({addChildHash: addChildHash}) %>
-</script>
-
-<script type="text/template" id="xos-listitem-template">
-  <% _.each(listFields, function(fieldName) { %>
-      <% if ($.inArray(fieldName, model.detailLinkFields)>=0) { %>
-          <td><%= xosDetailLinkTemplate({collectionName: collectionName, id: id, text: model.attributes[fieldName]}) %></td>
-      <% } else if (fieldName in foreignFields) { %>
-          <td><%= idToName(model.attributes[fieldName], foreignFields[fieldName], "humanReadableName") %></td>
-      <% } else { %>
-      <td><%= model.attributes[fieldName] %></td>
-      <% } %>
-  <% }); %>
-  <td><%= xosDeleteButtonTemplate({modelName: modelName, id: id}) %></td>
-</script>
-
-<script type="text/template" id="xos-savebuttons-template">
-  <div class="box save-box">
-    <button class="btn btn-high btn-info btn-xos-contentButtonPanel btn-xos-save-leave">Save</button>
-    <button class="btn btn-high btn-xos-contentButtonPanel btn-xos-save-continue">Save and continue editing</button>
-    <% if (!disableAdd) { %>
-    <button class="btn btn-high btn-xos-contentButtonPanel btn-xos-save-another">Save and add another</button>
-    <% }; %>
-    <button class="btn btn-danger btn-xos-contentButtonPanel btn-xos-delete">Delete</button>
-  </div>
-</script>
-
-<script type="text/template" id="xos-listbuttons-template">
-  <div class="box save-box">
-    <button class="btn btn-high btn-primary btn-xos-contentButtonPanel btn-xos-refresh">Refresh</button>
-    <% if (!disableAdd) { %>
-    <button class="btn btn-high btn-success btn-xos-contentButtonPanel btn-xos-add">Add</button>
-    <% }; %>
-  </div>
-</script>
-
-<script type="text/template" id="xos-datatable-spinner-template">
-    <!-- arguments: value, id, collectionName, fieldName -->
-    <%= value %> <img style="cursor: pointer;" src="/static/img/plus_circle.png" onclick='<%= app.varName %>.adjustCollectionField("<%= collectionName %>", <%= id %>, "<%= fieldName %>", 1)'>
-                 <img style="cursor: pointer;" src="/static/img/minus_circle.png" onclick='<%= app.varName %>.adjustCollectionField("<%= collectionName %>", <%= id %>, "<%= fieldName %>", -1)'>
-</script>
-
-<script type="text/template" id="xos-datatable-spinner-template-old">
-    <!-- arguments: value, id, collectionName, fieldName -->
-    <%= value %> <a href="javascript:undefined" onclick='<%= app.varName %>.adjustCollectionField("<%= collectionName %>", <%= id %>, "<%= fieldName %>", 1)'> more </a>
-                 <a href="javascript:undefined" onclick='<%= app.varName %>.adjustCollectionField("<%= collectionName %>", <%= id %>, "<%= fieldName %>", -1)'> less </a>
-</script>
-
-<script type="text/template" id="xos-spinner-template">
-    <!-- arguments: fieldName, id, value -->
-    <input name="<%= fieldName %>" class="xos-spinner" id="<%= id %>">
-    <% detailView.viewInitializers.push( function() { init_spinner("#" + id, value); } ); %>
-</script>
-
-<script type="text/template" id="xos-picker-template">
-    <!-- arguments: unpickedItems, pickedItems, fieldName, id -->
-    <div id="<%= id %>">
-    <div class="picker_row">
-    <div class="picker_column">
-    <div>Available</div>
-    <select name="pickerfrom" class="select-picker-from" multiple size="5">
-        <% _.each(unpickedItems, function(item) { %>
-           <option value="<%= item %>"><%= lookupFunc? lookupFunc(item) : item %></option>
-        <% });%>
-    </select>
-    </div>
-    <div class="picker_column">
-    <br>
-    <div class="btn btn-success btn-picker-add">Add &raquo;</div><br><br>
-    <div class="btn btn-success btn-picker-remove">&laquo; Remove</div>
-    </div>
-    <div class="picker_column">
-    <div>Selected</div>
-    <select name=<%= fieldName %> class="select-picker-to syphonall" multiple size="5">
-        <% _.each(pickedItems, function(item) { %>
-           <option value="<%= item %>"><%= lookupFunc ? lookupFunc(item) : item %></option>
-        <% }); %>
-    </select>
-    </div>
-    <div class="picker_column">
-    <br>
-    <div class="btn btn-success btn-picker-up">Up</div><br><br>
-    <div class="btn btn-success btn-picker-down">Down</div>
-    </div>
-    </div>
-    </div>
-    <% detailView.viewInitializers.push( function() { init_picker("#" + id); } ); %>
-</script>
-
-<script type="text/template" id="xos-sliceselector-option">
-   <%= name %>
-</script>
-
-<script type="text/template" id="xos-sliceselector-select">
-    <% if (caption) { %>
-    <table class="xos-detail-table">
-      <tr>
-        <td class="xos-label-cell">
-          <label><%= caption %>:</label>
-        </td>
-        <td>
-          <select class="form-control"></select>
-        </td>
-      </tr>
-    </table>
-    <% } else { %>
-    <select></select>
-    <% } %>
-</script>
-
-<script>
-xosInlineDetailButtonsTemplate = _.template($("#xos-inline-detail-buttons-template").html());
-xosListHeaderTemplate = _.template($("#xos-list-header-template").html());
-xosListFooterTemplate = _.template($("#xos-list-footer-template").html());
-xosDeleteButtonTemplate = _.template($("#xos-delete-button-template").html());
-xosDetailLinkTemplate = _.template($("#xos-detail-link-template").html());
-xosBackendStatusIconTemplate = _.template($("#xos-backend-status-icon-template").html());
-xosBackendStatusTextTemplate = _.template($("#xos-backend-status-text-template").html());
-xosPickerTemplate = _.template($("#xos-picker-template").html());
-xosSpinnerTemplate = _.template($("#xos-spinner-template").html());
-xosDataTableSpinnerTemplate = _.template($("#xos-datatable-spinner-template").html());
-</script>
-
diff --git a/xos/core/xoslib/templates/xosAdminHeader.html b/xos/core/xoslib/templates/xosAdminHeader.html
deleted file mode 100644
index 1fb5638..0000000
--- a/xos/core/xoslib/templates/xosAdminHeader.html
+++ /dev/null
@@ -1,73 +0,0 @@
-{% load admin_static %}{% load suit_tags %}{% load i18n %}
-
-      <a href="{% url 'admin:index' %}"><h1 id="site-name"><img class="logo" height="70" width="259" src="{% static 'open-cloud-login-themed-light.png' %}"/></h1></a>
-      {% block header %}
-        {% if not is_popup %}
-          <!-- Header -->
-          <div id="header" class="header">
-            
-            <div id="branding">
-                  {% block quick-search %}
-                {% with 'SEARCH_URL'|suit_conf as search_url %}
-                  {% if search_url %}
-                    <form class="form-search nav-quick-search" autocomplete="off" action="{% if '/' in search_url %}{{ search_url }}{% else %}{% url search_url %}{% endif %}" method="GET">
-                      <i class="input-icon icon-search"></i>
-                      <input type="text" name="q" class="input-medium search-query" id="quick-search">
-                      <input type="submit" class="submit" value="">
-                    </form>
-                  {% endif %}
-                {% endwith %}
-              {% endblock %}
-            </div>
-          
-            {% block header_time %}
-            <div id="branding2">
-            <!--<div class="header-content header-content-first">
-              <div class="header-column icon">
-                <i class="icon-time"></i>
-              </div>
-              <div class="header-column">
-                <span class="date"> {% suit_date %}</span><br>
-                <span class="time" id="clock">{% suit_time %}</span>
-              </div>
-            </div>-->
-          
-            {% endblock %}
-
-            {% block header_content %}
-              <!--<div class="header-content">
-                <div class="header-column icon">
-                  <i class="icon-comment"></i>
-                </div>
-                <div class="header-column">
-                  <a href="" class="grey"><b>2</b> new messages</a>
-                </div>
-              </div>-->
-            {% endblock %}
-
-            {% if user.is_active and user.is_staff %}
-              <div id="user-tools">
-                {% trans 'Welcome,' %}
-                <a href="http://{{ request.get_host}}/admin/core/user/{{user.id}}">{{user.email}}</a>
-                <span class="user-links">
-                {% block userlinks %}
-                  {% url 'django-admindocs-docroot' as docsroot %}
-                  {% if docsroot %}
-                    <a href="{{ docsroot }}">{% trans 'Documentation' %}</a>
-                   <span class="separator">|</span>
-                  {% endif %}
-                  <a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a>
-                  <span class="separator">|</span>
-                  <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
-                  </span>
-                {% endblock %}
-              </div>
-            {% endif %}
-
-            {% block nav-global %}{% endblock %}
-
-          </div>
-           </div>
-        {% endif %}
-        <!-- END Header -->
-      {% endblock %}
diff --git a/xos/core/xoslib/templates/xosCordSubscriber.html b/xos/core/xoslib/templates/xosCordSubscriber.html
deleted file mode 100644
index db42fb8..0000000
--- a/xos/core/xoslib/templates/xosCordSubscriber.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<script type="text/template" id="xos-cord-subscriber-template">
-  <h3 class="xos-detail-title">CORD Subscriber</h3>
-  <form>
-
-  <div class="cord-subscriber-box">
-  <h3>vOLT</h3>
-  <table class="xos-detail-table cord-subscriber-table">
-  <tr><td class="xos-label-cell">Id:</td><td><%= model.attributes.id %></td></tr>
-  <tr><td class="xos-label-cell">Service Specific Id:</td><td><%= model.attributes.service_specific_id %></td></tr>
-  <tr><td class="xos-label-cell">S-Tag:</td><td><%= model.attributes.s_tag %></td></tr>
-  <tr><td class="xos-label-cell">C-Tag:</td><td><%= model.attributes.c_tag %></td></tr>
-  </table>
-  </div>
-
-  <br>
-
-  <div class="cord-subscriber-box">
-  <h3>vCPE</h3>
-  <table class="xos-detail-table cord-subscriber-table">
-  <tr><td class="xos-label-cell">Id:</td><td><%= model.attributes.vcpe_id %></td></tr>
-  <tr><td class="xos-label-cell">Synced:</td><td><% if (model.attributes.vcpe_synced) { print("Yes"); } else { print("No"); } %></td></tr>
-  <tr><td class="xos-label-cell">Image:</td><td><%= model.attributes.image_name %></td></tr>
-  <tr><td class="xos-label-cell">Instance Id:</td><td><%= model.attributes.instance %></td></tr>
-  <tr><td class="xos-label-cell">Firewall:</td><td><input type="checkbox" name="firewall_enable" <% if (model.attributes.firewall_enable) print("checked"); %>>Enable<br>
-                                                                  <textarea name="firewall_rules" style="width:320px; height:80px"><%= model.attributes.firewall_rules %></textarea></td></tr>
-  <tr><td class="xos-label-cell">URL Filter:</td><td><input type="checkbox" name="url_filter_enable" <% if (model.attributes.url_filter_enable) print("checked"); %>>Enable
-                                                                  <input name="url_filter_level" value="<%= model.attributes.url_filter_level %>"><br>
-                                                                  <textarea name="url_filter_rules" style="width:320px; height:80px"><%= model.attributes.url_filter_rules %></textarea><br>
-                                                                  BBS Account: <%= model.attributes.bbs_account %></td></tr>
-  <tr><td class="xos-label-cell">CDN:</td><td><input type="checkbox" name="cdn_enable" <% if (model.attributes.cdn_enable) print("checked"); %>>Enable</td></tr>
-  <tr><td class="xos-label-cell">Addresses:</td><td><%= model.attributes.wan_ip %> (wan)<br>
-                                                                   <%= model.attributes.lan_ip %> (lan)<br>
-                                                                   <%= model.attributes.nat_ip %> (nat)<br>
-                                                                   <%= model.attributes.private_ip %> (private) </td></tr>
-  <tr><td class="xos-label-cell">SSH Command:</td><td><%= model.attributes.ssh_command %></td></tr>
-  </table>
-  </div>
-
-  <br>
-
-  <div class="cord-subscriber-box">
-  <h3>vBNG</h3>
-  <table class="xos-detail-table cord-subscriber-table">
-  <tr><td class="xos-label-cell">Id:</td><td><%= model.attributes.vbng_id %></td></tr>
-  <tr><td class="xos-label-cell">Routeable Subnet:</td><td><%= model.attributes.routeable_subnet %></td></tr>
-  </table>
-  </div>
-
-  <%= xosInlineDetailButtonsTemplate() %>
-  </table>
-  </form>
-</script>
-
-
diff --git a/xos/core/xoslib/templatetags/mustache.py b/xos/core/xoslib/templatetags/mustache.py
deleted file mode 100644
index a3b3b2a..0000000
--- a/xos/core/xoslib/templatetags/mustache.py
+++ /dev/null
@@ -1,51 +0,0 @@
-from django import template
-from django.conf import settings
-import pystache
-import os
-
-register = template.Library()
-
-class View(pystache.View):
-    template_path = settings.TEMPLATE_DIRS[0]
-
-    def __init__(self, template_dir, template_name, context):
-        self.template_path = template_dir
-        self.template_name = template_name
-        return super(View, self).__init__(context=context)
-
-class MustacheNode(template.Node):
-    def __init__(self, template_name, attr=None):
-        for template_dir in settings.TEMPLATE_DIRS:
-            if os.path.exists(os.path.join(template_dir, template_name) + ".mustache"):
-                break
-        else:
-            raise IOError("failed to find %s in %s" % (template_name, str(settings.TEMPLATE_DIRS)))
-
-        self.template_path = template_dir
-        self.template = template_name
-        self.attr = attr
-
-    def render(self, context):
-        mcontext = context[self.attr] if self.attr else {}
-        view = View(self.template_path, self.template, context=mcontext)
-        return view.render()
-
-def do_mustache(parser, token):
-    """
-    Loads a mustache template and render it inline
-    
-    Example::
-    
-    {% mustache "foo/bar" data %}
-    
-    """
-    bits = token.split_contents()
-    if len(bits) not in  [2,3]:
-        raise template.TemplateSyntaxError("%r tag takes two arguments: the location of the template file, and the template context" % bits[0])
-    path = bits[1]
-    path = path[1:-1]
-    attrs = bits[2:]
-    return MustacheNode(path, *attrs)
-
-
-register.tag("mustache", do_mustache)
diff --git a/xos/core/xoslib/templatetags/straight_include.py b/xos/core/xoslib/templatetags/straight_include.py
deleted file mode 100644
index 54710f3..0000000
--- a/xos/core/xoslib/templatetags/straight_include.py
+++ /dev/null
@@ -1,62 +0,0 @@
-"""
-Straight Include template tag by @HenrikJoreteg
-
-Django templates don't give us any way to escape template tags.
-
-So if you ever need to include client side templates for ICanHaz.js (or anything else that
-may confuse django's templating engine) You can is this little snippet.
-
-Just use it as you would a normal {% include %} tag. It just won't process the included text.
-
-It assumes your included templates are in you django templates directory.
-
-Usage:
-
-{% load straight_include %}
-
-{% straight_include "my_icanhaz_templates.html" %}
-
-"""
-
-import os
-from django import template
-from django.conf import settings
-
-
-register = template.Library()
-
-
-class StraightIncludeNode(template.Node):
-    def __init__(self, template_path):
-        for template_dir in settings.TEMPLATE_DIRS:
-            self.filepath = '%s/%s' % (template_dir, template_path)
-            if os.path.exists(self.filepath):
-                break
-        else:
-            raise IOError("cannot find %s in %s" % (template_path, str(TEMPLATE_DIRS)))
-
-    def render(self, context):
-        fp = open(self.filepath, 'r')
-        output = fp.read()
-        fp.close()
-        return output
-
-
-def do_straight_include(parser, token):
-    """
-    Loads a template and includes it without processing it
-    
-    Example::
-    
-    {% straight_include "foo/some_include" %}
-    
-    """
-    bits = token.split_contents()
-    if len(bits) != 2:
-        raise template.TemplateSyntaxError("%r tag takes one argument: the location of the file within the template folder" % bits[0])
-    path = bits[1][1:-1]
-    
-    return StraightIncludeNode(path)
-
-
-register.tag("straight_include", do_straight_include)
diff --git a/xos/core/xoslib/tools/make_defaults.py b/xos/core/xoslib/tools/make_defaults.py
deleted file mode 100644
index caa5467..0000000
--- a/xos/core/xoslib/tools/make_defaults.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import os
-import sys
-XOS_DIR="/opt/xos"
-os.chdir(XOS_DIR)
-sys.path.append(XOS_DIR)
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
-import core.models
-from django.db import models
-django.setup()
-from django.forms.models import model_to_dict
-import inspect
-from django.core import serializers
-import json
-
-print "function xos_get_defaults() {"
-
-for c in dir(core.models):
-    c = getattr(core.models,c)
-    if inspect.isclass(c) and issubclass(c, models.Model):
-        c=c()
-        classname = c.__class__.__name__
-        classname = classname[0].lower() + classname[1:]
-
-        if (classname in ["plCoreBase", ]):
-            continue
-
-        fieldNames = [f.name for f in c._meta.fields]
-
-        fields = json.loads(serializers.serialize("json",[c],fields=fieldNames))[0]["fields"]
-
-        for f in fields.keys():
-            if f in ['created', 'updated', 'enacted']:
-                fields[f] = None
-
-        fields_json = json.dumps(fields)
-
-        print "  this." + classname + " = " + fields_json + ";"
-
-print "};"
-print "xosdefaults = new xos_get_defaults();"
-
diff --git a/xos/core/xoslib/tools/make_validators.py b/xos/core/xoslib/tools/make_validators.py
deleted file mode 100644
index 69bfee3..0000000
--- a/xos/core/xoslib/tools/make_validators.py
+++ /dev/null
@@ -1,36 +0,0 @@
-import os
-import sys
-XOS_DIR="/opt/xos"
-os.chdir(XOS_DIR)
-sys.path.append(XOS_DIR)
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
-import core.models
-from django.db import models
-django.setup()
-from django.forms.models import model_to_dict
-import inspect
-from django.core import serializers
-import json
-
-print "function xos_get_validators() {"
-
-for c in dir(core.models):
-    c = getattr(core.models,c)
-    if inspect.isclass(c) and issubclass(c, models.Model):
-        c=c()
-        classname = c.__class__.__name__
-        classname = classname[0].lower() + classname[1:]
-
-        if (classname in ["plCoreBase", ]):
-            continue
-
-        fields = c.getValidators();
-
-        fields_json = json.dumps(fields)
-
-        print "  this." + classname + " = " + fields_json + ";"
-
-print "};"
-print "xosvalidators = new xos_get_validators();"
-
diff --git a/xos/core/xoslib/up.sh b/xos/core/xoslib/up.sh
deleted file mode 100644
index 206c0d7..0000000
--- a/xos/core/xoslib/up.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-SLICE=princeton_planetstack
-HOST=node54.princeton.vicci.org
-#SLICE=service_vini
-#HOST=bilby.cs.princeton.edu
-rsync -avz --exclude "__history" --exclude "*~" -e ssh . $SLICE@$HOST:/opt/planetstack/core/xoslib/
-
diff --git a/xos/xos/settings.py b/xos/xos/settings.py
index bddeb3b..2bba8a1 100644
--- a/xos/xos/settings.py
+++ b/xos/xos/settings.py
@@ -144,7 +144,7 @@
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
     XOS_DIR + "/templates",
-    XOS_DIR + "/core/xoslib/templates",
+#    XOS_DIR + "/core/xoslib/templates",
 )
 
 INSTALLED_APPS = (
