Skip to content

Commit

Permalink
Add P4 meta in SAI spec for lib generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
r12f committed Jun 1, 2024
1 parent d94c45a commit 3d0417b
Show file tree
Hide file tree
Showing 19 changed files with 235 additions and 26 deletions.
28 changes: 25 additions & 3 deletions dash-pipeline/SAI/specs/dash_acl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 50200087
actions: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: dash_acl_rule
description: ''
Expand All @@ -38,15 +41,15 @@ sai_apis:
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_DASH_ACL_RULE_ACTION_PERMIT_AND_CONTINUE
description: ''
value: '0'
value: '1'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_DASH_ACL_RULE_ACTION_DENY
description: ''
value: '0'
value: '2'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_DASH_ACL_RULE_ACTION_DENY_AND_CONTINUE
description: ''
value: '0'
value: '3'
structs: []
attributes:
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
Expand Down Expand Up @@ -98,3 +101,22 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 41950136
actions:
SAI_DASH_ACL_RULE_ACTION_PERMIT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_DASH_ACL_RULE_ACTION_PERMIT
id: 32161567
attr_param_id: {}
SAI_DASH_ACL_RULE_ACTION_PERMIT_AND_CONTINUE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_DASH_ACL_RULE_ACTION_PERMIT_AND_CONTINUE
id: 20706700
attr_param_id: {}
SAI_DASH_ACL_RULE_ACTION_DENY: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_DASH_ACL_RULE_ACTION_DENY
id: 28146588
attr_param_id: {}
SAI_DASH_ACL_RULE_ACTION_DENY_AND_CONTINUE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_DASH_ACL_RULE_ACTION_DENY_AND_CONTINUE
id: 31424218
attr_param_id: {}
7 changes: 7 additions & 0 deletions dash-pipeline/SAI/specs/dash_direction_lookup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 44703784
actions:
SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_OUTBOUND_DIRECTION: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_DIRECTION_LOOKUP_ENTRY_ACTION_SET_OUTBOUND_DIRECTION
id: 17408972
attr_param_id: {}
11 changes: 11 additions & 0 deletions dash-pipeline/SAI/specs/dash_eni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 36648123
actions:
SAI_ENI_ETHER_ADDRESS_MAP_ENTRY_ACTION_SET_ENI: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_ENI_ETHER_ADDRESS_MAP_ENTRY_ACTION_SET_ENI
id: 24618133
attr_param_id:
SAI_ENI_ETHER_ADDRESS_MAP_ENTRY_ENI_ID: 1
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: eni
description: ''
Expand Down Expand Up @@ -1428,3 +1436,6 @@ sai_apis:
allow_null: false
valid_only: null
deprecated: null
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 45859274
actions: {}
6 changes: 6 additions & 0 deletions dash-pipeline/SAI/specs/dash_ha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ sai_apis:
allow_null: false
valid_only: null
deprecated: null
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 45319666
actions: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: ha_scope
description: ''
Expand Down Expand Up @@ -426,3 +429,6 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 49681752
actions: {}
30 changes: 27 additions & 3 deletions dash-pipeline/SAI/specs/dash_inbound_routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ sai_apis:
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_INBOUND_ROUTING_ENTRY_ACTION_TUNNEL_DECAP_PA_VALIDATE
description: ''
value: '0'
value: '1'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP
description: ''
value: '0'
value: '2'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP_PA_VALIDATE
description: ''
value: '0'
value: '3'
structs:
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
name: sai_inbound_routing_entry_entry_t
Expand Down Expand Up @@ -112,3 +112,27 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 38920290
actions:
SAI_INBOUND_ROUTING_ENTRY_ACTION_TUNNEL_DECAP: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_INBOUND_ROUTING_ENTRY_ACTION_TUNNEL_DECAP
id: 22253429
attr_param_id:
SAI_INBOUND_ROUTING_ENTRY_METER_CLASS_OR: 1
SAI_INBOUND_ROUTING_ENTRY_METER_CLASS_AND: 2
SAI_INBOUND_ROUTING_ENTRY_ACTION_TUNNEL_DECAP_PA_VALIDATE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_INBOUND_ROUTING_ENTRY_ACTION_TUNNEL_DECAP_PA_VALIDATE
id: 27987616
attr_param_id:
SAI_INBOUND_ROUTING_ENTRY_SRC_VNET_ID: 1
SAI_INBOUND_ROUTING_ENTRY_METER_CLASS_OR: 2
SAI_INBOUND_ROUTING_ENTRY_METER_CLASS_AND: 3
SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP
id: 32581635
attr_param_id: {}
SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP_PA_VALIDATE: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_INBOUND_ROUTING_ENTRY_ACTION_VXLAN_DECAP_PA_VALIDATE
id: 22711915
attr_param_id: {}
9 changes: 9 additions & 0 deletions dash-pipeline/SAI/specs/dash_meter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ sai_apis:
allow_null: false
valid_only: null
deprecated: null
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 45482818
actions: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: meter_policy
description: ''
Expand All @@ -54,6 +57,9 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 40733610
actions: {}
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: meter_rule
description: ''
Expand Down Expand Up @@ -98,3 +104,6 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 44484556
actions: {}
27 changes: 26 additions & 1 deletion dash-pipeline/SAI/specs/dash_outbound_ca_to_pa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sai_apis:
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING
description: ''
value: '0'
value: '1'
structs:
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
name: sai_outbound_ca_to_pa_entry_entry_t
Expand Down Expand Up @@ -194,3 +194,28 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 43335456
actions:
SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_TUNNEL_MAPPING: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_TUNNEL_MAPPING
id: 25614729
attr_param_id:
SAI_OUTBOUND_CA_TO_PA_ENTRY_UNDERLAY_DIP: 1
SAI_OUTBOUND_CA_TO_PA_ENTRY_OVERLAY_DMAC: 2
SAI_OUTBOUND_CA_TO_PA_ENTRY_USE_DST_VNET_VNI: 3
SAI_OUTBOUND_CA_TO_PA_ENTRY_METER_CLASS_OR: 4
SAI_OUTBOUND_CA_TO_PA_ENTRY_FLOW_RESIMULATION_REQUESTED: 5
SAI_OUTBOUND_CA_TO_PA_ENTRY_ROUTING_ACTIONS_DISABLED_IN_FLOW_RESIMULATION: 6
SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING
id: 31441909
attr_param_id:
SAI_OUTBOUND_CA_TO_PA_ENTRY_UNDERLAY_DIP: 1
SAI_OUTBOUND_CA_TO_PA_ENTRY_OVERLAY_SIP: 2
SAI_OUTBOUND_CA_TO_PA_ENTRY_OVERLAY_DIP: 3
SAI_OUTBOUND_CA_TO_PA_ENTRY_DASH_ENCAPSULATION: 4
SAI_OUTBOUND_CA_TO_PA_ENTRY_TUNNEL_KEY: 5
SAI_OUTBOUND_CA_TO_PA_ENTRY_METER_CLASS_OR: 6
SAI_OUTBOUND_CA_TO_PA_ENTRY_FLOW_RESIMULATION_REQUESTED: 7
SAI_OUTBOUND_CA_TO_PA_ENTRY_ROUTING_ACTIONS_DISABLED_IN_FLOW_RESIMULATION: 8
54 changes: 50 additions & 4 deletions dash-pipeline/SAI/specs/dash_outbound_routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ sai_apis:
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET_DIRECT
description: ''
value: '0'
value: '1'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_DIRECT
description: ''
value: '0'
value: '2'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_SERVICE_TUNNEL
description: ''
value: '0'
value: '3'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_DROP
description: ''
value: '0'
value: '4'
structs:
- !!python/object:utils.sai_spec.sai_struct.SaiStruct
name: sai_outbound_routing_entry_entry_t
Expand Down Expand Up @@ -242,3 +242,49 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 44010720
actions:
SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET
id: 21392322
attr_param_id:
SAI_OUTBOUND_ROUTING_ENTRY_DST_VNET_ID: 1
SAI_OUTBOUND_ROUTING_ENTRY_METER_CLASS_OR: 2
SAI_OUTBOUND_ROUTING_ENTRY_METER_CLASS_AND: 3
SAI_OUTBOUND_ROUTING_ENTRY_ROUTING_ACTIONS_DISABLED_IN_FLOW_RESIMULATION: 4
SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET_DIRECT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_VNET_DIRECT
id: 24813914
attr_param_id:
SAI_OUTBOUND_ROUTING_ENTRY_DST_VNET_ID: 1
SAI_OUTBOUND_ROUTING_ENTRY_OVERLAY_IP: 3
SAI_OUTBOUND_ROUTING_ENTRY_METER_CLASS_OR: 4
SAI_OUTBOUND_ROUTING_ENTRY_METER_CLASS_AND: 5
SAI_OUTBOUND_ROUTING_ENTRY_ROUTING_ACTIONS_DISABLED_IN_FLOW_RESIMULATION: 6
SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_DIRECT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_DIRECT
id: 31102279
attr_param_id:
SAI_OUTBOUND_ROUTING_ENTRY_METER_CLASS_OR: 1
SAI_OUTBOUND_ROUTING_ENTRY_METER_CLASS_AND: 2
SAI_OUTBOUND_ROUTING_ENTRY_ROUTING_ACTIONS_DISABLED_IN_FLOW_RESIMULATION: 3
SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_SERVICE_TUNNEL: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_ROUTE_SERVICE_TUNNEL
id: 26982790
attr_param_id:
SAI_OUTBOUND_ROUTING_ENTRY_OVERLAY_DIP: 2
SAI_OUTBOUND_ROUTING_ENTRY_OVERLAY_DIP_MASK: 4
SAI_OUTBOUND_ROUTING_ENTRY_OVERLAY_SIP: 6
SAI_OUTBOUND_ROUTING_ENTRY_OVERLAY_SIP_MASK: 8
SAI_OUTBOUND_ROUTING_ENTRY_UNDERLAY_DIP: 10
SAI_OUTBOUND_ROUTING_ENTRY_UNDERLAY_SIP: 12
SAI_OUTBOUND_ROUTING_ENTRY_DASH_ENCAPSULATION: 13
SAI_OUTBOUND_ROUTING_ENTRY_TUNNEL_KEY: 14
SAI_OUTBOUND_ROUTING_ENTRY_METER_CLASS_OR: 15
SAI_OUTBOUND_ROUTING_ENTRY_METER_CLASS_AND: 16
SAI_OUTBOUND_ROUTING_ENTRY_ROUTING_ACTIONS_DISABLED_IN_FLOW_RESIMULATION: 17
SAI_OUTBOUND_ROUTING_ENTRY_ACTION_DROP: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_OUTBOUND_ROUTING_ENTRY_ACTION_DROP
id: 18759588
attr_param_id: {}
7 changes: 7 additions & 0 deletions dash-pipeline/SAI/specs/dash_pa_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 35526612
actions:
SAI_PA_VALIDATION_ENTRY_ACTION_PERMIT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_PA_VALIDATION_ENTRY_ACTION_PERMIT
id: 32591400
attr_param_id: {}
7 changes: 7 additions & 0 deletions dash-pipeline/SAI/specs/dash_vip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,10 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 45245089
actions:
SAI_VIP_ENTRY_ACTION_ACCEPT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_VIP_ENTRY_ACTION_ACCEPT
id: 26041632
attr_param_id: {}
3 changes: 3 additions & 0 deletions dash-pipeline/SAI/specs/dash_vnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 49590243
actions: {}
9 changes: 9 additions & 0 deletions dash-pipeline/SAI/specs/route.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,12 @@ sai_apis:
valid_only: null
deprecated: null
stats: []
p4_meta: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4Meta
id: 49279256
actions:
SAI_ROUTE_ENTRY_ACTION_PKT_ACT: !!python/object:utils.sai_spec.sai_api_p4_meta.SaiApiP4MetaAction
name: SAI_ROUTE_ENTRY_ACTION_PKT_ACT
id: 32404057
attr_param_id:
SAI_ROUTE_ENTRY_PACKET_ACTION: 1
SAI_ROUTE_ENTRY_NEXT_HOP_ID: 2
4 changes: 2 additions & 2 deletions dash-pipeline/SAI/utils/dash_p4/dash_p4_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ def generate_counter_sai_attributes(self) -> "Iterator[DashP4Counter]":
#
# Functions for generating SAI specs.
#
def _get_sai_name(self, table_name: str) -> str:
def get_sai_name(self, table_name: str) -> str:
if self.attr_type == "stats":
return f"SAI_{table_name.upper()}_STAT_{self.name.upper()}"

return f"SAI_{table_name.upper()}_{self.name.upper()}"

def _get_sai_description(self, table_name: str):
def get_sai_description(self, table_name: str):
if self.attr_type == "stats":
return f"DASH {table_name.upper()} {self.name.upper()} stat count"

Expand Down
Loading

0 comments on commit 3d0417b

Please sign in to comment.