[PATCH] [TEST]#3 Fix HostedService.02, 03&04 to work with sblim base provider installed

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1222482583 25200 # Node ID 145cde258442f326f9503bc261f9f3674e2fe82d # Parent 0ecb3a22c3617eaa4298dfd9cd3b7b27b9846110 [TEST]#3 Fix HostedService.02,03&04 to work with sblim base provider installed Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 0ecb3a22c361 -r 145cde258442 suites/libvirt-cim/cimtest/HostedService/02_reverse.py --- a/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Fri Sep 26 02:44:52 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Fri Sep 26 19:29:43 2008 -0700 @@ -25,6 +25,7 @@ from VirtLib import utils from VirtLib import utils from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import get_host_info from XenKvmLib.classes import get_typed_class from CimTest import Globals from XenKvmLib.const import do_main @@ -37,11 +38,11 @@ def main(): def main(): options = main.options keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) + status, host_name, host_ccn = get_host_info(options.ip, options.virt) + if status != PASS: + logger.error("Check sblim provider or enumerate hostsystem error") return FAIL + servicelist = {"ResourcePoolConfigurationService" : "RPCS", "VirtualSystemManagementService" : "Management Service", "VirtualSystemMigrationService" : "MigrationService"} @@ -54,8 +55,8 @@ def main(): options.virt, Name = v, CreationClassName = get_typed_class(options.virt, k), - SystemCreationClassName = host_sys.CreationClassName, - SystemName = host_sys.Name) + SystemCreationClassName = host_ccn, + SystemName = host_name) except Exception: logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % item) return FAIL @@ -67,10 +68,10 @@ def main(): ccn = assoc_host[0].keybindings['CreationClassName'] name = assoc_host[0].keybindings['Name'] - if ccn != get_typed_class(options.virt, "HostSystem"): + if ccn != host_ccn: logger.error("CreationClassName Error") return FAIL - elif name != host_sys.Name: + elif name != host_name: logger.error("CCN Error") return FAIL diff -r 0ecb3a22c361 -r 145cde258442 suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Sep 26 02:44:52 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Sep 26 19:29:43 2008 -0700 @@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import get_host_info from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \ CIM_PASS, CIM_NS @@ -40,24 +41,22 @@ def main(): options = main.options rc = -1 status = FAIL - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(CIM_ERROR_ENUMERATE % host_sys.name) + status, host_name, host_ccn = get_host_info(options.ip, options.virt) + if status != PASS: + logger.error("Error in calling get_host_info function") return FAIL - - + conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS) instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), - keybindings = {"Wrong" : "wrong", "CreationClassName" : host_sys.CreationClassName}) + keybindings = {"Wrong" : "wrong", \ + "CreationClassName" : host_ccn}) names = [] - + assoc_class = get_typed_class(options.virt, "HostedService") try: - names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService")) + names = conn.AssociatorNames(instanceref, AssocClass = assoc_class) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -70,7 +69,8 @@ def main(): logger.error(details) if rc == 0: - logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of HostSystem input") + logger.error("HostedService associator should NOT return excepted result\ + with a wrong key name and value of HostSystem input") status = FAIL return status diff -r 0ecb3a22c361 -r 145cde258442 suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Fri Sep 26 02:44:52 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Fri Sep 26 19:29:43 2008 -0700 @@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import get_host_info from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \ CIM_PASS, CIM_NS @@ -40,13 +41,10 @@ def main(): options = main.options rc = -1 status = FAIL - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(CIM_ERROR_ENUMERATE % host_sys.name) + status, host_name, host_ccn = get_host_info(options.ip, options.virt) + if status != PASS: + logger.error("Error in calling get_host_info function") return FAIL - servicelist = {get_typed_class(options.virt, "ResourcePoolConfigurationService") : "RPCS", get_typed_class(options.virt, "VirtualSystemManagementService") : "Management Service", @@ -60,12 +58,12 @@ def main(): instanceref = CIMInstanceName(k, keybindings = {"Wrong" : v, "CreationClassName" : "wrong", - "SystemCreationClassName" : host_sys.CreationClassName, - "SystemName" : host_sys.Name}) + "SystemCreationClassName" : host_name, + "SystemName" : host_ccn}) names = [] - + assoc_class = get_typed_class(options.virt, "HostedService") try: - names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService")) + names = conn.AssociatorNames(instanceref, AssocClass = assoc_class) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -78,7 +76,8 @@ def main(): logger.error(details) if rc == 0: - logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of %s input" % k) + logger.error("HostedService associator should NOT return excepted result\ + with a wrong key name and value of %s input" % k) status = FAIL return status

