-
Notifications
You must be signed in to change notification settings - Fork 1.8k
DELL Platform 2.0 API Infra and Reboot Reason support in Z9100 & S6100 #3063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ab4176a
DELL Platform 2.0 API Infra and Reboot Reason support in Z9100 & S6100
sridhar-ravindran 25568fa
Addressing Review Comments for DELL Platform 2.0 API Infra
sridhar-ravindran bf5485b
Addressing Review Comments for DELL Platform 2.0 API Infra
sridhar-ravindran 2afdbbf
Addressing Review comments
sridhar-ravindran f49e1f3
Addressing review comments, Return string instead of tuple
sridhar-ravindran 65011c6
Reverting back to returning tuple
sridhar-ravindran 80a889b
Address Review Comments : Return the reboot reason as tuple instead o…
sridhar-ravindran acfc333
Address review Comments, Removed paranthesis and returned None for tuple
sridhar-ravindran 0f7a5b0
Renamed REBOOT_CAUSE_INSUFFICIENT_FAN to REBOOT_CAUSE_INSUFFICIENT_FA…
sridhar-ravindran 6307ccf
Merge branch 'master' into platform_2_0
sridhar-ravindran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
platform/broadcom/sonic-platform-modules-dell/s6100/setup.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| from setuptools import setup | ||
|
|
||
| setup( | ||
| name='sonic-platform', | ||
| version='1.0', | ||
| description='SONiC platform API implementation on DellEmc Platforms', | ||
| license='Apache 2.0', | ||
| author='SONiC Team', | ||
| author_email='linuxnetdev@microsoft.com', | ||
| url='https://github.com/Azure/sonic-buildimage', | ||
| maintainer='DellEMC', | ||
| maintainer_email='dell-sonic@dell.com', | ||
| packages=[ | ||
| 'sonic_platform', | ||
| ], | ||
| classifiers=[ | ||
| 'Development Status :: 3 - Alpha', | ||
| 'Environment :: Plugins', | ||
| 'Intended Audience :: Developers', | ||
| 'Intended Audience :: Information Technology', | ||
| 'Intended Audience :: System Administrators', | ||
| 'License :: OSI Approved :: Apache Software License', | ||
| 'Natural Language :: English', | ||
| 'Operating System :: POSIX :: Linux', | ||
| 'Programming Language :: Python :: 2.7', | ||
| 'Topic :: Utilities', | ||
| ], | ||
| keywords='sonic SONiC platform PLATFORM', | ||
| ) | ||
|
|
2 changes: 2 additions & 0 deletions
2
platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
|
|
||
|
|
82 changes: 82 additions & 0 deletions
82
platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| ############################################################################# | ||
| # DELLEMC | ||
| # | ||
| # Module contains an implementation of SONiC Platform Base API and | ||
| # provides the platform information | ||
| # | ||
| ############################################################################# | ||
|
|
||
| try: | ||
| import os | ||
| from sonic_platform_base.chassis_base import ChassisBase | ||
| except ImportError as e: | ||
| raise ImportError(str(e) + "- required module not found") | ||
|
|
||
|
|
||
| class Chassis(ChassisBase): | ||
| """ | ||
| DELLEMC Platform-specific Chassis class | ||
| """ | ||
|
|
||
| HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/" | ||
| HWMON_NODE = os.listdir(HWMON_DIR)[0] | ||
| MAILBOX_DIR = HWMON_DIR + HWMON_NODE | ||
|
|
||
| reset_reason_dict = {} | ||
| reset_reason_dict[11] = (ChassisBase.REBOOT_CAUSE_POWER_LOSS) | ||
| reset_reason_dict[33] = (ChassisBase.REBOOT_CAUSE_WATCHDOG) | ||
| reset_reason_dict[44] = (ChassisBase.REBOOT_CAUSE_NON_HARDWARE) | ||
| reset_reason_dict[55] = (ChassisBase.REBOOT_CAUSE_NON_HARDWARE) | ||
|
|
||
| power_reason_dict = {} | ||
| power_reason_dict[11] = (ChassisBase.REBOOT_CAUSE_POWER_LOSS) | ||
| power_reason_dict[22] = (ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU) | ||
| power_reason_dict[33] = (ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC) | ||
| power_reason_dict[44] = (ChassisBase.REBOOT_CAUSE_INSUFFICIENT_FAN) | ||
|
|
||
| def __init__(self): | ||
| ChassisBase.__init__(self) | ||
|
|
||
| def get_pmc_register(self, reg_name): | ||
| rv = 'ERR' | ||
| mb_reg_file = self.MAILBOX_DIR+'/'+reg_name | ||
|
|
||
| if (not os.path.isfile(mb_reg_file)): | ||
| print mb_reg_file, 'not found !' | ||
| return rv | ||
|
|
||
| try: | ||
| with open(mb_reg_file, 'r') as fd: | ||
| rv = fd.read() | ||
| except Exception as error: | ||
| logging.error("Unable to open ", mb_reg_file, "file !") | ||
|
|
||
| rv = rv.rstrip('\r\n') | ||
| rv = rv.lstrip(" ") | ||
| return rv | ||
|
|
||
| def get_reboot_cause(self): | ||
| """ | ||
| Retrieves the cause of the previous reboot | ||
| """ | ||
| reset_reason = int(self.get_pmc_register('smf_reset_reason')) | ||
| power_reason = int(self.get_pmc_register('smf_poweron_reason')) | ||
|
|
||
| # Reset_Reason = 11 ==> PowerLoss | ||
| # So return the reboot reason from Last Power_Reason Dictionary | ||
| # If Reset_Reason is not 11 return from Reset_Reason dictionary | ||
| # Also check if power_reason, reset_reason are valid values by | ||
| # checking key presence in dictionary else return | ||
| # REBOOT_CAUSE_HARDWARE_OTHER as the Power_Reason and Reset_Reason | ||
| # registers returned invalid data | ||
| if (reset_reason == 11): | ||
| if (power_reason in self.power_reason_dict): | ||
| return self.power_reason_dict[power_reason] | ||
| else: | ||
| if (reset_reason in self.reset_reason_dict): | ||
| return self.reset_reason_dict[reset_reason] | ||
|
|
||
| return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../s6100/setup.py |
1 change: 1 addition & 0 deletions
1
platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../s6100/sonic_platform/__init__.py |
1 change: 1 addition & 0 deletions
1
platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../s6100/sonic_platform/chassis.py |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.