mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 03:10:46 +08:00
fix(netx): parse space-separated net id from alarmkey
Support UME alarmkey values like "<net_id> <x> <y>" when deriving ne_id so current alarms can join inventory correctly. Add regression coverage for hash, csv, and space-delimited alarmkey formats. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
67f7e48597
commit
626bb2b02e
2 changed files with 9 additions and 0 deletions
|
|
@ -73,10 +73,14 @@ def _derive_ne_id_from_alarm(alarm: dict[str, Any]) -> str:
|
|||
# Common UME formats observed:
|
||||
# 1) "<net_id>#<suffix>"
|
||||
# 2) "<net_id>, <x>, <y>"
|
||||
# 3) "<net_id> <x> <y>"
|
||||
if "#" in alarm_key:
|
||||
return _s(alarm_key.split("#", 1)[0])
|
||||
if "," in alarm_key:
|
||||
return _s(alarm_key.split(",", 1)[0])
|
||||
parts = [p for p in alarm_key.split() if p]
|
||||
if len(parts) >= 2:
|
||||
return _s(parts[0])
|
||||
return ""
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue