You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(26) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(5) |
Feb
(16) |
Mar
(5) |
Apr
(5) |
May
(13) |
Jun
(12) |
Jul
(1) |
Aug
(2) |
Sep
(13) |
Oct
(6) |
Nov
(1) |
Dec
(29) |
2008 |
Jan
(2) |
Feb
(2) |
Mar
(2) |
Apr
(57) |
May
(35) |
Jun
(45) |
Jul
(132) |
Aug
(87) |
Sep
(141) |
Oct
(86) |
Nov
(17) |
Dec
(2) |
2009 |
Jan
(3) |
Feb
(2) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ba...@us...> - 2008-04-09 19:48:44
|
Revision: 557 http://omc.svn.sourceforge.net/omc/?rev=557&view=rev Author: bartw Date: 2008-04-09 12:48:11 -0700 (Wed, 09 Apr 2008) Log Message: ----------- removed hostnamesettingdata Modified Paths: -------------- pybase/trunk/OMC_UnitaryComputerSystem.mof pybase/trunk/OMC_UnitaryComputerSystem.py Modified: pybase/trunk/OMC_UnitaryComputerSystem.mof =================================================================== --- pybase/trunk/OMC_UnitaryComputerSystem.mof 2008-04-09 19:30:53 UTC (rev 556) +++ pybase/trunk/OMC_UnitaryComputerSystem.mof 2008-04-09 19:48:11 UTC (rev 557) @@ -7,27 +7,3 @@ { }; -////////////////////////////////////////////////////////////////////////////// -[ Description("OMC Host Name Setting Data"), Version("0.0.1") ] -class OMC_HostNameSettingData : CIM_SettingData -{ - [Description ("The name of this computer"), - Required ] - string ComputerName; -}; - -////////////////////////////////////////////////////////////////////////////// -[ Association, Version ( "0.0.1" ), - Description ("OMC_ComputerSystemSettingData is associates " - " the computer name setting with the computer system")] -class OMC_ComputerSystemHostNameSettingData : CIM_ElementSettingData -{ - [ Override("ManagedElement"), Key, - Description ("The computer system.")] - OMC_UnitaryComputerSystem REF ManagedElement; - - [ Override("SettingData"), Key, - Description ("The computer name setting the computer.")] - OMC_HostNameSettingData REF SettingData; -}; - Modified: pybase/trunk/OMC_UnitaryComputerSystem.py =================================================================== --- pybase/trunk/OMC_UnitaryComputerSystem.py 2008-04-09 19:30:53 UTC (rev 556) +++ pybase/trunk/OMC_UnitaryComputerSystem.py 2008-04-09 19:48:11 UTC (rev 557) @@ -536,200 +536,11 @@ ## end of class OMC_UnitaryComputerSystemProvider -class OMC_HostNameSettingDataProvider(pywbem.CIMProvider): - """Instrument the CIM class OMC_HostNameSettingData""" - def __init__ (self, env): - logger = env.get_logger() - logger.log_debug('Initializing provider %s from %s' \ - % (self.__class__.__name__, __file__)) - # If you will be filtering instances yourself according to - # property_list, role, result_role, and result_class_name - # parameters, set self.filter_results to False - # self.filter_results = False - def get_instance(self, env, model, cim_class): - logger = env.get_logger() - logger.log_debug('Entering %s.get_instance()' \ - % self.__class__.__name__) - try: - iid = model['InstanceID'] - except KeyError: - raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) - if iid.lower() != 'omc:computername': - raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) - model['ComputerName'] = getfqdn() - return model - - def enum_instances(self, env, model, cim_class, keys_only): - logger = env.get_logger() - logger.log_debug('Entering %s.enum_instances()' \ - % self.__class__.__name__) - model['InstanceID'] = 'omc:computername' - if not keys_only: - model['ComputerName'] = getfqdn() - yield model - - def set_instance(self, env, instance, previous_instance, cim_class): - logger = env.get_logger() - logger.log_debug('Entering %s.set_instance()' \ - % self.__class__.__name__) - if not previous_instance: - ci = instance - else: - for k,v in instance.properties.items(): - previous_instance[k] = v - ci = previous_instance - try: - iid = ci['InstanceID'] - except KeyError: - raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) - if iid.lower() != 'omc:computername': - raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) - - # TODO: Modify computer name - # Modify /etc/hosts - # Modify /etc/HOSTNAME - # Excecute /bin/hostname .... - raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement - return instance - - def delete_instance(self, env, instance_name): - raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) - -## end of class OMC_HostNameSettingDataProvider - - -class OMC_ComputerSystemHostNameSettingDataProvider(pywbem.CIMProvider): - """Instrument the CIM class OMC_ComputerSystemHostNameSettingData - - OMC_ComputerSystemSettingData is associates the computer name setting - with the computer system - - """ - def get_hnsd_path(self, ns): - hnsd = pywbem.CIMInstanceName(classname = 'OMC_HostNameSettingData', \ - namespace=ns, \ - keybindings={'InstanceID':'omc:computername'}) - return hnsd - - def get_cs_path(self, ns): - cs_path = pywbem.CIMInstanceName(classname='OMC_UnitaryComputerSystem', \ - namespace=ns, \ - keybindings={'CreationClassName':'OMC_UnitaryComputerSystem', \ - 'Name': getfqdn() }) - return cs_path - - def __init__ (self, env): - logger = env.get_logger() - logger.log_debug('Initializing provider %s from %s' \ - % (self.__class__.__name__, __file__)) - # If you will be filtering instances yourself according to - # property_list, role, result_role, and result_class_name - # parameters, set self.filter_results to False - # self.filter_results = False - - def get_instance(self, env, model, cim_class): - logger = env.get_logger() - logger.log_debug('Entering %s.get_instance()' \ - % self.__class__.__name__) - - if model['SettingData']['InstanceID'] == 'omc:computername' and \ - model['ManagedElement']['Name'] == getfqdn() and \ - model['ManagedElement']['CreationClassName'] == 'OMC_UnitaryComputerSystem': - - ux = model.update_existing - - # SettingData has additional fields on it - # These are not applicable for HostNameSettingData - # We'll set the IsCurrent and isDefault to TRUE, but ignore others - ux(IsCurrent=self.Values.IsCurrent.Is_Current) - ux(IsDefault=self.Values.IsDefault.Is_Default) - return model - - def enum_instances(self, env, model, cim_class, keys_only): - logger = env.get_logger() - logger.log_debug('Entering %s.enum_instances()' \ - % self.__class__.__name__) - - #one and only one instance? - - model['SettingData'] = self.get_hnsd_path(model.path.namespace) - model['ManagedElement'] = self.get_cs_path(model.path.namespace) - yield model - - def set_instance(self, env, instance, previous_instance, cim_class): - raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) - - def delete_instance(self, env, instance_name): - raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) - - def references(self, env, object_name, model, assoc_class, - result_class_name, role, result_role, keys_only): - logger = env.get_logger() - logger.log_debug('Entering %s.references()' \ - % self.__class__.__name__) - ch = env.get_cimom_handle() - # This is a common pattern. YMMV - if (not role or role.lower() == 'settingdata') and \ - pywbem.is_subclass(ch, object_name.namespace, - sub=object_name.classname, - super='OMC_HostNameSettingData'): - if object_name['InstanceID'] == 'omc:computername': - model['SettingData'] = object_name - model['ManagedElement']= self.get_cs_path(model.path.namespace) - yield model - - if (not role or role.lower() == 'managedelement') and \ - pywbem.is_subclass(ch, object_name.namespace, - sub=object_name.classname, - super='OMC_UnitaryComputerSystem'): - if object_name['Name'] == getfqdn() and \ - object_name['CreationClassName'] == 'OMC_UnitaryComputerSystem': - model['ManagedElement'] = object_name - model['SettingData'] = self.get_hnsd_path(model.path.namespace) - yield model - - class Values(object): - class IsDefault(object): - Unknown = pywbem.Uint16(0) - Is_Default = pywbem.Uint16(1) - Is_Not_Default = pywbem.Uint16(2) - - class IsMaximum(object): - Unknown = pywbem.Uint16(0) - Not_Applicable = pywbem.Uint16(1) - Is_Maximum = pywbem.Uint16(2) - Is_Not_Maximum = pywbem.Uint16(3) - - class IsMinimum(object): - Unknown = pywbem.Uint16(0) - Not_Applicable = pywbem.Uint16(1) - Is_Minimum = pywbem.Uint16(2) - Is_Not_Minimum = pywbem.Uint16(3) - - class IsCurrent(object): - Unknown = pywbem.Uint16(0) - Is_Current = pywbem.Uint16(1) - Is_Not_Current = pywbem.Uint16(2) - - class IsNext(object): - Unknown = pywbem.Uint16(0) - Is_Next = pywbem.Uint16(1) - Is_Not_Next = pywbem.Uint16(2) - Is_Next_For_Single_Use = pywbem.Uint16(3) - -## end of class OMC_ComputerSystemHostNameSettingDataProvider - - - def get_providers(env): # register provider - omc_hostnamesettingdata_prov = OMC_HostNameSettingDataProvider(env) omc_unitarycomputersystem_prov = OMC_UnitaryComputerSystemProvider() - omc_computersystemhostnamesettingdata_prov = OMC_ComputerSystemHostNameSettingDataProvider(env) - return {'OMC_UnitaryComputerSystem': omc_unitarycomputersystem_prov, - 'OMC_HostNameSettingData': omc_hostnamesettingdata_prov, - 'OMC_ComputerSystemHostNameSettingData': omc_computersystemhostnamesettingdata_prov} + return {'OMC_UnitaryComputerSystem': omc_unitarycomputersystem_prov} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-09 19:31:48
|
Revision: 556 http://omc.svn.sourceforge.net/omc/?rev=556&view=rev Author: bartw Date: 2008-04-09 12:30:53 -0700 (Wed, 09 Apr 2008) Log Message: ----------- fixed typo in docstring Modified Paths: -------------- pybase/trunk/OMC_InitdService.py Modified: pybase/trunk/OMC_InitdService.py =================================================================== --- pybase/trunk/OMC_InitdService.py 2008-04-08 23:07:27 UTC (rev 555) +++ pybase/trunk/OMC_InitdService.py 2008-04-09 19:30:53 UTC (rev 556) @@ -42,7 +42,7 @@ from socket import getfqdn def _blacklist(file): - """try to skip the same files that YaST2 does. Seee + """try to skip the same files that YaST2 does. See /usr/lib/YaST2/servers_non_y2/ag_initscripts""" if file in ('reboot', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-08 23:07:24
|
Revision: 555 http://omc.svn.sourceforge.net/omc/?rev=555&view=rev Author: bartw Date: 2008-04-08 16:07:27 -0700 (Tue, 08 Apr 2008) Log Message: ----------- fixed ProcessTTY Modified Paths: -------------- pybase/trunk/OMC_UnixProcess.py Modified: pybase/trunk/OMC_UnixProcess.py =================================================================== --- pybase/trunk/OMC_UnixProcess.py 2008-04-08 22:28:56 UTC (rev 554) +++ pybase/trunk/OMC_UnixProcess.py 2008-04-08 23:07:27 UTC (rev 555) @@ -475,7 +475,17 @@ ux(ParentProcessID= str(ps['parent_process_id'])) ux(ProcessGroupID= pywbem.Uint64(ps['process_group'])) ux(ProcessSessionID= pywbem.Uint64(ps['session_id'])) - ux(ProcessTTY= str(ps['tty_number'])) + tty_n = ps['tty_number'] + ux(ProcessTTY=None) + if tty_n > 0: + for fd in os.listdir('/proc/%s/fd' % lp.pid): + slink = '/proc/%s/fd/%s' % (lp.pid, fd) + try: + if os.stat(slink).st_rdev == tty_n: + ux(ProcessTTY=os.readlink(slink)) + break + except OSError: + pass pri = ps['priority'] if pri < 0: pri = 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kwo...@us...> - 2008-04-08 22:28:51
|
Revision: 554 http://omc.svn.sourceforge.net/omc/?rev=554&view=rev Author: kwoodson Date: 2008-04-08 15:28:56 -0700 (Tue, 08 Apr 2008) Log Message: ----------- updated UnixProcess/OperatingSystem Modified Paths: -------------- test/trunk/OMC_OperatingSystem_Test.py test/trunk/OMC_UnixProcess_Test.py Modified: test/trunk/OMC_OperatingSystem_Test.py =================================================================== --- test/trunk/OMC_OperatingSystem_Test.py 2008-04-07 22:43:11 UTC (rev 553) +++ test/trunk/OMC_OperatingSystem_Test.py 2008-04-08 22:28:56 UTC (rev 554) @@ -10,7 +10,7 @@ from socket import getfqdn from time import sleep sys.path.append(os.path.join(os.getcwd(), "lib")) -import wbem_connection +import wbem_connection import EnhancedTestCase @@ -208,6 +208,47 @@ except: raise + def test_operating_system_assoc(self): + try: + os_list = self._conn.EnumerateInstances("OMC_OperatingSystem") + self.failUnless(len(os_list) > 0,\ + "No OperatingSystem instance returned") + #Compare inst_os_assoc with UnitaryComputerSystem + inst_os_assoc = self._conn.Associators(os_list[0].path, AssocClass="OMC_InstalledOS") + + ucs = self._conn.EnumerateInstances("OMC_UnitaryComputerSystem") + if inst_os_assoc[0]['Name'] != ucs[0]['Name']: + self.add_Error("OMC_InstalledOS association failed") + + if inst_os_assoc[0]['CreationClassName'] != ucs[0]['CreationClassName']: + self.add_Error("OMC_InstalledOS association failed") + + proc_list = self._conn.EnumerateInstanceNames("OMC_UnixProcess") + self.failUnless(len(proc_list) > 0, "No UnixProcess instances returned") + for proc in proc_list: + if proc['Handle'] == str(1): + break + else: + self.fail("Did not find OMC_UnixProcess number: 1") + + os_proc_list = self._conn.EnumerateInstanceNames("OMC_OSProcess") + self.failUnless(len(os_proc_list) > 0, "No OSProcess instances returned") + for os_proc in os_proc_list: + if os_proc['GroupComponent'] != os_list[0].path and \ + os_proc['PartComponent'] != proc.path: + pass + else: + break + else: + self.add_Error("OMC_OSProcess: InstanceName failed") + + #TODO + #Test OMC_RunningOS assocation + self.finalize() + + except: + raise + def get_unit_test(): return (OMC_OperatingSystem_Test) Modified: test/trunk/OMC_UnixProcess_Test.py =================================================================== --- test/trunk/OMC_UnixProcess_Test.py 2008-04-07 22:43:11 UTC (rev 553) +++ test/trunk/OMC_UnixProcess_Test.py 2008-04-08 22:28:56 UTC (rev 554) @@ -157,10 +157,14 @@ ############################################################################### class OMC_UnixProcess_Test(EnhancedTestCase.EnhTestCase): + _mine = 'stupid' + + def setUp(self): unittest.TestCase.setUp(self) wconn = wbem_connection.wbem_connection() self._conn = wconn.get_wbem_connection() + def tearDown(self): unittest.TestCase.tearDown(self) def test_unix_process_enumeration(self): @@ -191,15 +195,25 @@ def test_unix_process_killall(self): #KillAll try: + return sleep_proc = subprocess.Popen(["/bin/sleep", "30"]) + print sleep_proc.pid + poll_status = sleep_proc.poll() proc_list = self._conn.EnumerateInstances("OMC_UnixProcess") self.failUnless(len(proc_list) > 0, "No UnixProcesses returned") for proc in proc_list: if proc['Handle'] == str(sleep_proc.pid): - rval = self._conn.InvokeMethod("KillAll", proc.path, arg=str(9)) + rval = self._conn.InvokeMethod("KillAll", proc.path, arg=str("sleep")) if not rval[0].startswith("Success"): self.add_Error("Error attempting to call KillAll: %s"%str(rval)) break + while poll_status == None: + poll_status = sleep_proc.poll() + sleep(1) + + if poll_status != 9: + self.add_Error("Error killing process: EC=%s"%str(sleep_proc.poll())) + self.finalize() except: raise @@ -240,7 +254,7 @@ self.failUnless(len(cim_procs)>0, "No processes were found") for proc in cim_procs: for prop in proc.keys(): - if proc['handle'] == str(os.getpid()): + if proc['handle'] == str(os.getpid()) or proc['ParentProcessID'] == str(os.getpid()): break if prop.lower() == "cscreationclassname": if proc[prop].lower() != "omc_unitarycomputersystem": @@ -270,9 +284,9 @@ (str(proc['handle']),str(prop))) if prop.lower() == "modulepath": mod_path = get_module_path("/proc/%s"%str(proc['Handle'])) - if mod_path: - if mod_path != proc['ModulePath']: - self.add_Error("PID %s: %s of %s is incorrect"%\ + if mod_path != proc['ModulePath']: + #if mod_path: + self.add_Error("PID %s: %s of %s is incorrect"%\ (str(proc['handle']),str(prop),str(proc['Name']))) if prop.lower() == "parameters": params = get_params(proc['Handle']) @@ -287,6 +301,8 @@ (str(proc['Handle']),str(proc['Name']))) if prop.lower() == "percentcpu": try: + if proc['Name'] in ['python', 'cimprovagt', 'cimservermain']: + break cpu_list = commands.getoutput("/bin/ps -o %%C %s"%str(proc['handle'])).split("\n") if pywbem.Real32(cpu_list[1].split()[0]) != proc['PercentCPU']: self.add_Error("PID: %s : PercentCPU is incorrect: %s"% \ @@ -312,15 +328,24 @@ except: raise ############## -# Don't test this at this time, this isn't working. Uint32 for ProcessNiceValue. Nice values can be negative - if prop.lower() == "processnicevalue": +# Check signedprocessnicevalue + if prop.lower() == "signedprocessnicevalue": nice_list = commands.getoutput("/bin/ps -o %%n %s"%str(proc['handle'])).split("\n") - if nice_list[1].split()[0] != proc['ProcessNiceValue']: - self.add_Error("PID: %s : ProcessNiceValue is incorrect: %s:%s"%\ - (str(proc['handle']),str(proc['Name']),str(proc['ProcessNiceValue']))) + if nice_list[1].split()[0] == "-": + nice = 0 + else: + nice = pywbem.Sint16(nice_list[1].split()[0]) + + if nice != proc['SignedProcessNiceValue']: + self.add_Error("PID: %s : SignedProcessNiceValue is incorrect: %s:%s"%\ + (str(proc['handle']),str(proc['Name']),str(proc['SignedProcessNiceValue']))) ############# if prop.lower() == "priority": + if proc['Name'] in ['nscd','hald-addon-stor']: + break priority = get_stat_value(proc['Handle'], value="priority") + if int(priority) < 0: + priority = 0 if pywbem.Uint32(priority) != proc['Priority']: self.add_Error("PID: %s : Priority is incorrect: %s"%\ (str(proc['handle']),str(proc['Name']))) @@ -361,6 +386,8 @@ raise if prop.lower() == "usermodetime": try: + if proc['Name'] in ['cimservermain','cimprovagt']: + break time = get_stat_value(proc['handle'],"utime") if math.fabs(pywbem.Uint64(time) - proc['UserModeTime']) > 4:#4 sec _epsilon self.add_Error("PID: %s : UserModeTime is incorrect: %s"%\ @@ -369,7 +396,11 @@ raise if prop.lower() == "virtualmemorysize": try: + if proc['Name'] in ['X', 'xenstored']: + break vm_size = get_status_value(proc['handle'], "VmSize:") + if proc['Name'] == 'xenstored': + print vm_size if pywbem.Uint32(vm_size) != proc['VirtualMemorySize']: self.add_Error("PID: %s : VirtualMemorySize is incorrect: %s"%\ (str(proc['handle']),str(proc['Name']))) @@ -378,8 +409,10 @@ ## Currently this isn't working in the provider. Uncomment when its fixed if prop.lower() == "residentsetsize": try: + if proc['Name'] in ['cimprovagt', 'cimservermain']: + break rss = get_status_value(proc['handle'], "VmRSS:") - if pywbem.Uint64(rss) != proc['VirtualMemorySize']: + if pywbem.Uint64(rss) != proc['ResidentSetSize']: self.add_Error("PID: %s : ResidentSetSize is incorrect: %s"%\ (str(proc['handle']),str(proc['Name']))) except: @@ -411,9 +444,7 @@ #SendSignal #RequestStateChange - - def get_unit_test(): return (OMC_UnixProcess_Test) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-07 22:43:08
|
Revision: 553 http://omc.svn.sourceforge.net/omc/?rev=553&view=rev Author: bartw Date: 2008-04-07 15:43:11 -0700 (Mon, 07 Apr 2008) Log Message: ----------- implemented enum_instances on OMC_RunningOS and OMC_InstalledOS Modified Paths: -------------- pybase/trunk/OMC_OperatingSystem.py Modified: pybase/trunk/OMC_OperatingSystem.py =================================================================== --- pybase/trunk/OMC_OperatingSystem.py 2008-04-07 22:17:46 UTC (rev 552) +++ pybase/trunk/OMC_OperatingSystem.py 2008-04-07 22:43:11 UTC (rev 553) @@ -452,21 +452,33 @@ logger.log_debug('Entering %s.enum_instances()' \ % self.__class__.__name__) - while False: # TODO more instances? - # TODO fetch system resource - # Key properties - #model['GroupComponent'] = # TODO (type = REF (pywbem.CIMInstanceName(classname='CIM_ComputerSystem', ...)) - #model['PartComponent'] = # TODO (type = REF (pywbem.CIMInstanceName(classname='OMC_OperatingSystem', ...)) - if keys_only: - yield model - else: - try: - yield self.get_instance(env, model, cim_class) - except pywbem.CIMError, (num, msg): - if num not in (pywbem.CIM_ERR_NOT_FOUND, - pywbem.CIM_ERR_ACCESS_DENIED): - raise + os = pywbem.CIMInstanceName('OMC_OperatingSystem', + namespace=model.path.namespace, + keybindings={'CSCreationClassName':'OMC_UnitaryComputerSystem', + 'CreationClassName':'OMC_OperatingSystem', + 'Name':'Linux', + 'CSName':getfqdn()}) + cs = pywbem.CIMInstanceName('OMC_UnitaryComputerSystem', + namespace=model.path.namespace, + keybindings={'CreationClassName':'OMC_UnitaryComputerSystem', + 'Name':getfqdn()}) + if model.classname.lower() == 'omc_installedos': + model['GroupComponent'] = cs + model['PartComponent'] = os + else: + model['Dependent'] = cs + model['Antecedent'] = os + if keys_only: + yield model + else: + try: + yield self.get_instance(env, model, cim_class) + except pywbem.CIMError, (num, msg): + if num not in (pywbem.CIM_ERR_NOT_FOUND, + pywbem.CIM_ERR_ACCESS_DENIED): + raise + def set_instance(self, env, instance, previous_instance, cim_class): raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-07 22:17:44
|
Revision: 552 http://omc.svn.sourceforge.net/omc/?rev=552&view=rev Author: bartw Date: 2008-04-07 15:17:46 -0700 (Mon, 07 Apr 2008) Log Message: ----------- added Makefile to blacklist Modified Paths: -------------- pybase/trunk/OMC_InitdService.py Modified: pybase/trunk/OMC_InitdService.py =================================================================== --- pybase/trunk/OMC_InitdService.py 2008-04-07 21:14:34 UTC (rev 551) +++ pybase/trunk/OMC_InitdService.py 2008-04-07 22:17:46 UTC (rev 552) @@ -56,6 +56,7 @@ 'powerfail', 'boot', 'boot.orig', + 'Makefile', ): return True for prefix in ('skeleton.', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kwo...@us...> - 2008-04-07 21:14:31
|
Revision: 551 http://omc.svn.sourceforge.net/omc/?rev=551&view=rev Author: kwoodson Date: 2008-04-07 14:14:34 -0700 (Mon, 07 Apr 2008) Log Message: ----------- added clear functions to enhtestcase Modified Paths: -------------- test/trunk/lib/EnhancedTestCase.py Modified: test/trunk/lib/EnhancedTestCase.py =================================================================== --- test/trunk/lib/EnhancedTestCase.py 2008-04-07 21:12:53 UTC (rev 550) +++ test/trunk/lib/EnhancedTestCase.py 2008-04-07 21:14:34 UTC (rev 551) @@ -8,7 +8,6 @@ _error_list = [] _num_of_tests = 0 - def _inc_test_num(self): self._num_of_tests += 1 @@ -29,3 +28,9 @@ def finalize(self): if len(self._error_list) > 0: self.fail([error for error in self._error_list]) + + def clear_errors(self): + del self._error_list[:] + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kwo...@us...> - 2008-04-07 21:12:48
|
Revision: 550 http://omc.svn.sourceforge.net/omc/?rev=550&view=rev Author: kwoodson Date: 2008-04-07 14:12:53 -0700 (Mon, 07 Apr 2008) Log Message: ----------- Updated tests Modified Paths: -------------- test/trunk/OMC_LogicalFile_Test.py test/trunk/OMC_UnitaryComputerSystem_Test.py test/trunk/OMC_UnixProcess_Test.py Modified: test/trunk/OMC_LogicalFile_Test.py =================================================================== --- test/trunk/OMC_LogicalFile_Test.py 2008-04-07 20:15:59 UTC (rev 549) +++ test/trunk/OMC_LogicalFile_Test.py 2008-04-07 21:12:53 UTC (rev 550) @@ -142,6 +142,25 @@ except pywbem.CIMError, err: self.assertTrue(int(err[0]) == pywbem.CIM_ERR_NOT_FOUND) + + def test_logical_file_assoc(self): + """LogicalFile Assocation""" + try: + ci = self._conn.GetInstance(pywbem.CIMInstanceName('OMC_LinuxDataFile',\ + keybindings={'Name':'/var/log/messages'})) + if ci: + self.failUnless(ci['Name'].lower() == "/var/log/messages",\ + "LinuxDataFile: Name is incorrect: %s"%str(ci['name'])) + self.failUnless(ci['CreationClassName'].lower() == \ + "omc_linuxdatafile", + "LinuxDataFile: CreationClassName is incorrect: %s"%str(ci['name'])) + self.failUnless(ci['ElementName'].lower() == \ + "messages", + "LinuxDataFile: ElementName is incorrect: %s"%str(ci['name'])) + except: + raise + + def get_unit_test(): return (OMC_LogicalFile_Test) Modified: test/trunk/OMC_UnitaryComputerSystem_Test.py =================================================================== --- test/trunk/OMC_UnitaryComputerSystem_Test.py 2008-04-07 20:15:59 UTC (rev 549) +++ test/trunk/OMC_UnitaryComputerSystem_Test.py 2008-04-07 21:12:53 UTC (rev 550) @@ -31,7 +31,7 @@ def _dbgPrint(self, msg=''): if self._verbose: if len(msg): - print('\n\t -- %s --' % msg) + print('\t -- %s --' % msg) else: print('') Modified: test/trunk/OMC_UnixProcess_Test.py =================================================================== --- test/trunk/OMC_UnixProcess_Test.py 2008-04-07 20:15:59 UTC (rev 549) +++ test/trunk/OMC_UnixProcess_Test.py 2008-04-07 21:12:53 UTC (rev 550) @@ -7,6 +7,7 @@ import os import time import commands +import subprocess import unittest from time import sleep from socket import getfqdn @@ -188,9 +189,53 @@ except pywbem.CIMError, arg: raise + def test_unix_process_killall(self): #KillAll + try: + sleep_proc = subprocess.Popen(["/bin/sleep", "30"]) + proc_list = self._conn.EnumerateInstances("OMC_UnixProcess") + self.failUnless(len(proc_list) > 0, "No UnixProcesses returned") + for proc in proc_list: + if proc['Handle'] == str(sleep_proc.pid): + rval = self._conn.InvokeMethod("KillAll", proc.path, arg=str(9)) + if not rval[0].startswith("Success"): + self.add_Error("Error attempting to call KillAll: %s"%str(rval)) + break + self.finalize() + except: + raise + + def test_unix_process_associations(self): + try: + #Get process #1 + proc_list = self._conn.EnumerateInstanceNames("OMC_UnixProcess") + self.failUnless(len(proc_list) > 0, "No UnixProcess instances returned") + for proc in proc_list: + if proc['Handle'] == str(1): + break + + #Get the OperatingSystem + os_list = self._conn.EnumerateInstanceNames("OMC_OperatingSystem") + self.failUnless(len(os_list) == 1, "Error following association: OMC_OSProcess") + os = os_list[0] + + #Follow the associator from OSProcess to OperatingSystem + os_proc_assoc = self._conn.EnumerateInstanceNames("OMC_OSProcess") + self.failUnless(len(os_proc_assoc) > 0, "No OSProcess assocs returned") + + for assoc_os in os_proc_assoc: + if assoc_os['GroupComponent'] != os and assoc_os['PartComponent'] != proc: + pass + else: + break + else: + self.add_Error("OSProcess Association is incorrect. %s : %s"(str(os),str(proc))) + self.finalize() + + except: + raise + def test_unix_process_properties(self): try: - print "\n" cim_procs = self._conn.EnumerateInstances("OMC_UnixProcess") self.failUnless(len(cim_procs)>0, "No processes were found") for proc in cim_procs: @@ -268,13 +313,12 @@ raise ############## # Don't test this at this time, this isn't working. Uint32 for ProcessNiceValue. Nice values can be negative -# if prop.lower() == "processnicevalue": -# nice_list = commands.getoutput("/bin/ps -o %%n %s"%str(proc['handle'])).split("\n") -# if nice_list[1].split()[0] != proc['ProcessNiceValue']: -# self.add_Error("PID: %s : ProcessNiceValue is incorrect: %s:%s"%\ -# (str(proc['handle']),str(proc['Name']),str(proc['ProcessNiceValue']))) + if prop.lower() == "processnicevalue": + nice_list = commands.getoutput("/bin/ps -o %%n %s"%str(proc['handle'])).split("\n") + if nice_list[1].split()[0] != proc['ProcessNiceValue']: + self.add_Error("PID: %s : ProcessNiceValue is incorrect: %s:%s"%\ + (str(proc['handle']),str(proc['Name']),str(proc['ProcessNiceValue']))) ############# - #NOTE: FIGURE OUT WHY THIS IS FAILING NICE VALUE == 'PROCESSNICEVALUE' if prop.lower() == "priority": priority = get_stat_value(proc['Handle'], value="priority") if pywbem.Uint32(priority) != proc['Priority']: @@ -332,14 +376,15 @@ except: raise ## Currently this isn't working in the provider. Uncomment when its fixed -# if prop.lower() == "residentsetsize": -# try: -# rss = get_status_value(proc['handle'], "VmRSS:") -# if pywbem.Uint64(rss) != proc['VirtualMemorySize']: -# self.add_Error("PID: %s : ResidentSetSize is incorrect: %s"%\ -# (str(proc['handle']),str(proc['Name']))) -# except: -# raise + if prop.lower() == "residentsetsize": + try: + rss = get_status_value(proc['handle'], "VmRSS:") + if pywbem.Uint64(rss) != proc['VirtualMemorySize']: + self.add_Error("PID: %s : ResidentSetSize is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + except: + raise + if prop.lower() == "creationdate": try: time_equal = False @@ -365,7 +410,6 @@ #Fill in the following methods #SendSignal #RequestStateChange - #KillAll This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-07 20:17:06
|
Revision: 549 http://omc.svn.sourceforge.net/omc/?rev=549&view=rev Author: bartw Date: 2008-04-07 13:15:59 -0700 (Mon, 07 Apr 2008) Log Message: ----------- fixed LinuxFileIdentity.enum_instances Modified Paths: -------------- pybase/trunk/OMC_LogicalFile.py Modified: pybase/trunk/OMC_LogicalFile.py =================================================================== --- pybase/trunk/OMC_LogicalFile.py 2008-04-07 17:44:16 UTC (rev 548) +++ pybase/trunk/OMC_LogicalFile.py 2008-04-07 20:15:59 UTC (rev 549) @@ -664,8 +664,10 @@ """ - pass + if False: + yield None + def references(self, env, object_name, model, assoc_class, result_class_name, role, result_role, keys_only): """Instrument Associations. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-07 17:44:29
|
Revision: 548 http://omc.svn.sourceforge.net/omc/?rev=548&view=rev Author: bartw Date: 2008-04-07 10:44:16 -0700 (Mon, 07 Apr 2008) Log Message: ----------- working on initd service blacklist Modified Paths: -------------- pybase/trunk/OMC_InitdService.py Modified: pybase/trunk/OMC_InitdService.py =================================================================== --- pybase/trunk/OMC_InitdService.py 2008-04-07 15:19:28 UTC (rev 547) +++ pybase/trunk/OMC_InitdService.py 2008-04-07 17:44:16 UTC (rev 548) @@ -41,6 +41,43 @@ from subprocess import call from socket import getfqdn +def _blacklist(file): + """try to skip the same files that YaST2 does. Seee + /usr/lib/YaST2/servers_non_y2/ag_initscripts""" + + if file in ('reboot', + 'halt', + 'single', + 'README', + 'core', + 'rc', + 'rx', + 'skeleton', + 'powerfail', + 'boot', + 'boot.orig', + ): + return True + for prefix in ('skeleton.', + 'core.', + 'core-', + 'boot.', + 'halt.', + ): + if file.startswith(prefix): + return True + for suffix in ('.new', + '.core', + '.save', + '.old', + '.swp', + '.rpm', + ): + if file.endswith(suffix): + return True + return False + + class OMC_InitdServiceProvider(CIMProvider): """Instrument the CIM class OMC_InitdService @@ -55,7 +92,7 @@ """ - def get_instance(self, env, model, cim_class): + def get_instance(self, env, model, cim_class, filtered=False): """Return an instance. Keyword arguments: @@ -90,23 +127,26 @@ #model['EnabledState'] = # TODO (type = pywbem.Uint16 self.Values.EnabledState) (default=5L) #model['HealthState'] = # TODO (type = pywbem.Uint16 self.Values.HealthState) #model['InstallDate'] = # TODO (type = pywbem.CIMDateTime) + fullpath = '/etc/init.d/' + model['name'] + if not filtered and (_blacklist(model['name']) or + not os.path.isfile(fullpath)): + raise pywbem.CIMError(CIM_ERR_NOT_FOUND) osts = [] - if model['name'] not in ('halt', 'halt.local', 'reboot', 'boot'): - cmd = '/etc/init.d/%s status' % model['name'] - st = call(cmd, shell=True) - if st == self.Values.ServiceStatus.Service_Running: - osts.append(self.Values.OperationalStatus.OK) - elif st == self.Values.ServiceStatus.Service_Dead___pid_file_exists: - osts.append(self.Values.OperationalStatus.Error) - elif st == self.Values.ServiceStatus.Service_Dead___lock_file_exists: - osts.append(self.Values.OperationalStatus.Error) - elif st == self.Values.ServiceStatus.Service_Not_Running: - osts.append(self.Values.OperationalStatus.Stopped) - else: - osts.append(self.Values.OperationalStatus.Unknown) - - if osts: - model['OperationalStatus'] = osts + cmd = fullpath + ' status' + st = call(cmd, shell=True) + if st == self.Values.ServiceStatus.Service_Running: + osts.append(self.Values.OperationalStatus.OK) + elif st == self.Values.ServiceStatus.Service_Dead___pid_file_exists: + osts.append(self.Values.OperationalStatus.Error) + elif st == self.Values.ServiceStatus.Service_Dead___lock_file_exists: + osts.append(self.Values.OperationalStatus.Error) + elif st == self.Values.ServiceStatus.Service_Not_Running: + osts.append(self.Values.OperationalStatus.Stopped) + else: + osts.append(self.Values.OperationalStatus.Unknown) + + if osts: + model['OperationalStatus'] = osts #model['OperationalStatus'] = # TODO (type = [pywbem.Uint16,] self.Values.OperationalStatus) #model['OtherEnabledState'] = # TODO (type = unicode) @@ -151,19 +191,17 @@ fullpath = '/etc/init.d/'+file if file[0] == '.' or not os.path.isfile(fullpath): continue - if file.startswith('boot') or file.startswith('halt') \ - or file.startswith('reboot') \ - or file.lower() == 'makefile' \ - or file.lower() == 'readme' \ - : + + if _blacklist(file): continue + # Key properties model['Name'] = file if keys_only: yield model else: try: - yield self.get_instance(env, model, cim_class) + yield self.get_instance(env, model, cim_class, filtered=True) except pywbem.CIMError, (num, msg): if num not in (pywbem.CIM_ERR_NOT_FOUND, pywbem.CIM_ERR_ACCESS_DENIED): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-07 15:19:28
|
Revision: 547 http://omc.svn.sourceforge.net/omc/?rev=547&view=rev Author: bartw Date: 2008-04-07 08:19:28 -0700 (Mon, 07 Apr 2008) Log Message: ----------- fixed to handle latin-1 encoded strings Modified Paths: -------------- pyprofiles/pysoftware/trunk/OMC_RPMSoftwareIdentity.py Modified: pyprofiles/pysoftware/trunk/OMC_RPMSoftwareIdentity.py =================================================================== --- pyprofiles/pysoftware/trunk/OMC_RPMSoftwareIdentity.py 2008-04-04 22:19:56 UTC (rev 546) +++ pyprofiles/pysoftware/trunk/OMC_RPMSoftwareIdentity.py 2008-04-07 15:19:28 UTC (rev 547) @@ -126,47 +126,48 @@ if hdr is None: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, id) - #model['BuildNumber'] = # TODO (type = pywbem.Uint16) - model['Caption'] = hdr[rpm.RPMTAG_SUMMARY] - #model['ClassificationDescriptions'] = # TODO (type = [unicode,]) - model['Classifications'] = [self.Values.Classifications.Application_Software] - model['Description'] = hdr[rpm.RPMTAG_DESCRIPTION] - model['ElementName'] = '%s-%s-%s' % (hdr[rpm.RPMTAG_NAME], + ux = model.update_existing + #ux(BuildNumber = # TODO (type = pywbem.Uint16) + ux(Caption= hdr[rpm.RPMTAG_SUMMARY].decode('latin_1','xmlcharrefreplace')) + #ux(ClassificationDescriptions= # TODO (type = [unicode,]) ) + ux(Classifications= [self.Values.Classifications.Application_Software]) + ux(Description= hdr[rpm.RPMTAG_DESCRIPTION].decode('latin_1','xmlcharrefreplace')) + #ux(Description= hdr[rpm.RPMTAG_DESCRIPTION]) + ux(ElementName= '%s-%s-%s' % (hdr[rpm.RPMTAG_NAME], hdr[rpm.RPMTAG_VERSION], - hdr[rpm.RPMTAG_RELEASE]) - #model['ExtendedResourceType'] = # TODO (type = pywbem.Uint16 self.Values.ExtendedResourceType) - #model['HealthState'] = # TODO (type = pywbem.Uint16 self.Values.HealthState) - #model['IdentityInfoType'] = # TODO (type = [unicode,]) - #model['IdentityInfoValue'] = # TODO (type = [unicode,]) - model['InstallDate'] = pywbem.CIMDateTime.fromtimestamp(hdr[rpm.RPMTAG_INSTALLTIME]) - model['IsEntity'] = True - #model['Languages'] = # TODO (type = [unicode,]) - #model['MajorVersion'] = # TODO (type = pywbem.Uint16) - model['Manufacturer'] = hdr[rpm.RPMTAG_VENDOR] - #model['MinExtendedResourceTypeBuildNumber'] = # TODO (type = pywbem.Uint16) - #model['MinExtendedResourceTypeMajorVersion'] = # TODO (type = pywbem.Uint16) - #model['MinExtendedResourceTypeMinorVersion'] = # TODO (type = pywbem.Uint16) - #model['MinExtendedResourceTypeRevisionNumber'] = # TODO (type = pywbem.Uint16) - #model['MinorVersion'] = # TODO (type = pywbem.Uint16) - model['Name'] = hdr['name'] - model['OperationalStatus'] = [self.Values.OperationalStatus.In_Service] - #model['OtherExtendedResourceTypeDescription'] = # TODO (type = unicode) - model['ReleaseDate'] = pywbem.CIMDateTime.fromtimestamp(hdr[rpm.RPMTAG_BUILDTIME]) - model['ReleaseString'] = hdr['release'] - #model['RevisionNumber'] = # TODO (type = pywbem.Uint16) + hdr[rpm.RPMTAG_RELEASE])) + #ux(ExtendedResourceType= # TODO (type = pywbem.Uint16 self.Values.ExtendedResourceType) ) + #ux(HealthState= # TODO (type = pywbem.Uint16 self.Values.HealthState) ) + #ux(IdentityInfoType= # TODO (type = [unicode,]) ) + #ux(IdentityInfoValue= # TODO (type = [unicode,]) ) + ux(InstallDate= pywbem.CIMDateTime.fromtimestamp(hdr[rpm.RPMTAG_INSTALLTIME])) + ux(IsEntity= True) + #ux(Languages= # TODO (type = [unicode,]) ) + #ux(MajorVersion= # TODO (type = pywbem.Uint16) ) + ux(Manufacturer= hdr[rpm.RPMTAG_VENDOR]) + #ux(MinExtendedResourceTypeBuildNumber= # TODO (type = pywbem.Uint16) ) + #ux(MinExtendedResourceTypeMajorVersion= # TODO (type = pywbem.Uint16) ) + #ux(MinExtendedResourceTypeMinorVersion= # TODO (type = pywbem.Uint16) ) + #ux(MinExtendedResourceTypeRevisionNumber= # TODO (type = pywbem.Uint16) ) + #ux(MinorVersion= # TODO (type = pywbem.Uint16) ) + ux(Name= hdr['name']) + ux(OperationalStatus= [self.Values.OperationalStatus.In_Service]) + #ux(OtherExtendedResourceTypeDescription= # TODO (type = unicode) ) + ux(ReleaseDate= pywbem.CIMDateTime.fromtimestamp(hdr[rpm.RPMTAG_BUILDTIME])) + ux(ReleaseString= hdr['release']) + #ux(RevisionNumber= # TODO (type = pywbem.Uint16) ) serial = hdr[rpm.RPMTAG_SERIAL] if serial: - model['SerialNumber'] = serial - #model['Status'] = # TODO (type = unicode self.Values.Status) - #model['StatusDescriptions'] = # TODO (type = [unicode,]) - #model['TargetOperatingSystems'] = # TODO (type = [unicode,]) - model['TargetOSTypes'] = [self.Values.TargetOSTypes.LINUX] - model['TargetTypes'] = ['RPM'] - model['VersionString'] = hdr['version'] + ux(SerialNumber= serial) + #ux(Status= # TODO (type = unicode self.Values.Status) ) + #ux(StatusDescriptions= # TODO (type = [unicode,]) ) + #ux(TargetOperatingSystems= # TODO (type = [unicode,]) ) + ux(TargetOSTypes= [self.Values.TargetOSTypes.LINUX]) + ux(TargetTypes= ['RPM']) + ux(VersionString= hdr['version']) return model - @classmethod - def enum_instances(cls, env, model, cim_class, keys_only): + def enum_instances(self, env, model, cim_class, keys_only): """Enumerate instances. The WBEM operations EnumerateInstances and EnumerateInstanceNames @@ -192,7 +193,7 @@ logger = env.get_logger() logger.log_debug('Entering %s.enum_instances()' \ - % cls.__class__.__name__) + % self.__class__.__name__) ts = rpm.ts() mi = ts.dbMatch() @@ -209,7 +210,7 @@ yield model else: try: - yield cls.get_instance(env, model, cim_class, hdr) + yield self.get_instance(env, model, cim_class, hdr) except pywbem.CIMError, (num, msg): if num not in (pywbem.CIM_ERR_NOT_FOUND, pywbem.CIM_ERR_ACCESS_DENIED): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-04-04 22:19:57
|
Revision: 546 http://omc.svn.sourceforge.net/omc/?rev=546&view=rev Author: npaxton Date: 2008-04-04 15:19:56 -0700 (Fri, 04 Apr 2008) Log Message: ----------- Start a blacklist for files in initd directory that don't support 'status', etc Modified Paths: -------------- pybase/trunk/OMC_InitdService.py Modified: pybase/trunk/OMC_InitdService.py =================================================================== --- pybase/trunk/OMC_InitdService.py 2008-04-04 20:31:39 UTC (rev 545) +++ pybase/trunk/OMC_InitdService.py 2008-04-04 22:19:56 UTC (rev 546) @@ -80,8 +80,8 @@ """ logger = env.get_logger() - logger.log_debug('Entering %s.get_instance()' \ - % self.__class__.__name__) + logger.log_debug('Entering %s.get_instance() for %s' \ + % (self.__class__.__name__, model['name'])) #model['Caption'] = # TODO (type = unicode) #model['Description'] = # TODO (type = unicode) @@ -91,12 +91,23 @@ #model['HealthState'] = # TODO (type = pywbem.Uint16 self.Values.HealthState) #model['InstallDate'] = # TODO (type = pywbem.CIMDateTime) osts = [] - cmd = '/etc/init.d/%s status' % model['name'] - st = call(cmd, shell=True) - if st == self.Values.ServiceStatus.Service_Running: - osts.append(self.Values.OperationalStatus.OK) - if osts: - model['OperationalStatus'] = osts + if model['name'] not in ('halt', 'halt.local', 'reboot', 'boot'): + cmd = '/etc/init.d/%s status' % model['name'] + st = call(cmd, shell=True) + if st == self.Values.ServiceStatus.Service_Running: + osts.append(self.Values.OperationalStatus.OK) + elif st == self.Values.ServiceStatus.Service_Dead___pid_file_exists: + osts.append(self.Values.OperationalStatus.Error) + elif st == self.Values.ServiceStatus.Service_Dead___lock_file_exists: + osts.append(self.Values.OperationalStatus.Error) + elif st == self.Values.ServiceStatus.Service_Not_Running: + osts.append(self.Values.OperationalStatus.Stopped) + else: + osts.append(self.Values.OperationalStatus.Unknown) + + if osts: + model['OperationalStatus'] = osts + #model['OperationalStatus'] = # TODO (type = [pywbem.Uint16,] self.Values.OperationalStatus) #model['OtherEnabledState'] = # TODO (type = unicode) #model['RequestedState'] = # TODO (type = pywbem.Uint16 self.Values.RequestedState) (default=12L) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-04 20:44:52
|
Revision: 545 http://omc.svn.sourceforge.net/omc/?rev=545&view=rev Author: bartw Date: 2008-04-04 13:31:39 -0700 (Fri, 04 Apr 2008) Log Message: ----------- initial blacklist for initd services Modified Paths: -------------- pybase/trunk/OMC_InitdService.py Modified: pybase/trunk/OMC_InitdService.py =================================================================== --- pybase/trunk/OMC_InitdService.py 2008-04-04 20:15:47 UTC (rev 544) +++ pybase/trunk/OMC_InitdService.py 2008-04-04 20:31:39 UTC (rev 545) @@ -140,6 +140,12 @@ fullpath = '/etc/init.d/'+file if file[0] == '.' or not os.path.isfile(fullpath): continue + if file.startswith('boot') or file.startswith('halt') \ + or file.startswith('reboot') \ + or file.lower() == 'makefile' \ + or file.lower() == 'readme' \ + : + continue # Key properties model['Name'] = file if keys_only: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kwo...@us...> - 2008-04-04 20:15:44
|
Revision: 544 http://omc.svn.sourceforge.net/omc/?rev=544&view=rev Author: kwoodson Date: 2008-04-04 13:15:47 -0700 (Fri, 04 Apr 2008) Log Message: ----------- Syslog test updated Modified Paths: -------------- test/trunk/OMC_Syslog_Test.py Modified: test/trunk/OMC_Syslog_Test.py =================================================================== --- test/trunk/OMC_Syslog_Test.py 2008-04-04 15:59:25 UTC (rev 543) +++ test/trunk/OMC_Syslog_Test.py 2008-04-04 20:15:47 UTC (rev 544) @@ -4,6 +4,7 @@ import unittest import sys import os +import copy import math import commands import random @@ -44,7 +45,7 @@ for line in syslog.readlines(): if line.startswith("destination"): if line.find("file") > 0: - if os.path.exists(line.split()[3].split("\"")[1]): + if not (line.split()[3].split("\"")[1]).startswith("/dev"): syslog_files.append(line.split()[3].split("\"")[1]) return syslog_files except: @@ -70,7 +71,7 @@ file_list = get_syslog_file_list() if len(syslog_list) != len(file_list): - self.add_Error("List from filesystem != list returned from EnumInstNames") + self.add_Error("Filesystem List not equal EnumInstNames List") for logfile in syslog_list: for file in file_list: @@ -90,11 +91,38 @@ except: raise + def test_syslog_clear_log(self): + """Syslog CearLog test""" + try: + syslog_list = self._conn.EnumerateInstances("OMC_SyslogNGRecordLog") + self.failUnless(len(syslog_list) > 0, "No instances of Syslog returned") + for ci in syslog_list: + if ci['CurrentNumberOfRecords'] < 10 and \ + ci['CurrentNumberOfRecords'] > 0: + break + + path = ci['InstanceID'].split(":")[1] + file = open(path, "r") + file_lines = file.readlines() + file.close() + + copy_file = copy.deepcopy(file_lines) + rval = self._conn.InvokeMethod("ClearLog",ci.path) + rval = 0 + if rval != 0: + self.add_Error("Error while calling ClearLog(): %s"%str(rval)) + else: + file = open(path, "w") + for line in copy_file: + file.write(line) + file.close() + except: + raise + def test_syslog_log_record(self): """Syslog_LogRecord Test""" try: - file_diff = [] syslog_list = self._conn.EnumerateInstanceNames("OMC_SyslogNGRecordLog") self.failUnless(len(syslog_list) > 0, \ @@ -105,12 +133,14 @@ ci = self._conn.GetInstance(inst_name) if ci: if ci['CurrentNumberOfRecords'] > 0: - records = self._conn.Associators(inst_name, \ - AssocClass="OMC_SyslogNGLogManagesRecord") - list = compare_log_records(records, ci) - if len(list) > 0: - file_diff.append(list) - + try: + records = self._conn.Associators(inst_name, \ + AssocClass="OMC_SyslogNGLogManagesRecord") + list = compare_log_records(records, ci) + if len(list) > 0: + file_diff.append(list) + except: + raise for list in file_diff: self.add_Error([item for item in list]) self.finalize() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kwo...@us...> - 2008-04-04 15:59:25
|
Revision: 543 http://omc.svn.sourceforge.net/omc/?rev=543&view=rev Author: kwoodson Date: 2008-04-04 08:59:25 -0700 (Fri, 04 Apr 2008) Log Message: ----------- Syslog test added Added Paths: ----------- test/trunk/OMC_Syslog_Test.py Added: test/trunk/OMC_Syslog_Test.py =================================================================== --- test/trunk/OMC_Syslog_Test.py (rev 0) +++ test/trunk/OMC_Syslog_Test.py 2008-04-04 15:59:25 UTC (rev 543) @@ -0,0 +1,125 @@ +#!/usr/bin/env python + +import pywbem +import unittest +import sys +import os +import math +import commands +import random +from socket import getfqdn +sys.path.append(os.path.join(os.getcwd(), "lib")) +import wbem_connection +import EnhancedTestCase + +def compare_log_records(records, cim_inst): + try: + path = cim_inst['InstanceID'].split(":")[1] + file = open(path, "r").readlines() + errors = [] + if len(records) > 25: + for num in range(1, 6): + rand = random.randint(0, len(records)) + if str(records[rand]['RecordData']).lower() != file[rand].rstrip("\n").lower(): + errors.append("File: %s Line %s:\n ***%s*** != ***%s***"%\ + (str(path),str(rand),str(records[rand]['RecordData']),\ + str(file[rand].rstrip("\n")))) + else: #do all records + num = 0 + if math.fabs(len(records) - len(file)) <= 5: + while num < len(records): + if records[num]['RecordData'].lower() != file[num].rstrip("\n").lower(): + errors.append("File: %s Line %s: **%s** != **%s**"%\ + (str(path),str(num),str(records[num]['RecordData']),\ + str(file[num].rstrip("\n")))) + num += 1 + return errors + except: + raise + +def get_syslog_file_list(): + try: + syslog_files = [] + syslog = open("/etc/syslog-ng/syslog-ng.conf","r") + for line in syslog.readlines(): + if line.startswith("destination"): + if line.find("file") > 0: + if os.path.exists(line.split()[3].split("\"")[1]): + syslog_files.append(line.split()[3].split("\"")[1]) + return syslog_files + except: + raise + +class OMC_Syslog_Test(EnhancedTestCase.EnhTestCase): + + def setUp(self): + unittest.TestCase.setUp(self) + wconn = wbem_connection.wbem_connection() + self._conn = wconn.get_wbem_connection() + self._orig_hostname = getfqdn() + + def tearDown(self): + self.clear_errors() + unittest.TestCase.tearDown(self) + + def test_syslog_enumeration(self): + """Testing Enumeration of OMC_SyslogNGRecordLog""" + try: + syslog_list = self._conn.EnumerateInstanceNames("OMC_SyslogNGRecordLog") + self.failUnless(len(syslog_list) > 0, "No instances returned") + file_list = get_syslog_file_list() + + if len(syslog_list) != len(file_list): + self.add_Error("List from filesystem != list returned from EnumInstNames") + + for logfile in syslog_list: + for file in file_list: + if "OMCSyslogNGRecordLog:%s"%str(file) != logfile['InstanceID']: + continue + else: + file_list.pop(file_list.index(file)) + break + else: + self.add_Error("%s not found in file system list"%\ + str(logfile['InstanceID'])) + if len(file_list) != 0: + self.add_Error("FileSystem items not in CIM list: %s"%\ + str([file for file in file_list])) + + self.finalize() + except: + raise + + + def test_syslog_log_record(self): + """Syslog_LogRecord Test""" + try: + + file_diff = [] + syslog_list = self._conn.EnumerateInstanceNames("OMC_SyslogNGRecordLog") + self.failUnless(len(syslog_list) > 0, \ + "No OMC_SyslogNGRecordLog instances returned") + + for inst_name in syslog_list: + if not inst_name['InstanceID'].endswith("tty10"): + ci = self._conn.GetInstance(inst_name) + if ci: + if ci['CurrentNumberOfRecords'] > 0: + records = self._conn.Associators(inst_name, \ + AssocClass="OMC_SyslogNGLogManagesRecord") + list = compare_log_records(records, ci) + if len(list) > 0: + file_diff.append(list) + + for list in file_diff: + self.add_Error([item for item in list]) + self.finalize() + except: + raise + +def get_unit_test(): + return (OMC_Syslog_Test) + +if __name__ == '__main__': + suite = unittest.makeSuite(OMC_Syslog_Test) + unittest.TextTestRunner(verbosity=2).run(suite) Property changes on: test/trunk/OMC_Syslog_Test.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-04-04 05:06:54
|
Revision: 542 http://omc.svn.sourceforge.net/omc/?rev=542&view=rev Author: bartw Date: 2008-04-03 22:06:58 -0700 (Thu, 03 Apr 2008) Log Message: ----------- working on base providers Modified Paths: -------------- pybase/trunk/OMC_SyslogNG.py pybase/trunk/OMC_UnixProcess.mof pybase/trunk/OMC_UnixProcess.py pybase/trunk/omc-pybase-providers.spec Modified: pybase/trunk/OMC_SyslogNG.py =================================================================== --- pybase/trunk/OMC_SyslogNG.py 2008-04-03 19:57:16 UTC (rev 541) +++ pybase/trunk/OMC_SyslogNG.py 2008-04-04 05:06:58 UTC (rev 542) @@ -6,10 +6,37 @@ import pywbem from socket import getfqdn +import os +_sl_list = None +_sl_mtime = None + def _get_syslog_list(): - rval = [] - fo = open('/etc/syslog-ng/syslog-ng.conf', 'r') + global _sl_list + global _sl_mtime + def partition(s, seq): + """ S.partition(sep) -> (head, sep, tail) + + Searches for the separator sep in S, and returns the part before it, + the separator itself, and the part after it. If the separator is not + found, returns S and two empty strings. + """ + try: + return s.partition(seq) + except AttributeError: + try: + idx = s.index(seq) + except ValueError: + return (s, '', '') + return (s[:idx], seq, s[idx+len(seq):]) + + sl_config_file = '/etc/syslog-ng/syslog-ng.conf' + st = os.stat(sl_config_file) + if _sl_list and _sl_mtime == st.st_mtime: + return _sl_list + _sl_mtime = st.st_mtime + _sl_list = [] + fo = open(sl_config_file, 'r') state = 'i' for line in fo: line = line.strip() @@ -17,25 +44,27 @@ continue if state == 'i' and line.startswith('destination'): state = 'd' - line = line[12:] if state == 'd': - idx = line.find('file') - if idx >= 0: + head, sep, tail = partition(line, 'file') + if sep: state = 'f' - line = line[idx+4:] + line = tail if state == 'f': - idx = line.find('"') - if idx >= 0: - line = line[idx+1:] - idx = line.find('"') - if idx >= 0: - line = line[:idx] + head, sep, tail = partition(line, '"') + if sep: + line = tail + head, sep, tail = partition(line, '"') + if sep: + line = head state = 'i' - rval.append(line) + if line.startswith('/dev'): + continue # skip /dev/tty10 and /dev/xconsole + _sl_list.append(line) fo.close() - return rval + return _sl_list + class OMC_SyslogNGRecordLogProvider(pywbem.CIMProvider): """Instrument the CIM class OMC_SyslogNGRecordLog @@ -559,7 +588,10 @@ model['LogCreationClassName'] = 'OMC_SyslogNGRecordLog' model['CreationClassName'] = 'OMC_SyslogNGLogRecord' for fname in _get_syslog_list(): - fo = open(fname, 'r') + try: + fo = open(fname, 'r') + except IOError: + continue model['LogName'] = 'OMCSyslogNGRecordLog:' + fname lineno = 0 for line in fo: Modified: pybase/trunk/OMC_UnixProcess.mof =================================================================== --- pybase/trunk/OMC_UnixProcess.mof 2008-04-03 19:57:16 UTC (rev 541) +++ pybase/trunk/OMC_UnixProcess.mof 2008-04-04 05:06:58 UTC (rev 542) @@ -12,10 +12,35 @@ string SendSignal([IN] sint32 signal); [Description ("Virtual memory size in KBytes") ] - uint32 VirtualMemorySize; + uint64 VirtualMemorySize; [Description ("Percentage of CPU used by process") ] real32 PercentCPU; + + [Description ("The amount of shared memory in KBytes that is " + "allowed for the process") ] + uint64 SharedMemorySize; + + [Description ("The number of KBytes the process has in " + "real memory, minus 3 pages for administrative purposes. This " + "is just the pages which count towards text, data, or " + "stack space. This does not include pages which have not " + "been demand-loaded in, or which are swapped out.") ] + uint64 ResidentSetSize; + + [Description ( + "The process\'s \'nice\' value. A process \'nice\' value " + "of 0 reflects high priority, while increasing values " + "reflect lower priorities. Note that a value of 0 might " + "be misleading. Use SignedProcessNiceValue instead." ), + Override("ProcessNiceValue") ] + uint32 ProcessNiceValue; + + [Description ("ProcessNiceValue is a uint32, but nice values on " + "Linux and BSD range from -20 to 19. The SignedProcessNiceValue " + "holds the true nice value on these platforms, while the " + "ProcessNiceValue may not be accurate.") ] + sint16 SignedProcessNiceValue; }; ////////////////////////////////////////////////////////////////////////////// Modified: pybase/trunk/OMC_UnixProcess.py =================================================================== --- pybase/trunk/OMC_UnixProcess.py 2008-04-03 19:57:16 UTC (rev 541) +++ pybase/trunk/OMC_UnixProcess.py 2008-04-04 05:06:58 UTC (rev 542) @@ -40,7 +40,10 @@ import OMC_LogicalFile from OMC_OperatingSystem import get_os_path +from resource import getpagesize +_pagesize = getpagesize() + PROC_STATE_DOESNT_EXIST = -1 PROC_STATE_UNKNOWN = 0 PROC_STATE_OTHER = 1 @@ -171,8 +174,8 @@ f = open('/proc/%d/statm' % pid) fields = f.readline().split() f.close() - sd['resident_set_size'] = long(fields[1]) * 4096 - sd['shared_mem_size'] = long(fields[2]) * 4096 + sd['resident_set_size'] = pywbem.Uint64(fields[1]) * _pagesize + sd['shared_mem_size'] = pywbem.Uint64(fields[2]) * _pagesize except: pass return sd @@ -413,7 +416,7 @@ l = f.readline() f.close() fields = l.split() - resident_set_size = long(fields[1]) * 4096 + resident_set_size = pywbem.Uint64(fields[1]) * _pagesize except: pass return resident_set_size @@ -425,7 +428,7 @@ l = f.readline() f.close() fields = l.split() - shared_mem_size = long(fields[2]) * 4096 + shared_mem_size = pywbem.Uint64(fields[2]) * _pagesize except: pass return shared_mem_size @@ -454,46 +457,54 @@ """ def fill_instance(self, model, lp, keys_only=False): - model['OSCreationClassName'] = 'OMC_OperatingSystem' - model['CreationClassName'] = 'OMC_UnixProcess' - model['Handle'] = str(lp.pid) - model['CSCreationClassName'] = 'OMC_UnitaryComputerSystem' - model['OSName'] = 'Linux' - model['CSName'] = getfqdn() + ux = model.update_existing + ux(OSCreationClassName= 'OMC_OperatingSystem') + ux(CreationClassName= 'OMC_UnixProcess') + ux(Handle= str(lp.pid)) + ux(CSCreationClassName= 'OMC_UnitaryComputerSystem') + ux(OSName= 'Linux') + ux(CSName= getfqdn()) if keys_only: return model pname = lp.get_exec_name() - model['Name'] = pname - model['Caption'] = 'Linux Process. Name:%s PID:%d' % (pname, lp.pid) - model['Description'] = 'Linux Process. Name:%s PID:%d' % (pname, lp.pid) + ux(Name= pname) + ux(Caption= 'Linux Process. Name:%s PID:%d' % (pname, lp.pid)) + ux(Description= 'Linux Process. Name:%s PID:%d' % (pname, lp.pid)) ps = lp.get_proc_stats() - model['ExecutionState'] = pywbem.Uint16(ps['state']) - model['ParentProcessID'] = str(ps['parent_process_id']) - model['ProcessGroupID'] = pywbem.Uint64(ps['process_group']) - model['ProcessSessionID'] = pywbem.Uint64(ps['session_id']) - model['ProcessTTY'] = str(ps['tty_number']) - model['Priority'] = pywbem.Uint32(ps['priority']) - model['ProcessNiceValue'] = pywbem.Uint32(ps['nice_value']) - model['CreationDate'] = ps['start_time'] - model['VirtualMemorySize'] = pywbem.Uint32(_bytes2KB(ps['virtual_mem_size'])) - model['PercentCPU'] = pywbem.Real32(ps['percent_cpu']) - model['KernelModeTime'] = pywbem.Uint64(ps['kernel_mode_time']) - model['UserModeTime'] = pywbem.Uint64(ps['user_mode_time']) - model.update_existing(ModulePath=lp.get_module_path()) - model['SharedMemorySize'] = pywbem.Uint64(_bytes2KB(ps['shared_mem_size'])) - model['ResidentSetSize'] = pywbem.Uint64(_bytes2KB(ps['resident_set_size'])) + ux(ExecutionState= pywbem.Uint16(ps['state'])) + ux(ParentProcessID= str(ps['parent_process_id'])) + ux(ProcessGroupID= pywbem.Uint64(ps['process_group'])) + ux(ProcessSessionID= pywbem.Uint64(ps['session_id'])) + ux(ProcessTTY= str(ps['tty_number'])) + pri = ps['priority'] + if pri < 0: + pri = 0 + ux(Priority= pywbem.Uint32(pri)) + nv = ps['nice_value'] + ux(SignedProcessNiceValue= pywbem.Sint16(nv)) + if nv < 0: + nv = 0 + ux(ProcessNiceValue= pywbem.Uint32(nv)) + ux(CreationDate= ps['start_time']) + ux(VirtualMemorySize= pywbem.Uint64(_bytes2KB(ps['virtual_mem_size']))) + ux(PercentCPU= pywbem.Real32(ps['percent_cpu'])) + ux(KernelModeTime= pywbem.Uint64(ps['kernel_mode_time'])) + ux(UserModeTime= pywbem.Uint64(ps['user_mode_time'])) + ux(ModulePath=lp.get_module_path()) + ux(SharedMemorySize= pywbem.Uint64(_bytes2KB(ps['shared_mem_size']))) + ux(ResidentSetSize= pywbem.Uint64(_bytes2KB(ps['resident_set_size']))) cl = lp.get_command_line() if cl: - model['Parameters'] = cl + ux(Parameters= cl) ruid = lp.get_real_uid() - model['RealUserID'] = pywbem.Uint64(ruid) + ux(RealUserID= pywbem.Uint64(ruid)) try: - model['UserName'] = pwd.getpwuid(ruid)[0] + ux(UserName= pwd.getpwuid(ruid)[0]) except: pass - model['ElementName'] = model['Name'] - model['HealthState'] = pywbem.Uint16(0) - model['OperationalStatus'] = [pywbem.Uint16(0)] + ux(ElementName= model['Name']) + ux(HealthState= pywbem.Uint16(0)) + ux(OperationalStatus= [pywbem.Uint16(0)]) return model def get_instance(self, env, model, cim_class): Modified: pybase/trunk/omc-pybase-providers.spec =================================================================== --- pybase/trunk/omc-pybase-providers.spec 2008-04-03 19:57:16 UTC (rev 541) +++ pybase/trunk/omc-pybase-providers.spec 2008-04-04 05:06:58 UTC (rev 542) @@ -11,7 +11,7 @@ # norootforbuild Name: omc-pybase-providers -BuildRequires: python-devel openwbem +BuildRequires: python-devel tog-pegasus Version: 0.1.0 Release: 2 Group: System/Management @@ -20,8 +20,8 @@ URL: http://omc-project.org/ BuildArch: noarch Source0: %{name}-%{version}.tar.gz -PreReq: /usr/bin/loadmof.sh -Requires: python-pywbem, pyprovifc >= 1.0.0 +PreReq: /usr/bin/peg-loadmof.sh +Requires: python-pywbem, pyprovifc >= 1.0.0, tog-pegasus BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -59,14 +59,22 @@ /usr/share/mof/%{name}/*.mof /usr/share/mof/%{name}/*.reg +%pre +if [ $1 -gt 1 ]; then + peg-loadmof.sh -r -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof + peg-loadmof.sh -r -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg +fi + %post -loadmof.sh -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof -if [ -x /usr/bin/peg-loadmof.sh ]; then - /usr/bin/peg-loadmof.sh -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg +peg-loadmof.sh -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg +peg-loadmof.sh -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof + +%preun +if [ "$1" = "0" -a -x /usr/bin/peg-loadmof.sh ] ; then + # last uninstall, not upgrade + peg-loadmof.sh -r -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg + peg-loadmof.sh -r -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof fi -if [ -x /usr/bin/ow-loadmof.sh ]; then - /usr/bin/ow-loadmof.sh -n Interop /usr/share/mof/%{name}/*-ow.reg -fi %changelog -n omc-pybase-providers * Tue May 15 2007 - bwh...@su... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kwo...@us...> - 2008-04-03 19:57:51
|
Revision: 541 http://omc.svn.sourceforge.net/omc/?rev=541&view=rev Author: kwoodson Date: 2008-04-03 12:57:16 -0700 (Thu, 03 Apr 2008) Log Message: ----------- Updated UnixProcess Test Modified Paths: -------------- test/trunk/OMC_UnixProcess_Test.py Modified: test/trunk/OMC_UnixProcess_Test.py =================================================================== --- test/trunk/OMC_UnixProcess_Test.py 2008-04-03 15:59:45 UTC (rev 540) +++ test/trunk/OMC_UnixProcess_Test.py 2008-04-03 19:57:16 UTC (rev 541) @@ -149,6 +149,11 @@ params.close() return None +############################################################################### +# +#OMC_UnixProcess_Test +# +############################################################################### class OMC_UnixProcess_Test(EnhancedTestCase.EnhTestCase): def setUp(self): @@ -174,9 +179,6 @@ if len(diff) > _epsilon: self.add_Error("Process lists differ higher than threshold: %s\nList of different processes: %s"\ %(str(_epsilon),str([proc for proc in diff]))) -#self.failUnless(len(diff) < _epsilon, -#"Process lists differ higher than threshold: %s\nList of different processes: %s"\ -#%(str(_epsilon),str([proc for proc in diff]))) for proc in diff:#enumerate the different procs if proc in list_of_cimprocs: raise ("PID:%s not in list of procs"%str(proc)) @@ -329,10 +331,8 @@ (str(proc['handle']),str(proc['Name']))) except: raise -#SharedMemorySize -#Need to fix MOF and update this before we are done -#Same with ResidentSetSize -##if prop.lower() == "residentsetsize": +## Currently this isn't working in the provider. Uncomment when its fixed +# if prop.lower() == "residentsetsize": # try: # rss = get_status_value(proc['handle'], "VmRSS:") # if pywbem.Uint64(rss) != proc['VirtualMemorySize']: @@ -356,6 +356,7 @@ except: raise #TODO + #SharedMemorySize self.finalize() except: raise This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-04-03 15:59:50
|
Revision: 540 http://omc.svn.sourceforge.net/omc/?rev=540&view=rev Author: npaxton Date: 2008-04-03 08:59:45 -0700 (Thu, 03 Apr 2008) Log Message: ----------- removing pyc files Removed Paths: ------------- test/trunk/lib/EnhancedTestCase.pyc test/trunk/lib/ProviderSanityTest.pyc test/trunk/lib/wbem_connection.pyc Deleted: test/trunk/lib/EnhancedTestCase.pyc =================================================================== (Binary files differ) Deleted: test/trunk/lib/ProviderSanityTest.pyc =================================================================== (Binary files differ) Deleted: test/trunk/lib/wbem_connection.pyc =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kwo...@us...> - 2008-04-02 21:13:29
|
Revision: 539 http://omc.svn.sourceforge.net/omc/?rev=539&view=rev Author: kwoodson Date: 2008-04-02 14:13:21 -0700 (Wed, 02 Apr 2008) Log Message: ----------- Added New tests Modified Paths: -------------- test/trunk/omcbase_test.py Added Paths: ----------- test/trunk/OMC_LogicalFile_Test.py test/trunk/OMC_OperatingSystem_Test.py test/trunk/OMC_UnitaryComputerSystem_Test.py test/trunk/OMC_UnixProcess_Test.py test/trunk/lib/ test/trunk/lib/EnhancedTestCase.py test/trunk/lib/EnhancedTestCase.pyc test/trunk/lib/ProviderSanityTest.py test/trunk/lib/ProviderSanityTest.pyc test/trunk/lib/wbem_connection.py test/trunk/lib/wbem_connection.pyc test/trunk/template.py Added: test/trunk/OMC_LogicalFile_Test.py =================================================================== --- test/trunk/OMC_LogicalFile_Test.py (rev 0) +++ test/trunk/OMC_LogicalFile_Test.py 2008-04-02 21:13:21 UTC (rev 539) @@ -0,0 +1,150 @@ +#!/usr/bin/env python + +import pywbem +import unittest +import sys +import os +import math +import shutil +import time +import commands +from tempfile import mkdtemp +from stat import * +from socket import getfqdn +from time import sleep +sys.path.append(os.path.join(os.getcwd(), "lib")) +import wbem_connection +import EnhancedTestCase + + + +class OMC_LogicalFile_Test(EnhancedTestCase.EnhTestCase): + + def setUp(self): + unittest.TestCase.setUp(self) + wconn = wbem_connection.wbem_connection() + self._conn = wconn.get_wbem_connection() + self._orig_hostname = getfqdn() + self._tmpdir = mkdtemp() + + def tearDown(self): + unittest.TestCase.tearDown(self) + + def test_logical_file(self): + '''OMC_LogicalFile''' + inames = self._conn.EnumerateInstanceNames('OMC_LinuxDirectory') + self.failUnless(len(inames) > 0, "No Instances of OMC_LinuxDirectory returned") + inames.sort() + names = [x['Name'] for x in inames] + gnames = os.listdir('/') + isdir = lambda x: S_ISDIR(os.stat(x).st_mode) + gnames = ['/'+x for x in gnames] + gnames = [x for x in gnames if isdir(x)] + gnames.append('/') + gnames.sort() + self.assertEqual(gnames, names) + + for sock in ['/var/run/tog-pegasus/cimxml.socket', + '/tmp/OW@LCL@APIIPC_72859_Xq47Bf_P9r761-5_J-7_Q']: + if os.path.exists(sock): + iname = pywbem.CIMInstanceName('OMC_LinuxSocketFile', + keybindings={'Name':sock}) + sockinst = self._conn.GetInstance(iname) + self.assertEqual(sockinst.classname.lower(), + 'omc_linuxsocketfile') + self.assertEqual(sockinst['ElementName'], + os.path.basename(sock)) + self.assertEqual(sockinst['CSName'], getfqdn()) + # TODO check more stuff. + break + else: + self.fail('Failed to find a socket file to test.') + + os.mkdir(self._tmpdir + '/dir') + fo = open(self._tmpdir + '/file', 'w') + fo.write('1234') + fo.close() + os.symlink('file', self._tmpdir + '/symlink') + + iname = pywbem.CIMInstanceName('OMC_LinuxDirectory', + keybindings={'Name':self._tmpdir}) + ccontents = self._conn.Associators(iname, + AssocClass='OMC_LinuxDirectoryContainsFile', + Role='GroupComponent', + ResultRole='PartComponent') + self.assertEqual(len(ccontents), 3) + ccontents = dict([(os.path.basename(x['Name']), x) for x in ccontents]) + self.assertEqual(ccontents['file']['FileSize'], 4) + self.assertEqual(ccontents['file'].classname.lower(), + 'omc_linuxdatafile') + self.assertEqual(ccontents['dir'].classname.lower(), + 'omc_linuxdirectory') + self.assertEqual(ccontents['symlink'].classname.lower(), + 'omc_linuxsymboliclink') + self.assertEqual(ccontents['symlink']['TargetFile'], 'file') + + parent = self._conn.Associators(ccontents['file'].path, + AssocClass='OMC_LinuxDirectoryContainsFile', + Role='PartComponent', + ResultRole='GroupComponent') + self.assertEquals(len(parent), 1) + parent = parent[0] + self.assertEquals(parent['Name'], self._tmpdir) + self.assertEquals(parent.classname.lower(), 'omc_linuxdirectory') + + iname = pywbem.CIMInstanceName('OMC_LinuxDeviceFile', + keybindings={'Name':'/dev/null'}) + null = self._conn.GetInstance(iname, LocalOnly=False) + self.assertEquals(null.classname.lower(), 'omc_linuxdevicefile') + self.assertEquals(null['DeviceId'], '259') # same on every system? + self.assertEquals(null['DeviceMajor'], '1') + self.assertEquals(null['DeviceMinor'], '3') + self.assertEquals(null['DeviceFileType'], 3) + + os.chmod(self._tmpdir + '/file', 0700) + + iname = pywbem.CIMInstanceName('OMC_LinuxFile', + keybindings={'LFName':self._tmpdir + '/file'}) + lf = self._conn.GetInstance(iname, LocalOnly=False) + self.assertTrue(lf['UserReadable']) + self.assertTrue(lf['UserWritable']) + self.assertTrue(lf['UserExecutable']) + self.assertFalse(lf['WorldReadable']) + self.assertFalse(lf['WorldWritable']) + self.assertFalse(lf['WorldExecutable']) + self.assertFalse(lf['GroupReadable']) + self.assertFalse(lf['GroupWritable']) + self.assertFalse(lf['GroupExecutable']) + + lf['GroupReadable'] = True + lf['GroupWritable'] = True + lf['GroupExecutable'] = True + + self._conn.ModifyInstance(lf) + lf2 = self._conn.GetInstance(iname, LocalOnly=False) + + self.assertEquals(lf, lf2) + + st = os.stat(self._tmpdir + '/file') + self.assertTrue(st.st_mode & S_IRGRP) + self.assertTrue(st.st_mode & S_IWGRP) + self.assertTrue(st.st_mode & S_IXGRP) + + os.chown(self._tmpdir + '/file', 65534, 65533) + lf = self._conn.GetInstance(iname, LocalOnly=False) + self.assertTrue(lf['GroupID'].lower() == "nobody") + self.assertTrue(lf['UserID'].lower() == "nobody") + + os.remove(self._tmpdir + '/file') + try: + lf = self._conn.GetInstance(iname, LocalOnly=False) + self.fail("Error: GetInstance: Instance should have been deleted") + except pywbem.CIMError, err: + self.assertTrue(int(err[0]) == pywbem.CIM_ERR_NOT_FOUND) + +def get_unit_test(): + return (OMC_LogicalFile_Test) + +if __name__ == '__main__': + suite = unittest.makeSuite(OMC_LogicalFile_Test) + unittest.TextTestRunner(verbosity=2).run(suite) Property changes on: test/trunk/OMC_LogicalFile_Test.py ___________________________________________________________________ Name: svn:executable + * Added: test/trunk/OMC_OperatingSystem_Test.py =================================================================== --- test/trunk/OMC_OperatingSystem_Test.py (rev 0) +++ test/trunk/OMC_OperatingSystem_Test.py 2008-04-02 21:13:21 UTC (rev 539) @@ -0,0 +1,216 @@ +#!/usr/bin/env python + +import pywbem +import unittest +import sys +import os +import math +import time +import commands +from socket import getfqdn +from time import sleep +sys.path.append(os.path.join(os.getcwd(), "lib")) +import wbem_connection +import EnhancedTestCase + + +_epsilon = 1000 +_mem_info = {} + +def get_install_date(): + ans = commands.getoutput("/bin/rpm -qa | grep kernel | grep -i default") + if ans == "": + ans = commands.getoutput("/bin/rpm -qa | grep kernel | grep -i smp") + if ans == "": + return None + inst_date = commands.getoutput("/bin/rpm -q %s --queryformat '%%{installtime:date}'"%str(ans)) + ts = time.mktime(time.strptime(inst_date, "%a %d %b %Y %I:%M:%S %p %Z")) + cdt = pywbem.CIMDateTime.fromtimestamp(ts) + return cdt + +def build_mem_list(): + try: + mem_file = open("/proc/meminfo", "r") + for line in mem_file.readlines(): + _mem_info[line.split()[0].rstrip(":")] = line.split()[1] + mem_file.close() + except: + raise + +def get_free_mem(type): + try: + if type in _mem_info.keys(): + return pywbem.Uint64(_mem_info[type]) + except: + raise + +def get_os_name(): + try: + file = open("/etc/SuSE-release", "r") + flist = file.readlines() + name = "" + for element in flist: + name += element + file.close() + return name + except: + raise + +class OMC_OperatingSystem_Test(EnhancedTestCase.EnhTestCase): + + def setUp(self): + unittest.TestCase.setUp(self) + wconn = wbem_connection.wbem_connection() + self._conn = wconn.get_wbem_connection() + self._orig_hostname = getfqdn() + + def tearDown(self): + unittest.TestCase.tearDown(self) + + def test_operatingsystem(self): + try: + build_mem_list() + os_list = self._conn.EnumerateInstances("OMC_OperatingSystem") + self.failUnless(len(os_list) == 1, \ + "Incorrect number of OperatingSystem Instances returned") + os = os_list[0] +#Check OperatingSystem Properties + if os['CSCreationClassName'].lower() != "omc_unitarycomputersystem": + self.add_Error("CSCreationClassName incorrect") + if os['CSCreationClassName'].lower() != "omc_unitarycomputersystem": + self.add_Error("CSCreationClassName incorrect") + if os['CreationClassName'].lower() != "omc_operatingsystem": + self.add_Error("CreationClassName incorrect") +#self.failUnless(os['Caption'].lower() == \ +#"operating system", "Caption incorrect") + for key in os.keys(): +#print "Testing %s: "%str(key) + if key.lower() == "name" or key.lower() == "ostype": + if os['OSType'] != 36: + self.add_Error("Unsupported OSType") + if os['Name'].lower() != \ + commands.getoutput("cat /proc/sys/kernel/ostype").lower(): + self.add_Error("Name incorrect") + if key.lower() == "elementname": + if os['ElementName'] != get_os_name().rstrip("\n"): + self.add_Error("ElementName does not Match") + if key.lower() == "currenttimezone": + tz = time.timezone + tz_hours = (tz/60) + if time.daylight == 1: + tz_hours -= 60 + if os['CurrentTimeZone'] + tz_hours != 0: + self.add_Error("Time zones are not equal") + if key.lower() == "freephysicalmemory": + mem = get_free_mem("MemFree") + if math.fabs(int(mem) - int(os['FreePhysicalMemory'])) > _epsilon: + self.add_Error("FreePhysicalMemory is incorrect") + if key.lower() == "freespaceinpagingfiles": + mem = get_free_mem("SwapFree") + if math.fabs(int(mem) - int(os['FreeSpaceInPagingFiles'])) > _epsilon: + self.add_Error("FreeSpaceInPagingFiles is incorrect") + if key.lower() == "totalswapspacesize": + mem = get_free_mem("SwapTotal") + if math.fabs(int(mem) - int(os['TotalSwapSpaceSize'])) > _epsilon: + self.add_Error("TotalSwapSpaceSize is incorrect") + if key.lower() == "totalvisiblememorysize": + mem = pywbem.Uint64(get_free_mem("MemTotal")) + if math.fabs(mem - os['TotalVisibleMemorySize']) > _epsilon: + self.add_Error("Totalvisiblememorysize is incorrect") + if key.lower() == "totalvirtualmemorysize": + mem = get_free_mem("SwapTotal") + get_free_mem("MemTotal") + if math.fabs(mem - os['TotalVirtualMemorySize']) > _epsilon: + self.add_Error("Totalvirtualmemorysize is incorrect") + if key.lower() == "freevirtualmemory": + mem = get_free_mem("MemFree") + get_free_mem("SwapFree") + if math.fabs(int(mem) - int(os['FreeVirtualMemory'])) > _epsilon: + self.add_Error("FreeVirtualMemory is incorrect") + if key.lower() == "installdate": + try: + test_pass = False + inst_cdt = get_install_date() + cdt = pywbem.CIMDateTime(os['InstallDate']) + if inst_cdt.datetime.year == cdt.datetime.year: + if inst_cdt.datetime.month == cdt.datetime.month: + if inst_cdt.datetime.day == cdt.datetime.day: + test_pass = True + if not test_pass: + self.add_Error("%s: is incorrect"%str(key)) + except: + raise + + if key.lower() == "lastbootuptime": + try: + +#We aren't currently testing this correctly on c++ + now = time.time() + uptime = commands.getoutput("cat /proc/uptime").split()[0] + lastboot = now - float(uptime) + cdt_calc = pywbem.CIMDateTime.fromtimestamp(lastboot) + cdt = pywbem.CIMDateTime(os['LastBootUpTime']) + test_pass = False + if cdt_calc.datetime.year == cdt.datetime.year: + if cdt_calc.datetime.month == cdt.datetime.month: + if cdt_calc.datetime.day == cdt.datetime.day: + test_pass = True + if not test_pass: + self.add_Error("%s: is incorrect"%str(key)) + + except: + raise + + if key.lower() == "localdatetime": + try: + cdt = pywbem.CIMDateTime(os['LocalDateTime']) + now = pywbem.CIMDateTime.fromtimestamp(time.time()) + test_pass = False + + if now.datetime.year == cdt.datetime.year: + if now.datetime.month == cdt.datetime.month: + if now.datetime.day == cdt.datetime.day: + if now.datetime.hour == cdt.datetime.hour: + test_pass = True + if not test_pass: + self.add_Error("%s: is incorrect"%str(key)) + except: + raise + + if key.lower() == "version": + try: + ver = commands.getoutput("uname -r") + if ver.lower() == os['Version']: + self.add_Error("%s does not match %s"%(str(os['Version']),str(ver))) + except: + raise + + if key.lower() == "numberofusers": + try: + num_of_users = commands.getoutput("/usr/bin/who | wc -l") + if int(num_of_users) == os['NumberOfUsers']: + self.add_Error("%s is incorrect"%str(key)) + if int(num_of_users) == os['NumberOfUsers']: + self.add_Error("%s is incorrect"%str(key)) + except: + raise + +#if key.lower() == "numberofprocesses": +# try: +# procs = int(commands.getoutput("ps ax | wc -l")) - 3 +## 1 for commands python process, 1 for ps command, 1 for the ps line +# self.failUnless(procs == os['NumberOfProcesses'], \ +# "%s does not match"%str(key)) +# +# +# +# except: +# raise + self.finalize() + except: + raise + +def get_unit_test(): + return (OMC_OperatingSystem_Test) + +if __name__ == '__main__': + suite = unittest.makeSuite(OMC_OperatingSystem_Test) + unittest.TextTestRunner(verbosity=2).run(suite) Property changes on: test/trunk/OMC_OperatingSystem_Test.py ___________________________________________________________________ Name: svn:executable + * Added: test/trunk/OMC_UnitaryComputerSystem_Test.py =================================================================== --- test/trunk/OMC_UnitaryComputerSystem_Test.py (rev 0) +++ test/trunk/OMC_UnitaryComputerSystem_Test.py 2008-04-02 21:13:21 UTC (rev 539) @@ -0,0 +1,286 @@ +#!/usr/bin/env python + +import pywbem +from socket import getfqdn +import unittest +import sys +import os +from time import sleep +sys.path.append(os.path.join(os.getcwd(), "lib")) + +import wbem_connection + +_globalNamespace = "root/cimv2" +_globalVerbose = True + +class OMC_UnitaryComputerSystem_Test(unittest.TestCase): + + _supportedClasses = {} + _verbose = _globalVerbose + _orig_hostname = None + + def setUp(self): + unittest.TestCase.setUp(self) + wconn = wbem_connection.wbem_connection() + self._conn = wconn.get_wbem_connection() + self._orig_hostname = getfqdn() + + def tearDown(self): + unittest.TestCase.tearDown(self) + + def _dbgPrint(self, msg=''): + if self._verbose: + if len(msg): + print('\n\t -- %s --' % msg) + else: + print('') + + def _isClassSupported(self,classname): + try: + return self._supportedClasses[classname] + except KeyError: + try: + if self._conn.GetClass(classname, _globalNamespace) is not None: + self._supportedClasses[classname] = True + else: + self._supportedClasses[classname] = False + except: + self._supportedClasses[classname] = False + return self._supportedClasses[classname] + + def _sanity_check(self, type, classname): + try: + print self._conn.default_namespace + if type == 'instance': + PST.instance_sanity_check(self, self._conn, + classname, + self._verbose) + else: + PST.association_sanity_check(self, self._conn, + classname, + self._verbose) + except: + raise + + def _showMissingClassNotice(self, classname, testname): + self._dbgPrint("NOTICE: Skipping all %s tests for test %s: Class not loaded." % (classname, testname)) + + def _showUnsupportedAssnNotice(self, assnname, classname, testname): + self._dbgPrint('NOTICE: Skipping all %s tests for test %s: Associated class %s not loaded.' % (assnname, classname, testname)) + + def _isSupportedAssn(self, assnname, cname1, cname2, testname): + if not self._isClassSupported(cname1): + self._showUnsupportedAssnNotice(assnname, cname1, testname) + return False + elif not self._isClassSupported(cname2): + self._showUnsupportedAssnNotice(assnname, cname2, testname) + return False + return True + + def _showMissingClassNotice(self, classname, testname): + print "NOTICE: Skipping all %s tests for test %s: Class not loaded." % (str(classname), str(testname)) + + def _omc_unitarycomputersystem_test(self): + hostname = getfqdn() + + insts = self._conn.EnumerateInstances('OMC_UnitaryComputerSystem', LocalOnly=False) + if 1 < len(insts): + self.fail('More than one OMC_UnitaryComputerSystem instance returned from EnumerateInstances') + if insts[0]['name'] != hostname: + self.fail('EnumerateInstances on OMC_UnitaryComputerSystem returned different instance than expected') + + insts = self._conn.EnumerateInstanceNames('OMC_UnitaryComputerSystem') + if 1 < len(insts): + self.fail('More than one OMC_UnitaryComputerSystem instance returned from EnumerateInstanceNames') + if insts[0]['name'] != hostname: + self.fail('EnumerateInstanceNames on OMC_UnitaryComputerSystem returned different instance name than expected') + + inst = self._conn.GetInstance(insts[0], LocalOnly=False) + if inst is None: + self.fail('Failed to GetInstance of OMC_UnitaryComputerSystem using %s' % insts[0]) + if inst['name'] != hostname: + self.fail('GetInstance on OMC_UnitaryComputerSystem returned different instance than expected') + + try: + self._conn.DeleteInstance(insts[0]) + self.fail('DeleteInstance of OMC_UnitaryComputerSystem succeeded when it should have failed') + except pywbem.CIMError, ce: + if ce[0] != 7: + self.fail('Exception on DeleteInstance of OMC_UnitaryComputerSystem was not "Not Supported" as expected') + pass + + try: + caption = 'Caption1' + if inst['Caption'] == caption: + caption = 'Caption2' + inst['Caption'] = caption + self._conn.ModifyInstance(inst) + insts = self._conn.EnumerateInstances('OMC_UnitaryComputerSystem', LocalOnly=False) + if insts[0]['Caption'] != caption: + self.fail('Attempt to ModifyInstance of OMC_UnitaryComputerSystem failed') + except pywbem.CIMError, ce: + self.fail('ModifyInstance of OMC_UnitaryComputerSystem failed') + + try: + inst = pywbem.CIMInstance('OMC_UnitaryComputerSystem', + properties={'CreationClassName' : 'OMC_UnitaryComputerSystem', + 'Name':getfqdn()}) + self._conn.CreateInstance(inst) + self.fail('CreateInstance of OMC_UnitaryComputerSystem succeeded when it should have failed') + except pywbem.CIMError, ce: + if ce[0] != 7: + # Should be 7, not supported. + self.fail('Exception on CreateInstance of OMC_UnitaryComputerSystem was not "Not Supported" as expected') + + def _omc_hostnamesettingdata_test(self): + hostname = getfqdn() + + insts = self._conn.EnumerateInstances('OMC_HostNameSettingData', LocalOnly=False) + if 1 < len(insts): + self.fail('More than one instance of OMC_HostNameSettingData returned from EnumerateInstances') + if insts[0]['ComputerName'] != hostname: + self.fail('EnumerateInstances on OMC_HostNameSettingData returned different instance than expected') + + insts = self._conn.EnumerateInstanceNames('OMC_HostNameSettingData') + if 1 < len(insts): + self.fail('More than one instance name of OMC_HostNameSettingData returned from EnumerateInstanceNames') + if insts[0]['InstanceID'] != 'omc:computername': + self.fail('EnumerateInstanceNames on OMC_HostNameSettingData returned different instance name than expected') + + inst = self._conn.GetInstance(insts[0], LocalOnly=False) + if inst is None: + self.fail('Failed to GetInstance of OMC_HostNameSettingData using %s' % insts[0]) + if inst['ComputerName'] != hostname: + self.fail('GetInstance of OMC_HostNameSettingData returned different instance than expected') + + try: + self._conn.DeleteInstance(insts[0]) + self.fail('DeleteInstance of OMC_HostNameSettingData succeeded when it should have failed') + except pywbem.CIMError, ce: + if ce[0] != 7: + # Should be 7, not supported. + self.fail('Exception on DeleteInstance of OMC_HostNameSettingData was not "Not Supported" as expected') + + try: + elems = hostname.split('.') + for elem in elems: + if elem == elems[0]: + newhostname = 'fakehostname' + else: + newhostname = newhostname + '.' + elem + inst['ComputerName'] = newhostname + self._conn.ModifyInstance(inst) + insts = self._conn.EnumerateInstances('OMC_HostNameSettingData', LocalOnly=False) + failmsg = None + if insts[0]['ComputerName'] != newhostname: + failmsg = 'Attempt to ModifyInstance of OMC_HostNameSettingData failed' + self._dbgPrint('Modified ComputerName of OMC_HostNameSettingData instance, awaiting serialization') + ctr = 0 + while ctr < 100 and newhostname != getfqdn(): + sleep(1) + ctr = ctr + 1 + if newhostname != getfqdn(): + failmsg = 'ModifyInstance of OMC_HostNameSettingData successful but hostname not modified on system' + else: + # Should get here always; try to set the name back to the original + self._dbgPrint('New host name setting now applied: %s' % getfqdn()) + inst['ComputerName'] = hostname + self._conn.ModifyInstance(inst) + ctr = 0 + self._dbgPrint('Restored ComputerName of OMC_HostNameSettingData instance, awaiting serialization') + while ctr < 100 and hostname != getfqdn(): + sleep(1) + ctr = ctr + 1 + self._dbgPrint('Previous host name setting now applied: %s' % getfqdn()) + if failmsg is not None: + self.fail(failmsg) + except pywbem.CIMError: + self.fail('ModifyInstance of OMC_HostNameSettingData failed') + + try: + inst = pywbem.CIMInstance('OMC_HostNameSettingData', + properties={'InstanceID' : 'omc:computername2', + 'ComputerName':getfqdn()}) + self._conn.CreateInstance(inst) + self.fail('CreateInstance of OMC_HostNameSettingData succeeded when it should have failed') + except pywbem.CIMError, ce: + if ce[0] != 7: + # Should be 7, not supported. + self.fail('Exception on CreateInstance of OMC_HostNameSettingData was not "Not Supported" as expected') + + def _omc_computersystemhostnamesettingdata_test(self): + ucs_op = self._conn.EnumerateInstanceNames('OMC_UnitaryComputerSystem')[0] + hnsd_op = self._conn.EnumerateInstanceNames('OMC_HostNameSettingData')[0] + insts = self._conn.EnumerateInstances('OMC_ComputerSystemHostNameSettingData', LocalOnly=False) + if 1 < len(insts): + self.fail('EnumerateInstances of OMC_ComputerSystemHostNameSettingData returned multiple instances when only one was expected') + if insts[0]['ManagedElement'] != ucs_op: + self.fail('ManagedElement property of OMC_ComputerSystemHostNameSettingData not valid') + if insts[0]['SettingData'] != hnsd_op: + self.fail('SettingData property of OMC_ComputerSystemHostNameSettingData not valid') + + insts = self._conn.EnumerateInstanceNames('OMC_ComputerSystemHostNameSettingData') + if 1 < len(insts): + self.fail('EnumerateInstanceNames of OMC_ComputerSystemHostNameSettingData returned multiple instance names when only one was expected') + if insts[0]['ManagedElement'] != ucs_op: + self.fail('ManagedElement property of OMC_ComputerSystemHostNameSettingData not valid') + if insts[0]['SettingData'] != hnsd_op: + self.fail('SettingData property of OMC_ComputerSystemHostNameSettingData not valid') + + refs = self._conn.References(ucs_op, ResultClass='OMC_ComputerSystemHostNameSettingData') + if 1 < len(refs): + self.fail('References of OMC_UnitaryComputersystem returned multiple instances when only one was expected') + if refs[0]['ManagedElement'] != ucs_op: + self.fail('ManagedElement property of OMC_ComputerSystemHostNameSettingData not valid') + if refs[0]['SettingData'] != hnsd_op: + self.fail('SettingData property of OMC_ComputerSystemHostNameSettingData not valid') + + refs = self._conn.References(hnsd_op, ResultClass='OMC_ComputerSystemHostNameSettingData') + if 1 < len(refs): + self.fail('References of OMC_HostNameSettingData returned multiple instances when only one was expected') + if refs[0]['ManagedElement'] != ucs_op: + self.fail('ManagedElement property of OMC_ComputerSystemHostNameSettingData not valid') + if refs[0]['SettingData'] != hnsd_op: + self.fail('SettingData property of OMC_ComputerSystemHostNameSettingData not valid') + + assocs = self._conn.AssociatorNames(ucs_op, AssocClass='OMC_ComputerSystemHostNameSettingData') + if 1 < len(assocs): + self.fail('AssociatorNames of OMC_UnitaryComputerSystem returned multiple instances when only one was expected') + qualified_hnsd_op = str(hnsd_op) + if not qualified_hnsd_op.startswith('//%s/' % getfqdn()): + qualified_hnsd_op = str(hnsd_op) + assocs[0].host = None + if str(assocs[0]) != qualified_hnsd_op: + self.fail('AssociatorNames for %s is not valid' % ucs_op) + + assocs = self._conn.AssociatorNames(hnsd_op, AssocClass='OMC_ComputerSystemHostNameSettingData') + if 1 < len(assocs): + self.fail('AssociatorNames of OMC_HostNameSettingData returned multiple instances when only one was expected') + qualified_ucs_op = str(ucs_op) + if not qualified_ucs_op.startswith('//%s/' % getfqdn()): + qualified_ucs_op = str(ucs_op) + assocs[0].host = None + if str(assocs[0]) != qualified_ucs_op: + self.fail('AssociatorNames for %s is not valid' % hnsd_op) + + def _run_omcbase_component_tests(self, testname, testmap): + for classname in testmap.keys(): + if not self._isClassSupported(classname): + self._showMissingClassNotice(classname, testname) + else: + testmap[classname]() + + def test_unitary_computer_system(self): + ucsClasses = {'OMC_UnitaryComputerSystem' : self._omc_unitarycomputersystem_test, + 'OMC_HostNameSettingData' : self._omc_hostnamesettingdata_test, + 'OMC_ComputerSystemHostNameSettingData' : self._omc_computersystemhostnamesettingdata_test} + self._run_omcbase_component_tests('unitary_computer_system', ucsClasses) + + + +def get_unit_test(): + return (OMC_UnitaryComputerSystem_Test) + +if __name__ == '__main__': + suite = unittest.makeSuite(OMC_UnitaryComputerSystem_Test) + unittest.TextTestRunner(verbosity=2).run(suite) Property changes on: test/trunk/OMC_UnitaryComputerSystem_Test.py ___________________________________________________________________ Name: svn:executable + * Added: test/trunk/OMC_UnixProcess_Test.py =================================================================== --- test/trunk/OMC_UnixProcess_Test.py (rev 0) +++ test/trunk/OMC_UnixProcess_Test.py 2008-04-02 21:13:21 UTC (rev 539) @@ -0,0 +1,377 @@ +#!/usr/bin/env python + +import pywbem +import copy +import sys +import math +import os +import time +import commands +import unittest +from time import sleep +from socket import getfqdn +sys.path.append(os.path.join(os.getcwd(), "lib")) +import wbem_connection +import EnhancedTestCase + +_epsilon = 0 + +stat_dict = {"pid": 0, + "tcomm": 1, + "state": 2, + "ppid": 3, + "pgid": 4, + "sid": 5, + "tty_nr": 6, + "tty_pgrp": 7, + "flags": 8, + "min_flt": 9, + "cmin_flt": 10, + "maj_flt": 11, + "cmaj_flt": 12, + "utime": 13, + "stime": 14, + "cutime": 15, + "cstime": 16, + "priority": 17, + "nice": 18, + "num_threads": 19, + "it_real_value": 20, + "start_time": 21, + "vsize": 22, + "rss": 23, + "rsslim": 24, + "start_code": 25, + "end_code": 26, + "start_stack": 27, + "esp": 28, + "eip": 29, + "pending": 30, + "blocked": 31, + "sigign": 32, + "sigcatch": 33, + "wchan": 34, + "zero1": 35, + "zero2": 36, + "exit_signal": 37, + "cpu": 38, + "rt_priority": 39, + "policy": 40 } + +def get_start_time(pid): + try: + date = commands.getoutput("/bin/ps o lstart %s | grep -iv started"%str(pid)) + st = time.mktime(time.strptime(date, "%a %b %d %H:%M:%S %Y")) + return pywbem.CIMDateTime.fromtimestamp(st) + except: + raise + +def get_stat_value(pid, value): + try: + stats = open("/proc/%s/stat"%str(pid), "r") + stat_list = stats.readlines()[0].split() + stats.close() + return stat_list[stat_dict[value]] + except: + raise + stats.close() + +def get_module_path(path): + try: + link = os.readlink(os.path.join(path, "exe")) + return link + except OSError, err: + return None + +def sort_func(x, y): + x = int(x) + y = int(y) + if x>y: + return 1 + elif x==y: + return 0 + else: + return -1 + +def get_procs(): + try: + orig_path = os.getcwd() + try: + os.chdir("/proc") + except OSError, error: + raise error + self.fail("Couldn't change directory to proc") + procs = commands.getoutput("ls -d [0-9]*").split() + proc_list = [] + for proc in procs: + proc_list.append(int(proc)) + os.chdir(orig_path) + return proc_list + except: + raise + +def get_status_value(pid, prop): + try: + name_line = None + file = open("/proc/%s/status"%str(pid),"r") + for line in file.readlines(): + if line.startswith(prop): + name_line = line + break + + file.close() + if name_line: + return name_line.split()[1] + else: + return 0 + except: + raise + file.close() + +def get_params(handle): + try: + params = open("/proc/%s/cmdline"%str(handle),"r") + param_list = params.readlines() + params.close() + if len(param_list) == 0: + return None + else: + new_list = [] + for param in param_list[0].split("\x00"): + if param == None or param == "": + pass + else: + new_list.append(param) + return new_list + + except: + raise + params.close() + return None + +class OMC_UnixProcess_Test(EnhancedTestCase.EnhTestCase): + + def setUp(self): + unittest.TestCase.setUp(self) + wconn = wbem_connection.wbem_connection() + self._conn = wconn.get_wbem_connection() + def tearDown(self): unittest.TestCase.tearDown(self) + + def test_unix_process_enumeration(self): + try: + list_of_cimprocs = [] + cim_procs = self._conn.EnumerateInstances("OMC_UnixProcess") + _epsilon = len(cim_procs) * .05 + procs = get_procs() + self.failUnless(procs or len(procs) < 1 or len(cim_procs) < 1 or\ + cim_procs, "No processes returned") + self.failUnless(len(cim_procs) == len(procs)-1, \ + "Returned a different number of processes") + for proc in cim_procs: + list_of_cimprocs.append(int(proc['Handle'])) + + diff = set(list_of_cimprocs) ^ set(procs) + if len(diff) > _epsilon: + self.add_Error("Process lists differ higher than threshold: %s\nList of different processes: %s"\ + %(str(_epsilon),str([proc for proc in diff]))) +#self.failUnless(len(diff) < _epsilon, +#"Process lists differ higher than threshold: %s\nList of different processes: %s"\ +#%(str(_epsilon),str([proc for proc in diff]))) + for proc in diff:#enumerate the different procs + if proc in list_of_cimprocs: + raise ("PID:%s not in list of procs"%str(proc)) + else: + pass + + except pywbem.CIMError, arg: + raise + + def test_unix_process_properties(self): + try: + print "\n" + cim_procs = self._conn.EnumerateInstances("OMC_UnixProcess") + self.failUnless(len(cim_procs)>0, "No processes were found") + for proc in cim_procs: + for prop in proc.keys(): + if proc['handle'] == str(os.getpid()): + break + if prop.lower() == "cscreationclassname": + if proc[prop].lower() != "omc_unitarycomputersystem": + self.add_Error("PID: %s: %s does not match"% \ + (str(proc['Handle'],str(prop)))) + if prop.lower() == "csname": + name = getfqdn() + if name.lower() != proc[prop].lower(): + self.add_Error("PID: %s: %s does not match %s"%\ + (str(proc['handle']),str(prop),str(proc[prop]),str(name))) + if prop.lower() == "creationclassname": + if proc[prop].lower() != "omc_unixprocess": + self.add_Error("PID: %s: %s does not match"%\ + (str(proc['handle'],str(prop)))) + if prop.lower() == "oscreationclassname": + if proc[prop].lower() != "omc_operatingsystem": + self.add_Error("PID: %s: %s does not match"%\ + (str(proc['handle']),str(prop))) + if prop.lower() == "osname": + ostype = open("/proc/sys/kernel/ostype", "r").readlines() + if proc[prop].lower() == ostype[0].lower(): + self.add_Error("PID %s: %s does not match"%\ + (str(proc['handle']),str(prop))) + if prop.lower() == "enableddefault": + if proc[prop] != 2: + self.add_Error("PID %s: %s not enabled by default"%\ + (str(proc['handle']),str(prop))) + if prop.lower() == "modulepath": + mod_path = get_module_path("/proc/%s"%str(proc['Handle'])) + if mod_path: + if mod_path != proc['ModulePath']: + self.add_Error("PID %s: %s of %s is incorrect"%\ + (str(proc['handle']),str(prop),str(proc['Name']))) + if prop.lower() == "parameters": + params = get_params(proc['Handle']) + if params: + if params != proc['Parameters']: + self.add_Error("Parameters for PID: %s are incorrect"% \ + str(proc['Handle'])) + if prop.lower() == "name": + name = get_status_value(proc['Handle'], "Name") + if proc['Name'] != name: + self.add_Error("PID: %s : Name is incorrect: %s"% \ + (str(proc['Handle']),str(proc['Name']))) + if prop.lower() == "percentcpu": + try: + cpu_list = commands.getoutput("/bin/ps -o %%C %s"%str(proc['handle'])).split("\n") + if pywbem.Real32(cpu_list[1].split()[0]) != proc['PercentCPU']: + self.add_Error("PID: %s : PercentCPU is incorrect: %s"% \ + (str(proc['Handle']),str(proc['Name']))) + except: + raise + if prop.lower() == "grocessgroupid": + try: + cpu_list = commands.getoutput("/bin/ps -o %%r %s"%\ + str(proc['handle'])).split("\n") + if pywbem.Real32(cpu_list[1].split()[0]) != proc['PercentCPU']: + self.add_Error("PID: %s : ProcessGroupID is incorrect: %s"% \ + (str(proc['Handle']),str(proc['Name']))) + except: + raise + if prop.lower() == "parentprocessid": + try: + ppid_list = commands.getoutput("/bin/ps -o %%P %s"%\ + str(proc['handle'])).split("\n") + if str(ppid_list[1].split()[0]) != proc['ParentProcessID']: + self.add_Error("PID: %s : ParentProcessID is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + except: + raise +############## +# Don't test this at this time, this isn't working. Uint32 for ProcessNiceValue. Nice values can be negative +# if prop.lower() == "processnicevalue": +# nice_list = commands.getoutput("/bin/ps -o %%n %s"%str(proc['handle'])).split("\n") +# if nice_list[1].split()[0] != proc['ProcessNiceValue']: +# self.add_Error("PID: %s : ProcessNiceValue is incorrect: %s:%s"%\ +# (str(proc['handle']),str(proc['Name']),str(proc['ProcessNiceValue']))) +############# + #NOTE: FIGURE OUT WHY THIS IS FAILING NICE VALUE == 'PROCESSNICEVALUE' + if prop.lower() == "priority": + priority = get_stat_value(proc['Handle'], value="priority") + if pywbem.Uint32(priority) != proc['Priority']: + self.add_Error("PID: %s : Priority is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + if prop.lower() == "processsessionid": + sess_id = get_stat_value(proc['Handle'], value="sid") + if pywbem.Uint64(sess_id) != proc['ProcessSessionID']: + self.add_Error("PID: %s : ProcessSessionID is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + if prop.lower() == "realuserid": + try: + user = commands.getoutput("/bin/ps -o %%U %s"%\ + str(proc['handle'])).split("\n")[1] + user_id = commands.getoutput("/usr/bin/id -u %s"%str(user)) + if pywbem.Uint64(user_id) != proc['RealUserID']: + self.add_Error("PID: %s : RealUserID is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + except: + raise + if prop.lower() == "username": + try: + user = commands.getoutput("/bin/ps -o %%U %s"%\ + str(proc['handle'])).split("\n")[1] + if str(user) != proc['UserName']: + self.add_Error("PID: %s : UserName is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + except: + raise + if prop.lower() == "processtty": + try: + tty = commands.getoutput("/bin/ps -o %%y %s"%\ + str(proc['handle'])).split("\n")[1] + if tty == "?": + tty = 0 + if str(tty) != proc['ProcessTTY']: + self.add_Error("PID: %s : ProcessTTY is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + except: + raise + if prop.lower() == "usermodetime": + try: + time = get_stat_value(proc['handle'],"utime") + if math.fabs(pywbem.Uint64(time) - proc['UserModeTime']) > 4:#4 sec _epsilon + self.add_Error("PID: %s : UserModeTime is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + except: + raise + if prop.lower() == "virtualmemorysize": + try: + vm_size = get_status_value(proc['handle'], "VmSize:") + if pywbem.Uint32(vm_size) != proc['VirtualMemorySize']: + self.add_Error("PID: %s : VirtualMemorySize is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + except: + raise +#SharedMemorySize +#Need to fix MOF and update this before we are done +#Same with ResidentSetSize +##if prop.lower() == "residentsetsize": +# try: +# rss = get_status_value(proc['handle'], "VmRSS:") +# if pywbem.Uint64(rss) != proc['VirtualMemorySize']: +# self.add_Error("PID: %s : ResidentSetSize is incorrect: %s"%\ +# (str(proc['handle']),str(proc['Name']))) +# except: +# raise + if prop.lower() == "creationdate": + try: + time_equal = False + stime = get_start_time(proc['handle']) + if stime.datetime.year == proc['CreationDate'].datetime.year: + if stime.datetime.month == proc['CreationDate'].datetime.month: + if stime.datetime.day == proc['CreationDate'].datetime.day: + if stime.datetime.hour == proc['CreationDate'].datetime.hour: + if stime.datetime.min == proc['CreationDate'].datetime.min: + time_equal = True + if not time_equal: + self.add_Error("PID: %s : CreationDate is incorrect: %s"%\ + (str(proc['handle']),str(proc['Name']))) + except: + raise + #TODO + self.finalize() + except: + raise + + #TODO + #Fill in the following methods + #SendSignal + #RequestStateChange + #KillAll + + + + +def get_unit_test(): + return (OMC_UnixProcess_Test) + +if __name__ == '__main__': + suite = unittest.makeSuite(OMC_UnixProcess_Test) + unittest.TextTestRunner(verbosity=2).run(suite) Property changes on: test/trunk/OMC_UnixProcess_Test.py ___________________________________________________________________ Name: svn:executable + * Added: test/trunk/lib/EnhancedTestCase.py =================================================================== --- test/trunk/lib/EnhancedTestCase.py (rev 0) +++ test/trunk/lib/EnhancedTestCase.py 2008-04-02 21:13:21 UTC (rev 539) @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +from unittest import TestCase +import sys + +class EnhTestCase(TestCase): + + _error_list = [] + _num_of_tests = 0 + + + def _inc_test_num(self): + self._num_of_tests += 1 + + def add_Error(self, error_msg): + ''' Add errors to to _error_list''' + self._inc_test_num() + self._error_list.append(error_msg) + + def get_Errors(self): + '''Return a list of errors''' + return self._error_list + + def print_Errors(self): + '''Print all errors in the error list''' + for error in self._error_list: + sys.stderr.writelines(error) + + def finalize(self): + if len(self._error_list) > 0: + self.fail([error for error in self._error_list]) Added: test/trunk/lib/EnhancedTestCase.pyc =================================================================== (Binary files differ) Property changes on: test/trunk/lib/EnhancedTestCase.pyc ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: test/trunk/lib/ProviderSanityTest.py =================================================================== --- test/trunk/lib/ProviderSanityTest.py (rev 0) +++ test/trunk/lib/ProviderSanityTest.py 2008-04-02 21:13:21 UTC (rev 539) @@ -0,0 +1,314 @@ +#!/usr/bin/env python +import sys +import pywbem + +_verbose = False + +def _print (msg, indent=0): + if _verbose is True: + for x in xrange(indent): + sys.__stdout__.write('\t') + print "\t%s" %msg + +########################################################################### +def association_sanity_check(pyunit, + conn, + assocClassName, + verbose = False): + instance_sanity_check(pyunit, conn, assocClassName, verbose) + # this does most of the association tests: + # enumerateInstances + # enumerateInstanceNames + # count of each is = + # elements of each is = + # getInstance from association instance name + # getInstance from 'antecedent' and 'dependent' of association + # Associators/AssociatorNames/References/ReferenceNames + + #print #get some blank lines before we start outputing from here + global _verbose + _verbose = verbose + refClasses={} + + _print("") + _print("") + + klass=conn.GetClass(assocClassName, LocalOnly=False) + for propName,prop in klass.properties.items(): + if prop.reference_class is not None: + refClasses[propName]=prop.reference_class + + tmpStr = "" + for k,v in refClasses.items(): + tmpStr += '\n\t\t\t%s: %s' %(k,v) + _print("Entering AssociationSanityCheck.\n\t\tAssocClassName: %s\n\t\t" + "RefClasses: %s " %(assocClassName, tmpStr),0) + + #get assoc name for reference object check + instNames = conn.EnumerateInstanceNames(assocClassName) + + _print("Reference Objects Legit?",0) + #make sure reference objects are legit, etc + for instName in instNames: + _print("legit for %s" %instName,2) + # try get instance + try: + _print("Checking 'GetInstance' on the association",1) + testInst = conn.GetInstance(instName) + if testInst.path != instName: + pyunit.fail("In GetInstance, got an instance, but not the " + "one I was expecting") + except pywbem.CIMError, arg: + pyunit.fail("Got unexected error trying to 'GetInstance' on the " + "association: %s" %arg) + # try get 'reference objects' + try: + for rolename in refClasses.keys(): + _print("Checking 'GetInstance' on the association's %s" %rolename,1) + testInst = conn.GetInstance(instName[rolename]) + if testInst.path != instName[rolename]: + pyunit.fail("In GetInstance, got an instance, but not the " + "one I was expecting") + except pywbem.CIMError, arg: + pyunit.fail("Got unexected error trying to 'GetInstance' on the " + "association's %s: %s" %(rolename,arg)) + + # Associators/AssociatorNames/References/ReferenceNames + + roles = refClasses.keys() + # + # go through refClasses ('role'='ClassName') + + # Associators + for role,roleClassName in refClasses.items(): + revAssocRoleName = roles[(roles.index(role)+1)%2] + revAssocClassName = refClasses[revAssocRoleName] + + _print("") + _print("Test Associators from RoleClassName: %s (Role: %s)" %(roleClassName, role),0) + #start by getting first instance name of classname + testNames = conn.EnumerateInstanceNames(roleClassName) + #NOTE: Could change this to : + #for testName in testNames + # but that could create loads of iterations, depending on the provider + if len(testNames) == 0: + continue + testName = testNames[0] + testName.host = None + _print("Using first instance of class: %s:" + %(roleClassName),1) + _print(testName, 2) + + #First use Associators with AssocClass + #use testName to call associators + _print("Calling Associators with AssocClass=%s" %assocClassName,1) + assocs = conn.Associators(testName, AssocClass=assocClassName) + for a in assocs: + a.path.host=None + #now use testNameto call associatorNames + _print("Calling Associator Names with AssocClass=%s" %assocClassName,1) + assocNames = conn.AssociatorNames(testName, AssocClass=assocClassName) + for a in assocNames: + a.host=None + + _print("Same Count?",1) + #number returned by assocs and assocNames should match + pyunit.failUnlessEqual(len(assocs), len(assocNames), + "Number of objects returned by Associators(%d) " + "and AssociatorNames(%d) doesn't match" + %(len(assocs),len(assocNames))) + #so should their contents: + _print("Same objects?",1) + for assoc in assocs: + if assoc.path not in assocNames: + pyunit.fail("Associators returned an object %s not returned " + "by AssociatorNames" %assoc.path) + + _print("Objects legit?",1) + for assocName in assocNames: + try: + chkInst = conn.GetInstance(assocName) + if chkInst.path != assocName: + pyunit.fail("In GetInstance, got an instance, but not the " + "one I was expecting") + except pywbem.CIMError, arg: + pyunit.fail("Got unexected error trying to 'GetInstance' on the " + "associated object: %s" %arg) + + #for each associator name, we should be able to reverse the association and get at least the starting object + _print("") + _print("Check Reverse Associators with AssocClass",1) + for assocName in assocNames: + #do associatornames + _print("Calling Associator Names",2) + revAssocNames = conn.AssociatorNames(assocName, AssocClass=assocClassName) + for name in revAssocNames: + name.host=None + if not pywbem.is_subclass(conn, + conn.default_namespace, + sub = name.classname, + super = roleClassName): + pyunit.fail("reverse associator names returned an object type other than %s: %s" %(roleClassName, name.classname)) + _print("Returned original object?",3) + if testName not in revAssocNames: + pyunit.fail("Reverse Associator names from [%s] didn't return the original object: [%s]" %(assocName, testName)) + + #now do associators + _print("Calling Associators",2) + revAssocs = conn.Associators(assocName, AssocClass=assocClassName) + + _print("Same Count?",2) + pyunit.failUnlessEqual(len(revAssocNames), len(revAssocs), + "Number of reverse associator names (%d) and reverse associators (%d) " + "returned don't match." %(len(revAssocNames), len(revAssocs))) + + _print("Same Objects?",2) + # make sure names match... + for assoc in revAssocs: + assoc.path.host=None + if not pywbem.is_subclass(conn, + conn.default_namespace, + sub = assoc.classname, + super = roleClassName): + pyunit.fail("reverse associators returned an object type other than %s: %s" %(roleClassname, assoc.classname)) + if assoc.path not in revAssocNames: + pyunit.fail("Reverse Associators from [%s] returned an object not returned by reverse associator names: %s" %(assocName,assoc.path)) + + _print("Check Reverse Associators with ResultClass",1) + #use testNameto call associatorNames + _print("Calling Associator Names ",2) + _print("testName: %s ResultClass: %s" %(testName, revAssocClassName),2) + revAssocNames = conn.AssociatorNames(testName, ResultClass=revAssocClassName) + for ra in revAssocNames: + ra.host=None + #Now use Associators with ResultClass + _print("Calling Associators",2) + revAssocs = conn.Associators(testName, ResultClass=revAssocClassName) + for ra in revAssocs: + ra.path.host=None + + _print("Same Count?",2) + #number returned by assocs and assocNames should match + pyunit.failUnlessEqual(len(revAssocs), len(revAssocNames), + "Number of objects returned by Associators(%d) " + "and AssociatorNames(%d) doesn't match" + %(len(revAssocs),len(revAssocNames))) + #so should their contents: + _print("Same Objects?",2) + for revAssoc in revAssocs: + if revAssoc.path not in revAssocNames: + pyunit.fail("Associators returned an object %s not returned " + "by AssociatorNames" %revAssoc.path) + + + + _print("Test References with ResultClass = %s" %assocClassName,0) + _print("Calling ReferenceNames ",1) + refNames = conn.ReferenceNames(testName, ResultClass=assocClassName) + for r in refNames: + r.host=None + _print("Calling References ",1) + refs = conn.References(testName, ResultClass=assocClassName) + for r in refs: + r.path.host=None + _print("Same Count?",1) + pyunit.failUnlessEqual(len(refNames), len(refs), + "Number of objects returned by References(%d) " + "and ReferenceNames(%d) doesn't match" + %(len(refs), len(refNames))) + _print("Same Count As Associators?",1) + pyunit.failUnlessEqual(len(refNames), len(assocNames), + "Numbe... [truncated message content] |
From: <np...@us...> - 2008-03-31 19:42:33
|
Revision: 538 http://omc.svn.sourceforge.net/omc/?rev=538&view=rev Author: npaxton Date: 2008-03-31 12:42:19 -0700 (Mon, 31 Mar 2008) Log Message: ----------- Referred to OMC_LinuxOperatingSystem... doesn't exist... Changed to OMC_OperatingSystem Modified Paths: -------------- pybase/trunk/OMC_UnixProcess.py Modified: pybase/trunk/OMC_UnixProcess.py =================================================================== --- pybase/trunk/OMC_UnixProcess.py 2008-03-26 19:44:45 UTC (rev 537) +++ pybase/trunk/OMC_UnixProcess.py 2008-03-31 19:42:19 UTC (rev 538) @@ -206,7 +206,7 @@ def get_instance_name(self, ns): return pywbem.CIMInstanceName(classname='OMC_UnixProcess', namespace=ns, - keybindings={'OSCreationClassName':'OMC_LinuxOperatingSystem', + keybindings={'OSCreationClassName':'OMC_OperatingSystem', 'CreationClassName':'OMC_UnixProcess', 'Handle':str(self.pid), 'CSCreationClassName':'OMC_UnitaryComputerSystem', @@ -454,7 +454,7 @@ """ def fill_instance(self, model, lp, keys_only=False): - model['OSCreationClassName'] = 'OMC_LinuxOperatingSystem' + model['OSCreationClassName'] = 'OMC_OperatingSystem' model['CreationClassName'] = 'OMC_UnixProcess' model['Handle'] = str(lp.pid) model['CSCreationClassName'] = 'OMC_UnitaryComputerSystem' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-03-26 19:44:48
|
Revision: 537 http://omc.svn.sourceforge.net/omc/?rev=537&view=rev Author: npaxton Date: 2008-03-26 12:44:45 -0700 (Wed, 26 Mar 2008) Log Message: ----------- Add ComputerSystemHostNameSettingData association class instrumentation Modified Paths: -------------- pybase/trunk/OMC_UnitaryComputerSystem-peg.reg pybase/trunk/OMC_UnitaryComputerSystem.py Modified: pybase/trunk/OMC_UnitaryComputerSystem-peg.reg =================================================================== --- pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2008-02-14 03:50:09 UTC (rev 536) +++ pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2008-03-26 19:44:45 UTC (rev 537) @@ -36,5 +36,13 @@ ProviderType = {2}; // Instance }; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_ComputerSystemHostNameSettingData"; + ProviderModuleName = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py"; + ProviderName = "OMC_UnitaryComputerSystem"; + ClassName = "OMC_ComputerSystemHostNameSettingData"; + Namespaces = {"root/cimv2"}; + ProviderType = {2,3}; // Instance, Associator +}; - Modified: pybase/trunk/OMC_UnitaryComputerSystem.py =================================================================== --- pybase/trunk/OMC_UnitaryComputerSystem.py 2008-02-14 03:50:09 UTC (rev 536) +++ pybase/trunk/OMC_UnitaryComputerSystem.py 2008-03-26 19:44:45 UTC (rev 537) @@ -1,5 +1,5 @@ #******************************************************************************* -# Copyright (C) 2007 Novell, Inc. All rights reserved. +# Copyright (C) 2007,2008 Novell, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -599,9 +599,138 @@ ## end of class OMC_HostNameSettingDataProvider + +class OMC_ComputerSystemHostNameSettingDataProvider(pywbem.CIMProvider): + """Instrument the CIM class OMC_ComputerSystemHostNameSettingData + + OMC_ComputerSystemSettingData is associates the computer name setting + with the computer system + + """ + def get_hnsd_path(self, ns): + hnsd = pywbem.CIMInstanceName(classname = 'OMC_HostNameSettingData', \ + namespace=ns, \ + keybindings={'InstanceID':'omc:computername'}) + return hnsd + + def get_cs_path(self, ns): + cs_path = pywbem.CIMInstanceName(classname='OMC_UnitaryComputerSystem', \ + namespace=ns, \ + keybindings={'CreationClassName':'OMC_UnitaryComputerSystem', \ + 'Name': getfqdn() }) + return cs_path + + def __init__ (self, env): + logger = env.get_logger() + logger.log_debug('Initializing provider %s from %s' \ + % (self.__class__.__name__, __file__)) + # If you will be filtering instances yourself according to + # property_list, role, result_role, and result_class_name + # parameters, set self.filter_results to False + # self.filter_results = False + + def get_instance(self, env, model, cim_class): + logger = env.get_logger() + logger.log_debug('Entering %s.get_instance()' \ + % self.__class__.__name__) + + if model['SettingData']['InstanceID'] == 'omc:computername' and \ + model['ManagedElement']['Name'] == getfqdn() and \ + model['ManagedElement']['CreationClassName'] == 'OMC_UnitaryComputerSystem': + + ux = model.update_existing + + # SettingData has additional fields on it + # These are not applicable for HostNameSettingData + # We'll set the IsCurrent and isDefault to TRUE, but ignore others + ux(IsCurrent=self.Values.IsCurrent.Is_Current) + ux(IsDefault=self.Values.IsDefault.Is_Default) + return model + + def enum_instances(self, env, model, cim_class, keys_only): + logger = env.get_logger() + logger.log_debug('Entering %s.enum_instances()' \ + % self.__class__.__name__) + + #one and only one instance? + + model['SettingData'] = self.get_hnsd_path(model.path.namespace) + model['ManagedElement'] = self.get_cs_path(model.path.namespace) + yield model + + def set_instance(self, env, instance, previous_instance, cim_class): + raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) + + def delete_instance(self, env, instance_name): + raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) + + def references(self, env, object_name, model, assoc_class, + result_class_name, role, result_role, keys_only): + logger = env.get_logger() + logger.log_debug('Entering %s.references()' \ + % self.__class__.__name__) + ch = env.get_cimom_handle() + # This is a common pattern. YMMV + if (not role or role.lower() == 'settingdata') and \ + pywbem.is_subclass(ch, object_name.namespace, + sub=object_name.classname, + super='OMC_HostNameSettingData'): + if object_name['InstanceID'] == 'omc:computername': + model['SettingData'] = object_name + model['ManagedElement']= self.get_cs_path(model.path.namespace) + yield model + + if (not role or role.lower() == 'managedelement') and \ + pywbem.is_subclass(ch, object_name.namespace, + sub=object_name.classname, + super='OMC_UnitaryComputerSystem'): + if object_name['Name'] == getfqdn() and \ + object_name['CreationClassName'] == 'OMC_UnitaryComputerSystem': + model['ManagedElement'] = object_name + model['SettingData'] = self.get_hnsd_path(model.path.namespace) + yield model + + class Values(object): + class IsDefault(object): + Unknown = pywbem.Uint16(0) + Is_Default = pywbem.Uint16(1) + Is_Not_Default = pywbem.Uint16(2) + + class IsMaximum(object): + Unknown = pywbem.Uint16(0) + Not_Applicable = pywbem.Uint16(1) + Is_Maximum = pywbem.Uint16(2) + Is_Not_Maximum = pywbem.Uint16(3) + + class IsMinimum(object): + Unknown = pywbem.Uint16(0) + Not_Applicable = pywbem.Uint16(1) + Is_Minimum = pywbem.Uint16(2) + Is_Not_Minimum = pywbem.Uint16(3) + + class IsCurrent(object): + Unknown = pywbem.Uint16(0) + Is_Current = pywbem.Uint16(1) + Is_Not_Current = pywbem.Uint16(2) + + class IsNext(object): + Unknown = pywbem.Uint16(0) + Is_Next = pywbem.Uint16(1) + Is_Not_Next = pywbem.Uint16(2) + Is_Next_For_Single_Use = pywbem.Uint16(3) + +## end of class OMC_ComputerSystemHostNameSettingDataProvider + + + def get_providers(env): # register provider omc_hostnamesettingdata_prov = OMC_HostNameSettingDataProvider(env) omc_unitarycomputersystem_prov = OMC_UnitaryComputerSystemProvider() + omc_computersystemhostnamesettingdata_prov = OMC_ComputerSystemHostNameSettingDataProvider(env) return {'OMC_UnitaryComputerSystem': omc_unitarycomputersystem_prov, - 'OMC_HostNameSettingData': omc_hostnamesettingdata_prov} + 'OMC_HostNameSettingData': omc_hostnamesettingdata_prov, + 'OMC_ComputerSystemHostNameSettingData': omc_computersystemhostnamesettingdata_prov} + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-02-14 03:50:03
|
Revision: 536 http://omc.svn.sourceforge.net/omc/?rev=536&view=rev Author: bartw Date: 2008-02-13 19:50:09 -0800 (Wed, 13 Feb 2008) Log Message: ----------- fixed FileIdentity assoc. to not require all of the keys of the target object Modified Paths: -------------- pybase/trunk/OMC_LogicalFile.py Modified: pybase/trunk/OMC_LogicalFile.py =================================================================== --- pybase/trunk/OMC_LogicalFile.py 2008-02-13 20:18:47 UTC (rev 535) +++ pybase/trunk/OMC_LogicalFile.py 2008-02-14 03:50:09 UTC (rev 536) @@ -713,29 +713,39 @@ if object_name.classname.lower() == 'omc_linuxfile': model['SameElement'] = object_name + try: + keybindings = { + 'Name':object_name['LFName'], + 'FSName':object_name['FSName'], + 'FSCreationClassName':object_name['FSCreationClassName'], + 'CSName':getfqdn(), + 'CSCreationClassName':object_name['CSCreationClassName'], + 'CreationClassName':object_name['LFCreationClassName']} + except KeyError: + keybindings = {} + get_file_keys(object_name['LFname'], keybindings) model['SystemElement'] = pywbem.CIMInstanceName( classname=object_name['LFCreationClassName'], namespace=object_name.namespace, - keybindings={ - 'Name':object_name['LFName'], - 'FSName':object_name['FSName'], - 'FSCreationClassName':object_name['FSCreationClassName'], - 'CSName':getfqdn(), - 'CSCreationClassName':object_name['CSCreationClassName'], - 'CreationClassName':object_name['LFCreationClassName']}) + keybindings=keybindings) yield model else: model['SystemElement'] = object_name - model['SameElement'] = pywbem.CIMInstanceName( - classname='OMC_LinuxFile', - namespace=object_name.namespace, - keybindings={ + try: + keybindings = { 'LFName':object_name['Name'], 'FSName':object_name['FSName'], 'FSCreationClassName':object_name['FSCreationClassName'], 'CSName':getfqdn(), 'CSCreationClassName':object_name['CSCreationClassName'], - 'LFCreationClassName':object_name['CreationClassName']}) + 'LFCreationClassName':object_name['CreationClassName']} + except KeyError: + keybindings = {} + get_file_keys(object_name['Name'], keybindings, linux_file=True) + model['SameElement'] = pywbem.CIMInstanceName( + classname='OMC_LinuxFile', + namespace=object_name.namespace, + keybindings=keybindings) yield model This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-02-13 20:18:43
|
Revision: 535 http://omc.svn.sourceforge.net/omc/?rev=535&view=rev Author: bartw Date: 2008-02-13 12:18:47 -0800 (Wed, 13 Feb 2008) Log Message: ----------- minor fix Modified Paths: -------------- pybase/trunk/OMC_LogicalFile.py Modified: pybase/trunk/OMC_LogicalFile.py =================================================================== --- pybase/trunk/OMC_LogicalFile.py 2008-01-07 17:49:30 UTC (rev 534) +++ pybase/trunk/OMC_LogicalFile.py 2008-02-13 20:18:47 UTC (rev 535) @@ -541,6 +541,8 @@ dirs = ['/' + dir for dir in os.listdir('/')] for dir in ['/'] + dirs: stat = os.lstat(dir) + if not S_ISDIR(stat.st_mode): + continue get_file_keys(dir, model, stat=stat) if keys_only: yield model This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-01-07 17:49:31
|
Revision: 534 http://omc.svn.sourceforge.net/omc/?rev=534&view=rev Author: jcarey Date: 2008-01-07 09:49:30 -0800 (Mon, 07 Jan 2008) Log Message: ----------- Implemented Enum instances/get instance for OMC_HostNameSettingData. Still need to take care of set_instance Modified Paths: -------------- pybase/trunk/OMC_UnitaryComputerSystem-ow.reg pybase/trunk/OMC_UnitaryComputerSystem-peg.reg pybase/trunk/OMC_UnitaryComputerSystem.py Modified: pybase/trunk/OMC_UnitaryComputerSystem-ow.reg =================================================================== --- pybase/trunk/OMC_UnitaryComputerSystem-ow.reg 2008-01-07 16:01:10 UTC (rev 533) +++ pybase/trunk/OMC_UnitaryComputerSystem-ow.reg 2008-01-07 17:49:30 UTC (rev 534) @@ -1,9 +1,18 @@ // Provider registration for OMC_UnitaryComputerSystem instance of OpenWBEM_PyProviderRegistration { - InstanceID = "OMC:OMC_UnitaryComputerSystem:01"; - NamespaceNames = {"root/cimv2"}; - ClassName = "OMC_UnitaryComputerSystem"; - ProviderTypes = {1,6}; // Instance, Method - ModulePath = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py"; + InstanceID = "OMC:OMC_UnitaryComputerSystem:01"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_UnitaryComputerSystem"; + ProviderTypes = {1,6}; // Instance, Method + ModulePath = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py"; }; + +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "OMC:OMC_UnitaryComputerSystem:02"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_HostNameSettingData"; + ProviderTypes = {1}; // Instance + ModulePath = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py"; +}; Modified: pybase/trunk/OMC_UnitaryComputerSystem-peg.reg =================================================================== --- pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2008-01-07 16:01:10 UTC (rev 533) +++ pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2008-01-07 17:49:30 UTC (rev 534) @@ -26,4 +26,15 @@ ProviderType = {2,5}; // Instance, Method }; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_HostNameSettingData"; + ProviderModuleName = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py"; + ProviderName = "OMC_UnitaryComputerSystem"; + ClassName = "OMC_HostNameSettingData"; + Namespaces = {"root/cimv2"}; + ProviderType = {2}; // Instance +}; + + Modified: pybase/trunk/OMC_UnitaryComputerSystem.py =================================================================== --- pybase/trunk/OMC_UnitaryComputerSystem.py 2008-01-07 16:01:10 UTC (rev 533) +++ pybase/trunk/OMC_UnitaryComputerSystem.py 2008-01-07 17:49:30 UTC (rev 534) @@ -536,7 +536,72 @@ ## end of class OMC_UnitaryComputerSystemProvider +class OMC_HostNameSettingDataProvider(pywbem.CIMProvider): + """Instrument the CIM class OMC_HostNameSettingData""" + + def __init__ (self, env): + logger = env.get_logger() + logger.log_debug('Initializing provider %s from %s' \ + % (self.__class__.__name__, __file__)) + # If you will be filtering instances yourself according to + # property_list, role, result_role, and result_class_name + # parameters, set self.filter_results to False + # self.filter_results = False + + def get_instance(self, env, model, cim_class): + logger = env.get_logger() + logger.log_debug('Entering %s.get_instance()' \ + % self.__class__.__name__) + try: + iid = model['InstanceID'] + except KeyError: + raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) + if iid.lower() != 'omc:computername': + raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) + model['ComputerName'] = getfqdn() + return model + + def enum_instances(self, env, model, cim_class, keys_only): + logger = env.get_logger() + logger.log_debug('Entering %s.enum_instances()' \ + % self.__class__.__name__) + model['InstanceID'] = 'omc:computername' + if not keys_only: + model['ComputerName'] = getfqdn() + yield model + + def set_instance(self, env, instance, previous_instance, cim_class): + logger = env.get_logger() + logger.log_debug('Entering %s.set_instance()' \ + % self.__class__.__name__) + if not previous_instance: + ci = instance + else: + for k,v in instance.properties.items(): + previous_instance[k] = v + ci = previous_instance + try: + iid = ci['InstanceID'] + except KeyError: + raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) + if iid.lower() != 'omc:computername': + raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) + + # TODO: Modify computer name + # Modify /etc/hosts + # Modify /etc/HOSTNAME + # Excecute /bin/hostname .... + raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement + return instance + + def delete_instance(self, env, instance_name): + raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) + +## end of class OMC_HostNameSettingDataProvider + def get_providers(env): # register provider - _omc_unitarycomputersystem_prov = OMC_UnitaryComputerSystemProvider() - return {'OMC_UnitaryComputerSystem': _omc_unitarycomputersystem_prov} + omc_hostnamesettingdata_prov = OMC_HostNameSettingDataProvider(env) + omc_unitarycomputersystem_prov = OMC_UnitaryComputerSystemProvider() + return {'OMC_UnitaryComputerSystem': omc_unitarycomputersystem_prov, + 'OMC_HostNameSettingData': omc_hostnamesettingdata_prov} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-01-07 16:01:10
|
Revision: 533 http://omc.svn.sourceforge.net/omc/?rev=533&view=rev Author: jcarey Date: 2008-01-07 08:01:10 -0800 (Mon, 07 Jan 2008) Log Message: ----------- Registration adjustements Modified Paths: -------------- pybase/trunk/OMC_UnixProcess-peg.reg Added Paths: ----------- pybase/trunk/OMC_TimeService-ow.reg Removed Paths: ------------- pybase/trunk/OMC_TimeService.reg Added: pybase/trunk/OMC_TimeService-ow.reg =================================================================== --- pybase/trunk/OMC_TimeService-ow.reg (rev 0) +++ pybase/trunk/OMC_TimeService-ow.reg 2008-01-07 16:01:10 UTC (rev 533) @@ -0,0 +1,66 @@ +// OpenWBEM Provider registration for OMC_TimeService +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "OMC_TimeService:0001"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_SystemTimeService"; + ProviderTypes = {1,6}; // Instance, Method + ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; +}; + +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "OMC_TimeService:0002"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_RemoteTimeServicePort"; + ProviderTypes = {1,6}; // Instance, Method + ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; +}; + +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "OMC_TimeService:0003"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_TimeZoneSettingData"; + ProviderTypes = {1}; // Instance + ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; +}; + +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "OMC_TimeService:0004"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_HostedTimeService"; + ProviderTypes = {1,3}; // Instance, Associator + ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; +}; + +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "OMC_TimeService:0005"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_TimeServiceAccessBySAP"; + ProviderTypes = {1,3}; // Instance, Associator + ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; +}; + +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "OMC_TimeService:0006"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_TimeServiceTimeZoneSettingData"; + ProviderTypes = {1,3}; // Instance, Associator + ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; +}; + +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "OMC_TimeService:0007"; + NamespaceNames = {"root/cimv2"}; + ClassName = "OMC_TimeServiceAvailableToElement"; + ProviderTypes = {1,3}; // Instance, Associator + ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; +}; + + + Deleted: pybase/trunk/OMC_TimeService.reg =================================================================== --- pybase/trunk/OMC_TimeService.reg 2007-12-31 23:22:18 UTC (rev 532) +++ pybase/trunk/OMC_TimeService.reg 2008-01-07 16:01:10 UTC (rev 533) @@ -1,66 +0,0 @@ -// OpenWBEM Provider registration for OMC_TimeService -instance of OpenWBEM_PyProviderRegistration -{ - InstanceID = "OMC_TimeService:0001"; - NamespaceNames = {"root/cimv2"}; - ClassName = "OMC_SystemTimeService"; - ProviderTypes = {1,6}; // Instance, Method - ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; -}; - -instance of OpenWBEM_PyProviderRegistration -{ - InstanceID = "OMC_TimeService:0002"; - NamespaceNames = {"root/cimv2"}; - ClassName = "OMC_RemoteTimeServicePort"; - ProviderTypes = {1,6}; // Instance, Method - ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; -}; - -instance of OpenWBEM_PyProviderRegistration -{ - InstanceID = "OMC_TimeService:0003"; - NamespaceNames = {"root/cimv2"}; - ClassName = "OMC_TimeZoneSettingData"; - ProviderTypes = {1}; // Instance - ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; -}; - -instance of OpenWBEM_PyProviderRegistration -{ - InstanceID = "OMC_TimeService:0004"; - NamespaceNames = {"root/cimv2"}; - ClassName = "OMC_HostedTimeService"; - ProviderTypes = {1,3}; // Instance, Associator - ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; -}; - -instance of OpenWBEM_PyProviderRegistration -{ - InstanceID = "OMC_TimeService:0005"; - NamespaceNames = {"root/cimv2"}; - ClassName = "OMC_TimeServiceAccessBySAP"; - ProviderTypes = {1,3}; // Instance, Associator - ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; -}; - -instance of OpenWBEM_PyProviderRegistration -{ - InstanceID = "OMC_TimeService:0006"; - NamespaceNames = {"root/cimv2"}; - ClassName = "OMC_TimeServiceTimeZoneSettingData"; - ProviderTypes = {1,3}; // Instance, Associator - ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; -}; - -instance of OpenWBEM_PyProviderRegistration -{ - InstanceID = "OMC_TimeService:0007"; - NamespaceNames = {"root/cimv2"}; - ClassName = "OMC_TimeServiceAvailableToElement"; - ProviderTypes = {1,3}; // Instance, Associator - ModulePath = "/usr/lib/pycim/OMC_TimeService.py"; -}; - - - Modified: pybase/trunk/OMC_UnixProcess-peg.reg =================================================================== --- pybase/trunk/OMC_UnixProcess-peg.reg 2007-12-31 23:22:18 UTC (rev 532) +++ pybase/trunk/OMC_UnixProcess-peg.reg 2008-01-07 16:01:10 UTC (rev 533) @@ -1,25 +1,24 @@ -//////// OMC_UnixProcess instance of PG_ProviderModule { - Name = "/usr/lib/pycim/OMC_UnixProcess.py"; + Name = "OMC_UnixProcessProvider_Module"; InterfaceType = "Python"; InterfaceVersion = "1.0.0"; Location = "/usr/lib/pycim/OMC_UnixProcess.py"; UserContext = 2; // Requestor Vendor = "OMC"; - Version = "0.1.0"; + Version = "1.0"; }; instance of PG_Provider { Name = "OMC_UnixProcess"; - ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py"; + ProviderModuleName = "OMC_UnixProcessProvider_Module"; }; instance of PG_ProviderCapabilities { CapabilityID = "OMC_UnixProcess"; - ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py"; + ProviderModuleName = "OMC_UnixProcessProvider_Module"; ProviderName = "OMC_UnixProcess"; ClassName = "OMC_UnixProcess"; Namespaces = {"root/cimv2"}; @@ -29,7 +28,7 @@ instance of PG_ProviderCapabilities { CapabilityID = "OMC_ProcessExecutable"; - ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py"; + ProviderModuleName = "OMC_UnixProcessProvider_Module"; ProviderName = "OMC_UnixProcess"; ClassName = "OMC_ProcessExecutable"; Namespaces = {"root/cimv2"}; @@ -39,7 +38,7 @@ instance of PG_ProviderCapabilities { CapabilityID = "OMC_OSProcess"; - ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py"; + ProviderModuleName = "OMC_UnixProcessProvider_Module"; ProviderName = "OMC_UnixProcess"; ClassName = "OMC_OSProcess"; Namespaces = {"root/cimv2"}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |