[PATCH 0 of 3] [TEST] update EC test cases for XenFV and KVM support

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1206944886 25200 # Node ID 0c1a7077faebe978965e537505e978117f623929 # Parent 612ccb311e273b091659fe14f0471567abe61d08 [TEST] update EC.01 for XenFV and KVM support Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 612ccb311e27 -r 0c1a7077faeb suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Fri Mar 28 00:03:41 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Sun Mar 30 23:28:06 2008 -0700 @@ -25,11 +25,12 @@ from VirtLib import live from VirtLib import live from XenKvmLib import assoc from XenKvmLib import hostsystem +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import do_main from CimTest.ReturnCodes import PASS, FAIL, SKIP -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] @do_main(sup_types) def main(): @@ -37,15 +38,16 @@ def main(): Globals.log_param() try: - host_sys = hostsystem.enumerate(options.ip)[0] + host_sys = hostsystem.enumerate(options.ip, options.virt)[0] except Exception: - Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, 'Xen_HostSystem') + Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, get_typed_class(options.virt, 'HostSystem')) return FAIL try: elc = assoc.AssociatorNames(options.ip, - "Xen_ElementCapabilities", - "Xen_HostSystem", + "ElementCapabilities", + "HostSystem", + options.virt, Name = host_sys.Name, CreationClassName = host_sys.CreationClassName) except Exception: @@ -53,8 +55,8 @@ def main(): return FAIL - valid_elc_name = ["Xen_VirtualSystemManagementCapabilities", - "Xen_VirtualSystemMigrationCapabilities"] + valid_elc_name = [get_typed_class(options.virt, "VirtualSystemManagementCapabilities"), + get_typed_class(options.virt, "VirtualSystemMigrationCapabilities")] valid_elc_id = ["ManagementCapabilities", "MigrationCapabilities"] @@ -70,19 +72,20 @@ def main(): return FAIL - cs = live.domain_list(options.ip) + cs = live.domain_list(options.ip, options.virt) for system in cs: try: elec = assoc.AssociatorNames(options.ip, - "Xen_ElementCapabilities", - "Xen_ComputerSystem", + "ElementCapabilities", + "ComputerSystem", + options.virt, Name = system, CreationClassName = "Xen_ComputerSystem") except Exception: Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % system) return FAIL - if elec[0].classname != "Xen_EnabledLogicalElementCapabilities": + if elec[0].classname != get_typed_class(options.virt, "EnabledLogicalElementCapabilities"): Globals.logger.error("ElementCapabilities association classname error") return FAIL elif elec[0].keybindings['InstanceID'] != system:

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1206945214 25200 # Node ID 8a88d71e2fc844fcf4a2fd45924c9971e1639dac # Parent 0c1a7077faebe978965e537505e978117f623929 [TEST] update EC.03 for XenFV and KVM support Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 0c1a7077faeb -r 8a88d71e2fc8 suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Sun Mar 30 23:28:06 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Sun Mar 30 23:33:34 2008 -0700 @@ -25,11 +25,12 @@ from pywbem.cim_obj import CIMInstanceNa from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc from XenKvmLib import hostsystem +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] exp_rc = 6 #CIM_ERR_NOT_FOUND exp_desc = "No such instance" @@ -38,13 +39,12 @@ def try_assoc(ref, ref_class, exp_rc, ex conn = assoc.myWBEMConnection('http://%s' % options.ip, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) - log_param() status = FAIL rc = -1 names = [] try: - names = conn.AssociatorNames(ref, AssocClass = "Xen_ElementCapabilities") + names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities")) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -57,7 +57,8 @@ def try_assoc(ref, ref_class, exp_rc, ex logger.error(details) finally: if rc == 0: - logger.error("Xen_ElementCapabilities associator should NOT return excepted result with a wrong key name and value of %s input" % ref_class) + logger.error("ElementCapabilities associator should NOT return excepted result \ + with a wrong key name and value of %s input" % ref_class) status = FAIL return status @@ -67,18 +68,20 @@ def main(): def main(): options = main.options rc = PASS + log_param() - instanceref = CIMInstanceName("Xen_HostSystem", + instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), keybindings = {"Name" : "wrong", "CreationClassName" : "wrong"}) - rc = try_assoc(instanceref, "Xen_HostSystem", exp_rc, exp_desc, options) + rc = try_assoc(instanceref, get_typed_class(options.virt, "HostSystem"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL return status - instance_cs = CIMInstanceName("Xen_ComputerSystem", - keybindings = {"Name" : "wrong", "CreationClassName" : "Xen_ComputerSystem"}) - rc = try_assoc(instance_cs, "Xen_ComputerSystem", exp_rc, exp_desc, options) + instance_cs = CIMInstanceName(get_typed_class(options.virt, "ComputerSystem"), + keybindings = {"Name" : "wrong", + "CreationClassName" : get_typed_class(options.virt,"ComputerSystem")}) + rc = try_assoc(instance_cs, get_typed_class(options.virt, "ComputerSystem"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL return status

