From 2e2046fe389b79b2b105ef40b792263cee831929 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Thu, 21 Mar 2013 20:02:23 +0530 Subject: [PATCH] marvin changes to do an pre-integration and integration test Introducing the simulator spring context - simulatorComponentContext.xml.in. This separates the simulator beans so that production deployments don't have the simulator in them. Context is enabled with -Dsimulator as part of the developer profile. Also adding config files - Simulator Config for advanced zone and basic zone deployments under setup/dev. Signed-off-by: Prasanna Santhanam --- client/pom.xml | 67 +++-- client/tomcatconf/componentContext.xml.in | 9 - .../simulatorComponentContext.xml.in | 270 ++++++++++++++++++ setup/db/templates.simulator.sql | 2 +- .../simulator.cfg => setup/dev/advanced.cfg | 167 ++++++----- setup/dev/basic.cfg | 178 ++++++++++++ test/integration/smoke/test_vm_life_cycle.py | 14 +- tools/marvin/marvin/testSetupSuccess.py | 5 + tools/marvin/pom.xml | 49 ++-- 9 files changed, 626 insertions(+), 135 deletions(-) create mode 100644 client/tomcatconf/simulatorComponentContext.xml.in rename tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg => setup/dev/advanced.cfg (54%) create mode 100644 setup/dev/basic.cfg diff --git a/client/pom.xml b/client/pom.xml index 75650295849..91dfece3952 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -218,6 +218,10 @@ org.apache.cloudstack cloud-plugin-hypervisor-simulator ${project.version} + + org.apache.cloudstack + cloud-plugin-storage-volume-default + ${project.version} @@ -376,22 +380,38 @@ - - process-nonoss - process-resources - - run - - - - test - - - - + + process-nonoss + process-resources + + run + + + + test + + + + + + process-simulator-context + process-resources + + run + + + + test + + + + process-nonoss-spring-context process-resources @@ -480,6 +500,21 @@ + + developer + + + simulator + + + + + org.apache.cloudstack + cloud-plugin-hypervisor-simulator + ${project.version} + + + netapp diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in index d5714ea9f01..584be9787e8 100644 --- a/client/tomcatconf/componentContext.xml.in +++ b/client/tomcatconf/componentContext.xml.in @@ -203,11 +203,6 @@ - - - - - @@ -304,10 +299,6 @@ - - - - diff --git a/client/tomcatconf/simulatorComponentContext.xml.in b/client/tomcatconf/simulatorComponentContext.xml.in new file mode 100644 index 00000000000..d501ca1d10e --- /dev/null +++ b/client/tomcatconf/simulatorComponentContext.xml.in @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/setup/db/templates.simulator.sql b/setup/db/templates.simulator.sql index 13246233c16..a8044504487 100755 --- a/setup/db/templates.simulator.sql +++ b/setup/db/templates.simulator.sql @@ -19,4 +19,4 @@ INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, image_data_store_id) VALUES (10, UUID(), 'simulator-domR', 'SystemVM Template (simulator)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/latest/systemvm.vhd.bz2', '', 0, 'SystemVM Template (simulator)', 'VHD', 15, 0, 1, 'Simulator', 1); INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, image_data_store_id) - VALUES (11, UUID(), 'simulator-Centos', 'CentOS 5.3(64-bit) no GUI (Simulator)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', '', 0, 'CentOS 5.3(64-bit) no GUI (Simulator)', 'VHD', 11, 1, 1, 'Simulator', 1); + VALUES (11, UUID(), 'simulator-Centos', 'CentOS 5.3(64-bit) no GUI (Simulator)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', '', 0, 'CentOS 5.3(64-bit) no GUI (Simulator)', 'VHD', 12, 1, 1, 'Simulator', 1); diff --git a/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg b/setup/dev/advanced.cfg similarity index 54% rename from tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg rename to setup/dev/advanced.cfg index ca794605540..c031c2a4f84 100644 --- a/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg +++ b/setup/dev/advanced.cfg @@ -5,9 +5,9 @@ # 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 @@ -15,181 +15,180 @@ # specific language governing permissions and limitations # under the License. - { "zones": [ { - "name": "Sandbox-simulator", - "guestcidraddress": "10.1.1.0/24", - "dns1": "10.147.28.6", - "vlan": "100-200", + "name": "Sandbox-simulator", + "guestcidraddress": "10.1.1.0/24", + "dns1": "10.147.28.6", "physical_networks": [ { - "broadcastdomainrange": "Zone", - "name": "Sandbox-pnet", + "broadcastdomainrange": "Zone", + "vlan": "100-200", + "name": "Sandbox-pnet", "traffictypes": [ { "typ": "Guest" - }, + }, { "typ": "Management" - }, + }, { "typ": "Public" } - ], + ], "providers": [ { - "broadcastdomainrange": "ZONE", + "broadcastdomainrange": "ZONE", "name": "VirtualRouter" - }, + }, { - "broadcastdomainrange": "ZONE", + "broadcastdomainrange": "ZONE", "name": "VpcVirtualRouter" } ] } - ], + ], "ipranges": [ { - "startip": "192.168.2.2", - "endip": "192.168.2.200", - "netmask": "255.255.255.0", - "vlan": "50", + "startip": "192.168.2.2", + "endip": "192.168.2.200", + "netmask": "255.255.255.0", + "vlan": "50", "gateway": "192.168.2.1" } - ], - "networktype": "Advanced", + ], + "networktype": "Advanced", "pods": [ { - "endip": "172.16.15.200", - "name": "POD0", - "startip": "172.16.15.2", - "netmask": "255.255.255.0", + "endip": "172.16.15.200", + "name": "POD0", + "startip": "172.16.15.2", + "netmask": "255.255.255.0", "clusters": [ { - "clustername": "C0", - "hypervisor": "simulator", + "clustername": "C0", + "hypervisor": "simulator", "hosts": [ { - "username": "root", - "url": "http://sim/c0/h0", + "username": "root", + "url": "http://sim/c0/h0", "password": "password" - }, + }, { - "username": "root", - "url": "http://sim/c0/h1", + "username": "root", + "url": "http://sim/c0/h1", "password": "password" } - ], - "clustertype": "CloudManaged", + ], + "clustertype": "CloudManaged", "primaryStorages": [ { - "url": "nfs://10.147.28.6:/export/home/sandbox/primary", + "url": "nfs://10.147.28.6:/export/home/sandbox/primary", "name": "PS0" } ] } - ], + ], "gateway": "172.16.15.1" } - ], - "internaldns1": "10.147.28.6", + ], + "internaldns1": "10.147.28.6", "secondaryStorages": [ { "url": "nfs://10.147.28.6:/export/home/sandbox/secondary" } ] } - ], + ], "dbSvr": { - "dbSvr": "localhost", - "passwd": "cloud", - "db": "cloud", - "port": 3306, + "dbSvr": "localhost", + "passwd": "cloud", + "db": "cloud", + "port": 3306, "user": "cloud" - }, + }, "logger": [ { - "name": "TestClient", + "name": "TestClient", "file": "/tmp/testclient.log" - }, + }, { - "name": "TestCase", + "name": "TestCase", "file": "/tmp/testcase.log" } - ], + ], "globalConfig": [ { - "name": "network.gc.wait", + "name": "network.gc.wait", "value": "60" - }, + }, { - "name": "storage.cleanup.interval", + "name": "storage.cleanup.interval", "value": "300" - }, + }, { - "name": "vm.op.wait.interval", + "name": "vm.op.wait.interval", "value": "5" - }, + }, { - "name": "default.page.size", + "name": "default.page.size", "value": "10000" - }, + }, { - "name": "network.gc.interval", + "name": "network.gc.interval", "value": "60" - }, + }, { - "name": "instance.name", + "name": "instance.name", "value": "QA" - }, + }, { - "name": "workers", + "name": "workers", "value": "10" - }, + }, { - "name": "account.cleanup.interval", + "name": "account.cleanup.interval", "value": "600" - }, + }, { - "name": "guest.domain.suffix", + "name": "guest.domain.suffix", "value": "sandbox.simulator" - }, + }, { - "name": "expunge.delay", + "name": "expunge.delay", "value": "60" - }, + }, { - "name": "vm.allocation.algorithm", + "name": "vm.allocation.algorithm", "value": "random" - }, + }, { - "name": "expunge.interval", + "name": "expunge.interval", "value": "60" - }, + }, { - "name": "expunge.workers", + "name": "expunge.workers", "value": "3" - }, + }, { - "name": "check.pod.cidrs", + "name": "check.pod.cidrs", "value": "true" - }, + }, { - "name": "secstorage.allowed.internal.sites", + "name": "secstorage.allowed.internal.sites", "value": "10.147.28.0/24" - }, + }, { - "name": "direct.agent.load.size", + "name": "direct.agent.load.size", "value": "1000" } - ], + ], "mgtSvr": [ { - "mgtSvrIp": "localhost", - "passwd": "password", - "user": "root", + "mgtSvrIp": "localhost", + "passwd": "password", + "user": "root", "port": 8096 } ] diff --git a/setup/dev/basic.cfg b/setup/dev/basic.cfg new file mode 100644 index 00000000000..fb99b8b5498 --- /dev/null +++ b/setup/dev/basic.cfg @@ -0,0 +1,178 @@ +# 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. + + +{ + "zones": [ + { + "name": "Sandbox-simulator", + "dns1": "8.8.8.8", + "physical_networks": [ + { + "broadcastdomainrange": "Zone", + "name": "Sandbox-pnet", + "traffictypes": [ + { + "typ": "Guest" + }, + { + "typ": "Management" + } + ], + "providers": [ + { + "broadcastdomainrange": "ZONE", + "name": "VirtualRouter" + }, + { + "broadcastdomainrange": "Pod", + "name": "SecurityGroupProvider" + } + ] + } + ], + "securitygroupenabled": "true", + "networktype": "Basic", + "pods": [ + { + "endip": "172.16.15.254", + "name": "POD0", + "startip": "172.16.15.2", + "guestIpRanges": [ + { + "startip": "60.147.41.2", + "endip": "60.147.41.254", + "netmask": "255.255.255.0", + "gateway": "60.147.40.1" + } + ], + "netmask": "255.255.255.0", + "clusters": [ + { + "clustername": "C0", + "hypervisor": "simulator", + "hosts": [ + { + "username": "root", + "url": "http://sim/c0/h0", + "password": "password" + } + ], + "clustertype": "CloudManaged", + "primaryStorages": [ + { + "url": "nfs://nfsstor:/export/home/sandbox/primary", + "name": "PS0" + } + ] + } + ], + "gateway": "172.16.15.1" + } + ], + "internaldns1": "8.8.8.8", + "secondaryStorages": [ + { + "url": "nfs://nfsstor:/export/home/sandbox/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": "direct.agent.load.size", + "value": "1000" + }, + { + "name": "default.page.size", + "value": "10000" + }, + { + "name": "instance.name", + "value": "QA" + }, + { + "name": "workers", + "value": "10" + }, + { + "name": "vm.op.wait.interval", + "value": "5" + }, + { + "name": "account.cleanup.interval", + "value": "600" + }, + { + "name": "guest.domain.suffix", + "value": "sandbox.simulator" + }, + { + "name": "expunge.delay", + "value": "60" + }, + { + "name": "vm.allocation.algorithm", + "value": "random" + }, + { + "name": "expunge.interval", + "value": "60" + }, + { + "name": "expunge.workers", + "value": "3" + }, + { + "name": "secstorage.allowed.internal.sites", + "value": "172.16.15.0/24" + }, + { + "name": "check.pod.cidrs", + "value": "true" + } + ], + "mgtSvr": [ + { + "mgtSvrIp": "localhost", + "passwd": "password", + "user": "root", + "port": 8096 + } + ] +} diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index 719984d4fd9..143fea71975 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -20,7 +20,6 @@ import marvin from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * -from marvin.remoteSSHClient import remoteSSHClient from marvin.integration.lib.utils import * from marvin.integration.lib.base import * from marvin.integration.lib.common import * @@ -177,7 +176,7 @@ class TestDeployVM(cloudstackTestCase): self.account ] - @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"]) + @attr(tags = ["simulator", "devcloud", "advanced", "advancedns", "smoke", "basic", "sg"]) def test_deploy_vm(self): """Test Deploy Virtual Machine """ @@ -231,6 +230,13 @@ class TestDeployVM(cloudstackTestCase): self.virtual_machine.name, "Check virtual machine name in listVirtualMachines" ) + + self.assertEqual( + vm_response.state, + 'Running', + msg="VM is not in Running state" + ) + return def tearDown(self): @@ -996,6 +1002,4 @@ class TestVMLifeCycle(cloudstackTestCase): False, "Check if ISO is detached from virtual machine" ) - return - - + return \ No newline at end of file diff --git a/tools/marvin/marvin/testSetupSuccess.py b/tools/marvin/marvin/testSetupSuccess.py index b1721c40d3b..dcd15e674eb 100644 --- a/tools/marvin/marvin/testSetupSuccess.py +++ b/tools/marvin/marvin/testSetupSuccess.py @@ -76,6 +76,11 @@ class TestSetupSuccess(cloudstackTestCase): delay(60) #wait a minute for retry self.assertNotEqual(retry, 0, "builtIn templates not ready in zone %s"%z.name) + def test_deployVmWithBuiltIn(self): + """ + Deploys a VM with the built-in CentOS template + """ + @classmethod def tearDownClass(cls): pass diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml index 194d7841030..ff5176fbcb6 100644 --- a/tools/marvin/pom.xml +++ b/tools/marvin/pom.xml @@ -48,8 +48,8 @@ 1.2.1 - compile - compile + generate-sources + generate-sources exec @@ -80,7 +80,6 @@ - @@ -88,7 +87,9 @@ marvin - marvin.config + + marvin.config + @@ -96,24 +97,32 @@ org.codehaus.mojo exec-maven-plugin 1.2.1 - - ${basedir}/marvin - python - - deployAndRun.py - -c - ${user.dir}/${marvin.config} - -t - /tmp/t.log - -r - /tmp/r.log - -f - ${basedir}/marvin/testSetupSuccess.py - - - test + pre-integration-test + pre-integration-test + + exec + + + ${basedir}/marvin + python + + deployAndRun.py + -c + ${user.dir}/${marvin.config} + -t + /tmp/t.log + -r + /tmp/r.log + -f + ${basedir}/marvin/testSetupSuccess.py + + + + + integration-test + integration-test exec