# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1224746643 25200
# Node ID 73be202634a52607d5ab54ca62a2706ec7aca23b
# Parent 868aa0f5175568c5752787c1fcbd2b1df4001aad
[TEST] Addring new tc 01_enum_crs.py to verify CRS fields.
Assumption :
The value of MaxConcurrentEnabledSAPs = 2* nof of guest on the machine.
This needs to be updated
Tested on KVM with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 868aa0f51755 -r 73be202634a5
suites/libvirt-cim/cimtest/RedirectionService/01_enum_crs.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/RedirectionService/01_enum_crs.py Thu Oct 23 00:24:03
2008 -0700
@@ -0,0 +1,80 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <dkalaker(a)in.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# This test case is used to verify the RedirectionService
+# properties in detail.
+#
+# Date : 22-10-2008
+#
+
+import sys
+from VirtLib.live import domain_list
+from XenKvmLib.enumclass import EnumInstances
+from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.const import do_main
+from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.common_util import get_host_info
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+@do_main(sup_types)
+def main():
+ virt = main.options.virt
+ server = main.options.ip
+ cname = 'ConsoleRedirectionService'
+ classname = get_typed_class(virt, cname)
+ try:
+ crs = EnumInstances(server, classname)
+ except Exception, detail:
+ logger.error(CIM_ERROR_ENUMERATE, classname)
+ logger.error("Exception: %s", detail)
+ return FAIL
+
+ status, host_name, host_cn = get_host_info(server, virt)
+ if status != PASS:
+ return status
+
+ max_con_saps = 2 * len(domain_list(server, virt))
+ crs_list = {
+ 'ElementName' : cname,
+ 'SystemCreationClassName' : host_cn,
+ 'SystemName' : host_name,
+ 'CreationClassName' : classname,
+ 'Name' : cname,
+ 'RedirectionServiceType' : [3],
+ 'SharingMode' : 3,
+ 'EnabledState' : 2,
+ 'EnabledDefault' : 2,
+ 'RequestedState' : 12,
+ 'MaxConcurrentEnabledSAPs': max_con_saps
+ }
+
+ crs_val = crs[0]
+ for k, exp_val in crs_list.iteritems():
+ res_val = eval("crs_val." + k)
+ if res_val != exp_val:
+ logger.error("'%s' Mismatch", k)
+ logger.error("Expected '%s', Got '%s'", exp_val,
res_val)
+ return FAIL
+ return PASS
+
+if __name__ == "__main__":
+ sys.exit(main())
Show replies by thread
Deepti B. Kalakeri wrote:
# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1224746643 25200
# Node ID 73be202634a52607d5ab54ca62a2706ec7aca23b
# Parent 868aa0f5175568c5752787c1fcbd2b1df4001aad
[TEST] Addring new tc 01_enum_crs.py to verify CRS fields.
Assumption :
The value of MaxConcurrentEnabledSAPs = 2* nof of guest on the machine.
This needs to be updated
Tested on KVM with current sources.
+
+sup_types = ['Xen', 'KVM', 'XenFV']
This should also work for LXC.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com
+ crs_val = crs[0]
You also want to check the length of crs. The provider should always
return an instance, but it's always good to have a check. If something
causes the provider not to return an instance and also not return a
failure, then you'd be accessing the array out of bounds.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com
Kaitlin Rupert wrote:
> + crs_val = crs[0]
You also want to check the length of crs. The provider should always
return an instance, but it's always good to have a check. If something
causes the provider not to return an instance and also not return a
failure, then you'd be accessing the array out of bounds.
Yup, I forgot this check.
Thanks patch with changes submitted.
Regards,
Deepti.