[sai-gen] Add counter id generation support for counters. #503
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.
Problem
Currently, DASH only supports generating counters as SAI attributes upon DASH APIs, such as metering buckets. This might be ok for new things that has dedicated DASH concepts, i.e., metering buckets. However, for other more generic counters used for collecting telemetry, this approach could leads to feature missing and not fully utilizing what we already have in SAI and SONiC. For example, no get-and-reset operation support and need to build dedicated pipeline for pulling the counters and feeds them into the telemetry.
What are we doing in this change
This change adds support to generate the counters as SAI generic counters. Instead of generate the counters as readonly attributes, we generate a counter id for it. Then, we can leverage all the infrastructure already built for counters.
As the screenshot shows below, after removing
as_attr="true"
for metering_bucket_outbound, a counter id will be generated instead of an readonly counter attribute. It also supports handling the packets-and-bytes counter too, because generic counter already collects both information.