[PATCH] [TEST][Addition] Add cross-provider test case 06_hs_to_vsms.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207055270 -19800
# Node ID 74a458de2c6ed158c83f0bf7e3687fc36f46b284
# Parent 60f6b8f32c9d56b163377ec6447a6d21436021aa
[TEST][Addition] Add cross-provider test case 06_hs_to_vsms.py.
It traverses the following path:
{Hostsystem} --> [HostedService] {VirtualSystemMigrationService} -->
[ElementCapabilities] {VirtualSystemMigrationCapabilities} --> [SettingsDefineCapabilities] {VirtualSystemMigrationSettingData}
Verify the VirtualSystemMigrationSettingData.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 60f6b8f32c9d -r 74a458de2c6e suites/libvirt-cim/cimtest/HostSystem/06_hs_to_vsms.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/HostSystem/06_hs_to_vsms.py Tue Apr 01 18:37:50 2008 +0530
@@ -0,0 +1,208 @@
+#!/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 is a cross-provider testcase to
+# Get the MigrationSettingData properties starting from the host
+#
+# It traverses the following path:
+# {Hostsystem} --> [HostedService] {VirtualSystemMigrationService} -->
+# [ElementCapabilities] {VirtualSystemMigrationCapabilities} -->
+# [SettingsDefineCapabilities] {VirtualSystemMigrationSettingData}
+# Verify the VirtualSystemMigrationSettingData.
+#
+# Steps:
+# ------
+# 1) Get the hostname by enumerating the hostsystem.
+# 2) Get the various service on the host by using the HostedService association by supplying
+# the inputs obtained from querying the hostsystem.
+# 4) Select the VirtualSystemMigrationService from the association returned. We should get only
+# one record.
+# 5) Use the VirtualSystemMigrationService information to query ElementCapabilities association
+# Verify that we should get only one MigrationCapabilities record from the VSMS association.
+# 6) Obtain the VSMigrationSettingData values by using the MigrationCapabilities output from the
+# previous query and supplying it to the SettingsDefineCapabilities association.
+# 7) Check, that we obtain only one VSMigrationSettingData data.
+# Verify the VSMigrationSettingData values.
+# Date : 28.03.2008
+
+import sys
+from CimTest.Globals import do_main
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.assoc import Associators, AssociatorNames
+from XenKvmLib.common_util import get_host_info, check_len
+from CimTest.Globals import log_param, logger, CIM_ERROR_ASSOCIATORNAMES, \
+CIM_ERROR_ASSOCIATORS
+from CimTest.ReturnCodes import PASS, FAIL
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+def print_err(err, detail, cn):
+ logger.error(err % cn)
+ logger.error("Exception: %s", detail)
+
+def print_field_error(fieldname, ret_value, exp_value):
+ logger.error("%s Mismatch", fieldname)
+ logger.error("Returned %s instead of %s", ret_value, exp_value)
+
+
+def get_inst_from_list(server, cn, assoc_info, filter_name, exp_val):
+ status = PASS
+ ret = -1
+ inst = []
+ for rec in assoc_info:
+ record = rec[filter_name['key']]
+ if record == exp_val:
+ inst.append(rec)
+ ret = PASS
+
+ # When no records are found.
+ if ret != PASS:
+ logger.error("%s with %s was not returned" % (cn, exp_val))
+ status = FAIL
+
+ return status, inst
+
+def get_assocnames_info(server, cn, an, qcn, name):
+ status = PASS
+ assoc_info = []
+ try:
+ assoc_info = AssociatorNames(server, an, cn, virt, Name = name, CreationClassName = cn)
+ status = check_len(an, assoc_info, qcn, crit='lt', exp_len=3)
+ except Exception, detail:
+ print_err(CIM_ERROR_ASSOCIATORNAMES, detail, an)
+ status = FAIL
+
+ return status, assoc_info
+
+
+def get_vsms_info():
+ status, host_name, classname = get_host_info(server, virt)
+ if status != PASS:
+ return status, []
+ status, service_assoc_info = get_assocnames_info(server, classname,
+ assoc_name, req_cn, host_name)
+ if status != PASS or len(service_assoc_info) == 0:
+ return status, service_assoc_info
+ filter_name = {"key" : "Name"}
+ filter_value = 'MigrationService'
+ cn = 'VirtualSystemMigrationService'
+ status, vsms_list = get_inst_from_list(server, cn, service_assoc_info, filter_name,
+ filter_value)
+ return status, vsms_list
+
+def get_vsmcap_from_ec(vsms_list):
+ vsms_info = vsms_list[0]
+ cn = vsms_info['CreationClassName']
+ sn = vsms_info['SystemName']
+ name = vsms_info['Name']
+ sccn = vsms_info['SystemCreationClassName']
+ assoc_info = []
+ try:
+ assoc_info = AssociatorNames(server, assoc_name, cn, virt, CreationClassName = cn,
+ SystemName = sn, Name = name, SystemCreationClassName = sccn)
+ status = check_len(assoc_name, assoc_info, req_cn, crit='ne', exp_len=1)
+
+ except Exception, detail:
+ print_err(CIM_ERROR_ASSOCIATORNAMES, detail, assoc_name)
+ status = FAIL
+
+ return status, assoc_info
+
+def get_vsmsd_from_sdc(vsmsd_list):
+ vsmsd_info = vsmsd_list[0]
+ cn = vsmsd_info.classname
+ instid = vsmsd_info['InstanceID']
+ assoc_info = []
+ try:
+ assoc_info = Associators(server, assoc_name, cn, virt, CreationClassName = cn,
+ InstanceID = instid)
+ status = check_len(assoc_name, assoc_info, req_cn, crit='ne', exp_len=1)
+
+ except Exception, detail:
+ print_err(CIM_ERROR_ASSOCIATORS, detail, assoc_name)
+ status = FAIL
+
+ return status, assoc_info
+
+def verify_vsmsd_values(vsmsd_list):
+
+ # Values to be used for comparison
+ cn = get_typed_class(virt, "VirtualSystemMigrationSettingData")
+ instid = 'MigrationSettingData'
+ MType = 2 #[CIM_MIGRATE_LIVE]
+ priority = 0
+
+ verify_vsmsd = vsmsd_list[0]
+ if verify_vsmsd.classname != cn:
+ print_field_error('ClassName', verify_vsmsd.classname, cn)
+ return FAIL
+ if verify_vsmsd['InstanceID'] != instid:
+ print_field_error('InstanceID', verify_vsmsd['InstanceID'], instid)
+ return FAIL
+ if verify_vsmsd['MigrationType'] != MType:
+ print_field_error('MigrationType', verify_vsmsd['MigrationType'], MType)
+ return FAIL
+ if verify_vsmsd['Priority'] != priority:
+ print_field_error('Priority', verify_vsmsd['Priority'], priority)
+ return FAIL
+ return PASS
+
+
+@do_main(sup_types)
+def main():
+ global virt, server
+ global assoc_name, class_name, req_cn
+ options = main.options
+ log_param()
+ server = options.ip
+ status = PASS
+ virt = options.virt
+
+ assoc_name = get_typed_class(virt, 'HostedService')
+ req_cn = 'Service'
+ status, vsms_list = get_vsms_info()
+ if status != PASS or len(vsms_list) == 0:
+ logger.error("Did not get the expected MigrationService record")
+ return status
+ status = check_len(assoc_name, vsms_list, req_cn, crit='ne', exp_len=1)
+ if status != PASS:
+ return status
+
+ assoc_name = get_typed_class(virt, 'ElementCapabilities')
+ req_cn = 'MigrationCapabilities'
+ status, vsmscap = get_vsmcap_from_ec(vsms_list)
+ if status != PASS or len(vsmscap) == 0:
+ logger.error("Did not get the expected MigrationCapabilities record")
+ return status
+
+ assoc_name = get_typed_class(virt, 'SettingsDefineCapabilities')
+ req_cn = 'MigrationSettingData'
+ status, vsmsd = get_vsmsd_from_sdc(vsmscap)
+ if status != PASS or len(vsmsd) == 0:
+ logger.error("Did not get the expected MigrationSettingData record")
+ return status
+
+ status = verify_vsmsd_values(vsmsd)
+
+ return status
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months
[PATCH] [TEST][Addition] : Adding 03_refprofile_errs.py tc to verify ReferencedProfile
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207042809 -19800
# Node ID 60f6b8f32c9d56b163377ec6447a6d21436021aa
# Parent 78d46047fb435f32afc4f1b913a4c90f83866d4c
[TEST][Addition] : Adding 03_refprofile_errs.py tc to verify ReferencedProfile.
Signed-off-by: Deepti B. Kalakeri <deeptik linux vnet ibm com>
diff -r 78d46047fb43 -r 60f6b8f32c9d suites/libvirt-cim/cimtest/ReferencedProfile/03_refprofile_errs.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/03_refprofile_errs.py Tue Apr 01 15:10:09 2008 +0530
@@ -0,0 +1,148 @@
+#!/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
+#
+#
+# Test Case Info:
+# --------------
+# The following test case is used to verify the ReferencedProfile association supported
+# returns exceptions when invalid values are passed to it.
+#
+# 1) Test by passing Invalid InstanceID Key Name
+# Input:
+# ------
+# wbemcli ai -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.Wrong="CIM:DSP1042-SystemVirtualization-1.0.0"' -nl
+#
+# Output:
+# -------
+# error code : CIM_ERR_FAILED
+# error desc : "No InstanceID specified"
+#
+# 2) Test by giving invalid Invalid InstanceID Key Value
+# Input:
+# ------
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="Wrong"' -nl
+#
+# Output:
+# -------
+# error code : CIM_ERR_NOT_FOUND
+# error desc : "No such instance"
+#
+#
+# Date : 31-03-2008
+
+import sys
+import pywbem
+from XenKvmLib import enumclass
+from XenKvmLib import assoc
+from CimTest import Globals
+from CimTest.Globals import log_param, logger, CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORS
+from CimTest.Globals import do_main, CIM_USER, CIM_PASS
+from XenKvmLib.classes import get_typed_class
+from CimTest.ReturnCodes import FAIL, PASS
+from XenKvmLib.common_util import check_len
+from XenKvmLib.common_util import try_assoc
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+expr_values = {
+ 'INVALID_Instid_KeyName' : {
+ 'rc' : pywbem.CIM_ERR_FAILED,
+ 'desc' : "No InstanceID specified"
+ },
+ 'INVALID_Instid_KeyValue' : {
+ 'rc' : pywbem.CIM_ERR_NOT_FOUND,
+ 'desc' : "No such instance"
+ }
+ }
+
+
+def get_proflist():
+ proflist = []
+ status = PASS
+ try:
+ key_list = ["InstanceID"]
+ proflist = enumclass.enumerate(server, eval('enumclass.' + reg_classname), key_list, virt)
+ status = check_len(reg_classname, proflist, 'Profile', crit='lt', exp_len=5)
+ except Exception, detail:
+ logger.error(CIM_ERROR_ENUMERATE, reg_classname)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+ if status != PASS:
+ return status, proflist
+ profiles_instid_list = []
+ for profile in proflist:
+ profiles_instid_list.append(profile.InstanceID)
+ return status, profiles_instid_list
+
+
+def verify_prof_err(field, keys):
+ status = PASS
+ assoc_classname = get_typed_class(virt, 'ReferencedProfile')
+ try:
+ ret_value = try_assoc(conn, reg_classname, assoc_classname, keys, field_name=field, \
+ expr_values=expr_values[field], bug_no="")
+ if ret_value != PASS:
+ logger.error("------ FAILED: to verify %s.------", field)
+ status = ret_value
+ except Exception, detail:
+ logger.error(CIM_ERROR_ASSOCIATORS, assoc_classname)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+ return status
+
+
+@do_main(sup_types)
+def main():
+ log_param()
+ options = main.options
+ global virt, server, reg_classname, conn
+ virt = options.virt
+ server = options.ip
+ status = PASS
+ prev_namespace = Globals.CIM_NS
+ Globals.CIM_NS = 'root/interop'
+ reg_classname = get_typed_class(virt, 'RegisteredProfile')
+ status, proflist = get_proflist()
+ if status != PASS :
+ Globals.CIM_NS = prev_namespace
+ return status
+
+ conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), Globals.CIM_NS)
+
+ for prof in sorted(proflist):
+ field = 'INVALID_Instid_KeyName'
+ keys = { field : prof }
+ status = verify_prof_err(field, keys)
+ if status != PASS:
+ break
+
+ field = 'INVALID_Instid_KeyValue'
+ keys = { 'InstanceID' : field }
+ status = verify_prof_err(field, keys)
+ if status != PASS:
+ break
+
+ Globals.CIM_NS = prev_namespace
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months
[PATCH] [TEST][Addition] : Adding 02_reverse.py tc to verify ReferencedProfile
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207042694 -19800
# Node ID 78d46047fb435f32afc4f1b913a4c90f83866d4c
# Parent 560b0f60eaa938d4346d9019d9a71f8b35cd7dfa
[TEST][Addition] : Adding 02_reverse.py tc to verify ReferencedProfile.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 560b0f60eaa9 -r 78d46047fb43 suites/libvirt-cim/cimtest/ReferencedProfile/02_reverse.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/02_reverse.py Tue Apr 01 15:08:14 2008 +0530
@@ -0,0 +1,168 @@
+#!/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
+#
+# The following test case is used to verify the ReferencedProfile supported
+# by the VSM providers.
+#
+# Command:
+# -------
+#
+# wbemcli ai -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0"'
+#
+# Output:
+# -------
+# localhost:5988/root/interop:Xen_RegisteredProfile.InstanceID="CIM:DSP1057-VirtualSystem-1.0.0a"
+# -InstanceID="CIM:DSP1057-VirtualSystem-1.0.0a"
+# -RegisteredOrganization=2
+# -RegisteredName="Virtual System Profile"
+# -RegisteredVersion="1.0.0a"
+#
+# localhost:5988/root/interop:Xen_RegisteredProfile.
+# InstanceID="CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0"
+# .....
+# localhost:5988/root/interop:Xen_RegisteredProfile.
+# InstanceID="CIM:DSP1045-MemoryResourceVirtualization-1.0.0"
+# ......
+# localhost:5988/root/interop:Xen_RegisteredProfile.
+# InstanceID="CIM:DSP1081-VirtualSystemMigration-1.0"
+# ......
+# Date : 31-03-2008
+import sys
+from XenKvmLib.assoc import Associators
+from CimTest import Globals
+from CimTest.Globals import log_param, logger, CIM_ERROR_ASSOCIATORS
+from CimTest.Globals import do_main
+from XenKvmLib.classes import get_typed_class
+from CimTest.ReturnCodes import FAIL, PASS
+from XenKvmLib.common_util import check_len
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+
+def init_list():
+ vs_prof = {
+ "InstanceID" : "CIM:DSP1057-VirtualSystem-1.0.0a",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Virtual System Profile",
+ "RegisteredVersion" : "1.0.0a"
+ }
+ gen_dev_prof = {
+ "InstanceID" :
+ "CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Generic Device Resource Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ mem_res_prof = {
+ "InstanceID" : "CIM:DSP1045-MemoryResourceVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Memory Resource Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ vs_mig_prof = {
+ "InstanceID" : "CIM:DSP1081-VirtualSystemMigration-1.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "Virtual System Migration",
+ "RegisteredVersion" : "1.0"
+ }
+
+ return vs_prof, gen_dev_prof, mem_res_prof, vs_mig_prof
+
+def print_field_error(fieldname, ret_value, exp_value):
+ logger.error("%s Mismatch", fieldname)
+ logger.error("Returned '%s' instead of '%s'", ret_value, exp_value)
+
+
+def verify_fields(assoc_info, prof_info):
+ if assoc_info['InstanceID'] != prof_info['InstanceID']:
+ print_field_error('InstanceID', assoc_info['InstanceID'], prof_info['InstanceID'])
+ return FAIL
+ if assoc_info['RegisteredOrganization'] != prof_info['RegisteredOrganization']:
+ print_field_error('RegisteredOrganization', assoc_info['RegisteredOrganization'], \
+ prof_info['RegisteredOrganization'])
+ return FAIL
+ if assoc_info['RegisteredName'] != prof_info['RegisteredName']:
+ print_field_error('RegisteredName', assoc_info['RegisteredName'], \
+ prof_info['RegisteredName'])
+ return FAIL
+ if assoc_info['RegisteredVersion'] != prof_info['RegisteredVersion']:
+ print_field_error('RegisteredVersion', assoc_info['RegisteredVersion'], \
+ prof_info['RegisteredVersion'])
+ return FAIL
+ return PASS
+
+
+def verify_ref_assoc_info(assoc_info):
+ status = PASS
+ vs_prof, gen_dev_prof, mem_res_prof, vs_mig_prof = init_list()
+ for i in range(len(assoc_info)):
+ instid = assoc_info[i]['InstanceID']
+ if instid.find("DSP1045") >=0 :
+ status = verify_fields(assoc_info[i], mem_res_prof)
+ elif instid.find("DSP1057") >=0 :
+ status = verify_fields(assoc_info[i], vs_prof)
+ elif instid.find("DSP1059") >=0 :
+ status = verify_fields(assoc_info[i], gen_dev_prof)
+ elif instid.find("DSP1081") >=0 :
+ status = verify_fields(assoc_info[i], vs_mig_prof)
+ else:
+ status = FAIL
+ if status != PASS:
+ break
+ return status
+
+def get_refprof_verify_info():
+ assoc_info = []
+ assoc_name = get_typed_class(virt, 'ReferencedProfile')
+ instid = "CIM:DSP1042-SystemVirtualization-1.0.0"
+ try:
+ assoc_info = Associators(server, assoc_name, reg_classname, virt, InstanceID = instid,
+ CreationClassName = reg_classname)
+ status = check_len(assoc_name, assoc_info, 'Profile', crit='ne', exp_len=4)
+ if status != PASS:
+ return status
+ status = verify_ref_assoc_info(assoc_info)
+ except Exception, detail:
+ logger.error(CIM_ERROR_ASSOCIATORS, assoc_name)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+ return status
+
+@do_main(sup_types)
+def main():
+ log_param()
+ options = main.options
+ global virt, server, reg_classname
+ virt = options.virt
+ server = options.ip
+ status = PASS
+ prev_namespace = Globals.CIM_NS
+ Globals.CIM_NS = 'root/interop'
+
+ reg_classname = get_typed_class(virt, 'RegisteredProfile')
+ status = get_refprof_verify_info()
+
+ Globals.CIM_NS = prev_namespace
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months
[PATCH] [TEST][Addition] : Adding 01_forward.py tc to verify ReferencedProfile
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207042611 -19800
# Node ID 560b0f60eaa938d4346d9019d9a71f8b35cd7dfa
# Parent 9b12b065560215945ce8175fad6d34136069bd06
[TEST][Addition] : Adding 01_forward.py tc to verify ReferencedProfile.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 9b12b0655602 -r 560b0f60eaa9 suites/libvirt-cim/cimtest/ReferencedProfile/01_forward.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/01_forward.py Tue Apr 01 15:06:51 2008 +0530
@@ -0,0 +1,159 @@
+#!/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
+#
+# The following test case is used to verify the ReferencedProfile provider.
+#
+#Ex Command:
+#-----------
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1057-VirtualSystem-1.0.0a"'
+#
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1059-GenericDeviceResourceVirtualization-1.0.0"'
+#
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1045-MemoryResourceVirtualization-1.0.0"'
+#
+# wbemcli ain -ac Xen_ReferencedProfile 'http://localhost:5988/root/interop:
+# Xen_RegisteredProfile.InstanceID="CIM:DSP1081-VirtualSystemMigration-1.0"'
+#
+# Output:
+# -------
+# All the above examples have the following as result.
+#
+# localhost:5988/root/interop:Xen_RegisteredProfile.
+# InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0"
+# ......
+# InstanceID="CIM:DSP1042-SystemVirtualization-1.0.0"
+# RegisteredOrganization=2
+# RegisteredName="System Virtualization"
+# RegisteredVersion="1.0.0"
+# ....
+#
+# Date : 31-03-2008
+import sys
+from XenKvmLib import enumclass
+from XenKvmLib.assoc import Associators
+from CimTest import Globals
+from CimTest.Globals import log_param, logger, CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORS
+from CimTest.Globals import do_main
+from XenKvmLib.classes import get_typed_class
+from CimTest.ReturnCodes import FAIL, PASS
+from XenKvmLib.common_util import check_len
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+
+def init_list():
+ sys_prof_info = {
+ "InstanceID" : "CIM:DSP1042-SystemVirtualization-1.0.0",
+ "RegisteredOrganization" : 2,
+ "RegisteredName" : "System Virtualization",
+ "RegisteredVersion" : "1.0.0"
+ }
+ return sys_prof_info
+
+def print_field_error(fieldname, ret_value, exp_value):
+ logger.error("%s Mismatch", fieldname)
+ logger.error("Returned %s instead of %s", ret_value, exp_value)
+
+def get_proflist():
+ proflist = []
+ status = PASS
+ try:
+ key_list = ["InstanceID"]
+ proflist = enumclass.enumerate(server, eval('enumclass.' + reg_classname), key_list, virt)
+ status = check_len(reg_classname, proflist, 'Profile', crit='lt', exp_len=5)
+ except Exception, detail:
+ logger.error(CIM_ERROR_ENUMERATE, reg_classname)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+ if status != PASS:
+ return status, proflist
+ profiles_instid_list = []
+ for profile in proflist:
+ if not ("DSP1042" in profile.InstanceID):
+ profiles_instid_list.append(profile.InstanceID)
+ return status, profiles_instid_list
+
+def verify_ref_assoc_info(assoc_info, sys_prof_info):
+ if assoc_info['InstanceID'] != sys_prof_info['InstanceID']:
+ print_field_error('InstanceID', assoc_info['InstanceID'], sys_prof_info['InstanceID'])
+ return FAIL
+ if assoc_info['RegisteredOrganization'] != sys_prof_info['RegisteredOrganization']:
+ print_field_error('RegisteredOrganization', assoc_info['RegisteredOrganization'],
+ sys_prof_info['RegisteredOrganization'])
+ return FAIL
+ if assoc_info['RegisteredName'] != sys_prof_info['RegisteredName']:
+ print_field_error('RegisteredName', assoc_info['RegisteredName'],
+ sys_prof_info['RegisteredName'])
+ return FAIL
+ if assoc_info['RegisteredVersion'] != sys_prof_info['RegisteredVersion']:
+ print_field_error('RegisteredVersion', assoc_info['RegisteredVersion'],
+ sys_prof_info['RegisteredVersion'])
+ return FAIL
+ return PASS
+
+
+
+def get_refprof_verify_info(proflist):
+ assoc_info = []
+ assoc_name = get_typed_class(virt, 'ReferencedProfile')
+ sys_prof_info = init_list()
+ for instid in proflist:
+ try:
+ assoc_info = Associators(server, assoc_name, reg_classname, virt, InstanceID = instid,
+ CreationClassName = reg_classname)
+ status = check_len(assoc_name, assoc_info, 'SystemVirtualization', crit='ne', exp_len=1)
+ if status != PASS:
+ break
+ status = verify_ref_assoc_info(assoc_info[0], sys_prof_info)
+ if status != PASS:
+ break
+ except Exception, detail:
+ logger.error(CIM_ERROR_ASSOCIATORS, assoc_name)
+ logger.error("Exception: %s", detail)
+ status = FAIL
+ return status
+
+@do_main(sup_types)
+def main():
+ log_param()
+ options = main.options
+ global virt, server, reg_classname
+ virt = options.virt
+ server = options.ip
+ status = PASS
+ prev_namespace = Globals.CIM_NS
+ Globals.CIM_NS = 'root/interop'
+ reg_classname = get_typed_class(virt, 'RegisteredProfile')
+
+ status, proflist = get_proflist()
+ if status != PASS :
+ Globals.CIM_NS = prev_namespace
+ return status
+
+ status = get_refprof_verify_info(proflist)
+ Globals.CIM_NS = prev_namespace
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
16 years, 8 months
[PATCH] [TEST] ElementCapabilities.02 for XenFV and KVM support
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1207041438 25200
# Node ID e4dd979be474106453ad38fb4c22b508377dbbec
# Parent 5d47437104551b638aa75e2e525e49ec4b41e3ec
[TEST] ElementCapabilities.02 for XenFV and KVM support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 5d4743710455 -r e4dd979be474 suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py Mon Mar 31 07:54:19 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py Tue Apr 01 02:17:18 2008 -0700
@@ -26,24 +26,26 @@ from VirtLib import live
from VirtLib import live
from XenKvmLib import assoc
from XenKvmLib import hostsystem
-from XenKvmLib import vsms
+from XenKvmLib import vsms
+from XenKvmLib.classes import get_typed_class
from CimTest.Globals import log_param, logger, CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORNAMES
from CimTest.Globals import do_main
from CimTest.ReturnCodes import PASS, FAIL, SKIP
-sup_types = ['xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
-def call_assoc(ip, cn, id):
+def call_assoc(ip, cn, id, virt="Xen"):
status = PASS
ec_ele = []
try:
ec_ele = assoc.AssociatorNames(ip,
- "Xen_ElementCapabilities",
- cn,
+ "ElementCapabilities",
+ cn,
+ virt,
InstanceID = id)
except Exception:
logger.error(CIM_ERROR_ASSOCIATORNAMES,
- 'Xen_ElementCapabilities')
+ 'ElementCapabilities')
status = FAIL
return status, ec_ele
@@ -55,16 +57,17 @@ def filter(list, cn, exp_result):
return FAIL, new_list
return PASS, new_list
-def verify_host(inst_list, ip):
- status, list = filter(inst_list, 'Xen_HostSystem', 1)
+def verify_host(inst_list, ip, virt="Xen"):
+ hs = get_typed_class(virt, 'HostSystem')
+ status, list = filter(inst_list, hs, 1)
if status != PASS:
return status
inst = list[0]
try:
- host_sys = hostsystem.enumerate(ip)[0]
+ host_sys = hostsystem.enumerate(ip, virt)[0]
except Exception:
- logger.error(CIM_ERROR_ENUMERATE, 'Xen_HostSystem')
+ logger.error(CIM_ERROR_ENUMERATE, 'HostSystem')
return FAIL
creationclassname = inst.keybindings['CreationClassName']
@@ -79,17 +82,18 @@ def verify_host(inst_list, ip):
return PASS
-def verify_service(inst_list, ip):
- status, list = filter(inst_list, 'Xen_VirtualSystemManagementService', 1)
+def verify_service(inst_list, ip, virt):
+ service = get_typed_class(virt, "VirtualSystemManagementService")
+ status, list = filter(inst_list, service, 1)
if status != PASS:
return status
inst = list[0]
try:
- service = vsms.enumerate_instances(ip)[0]
+ service = vsms.enumerate_instances(ip, virt)[0]
except Exception:
logger.error(CIM_ERROR_ENUMERATE,
- 'Xen_VirtualSystemManagementService')
+ 'VirtualSystemManagementService')
return FAIL
creationclassname = inst.keybindings['CreationClassName']
@@ -109,28 +113,30 @@ def main():
options = main.options
log_param()
- cap_list = {"Xen_VirtualSystemManagementCapabilities" : "ManagementCapabilities",
- "Xen_VirtualSystemMigrationCapabilities" : "MigrationCapabilities"}
-
+ cap_list = {"VirtualSystemManagementCapabilities" : "ManagementCapabilities",
+ "VirtualSystemMigrationCapabilities" : "MigrationCapabilities"}
+ import pdb
+ #pdb.set_trace()
for k, v in cap_list.iteritems():
- status, ec_ele = call_assoc(options.ip, k, v)
+ status, ec_ele = call_assoc(options.ip, k, v, options.virt)
if status != PASS:
return
-
- status = verify_host(ec_ele, options.ip)
+
+ status = verify_host(ec_ele, options.ip, options.virt)
if status != PASS:
return status
if v == 'ManagementCapabilities':
- status = verify_service(ec_ele, options.ip)
+ status = verify_service(ec_ele, options.ip, options.virt)
if status != PASS:
return status
- cs = live.domain_list(options.ip)
+ cs = live.domain_list(options.ip, options.virt)
for system in cs:
status, elec_cs = call_assoc(options.ip,
- "Xen_EnabledLogicalElementCapabilities",
- system)
+ "EnabledLogicalElementCapabilities",
+ system,
+ options.virt)
if status != PASS:
return
@@ -138,9 +144,9 @@ def main():
logger.error("No ELEC instances returned")
return FAIL
- if elec_cs[0].keybindings['CreationClassName'] != "Xen_ComputerSystem":
+ if elec_cs[0].keybindings['CreationClassName'] != get_typed_class(options.virt, "ComputerSystem"):
logger.error("Excpeted CreationClassName %s, got %s" %
- ("Xen_ComputerSystem",
+ ("ComputerSystem",
elec_cs[0].keybindings['CreationClassName']))
return FAIL
elif elec_cs[0].keybindings['Name'] != system:
16 years, 8 months
[PATCH] [TEST] ResourcePoolConfigurationCapabilities.02 for XenFV and KVM support
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1207039131 25200
# Node ID 0ade340e36829a6cbaac60e9451cd02ccbd00816
# Parent 5d47437104551b638aa75e2e525e49ec4b41e3ec
[TEST] ResourcePoolConfigurationCapabilities.02 for XenFV and KVM support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 5d4743710455 -r 0ade340e3682 suites/libvirt-cim/cimtest/ResourcePoolConfigurationCapabilities/02_rpcc_gi_errs.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationCapabilities/02_rpcc_gi_errs.py Mon Mar 31 07:54:19 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationCapabilities/02_rpcc_gi_errs.py Tue Apr 01 01:38:51 2008 -0700
@@ -4,7 +4,7 @@
#
# Authors:
# Deepti B. Kalakeri<dkalaker(a)in.ibm.com>
-#
+# Guolian Yun <yunguol(a)cn.ibm.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
@@ -48,12 +48,13 @@ import sys
import sys
import pywbem
from XenKvmLib import assoc
+from XenKvmLib.classes import get_typed_class
from CimTest.Globals import log_param, logger, CIM_USER, CIM_PASS, CIM_NS
from CimTest.Globals import do_main
from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib.common_util import try_getinstance
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
expr_values = {
"invalid_instid" : { 'rc' : pywbem.CIM_ERR_NOT_FOUND, \
@@ -66,7 +67,7 @@ def main():
log_param()
status = PASS
conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS)
- classname = 'Xen_ResourcePoolConfigurationCapabilities'
+ classname = get_typed_class(options.virt, 'ResourcePoolConfigurationCapabilities')
field = 'INVALID_Instid_KeyName'
keys = { field : "RPCC" }
16 years, 8 months
[PATCH 0 of 2] cim_define in vxml
by zli@linux.vnet.ibm.com
cim_define added in class VirtCIM in vxml.
Also added a const module to move the default values in vxml to avoid
cyclic import between vxml and vsms.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
16 years, 8 months
[PATCH] [TEST][Fixing]: Fixing the enumerate_inst() of enumclass.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207033425 -19800
# Node ID 9b12b065560215945ce8175fad6d34136069bd06
# Parent b44edf769748143fc161a8efc980203533a9cac8
[TEST][Fixing]: Fixing the enumerate_inst() of enumclass.py.
Signed-off-by: Deepti B. Kalakeri<dkalaker(a)in.ibm.com>
diff -r b44edf769748 -r 9b12b0655602 suites/libvirt-cim/lib/XenKvmLib/enumclass.py
--- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Tue Apr 01 12:21:42 2008 +0530
+++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Tue Apr 01 12:33:45 2008 +0530
@@ -219,8 +219,7 @@ def enumerate_inst(server, classname, vi
classname = "%s" % classname
new_classname = classname.split('_')
if len(new_classname) == 2:
- classname = classname[1]
-
+ classname = new_classname[1]
classname = eval(get_typed_class(virt, classname))
instances = []
conn = pywbem.WBEMConnection('http://%s' % server,
@@ -243,7 +242,7 @@ def enumerate(server, basename, keys, vi
basename = new_base[1]
classname = eval(get_typed_class(virt, basename))
- instances = enumerate_inst(server, classname)
+ instances = enumerate_inst(server, classname, virt)
list = []
16 years, 8 months
[PATCH] [TEST][Fixing] Fixing the 03_rasd_errs.py, removed the extra log message
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207032702 -19800
# Node ID b44edf769748143fc161a8efc980203533a9cac8
# Parent 37958b18d9a91b23b833248f29e5edc6ab74144b
[TEST][Fixing] Fixing the 03_rasd_errs.py, removed the extra log message.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 37958b18d9a9 -r b44edf769748 suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py
--- a/suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py Tue Apr 01 12:14:30 2008 +0530
+++ b/suites/libvirt-cim/cimtest/RASD/03_rasd_errs.py Tue Apr 01 12:21:42 2008 +0530
@@ -111,7 +111,6 @@ def verify_rasd_err(field, keys, rasd_ty
if ret_value != PASS:
logger.error("------ FAILED: to verify %s.------", field)
status = ret_value
- logger.error(CIM_ERROR_GETINSTANCE, rasd_type['cn'])
except Exception, detail:
logger.error(CIM_ERROR_GETINSTANCE, rasd_type['cn'])
logger.error("Exception: %s", detail)
16 years, 8 months