feat: add pynng support for docker-ptf - #27777
Conversation
Signed-off-by: Austin (Ngoc Thang) Pham <austinpham@microsoft.com>
c28428d to
1f33d07
Compare
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR updates the docker-ptf container build to support the newer PTF nn-agent transport by adding pynng for the Python 3 PTF environment and selecting a different upstream ptf_nn_agent.py depending on the PTF Python env.
Changes:
- Fetch
ptf_nn/ptf_nn_agent.pyfrom different upstream refs depending onPTF_ENV_PY_VER(mixed vs py3). - Install
pynngin thepy3PTF environment.
| {# ptf_nn_agent.py is pinned per Python env: the "mixed" image runs the agent | ||
| under Python 2 (nnpy), so it stays on the last nnpy-compatible upstream | ||
| commit; the py3 image ships pynng and tracks a p4lang/ptf main commit that | ||
| uses pynng (see #26912 / upstream p4lang/ptf#234). #} |
| {% if PTF_ENV_PY_VER == "mixed" %} | ||
| && wget https://raw.githubusercontent.com/p4lang/ptf/23ebe7237f3c284032bda02fbd1f4a98f1bc12f4/ptf_nn/ptf_nn_agent.py | ||
| {% else %} | ||
| && wget https://raw.githubusercontent.com/p4lang/ptf/main/ptf_nn/ptf_nn_agent.py |
| {% if PTF_ENV_PY_VER == "py3" %} | ||
| && pip3 install pynng \ | ||
| {% endif %} |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Hi @auspham Could you help merge the fix? |
|
/azpw retry |
|
Retrying failed(or canceled) jobs... |
|
Build not found. Please close and reopen the PR or rebase your branch to trigger a new build. |
|
@weiguo-nvidia the test is still failing, so i cant merge yet |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azpw retry |
|
Retrying failed(or canceled) jobs... |
|
Retrying failed(or canceled) stages in build 1149409: ✅Stage Test:
|
|
/azpw retry |
|
Retrying failed(or canceled) jobs... |
|
Retrying failed(or canceled) stages in build 1149409: ✅Stage Test:
|
|
/azpw retry |
|
Retrying failed(or canceled) jobs... |
|
No failed(or canceled) stages or jobs found in the most recent build 1149409. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Austin (Ngoc Thang) Pham <austinpham@microsoft.com>
Why I did it
PTF tests on scale topologies frequently fail with
nnpy.errors.NNError: Connection timed outcoming fromptf_nn_agent.py.Upstream
p4lang/ptfhas already replacednnpywithpynng(p4lang/ptf#234). SONiC tried to pick this up but had to pinptf_nn_agent.pyback to an oldernnpy-compatible commit in #26912, becausedocker-ptfdid not ship thepynngpackage.This PR adds
pynngtodocker-ptfand moves the Python 3 image'sptf_nn_agent.pyonto the upstreampynng-based agent, aligning SONiC withp4lang/ptfmaster and unblocking the migration offnnpy.Work item tracking
How I did it
In
dockers/docker-ptf/Dockerfile.j2, gated the change onPTF_ENV_PY_VERso the two PTF images keep working independently:pynnginto the virtualenv, and fetchptf_nn_agent.pyfromp4lang/ptfmaster (thepynng-based agent).nnpyand thennpy-pinned agent commit from chore: pin ptf_nn_agent.py to use nnpy #26912, becausepynngrequires Python 3.7+ and the agent there runs under Python 2.docker-ptf-saibuildsFROM docker-ptf, so it inherits the change automatically.How to verify it
nnpy.errors.NNError: Connection timed out.Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
[docker-ptf]: Add pynng package and move py3 ptf_nn_agent off nnpy to pynng (aligns with p4lang/ptf master; addresses NNError connection timeouts on scale topologies)
Link to config_db schema for YANG module changes
N/A — no YANG/config_db changes.