sonic-net / DASH

Disaggregated APIs for SONiC Hosts
Apache License 2.0
78 stars 88 forks source link

[sai-gen] Add support to packets and packet_and_bytes counters, also make counter generation to be adaptive to its type. #501

Closed r12f closed 6 months ago

r12f commented 6 months ago

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:

  1. 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.
  2. 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.

image

This change will not change any of existing SAI header files that we generated, but can be used for future scenarios.

r12f commented 6 months ago

Woot! Thanks @chrispsommers ! Also - happy new year!

KrisNey-MSFT commented 5 months ago

Closing as items is Merged