You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2022/12/31 13:45:55 UTC

[cloudstack] branch main updated: revert cleanup of test_acl_sharenetworks (#7033)

This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 73a610da943 revert cleanup of test_acl_sharenetworks (#7033)
73a610da943 is described below

commit 73a610da94308df549eb0660ead2f6126331c82a
Author: dahn <da...@onecht.net>
AuthorDate: Sat Dec 31 05:45:03 2022 -0800

    revert cleanup of test_acl_sharenetworks (#7033)
---
 .../component/test_acl_sharednetwork.py            | 311 +++++++++++----------
 1 file changed, 156 insertions(+), 155 deletions(-)

diff --git a/test/integration/component/test_acl_sharednetwork.py b/test/integration/component/test_acl_sharednetwork.py
index 2d538f6c6f9..42f4a899e12 100644
--- a/test/integration/component/test_acl_sharednetwork.py
+++ b/test/integration/component/test_acl_sharednetwork.py
@@ -59,7 +59,7 @@ class TestSharedNetwork(cloudstackTestCase):
         cls.acldata = cls.testdata["acl"]
         cls.domain_1 = None
         cls.domain_2 = None
-        cls._cleanup = []
+        cls.cleanup = []
 
 
         try:
@@ -72,30 +72,25 @@ class TestSharedNetwork(cloudstackTestCase):
                                        cls.apiclient,
                                        cls.acldata["domain1"]
                                        )
-            cls._cleanup.append(cls.domain_1)
             cls.domain_11 = Domain.create(
                                        cls.apiclient,
                                        cls.acldata["domain11"],
                                    parentdomainid=cls.domain_1.id
                                        )
-            cls._cleanup.append(cls.domain_11)
             cls.domain_111 = Domain.create(
                                        cls.apiclient,
                                        cls.acldata["domain111"],
                                    parentdomainid=cls.domain_11.id,
                                        )
-            cls._cleanup.append(cls.domain_111)
             cls.domain_12 = Domain.create(
                                        cls.apiclient,
                                        cls.acldata["domain12"],
                                    parentdomainid=cls.domain_1.id
                                        )
-            cls._cleanup.append(cls.domain_12)
             cls.domain_2 = Domain.create(
                                        cls.apiclient,
                                        cls.acldata["domain2"]
                                        )
-            cls._cleanup.append(cls.domain_2)
             # Create  1 admin account and 2 user accounts for doamin_1
             cls.account_d1 = Account.create(
                                 cls.apiclient,
@@ -103,7 +98,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=True,
                                 domainid=cls.domain_1.id
                                 )
-            cls._cleanup.append(cls.account_d1)
 
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
             cls.user_d1_apikey = user.apikey
@@ -115,7 +109,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_1.id
                                 )
-            cls._cleanup.append(cls.account_d1a)
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
             cls.user_d1a_apikey = user.apikey
             cls.user_d1a_secretkey = user.secretkey
@@ -127,7 +120,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_1.id
                                 )
-            cls._cleanup.append(cls.account_d1b)
 
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
             cls.user_d1b_apikey = user.apikey
@@ -140,7 +132,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=True,
                                 domainid=cls.domain_11.id
                                 )
-            cls._cleanup.append(cls.account_d11)
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
             cls.user_d11_apikey = user.apikey
             cls.user_d11_secretkey = user.secretkey
@@ -151,7 +142,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_11.id
                                 )
-            cls._cleanup.append(cls.account_d11a)
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
             cls.user_d11a_apikey = user.apikey
             cls.user_d11a_secretkey = user.secretkey
@@ -162,7 +152,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_11.id
                                 )
-            cls._cleanup.append(cls.account_d11b)
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
             cls.user_d11b_apikey = user.apikey
             cls.user_d11b_secretkey = user.secretkey
@@ -175,7 +164,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=True,
                                 domainid=cls.domain_111.id
                                 )
-            cls._cleanup.append(cls.account_d111)
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
             cls.user_d111_apikey = user.apikey
             cls.user_d111_secretkey = user.secretkey
@@ -186,7 +174,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_111.id
                                 )
-            cls._cleanup.append(cls.account_d111a)
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
             cls.user_d111a_apikey = user.apikey
             cls.user_d111a_secretkey = user.secretkey
@@ -197,7 +184,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_111.id
                                 )
-            cls._cleanup.append(cls.account_d111b)
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
             cls.user_d111b_apikey = user.apikey
             cls.user_d111b_secretkey = user.secretkey
@@ -209,7 +195,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_12.id
                                 )
-            cls._cleanup.append(cls.account_d12a)
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
             cls.user_d12a_apikey = user.apikey
             cls.user_d12a_secretkey = user.secretkey
@@ -220,7 +205,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_12.id
                                 )
-            cls._cleanup.append(cls.account_d12b)
 
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
             cls.user_d12b_apikey = user.apikey
@@ -234,7 +218,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 admin=False,
                                 domainid=cls.domain_2.id
                                 )
-            cls._cleanup.append(cls.account_d2a)
 
             user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
             cls.user_d2a_apikey = user.apikey
@@ -248,7 +231,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 cls.acldata["accountROOTA"],
                                 admin=False,
                                 )
-            cls._cleanup.append(cls.account_roota)
 
             user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
             cls.user_roota_apikey = user.apikey
@@ -259,7 +241,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                 cls.acldata["accountROOTA"],
                                 admin=True,
                                 )
-            cls._cleanup.append(cls.account_root)
 
             user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
             cls.user_root_apikey = user.apikey
@@ -270,7 +251,6 @@ class TestSharedNetwork(cloudstackTestCase):
                                     cls.apiclient,
                                     cls.acldata["service_offering"]["small"]
                                     )
-            cls._cleanup.append(cls.service_offering)
 
             cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
             cls.acldata['mode'] = cls.zone.networktype
@@ -299,7 +279,6 @@ class TestSharedNetwork(cloudstackTestCase):
                              networkofferingid=cls.shared_network_offering_id,
                              zoneid=cls.zone.id
                              )
-            cls._cleanup.append(cls.shared_network_all)
 
             cls.shared_network_domain_d11 =  Network.create(
                              cls.apiclient,
@@ -309,7 +288,6 @@ class TestSharedNetwork(cloudstackTestCase):
                              domainid=cls.domain_11.id,
                              subdomainaccess=False
                              )
-            cls._cleanup.append(cls.shared_network_domain_d11)
 
             cls.shared_network_domain_with_subdomain_d11 =  Network.create(
                              cls.apiclient,
@@ -319,7 +297,6 @@ class TestSharedNetwork(cloudstackTestCase):
                              domainid=cls.domain_11.id,
                             subdomainaccess=True
                              )
-            cls._cleanup.append(cls.shared_network_domain_with_subdomain_d11)
 
             cls.shared_network_account_d111a =  Network.create(
                              cls.apiclient,
@@ -329,35 +306,40 @@ class TestSharedNetwork(cloudstackTestCase):
                              domainid=cls.domain_111.id,
                              accountid=cls.account_d111a.user[0].username
                         )
-            cls._cleanup.append(cls.shared_network_account_d111a)
             cls.vmdata = {"name": "test",
                           "displayname" : "test"
                           }
+            cls.cleanup = [
+                            cls.account_root,
+                            cls.account_roota,
+                            cls.shared_network_all,
+                            cls.service_offering,
+                            ]
         except Exception as e:
-            cls.tearDownClass()
-            raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
+                cls.domain_1.delete(cls.apiclient,cleanup="true")
+                cls.domain_2.delete(cls.apiclient,cleanup="true")
+                cleanup_resources(cls.apiclient, cls.cleanup)
+                raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
 
     @classmethod
     def tearDownClass(cls):
+        cls.apiclient = super(TestSharedNetwork, cls).getClsTestClient().getApiClient()
         cls.apiclient.connection.apiKey = cls.default_apikey
         cls.apiclient.connection.securityKey = cls.default_secretkey
         cls.domain_1.delete(cls.apiclient,cleanup="true")
         cls.domain_2.delete(cls.apiclient,cleanup="true")
         cleanup_resources(cls.apiclient, cls.cleanup)
-#        super(TestSharedNetwork, cls).tearDownClass()
+        return
 
-    def setUp(self):
-        self.debug(f"===setup===")
-        self.apiclient = self.testClient.getApiClient()
-        self.dbclient = self.testClient.getDbConnection()
-        self.cleanup = []
+    def setUp(cls):
+        cls.apiclient = cls.testClient.getApiClient()
+        cls.dbclient = cls.testClient.getDbConnection()
 
-    def tearDown(self):
+    def tearDown(cls):
         # restore back default apikey and secretkey
-        self.apiclient.connection.apiKey = self.default_apikey
-        self.apiclient.connection.securityKey = self.default_secretkey
-        self.debug(f"===tearDown=== cleanup list length {self.cleanup.len()}")
-        super(TestSharedNetwork, self).tearDown()
+        cls.apiclient.connection.apiKey = cls.default_apikey
+        cls.apiclient.connection.securityKey = cls.default_secretkey
+        return
 
 ## Test cases relating to deploying Virtual Machine in shared network with scope=all
 
@@ -373,7 +355,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-all"
         self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-all"
 
-        vm = VirtualMachine.create(
+        vm_d1a = VirtualMachine.create(
             self.apiclient,
             self.vmdata,
             zoneid=self.zone.id,
@@ -381,16 +363,17 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_all.id
         )
-        self.cleanup.append(vm)
 
-        self.assertEqual(vm.state == "Running",
+        self.assertEqual(vm_d1a.state == "Running",
                     True,
                     "User in a domain under ROOT failed to deploy VM in a shared network with scope=all")
 
+
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_all_domainadminuser(self):
         """
         Validate that regular user in "ROOT" domain is allowed to deploy VM in a shared network created with scope="all"
+
         """
         # deploy VM as  an admin user in a domain under ROOT
 
@@ -407,24 +390,25 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_all.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
                     "Admin User in a domain under ROOT failed to deploy VM in a shared network with scope=all")
 
+
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_all_subdomainuser(self):
         """
         Validate that regular user in any subdomain is allowed to deploy VM in a shared network created with scope="all"
         """
+
         # deploy VM as user in a subdomain under ROOT
 
         self.apiclient.connection.apiKey = self.user_d11a_apikey
         self.apiclient.connection.securityKey = self.user_d11a_secretkey
         self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-all"
         self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-all"
-        vm = VirtualMachine.create(
+        vm_d11a = VirtualMachine.create(
             self.apiclient,
             self.vmdata,
             zoneid=self.zone.id,
@@ -432,9 +416,8 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_all.id
         )
-        self.cleanup.append(vm)
 
-        self.assertEqual(vm.state == "Running",
+        self.assertEqual(vm_d11a.state == "Running",
                     True,
                     "User in a domain under ROOT failed to deploy VM in a shared network with scope=all")
 
@@ -442,6 +425,7 @@ class TestSharedNetwork(cloudstackTestCase):
     def test_deployVM_in_sharedNetwork_scope_all_subdomainadminuser(self):
         """
         Validate that regular user in a subdomain under ROOT is allowed to deploy VM in a shared network created with scope="all"
+
         """
         # deploy VM as an admin user in a subdomain under ROOT
 
@@ -457,16 +441,17 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_all.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
                     "Admin User in a domain under ROOT failed to deploy VM in a shared network with scope=all")
 
+
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_all_ROOTuser(self):
         """
         Validate that regular user in ROOT domain is allowed to deploy VM in a shared network created with scope="all"
+
         """
         # deploy VM as user in ROOT domain
 
@@ -482,7 +467,6 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_all.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
@@ -507,7 +491,6 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_all.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
@@ -520,6 +503,7 @@ class TestSharedNetwork(cloudstackTestCase):
         """
         Validate that regular user in a domain is allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
         """
+
         # deploy VM as user in a domain that has shared network with no subdomain access
 
         self.apiclient.connection.apiKey = self.user_d11a_apikey
@@ -535,16 +519,17 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_domain_d11.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
                     "User in a domain that has a shared network with no subdomain access failed to deploy VM in a shared network with scope=domain with no subdomain access")
 
+
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_domainadminuser(self):
         """
         Validate that admin user in a domain is allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
+
         """
         #deploy VM as an admin user in a domain that has shared network with no subdomain access
 
@@ -561,7 +546,6 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_domain_d11.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
@@ -571,6 +555,7 @@ class TestSharedNetwork(cloudstackTestCase):
     def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_subdomainuser(self):
         """
         Validate that regular user in a subdomain is NOT allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
+
         """
         # deploy VM as user in a subdomain under  a domain that has shared network with no subdomain access
 
@@ -579,7 +564,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-nosubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] +"-shared-scope-domain-nosubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -587,17 +572,17 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_d11.id
                 )
