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 6C0FF1108E for ; Fri, 16 May 2014 17:33:01 +0000 (UTC) Received: (qmail 26597 invoked by uid 500); 16 May 2014 10:16:56 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 16324 invoked by uid 500); 16 May 2014 10:16:16 -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 15040 invoked by uid 99); 16 May 2014 10:16:12 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 May 2014 10:16:12 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3779E913E23; Thu, 15 May 2014 15:15:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: girish@apache.org To: commits@cloudstack.apache.org Message-Id: <4d182fbab76d47d9976e570b703586c0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.4-forward to 3c43401 Date: Thu, 15 May 2014 15:15:18 +0000 (UTC) Repository: cloudstack Updated Branches: refs/heads/4.4-forward 77460e955 -> 3c4340144 Code improvement: Persistent Network Test cases, Adding check to verify network state and fail test case in case network state is not as desired Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3c434014 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3c434014 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3c434014 Branch: refs/heads/4.4-forward Commit: 3c43401449595174b177bfeb8346232293ac233e Parents: 77460e9 Author: Gaurav Aradhye Authored: Thu May 15 03:58:13 2014 -0400 Committer: Girish Shilamkar Committed: Thu May 15 04:27:48 2014 -0400 ---------------------------------------------------------------------- .../component/test_persistent_networks.py | 212 ++++++++++++++++--- 1 file changed, 187 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3c434014/test/integration/component/test_persistent_networks.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_persistent_networks.py b/test/integration/component/test_persistent_networks.py index 0350a05..d42ffcd 100644 --- a/test/integration/component/test_persistent_networks.py +++ b/test/integration/component/test_persistent_networks.py @@ -219,7 +219,13 @@ class TestPersistentNetworks(cloudstackTestCase): accountid=self.account.name,domainid=self.domain.id, zoneid=self.zone.id) self.cleanup.append(network) - verifyNetworkState(self.apiclient, network.id, "implemented") + response = verifyNetworkState(self.apiclient, network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(network.vlan, "vlan must not be null for persistent network") try: @@ -238,6 +244,12 @@ class TestPersistentNetworks(cloudstackTestCase): wait_for_cleanup(self.api_client, ["network.gc.interval", "network.gc.wait"]) verifyNetworkState(self.api_client, network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) return @attr(tags=["advanced", "selfservice"]) @@ -325,7 +337,13 @@ class TestPersistentNetworks(cloudstackTestCase): networkofferingid=networkOffering.id, accountid=account.name,domainid=self.domain.id, zoneid=self.zone.id) - verifyNetworkState(self.api_client, isolated_network.id, "allocated") + response = verifyNetworkState(self.api_client, isolated_network.id, "allocated") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) # Update the network with persistent network offering isolated_network.update(self.apiclient, networkofferingid=self.isolated_persistent_network_offering.id, changecidr=changecidr) @@ -369,7 +387,13 @@ class TestPersistentNetworks(cloudstackTestCase): wait_for_cleanup(self.api_client, ["network.gc.interval", "network.gc.wait"]) # Check network state now, this will bolster that network updation has taken effect - verifyNetworkState(self.api_client, isolated_network.id, "implemented") + response = verifyNetworkState(self.api_client, isolated_network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) return @attr(tags=["advanced"]) @@ -394,7 +418,13 @@ class TestPersistentNetworks(cloudstackTestCase): networkofferingid=self.isolated_network_offering.id, accountid=account.name,domainid=self.domain.id, zoneid=self.zone.id) - verifyNetworkState(self.api_client, isolated_network.id, "allocated") + response = verifyNetworkState(self.api_client, isolated_network.id, "allocated") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) # Update network with network offering which has RVR isolated_network.update(self.apiclient, networkofferingid=self.isolated_persistent_network_offering_RVR.id) @@ -436,7 +466,13 @@ class TestPersistentNetworks(cloudstackTestCase): wait_for_cleanup(self.api_client, ["network.gc.interval", "network.gc.wait"]) # Check network state now, this will bolster that network updation has taken effect - verifyNetworkState(self.api_client, isolated_network.id, "implemented") + response = verifyNetworkState(self.api_client, isolated_network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) return @attr(tags=["advanced", "advancedns"]) @@ -467,7 +503,13 @@ class TestPersistentNetworks(cloudstackTestCase): networkofferingid=self.isolated_network_offering_netscaler.id, accountid=account.name,domainid=self.domain.id, zoneid=self.zone.id) - verifyNetworkState(self.api_client, isolated_network.id, "allocated") + response = verifyNetworkState(self.api_client, isolated_network.id, "allocated") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) isolated_network.update(self.apiclient, networkofferingid=self.isolated_persistent_network_offering_netscaler.id, changecidr=True) @@ -507,7 +549,13 @@ class TestPersistentNetworks(cloudstackTestCase): wait_for_cleanup(self.api_client, ["network.gc.interval", "network.gc.wait"]) # Check network state now, this will bolster that network updation has taken effect - verifyNetworkState(self.api_client, isolated_network.id, "implemented") + response = verifyNetworkState(self.api_client, isolated_network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) return @data("LB-VR","LB-Netscaler") @@ -880,7 +928,13 @@ class TestPersistentNetworks(cloudstackTestCase): wait_for_cleanup(self.api_client, ["network.gc.interval", "network.gc.wait"]) # Check network state now, this will bolster that network updation has taken effect - verifyNetworkState(self.api_client, network.id, "allocated") + response = verifyNetworkState(self.api_client, network.id, "allocated") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) return @attr(tags=["advanced"]) @@ -1064,7 +1118,13 @@ class TestAssignVirtualMachine(cloudstackTestCase): networkofferingid=network_offering.id, accountid=account_1.name,domainid=self.domain.id, zoneid=self.zone.id) - verifyNetworkState(self.api_client, network.id, "implemented") + response = verifyNetworkState(self.api_client, network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(network.vlan, "vlan must not be null for persistent network") try: @@ -1173,7 +1233,13 @@ class TestProjectAccountOperations(cloudstackTestCase): networkofferingid=self.isolated_persistent_network_offering.id, accountid=account.name,domainid=self.domain.id, zoneid=self.zone.id) - verifyNetworkState(self.api_client, network.id, "implemented") + response = verifyNetworkState(self.api_client, network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(network.vlan, "vlan must not be null for persistent network") if value == "disabled": @@ -1191,7 +1257,13 @@ class TestProjectAccountOperations(cloudstackTestCase): networks = Network.list(self.apiclient, account=account.name, domainid = account.domainid) self.assertEqual(validateList(networks)[0], PASS, "networks list validation failed, list is %s" % networks) - verifyNetworkState(self.api_client, networks[0].id, "implemented") + response = verifyNetworkState(self.api_client, networks[0].id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(networks[0].vlan, "vlan must not be null for persistent network") return @@ -1242,7 +1314,13 @@ class TestProjectAccountOperations(cloudstackTestCase): # Wait for network cleanup interval wait_for_cleanup(self.api_client, ["network.gc.interval", "network.gc.wait"]) - verifyNetworkState(self.apiclient, network.id, "implemented") + response = verifyNetworkState(self.apiclient, network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) return @ddt @@ -1378,7 +1456,13 @@ class TestRestartPersistentNetwork(cloudstackTestCase): networkofferingid=self.isolated_persistent_network_offering.id, accountid=account.name,domainid=self.domain.id, zoneid=self.zone.id) - verifyNetworkState(self.apiclient, isolated_persistent_network.id, "implemented") + response = verifyNetworkState(self.apiclient, isolated_persistent_network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(isolated_persistent_network.vlan, "vlan must not be null for persistent network") self.debug("Listing routers for network: %s" % isolated_persistent_network.name) @@ -1413,6 +1497,12 @@ class TestRestartPersistentNetwork(cloudstackTestCase): self.assertEqual(validateList(networks)[0], PASS, "networks list validation failed, list is %s" % networks) verifyNetworkState(self.apiclient, networks[0].id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(networks[0].vlan, "vlan must not be null for persistent network") # Deploy VM @@ -1453,7 +1543,13 @@ class TestRestartPersistentNetwork(cloudstackTestCase): networkofferingid=self.isolated_persistent_network_offering_netscaler.id, accountid=account.name,domainid=self.domain.id, zoneid=self.zone.id) - verifyNetworkState(self.apiclient, isolated_persistent_network.id, "implemented") + response = verifyNetworkState(self.apiclient, isolated_persistent_network.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(isolated_persistent_network.vlan, "vlan must not be null for persistent network") self.debug("Listing routers for network: %s" % isolated_persistent_network.name) @@ -1483,7 +1579,13 @@ class TestRestartPersistentNetwork(cloudstackTestCase): networks = Network.list(self.apiclient, account=account.name, domainid = account.domainid) self.assertEqual(validateList(networks)[0], PASS, "networks list validation failed, list is %s" % networks) - verifyNetworkState(self.apiclient, networks[0].id, "implemented") + response = verifyNetworkState(self.apiclient, networks[0].id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(networks[0].vlan, "vlan must not be null for persistent network") # Deploy VM @@ -1685,21 +1787,45 @@ class TestVPCNetworkOperations(cloudstackTestCase): networkofferingid=self.persistent_network_offering_NoLB.id, accountid=account.name,domainid=self.domain.id, zoneid=self.zone.id, vpcid=vpc.id, gateway="10.1.1.1", netmask="255.255.255.0") - verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(persistent_network_1.vlan, "vlan must not be null for persistent network %s" % persistent_network_1.id) persistent_network_2 = Network.create(self.api_client,self.services["isolated_network"], networkofferingid=self.persistent_network_offering_NoLB.id, accountid=account.name,domainid=self.domain.id, zoneid=self.zone.id, vpcid=vpc.id, gateway="10.1.2.1", netmask="255.255.255.0") - verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(persistent_network_2.vlan, "vlan must not be null for persistent network: %s" % persistent_network_2.id) if value == "restart": # Restart VPC vpc.restart(self.apiclient) - verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") - verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) + response = verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) elif value == "delete": vpc.delete(self.apiclient) @@ -1749,14 +1875,26 @@ class TestVPCNetworkOperations(cloudstackTestCase): networkofferingid=self.persistent_network_offering_NoLB.id, accountid=account_1.name,domainid=account_1.domainid, zoneid=self.zone.id, vpcid=vpc_1.id, gateway="10.1.1.1", netmask="255.255.255.0") - verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(persistent_network_1.vlan, "vlan must not be null for persistent network %s" % persistent_network_1.id) persistent_network_2 = Network.create(self.api_client,self.services["isolated_network"], networkofferingid=self.persistent_network_offering_NoLB.id, accountid=account_2.name,domainid=account_2.domainid, zoneid=self.zone.id, vpcid=vpc_2.id, gateway="10.1.1.1", netmask="255.255.255.0") - verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(persistent_network_2.vlan, "vlan must not be null for persistent network: %s" % persistent_network_2.id) # Force delete domain @@ -1810,14 +1948,26 @@ class TestVPCNetworkOperations(cloudstackTestCase): networkofferingid=self.persistent_network_offering_NoLB.id, accountid=account.name,domainid=account.domainid, zoneid=self.zone.id, vpcid=vpc.id, gateway="10.1.1.1", netmask="255.255.255.0") - verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(persistent_network_1.vlan, "vlan must not be null for persistent network %s" % persistent_network_1.id) persistent_network_2 = Network.create(self.api_client,self.services["isolated_network"], networkofferingid=self.persistent_network_offering_LB.id, accountid=account.name,domainid=account.domainid, zoneid=self.zone.id, vpcid=vpc.id, gateway="10.1.2.1", netmask="255.255.255.0") - verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(persistent_network_2.vlan, "vlan must not be null for persistent network: %s" % persistent_network_2.id) # Deploy VMs in above networks (VM1, VM2 in network1 and VM3, VM4 in network2) @@ -1921,14 +2071,26 @@ class TestVPCNetworkOperations(cloudstackTestCase): networkofferingid=self.persistent_network_offering_NoLB.id, accountid=account.name,domainid=account.domainid, zoneid=self.zone.id, vpcid=vpc.id, gateway="10.1.1.1", netmask="255.255.255.0") - verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_1.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(persistent_network_1.vlan, "vlan must not be null for persistent network %s" % persistent_network_1.id) persistent_network_2 = Network.create(self.api_client,self.services["isolated_network"], networkofferingid=self.persistent_network_offering_LB.id, accountid=account.name,domainid=account.domainid, zoneid=self.zone.id, vpcid=vpc.id, gateway="10.1.2.1", netmask="255.255.255.0") - verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + response = verifyNetworkState(self.apiclient, persistent_network_2.id, "implemented") + exceptionOccured = response[0] + isNetworkInDesiredState = response[1] + exceptionMessage = response[2] + + if (exceptionOccured or (not isNetworkInDesiredState)): + self.fail(exceptionMessage) self.assertIsNotNone(persistent_network_2.vlan, "vlan must not be null for persistent network: %s" % persistent_network_2.id) # Deploy VMs in above networks (VM1, VM2 in network1 and VM3, VM4 in network2)