From 6ec4e5722807b0cdf75104ed61889f1e56efae02 Mon Sep 17 00:00:00 2001 From: Gaurav Aradhye Date: Mon, 29 Jul 2013 20:19:54 -0400 Subject: [PATCH] CLOUDSTACK-3168: Fix test_reboot_router.py to ssh using public IP test_reboot_router.py was trying to ssh to vm using private IP and hence it failed with error "No route to host." Fixed the testcase to ssh using public IP. Signed-off-by: Prasanna Santhanam (cherry picked from commit 003721a085210afe167fbc734abe4cc8e2d3d23f) --- test/integration/smoke/test_network.py | 47 ++++++++++++++------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index dad5630eccb..77cb2eaf6e5 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -635,21 +635,21 @@ class TestRebootRouter(cloudstackTestCase): raise Exception("Warning: Exception during fetching source NAT: %s" % e) self.public_ip = PublicIPAddress.create( - self.apiclient, - self.vm_1.account, - self.vm_1.zoneid, - self.vm_1.domainid, - self.services["server"] - ) - # Open up firewall port for SSH + self.apiclient, + self.vm_1.account, + self.vm_1.zoneid, + self.vm_1.domainid, + self.services["server"] + ) + #Open up firewall port for SSH fw_rule = FireWallRule.create( - self.apiclient, - ipaddressid=self.public_ip.ipaddress.id, - protocol=self.services["lbrule"]["protocol"], - cidrlist=['0.0.0.0/0'], - startport=self.services["lbrule"]["publicport"], - endport=self.services["lbrule"]["publicport"] - ) + self.apiclient, + ipaddressid=self.public_ip.ipaddress.id, + protocol=self.services["lbrule"]["protocol"], + cidrlist=['0.0.0.0/0'], + startport=self.services["lbrule"]["publicport"], + endport=self.services["lbrule"]["publicport"] + ) lb_rule = LoadBalancerRule.create( self.apiclient, @@ -659,16 +659,16 @@ class TestRebootRouter(cloudstackTestCase): ) lb_rule.assign(self.apiclient, [self.vm_1]) self.nat_rule = NATRule.create( - self.apiclient, - self.vm_1, - self.services["natrule"], - ipaddressid=self.public_ip.ipaddress.id - ) + self.apiclient, + self.vm_1, + self.services["natrule"], + ipaddressid=self.public_ip.ipaddress.id + ) self.cleanup = [ self.vm_1, lb_rule, - self.service_offering, self.nat_rule, + self.service_offering, self.account, ] return @@ -683,6 +683,9 @@ class TestRebootRouter(cloudstackTestCase): # still works through the sourceNAT Ip #Retrieve router for the user account + + self.debug("Public IP: %s" % self.vm_1.ssh_ip) + self.debug("Public IP: %s" % self.public_ip.ipaddress.ipaddress) routers = list_routers( self.apiclient, account=self.account.name, @@ -732,7 +735,7 @@ class TestRebootRouter(cloudstackTestCase): self.debug("SSH into VM (ID : %s ) after reboot" % self.vm_1.id) remoteSSHClient( - self.nat_rule.ipaddress, + self.public_ip.ipaddress.ipaddress, self.services["natrule"]["publicport"], self.vm_1.username, self.vm_1.password @@ -740,7 +743,7 @@ class TestRebootRouter(cloudstackTestCase): except Exception as e: self.fail( "SSH Access failed for %s: %s" % \ - (self.vm_1.ipaddress, e)) + (self.public_ip.ipaddress.ipaddress, e)) return def tearDown(self):