Skip to content

Improve gNMI Set error responses with proper gRPC codes and request paths - #730

Open
Verma-Anukul wants to merge 3 commits into
sonic-net:masterfrom
Verma-Anukul:upstream/gnmi-set-proper-error-codes
Open

Verma-Anukul wants to merge 3 commits into
sonic-net:masterfrom
Verma-Anukul:upstream/gnmi-set-proper-error-codes

Conversation

@Verma-Anukul

@Verma-Anukul Verma-Anukul commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Map translib errors to proper gRPC status codes in Set responses (e.g.
    InvalidArgument, NotFound) instead of always returning Unknown
  • Include the request path in Set error messages so users know which
    gNMI path caused the failure
  • Enrich CVL failure messages with table name, keys, and detailed error
    info instead of generic "Validation failed"

Changes

  • gnmi_server/server.go: Convert Set errors through ToStatus() before
    returning to the gRPC client
  • transl_utils/transl_utils.go: Add errorPath() and formatErrorWithPath()
    helpers; improve CVL error message fallback chain; fix bulk operation error
    reporting with per-entry paths
  • gnmi_server/server_test.go: Update expected error codes in tests

Before / After

Before: code = Unknown desc = got float64 type for field enabled, expect bool
After: code = InvalidArgument desc = got float64 type for field enabled, expect bool; list entry: interface[name=Ethernet8]
request path: /openconfig-interfaces:interfaces/interface

Use transutil.ToStatus() in the Set handler so translib errors surface
with correct gRPC codes and request-path context. Extend transl_utils
error mapping for CVL failures and path-aware messages, and add tests
for invalid-path Set error reporting.

Signed-off-by: Verma-Anukul <anukulverma2013@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@azure-pipelines

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

@Verma-Anukul Verma-Anukul changed the title Return proper gRPC error codes and paths in gNMI Set responses gNMI Set: return proper gRPC error codes and path context Aug 4, 2026
Restore richer TranslibCVLFailure messages and update the invalid-path
test name to match c-master behavior.

Signed-off-by: Verma-Anukul <anukulverma2013@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@Verma-Anukul Verma-Anukul changed the title gNMI Set: return proper gRPC error codes and path context Improve gNMI Set error responses with proper gRPC codes and request paths Aug 4, 2026
Cover errorPath, formatErrorWithPath, CVL table/key detail, and
TranslProcessBulk gRPC status returns to satisfy diff coverage for
PR sonic-net#730.

Signed-off-by: Verma-Anukul <anukulverma2013@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@mssonicbld

Copy link
Copy Markdown
Contributor

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

@Verma-Anukul

Copy link
Copy Markdown
Contributor Author

@hdwhdw
Please review this PR

1 similar comment
@Verma-Anukul

Copy link
Copy Markdown
Contributor Author

@hdwhdw
Please review this PR

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.

2 participants