mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 03:10:46 +08:00
Move port traffic to device-centric monitoring with a dedicated wall and collect logs.
Split the ops wall to its own route with fullscreen charts, persist collect errors as device events, and polish wall legend layout. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
5079343b2a
commit
214bc56774
24 changed files with 3309 additions and 1357 deletions
|
|
@ -15,6 +15,7 @@ from netx_api.port_traffic_parsers import (
|
|||
parse_interface_detail,
|
||||
parse_zte_interface_brief,
|
||||
parse_zte_interface_detail,
|
||||
resolve_util_pct,
|
||||
)
|
||||
|
||||
SAMPLE_DETAIL = """\
|
||||
|
|
@ -280,5 +281,20 @@ class CommandsTests(unittest.TestCase):
|
|||
)
|
||||
|
||||
|
||||
class ResolveUtilTests(unittest.TestCase):
|
||||
def test_keeps_vendor_util(self):
|
||||
self.assertEqual(resolve_util_pct(0.01, 0.0, 1_000_000_000), 0.01)
|
||||
|
||||
def test_derives_when_vendor_zero(self):
|
||||
# 98 Kbit/s on 1 Gbit/s ≈ 0.0098%
|
||||
self.assertAlmostEqual(resolve_util_pct(0.0, 98_000.0, 1_000_000_000), 0.0098)
|
||||
|
||||
def test_zero_when_no_traffic(self):
|
||||
self.assertEqual(resolve_util_pct(0.0, 0.0, 1_000_000_000), 0.0)
|
||||
|
||||
def test_zero_when_no_bw(self):
|
||||
self.assertEqual(resolve_util_pct(0.0, 98_000.0, 0), 0.0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue