Skip to content

Commit d4b8f46

Browse files
authored
Fix AS4625-54T port detection by using correct alias extraction (#1774)
The Accton-AS4625-54T uses alias format Eth1(Port1) instead of the standard tenGigE1 format. The inline regex r"(\d+)$" failed to extract port numbers from this format because the string ends with ")" not a digit, causing NetBox interface mapping to fail and ports to appear disconnected. Solution: Replace inline regex with existing _extract_port_number_from_alias() helper function which correctly handles both formats: - Standard format: tenGigE1 -> extracts 1 - AS4625-54T format: Eth1(Port1) -> extracts 1 This allows proper NetBox to SONiC interface mapping: Eth1(Port1) -> generates expected_names ['Eth1/1', 'Eth1/1/1'] -> matches NetBox interface Eth1/1 -> returns Ethernet0 Result: AS4625-54T ports are now correctly detected as connected, receive admin_status='up', and have BGP configurations generated. AI-assisted: Claude Code Signed-off-by: Christian Berendt <[email protected]>
1 parent f28d786 commit d4b8f46

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

osism/tasks/conductor/sonic/interface.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,16 +287,14 @@ def _find_sonic_name_by_alias_mapping(interface_name, port_config):
287287
logger.debug(f"Skipping {sonic_port}: no alias")
288288
continue
289289

290-
# Extract number from alias (e.g., tenGigE1 -> 1, hundredGigE49 -> 49)
291-
alias_match = re.search(r"(\d+)$", alias)
292-
if not alias_match:
290+
# Extract number from alias (e.g., tenGigE1 -> 1, Eth1(Port1) -> 1)
291+
alias_num = _extract_port_number_from_alias(alias)
292+
if alias_num is None:
293293
logger.debug(
294-
f"Skipping {sonic_port}: alias '{alias}' has no trailing number"
294+
f"Skipping {sonic_port}: could not extract number from alias '{alias}'"
295295
)
296296
continue
297297

298-
alias_num = int(alias_match.group(1))
299-
300298
# Generate expected NetBox interface names for this alias
301299
expected_names = [
302300
f"Eth1/{alias_num}", # Standard format

0 commit comments

Comments
 (0)