|
819 | 819 | Health Percentage: 71%
|
820 | 820 | """
|
821 | 821 |
|
| 822 | +output_wdc_vendor = """ |
| 823 | +smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.0-18-2-amd64] (local build) |
| 824 | +Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org |
| 825 | +
|
| 826 | +=== START OF INFORMATION SECTION === |
| 827 | +Device Model: WDC PC SA530 SDASN8Y1T00 |
| 828 | +Serial Number: 2122FF441406 |
| 829 | +LU WWN Device Id: 5 001b44 4a7dc5677 |
| 830 | +Firmware Version: 40103000 |
| 831 | +User Capacity: 1,024,209,543,168 bytes [1.02 TB] |
| 832 | +Sector Size: 512 bytes logical/physical |
| 833 | +Rotation Rate: Solid State Device |
| 834 | +Form Factor: M.2 |
| 835 | +TRIM Command: Available, deterministic, zeroed |
| 836 | +Device is: Not in smartctl database [for details use: -P showall] |
| 837 | +ATA Version is: ACS-4 T13/BSR INCITS 529 revision 5 |
| 838 | +SATA Version is: SATA 3.3, 6.0 Gb/s (current: 6.0 Gb/s) |
| 839 | +Local Time is: Thu Feb 15 14:12:34 2024 UTC |
| 840 | +SMART support is: Available - device has SMART capability. |
| 841 | +SMART support is: Enabled |
| 842 | +
|
| 843 | +=== START OF READ SMART DATA SECTION === |
| 844 | +SMART overall-health self-assessment test result: PASSED |
| 845 | +
|
| 846 | +General SMART Values: |
| 847 | +Offline data collection status: (0x00) Offline data collection activity |
| 848 | + was never started. |
| 849 | + Auto Offline Data Collection: Disabled. |
| 850 | +Self-test execution status: ( 0) The previous self-test routine completed |
| 851 | + without error or no self-test has ever |
| 852 | + been run. |
| 853 | +Total time to complete Offline |
| 854 | +data collection: ( 0) seconds. |
| 855 | +Offline data collection |
| 856 | +capabilities: (0x11) SMART execute Offline immediate. |
| 857 | + No Auto Offline data collection support. |
| 858 | + Suspend Offline collection upon new |
| 859 | + command. |
| 860 | + No Offline surface scan supported. |
| 861 | + Self-test supported. |
| 862 | + No Conveyance Self-test supported. |
| 863 | + No Selective Self-test supported. |
| 864 | +SMART capabilities: (0x0003) Saves SMART data before entering |
| 865 | + power-saving mode. |
| 866 | + Supports SMART auto save timer. |
| 867 | +Error logging capability: (0x01) Error logging supported. |
| 868 | + General Purpose Logging supported. |
| 869 | +Short self-test routine |
| 870 | +recommended polling time: ( 2) minutes. |
| 871 | +Extended self-test routine |
| 872 | +recommended polling time: ( 10) minutes. |
| 873 | +
|
| 874 | +SMART Attributes Data Structure revision number: 4 |
| 875 | +Vendor Specific SMART Attributes with Thresholds: |
| 876 | +ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE |
| 877 | + 5 Reallocated_Sector_Ct 0x0032 100 100 --- Old_age Always - 0 |
| 878 | + 9 Power_On_Hours 0x0032 100 100 --- Old_age Always - 18904 |
| 879 | + 12 Power_Cycle_Count 0x0032 100 100 --- Old_age Always - 169 |
| 880 | +165 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 28311878 |
| 881 | +166 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 1 |
| 882 | +167 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 54 |
| 883 | +168 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 10 |
| 884 | +169 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 361 |
| 885 | +170 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0 |
| 886 | +171 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0 |
| 887 | +172 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0 |
| 888 | +173 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 5 |
| 889 | +174 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 61 |
| 890 | +184 End-to-End_Error 0x0032 100 100 --- Old_age Always - 0 |
| 891 | +187 Reported_Uncorrect 0x0032 100 100 --- Old_age Always - 0 |
| 892 | +188 Command_Timeout 0x0032 100 100 --- Old_age Always - 0 |
| 893 | +194 Temperature_Celsius 0x0022 077 059 --- Old_age Always - 23 (Min/Max 16/59) |
| 894 | +199 UDMA_CRC_Error_Count 0x0032 100 100 --- Old_age Always - 0 |
| 895 | +230 Unknown_SSD_Attribute 0x0032 001 001 --- Old_age Always - 279176151105 |
| 896 | +232 Available_Reservd_Space 0x0033 100 100 004 Pre-fail Always - 100 |
| 897 | +233 Media_Wearout_Indicator 0x0032 100 100 --- Old_age Always - 5374 |
| 898 | +234 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 7530 |
| 899 | +241 Total_LBAs_Written 0x0030 253 253 --- Old_age Offline - 6756 |
| 900 | +242 Total_LBAs_Read 0x0030 253 253 --- Old_age Offline - 963 |
| 901 | +244 Unknown_Attribute 0x0032 000 100 --- Old_age Always - 0 |
| 902 | +
|
| 903 | +SMART Error Log Version: 1 |
| 904 | +No Errors Logged |
| 905 | +
|
| 906 | +SMART Self-test log structure revision number 1 |
| 907 | +No self-tests have been logged. [To run self-tests, use: smartctl -t] |
| 908 | +
|
| 909 | +Selective Self-tests/Logging not supported |
| 910 | +""" |
| 911 | + |
822 | 912 | class TestSsdGeneric:
|
823 | 913 | @mock.patch('sonic_platform_base.sonic_ssd.ssd_generic.SsdUtil._execute_shell', mock.MagicMock(return_value=output_nvme_ssd))
|
824 | 914 | def test_nvme_ssd(self):
|
@@ -948,3 +1038,13 @@ def test_transcend_ssd(self, mock_exec):
|
948 | 1038 | assert transcend_ssd.get_firmware() == "O0918B"
|
949 | 1039 | assert transcend_ssd.get_temperature() == '40'
|
950 | 1040 | assert transcend_ssd.get_serial() == "F318410080"
|
| 1041 | + |
| 1042 | + @mock.patch('sonic_platform_base.sonic_ssd.ssd_generic.SsdUtil._execute_shell') |
| 1043 | + def test_wdc_ssd(self, mock_exec): |
| 1044 | + mock_exec.return_value = output_wdc_vendor |
| 1045 | + swissbit_ssd = SsdUtil('/dev/sda') |
| 1046 | + assert swissbit_ssd.get_health() == '100' |
| 1047 | + assert swissbit_ssd.get_model() == 'WDC PC SA530 SDASN8Y1T00' |
| 1048 | + assert swissbit_ssd.get_firmware() == "40103000" |
| 1049 | + assert swissbit_ssd.get_temperature() == '23' |
| 1050 | + assert swissbit_ssd.get_serial() == "2122FF441406" |
0 commit comments