You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 0.2 | 09/05/2025 | Stephen Sun | Added mirror capability discovery and validation |
52
54
53
55
54
56
# About this Manual
@@ -144,7 +146,28 @@ Existing table PORT_MIRROR_TABLE is enhanced to accept new source and destinatio
144
146
### 3.2.2 APP_DB
145
147
No tables are introduced in APP_DB
146
148
### 3.2.3 STATE_DB
147
-
No tables are introduced in STATE_DB.·
149
+
150
+
#### Table SWITCH_CAPABILITY
151
+
152
+
Table `SWITCH_CAPABILITY` is not a new table. It has been designed to represent various switch object capabilities supported on the platform.
153
+
154
+
The following fields are introduced in this design for mirror capability discovery:
155
+
156
+
```text
157
+
PORT_INGRESS_MIRROR_CAPABLE = "true" | "false" ; whether SAI attribute SAI_PORT_ATTR_INGRESS_MIRROR_SESSION is supported
158
+
PORT_EGRESS_MIRROR_CAPABLE = "true" | "false" ; whether SAI attribute SAI_PORT_ATTR_EGRESS_MIRROR_SESSION is supported
159
+
```
160
+
161
+
These capabilities are discovered during system initialization by SwitchOrch using `sai_query_attribute_capability()` and stored in STATE_DB under the key `SWITCH_CAPABILITY|switch`.
162
+
163
+
**Example STATE_DB entry:**
164
+
```text
165
+
SWITCH_CAPABILITY|switch
166
+
PORT_INGRESS_MIRROR_CAPABLE: "true"
167
+
PORT_EGRESS_MIRROR_CAPABLE: "false"
168
+
```
169
+
170
+
This indicates that the ASIC supports ingress mirror sessions but does not support egress mirror sessions.
148
171
149
172
### 3.2.4 ASIC_DB
150
173
No changes are introduced in ASIC_DB.·
@@ -163,7 +186,58 @@ Mirror Orchestration agent is modified to support this feature:
163
186
- Session with source/destination/direction config will be active once the session created from SAI is programmed on the source ports.
164
187
- Populates the mirror attribute SAI structures and pushes the entry to ASIC_DB.·
165
188
166
-
## 3.4 SAI
189
+
## 3.4 Mirror Capability Discovery
190
+
191
+
The mirror capability discovery feature provides runtime detection and validation of ASIC mirror capabilities to ensure proper configuration and graceful error handling.
192
+
193
+
### 3.4.1 Capability Discovery Process
194
+
195
+
The capability discovery process involves multiple layers:
196
+
197
+
1.**SAI Layer Discovery**: SwitchOrch queries SAI for port mirror capabilities using `sai_query_attribute_capability()` for:
198
+
-`SAI_PORT_ATTR_INGRESS_MIRROR_SESSION`
199
+
-`SAI_PORT_ATTR_EGRESS_MIRROR_SESSION`
200
+
201
+
2.**STATE_DB Storage**: Discovered capabilities are stored in STATE_DB under `SWITCH_CAPABILITY|switch`:
202
+
-`PORT_INGRESS_MIRROR_CAPABLE`: "true"/"false"
203
+
-`PORT_EGRESS_MIRROR_CAPABLE`: "true"/"false"
204
+
205
+
3.**Runtime Validation**: MirrorOrch validates capabilities before configuring mirror sessions
206
+
207
+
### 3.4.2 Capability Validation Flow
208
+
209
+
The capability validation follows this sequence:
210
+
211
+
1.**User CLI Command**: User executes a mirror session configuration command
212
+
2.**CLI Validation**: `is_port_mirror_capability_supported()` function is called
213
+
3.**STATE_DB Query**: System queries STATE_DB for mirror capabilities
214
+
4.**Direction Validation**: System validates if the requested mirror direction is supported
215
+
5.**Result**: Command proceeds if supported, or returns error message if not supported
216
+
217
+
### 3.4.3 Error Handling
218
+
219
+
-**CLI Level**: Early validation prevents invalid configurations
220
+
-**OrchAgent Level**: Runtime validation with detailed error logging
221
+
-**Graceful Degradation**: System continues to function with unsupported features disabled
222
+
223
+
### 3.4.4 Implementation Components
224
+
225
+
#### SwitchOrch Enhancements
226
+
- New capability constants: `SWITCH_CAPABILITY_TABLE_PORT_INGRESS_MIRROR_CAPABLE`, `SWITCH_CAPABILITY_TABLE_PORT_EGRESS_MIRROR_CAPABLE`
227
+
-`querySwitchPortMirrorCapability()`: Discovers and stores capabilities
228
+
- Public interface methods: `isPortIngressMirrorSupported()`, `isPortEgressMirrorSupported()`
229
+
230
+
#### MirrorOrch Enhancements
231
+
- Capability validation in `setUnsetPortMirror()`
232
+
- Separate validation for ingress and egress directions
233
+
- Detailed error logging for unsupported operations
234
+
235
+
#### CLI Enhancements
236
+
-`is_port_mirror_capability_supported()`: Queries STATE_DB for capabilities
237
+
- Integration with `validate_mirror_session_config()`
238
+
- User-friendly error messages for unsupported directions
239
+
240
+
## 3.5 SAI
167
241
Mirror SAI interface APIs are already defined.
168
242
More details about SAI API and attributes are described below SAI Spec @
0 commit comments