Skip to content
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

[pdu controller] refactoring snmp pdu controller #3041

Merged
merged 4 commits into from
Mar 2, 2021
Merged

Conversation

yxieca
Copy link
Collaborator

@yxieca yxieca commented Feb 25, 2021

Description of PR

Refactoring the SNMP PDU controller code.

Summary:

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

Clean up the SNMP PDU control code to be a generic SNMP controller controls the whole PDU.

How did you do it?

Making PDU controller more generic. It should manage the whole PDU controller instead of just for a single DUT.

For PDU models that know has lane concept. Make lane ID part of the outlet ID. And outlet ID is the portion of OID that can
uniquely identify an outlet on the particular PDU.

Label match is still supported by a passed in hostname.

Add support to query output power wattage

Signed-off-by: Ying Xie ying.xie@microsoft.com

How did you verify/test it?

platform_tests/test_platform_info.py::test_turn_on_off_psu_and_check_psustatus[ignore_particular_error_log0] PASSED                                                                [  7%]
platform_tests/test_platform_info.py::test_show_platform_fanstatus_mocked SKIPPED                                                                                                  [ 14%]
platform_tests/test_platform_info.py::test_show_platform_temperature_mocked[ignore_particular_error_log0] SKIPPED                                                                  [ 21%]
platform_tests/test_platform_info.py::test_thermal_control_load_invalid_format_json PASSED                                                                                         [ 28%]
platform_tests/test_platform_info.py::test_thermal_control_load_invalid_value_json PASSED                                                                                          [ 35%]
platform_tests/test_platform_info.py::test_thermal_control_psu_absence[ignore_particular_error_log0] SKIPPED                                                                       [ 42%]
platform_tests/test_platform_info.py::test_thermal_control_psu_absence[ignore_particular_error_log0] ERROR                                                                         [ 42%]
platform_tests/test_platform_info.py::test_thermal_control_fan_status SKIPPED                                                                                                      [ 50%]
snmp/test_snmp_phy_entity.py::test_fan_drawer_info PASSED                                                                                                                          [ 57%]
snmp/test_snmp_phy_entity.py::test_fan_info PASSED                                                                                                                                 [ 64%]
snmp/test_snmp_phy_entity.py::test_psu_info PASSED                                                                                                                                 [ 71%]
snmp/test_snmp_phy_entity.py::test_thermal_info PASSED                                                                                                                             [ 78%]
snmp/test_snmp_phy_entity.py::test_transceiver_info PASSED                                                                                                                         [ 85%]
snmp/test_snmp_phy_entity.py::test_turn_off_pdu_and_check_psu_info PASSED                                                                                                          [ 92%]
snmp/test_snmp_phy_entity.py::test_remove_insert_fan_and_check_fan_info SKIPPED                                                                                                    [100%]

yinxi@681acf730601:/var/src/sonic-mgmt/ansible$ ./devutils -i str -a pdu_status -g sonic -l str-7260cx3-acs-1
+-------------------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
| Host              | Action   | PDU status                                                                                                                                                                                                              | Summary   |
+===================+==========+=========================================================================================================================================================================================================================+===========+
| str-7260cx3-acs-1 | status   | [{'outlet_on': True, 'output_watts': '87', 'outlet_id': '.1.1.39', 'pdu_name': u'pdu-107', 'pdu_index': 0}, {'outlet_on': True, 'output_watts': '165', 'outlet_id': '.1.1.38', 'pdu_name': u'pdu-107', 'pdu_index': 0}] | []        |
+-------------------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
yinxi@681acf730601:/var/src/sonic-mgmt/ansible$ ./devutils -i str -a pdu_off -g sonic -l str-7260cx3-acs-1      
+-------------------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
| Host              | Action   | PDU status                                                                                                                                                                                                              | Summary   |
+===================+==========+=========================================================================================================================================================================================================================+===========+
| str-7260cx3-acs-1 | off      | [{'outlet_on': True, 'output_watts': '86', 'outlet_id': '.1.1.39', 'pdu_name': u'pdu-107', 'pdu_index': 0}, {'outlet_on': True, 'output_watts': '155', 'outlet_id': '.1.1.38', 'pdu_name': u'pdu-107', 'pdu_index': 0}] | []        |
+-------------------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
yinxi@681acf730601:/var/src/sonic-mgmt/ansible$ ./devutils -i str -a pdu_status -g sonic -l str-7260cx3-acs-1
+-------------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
| Host              | Action   | PDU status                                                                                                                                                                                                             | Summary   |
+===================+==========+========================================================================================================================================================================================================================+===========+
| str-7260cx3-acs-1 | status   | [{'outlet_on': False, 'output_watts': '0', 'outlet_id': '.1.1.39', 'pdu_name': u'pdu-107', 'pdu_index': 0}, {'outlet_on': False, 'output_watts': '0', 'outlet_id': '.1.1.38', 'pdu_name': u'pdu-107', 'pdu_index': 0}] | []        |
+-------------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
yinxi@681acf730601:/var/src/sonic-mgmt/ansible$ ./devutils -i str -a pdu_on -g sonic -l str-7260cx3-acs-1     
+-------------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
| Host              | Action   | PDU status                                                                                                                                                                                                             | Summary   |
+===================+==========+========================================================================================================================================================================================================================+===========+
| str-7260cx3-acs-1 | on       | [{'outlet_on': False, 'output_watts': '0', 'outlet_id': '.1.1.39', 'pdu_name': u'pdu-107', 'pdu_index': 0}, {'outlet_on': False, 'output_watts': '0', 'outlet_id': '.1.1.38', 'pdu_name': u'pdu-107', 'pdu_index': 0}] | []        |
+-------------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
yinxi@681acf730601:/var/src/sonic-mgmt/ansible$ ./devutils -i str -a pdu_status -g sonic -l str-7260cx3-acs-1
+-------------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
| Host              | Action   | PDU status                                                                                                                                                                                                             | Summary   |
+===================+==========+========================================================================================================================================================================================================================+===========+
| str-7260cx3-acs-1 | status   | [{'outlet_on': True, 'output_watts': '55', 'outlet_id': '.1.1.39', 'pdu_name': u'pdu-107', 'pdu_index': 0}, {'outlet_on': True, 'output_watts': '59', 'outlet_id': '.1.1.38', 'pdu_name': u'pdu-107', 'pdu_index': 0}] | []        |
+-------------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+

Making PDU controller more generic. It should manage the whole
PDU controller instead of just for a single DUT.

For PDU models that know has lane concept. Make lane ID part of
the outlet ID. And outlet ID is the partion of OID that can
uniquely identify an outlet on the particular PDU.

Label match is still supported by a passed in hostname.

Add support to query output power wattage

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
@yxieca yxieca requested a review from wangxin February 25, 2021 21:36
@yxieca yxieca requested a review from a team as a code owner February 25, 2021 21:36
@lgtm-com
Copy link

lgtm-com bot commented Feb 25, 2021

This pull request introduces 1 alert when merging 1d29e4d into 936bcac - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@yxieca
Copy link
Collaborator Author

yxieca commented Feb 26, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yxieca yxieca merged commit 724e05f into sonic-net:master Mar 2, 2021
@yxieca yxieca deleted the pdu branch March 2, 2021 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants