Skip to content

[cherry-pick] install gobgp on ptf image - #3531

Open
Leyza wants to merge 1 commit into
Azure:202511_azdfrom
Leyza:202511_gobgp_cp
Open

Leyza wants to merge 1 commit into
Azure:202511_azdfrom
Leyza:202511_gobgp_cp

Conversation

@Leyza

@Leyza Leyza commented Nov 5, 2026 •

Copy link
Copy Markdown

Why I did it

Cherry-pick of sonic-net/sonic-buildimage#28732 .
Gobgp will be used in some of the sonic-mgmt tests.

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
  • 202512
  • 202605
  • 202608

Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO):
Failure type:

Tested branch

  • master
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511
  • 202512
  • 202605
  • 202608
  • N/A

Test result

Description for the changelog

Link to config_db schema for YANG module changes

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

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Add a build-from-source step for the gobgp daemon (gobgpd) and CLI (gobgp)
to the docker-ptf image. gobgpd is the BGP-speaker engine for the
GoBGP-backed sonic-mgmt PTF route speaker (opt-in via bgp_speaker=gobgp;
ExaBGP stays the default), the scalable replacement that streams 100k+
prefixes/neighbor over gRPC. See HLD
sonic-net/sonic-mgmt#26382.

The image carries the gobgpd/gobgp binaries and the Python gRPC stubs
generated from the same checkout into /usr/local/lib/gobgp-api; the shim
that drives them ships in sonic-mgmt and is deployed at runtime (mirroring
http_api.py). Generating the stubs here keeps them on the same gobgp
version as the daemon and keeps generated code out of sonic-mgmt. An import
check after generation fails the build if the gencode and the image's
protobuf runtime disagree. The mixed-python image pins a protobuf runtime
older than the gencode grpcio-tools emits, so the stubs are skipped there,
matching the existing gnxi regeneration step.

The version is resolved from the latest upstream release rather than
hardcoded, following the grpcurl, sflowtool and nanomsg blocks in this file,
so the version-refresh build proposes gobgp security updates on its own
cadence and freezes the exact commit in versions-git, the same way gnmic and
grpcurl are tracked. Version control then resets the clone to that commit,
which is why this clone is not shallow: a --depth 1 clone does not contain
the recorded commit, so the reset fails without failing the build and leaves
the pin silently ineffective.

The recipe follows the existing grpcurl and gnmic blocks: reuse the patched
Go toolchain installed earlier, and sit before the Go-toolchain-removal
step. google.golang.org/grpc, golang.org/x/net and golang.org/x/text are
raised above the versions the release's go.mod selects, clearing the
MEDIUM+ findings the docker-ptf Trivy job reports against the stock build.
They are minimum versions, so Go's minimal version selection keeps them in
effect across a gobgp bump. Building from source (vs downloading a release)
keeps the Go stdlib patched for S360/CVE scans and provides the .proto
sources the stubs are generated from. ExaBGP is retained unchanged.

Validated at v4.8.0 (the tag the resolver currently selects): binaries
build with the dependency floors applied, stubs regenerate and import
cleanly, and a live announce/withdraw through the sonic-mgmt shim against
gobgpd v4.8.0 programs and drains both the IPv4 and IPv6 RIBs with AS_PATH,
LOCAL_PREF, MED, and standard/large/extended communities intact.

Signed-off-by: Deepak Singhal <deepsinghal@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b76b3be2-b70c-418e-9b00-c4c6d4828afa
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@Leyza Leyza changed the title [cherry-pick] install gobgp and jq for ptf [cherry-pick] install gobgp on ptf Nov 12, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@Leyza Leyza changed the title [cherry-pick] install gobgp on ptf [cherry-pick] install gobgp on ptf image Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants