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
Changes update switch statement in CrmOrch::getResAvailableCounters() to use CrmResourceType enum which guarantees the uniqueness of labels in the switch statement.
Why I did it
Previously, the switch statement in CrmOrch::getResAvailableCounters() used values from two different enums: sai_switch_attr_t and sai_acl_table_attr_t. There is no guarantee that the values from sai_switch_attr_t will not conflict with values from sai_acl_table_attr_t, so it is not good coding practice. Any future development in this area should not be using values from multiple enums with overlapping values in a single switch statement.
Additionally, future CRM development can use the new sai_object_type_get_availability() with sai_object_type_t instead of defining new SAI attrs per CrmResourceType without issue of enum conflict.
Refer to crmorch.cpp changes in #1686 for an example of sai_object_type_get_availability() in CrmOrch::getResAvailableCounters().
How I verified it
Re-test of route and acl plus mpls CRM support in #1686
Details if related