# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1224835478 25200
# Node ID 0f340004e1cd48f5ede60a68283a850ae60c9ebe
# Parent 1f9f2d2c410e9dfb53bda9befe230475fcacf159
[TEST] #2 Adding new tc 02_enum_crscap.py to verify ConsoleRedirectionServiceCapabilities
fields.
Tested on KVM and LXC with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 1f9f2d2c410e -r 0f340004e1cd
suites/libvirt-cim/cimtest/RedirectionService/02_enum_crscap.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/RedirectionService/02_enum_crscap.py Fri Oct 24 01:04:38
2008 -0700
@@ -0,0 +1,81 @@
+#!/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 ConsoleRedirectionServiceCapabilities
+# 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
+
+SHAREMODESUPP = 3
+
+sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
+@do_main(sup_types)
+def main():
+ virt = main.options.virt
+ server = main.options.ip
+ cname = 'ConsoleRedirectionServiceCapabilities'
+ cap_name = 'ConsoleRedirectionCapabilities'
+ classname = get_typed_class(virt, cname)
+ try:
+ crs = EnumInstances(server, classname)
+
+ if len(crs) != 1:
+ logger.error("'%s' returned %i records, expected 1",
+ classname, len(crs))
+ return FAIL
+
+ crs_val = crs[0]
+ if crs_val.InstanceID != cap_name:
+ logger.error("InstanceID Mismatch")
+ logger.error("Got '%s', Expected '%s'",
crs_val.InstanceID,
+ cap_name)
+ return FAIL
+
+ if crs_val.ElementName != cap_name:
+ logger.error("ElementName Mismatch")
+ logger.error("Got '%s', Expected '%s'",
crs_val.ElementName,
+ cap_name)
+ return FAIL
+
+ mode_supp = crs_val.SharingModeSupported[0]
+ if mode_supp != SHAREMODESUPP:
+ logger.error("SharingModeSupported Mismatch")
+ logger.error("Got '%s', Expected '%s'", mode_supp,
SHAREMODESUPP)
+ return FAIL
+
+ except Exception, detail:
+ logger.error(CIM_ERROR_ENUMERATE, classname)
+ logger.error("Exception: %s", detail)
+ return FAIL
+
+ return PASS
+
+if __name__ == "__main__":
+ sys.exit(main())