The PSU CLI and SNMP support - Staphylo/SONiC GitHub Wiki
The PSU CLI and SNMP support
High Level Design Document
Rev 0.3
Table of Contents
List of Tables
Revision
Rev | Date | Author | Change Description |
---|---|---|---|
0.1 | Andrii Savka | Initial version | |
0.2 | Andrii Savka | Added presence status to API and CLI |
About this Manual
This document provides general information about the PSU CLI and SNMP support feature.
Scope
This document describes the high level design of the PSU CLI and SNMP support feature.
Definitions/Abbreviation
Table 2: Abbreviations
Definitions/Abbreviation | Description |
---|---|
SNMP | Simple Network Management Protocol |
PSU | Power supply unit |
API | Application Programmable Interface |
CLI | Command-line utility |
1 Overview
1.1 PSU Chart
Following diagram describes a top level overview of the SONiC PSU architecture:
1.2 Modules description
1.2.1 SNMP agent
The agent handles the SNMP requests and takes the PSU status from PSU API.
1.2.2 SONiC-utilities
The command-line utilities for SONiC
1.2.3 PSU daemon
The daemon is to collect the PSU information and write to state DB.
2 Requirements
2.1 Platform PSU API
Microsoft will develop a simple plugin-style API in the vein of sfputil.py and led_control.py. Each vendor needs to implement the PSU module for API which should consist the implementation of each function. The API has the following functions:
API | Return value | Description |
---|---|---|
get_num_psus() | integer | the number of PSUs which are supported in the platform |
get_psu_status(psu_index) | True if PSU has correct functioning, False if not. | Function takes a zero-based PSU index and provides the status. Any platform-specific appropriate voltage/amperage/temperature calculations should be carried out to determine whether the PSU is operating properly or not. |
get_psu_presence(psu_index) | True if PSU is plugged, False if not. | Function takes a zero-based PSU index and provides the presence info |
2.2 Command-line utility for querying PSU status
Mellanox will implement a simple Python command-line utility which implements the plugin and can output the status of each PSU/all PSUs. The CLI will get the data from state DB to show the PSU status and presence info. The CLI should have the following behavior:
Input parameters | CLI expected result |
---|---|
No Input parameters | Provide the status of all PSUs which are available in the platform |
PSU ID | Provide the status for specific PSU |
The CLI has a following output:
Module | Status |
---|---|
PSU 1 | OK (status == True, presence == True) |
PSU 2 | NOT OK (status == False, presence == True) |
PSU X | NOT PRESENT (presence == False) |
2.3 SNMP agent support
Mellanox will add the PSU support to SNMP agent for retrieving PSU statuses. Querying below OID should return the status of PSU/PSUs in the platform. The response has following integer values:
- “1” for proper operational status
- “0” for faulty
The following OID should be supported:
OID | Description of the SNMP instance |
---|---|
1.3.6.1.4.1.9.9.117.1.1.2 | cefcFRUPowerStatusTable |
1.3.6.1.4.1.9.9.117.1.1.2.1 | cefcFRUPowerStatusEntry |
1.3.6.1.4.1.9.9.117.1.1.2.1.2 | return the statuses of all PSUs which are available in the platform |
1.3.6.1.4.1.9.9.117.1.1.2.1.2.psu_index | return the status of PSU specified by psu_index |
3 Modules Design
3.1 Modules that need to be updated
3.1.1 SNMP agent
The support for the new PSU OID should be added.
3.1.2 SONiC-utilities
The following components should be implemented:
- The PSU plugin-style API for SONiC that takes a zero-based PSU ID and returns a boolean value indicating the status of the PSU.
- The Python command-line utility that provides the PSU(s) status. Also PSU status should be available in general "show platform psustatus" command.
- Each vendor needs to provide the PSU module which should consists the implementation of PSU API. The module should be placed under "sonic-buildimage/device/[vendor]/[platform]/plugins/psuutil.py" directory and will be loaded by CLI.
3.1.3 PSU daemon
- Supervisord takes charge of this daemon. This daemon will loop every 3 seconds and get the data from PSU API and then write it the state DB.
- The num_psus will store in "chassis_info" table. It will just be invoked one time when system boot up or reload. The key is chassis_name, the field is "num_psus" and the value is gotten from PSU API get_num_psus().
- The psu_status and psu_presence will store in "psu_info" table. It will be updated every 3 seconds. The key is psu_name, the field is "presence" and "status", the value is from PSU API get_psu_presence() and get_psu_num().