[sai-gen] Add support for generating SAI stats APIs for counters. #514
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
DASH has scaling requirement that requires technology providers to support huge number of objects, e.g. 8M of CA-PA mappings. If we need to add counters for these objects by using generic SAI counters, we will generate large number of counter ids, which might not be ideal.
Also some counters we are collecting are not data path counters, but more like hit counts, which is not what generic SAI counter is modeling.
For these cases, we can support generating the counters as SAI stats and leverage existing SAI stats API design for querying the counters back.
What we are doing in this change
This change updated sai_api_gen.py with 2 changes:
as_attr
toattr_type
for supporting more types of counter generation.This feature will be used in the incoming fast path API generations.
Take metering bucket as an example to illustrate this change, say we updated its counters to capture both packet and bytes, change its type to stats, then add another counter for tracking all traffic, not on metering bucket level:
This will results in the both metering bucket counter being generated as stats enum:
Once an table as any stats enum, we will generate the stats APIs:
On port level, it will generate the overall counters:
However, we are not generating a working libsai at this moment, which is the same as the counters today. This work will be postponed to later time.