Exemple #1
0
    def test_read_smart_ata(self, mock_popen):
        hwlst = []
        fake_output = sample('smartctl_ata').splitlines()
        mock_popen.return_value = mock.Mock(stdout=fake_output)
        smart_utils.read_smart_ata(hwlst, 'fake')

        self.assertEqual(hwlst, smart_utils_results.read_smart_ata_result())
    def test_detect_auxv_ppc8_succeed(self, mock_environ_copy, mock_popen):
        test_data = {
            'AT_HWCAP':
            ('hwcap', 'true_le archpmu vsx arch_2_06 dfp ic_snoop smt '
             'mmu fpu altivec ppc64 ppc32'),
            'AT_HWCAP2': ('hwcap2', 'htm-nosc vcrypto tar isel ebb dscr '
                          'htm arch_2_07'),
            'AT_PAGESZ': ('pagesz', '65536'),
            'AT_FLAGS': ('flags', '0x0'),
            'AT_PLATFORM': ('platform', 'power8'),
            'AT_BASE_PLATFORM': ('base_platform', 'power8'),
        }

        process_mock = mock.Mock()
        attrs = {
            'communicate.return_value':
            (sample('auxv_ppc8').encode('utf-8'), None)
        }
        process_mock.configure_mock(**attrs)
        mock_popen.return_value = process_mock

        hw = detect_utils.detect_auxv()

        ppc_flags = detect_utils.AUXV_FLAGS + detect_utils.AUXV_OPT_FLAGS
        for k in ppc_flags:
            t = ('hw', 'auxv', test_data[k][0], test_data[k][1])
            self.assertIn(t, hw)
Exemple #3
0
 def test_ld_get_info(self):
     self.output = sample('megacli_ld_get_info')
     self.assertEqual(megacli.ld_get_info(0, 0),
                      {'Adapter0--VirtualDriveInformation': '',
                       'BadBlocksExist': 'No',
                       'CacheCadeType': 'Read Only',
                       'CanSpinUpIn1Minute': 'Yes',
                       'CurrentAccessPolicy': 'Read/Write',
                       'CurrentCachePolicy':
                       'WriteBack, ReadAdaptive, Direct, '
                       'No Write Cache if Bad BBU',
                       'CurrentPowerSavingsPolicy': 'None',
                       'DefaultAccessPolicy': 'Read/Write',
                       'DefaultCachePolicy': 'WriteBack, ReadAdaptive, '
                       'Direct, No Write Cache if Bad BBU',
                       'DefaultPowerSavingsPolicy': 'Controller Defined',
                       'DiskCachePolicy': "Disk's Default",
                       'EncryptionType': 'None',
                       'IsVdCached': 'Yes',
                       "Ld'SIoProfileSupportsMaxPowerSavings"
                       "WithCachedWrites": 'No',
                       'LdHasDrivesThatSupportT10PowerConditions': 'No',
                       'MirrorData': '465.25 GB',
                       'Name': '',
                       'NumberOfDrives': 2,
                       'RaidLevel': 'Primary-1, Secondary-0, RAID Level '
                       'Qualifier-0',
                       'SectorSize': 512,
                       'Size': '465.25 GB',
                       'SpanDepth': 1,
                       'State': 'Optimal',
                       'StripSize': '64 KB'})
Exemple #4
0
    def test_read_smart_scsi(self, mock_popen):
        hwlst = []
        fake_output = sample('smartctl_scsi').splitlines()
        mock_popen.return_value = mock.Mock(stdout=fake_output)
        smart_utils.read_smart_scsi(hwlst, 'fake')

        self.assertEqual(hwlst, smart_utils_results.READ_SMART_SCSI_RESULT)
Exemple #5
0
    def test_read_smart_nvme(self, mock_popen, mock_os_path_exists):
        hwlst = []
        fake_output = sample('smartctl_nvme', mode='rb').splitlines()
        mock_popen.return_value = mock.Mock(stdout=fake_output)
        smart_utils.read_smart_nvme(hwlst, 'fake_nvme')

        self.assertEqual(hwlst, smart_utils_results.READ_SMART_NVME_RESULT)
Exemple #6
0
 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'
         })
Exemple #7
0
 def test_hddpwr_info(self):
     self.output = sample('areca_hddpwr_info')
     self.assertEqual(areca.hdd_pwr_info(),
                      {'StaggerPowerOnControl': '0.7',
                       'TimeToHddLowPowerIdle': 'Disabled',
                       'TimeToHddLowRpmMode': 'Disabled',
                       'TimeToSpinDownIdleHdd': 'Disabled'})
Exemple #8
0
 def test_adsys_info(self):
     self.output = sample('areca_adsysinfo')
     self.assertEqual(
         areca.adsys_info(), {
             'TlerSetting': 7,
             'TlerSetting/unit': 'Seconds',
             'TimeoutSetting': 8,
             'TimeoutSetting/unit': 'Seconds',
             'RetryCountSetting': 2,
             'RetryCountSetting/unit': 'Times',
             'BufferThreshold': 25,
             'BufferThreshold/unit': '%',
             'AmountOfReadAhead': 'Auto',
             'NumberOfAvStreams': 6,
             'OptimizeAvRecoding': 'Disabled',
             'PhyStatus': 'Default',
             'ReadPerformanceMargin': 0,
             'ReadPerformanceMargin/unit': '%',
             'WritePerformanceMargin': 0,
             'WritePerformanceMargin/unit': '%',
             'ReadAndDiscardParityData': 'Disabled',
             'HitachiSataHddSpeed': 'Default',
             'WdcSataHddSpeed': 'Default',
             'SeagateSataHddSpeed': 'Default'
         })
Exemple #9
0
 def test_hddpwr_info(self):
     self.output = sample('areca_hddpwr_info')
     self.assertEqual(areca.hdd_pwr_info(),
                      {'StaggerPowerOnControl': '0.7',
                       'TimeToHddLowPowerIdle': 'Disabled',
                       'TimeToHddLowRpmMode': 'Disabled',
                       'TimeToSpinDownIdleHdd': 'Disabled'})
Exemple #10
0
 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'})
Exemple #11
0
 def test_ld_get_info(self):
     self.output = sample('megacli_ld_get_info')
     self.assertEqual(megacli.ld_get_info(0, 0),
                      {'Adapter0--VirtualDriveInformation': '',
                       'BadBlocksExist': 'No',
                       'CacheCadeType': 'Read Only',
                       'CanSpinUpIn1Minute': 'Yes',
                       'CurrentAccessPolicy': 'Read/Write',
                       'CurrentCachePolicy':
                       'WriteBack, ReadAdaptive, Direct, '
                       'No Write Cache if Bad BBU',
                       'CurrentPowerSavingsPolicy': 'None',
                       'DefaultAccessPolicy': 'Read/Write',
                       'DefaultCachePolicy': 'WriteBack, ReadAdaptive, '
                       'Direct, No Write Cache if Bad BBU',
                       'DefaultPowerSavingsPolicy': 'Controller Defined',
                       'DiskCachePolicy': "Disk's Default",
                       'EncryptionType': 'None',
                       'IsVdCached': 'Yes',
                       "Ld'SIoProfileSupportsMaxPowerSavings"
                       "WithCachedWrites": 'No',
                       'LdHasDrivesThatSupportT10PowerConditions': 'No',
                       'MirrorData': '465.25 GB',
                       'Name': '',
                       'NumberOfDrives': 2,
                       'RaidLevel': 'Primary-1, Secondary-0, RAID Level '
                       'Qualifier-0',
                       'SectorSize': 512,
                       'Size': '465.25 GB',
                       'SpanDepth': 1,
                       'State': 'Optimal',
                       'StripSize': '64 KB'})
Exemple #12
0
    def test_read_smart_ata_hdd(self, mock_popen):
        hwlst = []
        fake_output = sample('smartctl_ata_hdd', mode='rb').splitlines()
        mock_popen.return_value = mock.Mock(stdout=fake_output)
        smart_utils.read_smart_ata(hwlst, 'fake')

        self.assertEqual(hwlst, smart_utils_results.READ_SMART_ATA_HDD_RESULT)
Exemple #13
0
    def test_read_smart_call_smart_ata(self, mock_popen, mock_os_path_exists,
                                       mock_ata, mock_which):
        hwlst = []
        fake_output = sample('smartctl_ata').splitlines()
        mock_popen.return_value = mock.Mock(stdout=fake_output)
        smart_utils.read_smart(hwlst, 'fake')

        mock_ata.assert_called()
Exemple #14
0
    def test_read_smart_call_smart_scsi(self, mock_popen, mock_os_path_exists,
                                        mock_scsi):
        hwlst = []
        fake_output = sample('smartctl_scsi', mode='rb').splitlines()
        mock_popen.return_value = mock.Mock(stdout=fake_output)
        smart_utils.read_smart(hwlst, 'fake')

        mock_scsi.assert_called()
Exemple #15
0
 def test_adp_all_info(self):
     self.output = sample('megacli_adp_all_info')
     self.assertEqual(megacli.adp_all_info(0),
                      {'CriticalDisks': 0,
                       'Degraded': 0,
                       'Disks': 6,
                       'FwPackageBuild': '21.1.0-0007',
                       'FailedDisks': 0,
                       'Offline': 0,
                       'PhysicalDevices': 7,
                       'ProductName': 'PERC H710 Mini',
                       'SerialNo': '29F026R',
                       'VirtualDrives': 1})
Exemple #16
0
 def test_adp_all_info(self):
     self.output = sample('megacli_adp_all_info')
     self.assertEqual(megacli.adp_all_info(0),
                      {'CriticalDisks': 0,
                       'Degraded': 0,
                       'Disks': 6,
                       'FwPackageBuild': '21.1.0-0007',
                       'FailedDisks': 0,
                       'Offline': 0,
                       'PhysicalDevices': 7,
                       'ProductName': 'PERC H710 Mini',
                       'SerialNo': '29F026R',
                       'VirtualDrives': 1})
Exemple #17
0
 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'})
Exemple #18
0
 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'})
Exemple #19
0
 def test_detect_system_3(self, mock_cmd, mock_get_uuid, mock_get_cpus, mock_output_lines):
     result = []
     detect.detect_system(result, sample('lshw3'))
     self.assertEqual(
         result,
         [('system', 'product', 'serial', 'Empty'),
          ('system', 'product', 'name', 'S2915'),
          ('system', 'product', 'vendor', 'Tyan Computer Corporation'),
          ('system', 'product', 'version', 'REFERENCE'),
          ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
          ('system', 'motherboard', 'name', 'S2915'),
          ('system', 'motherboard', 'vendor', 'Tyan Computer Corporation'),
          ('system', 'motherboard', 'version', 'REFERENCE'),
          ('system', 'motherboard', 'serial', 'Empty'),
          ('firmware', 'bios', 'version', 'v3.00.2915 (10/10/2008)'),
          ('firmware', 'bios', 'vendor', 'Phoenix Technologies Ltd.'),
          ('memory', 'total', 'size', '4294967296'),
          ('memory', 'bank:0:0', 'description', 'DIMM Synchronous [empty]'),
          ('memory', 'bank:0:0', 'slot', 'C0_DIMM0'),
          ('memory', 'bank:0:1', 'description', 'DIMM Synchronous [empty]'),
          ('memory', 'bank:0:1', 'slot', 'C0_DIMM1'),
          ('memory', 'bank:0:2', 'size', '1073741824'),
          ('memory', 'bank:0:2', 'description', 'DIMM Synchronous'),
          ('memory', 'bank:0:2', 'slot', 'C0_DIMM2'),
          ('memory', 'bank:0:3', 'size', '1073741824'),
          ('memory', 'bank:0:3', 'description', 'DIMM Synchronous'),
          ('memory', 'bank:0:3', 'slot', 'C0_DIMM3'),
          ('memory', 'bank:0:4', 'description', 'DIMM Synchronous [empty]'),
          ('memory', 'bank:0:4', 'slot', 'C0_DIMM0'),
          ('memory', 'bank:0:5', 'description', 'DIMM Synchronous [empty]'),
          ('memory', 'bank:0:5', 'slot', 'C1_DIMM1'),
          ('memory', 'bank:0:6', 'size', '1073741824'),
          ('memory', 'bank:0:6', 'description', 'DIMM Synchronous'),
          ('memory', 'bank:0:6', 'slot', 'C1_DIMM2'),
          ('memory', 'bank:0:7', 'size', '1073741824'),
          ('memory', 'bank:0:7', 'description', 'DIMM Synchronous'),
          ('memory', 'bank:0:7', 'slot', 'C1_DIMM3'),
          ('memory', 'banks', 'count', '8'),
          ('system', 'os', 'vendor', 'Ubuntu'),
          ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
          ('system', 'kernel', 'version', '3.13.0-24-generic'),
          ('system', 'kernel', 'arch', 'x86_64'),
          ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
          ]
     )
 def test_detect_system_3(self, mock_cmd, mock_get_uuid, mock_get_cpus,
                          mock_output_lines):
     result = []
     detect.detect_system(result, sample('lshw3'))
     self.assertEqual(result, [
         ('system', 'product', 'serial', 'Empty'),
         ('system', 'product', 'name', 'S2915'),
         ('system', 'product', 'vendor', 'Tyan Computer Corporation'),
         ('system', 'product', 'version', 'REFERENCE'),
         ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
         ('system', 'motherboard', 'name', 'S2915'),
         ('system', 'motherboard', 'vendor', 'Tyan Computer Corporation'),
         ('system', 'motherboard', 'version', 'REFERENCE'),
         ('system', 'motherboard', 'serial', 'Empty'),
         ('firmware', 'bios', 'version', 'v3.00.2915 (10/10/2008)'),
         ('firmware', 'bios', 'vendor', 'Phoenix Technologies Ltd.'),
         ('memory', 'total', 'size', '4294967296'),
         ('memory', 'bank:0:0', 'description', 'DIMM Synchronous [empty]'),
         ('memory', 'bank:0:0', 'slot', 'C0_DIMM0'),
         ('memory', 'bank:0:1', 'description', 'DIMM Synchronous [empty]'),
         ('memory', 'bank:0:1', 'slot', 'C0_DIMM1'),
         ('memory', 'bank:0:2', 'size', '1073741824'),
         ('memory', 'bank:0:2', 'description', 'DIMM Synchronous'),
         ('memory', 'bank:0:2', 'slot', 'C0_DIMM2'),
         ('memory', 'bank:0:3', 'size', '1073741824'),
         ('memory', 'bank:0:3', 'description', 'DIMM Synchronous'),
         ('memory', 'bank:0:3', 'slot', 'C0_DIMM3'),
         ('memory', 'bank:0:4', 'description', 'DIMM Synchronous [empty]'),
         ('memory', 'bank:0:4', 'slot', 'C0_DIMM0'),
         ('memory', 'bank:0:5', 'description', 'DIMM Synchronous [empty]'),
         ('memory', 'bank:0:5', 'slot', 'C1_DIMM1'),
         ('memory', 'bank:0:6', 'size', '1073741824'),
         ('memory', 'bank:0:6', 'description', 'DIMM Synchronous'),
         ('memory', 'bank:0:6', 'slot', 'C1_DIMM2'),
         ('memory', 'bank:0:7', 'size', '1073741824'),
         ('memory', 'bank:0:7', 'description', 'DIMM Synchronous'),
         ('memory', 'bank:0:7', 'slot', 'C1_DIMM3'),
         ('memory', 'banks', 'count', '8'),
         ('system', 'os', 'vendor', 'Ubuntu'),
         ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
         ('system', 'kernel', 'version', '3.13.0-24-generic'),
         ('system', 'kernel', 'arch', 'x86_64'),
         ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
     ])
Exemple #21
0
 def test_diskinfo(self):
     self.output = sample('areca_disks_info')
     self.assertEqual(areca.disk_info(1),
                      {'DeviceLocation': 'Enclosure#1 Slot#8',
                       'DeviceState': 'NORMAL',
                       'DeviceTemperature': 27,
                       'DeviceTemperature/unit': 'C',
                       'DeviceType': 'SATA(5001B4D4188DF017)',
                       'DiskCapacity': '1000.2',
                       'DiskCapacity/unit': 'GB',
                       'FirmwareRev.': 'JP4OA3MA',
                       'MediaErrorCount': 0,
                       'ModelName': 'Hitachi HDS721010CLA330',
                       'SerialNumber': 'JPS930N121H4YV',
                       'SmartCalibrationRetries': 'N.A.(N.A.)',
                       'SmartReadErrorRate': '100(16)',
                       'SmartReallocationCount': '100(5)',
                       'SmartSeekErrorRate': '100(67)',
                       'SmartSpinupRetries': '100(60)',
                       'SmartSpinupTime': '122(24)',
                       'TimeoutCount': 0})
Exemple #22
0
 def test_diskinfo(self):
     self.output = sample('areca_disks_info')
     self.assertEqual(areca.disk_info(1),
                      {'DeviceLocation': 'Enclosure#1 Slot#8',
                       'DeviceState': 'NORMAL',
                       'DeviceTemperature': 27,
                       'DeviceTemperature/unit': 'C',
                       'DeviceType': 'SATA(5001B4D4188DF017)',
                       'DiskCapacity': '1000.2',
                       'DiskCapacity/unit': 'GB',
                       'FirmwareRev.': 'JP4OA3MA',
                       'MediaErrorCount': 0,
                       'ModelName': 'Hitachi HDS721010CLA330',
                       'SerialNumber': 'JPS930N121H4YV',
                       'SmartCalibrationRetries': 'N.A.(N.A.)',
                       'SmartReadErrorRate': '100(16)',
                       'SmartReallocationCount': '100(5)',
                       'SmartSeekErrorRate': '100(67)',
                       'SmartSpinupRetries': '100(60)',
                       'SmartSpinupTime': '122(24)',
                       'TimeoutCount': 0})
Exemple #23
0
 def test_sys_showcfg(self):
     self.output = sample('areca_sys_showcfg')
     self.assertEqual(areca.sys_showcfg(),
                      {'SystemBeeperSetting': 'Enabled',
                       'BackgroundTaskPriority': 'High(80%)',
                       'Jbod/RaidConfiguration': 'JBOD',
                       'SataNcqSupport': 'Enabled',
                       'HddReadAheadCache': 'Enabled',
                       'VolumeDataReadAhead': 'Normal',
                       'HddQueueDepth': 8,
                       'EmptyHddSlotLed': 'ON',
                       'CpuFanDetection': 'Disabled',
                       'SasMuxSetting': 'Auto',
                       'Ses2Support': 'Enabled',
                       'MaxCommandLength': '148K',
                       'AutoActivateIncompleteRaid': 'Disabled',
                       'DiskWriteCacheMode': 'Disabled',
                       'WriteSameForInitialization': 'SAS And SATA',
                       'HotPluggedDiskForRebuilding': 'Blank Disk Only',
                       'DiskCapacityTruncationMode': 'Multiples Of 10G',
                       'SmartOptionForHdd': 'Failed The Drive',
                       'SmartPollingInterval': 'On Demand'})
Exemple #24
0
    def test_detect_auxv_x86_succeed(self, mock_environ_copy, mock_popen):
        test_data = {
            'AT_HWCAP': ('hwcap', 'bfebfbff'),
            'AT_HWCAP2': ('hwcap2', '0x0'),
            'AT_PAGESZ': ('pagesz', '4096'),
            'AT_FLAGS': ('flags', '0x0'),
            'AT_PLATFORM': ('platform', 'x86_64'),
        }

        process_mock = mock.Mock()
        attrs = {'communicate.return_value': (sample('auxv_x86').encode('utf-8'),
                                              None)}
        process_mock.configure_mock(**attrs)
        mock_popen.return_value = process_mock

        hw = []
        detect.detect_auxv(hw)

        # NOTE(mrda): x86 doesn't have AUXV_OPT_FLAGS
        for k in detect.AUXV_FLAGS:
            t = ('hw', 'auxv', test_data[k][0], test_data[k][1])
            self.assertTrue(t in hw)
Exemple #25
0
 def test_sys_showcfg(self):
     self.output = sample('areca_sys_showcfg')
     self.assertEqual(areca.sys_showcfg(),
                      {'SystemBeeperSetting': 'Enabled',
                       'BackgroundTaskPriority': 'High(80%)',
                       'Jbod/RaidConfiguration': 'JBOD',
                       'SataNcqSupport': 'Enabled',
                       'HddReadAheadCache': 'Enabled',
                       'VolumeDataReadAhead': 'Normal',
                       'HddQueueDepth': 8,
                       'EmptyHddSlotLed': 'ON',
                       'CpuFanDetection': 'Disabled',
                       'SasMuxSetting': 'Auto',
                       'Ses2Support': 'Enabled',
                       'MaxCommandLength': '148K',
                       'AutoActivateIncompleteRaid': 'Disabled',
                       'DiskWriteCacheMode': 'Disabled',
                       'WriteSameForInitialization': 'SAS And SATA',
                       'HotPluggedDiskForRebuilding': 'Blank Disk Only',
                       'DiskCapacityTruncationMode': 'Multiples Of 10G',
                       'SmartOptionForHdd': 'Failed The Drive',
                       'SmartPollingInterval': 'On Demand'})
Exemple #26
0
 def test_adsys_info(self):
     self.output = sample('areca_adsysinfo')
     self.assertEqual(areca.adsys_info(),
                      {'TlerSetting': 7,
                       'TlerSetting/unit': 'Seconds',
                       'TimeoutSetting': 8,
                       'TimeoutSetting/unit': 'Seconds',
                       'RetryCountSetting': 2,
                       'RetryCountSetting/unit': 'Times',
                       'BufferThreshold': 25,
                       'BufferThreshold/unit': '%',
                       'AmountOfReadAhead': 'Auto',
                       'NumberOfAvStreams': 6,
                       'OptimizeAvRecoding': 'Disabled',
                       'PhyStatus': 'Default',
                       'ReadPerformanceMargin': 0,
                       'ReadPerformanceMargin/unit': '%',
                       'WritePerformanceMargin': 0,
                       'WritePerformanceMargin/unit': '%',
                       'ReadAndDiscardParityData': 'Disabled',
                       'HitachiSataHddSpeed': 'Default',
                       'WdcSataHddSpeed': 'Default',
                       'SeagateSataHddSpeed': 'Default'})
