Skip to content

chore: pin ptf_nn_agent.py to use nnpy#26912

Merged
yejianquan merged 1 commit into
sonic-net:masterfrom
auspham:austinpham/37580365-pin-ptf-nn-agent
Apr 22, 2026
Merged

chore: pin ptf_nn_agent.py to use nnpy#26912
yejianquan merged 1 commit into
sonic-net:masterfrom
auspham:austinpham/37580365-pin-ptf-nn-agent

Conversation

@auspham
Copy link
Copy Markdown
Contributor

@auspham auspham commented Apr 21, 2026

Why I did it

With this commit here, PTF replace nnpy with pynng p4lang/ptf

However, we don't have pynng. To unblock us now, I'll pin ptf_nn_agent.py to a previous version that doesn't require pynng

Work item tracking
  • Microsoft ADO (number only):

How I did it

How to verify it

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Austin Pham <austinpham@microsoft.com>
Copilot AI review requested due to automatic review settings April 21, 2026 02:59
@auspham auspham requested a review from lguohan as a code owner April 21, 2026 02:59
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pins the PTF NN agent script fetched during docker-ptf image build to a specific upstream commit to avoid the newer upstream dependency on pynng (keeping compatibility with the existing nnpy usage).

Changes:

  • Update the ptf_nn_agent.py download URL in the PTF Docker image to a fixed upstream commit SHA.

&& mkdir -p /opt \
&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
&& wget https://raw.githubusercontent.com/p4lang/ptf/23ebe7237f3c284032bda02fbd1f4a98f1bc12f4/ptf_nn/ptf_nn_agent.py
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit SHA is hard-coded in the download URL without any inline context. Please add a short comment (or lift the SHA into a named ARG/Jinja variable) indicating that this pin is intentional to avoid the upstream switch from nnpy to pynng, and include the upstream commit/link being worked around so future updates know what to change and why.

Copilot uses AI. Check for mistakes.
&& mkdir -p /opt \
&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
&& wget https://raw.githubusercontent.com/p4lang/ptf/23ebe7237f3c284032bda02fbd1f4a98f1bc12f4/ptf_nn/ptf_nn_agent.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pin works as a short-term unblock, but it freezes ptf_nn_agent at a 2024 snapshot and misses any future bug fixes from upstream. The forward fix would be to replace nnpy with pynng in this Dockerfile (and drop the nanomsg-from-source build ~20 lines above), then point back at master. There is already a similar migration in sonic-mgmt PR #23719 for the copp helper path. Is there a tracking issue to do the full pynng migration in docker-ptf so this pin doesn't become permanent?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ZhaohuiS. No there is no tracking issue. I didn't upgrade to pynng as i'm not sure if it will introduce any new failures or vulnerability security

To avoid additional work, I pin down the ptf_nn_agent. I agree that we should have an issue and assign to relevant owner to track this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug filed for track: #26925

&& mkdir -p /opt \
&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
&& wget https://raw.githubusercontent.com/p4lang/ptf/23ebe7237f3c284032bda02fbd1f4a98f1bc12f4/ptf_nn/ptf_nn_agent.py
Copy link
Copy Markdown
Contributor

@opcoder0 opcoder0 Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah installing pynng may be better. I didn't see a failure in the latest docker-ptf image. Is this failing CI / PR checkers already ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's failing on PR check yes

Copy link
Copy Markdown
Contributor

@xwjiang-ms xwjiang-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve for temporary unblock PR test

@yejianquan yejianquan merged commit 4c9b302 into sonic-net:master Apr 22, 2026
31 checks passed
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #26942

@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202511: #26943

attackofthetitan pushed a commit to attackofthetitan/sonic-buildimage that referenced this pull request Apr 23, 2026
Why I did it
With this commit here, PTF replace nnpy with pynng p4lang/ptf

However, we don't have pynng. To unblock us now, I'll pin ptf_nn_agent.py to a previous version that doesn't require pynng

Signed-off-by: Austin Pham <austinpham@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

@auspham cherry pick PR didn't pass PR checker after retry. Please help check! Thanks.
#26942

---Powered by SONiC BuildBot

kalash-nexthop pushed a commit to nexthop-ai/sonic-buildimage that referenced this pull request Apr 29, 2026
Why I did it
With this commit here, PTF replace nnpy with pynng p4lang/ptf

However, we don't have pynng. To unblock us now, I'll pin ptf_nn_agent.py to a previous version that doesn't require pynng

Signed-off-by: Austin Pham <austinpham@microsoft.com>
Signed-off-by: Kalash Nainwal <kalash@nexthop.ai>
vivekverma-arista pushed a commit to vivekverma-arista/sonic-buildimage that referenced this pull request Apr 30, 2026
Why I did it
With this commit here, PTF replace nnpy with pynng p4lang/ptf

However, we don't have pynng. To unblock us now, I'll pin ptf_nn_agent.py to a previous version that doesn't require pynng

Signed-off-by: Austin Pham <austinpham@microsoft.com>
mhchann pushed a commit to mhchann/sonic-buildimage that referenced this pull request May 7, 2026
Why I did it
With this commit here, PTF replace nnpy with pynng p4lang/ptf

However, we don't have pynng. To unblock us now, I'll pin ptf_nn_agent.py to a previous version that doesn't require pynng

Signed-off-by: Austin Pham <austinpham@microsoft.com>
Signed-off-by: mhchann <mhchann082@gmail.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202412: Azure/sonic-buildimage-msft#2311

rminnikanti added a commit to rminnikanti/sonic-buildimage that referenced this pull request May 19, 2026
Pin ptf_nn_agent.py download URL in docker-syncd-mrvl-teralynx-rpc
to the last upstream PTF commit that uses nnpy, matching the fix
in sonic-net#26912.

Ref: sonic-net#26925

Signed-off-by: Ravi Minnikanti <rminnikanti@marvell.com>
r12f added a commit to Azure/sonic-buildimage-msft that referenced this pull request Jun 4, 2026
…hrift to 0.22.0 to fix build issue. (#2365)

<!--
Please make sure you've read and understood our contributing guidelines:
     https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

** Make sure all your commits include a signature generated with `git
commit -s` **

If this is a bug fix, make sure your description includes "fixes #xxxx",
or
     "closes #xxxx" or "resolves #xxxx"

     Please provide the following information:
-->

#### Why I did it
to fix build issue.
cherry-pick sonic-net/sonic-buildimage#26912 and
internal PR to pin thrift.

#### How I did it
cherry-pick both changes.

#### How to verify it
PR pipeline.

<!--
If PR needs to be backported, then the PR must be tested against the
base branch and the earliest backport release branch and provide tested
image version on these two branches. For example, if the PR is requested
for master, 202211 and 202012, then the requester needs to provide test
results on master and 202012.
-->

#### Which release branch to backport (provide reason below if selected)

<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111
- [ ] 202205
- [ ] 202211

#### Tested branch (Please provide the tested image version)

<!--
- Please provide tested image version
- e.g.
- [x] 20201231.100
-->

- [ ] <!-- image version 1 -->
- [ ] <!-- image version 2 -->

#### Description for the changelog
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->

<!--
Ensure to add label/tag for the feature raised. example - PR#2174 under
sonic-utilities repo. where, Generic Config and Update feature has been
labelled as GCU.
-->

#### Link to config_db schema for YANG module changes
<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on
https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md
-->

#### A picture of a cute animal (not mandatory but encouraged)

---------

Signed-off-by: Austin Pham <austinpham@microsoft.com>
Co-authored-by: Austin (Thang Pham) <austinpham@microsoft.com>
Co-authored-by: Riff Jiang <riffjiang@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.