|
532 | 532 | ID Attribute High Raw Low Raw Value Worst Threshold
|
533 | 533 | """
|
534 | 534 |
|
| 535 | +output_swissbit_vendor = """ |
| 536 | +smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.0-23-2-amd64] (local build) |
| 537 | +Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org |
| 538 | +
|
| 539 | +=== START OF INFORMATION SECTION === |
| 540 | +Device Model: SFSA160GM2AK2TO-I-8C-22K-STD |
| 541 | +Serial Number: 00006022750795000010 |
| 542 | +Firmware Version: SBR15004 |
| 543 | +User Capacity: 160,041,885,696 bytes [160 GB] |
| 544 | +Sector Size: 512 bytes logical/physical |
| 545 | +Rotation Rate: Solid State Device |
| 546 | +Form Factor: 2.5 inches |
| 547 | +TRIM Command: Available, deterministic, zeroed |
| 548 | +Device is: Not in smartctl database [for details use: -P showall] |
| 549 | +ATA Version is: ACS-3 (minor revision not indicated) |
| 550 | +SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s) |
| 551 | +Local Time is: Wed Aug 2 08:24:31 2023 UTC |
| 552 | +SMART support is: Available - device has SMART capability. |
| 553 | +SMART support is: Enabled |
| 554 | +
|
| 555 | +=== START OF READ SMART DATA SECTION === |
| 556 | +SMART overall-health self-assessment test result: PASSED |
| 557 | +
|
| 558 | +General SMART Values: |
| 559 | +Offline data collection status: (0x00) Offline data collection activity |
| 560 | + was never started. |
| 561 | + Auto Offline Data Collection: Disabled. |
| 562 | +Self-test execution status: ( 0) The previous self-test routine completed |
| 563 | + without error or no self-test has ever |
| 564 | + been run. |
| 565 | +Total time to complete Offline |
| 566 | +data collection: ( 0) seconds. |
| 567 | +Offline data collection |
| 568 | +capabilities: (0x53) SMART execute Offline immediate. |
| 569 | + Auto Offline data collection on/off support. |
| 570 | + Suspend Offline collection upon new |
| 571 | + command. |
| 572 | + No Offline surface scan supported. |
| 573 | + Self-test supported. |
| 574 | + No Conveyance Self-test supported. |
| 575 | + Selective Self-test supported. |
| 576 | +SMART capabilities: (0x0003) Saves SMART data before entering |
| 577 | + power-saving mode. |
| 578 | + Supports SMART auto save timer. |
| 579 | +Error logging capability: (0x01) Error logging supported. |
| 580 | + General Purpose Logging supported. |
| 581 | +Short self-test routine |
| 582 | +recommended polling time: ( 2) minutes. |
| 583 | +Extended self-test routine |
| 584 | +recommended polling time: ( 15) minutes. |
| 585 | +SCT capabilities: (0x0031) SCT Status supported. |
| 586 | + SCT Feature Control supported. |
| 587 | + SCT Data Table supported. |
| 588 | +
|
| 589 | +SMART Attributes Data Structure revision number: 1 |
| 590 | +Vendor Specific SMART Attributes with Thresholds: |
| 591 | +ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE |
| 592 | + 1 Raw_Read_Error_Rate 0x000b 100 100 000 Pre-fail Always - 0 |
| 593 | + 5 Reallocated_Sector_Ct 0x0013 100 100 000 Pre-fail Always - 0 |
| 594 | + 9 Power_On_Hours 0x0012 100 100 000 Old_age Always - 825 |
| 595 | + 12 Power_Cycle_Count 0x0012 100 100 000 Old_age Always - 447 |
| 596 | + 16 Unknown_Attribute 0x0112 100 100 001 Old_age Always - 4 |
| 597 | + 17 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 30000 |
| 598 | +160 Unknown_Attribute 0x0002 100 100 000 Old_age Always - 0 |
| 599 | +161 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 15401195 |
| 600 | +163 Unknown_Attribute 0x0003 100 100 000 Pre-fail Always - 33 |
| 601 | +164 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 6506 |
| 602 | +165 Unknown_Attribute 0x0002 100 100 000 Old_age Always - 38 |
| 603 | +166 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 1 |
| 604 | +167 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 4 |
| 605 | +168 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 30000 |
| 606 | +169 Unknown_Attribute 0x0003 100 100 000 Pre-fail Always - 421 |
| 607 | +193 Unknown_SSD_Attribute 0x0012 100 100 000 Old_age Always - 0 |
| 608 | +194 Temperature_Celsius 0x0023 100 100 000 Pre-fail Always - 25 (Min/Max 22/45) |
| 609 | +195 Hardware_ECC_Recovered 0x0012 100 100 000 Old_age Always - 0 |
| 610 | +196 Reallocated_Event_Count 0x0012 000 000 000 Old_age Always - 0 |
| 611 | +198 Offline_Uncorrectable 0x0012 100 100 000 Old_age Always - 0 |
| 612 | +199 UDMA_CRC_Error_Count 0x000b 100 100 000 Pre-fail Always - 0 |
| 613 | +215 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 4275 |
| 614 | +231 Unknown_SSD_Attribute 0x1913 100 100 025 Pre-fail Always - 100 |
| 615 | +235 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 1302467136 |
| 616 | +237 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 0 |
| 617 | +241 Total_LBAs_Written 0x0012 100 100 000 Old_age Always - 1186450104 |
| 618 | +242 Total_LBAs_Read 0x0012 100 100 000 Old_age Always - 2257141451 |
| 619 | +243 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 0 |
| 620 | +244 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 0 |
| 621 | +248 Unknown_Attribute 0x0112 100 100 001 Old_age Always - 100 |
| 622 | +
|
| 623 | +SMART Error Log Version: 1 |
| 624 | +No Errors Logged |
| 625 | +
|
| 626 | +SMART Self-test log structure revision number 1 |
| 627 | +No self-tests have been logged. [To run self-tests, use: smartctl -t] |
| 628 | +
|
| 629 | +SMART Selective self-test log data structure revision number 1 |
| 630 | + SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS |
| 631 | + 1 0 0 Not_testing |
| 632 | + 2 0 0 Not_testing |
| 633 | + 3 0 0 Not_testing |
| 634 | + 4 0 0 Not_testing |
| 635 | + 5 0 0 Not_testing |
| 636 | +Selective self-test flags (0x0): |
| 637 | + After scanning selected spans, do NOT read-scan remainder of disk. |
| 638 | +If Selective self-test is pending on power-up, resume after 0 minute delay. |
| 639 | +""" |
| 640 | + |
535 | 641 | class TestSsdGeneric:
|
536 | 642 | @mock.patch('sonic_platform_base.sonic_ssd.ssd_generic.SsdUtil._execute_shell', mock.MagicMock(return_value=output_nvme_ssd))
|
537 | 643 | def test_nvme_ssd(self):
|
@@ -631,3 +737,13 @@ def test_virtium_ssd(self, mock_exec):
|
631 | 737 | mock_exec.side_effect = [output_virtium_generic, output_virtium_invalid_remain_life]
|
632 | 738 | virtium_ssd = SsdUtil('/dev/sda')
|
633 | 739 | assert virtium_ssd.get_health() == "N/A"
|
| 740 | + |
| 741 | + @mock.patch('sonic_platform_base.sonic_ssd.ssd_generic.SsdUtil._execute_shell') |
| 742 | + def test_swissbit_ssd(self, mock_exec): |
| 743 | + mock_exec.return_value = output_swissbit_vendor |
| 744 | + swissbit_ssd = SsdUtil('/dev/sda') |
| 745 | + assert swissbit_ssd.get_health() == '100' |
| 746 | + assert swissbit_ssd.get_model() == 'SFSA160GM2AK2TO-I-8C-22K-STD' |
| 747 | + assert swissbit_ssd.get_firmware() == "SBR15004" |
| 748 | + assert swissbit_ssd.get_temperature() == '25' |
| 749 | + assert swissbit_ssd.get_serial() == "00006022750795000010" |
0 commit comments