Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libsai] Re-implement APIs create/remove (#653)
Following #651, refactor APIs create/remove for easier read and maintenance: 1. Use common code `DashSai::create` and `DashSai::remove` to implement them for all SAI objects/entries 2. Fix issue #436, now only 1 SAI object is created for multiple bmv2 objects (each bmv2 object as a p4 table entry in p4 table for each stage). 3. Fix issue #654 The generated sample code of APIs create/remove attribute is as below: - SAI object objectID ![image](https://github.com/user-attachments/assets/1f300b7a-7750-43df-89e2-71570801cd06) - SAI object entry ![image](https://github.com/user-attachments/assets/d16a3bcc-0a41-4fd1-a23a-6f6663761a67) For the case of acl rule object, one acl rule is inserted into multiple p4 tables in different stages. These p4 stage tables are same and the only difference is `table id` and `table action id` in table entry, captured in struct P4MetaSiblingTable: ``` struct P4MetaSiblingTable { uint32_t id; // action enum id -> p4 action id std::map<uint32_t, uint32_t> actions; }; ``` The generated code of sibling tables for acl rule is as below: ![image](https://github.com/user-attachments/assets/4dbf0725-1ca5-488f-bf08-62b032c2f66a)
- Loading branch information