Skip to content

Commit ae6aa2a

Browse files
CLOUDSTACK-8933 - Improves the the test internals of the SSVM/CPVM
- Check if the link local IP is the same a dthe one cached in the cmdline config file. - SSVM/CPSM can have the same IP after reboot
1 parent 698171d commit ae6aa2a

1 file changed

Lines changed: 90 additions & 1 deletion

File tree

‎test/integration/smoke/test_ssvm.py‎

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def setUp(self):
4747
self.cleanup = []
4848
self.services = self.testClient.getParsedTestDataConfig()
4949
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
50+
51+
# Default sleep is set to 90 seconds, which is too long if the SSVM takes up to 2min to start.
52+
# Second sleep in the loop will waste test time.
53+
self.services["sleep"] = 30
54+
# Default value is 120 seconds. That's just too much.
55+
self.services["configurableData"]["systemVmDelay"] = 60
56+
5057
return
5158

5259
def tearDown(self):
@@ -470,6 +477,47 @@ def test_03_ssvm_internals(self):
470477
1,
471478
"Check cloud service is running or not"
472479
)
480+
481+
linklocal_ip = None
482+
# Check status of cloud service
483+
if self.hypervisor.lower() in ('vmware', 'hyperv'):
484+
# SSH into SSVMs is done via management server for Vmware and
485+
# Hyper-V
486+
linklocal_ip = ssvm.privateip
487+
result = get_process_status(
488+
self.apiclient.connection.mgtSvr,
489+
22,
490+
self.apiclient.connection.user,
491+
self.apiclient.connection.passwd,
492+
ssvm.privateip,
493+
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'",
494+
hypervisor=self.hypervisor
495+
)
496+
else:
497+
try:
498+
linklocal_ip = ssvm.linklocalip
499+
host.user, host.passwd = get_host_credentials(
500+
self.config, host.ipaddress)
501+
result = get_process_status(
502+
host.ipaddress,
503+
22,
504+
host.user,
505+
host.passwd,
506+
ssvm.linklocalip,
507+
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'"
508+
)
509+
except KeyError:
510+
self.skipTest(
511+
"Marvin configuration has no host\
512+
credentials to check router services")
513+
res = result[0]
514+
self.debug("Cached Link Local IP: %s" % res)
515+
self.assertEqual(
516+
linklocal_ip,
517+
res,
518+
"The cached Link Local should be the same as the current Link Local IP, but they are different! Current ==> %s; Cached ==> %s " % (linklocal_ip, res)
519+
)
520+
473521
return
474522

475523
@attr(
@@ -564,6 +612,47 @@ def test_04_cpvm_internals(self):
564612
1,
565613
"Check cloud service is running or not"
566614
)
615+
616+
linklocal_ip = None
617+
# Check status of cloud service
618+
if self.hypervisor.lower() in ('vmware', 'hyperv'):
619+
# SSH into SSVMs is done via management server for Vmware and
620+
# Hyper-V
621+
linklocal_ip = cpvm.privateip
622+
result = get_process_status(
623+
self.apiclient.connection.mgtSvr,
624+
22,
625+
self.apiclient.connection.user,
626+
self.apiclient.connection.passwd,
627+
cpvm.privateip,
628+
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'",
629+
hypervisor=self.hypervisor
630+
)
631+
else:
632+
try:
633+
linklocal_ip = cpvm.linklocalip
634+
host.user, host.passwd = get_host_credentials(
635+
self.config, host.ipaddress)
636+
result = get_process_status(
637+
host.ipaddress,
638+
22,
639+
host.user,
640+
host.passwd,
641+
cpvm.linklocalip,
642+
"cat /var/cache/cloud/cmdline | xargs | sed \"s/ /\\n/g\" | grep eth0ip= | sed \"s/\=/ /g\" | awk '{print $2}'"
643+
)
644+
except KeyError:
645+
self.skipTest(
646+
"Marvin configuration has no host\
647+
credentials to check router services")
648+
res = result[0]
649+
self.debug("Cached Link Local IP: %s" % res)
650+
self.assertEqual(
651+
linklocal_ip,
652+
res,
653+
"The cached Link Local should be the same as the current Link Local IP, but they are different! Current ==> %s; Cached ==> %s " % (linklocal_ip, res)
654+
)
655+
567656
return
568657

569658
@attr(
@@ -817,7 +906,7 @@ def test_07_reboot_ssvm(self):
817906
old_public_ip,
818907
"Check Public IP after reboot with that of before reboot"
819908
)
820-
909+
821910
# Private IP Address of System VMs are allowed to change after reboot - CLOUDSTACK-7745
822911

823912
# Wait for the agent to be up

0 commit comments

Comments
 (0)