yunguol@cn.ibm.com wrote:
diff -r 0ecb3a22c361 -r 145cde258442 suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Sep 26 02:44:52 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Sep 26 19:29:43 2008 -0700 @@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import get_host_info from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \ CIM_PASS, CIM_NS @@ -40,24 +41,22 @@ def main(): options = main.options rc = -1 status = FAIL - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(CIM_ERROR_ENUMERATE % host_sys.name) + status, host_name, host_ccn = get_host_info(options.ip, options.virt) + if status != PASS: + logger.error("Error in calling get_host_info function") return FAIL - - + conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS) instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), - keybindings = {"Wrong" : "wrong", "CreationClassName" : host_sys.CreationClassName}) + keybindings = {"Wrong" : "wrong", \ + "CreationClassName" : host_ccn})
names = [] - + assoc_class = get_typed_class(options.virt, "HostedService") try: - names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService")) + names = conn.AssociatorNames(instanceref, AssocClass = assoc_class) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -70,7 +69,8 @@ def main(): logger.error(details)
if rc == 0: - logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of HostSystem input") + logger.error("HostedService associator should NOT return excepted result\ + with a wrong key name and value of HostSystem input") status = FAIL
return status
The above test case passes with false positive. The existing test case is intended to verify for exception when a wrong Name is passed as a parameter. _ For ex: without the sblim-base-provider the tc would be checking_ wbemcli ain -ac Xen_HostedService 'http://root:p@localhost:5988/root/virt:Xen_HostSystem.CreationClassName="Xen_HostSystem",Wrong="wrong"' * * wbemcli: Cim: (6) CIM_ERR_NOT_FOUND: No such instance (Name) * _But with the sblim-base-provider installed the tc would be checking_ wbemcli ain -ac Xen_HostedService 'http://root:P@localhost:5988/root/virt:Xen_HostSystem.CreationClassName="Linux_ComputerSystem",Wrong="wrong"' * * wbemcli: Cim: (6) CIM_ERR_NOT_FOUND: No such instance (CreationClassName) * though getting the exception for Linux_ComputerSystem in the second case is valid for now, as the query with the Linux_CS does not work yet, but this is not the expected behavior of the test case. The tc just verifies only "No such instance " string which is present in both the exceptions and hence passes. 1) This test cannot be supported to work with sblim-base-provider installed yet. 2) We need to update the tc to verify the case where we pass Invalid CreationClassName. 3) We need to be verifying the complete exception instead of just verifying part of it. Thanks and Regards, Deepti.

The above test case passes with false positive. The existing test case is intended to verify for exception when a wrong Name is passed as a parameter. _ For ex: without the sblim-base-provider the tc would be checking_ wbemcli ain -ac Xen_HostedService 'http://root:p@localhost:5988/root/virt:Xen_HostSystem.CreationClassName="Xen_HostSystem",Wrong="wrong"'
* * wbemcli: Cim: (6) CIM_ERR_NOT_FOUND: No such instance (Name) *
_But with the sblim-base-provider installed the tc would be checking_
wbemcli ain -ac Xen_HostedService 'http://root:P@localhost:5988/root/virt:Xen_HostSystem.CreationClassName="Linux_ComputerSystem",Wrong="wrong"'
* * wbemcli: Cim: (6) CIM_ERR_NOT_FOUND: No such instance (CreationClassName) *
These are really good points Deepti - thanks for taking a look at this.
though getting the exception for Linux_ComputerSystem in the second case is valid for now, as the query with the Linux_CS does not work yet, but this is not the expected behavior of the test case.
The tc just verifies only "No such instance " string which is present in both the exceptions and hence passes. 1) This test cannot be supported to work with sblim-base-provider installed yet.
It can return an XFAIL in the case where the SBLIM providers are installed.
2) We need to update the tc to verify the case where we pass Invalid CreationClassName. 3) We need to be verifying the complete exception instead of just verifying part of it.
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

