Skip to content

Commit

Permalink
Fix underlay header generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
r12f committed Jun 2, 2024
1 parent 8336bdf commit 045a953
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_acl.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_acl
description: DASH ACL
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: dash_acl_group
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_direction_lookup.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_direction_lookup
description: DASH direction lookup
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: direction_lookup_entry
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_eni.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_eni
description: DASH ENI
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: eni_ether_address_map_entry
Expand Down
11 changes: 6 additions & 5 deletions dash-pipeline/SAI/specs/dash_ha.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_ha
description: DASH HA
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: ha_set
Expand Down Expand Up @@ -46,7 +47,7 @@ sai_apis:
object_name: null
allow_null: false
valid_only: null
is_vlan: false
is_vlan: true
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_HA_SET_ATTR_DP_CHANNEL_DST_PORT
Expand All @@ -59,7 +60,7 @@ sai_apis:
object_name: null
allow_null: false
valid_only: null
is_vlan: false
is_vlan: true
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_HA_SET_ATTR_DP_CHANNEL_MIN_SRC_PORT
Expand All @@ -72,7 +73,7 @@ sai_apis:
object_name: null
allow_null: false
valid_only: null
is_vlan: false
is_vlan: true
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_HA_SET_ATTR_DP_CHANNEL_MAX_SRC_PORT
Expand All @@ -85,7 +86,7 @@ sai_apis:
object_name: null
allow_null: false
valid_only: null
is_vlan: false
is_vlan: true
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_HA_SET_ATTR_DP_CHANNEL_PROBE_INTERVAL_MS
Expand Down Expand Up @@ -414,7 +415,7 @@ sai_apis:
object_name: null
allow_null: false
valid_only: null
is_vlan: false
is_vlan: true
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_HA_SCOPE_ATTR_DASH_HA_ROLE
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_inbound_routing.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_inbound_routing
description: DASH inbound routing
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: inbound_routing_entry
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_meter.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_meter
description: DASH meter
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: meter_bucket
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_outbound_ca_to_pa.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_outbound_ca_to_pa
description: DASH outbound CA to PA
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: outbound_ca_to_pa_entry
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_outbound_routing.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_outbound_routing
description: DASH outbound routing
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: outbound_routing_entry
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_pa_validation.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_pa_validation
description: DASH PA validation
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: pa_validation_entry
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_tunnel.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_tunnel
description: DASH tunnel
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: dash_tunnel
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_vip.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_vip
description: DASH vip
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: vip_entry
Expand Down
1 change: 1 addition & 0 deletions dash-pipeline/SAI/specs/dash_vnet.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: dash_vnet
description: DASH VNET
api_type: overlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: vnet
Expand Down
5 changes: 3 additions & 2 deletions dash-pipeline/SAI/specs/route.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!!python/object:utils.sai_spec.sai_api_group.SaiApiGroup
name: route
description: route
api_type: underlay
sai_apis:
- !!python/object:utils.sai_spec.sai_api.SaiApi
name: route_entry
Expand Down Expand Up @@ -57,7 +58,7 @@ sai_apis:
object_name: null
allow_null: false
valid_only: null
is_vlan: false
is_vlan: true
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID
Expand All @@ -70,7 +71,7 @@ sai_apis:
object_name: null
allow_null: false
valid_only: null
is_vlan: false
is_vlan: true
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_ROUTE_ENTRY_ATTR_IP_ADDR_FAMILY
Expand Down
2 changes: 2 additions & 0 deletions dash-pipeline/SAI/utils/dash_p4/dash_p4_table_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def to_sai_attribute(self, table_name: str, create_only: bool = False) -> List[S

object_name = f"SAI_OBJECT_TYPE_{self.object_name.upper()}" if self.object_name else None
allow_null = True if self.type == "sai_object_id_t" else False
is_vlan = True if self.type == "sai_uint16_t" else False

if self.isreadonly == "true":
sai_flags = "READ_ONLY"
Expand All @@ -152,6 +153,7 @@ def to_sai_attribute(self, table_name: str, create_only: bool = False) -> List[S
object_name = object_name,
allow_null = allow_null,
valid_only = self.validonly,
is_vlan = is_vlan,
)
]

Expand Down
2 changes: 2 additions & 0 deletions dash-pipeline/SAI/utils/dash_p4/dash_p4_table_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ def to_sai(self) -> SaiApiGroup:
sai_api_list.append(sai_api)

sai_api_group = SaiApiGroup(self.app_name, self.app_name.replace("_", " "))
sai_api_group.api_type = "overlay" if self.api_type == None else self.api_type
sai_api_group.sai_apis = sai_api_list

return sai_api_group
3 changes: 3 additions & 0 deletions dash-pipeline/SAI/utils/sai_gen/sai_header_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ def generate(self) -> None:
print("\nGenerating all SAI header files ...")

for api_group in self.sai_spec.api_groups:
if api_group.api_type == "underlay":
continue

self._generate_sai_api_group(api_group)

def _generate_sai_api_group(self, api_group: SaiApiGroup) -> None:
Expand Down
2 changes: 2 additions & 0 deletions dash-pipeline/SAI/utils/sai_spec/sai_api_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class SaiApiGroup(SaiCommon):

def __init__(self, name: str, description: str):
super().__init__(name, description)
self.api_type: str = ""
self.sai_apis: List[SaiApi] = []

def finalize(self):
Expand All @@ -19,6 +20,7 @@ def finalize(self):

def merge(self, other: "SaiCommon"):
super().merge(other)
self.api_type = other.api_type
sai_spec_utils.merge_sai_common_lists(self.sai_apis, other.sai_apis)

def deprecate(self) -> bool:
Expand Down

0 comments on commit 045a953

Please sign in to comment.