[switchorch]: Add sampled mirror and truncation capability discovery#4502
Open
Janetxxx wants to merge 1 commit intosonic-net:masterfrom
Open
[switchorch]: Add sampled mirror and truncation capability discovery#4502Janetxxx wants to merge 1 commit intosonic-net:masterfrom
Janetxxx wants to merge 1 commit intosonic-net:masterfrom
Conversation
Signed-off-by: Janet Cui <janet970527@gmail.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds SwitchOrch startup capability discovery for sampled port mirroring and samplepacket truncation, publishing results into SWITCH_CAPABILITY|switch for consumption by other components (e.g., MirrorOrch/CLI) to enable runtime feature gating.
Changes:
- Introduces new capability keys for ingress/egress sampled mirror and samplepacket truncation in
switchorch.h. - Adds
SwitchOrch::querySwitchSampledMirrorCapability()to query SAI attribute capabilities and store results in STATE_DB. - Exposes new
SwitchOrchgetters for sampled mirror and truncation support flags.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| orchagent/switchorch.h | Adds new capability key macros, new public support getters, and a private query method declaration. |
| orchagent/switchorch.cpp | Calls the new query at startup and implements SAI capability discovery + STATE_DB publishing. |
Comment on lines
+36
to
+38
| #define SWITCH_CAPABILITY_TABLE_PORT_INGRESS_SAMPLE_MIRROR_CAPABLE "PORT_INGRESS_SAMPLE_MIRROR_CAPABLE" | ||
| #define SWITCH_CAPABILITY_TABLE_PORT_EGRESS_SAMPLE_MIRROR_CAPABLE "PORT_EGRESS_SAMPLE_MIRROR_CAPABLE" | ||
| #define SWITCH_CAPABILITY_TABLE_SAMPLEPACKET_TRUNCATION_CAPABLE "SAMPLEPACKET_TRUNCATION_CAPABLE" |
| void querySwitchTpidCapability(); | ||
| void querySwitchPortEgressSampleCapability(); | ||
| void querySwitchPortMirrorCapability(); | ||
| void querySwitchSampledMirrorCapability(); |
Comment on lines
+2002
to
+2005
| } | ||
|
|
||
| set_switch_capability(fvVector); | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What I did
Added capability discovery for sampled port mirroring and packet truncation in SwitchOrch. Three new capabilities are queried at startup via
sai_query_attribute_capability()and written to STATE_DBunder
SWITCH_CAPABILITY|switch:PORT_INGRESS_SAMPLE_MIRROR_CAPABLE— SAI_PORT_ATTR_INGRESS_SAMPLE_MIRROR_SESSIONPORT_EGRESS_SAMPLE_MIRROR_CAPABLE— SAI_PORT_ATTR_EGRESS_SAMPLE_MIRROR_SESSIONSAMPLEPACKET_TRUNCATION_CAPABLE— SAI_SAMPLEPACKET_ATTR_TRUNCATE_ENABLEWhy I did it
This is part of the sampled port mirroring with truncation feature. MirrorOrch and CLI need to know at runtime whether the platform supports sampled mirroring and truncation, so they can gracefully fall back to full mirroring on platforms that do not support these capabilities.
How I verified it
querySwitchPortMirrorCapability()andquerySwitchPortEgressSampleCapability()Details if related