You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2013/12/04 06:57:38 UTC

git commit: updated refs/heads/4.2 to 27c2c12

Updated Branches:
  refs/heads/4.2 3571b2c6a -> 27c2c125d


CLOUDSTACK-5346: Fixed shared network cleanup issue


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

Branch: refs/heads/4.2
Commit: 27c2c125d8e11cba5c58f1fcda57926832f75ebe
Parents: 3571b2c
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 4 11:25:58 2013 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Wed Dec 4 11:27:32 2013 +0530

----------------------------------------------------------------------
 .../component/test_project_resources.py         | 66 ++++++++++++++++----
 1 file changed, 54 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/27c2c125/test/integration/component/test_project_resources.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_resources.py b/test/integration/component/test_project_resources.py
index 9b9b2e6..b7ed60e 100644
--- a/test/integration/component/test_project_resources.py
+++ b/test/integration/component/test_project_resources.py
@@ -17,15 +17,35 @@
 """ P1 tests for Resource creation
 """
 #Import Local Modules
-import marvin
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
-from marvin.sshClient import SshClient
-import datetime
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.integration.lib.base import (VirtualMachine,
+                                         Account,
+                                         Project,
+                                         NATRule,
+                                         PublicIPAddress,
+                                         Network,
+                                         Snapshot,
+                                         Template,
+                                         FireWallRule,
+                                         SecurityGroup,
+                                         ServiceOffering,
+                                         Domain,
+                                         Volume,
+                                         DiskOffering,
+                                         LoadBalancerRule)
+
+from marvin.integration.lib.common import (get_zone,
+                                           get_template,
+                                           get_domain,
+                                           list_volumes,
+                                           list_network_offerings,
+                                           list_lb_rules,
+                                           get_free_vlan,
+                                           wait_for_cleanup)
+
+from marvin.integration.lib.utils import cleanup_resources
+import random
 
 
 class Services:
@@ -98,11 +118,11 @@ class Services:
                         "domain_network": {
                                     "name": "Domainwide Network",
                                     "displaytext": "Domainwide Network",
-                                    "gateway": '192.168.100.1',
+                                    "gateway": '',
                                     "netmask": '255.255.255.0',
-                                    "startip": '192.168.100.200',
-                                    "endip": '192.168.100.201',
-                                    "vlan": 4001,
+                                    "startip": '',
+                                    "endip": '',
+                                    "vlan": '',
                                     "acltype": 'domain'
                         },
                         "natrule": {
@@ -478,6 +498,20 @@ class TestNetwork(cloudstackTestCase):
 
         self.debug("creating a shared network in domain: %s" %
                                                         self.domain.id)
+
+        # Getting physical network and free vlan in it
+        physical_network, vlan = get_free_vlan(self.apiclient, self.zone.id)
+
+        self.services["domain_network"]["vlan"] = vlan
+        self.services["domain_network"]["physicalnetworkid"] = physical_network.id
+
+        # Generating random subnet number for shared network creation
+        shared_network_subnet_number = random.randrange(1,254)
+
+        self.services["domain_network"]["gateway"] = "172.16."+str(shared_network_subnet_number)+".1"
+        self.services["domain_network"]["startip"] = "172.16."+str(shared_network_subnet_number)+".2"
+        self.services["domain_network"]["endip"] = "172.16."+str(shared_network_subnet_number)+".20"
+
         domain_network = Network.create(
                                  self.apiclient,
                                  self.services["domain_network"],
@@ -503,6 +537,14 @@ class TestNetwork(cloudstackTestCase):
                             'Running',
                             "Check VM state is Running or not"
                         )
+
+        # Delete VM before network gets deleted in cleanup
+        virtual_machine.delete(self.apiclient)
+
+        # Wait for expunge interval to cleanup VM
+        wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
+
+        self.cleanup.append(domain_network)
         return