Skip to content

Commit

Permalink
fixup! Remove useless try except blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelaferreira committed Aug 15, 2016
1 parent 7e3f013 commit f79b0d4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cosmic-core/test/integration/smoke/test_vpc_vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ def _test_vpc_site2site_vpn(self, vpc_offering, num_VPCs=3):
domainid=self.domain.id
)
self.assertIsNotNone(vpc_n, "VPC%d creation failed" % i)
self.logger.debug("VPC%d %s created" % (i, vpc_list[i].id))
self.cleanup.append(vpc_n)
vpc_list.append(vpc_n)
self.cleanup.append(vpc_n)
self.logger.debug("VPC%d %s created" % (i, vpc_list[i].id))

default_acl = NetworkACLList.list(self.apiclient, name="default_allow")[0]

Expand All @@ -399,9 +399,9 @@ def _test_vpc_site2site_vpn(self, vpc_offering, num_VPCs=3):
aclid=default_acl.id
)
self.assertIsNotNone(ntwk_n, "Network%d failed to create" % i)
self.logger.debug("Network%d %s created in VPC %s" % (i, ntwk_list[i].id, vpc_list[i].id))
self.cleanup.append(ntwk_n)
ntwk_list.append(ntwk_n)
self.logger.debug("Network%d %s created in VPC %s" % (i, ntwk_list[i].id, vpc_list[i].id))

# Deploy a vm in network i
vm_list = []
Expand All @@ -419,18 +419,18 @@ def _test_vpc_site2site_vpn(self, vpc_offering, num_VPCs=3):
mode='advanced' if (i == 0) or (i == maxnumVM) else 'default'
)
self.assertIsNotNone(vm_n, "VM%d failed to deploy" % i)
self.logger.debug("VM%d %s deployed in VPC %s" % (i, vm_list[i].id, vpc_list[i].id))
self.cleanup.append(vm_n)
vm_list.append(vm_n)
self.logger.debug("VM%d %s deployed in VPC %s" % (i, vm_list[i].id, vpc_list[i].id))
self.assertEquals(vm_n.state, 'Running', "VM%d is not running" % i)

# 4) Enable Site-to-Site VPN for VPC
vpn_response_list = []
for i in range(num_VPCs):
vpn_response = Vpn.createVpnGateway(self.apiclient, vpc_list[i].id)
self.assertIsNotNone(vpn_response, "Failed to enable VPN Gateway %d" % i)
self.logger.debug("VPN gateway for VPC%d %s enabled" % (i, vpc_list[i].id))
vpn_response_list.append(vpn_response)
self.logger.debug("VPN gateway for VPC%d %s enabled" % (i, vpc_list[i].id))

# 5) Add VPN Customer gateway info
vpn_cust_gw_list = []
Expand All @@ -447,9 +447,9 @@ def _test_vpc_site2site_vpn(self, vpc_offering, num_VPCs=3):
ip = src_nat_list[0]

customer_response = VpnCustomerGateway.create(self.apiclient, services, "Peer VPC" + `i`, ip.ipaddress, vpc_list[i].cidr, self.account.name, self.domain.id)
self.logger.debug("VPN customer gateway added for VPC%d %s enabled" % (i, vpc_list[i].id))
self.cleanup.append(customer_response)
vpn_cust_gw_list.append(customer_response)
self.logger.debug("VPN customer gateway added for VPC%d %s enabled" % (i, vpc_list[i].id))

# Before the next step ensure the last VPC is up and running
# Routers in the right state?
Expand All @@ -458,12 +458,12 @@ def _test_vpc_site2site_vpn(self, vpc_offering, num_VPCs=3):
# 6) Connect VPCi with VPC0
for i in range(num_VPCs)[1:]:
vpnconn1_response = Vpn.createVpnConnection(self.apiclient, vpn_cust_gw_list[0].id, vpn_response_list[i]['id'], True)
self.logger.debug("VPN passive connection created for VPC%d %s" % (i, vpc_list[i].id))
self.cleanup.append(vpnconn1_response)
self.logger.debug("VPN passive connection created for VPC%d %s" % (i, vpc_list[i].id))

vpnconn2_response = Vpn.createVpnConnection(self.apiclient, vpn_cust_gw_list[i].id, vpn_response_list[0]['id'])
self.logger.debug("VPN connection created for VPC%d %s" % (0, vpc_list[0].id))
self.cleanup.append(vpnconn2_response)
self.logger.debug("VPN connection created for VPC%d %s" % (0, vpc_list[0].id))

self.assertEqual(vpnconn2_response['state'], "Connected", "Failed to connect between VPCs 0 and %d!" % i)
self.logger.debug("VPN connected between VPC0 and VPC%d" % i)
Expand Down

0 comments on commit f79b0d4

Please sign in to comment.