Functional Weave
Code in Python

net.device-status@1.0.0

vectors.json

8,602 bytes · view raw

[
  {"name": "a healthy link is up with no reasons", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 10000, "avgUs": 11500, "maxUs": 13000, "p95Us": 13000, "jitterUs": 1667}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "up", "reasons": []}},
  {"name": "no replies at all is down", "args": [{"sent": 3, "received": 0, "lost": 3, "lossBasisPoints": 10000, "minUs": null, "avgUs": null, "maxUs": null, "p95Us": null, "jitterUs": null}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "down", "reasons": ["no replies: 3 of 3 probes lost"]}},
  {"name": "loss above the down threshold is down", "args": [{"sent": 3, "received": 1, "lost": 2, "lossBasisPoints": 6667, "minUs": 700, "avgUs": 700, "maxUs": 700, "p95Us": 700, "jitterUs": null}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "down", "reasons": ["loss 66.67% at or above the down threshold 50.00%"]}},
  {"name": "loss exactly at the down threshold is down", "args": [{"sent": 4, "received": 2, "lost": 2, "lossBasisPoints": 5000, "minUs": 10, "avgUs": 15, "maxUs": 20, "p95Us": 20, "jitterUs": 10}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "down", "reasons": ["loss 50.00% at or above the down threshold 50.00%"]}},
  {"name": "a quarter lost is degraded", "args": [{"sent": 4, "received": 3, "lost": 1, "lossBasisPoints": 2500, "minUs": 1000, "avgUs": 2000, "maxUs": 3000, "p95Us": 3000, "jitterUs": 1500}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "degraded", "reasons": ["loss 25.00% at or above 10.00%"]}},
  {"name": "loss exactly at the degraded threshold is degraded", "args": [{"sent": 10, "received": 9, "lost": 1, "lossBasisPoints": 1000, "minUs": 1000, "avgUs": 1000, "maxUs": 1000, "p95Us": 1000, "jitterUs": 0}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "degraded", "reasons": ["loss 10.00% at or above 10.00%"]}},
  {"name": "loss just under the degraded threshold is up", "args": [{"sent": 11, "received": 10, "lost": 1, "lossBasisPoints": 909, "minUs": 1000, "avgUs": 1000, "maxUs": 1000, "p95Us": 1000, "jitterUs": 0}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "up", "reasons": []}},
  {"name": "p95 exactly at the threshold is degraded", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 50000, "avgUs": 70000, "maxUs": 100000, "p95Us": 100000, "jitterUs": 10000}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "degraded", "reasons": ["p95 100.000 ms at or above 100.000 ms"]}},
  {"name": "loss, p95 and jitter reasons are all listed, in that order", "args": [{"sent": 4, "received": 3, "lost": 1, "lossBasisPoints": 2500, "minUs": 90000, "avgUs": 120000, "maxUs": 152300, "p95Us": 152300, "jitterUs": 25000}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "degraded", "reasons": ["loss 25.00% at or above 10.00%", "p95 152.300 ms at or above 100.000 ms", "jitter 25.000 ms at or above 20.000 ms"]}},
  {"name": "a null jitter threshold ignores jitter", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 1000, "avgUs": 30000, "maxUs": 60000, "p95Us": 60000, "jitterUs": 50000}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": null}], "expect": {"status": "up", "reasons": []}},
  {"name": "a single reply has no jitter to judge", "args": [{"sent": 1, "received": 1, "lost": 0, "lossBasisPoints": 0, "minUs": 7, "avgUs": 7, "maxUs": 7, "p95Us": 7, "jitterUs": null}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "up", "reasons": []}},
  {"name": "a 5 bp loss prints as 0.05%", "args": [{"sent": 2000, "received": 1999, "lost": 1, "lossBasisPoints": 5, "minUs": 100, "avgUs": 100, "maxUs": 100, "p95Us": 100, "jitterUs": 0}, {"degradedLossBasisPoints": 5, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "degraded", "reasons": ["loss 0.05% at or above 0.05%"]}},
  {"name": "sub-millisecond latency prints with three places", "args": [{"sent": 2, "received": 2, "lost": 0, "lossBasisPoints": 0, "minUs": 7, "avgUs": 7, "maxUs": 7, "p95Us": 7, "jitterUs": 0}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 7, "degradedJitterUs": 20000}], "expect": {"status": "degraded", "reasons": ["p95 0.007 ms at or above 0.007 ms"]}},
  {"name": "no replies is down even when the down threshold is 100%", "args": [{"sent": 1, "received": 0, "lost": 1, "lossBasisPoints": 10000, "minUs": null, "avgUs": null, "maxUs": null, "p95Us": null, "jitterUs": null}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 10000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expect": {"status": "down", "reasons": ["no replies: 1 of 1 probes lost"]}},
  {"name": "received plus lost must equal sent", "args": [{"sent": 3, "received": 2, "lost": 2, "lossBasisPoints": 6667, "minUs": 1, "avgUs": 1, "maxUs": 1, "p95Us": 1, "jitterUs": 0}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expectError": "summary is inconsistent"},
  {"name": "a summary of no probes is an error", "args": [{"sent": 0, "received": 0, "lost": 0, "lossBasisPoints": 0, "minUs": null, "avgUs": null, "maxUs": null, "p95Us": null, "jitterUs": null}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expectError": "summary is inconsistent"},
  {"name": "a zero down threshold is an error", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 10000, "avgUs": 11500, "maxUs": 13000, "p95Us": 13000, "jitterUs": 1667}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 0, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expectError": "downLossBasisPoints must be 1 to 10000"},
  {"name": "a down threshold over 100% is an error", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 10000, "avgUs": 11500, "maxUs": 13000, "p95Us": 13000, "jitterUs": 1667}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 10001, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expectError": "downLossBasisPoints must be 1 to 10000"},
  {"name": "a degraded threshold above the down threshold is an error", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 10000, "avgUs": 11500, "maxUs": 13000, "p95Us": 13000, "jitterUs": 1667}, {"degradedLossBasisPoints": 6000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expectError": "degradedLossBasisPoints must be 1 to downLossBasisPoints"},
  {"name": "a zero degraded loss threshold is an error", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 10000, "avgUs": 11500, "maxUs": 13000, "p95Us": 13000, "jitterUs": 1667}, {"degradedLossBasisPoints": 0, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 20000}], "expectError": "degradedLossBasisPoints must be 1 to downLossBasisPoints"},
  {"name": "a zero p95 threshold is an error", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 10000, "avgUs": 11500, "maxUs": 13000, "p95Us": 13000, "jitterUs": 1667}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 0, "degradedJitterUs": 20000}], "expectError": "degradedP95Us must be at least 1"},
  {"name": "a zero jitter threshold is an error", "args": [{"sent": 4, "received": 4, "lost": 0, "lossBasisPoints": 0, "minUs": 10000, "avgUs": 11500, "maxUs": 13000, "p95Us": 13000, "jitterUs": 1667}, {"degradedLossBasisPoints": 1000, "downLossBasisPoints": 5000, "degradedP95Us": 100000, "degradedJitterUs": 0}], "expectError": "degradedJitterUs must be null or at least 1"}
]