Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C07FDF412 for ; Mon, 25 Mar 2013 13:08:01 +0000 (UTC) Received: (qmail 57416 invoked by uid 500); 25 Mar 2013 13:08:01 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 57093 invoked by uid 500); 25 Mar 2013 13:07:54 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 57066 invoked by uid 99); 25 Mar 2013 13:07:54 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Mar 2013 13:07:54 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 00E1832ABDE; Mon, 25 Mar 2013 13:07:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: commits@cloudstack.apache.org Date: Mon, 25 Mar 2013 13:07:54 -0000 Message-Id: <3f72dd0737eb4912b6250ec249839cb1@git.apache.org> In-Reply-To: <4544549f35a64c17a93cf6aab0900525@git.apache.org> References: <4544549f35a64c17a93cf6aab0900525@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: refs/heads/bvt - simulator+marvin: include a router test simulator+marvin: include a router test Added a test that will ensure the advanced router comes up in the account belonging to the deployed VM. It should come up with the publicip, guestip and linklocalip. Signed-off-by: Prasanna Santhanam Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3307dbae Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3307dbae Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3307dbae Branch: refs/heads/bvt Commit: 3307dbaecb58d2afe431498ea1582a8d1303595f Parents: 4fcc97b Author: Prasanna Santhanam Authored: Mon Mar 25 18:36:37 2013 +0530 Committer: Prasanna Santhanam Committed: Mon Mar 25 18:36:37 2013 +0530 ---------------------------------------------------------------------- test/integration/smoke/test_vm_life_cycle.py | 137 ++++++++++++--------- tools/marvin/pom.xml | 22 ---- 2 files changed, 79 insertions(+), 80 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3307dbae/test/integration/smoke/test_vm_life_cycle.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index 51e02ea..9d6c249 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -129,72 +129,79 @@ class Services: class TestDeployVM(cloudstackTestCase): - def setUp(self): - - self.apiclient = self.testClient.getApiClient() - self.dbclient = self.testClient.getDbConnection() - self.services = Services().services + @classmethod + def setUpClass(cls): + cls.services = Services().services + cls.apiclient = super(TestDeployVM, cls).getClsTestClient().getApiClient() # Get Zone, Domain and templates - domain = get_domain(self.apiclient, self.services) - zone = get_zone(self.apiclient, self.services) - self.services['mode'] = zone.networktype + domain = get_domain(cls.apiclient, cls.services) + zone = get_zone(cls.apiclient, cls.services) + cls.services['mode'] = zone.networktype - #if local storage is enabled, alter the offerings to use localstorage + #If local storage is enabled, alter the offerings to use localstorage #this step is needed for devcloud if zone.localstorageenabled == True: - self.services["service_offerings"]["tiny"]["storagetype"] = 'local' - self.services["service_offerings"]["small"]["storagetype"] = 'local' - self.services["service_offerings"]["medium"]["storagetype"] = 'local' + cls.services["service_offerings"]["tiny"]["storagetype"] = 'local' + cls.services["service_offerings"]["small"]["storagetype"] = 'local' + cls.services["service_offerings"]["medium"]["storagetype"] = 'local' template = get_template( - self.apiclient, - zone.id, - self.services["ostype"] - ) + cls.apiclient, + zone.id, + cls.services["ostype"] + ) # Set Zones and disk offerings - self.services["small"]["zoneid"] = zone.id - self.services["small"]["template"] = template.id + cls.services["small"]["zoneid"] = zone.id + cls.services["small"]["template"] = template.id - self.services["medium"]["zoneid"] = zone.id - self.services["medium"]["template"] = template.id - self.services["iso"]["zoneid"] = zone.id + cls.services["medium"]["zoneid"] = zone.id + cls.services["medium"]["template"] = template.id + cls.services["iso"]["zoneid"] = zone.id - # Create Account, VMs, NAT Rules etc - self.account = Account.create( - self.apiclient, - self.services["account"], - domainid=domain.id - ) + cls.account = Account.create( + cls.apiclient, + cls.services["account"], + domainid=domain.id + ) + + cls.service_offering = ServiceOffering.create( + cls.apiclient, + cls.services["service_offerings"]["tiny"] + ) + + cls.virtual_machine = VirtualMachine.create( + cls.apiclient, + cls.services["small"], + accountid=cls.account.account.name, + domainid=cls.account.account.domainid, + serviceofferingid=cls.service_offering.id, + mode=cls.services['mode'] + ) + + cls.cleanup = [ + cls.service_offering, + cls.account + ] + + @classmethod + def tearDownClass(cls): + try: + cleanup_resources(cls.apiclient, cls.cleanup) + except Exception as e: + cls.debug("Warning! Exception in tearDown: %s" % e) + + def setUp(self): + self.apiclient = self.testClient.getApiClient() + self.dbclient = self.testClient.getDbConnection() - self.service_offering = ServiceOffering.create( - self.apiclient, - self.services["service_offerings"]["tiny"] - ) - # Cleanup - self.cleanup = [ - self.service_offering, - self.account - ] @attr(tags = ["simulator", "devcloud", "advanced", "advancedns", "smoke", "basic", "sg"]) def test_deploy_vm(self): """Test Deploy Virtual Machine """ - # Validate the following: # 1. Virtual Machine is accessible via SSH # 2. listVirtualMachines returns accurate information - # 3. The Cloud Database contains the valid information - - self.virtual_machine = VirtualMachine.create( - self.apiclient, - self.services["small"], - accountid=self.account.account.name, - domainid=self.account.account.domainid, - serviceofferingid=self.service_offering.id, - mode=self.services['mode'] - ) - list_vm_response = list_virtual_machines( self.apiclient, id=self.virtual_machine.id @@ -204,46 +211,60 @@ class TestDeployVM(cloudstackTestCase): "Verify listVirtualMachines response for virtual machine: %s" \ % self.virtual_machine.id ) - self.assertEqual( isinstance(list_vm_response, list), True, "Check list response returns a valid list" ) - self.assertNotEqual( len(list_vm_response), 0, "Check VM available in List Virtual Machines" ) vm_response = list_vm_response[0] - self.assertEqual( vm_response.id, self.virtual_machine.id, "Check virtual machine id in listVirtualMachines" ) - self.assertEqual( vm_response.name, self.virtual_machine.name, "Check virtual machine name in listVirtualMachines" ) - self.assertEqual( vm_response.state, 'Running', msg="VM is not in Running state" ) - return + + @attr(tags = ["simulator", "advanced"]) + def test_advZoneVirtualRouter(self): + """ + Test advanced zone virtual router + 1. Is Running + 2. is in the account the VM was deployed in + 3. Has a linklocalip, publicip and a guestip + @return: + """ + routers = list_routers(self.apiclient, account=self.account.account.name) + self.assertTrue(len(routers) > 0, msg = "No virtual router found") + router = routers[0] + + self.assertEqual(router.state, 'Running', msg="Router is not in running state") + self.assertEqual(router.account, self.account.account.name, msg="Router does not belong to the account") + + #Has linklocal, public and guest ips + self.assertIsNotNone(router.linklocalip, msg="Router has no linklocal ip") + self.assertIsNotNone(router.publicip, msg="Router has no public ip") + self.assertIsNotNone(router.guestipaddress, msg="Router has no guest ip") + def tearDown(self): - try: - cleanup_resources(self.apiclient, self.cleanup) - except Exception as e: - self.debug("Warning! Exception in tearDown: %s" % e) + pass + class TestVMLifeCycle(cloudstackTestCase): http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3307dbae/tools/marvin/pom.xml ---------------------------------------------------------------------- diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml index e9ca189..bf90ab3 100644 --- a/tools/marvin/pom.xml +++ b/tools/marvin/pom.xml @@ -138,28 +138,6 @@ -