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

function get_asic() returns wrong object #3103

Closed
AntonHryshchuk opened this issue Mar 7, 2021 · 3 comments · Fixed by #3118
Closed

function get_asic() returns wrong object #3103

AntonHryshchuk opened this issue Mar 7, 2021 · 3 comments · Fixed by #3118

Comments

@AntonHryshchuk
Copy link
Contributor

Description

In commit b38562a
Was changed returned object in function get_asic().
From SonicAsic, which contained method get_docker_cmd().
To SonicHost, which don't have method get_docker_cmd().

As a result, test test_xcvr_info_in_db.py failed with error message:

platform_tests/test_xcvr_info_in_db.py:36:


common/platform/transceiver_utils.py:137: in check_transceiver_status
check_transceiver_basic(dut, asic_index, interfaces, xcvr_skip_list)
common/platform/transceiver_utils.py:66: in check_transceiver_basic
docker_cmd = asichost.get_docker_cmd(cmd, "database")


self = <tests.common.devices.SonicHost object at 0x7f8a23805550>, module_name = 'get_docker_cmd'

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
    raise AttributeError(
      "'%s' object has no attribute '%s'" % (self.__class__, module_name)
        )

E AttributeError: '<class 'tests.common.devices.SonicHost'>' object has no attribute 'get_docker_cmd'

Steps to reproduce the issue:

  1. run the platform_tests/test_xcvr_info_in_db.py
@AntonHryshchuk AntonHryshchuk changed the title function get_asic() returns wrong object in function get_asic() returns wrong object Mar 7, 2021
@liat-grozovik
Copy link
Collaborator

@abdosi and @yaxia please note recent degradation.
if the fix provided in commit is approved the tests which assumed to be working should be fixed as well.

@abdosi
Copy link
Contributor

abdosi commented Mar 8, 2021

Let me check on this.

abdosi added a commit to abdosi/sonic-mgmt that referenced this issue Mar 9, 2021
sonic-net#3103

Signed-off-by: Abhishek Dosi <[email protected]>
@abdosi abdosi linked a pull request Mar 9, 2021 that will close this issue
@vcheketx
Copy link
Contributor

@abdosi This issue also occurs during platform_tests/test_sequential_restart.py::test_restart_swss:
E AttributeError: '<class 'tests.common.devices.SonicHost'>' object has no attribute 'get_service_name'
Could you take a look at this and update your fix for 'get_service_name' also?

abdosi added a commit that referenced this issue Mar 10, 2021
With this PR made following changes:

Use asic_instance() to always return ASIC object

Rename get_asic() to get_asic_or_sonic_host() which will return sonic host if asic_index is None else return asic host object. This API is useful if we want to execute/run something on host as well on asic in multi-asic platforms

Updated all the testcases to use correct set of API's.

Fix the issue
#3103
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 a pull request may close this issue.

4 participants