sonic-buildimage/dockers/docker-ptf
Zhaohui Sun 1effff9836
Enable system-site-packages for ptf docker and install thrift for test_qos_sai (#12094)
Why I did it
test_sai_qos failed because of the following error:

"stderr_lines": [
        "Traceback (most recent call last):", 
        "  File \"/usr/bin/ptf\", line 522, in <module>", 
        "    test_modules = load_test_modules(config)", 
        "  File \"/usr/bin/ptf\", line 413, in load_test_modules", 
        "    mod = imp.load_module(modname, *imp.find_module(modname, [root]))", 
        "  File \"saitests/switch.py\", line 19, in <module>", 
        "    import switch_sai_thrift", 
        "ImportError: No module named switch_sai_thrift"
    ], 

It's because test_sai_qos runs ptf script which imports switch_sai_thrift, switch_sai_thrift is installed from python-saithrift_0.9.4_amd64.deb.
For master image, the deb file is for python3, but ptf only has virtual python3 environment, that's why we add --system-site-packages to allow virtual env to access system site-packeges.

Add thrift package in docker ptf virtual python3 env, because currently env-python3 doesn't have thrift module which is needed in switch_sai_thrift.

How I did it
Enable --system-site-packages for virtual py3 env in ptf docker and install thrift for test_qos_sai

How to verify it
load and login ptf conatiner
dpkg - i python-saithrift_0.9.4_amd64.deb
source /root/env-python3/bin/activate
python
import switch_sai_thrift.switch_sai_rpc
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
2022-09-17 13:33:53 +08:00
..
conf.d [docker-ptf] Add support for spytest to ptf container (#4410) 2020-04-13 16:56:19 -07:00
brcm_interface_to_front_map.ini [docker-ptf]: build docker ptf 2021-01-27 08:28:21 -08:00
Dockerfile.j2 Enable system-site-packages for ptf docker and install thrift for test_qos_sai (#12094) 2022-09-17 13:33:53 +08:00
msn_2700_interface_to_front_map.ini [docker-ptf]: build docker ptf 2021-01-27 08:28:21 -08:00
ptf_tgen.sh [docker-ptf] Add support for spytest to ptf container (#4410) 2020-04-13 16:56:19 -07:00
supervisord.conf Fix typos and comment alignment in supervisor.conf files (#3714) 2019-11-06 09:24:54 -08:00