-            self.cleanup.append(vm)
-            self.fail("Subdomain user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
+                self.fail("Subdomain user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
         except Exception as e:
-            self.debug ("When a user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when Subdomain user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+                self.debug ("When a user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when Subdomain user tries to deploy VM in a shared network with scope=domain with no subdomain access")
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_subdomainadminuser(self):
         """
         Validate that admin user in a subdomain is NOT allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
+
         """
         # deploy VM as an admin user in a subdomain under  a domain that has shared network with no subdomain access
 
@@ -606,7 +591,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-nosubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] +"-shared-scope-domain-nosubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -614,17 +599,19 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_d11.id
                 )
-            self.cleanup.append(vm)
-            self.fail("Subdomain admin user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
+                self.fail("Subdomain admin user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
         except Exception as e:
-            self.debug ("When a admin user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when Subdomain admin user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+                self.debug ("When a admin user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when Subdomain admin user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+
+
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_parentdomainuser(self):
         """
         Validate that user in the parent domain is NOT allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
+
         """
         # deploy VM as user in parentdomain of a domain that has shared network with no subdomain access
 
@@ -633,7 +620,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-domain-nosubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-domain-nosubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -641,17 +628,18 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_d11.id
                 )
-            self.cleanup.append(vm)
-            self.fail("Parent domain user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
+                self.fail("Parent domain user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
         except Exception as e:
-            self.debug ("When a user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when Parent domain user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+                self.debug ("When a user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when Parent domain user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_parentdomainadminuser(self):
         """
         Validate that admin user in the parent domain is NOT allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
+
         """
         # deploy VM as an admin user in parentdomain of  a domain that has shared network with no subdomain access
 
@@ -660,7 +648,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-domain-nosubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] +"-shared-scope-domain-nosubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -668,18 +656,20 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_d11.id
                 )
-            self.cleanup.append(vm)
-            self.fail("Parent domain's admin user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
+                self.fail("Parent domain's admin user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
         except Exception as e:
-            self.debug ("When an admin user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when Parent domain's admin user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+                self.debug ("When an admin user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when Parent domain's admin user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+
+
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_ROOTuser(self):
         """
         Validate that user in ROOT domain is NOT allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
         """
+
         # deploy VM as user in ROOT domain
 
         self.apiclient.connection.apiKey = self.user_roota_apikey
@@ -687,7 +677,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-nosubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-nosubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -695,17 +685,19 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_d11.id
                 )
-            self.cleanup.append(vm)
-            self.fail("ROOT domain's user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
+                self.fail("ROOT domain's user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
         except Exception as e:
-            self.debug ("When a regular user from ROOT domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when ROOT domain's user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+                self.debug ("When a regular user from ROOT domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when ROOT domain's user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+
+
 
-    @attr("simulator_only",tags=["advanced", "bla"],required_hardware="false")
+    @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_ROOTadmin(self):
         """
         Validate that admin in ROOT domain is NOT allowed to deploy VM in a shared network created with scope="domain" and no subdomain access
+
         """
         # deploy VM as admin user in ROOT domain
 
@@ -714,21 +706,21 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmROOT"]["name"] + "-shared-scope-domain-nosubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmROOT"]["displayname"] + "-shared-scope-domain-nosubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
                 serviceofferingid=self.service_offering.id,
                 templateid=self.template.id,
-                networkids=self.shared_network_domain_d11.id)
-            self.cleanup.append(vm)
-            vm.stop(self.apiclient, forced=True)
-            vm.assign_virtual_machine(self.apiclient, self.account_d11.name, self.domain_11.id)
-            self.fail("ROOT domain's admin user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
+                networkids=self.shared_network_domain_d11.id
+        )
+                self.fail("ROOT domain's admin user is able to deploy VM in a shared network with scope=domain with no subdomain access ")
         except Exception as e:
-            self.debug ("When a admin user from ROOT domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when ROOT domain's admin user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+                self.debug ("When a admin user from ROOT domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when ROOT domain's admin user tries to deploy VM in a shared network with scope=domain with no subdomain access")
+
+
 
 ## Test cases relating to deploying Virtual Machine in shared network with scope=Domain and with subdomain access
 
@@ -736,6 +728,7 @@ class TestSharedNetwork(cloudstackTestCase):
     def test_deployVM_in_sharedNetwork_scope_domain_withsubdomainaccess_domainuser(self):
         """
         Validate that regular user in a domain is allowed to deploy VM in a shared network created with scope="domain" and  with subdomain access for the domain
+
         """
         # deploy VM as user in a domain that has shared network with subdomain access
 
@@ -752,17 +745,18 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_domain_with_subdomain_d11.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
                     "User in a domain that has a shared network with subdomain access failed to deploy VM in a shared network with scope=domain with no subdomain access")
 
+
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_withsubdomainaccess_domainadminuser(self):
         """
         Validate that admin user in a domain is allowed to deploy VM in a shared network created with scope="domain" and  with subdomain access for the domain
         """
+
         # deploy VM as an admin user in a domain that has shared network with subdomain access
 
         self.apiclient.connection.apiKey = self.user_d11_apikey
@@ -778,7 +772,6 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_domain_with_subdomain_d11.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
@@ -789,6 +782,7 @@ class TestSharedNetwork(cloudstackTestCase):
         """
         Validate that regular user in a subdomain is allowed to deploy VM in a shared network created with scope="domain" and  with subdomain access  for the parent domain
         """
+
         # deploy VM as user in a subdomain under  a domain that has shared network with subdomain access
 
         self.apiclient.connection.apiKey = self.user_d111a_apikey
@@ -803,7 +797,6 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_domain_with_subdomain_d11.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
@@ -814,6 +807,7 @@ class TestSharedNetwork(cloudstackTestCase):
         """
         Validate that an admin user in a subdomain is allowed to deploy VM in a shared network created with scope="domain" and  with subdomain access for the parent domain
         """
+
         # deploy VM as an admin user in a subdomain under  a domain that has shared network with subdomain access
 
         self.apiclient.connection.apiKey = self.user_d111_apikey
@@ -828,7 +822,6 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_domain_with_subdomain_d11.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
@@ -839,6 +832,7 @@ class TestSharedNetwork(cloudstackTestCase):
         """
         Validate that regular user in a parent domain is NOT allowed to deploy VM in a shared network created with scope="domain" and  with subdomain access for the domain
         """
+
         # deploy VM as user in parentdomain of a domain that has shared network with subdomain access
 
         self.apiclient.connection.apiKey = self.user_d1a_apikey
@@ -846,7 +840,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-domain-withsubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -854,18 +848,19 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_with_subdomain_d11.id
                 )
-            self.cleanup.append(vm)
-            self.fail("Parent domain's user is able to deploy VM in a shared network with scope=domain with subdomain access ")
+                self.fail("Parent domain's user is able to deploy VM in a shared network with scope=domain with subdomain access ")
         except Exception as e:
-            self.debug ("When a user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when Parent domain's user tries to deploy VM in a shared network with scope=domain with subdomain access ")
+                self.debug ("When a user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when Parent domain's user tries to deploy VM in a shared network with scope=domain with subdomain access ")
+
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_withsubdomainaccess_parentdomainadminuser(self):
         """
         Validate that admin user in a parent domain is NOT allowed to deploy VM in a shared network created with scope="domain" and  with subdomain access for any domain
         """
+
         # deploy VM as an admin user in parentdomain of  a domain that has shared network with subdomain access
 
         self.apiclient.connection.apiKey = self.user_d1_apikey
@@ -873,7 +868,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-domain-withsubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] +"-shared-scope-domain-withsubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -881,18 +876,20 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_with_subdomain_d11.id
                 )
-            self.cleanup.append(vm)
-            self.fail("Parent domain's admin user is able to deploy VM in a shared network with scope=domain with  subdomain access ")
+                self.fail("Parent domain's admin user is able to deploy VM in a shared network with scope=domain with  subdomain access ")
         except Exception as e:
-            self.debug ("When an admin user from parent domain deploys a VM in a shared network with scope=domain with  subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when Parent domain's admin user tries to deploy VM in a shared network with scope=domain with  subdomain access")
+                self.debug ("When an admin user from parent domain deploys a VM in a shared network with scope=domain with  subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when Parent domain's admin user tries to deploy VM in a shared network with scope=domain with  subdomain access")
+
+
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_withsubdomainaccess_ROOTuser(self):
         """
         Validate that regular user in ROOT domain is NOT allowed to deploy VM in a shared network created with scope="domain" and  with subdomain access for any domain
         """
+
         # deploy VM as user in ROOT domain
 
         self.apiclient.connection.apiKey = self.user_roota_apikey
@@ -900,7 +897,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-withsubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-withsubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -908,18 +905,19 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_with_subdomain_d11.id
                 )
-            self.cleanup.append(vm)
-            self.fail("ROOT domain's user is able to deploy VM in a shared network with scope=domain with subdomain access ")
+                self.fail("ROOT domain's user is able to deploy VM in a shared network with scope=domain with subdomain access ")
         except Exception as e:
-            self.debug ("When a user from ROOT domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when ROOT domain's user tries to deploy VM in a shared network with scope=domain with subdomain access")
+                self.debug ("When a user from ROOT domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when ROOT domain's user tries to deploy VM in a shared network with scope=domain with subdomain access")
+
 
-    @attr("simulator_only",tags=["advanced", "bla"],required_hardware="false")
+    @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_domain_withsubdomainaccess_ROOTadmin(self):
         """
         Validate that admin user in ROOT domain is NOT allowed to deploy VM in a shared network created with scope="domain" and  with subdomain access for any domain
         """
+
         # deploy VM as admin user in ROOT domain
 
         self.apiclient.connection.apiKey = self.user_root_apikey
@@ -927,7 +925,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmROOT"]["name"] + "-shared-scope-domain-withsubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmROOT"]["displayname"] + "-shared-scope-domain-withsubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -935,14 +933,13 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_domain_with_subdomain_d11.id
                 )
-            self.cleanup.append(vm)
-            vm.stop(self.apiclient, forced=True)
-            vm.assign_virtual_machine(self.apiclient, self.account_d11.name, self.domain_11.id)
-            self.fail("ROOT domain's admin user is able to deploy VM in a shared network with scope=domain with subdomain access ")
+                self.fail("ROOT domain's admin user is able to deploy VM in a shared network with scope=domain with subdomain access ")
         except Exception as e:
-            self.debug ("When an admin user from ROOT domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
-                self.fail("Error message validation failed when ROOT domain's admin user tries to deploy VM in a shared network with scope=domain with subdomain access")
+                self.debug ("When an admin user from ROOT domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+                    self.fail("Error message validation failed when ROOT domain's admin user tries to deploy VM in a shared network with scope=domain with subdomain access")
+
+
 
 ## Test cases relating to deploying Virtual Machine in shared network with scope=account
 
@@ -951,6 +948,7 @@ class TestSharedNetwork(cloudstackTestCase):
         """
         Validate that any other user in same domain is NOT allowed to deploy VM in a shared network created with scope="account" for an account
         """
+
         # deploy VM as user under the same domain but belonging to a different account from the acount that has a shared network with scope=account
 
         self.apiclient.connection.apiKey = self.user_d111b_apikey
@@ -958,7 +956,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD111B"]["name"] +"-shared-scope-domain-withsubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmD111B"]["displayname"] +"-shared-scope-domain-withsubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -966,17 +964,19 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_account_d111a.id
                 )
-            self.cleanup.append(vm)
-            self.fail("User from same domain but different account is able to deploy VM in a shared network with scope=account")
+                self.fail("User from same domain but different account is able to deploy VM in a shared network with scope=account")
         except Exception as e:
-            self.debug ("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
-                self.fail("Error message validation failed when User from same domain but different account tries to deploy VM in a shared network with scope=account")
+                self.debug ("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
+                    self.fail("Error message validation failed when User from same domain but different account tries to deploy VM in a shared network with scope=account")
+
+
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_account_domainadminuser(self):
         """
         Validate that an admin user under the same domain but belonging to a different account is allowed to deploy VM in a shared network created with scope="account" for an account
+
         """
         # deploy VM as admin user for a domain that has an account with shared network with scope=account
 
@@ -985,7 +985,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-withsubdomainaccess"
         self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] +"-shared-scope-domain-withsubdomainaccess"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -993,18 +993,19 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_account_d111a.id
                 )
-            self.cleanup.append(vm)
-            self.fail("User from same domain but different account is able to deploy VM in a shared network with scope=account")
+                self.fail("User from same domain but different account is able to deploy VM in a shared network with scope=account")
         except Exception as e:
-            self.debug ("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
-                self.fail("Error message validation failed when User from same domain but different account tries to deploy VM in a shared network with scope=account")
+                self.debug ("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
+                    self.fail("Error message validation failed when User from same domain but different account tries to deploy VM in a shared network with scope=account")
+
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_account_user(self):
         """
         Validate that regular user in the account is allowed to deploy VM in a shared network created with scope="account" for an account
         """
+
         # deploy VM as account with shared network with scope=account
 
         self.apiclient.connection.apiKey = self.user_d111a_apikey
@@ -1020,7 +1021,6 @@ class TestSharedNetwork(cloudstackTestCase):
             templateid=self.template.id,
             networkids=self.shared_network_account_d111a.id
         )
-        self.cleanup.append(vm)
 
         self.assertEqual(vm.state == "Running",
                     True,
@@ -1031,6 +1031,7 @@ class TestSharedNetwork(cloudstackTestCase):
         """
         Validate that regular user from a domain different from that of the account is NOT allowed to deploy VM in a shared network created with scope="account" for an account
         """
+
         # deploy VM as a user in a subdomain under ROOT
 
         self.apiclient.connection.apiKey = self.user_d2a_apikey
@@ -1038,7 +1039,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmD2A"]["name"] +"-shared-scope-account"
         self.vmdata["displayname"] = self.acldata["vmD2A"]["displayname"] +"-shared-scope-account"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -1046,17 +1047,19 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_account_d111a.id
                 )
-            self.cleanup.append(vm)
-            self.fail("User from different domain is able to deploy VM in a shared network with scope=account ")
+                self.fail("User from different domain is able to deploy VM in a shared network with scope=account ")
         except Exception as e:
-            self.debug ("When a user from different domain deploys a VM in a shared network with scope=account %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
-                self.fail("Error message validation failed when User from different domain tries to deploy VM in a shared network with scope=account")
+                self.debug ("When a user from different domain deploys a VM in a shared network with scope=account %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
+                    self.fail("Error message validation failed when User from different domain tries to deploy VM in a shared network with scope=account")
+
+
 
     @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_account_ROOTuser(self):
         """
         Validate that user in ROOT domain is NOT allowed to deploy VM in a shared network created with scope="account" for an account
+
         """
         # deploy VM as user in ROOT domain
 
@@ -1065,7 +1068,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-account"
         self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-account"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -1073,18 +1076,19 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_account_d111a.id
                 )
-            self.cleanup.append(vm)
-            self.fail("ROOT domain's  user is able to deploy VM in a shared network with scope=account ")
+                self.fail("ROOT domain's  user is able to deploy VM in a shared network with scope=account ")
         except Exception as e:
-            self.debug ("When a user from ROOT domain deploys a VM in a shared network with scope=account %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
-                self.fail("Error message validation failed when ROOT domain's  user tries to deploy VM in a shared network with scope=account ")
+                self.debug ("When a user from ROOT domain deploys a VM in a shared network with scope=account %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
+                    self.fail("Error message validation failed when ROOT domain's  user tries to deploy VM in a shared network with scope=account ")
 
-    @attr("simulator_only",tags=["advanced", "bla"],required_hardware="false")
+
+    @attr("simulator_only",tags=["advanced"],required_hardware="false")
     def test_deployVM_in_sharedNetwork_scope_account_ROOTadmin(self):
         """
         Validate that admin user in ROOT domain is NOT allowed to deploy VM in a shared network created with scope="account" for an account
         """
+
         # deploy VM as admin user in ROOT domain
 
         self.apiclient.connection.apiKey = self.user_root_apikey
@@ -1092,7 +1096,7 @@ class TestSharedNetwork(cloudstackTestCase):
         self.vmdata["name"] = self.acldata["vmROOT"]["name"] + "-shared-scope-account"
         self.vmdata["displayname"] = self.acldata["vmROOT"]["displayname"] + "-shared-scope-account"
         try:
-            vm = VirtualMachine.create(
+                vm = VirtualMachine.create(
                 self.apiclient,
                 self.vmdata,
                 zoneid=self.zone.id,
@@ -1100,14 +1104,11 @@ class TestSharedNetwork(cloudstackTestCase):
                 templateid=self.template.id,
                 networkids=self.shared_network_account_d111a.id
                 )
-            self.cleanup.append(vm)
-            vm.stop(self.apiclient, forced=True)
-            vm.assign_virtual_machine(self.apiclient, self.account_d111a.name, self.domain_111.id)
-            self.fail("ROOT domain's admin user is able to deploy VM in a shared network with scope=account ")
+                self.fail("ROOT domain's admin user is able to deploy VM in a shared network with scope=account ")
         except Exception as e:
-            self.debug ("When an admin user from ROOT domain deploys a VM in a shared network with scope=account %s" %e)
-            if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
-                self.fail("Error message validation failed when ROOT domain's admin user tries to deploy VM in a shared network with scope=account")
+                self.debug ("When an admin user from ROOT domain deploys a VM in a shared network with scope=account %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
+                    self.fail("Error message validation failed when ROOT domain's admin user tries to deploy VM in a shared network with scope=account")