remove obsolete tests that referenced openstack
remove openstack references from core/admin.py

Change-Id: I0bf23865dde1cfde13621d9253b94d9f56a9e783
diff --git a/xos/core/admin.py b/xos/core/admin.py
index ab34183..d968c32 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -21,7 +21,6 @@
 from django.utils.html import conditional_escape, format_html
 from django.utils.safestring import mark_safe
 from django.utils.text import capfirst
-from openstack_xos.manager import OpenStackManager
 from suit.widgets import LinkedSelect
 
 # thread locals necessary to work around a django-suit issue
@@ -1399,14 +1398,12 @@
         # update openstack connection to use this site/tenant
         auth = request.session.get('auth', {})
         auth['tenant'] = obj.slice.slicename
-        obj.os_manager = OpenStackManager(auth=auth, caller=request.user)
         obj.save()
 
     def delete_model(self, request, obj):
         # update openstack connection to use this site/tenant
         auth = request.session.get('auth', {})
         auth['tenant'] = obj.slice.slicename
-        obj.os_manager = OpenStackManager(auth=auth, caller=request.user)
         obj.delete()
 
 
@@ -1635,21 +1632,6 @@
 
         return field
 
-    # def save_model(self, request, obj, form, change):
-    #    # update openstack connection to use this site/tenant
-    #    auth = request.session.get('auth', {})
-    #    auth['tenant'] = obj.slice.name
-    #    obj.os_manager = OpenStackManager(auth=auth, caller=request.user)
-    #    obj.creator = request.user
-    #    obj.save()
-
-    # def delete_model(self, request, obj):
-    #    # update openstack connection to use this site/tenant
-    #    auth = request.session.get('auth', {})
-    #    auth['tenant'] = obj.slice.name
-    #    obj.os_manager = OpenStackManager(auth=auth, caller=request.user)
-    #    obj.delete()
-
 # class ContainerPortInline(XOSTabularInline):
 #    fields = ['backend_status_icon', 'network', 'container', 'ip', 'mac', 'segmentation_id']
 #    readonly_fields = ("backend_status_icon", "ip", "mac", "segmentation_id")
diff --git a/xos/synchronizers/base/event_loop.py b/xos/synchronizers/base/event_loop.py
index 7c71d2b..6644b09 100644
--- a/xos/synchronizers/base/event_loop.py
+++ b/xos/synchronizers/base/event_loop.py
@@ -18,7 +18,6 @@
 from django.db.models import F, Q
 from django.db import connection
 from django.db import reset_queries
-#from openstack_xos.manager import OpenStackManager
 from openstack_xos.driver import OpenStackDriver
 from xos.logger import Logger, logging, logger
 #from timeout import timeout
diff --git a/xos/tests/instancetest.py b/xos/tests/instancetest.py
deleted file mode 100644
index 2813521..0000000
--- a/xos/tests/instancetest.py
+++ /dev/null
@@ -1,51 +0,0 @@
-"""
-    Basic Instance Test
-
-    1) Create a slice1
-    2) Create instance1 on slice1
-"""
-
-import os
-import json
-import sys
-import time
-
-sys.path.append("/opt/xos")
-
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-from openstack.manager import OpenStackManager
-from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
-
-from planetstacktest import PlanetStackTest, fail_unless
-
-class InstanceTest(PlanetStackTest):
-    def __init__(self):
-        PlanetStackTest.__init__(self)
-
-    def run_instance1(self):
-        slice1Name = self.make_slice_name()
-        slice1 = Slice(name = slice1Name,
-                       omf_friendly=True,
-                       site=self.testSite,
-                       creator=self.testUser)
-        slice1=self.save_and_wait_for_enacted(slice1, nonempty_fields=["tenant_id"])
-
-        instance1 = Instance(image = self.testImage,
-                         creator=self.testUser,
-                         slice=slice1,
-                         node=self.testNode,
-                         deploymentNetwork=self.testDeployment)
-        instance1=self.save_and_wait_for_enacted(instance1, nonempty_fields=["instance_id", "ip"])
-
-    def run(self):
-        self.setup()
-        try:
-             self.run_instance1()
-        finally:
-             self.cleanup()
-
-def main():
-    InstanceTest().run()
-
-if __name__=="__main__":
-    main()
diff --git a/xos/tests/networktest.py b/xos/tests/networktest.py
deleted file mode 100644
index b4bcbd2..0000000
--- a/xos/tests/networktest.py
+++ /dev/null
@@ -1,195 +0,0 @@
-"""
-    Network Data Model Test
-
-    1) Create a slice1
-    2) Create instance1 on slice1
-    3) Verify one quantum network created for instance1
-    4) Create a private network, network1
-    5) Connect network1 to slice1
-    6) Create instance1_2 on slice1
-    7) Verify two quantum networks created for instance1_2
-"""
-
-import os
-import json
-import sys
-import time
-
-sys.path.append("/opt/xos")
-
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-from openstack.manager import OpenStackManager
-from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
-
-from planetstacktest import PlanetStackTest, fail_unless, fail
-
-class NetworkTest(PlanetStackTest):
-    def __init__(self):
-        PlanetStackTest.__init__(self)
-
-    def wait_for_ports(self, instance, count=1, max_time=120):
-        print "waiting for %d ports on %s" % (count, str(instance))
-        while max_time>0:
-            ports = self.manager.driver.shell.quantum.list_ports(device_id=instance.instance_id)["ports"]
-            if len(ports)==count:
-                return ports
-
-            fail_unless(len(ports)<=count, "too many ports")
-
-            time.sleep(10)
-            max_time = max_time - 10
-
-        fail("timed out while waiting for port creation")
-
-    def ports_to_networks(self, ports):
-        networks = []
-        for port in ports:
-            port_networks = networks + self.manager.driver.shell.quantum.list_networks(id=port["network_id"])["networks"]
-            for network in port_networks:
-                if not (network in networks):
-                    networks.append(network)
-        return networks
-
-    def ports_to_network_names(self, ports):
-        network_names = []
-        for network in self.ports_to_networks(ports):
-             network_names.append(network["name"])
-        return network_names
-
-    def verify_network_names(self, ports, network_names):
-        port_network_names = sorted(self.ports_to_network_names(ports))
-        network_names = sorted(network_names)
-        fail_unless(port_network_names == network_names, "mismatched network names: %s != %s" % (str(port_network_names), str(network_names)))
-        print "   verified network ports to", ",".join(port_network_names)
-
-    def test_slice1(self):
-        slice1Name = self.make_slice_name()
-        slice1 = Slice(name = slice1Name,
-                       omf_friendly=True,
-                       site=self.testSite,
-                       creator=self.testUser)
-        slice1=self.save_and_wait_for_enacted(slice1, nonempty_fields=["tenant_id"])
-
-        instance1 = Instance(image = self.testImage,
-                         creator=self.testUser,
-                         slice=slice1,
-                         node=self.testNode,
-                         deploymentNetwork=self.testDeployment)
-        instance1=self.save_and_wait_for_enacted(instance1, nonempty_fields=["instance_id", "ip"])
-
-        # instance1 should have only one port, its private network
-        ports = self.wait_for_ports(instance1, count=1)
-        self.verify_network_names(ports, [slice1.name])
-
-        network1 = Network(name = slice1Name + "-pvt",
-                           template = self.get_network_template("private"),
-                           owner = slice1)
-        network1=self.save_and_wait_for_enacted(network1, nonempty_fields=["network_id", "subnet_id", "router_id", "subnet"])
-
-        network1_slice1 = NetworkSlice(network=network1, slice=slice1)
-        network1_slice1.save() # does not need to be enacted
-
-        instance1_2 = Instance(image = self.testImage,
-                         creator=self.testUser,
-                         slice=slice1,
-                         node=self.testNode,
-                         deploymentNetwork=self.testDeployment)
-        instance1_2=self.save_and_wait_for_enacted(instance1_2, nonempty_fields=["instance_id", "ip"])
-
-        ports = self.wait_for_ports(instance1_2, count=2)
-        self.verify_network_names(ports, [slice1.name, network1.name])
-
-        self.slice1 = slice1
-        self.network1 = network1
-
-    def test_slice2(self):
-        slice2Name = self.make_slice_name()
-        slice2 = Slice(name = slice2Name,
-                       omf_friendly=True,
-                       site=self.testSite,
-                       creator=self.testUser)
-        slice2=self.save_and_wait_for_enacted(slice2, nonempty_fields=["tenant_id"])
-
-        network2 = Network(name = slice2Name + "-pvt",
-                           template = self.get_network_template("private"),
-                           owner = slice2)
-        network2=self.save_and_wait_for_enacted(network2, nonempty_fields=["network_id", "subnet_id", "router_id", "subnet"])
-
-        network2_slice2 = NetworkSlice(network=network2, slice=slice2)
-        network2_slice2.save() # does not need to be enacted
-
-        instance2_1 = Instance(image = self.testImage,
-                         creator=self.testUser,
-                         slice=slice2,
-                         node=self.testNode,
-                         deploymentNetwork=self.testDeployment)
-        instance2_1=self.save_and_wait_for_enacted(instance2_1, nonempty_fields=["instance_id", "ip"])
-
-        ports = self.wait_for_ports(instance2_1, count=2)
-        self.verify_network_names(ports, [slice2.name, network2.name])
-
-        self.slice2 = slice2
-        self.network2 = network2
-
-    def test_shared_private_net(self):
-        # connect network2 to slice1
-        self.network2.permittedSlices.add(self.slice1)
-        network2_slice1 = NetworkSlice(network=self.network2, slice=self.slice1)
-        network2_slice1.save()
-
-        instance1_3 = Instance(image = self.testImage,
-                         creator=self.testUser,
-                         slice=self.slice1,
-                         node=self.testNode,
-                         deploymentNetwork=self.testDeployment)
-        instance1_3=self.save_and_wait_for_enacted(instance1_3, nonempty_fields=["instance_id", "ip"])
-
-        ports = self.wait_for_ports(instance1_3, count=3)
-        self.verify_network_names(ports, [self.slice1.name, self.network1.name, self.network2.name])
-
-    def test_nat_net(self):
-        slice3Name = self.make_slice_name()
-        slice3 = Slice(name = slice3Name,
-                       omf_friendly=True,
-                       site=self.testSite,
-                       creator=self.testUser)
-        slice3=self.save_and_wait_for_enacted(slice3, nonempty_fields=["tenant_id"])
-
-        network3 = Network(name = slice3Name + "-nat",
-                           template = self.get_network_template("private-nat"),
-                           owner = slice3)
-        # note that router_id will not be filled in for nat-net, since nat-net has no routers
-        network3=self.save_and_wait_for_enacted(network3, nonempty_fields=["network_id", "subnet_id", "subnet"])
-
-        network3_slice3 = NetworkSlice(network=network3, slice=slice3)
-        network3_slice3.save() # does not need to be enacted
-
-        instance3_1 = Instance(image = self.testImage,
-                         creator=self.testUser,
-                         slice=slice3,
-                         node=self.testNode,
-                         deploymentNetwork=self.testDeployment)
-        instance3_1=self.save_and_wait_for_enacted(instance3_1, nonempty_fields=["instance_id", "ip"])
-
-        ports = self.wait_for_ports(instance3_1, count=2)
-        self.verify_network_names(ports, [slice3.name, "nat-net"])
-
-    def run(self):
-        self.setup()
-        try:
-             self.test_slice1()
-             self.test_slice2()
-             self.test_shared_private_net()
-             self.test_nat_net()
-             print "SUCCESS"
-        finally:
-             self.cleanup()
-
-def main():
-    NetworkTest().run()
-
-if __name__=="__main__":
-    main()
-
-
-
diff --git a/xos/tests/planetstacktest.py b/xos/tests/planetstacktest.py
deleted file mode 100644
index baf7efe..0000000
--- a/xos/tests/planetstacktest.py
+++ /dev/null
@@ -1,94 +0,0 @@
-import os
-import json
-import sys
-import time
-
-sys.path.append("/opt/xos")
-
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-from openstack.manager import OpenStackManager
-from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
-
-TEST_SITE_NAME = "Princeton University"
-TEST_USER_EMAIL = "sbaker@planetstack.org"
-TEST_IMAGE_NAME = "Fedora 16 LXC rev 1.3"
-TEST_NODE_NAME = "viccidev3.cs.princeton.edu"
-TEST_DEPLOYMENT_NAME = "VICCI"
-
-def fail(msg):
-    print msg
-    sys.exit(-1)
-
-def fail_unless(condition, msg):
-    if not condition:
-        fail(msg)
-
-class PlanetStackTest:
-    def __init__(self):
-        self.objs_saved = []
-        self.counter = 0
-
-    def setup(self):
-        self.manager = OpenStackManager()
-
-        print "getting test site"
-        self.testSite = Site.objects.get(name=TEST_SITE_NAME)
-
-        print "getting test user"
-        self.testUser = User.objects.get(email=TEST_USER_EMAIL)
-
-        print "getting test image"
-        self.testImage = Image.objects.get(name=TEST_IMAGE_NAME)
-
-        print "getting test node"
-        self.testNode = Node.objects.get(name=TEST_NODE_NAME)
-
-        print "getting test deployment"
-        self.testDeployment = Deployment.objects.get(name=TEST_DEPLOYMENT_NAME)
-
-    def save_and_wait_for_enacted(self, x, nonempty_fields=[]):
-        print "saving", x.__class__.__name__, str(x)
-        x.save()
-        self.objs_saved.append(x)
-        print "   waiting for", str(x), "to be enacted"
-        tStart = time.time()
-        while True:
-            new_x = x.__class__.objects.get(id=x.id)
-            if (new_x.enacted != None) and (new_x.enacted >= new_x.updated):
-                print "  ", str(x), "has been enacted"
-                break
-            time.sleep(5)
-
-        if nonempty_fields:
-            print "   waiting for", ", ".join(nonempty_fields), "to be nonempty"
-            while True:
-                new_x = x.__class__.objects.get(id=x.id)
-                keep_waiting=False
-                for field in nonempty_fields:
-                    if not getattr(new_x, field, None):
-                        keep_waiting=True
-                if not keep_waiting:
-                    break
-
-        print "   saved and enacted in %d seconds" % int(time.time() - tStart)
-
-        return new_x
-
-    def make_slice_name(self):
-        self.counter = self.counter +1
-        return "test-" + str(time.time()) + "." + str(self.counter)
-
-    def get_network_template(self,name):
-        template = NetworkTemplate.objects.get(name=name)
-        return template
-
-    def cleanup(self):
-        print "cleaning up"
-        print "press return"
-        sys.stdin.readline()
-        for obj in self.objs_saved:
-            try:
-                 print "  deleting", str(obj)
-                 obj.delete()
-            except:
-                 print "failed to delete", str(obj)