You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/01/02 15:36:18 UTC
[26/50] [abbrv] git commit: updated refs/heads/reporter to b26f3fc
CLOUDSTACK-8096: Fixed test_ssvm.py for issues while checking the result of diagnostic scripts
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/77bd069c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/77bd069c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/77bd069c
Branch: refs/heads/reporter
Commit: 77bd069cc7b38bf93cc4e314d5d1ddcada56f11d
Parents: 5f9e4fd
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Mon Dec 22 14:49:25 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Dec 23 14:27:03 2014 +0530
----------------------------------------------------------------------
test/integration/smoke/test_ssvm.py | 1100 ++++++++++++++------------
tools/marvin/marvin/config/test_data.py | 3 +-
2 files changed, 611 insertions(+), 492 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/77bd069c/test/integration/smoke/test_ssvm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py
index ed9eab0..0df0302 100644
--- a/test/integration/smoke/test_ssvm.py
+++ b/test/integration/smoke/test_ssvm.py
@@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -16,21 +16,29 @@
# under the License.
""" BVT tests for SSVM
"""
-#Import Local Modules
-import marvin
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+# Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (stopSystemVm,
+ rebootSystemVm,
+ destroySystemVm)
+from marvin.lib.utils import (cleanup_resources,
+ get_process_status,
+ get_host_credentials)
+from marvin.lib.base import (PhysicalNetwork,
+ NetScaler)
+from marvin.lib.common import (get_zone,
+ list_hosts,
+ list_ssvms,
+ list_zones,
+ list_vlan_ipranges)
from nose.plugins.attrib import attr
import telnetlib
-#Import System modules
+# Import System modules
import time
_multiprocess_shared_ = True
+
class TestSSVMs(cloudstackTestCase):
def setUp(self):
@@ -43,7 +51,7 @@ class TestSSVMs(cloudstackTestCase):
def tearDown(self):
try:
- #Clean up, terminate the created templates
+ # Clean up, terminate the created templates
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
@@ -55,9 +63,9 @@ class TestSSVMs(cloudstackTestCase):
while True:
list_host_response = list_hosts(
- self.apiclient,
- name=vmname
- )
+ self.apiclient,
+ name=vmname
+ )
if list_host_response and list_host_response[0].state == 'Up':
break
@@ -68,8 +76,14 @@ class TestSSVMs(cloudstackTestCase):
time.sleep(self.services["sleep"])
timeout = timeout - 1
-
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="false")
def test_01_list_sec_storage_vm(self):
"""Test List secondary storage VMs
"""
@@ -85,117 +99,129 @@ class TestSSVMs(cloudstackTestCase):
# 5. DNS entries must match those given for the zone
list_ssvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='secondarystoragevm',
- state='Running',
- )
- self.assertEqual(
- isinstance(list_ssvm_response, list),
- True,
- "Check list response returns a valid list"
- )
- #Verify SSVM response
+ self.apiclient,
+ systemvmtype='secondarystoragevm',
+ state='Running',
+ )
+ self.assertEqual(
+ isinstance(list_ssvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
+ # Verify SSVM response
self.assertNotEqual(
- len(list_ssvm_response),
- 0,
- "Check list System VMs response"
- )
+ len(list_ssvm_response),
+ 0,
+ "Check list System VMs response"
+ )
list_zones_response = list_zones(self.apiclient)
-
+
self.assertEqual(
- isinstance(list_zones_response, list),
- True,
- "Check list response returns a valid list"
- )
+ isinstance(list_zones_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
self.debug("Number of zones: %s" % len(list_zones_response))
self.debug("Number of SSVMs: %s" % len(list_ssvm_response))
# Number of Sec storage VMs = No of Zones
self.assertEqual(
- len(list_ssvm_response),
- len(list_zones_response),
- "Check number of SSVMs with number of zones"
- )
- #For each secondary storage VM check private IP,
- #public IP, link local IP and DNS
+ len(list_ssvm_response),
+ len(list_zones_response),
+ "Check number of SSVMs with number of zones"
+ )
+ # For each secondary storage VM check private IP,
+ # public IP, link local IP and DNS
for ssvm in list_ssvm_response:
self.debug("SSVM state: %s" % ssvm.state)
self.assertEqual(
- ssvm.state,
- 'Running',
- "Check whether state of SSVM is running"
- )
+ ssvm.state,
+ 'Running',
+ "Check whether state of SSVM is running"
+ )
self.assertEqual(
- hasattr(ssvm, 'privateip'),
- True,
- "Check whether SSVM has private IP field"
- )
+ hasattr(ssvm, 'privateip'),
+ True,
+ "Check whether SSVM has private IP field"
+ )
self.assertEqual(
- hasattr(ssvm, 'linklocalip'),
- True,
- "Check whether SSVM has link local IP field"
- )
+ hasattr(ssvm, 'linklocalip'),
+ True,
+ "Check whether SSVM has link local IP field"
+ )
self.assertEqual(
- hasattr(ssvm, 'publicip'),
- True,
- "Check whether SSVM has public IP field"
- )
+ hasattr(ssvm, 'publicip'),
+ True,
+ "Check whether SSVM has public IP field"
+ )
- #Fetch corresponding ip ranges information from listVlanIpRanges
+ # Fetch corresponding ip ranges information from listVlanIpRanges
ipranges_response = list_vlan_ipranges(
- self.apiclient,
- zoneid=ssvm.zoneid
- )
+ self.apiclient,
+ zoneid=ssvm.zoneid
+ )
self.assertEqual(
- isinstance(ipranges_response, list),
- True,
- "Check list response returns a valid list"
- )
+ isinstance(ipranges_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
iprange = ipranges_response[0]
-
- #Fetch corresponding Physical Network of SSVM's Zone
+
+ # Fetch corresponding Physical Network of SSVM's Zone
listphyntwk = PhysicalNetwork.list(
- self.apiclient,
- zoneid=ssvm.zoneid
- )
-
+ self.apiclient,
+ zoneid=ssvm.zoneid
+ )
+
# Execute the following assertion in all zones except EIP-ELB Zones
- if not (self.zone.networktype.lower() == 'basic' and isinstance(NetScaler.list(self.apiclient,physicalnetworkid=listphyntwk[0].id), list) is True):
+ if not (
+ self.zone.networktype.lower() == 'basic' and isinstance(
+ NetScaler.list(
+ self.apiclient,
+ physicalnetworkid=listphyntwk[0].id),
+ list) is True):
self.assertEqual(
- ssvm.gateway,
- iprange.gateway,
- "Check gateway with that of corresponding ip range"
- )
+ ssvm.gateway,
+ iprange.gateway,
+ "Check gateway with that of corresponding ip range"
+ )
- #Fetch corresponding zone information from listZones
+ # Fetch corresponding zone information from listZones
zone_response = list_zones(
- self.apiclient,
- id=ssvm.zoneid
- )
+ self.apiclient,
+ id=ssvm.zoneid
+ )
self.assertEqual(
- isinstance(zone_response, list),
- True,
- "Check list response returns a valid list"
- )
+ isinstance(zone_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
self.assertEqual(
- ssvm.dns1,
- zone_response[0].dns1,
- "Check DNS1 with that of corresponding zone"
- )
+ ssvm.dns1,
+ zone_response[0].dns1,
+ "Check DNS1 with that of corresponding zone"
+ )
self.assertEqual(
- ssvm.dns2,
- zone_response[0].dns2,
- "Check DNS2 with that of corresponding zone"
- )
+ ssvm.dns2,
+ zone_response[0].dns2,
+ "Check DNS2 with that of corresponding zone"
+ )
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="false")
def test_02_list_cpvm_vm(self):
"""Test List console proxy VMs
"""
@@ -211,111 +237,123 @@ class TestSSVMs(cloudstackTestCase):
# 5. DNS entries must match those given for the zone
list_cpvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='consoleproxy',
- state='Running',
- )
- self.assertEqual(
- isinstance(list_cpvm_response, list),
- True,
- "Check list response returns a valid list"
- )
- #Verify CPVM response
+ self.apiclient,
+ systemvmtype='consoleproxy',
+ state='Running',
+ )
+ self.assertEqual(
+ isinstance(list_cpvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
+ # Verify CPVM response
self.assertNotEqual(
- len(list_cpvm_response),
- 0,
- "Check list System VMs response"
- )
+ len(list_cpvm_response),
+ 0,
+ "Check list System VMs response"
+ )
list_zones_response = list_zones(self.apiclient)
# Number of Console Proxy VMs = No of Zones
-
+
self.assertEqual(
- isinstance(list_zones_response, list),
- True,
- "Check list response returns a valid list"
- )
-
+ isinstance(list_zones_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
+
self.debug("Number of zones: %s" % len(list_zones_response))
self.debug("Number of CPVMs: %s" % len(list_cpvm_response))
self.assertEqual(
- len(list_cpvm_response),
- len(list_zones_response),
- "Check number of CPVMs with number of zones"
- )
- #For each CPVM check private IP, public IP, link local IP and DNS
+ len(list_cpvm_response),
+ len(list_zones_response),
+ "Check number of CPVMs with number of zones"
+ )
+ # For each CPVM check private IP, public IP, link local IP and DNS
for cpvm in list_cpvm_response:
self.debug("CPVM state: %s" % cpvm.state)
self.assertEqual(
- cpvm.state,
- 'Running',
- "Check whether state of CPVM is running"
- )
+ cpvm.state,
+ 'Running',
+ "Check whether state of CPVM is running"
+ )
self.assertEqual(
- hasattr(cpvm, 'privateip'),
- True,
- "Check whether CPVM has private IP field"
- )
+ hasattr(cpvm, 'privateip'),
+ True,
+ "Check whether CPVM has private IP field"
+ )
self.assertEqual(
- hasattr(cpvm, 'linklocalip'),
- True,
- "Check whether CPVM has link local IP field"
- )
+ hasattr(cpvm, 'linklocalip'),
+ True,
+ "Check whether CPVM has link local IP field"
+ )
self.assertEqual(
- hasattr(cpvm, 'publicip'),
- True,
- "Check whether CPVM has public IP field"
- )
- #Fetch corresponding ip ranges information from listVlanIpRanges
+ hasattr(cpvm, 'publicip'),
+ True,
+ "Check whether CPVM has public IP field"
+ )
+ # Fetch corresponding ip ranges information from listVlanIpRanges
ipranges_response = list_vlan_ipranges(
- self.apiclient,
- zoneid=cpvm.zoneid
- )
+ self.apiclient,
+ zoneid=cpvm.zoneid
+ )
self.assertEqual(
- isinstance(ipranges_response, list),
- True,
- "Check list response returns a valid list"
- )
+ isinstance(ipranges_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
iprange = ipranges_response[0]
- #Fetch corresponding Physical Network of SSVM's Zone
+ # Fetch corresponding Physical Network of SSVM's Zone
listphyntwk = PhysicalNetwork.list(
- self.apiclient,
- zoneid=cpvm.zoneid
- )
-
+ self.apiclient,
+ zoneid=cpvm.zoneid
+ )
+
# Execute the following assertion in all zones except EIP-ELB Zones
- if not (self.zone.networktype.lower() == 'basic' and isinstance(NetScaler.list(self.apiclient,physicalnetworkid=listphyntwk[0].id), list) is True):
+ if not (
+ self.zone.networktype.lower() == 'basic' and isinstance(
+ NetScaler.list(
+ self.apiclient,
+ physicalnetworkid=listphyntwk[0].id),
+ list) is True):
self.assertEqual(
- cpvm.gateway,
- iprange.gateway,
- "Check gateway with that of corresponding ip range"
- )
+ cpvm.gateway,
+ iprange.gateway,
+ "Check gateway with that of corresponding ip range"
+ )
- #Fetch corresponding zone information from listZones
+ # Fetch corresponding zone information from listZones
zone_response = list_zones(
- self.apiclient,
- id=cpvm.zoneid
- )
+ self.apiclient,
+ id=cpvm.zoneid
+ )
self.assertEqual(
- cpvm.dns1,
- zone_response[0].dns1,
- "Check DNS1 with that of corresponding zone"
- )
+ cpvm.dns1,
+ zone_response[0].dns1,
+ "Check DNS1 with that of corresponding zone"
+ )
self.assertEqual(
- cpvm.dns2,
- zone_response[0].dns2,
- "Check DNS2 with that of corresponding zone"
- )
+ cpvm.dns2,
+ zone_response[0].dns2,
+ "Check DNS2 with that of corresponding zone"
+ )
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_03_ssvm_internals(self):
"""Test SSVM Internals"""
@@ -329,106 +367,119 @@ class TestSSVMs(cloudstackTestCase):
# then the test is a failure
list_ssvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='secondarystoragevm',
- state='Running',
- zoneid=self.zone.id
- )
- self.assertEqual(
- isinstance(list_ssvm_response, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ systemvmtype='secondarystoragevm',
+ state='Running',
+ zoneid=self.zone.id
+ )
+ self.assertEqual(
+ isinstance(list_ssvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
ssvm = list_ssvm_response[0]
hosts = list_hosts(
- self.apiclient,
- id=ssvm.hostid
- )
- self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ id=ssvm.hostid
+ )
+ self.assertEqual(
+ isinstance(hosts, list),
+ True,
+ "Check list response returns a valid list"
+ )
host = hosts[0]
self.debug("Running SSVM check script")
if self.hypervisor.lower() in ('vmware', 'hyperv'):
- #SSH into SSVMs is done via management server for Vmware and Hyper-V
+ # SSH into SSVMs is done via management server for Vmware and
+ # Hyper-V
result = get_process_status(
- self.apiclient.connection.mgtSvr,
- 22,
- self.apiclient.connection.user,
- self.apiclient.connection.passwd,
- ssvm.privateip,
- "/usr/local/cloud/systemvm/ssvm-check.sh |grep -e ERROR -e WARNING -e FAIL",
- hypervisor=self.hypervisor
- )
+ self.apiclient.connection.mgtSvr,
+ 22,
+ self.apiclient.connection.user,
+ self.apiclient.connection.passwd,
+ ssvm.privateip,
+ "/usr/local/cloud/systemvm/ssvm-check.sh |grep -e ERROR -e WARNING -e FAIL",
+ hypervisor=self.hypervisor)
else:
try:
- host.user, host.passwd = get_host_credentials(self.config, host.ipaddress)
+ host.user, host.passwd = get_host_credentials(
+ self.config, host.ipaddress)
result = get_process_status(
- host.ipaddress,
- 22,
- host.user,
- host.passwd,
- ssvm.linklocalip,
- "/usr/local/cloud/systemvm/ssvm-check.sh |grep -e ERROR -e WARNING -e FAIL"
- )
+ host.ipaddress,
+ 22,
+ host.user,
+ host.passwd,
+ ssvm.linklocalip,
+ "/usr/local/cloud/systemvm/ssvm-check.sh |grep -e ERROR -e WARNING -e FAIL")
except KeyError:
- self.skipTest("Marvin configuration has no host credentials to check router services")
+ self.skipTest(
+ "Marvin configuration has no host\
+ credentials to check router services")
res = str(result)
self.debug("SSVM script output: %s" % res)
self.assertEqual(
- res.count("ERROR"),
- 1,
- "Check for Errors in tests"
- )
+ res.count("ERROR"),
+ 1,
+ "Check for Errors in tests"
+ )
self.assertEqual(
- res.count("WARNING"),
- 1,
- "Check for warnings in tests"
- )
+ res.count("WARNING"),
+ 1,
+ "Check for warnings in tests"
+ )
- #Check status of cloud service
+ # Check status of cloud service
if self.hypervisor.lower() in ('vmware', 'hyperv'):
- #SSH into SSVMs is done via management server for Vmware and Hyper-V
+ # SSH into SSVMs is done via management server for Vmware and
+ # Hyper-V
result = get_process_status(
- self.apiclient.connection.mgtSvr,
- 22,
- self.apiclient.connection.user,
- self.apiclient.connection.passwd,
- ssvm.privateip,
- "service cloud status",
- hypervisor=self.hypervisor
- )
+ self.apiclient.connection.mgtSvr,
+ 22,
+ self.apiclient.connection.user,
+ self.apiclient.connection.passwd,
+ ssvm.privateip,
+ "service cloud status",
+ hypervisor=self.hypervisor
+ )
else:
try:
- host.user, host.passwd = get_host_credentials(self.config, host.ipaddress)
+ host.user, host.passwd = get_host_credentials(
+ self.config, host.ipaddress)
result = get_process_status(
- host.ipaddress,
- 22,
- host.user,
- host.passwd,
- ssvm.linklocalip,
- "service cloud status"
- )
+ host.ipaddress,
+ 22,
+ host.user,
+ host.passwd,
+ ssvm.linklocalip,
+ "service cloud status"
+ )
except KeyError:
- self.skipTest("Marvin configuration has no host credentials to check router services")
+ self.skipTest(
+ "Marvin configuration has no host\
+ credentials to check router services")
res = str(result)
self.debug("Cloud Process status: %s" % res)
# cloud.com service (type=secstorage) is running: process id: 2346
self.assertEqual(
- res.count("is running"),
- 1,
- "Check cloud service is running or not"
- )
+ res.count("is running"),
+ 1,
+ "Check cloud service is running or not"
+ )
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_04_cpvm_internals(self):
"""Test CPVM Internals"""
@@ -440,78 +491,89 @@ class TestSSVMs(cloudstackTestCase):
# running
list_cpvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='consoleproxy',
- state='Running',
- zoneid=self.zone.id
- )
- self.assertEqual(
- isinstance(list_cpvm_response, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ systemvmtype='consoleproxy',
+ state='Running',
+ zoneid=self.zone.id
+ )
+ self.assertEqual(
+ isinstance(list_cpvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
cpvm = list_cpvm_response[0]
hosts = list_hosts(
- self.apiclient,
- id=cpvm.hostid
- )
- self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ id=cpvm.hostid
+ )
+ self.assertEqual(
+ isinstance(hosts, list),
+ True,
+ "Check list response returns a valid list"
+ )
host = hosts[0]
try:
- telnet = telnetlib.Telnet(
- str(self.apiclient.connection.mgtSvr),
- '8250'
- )
- self.debug("Telnet management server (IP: %s)" %
- self.apiclient.connection.mgtSvr)
+ telnetlib.Telnet(
+ str(self.apiclient.connection.mgtSvr),
+ '8250'
+ )
+ self.debug("Telnet management server (IP: %s)" %
+ self.apiclient.connection.mgtSvr)
except Exception as e:
self.fail(
- "Telnet Access failed for %s: %s" % \
- (self.apiclient.connection.mgtSvr, e)
- )
+ "Telnet Access failed for %s: %s" %
+ (self.apiclient.connection.mgtSvr, e)
+ )
self.debug("Checking cloud process status")
if self.hypervisor.lower() in ('vmware', 'hyperv'):
- #SSH into SSVMs is done via management server for Vmware and Hyper-V
+ # SSH into SSVMs is done via management server for Vmware and
+ # Hyper-V
result = get_process_status(
- self.apiclient.connection.mgtSvr,
- 22,
- self.apiclient.connection.user,
- self.apiclient.connection.passwd,
- cpvm.privateip,
- "service cloud status",
- hypervisor=self.hypervisor
- )
+ self.apiclient.connection.mgtSvr,
+ 22,
+ self.apiclient.connection.user,
+ self.apiclient.connection.passwd,
+ cpvm.privateip,
+ "service cloud status",
+ hypervisor=self.hypervisor
+ )
else:
try:
- host.user, host.passwd = get_host_credentials(self.config, host.ipaddress)
+ host.user, host.passwd = get_host_credentials(
+ self.config, host.ipaddress)
result = get_process_status(
- host.ipaddress,
- 22,
- host.user,
- host.passwd,
- cpvm.linklocalip,
- "service cloud status"
- )
+ host.ipaddress,
+ 22,
+ host.user,
+ host.passwd,
+ cpvm.linklocalip,
+ "service cloud status"
+ )
except KeyError:
- self.skipTest("Marvin configuration has no host credentials to check router services")
+ self.skipTest(
+ "Marvin configuration has no host\
+ credentials to check router services")
res = str(result)
self.debug("Cloud Process status: %s" % res)
self.assertEqual(
- res.count("is running"),
- 1,
- "Check cloud service is running or not"
- )
+ res.count("is running"),
+ 1,
+ "Check cloud service is running or not"
+ )
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_05_stop_ssvm(self):
"""Test stop SSVM
"""
@@ -524,70 +586,81 @@ class TestSSVMs(cloudstackTestCase):
# 3. If either of the two above steps fail the test is a failure
list_ssvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='secondarystoragevm',
- state='Running',
- zoneid=self.zone.id
- )
- self.assertEqual(
- isinstance(list_ssvm_response, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ systemvmtype='secondarystoragevm',
+ state='Running',
+ zoneid=self.zone.id
+ )
+ self.assertEqual(
+ isinstance(list_ssvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
ssvm = list_ssvm_response[0]
hosts = list_hosts(
- self.apiclient,
- id=ssvm.hostid
- )
- self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check list response returns a valid list"
- )
- host = hosts[0]
+ self.apiclient,
+ id=ssvm.hostid
+ )
+ self.assertEqual(
+ isinstance(hosts, list),
+ True,
+ "Check list response returns a valid list"
+ )
self.debug("Stopping SSVM: %s" % ssvm.id)
cmd = stopSystemVm.stopSystemVmCmd()
cmd.id = ssvm.id
self.apiclient.stopSystemVm(cmd)
-
+
timeout = self.services["timeout"]
while True:
list_ssvm_response = list_ssvms(
- self.apiclient,
- id=ssvm.id
- )
+ self.apiclient,
+ id=ssvm.id
+ )
if isinstance(list_ssvm_response, list):
if list_ssvm_response[0].state == 'Running':
break
if timeout == 0:
raise Exception("List SSVM call failed!")
-
+
time.sleep(self.services["sleep"])
timeout = timeout - 1
-
+
self.assertEqual(
- isinstance(list_ssvm_response, list),
- True,
- "Check list response returns a valid list"
- )
+ isinstance(list_ssvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
ssvm_response = list_ssvm_response[0]
self.debug("SSVM state after debug: %s" % ssvm_response.state)
self.assertEqual(
- ssvm_response.state,
- 'Running',
- "Check whether SSVM is running or not"
- )
+ ssvm_response.state,
+ 'Running',
+ "Check whether SSVM is running or not"
+ )
# Wait for the agent to be up
self.waitForSystemVMAgent(ssvm_response.name)
# Call above tests to ensure SSVM is properly running
self.test_01_list_sec_storage_vm()
+
+ # Wait for some time before running diagnostic scripts on SSVM
+ # as it may take some time to start all service properly
+ time.sleep(int(self.services["configurableData"]["systemVmDelay"]))
+
self.test_03_ssvm_internals()
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_06_stop_cpvm(self):
"""Test stop CPVM
"""
@@ -600,28 +673,27 @@ class TestSSVMs(cloudstackTestCase):
# 3. If either of the two above steps fail the test is a failure
list_cpvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='consoleproxy',
- state='Running',
- zoneid=self.zone.id
- )
- self.assertEqual(
- isinstance(list_cpvm_response, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ systemvmtype='consoleproxy',
+ state='Running',
+ zoneid=self.zone.id
+ )
+ self.assertEqual(
+ isinstance(list_cpvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
cpvm = list_cpvm_response[0]
hosts = list_hosts(
- self.apiclient,
- id=cpvm.hostid
- )
- self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check list response returns a valid list"
- )
- host = hosts[0]
+ self.apiclient,
+ id=cpvm.hostid
+ )
+ self.assertEqual(
+ isinstance(hosts, list),
+ True,
+ "Check list response returns a valid list"
+ )
self.debug("Stopping CPVM: %s" % cpvm.id)
cmd = stopSystemVm.stopSystemVmCmd()
@@ -631,15 +703,15 @@ class TestSSVMs(cloudstackTestCase):
timeout = self.services["timeout"]
while True:
list_cpvm_response = list_ssvms(
- self.apiclient,
- id=cpvm.id
- )
+ self.apiclient,
+ id=cpvm.id
+ )
if isinstance(list_cpvm_response, list):
if list_cpvm_response[0].state == 'Running':
break
if timeout == 0:
raise Exception("List CPVM call failed!")
-
+
time.sleep(self.services["sleep"])
timeout = timeout - 1
@@ -648,20 +720,32 @@ class TestSSVMs(cloudstackTestCase):
self.debug("CPVM state after debug: %s" % cpvm_response.state)
self.assertEqual(
- cpvm_response.state,
- 'Running',
- "Check whether CPVM is running or not"
- )
+ cpvm_response.state,
+ 'Running',
+ "Check whether CPVM is running or not"
+ )
# Wait for the agent to be up
self.waitForSystemVMAgent(cpvm_response.name)
# Call above tests to ensure CPVM is properly running
self.test_02_list_cpvm_vm()
+
+ # Wait for some time before running diagnostic scripts on SSVM
+ # as it may take some time to start all service properly
+ time.sleep(int(self.services["configurableData"]["systemVmDelay"]))
+
self.test_04_cpvm_internals()
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_07_reboot_ssvm(self):
"""Test reboot SSVM
"""
@@ -672,32 +756,31 @@ class TestSSVMs(cloudstackTestCase):
# 3. The cloud process should still be running within the SSVM
list_ssvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='secondarystoragevm',
- state='Running',
- zoneid=self.zone.id
- )
-
- self.assertEqual(
- isinstance(list_ssvm_response, list),
- True,
- "Check list response returns a valid list"
- )
-
+ self.apiclient,
+ systemvmtype='secondarystoragevm',
+ state='Running',
+ zoneid=self.zone.id
+ )
+
+ self.assertEqual(
+ isinstance(list_ssvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
+
ssvm_response = list_ssvm_response[0]
hosts = list_hosts(
- self.apiclient,
- id=ssvm_response.hostid
- )
- self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check list response returns a valid list"
- )
- host = hosts[0]
+ self.apiclient,
+ id=ssvm_response.hostid
+ )
+ self.assertEqual(
+ isinstance(hosts, list),
+ True,
+ "Check list response returns a valid list"
+ )
- #Store the public & private IP values before reboot
+ # Store the public & private IP values before reboot
old_public_ip = ssvm_response.publicip
old_private_ip = ssvm_response.privateip
@@ -709,46 +792,57 @@ class TestSSVMs(cloudstackTestCase):
timeout = self.services["timeout"]
while True:
list_ssvm_response = list_ssvms(
- self.apiclient,
- id=ssvm_response.id
- )
+ self.apiclient,
+ id=ssvm_response.id
+ )
if isinstance(list_ssvm_response, list):
if list_ssvm_response[0].state == 'Running':
break
if timeout == 0:
raise Exception("List SSVM call failed!")
-
+
time.sleep(self.services["sleep"])
timeout = timeout - 1
ssvm_response = list_ssvm_response[0]
self.debug("SSVM State: %s" % ssvm_response.state)
self.assertEqual(
- 'Running',
- str(ssvm_response.state),
- "Check whether CPVM is running or not"
- )
+ 'Running',
+ str(ssvm_response.state),
+ "Check whether CPVM is running or not"
+ )
self.assertEqual(
- ssvm_response.publicip,
- old_public_ip,
- "Check Public IP after reboot with that of before reboot"
- )
+ ssvm_response.publicip,
+ old_public_ip,
+ "Check Public IP after reboot with that of before reboot"
+ )
self.assertEqual(
- ssvm_response.privateip,
- old_private_ip,
- "Check Private IP after reboot with that of before reboot"
- )
+ ssvm_response.privateip,
+ old_private_ip,
+ "Check Private IP after reboot with that of before reboot"
+ )
# Wait for the agent to be up
self.waitForSystemVMAgent(ssvm_response.name)
- #Call to verify cloud process is running
+ # Wait for some time before running diagnostic scripts on SSVM
+ # as it may take some time to start all service properly
+ time.sleep(int(self.services["configurableData"]["systemVmDelay"]))
+
+ # Call to verify cloud process is running
self.test_03_ssvm_internals()
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_08_reboot_cpvm(self):
"""Test reboot CPVM
"""
@@ -758,32 +852,30 @@ class TestSSVMs(cloudstackTestCase):
# the same before and after reboot
# 3. the cloud process should still be running within the CPVM
-
list_cpvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='consoleproxy',
- state='Running',
- zoneid=self.zone.id
- )
- self.assertEqual(
- isinstance(list_cpvm_response, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ systemvmtype='consoleproxy',
+ state='Running',
+ zoneid=self.zone.id
+ )
+ self.assertEqual(
+ isinstance(list_cpvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
cpvm_response = list_cpvm_response[0]
hosts = list_hosts(
- self.apiclient,
- id=cpvm_response.hostid
- )
- self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check list response returns a valid list"
- )
- host = hosts[0]
+ self.apiclient,
+ id=cpvm_response.hostid
+ )
+ self.assertEqual(
+ isinstance(hosts, list),
+ True,
+ "Check list response returns a valid list"
+ )
- #Store the public & private IP values before reboot
+ # Store the public & private IP values before reboot
old_public_ip = cpvm_response.publicip
old_private_ip = cpvm_response.privateip
@@ -796,15 +888,15 @@ class TestSSVMs(cloudstackTestCase):
timeout = self.services["timeout"]
while True:
list_cpvm_response = list_ssvms(
- self.apiclient,
- id=cpvm_response.id
- )
+ self.apiclient,
+ id=cpvm_response.id
+ )
if isinstance(list_cpvm_response, list):
if list_cpvm_response[0].state == 'Running':
break
if timeout == 0:
raise Exception("List CPVM call failed!")
-
+
time.sleep(self.services["sleep"])
timeout = timeout - 1
@@ -812,30 +904,41 @@ class TestSSVMs(cloudstackTestCase):
self.debug("CPVM state: %s" % cpvm_response.state)
self.assertEqual(
- 'Running',
- str(cpvm_response.state),
- "Check whether CPVM is running or not"
- )
+ 'Running',
+ str(cpvm_response.state),
+ "Check whether CPVM is running or not"
+ )
self.assertEqual(
- cpvm_response.publicip,
- old_public_ip,
- "Check Public IP after reboot with that of before reboot"
- )
+ cpvm_response.publicip,
+ old_public_ip,
+ "Check Public IP after reboot with that of before reboot"
+ )
self.assertEqual(
- cpvm_response.privateip,
- old_private_ip,
- "Check Private IP after reboot with that of before reboot"
- )
+ cpvm_response.privateip,
+ old_private_ip,
+ "Check Private IP after reboot with that of before reboot"
+ )
# Wait for the agent to be up
self.waitForSystemVMAgent(cpvm_response.name)
- #Call to verify cloud process is running
+ # Wait for some time before running diagnostic scripts on SSVM
+ # as it may take some time to start all service properly
+ time.sleep(int(self.services["configurableData"]["systemVmDelay"]))
+
+ # Call to verify cloud process is running
self.test_04_cpvm_internals()
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_09_destroy_ssvm(self):
"""Test destroy SSVM
"""
@@ -848,16 +951,16 @@ class TestSSVMs(cloudstackTestCase):
# 4. cloud process within SSVM must be up and running
list_ssvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='secondarystoragevm',
- state='Running',
- zoneid=self.zone.id
- )
- self.assertEqual(
- isinstance(list_ssvm_response, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ systemvmtype='secondarystoragevm',
+ state='Running',
+ zoneid=self.zone.id
+ )
+ self.assertEqual(
+ isinstance(list_ssvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
ssvm_response = list_ssvm_response[0]
old_name = ssvm_response.name
@@ -870,16 +973,16 @@ class TestSSVMs(cloudstackTestCase):
timeout = self.services["timeout"]
while True:
list_ssvm_response = list_ssvms(
- self.apiclient,
- zoneid=self.zone.id,
- systemvmtype='secondarystoragevm'
- )
+ self.apiclient,
+ zoneid=self.zone.id,
+ systemvmtype='secondarystoragevm'
+ )
if isinstance(list_ssvm_response, list):
if list_ssvm_response[0].state == 'Running':
break
if timeout == 0:
raise Exception("List SSVM call failed!")
-
+
time.sleep(self.services["sleep"])
timeout = timeout - 1
@@ -888,36 +991,47 @@ class TestSSVMs(cloudstackTestCase):
# Verify Name, Public IP, Private IP and Link local IP
# for newly created SSVM
self.assertNotEqual(
- ssvm_response.name,
- old_name,
- "Check SSVM new name with name of destroyed SSVM"
- )
+ ssvm_response.name,
+ old_name,
+ "Check SSVM new name with name of destroyed SSVM"
+ )
self.assertEqual(
- hasattr(ssvm_response, 'privateip'),
- True,
- "Check whether SSVM has private IP field"
- )
+ hasattr(ssvm_response, 'privateip'),
+ True,
+ "Check whether SSVM has private IP field"
+ )
self.assertEqual(
- hasattr(ssvm_response, 'linklocalip'),
- True,
- "Check whether SSVM has link local IP field"
- )
+ hasattr(ssvm_response, 'linklocalip'),
+ True,
+ "Check whether SSVM has link local IP field"
+ )
self.assertEqual(
- hasattr(ssvm_response, 'publicip'),
- True,
- "Check whether SSVM has public IP field"
- )
-
+ hasattr(ssvm_response, 'publicip'),
+ True,
+ "Check whether SSVM has public IP field"
+ )
+
# Wait for the agent to be up
self.waitForSystemVMAgent(ssvm_response.name)
- #Call to verify cloud process is running
+ # Wait for some time before running diagnostic scripts on SSVM
+ # as it may take some time to start all service properly
+ time.sleep(int(self.services["configurableData"]["systemVmDelay"]))
+
+ # Call to verify cloud process is running
self.test_03_ssvm_internals()
return
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+ @attr(
+ tags=[
+ "advanced",
+ "advancedns",
+ "smoke",
+ "basic",
+ "sg"],
+ required_hardware="true")
def test_10_destroy_cpvm(self):
"""Test destroy CPVM
"""
@@ -930,15 +1044,15 @@ class TestSSVMs(cloudstackTestCase):
# 4. cloud process within CPVM must be up and running
list_cpvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='consoleproxy',
- zoneid=self.zone.id
- )
- self.assertEqual(
- isinstance(list_cpvm_response, list),
- True,
- "Check list response returns a valid list"
- )
+ self.apiclient,
+ systemvmtype='consoleproxy',
+ zoneid=self.zone.id
+ )
+ self.assertEqual(
+ isinstance(list_cpvm_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
cpvm_response = list_cpvm_response[0]
old_name = cpvm_response.name
@@ -951,16 +1065,16 @@ class TestSSVMs(cloudstackTestCase):
timeout = self.services["timeout"]
while True:
list_cpvm_response = list_ssvms(
- self.apiclient,
- systemvmtype='consoleproxy',
- zoneid=self.zone.id
- )
+ self.apiclient,
+ systemvmtype='consoleproxy',
+ zoneid=self.zone.id
+ )
if isinstance(list_cpvm_response, list):
if list_cpvm_response[0].state == 'Running':
break
if timeout == 0:
raise Exception("List CPVM call failed!")
-
+
time.sleep(self.services["sleep"])
timeout = timeout - 1
@@ -969,31 +1083,35 @@ class TestSSVMs(cloudstackTestCase):
# Verify Name, Public IP, Private IP and Link local IP
# for newly created CPVM
self.assertNotEqual(
- cpvm_response.name,
- old_name,
- "Check SSVM new name with name of destroyed CPVM"
- )
+ cpvm_response.name,
+ old_name,
+ "Check SSVM new name with name of destroyed CPVM"
+ )
self.assertEqual(
- hasattr(cpvm_response, 'privateip'),
- True,
- "Check whether CPVM has private IP field"
- )
+ hasattr(cpvm_response, 'privateip'),
+ True,
+ "Check whether CPVM has private IP field"
+ )
self.assertEqual(
- hasattr(cpvm_response, 'linklocalip'),
- True,
- "Check whether CPVM has link local IP field"
- )
+ hasattr(cpvm_response, 'linklocalip'),
+ True,
+ "Check whether CPVM has link local IP field"
+ )
self.assertEqual(
- hasattr(cpvm_response, 'publicip'),
- True,
- "Check whether CPVM has public IP field"
- )
-
+ hasattr(cpvm_response, 'publicip'),
+ True,
+ "Check whether CPVM has public IP field"
+ )
+
# Wait for the agent to be up
self.waitForSystemVMAgent(cpvm_response.name)
- #Call to verify cloud process is running
+ # Wait for some time before running diagnostic scripts on SSVM
+ # as it may take some time to start all service properly
+ time.sleep(int(self.services["configurableData"]["systemVmDelay"]))
+
+ # Call to verify cloud process is running
self.test_04_cpvm_internals()
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/77bd069c/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 9add0fa..f123dd0 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -1468,6 +1468,7 @@ test_data = {
"publicport": 22,
"username": "root",
"password": "password",
- }
+ },
+ "systemVmDelay": 120
}
}