sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
201 stars 727 forks source link

[Python3 Migration] - Docker (sonic-mgmt) doesn't have the Necessary Libraries Installed #10556

Open mithun2498 opened 1 year ago

mithun2498 commented 1 year ago

Description

The sonic-mgmt docker does not have all the necessary packages installed in it. I am unable to execute the test cases using the latest docker.

Describe the results you received: Unable to execute the test cases because of package installation error.

Describe the results you expected: Should be able to run the test cases.

mithun2498 commented 12 months ago

I am trying to run test cases using the latest docker with python3. But I am unable to run the test cases after successfully deploying the topology because there is no packages installed.

mithun2498 commented 12 months ago

I am facing this issue during the test execution.

Issue Log: Module Error: module dash_api not found from dash_api.appliance_pb2 import Appliance E ModuleNotFoundError: No module named 'dash_api' builtins = cached = '/data/sonic-mgmt/tests/dash/pycache/proto_utils.cpython-38.pyc' doc = None file = '/data/sonic-mgmt/tests/dash/proto_utils.py' loader = <_frozen_importlib_external.SourceFileLoader object at 0x7fce9e8fa370> name = 'proto_utils' package = '' spec = ModuleSpec(name='proto_utils', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fce9e8fa370>, origin='/data/sonic-mgmt/tests/dash/proto_utils.py') ipaddress = <module 'ipaddress' from '/usr/lib/python3.8/ipaddress.py'> pytest = <module 'pytest' from '/usr/local/lib/python3.8/dist-packages/pytest/init.py'> re = <module 're' from '/usr/lib/python3.8/re.py'> socket = <module 'socket' from '/usr/lib/python3.8/socket.py'> uuid = <module 'uuid' from '/usr/lib/python3.8/uuid.py'>

mithun2498 commented 10 months ago

Hi @yxieca @wangxin

Kindly help me to run the test cases with the latest sonic-mgmt docker. I am able to deploy the topology but unable to execute the test cases. There is no python packages installed in this directory - "/usr/local/lib/python3.8/dist-packages/".

yxieca commented 10 months ago

@wangxin please assign someone to take a look. Thanks

mithun2498 commented 9 months ago

Hi @yxieca @wangxin ,

Kindly let us know if there is any solution for the issue reported. Thanks.

mithun2498 commented 9 months ago

Hello @yxieca @wangxin ,

I manually tried to install the required packages for test execution and I am now facing this issue. Kindly help me on this!

root@sonic-mgmt:/data/sonic-mgmt/tests# ./run_tests.sh -n vms-sn2700-t0 -d str-msn2700-01 -c arp/test_unknown_mac.py -f ../ansible/testbed.yaml -i ../ansible/lab,../ansible/veos -e "--neighbor_type=sonic" -p /data/sonic-mgmt/tests/logs/08-02-2024/test_unknown_mac > test_unknown_mac_8-2-24_1 Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.8/dist-packages/pytest/main.py", line 5, in raise SystemExit(pytest.console_main()) File "/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py", line 185, in console_main code = main() File "/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py", line 143, in main config = _prepareconfig(args, plugins) File "/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py", line 318, in _prepareconfig config = pluginmanager.hook.pytest_cmdline_parse( File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 433, in call return self._hookexec(self.name, self._hookimpls, kwargs, firstresult) File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 112, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 133, in _multicall teardown[0].send(outcome) File "/usr/local/lib/python3.8/dist-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse config: Config = outcome.get_result() File "/usr/local/lib/python3.8/dist-packages/pluggy/_result.py", line 108, in get_result raise exc.with_traceback(exc.traceback) File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 80, in _multicall res = hook_impl.function(*args) File "/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py", line 1003, in pytest_cmdline_parse self.parse(args) File "/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py", line 1283, in parse self._preparse(args, addopts=addopts) File "/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py", line 1172, in _preparse self.pluginmanager.load_setuptools_entrypoints("pytest11") File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 365, in load_setuptools_entrypoints self.register(plugin, name=ep.name) File "/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py", line 436, in register ret: Optional[str] = super().register(plugin, name) File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 157, in register self._verify_hook(hook, hookimpl) File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 297, in _verify_hook raise PluginValidationError( pluggy._manager.PluginValidationError: Plugin 'pytest-ansible' for hook 'pytest_collect_file' hookimpl definition: pytest_collect_file(file_path: 'Path | None', parent: 'pytest.Collector') -> 'Node | None' Argument(s) {'file_path'} are declared in the hookimpl but can not be found in the hookspec