From 74de820d7e2cada619aaf12bae89cdc031e79661 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 3 May 2021 13:56:48 +0200 Subject: [PATCH] ucentral-schema: various cleanups for the new schema Signed-off-by: John Crispin --- new/generate-example.uc | 4 ++-- new/globals.yml | 2 ++ new/interface.bridge.yml | 4 ++-- new/interface.ethernet.yml | 3 +-- new/interface.ipv4.dhcp-lease.yml | 6 +++--- new/interface.ipv4.yml | 3 +++ new/interface.ssid.captive.yml | 26 ++++++++++-------------- new/interface.ssid.encryption.yml | 2 +- new/interface.ssid.pass-point.yml | 6 +++--- new/interface.ssid.radius.local-user.yml | 5 ++--- new/interface.ssid.radius.server.yml | 3 ++- new/interface.ssid.radius.yml | 2 +- new/interface.ssid.rate-limit.yml | 4 ++-- new/interface.ssid.rates.yml | 4 ++-- new/interface.ssid.rrm.yml | 2 +- new/interface.ssid.yml | 19 ++++++++--------- new/interface.vlan.yml | 2 +- new/interface.yml | 4 ++-- new/metrics.yml | 6 +++--- new/radio.yml | 18 ++++++++-------- new/service.log.yml | 5 +++-- new/service.ntp.yml | 1 + new/service.rtty.yml | 7 ++++--- new/service.ssh.yml | 2 +- 24 files changed, 72 insertions(+), 68 deletions(-) diff --git a/new/generate-example.uc b/new/generate-example.uc index a5347a1..9d1db59 100755 --- a/new/generate-example.uc +++ b/new/generate-example.uc @@ -145,7 +145,7 @@ let GeneratorProto = { emit_number: function(numberSpec) { - assert(numberSpec.type == "number", "Expecting number type"); + assert(numberSpec.type == "integer", "Expecting number type"); let rv = this.emit_generic(numberSpec); @@ -223,7 +223,7 @@ let GeneratorProto = { case "string": return this.emit_string(valueSpec); - case "number": + case "integer": return this.emit_number(valueSpec); case "boolean": diff --git a/new/globals.yml b/new/globals.yml index 90f3d7f..40a43ee 100644 --- a/new/globals.yml +++ b/new/globals.yml @@ -8,6 +8,7 @@ properties: Define the IPv4 range that is delegatable to the downstream interfaces This is described as a CIDR block. (192.168.0.0/16, 172.16.128/17) type: string + format: uc-cidr4 example: - 192.168.0.0/16 ipv6-network: @@ -15,5 +16,6 @@ properties: Define the IPv6 range that is delegatable to the downstream interfaces This is described as a CIDR block. (fdca:1234:4567::/48) type: string + format: uc-cidr6 example: - fdca:1234:4567::/48 diff --git a/new/interface.bridge.yml b/new/interface.bridge.yml index fff96aa..26ab478 100644 --- a/new/interface.bridge.yml +++ b/new/interface.bridge.yml @@ -5,7 +5,7 @@ properties: mtu: description: The MTU that shall be used by the network interface. - type: number + type: integer maximum: 65535 minimum: 256 example: @@ -15,7 +15,7 @@ properties: The Transmit Queue Length is a TCP/IP stack network interface value that sets the number of packets allowed per kernel transmit queue of a network interface device. - type: number + type: integer example: - 5000 isolate-ports: diff --git a/new/interface.ethernet.yml b/new/interface.ethernet.yml index 23ffac8..6d40a3b 100644 --- a/new/interface.ethernet.yml +++ b/new/interface.ethernet.yml @@ -36,8 +36,7 @@ properties: description: Enforce a specific MAC to these ports. type: string - maxLength: 17 - minLength: 17 + format: uc-mac example: - true reverse-path-filter: diff --git a/new/interface.ipv4.dhcp-lease.yml b/new/interface.ipv4.dhcp-lease.yml index b46553e..f467403 100644 --- a/new/interface.ipv4.dhcp-lease.yml +++ b/new/interface.ipv4.dhcp-lease.yml @@ -6,21 +6,21 @@ properties: description: The MAC address of the host that this lease shall be used for. type: string - maxLength: 17 - minLength: 17 + format: uc-mac example: - 00:11:22:33:44:55 static-lease-offset: description: The offset of the IP that shall be used in relation to the first IP in the available range. - type: number + type: integer example: - 10 lease-time: description: How long the lease is valid before a RENEW muss ne issued. type: string + format: uc-dhcp-time default: 6h publish-hostname: description: diff --git a/new/interface.ipv4.yml b/new/interface.ipv4.yml index bce94fc..c774349 100644 --- a/new/interface.ipv4.yml +++ b/new/interface.ipv4.yml @@ -18,12 +18,14 @@ properties: auto/24 can be used, causing the configuration layer to automatically use and address range from globals.ipv4-network. type: string + format: uc-cidr4 example: - auto/24 gateway: description: This option defines the static IPv4 gateway of the logical interface. type: string + format: uc-cidr4 example: - 192.168.1.1 send-hostname: @@ -40,6 +42,7 @@ properties: type: array items: type: string + format: uc-cidr4 example: - 8.8.8.8 - 4.4.4.4 diff --git a/new/interface.ssid.captive.yml b/new/interface.ssid.captive.yml index 262d5ad..1e05527 100644 --- a/new/interface.ssid.captive.yml +++ b/new/interface.ssid.captive.yml @@ -11,34 +11,30 @@ properties: description: The fqdn used for the captive portal IP. type: string + format: fqdn default: ucentral.splash maxclients: description: The maximum number of clients that shall be accept. - type: number - example: - - 32 + type: integer + default: 32 upload-rate: description: The maximum upload rate for a specific client. - type: number - example: - - 10000 + type: integer + default: 10000 download-rate: description: The maximum download rate for a specific client. - type: number - example: - - 10000 + type: integer + default: 10000 upload-quota: description: The maximum upload quota for a specific client. - type: number - example: - - 10000 + type: integer + default : 10000 download-quota: description: The maximum download quota for a specific client. - type: number - example: - - 10000 + type: integer + default: 10000 diff --git a/new/interface.ssid.encryption.yml b/new/interface.ssid.encryption.yml index 0f3a666..5fa4e8c 100644 --- a/new/interface.ssid.encryption.yml +++ b/new/interface.ssid.encryption.yml @@ -33,7 +33,7 @@ properties: ieee80211w: description: Enable 802.11w Management Frame Protection (MFP) for this BSS. - type: number + type: integer maximum: 2 minimum: 0 example: diff --git a/new/interface.ssid.pass-point.yml b/new/interface.ssid.pass-point.yml index 582f1ea..ee8e1fe 100644 --- a/new/interface.ssid.pass-point.yml +++ b/new/interface.ssid.pass-point.yml @@ -10,12 +10,12 @@ properties: venue-group: description: The available values are defined in 802.11u. - type: number + type: integer maximum: 32 venue-type: description: The available values are defined in IEEE Std 802.11u-2011, 7.3.1.34 - type: number + type: integer maximum: 32 venue-url: description: @@ -45,7 +45,7 @@ properties: description: ANQP Domain ID, An identifier for a set of APs in an ESS that share the same common ANQP information. - type: number + type: integer maximum: 65535 friendly-name: description: diff --git a/new/interface.ssid.radius.local-user.yml b/new/interface.ssid.radius.local-user.yml index 2bc0398..43ed3ff 100644 --- a/new/interface.ssid.radius.local-user.yml +++ b/new/interface.ssid.radius.local-user.yml @@ -4,8 +4,7 @@ description: properties: mac: type: string - maxLength: 17 - minLength: 17 + format: uc-mac example: - 00:11:22:33:44:55 key: @@ -15,7 +14,7 @@ properties: example: - aaaaaaaa vid: - type: number + type: integer maximum: 4096 example: - 100 diff --git a/new/interface.ssid.radius.server.yml b/new/interface.ssid.radius.server.yml index 2c18b56..1bc7fec 100644 --- a/new/interface.ssid.radius.server.yml +++ b/new/interface.ssid.radius.server.yml @@ -6,12 +6,13 @@ properties: description: The URI of our Radius server. type: string + format: uc-host example: - 192.168.1.10 port: description: The network of our Radius server. - type: number + type: integer maximum: 65535 minimum: 1024 example: diff --git a/new/interface.ssid.radius.yml b/new/interface.ssid.radius.yml index 54ba91b..e05b034 100644 --- a/new/interface.ssid.radius.yml +++ b/new/interface.ssid.radius.yml @@ -17,7 +17,7 @@ properties: interval: description: The interim accounting update interval. This value is defined in seconds. - type: number + type: integer maximum: 600 minimum: 60 default: 60 diff --git a/new/interface.ssid.rate-limit.yml b/new/interface.ssid.rate-limit.yml index bc54380..d34dfe9 100644 --- a/new/interface.ssid.rate-limit.yml +++ b/new/interface.ssid.rate-limit.yml @@ -5,10 +5,10 @@ properties: ingress-rate: description: The ingress rate to which hosts will be shaped. Values are in Mbps - type: number + type: integer default: 0 egress-rate: description: The egress rate to which hosts will be shaped. Values are in Mbps - type: number + type: integer default: 0 diff --git a/new/interface.ssid.rates.yml b/new/interface.ssid.rates.yml index 833a281..274df9f 100644 --- a/new/interface.ssid.rates.yml +++ b/new/interface.ssid.rates.yml @@ -5,10 +5,10 @@ properties: beacon: description: The beacon rate that shall be used by the BSS. Values are in Mbps. - type: number + type: integer default: 0 multicast: description: The multicast rate that shall be used by the BSS. Values are in Mbps. - type: number + type: integer default: 0 diff --git a/new/interface.ssid.rrm.yml b/new/interface.ssid.rrm.yml index 0a9557c..3b2d81b 100644 --- a/new/interface.ssid.rrm.yml +++ b/new/interface.ssid.rrm.yml @@ -21,4 +21,4 @@ properties: stationary-ap: description: Stationary AP config indicates that the AP doesn't move. - type: number + type: integer diff --git a/new/interface.ssid.yml b/new/interface.ssid.yml index 7471e54..e76ca28 100644 --- a/new/interface.ssid.yml +++ b/new/interface.ssid.yml @@ -18,11 +18,11 @@ properties: items: type: string enum: - - 2 - - 5 - - 5l - - 5u - - 6 + - 2G + - 5G + - 5Gl + - 5Gu + - 6G bss-mode: description: Selects the operation mode of the wireless network interface controller. @@ -35,12 +35,11 @@ properties: description: Override the BSSID of the network, only applicable in adhoc or sta mode. type: string - maxLength: 17 - minLength: 17 + format: uc-mac beacon-interval: description: Beacon interval in kus (1.024 ms). - type: number + type: integer maximum: 1000 minimum: 15 dtim-period: @@ -48,7 +47,7 @@ properties: Set the DTIM (delivery traffic information message) period. There will be one DTIM per this many beacon frames. This may be set between 1 and 255. This option only has an effect on ap wifi-ifaces. - type: number + type: integer maximum: 255 minimum: 1 hidden-ssid: @@ -67,7 +66,7 @@ properties: rts-threshold: description: Set the RTS/CTS threshold of the BSS. - type: number + type: integer maximum: 65535 minimum: 1 broadcast-time: diff --git a/new/interface.vlan.yml b/new/interface.vlan.yml index f4fc5ef..4c1aa20 100644 --- a/new/interface.vlan.yml +++ b/new/interface.vlan.yml @@ -7,7 +7,7 @@ properties: This is the pvid of the vlan that shall be assigned to the interface. The individual physical network devices contained within the interface need to be told explicitly if egress traffic shall be tagged. - type: number + type: integer maximum: 4096 proto: decription: diff --git a/new/interface.yml b/new/interface.yml index a4a560c..beace65 100644 --- a/new/interface.yml +++ b/new/interface.yml @@ -16,8 +16,8 @@ properties: The role defines if the interface is upstream or downstream facing. type: string enum: - - upstream - - downstream + - upstream + - downstream example: - downstream isolate-hosts: diff --git a/new/metrics.yml b/new/metrics.yml index 2155546..1846d52 100644 --- a/new/metrics.yml +++ b/new/metrics.yml @@ -11,7 +11,7 @@ properties: interval: description: The reporting interval defined in seconds. - type: number + type: integer types: description: A list of names of subsystems that shall be reported periodically. @@ -27,7 +27,7 @@ properties: interval: description: The reporting interval defined in seconds. - type: number + type: integer types: description: A list of names of subsystems that shall be reported periodically. @@ -43,7 +43,7 @@ properties: interval: description: The reporting interval defined in seconds. - type: number + type: integer types: description: A list of the message types that shall be sent to the backend. diff --git a/new/radio.yml b/new/radio.yml index 8bbfee4..934b223 100644 --- a/new/radio.yml +++ b/new/radio.yml @@ -6,15 +6,15 @@ properties: band: type: string enum: - - 2 - - 5 - - 5u - - 5l - - 6 + - 2G + - 5G + - 5Gu + - 5Gl + - 6G bandwidth: description: Specifies a narrow channel width in MHz, possible values are: 5, 10, 20. - type: number + type: integer enum: - 5 - 10 @@ -23,7 +23,7 @@ properties: description: Specifies the wireless channel to use. A value of 0 starts the ACS algorithm. - type: number + type: integer maximum: 171 minimum: 0 country: @@ -33,6 +33,8 @@ properties: type: string maxLength: 2 minLength: 2 + example: + - US channel-mode: description: Define the ideal channel mode that the radio shall use. This can be 802.11n, 802.11ac @@ -82,7 +84,7 @@ properties: tx-power: description: This option specifies the transmission power in dBm - type: number + type: integer maximum: 30 minimum: 0 legacy-rates: diff --git a/new/service.log.yml b/new/service.log.yml index 038d039..9bb7121 100644 --- a/new/service.log.yml +++ b/new/service.log.yml @@ -7,12 +7,13 @@ properties: IP address of a syslog server to which the log messages should be sent in addition to the local destination. type: string + format: uc-host example: - 192.168.1.10 port: description: Port number of the remote syslog server specified with log_ip. - type: number + type: integer maximum: 65535 minimum: 100 example: @@ -29,6 +30,6 @@ properties: description: Size of the file based log buffer in KiB. This value is used as the fallback value for log_buffer_size if the latter is not specified. - type: number + type: integer minimum: 32 default: 1000 diff --git a/new/service.ntp.yml b/new/service.ntp.yml index bc6c604..fd1ab06 100644 --- a/new/service.ntp.yml +++ b/new/service.ntp.yml @@ -9,5 +9,6 @@ properties: type: array items: type: string + format: uc-host example: - 0.openwrt.pool.ntp.org diff --git a/new/service.rtty.yml b/new/service.rtty.yml index aad0859..de8cb82 100644 --- a/new/service.rtty.yml +++ b/new/service.rtty.yml @@ -6,19 +6,20 @@ properties: description: The server that the AP shal to connect to. type: string + format: uc-host example: - 192.168.1.10 port: description: This option defines the port that we connect to. - type: number + type: integer maximum: 65535 default: 5912 token: description: The security token that we use to authenticate with the server. type: string - maxLength: 17 - minLength: 17 + maxLength: 32 + minLength: 32 example: - 01234567890123456789012345678901 diff --git a/new/service.ssh.yml b/new/service.ssh.yml index 7a33243..36f30f7 100644 --- a/new/service.ssh.yml +++ b/new/service.ssh.yml @@ -5,7 +5,7 @@ properties: port: description: This option defines which port the SSH server shall be available on. - type: number + type: integer maximum: 65535 default: 22 authorized-keys: