Skip to content

Enhancement: Upgrade to libyang3 #22385

Closed
Closed

Description

@bradh352

Is it platform specific

generic

Importance or Severity

High

Description of the enhancement

SONiC currently uses 3 versions of libyang: 1.0.73, 1.0.184, and 2.1.148. All are end of life and potentially have security issues. The current release is 3.12.2 and that is what we are targeting here.

There are also numerous libyang related bugs that have been "worked around" in SONiC due to the shortcomings of libyang1. Hopefully upgrading to a modern version will resolve such issues.

Current Behavior

3 libyang versions

Proposed Behavior

single libyang version

PR Tracking Table

Legend: strikethrough = merged/done.

Foundation (merged)

PR description
#21679 Remove libyang 1.0.184; build libyang 3.12.2 + libyang-python 3.1.0; migrate FRR to libyang3; pre-stage sonic-yang-models test cases
#21719 Port sonic-yang-models test cases
#24414 sonic-yang-mgmt: helpers to keep dependents from calling into libyang directly
#26584 Port sonic-yang-mgmt from libyang1 to libyang3 Python bindings
sonic-net/sonic-utilities#4118 sonic-utilities: remove direct dependency on libyang
sonic-net/sonic-platform-daemons#589, sonic-net/sonic-platform-common#544 Interim: install both libyang1 and libyang3
sonic-net/sonic-swss-common#973 sonic-swss-common: port to libyang3

Code port (open)

PR description
sonic-net/sonic-mgmt-common#157 sonic-mgmt-common (Go/CVL): port to libyang3
sonic-net/sonic-mgmt#24821 sonic-mgmt: port tests/telemetry/validate_yang_events.py from libyang1 to libyang3 Python bindings (last import yang consumer in the test repo)

Buildimage — consolidated final change (open)

PR description
#27629 Migrate the remaining buildimage consumers to libyang3, remove the libyang3-dev-done coexistence shim and the post-FRR libyang3-dev UNINSTALLS, and delete libyang1 (rules/libyang.{mk,dep}, src/libyang). Supersedes and replaces former steps 4–7 (#21718, #21752, #21789, #21790, now closed). This is the last buildimage PR to complete the migration.

Per-repo CI/build: install libyang3 debs instead of libyang1 (open)

PR description
sonic-net/sonic-swss#4624 build-env / dev Dockerfile / README → versionless libyang3 globs
sonic-net/sonic-dbsyncd#82 azure-pipelines → libyang3_*.deb
sonic-net/sonic-restapi#189 Dockerfile / copy.sh / dependencies.conf → libyang3
sonic-net/sonic-snmpagent#377 azure-pipelines → libyang3_*.deb
sonic-net/sonic-dhcpmon#78 azure-pipelines download filter → libyang3
sonic-net/sonic-dhcp-relay#113 azure-pipelines + codeql → libyang3
sonic-net/sonic-linkmgrd#341 azure-pipelines download filters → libyang3
sonic-net/sonic-bmp#37 azure-pipelines install → libyang3_*.deb
sonic-net/sonic-gnmi#693 install-dependencies → libyang3
sonic-net/sonic-host-services#386 azure-pipelines install → libyang3_*.deb
sonic-net/sonic-mgmt-framework#161 azure-pipelines download/install → libyang3
sonic-net/sonic-platform-common#683 azure-pipelines: drop libyang1, keep libyang3
sonic-net/sonic-platform-daemons#827 azure-pipelines: drop libyang1, keep libyang3
sonic-net/sonic-stp#90 azure-pipelines install → libyang3_*.deb
sonic-net/sonic-utilities#4578 azure-pipelines / README → libyang3 (drop libyang-cpp, python3-yang→python3-libyang)
sonic-net/sonic-wpa-supplicant#115 azure-pipelines download filters → libyang3
sonic-net/sonic-platform-vpp#243 rules: migrate libyang1 make-vars (LIBYANG/LIBYANG_CPP/LIBYANG_PY3/LIBYANG2) to libyang3

Per-repo CI already migrated upstream (done)

PR description
sonic-net/sonic-sairedis#1916 sonic-sairedis: download/install libyang3
sonic-net/sonic-dash-ha#173 sonic-dash-ha: CI deps → libyang3

Order: merge the code ports (sonic-mgmt-common#157) and the per-repo CI PRs first, then #27629 last (it removes libyang1, so it must land only after every consumer is on libyang3).

Activity

  1. added
    YANGYANG model related changes
    Triagedthis issue has been triaged
    on Apr 23, 2025
  2. prgeor commented on Apr 23, 2025

    @prgeor
    Contributor

    @qiluo-msft can you have someone review these PRs?

  3. moved this from To do to Review in progress in yangon Jun 12, 2025
  4. zhangyanzhao commented on Jun 12, 2025

    @zhangyanzhao

    The tracking PR for the libyang upgrade

  5. zhangyanzhao commented on Jun 12, 2025

    @zhangyanzhao

    Libyang v2 is end of life, need to get this merged asap. Thanks.

  6. bradh352 commented on Jun 12, 2025

    @bradh352
    CollaboratorAuthor

    If I can get commitment from the community to review and merge this set of PRs, I can work on on the merge conflicts. They were fully validated and working a few months back, but I could never get review so I stopped keeping them up-to-date as it is quite time consuming.

    That said, I do need a couple of PRs merged first as otherwise they will cause more significant merge conflicts when they do merge.

    #21907

    then once that's merged, this PR should succeed in builds and also be merged:
    sonic-net/sonic-utilities#3831

  7. bradh352 commented on Jun 13, 2025

    @bradh352
    CollaboratorAuthor

    FYI, I've rebased the first PR in the series and it is passing now. Its much smaller due to FRR 10.3 no longer needing patches, and also libyang 3.12.2 incorporated a large number of the patches I sent upstream, so have rebased to use that version.

  8. moved this to 📋 In Plan Features in SONiC 202511 Releaseon Jun 13, 2025
  9. 106 remaining items

  10. bhouse-nexthop commented on Jun 30, 2026

    @bhouse-nexthop
    Collaborator

    all merged

  11. moved this from To be reviewed to Done in yangon Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Enhancement ➕Triagedthis issue has been triagedYANGYANG model related changes

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions