def setup(self): # Empty self.xml.append(cim_xml.VALUE_REFARRAY([])) # VALUE.REFARRAY self.xml.append( cim_xml.VALUE_REFARRAY([ cim_xml.VALUE_REFERENCE(cim_xml.CLASSNAME('CIM_Foo')), cim_xml.VALUE_REFERENCE( cim_xml.LOCALCLASSPATH(LOCALNAMESPACEPATH(), CLASSNAME())) ]))
def setUp(self): super(ValueRefArray, self).setUp() # Empty self.xml.append(cim_xml.VALUE_REFARRAY([])) # VALUE.REFARRAY self.xml.append( cim_xml.VALUE_REFARRAY([ cim_xml.VALUE_REFERENCE(cim_xml.CLASSNAME('CIM_Foo')), cim_xml.VALUE_REFERENCE( cim_xml.LOCALCLASSPATH(LOCALNAMESPACEPATH(), CLASSNAME())) ]))
def setUp(self): super(ParamValue, self).setUp() # Empty self.xml.append(cim_xml.PARAMVALUE('Pet')) # VALUE self.xml.append( cim_xml.PARAMVALUE('Pet', cim_xml.VALUE('Dog'), 'string')) # VALUE.REFERENCE self.xml.append( cim_xml.PARAMVALUE( 'Pet', cim_xml.VALUE_REFERENCE( cim_xml.CLASSPATH(NAMESPACEPATH(), CLASSNAME())))) # VALUE.ARRAY self.xml.append(cim_xml.PARAMVALUE('Pet', cim_xml.VALUE_ARRAY([]))) # VALUE.REFARRAY self.xml.append(cim_xml.PARAMVALUE('Pet', cim_xml.VALUE_REFARRAY([])))
def paramvalue(obj): """Return a cim_xml node to be used as the value for a parameter.""" if isinstance(obj, (datetime, timedelta)): obj = CIMDateTime(obj) if isinstance(obj, (cim_types.CIMType, bool, StringTypes)): return cim_xml.VALUE(cim_types.atomic_to_cim_xml(obj)) if isinstance(obj, (CIMClassName, CIMInstanceName)): return cim_xml.VALUE_REFERENCE(obj.tocimxml()) if isinstance(obj, (CIMClass, CIMInstance)): return cim_xml.VALUE(obj.tocimxml().toxml()) if isinstance(obj, list): if isinstance(obj[0], (CIMClassName, CIMInstanceName)): return cim_xml.VALUE_REFARRAY([paramvalue(x) for x in obj]) return cim_xml.VALUE_ARRAY([paramvalue(x) for x in obj]) raise TypeError('Unsupported parameter type "%s"' % type(obj))