Skip to content

Commit 6ec4e57

Browse files
Gaurav AradhyePrasanna Santhanam
authored andcommitted
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 <tsp@apache.org> (cherry picked from commit 003721a085210afe167fbc734abe4cc8e2d3d23f)
1 parent 8392a6e commit 6ec4e57

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

‎test/integration/smoke/test_network.py‎

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -635,21 +635,21 @@ def setUp(self):
635635
raise Exception("Warning: Exception during fetching source NAT: %s" % e)
636636

637637
self.public_ip = PublicIPAddress.create(
638-
self.apiclient,
639-
self.vm_1.account,
640-
self.vm_1.zoneid,
641-
self.vm_1.domainid,
642-
self.services["server"]
643-
)
644-
# Open up firewall port for SSH
638+
self.apiclient,
639+
self.vm_1.account,
640+
self.vm_1.zoneid,
641+
self.vm_1.domainid,
642+
self.services["server"]
643+
)
644+
#Open up firewall port for SSH
645645
fw_rule = FireWallRule.create(
646-
self.apiclient,
647-
ipaddressid=self.public_ip.ipaddress.id,
648-
protocol=self.services["lbrule"]["protocol"],
649-
cidrlist=['0.0.0.0/0'],
650-
startport=self.services["lbrule"]["publicport"],
651-
endport=self.services["lbrule"]["publicport"]
652-
)
646+
self.apiclient,
647+
ipaddressid=self.public_ip.ipaddress.id,
648+
protocol=self.services["lbrule"]["protocol"],
649+
cidrlist=['0.0.0.0/0'],
650+
startport=self.services["lbrule"]["publicport"],
651+
endport=self.services["lbrule"]["publicport"]
652+
)
653653

654654
lb_rule = LoadBalancerRule.create(
655655
self.apiclient,
@@ -659,16 +659,16 @@ def setUp(self):
659659
)
660660
lb_rule.assign(self.apiclient, [self.vm_1])
661661
self.nat_rule = NATRule.create(
662-
self.apiclient,
663-
self.vm_1,
664-
self.services["natrule"],
665-
ipaddressid=self.public_ip.ipaddress.id
666-
)
662+
self.apiclient,
663+
self.vm_1,
664+
self.services["natrule"],
665+
ipaddressid=self.public_ip.ipaddress.id
666+
)
667667
self.cleanup = [
668668
self.vm_1,
669669
lb_rule,
670-
self.service_offering,
671670
self.nat_rule,
671+
self.service_offering,
672672
self.account,
673673
]
674674
return
@@ -683,6 +683,9 @@ def test_reboot_router(self):
683683
# still works through the sourceNAT Ip
684684

685685
#Retrieve router for the user account
686+
687+
self.debug("Public IP: %s" % self.vm_1.ssh_ip)
688+
self.debug("Public IP: %s" % self.public_ip.ipaddress.ipaddress)
686689
routers = list_routers(
687690
self.apiclient,
688691
account=self.account.name,
@@ -732,15 +735,15 @@ def test_reboot_router(self):
732735
self.debug("SSH into VM (ID : %s ) after reboot" % self.vm_1.id)
733736

734737
remoteSSHClient(
735-
self.nat_rule.ipaddress,
738+
self.public_ip.ipaddress.ipaddress,
736739
self.services["natrule"]["publicport"],
737740
self.vm_1.username,
738741
self.vm_1.password
739742
)
740743
except Exception as e:
741744
self.fail(
742745
"SSH Access failed for %s: %s" % \
743-
(self.vm_1.ipaddress, e))
746+
(self.public_ip.ipaddress.ipaddress, e))
744747
return
745748

746749
def tearDown(self):

0 commit comments

Comments
 (0)