incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [3/7] remove tools/testClient as they are moved to tools/marvin/marvin already
Date Fri, 22 Jun 2012 17:58:04 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/testClient/cloudstackConnection.py b/tools/testClient/cloudstackConnection.py
deleted file mode 100644
index b72e54c..0000000
--- a/tools/testClient/cloudstackConnection.py
+++ /dev/null
@@ -1,174 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-import urllib2
-import urllib
-import base64
-import hmac
-import hashlib
-import json
-import xml.dom.minidom
-import types
-import time
-import inspect
-import cloudstackException
-from cloudstackAPI import * 
-import jsonHelper
-
-class cloudConnection(object):
-    def __init__(self, mgtSvr, port=8096, apiKey = None, securityKey = None, asyncTimeout=3600, logging=None):
-        self.apiKey = apiKey
-        self.securityKey = securityKey
-        self.mgtSvr = mgtSvr
-        self.port = port
-        self.logging = logging
-        if port == 8096:
-            self.auth = False
-        else:
-            self.auth = True
-            
-        self.retries = 5
-        self.asyncTimeout = asyncTimeout
-    
-    def close(self):
-        try:
-            self.connection.close()
-        except:
-            pass
-    
-    def __copy__(self):
-        return cloudConnection(self.mgtSvr, self.port, self.apiKey, self.securityKey, self.asyncTimeout, self.logging)
-    
-    def make_request_with_auth(self, command, requests={}):
-        requests["command"] = command
-        requests["apiKey"] = self.apiKey
-        requests["response"] = "json"
-        request = zip(requests.keys(), requests.values())
-        request.sort(key=lambda x: str.lower(x[0]))
-        
-        requestUrl = "&".join(["=".join([r[0], urllib.quote_plus(str(r[1]))]) for r in request])
-        hashStr = "&".join(["=".join([str.lower(r[0]), str.lower(urllib.quote_plus(str(r[1]))).replace("+", "%20")]) for r in request])
-
-        sig = urllib.quote_plus(base64.encodestring(hmac.new(self.securityKey, hashStr, hashlib.sha1).digest()).strip())
-        requestUrl += "&signature=%s"%sig
-
-        try:
-            self.connection = urllib2.urlopen("http://%s:%d/client/api?%s"%(self.mgtSvr, self.port, requestUrl))
-            self.logging.debug("sending GET request: %s"%requestUrl)
-            response = self.connection.read()
-            self.logging.info("got response: %s"%response)
-        except IOError, e:
-            if hasattr(e, 'reason'):
-                self.logging.critical("failed to reach %s because of %s"%(self.mgtSvr, e.reason))
-            elif hasattr(e, 'code'):
-                self.logging.critical("server returned %d error code"%e.code)
-        except HTTPException, h:
-            self.logging.debug("encountered http Exception %s"%h.args)
-            if self.retries > 0:
-                self.retries = self.retries - 1
-                self.make_request_with_auth(command, requests)
-            else:
-                self.retries = 5
-                raise h
-        else:
-            return response
-        
-    def make_request_without_auth(self, command, requests={}):
-        requests["command"] = command
-        requests["response"] = "json" 
-        requests = zip(requests.keys(), requests.values())
-        requestUrl = "&".join(["=".join([request[0], urllib.quote_plus(str(request[1]))]) for request in requests])
-
-        self.connection = urllib2.urlopen("http://%s:%d/client/api?%s"%(self.mgtSvr, self.port, requestUrl))
-        self.logging.debug("sending GET request without auth: %s"%requestUrl)
-        response = self.connection.read()
-        self.logging.info("got response: %s"%response)
-        return response
-    
-    def pollAsyncJob(self, jobId, response):
-        cmd = queryAsyncJobResult.queryAsyncJobResultCmd()
-        cmd.jobid = jobId
-        timeout = self.asyncTimeout
-        
-        while timeout > 0:
-            asyncResonse = self.make_request(cmd, response, True)
-            
-            if asyncResonse.jobstatus == 2:
-                raise cloudstackException.cloudstackAPIException("asyncquery", asyncResonse.jobresult)
-            elif asyncResonse.jobstatus == 1:
-                return asyncResonse
-            
-            time.sleep(5)
-            self.logging.debug("job: %s still processing, will timeout in %ds"%(jobId, timeout))
-            timeout = timeout - 5
-            
-        raise cloudstackException.cloudstackAPIException("asyncquery", "Async job timeout %s"%jobId)
-    
-    def make_request(self, cmd, response = None, raw=False):
-        commandName = cmd.__class__.__name__.replace("Cmd", "")
-        isAsync = "false"
-        requests = {}
-        required = []
-        for attribute in dir(cmd):
-            if attribute != "__doc__" and attribute != "__init__" and attribute != "__module__":
-                if attribute == "isAsync":
-                    isAsync = getattr(cmd, attribute)
-                elif attribute == "required":
-                    required = getattr(cmd, attribute)
-                else:
-                    requests[attribute] = getattr(cmd, attribute)
-        
-        for requiredPara in required:
-            if requests[requiredPara] is None:
-                raise cloudstackException.cloudstackAPIException(commandName, "%s is required"%requiredPara)
-        '''remove none value'''
-        for param, value in requests.items():
-            if value is None:
-                requests.pop(param)
-            elif isinstance(value, list):
-                if len(value) == 0:
-                    requests.pop(param)
-                else:
-                    if not isinstance(value[0], dict):
-                        requests[param] = ",".join(value)
-                    else:
-                        requests.pop(param)
-                        i = 0
-                        for v in value:
-                            for key, val in v.iteritems():
-                                requests["%s[%d].%s"%(param,i,key)] = val
-                            i = i + 1
-        
-        if self.logging is not None:
-            self.logging.info("sending command: %s %s"%(commandName, str(requests)))
-        result = None
-        if self.auth:
-            result = self.make_request_with_auth(commandName, requests)
-        else:
-            result = self.make_request_without_auth(commandName, requests)
-        
-        if result is None:
-            return None
-        
-        result = jsonHelper.getResultObj(result, response)
-        if raw or isAsync == "false":
-            return result
-        else:
-            asynJobId = result.jobid
-            result = self.pollAsyncJob(asynJobId, response)
-            return result.jobresult
-        
-if __name__ == '__main__':
-    xml = '<?xml version="1.0" encoding="ISO-8859-1"?><deployVirtualMachineResponse><virtualmachine><id>407</id><name>i-1-407-RS3</name><displayname>i-1-407-RS3</displayname><account>system</account><domainid>1</domainid><domain>ROOT</domain><created>2011-07-30T14:45:19-0700</created><state>Running</state><haenable>false</haenable><zoneid>1</zoneid><zonename>CA1</zonename><hostid>3</hostid><hostname>kvm-50-205</hostname><templateid>4</templateid><templatename>CentOS 5.5(64-bit) no GUI (KVM)</templatename><templatedisplaytext>CentOS 5.5(64-bit) no GUI (KVM)</templatedisplaytext><passwordenabled>false</passwordenabled><serviceofferingid>1</serviceofferingid><serviceofferingname>Small Instance</serviceofferingname><cpunumber>1</cpunumber><cpuspeed>500</cpuspeed><memory>512</memory><guestosid>112</guestosid><rootdeviceid>0</rootdeviceid><rootdevicetype>NetworkFilesystem</rootdevicetype><nic><id>380</id><networkid>203</networkid><netmask>255.255.255.0</netmask><gateway>65.19.181.1</gatew
 ay><ipaddress>65.19.181.110</ipaddress><isolationuri>vlan://65</isolationuri><broadcasturi>vlan://65</broadcasturi><traffictype>Guest</traffictype><type>Direct</type><isdefault>true</isdefault><macaddress>06:52:da:00:00:08</macaddress></nic><hypervisor>KVM</hypervisor></virtualmachine></deployVirtualMachineResponse>'
