SEBA-457 Remove files obsoleted by core model cleanup

Change-Id: I1c6fd7277467005e399074b30d759a0bfd5bcc68
diff --git a/VERSION b/VERSION
index bda8fbe..5bc1cc4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.6
+2.2.7
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index ee2ddbe..059ef0a 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.2.6
+FROM xosproject/xos-base:2.2.7
 
 # xos-base already has protoc and dependencies installed
 
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index f7fcd50..b5b3fcd 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.2.6
+FROM xosproject/xos-libraries:2.2.7
 
 # Install XOS client
 COPY lib/xos-api /tmp/xos-api
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index a7ecf03..1c034b5 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-libraries
-FROM xosproject/xos-base:2.2.6
+FROM xosproject/xos-base:2.2.7
 
 # Add libraries
 COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index 64dd9cb..f219574 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.2.6
+FROM xosproject/xos-client:2.2.7
 
 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 c1aa1d0..687ed08 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.2.6
+FROM xosproject/xos-libraries:2.2.7
 
 # Install XOS
 ADD xos /opt/xos
diff --git a/lib/xos-synchronizer/xossynchronizer/model_policies/model_policy_tenantwithcontainer.py b/lib/xos-synchronizer/xossynchronizer/model_policies/model_policy_tenantwithcontainer.py
deleted file mode 100644
index 3db1395..0000000
--- a/lib/xos-synchronizer/xossynchronizer/model_policies/model_policy_tenantwithcontainer.py
+++ /dev/null
@@ -1,318 +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 xossynchronizer.modelaccessor import *
-from xossynchronizer.model_policies.policy import Policy
-from xossynchronizer.exceptions import *
-
-
-class Scheduler(object):
-    # XOS Scheduler Abstract Base Class
-    # Used to implement schedulers that pick which node to put instances on
-
-    def __init__(self, slice, label=None, constrain_by_service_instance=False):
-        self.slice = slice
-        self.label = label  # Only pick nodes with this label
-        # Apply service-instance-based constraints
-        self.constrain_by_service_instance = constrain_by_service_instance
-
-    def pick(self):
-        # this method should return a tuple (node, parent)
-        #    node is the node to instantiate on
-        #    parent is for container_vm instances only, and is the VM that will
-        #      hold the container
-
-        raise Exception("Abstract Base")
-
-
-class LeastLoadedNodeScheduler(Scheduler):
-    # This scheduler always return the node with the fewest number of
-    # instances.
-
-    def pick(self):
-        set_label = False
-
-        nodes = []
-        if self.label:
-            nodes = Node.objects.filter(nodelabels__name=self.label)
-            if not nodes:
-                set_label = self.constrain_by_service_instance
-
-        if not nodes:
-            if self.slice.default_node:
-                # if slice.default_node is set, then filter by default_node
-                nodes = Node.objects.filter(name=self.slice.default_node)
-            else:
-                nodes = Node.objects.all()
-
-        # convert to list
-        nodes = list(nodes)
-
-        # sort so that we pick the least-loaded node
-        nodes = sorted(nodes, key=lambda node: node.instances.count())
-
-        if not nodes:
-            raise Exception("LeastLoadedNodeScheduler: No suitable nodes to pick from")
-
-        picked_node = nodes[0]
-
-        if set_label:
-            nl = NodeLabel(name=self.label)
-            nl.node.add(picked_node)
-            nl.save()
-
-        # TODO: logic to filter nodes by which nodes are up, and which
-        #   nodes the slice can instantiate on.
-        return [picked_node, None]
-
-
-class TenantWithContainerPolicy(Policy):
-    # This policy is abstract. Inherit this class into your own policy and override model_name
-    model_name = None
-
-    def handle_create(self, tenant):
-        return self.handle_update(tenant)
-
-    def handle_update(self, service_instance):
-        if (service_instance.link_deleted_count > 0) and (
-            not service_instance.provided_links.exists()
-        ):
-            model = globals()[self.model_name]
-            self.log.info(
-                "The last provided link has been deleted -- self-destructing."
-            )
-            self.handle_delete(service_instance)
-            if model.objects.filter(id=service_instance.id).exists():
-                service_instance.delete()
-            else:
-                self.log.info("Tenant %s is already deleted" % service_instance)
-            return
-        self.manage_container(service_instance)
-
-    #    def handle_delete(self, tenant):
-    #        if tenant.vcpe:
-    #            tenant.vcpe.delete()
-
-    def save_instance(self, instance):
-        # Override this function to do custom pre-save or post-save processing,
-        # such as creating ports for containers.
-        instance.save()
-
-    def ip_to_mac(self, ip):
-        (a, b, c, d) = ip.split(".")
-        return "02:42:%02x:%02x:%02x:%02x" % (int(a), int(b), int(c), int(d))
-
-    def allocate_public_service_instance(self, **kwargs):
-        """ Get a ServiceInstance that provides public connectivity. Currently this means to use AddressPool and
-            the AddressManager Service.
-
-            Expect this to be refactored when we break hard-coded service dependencies.
-        """
-        address_pool_name = kwargs.pop("address_pool_name")
-
-        am_service = AddressManagerService.objects.all()  # TODO: Hardcoded dependency
-        if not am_service:
-            raise Exception("no addressing services")
-        am_service = am_service[0]
-
-        ap = AddressPool.objects.filter(
-            name=address_pool_name, service_id=am_service.id
-        )
-        if not ap:
-            raise Exception("Addressing service unable to find addresspool %s" % name)
-        ap = ap[0]
-
-        ip = ap.get_address()
-        if not ip:
-            raise Exception("AddressPool '%s' has run out of addresses." % ap.name)
-
-        ap.save()  # save the AddressPool to account for address being removed from it
-
-        subscriber_service = None
-        if "subscriber_service" in kwargs:
-            subscriber_service = kwargs.pop("subscriber_service")
-
-        subscriber_service_instance = None
-        if "subscriber_tenant" in kwargs:
-            subscriber_service_instance = kwargs.pop("subscriber_tenant")
-        elif "subscriber_service_instance" in kwargs:
-            subscriber_service_instance = kwargs.pop("subscriber_service_instance")
-
-        # TODO: potential partial failure -- AddressPool address is allocated and saved before addressing tenant
-
-        t = None
-        try:
-            t = AddressManagerServiceInstance(
-                owner=am_service, **kwargs
-            )  # TODO: Hardcoded dependency
-            t.public_ip = ip
-            t.public_mac = self.ip_to_mac(ip)
-            t.address_pool_id = ap.id
-            t.save()
-
-            if subscriber_service:
-                link = ServiceInstanceLink(
-                    subscriber_service=subscriber_service, provider_service_instance=t
-                )
-                link.save()
-
-            if subscriber_service_instance:
-                link = ServiceInstanceLink(
-                    subscriber_service_instance=subscriber_service_instance,
-                    provider_service_instance=t,
-                )
-                link.save()
-        except BaseException:
-            # cleanup if anything went wrong
-            ap.put_address(ip)
-            ap.save()  # save the AddressPool to account for address being added to it
-            if t and t.id:
-                t.delete()
-            raise
-
-        return t
-
-    def get_image(self, tenant):
-        slice = tenant.owner.slices.all()
-        if not slice:
-            raise SynchronizerProgrammingError("provider service has no slice")
-        slice = slice[0]
-
-        # If slice has default_image set then use it
-        if slice.default_image:
-            return slice.default_image
-
-        raise SynchronizerProgrammingError(
-            "Please set a default image for %s" % self.slice.name
-        )
-
-    """ get_legacy_tenant_attribute
-        pick_least_loaded_instance_in_slice
-        count_of_tenants_of_an_instance
-
-        These three methods seem to be used by A-CORD. Look for ways to consolidate with existing methods and eliminate
-        these legacy ones
-    """
-
-    def get_legacy_tenant_attribute(self, tenant, name, default=None):
-        if tenant.service_specific_attribute:
-            attributes = json.loads(tenant.service_specific_attribute)
-        else:
-            attributes = {}
-        return attributes.get(name, default)
-
-    def pick_least_loaded_instance_in_slice(self, tenant, slices, image):
-        for slice in slices:
-            if slice.instances.all().count() > 0:
-                for instance in slice.instances.all():
-                    if instance.image != image:
-                        continue
-                    # Pick the first instance that has lesser than 5 tenants
-                    if self.count_of_tenants_of_an_instance(tenant, instance) < 5:
-                        return instance
-        return None
-
-    # TODO: Ideally the tenant count for an instance should be maintained using a
-    # many-to-one relationship attribute, however this model being proxy, it does
-    # not permit any new attributes to be defined. Find if any better solutions
-    def count_of_tenants_of_an_instance(self, tenant, instance):
-        tenant_count = 0
-        for tenant in self.__class__.objects.all():
-            if (
-                self.get_legacy_tenant_attribute(tenant, "instance_id", None)
-                == instance.id
-            ):
-                tenant_count += 1
-        return tenant_count
-
-    def manage_container(self, tenant):
-        if tenant.deleted:
-            return
-
-        desired_image = self.get_image(tenant)
-
-        if (tenant.instance is not None) and (
-            tenant.instance.image.id != desired_image.id
-        ):
-            tenant.instance.delete()
-            tenant.instance = None
-
-        if tenant.instance is None:
-            if not tenant.owner.slices.count():
-                raise SynchronizerConfigurationError("The service has no slices")
-
-            new_instance_created = False
-            instance = None
-            if self.get_legacy_tenant_attribute(
-                tenant, "use_same_instance_for_multiple_tenants", default=False
-            ):
-                # Find if any existing instances can be used for this tenant
-                slices = tenant.owner.slices.all()
-                instance = self.pick_least_loaded_instance_in_slice(
-                    tenant, slices, desired_image
-                )
-
-            if not instance:
-                slice = tenant.owner.slices.first()
-
-                flavor = slice.default_flavor
-                if not flavor:
-                    flavors = Flavor.objects.filter(name="m1.small")
-                    if not flavors:
-                        raise SynchronizerConfigurationError("No m1.small flavor")
-                    flavor = flavors[0]
-
-                if slice.default_isolation == "container_vm":
-                    raise Exception("Not implemented")
-                else:
-                    scheduler = getattr(self, "scheduler", LeastLoadedNodeScheduler)
-                    constrain_by_service_instance = getattr(
-                        self, "constrain_by_service_instance", False
-                    )
-                    tenant_node_label = getattr(tenant, "node_label", None)
-                    (node, parent) = scheduler(
-                        slice,
-                        label=tenant_node_label,
-                        constrain_by_service_instance=constrain_by_service_instance,
-                    ).pick()
-
-                assert slice is not None
-                assert node is not None
-                assert desired_image is not None
-                assert tenant.creator is not None
-                assert flavor is not None
-
-                try:
-                    instance = Instance(
-                        slice=slice,
-                        node=node,
-                        image=desired_image,
-                        creator=tenant.creator,
-                        flavor=flavor,
-                        isolation=slice.default_isolation,
-                        parent=parent,
-                    )
-                    self.save_instance(instance)
-                    new_instance_created = True
-
-                    tenant.instance = instance
-                    tenant.save()
-                except BaseException:
-                    # NOTE: We don't have transactional support, so if the synchronizer crashes and exits after
-                    #       creating the instance, but before adding it to the tenant, then we will leave an
-                    #       orphaned instance.
-                    if new_instance_created:
-                        instance.delete()
-                    raise
diff --git a/lib/xos-synchronizer/xossynchronizer/steps/SyncInstanceUsingAnsible.py b/lib/xos-synchronizer/xossynchronizer/steps/SyncInstanceUsingAnsible.py
deleted file mode 100644
index 1bc54ce..0000000
--- a/lib/xos-synchronizer/xossynchronizer/steps/SyncInstanceUsingAnsible.py
+++ /dev/null
@@ -1,319 +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 hashlib
-import os
-import socket
-import sys
-import base64
-import time
-from xosconfig import Config
-
-from xossynchronizer.steps.syncstep import SyncStep, DeferredException
-from xossynchronizer.ansible_helper import run_template_ssh
-
-
-class SyncInstanceUsingAnsible(SyncStep):
-    # All of the following should be defined for classes derived from this
-    # base class. Examples below use VSGTenant.
-
-    # provides=[VSGTenant]
-    # observes=VSGTenant
-    # requested_interval=0
-    # template_name = "sync_vcpetenant.yaml"
-
-    def __init__(self, **args):
-        SyncStep.__init__(self, **args)
-
-    def skip_ansible_fields(self, o):
-        # Return True if the instance processing and get_ansible_fields stuff
-        # should be skipped. This hook is primarily for the OnosApp
-        # sync step, so it can do its external REST API sync thing.
-        return False
-
-    def defer_sync(self, o, reason):
-        # zdw, 2017-02-18 - is raising the exception here necessary? - seems like
-        # it's just logging the same thing twice
-        self.log.info("defer object", object=str(o), reason=reason, **o.tologdict())
-        raise DeferredException("defer object %s due to %s" % (str(o), reason))
-
-    def get_extra_attributes(self, o):
-        # This is a place to include extra attributes that aren't part of the
-        # object itself.
-
-        return {}
-
-    def get_instance(self, o):
-        # We need to know what instance is associated with the object. Let's
-        # assume 'o' has a field called 'instance'. If the field is called
-        # something else, or if custom logic is needed, then override this
-        # method.
-
-        return o.instance
-
-    def get_external_sync(self, o):
-        hostname = getattr(o, "external_hostname", None)
-        container = getattr(o, "external_container", None)
-        if hostname and container:
-            return (hostname, container)
-        else:
-            return None
-
-    def run_playbook(self, o, fields, template_name=None):
-        if not template_name:
-            template_name = self.template_name
-        tStart = time.time()
-        run_template_ssh(template_name, fields, object=o)
-        self.log.info(
-            "playbook execution time", time=int(time.time() - tStart), **o.tologdict()
-        )
-
-    def pre_sync_hook(self, o, fields):
-        pass
-
-    def post_sync_hook(self, o, fields):
-        pass
-
-    def sync_fields(self, o, fields):
-        self.run_playbook(o, fields)
-
-    def prepare_record(self, o):
-        pass
-
-    def get_node(self, o):
-        return o.node
-
-    def get_node_key(self, node):
-        # NOTE `node_key` is never defined, does it differ from `proxy_ssh_key`? the value looks to be the same
-        return Config.get("node_key")
-
-    def get_key_name(self, instance):
-        if instance.isolation == "vm":
-            if (
-                instance.slice
-                and instance.slice.service
-                and instance.slice.service.private_key_fn
-            ):
-                key_name = instance.slice.service.private_key_fn
-            else:
-                raise Exception("Make sure to set private_key_fn in the service")
-        elif instance.isolation == "container":
-            node = self.get_node(instance)
-            key_name = self.get_node_key(node)
-        else:
-            # container in VM
-            key_name = instance.parent.slice.service.private_key_fn
-
-        return key_name
-
-    def get_ansible_fields(self, instance):
-        # return all of the fields that tell Ansible how to talk to the context
-        # that's setting up the container.
-
-        if instance.isolation == "vm":
-            # legacy where container was configured by sync_vcpetenant.py
-
-            fields = {
-                "instance_name": instance.name,
-                "hostname": instance.node.name,
-                "instance_id": instance.instance_id,
-                "username": "ubuntu",
-                "ssh_ip": instance.get_ssh_ip(),
-            }
-
-        elif instance.isolation == "container":
-            # container on bare metal
-            node = self.get_node(instance)
-            hostname = node.name
-            fields = {
-                "hostname": hostname,
-                "baremetal_ssh": True,
-                "instance_name": "rootcontext",
-                "username": "root",
-                "container_name": "%s-%s" % (instance.slice.name, str(instance.id))
-                # ssh_ip is not used for container-on-metal
-            }
-        else:
-            # container in a VM
-            if not instance.parent:
-                raise Exception("Container-in-VM has no parent")
-            if not instance.parent.instance_id:
-                raise Exception("Container-in-VM parent is not yet instantiated")
-            if not instance.parent.slice.service:
-                raise Exception("Container-in-VM parent has no service")
-            if not instance.parent.slice.service.private_key_fn:
-                raise Exception("Container-in-VM parent service has no private_key_fn")
-            fields = {
-                "hostname": instance.parent.node.name,
-                "instance_name": instance.parent.name,
-                "instance_id": instance.parent.instance_id,
-                "username": "ubuntu",
-                "ssh_ip": instance.parent.get_ssh_ip(),
-                "container_name": "%s-%s" % (instance.slice.name, str(instance.id)),
-            }
-
-        key_name = self.get_key_name(instance)
-        if not os.path.exists(key_name):
-            raise Exception("Node key %s does not exist" % key_name)
-
-        key = file(key_name).read()
-
-        fields["private_key"] = key
-
-        # Now the ceilometer stuff
-        # Only do this if the instance is not being deleted.
-        if not instance.deleted:
-            cslice = ControllerSlice.objects.get(slice_id=instance.slice.id)
-            if not cslice:
-                raise Exception(
-                    "Controller slice object for %s does not exist"
-                    % instance.slice.name
-                )
-
-            cuser = ControllerUser.objects.get(user_id=instance.creator.id)
-            if not cuser:
-                raise Exception(
-                    "Controller user object for %s does not exist" % instance.creator
-                )
-
-            fields.update(
-                {
-                    "keystone_tenant_id": cslice.tenant_id,
-                    "keystone_user_id": cuser.kuser_id,
-                    "rabbit_user": getattr(instance.controller, "rabbit_user", None),
-                    "rabbit_password": getattr(
-                        instance.controller, "rabbit_password", None
-                    ),
-                    "rabbit_host": getattr(instance.controller, "rabbit_host", None),
-                }
-            )
-
-        return fields
-
-    def sync_record(self, o):
-        self.log.info("sync'ing object", object=str(o), **o.tologdict())
-
-        self.prepare_record(o)
-
-        if self.skip_ansible_fields(o):
-            fields = {}
-        else:
-            if self.get_external_sync(o):
-                # sync to some external host
-
-                # UNTESTED
-
-                (hostname, container_name) = self.get_external_sync(o)
-                fields = {
-                    "hostname": hostname,
-                    "baremetal_ssh": True,
-                    "instance_name": "rootcontext",
-                    "username": "root",
-                    "container_name": container_name,
-                }
-                key_name = self.get_node_key(node)
-                if not os.path.exists(key_name):
-                    raise Exception("Node key %s does not exist" % key_name)
-
-                key = file(key_name).read()
-
-                fields["private_key"] = key
-                # TO DO: Ceilometer stuff
-            else:
-                instance = self.get_instance(o)
-                # sync to an XOS instance
-                if not instance:
-                    self.defer_sync(o, "waiting on instance")
-                    return
-
-                if not instance.instance_name:
-                    self.defer_sync(o, "waiting on instance.instance_name")
-                    return
-
-                fields = self.get_ansible_fields(instance)
-
-        fields["ansible_tag"] = getattr(
-            o, "ansible_tag", o.__class__.__name__ + "_" + str(o.id)
-        )
-
-        # If 'o' defines a 'sync_attributes' list, then we'll copy those
-        # attributes into the Ansible recipe's field list automatically.
-        if hasattr(o, "sync_attributes"):
-            for attribute_name in o.sync_attributes:
-                fields[attribute_name] = getattr(o, attribute_name)
-
-        fields.update(self.get_extra_attributes(o))
-
-        self.sync_fields(o, fields)
-
-        o.save()
-
-    def delete_record(self, o):
-        try:
-            # TODO: This may be broken, as get_controller() does not exist in convenience wrapper
-            controller = o.get_controller()
-            controller_register = json.loads(
-                o.node.site_deployment.controller.backend_register
-            )
-
-            if controller_register.get("disabled", False):
-                raise InnocuousException(
-                    "Controller %s is disabled" % o.node.site_deployment.controller.name
-                )
-        except AttributeError:
-            pass
-
-        instance = self.get_instance(o)
-
-        if not instance:
-            # the instance is gone. There's nothing left for us to do.
-            return
-
-        if instance.deleted:
-            # the instance is being deleted. There's nothing left for us to do.
-            return
-
-        if isinstance(instance, basestring):
-            # sync to some external host
-
-            # XXX - this probably needs more work...
-
-            fields = {
-                "hostname": instance,
-                "instance_id": "ubuntu",  # this is the username to log into
-                "private_key": service.key,
-            }
-        else:
-            # sync to an XOS instance
-            fields = self.get_ansible_fields(instance)
-
-            fields["ansible_tag"] = getattr(
-                o, "ansible_tag", o.__class__.__name__ + "_" + str(o.id)
-            )
-
-        # If 'o' defines a 'sync_attributes' list, then we'll copy those
-        # attributes into the Ansible recipe's field list automatically.
-        if hasattr(o, "sync_attributes"):
-            for attribute_name in o.sync_attributes:
-                fields[attribute_name] = getattr(o, attribute_name)
-
-        if hasattr(self, "map_delete_inputs"):
-            fields.update(self.map_delete_inputs(o))
-
-        fields["delete"] = True
-        res = self.run_playbook(o, fields)
-
-        if hasattr(self, "map_delete_outputs"):
-            self.map_delete_outputs(o, res)
diff --git a/xos/core/models/controller.py b/xos/core/models/controller.py
deleted file mode 100644
index 90af736..0000000
--- a/xos/core/models/controller.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from controller_decl import *
-
-
-class Controller(Controller_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/controllerimages.py b/xos/core/models/controllerimages.py
deleted file mode 100644
index 4ae0ce8..0000000
--- a/xos/core/models/controllerimages.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from controllerimages_decl import *
-
-
-class ControllerImages(ControllerImages_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/controllernetwork.py b/xos/core/models/controllernetwork.py
deleted file mode 100644
index ac40575..0000000
--- a/xos/core/models/controllernetwork.py
+++ /dev/null
@@ -1,30 +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 xos.exceptions import *
-from controllernetwork_decl import *
-
-
-class ControllerNetwork(ControllerNetwork_decl):
-    class Meta:
-        proxy = True
-
-    def tologdict(self):
-        d = super(ControllerNetwork, self).tologdict()
-        try:
-            d["network_name"] = self.network.name
-            d["controller_name"] = self.controller.name
-        except BaseException:
-            pass
-        return d
diff --git a/xos/core/models/controllerrole.py b/xos/core/models/controllerrole.py
deleted file mode 100644
index f01d958..0000000
--- a/xos/core/models/controllerrole.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from controllerrole_decl import *
-
-
-class ControllerRole(ControllerRole_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/controllersite.py b/xos/core/models/controllersite.py
deleted file mode 100644
index 178c014..0000000
--- a/xos/core/models/controllersite.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from controllersite_decl import *
-
-
-class ControllerSite(ControllerSite_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/controllersiteprivilege.py b/xos/core/models/controllersiteprivilege.py
deleted file mode 100644
index e4283d5..0000000
--- a/xos/core/models/controllersiteprivilege.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from controllersiteprivilege_decl import *
-
-
-class ControllerSitePrivilege(ControllerSitePrivilege_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/controllerslice.py b/xos/core/models/controllerslice.py
deleted file mode 100644
index 0e48dc9..0000000
--- a/xos/core/models/controllerslice.py
+++ /dev/null
@@ -1,30 +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 xos.exceptions import *
-from controllerslice_decl import *
-
-
-class ControllerSlice(ControllerSlice_decl):
-    class Meta:
-        proxy = True
-
-    def tologdict(self):
-        d = super(ControllerSlice, self).tologdict()
-        try:
-            d["slice_name"] = self.slice.name
-            d["controller_name"] = self.controller.name
-        except BaseException:
-            pass
-        return d
diff --git a/xos/core/models/controllersliceprivilege.py b/xos/core/models/controllersliceprivilege.py
deleted file mode 100644
index 9fa9ca5..0000000
--- a/xos/core/models/controllersliceprivilege.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from controllersliceprivilege_decl import *
-
-
-class ControllerSlicePrivilege(ControllerSlicePrivilege_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/controlleruser.py b/xos/core/models/controlleruser.py
deleted file mode 100644
index c64cd26..0000000
--- a/xos/core/models/controlleruser.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from controlleruser_decl import *
-
-
-class ControllerUser(ControllerUser_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/deployment.py b/xos/core/models/deployment.py
deleted file mode 100644
index 84b2ba6..0000000
--- a/xos/core/models/deployment.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from deployment_decl import *
-
-
-class Deployment(Deployment_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/imagedeployments.py b/xos/core/models/imagedeployments.py
deleted file mode 100644
index 5c62569..0000000
--- a/xos/core/models/imagedeployments.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from imagedeployments_decl import *
-
-
-class ImageDeployments(ImageDeployments_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/instance.py b/xos/core/models/instance.py
deleted file mode 100644
index a742d94..0000000
--- a/xos/core/models/instance.py
+++ /dev/null
@@ -1,38 +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 xos.exceptions import *
-from instance_decl import *
-
-
-class Instance(Instance_decl):
-    class Meta:
-        proxy = True
-
-    def tologdict(self):
-        d = super(Instance, self).tologdict()
-        try:
-            d["slice_name"] = self.slice.name
-            d["controller_name"] = self.get_controller().name
-        except BaseException:
-            pass
-        return d
-
-    def save(self, *args, **kwargs):
-        if not self.name:
-            self.name = self.slice.name
-        if not self.creator and hasattr(self, "caller"):
-            self.creator = self.caller
-
-        super(Instance, self).save(*args, **kwargs)
diff --git a/xos/core/models/sitedeployment.py b/xos/core/models/sitedeployment.py
deleted file mode 100644
index dbac66d..0000000
--- a/xos/core/models/sitedeployment.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from sitedeployment_decl import *
-
-
-class SiteDeployment(SiteDeployment_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/siteprivilege.py b/xos/core/models/siteprivilege.py
deleted file mode 100644
index ab450b9..0000000
--- a/xos/core/models/siteprivilege.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from siteprivilege_decl import *
-
-
-class SitePrivilege(SitePrivilege_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/siterole.py b/xos/core/models/siterole.py
deleted file mode 100644
index e38c0a4..0000000
--- a/xos/core/models/siterole.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from siterole_decl import *
-
-
-class SiteRole(SiteRole_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/sliceprivilege.py b/xos/core/models/sliceprivilege.py
deleted file mode 100644
index 26832f7..0000000
--- a/xos/core/models/sliceprivilege.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from sliceprivilege_decl import *
-
-
-class SlicePrivilege(SlicePrivilege_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/slicerole.py b/xos/core/models/slicerole.py
deleted file mode 100644
index 957c2e1..0000000
--- a/xos/core/models/slicerole.py
+++ /dev/null
@@ -1,21 +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 xos.exceptions import *
-from slicerole_decl import *
-
-
-class SliceRole(SliceRole_decl):
-    class Meta:
-        proxy = True
diff --git a/xos/core/models/tenantwithcontainer.py b/xos/core/models/tenantwithcontainer.py
deleted file mode 100644
index d645a63..0000000
--- a/xos/core/models/tenantwithcontainer.py
+++ /dev/null
@@ -1,70 +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 xos.exceptions import *
-from tenantwithcontainer_decl import *
-
-
-class TenantWithContainer(TenantWithContainer_decl):
-    class Meta:
-        proxy = True
-
-    def __init__(self, *args, **kwargs):
-        super(TenantWithContainer, self).__init__(*args, **kwargs)
-
-        # vSG service relies on knowing when instance id has changed
-        self.orig_instance_id = self.get_attribute("instance_id")
-
-    # vSG service relies on instance_id attribute
-    def get_attribute(self, name, default=None):
-        if name == "instance_id":
-            if self.instance:
-                return self.instance.id
-            else:
-                return None
-        else:
-            return super(TenantWithContainer, self).get_attribute(name, default)
-
-    # Services may wish to override the image() function to return different
-    # images based on criteria in the tenant object. For example,
-    #    if (self.has_feature_A):
-    #        return Instance.object.get(name="image_with_feature_a")
-    #    elif (self.has_feature_B):
-    #        return Instance.object.get(name="image_with_feature_b")
-    #    else:
-    #        return super(MyTenantClass,self).image()
-
-    @property
-    def image(self):
-        from core.models import Image
-
-        # Implement the logic here to pick the image that should be used when
-        # instantiating the VM that will hold the container.
-
-        slice = self.provider_service.slices.all()
-        if not slice:
-            raise XOSProgrammingError("provider service has no slice")
-        slice = slice[0]
-
-        # If slice has default_image set then use it
-        if slice.default_image:
-            return slice.default_image
-
-        raise XOSProgrammingError("Please set a default image for %s" % self.slice.name)
-
-    def save(self, *args, **kwargs):
-        if (not self.creator) and (hasattr(self, "caller")) and (self.caller):
-            self.creator = self.caller
-
-        super(TenantWithContainer, self).save(*args, **kwargs)