You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/09/10 22:55:52 UTC

[23/50] [abbrv] git commit: Remove /tools/test which is taken over by /tools/marvin

Remove /tools/test which is taken over by /tools/marvin

Signed-off-by: Mice Xia <mi...@tcloudcomputing.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/073a9154
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/073a9154
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/073a9154

Branch: refs/heads/4.0
Commit: 073a91544f0914595af69a677c12c2a5c69362c4
Parents: 07592cc
Author: Sebastien Goasguen <ru...@gmail.com>
Authored: Mon Sep 10 10:23:34 2012 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Mon Sep 10 10:37:37 2012 +0800

----------------------------------------------------------------------
 tools/test/apisession.py       |   68 ------------------------------
 tools/test/cloudkit.py         |   78 -----------------------------------
 tools/test/db.py               |   35 ----------------
 tools/test/globalconfig.py     |   35 ----------------
 tools/test/physicalresource.py |   71 -------------------------------
 tools/test/vm.py               |   69 -------------------------------
 tools/test/vmcreate.py         |   36 ----------------
 7 files changed, 0 insertions(+), 392 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/073a9154/tools/test/apisession.py
----------------------------------------------------------------------
diff --git a/tools/test/apisession.py b/tools/test/apisession.py
deleted file mode 100644
index bdeae53..0000000
--- a/tools/test/apisession.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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 cookielib
-import hashlib
-import json
-import os
-import random
-import sys
-import urllib2
-import urllib
-
-
-class ApiSession:
-    """an ApiSession represents one api session, with cookies."""
-    def __init__(self, url, username, password):
-        self._username = username
-        self._password = hashlib.md5(password).hexdigest()
-        self._url = url
-        self._cj = cookielib.CookieJar()
-        self._opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cj))
-
-    def _get(self, parameters):
-        encoded = urllib.urlencode(parameters)
-        url = "%s?%s"% (self._url, encoded)
-        try:
-           f = self._opener.open(url)
-           return f.read()
-        except urllib2.HTTPError as exn:
-            print "Command %s failed" % parameters['command']
-            print "Reason: %s" % json.loads(exn.read())
-
-    def GET(self, parameters):
-        parameters['sessionkey'] = self._sessionkey
-        parameters['response'] = 'json'
-        return self._get(parameters)
-        
-    def _post(self,  parameters):
-        return self._opener.open(self._url, urllib.urlencode(parameters)).read()
-
-    def POST(self, parameters):
-        parameters['sessionkey'] = self._sessionkey
-        parameters['response'] = 'json'
-        return self._post(parameters)
-
-    def login(self):
-        params = {'command':'login', 'response': 'json'}
-        params['username'] = self._username
-        params['password'] = self._password
-        result = self._get(params)
-        jsonresult = json.loads(result)
-        jsessionid = None
-        self._sessionkey = jsonresult['loginresponse']['sessionkey']
-

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/073a9154/tools/test/cloudkit.py
----------------------------------------------------------------------
diff --git a/tools/test/cloudkit.py b/tools/test/cloudkit.py
deleted file mode 100644
index 02dd68c..0000000
--- a/tools/test/cloudkit.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-from apisession import ApiSession
-from physicalresource import ZoneCreator
-from globalconfig import GlobalConfig
-from db import Database
-import random
-import uuid
-
-def fix_default_db():
-    database = Database()
-    statement="""
-     UPDATE vm_template SET url='%s'
-     WHERE unique_name='%s' """
-    database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/systemvm.vhd', 'routing-1'))
-    database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/systemvm.qcow2', 'routing-3'))
-    database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/systemvm.ova', 'routing-8'))
-
-    database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/builtin.vhd', 'centos53-x86_64'))
-    database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/builtin.ova', 'centos53-x64'))
-    statement="""UPDATE vm_template SET checksum=NULL"""
-    database.update(statement)
-    
-    statement="""
-    UPDATE vm_template SET url='%s', unique_name='%s', name='%s', display_text='%s'
-    WHERE id=4 """
-    database.update(statement % ('http://nfs1.lab.vmops.com/templates/rightscale/RightImage_CentOS_5.4_x64_v5.6.34.qcow2.bz2', 'Rightscale CentOS 5.4', 'Rightscale CentOS 5.4', 'Rightscale CentOS 5.4'))
-    statement="""UPDATE disk_offering set use_local_storage=1"""
-    database.update(statement)
-    
-def config():
-    config = GlobalConfig(api)
-    config.update('use.local.storage', 'true')
-    config.update('max.template.iso.size', '20')
-
-def create_zone():
-    zonecreator = ZoneCreator(api, random.randint(2,1000))
-    zoneid = zonecreator.create()
-    database = Database()
-    statement="""INSERT INTO data_center_details (dc_id, name, value) 
-                 VALUES (%s, '%s', '0')"""
-    database.update(statement % (zoneid, 'enable.secstorage.vm'))
-    database.update(statement % (zoneid, 'enable.consoleproxy.vm'))
-    statement="""INSERT INTO data_center_details (dc_id, name, value) 
-                 VALUES (%s, '%s', '%s')"""
-    database.update(statement % (zoneid, 'zone.dhcp.strategy', 'external'))
-
-    statement="""UPDATE data_center set dhcp_provider='ExternalDhcpServer' where id=%s""" 
-    database.update(statement % (zoneid))
-
-if __name__ == "__main__":
-    fix_default_db()
-
-    api = ApiSession('http://localhost:8080/client/api', 'admin', 'password')
-    api.login()
-    
-    config()
-
-    create_zone()
-
-    print "guid=%s" % str(uuid.uuid4())
-
-

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/073a9154/tools/test/db.py
----------------------------------------------------------------------
diff --git a/tools/test/db.py b/tools/test/db.py
deleted file mode 100644
index 2a3d3cf..0000000
--- a/tools/test/db.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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 MySQLdb
-
-class Database:
-    """Database connection"""
-    def __init__(self, host='localhost', username='cloud', password='cloud', db='cloud'):
-        self._conn = MySQLdb.connect (host, username, password, db)
-
-    def update(self, statement):
-        cursor = self._conn.cursor ()
-        #print statement
-        cursor.execute (statement)
-        #print "Number of rows updated: %d" % cursor.rowcount
-        cursor.close ()
-        self._conn.commit ()
-
-    def __del__(self):
-        self._conn.close ()
-

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/073a9154/tools/test/globalconfig.py
----------------------------------------------------------------------
diff --git a/tools/test/globalconfig.py b/tools/test/globalconfig.py
deleted file mode 100644
index 7a5d0fd..0000000
--- a/tools/test/globalconfig.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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 json
-import os
-import random
-import sys
-
-class GlobalConfig:
-    """Updates global configuration values"""
-    def __init__(self, api):
-        self._api = api
-
-    def update(self, key, value):
-        jsonresult = self._api.GET({'command': 'updateConfiguration', 'name':key,
-                      'value':value})
-        if  jsonresult is  None:
-           print "Failed to update configuration"
-           return 1
-
-        return 0

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/073a9154/tools/test/physicalresource.py
----------------------------------------------------------------------
diff --git a/tools/test/physicalresource.py b/tools/test/physicalresource.py
deleted file mode 100644
index 57767f6..0000000
--- a/tools/test/physicalresource.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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 json
-import os
-import random
-import sys
-
-class ZoneCreator:
-    """Creates a zone (and a pod and cluster for now)"""
-    def __init__(self, api, zonenum, dns1='192.168.10.254', 
-                 dns2='192.168.10.253', internaldns='192.168.10.254'):
-        self._api = api
-        self._zonenum = zonenum
-        self._zonename = "ZONE%04d"%zonenum
-        self._dns1 = dns1
-        self._dns2 = dns2
-        self._internaldns = internaldns
-    
-    def create(self):
-        jsonresult = self._api.GET({'command': 'createZone', 'networktype':'Basic', 
-                      'name':self._zonename, 'dns1':self._dns1, 'dns2':self._dns2,
-                      'internaldns1':self._internaldns})
-        if  jsonresult is  None:
-           print "Failed to create zone"
-           return 0
-        jsonobj = json.loads(jsonresult)
-        self._zoneid = jsonobj['createzoneresponse']['zone']['id']
-        self._zonetoken = jsonobj['createzoneresponse']['zone']['zonetoken']
-        print "Zone %s is created"%self._zonename
-        print "zone=%s"%self._zonetoken
-        #self.createPod()
-        return self._zoneid
-
-
-    def createPod(self):
-        self._podname = "POD%04d"%self._zonenum
-        self._clustername = "CLUSTER%04d"%self._zonenum
-        jsonresult = self._api.GET({'command': 'createPod', 'zoneId':self._zoneid,
-                          'name':self._podname, 'gateway':'192.168.1.1', 'netmask':'255.255.255.0',
-                          'startIp':'192.168.1.100', 'endIp':'192.168.1.150'})
-        if  jsonresult is  None:
-           print "Failed to create pod"
-           return 2
-        jsonobj = json.loads(jsonresult)
-        podid = jsonobj['createpodresponse']['pod']['id']
-        jsonresult = self._api.GET({'command': 'addCluster', 'zoneId':self._zoneid,
-                              'clustername':self._clustername, 'podId':podid, 'hypervisor':'KVM',
-                              'clustertype':'CloudManaged'})
-        if  jsonresult is  None:
-           print "Failed to create cluster"
-           return 3
-        jsonobj = json.loads(jsonresult)
-        clusterid = jsonobj['addclusterresponse']['cluster'][0]['id']
-        print "pod=%s"%podid
-        print "cluster=%s"%clusterid
-        

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/073a9154/tools/test/vm.py
----------------------------------------------------------------------
diff --git a/tools/test/vm.py b/tools/test/vm.py
deleted file mode 100644
index 434e196..0000000
--- a/tools/test/vm.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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 json
-import os
-import random
-import sys
-import time
-#http://localhost:8080/client/api?_=1303171692177&command=listTemplates&templatefilter=featured&zoneid=1&pagesize=6&page=1&response=json&sessionkey=%2Bh3Gh4BffWpQdk4nXmcC88uEk9k%3D
-#http://localhost:8080/client/api?_=1303171711292&command=deployVirtualMachine&zoneId=1&hypervisor=KVM&templateId=4&serviceOfferingId=7&response=json&sessionkey=%2Bh3Gh4BffWpQdk4nXmcC88uEk9k%3D
-#http://localhost:8080/client/api?_=1303171934824&command=queryAsyncJobResult&jobId=20&response=json&sessionkey=%2Bh3Gh4BffWpQdk4nXmcC88uEk9k%3D
-
-class VMCreator:
-    """Creates a VM """
-    def __init__(self, api, params):
-        self._api = api
-        self._params = params
-    
-    def create(self):
-        cmd = {'command': 'deployVirtualMachine'}
-        cmd.update(self._params)
-        jsonresult = self._api.GET(cmd)
-        if  jsonresult is  None:
-           print "Failed to create VM"
-           return 0
-        jsonobj = json.loads(jsonresult)
-        self._jobid = jsonobj['deployvirtualmachineresponse']['jobid']
-        self._vmid = jsonobj['deployvirtualmachineresponse']['id']
-        print "VM %s creation is scheduled, job=%s"%(self._vmid, self._jobid)
-
-
-    def poll(self, tries, wait):
-        jobstatus = -1
-        while jobstatus < 1 and tries > 0:
-           time.sleep(wait)
-           cmd = {'command': 'queryAsyncJobResult', 'jobId': self._jobid}
-           jsonresult = self._api.GET(cmd)
-           if  jsonresult is  None:
-              print "Failed to query VM creation job"
-              return -1
-           jsonobj = json.loads(jsonresult)
-           jobstatus = jsonobj['queryasyncjobresultresponse']['jobstatus']
-           print jobstatus, type(jobstatus)
-           tries = tries - 1
-
-        if jobstatus == 1:
-           jsonobj = json.loads(jsonresult)
-           jobresult = jsonobj['queryasyncjobresultresponse']['jobresult']
-           vm = jobresult['virtualmachine']
-           print vm
-        else:
-          print "Failed to create vm"
-      
-        return jobstatus
-        

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/073a9154/tools/test/vmcreate.py
----------------------------------------------------------------------
diff --git a/tools/test/vmcreate.py b/tools/test/vmcreate.py
deleted file mode 100644
index f220581..0000000
--- a/tools/test/vmcreate.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-from apisession import ApiSession
-from vm import VMCreator
-
-#http://localhost:8080/client/api?_=1303171711292&command=deployVirtualMachine&zoneId=1&hypervisor=KVM&templateId=4&serviceOfferingId=7&response=json&sessionkey=%2Bh3Gh4BffWpQdk4nXmcC88uEk9k%3D
-
-def create_vm():
-    vmcreator = VMCreator(api, {'zoneId':1, 'hypervisor':'KVM', 'templateId':4, 
-                                'serviceOfferingId':7,
-                                'userdata':'dGhpcyBpcyBhIHRlc3QK'})
-    vmid = vmcreator.create()
-    vmcreator.poll(10, 3)
-
-if __name__ == "__main__":
-    api = ApiSession('http://localhost:8080/client/api', 'admin', 'password')
-    api.login()
-
-    create_vm()
-
-