Skip to content

Commit

Permalink
Default action for SAI objects or entries with only 1 table actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
r12f committed Jun 1, 2024
1 parent 7583b64 commit f9de4eb
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 9 deletions.
6 changes: 5 additions & 1 deletion dash-pipeline/SAI/specs/dash_acl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 50200087
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 25655048
attr_param_id: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: dash_acl_rule
description: ''
Expand Down
6 changes: 5 additions & 1 deletion dash-pipeline/SAI/specs/dash_eni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1442,4 +1442,8 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 45859274
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 27167550
attr_param_id: {}
12 changes: 10 additions & 2 deletions dash-pipeline/SAI/specs/dash_ha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 45319666
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 21324178
attr_param_id: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: ha_scope
description: ''
Expand Down Expand Up @@ -435,4 +439,8 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 49681752
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 25507507
attr_param_id: {}
18 changes: 15 additions & 3 deletions dash-pipeline/SAI/specs/dash_meter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 45482818
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 21630451
attr_param_id: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: meter_policy
description: ''
Expand All @@ -63,7 +67,11 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 40733610
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 20564717
attr_param_id: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: meter_rule
description: ''
Expand Down Expand Up @@ -112,4 +120,8 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 44484556
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 19652160
attr_param_id: {}
6 changes: 5 additions & 1 deletion dash-pipeline/SAI/specs/dash_tunnel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 44400659
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 27891720
attr_param_id: {}
6 changes: 5 additions & 1 deletion dash-pipeline/SAI/specs/dash_vnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ sai_apis:
tables:
- !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaTable
id: 49590243
actions: {}
actions:
default: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: default
id: 20510911
attr_param_id: {}
3 changes: 3 additions & 0 deletions dash-pipeline/SAI/utils/dash_p4/dash_p4_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ def create_sai_action_enum(self, sai_api: SaiApi) -> None:
# If the table represents an SAI object, it should not have an action enum.
# If the table has only 1 action, we don't need to create the action enum.
if len(self.actions) <= 1 and self.is_object != "false":
# We still need to create the p4 meta action here for generating default action code in libsai.
if len(self.actions) == 1:
sai_api.p4_meta.tables[0].actions["default"] = SaiApiP4MetaAction("default", self.actions[0].id)
return

action_enum_member_value = 0
Expand Down

0 comments on commit f9de4eb

Please sign in to comment.