sonic-net / DASH

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

[sai-gen] Simplify condition for table action generation. #554

Closed r12f closed 2 months ago

r12f commented 2 months ago

Problem

Currently, we have a very complicated check for when a table action should be generated, for example:

image

The reason of this check being introduced is to enable us ignore the SAI_VIP_ENTRY_ACTION_DENY and SAI_PA_VALIDATION_ENTRY_ACTION_DENY action while still keep the action generated for them, as these entries only has 1 action which will be ignored.

However, this check is too narrowed, and also create some issues, for example - an object (not entry) with 1 action will also have the action type generated, which is not ideal.

What are we doing in this change

Ideally, the condition to generate the action type should be really straightforward:

  1. If the table entry has more than 2 valid actions (not deny), the action type should be generated.
  2. If the table entry is an entry, not object, the action type should be generated.
  3. Otherwise, the action type should not be generated.

This simple logic simplify the mind model a lot, and the only case it didn't cover is the eni_eth_address_map_entry, which IMO, should follow the same pattern as many other similar tables (direction lookup, VIP, PA validation) and have the action type created too.

image

Hence, proposing the change to make our life easier.

r12f commented 2 months ago

thanks Mukesh for reviewing the change!