# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1226705450 28800
# Node ID 59a6bdb3083be965c9959447b117efd57bd29e9d
# Parent aca519aaabf055d41e3b721bd5917d0086efccd5
[TEST] Update HostedDependency tests to expect an instance from get_host_info().
Also remove XFAILs as these tests should pass now.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r aca519aaabf0 -r 59a6bdb3083b
suites/libvirt-cim/cimtest/HostedDependency/01_forward.py
--- a/suites/libvirt-cim/cimtest/HostedDependency/01_forward.py Fri Nov 14 15:30:49 2008
-0800
+++ b/suites/libvirt-cim/cimtest/HostedDependency/01_forward.py Fri Nov 14 15:30:50 2008
-0800
@@ -78,11 +78,13 @@
status = FAIL
return status
- status, host_name, host_ccn = get_host_info(server, virt)
+ status, host_inst = get_host_info(server, virt)
if status != PASS:
cxml.undefine(server)
return status
+ host_ccn = host_inst.CreationClassName
+ host_name = host_inst.Name
cs_class = get_typed_class(options.virt, 'ComputerSystem')
try:
cs = enumclass.EnumInstances(server, cs_class)
diff -r aca519aaabf0 -r 59a6bdb3083b
suites/libvirt-cim/cimtest/HostedDependency/02_reverse.py
--- a/suites/libvirt-cim/cimtest/HostedDependency/02_reverse.py Fri Nov 14 15:30:49 2008
-0800
+++ b/suites/libvirt-cim/cimtest/HostedDependency/02_reverse.py Fri Nov 14 15:30:50 2008
-0800
@@ -48,7 +48,7 @@
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib.common_util import get_host_info, call_request_state_change
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
@@ -56,7 +56,6 @@
test_dom = "hd_domain"
test_mac = "00:11:22:33:44:55"
TIME = "00000000000000.000000:000"
-bug_sblim = "00007"
@do_main(sup_types)
def main():
@@ -83,11 +82,14 @@
return FAIL
try:
- status, host_name, host_ccn = get_host_info(server, virt)
+ status, host_inst = get_host_info(server, virt)
if status != PASS:
cxml.destroy(server)
cxml.undefine(server)
return status
+
+ host_ccn = host_inst.CreationClassName
+ host_name = host_inst.Name
cs_class = get_typed_class(options.virt, 'ComputerSystem')
cs = enumclass.EnumInstances(server, cs_class)
@@ -118,8 +120,6 @@
len(systems))
cxml.destroy(server)
cxml.undefine(server)
- return XFAIL_RC(bug_sblim)
-
ccn = cs[0].CreationClassName
for guest in systems:
diff -r aca519aaabf0 -r 59a6bdb3083b
suites/libvirt-cim/cimtest/HostedDependency/03_enabledstate.py
--- a/suites/libvirt-cim/cimtest/HostedDependency/03_enabledstate.py Fri Nov 14 15:30:49
2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedDependency/03_enabledstate.py Fri Nov 14 15:30:50
2008 -0800
@@ -44,14 +44,13 @@
CIM_ERROR_GETINSTANCE
from XenKvmLib.const import do_main
from XenKvmLib.devices import CIM_Instance
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV']
TIME = "00000000000000.000000:000"
test_dom = "hd_domain1"
test_mac = "00:11:22:33:44:55"
-bug_sblim = "00007"
def create_list(instance):
new_list = {
@@ -128,12 +127,15 @@
cxml.undefine(server)
return FAIL
- status, host_name, host_ccn = get_host_info(server, virt)
+ status, host_inst = get_host_info(server, virt)
if status != PASS:
logger.error("Failed to get host info")
cxml.destroy(server)
cxml.undefine(server)
return status
+
+ host_ccn = host_inst.CreationClassName
+ host_name = host_inst.Name
try:
@@ -157,7 +159,6 @@
logger.error("HostedDependency didn't return any instances.")
cxml.destroy(server)
cxml.undefine(server)
- return XFAIL_RC(bug_sblim)
hs_field_list = []
for hsi in hs:
diff -r aca519aaabf0 -r 59a6bdb3083b
suites/libvirt-cim/cimtest/HostedDependency/04_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/HostedDependency/04_reverse_errs.py Fri Nov 14 15:30:49
2008 -0800
+++ b/suites/libvirt-cim/cimtest/HostedDependency/04_reverse_errs.py Fri Nov 14 15:30:50
2008 -0800
@@ -29,6 +29,7 @@
# Date : 17-01-2008
import sys
+import pywbem
from VirtLib import utils
from XenKvmLib import assoc
from XenKvmLib import vxml
@@ -36,36 +37,40 @@
from XenKvmLib.const import do_main
from XenKvmLib.classes import get_typed_class
from XenKvmLib.common_util import get_host_info, try_assoc
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "hd_domain1"
test_mac = "00:11:22:33:44:55"
-bug_sblim='00007'
-exp_rc = 6 #CIM_ERR_NOT_FOUND
-exp_d1 = "No such instance (Name)"
-exp_d2 = "No such instance (CreationClassName)"
+def set_expr_values(host_ccn):
+ if (host_ccn == "Linux_ComputerSystem"):
+ exp_rc = pywbem.CIM_ERR_INVALID_PARAMETER
+ exp_d1 = "INVALID"
+ exp_d2 = "INVALID"
+ else:
+ exp_rc = pywbem.CIM_ERR_NOT_FOUND
+ exp_d1 = "No such instance (Name)"
+ exp_d2 = "No such instance (CreationClassName)"
-expr_values = {
- "INVALID_KeyName" : { 'rc' : exp_rc, 'desc'
: exp_d1 },
- "INVALID_NameValue" : { 'rc' : exp_rc, 'desc'
: exp_d1 },
- "INVALID_CCNKeyName" : { 'rc' : exp_rc, 'desc'
: exp_d2 },
- "INVALID_CCNameValue" : { 'rc' : exp_rc, 'desc'
: exp_d2 }
- }
+ expr_values = {
+ "INVALID_KeyName" : { 'rc' : exp_rc,
'desc' : exp_d1 },
+ "INVALID_NameValue" : { 'rc' : exp_rc,
'desc' : exp_d1 },
+ "INVALID_CCNKeyName" : { 'rc' : exp_rc,
'desc' : exp_d2 },
+ "INVALID_CCNameValue" : { 'rc' : exp_rc,
'desc' : exp_d2 }
+ }
+
+ return expr_values
def verify_err_fields(cxml, server, conn, keys, classname,
- assoc_classname, msg, field):
+ assoc_classname, msg, field, expr_values):
try:
ret = try_assoc(conn, classname, assoc_classname, keys,
field_name=field, expr_values=expr_values[field],
bug_no="")
if ret != PASS:
- if classname == 'Linux_ComputerSystem':
- return XFAIL_RC(bug_sblim)
- else:
- logger.error("--- FAILED: %s---", msg)
+ logger.error("--- FAILED: %s---", msg)
cxml.destroy(server)
except Exception, details:
logger.error("Exception: %s", details)
@@ -93,17 +98,22 @@
(CIM_USER, CIM_PASS), CIM_NS)
acn = get_typed_class(virt, 'HostedDependency')
- status, host_name, classname = get_host_info(server, virt)
+ status, host_inst = get_host_info(server, virt)
if status:
logger.error("Unable to get host info")
cxml.destroy(server)
return status
+ classname = host_inst.CreationClassName
+ host_name = host_inst.Name
+
+ expr_values = set_expr_values(classname)
+
msg = 'Invalid Name Key Name'
field = 'INVALID_KeyName'
keys = { 'CreationClassName' : classname, field : host_name }
ret_value = verify_err_fields(cxml, server, conn, keys, classname,
- acn, msg, field)
+ acn, msg, field, expr_values)
if ret_value != PASS:
return ret_value
@@ -111,7 +121,7 @@
field='INVALID_NameValue'
keys = { 'CreationClassName' : classname, 'Name' : field }
ret_value = verify_err_fields(cxml, server, conn, keys, classname,
- acn, msg, field)
+ acn, msg, field, expr_values)
if ret_value != PASS:
return ret_value
@@ -119,7 +129,7 @@
field='INVALID_CCNKeyName'
keys = { field : classname, 'Name' : host_name }
ret_value = verify_err_fields(cxml, server, conn, keys, classname,
- acn, msg, field)
+ acn, msg, field, expr_values)
if ret_value != PASS:
return ret_value
@@ -127,7 +137,7 @@
field='INVALID_CCNameValue'
keys = { 'CreationClassName' : field, 'Name' : host_name }
ret_value = verify_err_fields(cxml, server, conn, keys, classname,
- acn, msg, field)
+ acn, msg, field, expr_values)
cxml.destroy(server)
return ret_value
if __name__ == "__main__":