You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/06/22 19:58:04 UTC
[7/7] remove tools/testClient as they are moved to
tools/marvin/marvin already
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/simulator/sandbox.cfg
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/simulator/sandbox.cfg b/tools/testClient/sandbox/simulator/sandbox.cfg
deleted file mode 100644
index ee87b0d..0000000
--- a/tools/testClient/sandbox/simulator/sandbox.cfg
+++ /dev/null
@@ -1,138 +0,0 @@
-{
- "zones": [
- {
- "name": "Sandbox-simulator",
- "guestcidraddress": "10.1.1.0/24",
- "providers": [
- {
- "broadcastdomainrange": "ZONE",
- "name": "VirtualRouter"
- }
- ],
- "dns1": "10.147.28.6",
- "vlan": "100-500",
- "ipranges": [
- {
- "startip": "172.2.1.2",
- "endip": "172.2.1.252",
- "netmask": "255.255.255.0",
- "vlan": "30",
- "gateway": "172.2.1.1"
- }
- ],
- "networktype": "Advanced",
- "pods": [
- {
- "endip": "172.1.2.252",
- "name": "POD0",
- "startip": "172.1.2.2",
- "netmask": "255.255.255.0",
- "clusters": [
- {
- "clustername": "C0",
- "hypervisor": "simulator",
- "hosts": [
- {
- "username": "root",
- "url": "http://sim",
- "password": "password"
- }
- ],
- "clustertype": "CloudManaged",
- "primaryStorages": [
- {
- "url": "nfs://172.2.2.6:/export/home/primary",
- "name": "PS0"
- }
- ]
- }
- ],
- "gateway": "172.1.2.1"
- }
- ],
- "internaldns1": "10.147.28.6",
- "secondaryStorages": [
- {
- "url": "nfs://172.2.2.6:/export/home/secondary"
- }
- ]
- }
- ],
- "dbSvr": {
- "dbSvr": "localhost",
- "passwd": "cloud",
- "db": "cloud",
- "port": 3306,
- "user": "cloud"
- },
- "logger": [
- {
- "name": "TestClient",
- "file": "/var/log/testclient.log"
- },
- {
- "name": "TestCase",
- "file": "/var/log/testcase.log"
- }
- ],
- "globalConfig": [
- {
- "name": "storage.cleanup.interval",
- "value": "300"
- },
- {
- "name": "vm.op.wait.interval",
- "value": "5"
- },
- {
- "name": "default.page.size",
- "value": "10000"
- },
- {
- "name": "instance.name",
- "value": "QA"
- },
- {
- "name": "workers",
- "value": "10"
- },
- {
- "name": "direct.agent.load.size",
- "value": "1000"
- },
- {
- "name": "account.cleanup.interval",
- "value": "600"
- },
- {
- "name": "guest.domain.suffix",
- "value": "sandbox.simulator"
- },
- {
- "name": "expunge.delay",
- "value": "60"
- },
- {
- "name": "vm.allocation.algorithm",
- "value": "userdispersing"
- },
- {
- "name": "expunge.interval",
- "value": "60"
- },
- {
- "name": "expunge.workers",
- "value": "3"
- },
- {
- "name": "check.pod.cidrs",
- "value": "true"
- }
- ],
- "mgtSvr": [
- {
- "mgtSvrIp": "localhost",
- "port": 8096
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/simulator/setup.py
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/simulator/setup.py b/tools/testClient/sandbox/simulator/setup.py
deleted file mode 100644
index c0b8c74..0000000
--- a/tools/testClient/sandbox/simulator/setup.py
+++ /dev/null
@@ -1,128 +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
-
-'''
-# Experimental state of scripts
-# * Need to be reviewed
-# * Only a sandbox
-'''
-
-from ConfigParser import SafeConfigParser
-from optparse import OptionParser
-from configGenerator import *
-import random
-
-
-def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
- cfg = configuration()
- cfg.name = k
- cfg.value = v
- yield cfg
-
-
-def describeResources(config):
- zs = cloudstackConfiguration()
-
- z = zone()
- z.dns1 = config.get('environment', 'dns')
- z.internaldns1 = config.get('environment', 'dns')
- z.name = 'Sandbox-%s'%(config.get('environment', 'hypervisor'))
- z.networktype = 'Advanced'
- z.guestcidraddress = '10.1.1.0/24'
- z.vlan = config.get('cloudstack','guest.vlan')
-
- p = pod()
- p.name = 'POD0'
- p.gateway = config.get('cloudstack', 'private.gateway')
- p.startip = config.get('cloudstack', 'private.pod.startip')
- p.endip = config.get('cloudstack', 'private.pod.endip')
- p.netmask = '255.255.255.0'
-
- v = iprange()
- v.gateway = config.get('cloudstack', 'public.gateway')
- v.startip = config.get('cloudstack', 'public.vlan.startip')
- v.endip = config.get('cloudstack', 'public.vlan.endip')
- v.netmask = '255.255.255.0'
- v.vlan = config.get('cloudstack', 'public.vlan')
- z.ipranges.append(v)
-
- c = cluster()
- c.clustername = 'C0'
- c.hypervisor = config.get('environment', 'hypervisor')
- c.clustertype = 'CloudManaged'
-
- h = host()
- h.username = 'root'
- h.password = 'password'
- h.url = 'http://%s'%(config.get('cloudstack', 'host'))
- c.hosts.append(h)
-
- ps = primaryStorage()
- ps.name = 'PS0'
- ps.url = config.get('cloudstack', 'pool')
- c.primaryStorages.append(ps)
-
- p.clusters.append(c)
- z.pods.append(p)
-
- secondary = secondaryStorage()
- secondary.url = config.get('cloudstack', 'secondary')
- z.secondaryStorages.append(secondary)
-
- '''Add zone'''
- zs.zones.append(z)
-
- '''Add mgt server'''
- mgt = managementServer()
- mgt.mgtSvrIp = config.get('environment', 'mshost')
- zs.mgtSvr.append(mgt)
-
- '''Add a database'''
- db = dbServer()
- db.dbSvr = config.get('environment', 'database')
- zs.dbSvr = db
-
- '''Add some configuration'''
- [zs.globalConfig.append(cfg) for cfg in getGlobalSettings(config)]
-
- ''''add loggers'''
- testClientLogger = logger()
- testClientLogger.name = 'TestClient'
- testClientLogger.file = '/var/log/testclient.log'
-
- testCaseLogger = logger()
- testCaseLogger.name = 'TestCase'
- testCaseLogger.file = '/var/log/testcase.log'
-
- zs.logger.append(testClientLogger)
- zs.logger.append(testCaseLogger)
- return zs
-
-
-if __name__ == '__main__':
- parser = OptionParser()
- parser.add_option('-i', '--input', action='store', default='setup.properties', \
- dest='input', help='file containing environment setup information')
- parser.add_option('-o', '--output', action='store', default='./sandbox.cfg', \
- dest='output', help='path where environment json will be generated')
-
-
- (opts, args) = parser.parse_args()
-
- cfg_parser = SafeConfigParser()
- cfg_parser.read(opts.input)
-
- cfg = describeResources(cfg_parser)
- generate_setup_config(cfg, opts.output)
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/simulator/simulator.properties
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/simulator/simulator.properties b/tools/testClient/sandbox/simulator/simulator.properties
deleted file mode 100644
index c5c9bc5..0000000
--- a/tools/testClient/sandbox/simulator/simulator.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-[globals]
-expunge.delay=60
-expunge.interval=60
-storage.cleanup.interval=300
-account.cleanup.interval=600
-expunge.workers=3
-workers=10
-vm.allocation.algorithm=userdispersing
-vm.op.wait.interval=5
-guest.domain.suffix=sandbox.simulator
-instance.name=QA
-direct.agent.load.size=1000
-default.page.size=10000
-check.pod.cidrs=true
-[environment]
-dns=10.147.28.6
-mshost=localhost
-database=localhost
-hypervisor=simulator
-[cloudstack]
-guest.vlan=100-500
-#pod configuration
-private.gateway=172.1.2.1
-private.pod.startip=172.1.2.2
-private.pod.endip=172.1.2.252
-#public vlan range
-public.gateway=172.2.1.1
-public.vlan=30
-public.vlan.startip=172.2.1.2
-public.vlan.endip=172.2.1.252
-#hosts
-host=sim
-#pools
-pool=nfs://172.2.2.6:/export/home/primary
-secondary=nfs://172.2.2.6:/export/home/secondary
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/simulator/tests/testProvision.py
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/simulator/tests/testProvision.py b/tools/testClient/sandbox/simulator/tests/testProvision.py
deleted file mode 100644
index e90da34..0000000
--- a/tools/testClient/sandbox/simulator/tests/testProvision.py
+++ /dev/null
@@ -1,131 +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
-import random
-import hashlib
-from cloudstackTestCase import *
-
-class Provision(cloudstackTestCase):
- '''
- '''
- def setUp(self):
- pass
-
-
- def tearDown(self):
- pass
-
-
- def test_1_createAccounts(self, numberOfAccounts=5):
- '''
- Create a bunch of user accounts
- '''
- mdf = hashlib.md5()
- mdf.update('password')
- mdf_pass = mdf.hexdigest()
- api = self.testClient.getApiClient()
- for i in range(1, numberOfAccounts + 1):
- acct = createAccount.createAccountCmd()
- acct.accounttype = 0
- acct.firstname = 'user' + str(i)
- acct.lastname = 'user' + str(i)
- acct.password = mdf_pass
- acct.username = 'user' + str(i)
- acct.email = 'user@example.com'
- acct.account = 'user' + str(i)
- acct.domainid = 1
- acctResponse = api.createAccount(acct)
- self.debug("successfully created account: %s, user: %s, id: %s"%(acctResponse.account, acctResponse.username, acctResponse.id))
-
-
- def test_2_createServiceOffering(self):
- apiClient = self.testClient.getApiClient()
- createSOcmd=createServiceOffering.createServiceOfferingCmd()
- createSOcmd.name='Sample SO'
- createSOcmd.displaytext='Sample SO'
- createSOcmd.storagetype='shared'
- createSOcmd.cpunumber=1
- createSOcmd.cpuspeed=100
- createSOcmd.memory=128
- createSOcmd.offerha='false'
- createSOresponse = apiClient.createServiceOffering(createSOcmd)
- return createSOresponse.id
-
- def deployCmd(self, account, service):
- deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
- deployVmCmd.zoneid = 1
- deployVmCmd.hypervisor='Simulator'
- deployVmCmd.account=account
- deployVmCmd.domainid=1
- deployVmCmd.templateid=10
- deployVmCmd.serviceofferingid=service
- return deployVmCmd
-
- def listVmsInAccountCmd(self, acct):
- api = self.testClient.getApiClient()
- listVmCmd = listVirtualMachines.listVirtualMachinesCmd()
- listVmCmd.account = acct
- listVmCmd.zoneid = 1
- listVmCmd.domainid = 1
- listVmResponse = api.listVirtualMachines(listVmCmd)
- return listVmResponse
-
-
- def destroyVmCmd(self, key):
- api = self.testClient.getApiClient()
- destroyVmCmd = destroyVirtualMachine.destroyVirtualMachineCmd()
- destroyVmCmd.id = key
- api.destroyVirtualMachine(destroyVmCmd)
-
-
- def test_3_stressDeploy(self):
- '''
- Deploy 20 Vms in each account
- '''
- service_id = self.test_2_createServiceOffering()
- api = self.testClient.getApiClient()
- for acct in range(1, 5):
- [api.deployVirtualMachine(self.deployCmd('user'+str(acct), service_id)) for x in range(0,20)]
-
- def test_4_stressDestroy(self):
- '''
- Cleanup all Vms in every account
- '''
- api = self.testClient.getApiClient()
- for acct in range(1, 6):
- for vm in self.listVmsInAccountCmd('user'+str(acct)):
- if vm is not None:
- self.destroyVmCmd(vm.id)
-
- def test_5_combineStress(self):
- for i in range(0, 5):
- self.test_3_stressDeploy()
- self.test_4_stressDestroy()
-
- def deployN(self,nargs=300,batchsize=0):
- '''
- Deploy Nargs number of VMs concurrently in batches of size {batchsize}.
- When batchsize is 0 all Vms are deployed in one batch
- VMs will be deployed in 5:2:6 ratio
- '''
- cmds = []
-
- if batchsize == 0:
- self.testClient.submitCmdsAndWait(cmds)
- else:
- while len(z) > 0:
- try:
- newbatch = [cmds.pop() for b in range(batchsize)] #pop batchsize items
- self.testClient.submitCmdsAndWait(newbatch)
- except IndexError:
- break
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/testcase/test_1.py
----------------------------------------------------------------------
diff --git a/tools/testClient/testcase/test_1.py b/tools/testClient/testcase/test_1.py
deleted file mode 100644
index f440a6e4..0000000
--- a/tools/testClient/testcase/test_1.py
+++ /dev/null
@@ -1,31 +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 cloudstackTestCase import *
-
-@UserName("edison", "edison", "0")
-class TestCase1(cloudstackTestCase):
-
- def test_cloudstackapi(self):
- apiClient = self.testClient.getApiClient()
- listtmcmd = listTemplates.listTemplatesCmd()
- listtmcmd.id = 10
- listtmcmd.zoneid = 1
- listtmcmd.templatefilter = "featured"
- listtmresponse = apiClient.listTemplates(listtmcmd)
- if listtmresponse is not None and len(listtmresponse) > 0:
- self.debug(listtmresponse)
- self.debug("we are here")
- else:
- self.debug("we are there")
-
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/testcase/test_2.py
----------------------------------------------------------------------
diff --git a/tools/testClient/testcase/test_2.py b/tools/testClient/testcase/test_2.py
deleted file mode 100644
index cf5bcfb..0000000
--- a/tools/testClient/testcase/test_2.py
+++ /dev/null
@@ -1,35 +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 cloudstackTestCase import *
-class TestCase2(cloudstackTestCase):
-
- def test_cloudstackapi1(self):
- apiClient = self.testClient.getApiClient()
- listtmcmd = listTemplates.listTemplatesCmd()
- listtmcmd.id = 10
- listtmcmd.zoneid = 1
- listtmcmd.templatefilter = "featured"
- #listtmresponse = apiClient.listTemplates(listtmcmd)
- #self.debug(listtmresponse[0].isready)
-
- listhostcmd=listHosts.listHostsCmd()
- listhostcmd.zoneid=1
- listhostcmd.type="Routing"
-
- asyncJobResult=self.testClient.submitCmdsAndWait([listhostcmd],1)
- listVMresponse = asyncJobResult[0].result
- self.debug("Total Number of Hosts: " + str(len(listVMresponse)))
-
- for i in listVMresponse:
- self.debug("id: " + str(i.id) +" pod id: " + str(i.podid) +" host tag: " + str(i.hosttags))
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/testcase/test_3.py
----------------------------------------------------------------------
diff --git a/tools/testClient/testcase/test_3.py b/tools/testClient/testcase/test_3.py
deleted file mode 100644
index 35e179d..0000000
--- a/tools/testClient/testcase/test_3.py
+++ /dev/null
@@ -1,122 +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 cloudstackTestCase import *
-import uuid
-class TestCase1(cloudstackTestCase):
- def setUp(self):
- '''get a small service offering id'''
- listsocmd = listServiceOfferings.listServiceOfferingsCmd()
- listsocmd.name = "Small Instance"
- listsocmd.issystem = "false"
- sos = self.testClient.getApiClient().listServiceOfferings(listsocmd)
- if sos is not None and len(sos) > 0:
- self.svid = sos[0].id
- listdiskovcmd = listDiskOfferings.listDiskOfferingsCmd()
- listdiskovcmd.name = "Small"
- disoov = self.testClient.getApiClient().listDiskOfferings(listdiskovcmd)
- if disoov is not None and len(disoov) > 0:
- self.diskov = disoov[0].id
-
- '''get user vm template id'''
- listtmplcmd = listTemplates.listTemplatesCmd()
- listtmplcmd.templatefilter = "featured"
- tmpls = self.testClient.getApiClient().listTemplates(listtmplcmd)
- if tmpls is not None:
- for tmpl in tmpls:
- if tmpl.isready:
- self.templateId = tmpl.id
- self.zoneId = tmpl.zoneid
- break
-
- def test_cloudstackapi(self):
- apiClient = self.testClient.getApiClient()
-
- getzone = listZones.listZonesCmd()
- getzone.id = self.zoneId
- zone = apiClient.listZones(getzone)
- if zone[0].networktype == "Basic":
- '''create a security group for admin'''
- admincmd = listUsers.listUsersCmd()
- admincmd.account = "admin"
- admin = apiClient.listUsers(admincmd)
- domainId = admin[0].domainid
-
- securitygroup = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd()
- securitygroup.domainid = admin[0].domainid
- securitygroup.account = admin[0].account
- securitygroup.securitygroupid = 1
- securitygroup.protocol = "TCP"
- securitygroup.startport = "22"
- securitygroup.endport = "22"
- '''
- groups = [{"account":"a","group":"default"}, {"account":"b", "group":"default"}]
- securitygroup.usersecuritygrouplist = groups
- '''
- cidrlist = ["192.168.1.1/24", "10.1.1.1/24"]
- securitygroup.cidrlist = cidrlist
- try:
- apiClient.authorizeSecurityGroupIngress(securitygroup)
- except:
- pass
- '''
- createvm = deployVirtualMachine.deployVirtualMachineCmd()
- createvm.serviceofferingid = self.svid
- createvm.templateid = self.templateId
- createvm.zoneid = self.zoneId
- vm = apiClient.deployVirtualMachine(createvm)
- vmId = vm.id
- '''
- vmId = 1
- vmcmds = []
- for i in range(10):
- createvm = deployVirtualMachine.deployVirtualMachineCmd()
- createvm.serviceofferingid = self.svid
- createvm.templateid = self.templateId
- createvm.zoneid = self.zoneId
- vmcmds.append(createvm)
-
- result = self.testClient.submitCmdsAndWait(vmcmds, 5)
- for jobstatus in result:
- if jobstatus.status == 1:
- self.debug(jobstatus.result.id)
- self.debug(jobstatus.result.displayname)
- else:
- self.debug(jobstatus.result)
-
- creatvolume = createVolume.createVolumeCmd()
- creatvolume.name = "tetst" + str(uuid.uuid4())
- creatvolume.diskofferingid = self.diskov
- creatvolume.zoneid = self.zoneId
- createvolumeresponse = apiClient.createVolume(creatvolume)
- volumeId = createvolumeresponse.id
- attach = attachVolume.attachVolumeCmd()
-
- attach.id = volumeId
- attach.virtualmachineid = vmId
- apiClient.attachVolume(attach)
-
- detach = detachVolume.detachVolumeCmd()
- detach.id = volumeId
- detach.virtualmachineid = vmId
- apiClient.detachVolume(detach)
-
- snapshotcmd = createSnapshot.createSnapshotCmd()
- snapshotcmd.volumeid = volumeId
- snapshotrespose = apiClient.createSnapshot(snapshotcmd)
- snapshotId = snapshotrespose.id
-
- createvolume = createVolume.createVolumeCmd()
- createvolume.snapshotid = snapshotId
- createvolume.name = "volumefrom_snapshot"+ str(snapshotId)
- apiClient.createVolume(createvolume)
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/testcase/test_userDecorator.py
----------------------------------------------------------------------
diff --git a/tools/testClient/testcase/test_userDecorator.py b/tools/testClient/testcase/test_userDecorator.py
deleted file mode 100644
index 437700c..0000000
--- a/tools/testClient/testcase/test_userDecorator.py
+++ /dev/null
@@ -1,69 +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 cloudstackTestCase import *
-
-#@UserName('user', 'LEAF', 0)
-#@UserName('user0', 'LEAF', 0)
-#@UserName('user', 'LEAF0', 0)
-#@UserName('admin', 'ROOT', 1)
-@UserName('domadmin', 'LEAF0', 2)
-class TestUserDecorator(cloudstackTestCase):
-
- def test_listUserTemplates(self):
- apiClient = self.testClient.getApiClient()
- listtmcmd = listTemplates.listTemplatesCmd()
- listtmcmd.zoneid = 1
- listtmcmd.templatefilter = "self"
- listtmresponse = apiClient.listTemplates(listtmcmd)
- if listtmresponse is not None:
- self.assertEqual(len(listtmresponse), 0, "there should be no user created templates")
- self.debug("%d user templates found"%len(listtmresponse))
-
- def test_listFeaturedTemplates(self):
- apiClient = self.testClient.getApiClient()
- listtmcmd = listTemplates.listTemplatesCmd()
- listtmcmd.zoneid = 1
- listtmcmd.templatefilter = "featured"
- listtmresponse = apiClient.listTemplates(listtmcmd)
- if listtmresponse is not None:
- self.assertNotEqual(len(listtmresponse), 0, "there should default featured templates")
- self.debug("%d featured templates found"%len(listtmresponse))
- return listtmresponse[0].id
-
- def test_listVirtualMachines(self):
- apiClient = self.testClient.getApiClient()
- listvmcmd = listVirtualMachines.listVirtualMachinesCmd()
- listvmcmd.zoneid = 1
- listvmcmd.state = "Running"
- listvmresponse = apiClient.listVirtualMachines(listvmcmd)
- if listvmresponse is not None and len(listvmresponse) > 0:
- self.debug("%d running VMs found"%len(listvmresponse))
- else:
- self.debug("No Vms Found")
-
- def test_deployVM(self):
- apiClient = self.testClient.getApiClient()
- listzones = listZones.listZonesCmd()
- listzoneres = apiClient.listZones(listzones)
- zoneid = listzoneres[0].id
-
- listservice = listServiceOfferings.listServiceOfferingsCmd()
- listserviceres = apiClient.listServiceOfferings(listservice)
- serviceofferingid = listserviceres[0].id
-
- deploycmd = deployVirtualMachine.deployVirtualMachineCmd()
- deploycmd.displayname = "testVm"
- deploycmd.templateid = self.test_listFeaturedTemplates()
- deploycmd.zoneid = zoneid
- deploycmd.serviceofferingid = serviceofferingid
- apiClient.deployVirtualMachine(deploycmd)
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/translator.py
----------------------------------------------------------------------
diff --git a/tools/testClient/translator.py b/tools/testClient/translator.py
deleted file mode 100644
index 5b3375b..0000000
--- a/tools/testClient/translator.py
+++ /dev/null
@@ -1,212 +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
-import datetime
-from optparse import OptionParser
-import random
-import os
-import sys
-
-# Constants
-INDENT = " "
-INDENT2 = INDENT + INDENT
-
-class xml_to_python(object):
- def __init__(self, debug):
- '''
- constructor
- '''
- self.debug = debug
- self._output = False
- self.out_buffer = []
-
- self.cmd_name = None
- self.cmd_name_var = None
- self.cmd_name_resp = None
-
- self.glos = []
-
- def _write(self, output_string):
- '''
- internal print function
- '''
- self.out_buffer.append("%s\n" % output_string)
-
- def parse_parameters(self, dom):
- '''
- process parameters of command
- '''
- for param in dom.getElementsByTagName("parameters"):
- for item in param.getElementsByTagName("item"):
- itemName = item.getElementsByTagName("name")[0].childNodes[0].nodeValue.strip()
- itemParam = None
- itemValue = None
-
- # this could be handled much cleaner
- try:
- itemValue = item.getElementsByTagName("value")[0].childNodes[0].nodeValue.strip()
- except:
- itemValue = None
- try:
- itemParam = item.getElementsByTagName("param")[0].childNodes[0].nodeValue.strip()
- except:
- itemParam = None
-
- # handle getparam and setparam and random attributes here...
- if item.getAttribute("getparam") == "true" and itemParam is not None:
- self._write("%s%s.%s = %s" % (INDENT, self.cmd_name_var, itemName, itemParam))
- self.glos.append(itemParam)
- elif item.getAttribute("random") == "true" or item.getAttribute("randomnumber") == "true":
- # we should do this in the resulting python file.
- randValue = int(random.random() * 10000000)
- self._write("%s%s.%s = '%s-randomName'" % (INDENT, self.cmd_name_var, itemName, str(randValue)))
- if item.getAttribute("setparam") == "true" and itemParam is not None:
- self._write("%s%s = '%s-randomName'" % (INDENT, itemParam, str(randValue)))
- self.glos.append(itemParam)
- else:
- try:
- val = int(itemValue)
- except:
- val = "'%s'" % itemValue
- self._write("%s%s.%s = %s" % (INDENT, self.cmd_name_var, itemName, val))
-
-
- def parse_returnvalue(self, dom):
- '''
- process returnvalue section of command
- '''
- for return_val in dom.getElementsByTagName("returnvalue"):
- for item in return_val.getElementsByTagName("item"):
- #if item.getAttribute("list") == "true":
-
- itemName = item.getElementsByTagName("name")[0].childNodes[0].nodeValue.strip()
- try:
- itemParam = item.getElementsByTagName("param")[0].childNodes[0].nodeValue.strip()
- except:
- print "parse_returnvalue: No 'param' found in : '" + item.toprettyxml() + "'"
- itemParam = None
-
- if item.getAttribute("setparam") == "true":
- self._write("%s%s = %s.%s" % (INDENT, itemParam, self.cmd_name_resp, itemName))
- else:
- self._write("%sif %s != %s.%s:" % (INDENT, itemParam, self.cmd_name_resp, itemName))
- self._write("%sprint %s.%s + \" does not match \" + %s" % (
- INDENT2, self.cmd_name_resp, itemName, itemParam))
-
-
- def parse_command(self, dom):
- '''
- process command elements and their children
- '''
- for cmd in dom.getElementsByTagName("command"):
- self.cmd_name = cmd.getElementsByTagName("name")[0].childNodes[0].nodeValue.strip()
- self.cmd_name_var = "_%s" % self.cmd_name
- self.cmd_name_resp = "resp_%s" % self.cmd_name
-
- try:
- testCaseName = cmd.getElementsByTagName("testcase")[0].childNodes[0].nodeValue.strip()
- except:
- print "parse_command: No 'testcase' found in: " + cmd.toprettyxml()
- testCaseName = None
- self._write("\n%s# %s" % (INDENT, testCaseName))
-
- self._write("%s%s = %s.%sCmd()" % (INDENT, self.cmd_name_var, self.cmd_name, self.cmd_name))
-
- self.parse_parameters(cmd)
- # now we execute command
- self._write("%s%s = apiClient.%s(%s)" % (INDENT, self.cmd_name_resp, self.cmd_name, self.cmd_name_var))
- self._write("%sif %s is None:" % (INDENT, self.cmd_name_resp))
- self._write("%sprint 'test [%s] failed'" % (INDENT2, testCaseName))
- self._write("%selse:" % INDENT)
- self._write("%sprint 'test [%s] succeeded'" % (INDENT2, testCaseName))
- self.parse_returnvalue(cmd)
-
- def generate_python_header(self, outfile):
- '''
- generates python file header
-
- the basic stuff to bootstrap the script
- '''
- now = datetime.datetime.now()
-
- outfile.write("# Generated by translator.py\n")
- outfile.write("# from %s\n" % options.xmlfile)
- outfile.write("# on %s\n\n" % str(now))
- outfile.write("from cloudstackTestCase import *\n")
- outfile.write("import cloudstackTestClient\n")
- outfile.write("import time\n\n")
- outfile.write("# These are global variables used in the script below\n")
- for key in set(self.glos):
- outfile.write("%s = None\n" % key)
- outfile.write("# End of globals\n\n")
- outfile.write("if __name__ == \"__main__\":\n")
- outfile.write("%s# Possible initialization parameters:\n" % INDENT)
- outfile.write("%s# cloudstackTestClient(mgtSvr=None, port=8096, apiKey = None, securityKey = None,\n" % INDENT)
- outfile.write("%s# asyncTimeout=3600, defaultWorkerThreads=10, logging=None)\n" % INDENT)
- outfile.write("%stestClient = cloudstackTestClient.cloudstackTestClient(\"localhost\")\n" % INDENT)
- outfile.write("%sapiClient = testClient.getApiClient()\n" % INDENT)
-
- def output_python(self, outfile):
- self.generate_python_header(outfile)
- for line in self.out_buffer:
- outfile.write(line)
- outfile.close()
-
-
- def parse_xmlFile(self, xmlFile, outfile):
- '''
- parse_xmlFile, this is the main function of the translator
- '''
- dom = xml.dom.minidom.parse(xmlFile)
-
- self.parse_command(dom)
- self.output_python(outfile)
-
-
-if __name__ == "__main__":
- opts = OptionParser()
-
- opts.add_option("-i", "--inputfile", dest="xmlfile", help="The XML file and it's path containing tests.",
- default="../../test/metadata/func/portforwarding.xml")
- opts.add_option("-o", "--output_file_path", dest="outpath", help="The path where we create the python file.")
- opts.add_option("-d", action="store_true", dest="debug",
- help="Don't create output file, but send output to stderr", default=False)
-
- (options, args) = opts.parse_args()
-
- if options.xmlfile is None or not os.path.exists(options.xmlfile):
- print "The input file MUST be specified and exist: %s" % options.xmlfile
- exit(1)
-
- if options.debug == False:
- if options.outpath is None:
- options.outpath = "%s.py" % (os.path.basename(options.xmlfile))
- else:
- if options.outpath.endswith('/'):
- options.outpath = "%s%s.py" % (options.outpath, os.path.basename(options.xmlfile))
- else:
- options.outpath = "%s/%s.py" % (options.outpath, os.path.basename(options.xmlfile))
-
- if os.path.exists(options.outpath):
- print "The output file already exists: %s" % options.outpath
- exit(1)
-
- outFile = open(options.outpath, "w")
- else:
- outFile = sys.stderr
-
- print("[Processing: %s Output: %s]" % (options.xmlfile, outFile.name))
-
- processor = xml_to_python(options.debug)
-
- processor.parse_xmlFile(options.xmlfile, outFile)
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/unitTest/test_advanced.py
----------------------------------------------------------------------
diff --git a/tools/testClient/unitTest/test_advanced.py b/tools/testClient/unitTest/test_advanced.py
deleted file mode 100644
index a4ff26f..0000000
--- a/tools/testClient/unitTest/test_advanced.py
+++ /dev/null
@@ -1,107 +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
-import inspect
-import uuid
-import time
-from cloudstackAPI import *
-import cloudstackTestClient
-if __name__ == "__main__":
- randomName = str(uuid.uuid4())
- testClient = cloudstackTestClient.cloudstackTestClient("localhost")
- api = testClient.getApiClient()
-
- czcmd = createZone.createZoneCmd()
- czcmd.dns1 = "8.8.8.8"
- czcmd.internaldns1 = "192.168.110.254"
- czcmd.name = "test" + randomName
- czcmd.networktype = "Advanced"
- czcmd.guestcidraddress = "10.1.1.0/24"
- czcmd.vlan = "1160-1200"
- czresponse = api.createZone(czcmd)
- zoneId = czresponse.id
-
- cvlancmd = createVlanIpRange.createVlanIpRangeCmd()
- cvlancmd.zoneid = zoneId
- cvlancmd.vlan = "2020"
- cvlancmd.gateway = "172.16.112.1"
- cvlancmd.netmask = "255.255.0.0"
- cvlancmd.startip = "172.16.112.2"
- cvlancmd.endip = "172.16.112.100"
- api.createVlanIpRange(cvlancmd)
-
- cpodcmd = createPod.createPodCmd()
- cpodcmd.zoneid = zoneId
- cpodcmd.gateway = "192.168.137.1"
- cpodcmd.name = "testpod"+ randomName
- cpodcmd.netmask = "255.255.255.0"
- cpodcmd.startip = "192.168.137.200"
- cpodcmd.endip = "192.168.137.220"
- cpodresponse = api.createPod(cpodcmd)
- podId = cpodresponse.id
-
- aclustercmd = addCluster.addClusterCmd()
- aclustercmd.clustername = "testcluster"+ randomName
- aclustercmd.hypervisor = "KVM"
- aclustercmd.podid = podId
- aclustercmd.zoneid = zoneId
- aclustercmd.clustertype = "CloudManaged"
- clusterresponse = api.addCluster(aclustercmd)
- clusterId = clusterresponse[0].id
- '''
- for i in range(1):
- addhostcmd = addHost.addHostCmd()
- addhostcmd.zoneid = zoneId
- addhostcmd.podid = podId
- addhostcmd.clusterid = clusterId
- addhostcmd.hypervisor = "KVM"
- addhostcmd.username = "root"
- addhostcmd.password = "password"
- addhostcmd.url = "http://192.168.137.2"
- addhostresponse = api.addHost(addhostcmd)
- print addhostresponse[0].id, addhostresponse[0].ipaddress
- '''
- createspcmd = createStoragePool.createStoragePoolCmd()
- createspcmd.zoneid = zoneId
- createspcmd.podid = podId
- createspcmd.clusterid = clusterId
- createspcmd.url = "nfs://nfs2.lab.vmops.com/export/home/edison/kvm2"
- createspcmd.name = "storage pool" + randomName
- createspresponse = api.createStoragePool(createspcmd)
-
- addsscmd = addSecondaryStorage.addSecondaryStorageCmd()
- addsscmd.url = "nfs://nfs2.lab.vmops.com/export/home/edison/xen/secondary"
- addsscmd.zoneid = zoneId
- api.addSecondaryStorage(addsscmd)
-
- listtmcmd = listTemplates.listTemplatesCmd()
- listtmcmd.id = 4
- listtmcmd.zoneid = zoneId
- listtmcmd.templatefilter = "featured"
- listtmresponse = api.listTemplates(listtmcmd)
- while True:
- if listtmresponse is not None and listtmresponse[0].isready == "true":
- break
- time.sleep(30)
- listtmresponse = api.listTemplates(listtmcmd)
-
- vmId = []
- for i in range(2):
- cmd = deployVirtualMachine.deployVirtualMachineCmd()
- cmd.zoneid = zoneId
- cmd.hypervisor = "KVM"
- cmd.serviceofferingid = "1"
- cmd.templateid = listtmresponse[0].id
- res = api.deployVirtualMachine(cmd)
-
- vmId.append(res.id)
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/unitTest/test_async.py
----------------------------------------------------------------------
diff --git a/tools/testClient/unitTest/test_async.py b/tools/testClient/unitTest/test_async.py
deleted file mode 100644
index 14aed9b..0000000
--- a/tools/testClient/unitTest/test_async.py
+++ /dev/null
@@ -1,70 +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 *
-import cloudstackException
-import cloudstackTestClient
-import sys
-import uuid
-
-class jobs():
- def __init__(self, zoneId):
- self.zoneId = zoneId
-
- def run(self):
- try:
- cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
- cmd.id = 4
- self.apiClient.destroyVirtualMachine(cmd)
- except cloudstackException.cloudstackAPIException, e:
- print str(e)
- except :
- print sys.exc_info()
-
-if __name__ == "__main__":
- ''' to logging the testclient
- logger = logging.getLogger("test_async")
- fh = logging.FileHandler("test.log")
- logger.addHandler(fh)
- logger.setLevel(logging.DEBUG)
- testclient = cloudstackTestClient.cloudstackTestClient(mgtSvr="localhost", logging=logger)
- '''
- testclient = cloudstackTestClient.cloudstackTestClient(mgtSvr="localhost", port=8080, apiKey="rUJI62HcbyhAXpRgqERZHXlrJz9GiC55fmAm7j4WobLUTFkJyupBm87sbMki1-aRFox7TDs436xYvNW9fTHcew", securityKey="2_SIz9HULx5guCLypSoRoePCBFnTZGIrA3gQ0qhy__oca6dDacJwibMSQh-kVeJivJHeA55AwJZPJAu4U3V5KQ")
- testclient.dbConfigure()
- api = testclient.getApiClient()
- '''
- testclient.submitJob(jobs(1), 10, 10, 1)
-
- js = []
- for i in range(10):
- js.append(jobs(1))
-
- testclient.submitJobs(js, 10, 1)
- '''
- cmds = []
- for i in range(20):
- cmd = deployVirtualMachine.deployVirtualMachineCmd()
- cmd.zoneid =1
- cmd.templateid = 10
- cmd.serviceofferingid = 16
- cmd.displayname = str(uuid.uuid4())
- cmds.append(cmd)
-
- asyncJobResult = testclient.submitCmdsAndWait(cmds, 6)
-
- for jobStatus in asyncJobResult:
- if jobStatus.status:
- print jobStatus.result[0].id, jobStatus.result[0].templatename, jobStatus.startTime, jobStatus.endTime
- else:
- print jobStatus.result, jobStatus.startTime, jobStatus.endTime
-
- print jobStatus.duration
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/unitTest/test_basic_zone.py
----------------------------------------------------------------------
diff --git a/tools/testClient/unitTest/test_basic_zone.py b/tools/testClient/unitTest/test_basic_zone.py
deleted file mode 100644
index 9a1edf8..0000000
--- a/tools/testClient/unitTest/test_basic_zone.py
+++ /dev/null
@@ -1,227 +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 uuid
-from cloudstackAPI import *
-import cloudstackException
-import cloudstackTestClient
-import time
-if __name__ == "__main__":
- hypervisor = "KVM"
- hostNum = 30
- templateId = 10
- vmNum = 10
-
- randomName = str(uuid.uuid4())
-
- testClient = cloudstackTestClient.cloudstackTestClient("localhost")
- api = testClient.getApiClient()
-
-
- czcmd = createZone.createZoneCmd()
- czcmd.dns1 = "8.8.8.8"
- czcmd.internaldns1 = "192.168.110.254"
- czcmd.name = "test" + randomName
- czcmd.networktype = "Basic"
-
- czresponse = api.createZone(czcmd)
- zoneId = czresponse.id
-
- cpodcmd = createPod.createPodCmd()
- cpodcmd.zoneid = zoneId
- cpodcmd.gateway = "192.168.137.1"
- cpodcmd.name = "testpod"+ randomName
- cpodcmd.netmask = "255.255.255.0"
- cpodcmd.startip = "192.168.137.200"
- cpodcmd.endip = "192.168.137.230"
- cpodresponse = api.createPod(cpodcmd)
- podId = cpodresponse.id
-
- cvlancmd = createVlanIpRange.createVlanIpRangeCmd()
- cvlancmd.zoneid = zoneId
- cvlancmd.podid = podId
- cvlancmd.gateway = "192.168.137.1"
- cvlancmd.netmask = "255.255.255.0"
- cvlancmd.startip = "192.168.137.100"
- cvlancmd.endip = "192.168.137.190"
- cvlancmd.forvirtualnetwork = "false"
- cvlancmd.vlan = "untagged"
-
- api.createVlanIpRange(cvlancmd)
-
- aclustercmd = addCluster.addClusterCmd()
- aclustercmd.clustername = "testcluster"+ randomName
- aclustercmd.hypervisor = hypervisor
- aclustercmd.podid = podId
- aclustercmd.zoneid = zoneId
- aclustercmd.clustertype = "CloudManaged"
- clusterresponse = api.addCluster(aclustercmd)
- clusterId = clusterresponse[0].id
- '''
- for i in range(hostNum):
- addhostcmd = addHost.addHostCmd()
- addhostcmd.zoneid = zoneId
- addhostcmd.podid = podId
- addhostcmd.clusterid = clusterId
- addhostcmd.hypervisor = hypervisor
- addhostcmd.username = "root"
- addhostcmd.password = "password"
- if hypervisor == "Simulator":
- addhostcmd.url = "http://sim"
- else:
- addhostcmd.url = "http://192.168.137.4"
- addhostresponse = api.addHost(addhostcmd)
- print addhostresponse[0].id, addhostresponse[0].ipaddress
-
- createspcmd = createStoragePool.createStoragePoolCmd()
- createspcmd.zoneid = zoneId
- createspcmd.podid = podId
- createspcmd.clusterid = clusterId
- createspcmd.url = "nfs://nfs2.lab.vmops.com/export/home/edison/primary"
- createspcmd.name = "storage pool" + randomName
- createspresponse = api.createStoragePool(createspcmd)
-
- addsscmd = addSecondaryStorage.addSecondaryStorageCmd()
- addsscmd.url = "nfs://nfs2.lab.vmops.com/export/home/edison/xen/secondary"
- addsscmd.zoneid = zoneId
- api.addSecondaryStorage(addsscmd)
-
- listtmcmd = listTemplates.listTemplatesCmd()
- listtmcmd.id = templateId
- listtmcmd.zoneid = zoneId
- listtmcmd.templatefilter = "featured"
- listtmresponse = api.listTemplates(listtmcmd)
- while True:
- if listtmresponse is not None and listtmresponse[0].isready == "true":
- break
- time.sleep(30)
- listtmresponse = api.listTemplates(listtmcmd)
-
- vmId = []
- for i in range(vmNum):
- cmd = deployVirtualMachine.deployVirtualMachineCmd()
- cmd.zoneid = zoneId
- cmd.hypervisor = hypervisor
- cmd.serviceofferingid = "1"
- cmd.templateid = listtmresponse[0].id
- res = api.deployVirtualMachine(cmd)
-
- vmId.append(res.id)
-
-
- registerTempl = registerTemplate.registerTemplateCmd()
- registerTempl.displaytext = "test template4"
- registerTempl.format = "QCOW2"
- registerTempl.hypervisor = "Simulator"
- registerTempl.name = "test template4"
- registerTempl.ostypeid = "100"
- registerTempl.url = "http://www.google.com/template.qcow2"
- registerTempl.zoneid = 1
- registerTemlResponse = api.registerTemplate(registerTempl)
- newtemplateId = registerTemlResponse[0].id
-
- listtempl = listTemplates.listTemplatesCmd()
- listtempl.id = newtemplateId
- listtempl.templatefilter = "self"
- listemplResponse = api.listTemplates(listtempl)
- while True:
- if listemplResponse is not None:
-
- if listemplResponse[0].isready == "true":
- break
- else:
- print listemplResponse[0].status
-
- time.sleep(30)
- listemplResponse = api.listTemplates(listtempl)
-
-
-
- for i in range(10):
- cmd = deployVirtualMachine.deployVirtualMachineCmd()
- cmd.zoneid = 1
- cmd.hypervisor = hypervisor
- cmd.serviceofferingid = "1"
- #cmd.templateid = listemplResponse[0].id
- cmd.templateid = 200
- res = api.deployVirtualMachine(cmd)
-
-
- createvolume = createVolume.createVolumeCmd()
- createvolume.zoneid = 1
- createvolume.diskofferingid = 9
- createvolume.name = "test"
-
- createvolumeresponse = api.createVolume(createvolume)
- volumeId = createvolumeresponse.id
-
- attachvolume = attachVolume.attachVolumeCmd()
- attachvolume.id = volumeId
- attachvolume.virtualmachineid = 9
- attachvolumeresponse = api.attachVolume(attachvolume)
-
- deattachevolume = detachVolume.detachVolumeCmd()
- deattachevolume.id = volumeId
- deattachvolumeresponse = api.detachVolume(deattachevolume)
-
- createsnapshot = createSnapshot.createSnapshotCmd()
- createsnapshot.volumeid = volumeId
- createsnapshotresponse = api.createSnapshot(createsnapshot)
- snapshotId = createsnapshotresponse.id
-
- createtmpl = createTemplate.createTemplateCmd()
- createtmpl.snapshotid = snapshotId
- createtmpl.name = randomName[:10]
- createtmpl.displaytext = randomName[:10]
- createtmpl.ostypeid = 100
- createtmpl.ispublic = "false"
- createtmpl.passwordenabled = "false"
- createtmpl.isfeatured = "false"
- createtmplresponse = api.createTemplate(createtmpl)
- templateId = createtmplresponse.id
-
- createvolume = createVolume.createVolumeCmd()
- createvolume.snapshotid = snapshotId
- createvolume.name = "test"
- createvolumeresponse = api.createVolume(createvolume)
- volumeId = createvolumeresponse.id
-
- cmd = deployVirtualMachine.deployVirtualMachineCmd()
- cmd.zoneid = 1
- cmd.hypervisor = hypervisor
- cmd.serviceofferingid = "1"
- cmd.templateid = templateId
- cmd.name = "fdf"
- res = api.deployVirtualMachine(cmd)
-
- attachvolume = attachVolume.attachVolumeCmd()
- attachvolume.id = volumeId
- attachvolume.virtualmachineid = 1
- attachvolumeresponse = api.attachVolume(attachvolume)
-
- deattachevolume = detachVolume.detachVolumeCmd()
- deattachevolume.id = volumeId
- deattachvolumeresponse = api.detachVolume(deattachevolume)
-
- deletetmpl = deleteTemplate.deleteTemplateCmd()
- deletetmpl.id = templateId
- deletetmpl.zoneid = 1
- api.deleteTemplate(deletetmpl)
-
- deletevolume = deleteVolume.deleteVolumeCmd()
- deletevolume.id = volumeId
- api.deleteVolume(deletevolume)
-
- deletesnapshot = deleteSnapshot.deleteSnapshotCmd()
- deletesnapshot.id = snapshotId
-
- '''
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/unitTest/test_local_storage.py
----------------------------------------------------------------------
diff --git a/tools/testClient/unitTest/test_local_storage.py b/tools/testClient/unitTest/test_local_storage.py
deleted file mode 100644
index 539025f..0000000
--- a/tools/testClient/unitTest/test_local_storage.py
+++ /dev/null
@@ -1,255 +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 uuid
-import time
-import cloudstackAPIException
-import cloudstackTestClient
-from cloudstackAPI import *
-if __name__ == "__main__":
- hypervisor = "Simulator"
- hostNum = 100
- clusterNum = hostNum/10
- templateId = 10
- vmNum = 10
-
- randomName = str(uuid.uuid4())
-
- testclient = cloudstackTestClient.cloudstackTestClient("localhost")
- api = testclient.getApiClient()
-
-
- updatecfg = updateConfiguration.updateConfigurationCmd()
- updatecfg.name = "expunge.delay"
- updatecfg.value = "100"
- ret = api.updateConfiguration(updatecfg)
-
- updatecfg.name = "expunge.interval"
- updatecfg.value = "100"
- ret = api.updateConfiguration(updatecfg)
-
- updatecfg.name = "ping.interval"
- updatecfg.value = "180"
- ret = api.updateConfiguration(updatecfg)
-
- updatecfg.name = "system.vm.use.local.storage"
- updatecfg.value = "true"
- ret = api.updateConfiguration(updatecfg)
-
- updatecfg.name = "use.local.storage"
- updatecfg.value = "true"
- ret = api.updateConfiguration(updatecfg)
-
-
-
- czcmd = createZone.createZoneCmd()
- czcmd.dns1 = "8.8.8.8"
- czcmd.internaldns1 = "192.168.110.254"
- czcmd.name = "test" + randomName
- czcmd.networktype = "Basic"
-
- czresponse = api.createZone(czcmd)
- zoneId = czresponse.id
-
- cpodcmd = createPod.createPodCmd()
- cpodcmd.zoneid = zoneId
- cpodcmd.gateway = "192.168.137.1"
- cpodcmd.name = "testpod"+ randomName
- cpodcmd.netmask = "255.255.255.0"
- cpodcmd.startip = "192.168.137.200"
- cpodcmd.endip = "192.168.137.230"
- cpodresponse = api.createPod(cpodcmd)
- podId = cpodresponse.id
-
- cvlancmd = createVlanIpRange.createVlanIpRangeCmd()
- cvlancmd.zoneid = zoneId
- cvlancmd.podid = podId
- cvlancmd.gateway = "192.168.137.1"
- cvlancmd.netmask = "255.255.255.0"
- cvlancmd.startip = "192.168.137.100"
- cvlancmd.endip = "192.168.137.190"
- cvlancmd.forvirtualnetwork = "false"
- cvlancmd.vlan = "untagged"
-
- api.createVlanIpRange(cvlancmd)
-
- aclustercmd = addCluster.addClusterCmd()
- aclustercmd.clustername = "testcluster"+ randomName
- aclustercmd.hypervisor = hypervisor
- aclustercmd.podid = podId
- aclustercmd.zoneid = zoneId
- aclustercmd.clustertype = "CloudManaged"
- clusterresponse = api.addCluster(aclustercmd)
- clusterId = clusterresponse[0].id
-
- for i in range(hostNum):
- addhostcmd = addHost.addHostCmd()
- addhostcmd.zoneid = zoneId
- addhostcmd.podid = podId
- addhostcmd.clusterid = clusterId
- addhostcmd.hypervisor = hypervisor
- addhostcmd.username = "root"
- addhostcmd.password = "password"
- if hypervisor == "Simulator":
- addhostcmd.url = "http://sim"
- else:
- addhostcmd.url = "http://192.168.137.4"
- addhostresponse = api.addHost(addhostcmd)
- print addhostresponse[0].id, addhostresponse[0].ipaddress
-
-
- createspcmd = createStoragePool.createStoragePoolCmd()
- createspcmd.zoneid = zoneId
- createspcmd.podid = podId
- createspcmd.clusterid = clusterId
- createspcmd.url = "nfs://nfs2.lab.vmops.com/export/home/edison/primary"
- createspcmd.name = "storage pool" + randomName
- createspresponse = api.createStoragePool(createspcmd)
-
-
-
- addsscmd = addSecondaryStorage.addSecondaryStorageCmd()
- addsscmd.url = "nfs://nfs2.lab.vmops.com/export/home/edison/xen/secondary"
- addsscmd.zoneid = zoneId
- api.addSecondaryStorage(addsscmd)
-
- listtmcmd = listTemplates.listTemplatesCmd()
- listtmcmd.id = templateId
- listtmcmd.zoneid = zoneId
- listtmcmd.templatefilter = "featured"
- listtmresponse = api.listTemplates(listtmcmd)
- while True:
- if listtmresponse is not None and listtmresponse[0].isready == "true":
- break
- time.sleep(30)
- listtmresponse = api.listTemplates(listtmcmd)
-
- vmId = []
- for i in range(vmNum):
- cmd = deployVirtualMachine.deployVirtualMachineCmd()
- cmd.zoneid = zoneId
- cmd.hypervisor = hypervisor
- cmd.serviceofferingid = "1"
- cmd.templateid = listtmresponse[0].id
- res = api.deployVirtualMachine(cmd)
-
- vmId.append(res.id)
-
- registerTempl = registerTemplate.registerTemplateCmd()
- registerTempl.displaytext = "test template4"
- registerTempl.format = "QCOW2"
- registerTempl.hypervisor = "Simulator"
- registerTempl.name = "test template4"
- registerTempl.ostypeid = "100"
- registerTempl.url = "http://www.google.com/template.qcow2"
- registerTempl.zoneid = 1
- registerTemlResponse = api.registerTemplate(registerTempl)
- newtemplateId = registerTemlResponse[0].id
-
- listtempl = listTemplates.listTemplatesCmd()
- listtempl.id = newtemplateId
- listtempl.templatefilter = "self"
- listemplResponse = api.listTemplates(listtempl)
- while True:
- if listemplResponse is not None:
-
- if listemplResponse[0].isready == "true":
- break
- else:
- print listemplResponse[0].status
-
- time.sleep(30)
- listemplResponse = api.listTemplates(listtempl)
-
-
-
- for i in range(10):
- cmd = deployVirtualMachine.deployVirtualMachineCmd()
- cmd.zoneid = 1
- cmd.hypervisor = hypervisor
- cmd.serviceofferingid = "1"
- #cmd.templateid = listemplResponse[0].id
- cmd.templateid = 200
- res = api.deployVirtualMachine(cmd)
-
-
- createvolume = createVolume.createVolumeCmd()
- createvolume.zoneid = 1
- createvolume.diskofferingid = 9
- createvolume.name = "test"
-
- createvolumeresponse = api.createVolume(createvolume)
- volumeId = createvolumeresponse.id
-
- attachvolume = attachVolume.attachVolumeCmd()
- attachvolume.id = volumeId
- attachvolume.virtualmachineid = 9
- attachvolumeresponse = api.attachVolume(attachvolume)
-
- deattachevolume = detachVolume.detachVolumeCmd()
- deattachevolume.id = volumeId
- deattachvolumeresponse = api.detachVolume(deattachevolume)
-
- createsnapshot = createSnapshot.createSnapshotCmd()
- createsnapshot.volumeid = volumeId
- createsnapshotresponse = api.createSnapshot(createsnapshot)
- snapshotId = createsnapshotresponse.id
-
- createtmpl = createTemplate.createTemplateCmd()
- createtmpl.snapshotid = snapshotId
- createtmpl.name = randomName[:10]
- createtmpl.displaytext = randomName[:10]
- createtmpl.ostypeid = 100
- createtmpl.ispublic = "false"
- createtmpl.passwordenabled = "false"
- createtmpl.isfeatured = "false"
- createtmplresponse = api.createTemplate(createtmpl)
- templateId = createtmplresponse.id
-
- createvolume = createVolume.createVolumeCmd()
- createvolume.snapshotid = snapshotId
- createvolume.name = "test"
- createvolumeresponse = api.createVolume(createvolume)
- volumeId = createvolumeresponse.id
-
- cmd = deployVirtualMachine.deployVirtualMachineCmd()
- cmd.zoneid = 1
- cmd.hypervisor = hypervisor
- cmd.serviceofferingid = "1"
- cmd.templateid = templateId
- cmd.name = "fdf"
- res = api.deployVirtualMachine(cmd)
-
-
-
- attachvolume = attachVolume.attachVolumeCmd()
- attachvolume.id = volumeId
- attachvolume.virtualmachineid = 1
- attachvolumeresponse = api.attachVolume(attachvolume)
-
- deattachevolume = detachVolume.detachVolumeCmd()
- deattachevolume.id = volumeId
- deattachvolumeresponse = api.detachVolume(deattachevolume)
-
- deletetmpl = deleteTemplate.deleteTemplateCmd()
- deletetmpl.id = templateId
- deletetmpl.zoneid = 1
- api.deleteTemplate(deletetmpl)
-
- deletevolume = deleteVolume.deleteVolumeCmd()
- deletevolume.id = volumeId
- api.deleteVolume(deletevolume)
-
- deletesnapshot = deleteSnapshot.deleteSnapshotCmd()
- deletesnapshot.id = snapshotId
-
-
\ No newline at end of file