def test_sys_info(self): self.output = sample('areca_sysinfo') self.assertEqual(areca.sys_info(), {'MainProcessor': 800, 'MainProcessor/unit': 'MHz', 'CpuIcacheSize': 32, 'CpuIcacheSize/unit': 'KB', 'CpuDcacheSize': 32, 'CpuDcacheSize/unit': 'KB', 'CpuScacheSize': 512, 'CpuScacheSize/unit': 'KB', 'SystemMemory': '256MB/533MHz/ECC', 'FirmwareVersion': 'V1.49 2011-08-10', 'BootRomVersion': 'V1.49 2010-12-02', 'SerialNumber': 'Y106CABRAR200408', 'ControllerName': 'ARC-1222', 'CurrentIpAddress': '192.168.1.100'})
def detect_areca(hw_lst): 'Detect Areca controller configuration' device = areca.sys_info() if not device: sys.stderr.write('Info: detect_areca: No controller found\n') return if "ControllerName" not in device.keys(): sys.stderr.write('Info: detect_areca: Cannot found controller name\n') return sys.stderr.write('Info: detect_areca: Found %s version %s\n' % (device['ControllerName'], device['FirmwareVersion'])) areca.disable_password() for info in device.keys(): hw_lst.append(('areca', 'system', info, device[info])) adsys = areca.adsys_info() for info in adsys.keys(): hw_lst.append(('areca', 'system', info, adsys[info])) cfg = areca.sys_showcfg() for info in cfg.keys(): hw_lst.append(('areca', 'config', info, cfg[info])) hw_info = areca.hw_info() for info in hw_info.keys(): hw_lst.append(('areca', 'hardware', info, hw_info[info])) pwr_info = areca.hdd_pwr_info() for info in pwr_info.keys(): hw_lst.append(('areca', 'power', info, pwr_info[info])) for disk_number in range(1, 255): disk_info = areca.disk_info(disk_number) # If we don't have info about that disk, let's stop here if len(disk_info) < 2: break # Extracting disk information for info in disk_info: hw_lst.append( ('areca', "disk%d" % disk_number, info, disk_info[info]))
def detect_areca(hw_lst): 'Detect Areca controller configuration' device = areca.sys_info() if not device: sys.stderr.write('Info: detect_areca: No controller found\n') return if "ControllerName" not in device.keys(): sys.stderr.write('Info: detect_areca: Cannot found controller name\n') return sys.stderr.write('Info: detect_areca: Found %s version %s\n' % (device['ControllerName'], device['FirmwareVersion'])) areca.disable_password() for info in device.keys(): hw_lst.append(('areca', 'system', info, device[info])) adsys = areca.adsys_info() for info in adsys.keys(): hw_lst.append(('areca', 'system', info, adsys[info])) cfg = areca.sys_showcfg() for info in cfg.keys(): hw_lst.append(('areca', 'config', info, cfg[info])) hw_info = areca.hw_info() for info in hw_info.keys(): hw_lst.append(('areca', 'hardware', info, hw_info[info])) pwr_info = areca.hdd_pwr_info() for info in pwr_info.keys(): hw_lst.append(('areca', 'power', info, pwr_info[info])) for disk_number in range(1, 255): disk_info = areca.disk_info(disk_number) # If we don't have info about that disk, let's stop here if len(disk_info) < 2: break # Extracting disk information for info in disk_info: hw_lst.append(('areca', "disk%d" % disk_number, info, disk_info[info]))