Skip to content

[device] get attributes from super class when unavailabe#1811

Merged
yxieca merged 1 commit intosonic-net:masterfrom
yxieca:attr
Jun 24, 2020
Merged

[device] get attributes from super class when unavailabe#1811
yxieca merged 1 commit intosonic-net:masterfrom
yxieca:attr

Conversation

@yxieca
Copy link
Copy Markdown
Collaborator

@yxieca yxieca commented Jun 24, 2020

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?

test_link_flap failing with following output:

platform_tests/test_link_flap.py:81:


platform_tests/test_link_flap.py:63: in run_link_flap_test
candidates = self.__build_test_candidates(dut, fanouthosts)
platform_tests/test_link_flap.py:50: in __build_test_candidates
if not fanout or not fanout_port:
common/devices.py:883: in getattr
return getattr(self.host, module_name)
common/devices.py:708: in getattr
return super(EosHost, self).getattr(module_name)


self = <tests.common.devices.EosHost object at 0x7f0083050750>, module_name = 'nonzero'

def __getattr__(self, module_name):
    if self.host.has_module(module_name):
        self.module_name = module_name
        self.module = getattr(self.host, module_name)

        return self._run
    else:
      raise UnsupportedAnsibleModule("Unsupported module")

E UnsupportedAnsibleModule: Unsupported module

module_name = 'nonzero'
self = <tests.common.devices.EosHost object at 0x7f0083050750>

common/devices.py:56: UnsupportedAnsibleModule

How did you do it?

Call super class to return attributes when unavailable.

How did you verify/test it?

With the fix. test_link_flap passes:

plugins: ansible-2.2.2, xdist-1.28.0, forked-1.1.3, repeat-0.8.0
collected 1 item

platform_tests/test_link_flap.py::test_link_flap PASSED [100%]

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Jun 24, 2020

This pull request introduces 1 alert when merging 69ad86f into bfea307 - view on LGTM.com

new alerts:

  • 1 for Unused import

@yxieca yxieca merged commit 1074768 into sonic-net:master Jun 24, 2020
@yxieca yxieca deleted the attr branch June 24, 2020 21:47
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…t#8778)

912d443 [sonic-utilities]remove db_migrator logic for autoneg enable/disable (sonic-net#1823)
5323e9d [202012] Advertise ipv6 link local address (sonic-net#1811)

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
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