Skip to content

Commit e5825e7

Browse files
committed
Add gnmi feedback design
Signed-off-by: Ze Gan <[email protected]>
1 parent b0e0bad commit e5825e7

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Smart Switch GNMI feedback design <!-- omit in toc -->
2+
3+
## Table of content <!-- omit in toc -->
4+
5+
- [Revision](#revision)
6+
- [Overview](#overview)
7+
- [Requirement](#requirement)
8+
- [Sequence flow](#sequence-flow)
9+
- [Set/Remove](#setremove)
10+
- [Message](#message)
11+
- [Get](#get)
12+
- [Subscribe](#subscribe)
13+
- [Table](#table)
14+
- [APPL STATE DB](#appl-state-db)
15+
- [Example 1 DASH\_ROUTE\_TABLE](#example-1-dash_route_table)
16+
- [Example 2 DASH\_ROUTING\_APPLIANCE\_TABLE](#example-2-dash_routing_appliance_table)
17+
18+
## Revision
19+
20+
| Rev | Date | Author | Change Description |
21+
| :---: | :---: | :----: | ------------------ |
22+
| 0.1 | | Ze Gan | Initial version. |
23+
24+
## Overview
25+
26+
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.
27+
28+
## Requirement
29+
30+
- Support for multiple operations in a single request
31+
- Non-child objects must always include the version ID field
32+
- The GNMI server supports set, remove, get, and subscribe operations
33+
- The GNMI client can proactively subscribe to or get objects/tables via object key or table name
34+
35+
| Child object |
36+
| ----------------- |
37+
| DASH_ACL_RULE |
38+
| DASH_ROUTE |
39+
| DASH_ROUTE_RULE |
40+
| DASH_VNET_MAPPING |
41+
42+
43+
## Sequence flow
44+
45+
### Set/Remove
46+
47+
```mermaid
48+
sequenceDiagram
49+
participant GC as GNMI Client
50+
box NPU SONiC
51+
participant GS as GNMI Server
52+
participant AD as APP DB
53+
participant ASD as APP STATE DB
54+
end
55+
Note over AD, ASD: DPUx Redis
56+
box DPU SONiC
57+
participant ZMQ as ZMQ
58+
participant SW as SWSS
59+
participant SY as SYNCD
60+
end
61+
62+
GC ->> GS: Update commands
63+
loop Each commands:
64+
GS --) AD: Insert object
65+
GS ->> ZMQ: Update command
66+
end
67+
GS -->> GC:
68+
ZMQ ->> SW: Consume commands
69+
SW ->> SY: SAI call
70+
SY -->> SW:
71+
alt Set command
72+
SW ->> ASD: Update command result
73+
Note over ZMQ: Include result code and version ID (If it's non-child object)
74+
else Del command
75+
SW ->> ASD: Remove objects
76+
end
77+
78+
```
79+
80+
### Message
81+
82+
### Get
83+
84+
```mermaid
85+
sequenceDiagram
86+
participant GC as GNMI Client
87+
box NPU SONiC
88+
participant GS as GNMI Server
89+
participant ASD as APP STATE DB
90+
end
91+
Note over ASD: DPUx Redis
92+
93+
GC ->> GS: Query object or table result
94+
GS ->> ASD: Get object via key or get objects via table name
95+
ASD -->> GS: Query results
96+
GS -->> GC: Query result
97+
98+
```
99+
100+
### Subscribe
101+
102+
```mermaid
103+
sequenceDiagram
104+
participant GC as GNMI Client
105+
box NPU SONiC
106+
participant GS as GNMI Server
107+
participant ASD as APP STATE DB
108+
end
109+
Note over ASD: DPUx Redis
110+
participant DPU as DPU
111+
112+
GC ->> GS: Subscribe object or table
113+
GS ->> GS: Register subscribe events
114+
GS ->> ASD: Get object via key or get objects via table name
115+
Note over ASD: Cache result before subscribe
116+
ASD -->> GS: Query results
117+
GS -->> GC: Query results
118+
loop Each commands
119+
alt Set command
120+
DPU ->> ASD: Update command result
121+
else Del command
122+
DPU ->> ASD: Remove objects
123+
end
124+
end
125+
ASD -->> GS: Proactively push results
126+
GS -->> GC: Proactively push results
127+
128+
```
129+
130+
## Table
131+
132+
### APPL STATE DB
133+
134+
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.
135+
136+
#### Example 1 DASH_ROUTE_TABLE
137+
138+
```text
139+
DASH_ROUTE_TABLE:{{group_id}}:{{prefix}}
140+
"result": {{result}}
141+
142+
key = DASH_ROUTE_TABLE:group_id:prefix
143+
; field = value
144+
result = uint32 0 for success, > 0 for error code
145+
```
146+
147+
#### Example 2 DASH_ROUTING_APPLIANCE_TABLE
148+
149+
```
150+
DASH_ROUTE_GROUP_TABLE:{{group_id}}
151+
"result": {{result}}
152+
"version_id": {{string}}
153+
154+
key = DASH_ROUTE_GROUP_TABLE:group_id
155+
; field = value
156+
result = uint32 0 for success, > 0 for error code
157+
version_id = string, Indicate the unique version of metadata of route group. E.G. "1", "1.1".
158+
```

0 commit comments

Comments
 (0)