[PATCH] [TEST] Adding 02_refprofile_errs.py to verify the exception returned for ReferencedProfile when invalid values are passed
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207226220 -19800
# Node ID 3129aaf0add9f197c05d19064668d02f5aea5d07
# Parent f26165d0a996d3358d894b8c00efc0bd4fe625a4
[TEST] Adding 02_refprofile_errs.py to verify the exception returned for ReferencedProfile when invalid values are passed.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r f26165d0a996 -r 3129aaf0add9 suites/libvirt-cim/cimtest/ReferencedProfile/02_refprofile_errs.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/02_refprofile_errs.py Thu Apr 03 18:07:00 2008 +0530
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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 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, reg_classname, key_list, virt)
+ if len(proflist) < 5 :
+ logger.error("%s returned %i %s objects, expected atleast 5",
+ reg_classname, len(proflist), 'Profile')
+ status = FAIL
+
+ 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 = [ profile.InstanceID for profile in proflist ]
+
+ 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, 7 months
[PATCH] [TEST] Adding 01_verify_refprof.py tc to verify the ReferencedProfile
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207226095 -19800
# Node ID f26165d0a996d3358d894b8c00efc0bd4fe625a4
# Parent 4ae171df56c92ff442bbd098102779140f3c7ff1
[TEST] Adding 01_verify_refprof.py tc to verify the ReferencedProfile.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 4ae171df56c9 -r f26165d0a996 suites/libvirt-cim/cimtest/ReferencedProfile/01_verify_refprof.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/01_verify_refprof.py Thu Apr 03 18:04:55 2008 +0530
@@ -0,0 +1,183 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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"'
+#
+# All the above give the following 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"
+# ....
+#
+# 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 import enumclass
+from XenKvmLib.assoc import Associators
+from XenKvmLib.common_util import profile_init_list
+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
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+
+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, reg_classname, key_list, virt)
+ if len(proflist) < 5:
+ logger.error("%s returned %i %s objects, expected atleast 5",
+ reg_classname, len(proflist), 'Profile')
+ status = FAIL
+
+ 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 = [ profile.InstanceID for profile in proflist ]
+
+ return status, profiles_instid_list
+
+def verify_fields(assoc_info, sys_prof_info):
+ fieldnames = ["InstanceID", "RegisteredOrganization", "RegisteredName", "RegisteredVersion"]
+ for f in fieldnames:
+ if assoc_info[f] != sys_prof_info[f]:
+ print_field_error(f, assoc_info[f], sys_prof_info[f])
+ return FAIL
+ return PASS
+
+def verify_ref_assoc_info(assoc_info, profilename):
+ status = PASS
+ profiles = profile_init_list()
+ logger.info("Verifying profile: %s", profilename)
+ for inst in assoc_info:
+ for profnum, profinfo in profiles.items():
+ if profnum in inst['InstanceID']:
+ status = verify_fields(inst, profinfo)
+ if status != PASS:
+ break
+ if status != PASS:
+ break
+ return status
+
+
+def get_refprof_verify_info(proflist):
+ assoc_info = []
+ status = PASS
+ assoc_name = get_typed_class(virt, 'ReferencedProfile')
+ for instid in proflist:
+ try:
+ assoc_info = Associators(server, assoc_name, reg_classname, virt, InstanceID = instid,
+ CreationClassName = reg_classname)
+ if len(assoc_info) < 1:
+ logger.error("%s returned %i %s objects, expected atleast 1",
+ assoc_name, len(assoc_info), 'Profiles')
+ status = FAIL
+ if status != PASS:
+ break
+
+ status = verify_ref_assoc_info(assoc_info, instid)
+ 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, 7 months
[TEST] CIMTest Failing Test Case Report (20080402)
by Guo Lian Yun
stro: Fedora8
Kernel: kernel-2.6.23.1-42.fc8
Xen: xen-3.1.2-2.fc9
Libvirt: libvirt-0.4.0-4.fc8
CIMOM: sblim-sfcb-1.2.5-0
PyWBEM: pywbem-0.6-1
LibCMPIutil: 72
LibVirtCIM: 528
CIM Schema: cimv216Experimental
CIMTEST: 38
=============CIMTEST FAILING REPORT==================
ElementConforms
04_ectp_rev_errs.py FAIL
HostSystem
03_hs_to_settdefcap.py FAIL
Profile
01_enum.py FAIL
RASD
RASD - 01_verify_rasd_fields.py: FAIL
RASD - 02_enum.py: FAIL
SettingsDefineCapabilities
04_forward_vsmsdata.py FAIL
VirtualSystemManagementService
05_destroysystem_neg.py FAIL
06_addresource.py FAIL
VirtualSystemMigrationService
01_migratable_host.py FAIL
02_host_migrate_type.py FAIL
VirtualSystemMigrationSettingData
01_enum.py FAIL
02_vsmsd_gi_errs.py FAIL
VirtualSystemSettingDataComponent
01_forward.py FAIL
VirtualSystemSnapshotService
01_enum.py FAIL
02_vs_sservice_gi_errs.py FAIL
VirtualSystemSnapshotServiceCapabilities
01_enum.py FAIL
02_vs_sservicecap_gi_errs.py FAIL
=====================================================
Total: 17
Best,
Regards
Daisy Guo Lian Yun
E-mail: yunguol(a)cn.ibm.com
IBM China Development Lab, Shanghai, China
TEL: (86)-21-61008057
16 years, 7 months
[PATCH] [TEST].2# Fixing the 01_verify_rasd_fields.py tc
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207208862 -19800
# Node ID cbadbbee26c59304d6ef6a46e94eeb9b5dbed26b
# Parent bf376e97b3ea01ee72ce429ca5ecacb709aa6dae
[TEST].2# Fixing the 01_verify_rasd_fields.py tc.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r bf376e97b3ea -r cbadbbee26c5 suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py
--- a/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py Wed Apr 02 00:52:23 2008 -0700
+++ b/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py Thu Apr 03 13:17:42 2008 +0530
@@ -86,7 +86,7 @@ def init_list(virt="Xen"):
"CreationClassName": get_typed_class(virt, 'NetResourceAllocationSettingData')
}
- address = eval("%s.%s" % (get_class(virt), 'disk_path'))
+ address = vsxml.xml_get_disk_source()
diskrasd = {
"InstanceID" : '%s/%s' %(test_dom, test_disk), \
"ResourceType" : 17, \
@@ -133,6 +133,7 @@ def assoc_values(ip, assoc_info, virt="X
@do_main(sup_types)
def main():
+ global vsxml
options = main.options
status = 0
rc = 1
@@ -171,7 +172,7 @@ def main():
status = assoc_values(options.ip, assoc_info, options.virt)
except Exception, details:
logger.error(Globals.CIM_ERROR_ASSOCIATORS, \
- get_typed_class('VirtualSystemSettingDataComponent', options.virt))
+ get_typed_class(options.virt, 'VirtualSystemSettingDataComponent'))
logger.error("Exception : %s" % details)
status = 1
16 years, 7 months
[PATCH] [TEST] Fixing 02_enum.py tc of RASD
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207207471 -19800
# Node ID 5171b45a180b122994d098a70d164cda8c302c4a
# Parent a6d6b7807c9a4b3f76b310d049f61e2c67712bfc
[TEST] Fixing 02_enum.py tc of RASD.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r a6d6b7807c9a -r 5171b45a180b suites/libvirt-cim/cimtest/RASD/02_enum.py
--- a/suites/libvirt-cim/cimtest/RASD/02_enum.py Thu Apr 03 12:44:46 2008 +0530
+++ b/suites/libvirt-cim/cimtest/RASD/02_enum.py Thu Apr 03 12:54:31 2008 +0530
@@ -63,7 +63,7 @@ def init_list(virt="Xen"):
"ntype2": "ethernet", \
"CreationClassName": get_typed_class(virt, 'NetResourceAllocationSettingData')
}
- address = eval("%s.%s" % (get_class(virt), 'disk_path'))
+ address = vsxml.xml_get_disk_source()
diskrasd = {
"InstanceID" : '%s/%s' %(test_dom, test_disk), \
"ResourceType" : 17, \
16 years, 7 months
[PATCH] [TEST]Fixing the 01_verify_rasd_fields.py tc
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1207206886 -19800
# Node ID a6d6b7807c9a4b3f76b310d049f61e2c67712bfc
# Parent 104b65ee0d5f0bb2af8e140b6b1e194d75bab44f
[TEST]Fixing the 01_verify_rasd_fields.py tc.
diff -r 104b65ee0d5f -r a6d6b7807c9a suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py
--- a/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py Thu Apr 03 11:56:56 2008 +0530
+++ b/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py Thu Apr 03 12:44:46 2008 +0530
@@ -86,7 +86,7 @@ def init_list(virt="Xen"):
"CreationClassName": get_typed_class(virt, 'NetResourceAllocationSettingData')
}
- address = eval("%s.%s" % (get_class(virt), 'disk_path'))
+ address = vsxml.xml_get_disk_source()
diskrasd = {
"InstanceID" : '%s/%s' %(test_dom, test_disk), \
"ResourceType" : 17, \
@@ -133,6 +133,7 @@ def assoc_values(ip, assoc_info, virt="X
@do_main(sup_types)
def main():
+ global vsxml
options = main.options
status = 0
rc = 1
@@ -171,7 +172,7 @@ def main():
status = assoc_values(options.ip, assoc_info, options.virt)
except Exception, details:
logger.error(Globals.CIM_ERROR_ASSOCIATORS, \
- get_typed_class('VirtualSystemSettingDataComponent', options.virt))
+ get_typed_class(options.virt, 'VirtualSystemSettingDataComponent'))
logger.error("Exception : %s" % details)
status = 1
16 years, 7 months
[PATCH] [TEST] Add UUID workaround for python-2.4-based systems (i.e. RHEL5.x)
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1206986066 25200
# Node ID ace377826c9c8f3b034f5c696ffb71dfb163d77b
# Parent 5d47437104551b638aa75e2e525e49ec4b41e3ec
[TEST] Add UUID workaround for python-2.4-based systems (i.e. RHEL5.x)
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 5d4743710455 -r ace377826c9c suites/libvirt-cim/lib/XenKvmLib/test_doms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Mar 31 07:54:19 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Mar 31 10:54:26 2008 -0700
@@ -22,11 +22,23 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import tempfile
-import uuid
import os
from VirtLib import utils
from VirtLib import live
from CimTest.Globals import CIM_FUUID
+
+try:
+ import uuid as _uuid
+ def uuid():
+ return str(_uuid.uuid1())
+except ImportError:
+ def uuid():
+ from commands import getstatusoutput as run
+ s, o = run('uuidgen')
+ if s == 0:
+ return o
+ else:
+ raise ImportError("Missing uuid library (and can't fake it)")
def define_test_domain(xml, server, virt="Xen"):
name = tempfile.mktemp()
@@ -74,7 +86,7 @@ def set_uuid(myuuid=0):
"""Generate a random uuid and record it into CIM_FUUID"""
if myuuid == 0:
- myuuid = uuid.uuid1().urn[9:]
+ myuuid = uuid()
f = file(CIM_FUUID, 'a')
f.write('%s\n' % myuuid)
16 years, 7 months
[PATCH] [TEST] ElementConforms.04 for XenFV and KVM support
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1207120345 25200
# Node ID 79575db14685b6b53ee3a9df1e9a8137a6b6e503
# Parent 2a4a86706ee4bdb3cf3d0c20d38718e9fb6bc74f
[TEST] ElementConforms.04 for XenFV and KVM support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 2a4a86706ee4 -r 79575db14685 suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py
--- a/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py Tue Apr 01 19:06:53 2008 +0530
+++ b/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py Wed Apr 02 00:12:25 2008 -0700
@@ -4,6 +4,7 @@
#
# Authors:
# Anoop V Chakkalakkal<anoop.vijayan(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
@@ -83,29 +84,30 @@ from VirtLib import utils, live
from VirtLib import utils, live
from XenKvmLib import assoc
from XenKvmLib.common_util import try_assoc
+from XenKvmLib.classes import get_typed_class
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.vxml import XenXML, KVMXML, get_class
from CimTest.Globals import log_param, logger, CIM_USER, CIM_PASS, CIM_NS, do_main
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
+test_dom = "domU"
-ac_classname = 'Xen_ElementConformsToProfile'
-bug = '92642'
+bug = '92642'
expr_values = {
- "INVALID_CCName_Keyname" : { 'rc' : '' , 'desc' : '' }, \
- "INVALID_CCName_Keyvalue" : { 'rc' : '' , 'desc' : '' }, \
- "INVALID_Name_Keyname" : { 'rc' : '' , 'desc' : '' }, \
- "INVALID_Name_Keyvalue" : { 'rc' : '' , 'desc' : '' }
+ "INVALID_CCName_Keyname" : { 'rc' : 6 , 'desc' : 'No such instance' }, \
+ "INVALID_CCName_Keyvalue" : { 'rc' : 6 , 'desc' : 'No such instance' }, \
}
-def try_invalid_assoc(classname, name_val, i, field):
+def try_invalid_assoc(classname, name_val, i, field, virt="Xen"):
+ ac_classname = get_typed_class(virt, "ElementConformsToProfile")
j = 0
keys = {}
temp = name_val[i]
name_val[i] = field
for j in range(len(name_val)/2):
k = j * 2
- keys[name_val[k]] = name_val[k+1]
+ keys[name_val[k]] = name_val[k+1]
ret_val = try_assoc(conn, classname, ac_classname, keys, field_name=field, \
expr_values=expr_values[field], bug_no=bug)
if ret_val != PASS:
@@ -120,38 +122,46 @@ def main():
log_param()
status = PASS
+
+ virt_xml = get_class(options.virt)
+ cxml = virt_xml(test_dom)
+ ret = cxml.define(options.ip)
+ if not ret:
+ logger.error("ERROR: Failed to Create the dom: %s" % test_dom)
+ return status
global conn
conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS)
host_name = live.hostname(options.ip)
+ hs = get_typed_class(options.virt ,'HostSystem')
+ cs = get_typed_class(options.virt, 'ComputerSystem')
host_name_val = [
- 'CreationClassName', 'Xen_HostSystem', \
+ 'CreationClassName', hs, \
'Name', host_name
]
comp_name_val = [
- 'CreationClassName', 'Xen_ComputerSystem', \
- 'Name', 'Domain-0'
+ 'CreationClassName', cs, \
+ 'Name', test_dom
]
tc_scen = [
'INVALID_CCName_Keyname', \
'INVALID_CCName_Keyvalue', \
- 'INVALID_Name_Keyname', \
- 'INVALID_Name_Keyvalue'
]
for i in range(len(tc_scen)):
- retval = try_invalid_assoc('Xen_HostSystem', host_name_val, i, tc_scen[i])
+ retval = try_invalid_assoc(hs, host_name_val, i, tc_scen[i], options.virt)
if retval != PASS:
status = retval
for i in range(len(tc_scen)):
- retval = try_invalid_assoc('Xen_ComputerSystem', comp_name_val, i, tc_scen[i])
+ retval = try_invalid_assoc(cs, comp_name_val, i, tc_scen[i], options.virt)
if retval != PASS:
status = retval
+ cxml.undefine(options.ip)
return status
if __name__ == "__main__":
sys.exit(main())
16 years, 7 months
[PATCH] [TEST][Resubmitting: 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 1207119213 -19800
# Node ID 3ef227041d3ddb305dc9568b838ae47644988389
# Parent 421fe4997e8b298bdbb74280743e60e51226d16d
[TEST][Resubmitting: Addition] Add cross-provider test case 06_hs_to_vsms.py.
1) Removed the check_len() function and included the logic to check the len of assoc, list in the same file.
2) 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 421fe4997e8b -r 3ef227041d3d 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 Wed Apr 02 12:23:33 2008 +0530
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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
+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)
+ if len(assoc_info) < 3 :
+ logger.error("%s returned %i %s objects, expected atleast 3", an, len(assoc_info), qcn)
+ status = FAIL
+ 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):
+ status = PASS
+ 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)
+ if len(assoc_info) != 1:
+ logger.error("%s returned %i %s objects, expected only 1", assoc_name, len(assoc_info), req_cn)
+ status = FAIL
+
+ except Exception, detail:
+ print_err(CIM_ERROR_ASSOCIATORNAMES, detail, assoc_name)
+ status = FAIL
+
+ return status, assoc_info
+
+def get_vsmsd_from_sdc(vsmsd_list):
+ status = PASS
+ 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)
+ if len(assoc_info) != 1:
+ logger.error("%s returned %i %s objects, expected only 1", assoc_name, len(assoc_info), req_cn)
+ status = FAIL
+
+ 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
+ if len(vsms_list) != 1:
+ logger.error("%s returned %i %s objects, expected only 1", assoc_name, len(vsms_list), req_cn)
+ return FAIL
+
+ 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, 7 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 1207118004 -19800
# Node ID 421fe4997e8b298bdbb74280743e60e51226d16d
# Parent f3e2ef4edbb4ec299aaba8a9a6307e5b777a8712
[TEST][Addition] : Adding 03_refprofile_errs.py tc to verify ReferencedProfile.
Removed the check_len() function and included the logic to check the len of assoc, list in the same file.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r f3e2ef4edbb4 -r 421fe4997e8b 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 Wed Apr 02 12:03:24 2008 +0530
@@ -0,0 +1,154 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.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 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)
+ if len(proflist) < 5 :
+ logger.error("%s returned %i %s objects, expected atleast 5",
+ reg_classname, len(proflist), 'Profile')
+ status = FAIL
+
+ 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, 7 months