-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[doc]: Add gnmi feedback design for SmartSwitch #1759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Pterosaur
wants to merge
4
commits into
sonic-net:master
Choose a base branch
from
Pterosaur:gnmi_feedback
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
158 changes: 158 additions & 0 deletions
158
doc/smart-switch/gnmi-feedback/smart-switch-gnmi-feedback-design.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# Smart Switch GNMI feedback design <!-- omit in toc --> | ||
|
||
## Table of content <!-- omit in toc --> | ||
|
||
- [Revision](#revision) | ||
- [Overview](#overview) | ||
- [Requirement](#requirement) | ||
- [Sequence flow](#sequence-flow) | ||
- [Set/Remove](#setremove) | ||
- [Message](#message) | ||
- [Get](#get) | ||
- [Subscribe](#subscribe) | ||
- [Table](#table) | ||
- [APPL STATE DB](#appl-state-db) | ||
- [Example 1 DASH\_ROUTE\_TABLE](#example-1-dash_route_table) | ||
- [Example 2 DASH\_ROUTING\_APPLIANCE\_TABLE](#example-2-dash_routing_appliance_table) | ||
|
||
## Revision | ||
|
||
| Rev | Date | Author | Change Description | | ||
| :---: | :---: | :----: | ------------------ | | ||
| 0.1 | | Ze Gan | Initial version. | | ||
|
||
## Overview | ||
|
||
The controller communicates with SmartSwitch via the GNMI interface. To enhance configuration efficiency, we provide batch GNMI operations to the GNMI client, allowing it to submit multiple operations in a single request. This document covers two communication channels: the external channel between the GNMI client and server, and the internal channel between the GNMI server and DPU SAI. | ||
|
||
## Requirement | ||
|
||
- Support for multiple operations in a single request | ||
- Non-child objects must always include the version ID field | ||
- The GNMI server supports set, remove, get, and subscribe operations | ||
- The GNMI client can proactively subscribe to or get objects/tables via object key or table name | ||
|
||
| Child object | | ||
| ----------------- | | ||
| DASH_ACL_RULE | | ||
| DASH_ROUTE | | ||
| DASH_ROUTE_RULE | | ||
| DASH_VNET_MAPPING | | ||
|
||
|
||
## Sequence flow | ||
|
||
### Set/Remove | ||
|
||
```mermaid | ||
sequenceDiagram | ||
participant GC as GNMI Client | ||
box NPU SONiC | ||
participant GS as GNMI Server | ||
participant AD as APP DB | ||
participant ASD as APP STATE DB | ||
end | ||
Note over AD, ASD: DPUx Redis | ||
box DPU SONiC | ||
participant ZMQ as ZMQ | ||
participant SW as SWSS | ||
participant SY as SYNCD | ||
end | ||
|
||
GC ->> GS: Update commands | ||
loop Each commands: | ||
GS --) AD: Insert object | ||
GS ->> ZMQ: Update command | ||
end | ||
GS -->> GC: | ||
ZMQ ->> SW: Consume commands | ||
SW ->> SY: SAI call | ||
SY -->> SW: | ||
alt Set command | ||
SW ->> ASD: Update command result | ||
Note over ZMQ: Include result code and version ID (If it's non-child object) | ||
else Del command | ||
SW ->> ASD: Remove objects | ||
end | ||
|
||
``` | ||
|
||
### Message | ||
|
||
### Get | ||
|
||
```mermaid | ||
sequenceDiagram | ||
participant GC as GNMI Client | ||
box NPU SONiC | ||
participant GS as GNMI Server | ||
participant ASD as APP STATE DB | ||
end | ||
Note over ASD: DPUx Redis | ||
|
||
GC ->> GS: Query object or table result | ||
GS ->> ASD: Get object via key or get objects via table name | ||
ASD -->> GS: Query results | ||
GS -->> GC: Query result | ||
|
||
``` | ||
|
||
### Subscribe | ||
|
||
```mermaid | ||
sequenceDiagram | ||
participant GC as GNMI Client | ||
box NPU SONiC | ||
participant GS as GNMI Server | ||
participant ASD as APP STATE DB | ||
end | ||
Note over ASD: DPUx Redis | ||
participant DPU as DPU | ||
|
||
GC ->> GS: Subscribe object or table | ||
GS ->> GS: Register subscribe events | ||
GS ->> ASD: Get object via key or get objects via table name | ||
Note over ASD: Cache result before subscribe | ||
ASD -->> GS: Query results | ||
GS -->> GC: Query results | ||
loop Each commands | ||
alt Set command | ||
DPU ->> ASD: Update command result | ||
else Del command | ||
DPU ->> ASD: Remove objects | ||
end | ||
end | ||
ASD -->> GS: Proactively push results | ||
GS -->> GC: Proactively push results | ||
|
||
``` | ||
|
||
## Table | ||
|
||
### APPL STATE DB | ||
|
||
DASH state table in APPL STATE DB, table name is the same as DASH table, key is the same, and fields are result and version ID if it's not a child object. | ||
|
||
#### Example 1 DASH_ROUTE_TABLE | ||
|
||
```text | ||
DASH_ROUTE_TABLE:{{group_id}}:{{prefix}} | ||
"result": {{result}} | ||
|
||
key = DASH_ROUTE_TABLE:group_id:prefix | ||
; field = value | ||
result = uint32 0 for success, > 0 for error code | ||
``` | ||
|
||
#### Example 2 DASH_ROUTING_APPLIANCE_TABLE | ||
|
||
``` | ||
DASH_ROUTE_GROUP_TABLE:{{group_id}} | ||
"result": {{result}} | ||
"version_id": {{string}} | ||
|
||
key = DASH_ROUTE_GROUP_TABLE:group_id | ||
; field = value | ||
result = uint32 0 for success, > 0 for error code | ||
version_id = string, Indicate the unique version of metadata of route group. E.G. "1", "1.1". | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an example for DASH_ROUTE_GROUP_TABLE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is just an example, more tables will be on the dash hld document.