Automation: Fix clean up in tearDown

We shouldn't clean up class-scope resources(_cleanup). We should create local
ones(cleanup) then clean it.

So:
cls._cleanup would be used for class-scope resources.
self.cleanup would be used for each unit.
This commit is contained in:
Sheng Yang 2013-07-23 21:03:26 -07:00
parent 79d49ca2dc
commit f3cf319c37
15 changed files with 146 additions and 133 deletions

View File

@ -1827,7 +1827,7 @@ class TestDomainForceRemove(cloudstackTestCase):
self.services["domain"], self.services["domain"],
parentdomainid=self.domain.id parentdomainid=self.domain.id
) )
self._cleanup.append(domain) self.cleanup.append(domain)
self.debug("Domain: %s is created successfully." % domain.name) self.debug("Domain: %s is created successfully." % domain.name)
self.debug( self.debug(
"Checking if the created domain is listed in list domains API") "Checking if the created domain is listed in list domains API")

View File

@ -107,13 +107,13 @@ class TestASASetup(cloudstackTestCase):
self.clusters = Cluster.list(self.apiclient, hypervisor='VMware') self.clusters = Cluster.list(self.apiclient, hypervisor='VMware')
self.assertNotEqual(len(self.clusters), 0, "Check if the list cluster API returns a non-empty response") self.assertNotEqual(len(self.clusters), 0, "Check if the list cluster API returns a non-empty response")
self.cleanup = []
return return
def tearDown(self): def tearDown(self):
try: try:
self.debug("Cleaning up the resources") self.debug("Cleaning up the resources")
# Cleanup cleanup_resources(self.apiclient, self.cleanup)
cleanup_resources(self.apiclient, self._cleanup)
self.debug("Cleanup complete!") self.debug("Cleanup complete!")
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)

View File

@ -485,7 +485,7 @@ class TestNetwork(cloudstackTestCase):
networkofferingid=network_offering.id, networkofferingid=network_offering.id,
zoneid=self.zone.id zoneid=self.zone.id
) )
self._cleanup.append(domain_network) self.cleanup.append(domain_network)
self.debug("Created network with ID: %s" % domain_network.id) self.debug("Created network with ID: %s" % domain_network.id)
virtual_machine = VirtualMachine.create( virtual_machine = VirtualMachine.create(

View File

@ -283,12 +283,13 @@ class TestCreateRvRNetwork(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@ -481,12 +482,13 @@ class TestCreateRvRNetworkNonDefaultGuestCidr(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@ -688,12 +690,13 @@ class TestRVRInternals(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@ -1008,12 +1011,13 @@ class TestRvRRedundancy(cloudstackTestCase):
networkids=[str(self.network.id)] networkids=[str(self.network.id)]
) )
self.debug("Deployed VM in network: %s" % self.network.id) self.debug("Deployed VM in network: %s" % self.network.id)
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return

View File

@ -189,12 +189,13 @@ class TestRedundantRouterNetworkCleanups(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup=[]
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)

View File

@ -188,12 +188,13 @@ class TestRvRDeploymentPlanning(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)

View File

@ -188,12 +188,13 @@ class TestRedundantRouterRulesLifeCycle(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)

View File

@ -190,12 +190,12 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return

View File

@ -189,12 +189,13 @@ class TestRvRUpgradeDowngrade(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return

View File

@ -139,7 +139,7 @@ class TestRouterServices(cloudstackTestCase):
domainid=cls.account.domainid, domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id serviceofferingid=cls.service_offering.id
) )
cls.cleanup = [ cls._cleanup = [
cls.account, cls.account,
cls.service_offering cls.service_offering
] ]
@ -150,7 +150,7 @@ class TestRouterServices(cloudstackTestCase):
try: try:
cls.api_client = super(TestRouterServices, cls).getClsTestClient().getApiClient() cls.api_client = super(TestRouterServices, cls).getClsTestClient().getApiClient()
#Clean up, terminate the created templates #Clean up, terminate the created templates
cleanup_resources(cls.api_client, cls.cleanup) cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
@ -158,14 +158,14 @@ class TestRouterServices(cloudstackTestCase):
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self._cleanup = [] self.cleanup = []
return return
@attr(tags = ["advanced"]) @attr(tags = ["advanced"])
@ -470,7 +470,7 @@ class TestRouterServices(cloudstackTestCase):
router.state router.state
)) ))
# Cleanup Vm_2 - Not required for further tests # Cleanup Vm_2 - Not required for further tests
self._cleanup.append(self.vm_2) self.cleanup.append(self.vm_2)
return return
@attr(tags = ["advanced"]) @attr(tags = ["advanced"])
@ -619,7 +619,7 @@ class TestRouterStopCreatePF(cloudstackTestCase):
domainid=cls.account.domainid, domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id serviceofferingid=cls.service_offering.id
) )
cls.cleanup = [ cls._cleanup = [
cls.account, cls.account,
cls.service_offering cls.service_offering
] ]
@ -630,7 +630,7 @@ class TestRouterStopCreatePF(cloudstackTestCase):
try: try:
cls.api_client = super(TestRouterStopCreatePF, cls).getClsTestClient().getApiClient() cls.api_client = super(TestRouterStopCreatePF, cls).getClsTestClient().getApiClient()
# Clean up, terminate the created resources # Clean up, terminate the created resources
cleanup_resources(cls.api_client, cls.cleanup) cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
@ -639,14 +639,14 @@ class TestRouterStopCreatePF(cloudstackTestCase):
def tearDown(self): def tearDown(self):
try: try:
# Clean up, terminate the created resources # Clean up, terminate the created resources
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self._cleanup = [] self.cleanup = []
return return
@attr(tags = ["advanced", "advancedns"]) @attr(tags = ["advanced", "advancedns"])
@ -831,7 +831,7 @@ class TestRouterStopCreateLB(cloudstackTestCase):
domainid=cls.account.domainid, domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id serviceofferingid=cls.service_offering.id
) )
cls.cleanup = [ cls._cleanup = [
cls.account, cls.account,
cls.service_offering cls.service_offering
] ]
@ -842,7 +842,7 @@ class TestRouterStopCreateLB(cloudstackTestCase):
try: try:
cls.api_client = super(TestRouterStopCreateLB, cls).getClsTestClient().getApiClient() cls.api_client = super(TestRouterStopCreateLB, cls).getClsTestClient().getApiClient()
#Clean up, terminate the created resources #Clean up, terminate the created resources
cleanup_resources(cls.api_client, cls.cleanup) cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
@ -850,14 +850,14 @@ class TestRouterStopCreateLB(cloudstackTestCase):
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self._cleanup = [] self.cleanup = []
return return
@attr(tags = ["advanced", "advancedns"]) @attr(tags = ["advanced", "advancedns"])
@ -1042,7 +1042,7 @@ class TestRouterStopCreateFW(cloudstackTestCase):
domainid=cls.account.domainid, domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id serviceofferingid=cls.service_offering.id
) )
cls.cleanup = [ cls._cleanup = [
cls.account, cls.account,
cls.service_offering cls.service_offering
] ]
@ -1053,7 +1053,7 @@ class TestRouterStopCreateFW(cloudstackTestCase):
try: try:
cls.api_client = super(TestRouterStopCreateFW, cls).getClsTestClient().getApiClient() cls.api_client = super(TestRouterStopCreateFW, cls).getClsTestClient().getApiClient()
#Clean up, terminate the created templates #Clean up, terminate the created templates
cleanup_resources(cls.api_client, cls.cleanup) cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
@ -1061,14 +1061,14 @@ class TestRouterStopCreateFW(cloudstackTestCase):
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self._cleanup = [] self.cleanup = []
return return
@attr(tags = ["advanced", "advancedns"]) @attr(tags = ["advanced", "advancedns"])

View File

@ -223,12 +223,13 @@ class TestVPC(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)
@ -525,7 +526,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -554,7 +555,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering_no_lb.update(self.apiclient, state='Enabled') self.network_offering_no_lb.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering_no_lb) self.cleanup.append(self.network_offering_no_lb)
gateway = '10.1.2.1' # New network -> different gateway gateway = '10.1.2.1' # New network -> different gateway
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -652,7 +653,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -681,7 +682,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering_no_lb.update(self.apiclient, state='Enabled') self.network_offering_no_lb.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering_no_lb) self.cleanup.append(self.network_offering_no_lb)
gateway = '10.1.2.1' # New network -> different gateway gateway = '10.1.2.1' # New network -> different gateway
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -765,7 +766,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient, self.apiclient,
self.services["account"], self.services["account"],
) )
self._cleanup.append(self.user) self.cleanup.append(self.user)
self.services["vpc"]["cidr"] = "10.1.1.1/16" self.services["vpc"]["cidr"] = "10.1.1.1/16"
self.debug("creating a VPC network in the account: %s" % self.debug("creating a VPC network in the account: %s" %
@ -841,7 +842,7 @@ class TestVPC(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -867,7 +868,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
self.network_offering_no_lb = NetworkOffering.create( self.network_offering_no_lb = NetworkOffering.create(
self.apiclient, self.apiclient,
@ -876,7 +877,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering_no_lb.update(self.apiclient, state='Enabled') self.network_offering_no_lb.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering_no_lb) self.cleanup.append(self.network_offering_no_lb)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -1186,7 +1187,7 @@ class TestVPC(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1212,7 +1213,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
self.network_offering_no_lb = NetworkOffering.create( self.network_offering_no_lb = NetworkOffering.create(
self.apiclient, self.apiclient,
@ -1221,7 +1222,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering_no_lb.update(self.apiclient, state='Enabled') self.network_offering_no_lb.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering_no_lb) self.cleanup.append(self.network_offering_no_lb)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -1674,7 +1675,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -1821,7 +1822,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -1877,7 +1878,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -1926,7 +1927,7 @@ class TestVPC(cloudstackTestCase):
self.services["account"] self.services["account"]
) )
self.debug("Created account: %s" % user.name) self.debug("Created account: %s" % user.name)
self._cleanup.append(user) self.cleanup.append(user)
self.services["vpc"]["cidr"] = "10.1.1.1/16" self.services["vpc"]["cidr"] = "10.1.1.1/16"
self.debug("creating a VPC network in the account: %s" % self.debug("creating a VPC network in the account: %s" %
@ -1953,7 +1954,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -2007,7 +2008,7 @@ class TestVPC(cloudstackTestCase):
self.services["account"] self.services["account"]
) )
self.debug("Created account: %s" % user.name) self.debug("Created account: %s" % user.name)
self._cleanup.append(user) self.cleanup.append(user)
self.services["vpc"]["cidr"] = "10.1.1.1/16" self.services["vpc"]["cidr"] = "10.1.1.1/16"
self.debug("creating a VPC network in the account: %s" % self.debug("creating a VPC network in the account: %s" %
@ -2034,7 +2035,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -2083,7 +2084,7 @@ class TestVPC(cloudstackTestCase):
self.services["account"] self.services["account"]
) )
self.debug("Created account: %s" % user.name) self.debug("Created account: %s" % user.name)
self._cleanup.append(user) self.cleanup.append(user)
self.services["vpc"]["cidr"] = "10.1.1.1/16" self.services["vpc"]["cidr"] = "10.1.1.1/16"
self.debug("creating a VPC network in the account: %s" % self.debug("creating a VPC network in the account: %s" %
@ -2111,7 +2112,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -2167,7 +2168,7 @@ class TestVPC(cloudstackTestCase):
self.services["domain_admin"] self.services["domain_admin"]
) )
self.debug("Created account: %s" % domain_admin.name) self.debug("Created account: %s" % domain_admin.name)
self._cleanup.append(domain_admin) self.cleanup.append(domain_admin)
da_apiclient = self.testClient.getUserApiClient( da_apiclient = self.testClient.getUserApiClient(
account=domain_admin.name, account=domain_admin.name,
domain=domain_admin.domain, domain=domain_admin.domain,
@ -2178,7 +2179,7 @@ class TestVPC(cloudstackTestCase):
self.services["account"] self.services["account"]
) )
self.debug("Created account: %s" % user.name) self.debug("Created account: %s" % user.name)
self._cleanup.append(user) self.cleanup.append(user)
self.services["vpc"]["cidr"] = "10.1.1.1/16" self.services["vpc"]["cidr"] = "10.1.1.1/16"
self.debug("creating a VPC network in the account: %s" % self.debug("creating a VPC network in the account: %s" %
@ -2218,7 +2219,7 @@ class TestVPC(cloudstackTestCase):
self.services["domain_admin"] self.services["domain_admin"]
) )
self.debug("Created account: %s" % domain_admin.name) self.debug("Created account: %s" % domain_admin.name)
self._cleanup.append(domain_admin) self.cleanup.append(domain_admin)
da_apiclient = self.testClient.getUserApiClient( da_apiclient = self.testClient.getUserApiClient(
account=domain_admin.name, account=domain_admin.name,
domain=self.services["domain"]["name"], domain=self.services["domain"]["name"],
@ -2229,7 +2230,7 @@ class TestVPC(cloudstackTestCase):
self.services["account"] self.services["account"]
) )
self.debug("Created account: %s" % user.name) self.debug("Created account: %s" % user.name)
self._cleanup.append(user) self.cleanup.append(user)
self.services["vpc"]["cidr"] = "10.1.1.1/16" self.services["vpc"]["cidr"] = "10.1.1.1/16"
self.debug("creating a VPC network in the account: %s" % self.debug("creating a VPC network in the account: %s" %
@ -2256,7 +2257,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -2367,7 +2368,7 @@ class TestVPC(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway

View File

@ -227,12 +227,13 @@ class TestVPCNetwork(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)
@ -311,7 +312,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -337,7 +338,7 @@ class TestVPCNetwork(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -404,7 +405,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -434,7 +435,7 @@ class TestVPCNetwork(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -474,7 +475,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -500,7 +501,7 @@ class TestVPCNetwork(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -565,7 +566,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -591,7 +592,7 @@ class TestVPCNetwork(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -670,7 +671,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -721,7 +722,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -754,7 +755,7 @@ class TestVPCNetwork(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -798,7 +799,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -824,7 +825,7 @@ class TestVPCNetwork(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -867,7 +868,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -929,7 +930,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -957,7 +958,7 @@ class TestVPCNetwork(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug( self.debug(
@ -999,7 +1000,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1083,12 +1084,13 @@ class TestVPCNetworkRanges(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)
@ -1160,7 +1162,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1187,7 +1189,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network outside of the VPC's network") self.debug("Creating network outside of the VPC's network")
@ -1222,7 +1224,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1249,7 +1251,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network outside of the VPC's network") self.debug("Creating network outside of the VPC's network")
@ -1284,7 +1286,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1311,7 +1313,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network inside of the VPC's network") self.debug("Creating network inside of the VPC's network")
@ -1352,7 +1354,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1379,7 +1381,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -1473,7 +1475,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1500,7 +1502,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
self.debug( self.debug(
"Creating the new account to create new network in VPC: %s" % "Creating the new account to create new network in VPC: %s" %
@ -1586,12 +1588,13 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)
@ -1671,7 +1674,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1697,7 +1700,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
nw_off.update(self.apiclient, state='Enabled') nw_off.update(self.apiclient, state='Enabled')
self._cleanup.append(nw_off) self.cleanup.append(nw_off)
self.services["network_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,UserData,Lb,StaticNat,NetworkACL' self.services["network_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,UserData,Lb,StaticNat,NetworkACL'
self.services["network_offering"]["serviceProviderList"] = { self.services["network_offering"]["serviceProviderList"] = {
@ -1718,7 +1721,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
nw_off_no_pf.update(self.apiclient, state='Enabled') nw_off_no_pf.update(self.apiclient, state='Enabled')
self._cleanup.append(nw_off_no_pf) self.cleanup.append(nw_off_no_pf)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.debug("Creating network with network offering: %s" %
@ -2019,7 +2022,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -2045,7 +2048,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
nw_off.update(self.apiclient, state='Enabled') nw_off.update(self.apiclient, state='Enabled')
self._cleanup.append(nw_off) self.cleanup.append(nw_off)
self.services["network_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,UserData,Lb,StaticNat' self.services["network_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,UserData,Lb,StaticNat'
self.services["network_offering"]["serviceProviderList"] = { self.services["network_offering"]["serviceProviderList"] = {
@ -2066,7 +2069,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
nw_off_vr.update(self.apiclient, state='Enabled') nw_off_vr.update(self.apiclient, state='Enabled')
self._cleanup.append(nw_off_vr) self.cleanup.append(nw_off_vr)
# Creating network using the network offering created # Creating network using the network offering created
self.debug("Creating network with network offering: %s" % nw_off.id) self.debug("Creating network with network offering: %s" % nw_off.id)

View File

@ -225,14 +225,14 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup = [self.account] self.cleanup = [self.account]
self.debug("Creating a VPC offering..") self.debug("Creating a VPC offering..")
self.vpc_off = VpcOffering.create( self.vpc_off = VpcOffering.create(
self.apiclient, self.apiclient,
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(self.vpc_off) self.cleanup.append(self.vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
self.vpc_off.update(self.apiclient, state='Enabled') self.vpc_off.update(self.apiclient, state='Enabled')
@ -251,7 +251,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
def tearDown(self): def tearDown(self):
try: try:
#Clean up, terminate the created network offerings #Clean up, terminate the created network offerings
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)
@ -405,7 +405,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
vpc_off.update(self.apiclient, state='Enabled') vpc_off.update(self.apiclient, state='Enabled')
@ -431,7 +431,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
nw_off.update(self.apiclient, state='Enabled') nw_off.update(self.apiclient, state='Enabled')
self._cleanup.append(nw_off) self.cleanup.append(nw_off)
self.debug('Created and Enabled NetworkOffering') self.debug('Created and Enabled NetworkOffering')
self.services["network"]["name"] = "NETWORK-" + str(gateway) self.services["network"]["name"] = "NETWORK-" + str(gateway)

View File

@ -224,14 +224,14 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup = [self.account] self.cleanup = [self.account]
self.debug("Creating a VPC offering..") self.debug("Creating a VPC offering..")
self.vpc_off = VpcOffering.create( self.vpc_off = VpcOffering.create(
self.apiclient, self.apiclient,
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(self.vpc_off) self.cleanup.append(self.vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
self.vpc_off.update(self.apiclient, state='Enabled') self.vpc_off.update(self.apiclient, state='Enabled')
@ -250,7 +250,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
def tearDown(self): def tearDown(self):
try: try:
#Clean up, terminate the created network offerings #Clean up, terminate the created network offerings
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
self.debug("Warning: Exception during cleanup : %s" % e) self.debug("Warning: Exception during cleanup : %s" % e)
#raise Exception("Warning: Exception during cleanup : %s" % e) #raise Exception("Warning: Exception during cleanup : %s" % e)
@ -405,7 +405,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(self.vpc_off) self.cleanup.append(self.vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
vpc_off.update(self.apiclient, state='Enabled') vpc_off.update(self.apiclient, state='Enabled')
@ -431,7 +431,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
nw_off.update(self.apiclient, state='Enabled') nw_off.update(self.apiclient, state='Enabled')
self._cleanup.append(nw_off) self.cleanup.append(nw_off)
self.debug('Created and Enabled NetworkOffering') self.debug('Created and Enabled NetworkOffering')
self.services["network"]["name"] = "NETWORK-" + str(gateway) self.services["network"]["name"] = "NETWORK-" + str(gateway)

View File

@ -180,12 +180,13 @@ class TestVPCOffering(cloudstackTestCase):
admin=True, admin=True,
domainid=self.domain.id domainid=self.domain.id
) )
self._cleanup.insert(0, self.account) self.cleanup = []
self.cleanup.insert(0, self.account)
return return
def tearDown(self): def tearDown(self):
try: try:
cleanup_resources(self.apiclient, self._cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@ -250,7 +251,7 @@ class TestVPCOffering(cloudstackTestCase):
) )
self.debug("Check if the VPC offering is created successfully?") self.debug("Check if the VPC offering is created successfully?")
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
return return
@ -277,7 +278,7 @@ class TestVPCOffering(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -302,7 +303,7 @@ class TestVPCOffering(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
gateway = vpc.cidr.split('/')[0] gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway # Split the cidr to retrieve gateway
@ -551,14 +552,14 @@ class TestVPCOffering(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
vpc_off = VpcOffering.create( vpc_off = VpcOffering.create(
self.apiclient, self.apiclient,
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -670,14 +671,14 @@ class TestVPCOffering(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
vpc_off = VpcOffering.create( vpc_off = VpcOffering.create(
self.apiclient, self.apiclient,
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -791,14 +792,14 @@ class TestVPCOffering(cloudstackTestCase):
) )
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
self._cleanup.append(self.network_offering) self.cleanup.append(self.network_offering)
vpc_off = VpcOffering.create( vpc_off = VpcOffering.create(
self.apiclient, self.apiclient,
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -911,7 +912,7 @@ class TestVPCOffering(cloudstackTestCase):
) )
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
# Appending to cleanup to delete after test # Appending to cleanup to delete after test
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
except Exception as e: except Exception as e:
self.fail("Failed to create the VPC offering - %s" % e) self.fail("Failed to create the VPC offering - %s" % e)
return return
@ -935,7 +936,7 @@ class TestVPCOffering(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off) self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off) self.validate_vpc_offering(vpc_off)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
@ -1031,7 +1032,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient, self.apiclient,
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off_1) self.cleanup.append(vpc_off_1)
self.validate_vpc_offering(vpc_off_1) self.validate_vpc_offering(vpc_off_1)
self.debug("Disabling the VPC offering created") self.debug("Disabling the VPC offering created")
vpc_off_1.update(self.apiclient, state='Disabled') vpc_off_1.update(self.apiclient, state='Disabled')
@ -1041,7 +1042,7 @@ class TestVPCOffering(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off_2) self.cleanup.append(vpc_off_2)
self.validate_vpc_offering(vpc_off_2) self.validate_vpc_offering(vpc_off_2)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
vpc_off_2.update(self.apiclient, state='Enabled') vpc_off_2.update(self.apiclient, state='Enabled')
@ -1051,7 +1052,7 @@ class TestVPCOffering(cloudstackTestCase):
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off_3) self.cleanup.append(vpc_off_3)
self.validate_vpc_offering(vpc_off_3) self.validate_vpc_offering(vpc_off_3)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
vpc_off_3.update(self.apiclient, state='Enabled') vpc_off_3.update(self.apiclient, state='Enabled')
@ -1060,7 +1061,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient, self.apiclient,
self.services["vpc_offering"] self.services["vpc_offering"]
) )
self._cleanup.append(vpc_off_4) self.cleanup.append(vpc_off_4)
self.debug("Enabling the VPC offering created") self.debug("Enabling the VPC offering created")
vpc_off_4.update(self.apiclient, state='Enabled') vpc_off_4.update(self.apiclient, state='Enabled')