Skip to content

Commit de11b73

Browse files
author
Boris Schrijver
committed
Add integration test for restartVPC with cleanup, and Private Gateway enabled.
1 parent 78fbaf7 commit de11b73

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

test/integration/smoke/test_privategw_acl.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,19 @@ def test_02_vpc_privategw_static_routes(self):
253253
self.performVPCTests(vpc_off)
254254

255255
@attr(tags=["advanced"], required_hardware="true")
256-
def test_03_rvpc_privategw_static_routes(self):
256+
def test_03_vpc_privategw_restart_vpc_cleanup(self):
257+
self.logger.debug("Creating a VPC offering..")
258+
vpc_off = VpcOffering.create(
259+
self.apiclient,
260+
self.services["vpc_offering"])
261+
262+
self.logger.debug("Enabling the VPC offering created")
263+
vpc_off.update(self.apiclient, state='Enabled')
264+
265+
self.performVPCTests(vpc_off, True)
266+
267+
@attr(tags=["advanced"], required_hardware="true")
268+
def test_04_rvpc_privategw_static_routes(self):
257269
self.logger.debug("Creating a Redundant VPC offering..")
258270
vpc_off = VpcOffering.create(
259271
self.apiclient,
@@ -264,7 +276,7 @@ def test_03_rvpc_privategw_static_routes(self):
264276

265277
self.performVPCTests(vpc_off)
266278

267-
def performVPCTests(self, vpc_off):
279+
def performVPCTests(self, vpc_off, restart_with_cleanup = False):
268280
self.logger.debug("Creating VPCs with offering ID %s" % vpc_off.id)
269281
vpc_1 = self.createVPC(vpc_off, cidr = '10.0.1.0/24')
270282
vpc_2 = self.createVPC(vpc_off, cidr = '10.0.2.0/24')
@@ -312,6 +324,13 @@ def performVPCTests(self, vpc_off):
312324
self.check_pvt_gw_connectivity(vm1, public_ip_1, vm2.nic[0].ipaddress)
313325
self.check_pvt_gw_connectivity(vm2, public_ip_2, vm1.nic[0].ipaddress)
314326

327+
if restart_with_cleanup:
328+
self.reboot_vpc_with_cleanup(vpc_1, True)
329+
self.reboot_vpc_with_cleanup(vpc_2, True)
330+
331+
self.check_pvt_gw_connectivity(vm1, public_ip_1, vm2.nic[0].ipaddress)
332+
self.check_pvt_gw_connectivity(vm2, public_ip_2, vm1.nic[0].ipaddress)
333+
315334
def createVPC(self, vpc_offering, cidr = '10.1.1.1/16'):
316335
try:
317336
self.logger.debug("Creating a VPC network in the account: %s" % self.account.name)
@@ -539,3 +558,14 @@ def check_pvt_gw_connectivity(self, virtual_machine, public_ip, vm_ip):
539558
1,
540559
"Ping to outside world from VM should be successful"
541560
)
561+
562+
def reboot_vpc_with_cleanup(self, vpc, cleanup = True):
563+
self.logger.debug("Restarting VPC %s with cleanup" % vpc.id)
564+
565+
# Reboot the router
566+
cmd = restartVPC.restartVPCCmd()
567+
cmd.id = vpc.id
568+
cmd.cleanup = cleanup
569+
cmd.makeredundant = False
570+
self.api_client.restartVPC(cmd)
571+

0 commit comments

Comments
 (0)