Exemple #27
0
        return self.assertEqual(
            detect_utils.parse_ethtool([], "enp0s25", ETHTOOL_K.split('\n')),
            ETHTOOL_K_RESULTS)


##############################################################################
# Output from real commands and expected results below
##############################################################################

ETHTOOL_A = '''Pause parameters for enp0s25:
Autonegotiate:	on
RX:		on
TX:		on
'''

ETHTOOL_K = sample('ethtool_k')

ETHTOOL_A_RESULTS = [('network', 'enp0s25', 'Autonegotiate', 'on'),
                     ('network', 'enp0s25', 'RX', 'on'),
                     ('network', 'enp0s25', 'TX', 'on')]

ETHTOOL_K_RESULTS = [
    ('network', 'enp0s25', 'rx-checksumming', 'on'),
    ('network', 'enp0s25', 'tx-checksumming', 'on'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-ipv4', 'off [fixed]'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-ip-generic', 'on'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-ipv6', 'off [fixed]'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-fcoe-crc',
     'off [fixed]'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-sctp', 'off [fixed]'),
    ('network', 'enp0s25', 'scatter-gather', 'on'),
Exemple #28
0
 def test_detect_system(self):
     self.maxDiff = None
     l = []
     self._save_functions("7", 4)
     detect.detect_system(l, sample('lshw'))
     self._restore_functions()
     self.assertEqual(
         l,
         [('system', 'product', 'serial', 'C02JR02WF57J'),
          ('system', 'product', 'name', 'MacBookAir5,2 (System SKU#)'),
          ('system', 'product', 'vendor', 'Apple Inc.'),
          ('system', 'product', 'version', '1.0'),
          ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
          ('system', 'motherboard', 'name', 'Mac-2E6FAB96566FE58C'),
          ('system', 'motherboard', 'vendor', 'Apple Inc.'),
          ('system', 'motherboard', 'version', 'MacBookAir5,2'),
          ('system', 'motherboard', 'serial', 'C02245301ZFF25WAT'),
          ('firmware', 'bios', 'version', 'MBA51.88Z.00EF.B01.1207271122'),
          ('firmware', 'bios', 'date', '07/27/2012'),
          ('firmware', 'bios', 'vendor', 'Apple Inc.'),
          ('memory', 'total', 'size', '8589934592'),
          ('memory', 'bank:0', 'size', '4294967296'),
          ('memory', 'bank:0', 'clock', '1600000000'),
          ('memory', 'bank:0', 'description',
           'SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)'),
          ('memory', 'bank:0', 'vendor',
           'Hynix Semiconductor (Hyundai Electronics)'),
          ('memory', 'bank:0', 'product', 'HMT451S6MFR8A-PB'),
          ('memory', 'bank:0', 'serial', '0x00000000'),
          ('memory', 'bank:0', 'slot', 'DIMM0'),
          ('memory', 'bank:1', 'size', '4294967296'),
          ('memory', 'bank:1', 'clock', '1600000000'),
          ('memory', 'bank:1', 'description',
           'SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)'),
          ('memory', 'bank:1', 'vendor',
           'Hynix Semiconductor (Hyundai Electronics)'),
          ('memory', 'bank:1', 'product', 'HMT451S6MFR8A-PB'),
          ('memory', 'bank:1', 'serial', '0x00000000'),
          ('memory', 'bank:1', 'slot', 'DIMM0'),
          ('memory', 'banks', 'count', '2'),
          ('network', 'vnet0', 'size', '10000000'),
          ('network', 'vnet0', 'link', 'yes'),
          ('network', 'vnet0', 'driver', 'tun'),
          ('network', 'vnet0', 'duplex', 'full'),
          ('network', 'vnet0', 'speed', '10Mbit/s'),
          ('network', 'vnet0', 'autonegotiation', 'off'),
          ('network', 'vnet0', 'serial', 'fe:54:00:c1:1a:f7'),
          ('network', 'tap0', 'size', '10000000'),
          ('network', 'tap0', 'ipv4', '10.152.18.103'),
          ('network', 'tap0', 'ipv4-netmask', '255.255.255.0'),
          ('network', 'tap0', 'ipv4-cidr', '24'),
          ('network', 'tap0', 'ipv4-network', '10.152.18.0'),
          ('network', 'tap0', 'link', 'yes'),
          ('network', 'tap0', 'driver', 'tun'),
          ('network', 'tap0', 'duplex', 'full'),
          ('network', 'tap0', 'speed', '10Mbit/s'),
          ('network', 'tap0', 'autonegotiation', 'off'),
          ('network', 'tap0', 'serial', 'e2:66:69:22:be:fb'),
          ('network', 'wlan0', 'firmware', 'N/A'),
          ('network', 'wlan0', 'ipv4', '192.168.12.13'),
          ('network', 'wlan0', 'ipv4-netmask', '255.255.255.0'),
          ('network', 'wlan0', 'ipv4-cidr', '24'),
          ('network', 'wlan0', 'ipv4-network', '192.168.12.0'),
          ('network', 'wlan0', 'link', 'yes'),
          ('network', 'wlan0', 'driver', 'brcmsmac'),
          ('network', 'wlan0', 'serial', '00:88:65:35:2b:50'),
          ('cpu', 'physical_0', 'physid', '0'),
          ('cpu', 'physical_0', 'product',
           'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
          ('cpu', 'physical_0', 'vendor', 'Intel Corp.'),
          ('cpu', 'physical_0', 'version',
           'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
          ('cpu', 'physical_0', 'frequency', '800000000'),
          ('cpu', 'physical_0', 'clock', '25000000'),
          ('cpu', 'physical_0', 'flags',
           'fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep '
           'mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 '
           'ss ht tm pbe syscall nx rdtscp x86-64 constant_tsc '
           'arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc '
           'aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx '
           'smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic '
           'popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm '
           'ida arat xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority '
           'ept vpid fsgsbase smep erms cpufreq'),
          ('cpu', 'physical_1', 'physid', '5'),
          ('cpu', 'physical_1', 'vendor', 'Intel(R) Corporation'),
          ('cpu', 'physical_1', 'version',
           'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
          ('cpu', 'physical_1', 'frequency', '800000000'),
          ('cpu', 'physical_1', 'clock', '25000000'),
          ('cpu', 'physical_1', 'flags', 'cpufreq'),
          ('cpu', 'physical_2', 'physid', 'a'),
          ('cpu', 'physical_2', 'vendor', 'Intel(R) Corporation'),
          ('cpu', 'physical_2', 'version',
           'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
          ('cpu', 'physical_2', 'frequency', '800000000'),
          ('cpu', 'physical_2', 'clock', '25000000'),
          ('cpu', 'physical_2', 'flags', 'cpufreq'),
          ('cpu', 'physical_3', 'physid', 'f'),
          ('cpu', 'physical_3', 'vendor', 'Intel(R) Corporation'),
          ('cpu', 'physical_3', 'version',
           'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
          ('cpu', 'physical_3', 'frequency', '800000000'),
          ('cpu', 'physical_3', 'clock', '25000000'),
          ('cpu', 'physical_3', 'flags', 'cpufreq'),
          ('cpu', 'physical', 'number', '4'),
          ('cpu', 'logical', 'number', '7'),
          ('system', 'os', 'vendor', 'Ubuntu'),
          ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
          ('system', 'kernel', 'version', '3.13.0-24-generic'),
          ('system', 'kernel', 'arch', 'x86_64'),
          ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
          ]
         )
Exemple #29
0
 def test_detect_system_2(self):
     l = []
     self._save_functions("4", 1)
     detect.detect_system(l, sample('lshw2'))
     self._restore_functions()
     self.assertEqual(
         l,
         [('system', 'product', 'serial', 'PB4F20N'),
          ('system', 'product', 'name', '2347GF8 (LENOVO_MT_2347)'),
          ('system', 'product', 'vendor', 'LENOVO'),
          ('system', 'product', 'version', 'ThinkPad T430'),
          ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
          ('system', 'motherboard', 'name', '2347GF8'),
          ('system', 'motherboard', 'vendor', 'LENOVO'),
          ('system', 'motherboard', 'version', 'Not Defined'),
          ('system', 'motherboard', 'serial', '1ZLMB31B1G6'),
          ('firmware', 'bios', 'version', 'G1ET73WW (2.09 )'),
          ('firmware', 'bios', 'date', '10/19/2012'),
          ('firmware', 'bios', 'vendor', 'LENOVO'),
          ('memory', 'total', 'size', '8589934592'),
          ('memory', 'bank:0', 'size', '4294967296'),
          ('memory', 'bank:0', 'clock', '1600000000'),
          ('memory', 'bank:0', 'description',
           'SODIMM DDR3 Synchrone 1600 MHz (0,6 ns)'),
          ('memory', 'bank:0', 'vendor', 'Samsung'),
          ('memory', 'bank:0', 'product', 'M471B5273CH0-CK0'),
          ('memory', 'bank:0', 'serial', '1222BCCE'),
          ('memory', 'bank:0', 'slot', 'ChannelA-DIMM0'),
          ('memory', 'bank:1', 'size', '4294967296'),
          ('memory', 'bank:1', 'clock', '1600000000'),
          ('memory', 'bank:1', 'description',
           'SODIMM DDR3 Synchrone 1600 MHz (0,6 ns)'),
          ('memory', 'bank:1', 'vendor', 'Samsung'),
          ('memory', 'bank:1', 'product', 'M471B5273CH0-CK0'),
          ('memory', 'bank:1', 'serial', '1222BCA2'),
          ('memory', 'bank:1', 'slot', 'ChannelB-DIMM0'),
          ('memory', 'banks', 'count', '2'),
          ('network', 'eth0', 'businfo', 'pci@0000:00:19.0'),
          ('network', 'eth0', 'vendor', 'Intel Corporation'),
          ('network', 'eth0', 'product',
           '82579LM Gigabit Network Connection'),
          ('network', 'eth0', 'firmware', '0.13-3'),
          ('network', 'eth0', 'link', 'no'),
          ('network', 'eth0', 'driver', 'e1000e'),
          ('network', 'eth0', 'latency', '0'),
          ('network', 'eth0', 'autonegotiation', 'on'),
          ('network', 'eth0', 'serial', '00:21:cc:d9:bf:26'),
          ('network', 'wlan0', 'businfo', 'pci@0000:03:00.0'),
          ('network', 'wlan0', 'vendor', 'Intel Corporation'),
          ('network', 'wlan0', 'product',
           'Centrino Advanced-N 6205 [Taylor Peak]'),
          ('network', 'wlan0', 'firmware', '18.168.6.1'),
          ('network', 'wlan0', 'ipv4', '192.168.1.185'),
          ('network', 'wlan0', 'ipv4-netmask', '255.255.255.0'),
          ('network', 'wlan0', 'ipv4-cidr', '24'),
          ('network', 'wlan0', 'ipv4-network', '192.168.1.0'),
          ('network', 'wlan0', 'link', 'yes'),
          ('network', 'wlan0', 'driver', 'iwlwifi'),
          ('network', 'wlan0', 'latency', '0'),
          ('network', 'wlan0', 'serial', '84:3a:4b:33:62:82'),
          ('network', 'wwan0', 'firmware',
           'Mobile Broadband Network Device'),
          ('network', 'wwan0', 'link', 'no'),
          ('network', 'wwan0', 'driver', 'cdc_ncm'),
          ('network', 'wwan0', 'serial', '02:15:e0:ec:01:00'),
          ('cpu', 'physical_0', 'physid', '1'),
          ('cpu', 'physical_0', 'product',
           'Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz'),
          ('cpu', 'physical_0', 'vendor', 'Intel Corp.'),
          ('cpu', 'physical_0', 'version',
           'Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz'),
          ('cpu', 'physical_0', 'frequency', '2601000000'),
          ('cpu', 'physical_0', 'clock', '100000000'),
          ('cpu', 'physical_0', 'cores', '2'),
          ('cpu', 'physical_0', 'enabled_cores', '2'),
          ('cpu', 'physical_0', 'threads', '4'),
          ('cpu', 'physical_0', 'flags',
           'x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 '
           'apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr '
           'sse sse2 ss ht tm pbe syscall nx rdtscp constant_tsc '
           'arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc '
           'aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx '
           'smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic '
           'popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm '
           'ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi '
           'flexpriority ept vpid fsgsbase smep erms cpufreq'),
          ('cpu', 'physical', 'number', '1'),
          ('cpu', 'logical', 'number', '4'),
          ('system', 'os', 'vendor', 'Ubuntu'),
          ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
          ('system', 'kernel', 'version', '3.13.0-24-generic'),
          ('system', 'kernel', 'arch', 'x86_64'),
          ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
          ]
         )
Exemple #30
0
 def test_parse_output_adpcount(self):
     self.assertEqual(megacli.parse_output(sample('megacli_adpcount')),
                      {'ControllerCount': 1,
                       'ExitCode': '0x01'})
Exemple #31
0
 def test_parse_ipmi_sdr(self):
     hw = ipmi.parse_ipmi_sdr(sample('parse_ipmi_sdr').split('\n'))
     self.assertEqual(hw, ipmi_results.IPMI_SDR_RESULT)
Exemple #32
0
 def test_detect_system_2(self):
     l = []
     self._save_functions("4", 1)
     detect.detect_system(l, sample('lshw2'))
     self._restore_functions()
     self.assertEqual(l, [
         ('system', 'product', 'serial', 'PB4F20N'),
         ('system', 'product', 'name', '2347GF8 (LENOVO_MT_2347)'),
         ('system', 'product', 'vendor', 'LENOVO'),
         ('system', 'product', 'version', 'ThinkPad T430'),
         ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
         ('system', 'motherboard', 'name', '2347GF8'),
         ('system', 'motherboard', 'vendor', 'LENOVO'),
         ('system', 'motherboard', 'version', 'Not Defined'),
         ('system', 'motherboard', 'serial', '1ZLMB31B1G6'),
         ('firmware', 'bios', 'version', 'G1ET73WW (2.09 )'),
         ('firmware', 'bios', 'date', '10/19/2012'),
         ('firmware', 'bios', 'vendor', 'LENOVO'),
         ('memory', 'total', 'size', '8589934592'),
         ('memory', 'bank:0', 'size', '4294967296'),
         ('memory', 'bank:0', 'clock', '1600000000'),
         ('memory', 'bank:0', 'description',
          'SODIMM DDR3 Synchrone 1600 MHz (0,6 ns)'),
         ('memory', 'bank:0', 'vendor', 'Samsung'),
         ('memory', 'bank:0', 'product', 'M471B5273CH0-CK0'),
         ('memory', 'bank:0', 'serial', '1222BCCE'),
         ('memory', 'bank:0', 'slot', 'ChannelA-DIMM0'),
         ('memory', 'bank:1', 'size', '4294967296'),
         ('memory', 'bank:1', 'clock', '1600000000'),
         ('memory', 'bank:1', 'description',
          'SODIMM DDR3 Synchrone 1600 MHz (0,6 ns)'),
         ('memory', 'bank:1', 'vendor', 'Samsung'),
         ('memory', 'bank:1', 'product', 'M471B5273CH0-CK0'),
         ('memory', 'bank:1', 'serial', '1222BCA2'),
         ('memory', 'bank:1', 'slot', 'ChannelB-DIMM0'),
         ('memory', 'banks', 'count', '2'),
         ('network', 'eth0', 'businfo', 'pci@0000:00:19.0'),
         ('network', 'eth0', 'vendor', 'Intel Corporation'),
         ('network', 'eth0', 'product',
          '82579LM Gigabit Network Connection'),
         ('network', 'eth0', 'firmware', '0.13-3'),
         ('network', 'eth0', 'link', 'no'),
         ('network', 'eth0', 'driver', 'e1000e'),
         ('network', 'eth0', 'latency', '0'),
         ('network', 'eth0', 'autonegotiation', 'on'),
         ('network', 'eth0', 'serial', '00:21:cc:d9:bf:26'),
         ('network', 'wlan0', 'businfo', 'pci@0000:03:00.0'),
         ('network', 'wlan0', 'vendor', 'Intel Corporation'),
         ('network', 'wlan0', 'product',
          'Centrino Advanced-N 6205 [Taylor Peak]'),
         ('network', 'wlan0', 'firmware', '18.168.6.1'),
         ('network', 'wlan0', 'ipv4', '192.168.1.185'),
         ('network', 'wlan0', 'ipv4-netmask', '255.255.255.0'),
         ('network', 'wlan0', 'ipv4-cidr', '24'),
         ('network', 'wlan0', 'ipv4-network', '192.168.1.0'),
         ('network', 'wlan0', 'link', 'yes'),
         ('network', 'wlan0', 'driver', 'iwlwifi'),
         ('network', 'wlan0', 'latency', '0'),
         ('network', 'wlan0', 'serial', '84:3a:4b:33:62:82'),
         ('network', 'wwan0', 'firmware',
          'Mobile Broadband Network Device'),
         ('network', 'wwan0', 'link', 'no'),
         ('network', 'wwan0', 'driver', 'cdc_ncm'),
         ('network', 'wwan0', 'serial', '02:15:e0:ec:01:00'),
         ('cpu', 'physical_0', 'physid', '1'),
         ('cpu', 'physical_0', 'product',
          'Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz'),
         ('cpu', 'physical_0', 'vendor', 'Intel Corp.'),
         ('cpu', 'physical_0', 'version',
          'Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz'),
         ('cpu', 'physical_0', 'frequency', '2601000000'),
         ('cpu', 'physical_0', 'clock', '100000000'),
         ('cpu', 'physical_0', 'cores', '2'),
         ('cpu', 'physical_0', 'enabled_cores', '2'),
         ('cpu', 'physical_0', 'threads', '4'),
         ('cpu', 'physical_0', 'flags',
          'x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 '
          'apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr '
          'sse sse2 ss ht tm pbe syscall nx rdtscp constant_tsc '
          'arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc '
          'aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx '
          'smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic '
          'popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm '
          'ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi '
          'flexpriority ept vpid fsgsbase smep erms cpufreq'),
         ('cpu', 'physical', 'number', '1'),
         ('cpu', 'logical', 'number', '4'),
         ('system', 'os', 'vendor', 'Ubuntu'),
         ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
         ('system', 'kernel', 'version', '3.13.0-24-generic'),
         ('system', 'kernel', 'arch', 'x86_64'),
         ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
     ])
Exemple #33
0
 def test_parse_dmesg(self):
     hw = []
     detect.parse_dmesg(hw, sample('dmesg'))
     self.assertEqual(
         hw, [('ahci', '0000:00:1f.2:', 'flags', '64bit apst clo ems led '
               'ncq part pio slum sntf')])
Exemple #34
0
                          'WriteBack, ReadAdaptive, Direct, '
                          'No Write Cache if Bad BBU',
                          'CurrentPowerSavingsPolicy': 'None',
                          'DefaultAccessPolicy': 'Read/Write',
                          'DefaultCachePolicy': 'WriteBack, ReadAdaptive, '
                          'Direct, No Write Cache if Bad BBU',
                          'DefaultPowerSavingsPolicy': 'Controller Defined',
                          'DiskCachePolicy': "Disk's Default",
                          'EncryptionType': 'None',
                          'IsVdCached': 'Yes',
                          "Ld'SIoProfileSupportsMaxPowerSavings"
                          "WithCachedWrites": 'No',
                          'LdHasDrivesThatSupportT10PowerConditions': 'No',
                          'MirrorData': '465.25 GB',
                          'Name': '',
                          'NumberOfDrives': 2,
                          'RaidLevel': 'Primary-1, Secondary-0, RAID Level '
                          'Qualifier-0',
                          'SectorSize': 512,
                          'Size': '465.25 GB',
                          'SpanDepth': 1,
                          'State': 'Optimal',
                          'StripSize': '64 KB'})

ENC_OUTPUT = sample('megacli_enc')

if __name__ == "__main__":
    unittest.main()

# test_megacli.py ends here
Exemple #35
0
         Model: ATA     MB2000GBUPB
         SATA NCQ Capable: True
         SATA NCQ Enabled: True
         Current Temperature (C): 32
         Maximum Temperature (C): 36
         PHY Count: 1
         PHY Transfer Rate: 6.0Gbps
         Drive Authentication Status: OK
         Carrier Application Version: 11
         Carrier Bootloader Version: 6


'''

# => ctrl slot=2 ld 1 show
CTRL_LD_SHOW_OUTPUT = sample('ctrl_ld_show')

CTRL_LD_SHOW_RESULT = {
    'Caching': 'Enabled',
    'Caching Association': 'None',
    'Cylinders': '23934',
    'Disk Name': '/dev/sda',
    'Drive Type': 'Data',
    'Fault Tolerance': '1',
    'Full Stripe Size': '256 KB',
    'Heads': '255',
    'Logical Drive': '1',
    'Logical Drive Label': 'A299BBB1PDKRH0ARH4F1R6D4B9',
    'Mirror Group 0': '2I:1:7',
    'Mirror Group 1': '2I:1:8',
    'Mount Points': 'None',
Exemple #36
0
class TestDetect(unittest.TestCase):

    def test_size_in_gb(self):
        self.assertEqual(detect.size_in_gb('100 GB'), '100')

    def test_size_in_tb(self):
        self.assertEqual(detect.size_in_gb('100TB'), '100000')

    def test_size_in_dottb(self):
        self.assertEqual(detect.size_in_gb('3.4601 TB'), '3460')

    def test_size_in_nothing(self):
        self.assertEqual(detect.size_in_gb('100'), '100')

    def test_get_cidr(self):
        self.assertEqual(detect.get_cidr('255.255.0.0'), '16')

    @mock.patch('os.path.exists', return_value=False)
    @mock.patch('hardware.detect_utils.output_lines',
                side_effect=[
                    sample('lscpu').split('\n'),
                    sample('lscpux').split('\n')])
    def test_get_cpus(self, mock_output_lines, mock_os_path_exists):
        hw = []
        detect.get_cpus(hw)
        self.assertEqual(hw, detect_results.GET_CPUS_RESULT)
        calls = []
        # Once per socket
        for i in range(2):
            calls.append(mock.call('/sys/devices/system/cpu/cpufreq/boost'))
        # Once per processor
        for i in range(1):
            f = ('/sys/devices/system/cpu/cpufreq/policy%d/scaling_governor' %
                 i)
            calls.append(mock.call(f))
        # NOTE(tonyb): We can't use assert_has_calls() because it's too
        # permissive.  We want an exact match
        self.assertEqual(calls, mock_os_path_exists.mock_calls)

    @mock.patch('os.path.exists', return_value=False)
    @mock.patch('hardware.detect_utils.output_lines',
                side_effect=[
                    sample('lscpu-vm').split('\n'),
                    sample('lscpu-vmx').split('\n'),
                    ('powersave',),
                    ('powersave',)])
    def test_get_cpus_vm(self, mock_output_lines, mock_os_path_exists):
        hw = []
        detect.get_cpus(hw)
        self.assertEqual(hw, detect_results.GET_CPUS_VM_RESULT)
        calls = []
        # Once per socket
        for i in range(1):
            calls.append(mock.call('/sys/devices/system/cpu/cpufreq/boost'))
        # Once per processor
        for i in range(2):
            f = ('/sys/devices/system/cpu/cpufreq/policy%d/scaling_governor' %
                 i)
            calls.append(mock.call(f))
        # NOTE(tonyb): We can't use assert_has_calls() because it's too
        # permissive.  We want an exact match
        self.assertEqual(calls, mock_os_path_exists.mock_calls)

    @mock.patch('os.path.exists', return_value=False)
    @mock.patch('hardware.detect_utils.output_lines',
                side_effect=[
                    sample('lscpu_aarch64').split('\n'),
                    sample('lscpux_aarch64').split('\n'),
                    ('powersave',),
                    ('powersave',)])
    def test_get_cpus_aarch64(self, mock_output_lines, mock_os_path_exists):
        self.maxDiff = None
        hw = []
        detect.get_cpus(hw)
        self.assertEqual(hw, detect_results.GET_CPUS_AARCH64_RESULT)
        calls = []
        # Once per socket
        for i in range(4):
            calls.append(mock.call('/sys/devices/system/cpu/cpufreq/boost'))
        # Once per processor
        for i in range(8):
            f = ('/sys/devices/system/cpu/cpufreq/policy%d/scaling_governor' %
                 i)
            calls.append(mock.call(f))
        # NOTE(tonyb): We can't use assert_has_calls() because it's too
        # permissive.  We want an exact match
        self.assertEqual(calls, mock_os_path_exists.mock_calls)

    @mock.patch('os.path.exists', return_value=False)
    @mock.patch('hardware.detect_utils.output_lines',
                side_effect=[
                    sample('lscpu_ppc64le').split('\n'),
                    sample('lscpux_ppc64le').split('\n')])
    def test_get_cpus_ppc64le(self, mock_output_lines, mock_os_path_exists):
        hw = []
        detect.get_cpus(hw)
        self.assertEqual(hw, detect_results.GET_CPUS_PPC64LE)
        calls = []
        # Once per socket
        for i in range(2):
            calls.append(mock.call('/sys/devices/system/cpu/cpufreq/boost'))
        # Once per processor
        for i in range(144):
            f = ('/sys/devices/system/cpu/cpufreq/policy%d/scaling_governor' %
                 i)
            calls.append(mock.call(f))
        # NOTE(tonyb): We can't use assert_has_calls() because it's too
        # permissive.  We want an exact match
        self.assertEqual(calls, mock_os_path_exists.mock_calls)

    @mock.patch('hardware.detect.cmd',
                return_value=(0, sample('dmesg')),
                autospec=True)
    def test_parse_dmesg(self, mock_cmd):
        hw = []
        detect.parse_dmesg(hw)
        self.assertEqual(hw, [('ahci', '0000:00:1f.2:', 'flags',
                               '64bit apst clo ems led '
                               'ncq part pio slum sntf')])

    @mock.patch('hardware.detect_utils.cmd', return_value=(0, 4))
    @mock.patch('hardware.detect.get_uuid',
                return_value='83462C81-52BA-11CB-870F')
    @mock.patch('hardware.detect.get_cpus', return_value='[]')
    @mock.patch('hardware.detect_utils.output_lines',
                side_effect=[
                    ('Ubuntu',),
                    ('Ubuntu 14.04 LTS',),
                    ('3.13.0-24-generic',),
                    ('x86_64',),
                    ('BOOT_IMAGE=/boot/vmlinuz',)])
    def test_detect_system_3(self, mock_cmd, mock_get_uuid, mock_get_cpus,
                             mock_output_lines):
        result = []
        detect.detect_system(result, sample('lshw3'))
        self.assertEqual(result, detect_results.DETECT_SYSTEM3_RESULT)

    @mock.patch('hardware.detect_utils.cmd', return_value=(0, 4))
    @mock.patch('hardware.detect.get_uuid',
                return_value='83462C81-52BA-11CB-870F')
    @mock.patch('hardware.detect.get_cpus', return_value='[]')
    @mock.patch('hardware.detect_utils.output_lines',
                side_effect=[
                    ('Ubuntu',),
                    ('Ubuntu 14.04 LTS',),
                    ('3.13.0-24-generic',),
                    ('x86_64',),
                    ('BOOT_IMAGE=/boot/vmlinuz',)])
    def test_detect_system_2(self, mock_cmd, mock_get_uuid, mock_get_cpus,
                             mock_output_lines):
        result = []
        detect.detect_system(result, sample('lshw2'))
        self.assertEqual(result, detect_results.DETECT_SYSTEM2_RESULT)

    @mock.patch('hardware.detect_utils.cmd', return_value=(0, 7))
    @mock.patch('hardware.detect.get_uuid',
                return_value='83462C81-52BA-11CB-870F')
    @mock.patch('hardware.detect.get_cpus', return_value='[]')
    @mock.patch('hardware.detect_utils.output_lines',
                side_effect=[
                    ('Ubuntu',),
                    ('Ubuntu 14.04 LTS',),
                    ('3.13.0-24-generic',),
                    ('x86_64',),
                    ('BOOT_IMAGE=/boot/vmlinuz',)
                ])
    def test_detect_system(self, mock_cmd, mock_get_uuid, mock_get_cpus,
                           mock_output_lines):
        result = []
        detect.detect_system(result, sample('lshw'))
        self.assertEqual(result, detect_results.DETECT_SYSTEM_RESULT)

    def test_get_value(self):
        self.assertEqual(detect._get_value([('a', 'b', 'c', 'd')],
                                           'a', 'b', 'c'), 'd')

    def test_fix_bad_serial_zero(self):
        hwl = [('system', 'product', 'serial', '0000000000')]
        detect.fix_bad_serial(hwl, 'uuid', '', '')
        self.assertEqual(detect._get_value(hwl, 'system', 'product', 'serial'),
                         'uuid')

    def test_fix_bad_serial_mobo(self):
        hwl = [('system', 'product', 'serial', '0123456789')]
        detect.fix_bad_serial(hwl, '', 'mobo', '')
        self.assertEqual(detect._get_value(hwl, 'system', 'product', 'serial'),
                         'mobo')

    def test_clean_str(self):
        self.assertEqual(detect.clean_str(b'\x8f' * 4), u'\ufffd' * 4)

    def test_clean_tuples(self):
        self.assertEqual(
            detect.clean_tuples([(b'\x8f' * 4, b'\x8f' * 4,
                                  b'h\xc3\xa9llo', 1)]),
            [(u'\ufffd' * 4, u'\ufffd' * 4, u'h\xe9llo', 1)])

    @mock.patch.object(detect, 'Popen')
    @mock.patch('os.environ.copy')
    def test_detect_auxv_x86_succeed(self, mock_environ_copy, mock_popen):
        test_data = {
            'AT_HWCAP': ('hwcap', 'bfebfbff'),
            'AT_HWCAP2': ('hwcap2', '0x0'),
            'AT_PAGESZ': ('pagesz', '4096'),
            'AT_FLAGS': ('flags', '0x0'),
            'AT_PLATFORM': ('platform', 'x86_64'),
        }

        process_mock = mock.Mock()
        attrs = {'communicate.return_value': (sample('auxv_x86').encode('utf-8'),
                                              None)}
        process_mock.configure_mock(**attrs)
        mock_popen.return_value = process_mock

        hw = []
        detect.detect_auxv(hw)

        # NOTE(mrda): x86 doesn't have AUXV_OPT_FLAGS
        for k in detect.AUXV_FLAGS:
            t = ('hw', 'auxv', test_data[k][0], test_data[k][1])
            self.assertTrue(t in hw)

    @mock.patch.object(detect, 'Popen')
    @mock.patch('os.environ.copy')
    def test_detect_auxv_ppc8_succeed(self, mock_environ_copy, mock_popen):
        test_data = {
            'AT_HWCAP': ('hwcap', 'true_le archpmu vsx arch_2_06 dfp ic_snoop smt mmu fpu altivec ppc64 ppc32'),
            'AT_HWCAP2': ('hwcap2', 'htm-nosc vcrypto tar isel ebb dscr htm arch_2_07'),
            'AT_PAGESZ': ('pagesz', '65536'),
            'AT_FLAGS': ('flags', '0x0'),
            'AT_PLATFORM': ('platform', 'power8'),
            'AT_BASE_PLATFORM': ('base_platform', 'power8'),
        }

        process_mock = mock.Mock()
        attrs = {'communicate.return_value': (sample('auxv_ppc8').encode('utf-8'),
                                              None)}
        process_mock.configure_mock(**attrs)
        mock_popen.return_value = process_mock

        hw = []
        detect.detect_auxv(hw)

        ppc_flags = detect.AUXV_FLAGS + detect.AUXV_OPT_FLAGS
        for k in ppc_flags:
            t = ('hw', 'auxv', test_data[k][0], test_data[k][1])
            self.assertTrue(t in hw)

    @mock.patch.object(detect, 'Popen')
    @mock.patch('os.uname', return_value=('', '', '', '', 'x86_64'))
    def test_get_uuid_x86_64(self, mock_uname, mock_popen):
        # This is more complex and 'magic' than I'd like :/
        process_mock = mock.Mock()
        attrs = {'communicate.return_value': ('83462C81-52BA-11CB-870F', '')}
        process_mock.configure_mock(**attrs)
        mock_popen.return_value = process_mock

        hw_list = []
        system_uuid = detect.get_uuid(hw_list)
        mock_popen.assert_has_calls([
            mock.call("dmidecode -t 1 | grep UUID | " "awk '{print $2}'",
                      shell=True, stdout=detect.PIPE,
                      universal_newlines=True)])
        self.assertEqual('83462C81-52BA-11CB-870F', system_uuid)

    @mock.patch('os.uname', return_value=('', '', '', '', 'ppc64le'))
    @mock.patch('os.access', return_value=True)
    def test_get_uuid_ppc64le_ok_generate(self, mock_access, mock_uname):
        expected_uuid = 'a2724b67-c27e-5e5f-aa2b-3089a2bd8f41'
        fileobj = mock.mock_open(read_data=expected_uuid)
        with mock.patch('six.moves.builtins.open', fileobj, create=True):
            uuid = detect.get_uuid([])
        self.assertEqual(expected_uuid, uuid)

    @mock.patch('os.uname', return_value=('', '', '', '', 'ppc64le'))
    def test_get_uuid_ppc64le_ok_read(self, mock_uname):
        hw_list = [('sys_cls', 'sys_type', 'vendor', 'IBM'),
                   ('sys_cls', 'sys_type', 'serial', '1234567A')]
        self.assertEqual('a2724b67-c27e-5e5f-aa2b-3089a2bd8f41',
                         detect.get_uuid(hw_list))

    @mock.patch('os.uname', return_value=('', '', '', '', 'ppc64le'))
    def test_get_uuid_ppc64le_missing_serial(self, mock_uname):
        hw_list = [('sys_cls', 'sys_type', 'vendor', 'IBM')]
        self.assertIsNone(detect.get_uuid(hw_list))

    @mock.patch('os.uname', return_value=('', '', '', '', 'ppc64le'))
    def test_get_uuid_ppc64le_missing_vendor(self, mock_uname):
        hw_list = [('sys_cls', 'sys_type', 'serial', '1234567A')]
        self.assertIsNone(detect.get_uuid(hw_list))

    @mock.patch('os.uname', return_value=('', '', '', '', 'ppc64le'))
    def test_get_uuid_ppc64le_no_hw_list(self, mock_uname):
        hw_list = []
        self.assertIsNone(detect.get_uuid(hw_list))
 def test_parse_ipmi_sdr(self):
     hw = []
     detect_utils.parse_ipmi_sdr(hw, sample('parse_ipmi_sdr').split('\n'))
     self.assertEqual(hw, parse_ipmi_sdr.get_ipmi_sdr_result())
Exemple #38
0
                          'No Write Cache if Bad BBU',
                          'CurrentPowerSavingsPolicy': 'None',
                          'DefaultAccessPolicy': 'Read/Write',
                          'DefaultCachePolicy': 'WriteBack, ReadAdaptive, '
                          'Direct, No Write Cache if Bad BBU',
                          'DefaultPowerSavingsPolicy': 'Controller Defined',
                          'DiskCachePolicy': "Disk's Default",
                          'EncryptionType': 'None',
                          'IsVdCached': 'Yes',
                          "Ld'SIoProfileSupportsMaxPowerSavings"
                          "WithCachedWrites": 'No',
                          'LdHasDrivesThatSupportT10PowerConditions': 'No',
                          'MirrorData': '465.25 GB',
                          'Name': '',
                          'NumberOfDrives': 2,
                          'RaidLevel': 'Primary-1, Secondary-0, RAID Level '
                          'Qualifier-0',
                          'SectorSize': 512,
                          'Size': '465.25 GB',
                          'SpanDepth': 1,
                          'State': 'Optimal',
                          'StripSize': '64 KB'})


ENC_OUTPUT = sample('megacli_enc')

if __name__ == "__main__":
    unittest.main()

# test_megacli.py ends here
Exemple #39
0
 def test_adp_count(self):
     self.output = sample('megacli_adpcount')
     self.assertEqual(megacli.adp_count(), 1)
Exemple #40
0
        return self.assertEqual(
            detect_utils.parse_ethtool([], "enp0s25", ETHTOOL_K.split('\n')),
            ETHTOOL_K_RESULTS)


##############################################################################
# Output from real commands and expected results below
##############################################################################

ETHTOOL_A = '''Pause parameters for enp0s25:
Autonegotiate:	on
RX:		on
TX:		on
'''

ETHTOOL_K = sample('ethtool_k')

ETHTOOL_A_RESULTS = [('network', 'enp0s25', 'Autonegotiate', 'on'),
                     ('network', 'enp0s25', 'RX', 'on'),
                     ('network', 'enp0s25', 'TX', 'on')]

ETHTOOL_K_RESULTS = [
    ('network', 'enp0s25', 'rx-checksumming', 'on'),
    ('network', 'enp0s25', 'tx-checksumming', 'on'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-ipv4', 'off [fixed]'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-ip-generic', 'on'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-ipv6', 'off [fixed]'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-fcoe-crc',
     'off [fixed]'),
    ('network', 'enp0s25', 'tx-checksumming/tx-checksum-sctp', 'off [fixed]'),
    ('network', 'enp0s25', 'scatter-gather', 'on'),
Exemple #41
0
 def test_adp_count(self):
     self.output = sample('megacli_adpcount')
     self.assertEqual(megacli.adp_count(), 1)
Exemple #42
0
 def test_detect_system_3(self):
     l = []
     self._save_functions("4", 2)
     detect.detect_system(l, sample('lshw3'))
     self._restore_functions()
     self.assertEqual(l, [
         ('system', 'product', 'serial', 'Empty'),
         ('system', 'product', 'name', 'S2915'),
         ('system', 'product', 'vendor', 'Tyan Computer Corporation'),
         ('system', 'product', 'version', 'REFERENCE'),
         ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
         ('system', 'motherboard', 'name', 'S2915'),
         ('system', 'motherboard', 'vendor', 'Tyan Computer Corporation'),
         ('system', 'motherboard', 'version', 'REFERENCE'),
         ('system', 'motherboard', 'serial', 'Empty'),
         ('firmware', 'bios', 'version', 'v3.00.2915 (10/10/2008)'),
         ('firmware', 'bios', 'vendor', 'Phoenix Technologies Ltd.'),
         ('memory', 'total', 'size', '4294967296'),
         ('memory', 'bank:0:0', 'description', 'DIMM Synchronous [empty]'),
         ('memory', 'bank:0:0', 'slot', 'C0_DIMM0'),
         ('memory', 'bank:0:1', 'description', 'DIMM Synchronous [empty]'),
         ('memory', 'bank:0:1', 'slot', 'C0_DIMM1'),
         ('memory', 'bank:0:2', 'size', '1073741824'),
         ('memory', 'bank:0:2', 'description', 'DIMM Synchronous'),
         ('memory', 'bank:0:2', 'slot', 'C0_DIMM2'),
         ('memory', 'bank:0:3', 'size', '1073741824'),
         ('memory', 'bank:0:3', 'description', 'DIMM Synchronous'),
         ('memory', 'bank:0:3', 'slot', 'C0_DIMM3'),
         ('memory', 'bank:0:4', 'description', 'DIMM Synchronous [empty]'),
         ('memory', 'bank:0:4', 'slot', 'C0_DIMM0'),
         ('memory', 'bank:0:5', 'description', 'DIMM Synchronous [empty]'),
         ('memory', 'bank:0:5', 'slot', 'C1_DIMM1'),
         ('memory', 'bank:0:6', 'size', '1073741824'),
         ('memory', 'bank:0:6', 'description', 'DIMM Synchronous'),
         ('memory', 'bank:0:6', 'slot', 'C1_DIMM2'),
         ('memory', 'bank:0:7', 'size', '1073741824'),
         ('memory', 'bank:0:7', 'description', 'DIMM Synchronous'),
         ('memory', 'bank:0:7', 'slot', 'C1_DIMM3'),
         ('memory', 'banks', 'count', '8'),
         ('cpu', 'physical_0', 'physid', '3'),
         ('cpu', 'physical_0', 'product',
          'Dual-Core AMD Opteron(tm) Processor 8218'),
         ('cpu', 'physical_0', 'vendor', 'Advanced Micro Devices [AMD]'),
         ('cpu', 'physical_0', 'version', 'AMD'),
         ('cpu', 'physical_0', 'frequency', '1000000000'),
         ('cpu', 'physical_0', 'clock', '200000000'),
         ('cpu', 'physical_0', 'flags',
          'fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic '
          'sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht '
          'syscall nx mmxext fxsr_opt rdtscp x86-64 3dnowext 3dnow '
          'rep_good nopl extd_apicid pni cx16 lahf_lm cmp_legacy svm '
          'extapic cr8_legacy cpufreq'),
         ('cpu', 'physical_1', 'physid', '4'),
         ('cpu', 'physical_1', 'product',
          'Dual-Core AMD Opteron(tm) Processor 8218'),
         ('cpu', 'physical_1', 'vendor', 'Advanced Micro Devices [AMD]'),
         ('cpu', 'physical_1', 'version', 'AMD'),
         ('cpu', 'physical_1', 'frequency', '1000000000'),
         ('cpu', 'physical_1', 'clock', '200000000'),
         ('cpu', 'physical_1', 'flags',
          'fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep '
          'mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht '
          'syscall nx mmxext fxsr_opt rdtscp x86-64 3dnowext 3dnow '
          'rep_good nopl extd_apicid pni cx16 lahf_lm cmp_legacy svm '
          'extapic cr8_legacy cpufreq'),
         ('cpu', 'physical', 'number', '2'),
         ('cpu', 'logical', 'number', '4'),
         ('system', 'os', 'vendor', 'Ubuntu'),
         ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
         ('system', 'kernel', 'version', '3.13.0-24-generic'),
         ('system', 'kernel', 'arch', 'x86_64'),
         ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
     ])
Exemple #43
0
 def test_parse_dmesg(self):
     hw = []
     detect.parse_dmesg(hw, sample('dmesg'))
     self.assertEqual(hw, [('ahci', '0000:00:1f.2:', 'flags',
                            '64bit apst clo ems led '
                            'ncq part pio slum sntf')])
Exemple #44
0
 def test_detect_system(self):
     self.maxDiff = None
     l = []
     self._save_functions("7", 4)
     detect.detect_system(l, sample('lshw'))
     self._restore_functions()
     self.assertEqual(l, [
         ('system', 'product', 'serial', 'C02JR02WF57J'),
         ('system', 'product', 'name', 'MacBookAir5,2 (System SKU#)'),
         ('system', 'product', 'vendor', 'Apple Inc.'),
         ('system', 'product', 'version', '1.0'),
         ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
         ('system', 'motherboard', 'name', 'Mac-2E6FAB96566FE58C'),
         ('system', 'motherboard', 'vendor', 'Apple Inc.'),
         ('system', 'motherboard', 'version', 'MacBookAir5,2'),
         ('system', 'motherboard', 'serial', 'C02245301ZFF25WAT'),
         ('firmware', 'bios', 'version', 'MBA51.88Z.00EF.B01.1207271122'),
         ('firmware', 'bios', 'date', '07/27/2012'),
         ('firmware', 'bios', 'vendor', 'Apple Inc.'),
         ('memory', 'total', 'size', '8589934592'),
         ('memory', 'bank:0', 'size', '4294967296'),
         ('memory', 'bank:0', 'clock', '1600000000'),
         ('memory', 'bank:0', 'description',
          'SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)'),
         ('memory', 'bank:0', 'vendor',
          'Hynix Semiconductor (Hyundai Electronics)'),
         ('memory', 'bank:0', 'product', 'HMT451S6MFR8A-PB'),
         ('memory', 'bank:0', 'serial', '0x00000000'),
         ('memory', 'bank:0', 'slot', 'DIMM0'),
         ('memory', 'bank:1', 'size', '4294967296'),
         ('memory', 'bank:1', 'clock', '1600000000'),
         ('memory', 'bank:1', 'description',
          'SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)'),
         ('memory', 'bank:1', 'vendor',
          'Hynix Semiconductor (Hyundai Electronics)'),
         ('memory', 'bank:1', 'product', 'HMT451S6MFR8A-PB'),
         ('memory', 'bank:1', 'serial', '0x00000000'),
         ('memory', 'bank:1', 'slot', 'DIMM0'),
         ('memory', 'banks', 'count', '2'),
         ('network', 'vnet0', 'size', '10000000'),
         ('network', 'vnet0', 'link', 'yes'),
         ('network', 'vnet0', 'driver', 'tun'),
         ('network', 'vnet0', 'duplex', 'full'),
         ('network', 'vnet0', 'speed', '10Mbit/s'),
         ('network', 'vnet0', 'autonegotiation', 'off'),
         ('network', 'vnet0', 'serial', 'fe:54:00:c1:1a:f7'),
         ('network', 'tap0', 'size', '10000000'),
         ('network', 'tap0', 'ipv4', '10.152.18.103'),
         ('network', 'tap0', 'ipv4-netmask', '255.255.255.0'),
         ('network', 'tap0', 'ipv4-cidr', '24'),
         ('network', 'tap0', 'ipv4-network', '10.152.18.0'),
         ('network', 'tap0', 'link', 'yes'),
         ('network', 'tap0', 'driver', 'tun'),
         ('network', 'tap0', 'duplex', 'full'),
         ('network', 'tap0', 'speed', '10Mbit/s'),
         ('network', 'tap0', 'autonegotiation', 'off'),
         ('network', 'tap0', 'serial', 'e2:66:69:22:be:fb'),
         ('network', 'wlan0', 'firmware', 'N/A'),
         ('network', 'wlan0', 'ipv4', '192.168.12.13'),
         ('network', 'wlan0', 'ipv4-netmask', '255.255.255.0'),
         ('network', 'wlan0', 'ipv4-cidr', '24'),
         ('network', 'wlan0', 'ipv4-network', '192.168.12.0'),
         ('network', 'wlan0', 'link', 'yes'),
         ('network', 'wlan0', 'driver', 'brcmsmac'),
         ('network', 'wlan0', 'serial', '00:88:65:35:2b:50'),
         ('cpu', 'physical_0', 'physid', '0'),
         ('cpu', 'physical_0', 'product',
          'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
         ('cpu', 'physical_0', 'vendor', 'Intel Corp.'),
         ('cpu', 'physical_0', 'version',
          'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
         ('cpu', 'physical_0', 'frequency', '800000000'),
         ('cpu', 'physical_0', 'clock', '25000000'),
         ('cpu', 'physical_0', 'flags',
          'fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep '
          'mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 '
          'ss ht tm pbe syscall nx rdtscp x86-64 constant_tsc '
          'arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc '
          'aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx '
          'smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic '
          'popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm '
          'ida arat xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority '
          'ept vpid fsgsbase smep erms cpufreq'),
         ('cpu', 'physical_1', 'physid', '5'),
         ('cpu', 'physical_1', 'vendor', 'Intel(R) Corporation'),
         ('cpu', 'physical_1', 'version',
          'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
         ('cpu', 'physical_1', 'frequency', '800000000'),
         ('cpu', 'physical_1', 'clock', '25000000'),
         ('cpu', 'physical_1', 'flags', 'cpufreq'),
         ('cpu', 'physical_2', 'physid', 'a'),
         ('cpu', 'physical_2', 'vendor', 'Intel(R) Corporation'),
         ('cpu', 'physical_2', 'version',
          'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
         ('cpu', 'physical_2', 'frequency', '800000000'),
         ('cpu', 'physical_2', 'clock', '25000000'),
         ('cpu', 'physical_2', 'flags', 'cpufreq'),
         ('cpu', 'physical_3', 'physid', 'f'),
         ('cpu', 'physical_3', 'vendor', 'Intel(R) Corporation'),
         ('cpu', 'physical_3', 'version',
          'Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz'),
         ('cpu', 'physical_3', 'frequency', '800000000'),
         ('cpu', 'physical_3', 'clock', '25000000'),
         ('cpu', 'physical_3', 'flags', 'cpufreq'),
         ('cpu', 'physical', 'number', '4'),
         ('cpu', 'logical', 'number', '7'),
         ('system', 'os', 'vendor', 'Ubuntu'),
         ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
         ('system', 'kernel', 'version', '3.13.0-24-generic'),
         ('system', 'kernel', 'arch', 'x86_64'),
         ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
     ])
Exemple #45
0
 def test_detect_system_3(self):
     l = []
     self._save_functions("4", 2)
     detect.detect_system(l, sample('lshw3'))
     self._restore_functions()
     self.assertEqual(
         l,
         [('system', 'product', 'serial', 'Empty'),
          ('system', 'product', 'name', 'S2915'),
          ('system', 'product', 'vendor', 'Tyan Computer Corporation'),
          ('system', 'product', 'version', 'REFERENCE'),
          ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
          ('system', 'motherboard', 'name', 'S2915'),
          ('system', 'motherboard', 'vendor', 'Tyan Computer Corporation'),
          ('system', 'motherboard', 'version', 'REFERENCE'),
          ('system', 'motherboard', 'serial', 'Empty'),
          ('firmware', 'bios', 'version', 'v3.00.2915 (10/10/2008)'),
          ('firmware', 'bios', 'vendor', 'Phoenix Technologies Ltd.'),
          ('memory', 'total', 'size', '4294967296'),
          ('memory', 'bank:0:0', 'description', 'DIMM Synchronous [empty]'),
          ('memory', 'bank:0:0', 'slot', 'C0_DIMM0'),
          ('memory', 'bank:0:1', 'description', 'DIMM Synchronous [empty]'),
          ('memory', 'bank:0:1', 'slot', 'C0_DIMM1'),
          ('memory', 'bank:0:2', 'size', '1073741824'),
          ('memory', 'bank:0:2', 'description', 'DIMM Synchronous'),
          ('memory', 'bank:0:2', 'slot', 'C0_DIMM2'),
          ('memory', 'bank:0:3', 'size', '1073741824'),
          ('memory', 'bank:0:3', 'description', 'DIMM Synchronous'),
          ('memory', 'bank:0:3', 'slot', 'C0_DIMM3'),
          ('memory', 'bank:0:4', 'description', 'DIMM Synchronous [empty]'),
          ('memory', 'bank:0:4', 'slot', 'C0_DIMM0'),
          ('memory', 'bank:0:5', 'description', 'DIMM Synchronous [empty]'),
          ('memory', 'bank:0:5', 'slot', 'C1_DIMM1'),
          ('memory', 'bank:0:6', 'size', '1073741824'),
          ('memory', 'bank:0:6', 'description', 'DIMM Synchronous'),
          ('memory', 'bank:0:6', 'slot', 'C1_DIMM2'),
          ('memory', 'bank:0:7', 'size', '1073741824'),
          ('memory', 'bank:0:7', 'description', 'DIMM Synchronous'),
          ('memory', 'bank:0:7', 'slot', 'C1_DIMM3'),
          ('memory', 'banks', 'count', '8'),
          ('cpu', 'physical_0', 'physid', '3'),
          ('cpu', 'physical_0', 'product',
           'Dual-Core AMD Opteron(tm) Processor 8218'),
          ('cpu', 'physical_0', 'vendor', 'Advanced Micro Devices [AMD]'),
          ('cpu', 'physical_0', 'version', 'AMD'),
          ('cpu', 'physical_0', 'frequency', '1000000000'),
          ('cpu', 'physical_0', 'clock', '200000000'),
          ('cpu', 'physical_0', 'flags',
           'fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic '
           'sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht '
           'syscall nx mmxext fxsr_opt rdtscp x86-64 3dnowext 3dnow '
           'rep_good nopl extd_apicid pni cx16 lahf_lm cmp_legacy svm '
           'extapic cr8_legacy cpufreq'),
          ('cpu', 'physical_1', 'physid', '4'),
          ('cpu', 'physical_1', 'product',
           'Dual-Core AMD Opteron(tm) Processor 8218'),
          ('cpu', 'physical_1', 'vendor', 'Advanced Micro Devices [AMD]'),
          ('cpu', 'physical_1', 'version', 'AMD'),
          ('cpu', 'physical_1', 'frequency', '1000000000'),
          ('cpu', 'physical_1', 'clock', '200000000'),
          ('cpu', 'physical_1', 'flags',
           'fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep '
           'mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht '
           'syscall nx mmxext fxsr_opt rdtscp x86-64 3dnowext 3dnow '
           'rep_good nopl extd_apicid pni cx16 lahf_lm cmp_legacy svm '
           'extapic cr8_legacy cpufreq'),
          ('cpu', 'physical', 'number', '2'),
          ('cpu', 'logical', 'number', '4'),
          ('system', 'os', 'vendor', 'Ubuntu'),
          ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
          ('system', 'kernel', 'version', '3.13.0-24-generic'),
          ('system', 'kernel', 'arch', 'x86_64'),
          ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
          ]
         )
Exemple #46
0
 def test_parse_lan_info(self):
     res = []
     ipmi.parse_lan_info(sample('ipmi_lan_info'), res)
     self.assertEqual(len(res), 19)
Exemple #47
0
 def test_parse_lan_info(self):
     res = []
     ipmi.parse_lan_info(sample('ipmi_lan_info'), res)
     self.assertEqual(len(res), 19)
Exemple #48
0
 def test_detect_system_2(self, mock_cmd, mock_get_uuid, mock_get_cpus, mock_output_lines):
     result = []
     detect.detect_system(result, sample('lshw2'))
     self.assertEqual(
         result,
         [('system', 'product', 'serial', 'PB4F20N'),
          ('system', 'product', 'name', '2347GF8 (LENOVO_MT_2347)'),
          ('system', 'product', 'vendor', 'LENOVO'),
          ('system', 'product', 'version', 'ThinkPad T430'),
          ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
          ('system', 'motherboard', 'name', '2347GF8'),
          ('system', 'motherboard', 'vendor', 'LENOVO'),
          ('system', 'motherboard', 'version', 'Not Defined'),
          ('system', 'motherboard', 'serial', '1ZLMB31B1G6'),
          ('firmware', 'bios', 'version', 'G1ET73WW (2.09 )'),
          ('firmware', 'bios', 'date', '10/19/2012'),
          ('firmware', 'bios', 'vendor', 'LENOVO'),
          ('memory', 'total', 'size', '8589934592'),
          ('memory', 'bank:0', 'size', '4294967296'),
          ('memory', 'bank:0', 'clock', '1600000000'),
          ('memory', 'bank:0', 'description',
           'SODIMM DDR3 Synchrone 1600 MHz (0,6 ns)'),
          ('memory', 'bank:0', 'vendor', 'Samsung'),
          ('memory', 'bank:0', 'product', 'M471B5273CH0-CK0'),
          ('memory', 'bank:0', 'serial', '1222BCCE'),
          ('memory', 'bank:0', 'slot', 'ChannelA-DIMM0'),
          ('memory', 'bank:1', 'size', '4294967296'),
          ('memory', 'bank:1', 'clock', '1600000000'),
          ('memory', 'bank:1', 'description',
           'SODIMM DDR3 Synchrone 1600 MHz (0,6 ns)'),
          ('memory', 'bank:1', 'vendor', 'Samsung'),
          ('memory', 'bank:1', 'product', 'M471B5273CH0-CK0'),
          ('memory', 'bank:1', 'serial', '1222BCA2'),
          ('memory', 'bank:1', 'slot', 'ChannelB-DIMM0'),
          ('memory', 'banks', 'count', '2'),
          ('network', 'eth0', 'businfo', 'pci@0000:00:19.0'),
          ('network', 'eth0', 'vendor', 'Intel Corporation'),
          ('network', 'eth0', 'product',
           '82579LM Gigabit Network Connection'),
          ('network', 'eth0', 'firmware', '0.13-3'),
          ('network', 'eth0', 'link', 'no'),
          ('network', 'eth0', 'driver', 'e1000e'),
          ('network', 'eth0', 'latency', '0'),
          ('network', 'eth0', 'autonegotiation', 'on'),
          ('network', 'eth0', 'serial', '00:21:cc:d9:bf:26'),
          ('network', 'wlan0', 'businfo', 'pci@0000:03:00.0'),
          ('network', 'wlan0', 'vendor', 'Intel Corporation'),
          ('network', 'wlan0', 'product',
           'Centrino Advanced-N 6205 [Taylor Peak]'),
          ('network', 'wlan0', 'firmware', '18.168.6.1'),
          ('network', 'wlan0', 'ipv4', '192.168.1.185'),
          ('network', 'wlan0', 'ipv4-netmask', '255.255.255.0'),
          ('network', 'wlan0', 'ipv4-cidr', '24'),
          ('network', 'wlan0', 'ipv4-network', '192.168.1.0'),
          ('network', 'wlan0', 'link', 'yes'),
          ('network', 'wlan0', 'driver', 'iwlwifi'),
          ('network', 'wlan0', 'latency', '0'),
          ('network', 'wlan0', 'serial', '84:3a:4b:33:62:82'),
          ('network', 'wwan0', 'firmware',
           'Mobile Broadband Network Device'),
          ('network', 'wwan0', 'link', 'no'),
          ('network', 'wwan0', 'driver', 'cdc_ncm'),
          ('network', 'wwan0', 'serial', '02:15:e0:ec:01:00'),
          ('system', 'os', 'vendor', 'Ubuntu'),
          ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
          ('system', 'kernel', 'version', '3.13.0-24-generic'),
          ('system', 'kernel', 'arch', 'x86_64'),
          ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
          ]
     )
Exemple #49
0
 def test_detect_system(self, mock_cmd, mock_get_uuid, mock_get_cpus, mock_output_lines):
     result = []
     detect.detect_system(result, sample('lshw'))
     self.assertEqual(
         result,
         [('system', 'product', 'serial', 'C02JR02WF57J'),
          ('system', 'product', 'name', 'MacBookAir5,2 (System SKU#)'),
          ('system', 'product', 'vendor', 'Apple Inc.'),
          ('system', 'product', 'version', '1.0'),
          ('system', 'product', 'uuid', '83462C81-52BA-11CB-870F'),
          ('system', 'motherboard', 'name', 'Mac-2E6FAB96566FE58C'),
          ('system', 'motherboard', 'vendor', 'Apple Inc.'),
          ('system', 'motherboard', 'version', 'MacBookAir5,2'),
          ('system', 'motherboard', 'serial', 'C02245301ZFF25WAT'),
          ('firmware', 'bios', 'version', 'MBA51.88Z.00EF.B01.1207271122'),
          ('firmware', 'bios', 'date', '07/27/2012'),
          ('firmware', 'bios', 'vendor', 'Apple Inc.'),
          ('memory', 'total', 'size', '8589934592'),
          ('memory', 'bank:0', 'size', '4294967296'),
          ('memory', 'bank:0', 'clock', '1600000000'),
          ('memory', 'bank:0', 'description',
           'SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)'),
          ('memory', 'bank:0', 'vendor',
           'Hynix Semiconductor (Hyundai Electronics)'),
          ('memory', 'bank:0', 'product', 'HMT451S6MFR8A-PB'),
          ('memory', 'bank:0', 'serial', '0x00000000'),
          ('memory', 'bank:0', 'slot', 'DIMM0'),
          ('memory', 'bank:1', 'size', '4294967296'),
          ('memory', 'bank:1', 'clock', '1600000000'),
          ('memory', 'bank:1', 'description',
           'SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)'),
          ('memory', 'bank:1', 'vendor',
           'Hynix Semiconductor (Hyundai Electronics)'),
          ('memory', 'bank:1', 'product', 'HMT451S6MFR8A-PB'),
          ('memory', 'bank:1', 'serial', '0x00000000'),
          ('memory', 'bank:1', 'slot', 'DIMM0'),
          ('memory', 'banks', 'count', '2'),
          ('network', 'vnet0', 'size', '10000000'),
          ('network', 'vnet0', 'link', 'yes'),
          ('network', 'vnet0', 'driver', 'tun'),
          ('network', 'vnet0', 'duplex', 'full'),
          ('network', 'vnet0', 'speed', '10Mbit/s'),
          ('network', 'vnet0', 'autonegotiation', 'off'),
          ('network', 'vnet0', 'serial', 'fe:54:00:c1:1a:f7'),
          ('network', 'tap0', 'size', '10000000'),
          ('network', 'tap0', 'ipv4', '10.152.18.103'),
          ('network', 'tap0', 'ipv4-netmask', '255.255.255.0'),
          ('network', 'tap0', 'ipv4-cidr', '24'),
          ('network', 'tap0', 'ipv4-network', '10.152.18.0'),
          ('network', 'tap0', 'link', 'yes'),
          ('network', 'tap0', 'driver', 'tun'),
          ('network', 'tap0', 'duplex', 'full'),
          ('network', 'tap0', 'speed', '10Mbit/s'),
          ('network', 'tap0', 'autonegotiation', 'off'),
          ('network', 'tap0', 'serial', 'e2:66:69:22:be:fb'),
          ('network', 'wlan0', 'firmware', 'N/A'),
          ('network', 'wlan0', 'ipv4', '192.168.12.13'),
          ('network', 'wlan0', 'ipv4-netmask', '255.255.255.0'),
          ('network', 'wlan0', 'ipv4-cidr', '24'),
          ('network', 'wlan0', 'ipv4-network', '192.168.12.0'),
          ('network', 'wlan0', 'link', 'yes'),
          ('network', 'wlan0', 'driver', 'brcmsmac'),
          ('network', 'wlan0', 'serial', '00:88:65:35:2b:50'),
          ('system', 'os', 'vendor', 'Ubuntu'),
          ('system', 'os', 'version', 'Ubuntu 14.04 LTS'),
          ('system', 'kernel', 'version', '3.13.0-24-generic'),
          ('system', 'kernel', 'arch', 'x86_64'),
          ('system', 'kernel', 'cmdline', 'BOOT_IMAGE=/boot/vmlinuz'),
          ]
     )
         Model: ATA     MB2000GBUPB
         SATA NCQ Capable: True
         SATA NCQ Enabled: True
         Current Temperature (C): 32
         Maximum Temperature (C): 36
         PHY Count: 1
         PHY Transfer Rate: 6.0Gbps
         Drive Authentication Status: OK
         Carrier Application Version: 11
         Carrier Bootloader Version: 6


'''

# => ctrl slot=2 ld 1 show
CTRL_LD_SHOW_OUTPUT = sample('ctrl_ld_show')

CTRL_LD_SHOW_RESULT = {
    'Caching': 'Enabled',
    'Caching Association': 'None',
    'Cylinders': '23934',
    'Disk Name': '/dev/sda',
    'Drive Type': 'Data',
    'Fault Tolerance': '1',
    'Full Stripe Size': '256 KB',
    'Heads': '255',
    'Logical Drive': '1',
    'Logical Drive Label': 'A299BBB1PDKRH0ARH4F1R6D4B9',
    'Mirror Group 0': '2I:1:7',
    'Mirror Group 1': '2I:1:8',
    'Mount Points': 'None',
Exemple #51
0
 def test_parse_output_adpcount(self):
     self.assertEqual(megacli.parse_output(sample('megacli_adpcount')),
                      {'ControllerCount': 1,
                       'ExitCode': '0x01'})
Exemple #52
0
 def test_detect_system(self, mock_cmd, mock_get_uuid, mock_get_cpus,
                        mock_output_lines):
     result = []
     detect.detect_system(result, sample('lshw'))
     self.assertEqual(result, detect_results.DETECT_SYSTEM_RESULT)
Exemple #53
0
    def test_parse_lldp_tin(self):
        return self.assertEqual(
            detect_utils.parse_lldtool([], "eth0", LLDPTOOL_TIN.split('\n')),
            LLDPTOOL_TIN_RESULTS)

    def test_parse_lldp_tin2(self):
        return self.assertEqual(
            detect_utils.parse_lldtool([], "eth0", LLDPTOOL_TIN2.split('\n')),
            LLDPTOOL_TIN2_RESULTS)


##############################################################################
# Output from real commands and expected results below
##############################################################################

LLDPTOOL_TIN = sample('lldptool_tin')

LLDPTOOL_TIN2 = sample('lldptool_tin2')

LLDPTOOL_TIN_RESULTS = [
    ('lldp', 'eth0', 'Chassis ID/MAC',
     'f8:b1:56:15:e6:c6'),
    ('lldp', 'eth0', 'Port ID/Ifname', 'gi1_1'),
    ('lldp', 'eth0', 'Time to Live', '120'),
    ('lldp',
     'eth0',
     'MAC_PHY Configuration Status',
     'Auto-negotiation supported and enabled'),
    ('lldp',
     'eth0',
     'MAC_PHY Configuration Status/PMD auto-negotiation capabilities',