Skip to content

Commit

Permalink
Add sonic_psu module along with initial psu_base.py base class for pl…
Browse files Browse the repository at this point in the history
…ugins (sonic-net#116)
  • Loading branch information
jleveque authored Oct 6, 2017
1 parent 77c9f81 commit c06b37a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
url='https://github.com/Azure/sonic-utilities',
maintainer='Joe LeVeque',
maintainer_email='[email protected]',
packages=['config', 'sfputil', 'show', 'sonic_eeprom', 'sonic_sfp', "sonic_installer"],
packages=['config', 'sfputil', 'show', 'sonic_eeprom', 'sonic_installer', 'sonic_psu', 'sonic_sfp'],
package_data={
'show': ['aliases.ini']
},
Expand Down
Empty file added sonic_psu/__init__.py
Empty file.
26 changes: 26 additions & 0 deletions sonic_psu/psu_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
#
# psu_base.py
#
# Abstract base class for implementing platform-specific
# PSU control functionality for SONiC
#

try:
import abc
except ImportError, e:
raise ImportError (str(e) + " - required module not found")

class PsuBase(object):
__metaclass__ = abc.ABCMeta

@abc.abstractmethod
def get_psu_status(self, index):
"""
Retrieves the oprational status of power supply unit (PSU) defined
by index <index>
:param index: An integer, index of the PSU of which to query status
:return: Boolean, True if PSU is operating properly, False if PSU is faulty
"""
return False

0 comments on commit c06b37a

Please sign in to comment.