# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208857588 -19800
# Node ID dcfad1d986ec429fd63475ecd53382117e55ad72
# Parent 320328bb0f70196ea52e6c0e9e254c681cfb5d60
[TEST] Updating the 03_forward_errs.py tc in SettingsDefineCapabilities
1) To support KVM and XenFV
2) To adapt to the new infrastructure changes
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 320328bb0f70 -r dcfad1d986ec
suites/libvirt-cim/cimtest/SettingsDefineCapabilities/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/03_forward_errs.py Tue Apr 22
15:14:54 2008 +0530
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/03_forward_errs.py Tue Apr 22
15:16:28 2008 +0530
@@ -16,7 +16,7 @@
# 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
+# 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 tc is used to verify if appropriate exceptions are
@@ -28,26 +28,24 @@
import sys
import pywbem
-from VirtLib import utils
from CimTest.ReturnCodes import PASS
from XenKvmLib.common_util import try_assoc
from XenKvmLib import assoc
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
-from CimTest.Globals import do_main
-
-sup_types = ['Xen']
+from CimTest.Globals import do_main, platform_sup
+from XenKvmLib.classes import get_typed_class
expr_values = {
- "invalid_instid_keyname" : { 'rc' : pywbem.CIM_ERR_FAILED, \
- 'desc' : '"Missing InstanceID' },
\
- "invalid_instid_keyvalue" : { 'rc' : pywbem.CIM_ERR_FAILED, \
- 'desc' : 'Unable to determine resource
type' },
+ "invalid_instid_keyname" : { 'rc' : pywbem.CIM_ERR_FAILED,
+ 'desc' : 'CIM_ERR_FAILED: Missing
InstanceID'},
+ "invalid_instid_keyvalue" : { 'rc' : pywbem.CIM_ERR_FAILED,
+ 'desc' : 'CIM_ERR_FAILED: Unable to
determine\
+ resource type' },
"invalid_ccname_keyname" : { 'rc' :
pywbem.CIM_ERR_INVALID_PARAMETER,
- 'desc' : 'One or more parameter values
passed \
-to the method were invalid' }
+ 'desc' : 'CIM_ERR_INVALID_PARAMETER' }
}
-def err_invalid_instid_keyname(conn, field):
+def err_invalid_instid_keyname(virt, conn, field):
# Input:
# ------
# wbemcli ai -ac Xen_SettingsDefineCapabilities \
@@ -59,14 +57,14 @@ def err_invalid_instid_keyname(conn, fie
# error code : CIM_ERR_FAILED
# error desc : "Missing InstanceID"
#
- assoc_classname = 'Xen_SettingsDefineCapabilities'
- classname = 'Xen_AllocationCapabilities'
+ assoc_classname = get_typed_class(virt, "SettingsDefineCapabilities")
+ classname = get_typed_class(virt, "AllocationCapabilities")
keys = { field : 'MemoryPool/0' }
return try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
expr_values=expr_values['invalid_instid_keyname'],
bug_no="")
-def err_invalid_instid_keyvalue(conn, field):
+def err_invalid_instid_keyvalue(virt, conn, field):
# Input:
# ------
# wbemcli ai -ac Xen_SettingsDefineCapabilities \
@@ -78,14 +76,14 @@ def err_invalid_instid_keyvalue(conn, fi
# Verify for the error
# error code : CIM_ERR_FAILED
# error desc : "Unable to determine resource type"
- assoc_classname = 'Xen_SettingsDefineCapabilities'
- classname = 'Xen_AllocationCapabilities'
+ assoc_classname = get_typed_class(virt, "SettingsDefineCapabilities")
+ classname = get_typed_class(virt, "AllocationCapabilities")
keys = { 'InstanceID' : field }
return try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
expr_values=expr_values['invalid_instid_keyvalue'],
bug_no="")
-def err_invalid_ccname_keyname(conn, field):
+def err_invalid_ccname_keyname(virt, conn, field):
# Input:
# ------
# wbemcli ai -ac Xen_SettingsDefineCapabilities \
@@ -95,33 +93,34 @@ def err_invalid_ccname_keyname(conn, fie
# -------
# error code : CIM_ERR_INVALID_PARAMETER
# error desc : One or more parameter values passed to the method were invalid
- assoc_classname = 'Xen_SettingsDefineCapabilities'
+ assoc_classname = get_typed_class(virt, "SettingsDefineCapabilities")
classname = field
keys = { 'InstanceID' : 'MemoryPool/0' }
return try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
expr_values=expr_values['invalid_ccname_keyname'],
bug_no="")
-@do_main(sup_types)
+@do_main(platform_sup)
def main():
options = main.options
- status = PASS
+ virt = options.virt
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(CIM_USER, CIM_PASS), CIM_NS)
- ret_value = err_invalid_instid_keyname(conn, field='INVALID_InstID_KeyName')
+ ret_value = err_invalid_instid_keyname(virt, conn,
+ field='INVALID_InstID_KeyName')
if ret_value != PASS:
logger.error("------ FAILED: Invalid InstanceID Key Name.------")
- status = ret_value
- ret_value = err_invalid_instid_keyvalue(conn,
+ return ret_value
+ ret_value = err_invalid_instid_keyvalue(virt, conn,
field='INVALID_InstID_KeyValue')
if ret_value != PASS:
logger.error("------ FAILED: Invalid InstanceID Key Value.------")
- status = ret_value
- ret_value = err_invalid_ccname_keyname(conn, field='WrongClassName')
+ return ret_value
+ ret_value = err_invalid_ccname_keyname(virt, conn, field='WrongClassName')
if ret_value != PASS:
logger.error("------ FAILED: Invalid CCName Key Name.------")
- status = ret_value
- return status
+ return ret_value
+ return PASS
if __name__ == "__main__":
sys.exit(main())