# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1222841815 25200
# Node ID 41c2dc5b6a669fa923a51c441de9604e1f8c5cf2
# Parent 0ecb3a22c3617eaa4298dfd9cd3b7b27b9846110
[TEST] Modifying assoc.py to accomodate Association parameter changes .
1) Made the Associators() and AssociatorNames() calls to accept the classname and
association classname.
This will allow us to support other SBLIM classnames (besides just
Linux_ComputerSystem), any changes to the association classname
and anything else we need to support in the future.
2) Removed the virt param.
Tested with Xen, XenFV, KVM on current sources and with/without sblim-base-provider
installed.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 0ecb3a22c361 -r 41c2dc5b6a66 suites/libvirt-cim/lib/XenKvmLib/assoc.py
--- a/suites/libvirt-cim/lib/XenKvmLib/assoc.py Fri Sep 26 02:44:52 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/assoc.py Tue Sep 30 23:16:55 2008 -0700
@@ -30,68 +30,44 @@ from CimTest.ReturnCodes import PASS, FA
from CimTest.ReturnCodes import PASS, FAIL
from CimTest.Globals import logger
-def AssociatorNames(host, basetype, baseobj, virt="Xen", **keys):
+def AssociatorNames(host, assoc_cn, classname, **keys):
'''Resolve the association specified by @type, given the
known @obj and @keys.
Return a list of CIMInstanceName objects, if an valid
@keys is provided, or CIMClassName objects, if no
@keys is provided, or None on failure'''
- #FIXME - Remove once all tests are converted for KVM
- basetype = "%s" % basetype
- type = basetype.split('_')
- if len(type) == 2:
- basetype = type[1]
-
- obj = baseobj.split('_')
- if len(type) == 2:
- baseobj = obj[1]
-
- type = get_typed_class(virt, basetype)
- obj = get_typed_class(virt, baseobj)
conn = myWBEMConnection('http://%s' % host,
(Globals.CIM_USER, Globals.CIM_PASS),
Globals.CIM_NS)
- instanceref = CIMInstanceName(obj, keybindings=keys)
+ instanceref = CIMInstanceName(classname, keybindings=keys)
names = []
try:
- names = conn.AssociatorNames(instanceref, AssocClass=type)
+ names = conn.AssociatorNames(instanceref, AssocClass=assoc_cn)
except pywbem.CIMError, arg:
print arg[1]
return names
return names
-def Associators(host, basetype, baseobj, virt="Xen", **keys):
+def Associators(host, assoc_cn, classname, **keys):
'''Resolve the association specified by @type, given the
known @obj and @keys.
Return a list of CIMInstanceName objects, if an valid
@keys is provided, or CIMClassName objects, if no
@keys is provided, or None on failure'''
- #FIXME - Remove once all tests are converted for KVM
- basetype = "%s" % basetype
- type = basetype.split('_')
- if len(type) == 2:
- basetype = type[1]
-
- obj = baseobj.split('_')
- if len(obj) == 2:
- baseobj = obj[1]
-
- type = get_typed_class(virt, basetype)
- obj = get_typed_class(virt, baseobj)
conn = myWBEMConnection('http://%s' % host,
(Globals.CIM_USER, Globals.CIM_PASS),
Globals.CIM_NS)
- instanceref = CIMInstanceName(obj, keybindings=keys)
+ instanceref = CIMInstanceName(classname, keybindings=keys)
names = []
try:
- names = conn.Associators(instanceref, AssocClass=type)
+ names = conn.Associators(instanceref, AssocClass=assoc_cn)
except pywbem.CIMError, arg:
print arg[1]