-    conn = cloudConnection(None)
-    
-    print conn.paraseReturnXML(xml, deployVirtualMachine.deployVirtualMachineResponse())

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/cloudstackException.py
----------------------------------------------------------------------
diff --git a/tools/testClient/cloudstackException.py b/tools/testClient/cloudstackException.py
deleted file mode 100644
index c864097..0000000
--- a/tools/testClient/cloudstackException.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-
-class cloudstackAPIException(Exception):
-    def __init__(self, cmd = "", result = ""):
-        self.errorMsg = "Execute cmd: %s failed, due to: %s"%(cmd, result)
-    def __str__(self):
-        return self.errorMsg
-    
-class InvalidParameterException(Exception):
-    def __init__(self, msg=''):
-        self.errorMsg = msg
-    def __str__(self):
-        return self.errorMsg
-    
-class dbException(Exception):
-    def __init__(self, msg=''):
-        self.errorMsg = msg
-    def __str__(self):
-        return self.errorMsg
-    
-class internalError(Exception):
-    def __init__(self, msg=''):
-        self.errorMsg = msg
-    def __str__(self):
-        return self.errorMsg
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/cloudstackTestCase.py
----------------------------------------------------------------------
diff --git a/tools/testClient/cloudstackTestCase.py b/tools/testClient/cloudstackTestCase.py
deleted file mode 100644
index cf822ad..0000000
--- a/tools/testClient/cloudstackTestCase.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-from cloudstackAPI import *
-try:
-    import unittest2 as unittest
-except ImportError:
-    import unittest
-import cloudstackTestClient
-
-#class UserName(object):
-#    def __init__(self, account, domain, type=0):
-#        self.account = account
-#        self.domain = domain
-#        self.accounttype = type
-#    def __call__(self, cls):
-#        class Wrapped(cls):
-#            cls.UserName = self.account
-#            cls.DomainName = self.domain
-#            cls.AcctType = self.accounttype
-#        return Wrapped
-
-def UserName(Name, DomainName, AcctType):
-    def wrapper(cls):
-        orig_init = cls.__init__
-        def __init__(self, *args, **kws):
-            cls.UserName = Name
-            cls.DomainName = DomainName
-            cls.AcctType = AcctType
-            orig_init(self, *args, **kws)
-        cls.__init__ = __init__
-        return cls
-    return wrapper
-
-class cloudstackTestCase(unittest.case.TestCase):
-    clstestclient = None
-    
-    def __init__(self, args):
-        unittest.case.TestCase.__init__(self, args)
-        self.testClient = cloudstackTestClient.cloudstackTestClient()
-        
-    @classmethod
-    def getClsTestClient(cls):
-        return cls.clstestclient

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/cloudstackTestClient.py
----------------------------------------------------------------------
diff --git a/tools/testClient/cloudstackTestClient.py b/tools/testClient/cloudstackTestClient.py
deleted file mode 100644
index 097307f..0000000
--- a/tools/testClient/cloudstackTestClient.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-import cloudstackConnection
-import asyncJobMgr
-import dbConnection
-from cloudstackAPI import * 
-import random
-import string
-import hashlib
-
-class cloudstackTestClient(object):
-    def __init__(self, mgtSvr=None, port=8096, apiKey = None, securityKey = None, asyncTimeout=3600, defaultWorkerThreads=10, logging=None):
-        self.connection = cloudstackConnection.cloudConnection(mgtSvr, port, apiKey, securityKey, asyncTimeout, logging)
-        self.apiClient = cloudstackAPIClient.CloudStackAPIClient(self.connection)
-        self.dbConnection = None
-        self.asyncJobMgr = None
-        self.ssh = None
-        self.defaultWorkerThreads = defaultWorkerThreads
-        
-        
-    def dbConfigure(self, host="localhost", port=3306, user='cloud', passwd='cloud', db='cloud'):
-        self.dbConnection = dbConnection.dbConnection(host, port, user, passwd, db)
-    
-    def isAdminContext(self):
-        """
-        A user is a regular user if he fails to listDomains;
-        if he is a domain-admin, he can list only domains that are non-ROOT;
-        if he is an admin, he can list the ROOT domain successfully
-        """
-        try:
-            listdom = listDomains.listDomainsCmd()
-            listdom.name = 'ROOT'
-            listdomres = self.apiClient.listDomains(listdom)
-            rootdom = listdomres[0].name
-            if rootdom == 'ROOT':
-                return 1 #admin
-            else:
-                return 2 #domain-admin
-        except:
-            return 0 #user
-    
-    def random_gen(self, size=6, chars=string.ascii_uppercase + string.digits):
-        """Generate Random Strings of variable length"""
-        return ''.join(random.choice(chars) for x in range(size))
-
-    def createNewApiClient(self, UserName, DomainName, acctType=0):
-        if not self.isAdminContext():
-            return self.apiClient
-        
-        listDomain = listDomains.listDomainsCmd()
-        listDomain.listall = True
-        listDomain.name = DomainName
-        try:
-            domains = self.apiClient.listDomains(listDomain)
-            domId = domains[0].id
-        except:
-            cdomain = createDomain.createDomainCmd()
-            cdomain.name = DomainName
-            domain = self.apiClient.createDomain(cdomain)
-            domId = domain.id
-        
-        mdf = hashlib.md5()
-        mdf.update("password")
-        mdf_pass = mdf.hexdigest()
-        
-        cmd = listAccounts.listAccountsCmd()
-        cmd.name = UserName
-        cmd.domainid = domId
-        try:
-            accounts = self.apiClient.listAccounts(cmd)
-            acctId = accounts[0].id
-        except:
-            createAcctCmd = createAccount.createAccountCmd()
-            createAcctCmd.accounttype = acctType
-            createAcctCmd.domainid = domId
-            createAcctCmd.email = "test-" + self.random_gen() + "@citrix.com"
-            createAcctCmd.firstname = UserName
-            createAcctCmd.lastname = UserName
-            createAcctCmd.password = mdf_pass
-            createAcctCmd.username = UserName
-            acct = self.apiClient.createAccount(createAcctCmd)
-            acctId = acct.id
-        
-        listuser = listUsers.listUsersCmd() 
-        listuser.username = UserName
-        
-        listuserRes = self.apiClient.listUsers(listuser)
-        userId = listuserRes[0].id
-        apiKey = listuserRes[0].apikey
-        securityKey = listuserRes[0].secretkey
-     
-        if apiKey is None:
-            registerUser = registerUserKeys.registerUserKeysCmd()
-            registerUser.id = userId
-            registerUserRes = self.apiClient.registerUserKeys(registerUser)
-            apiKey = registerUserRes.apikey
-            securityKey = registerUserRes.secretkey
-        
-        nConnection = cloudstackConnection.cloudConnection(self.connection.mgtSvr, self.connection.port, apiKey, securityKey, self.connection.asyncTimeout, self.connection.logging)
-        self.connection.close()
-        self.connection = nConnection
-        self.apiClient = cloudstackAPIClient.CloudStackAPIClient(self.connection)
-        
-    def close(self):
-        if self.connection is not None:
-            self.connection.close()
-        if self.dbConnection is not None:
-            self.dbConnection.close()
-        
-    def getDbConnection(self):
-        return self.dbConnection
-
-    def executeSql(self, sql=None):
-        if sql is None or self.dbConnection is None:
-            return None
-        
-        return self.dbConnection.execute()
-    
-    def executeSqlFromFile(self, sqlFile=None):
-        if sqlFile is None or self.dbConnection is None:
-            return None
-        return self.dbConnection.executeSqlFromFile(sqlFile)
-    
-    def getApiClient(self):
-        return self.apiClient
-    
-    '''FixME, httplib has issue if more than one thread submitted'''
-    def submitCmdsAndWait(self, cmds, workers=1):
-        if self.asyncJobMgr is None:
-            self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
-        return self.asyncJobMgr.submitCmdsAndWait(cmds, workers)
-    
-    '''submit one job and execute the same job ntimes, with nums_threads of threads'''
-    def submitJob(self, job, ntimes=1, nums_threads=10, interval=1):
-        if self.asyncJobMgr is None:
-            self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
-        self.asyncJobMgr.submitJobExecuteNtimes(job, ntimes, nums_threads, interval)
-        
-    '''submit n jobs, execute them with nums_threads of threads'''    
-    def submitJobs(self, jobs, nums_threads=10, interval=1):
-        if self.asyncJobMgr is None:
-            self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
-        self.asyncJobMgr.submitJobs(jobs, nums_threads, interval)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/codegenerator.py
----------------------------------------------------------------------
diff --git a/tools/testClient/codegenerator.py b/tools/testClient/codegenerator.py
deleted file mode 100644
index c719057..0000000
--- a/tools/testClient/codegenerator.py
+++ /dev/null
@@ -1,289 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-import xml.dom.minidom
-from optparse import OptionParser
-import os
-import sys
-class cmdParameterProperty(object):
-    def __init__(self):
-        self.name = None
-        self.required = False
-        self.desc = ""
-        self.type = "planObject"
-        self.subProperties = []
-        
-class cloudStackCmd:
-    def __init__(self):
-        self.name = ""
-        self.desc = ""
-        self.async = "false"
-        self.request = []
-        self.response = []
-
-class codeGenerator:
-    space = "    "
-
-    cmdsName = []
-    
-    def __init__(self, outputFolder, apiSpecFile):
-        self.cmd = None
-        self.code = ""
-        self.required = []
-        self.subclass = []
-        self.outputFolder = outputFolder
-        self.apiSpecFile = apiSpecFile
-        
-    def addAttribute(self, attr, pro):
-        value = pro.value
-        if pro.required:
-            self.required.append(attr)
-        desc = pro.desc
-        if desc is not None:
-            self.code += self.space
-            self.code += "''' " + pro.desc + " '''"
-            self.code += "\n"
-        
-        self.code += self.space
-        self.code += attr + " = " + str(value)
-        self.code += "\n"
-    
-    def generateSubClass(self, name, properties):
-        '''generate code for sub list'''
-        subclass = 'class %s:\n'%name
-        subclass += self.space + "def __init__(self):\n"
-        for pro in properties:
-            if pro.desc is not None:
-                subclass += self.space + self.space + '""""%s"""\n'%pro.desc
-            if len (pro.subProperties) > 0:
-                subclass += self.space + self.space + 'self.%s = []\n'%pro.name
-                self.generateSubClass(pro.name, pro.subProperties)
-            else:
-                subclass += self.space + self.space + 'self.%s = None\n'%pro.name
-        
-        self.subclass.append(subclass)
-    def generate(self, cmd):
-       
-        self.cmd = cmd
-        self.cmdsName.append(self.cmd.name)
-        self.code += "\n"
-        self.code += '"""%s"""\n'%self.cmd.desc  
-        self.code += 'from baseCmd import *\n'
-        self.code += 'from baseResponse import *\n'
-        self.code += "class %sCmd (baseCmd):\n"%self.cmd.name
-        self.code += self.space + "def __init__(self):\n"
-        
-        self.code += self.space + self.space + 'self.isAsync = "%s"\n' %self.cmd.async
-        
-        for req in self.cmd.request:
-            if req.desc is not None:
-                self.code += self.space + self.space + '"""%s"""\n'%req.desc
-            if req.required == "true":
-                self.code += self.space + self.space + '"""Required"""\n'
-            
-            value = "None"
-            if req.type == "list" or req.type == "map":
-                value = "[]"
-            
-            self.code += self.space + self.space  + 'self.%s = %s\n'%(req.name,value)
-            if req.required == "true":
-                self.required.append(req.name)
-        
-        self.code += self.space + self.space + "self.required = ["
-        for require in self.required:
-            self.code += '"' + require + '",'
-        self.code += "]\n"
-        self.required = []
-        
-        
-        """generate response code"""
-        subItems = {}
-        self.code += "\n"
-        self.code += 'class %sResponse (baseResponse):\n'%self.cmd.name
-        self.code += self.space + "def __init__(self):\n"
-        if len(self.cmd.response) == 0:
-            self.code += self.space + self.space + "pass"
-        else:
-            for res in self.cmd.response:
-                if res.desc is not None:
-                    self.code += self.space + self.space + '"""%s"""\n'%res.desc
-            
-                if len(res.subProperties) > 0:
-                    self.code += self.space + self.space + 'self.%s = []\n'%res.name
-                    self.generateSubClass(res.name, res.subProperties)
-                else:
-                    self.code += self.space + self.space + 'self.%s = None\n'%res.name
-        self.code += '\n'
-        
-        for subclass in self.subclass:
-            self.code += subclass + "\n"
-        
-        fp = open(self.outputFolder + "/cloudstackAPI/%s.py"%self.cmd.name, "w")
-        fp.write(self.code)
-        fp.close()
-        self.code = ""
-        self.subclass = []
-       
-        
-    def finalize(self):
-        '''generate an api call'''
-        
-        header = '"""Test Client for CloudStack API"""\n'
-        imports = "import copy\n"
-        initCmdsList = '__all__ = ['
-        body = ''
-        body += "class CloudStackAPIClient:\n"
-        body += self.space + 'def __init__(self, connection):\n'
-        body += self.space + self.space + 'self.connection = connection\n'
-        body += "\n"
-        
-        body += self.space + 'def __copy__(self):\n'
-        body += self.space + self.space + 'return CloudStackAPIClient(copy.copy(self.connection))\n'
-        body += "\n"
-        
-        for cmdName in self.cmdsName:
-            body += self.space + 'def %s(self,command):\n'%cmdName
-            body += self.space + self.space + 'response = %sResponse()\n'%cmdName
-            body += self.space + self.space + 'response = self.connection.make_request(command, response)\n'
-            body += self.space + self.space + 'return response\n'
-            body += '\n'
-        
-            imports += 'from %s import %sResponse\n'%(cmdName, cmdName)
-            initCmdsList += '"%s",'%cmdName
-        
-        fp = open(self.outputFolder + '/cloudstackAPI/cloudstackAPIClient.py', 'w')
-        for item in [header, imports, body]:
-            fp.write(item)
-        fp.close()
-        
-        '''generate __init__.py'''
-        initCmdsList += '"cloudstackAPIClient"]'
-        fp = open(self.outputFolder + '/cloudstackAPI/__init__.py', 'w')
-        fp.write(initCmdsList)
-        fp.close()
-        
-        fp = open(self.outputFolder + '/cloudstackAPI/baseCmd.py', 'w')
-        basecmd = '"""Base Command"""\n'
-        basecmd += 'class baseCmd:\n'
-        basecmd += self.space + 'pass\n'
-        fp.write(basecmd)
-        fp.close()
-        
-        fp = open(self.outputFolder + '/cloudstackAPI/baseResponse.py', 'w')
-        basecmd = '"""Base class for response"""\n'
-        basecmd += 'class baseResponse:\n'
-        basecmd += self.space + 'pass\n'
-        fp.write(basecmd)
-        fp.close()
-        
-    
-    def constructResponse(self, response):
-        paramProperty = cmdParameterProperty()
-        paramProperty.name = getText(response.getElementsByTagName('name'))
-        paramProperty.desc = getText(response.getElementsByTagName('description'))
-        if paramProperty.name.find('(*)') != -1:
-            '''This is a list'''
-            paramProperty.name = paramProperty.name.split('(*)')[0]
-            for subresponse in response.getElementsByTagName('arguments')[0].getElementsByTagName('arg'):
-                subProperty = self.constructResponse(subresponse)
-                paramProperty.subProperties.append(subProperty)
-        return paramProperty
-
-    def loadCmdFromXML(self):
-        dom = xml.dom.minidom.parse(self.apiSpecFile)
-        cmds = []
-        for cmd in dom.getElementsByTagName("command"):
-            csCmd = cloudStackCmd()
-            csCmd.name = getText(cmd.getElementsByTagName('name'))
-            assert csCmd.name
-        
-            desc = getText(cmd.getElementsByTagName('description'))
-            if desc: 
-                csCmd.desc = desc
-    
-            async = getText(cmd.getElementsByTagName('isAsync'))
-            if async:
-                csCmd.async = async
-        
-            for param in cmd.getElementsByTagName("request")[0].getElementsByTagName("arg"):
-                paramProperty = cmdParameterProperty()
-            
-                paramProperty.name = getText(param.getElementsByTagName('name'))
-                assert paramProperty.name
-            
-                required = param.getElementsByTagName('required')
-                if required:
-                    paramProperty.required = getText(required)
-            
-                requestDescription = param.getElementsByTagName('description')
-                if requestDescription:            
-                    paramProperty.desc = getText(requestDescription)
-            
-                type = param.getElementsByTagName("type")
-                if type:
-                    paramProperty.type = getText(type)
-                
-                csCmd.request.append(paramProperty)
-        
-            responseEle = cmd.getElementsByTagName("response")[0]
-            for response in responseEle.getElementsByTagName("arg"):
-                if response.parentNode != responseEle:
-                    continue
-            
-                paramProperty = self.constructResponse(response)
-                csCmd.response.append(paramProperty)
-            
-            cmds.append(csCmd)
-        return cmds
-    
-    def generateCode(self):
-        cmds = self.loadCmdFromXML()
-        for cmd in cmds:
-            self.generate(cmd)
-        self.finalize()
-
-def getText(elements):
-    return elements[0].childNodes[0].nodeValue.strip()
-
-if __name__ == "__main__":
-    parser = OptionParser()
-  
-    parser.add_option("-o", "--output", dest="output", help="the root path where code genereted, default is .")
-    parser.add_option("-s", "--specfile", dest="spec", help="the path and name of the api spec xml file, default is /etc/cloud/cli/commands.xml")
-    
-    (options, args) = parser.parse_args()
-    
-    apiSpecFile = "/etc/cloud/cli/commands.xml"
-    if options.spec is not None:
-        apiSpecFile = options.spec
-    
-    if not os.path.exists(apiSpecFile):
-        print "the spec file %s does not exists"%apiSpecFile
-        print parser.print_help()
-        exit(1)
-    
-
-    folder = "."
-    if options.output is not None:
-        folder = options.output
-    apiModule=folder + "/cloudstackAPI"
-    if not os.path.exists(apiModule):
-        try:
-            os.mkdir(apiModule)
-        except:
-            print "Failed to create folder %s, due to %s"%(apiModule,sys.exc_info())
-            print parser.print_help()
-            exit(2)
-    
-    cg = codeGenerator(folder, apiSpecFile)
-    cg.generateCode()
-    

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/configGenerator.py
----------------------------------------------------------------------
diff --git a/tools/testClient/configGenerator.py b/tools/testClient/configGenerator.py
deleted file mode 100644
index 52373bf..0000000
--- a/tools/testClient/configGenerator.py
+++ /dev/null
@@ -1,396 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-import json
-import os
-from optparse import OptionParser
-import jsonHelper
-
-class managementServer():
-    def __init__(self):
-        self.mgtSvrIp = None
-        self.port = 8096
-        self.apiKey = None
-        self.securityKey = None
-        
-class dbServer():
-    def __init__(self):
-        self.dbSvr = None
-        self.port = 3306
-        self.user = "cloud"
-        self.passwd = "cloud"
-        self.db = "cloud"
-
-class configuration():
-    def __init__(self):
-        self.name = None
-        self.value = None
-
-class logger():
-    def __init__(self):
-        '''TestCase/TestClient'''
-        self.name = None
-        self.file = None
-
-class cloudstackConfiguration():
-    def __init__(self):
-        self.zones = []
-        self.mgtSvr = []
-        self.dbSvr = None
-        self.globalConfig = []
-        self.logger = []
-
-class zone():
-    def __init__(self):
-        self.dns1 = None
-        self.internaldns1 = None
-        self.name = None
-        '''Basic or Advanced'''
-        self.networktype = None
-        self.dns2 = None
-        self.internaldns2 = None
-        self.securitygroupenabled = None
-        ''' Guest Vlan range - only advanced zone'''
-        self.vlan = None
-        '''default public network, in advanced mode'''
-        self.ipranges = []
-        self.networks = []
-        self.pods = []
-        self.secondaryStorages = []
-        '''enable default virtual router provider'''
-        vrouter = provider()
-        vrouter.name = 'VirtualRouter'
-        self.providers = [vrouter]
-        
-class provider():
-    def __init__(self):
-        self.name = None
-        self.state = None
-        self.broadcastdomainrange = 'ZONE'
-        self.zoneid = None
-        self.servicelist = []
-
-class pod():
-    def __init__(self):
-        self.gateway = None
-        self.name = None
-        self.netmask = None
-        self.startip = None
-        self.endip = None
-        self.zoneid = None
-        self.clusters = []
-        '''Used in basic network mode'''
-        self.guestIpRanges = []
-
-class cluster():
-    def __init__(self):
-        self.clustername = None
-        self.clustertype = None
-        self.hypervisor = None
-        self.zoneid = None
-        self.podid = None
-        self.password = None
-        self.url = None
-        self.username = None
-        self.hosts = []
-        self.primaryStorages = []
-  
-class host():
-    def __init__(self):
-        self.hypervisor = None
-        self.password = None
-        self.url = None
-        self.username = None
-        self.zoneid = None
-        self.podid = None
-        self.clusterid = None
-        self.clustername = None
-        self.cpunumber = None
-        self.cpuspeed = None
-        self.hostmac = None
-        self.hosttags = None
-        self.memory = None
-    
-class network():
-    def __init__(self):
-        self.displaytext = None
-        self.name = None
-        self.zoneid = None
-        self.acltype = None
-        self.domainid = None
-        self.networkdomain = None
-        self.networkofferingid = None
-        self.ipranges = []
-      
-class iprange():
-    def __init__(self):
-        '''tagged/untagged'''
-        self.gateway = None
-        self.netmask = None
-        self.startip = None
-        self.endip = None
-        self.vlan = None
-        '''for account specific '''
-        self.account = None
-        self.domain = None
-
-class primaryStorage():
-    def __init__(self):
-        self.name = None
-        self.url = None
-
-class secondaryStorage():
-    def __init__(self):
-        self.url = None
-  
-'''sample code to generate setup configuration file'''
-def describe_setup_in_basic_mode():
-    zs = cloudstackConfiguration()
-    
-    for l in range(1):
-        z = zone()
-        z.dns1 = "8.8.8.8"
-        z.dns2 = "4.4.4.4"
-        z.internaldns1 = "192.168.110.254"
-        z.internaldns2 = "192.168.110.253"
-        z.name = "test"+str(l)
-        z.networktype = 'Basic'
-    
-        '''create 10 pods'''
-        for i in range(2):
-            p = pod()
-            p.name = "test" +str(l) + str(i)
-            p.gateway = "192.168.%d.1"%i
-            p.netmask = "255.255.255.0"
-            p.startip = "192.168.%d.150"%i
-            p.endip = "192.168.%d.220"%i
-        
-            '''add two pod guest ip ranges'''
-            for j in range(2):
-                ip = iprange()
-                ip.gateway = p.gateway
-                ip.netmask = p.netmask
-                ip.startip = "192.168.%d.%d"%(i,j*20)
-                ip.endip = "192.168.%d.%d"%(i,j*20+10)
-            
-                p.guestIpRanges.append(ip)
-        
-            '''add 10 clusters'''
-            for j in range(2):
-                c = cluster()
-                c.clustername = "test"+str(l)+str(i) + str(j)
-                c.clustertype = "CloudManaged"
-                c.hypervisor = "Simulator"
-            
-                '''add 10 hosts'''
-                for k in range(2):
-                    h = host()
-                    h.username = "root"
-                    h.password = "password"
-                    memory = 8*1024*1024*1024
-                    localstorage=1*1024*1024*1024*1024
-                    #h.url = "http://sim/%d%d%d%d/cpucore=1&cpuspeed=8000&memory=%d&localstorage=%d"%(l,i,j,k,memory,localstorage)
-                    h.url = "http://sim/%d%d%d%d"%(l,i,j,k)
-                    c.hosts.append(h)
-                
-                '''add 2 primary storages'''
-                for m in range(2):
-                    primary = primaryStorage()
-                    size=1*1024*1024*1024*1024
-                    primary.name = "primary"+str(l) + str(i) + str(j) + str(m)
-                    #primary.url = "nfs://localhost/path%s/size=%d"%(str(l) + str(i) + str(j) + str(m), size)
-                    primary.url = "nfs://localhost/path%s"%(str(l) + str(i) + str(j) + str(m))
-                    c.primaryStorages.append(primary)
-        
-                p.clusters.append(c)
-            
-            z.pods.append(p)
-            
-        '''add two secondary'''
-        for i in range(5):
-            secondary = secondaryStorage()
-            secondary.url = "nfs://localhost/path"+str(l) + str(i)
-            z.secondaryStorages.append(secondary)
-        
-        zs.zones.append(z)
-    
-    '''Add one mgt server'''
-    mgt = managementServer()
-    mgt.mgtSvrIp = "localhost"
-    zs.mgtSvr.append(mgt)
-    
-    '''Add a database'''
-    db = dbServer()
-    db.dbSvr = "localhost"
-    
-    zs.dbSvr = db
-    
-    '''add global configuration'''
-    global_settings = {'expunge.delay': '60',
-                       'expunge.interval': '60',
-                       'expunge.workers': '3',
-                       }
-    for k,v in global_settings.iteritems():
-        cfg = configuration()
-        cfg.name = k
-        cfg.value = v
-        zs.globalConfig.append(cfg)
-    
-    ''''add loggers'''
-    testClientLogger = logger()
-    testClientLogger.name = "TestClient"
-    testClientLogger.file = "/tmp/testclient.log"
-    
-    testCaseLogger = logger()
-    testCaseLogger.name = "TestCase"
-    testCaseLogger.file = "/tmp/testcase.log"
-    
-    zs.logger.append(testClientLogger)
-    zs.logger.append(testCaseLogger)
-    
-    return zs
-
-'''sample code to generate setup configuration file'''
-def describe_setup_in_advanced_mode():
-    zs = cloudstackConfiguration()
-    
-    for l in range(1):
-        z = zone()
-        z.dns1 = "8.8.8.8"
-        z.dns2 = "4.4.4.4"
-        z.internaldns1 = "192.168.110.254"
-        z.internaldns2 = "192.168.110.253"
-        z.name = "test"+str(l)
-        z.networktype = 'Advanced'
-        z.guestcidraddress = "10.1.1.0/24"
-        z.vlan = "100-2000"
-    
-        '''create 10 pods'''
-        for i in range(2):
-            p = pod()
-            p.name = "test" +str(l) + str(i)
-            p.gateway = "192.168.%d.1"%i
-            p.netmask = "255.255.255.0"
-            p.startip = "192.168.%d.200"%i
-            p.endip = "192.168.%d.220"%i
-        
-            '''add 10 clusters'''
-            for j in range(2):
-                c = cluster()
-                c.clustername = "test"+str(l)+str(i) + str(j)
-                c.clustertype = "CloudManaged"
-                c.hypervisor = "Simulator"
-            
-                '''add 10 hosts'''
-                for k in range(2):
-                    h = host()
-                    h.username = "root"
-                    h.password = "password"
-                    memory = 8*1024*1024*1024
-                    localstorage=1*1024*1024*1024*1024
-                    #h.url = "http://sim/%d%d%d%d/cpucore=1&cpuspeed=8000&memory=%d&localstorage=%d"%(l,i,j,k,memory,localstorage)
-                    h.url = "http://sim/%d%d%d%d"%(l,i,j,k)
-                    c.hosts.append(h)
-                
-                '''add 2 primary storages'''
-                for m in range(2):
-                    primary = primaryStorage()
-                    size=1*1024*1024*1024*1024
-                    primary.name = "primary"+str(l) + str(i) + str(j) + str(m)
-                    #primary.url = "nfs://localhost/path%s/size=%d"%(str(l) + str(i) + str(j) + str(m), size)
-                    primary.url = "nfs://localhost/path%s"%(str(l) + str(i) + str(j) + str(m))
-                    c.primaryStorages.append(primary)
-        
-                p.clusters.append(c)
-            
-            z.pods.append(p)
-            
-        '''add two secondary'''
-        for i in range(5):
-            secondary = secondaryStorage()
-            secondary.url = "nfs://localhost/path"+str(l) + str(i)
-            z.secondaryStorages.append(secondary)
-        
-        '''add default public network'''
-        ips = iprange()
-        ips.vlan = "26"
-        ips.startip = "172.16.26.2"
-        ips.endip = "172.16.26.100"
-        ips.gateway = "172.16.26.1"
-        ips.netmask = "255.255.255.0"
-        z.ipranges.append(ips)
-        
-        
-        zs.zones.append(z)
-    
-    '''Add one mgt server'''
-    mgt = managementServer()
-    mgt.mgtSvrIp = "localhost"
-    zs.mgtSvr.append(mgt)
-    
-    '''Add a database'''
-    db = dbServer()
-    db.dbSvr = "localhost"
-    
-    zs.dbSvr = db
-    
-    '''add global configuration'''
-    global_settings = {'expunge.delay': '60',
-                       'expunge.interval': '60',
-                       'expunge.workers': '3',
-                       }
-    for k,v in global_settings.iteritems():
-        cfg = configuration()
-        cfg.name = k
-        cfg.value = v
-        zs.globalConfig.append(cfg)
-    
-    ''''add loggers'''
-    testClientLogger = logger()
-    testClientLogger.name = "TestClient"
-    testClientLogger.file = "/tmp/testclient.log"
-    
-    testCaseLogger = logger()
-    testCaseLogger.name = "TestCase"
-    testCaseLogger.file = "/tmp/testcase.log"
-    
-    zs.logger.append(testClientLogger)
-    zs.logger.append(testCaseLogger)
-    
-    return zs
-
-def generate_setup_config(config, file=None):
-    describe = config
-    if file is None:
-        return json.dumps(jsonHelper.jsonDump.dump(describe))
-    else:
-        fp = open(file, 'w')
-        json.dump(jsonHelper.jsonDump.dump(describe), fp, indent=4)
-        fp.close()
-        
-    
-def get_setup_config(file):
-    if not os.path.exists(file):
-        return None
-    config = cloudstackConfiguration()
-    fp = open(file, 'r')
-    config = json.load(fp)
-    return jsonHelper.jsonLoader(config)
-
-if __name__ == "__main__":
-    parser = OptionParser()
-  
-    parser.add_option("-o", "--output", action="store", default="./datacenterCfg", dest="output", help="the path where the json config file generated, by default is ./datacenterCfg")
-    
-    (options, args) = parser.parse_args()
-    config = describe_setup_in_advanced_mode()
-    generate_setup_config(config, options.output)

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/dbConnection.py
----------------------------------------------------------------------
diff --git a/tools/testClient/dbConnection.py b/tools/testClient/dbConnection.py
deleted file mode 100644
index afe5be5..0000000
--- a/tools/testClient/dbConnection.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-import pymysql
-import cloudstackException
-import sys
-import os
-import traceback
-class dbConnection(object):
-    def __init__(self, host="localhost", port=3306, user='cloud', passwd='cloud', db='cloud'):
-        self.host = host
-        self.port = port
-        self.user = user
-        self.passwd = passwd
-        self.database = db
-        
-        try:
-            self.db = pymysql.Connect(host=host, port=port, user=user, passwd=passwd, db=db)
-        except:
-            traceback.print_exc()
-            raise cloudstackException.InvalidParameterException(sys.exc_info())
-        
-    def __copy__(self):
-        return dbConnection(self.host, self.port, self.user, self.passwd, self.database)
-    
-    def close(self):
-        try:
-            self.db.close()
-        except:
-            pass
-    
-    def execute(self, sql=None):
-        if sql is None:
-            return None
-        
-        resultRow = []
-        cursor = None
-        try:
-            # commit to restart the transaction, else we don't get fresh data
-            self.db.commit()
-            cursor = self.db.cursor()
-            cursor.execute(sql)
-        
-            result = cursor.fetchall()
-            if result is not None:
-                for r in result:
-                    resultRow.append(r)
-            return resultRow
-        except pymysql.MySQLError, e:
-            raise cloudstackException.dbException("db Exception:%s"%e) 
-        except:
-            raise cloudstackException.internalError(sys.exc_info())
-        finally:
-            if cursor is not None:
-                cursor.close()
-        
-    def executeSqlFromFile(self, fileName=None):
-        if fileName is None:
-            raise cloudstackException.InvalidParameterException("file can't not none")
-        
-        if not os.path.exists(fileName):
-            raise cloudstackException.InvalidParameterException("%s not exists"%fileName)
-        
-        sqls = open(fileName, "r").read()
-        return self.execute(sqls)
-    
-if __name__ == "__main__":
-    db = dbConnection()
-    '''
-    try:
-     
-        result = db.executeSqlFromFile("/tmp/server-setup.sql")
-        if result is not None:
-            for r in result:
-                print r[0], r[1]
-    except cloudstackException.dbException, e:
-        print e
-    '''
-    print db.execute("update vm_template set name='fjkd' where id=200")
-    for i in range(10):
-        result = db.execute("select job_status, created, last_updated from async_job where id=%d"%i)
-        print result
-

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/demo/README
----------------------------------------------------------------------
diff --git a/tools/testClient/demo/README b/tools/testClient/demo/README
deleted file mode 100644
index 650ea05..0000000
--- a/tools/testClient/demo/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Demo files for use with the tutorial on "Testing with Python".
-
-testDeployVM.py - to be run against a 2.2.y installation of management server
-testSshDeployVM.py - to be run against a 3.0.x installation of management server

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/demo/demo.cfg
----------------------------------------------------------------------
diff --git a/tools/testClient/demo/demo.cfg b/tools/testClient/demo/demo.cfg
deleted file mode 100644
index a24793e..0000000
--- a/tools/testClient/demo/demo.cfg
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-    "dbSvr": {
-        "dbSvr": "automation", 
-        "passwd": "cloud", 
-        "db": "cloud", 
-        "port": 3306, 
-        "user": "cloud"
-    }, 
-    "logger": [
-        {
-            "name": "TestClient", 
-            "file": "/var/log/testclient.log"
-        }, 
-        {
-            "name": "TestCase", 
-            "file": "/var/log/testcase.log"
-        }
-    ], 
-    "mgtSvr": [
-        {
-            "mgtSvrIp": "automation", 
-            "port": 8096
-        }
-    ]
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/demo/testDeployVM.py
----------------------------------------------------------------------
diff --git a/tools/testClient/demo/testDeployVM.py b/tools/testClient/demo/testDeployVM.py
deleted file mode 100644
index 4afaee3..0000000
--- a/tools/testClient/demo/testDeployVM.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-
-from cloudstackTestCase import *
-
-import unittest
-import hashlib
-import random
-
-class TestDeployVm(cloudstackTestCase):
-    """
-    This test deploys a virtual machine into a user account 
-    using the small service offering and builtin template
-    """
-    def setUp(self):
-        """
-        CloudStack internally saves its passwords in md5 form and that is how we
-        specify it in the API. Python's hashlib library helps us to quickly hash
-        strings as follows
-        """
-        mdf = hashlib.md5()
-        mdf.update('password')
-        mdf_pass = mdf.hexdigest()
-
-        self.apiClient = self.testClient.getApiClient() #Get ourselves an API client
-
-        self.acct = createAccount.createAccountCmd() #The createAccount command
-        self.acct.accounttype = 0                    #We need a regular user. admins have accounttype=1
-        self.acct.firstname = 'bugs'                 
-        self.acct.lastname = 'bunny'                 #What's up doc?
-        self.acct.password = mdf_pass                #The md5 hashed password string
-        self.acct.username = 'bugs'
-        self.acct.email = 'bugs@rabbithole.com'
-        self.acct.account = 'bugs'
-        self.acct.domainid = 1                       #The default ROOT domain
-        self.acctResponse = self.apiClient.createAccount(self.acct)
-        #And upon successful creation we'll log a helpful message in our logs
-        self.debug("successfully created account: %s, user: %s, id: \
-                   %s"%(self.acctResponse.account.account, \
-                        self.acctResponse.account.username, \
-                        self.acctResponse.account.id))
-
-    def test_DeployVm(self):
-        """
-        Let's start by defining the attributes of our VM that we will be
-        deploying on CloudStack. We will be assuming a single zone is available
-        and is configured and all templates are Ready
-
-        The hardcoded values are used only for brevity. 
-        """
-        deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
-        deployVmCmd.zoneid = 1
-        deployVmCmd.account = self.acct.account
-        deployVmCmd.domainid = self.acct.domainid
-        deployVmCmd.templateid = 2
-        deployVmCmd.serviceofferingid = 1
-
-        deployVmResponse = self.apiClient.deployVirtualMachine(deployVmCmd)
-        self.debug("VM %s was deployed in the job %s"%(deployVmResponse.id, deployVmResponse.jobid))
-
-        # At this point our VM is expected to be Running. Let's find out what
-        # listVirtualMachines tells us about VMs in this account
-
-        listVmCmd = listVirtualMachines.listVirtualMachinesCmd()
-        listVmCmd.id = deployVmResponse.id
-        listVmResponse = self.apiClient.listVirtualMachines(listVmCmd)
-
-        self.assertNotEqual(len(listVmResponse), 0, "Check if the list API \
-                            returns a non-empty response")
-
-        vm = listVmResponse[0]
-
-        self.assertEqual(vm.id, deployVmResponse.id, "Check if the VM returned \
-                         is the same as the one we deployed")
-
-
-        self.assertEqual(vm.state, "Running", "Check if VM has reached \
-                         a state of running")
-
-    def tearDown(self):
-        """
-        And finally let us cleanup the resources we created by deleting the
-        account. All good unittests are atomic and rerunnable this way
-        """
-        deleteAcct = deleteAccount.deleteAccountCmd()
-        deleteAcct.id = self.acctResponse.account.id
-        self.apiClient.deleteAccount(deleteAcct)

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/demo/testSshDeployVM.py
----------------------------------------------------------------------
diff --git a/tools/testClient/demo/testSshDeployVM.py b/tools/testClient/demo/testSshDeployVM.py
deleted file mode 100644
index 106f693..0000000
--- a/tools/testClient/demo/testSshDeployVM.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-
-
-
-from cloudstackTestCase import *
-from remoteSSHClient import remoteSSHClient 
-
-import unittest
-import hashlib
-import random
-import string
-
-class TestDeployVm(cloudstackTestCase):
-    """
-    This test deploys a virtual machine into a user account 
-    using the small service offering and builtin template
-    """
-    @classmethod
-    def setUpClass(cls):
-        """
-        CloudStack internally saves its passwords in md5 form and that is how we
-        specify it in the API. Python's hashlib library helps us to quickly hash
-        strings as follows
-        """
-        mdf = hashlib.md5()
-        mdf.update('password')
-        mdf_pass = mdf.hexdigest()
-        acctName = 'bugs-'+''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(6)) #randomly generated account
-
-        cls.apiClient = super(TestDeployVm, cls).getClsTestClient().getApiClient() 
-        cls.acct = createAccount.createAccountCmd() #The createAccount command
-        cls.acct.accounttype = 0                    #We need a regular user. admins have accounttype=1
-        cls.acct.firstname = 'bugs'                 
-        cls.acct.lastname = 'bunny'                 #What's up doc?
-        cls.acct.password = mdf_pass                #The md5 hashed password string
-        cls.acct.username = acctName
-        cls.acct.email = 'bugs@rabbithole.com'
-        cls.acct.account = acctName
-        cls.acct.domainid = 1                       #The default ROOT domain
-        cls.acctResponse = cls.apiClient.createAccount(cls.acct)
-        
-    def setUpNAT(self, virtualmachineid):
-        listSourceNat = listPublicIpAddresses.listPublicIpAddressesCmd()
-        listSourceNat.account = self.acct.account
-        listSourceNat.domainid = self.acct.domainid
-        listSourceNat.issourcenat = True
-        
-        listsnatresponse = self.apiClient.listPublicIpAddresses(listSourceNat)
-        self.assertNotEqual(len(listsnatresponse), 0, "Found a source NAT for the acct %s"%self.acct.account)
-        
-        snatid = listsnatresponse[0].id
-        snatip = listsnatresponse[0].ipaddress
-        
-        try:
-            createFwRule = createFirewallRule.createFirewallRuleCmd()
-            createFwRule.cidrlist = "0.0.0.0/0"
-            createFwRule.startport = 22
-            createFwRule.endport = 22
-            createFwRule.ipaddressid = snatid
-            createFwRule.protocol = "tcp"
-            createfwresponse = self.apiClient.createFirewallRule(createFwRule)
-            
-            createPfRule = createPortForwardingRule.createPortForwardingRuleCmd()
-            createPfRule.privateport = 22
-            createPfRule.publicport = 22
-            createPfRule.virtualmachineid = virtualmachineid
-            createPfRule.ipaddressid = snatid
-            createPfRule.protocol = "tcp"
-            
-            createpfresponse = self.apiClient.createPortForwardingRule(createPfRule)
-        except e:
-            self.debug("Failed to create PF rule in account %s due to %s"%(self.acct.account, e))
-            raise e
-        finally:
-            return snatip        
-
-    def test_DeployVm(self):
-        """
-        Let's start by defining the attributes of our VM that we will be
-        deploying on CloudStack. We will be assuming a single zone is available
-        and is configured and all templates are Ready
-
-        The hardcoded values are used only for brevity. 
-        """
-        deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
-        deployVmCmd.zoneid = 1
-        deployVmCmd.account = self.acct.account
-        deployVmCmd.domainid = self.acct.domainid
-        deployVmCmd.templateid = 5 #CentOS 5.6 builtin
-        deployVmCmd.serviceofferingid = 1
-
-        deployVmResponse = self.apiClient.deployVirtualMachine(deployVmCmd)
-        self.debug("VM %s was deployed in the job %s"%(deployVmResponse.id, deployVmResponse.jobid))
-
-        # At this point our VM is expected to be Running. Let's find out what
-        # listVirtualMachines tells us about VMs in this account
-
-        listVmCmd = listVirtualMachines.listVirtualMachinesCmd()
-        listVmCmd.id = deployVmResponse.id
-        listVmResponse = self.apiClient.listVirtualMachines(listVmCmd)
-
-        self.assertNotEqual(len(listVmResponse), 0, "Check if the list API \
-                            returns a non-empty response")
-
-        vm = listVmResponse[0]
-        hostname = vm.name
-        nattedip = self.setUpNAT(vm.id)
-
-        self.assertEqual(vm.id, deployVmResponse.id, "Check if the VM returned \
-                         is the same as the one we deployed")
-
-
-        self.assertEqual(vm.state, "Running", "Check if VM has reached \
-                         a state of running")
-
-        # SSH login and compare hostname        
-        ssh_client = remoteSSHClient(nattedip, 22, "root", "password")
-        stdout = ssh_client.execute("hostname")
-        
-        self.assertEqual(hostname, stdout[0], "cloudstack VM name and hostname match")
-
-
-    @classmethod
-    def tearDownClass(cls):
-        """
-        And finally let us cleanup the resources we created by deleting the
-        account. All good unittests are atomic and rerunnable this way
-        """
-        deleteAcct = deleteAccount.deleteAccountCmd()
-        deleteAcct.id = cls.acctResponse.account.id
-        cls.apiClient.deleteAccount(deleteAcct)

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/deployAndRun.py
----------------------------------------------------------------------
diff --git a/tools/testClient/deployAndRun.py b/tools/testClient/deployAndRun.py
deleted file mode 100644
index b91453c..0000000
--- a/tools/testClient/deployAndRun.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-import deployDataCenter
-import TestCaseExecuteEngine
-from optparse import OptionParser
-import os
-if __name__ == "__main__":
-    parser = OptionParser()
-  
-    parser.add_option("-c", "--config", action="store", default="./datacenterCfg", dest="config", help="the path where the json config file generated, by default is ./datacenterCfg")
-    parser.add_option("-d", "--directory", dest="testCaseFolder", help="the test case directory")
-    parser.add_option("-r", "--result", dest="result", help="test result log file")
-    parser.add_option("-t", dest="testcaselog", help="test case log file")
-    parser.add_option("-l", "--load", dest="load", action="store_true", help="only load config, do not deploy, it will only run testcase")
-    (options, args) = parser.parse_args()
-    if options.testCaseFolder is None:
-        parser.print_usage()
-        exit(1)
-        
-    testResultLogFile = None
-    if options.result is not None:
-        testResultLogFile = options.result
-    
-    testCaseLogFile = None
-    if options.testcaselog is not None:
-        testCaseLogFile = options.testcaselog
-    deploy = deployDataCenter.deployDataCenters(options.config)    
-    if options.load:
-        deploy.loadCfg()
-    else:
-        deploy.deploy()
-    
-    testcaseEngine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient, options.testCaseFolder, testCaseLogFile, testResultLogFile)
-    testcaseEngine.run()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/testClient/deployDataCenter.py b/tools/testClient/deployDataCenter.py
deleted file mode 100644
index aa40b00..0000000
--- a/tools/testClient/deployDataCenter.py
+++ /dev/null
@@ -1,395 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-"""Deploy datacenters according to a json configuration file"""
-import configGenerator
-import cloudstackException
-import cloudstackTestClient
-import sys
-import logging
-from cloudstackAPI import *
-from optparse import OptionParser
-
-class deployDataCenters():
-
-    def __init__(self, cfgFile):
-        self.configFile = cfgFile
-
-    def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
-        if hosts is None:
-            return
-        for host in hosts:
-            hostcmd = addHost.addHostCmd()
-            hostcmd.clusterid = clusterId
-            hostcmd.cpunumber = host.cpunumer
-            hostcmd.cpuspeed = host.cpuspeed
-            hostcmd.hostmac = host.hostmac
-            hostcmd.hosttags = host.hosttags
-            hostcmd.hypervisor = host.hypervisor
-            hostcmd.memory = host.memory
-            hostcmd.password = host.password
-            hostcmd.podid = podId
-            hostcmd.url = host.url
-            hostcmd.username = host.username
-            hostcmd.zoneid = zoneId
-            hostcmd.hypervisor = hypervisor
-            self.apiClient.addHost(hostcmd)
-
-    def createClusters(self, clusters, zoneId, podId):
-        if clusters is None:
-            return
-
-        for cluster in clusters:
-            clustercmd = addCluster.addClusterCmd()
-            clustercmd.clustername = cluster.clustername
-            clustercmd.clustertype = cluster.clustertype
-            clustercmd.hypervisor = cluster.hypervisor
-            clustercmd.password = cluster.password
-            clustercmd.podid = podId
-            clustercmd.url = cluster.url
-            clustercmd.username = cluster.username
-            clustercmd.zoneid = zoneId
-            clusterresponse = self.apiClient.addCluster(clustercmd)
-            clusterId = clusterresponse[0].id
-
-            self.addHosts(cluster.hosts, zoneId, podId, clusterId,\
-                          cluster.hypervisor)
-            self.createPrimaryStorages(cluster.primaryStorages, zoneId, podId,\
-                                       clusterId)
-
-    def createPrimaryStorages(self, primaryStorages, zoneId, podId, clusterId):
-        if primaryStorages is None:
-            return
-        for primary in primaryStorages:
-            primarycmd = createStoragePool.createStoragePoolCmd()
-            primarycmd.details = primary.details
-            primarycmd.name = primary.name
-            primarycmd.podid = podId
-            primarycmd.tags = primary.tags
-            primarycmd.url = primary.url
-            primarycmd.zoneid = zoneId
-            primarycmd.clusterid = clusterId
-            self.apiClient.createStoragePool(primarycmd)
-
-    def createpods(self, pods, zone, zoneId):
-        if pods is None:
-            return
-        for pod in pods:
-            createpod = createPod.createPodCmd()
-            createpod.name = pod.name
-            createpod.gateway = pod.gateway
-            createpod.netmask = pod.netmask
-            createpod.startip = pod.startip
-            createpod.endip = pod.endip
-            createpod.zoneid = zoneId
-            createpodResponse = self.apiClient.createPod(createpod)
-            podId = createpodResponse.id
-
-            if pod.guestIpRanges is not None:
-                self.createVlanIpRanges("Basic", pod.guestIpRanges, zoneId,\
-                                        podId)
-
-            self.createClusters(pod.clusters, zoneId, podId)
-
-    def createVlanIpRanges(self, mode, ipranges, zoneId, podId=None,\
-                           networkId=None):
-        if ipranges is None:
-            return
-        for iprange in ipranges:
-            vlanipcmd = createVlanIpRange.createVlanIpRangeCmd()
-            vlanipcmd.account = iprange.account
-            vlanipcmd.domainid = iprange.domainid
-            vlanipcmd.endip = iprange.endip
-            vlanipcmd.gateway = iprange.gateway
-            vlanipcmd.netmask = iprange.netmask
-            vlanipcmd.networkid = networkId
-            vlanipcmd.podid = podId
-            vlanipcmd.startip = iprange.startip
-            vlanipcmd.zoneid = zoneId
-            vlanipcmd.vlan = iprange.vlan
-            if mode == "Basic":
-                vlanipcmd.forvirtualnetwork = "false"
-            else:
-                vlanipcmd.forvirtualnetwork = "true"
-
-            self.apiClient.createVlanIpRange(vlanipcmd)
-
-    def createSecondaryStorages(self, secondaryStorages, zoneId):
-        if secondaryStorages is None:
-            return
-        for secondary in secondaryStorages:
-            secondarycmd = addSecondaryStorage.addSecondaryStorageCmd()
-            secondarycmd.url = secondary.url
-            secondarycmd.zoneid = zoneId
-            self.apiClient.addSecondaryStorage(secondarycmd)
-
-    def createnetworks(self, networks, zoneId, mode):
-        if networks is None:
-            return
-        for network in networks:
-            networkcmd = createNetwork.createNetworkCmd()
-            networkcmd.displaytext = network.displaytext
-            networkcmd.name = network.name
-            networkcmd.networkofferingid = network.networkofferingid
-            networkcmd.zoneid = zoneId
-
-            ipranges = network.ipranges
-            if ipranges:
-                iprange = ipranges.pop()
-                networkcmd.startip = iprange.startip
-                networkcmd.endip = iprange.endip
-                networkcmd.gateway = iprange.gateway
-                networkcmd.netmask = iprange.netmask
-
-            networkcmdresponse = self.apiClient.createNetwork(networkcmd)
-            networkId = networkcmdresponse.id
-
-            self.createVlanIpRanges(mode, ipranges, zoneId, networkId)
-
-    def createPhysicalNetwork(self, name, zoneid, vlan=None):
-        phynet = createPhysicalNetwork.createPhysicalNetworkCmd()
-        phynet.zoneid = zoneid
-        phynet.name = name
-        if vlan:
-            phynet.vlan = vlan
-        return self.apiClient.createPhysicalNetwork(phynet)
-
-    def updatePhysicalNetwork(self, networkid, state="Enabled", vlan=None):
-        upnet = updatePhysicalNetwork.updatePhysicalNetworkCmd()
-        upnet.id = networkid
-        upnet.state = state
-        if vlan:
-            upnet.vlan = vlan
-        return self.apiClient.updatePhysicalNetwork(upnet)
-
-    def configureProviders(self, phynetwrk, zone):
-        pnetprov = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
-        pnetprov.physicalnetworkid = phynetwrk.id
-        pnetprov.state = "Disabled"
-        pnetprov.name = "VirtualRouter"
-        pnetprovres = self.apiClient.listNetworkServiceProviders(pnetprov)
-
-        vrprov = listVirtualRouterElements.listVirtualRouterElementsCmd()
-        vrprov.nspid = pnetprovres[0].id
-        vrprovresponse = self.apiClient.listVirtualRouterElements(vrprov)
-        vrprovid = vrprovresponse[0].id
-
-        vrconfig = \
-        configureVirtualRouterElement.configureVirtualRouterElementCmd()
-        vrconfig.enabled = "true"
-        vrconfig.id = vrprovid
-        vrconfigresponse = \
-        self.apiClient.configureVirtualRouterElement(vrconfig)
-
-        if zone.networktype == "Basic" and zone.securitygroupenabled:
-            sgprovider = configGenerator.provider()
-            sgprovider.name = "SecurityGroupProvider"
-            zone.providers.append(sgprovider)
-
-        for prov in zone.providers:
-            pnetprov = \
-            listNetworkServiceProviders.listNetworkServiceProvidersCmd()
-            pnetprov.physicalnetworkid = phynetwrk.id
-            pnetprov.name = prov.name
-            pnetprov.state = "Disabled"
-            pnetprovs = self.apiClient.listNetworkServiceProviders(pnetprov)
-
-            upnetprov = \
-            updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
-            upnetprov.id = pnetprovs[0].id
-            upnetprov.state = "Enabled"
-            upnetprovresponse = \
-            self.apiClient.updateNetworkServiceProvider(upnetprov)
-
-    def addTrafficTypes(self, physical_network_id, traffictypes=None, \
-                        network_labels=None):
-        [self.addTrafficType(physical_network_id, traffictype) for \
-         traffictype in traffictypes]
-
-    def addTrafficType(self, physical_network_id, traffictype, \
-                       network_label=None):
-        traffic_type = addTrafficType.addTrafficTypeCmd()
-        traffic_type.physicalnetworkid = physical_network_id
-        traffic_type.traffictype = traffictype
-        return self.apiClient.addTrafficType(traffic_type)
-
-    def enableZone(self, zoneid, allocation_state="Enabled"):
-        zoneCmd = updateZone.updateZoneCmd()
-        zoneCmd.id = zoneid
-        zoneCmd.allocationstate = allocation_state
-        return self.apiClient.updateZone(zoneCmd)
-
-    def createZones(self, zones):
-        for zone in zones:
-            createzone = createZone.createZoneCmd()
-            createzone.dns1 = zone.dns1
-            createzone.dns2 = zone.dns2
-            createzone.internaldns1 = zone.internaldns1
-            createzone.internaldns2 = zone.internaldns2
-            createzone.name = zone.name
-            createzone.securitygroupenabled = zone.securitygroupenabled
-            createzone.networktype = zone.networktype
-            createzone.guestcidraddress = zone.guestcidraddress
-
-            zoneresponse = self.apiClient.createZone(createzone)
-            zoneId = zoneresponse.id
-
-            phynetwrk = self.createPhysicalNetwork(zone.name + "-pnet", \
-                                                   zoneId)
-
-            self.addTrafficTypes(phynetwrk.id, ["Guest", "Public", \
-                                                    "Management"])
-
-            self.configureProviders(phynetwrk, zone)
-            self.updatePhysicalNetwork(phynetwrk.id, "Enabled", vlan=zone.vlan)
-
-            if zone.networktype == "Basic":
-                listnetworkoffering = \
-                listNetworkOfferings.listNetworkOfferingsCmd()
-
-                listnetworkoffering.name = \
-                "DefaultSharedNetworkOfferingWithSGService"
-
-                listnetworkofferingresponse = \
-                self.apiClient.listNetworkOfferings(listnetworkoffering)
-
-                guestntwrk = configGenerator.network()
-                guestntwrk.displaytext = "guestNetworkForBasicZone"
-                guestntwrk.name = "guestNetworkForBasicZone"
-                guestntwrk.zoneid = zoneId
-                guestntwrk.networkofferingid = \
-                        listnetworkofferingresponse[0].id
-                self.createnetworks([guestntwrk], zoneId, zone.networktype)
-
-            self.createpods(zone.pods, zone, zoneId)
-
-            if zone.networktype == "Advanced":
-                self.createVlanIpRanges(zone.networktype, zone.ipranges, \
-                                        zoneId)
-
-            self.createSecondaryStorages(zone.secondaryStorages, zoneId)
-            self.enableZone(zoneId, "Enabled")
-        return
-
-    def registerApiKey(self):
-        listuser = listUsers.listUsersCmd()
-        listuser.account = "admin"
-        listuserRes = self.testClient.getApiClient().listUsers(listuser)
-        userId = listuserRes[0].id
-        apiKey = listuserRes[0].apikey
-        securityKey = listuserRes[0].secretkey
-        if apiKey is None:
-            registerUser = registerUserKeys.registerUserKeysCmd()
-            registerUser.id = userId
-            registerUserRes = \
-            self.testClient.getApiClient().registerUserKeys(registerUser)
-
-            apiKey = registerUserRes.apikey
-            securityKey = registerUserRes.secretkey
-
-        self.config.mgtSvr[0].port = 8080
-        self.config.mgtSvr[0].apiKey = apiKey
-        self.config.mgtSvr[0].securityKey = securityKey
-        return apiKey, securityKey
-
-    def loadCfg(self):
-        try:
-            self.config = configGenerator.get_setup_config(self.configFile)
-        except:
-            raise cloudstackException.InvalidParameterException( \
-                            "Failed to load config %s" %sys.exc_info())
-
-        mgt = self.config.mgtSvr[0]
-
-        loggers = self.config.logger
-        testClientLogFile = None
-        self.testCaseLogFile = None
-        self.testResultLogFile = None
-        if loggers is not None and len(loggers) > 0:
-            for log in loggers:
-                if log.name == "TestClient":
-                    testClientLogFile = log.file
-                elif log.name == "TestCase":
-                    self.testCaseLogFile = log.file
-                elif log.name == "TestResult":
-                    self.testResultLogFile = log.file
-
-        testClientLogger = None
-        if testClientLogFile is not None:
-            testClientLogger = logging.getLogger("testclient.testengine.run")
-            fh = logging.FileHandler(testClientLogFile)
-            fh.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s"))
-            testClientLogger.addHandler(fh)
-            testClientLogger.setLevel(logging.INFO)
-        self.testClientLogger = testClientLogger
-
-        self.testClient = \
-        cloudstackTestClient.cloudstackTestClient(mgt.mgtSvrIp, mgt.port, \
-                                                  mgt.apiKey, \
-                                                  mgt.securityKey, \
-                                            logging=self.testClientLogger)
-        if mgt.apiKey is None:
-            apiKey, securityKey = self.registerApiKey()
-            self.testClient.close()
-            self.testClient = \
-            cloudstackTestClient.cloudstackTestClient(mgt.mgtSvrIp, 8080, \
-                                                      apiKey, securityKey, \
-                                             logging=self.testClientLogger)
-
-        """config database"""
-        dbSvr = self.config.dbSvr
-        self.testClient.dbConfigure(dbSvr.dbSvr, dbSvr.port, dbSvr.user, \
-                                    dbSvr.passwd, dbSvr.db)
-        self.apiClient = self.testClient.getApiClient()
-
-    def updateConfiguration(self, globalCfg):
-        if globalCfg is None:
-            return None
-
-        for config in globalCfg:
-            updateCfg = updateConfiguration.updateConfigurationCmd()
-            updateCfg.name = config.name
-            updateCfg.value = config.value
-            self.apiClient.updateConfiguration(updateCfg)
-
-    def deploy(self):
-        self.loadCfg()
-        self.createZones(self.config.zones)
-        self.updateConfiguration(self.config.globalConfig)
-
-
-if __name__ == "__main__":
-
-    parser = OptionParser()
-
-    parser.add_option("-i", "--intput", action="store", \
-                      default="./datacenterCfg", dest="input", help="the path \
-                      where the json config file generated, by default is \
-                      ./datacenterCfg")
-
-    (options, args) = parser.parse_args()
-
-    deploy = deployDataCenters(options.input)
-    deploy.deploy()
-
-    """
-    create = createStoragePool.createStoragePoolCmd()
-    create.clusterid = 1
-    create.podid = 2
-    create.name = "fdffdf"
-    create.url = "nfs://jfkdjf/fdkjfkd"
-    create.zoneid = 2
-
-    deploy = deployDataCenters("./datacenterCfg")
-    deploy.loadCfg()
-    deploy.apiClient.createStoragePool(create)
-    """


Mime
View raw message