# 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())