@@ -71,19 +71,18 @@ def setUpClass(cls):
7171 cls .services ["l2-network" ],
7272 zoneid = cls .zone .id
7373 )
74+ cls ._cleanup .append (cls .physical_network )
7475
7576 cls .physical_network_2 = PhysicalNetwork .create (
7677 cls .apiclient ,
7778 cls .services ["l2-network" ],
7879 zoneid = cls .zone .id
7980 )
81+ cls ._cleanup .append (cls .physical_network_2 )
8082 except Exception as e :
8183 cls .tearDownClass ()
8284 raise unittest .SkipTest (e )
8385
84- cls ._cleanup .append (cls .physical_network )
85- cls ._cleanup .append (cls .physical_network_2 )
86-
8786 cls .kvmnetworklabel = None
8887 try :
8988 hosts = Host .list (cls .apiclient , type = 'Routing' )
@@ -128,7 +127,7 @@ def tearDownClass(cls):
128127 allocationstate = "Enabled"
129128 )
130129 # Cleanup resources used
131- cleanup_resources ( cls . apiclient , cls . _cleanup )
130+ super ( TestMulipleNetworkCreation , cls ). tearDownClass ( )
132131 except Exception as e :
133132 raise Exception ("Warning: Exception during cleanup : %s" % e )
134133 return
@@ -140,12 +139,7 @@ def setUp(self):
140139 return
141140
142141 def tearDown (self ):
143- try :
144- # Clean up
145- cleanup_resources (self .apiclient , self .cleanup )
146- except Exception as e :
147- raise Exception ("Warning: Exception during cleanup : %s" % e )
148- return
142+ super (TestMulipleNetworkCreation , self ).tearDown ()
149143
150144 @attr (tags = ["advanced" ], required_hardware = "false" )
151145 def test_01_add_traffictype_for_untagged_networks (self ):
@@ -227,6 +221,7 @@ def test_02_created_shared_guest_network(self):
227221 isolationmethods = "VLAN" ,
228222 zoneid = self .zone .id
229223 )
224+ self .cleanup .append (self .physical_network_3 )
230225
231226 # Enable the network
232227 self .physical_network_3 .update (
@@ -267,12 +262,14 @@ def test_02_created_shared_guest_network(self):
267262 domainid = self .domain .id
268263 #physicalnetworkid=self.physical_network_3.id
269264 )
265+ self .cleanup .append (self .shared_network )
270266
271267 # Create small service offering
272268 self .service_offering = ServiceOffering .create (
273269 self .apiclient ,
274270 self .testdata ["service_offerings" ]["small" ]
275271 )
272+ self .cleanup .append (self .service_offering )
276273
277274 #4. Create virtual machine
278275 self .testdata ["virtual_machine" ]["zoneid" ] = self .zone .id
@@ -284,6 +281,7 @@ def test_02_created_shared_guest_network(self):
284281 serviceofferingid = self .service_offering .id ,
285282 networkids = self .shared_network .id
286283 )
284+ self .cleanup .append (self .virtual_machine )
287285
288286 list_vms = VirtualMachine .list (
289287 self .apiclient ,
0 commit comments