
# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1223027430 25200 # Node ID f3b93c41440495aca1d37f6a135ebe0644a3a574 # Parent c005ad2d0cd20f21ea75ec35b0476a9ea98a36ce [TEST] Fixing and Updating HostedDependency and HostedService tc for Association parameter changes 1) Upated HostedDependency - 01_forward.py for Association parameter changes. 2) Fixed HostedService - 01_forward.py to include the ConsoleRedirectionService. Included get_host_info() to get the host information. Included check to verify if the service and the list used for the verification is the same. Updated it for Association parameter changes. 333) Fixed HostedService - 02_reverse.py log stmt Included get_host_info() to get the host information. Updated it for Association parameter changes. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r c005ad2d0cd2 -r f3b93c414404 suites/libvirt-cim/cimtest/HostedDependency/01_forward.py --- a/suites/libvirt-cim/cimtest/HostedDependency/01_forward.py Fri Oct 03 01:54:40 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedDependency/01_forward.py Fri Oct 03 02:50:30 2008 -0700 @@ -49,7 +49,7 @@ from XenKvmLib import vxml from XenKvmLib import vxml from XenKvmLib import assoc from XenKvmLib import enumclass -from XenKvmLib.classes import get_class_basename +from XenKvmLib.classes import get_typed_class from CimTest.Globals import CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORS, logger from XenKvmLib.const import do_main from CimTest.ReturnCodes import PASS, FAIL @@ -92,12 +92,12 @@ def main(): cxml.undefine(server) return FAIL - hs_cn = "HostedDependency" + hs_cn = get_typed_class(virt, "HostedDependency") try: for system in cs: - ccn = get_class_basename(system.CreationClassName) - hs = assoc.Associators(server, hs_cn, ccn, virt, - CreationClassName=system.CreationClassName, + ccn = system.CreationClassName + hs = assoc.Associators(server, hs_cn, ccn, + CreationClassName=ccn, Name=system.name) if not hs: diff -r c005ad2d0cd2 -r f3b93c414404 suites/libvirt-cim/cimtest/HostedService/01_forward.py --- a/suites/libvirt-cim/cimtest/HostedService/01_forward.py Fri Oct 03 01:54:40 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/01_forward.py Fri Oct 03 02:50:30 2008 -0700 @@ -30,40 +30,52 @@ from XenKvmLib.const import do_main from XenKvmLib.const import do_main from CimTest.Globals import logger from CimTest.ReturnCodes import PASS, FAIL, XFAIL +from XenKvmLib.common_util import get_host_info sup_types = ['Xen', 'XenFV', 'KVM', 'LXC'] @do_main(sup_types) def main(): options = main.options - keys = ['Name', 'CreationClassName'] + virt = options.virt try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.name) - return FAIL - try: + status, host_name, host_ccn = get_host_info(options.ip, virt) + if status != PASS: + logger.error("Failed to get host info.") + return status + + an = get_typed_class(virt, "HostedService") service = assoc.AssociatorNames(options.ip, - "HostedService", - "HostSystem", - options.virt, - CreationClassName = host_sys.CreationClassName, - Name = host_sys.Name) - except Exception: - logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % host_sys.Name) + an, host_ccn, + CreationClassName = host_ccn, + Name = host_name) + except Exception, deatils: + logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % host_name) + logger.error("Exception: details %s", details) return FAIL if service == None: logger.error("No association return") return FAIL - valid_services = [get_typed_class(options.virt, "ResourcePoolConfigurationService"), - get_typed_class(options.virt, "VirtualSystemManagementService"), - get_typed_class(options.virt, "VirtualSystemMigrationService")] + valid_services = [get_typed_class(virt, "ResourcePoolConfigurationService"), + get_typed_class(virt, "VirtualSystemManagementService"), + get_typed_class(virt, "VirtualSystemMigrationService"), + get_typed_class(virt, "ConsoleRedirectionService")] + + ccn_list = [] for item in service: - ccn = item.keybindings["CreationClassName"] + ccn_list.append(item.keybindings["CreationClassName"]) + + if len(ccn_list) != len(valid_services): + logger.error("'%s' returned %d, expected %d", + an, len(valid_services), len(ccn_list)) + return FAIL + + for ccn in ccn_list: if ccn not in valid_services: - logger.error("HostedService association to associate HostSystem and %s is wrong " % ccn) + logger.error("Invalid Value '%s' returned for association '%s'", + ccn, an) return FAIL diff -r c005ad2d0cd2 -r f3b93c414404 suites/libvirt-cim/cimtest/HostedService/02_reverse.py --- a/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Fri Oct 03 01:54:40 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Fri Oct 03 02:50:30 2008 -0700 @@ -30,47 +30,49 @@ from XenKvmLib.const import do_main from XenKvmLib.const import do_main from CimTest.Globals import logger from CimTest.ReturnCodes import PASS, FAIL, XFAIL +from XenKvmLib.common_util import get_host_info sup_types = ['Xen', 'XenFV', 'KVM', 'LXC'] @do_main(sup_types) 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) - return FAIL + virt = options.virt + servicelist = {"ResourcePoolConfigurationService" : "RPCS", "VirtualSystemManagementService" : "Management Service", "VirtualSystemMigrationService" : "MigrationService"} + + status, host_name, host_ccn = get_host_info(options.ip, virt) + if status != PASS: + logger.error("Failed to get host info.") + return status + an = get_typed_class(virt, "HostedService") for k, v in servicelist.iteritems(): + cn = get_typed_class(virt, k) try: - assoc_host = assoc.AssociatorNames(options.ip, - "HostedService", - k, - options.virt, + assoc_host = assoc.AssociatorNames(options.ip, an, cn, Name = v, - CreationClassName = get_typed_class(options.virt, k), - SystemCreationClassName = host_sys.CreationClassName, - SystemName = host_sys.Name) + CreationClassName = cn, + SystemCreationClassName = host_ccn, + SystemName = host_name) except Exception: - logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % item) + logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES, an) return FAIL if len(assoc_host) != 1: - logger.error("Too many hosts error") + logger.error("Too many hosts") return FAIL 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