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

[sonic-mgmt] Fix "fdb/test_fdb_mac_move.py" AttributeError failure #15704

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vkjammala-arista
Copy link
Contributor

Description of PR

Summary: Fix "fdb/test_fdb_mac_move.py" failure with AttributeError: 'NoneType' object has no attribute...
Fixes # https://github.com/aristanetworks/sonic-qual.msft/issues/330

Type of change

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

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

Test is relying on duthost method get_crm_resources method (parses info from crm show resources all output) to get "fdb_entry" crm resource values. If output is empty for some reason then duthost.get_crm_resources().get("main_resources") will be empty and thus lead to AttributeError: 'NoneType' object has no attribute 'get' during get_crm_resources() failure if we try to access "fdb_entry" key.

How did you do it?

#11127 has introduced retry mechanism in case of empty output but condition is incorrect (len(duthost.get_crm_resources()) will never be 0, as duthost.get_crm_resources() will return {'main_resources': {}, 'acl_resources': [], 'table_resources': []} if command output is empty). Correcting this PR change to check for "main_resources" fixes the issue.

How did you verify/test it?

Stressed the test and failure is not observed.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

Test is relying on duthost method "get_crm_resources" method (parses
info from "crm show resources all" output)  to get "fdb_entry" crm
resource values. If output is empty for some reason then
"duthost.get_crm_resources().get("main_resources")" will be empty and thus
lead to "AttributeError: 'NoneType' object has no attribute 'get' during
get_crm_resources()" failure if we try to access "fdb_entry" key.

PR#11127 has introduced retry mechanism in case of empty output but condition is
incorrect ("len(duthost.get_crm_resources())") will never be 0. Correcting this
PR change to check for "main_resources" fixes the issue.
@lolyu lolyu self-requested a review November 24, 2024 15:30
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.

2 participants