]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
remove cisco_demo and test_scripts directory, which were used by our local tests
authorYing Liu <yinliu2@cisco.com>
Fri, 19 Aug 2011 01:57:51 +0000 (18:57 -0700)
committerYing Liu <yinliu2@cisco.com>
Fri, 19 Aug 2011 01:57:51 +0000 (18:57 -0700)
cisco_demo/demo_client.py [deleted file]
cisco_demo/demo_client.py.bk [deleted file]
cisco_demo/test_client.py [deleted file]
test_scripts/__init__.py [deleted file]
test_scripts/miniclient.py [deleted file]
test_scripts/tests.py [deleted file]

diff --git a/cisco_demo/demo_client.py b/cisco_demo/demo_client.py
deleted file mode 100755 (executable)
index 4f91abc..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-
-import os
-import sys
-
-import gettext
-
-#gettext.install('quantum', unicode=1)
-possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
-                                   os.pardir,
-                                   os.pardir))
-if os.path.exists(os.path.join(possible_topdir, 'quantum', '__init__.py')):
-    sys.path.insert(0, possible_topdir)
-
-gettext.install('quantum', unicode=1)
-
-from test_scripts.miniclient import MiniClient
-from test_client import ExtClient
-from quantum.common.wsgi import Serializer
-
-HOST = '127.0.0.1'
-PORT = 9696
-USE_SSL = False
-TENANT_ID = 'ucs_user'
-
-
-test_network_data = \
-    {'network': {'net-name': 'cisco_test_network',
-                 'valn-id': 28}}
-test_portprofile_data = \
-    {'portprofile': {'portprofile_name': 'cisco_test_portprofile',
-                 'qos_name': 2,
-                 'qos_name': 'test-qos'}}
-test_cred_data = \
-    {'credential': {'credential_name': 'cred3',
-                    'user_name': 'newUser',
-                    'password': 'newPasswd'
-                    }}
-test_qos_data = \
-    {'qos': {'qos_name': 'plantimum',
-                    'qos_desc': {'PPS': 50, 'TTL': 5}}}
-
-
-#we put this assignment under portprofile resources
-#therefore we need to create such a test data
-test_port_assign_data = {'portprofile': {'network-id': '001',
-                                         'port-id': '1'}}
-test_attach_data = {'port': {'attachment-id': 'v01'}}
-
-test_act_data = {"get_available_host":123}
-
-test_instance_data={'novatenant':{'instance_id' : 1, 
-                    'instance_desc' : {'key1' : '1',
-                                       'key2' : '2'
-                                       }}}
-
-def test_get_host(format='json'):
-    client = ExtClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    body = Serializer().serialize(test_instance_data, content_type)
-    res = client.do_request(TENANT_ID, 
-                            'PUT', "/novatenants/001/get_host." + format, body=body)
-    print "XML Response"
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"    
-    
-def test_get_instance_port(format='json'):
-    client = ExtClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    body = Serializer().serialize(test_instance_data, content_type)
-    res = client.do_request(TENANT_ID, 
-                            'PUT', "/novatenants/001/get_instance_port." + format, body=body)
-    print "XML Response"
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-def test_action_ext(format='json'):
-    client = ExtClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    action_name = 'get_available_host'
-    action_params = dict(name='test')
-    body = Serializer().serialize(test_act_data, content_type)
-  
-    res = client.do_request(TENANT_ID, 'POST', "/act_resources/1/action." + format, body=body)
-    content = print_response(res)
-
-def print_response(res):
-    content = res.read()
-    print "Status: %s" % res.status
-    print "Content: %s" % content
-    return content
-
-
-def create_cisco_network(format='xml'):
-    
-    client = MiniClient(HOST, PORT, USE_SSL)
-    print "CREATE NETWORK -- FORMAT:%s" % format 
-    print "----------------------------"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_network_data, content_type)
-    res = client.do_request(TENANT_ID, 
-                            'POST', "/networks." + format, body=body)
-    print "XML Response"
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-
-def create_cisco_portprofile(format='xml'):
-    client = ExtClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    print "List all Profile -- FORMat%s" % format
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'GET', "/portprofiles." + format)
-    content = print_response(res)
-    portprofile_data = Serializer().deserialize(content, content_type)
-    print portprofile_data
-    
-    """
-    print "List a specific Profile -- FORMAT:%s" % format
-    profile_id = portprofile_data['portprofiles'][0]['id']
-    #profile_id='001'
-    print "profile_id " + profile_id
-    res = client.do_request(TENANT_ID, 
-                            'GET', "/portprofiles/" 
-                            + profile_id + "." + format)
-    print_response(res)
-    """
-    print "CREATE Profile -- FORMAT:%s" % format
-    print "----------------------------"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_portprofile_data, content_type)
-    print "***BODY is "
-    print body
-    res = client.do_request(TENANT_ID, 'POST', 
-                            "/portprofiles." + format, body=body)
-    print "XML Response"
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-def test_credential (format='xml'):
-    client = ExtClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    print "----------------------------"
-    print "List all credentials -- FORMat%s" % format
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'GET', "/credentials." + format)
-    content = print_response(res)
-    credential_data = Serializer().deserialize(content, content_type)
-    print credential_data
-    
-    print "----------------------------"
-    print "CREATE Credential -- FORMAT:%s" % format
-    print "----------------------------"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_cred_data, content_type)
-    print "***BODY is "
-    print body
-    res = client.do_request(TENANT_ID, 'POST', 
-                            "/credentials." + format, body=body)
-    print "XML Response"
-    print_response(res)
-  
-    print "----------------------------"
-    print "List all credentials -- FORMat%s" % format
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'GET', "/credentials." + format)
-    content = print_response(res)
-    credential_data = Serializer().deserialize(content, content_type)
-    print credential_data
-    print "----------------------------"
-    print "List a specific cred -- FORMAT:%s" % format
-    print "----------------------------"
-    cred_id = credential_data['credentials'][0]['id']
-    #cred_id='001'
-    print "cred_id " + cred_id
-    res = client.do_request(TENANT_ID, 
-                            'GET', "/credentials/" 
-                            + cred_id + "." + format)
-    print_response(res)
-    
-    print "----------------------------"
-    print "TEST DELETE Credential -- FORMAT:%s" % format 
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'DELETE',
-                            "/credentials/" + cred_id + "." + format)
-    print_response(res)
-    
-    print "----------------------------"
-    print "List all credentials -- FORMat%s" % format
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'GET', "/credentials." + format)
-    content = print_response(res)
-    credential_data = Serializer().deserialize(content, content_type)
-    print credential_data
-    
-    print "COMPLETED"
-    print "----------------------------"
-
-def test_qos (format='xml'):
-    client = ExtClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    print "----------------------------"
-    print "List all qoss -- FORMat%s" % format
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'GET', "/qoss." + format)
-    content = print_response(res)
-    qos_data = Serializer().deserialize(content, content_type)
-    print qos_data
-    
-    print "----------------------------"
-    print "CREATE qos -- FORMAT:%s" % format
-    print "----------------------------"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_qos_data, content_type)
-    print "***BODY is "
-    print body
-    res = client.do_request(TENANT_ID, 'POST', 
-                            "/qoss." + format, body=body)
-    print "XML Response"
-    print_response(res)
-  
-    print "----------------------------"
-    print "List all qoss -- FORMat%s" % format
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'GET', "/qoss." + format)
-    content = print_response(res)
-    qos_data = Serializer().deserialize(content, content_type)
-    print qos_data
-    print "----------------------------"
-    print "List a specific cred -- FORMAT:%s" % format
-    print "----------------------------"
-    qos_id = qos_data['qoss'][0]['id']
-    #cred_id='001'
-    print "qos_id " + qos_id
-    res = client.do_request(TENANT_ID, 
-                            'GET', "/qoss/" 
-                            + qos_id + "." + format)
-    print_response(res)
-    
-    print "----------------------------"
-    print "TEST DELETE qos -- FORMAT:%s" % format 
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'DELETE',
-                            "/qoss/" + qos_id + "." + format)
-    print_response(res)
-    
-    print "----------------------------"
-    print "List all qoss -- FORMat%s" % format
-    print "----------------------------"
-    res = client.do_request(TENANT_ID, 'GET', "/qoss." + format)
-    content = print_response(res)
-    qos_data = Serializer().deserialize(content, content_type)
-    print qos_data
-    
-    print "COMPLETED"
-    print "----------------------------"
-
-def test_delete_network(format='xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    print "TEST DELETE NETWORK -- FORMAT:%s" % format 
-    print "----------------------------"
-    print "--> Step 1 - List All Networks"
-    res = client.do_request(TENANT_ID, 'GET', "/networks." + format)
-    content = print_response(res)
-    network_data = Serializer().deserialize(content, content_type)
-    print network_data
-    net_id = network_data['networks'][0]['id']
-    print "--> Step 2 - Delete network %s" % net_id    
-    res = client.do_request(TENANT_ID, 'DELETE',
-                            "/networks/" + net_id + "." + format)
-    print_response(res)
-    print "--> Step 3 - List All Networks (Again)"
-    res = client.do_request(TENANT_ID, 'GET', "/networks." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-
-def test_delete_portprofile(format='xml'):
-    client = ExtClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    print "TEST DELETE PROFILE -- FORMAT:%s" % format 
-    print "----------------------------"
-    print "--> Step 1 - List All Profiles"
-    res = client.do_request(TENANT_ID, 'GET', "/portprofiles." + format)
-    content = print_response(res)
-    portprofile_data = Serializer().deserialize(content, content_type)
-    print portprofile_data
-    profile_id = portprofile_data['portprofiles'][0]['id']
-    print "--> Step 2 - Delete portprofile %s" % profile_id    
-    res = client.do_request(TENANT_ID, 'DELETE',
-                            "/portprofiles/" + profile_id + "." + format)
-    print_response(res)
-    print "--> Step 3 - List All Profiles (Again)"
-    res = client.do_request(TENANT_ID, 'GET', "/portprofiles." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-    
-def test_create_port(format='xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    print "TEST CREATE PORT -- FORMAT:%s" % format 
-    print "----------------------------"
-    print "--> Step 1 - List Ports for network 001"
-    res = client.do_request(TENANT_ID, 'GET', "/networks/001/ports." + format)
-    print_response(res)
-    print "--> Step 2 - Create Port for network 001"
-    res = client.do_request(TENANT_ID, 'POST', "/networks/001/ports." + format)
-    print_response(res)
-    print "--> Step 3 - List Ports for network 001 (again)"
-    res = client.do_request(TENANT_ID, 'GET', "/networks/001/ports." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-
-#assuming network 001 and ports 1 are created in the plug-in    
-def test_attach_resource(format='xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    print "TEST attach resources to port"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_attach_data, content_type)
-    #attach virtual interface to the port
-    res = client.do_request(TENANT_ID, 'PUT', 
-                            "/networks/001/ports/1/attachment." 
-                            + format, body=body)
-    print_response(res)
-    #list existing interface of the port
-    res = client.do_request(TENANT_ID, 'GET', 
-                            "/networks/001/ports/1/attachment." + format)
-    print_response(res)
-    #de_attach virtual interface from the port
-    res = client.do_request(TENANT_ID, 'DELETE', 
-                            "/networks/001/ports/1/attachment." + format)
-    print_response(res)
-    #list existing interface of the port
-    res = client.do_request(TENANT_ID, 'GET', 
-                            "/networks/001/ports/1/attachment." + format)
-    print_response(res)
-
-
-#assuming network 001, ports 1 and portprofile 002 are created in the plug-in 
-def test_assign_portprofile(format='xml'):
-    client = ExtClient(HOST, PORT, USE_SSL)
-    print "TEST attach resources to port"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_port_assign_data, content_type)
-    print "body is " + body
-    res = client.do_request(TENANT_ID, 'PUT', 
-                            "/portprofiles/001/associate_portprofile." 
-                            + format, body=body)
-    print_response(res)
-    res = client.do_request(TENANT_ID, 'POST', 
-                            "/portprofiles/001/disassociate_portprofile." 
-                            + format, body=body)
-   
-    print_response(res)
-    
-    
-def main():
-    create_cisco_portprofile('json') 
-    #test_attach_resource('json') 
-   
-    test_delete_portprofile('json') 
-    test_credential('json')
-    test_qos('json')
-    ##test_action_ext('json')
-    test_get_host('json')
-    test_get_instance_port('json')
-    
-    create_cisco_network('json')
-    test_create_port('json')
-    create_cisco_portprofile('json')
-    test_assign_portprofile('json')
-    pass
-    
-
-# Standard boilerplate to call the main() function.
-if __name__ == '__main__':
-    main()
diff --git a/cisco_demo/demo_client.py.bk b/cisco_demo/demo_client.py.bk
deleted file mode 100755 (executable)
index 3c7c928..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-'''
-Created on Jun 08, 2011
-
-@author: ying
-'''
-
-import os
-import sys
-
-import gettext
-
-#gettext.install('quantum', unicode=1)
-possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
-                                   os.pardir,
-                                   os.pardir))
-if os.path.exists(os.path.join(possible_topdir, 'quantum', '__init__.py')):
-    sys.path.insert(0, possible_topdir)
-
-gettext.install('quantum', unicode=1)
-
-from test_scripts.miniclient import MiniClient
-from quantum.common.wsgi import Serializer
-
-HOST = '127.0.0.1'
-PORT = 9696
-USE_SSL = False
-TENANT_ID = 'ucs_user'
-
-test_network_data = \
-    {'network': {'network-name': 'cisco_test_network',
-                 'valn-id': 28 }}
-    
-test_portprofile_data = \
-    {'portprofile': {'portprofile-name': 'cisco_test_portprofile',
-                 'vlan-id': 28,
-                 'vlan-name': 'test-vlan' }}
-
-def print_response(res):
-    content = res.read()
-    print "Status: %s" %res.status
-    print "Content: %s" %content
-    return content
-
-    
-def create_cisco_network(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    print "CREATE NETWORK -- FORMAT:%s" %format 
-    print "----------------------------"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_network_data, content_type)
-    res = client.do_request(TENANT_ID,'POST', "/networks." + format, body=body)
-    print "XML Response"
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-def create_cisco_portprofile(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    print "CREATE Profile -- FORMAT:%s" %format
-    print "----------------------------"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_portprofile_data, content_type)
-    print "**********BODY is**********"
-    print body
-    print "***************************"
-    res = client.do_request(TENANT_ID,'POST', "/portprofiles." + format, body=body)
-    print "XML Response"
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-def test_delete_network(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    print "TEST DELETE NETWORK -- FORMAT:%s" %format 
-    print "----------------------------"
-    print "--> Step 1 - List All Networks"
-    res = client.do_request(TENANT_ID,'GET', "/networks." + format)
-    content = print_response(res)
-    network_data = Serializer().deserialize(content, content_type)
-    print network_data
-    net_id = network_data['networks'][0]['id']
-    print "--> Step 2 - Delete network %s" %net_id    
-    res = client.do_request(TENANT_ID,'DELETE',
-                            "/networks/" + net_id + "." + format)
-    print_response(res)
-    print "--> Step 3 - List All Networks (Again)"
-    res = client.do_request(TENANT_ID,'GET', "/networks." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-
-def test_delete_portprofile(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    print "TEST DELETE PROFILE -- FORMAT:%s" %format 
-    print "----------------------------"
-    print "--> Step 1 - List All Profiles"
-    res = client.do_request(TENANT_ID,'GET', "/portprofiles." + format)
-    content = print_response(res)
-    portprofile_data = Serializer().deserialize(content, content_type)
-    print portprofile_data
-    profile_id = portprofile_data['portprofiles'][0]['id']
-    print "--> Step 2 - Delete portprofile %s" %profile_id    
-    res = client.do_request(TENANT_ID,'DELETE',
-                            "/portprofiles/" + profile_id + "." + format)
-    print_response(res)
-    print "--> Step 3 - List All Profiles (Again)"
-    res = client.do_request(TENANT_ID,'GET', "/portprofiles." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-def main():
-   
-    create_cisco_network('xml')
-  
-    create_cisco_portprofile('xml')    
-    #test_delete_network('json')
-    test_delete_portprofile('json') 
-    pass
-    
-
-# Standard boilerplate to call the main() function.
-if __name__ == '__main__':
-    main()
diff --git a/cisco_demo/test_client.py b/cisco_demo/test_client.py
deleted file mode 100644 (file)
index 4273e7d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-"""A base client class - derived from Quantum.MiniClient"""
-
-import httplib
-import socket
-import urllib
-
-
-class ExtClient(object):
-
-    action_prefix = '/v0.1/extensions/csco/tenants/{tenant_id}'
-    #action_prefix = '/v0.1/tenants/{tenant_id}'
-    def __init__(self, host, port, use_ssl):
-        """
-        Creates a new client to some service.
-
-        :param host: The host where service resides
-        :param port: The port where service resides
-        :param use_ssl: Should we use HTTPS?
-        """
-        self.host = host
-        self.port = port
-        self.use_ssl = use_ssl
-        self.connection = None
-
-    def get_connection_type(self):
-        """
-        Returns the proper connection type
-        """
-        if self.use_ssl:
-            return httplib.HTTPSConnection
-        else:
-            return httplib.HTTPConnection
-
-    def do_request(self, tenant, method, action, body=None,
-                   headers=None, params=None):
-        """
-        Connects to the server and issues a request.  
-        Returns the result data, or raises an appropriate exception if
-        HTTP status code is not 2xx
-
-        :param method: HTTP method ("GET", "POST", "PUT", etc...)
-        :param body: string of data to send, or None (default)
-        :param headers: mapping of key/value pairs to add as headers
-        :param params: dictionary of key/value pairs to add to append
-                             to action
-
-        """
-        action = ExtClient.action_prefix + action
-        action = action.replace('{tenant_id}', tenant)
-        if type(params) is dict:
-            action += '?' + urllib.urlencode(params)
-
-        try:
-            connection_type = self.get_connection_type()
-            headers = headers or {}
-            
-            # Open connection and send request
-            c = connection_type(self.host, self.port)
-            c.request(method, action, body, headers)
-            res = c.getresponse()
-            status_code = self.get_status_code(res)
-            if status_code in (httplib.OK,
-                               httplib.CREATED,
-                               httplib.ACCEPTED,
-                               httplib.NO_CONTENT):
-                return res
-            else:
-                raise Exception("Server returned error: %s" % res.read())
-
-        except (socket.error, IOError), e:
-            raise Exception("Unable to connect to "
-                            "server. Got error: %s" % e)
-
-    def get_status_code(self, response):
-        """
-        Returns the integer status code from the response, which
-        can be either a Webob.Response (used in testing) or httplib.Response
-        """
-        if hasattr(response, 'status_int'):
-            return response.status_int
-        else:
-            return response.status
-        
diff --git a/test_scripts/__init__.py b/test_scripts/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/test_scripts/miniclient.py b/test_scripts/miniclient.py
deleted file mode 100644 (file)
index fb1ebc8..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 Citrix Systems
-# All Rights Reserved.
-#
-#    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 httplib
-import socket
-import urllib
-
-class MiniClient(object):
-
-    """A base client class - derived from Glance.BaseClient"""
-
-    action_prefix = '/v0.1/tenants/{tenant_id}'
-
-    def __init__(self, host, port, use_ssl):
-        """
-        Creates a new client to some service.
-
-        :param host: The host where service resides
-        :param port: The port where service resides
-        :param use_ssl: Should we use HTTPS?
-        """
-        self.host = host
-        self.port = port
-        self.use_ssl = use_ssl
-        self.connection = None
-
-    def get_connection_type(self):
-        """
-        Returns the proper connection type
-        """
-        if self.use_ssl:
-            return httplib.HTTPSConnection
-        else:
-            return httplib.HTTPConnection
-
-    def do_request(self, tenant, method, action, body=None,
-                   headers=None, params=None):
-        """
-        Connects to the server and issues a request.  
-        Returns the result data, or raises an appropriate exception if
-        HTTP status code is not 2xx
-
-        :param method: HTTP method ("GET", "POST", "PUT", etc...)
-        :param body: string of data to send, or None (default)
-        :param headers: mapping of key/value pairs to add as headers
-        :param params: dictionary of key/value pairs to add to append
-                             to action
-
-        """
-        action = MiniClient.action_prefix + action
-        action = action.replace('{tenant_id}',tenant)
-        if type(params) is dict:
-            action += '?' + urllib.urlencode(params)
-
-        try:
-            connection_type = self.get_connection_type()
-            headers = headers or {}
-            
-            # Open connection and send request
-            c = connection_type(self.host, self.port)
-            c.request(method, action, body, headers)
-            res = c.getresponse()
-            status_code = self.get_status_code(res)
-            if status_code in (httplib.OK,
-                               httplib.CREATED,
-                               httplib.ACCEPTED,
-                               httplib.NO_CONTENT):
-                return res
-            else:
-                raise Exception("Server returned error: %s" % res.read())
-
-        except (socket.error, IOError), e:
-            raise Exception("Unable to connect to "
-                            "server. Got error: %s" % e)
-
-    def get_status_code(self, response):
-        """
-        Returns the integer status code from the response, which
-        can be either a Webob.Response (used in testing) or httplib.Response
-        """
-        if hasattr(response, 'status_int'):
-            return response.status_int
-        else:
-            return response.status
\ No newline at end of file
diff --git a/test_scripts/tests.py b/test_scripts/tests.py
deleted file mode 100644 (file)
index 589d9da..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 Citrix Systems
-# All Rights Reserved.
-#
-#    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 gettext
-
-gettext.install('quantum', unicode=1)
-
-from miniclient import MiniClient
-from quantum.common.wsgi import Serializer
-
-HOST = '127.0.0.1'
-PORT = 9696
-USE_SSL = False
-TENANT_ID = 'totore'
-
-test_network_data = \
-    {'network': {'network-name': 'test' }}
-
-def print_response(res):
-    content = res.read()
-    print "Status: %s" %res.status
-    print "Content: %s" %content
-    return content
-
-def test_list_networks_and_ports(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    print "TEST LIST NETWORKS AND PORTS -- FORMAT:%s" %format 
-    print "----------------------------"
-    print "--> Step 1 - List All Networks"
-    res = client.do_request(TENANT_ID,'GET', "/networks." + format)
-    print_response(res)
-    print "--> Step 2 - Details for Network 001"
-    res = client.do_request(TENANT_ID,'GET', "/networks/001." + format)
-    print_response(res)
-    print "--> Step 3 - Ports for Network 001"
-    res = client.do_request(TENANT_ID,'GET', "/networks/001/ports." + format)
-    print_response(res)
-    print "--> Step 4 - Details for Port 1"
-    res = client.do_request(TENANT_ID,'GET', "/networks/001/ports/1." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-    
-def test_create_network(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    print "TEST CREATE NETWORK -- FORMAT:%s" %format 
-    print "----------------------------"
-    print "--> Step 1 - Create Network"
-    content_type = "application/" + format
-    body = Serializer().serialize(test_network_data, content_type)
-    res = client.do_request(TENANT_ID,'POST', "/networks." + format, body=body)
-    print_response(res)
-    print "--> Step 2 - List All Networks"
-    res = client.do_request(TENANT_ID,'GET', "/networks." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-def test_rename_network(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format    
-    print "TEST RENAME NETWORK -- FORMAT:%s" %format 
-    print "----------------------------"
-    print "--> Step 1 - Retrieve network"
-    res = client.do_request(TENANT_ID,'GET', "/networks/001." + format)
-    print_response(res)
-    print "--> Step 2 - Rename network to 'test_renamed'"
-    test_network_data['network']['network-name'] = 'test_renamed'
-    body = Serializer().serialize(test_network_data, content_type)
-    res = client.do_request(TENANT_ID,'PUT', "/networks/001." + format, body=body)
-    print_response(res)
-    print "--> Step 2 - Retrieve network (again)"
-    res = client.do_request(TENANT_ID,'GET', "/networks/001." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-    
-def test_delete_network(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    content_type = "application/" + format
-    print "TEST DELETE NETWORK -- FORMAT:%s" %format 
-    print "----------------------------"
-    print "--> Step 1 - List All Networks"
-    res = client.do_request(TENANT_ID,'GET', "/networks." + format)
-    content = print_response(res)
-    network_data = Serializer().deserialize(content, content_type)
-    print network_data
-    net_id = network_data['networks'][0]['id']
-    print "--> Step 2 - Delete network %s" %net_id    
-    res = client.do_request(TENANT_ID,'DELETE',
-                            "/networks/" + net_id + "." + format)
-    print_response(res)
-    print "--> Step 3 - List All Networks (Again)"
-    res = client.do_request(TENANT_ID,'GET', "/networks." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-
-def test_create_port(format = 'xml'):
-    client = MiniClient(HOST, PORT, USE_SSL)
-    print "TEST CREATE PORT -- FORMAT:%s" %format 
-    print "----------------------------"
-    print "--> Step 1 - List Ports for network 001"
-    res = client.do_request(TENANT_ID,'GET', "/networks/001/ports." + format)
-    print_response(res)
-    print "--> Step 2 - Create Port for network 001"
-    res = client.do_request(TENANT_ID,'POST', "/networks/001/ports." + format)
-    print_response(res)
-    print "--> Step 3 - List Ports for network 001 (again)"
-    res = client.do_request(TENANT_ID,'GET', "/networks/001/ports." + format)
-    print_response(res)
-    print "COMPLETED"
-    print "----------------------------"
-
-
-def main():
-    test_list_networks_and_ports('xml')
-    test_list_networks_and_ports('json')
-    test_create_network('xml')
-    test_create_network('json')
-    test_rename_network('xml')
-    test_rename_network('json')
-    # NOTE: XML deserializer does not work properly 
-    # disabling XML test - this is NOT a server-side issue
-    #test_delete_network('xml')
-    test_delete_network('json')
-    test_create_port('xml')
-    test_create_port('json')
-    
-    pass
-    
-
-# Standard boilerplate to call the main() function.
-if __name__ == '__main__':
-    main()
\ No newline at end of file