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>
This commit is contained in:
parent
93e3657e4c
commit
21b2361027
@ -136,7 +136,7 @@ RUN rm -rf /debs \
|
||||
&& cd /opt \
|
||||
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
|
||||
|
||||
RUN python3 -m venv env-python3
|
||||
RUN python3 -m venv --system-site-packages env-python3
|
||||
|
||||
# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD.
|
||||
ENV VIRTUAL_ENV=/root/env-python3
|
||||
@ -173,7 +173,8 @@ RUN python3 -m pip install setuptools \
|
||||
&& pip3 install itsdangerous \
|
||||
&& pip3 install retrying \
|
||||
&& pip3 install jinja2 \
|
||||
&& pip3 install scapy==2.4.5
|
||||
&& pip3 install scapy==2.4.5 \
|
||||
&& pip3 install thrift
|
||||
|
||||
{% if docker_ptf_whls.strip() -%}
|
||||
# Copy locally-built Python wheel dependencies
|
||||
|
Reference in New Issue
Block a user