All testcases in lldp/test_lldp_syncd.py fail because they are not multi-asic aware
For e.g : In lldp/test_lldp_syncd.py::test_lldp_entry_table_keys[sfd-lt2-lc0] it is checking for the keys using the command as :
sonic-db-cli APPL_DB keys LLDP_ENTRY_TABLE while for multi-asic boxes it should check as
Similary other testcases assume that lldp as the container instead of lldp0, lldp1, etc
Results you see
lldp/test_lldp_syncd.py::test_lldp_entry_table_keys[sfd-lt2-lc0]
-------------------------------- live log call ---------------------------------
21:08:02 sonic_db._run_and_check L0044 ERROR | No command response: APPL_DB keys LLDP_ENTRY_TABLE
21:08:02 init.pytest_runtest_call L0040 ERROR | Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 1788, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 513, in call
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.traceback)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(args)
File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 194, in pytest_pyfunc_call
result = testfunction(*testargs)
File "/data/tests/lldp/test_lldp_syncd.py", line 155, in test_lldp_entry_table_keys
lldp_entry_keys = get_lldp_entry_keys(db_instance)
File "/data/tests/lldp/test_lldp_syncd.py", line 30, in get_lldp_entry_keys
items = db.get_keys("LLDP_ENTRY_TABLE")
File "/data/tests/common/helpers/sonic_db.py", line 167, in get_keys
raise SonicDbKeyNotFound("No keys for %s found in sonic-db cmd: %s" % (table, cmd))
tests.common.helpers.sonic_db.SonicDbKeyNotFound: 'No keys for LLDP_ENTRY_TABLE found in sonic-db cmd: APPL_DB keys LLDP_ENTRY_TABLE'
FAILED [ 10%]
lldp/test_lldp_syncd.py::test_lldp_entry_table_content[sfd-lt2-lc0]
-------------------------------- live log call ---------------------------------
21:09:17 init.pytest_runtest_call L0040 ERROR | Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 1788, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 513, in call
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.traceback)
File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 194, in pytest_pyfunc_call
result = testfunction(*testargs)
File "/data/tests/lldp/test_lldp_syncd.py", line 168, in test_lldp_entry_table_content
lldpctl_output = get_lldpctl_output(duthost)
File "/data/tests/lldp/test_lldp_syncd.py", line 49, in get_lldpctl_output
result = duthost.shell("docker exec lldp /usr/sbin/lldpctl -f json")["stdout"]
File "/data/tests/common/devices/multi_asic.py", line 134, in _run_on_asics
return getattr(self.sonichost, self.multi_asic_attr)(module_args, **complex_args)
File "/data/tests/common/devices/base.py", line 131, in _run
raise RunAnsibleModuleFail("run module {} failed".format(self.module_name), res)
tests.common.errors.RunAnsibleModuleFail: run module shell failed, Ansible Results =>
{"changed": true, "cmd": "docker exec lldp /usr/sbin/lldpctl -f json", "delta": "0:00:00.017590", "end": "2024-10-11 21:09:17.091546", "failed": true, "msg": "non-zero return code", "rc": 1, "start": "2024-10-11 21:09:17.073956", "stderr": "Error response from daemon: No such container: lldp", "stderr_lines": ["Error response from daemon: No such container: lldp"], "stdout": "", "stdout_lines": []}
Issue Description
All testcases in lldp/test_lldp_syncd.py fail because they are not multi-asic aware
For e.g : In lldp/test_lldp_syncd.py::test_lldp_entry_table_keys[sfd-lt2-lc0] it is checking for the keys using the command as : sonic-db-cli APPL_DB keys LLDP_ENTRY_TABLE while for multi-asic boxes it should check as
sfd-lt2-lc0:~$ sudo ip netns exec asic0 sonic-db-cli APPL_DB keys LLDP_ENTRY_TABLE* LLDP_ENTRY_TABLE:Ethernet0 LLDP_ENTRY_TABLE:Ethernet8 LLDP_ENTRY_TABLE:Ethernet72 LLDP_ENTRY_TABLE:Ethernet80 LLDP_ENTRY_TABLE:Ethernet56 LLDP_ENTRY_TABLE:Ethernet48 LLDP_ENTRY_TABLE:Ethernet40 LLDP_ENTRY_TABLE:Ethernet88 LLDP_ENTRY_TABLE:Ethernet16 LLDP_ENTRY_TABLE:Ethernet24 LLDP_ENTRY_TABLE:Ethernet64 LLDP_ENTRY_TABLE:Ethernet32
Similary other testcases assume that lldp as the container instead of lldp0, lldp1, etc
Results you see
lldp/test_lldp_syncd.py::test_lldp_entry_table_keys[sfd-lt2-lc0] -------------------------------- live log call --------------------------------- 21:08:02 sonic_db._run_and_check L0044 ERROR | No command response: APPL_DB keys LLDP_ENTRY_TABLE 21:08:02 init.pytest_runtest_call L0040 ERROR | Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 1788, in runtest self.ihook.pytest_pyfunc_call(pyfuncitem=self) File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 513, in call return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 120, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 139, in _multicall raise exception.with_traceback(exception.traceback) File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 103, in _multicall res = hook_impl.function(args) File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 194, in pytest_pyfunc_call result = testfunction(*testargs) File "/data/tests/lldp/test_lldp_syncd.py", line 155, in test_lldp_entry_table_keys lldp_entry_keys = get_lldp_entry_keys(db_instance) File "/data/tests/lldp/test_lldp_syncd.py", line 30, in get_lldp_entry_keys items = db.get_keys("LLDP_ENTRY_TABLE") File "/data/tests/common/helpers/sonic_db.py", line 167, in get_keys raise SonicDbKeyNotFound("No keys for %s found in sonic-db cmd: %s" % (table, cmd)) tests.common.helpers.sonic_db.SonicDbKeyNotFound: 'No keys for LLDP_ENTRY_TABLE found in sonic-db cmd: APPL_DB keys LLDP_ENTRY_TABLE'
FAILED [ 10%] lldp/test_lldp_syncd.py::test_lldp_entry_table_content[sfd-lt2-lc0] -------------------------------- live log call --------------------------------- 21:09:17 init.pytest_runtest_call L0040 ERROR | Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 1788, in runtest self.ihook.pytest_pyfunc_call(pyfuncitem=self) File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 513, in call return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 120, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 139, in _multicall raise exception.with_traceback(exception.traceback) File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 103, in _multicall res = hook_impl.function(*args) File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 194, in pytest_pyfunc_call result = testfunction(*testargs) File "/data/tests/lldp/test_lldp_syncd.py", line 168, in test_lldp_entry_table_content lldpctl_output = get_lldpctl_output(duthost) File "/data/tests/lldp/test_lldp_syncd.py", line 49, in get_lldpctl_output result = duthost.shell("docker exec lldp /usr/sbin/lldpctl -f json")["stdout"] File "/data/tests/common/devices/multi_asic.py", line 134, in _run_on_asics return getattr(self.sonichost, self.multi_asic_attr)(module_args, **complex_args) File "/data/tests/common/devices/base.py", line 131, in _run raise RunAnsibleModuleFail("run module {} failed".format(self.module_name), res) tests.common.errors.RunAnsibleModuleFail: run module shell failed, Ansible Results => {"changed": true, "cmd": "docker exec lldp /usr/sbin/lldpctl -f json", "delta": "0:00:00.017590", "end": "2024-10-11 21:09:17.091546", "failed": true, "msg": "non-zero return code", "rc": 1, "start": "2024-10-11 21:09:17.073956", "stderr": "Error response from daemon: No such container: lldp", "stderr_lines": ["Error response from daemon: No such container: lldp"], "stdout": "", "stdout_lines": []}
Results you expected to see
Make the script multi-asic aware
Is it platform specific
generic
Relevant log output
No response
Output of
show version
No response
Attach files (if any)
No response