Skip to content

[pdu manager] introduce pdu manager#3013

Merged
yxieca merged 4 commits intosonic-net:masterfrom
yxieca:pdu
Feb 22, 2021
Merged

[pdu manager] introduce pdu manager#3013
yxieca merged 4 commits intosonic-net:masterfrom
yxieca:pdu

Conversation

@yxieca
Copy link
Copy Markdown
Collaborator

@yxieca yxieca commented Feb 20, 2021

Description of PR

Introducing pdu manager.

Summary:
Fixes # (issue)

Type of change

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

Approach

What is the motivation for this PR?

The existing PDU controller implementation cannot handle if DUT connects to 2 different PDUs. The outlet_id was an index in return list, when there is more than one controller, the index will collide. Existing client code uses the outlet_id to access specific outlet. Which will not work in multi-PDU scenario.

How did you do it?

  1. Introduce PDU manager to separate the client from the implementation of pdu controllers.
  2. Change client to toggle outlet with the whole outlet dictionary, so that client don't have to rely on the value of outlet_id.
  3. PDU manager manages all PDU controllers associated with a DUT.
  4. Change devutils to use PDU manager instead of invoking controller directly.

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

How did you verify/test it?

yinxi@681acf730601:/var/src/sonic-mgmt/ansible$ ./devutils -i str -g sonic -a pdu_status -l str-7260cx3-acs-1                                                                             +-------------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
| Host              | Action   | PDU status                                                                                                                                                 | Summary   |
+===================+==========+============================================================================================================================================================+===========+
| str-7260cx3-acs-1 | status   | [{'outlet_on': True, 'pdu_index': 0, 'outlet_id': 0, 'pdu_name': u'pdu-107'}, {'outlet_on': True, 'pdu_index': 0, 'outlet_id': 1, 'pdu_name': u'pdu-107'}] | []        |
+-------------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+

yinxi@681acf730601:/var/src/sonic-mgmt/tests$ ./run_tests.sh -n vms7-t0-7260-1 -i /var/src/sonic-mgmt/ansible/str,/var/src/sonic-mgmt/ansible/veos -u -m group -p /tmp/logs-01 -e --skip_sanity -c "snmp/test_snmp_phy_entity.py platform_tests/test_platform_info.py"
=== Running tests in groups ===
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.exceptions import InvalidSignature
================================================================================== test session starts ===================================================================================
platform linux2 -- Python 2.7.17, pytest-4.6.5, py-1.10.0, pluggy-0.13.1
ansible: 2.8.12
rootdir: /var/src/sonic-mgmt/tests, inifile: pytest.ini
plugins: forked-1.3.0, metadata-1.11.0, xdist-1.28.0, html-1.22.1, repeat-0.9.1, ansible-2.2.2
collected 14 items                                                                                                                                                                       

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%]

1. Introduce PDU manager to separte the client from the implentation
   of pdu controllers.
2. Change client to toggle outlet with the whole outlet dictionary,
   so that client don't have to rely on the value of outlet_id.
3. PDU manager manages all PDU controllers associated with a DUT.
4. Change devutils to use PDU manager instead of invoking controller
   directly.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
@yxieca yxieca requested review from a team and jleveque as code owners February 20, 2021 11:46
@lgtm-com

This comment has been minimized.

@yxieca
Copy link
Copy Markdown
Collaborator Author

yxieca commented Feb 22, 2021

You have one warning from LGTM. otherwise looks good.

@yxieca yxieca merged commit 5c80d9d into sonic-net:master Feb 22, 2021
@yxieca yxieca deleted the pdu branch February 22, 2021 17:13
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…atically (sonic-net#17018)

#### Why I did it
src/sonic-utilities
```
* 569beb19 - (HEAD -> 202305, origin/202305) Revert "Remove syslog service validator in GCU (sonic-net#2991)" (sonic-net#3015) (16 hours ago) [jingwenxie]
* ab7f03ea - [db_migrator] Fix the broken version chain (sonic-net#3014) (16 hours ago) [Vivek]
* 0f17b8d5 - [fwutil] Fix python SyntaxWarning for 'is' with literals (sonic-net#3013) (16 hours ago) [Kebo Liu]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants