Skip to content

Implements the frontend logic for gNSI Authz#508

Closed
kanchanavelusamy wants to merge 1 commit into
sonic-net:masterfrom
kanchanavelusamy:gnsi_authz_fe
Closed

Implements the frontend logic for gNSI Authz#508
kanchanavelusamy wants to merge 1 commit into
sonic-net:masterfrom
kanchanavelusamy:gnsi_authz_fe

Conversation

@kanchanavelusamy

@kanchanavelusamy kanchanavelusamy commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

This commit enables support for policy-based authorization of gRPC requests in gNMI server and handles the Authz Rotate() RPC for secure policy updates.

Dependency Chain for Merge

Please follow this merge order,

  1. Backend Base PR: sonic-mgmt-common #183 (Must be merged first)
  2. Backend Incremental PR: sonic-mgmt-common #184
  3. Current PR: sonic-gnmi #508

gNSI Authz - UT Results
=== RUN TestGnsiAuthzRotation
=== RUN TestGnsiAuthzRotation/RotateOpenClose
=== RUN TestGnsiAuthzRotation/RotatePolicyEmptyRequest
=== RUN TestGnsiAuthzRotation/RotatePolicyEmptyUploadRequest
=== RUN TestGnsiAuthzRotation/RotatePolicyWrongJSON
=== RUN TestGnsiAuthzRotation/RotatePolicyNoVersion
=== RUN TestGnsiAuthzRotation/RotatePolicySuccess
=== RUN TestGnsiAuthzRotation/RotatePolicyNoFinalize
=== RUN TestGnsiAuthzRotation/RotateTheSamePolicyTwice
=== RUN TestGnsiAuthzRotation/RotateTheSamePolicyTwiceWithForceOverwrite
=== RUN TestGnsiAuthzRotation/ParallelRotationCalls
--- PASS: TestGnsiAuthzRotation (4.55s)
--- PASS: TestGnsiAuthzRotation/RotateOpenClose (0.04s)
--- PASS: TestGnsiAuthzRotation/RotatePolicyEmptyRequest (0.03s)
--- PASS: TestGnsiAuthzRotation/RotatePolicyEmptyUploadRequest (0.03s)
--- PASS: TestGnsiAuthzRotation/RotatePolicyWrongJSON (0.03s)
--- PASS: TestGnsiAuthzRotation/RotatePolicyNoVersion (0.03s)
--- PASS: TestGnsiAuthzRotation/RotatePolicySuccess (0.03s)
--- PASS: TestGnsiAuthzRotation/RotatePolicyNoFinalize (0.03s)
--- PASS: TestGnsiAuthzRotation/RotateTheSamePolicyTwice (0.05s)
--- PASS: TestGnsiAuthzRotation/RotateTheSamePolicyTwiceWithForceOverwrite (0.05s)
--- PASS: TestGnsiAuthzRotation/ParallelRotationCalls (0.05s)

Why I did it

How I did it

How to verify it

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

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

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

@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

/azp run

@azure-pipelines

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

@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

/azp run

@azure-pipelines

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

@kanchanavelusamy kanchanavelusamy changed the title add gnsi authz Implements the frontend logic for gNSI Authz Sep 23, 2025
@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

/azp run

@azure-pipelines

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

@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

/azp run

@azure-pipelines

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

@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

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@kanchanavelusamy

Copy link
Copy Markdown
Contributor Author

@rlucus, @ndas7: Could you please review and share your feedback.
cc: @kishanps

Comment thread gnmi_server/gnsi_authz.go Outdated
Comment thread gnmi_server/log/level.go Outdated
Comment thread gnmi_server/server.go Outdated
Comment thread gnmi_server/server.go Outdated
Comment thread gnmi_server/server_test.go Outdated
@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

/azp run

@azure-pipelines

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

@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

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@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

/azp run

@azure-pipelines

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

@kanchanavelusamy

Copy link
Copy Markdown
Contributor Author

@ndas7: Due to the transformer code (#183, #184) not yet being merged into the master, the Azure build is failing, and we are unable to get code coverage reports through Azure.
To ensure code coverage could still be assessed, I utilized "go tool cover" for local analysis. Initially, some inconsistencies were observed in the file-specific coverage data. These have since been investigated and corrected.
This PR has been now updated with a new commit incorporating these corrections. . Kindly review and share your feedback.

cc: @kishanps

mssonicbld added a commit to mssonicbld/sonic-mgmt-common that referenced this pull request Dec 4, 2025
This PR introduces the new YANG models for gNSI Authz, Certz, Pathz and Credentialz. And, updates the list to include the new models.

**Dependency Chain for Merge**

Please follow this merge order,
1. Current PR: sonic-mgmt-common #[183 ](sonic-net#183 be merged first)
2. Incremental PR: sonic-mgmt-common #[184](sonic-net#184)
3. Frontend: sonic-gnmi #[508](sonic-net/sonic-gnmi#508)
mssonicbld added a commit to sonic-net/sonic-mgmt-common that referenced this pull request Dec 4, 2025
This PR introduces the new YANG models for gNSI Authz, Certz, Pathz and Credentialz. And, updates the list to include the new models.

**Dependency Chain for Merge**

Please follow this merge order,
1. Current PR: sonic-mgmt-common #[183 ](#183 be merged first)
2. Incremental PR: sonic-mgmt-common #[184](#184)
3. Frontend: sonic-gnmi #[508](sonic-net/sonic-gnmi#508)
Comment thread gnmi_server/gnsi_authz.go
import (
"bytes"
"context"
"encoding/json"

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.

Comment thread gnmi_server/gnsi_util.go
import (
"fmt"
"github.com/Azure/sonic-mgmt-common/translib/db"
"github.com/go-redis/redis/v7"

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.

@hdwhdw

hdwhdw commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

closing this due to staleness. please create another PR if we still want the feature.

@hdwhdw hdwhdw closed this Apr 8, 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.

5 participants