sonic-net / DASH

Disaggregated APIs for SONiC Hosts
Apache License 2.0
80 stars 89 forks source link

[sai-gen] Simplify type solving, move enum type solving to use Sai attribute, add default value in Sai attribute #475

Closed r12f closed 8 months ago

r12f commented 9 months ago

With these changes, we will be able to specify the enum types and default value for any table key and action parameter as below:

@Sai[type="sai_dash_encapsulation_t", default_value="SAI_DASH_ENCAPSULATION_VXLAN"]
dash_encapsulation_t dash_encapsulation,

This removes the dependency on the variable name which has to match with the type.

This leads below code change which makes the generated SAI matches what is in opencompute SAI:

r12f@r12f-dl380:~/data/code/sonic/DASH/dash-pipeline
$ diff SAI/SAI/experimental/ ~/data/code/sonic/DASH-exp/dash-pipeline/SAI/SAI/experimental/
diff SAI/SAI/experimental/saiexperimentaldashoutboundrouting.h /home/r12f/data/code/sonic/DASH-exp/dash-pipeline/SAI/SAI/experimental/saiexperimentaldashoutboundrouting.h
206c206
<      * @default SAI_DASH_ENCAPSULATION_VXLAN
---
>      * @default SAI_DASH_ENCAPSULATION_INVALID

r12f@r12f-dl380:~/data/code/sonic/DASH/dash-pipeline
$ diff SAI/lib ~/data/code/sonic/DASH-exp/dash-pipeline/SAI/lib
r12f commented 9 months ago

This change is built on top of #473 . Please don't review the change until #473 is merged.

After #473 is merged, i will rebase this change to show the real difference.

r12f commented 9 months ago

Ok, now the change is ready for review.