From 0f40765f2cfb3d0ea94d346915d23ea8d8ba1682 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 8 Mar 2023 17:31:46 +0100 Subject: [PATCH] turn telemetry and realtime filter into an enum Signed-off-by: John Crispin --- schema/metrics.realtime.yml | 14 ++++++++++++++ schema/metrics.telemetry.yml | 16 +++++++++++++++- schemareader.uc | 6 ++++++ state/interface.mesh-path.yml | 14 ++++++++++++++ ucentral.schema.json | 34 ++++++++++++++++++++++++++++++++-- 5 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 state/interface.mesh-path.yml diff --git a/schema/metrics.realtime.yml b/schema/metrics.realtime.yml index 49b61bf..3c63a2d 100644 --- a/schema/metrics.realtime.yml +++ b/schema/metrics.realtime.yml @@ -8,3 +8,17 @@ properties: type: array items: type: string + enum: + - ssh + - health + - health.dns + - health.dhcp + - health.radius + - health.memory + - client + - client.join + - client.leave + - client.key-mismatch + - wifi + - wifi.start + - wifi.stop diff --git a/schema/metrics.telemetry.yml b/schema/metrics.telemetry.yml index 5e2cfef..3c7d155 100644 --- a/schema/metrics.telemetry.yml +++ b/schema/metrics.telemetry.yml @@ -1,5 +1,5 @@ description: - Configure the unsolicitated telemetry stream. + Configure the unsolicited telemetry stream. type: object properties: interval: @@ -12,3 +12,17 @@ properties: type: array items: type: string + enum: + - ssh + - health + - health.dns + - health.dhcp + - health.radius + - health.memory + - client + - client.join + - client.leave + - client.key-mismatch + - wifi + - wifi.start + - wifi.stop diff --git a/schemareader.uc b/schemareader.uc index ef207c3..81ba183 100644 --- a/schemareader.uc +++ b/schemareader.uc @@ -8520,6 +8520,9 @@ function instantiateMetricsTelemetry(location, value, errors) { if (type(value) != "string") push(errors, [ location, "must be of type string" ]); + if (!(value in [ "ssh", "health", "health.dns", "health.dhcp", "health.radius", "health.memory", "client", "client.join", "client.leave", "client.key-mismatch", "wifi", "wifi.start", "wifi.stop" ])) + push(errors, [ location, "must be one of \"ssh\", \"health\", \"health.dns\", \"health.dhcp\", \"health.radius\", \"health.memory\", \"client\", \"client.join\", \"client.leave\", \"client.key-mismatch\", \"wifi\", \"wifi.start\" or \"wifi.stop\"" ]); + return value; } @@ -8555,6 +8558,9 @@ function instantiateMetricsRealtime(location, value, errors) { if (type(value) != "string") push(errors, [ location, "must be of type string" ]); + if (!(value in [ "ssh", "health", "health.dns", "health.dhcp", "health.radius", "health.memory", "client", "client.join", "client.leave", "client.key-mismatch", "wifi", "wifi.start", "wifi.stop" ])) + push(errors, [ location, "must be one of \"ssh\", \"health\", \"health.dns\", \"health.dhcp\", \"health.radius\", \"health.memory\", \"client\", \"client.join\", \"client.leave\", \"client.key-mismatch\", \"wifi\", \"wifi.start\" or \"wifi.stop\"" ]); + return value; } diff --git a/state/interface.mesh-path.yml b/state/interface.mesh-path.yml new file mode 100644 index 0000000..db64878 --- /dev/null +++ b/state/interface.mesh-path.yml @@ -0,0 +1,14 @@ +type: object +description: + This section contains info about connected mesh nodes. +properties: + destiination: + type: string + next_hop: + type: string + metric: + type: number + expire: + type: number + hop_count: + type: number diff --git a/ucentral.schema.json b/ucentral.schema.json index 984a093..6fb5452 100644 --- a/ucentral.schema.json +++ b/ucentral.schema.json @@ -3084,7 +3084,22 @@ "types": { "type": "array", "items": { - "type": "string" + "type": "string", + "enum": [ + "ssh", + "health", + "health.dns", + "health.dhcp", + "health.radius", + "health.memory", + "client", + "client.join", + "client.leave", + "client.key-mismatch", + "wifi", + "wifi.start", + "wifi.stop" + ] } } } @@ -3095,7 +3110,22 @@ "types": { "type": "array", "items": { - "type": "string" + "type": "string", + "enum": [ + "ssh", + "health", + "health.dns", + "health.dhcp", + "health.radius", + "health.memory", + "client", + "client.join", + "client.leave", + "client.key-mismatch", + "wifi", + "wifi.start", + "wifi.stop" + ] } } }