Skip to content

Commit

Permalink
Correct DPU driven HA attribute name (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
mukeshmv authored Jul 17, 2024
1 parent 222ef40 commit 57da5f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dash-pipeline/SAI/specs/dash_ha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ sai_apis:
is_vlan: false
deprecated: false
- !!python/object:utils.sai_spec.sai_attribute.SaiAttribute
name: SAI_HA_SET_ATTR_SWITCHOVER_NETWORK_CONVERGENCE_TIME_MS
description: Action parameter switchover network convergence time ms
name: SAI_HA_SET_ATTR_DPU_DRIVEN_HA_SWITCHOVER_WAIT_TIME_MS
description: Action parameter SAI vendor driven HA switchover wait time ms
type: sai_uint32_t
attr_value_field: u32
default: '0'
Expand Down
17 changes: 10 additions & 7 deletions dash-pipeline/SAI/utils/sai_spec/sai_spec_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ def load_word_fixers() -> None:
"resimulation": "re-simulation",
"pb": "protocol buffer",
"proto": "protocol",
"smac": "source MAC"
"smac": "source MAC",
"dpu": "DPU"
}

# Load all SAI acronyms
with open("SAI/meta/acronyms.txt", "r") as f:
for line in f:
word = line.split('-')[0].strip().lower()
word_fixers[word] = word.upper()

# More command word fixers

def normalize_sai_comment(s: str) -> str:
Expand All @@ -40,9 +41,11 @@ def normalize_sai_comment(s: str) -> str:
"""
if len(word_fixers) == 0:
load_word_fixers()

words = [word if word.lower() not in word_fixers else word_fixers[word.lower()] for word in s.split()]
return " ".join(words)
s = " ".join(words)
# temporary workaround until "DPU" is added to SAI meta acronyms
return s.replace("DPU driven HA ", "SAI vendor driven HA ")

def merge_sai_value_lists(
target: List[Any],
Expand All @@ -62,19 +65,19 @@ def merge_sai_value_lists(
it will not be removed from the old list.
"""
target_dict = {get_key(item): item for item in target}

source_keys = set()
for source_item in source:
source_key = get_key(source_item)
source_keys.add(source_key)

if source_key in target_dict:
target_item = target_dict[source_key]
on_conflict(target_item, source_item)
else:
target.append(source_item)
target_dict[source_key] = source_item

# Remove all items in target, if its key doesn't exist in source_keys and on_deprecate returns True.
target[:] = [item for item in target if get_key(item) in source_keys or not on_deprecate(item)]

Expand Down
2 changes: 1 addition & 1 deletion dash-pipeline/bmv2/stages/ha.p4
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ control ha_stage(inout headers_t hdr,
bit<32> dp_channel_probe_interval_ms,
bit<32> dp_channel_probe_fail_threshold,
@SaiVal[isreadonly="true"] bit<1> dp_channel_is_alive,
bit<32> switchover_network_convergence_time_ms
bit<32> dpu_driven_ha_switchover_wait_time_ms
) {
meta.ha.peer_ip_is_v6 = peer_ip_is_v6;
meta.ha.peer_ip = peer_ip;
Expand Down

0 comments on commit 57da5f7

Please sign in to comment.