def test_hw_info(self): self.output = sample('areca_hw_info') self.assertEqual(areca.hw_info(), {'Enclosure1/12V': '12.220', 'Enclosure1/12V/unit': 'V', 'Enclosure1/3.3V': '3.328', 'Enclosure1/3.3V/unit': 'V', 'Enclosure1/5V': '5.134', 'Enclosure1/5V/unit': 'V', 'Enclosure1/BatteryStatus': 100, 'Enclosure1/BatteryStatus/unit': '%', 'Enclosure1/ControllerTemp.': 37, 'Enclosure1/ControllerTemp./unit': 'C', 'Enclosure1/Cpu+1.2V': '1.216', 'Enclosure1/Cpu+1.2V/unit': 'V', 'Enclosure1/Cpu+1.8V': '1.856', 'Enclosure1/Cpu+1.8V/unit': 'V', 'Enclosure1/CpuFan': 2596, 'Enclosure1/CpuFan/unit': 'RPM', 'Enclosure1/CpuTemperature': 39, 'Enclosure1/CpuTemperature/unit': 'C', 'Enclosure1/Ddr-Ii+0.9V': '0.912', 'Enclosure1/Ddr-Ii+0.9V/unit': 'V', 'Enclosure1/Ddr-Ii+1.8V': '1.856', 'Enclosure1/Ddr-Ii+1.8V/unit': 'V', 'Enclosure1/Pci-E+1.8V': '1.856', 'Enclosure1/Pci-E+1.8V/unit': 'V'})
def test_hw_info(self): self.output = sample('areca_hw_info') self.assertEqual( areca.hw_info(), { 'Enclosure1/12V': '12.220', 'Enclosure1/12V/unit': 'V', 'Enclosure1/3.3V': '3.328', 'Enclosure1/3.3V/unit': 'V', 'Enclosure1/5V': '5.134', 'Enclosure1/5V/unit': 'V', 'Enclosure1/BatteryStatus': 100, 'Enclosure1/BatteryStatus/unit': '%', 'Enclosure1/ControllerTemp.': 37, 'Enclosure1/ControllerTemp./unit': 'C', 'Enclosure1/Cpu+1.2V': '1.216', 'Enclosure1/Cpu+1.2V/unit': 'V', 'Enclosure1/Cpu+1.8V': '1.856', 'Enclosure1/Cpu+1.8V/unit': 'V', 'Enclosure1/CpuFan': 2596, 'Enclosure1/CpuFan/unit': 'RPM', 'Enclosure1/CpuTemperature': 39, 'Enclosure1/CpuTemperature/unit': 'C', 'Enclosure1/Ddr-Ii+0.9V': '0.912', 'Enclosure1/Ddr-Ii+0.9V/unit': 'V', 'Enclosure1/Ddr-Ii+1.8V': '1.856', 'Enclosure1/Ddr-Ii+1.8V/unit': 'V', 'Enclosure1/Pci-E+1.8V': '1.856', 'Enclosure1/Pci-E+1.8V/unit': 'V' })
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]))