[Libvirt-cim] [PATCH] [TSST] add ElementConforms.04 for XenFV & KVM support

Guo Lian Yun yunguol at cn.ibm.com
Wed Apr 16 08:07:45 UTC 2008


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1208333259 -28800
# Node ID fd6c8eb84730b223387979a4255ec2c98b6d1de3
# Parent  dfa2a9c819bd026cc467fb3bced05211ee4f2ba9
[TSST] add ElementConforms.04 for XenFV & KVM support

Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>

diff -r dfa2a9c819bd -r fd6c8eb84730 suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py
--- a/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py	Tue Apr 15 15:00:01 2008 +0800
+++ b/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py	Wed Apr 16 16:07:39 2008 +0800
@@ -4,6 +4,7 @@
 #
 # Authors:
 #    Anoop V Chakkalakkal<anoop.vijayan at in.ibm.com>
+#    Guolian Yun <yunguol at cn.ibm.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public
@@ -82,14 +83,17 @@
 import pywbem
 from VirtLib import utils, live
 from XenKvmLib import assoc
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class 
 from XenKvmLib.common_util import try_assoc
+from XenKvmLib.test_doms import destroy_and_undefine_all
 from CimTest.ReturnCodes import PASS, FAIL
 from CimTest.Globals import log_param, logger, CIM_USER, CIM_PASS, CIM_NS, do_main
 
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
 
-ac_classname = 'Xen_ElementConformsToProfile'
 bug          = '92642'
+test_dom = "domU"
 
 cs_values = {
                 "INVALID_CCName_Keyname"  : { 'rc' : 6 , 'desc' : 'No such instance' }, \
@@ -105,7 +109,8 @@
                 "INVALID_Name_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]
@@ -113,7 +118,7 @@
     for j in range(len(name_val)/2):
         k = j * 2
         keys[name_val[k]] = name_val[k+1]
-    if classname == "Xen_HostSystem":
+    if classname == get_typed_class(virt, "HostSystem"):
         expr_values = hs_values
     else:
         expr_values = cs_values
@@ -134,16 +139,25 @@
 
     global conn
     conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS)
+    destroy_and_undefine_all(options.ip)
+    virt_xml = vxml.get_class(options.virt)
+    cxml = virt_xml(test_dom)
+    ret = cxml.define(options.ip)
+    if not ret:
+        logger.error('Unable to define domain %s' % test_dom)
+        return FAIL
 
+    hs = get_typed_class(options.virt, "HostSystem")
+    cs = get_typed_class(options.virt, "ComputerSystem")
     host_name = live.hostname(options.ip)
     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 =       [
@@ -154,12 +168,12 @@
                     ]
 
     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
 




More information about the Libvirt-cim mailing list