libvirt-cim-bounces@redhat.com wrote on 2008-09-29 19:36:20:
yunguol@cn.ibm.com wrote:
diff -r 0ecb3a22c361 -r 145cde258442 suites/libvirt-
cim/cimtest/HostedService/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Sep 26 02:44:52 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Sep 26 19:29:43 2008 -0700 @@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa from pywbem.cim_obj import CIMInstanceName from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import get_host_info from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \ CIM_PASS, CIM_NS @@ -40,24 +41,22 @@ def main(): options = main.options rc = -1 status = FAIL - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(CIM_ERROR_ENUMERATE % host_sys.name) + status, host_name, host_ccn = get_host_info(options.ip,
options.virt)
+ if status != PASS: + logger.error("Error in calling get_host_info function") return FAIL - - + conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS) instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"), - keybindings = {"Wrong" : "wrong", "CreationClassName" : host_sys.CreationClassName}) + keybindings = {"Wrong" : "wrong", \ + "CreationClassName" : host_ccn})
names = [] - + assoc_class = get_typed_class(options.virt, "HostedService") try: - names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService")) + names = conn.AssociatorNames(instanceref, AssocClass = assoc_class) rc = 0 except pywbem.CIMError, (rc, desc): if rc == exp_rc and desc.find(exp_desc) >= 0: @@ -70,7 +69,8 @@ def main(): logger.error(details)
if rc == 0: - logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of HostSystem input") + logger.error("HostedService associator should NOT return excepted result\ + with a wrong key name and value of HostSystem input") status = FAIL
return status
The above test case passes with false positive. The existing test case is intended to verify for exception when a wrong Name is passed as a parameter. _ For ex: without the sblim-base-provider the tc would be checking_ wbemcli ain -ac Xen_HostedService 'http://root:p@localhost:5988/root/virt:Xen_HostSystem. CreationClassName="Xen_HostSystem",Wrong="wrong"' * * wbemcli: Cim: (6) CIM_ERR_NOT_FOUND: No such instance (Name) *
_But with the sblim-base-provider installed the tc would be checking_
wbemcli ain -ac Xen_HostedService 'http://root:P@localhost:5988/root/virt:Xen_HostSystem. CreationClassName="Linux_ComputerSystem",Wrong="wrong"' * * wbemcli: Cim: (6) CIM_ERR_NOT_FOUND: No such instance (CreationClassName) *
though getting the exception for Linux_ComputerSystem in the second case
is valid for now, as the query with the Linux_CS does not work yet, but this is not the expected behavior of the test case.
The tc just verifies only "No such instance " string which is present in
both the exceptions and hence passes. 1) This test cannot be supported to work with sblim-base-provider installed yet. 2) We need to update the tc to verify the case where we pass Invalid CreationClassName. 3) We need to be verifying the complete exception instead of just verifying part of it.
Good catch - Deepti. I have update the tc to verify the complete exceptions for both HostedService03&04, also HostedService-03 to verify the case when we pass invalid CreationClassName. On HostedService-04, follow patch will to verify other invalid properties except invalid Name. Thanks!
Thanks and Regards, Deepti.
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (4)
-
Deepti B Kalakeri
-
Guo Lian Yun
-
Kaitlin Rupert
-
yunguol@cn.ibm.com