Currently, SAI API generation is not leveraging the counter type information, but blindly use whatever specified in the name annotation. This leads to 2 problems:
We could accidentally generate incorrect SAI headers, e.g. name says it is a byte counter, but in fact it is a packet counter in our BM.
We could not support counters that tracks multiple things, i.e. packets and bytes.
What we are doing in this change
This change uses the type info in the counter to generate the correct SAI attributes, also fork the counter when the single counter in BM tracks multiple things.
As the screenshot shows below, after the change, if we change the counter type of the meter_bucket_outbound, a new SAI attribute will be created for it.
This change will not change any of existing SAI header files that we generated, but can be used for future scenarios.
Problem
Currently, SAI API generation is not leveraging the counter type information, but blindly use whatever specified in the
name
annotation. This leads to 2 problems:What we are doing in this change
This change uses the type info in the counter to generate the correct SAI attributes, also fork the counter when the single counter in BM tracks multiple things.
As the screenshot shows below, after the change, if we change the counter type of the meter_bucket_outbound, a new SAI attribute will be created for it.
This change will not change any of existing SAI header files that we generated, but can be used for future scenarios.