Guo Lian Yun wrote:
@@ -67,18 +68,20 @@ def main(): def main(): options = main.options rc = PASS + log_param()
- instanceref = CIMInstanceName("Xen_HostSystem", + instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), #1
keybindings = {"Name" : "wrong", "CreationClassName" : "wrong"}) - rc = try_assoc(instanceref, "Xen_HostSystem", exp_rc, exp_desc, options) + rc = try_assoc(instanceref, get_typed_class(options.virt, "HostSystem"), exp_rc, exp_desc, options)
#2
if rc != PASS: status = FAIL return status
- instance_cs = CIMInstanceName("Xen_ComputerSystem", - keybindings = {"Name" : "wrong", "CreationClassName" : "Xen_ComputerSystem"}) - rc = try_assoc(instance_cs, "Xen_ComputerSystem", exp_rc, exp_desc, options) + instance_cs = CIMInstanceName(get_typed_class(options.virt, "ComputerSystem"),
#3
+ keybindings = {"Name" : "wrong", + "CreationClassName" : get_typed_class(options.virt,"ComputerSystem")}) + rc = try_assoc(instance_cs, get_typed_class(options.virt, "ComputerSystem"), exp_rc, exp_desc, options) #4
#1 & #2, #3 & #4 share some common code. I would consider use a variable to avoid duplicated get_typed_class() call.
if rc != PASS: status = FAIL return status
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- - Zhengang

libvirt-cim-bounces@redhat.com wrote on 2008-04-01 09:40:04:
Guo Lian Yun wrote:
@@ -67,18 +68,20 @@ def main(): def main(): options = main.options rc = PASS + log_param()
- instanceref = CIMInstanceName("Xen_HostSystem", + instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), #1
keybindings = {"Name" :
"wrong", "CreationClassName" : "wrong"})
- rc = try_assoc(instanceref, "Xen_HostSystem", exp_rc, exp_desc, options) + rc = try_assoc(instanceref, get_typed_class(options.virt, "HostSystem"), exp_rc, exp_desc, options) #2
if rc != PASS: status = FAIL return status
- instance_cs = CIMInstanceName("Xen_ComputerSystem", - keybindings = {"Name" :
"wrong", "CreationClassName" : "Xen_ComputerSystem"})
- rc = try_assoc(instance_cs, "Xen_ComputerSystem", exp_rc, exp_desc, options) + instance_cs = CIMInstanceName(get_typed_class(options.virt, "ComputerSystem"), #3
+ keybindings = {"Name" : "wrong", + "CreationClassName" : get_typed_class(options.virt,"ComputerSystem")}) + rc = try_assoc(instance_cs, get_typed_class(options.virt, "ComputerSystem"), exp_rc, exp_desc, options) #4
#1 & #2, #3 & #4 share some common code. I would consider use a variable to avoid duplicated get_typed_class() call.
Good catch! Changed and resubmit.
if rc != PASS: status = FAIL return status
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- - Zhengang
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1206945382 25200 # Node ID 8a80ce6eb0938f83877ffd54e047a6a54c58f756 # Parent 8a88d71e2fc844fcf4a2fd45924c9971e1639dac [TEST] update EC.04 for XenFV and KVM support Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 8a88d71e2fc8 -r 8a80ce6eb093 suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py Sun Mar 30 23:33:34 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/04_reverse_errs.py Sun Mar 30 23:36:22 2008 -0700 @@ -24,11 +24,12 @@ import pywbem import pywbem from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL, SKIP -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] exp_rc = 6 #CIM_ERR_NOT_FOUND exp_desc = "No such instance" @@ -37,13 +38,12 @@ def try_assoc(ref, ref_class, exp_rc, ex conn = assoc.myWBEMConnection('http://%s' % options.ip, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) - log_param() status = FAIL rc = -1 names = [] try: - names = conn.AssociatorNames(ref, AssocClass = "Xen_ElementCapabilities") + names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities")) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -56,16 +56,19 @@ def try_assoc(ref, ref_class, exp_rc, ex logger.error(details) finally: if rc == 0: - logger.error("Xen_ElementCapabilities associator should NOT return excepted result with a wrong key name and value of %s input" % ref_class) + logger.error("ElementCapabilities associator should NOT return excepted result \ + with a wrong key name and value of %s input" % ref_class) status = FAIL return status @do_main(sup_types) def main(): + options = main.options + log_param() rc = PASS - cap_list = {"Xen_VirtualSystemManagementCapabilities" : "ManagementCapabilities", - "Xen_VirtualSystemMigrationCapabilities" : "MigrationCapabilities"} + cap_list = {get_typed_class(options.virt, "VirtualSystemManagementCapabilities") : "ManagementCapabilities", + get_typed_class(options.virt, "VirtualSystemMigrationCapabilities") : "MigrationCapabilities"} for k, v in cap_list.items(): instanceref = CIMInstanceName(k, @@ -75,9 +78,9 @@ def main(): status = FAIL return status - elecref = CIMInstanceName("Xen_EnabledLogicalElementCapabilities", + elecref = CIMInstanceName(get_typed_class(options.virt, "EnabledLogicalElementCapabilities"), keybindings = {"InstanceID" : "wrong"}) - rc = try_assoc(elecref, "Xen_EnabledLogicalElementCapabilities", + rc = try_assoc(elecref, get_typed_class(options.virt, "EnabledLogicalElementCapabilities"), exp_rc, exp_desc, options) if rc != PASS: status = FAIL

Guo Lian Yun wrote:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1206945382 25200 # Node ID 8a80ce6eb0938f83877ffd54e047a6a54c58f756 # Parent 8a88d71e2fc844fcf4a2fd45924c9971e1639dac [TEST] update EC.04 for XenFV and KVM support
Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>
+1 -- - Zhengang
participants (2)
-
Guo Lian Yun
-
Zhengang Li