Skip to content

[code sync] Merge code from sonic-net/sonic-utilities:202511 to 202603#323

Merged
mssonicbld merged 2 commits intoAzure:202603from
mssonicbld:sonicbld/202603-merge
Apr 29, 2026
Merged

[code sync] Merge code from sonic-net/sonic-utilities:202511 to 202603#323
mssonicbld merged 2 commits intoAzure:202603from
mssonicbld:sonicbld/202603-merge

Conversation

@mssonicbld
Copy link
Copy Markdown
Collaborator

* 1d9a7b85 - (origin/202511) GCU: silence transient YANG leafref ERR during patch-sort search (#4482) (#4484) (2026-04-27) [Xichen96]<br>```

Xichen96 and others added 2 commits April 27, 2026 22:20
…82) (#4484)

* GCU: silence transient YANG leafref ERR during patch-sort search

FullConfigMoveValidator is invoked speculatively during the patch-sort
search to check whether a candidate move results in a YANG-valid config.
Forward leafref references produce expected transient validation
failures; the sorter already handles these as a prune signal via the
returned (False, error) tuple.

However, sonic_yang.loadData logs a LOG_ERR "Data Loading Failed" line
to syslog on every exception (log-and-throw antipattern) before
raising, so each speculative probe leaks an ERR to syslog. In practice
a single config apply-patch during the GCU test suite can emit 100+
such lines, which trips loganalyzer and makes real errors hard to
find.

This change threads a quiet= kwarg through:
  ConfigWrapper.validate_config_db_config(..., quiet=False)
      -> sonic_yang.loadData(..., quiet=quiet)

and makes FullConfigMoveValidator.validate pass quiet=True. Non-
speculative callers (e.g. final target-config validation) keep the
existing default (quiet=False) and continue to log on real errors.

Depends on sonic-net/sonic-buildimage: quiet= kwarg added to
sonic_yang_ext.SonicYangExtMixin.loadData.

Validated on DUT with sonic-mgmt generic_config_updater subset
(dhcp_relay, eth_interface, vlan_interface, portchannel_interface,
cacl, lo_interface, bgp_prefix, syslog):
  BEFORE: 31P/1F/3S/3E, 231 apply-patch,  115 Data Loading Failed ERR
  AFTER:  31P/1F/3S/2E, 231 apply-patch,   34 Data Loading Failed ERR
Remaining ERR lines are from legitimate non-speculative callers.



* Address review: backward-compat quiet= + unit test

- gu_common.validate_config_db_config: wrap sy.loadData call in
  try/except TypeError so callers keep working against older
  sonic-yang-mgmt wheels that do not yet ship the quiet= kwarg.
- tests/generic_config_updater/patch_sorter_test.py: add regression
  guard asserting FullConfigMoveValidator.validate invokes the config
  wrapper with quiet=True so the speculative patch-sort search does
  not spam syslog with transient leafref LOG_ERR lines.



* Simplify: drop quiet= plumbing, hardcode quiet=True in loadData

Per review feedback, the quiet= kwarg threading through
ConfigWrapper.validate_config_db_config adds API surface for no
real benefit. loadData's LOG_ERR "Data Loading Failed" line is
always redundant -- every caller already gets the full exception
via the returned (False, error) tuple, so the syslog line is
duplicate noise regardless of whether the call site is the
speculative patch-sort search or a non-speculative validator.

This commit:
  - Removes the quiet= kwarg from validate_config_db_config and
    pins quiet=True directly in the loadData call.
  - Reverts patch_sorter.FullConfigMoveValidator.validate to its
    original one-line form (no longer needs to pass quiet=True).
  - Updates the regression unit test to assert the wrapper is
    called without the kwarg.




---------



(cherry picked from commit e04fdbbf24dd4bfbdbbd23ca110b0b3ffbdce06c)

Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mssonicbld mssonicbld merged commit 277fb00 into Azure:202603 Apr 29, 2026
3 checks passed
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.

2 participants