Skip to content

Refactor Pcied and add unittest#189

Merged
sujinmkang merged 10 commits intosonic-net:masterfrom
sujinmkang:pcid_unittest
Jun 17, 2021
Merged

Refactor Pcied and add unittest#189
sujinmkang merged 10 commits intosonic-net:masterfrom
sujinmkang:pcid_unittest

Conversation

@sujinmkang
Copy link
Collaborator

Description

Refactor the pcied and add the unit test

Motivation and Context

Added unit test to increase the pmon unit test coverage.

How Has This Been Tested?

Build with unit test enabled and run manually on a dut to verify the pcied.

Additional Information (Optional)

@lgtm-com
Copy link

lgtm-com bot commented May 31, 2021

This pull request introduces 2 alerts when merging 3b20d27 into 9297a29 - view on LGTM.com

new alerts:

  • 1 for Unused local variable
  • 1 for Implicit string concatenation in a list

@sujinmkang sujinmkang requested a review from jleveque June 1, 2021 21:19
Comment on lines +43 to +47
def _wrapper_get_pcie_check():
return platform_pcieutil.get_pcie_check()

def _wrapper_get_pcie_aer_stats(bus, dev, func):
return platform_pcieutil.get_pcie_aer_stats(bus=bus, device=dev, func=func)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like these wrappers are unnecessary because you aren't checking for old or new API. The same function is being called for both, so these seem superfluous.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jleveque please review again

@lgtm-com
Copy link

lgtm-com bot commented Jun 8, 2021

This pull request introduces 1 alert when merging 8a47121 into bf60a27 - view on LGTM.com

new alerts:

  • 1 for Implicit string concatenation in a list

@lgtm-com
Copy link

lgtm-com bot commented Jun 9, 2021

This pull request introduces 1 alert when merging 61f07ed into bf60a27 - view on LGTM.com

new alerts:

  • 1 for Implicit string concatenation in a list

self.aer_stats = {}
if Id is not None:
self.device_table.set(self.device_name, [('id', Id)])
self.aer_stats = platform_pcieutil.get_pcie_aer_stats(bus=Bus, dev=Dev, func=Fn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the argument names as specified in https://github.com/Azure/sonic-platform-common/blob/master/sonic_platform_base/sonic_pcie/pcie_common.py#L102

Suggested change
self.aer_stats = platform_pcieutil.get_pcie_aer_stats(bus=Bus, dev=Dev, func=Fn)
self.aer_stats = platform_pcieutil.get_pcie_aer_stats(bus=Bus, device=Dev, func=Fn)

if Id is not None:
self.device_table.set(self.device_name, [('id', Id)])
self.aer_stats = _wrapper_get_pcie_aer_stats(bus=Bus, dev=Dev, func=Fn)
self.aer_stats = platform_pcieutil.get_pcie_aer_stats(bus=Bus, device=Dev, func=Fn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@ArunSaravananBalachandran ArunSaravananBalachandran Jun 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is observed that the parameter name is dev in the base class method defined in pcie_base.py, while it is overridden as device by the derived class method in pcie_common.py used by pcied (https://github.com/Azure/sonic-platform-common/blob/master/sonic_platform_base/sonic_pcie/pcie_common.py#L104) unifying them both as dev would resolve the issue

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the pcie_common.py with this PR : sonic-net/sonic-platform-common#197
And revert the change in pcied.

@jleveque
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

sujinmkang added a commit to sonic-net/sonic-buildimage that referenced this pull request Jun 16, 2021
…able name to match with pcied changes (#7886)

Why I did it
Support multiple pcie configuration file and change the pcie status table name
This is to match with below two PRs.
sonic-net/sonic-platform-common#195
sonic-net/sonic-platform-daemons#189

How I did it
Check pcie configuration file with wild card and change the device status table name

How to verify it
Restart with changes and see if the pcie check works as expected.
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jun 17, 2021
…able name to match with pcied changes (#7886)

Why I did it
Support multiple pcie configuration file and change the pcie status table name
This is to match with below two PRs.
sonic-net/sonic-platform-common#195
sonic-net/sonic-platform-daemons#189

How I did it
Check pcie configuration file with wild card and change the device status table name

How to verify it
Restart with changes and see if the pcie check works as expected.
@sujinmkang
Copy link
Collaborator Author

@jleveque Can you please review and approve this PR? PR build passed now. Thanks!

@sujinmkang sujinmkang merged commit 2fc05b2 into sonic-net:master Jun 17, 2021
@qiluo-msft
Copy link
Contributor

This commit could not be cleanly cherry-pick to 202012. Please submit another PR.

andywongarista pushed a commit to andywongarista/sonic-platform-daemons that referenced this pull request Jun 30, 2021
Description
Refactor the pcied and add the unit test

Motivation and Context
Added unit test to increase the pmon unit test coverage.

How Has This Been Tested?
Build with unit test enabled and run manually on a dut to verify the pcied.
@qiluo-msft
Copy link
Contributor

This PR could not be cleanly cherry-picked to 202012. Please submit another PR.

sujinmkang added a commit to sujinmkang/sonic-platform-daemons that referenced this pull request Jul 7, 2021
qiluo-msft pushed a commit to sujinmkang/sonic-platform-daemons that referenced this pull request Jul 19, 2021
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
…able name to match with pcied changes (sonic-net#7886)

Why I did it
Support multiple pcie configuration file and change the pcie status table name
This is to match with below two PRs.
sonic-net/sonic-platform-common#195
sonic-net/sonic-platform-daemons#189

How I did it
Check pcie configuration file with wild card and change the device status table name

How to verify it
Restart with changes and see if the pcie check works as expected.
vdahiya12 pushed a commit to vdahiya12/sonic-platform-daemons that referenced this pull request Apr 4, 2022
…t#189)

Description
Added constants to component_base for each potential return code of auto_firmware_update() so that vendor specific component implementations may reference these to provide the correct return codes to the firmware auto update utility.

Motivation and Context
This provides a central location from which standardized return codes may be imported, preventing the need for potential inconsistency in vendor implementations or the use of magic numbers in vendor implementations for return code.

How Has This Been Tested?
Non-functional change, builds successfully and can be successfully imported from at runtime.
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.

4 participants