mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 05:50:44 +08:00
Polish ops skills from field Q&A and tighten fiber_cut vs optical-power presets.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
4660cc7507
commit
2f1d3983b8
5 changed files with 143 additions and 24 deletions
|
|
@ -113,12 +113,22 @@ def test_filter_preset_and_row_helpers() -> None:
|
|||
items = [
|
||||
{"alarm_event_type": "Communication LOS", "alarm_host_name": "A"},
|
||||
{"alarm_event_type": "fan fail", "alarm_host_name": "B"},
|
||||
{
|
||||
"alarm_native_probable_cause": "Ethernet physical (ETPI) Input optical power(dBm) threshold crossed",
|
||||
"alarm_host_name": "C",
|
||||
},
|
||||
{"alarm_native_probable_cause": "Fiber Break", "alarm_host_name": "D"},
|
||||
{"alarm_native_probable_cause": "BN EMS alarm NE communication failure", "alarm_host_name": "E"},
|
||||
]
|
||||
filtered = _filter_preset_items("fiber_cut", items)
|
||||
assert len(filtered) == 1
|
||||
hosts = {r["alarm_host_name"] for r in filtered}
|
||||
assert hosts == {"A", "D"}
|
||||
assert "C" not in hosts # optical-power threshold is not fiber_cut
|
||||
offline = _filter_preset_items("offline", items)
|
||||
assert {r["alarm_host_name"] for r in offline} == {"E"}
|
||||
headers, rows = _rows_from_list_items(filtered)
|
||||
assert headers[0] == "host_name"
|
||||
assert rows[0][0] == "A"
|
||||
assert rows[0][0] in {"A", "D"}
|
||||
_, agg_rows, meta = _rows_from_aggregate_buckets(
|
||||
{"buckets": [{"key": "H1", "count": 2}], "total": 2, "by_ne_missing": 0}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue