774774If Selective self-test is pending on power-up, resume after 0 minute delay.
775775"""
776776
777+ output_wdc_vendor = """
778+ smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.0-18-2-amd64] (local build)
779+ Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
780+
781+ === START OF INFORMATION SECTION ===
782+ Device Model: WDC PC SA530 SDASN8Y1T00
783+ Serial Number: 2122FF441406
784+ LU WWN Device Id: 5 001b44 4a7dc5677
785+ Firmware Version: 40103000
786+ User Capacity: 1,024,209,543,168 bytes [1.02 TB]
787+ Sector Size: 512 bytes logical/physical
788+ Rotation Rate: Solid State Device
789+ Form Factor: M.2
790+ TRIM Command: Available, deterministic, zeroed
791+ Device is: Not in smartctl database [for details use: -P showall]
792+ ATA Version is: ACS-4 T13/BSR INCITS 529 revision 5
793+ SATA Version is: SATA 3.3, 6.0 Gb/s (current: 6.0 Gb/s)
794+ Local Time is: Thu Feb 15 14:12:34 2024 UTC
795+ SMART support is: Available - device has SMART capability.
796+ SMART support is: Enabled
797+
798+ === START OF READ SMART DATA SECTION ===
799+ SMART overall-health self-assessment test result: PASSED
800+
801+ General SMART Values:
802+ Offline data collection status: (0x00) Offline data collection activity
803+ was never started.
804+ Auto Offline Data Collection: Disabled.
805+ Self-test execution status: ( 0) The previous self-test routine completed
806+ without error or no self-test has ever
807+ been run.
808+ Total time to complete Offline
809+ data collection: ( 0) seconds.
810+ Offline data collection
811+ capabilities: (0x11) SMART execute Offline immediate.
812+ No Auto Offline data collection support.
813+ Suspend Offline collection upon new
814+ command.
815+ No Offline surface scan supported.
816+ Self-test supported.
817+ No Conveyance Self-test supported.
818+ No Selective Self-test supported.
819+ SMART capabilities: (0x0003) Saves SMART data before entering
820+ power-saving mode.
821+ Supports SMART auto save timer.
822+ Error logging capability: (0x01) Error logging supported.
823+ General Purpose Logging supported.
824+ Short self-test routine
825+ recommended polling time: ( 2) minutes.
826+ Extended self-test routine
827+ recommended polling time: ( 10) minutes.
828+
829+ SMART Attributes Data Structure revision number: 4
830+ Vendor Specific SMART Attributes with Thresholds:
831+ ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
832+ 5 Reallocated_Sector_Ct 0x0032 100 100 --- Old_age Always - 0
833+ 9 Power_On_Hours 0x0032 100 100 --- Old_age Always - 18904
834+ 12 Power_Cycle_Count 0x0032 100 100 --- Old_age Always - 169
835+ 165 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 28311878
836+ 166 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 1
837+ 167 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 54
838+ 168 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 10
839+ 169 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 361
840+ 170 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0
841+ 171 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0
842+ 172 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0
843+ 173 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 5
844+ 174 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 61
845+ 184 End-to-End_Error 0x0032 100 100 --- Old_age Always - 0
846+ 187 Reported_Uncorrect 0x0032 100 100 --- Old_age Always - 0
847+ 188 Command_Timeout 0x0032 100 100 --- Old_age Always - 0
848+ 194 Temperature_Celsius 0x0022 077 059 --- Old_age Always - 23 (Min/Max 16/59)
849+ 199 UDMA_CRC_Error_Count 0x0032 100 100 --- Old_age Always - 0
850+ 230 Unknown_SSD_Attribute 0x0032 001 001 --- Old_age Always - 279176151105
851+ 232 Available_Reservd_Space 0x0033 100 100 004 Pre-fail Always - 100
852+ 233 Media_Wearout_Indicator 0x0032 100 100 --- Old_age Always - 5374
853+ 234 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 7530
854+ 241 Total_LBAs_Written 0x0030 253 253 --- Old_age Offline - 6756
855+ 242 Total_LBAs_Read 0x0030 253 253 --- Old_age Offline - 963
856+ 244 Unknown_Attribute 0x0032 000 100 --- Old_age Always - 0
857+
858+ SMART Error Log Version: 1
859+ No Errors Logged
860+
861+ SMART Self-test log structure revision number 1
862+ No self-tests have been logged. [To run self-tests, use: smartctl -t]
863+
864+ Selective Self-tests/Logging not supported
865+ """
866+
777867class TestSsdGeneric :
778868 @mock .patch ('sonic_platform_base.sonic_ssd.ssd_generic.SsdUtil._execute_shell' , mock .MagicMock (return_value = output_nvme_ssd ))
779869 def test_nvme_ssd (self ):
@@ -891,3 +981,13 @@ def test_swissbit_ssd(self, mock_exec):
891981 assert swissbit_ssd .get_firmware () == "SBR15004"
892982 assert swissbit_ssd .get_temperature () == '25'
893983 assert swissbit_ssd .get_serial () == "00006022750795000010"
984+
985+ @mock .patch ('sonic_platform_base.sonic_ssd.ssd_generic.SsdUtil._execute_shell' )
986+ def test_wdc_ssd (self , mock_exec ):
987+ mock_exec .return_value = output_wdc_vendor
988+ wdc_ssd = SsdUtil ('/dev/sda' )
989+ assert wdc_ssd .get_health () == 98
990+ assert wdc_ssd .get_model () == 'WDC PC SA530 SDASN8Y1T00'
991+ assert wdc_ssd .get_firmware () == "40103000"
992+ assert wdc_ssd .get_temperature () == '23'
993+ assert wdc_ssd .get_serial () == "2122FF441406"
0 commit comments