ucentral-schema: add initial version of the reworked data model

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-04-15 16:57:47 +02:00
parent b4d02b3259
commit e9431c889e
34 changed files with 970 additions and 0 deletions

5
.gitignore vendored
View File

@@ -1,2 +1,7 @@
*.schema
docs/
new/ucentral.schema.json
new/ucentral.schema.pretty.json
new/docs/
new/central.schema.json
new/ucentral.schema.pretty.json

6
new/config-raw.yml Normal file
View File

@@ -0,0 +1,6 @@
description:
This object allows passing raw uci commands, that get applied after all the
other configuration was ben generated.
type: array
items:
type: string

11
new/definitions.yml Normal file
View File

@@ -0,0 +1,11 @@
description:
This section is used to define templates that can be reference by a
configuration. This avoids duplication of data. A RADIUS server can be
defined here for example and then referenced by several SSIDs.
type: object
properties:
wireless-encryption:
description:
A wireless encryption template.
type: object
$ref: "#/interfaces/ssids/encryption"

5
new/generate.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
./merge-schema.py
mkdir -p docs
generate-schema-doc --config expand_buttons=true ucentral.schema.pretty.json docs/ucentral-schema.html

17
new/globals.yml Normal file
View File

@@ -0,0 +1,17 @@
description:
A device has certain global properties that are used to derive parts of
the final configuration that gets applied.
type: object
properties:
ipv4-network:
description:
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
uc-example: 192.168.0.0/16
ipv6-network:
description:
Define the IPv6 range that is delegatable to the downstream interfaces
This is described as a CIDR block. (fdca:1234:4567::/48)
type: string
uc-example: fdca:1234:4567::/48

23
new/interfaces.bridge.yml Normal file
View File

@@ -0,0 +1,23 @@
description:
This section describes the bridge behaviour of a logical network interface.
type: object
properties:
mtu:
description:
The MTU that shall be used by the network interface.
type: number
maximum: 65535
minimum: 256
uc-example: 1500
tx-queue-len:
description:
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
uc-example: 5000
isolate-ports:
description:
Isolates the bridge ports from each other.
type: boolean
default: false

View File

@@ -0,0 +1,49 @@
description:
This section defines the physical copper/fiber ports that are members of the
interface. Network devices are referenced by their logical names.
type: array
items:
type: object
properties:
select-ports:
description:
The list of physical network devices that shall be added to the interface.
The names are logical ones and wildcardable. "WAN" will use whatever the
hardwares default upstream facing port is. "LANx" will use the "x'th"
downstream facing ethernet port. LAN* will use all downstream ports.
type: array
items:
type: string
uc-example:
- LAN1
- LAN2*
multicast:
description:
Enable multicast support.
type: boolean
default: true
learning:
description:
Controls whether a given port will learn MAC addresses from received
traffic or not. If learning if off, the bridge will end up flooding
any traffic for which it has no FDB entry. By default this flag is on.
type: boolean
default: true
isolate:
description:
Only allow communication with non-isolated bridge ports when enabled.
type: boolean
default: false
macaddr:
description:
Enforce a specific MAC to these ports.
type: string
maxLength: 17
minLength: 17
uc-example: true
reverse-path-filter:
description:
Reverse Path filtering is a method used by the Linux Kernel to help
prevent attacks used by Spoofing IP Addresses.
type: boolean
default: false

41
new/interfaces.ipv4.yml Normal file
View File

@@ -0,0 +1,41 @@
description:
This section describes the IPv4 properties of a logical interface.
type: object
properties:
addressing:
description:
This option defines the method by which the IPv4 address of the interface
is chosen.
type: string
enum:
- dynamic
- static
uc-example: static
subnet:
description:
This option defines the static IPv4 of the logical interface in CIDR notation.
auto/24 can be used, causing the configuration layer to automatically use
and address range from globals.ipv4-network.
type: string
uc-example: auto/24
gateway:
description:
This option defines the static IPv4 gateway of the logical interface.
type: string
uc-example: 192.168.1.1
send-hostname:
description:
include the devices hostname inside DHCP requests
type: boolean
default: true
uc-example: true
use-dns:
description:
Define which DNS servers shall be used. This can either be a list of
static IPv4 addresse or dhcp (use the server provided by the DHCP lease)
type: array
items:
type: string
uc-example:
- 8.8.8.8
- 4.4.4.4

View File

@@ -0,0 +1,39 @@
description:
This section can be used to setup a captive portal on the AP.
type: object
properties:
gateway-name:
description:
This name will be presented to connecting users in on the splash page.
type: string
default: uCentral - Captive Portal
gateway-fqdn:
description:
The fqdn used for the captive portal IP.
type: string
default: ucentral.splash
maxclients:
description:
The maximum number of clients that shall be accept.
type: number
uc-example: 32
upload-rate:
description:
The maximum upload rate for a specific client.
type: number
uc-example: 10000
download-rate:
description:
The maximum download rate for a specific client.
type: number
uc-example: 10000
upload-quota:
description:
The maximum upload quota for a specific client.
type: number
uc-example: 10000
download-quota:
description:
The maximum download quota for a specific client.
type: number
uc-example: 10000

View File

@@ -0,0 +1,37 @@
description:
A device has certain properties that describe its identity and location.
These properties are described inside this object.
type: object
properties:
proto:
description:
The wireless encryption protocol that shall be used for this BSS
type: string
enum:
- none
- psk
- psk2
- psk-mixed
- wpa
- wpa2
- wpa-mixed
- sae
- sae-mixed
- wpa3
- wpa3-mixed
uc-example: psk2
key:
description:
The Pre Shared Key (PSK) that is used for encryption on the BSS when
using any of the WPA-PSK modes.
type: string
maxLength: 63
minLength: 8
uc-example: aaaaaaaa
80211w:
description:
Enable 802.11w Management Frame Protection (MFP) for this BSS.
type: number
maximum: 2
minimum: 0
uc-example: 2

View File

@@ -0,0 +1,60 @@
description:
Enable Hotspot 2.0 support.
type: object
properties:
venue-name:
description:
This parameter can be used to configure one or more Venue Name Duples
for Venue Name ANQP information.
type: string
venue-group:
description:
The available values are defined in 802.11u.
type: number
maximum: 32
venue-type:
description:
The available values are defined in IEEE Std 802.11u-2011, 7.3.1.34
type: number
maximum: 32
venue-url:
description:
This parameter can be used to configure one or more Venue URL Duples to
provide additional information corresponding to Venue Name information.
type: string
auth-type:
description:
This parameter indicates what type of network authentication is used in
the network.
type: string
minLength: 2
maxLength: 2
domain-name:
description:
The IEEE 802.11u Domain Name.
type: string
nai-realm:
description:
NAI Realm information
type: string
osen:
description:
OSU Server-Only Authenticated L2 Encryption Network;
type: boolean
anqp-domain:
description:
ANQP Domain ID, An identifier for a set of APs in an ESS that share the
same common ANQP information.
type: number
maximum: 65535
friendly-name:
description:
This parameter can be used to configure one or more Operator Friendly
Name Duples.
type: string
icon:
description:
The operator icons.
type: array
items:
type: string

View File

@@ -0,0 +1,24 @@
description:
Describe the local EAP user/psk/vid triplets.
type: array
items:
type: object
properties:
type: array
items:
type: object
properties:
mac:
type: string
maxLength: 17
minLength: 17
uc-example: 00:11:22:33:44:55
key:
type: string
maxLength: 63
minLength: 8
uc-example: aaaaaaaa
vid:
type: number
maximum: 4096
uc-example: 100

View File

@@ -0,0 +1,34 @@
description:
Describe the properties of a Radius server.
type: object
properties:
host:
description:
The URI of our Radius server.
type: string
uc-example: 192.168.1.10
port:
description:
The network of our Radius server.
type: number
maximum: 65535
minimum: 1024
uc-example: 1812
secret:
description:
The shared Radius authentication secret.
type: string
uc-example: secret
request-attribute:
description:
The additional Access-Request attributes that gets sent to the server.
type: array
items:
type: string
uc-example:
- 126:s:Operator
request-cui:
description:
This will enable support for Chargeable-User-Identity (RFC 4372).
type: boolean
default: false

View File

@@ -0,0 +1,19 @@
description:
When using EAP encryption we need to provide the required information
allowing us to connect to the AAA servers.
type: object
properties:
local-users:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/radius/local-users/"
authentication:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/radius/server/"
accounting:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/radius/server/"
properties:
interval:
description:
The interim accounting update interval. This value is defined in seconds.
type: number
maximum: 600
minimum: 60
default: 60

View File

@@ -0,0 +1,14 @@
description:
The rate configuration of this BSS.
type: object
properties:
beacon:
description:
The beacon rate that shall be used by the BSS. Values are in Mbps.
type: number
default: 0
multicast:
description:
The multicast rate that shall be used by the BSS. Values are in Mbps.
type: number
default: 0

View File

@@ -0,0 +1,24 @@
description:
Enable 802.11r Fast Roaming for this BSS.
type: object
properties:
message-exchange:
description:
Shall the pre authenticated message exchange happen over the air or
distribution system.
type: string
enum:
- air
- ds
uc-example: ds
generate-psk:
description:
Whether to generate FT response locally for PSK networks. This avoids
use of PMK-R1 push/pull from other APs with FT-PSK networks.
type: boolean
uc-example: true
domain-identifier:
description:
Mobility Domain identifier (dot11FTMobilityDomainID, MDID).
type: string
uc-example: abcd

View File

@@ -0,0 +1,24 @@
description:
Enable 802.11k Radio Resource Management (RRM) for this BSS.
type: object
properties:
neighbor-reporting:
description:
Enable neighbor report via radio measurements (802.11k).
type: boolean
lci:
description:
The content of a LCI measurement subelement
type: string
civic-location:
description:
The content of a location civic measurement subelement
type: string
ftm-responder:
description:
Publish fine timing measurement (FTM) responder functionality on this BSS.
type: boolean
stationary-ap:
description:
Stationary AP config indicates that the AP doesn't move.
type: number

98
new/interfaces.ssids.yml Normal file
View File

@@ -0,0 +1,98 @@
description:
A device has certain properties that describe its identity and location.
These properties are described inside this object.
type: object
properties:
name:
description:
The broadcasted SSID of the wireless network and for for managed mode
the SSID of the network youre connecting to
type: string
maxLength: 32
minLength: 1
wifi-bands:
description:
The band that the SSID should be broadcasted on. The configuration layer
will use the first matching band.
type: array
items:
type: string
enum:
- 2
- 5
- 5l
- 5u
- 6
bss-mode:
description:
Selects the operation mode of the wireless network interface controller.
type: string
enum:
- ap
- sta
- mesh
bssid:
description:
Override the BSSID of the network, only applicable in adhoc or sta mode.
type: string
maxLength: 17
minLength: 17
beacon-interval:
description:
Beacon interval in kus (1.024 ms).
type: number
maximum: 1000
minimum: 15
dtim-period:
description:
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
maximum: 255
minimum: 1
hidden-ssid:
description:
Disables the broadcasting of beacon frames if set to 1 and,in doing so,
hides the ESSID.
type: boolean
isolate-clients:
description:
Isolates wireless clients from each other on this BSS.
type: boolean
power-save:
description:
Unscheduled Automatic Power Save Delivery.
type: boolean
rts-threshold:
description:
Set the RTS/CTS threshold of the BSS.
type: number
maximum: 65535
minimum: 1
broadcast-time:
description:
This option will make the unit braodcast the time inside its beacons.
type: boolean
unicast-conversion:
description:
Convert multicast traffic to unicast on this BSS.
type: boolean
encryption:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/encryption/"
captive:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/captive/"
rrm:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/rrm/"
rates:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/rates/"
roaming:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/roaming/"
radius:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/radius/"
hostapd-bss-raw:
description:
This array allows passing raw hostapd.conf lines.
type: array
items:
type: string

18
new/interfaces.vlan.yml Normal file
View File

@@ -0,0 +1,18 @@
description:
This section describes the vlan behaviour of a logical network interface.
type: object
properties:
id:
description:
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
maximum: 4096
proto:
decription:
The L2 vlan tag that shall be added (1q,1ad)
type: string
enum:
- 802.1ad
- 802.1q

56
new/interfaces.yml Normal file
View File

@@ -0,0 +1,56 @@
description:
This section describes the logical network interfaces of the device.
Interfaces as their primary have a role that is upstream, downstream,
guest, ....
type: object
properties:
name:
description:
This is a free text field, stating the administrative name of the
interface. It may contain spaces and special characters.
type: string
uc-example: LAN
role:
description:
The role defines if the interface is upstream or downstream facing.
type: string
enum:
- upstream
- downstream
uc-example: downstream
isolate-hosts:
description:
This option makes sure that any traffic leaving this interface is isolated
and all local IP ranges are blocked. It essentially enforces "guest network"
firewall settings.
type: boolean
uc-example: false
metric:
description:
The routing metric of this logical interface. Lower values have higher
priority.
type: boolean
default: 10
uc-example: 10
services:
description:
The services that shall be offered on this logical interface. These are
just strings such as "ssh", "lldp", "mdns"
type: array
items:
type: string
uc-example:
- ssh
- lldp
vlan:
$ref: "https://ucentral.io/schema/v1/interfaces/vlan/"
bridge:
$ref: "https://ucentral.io/schema/v1/interfaces/bridge/"
erthernet:
$ref: "https://ucentral.io/schema/v1/interfaces/ethernet/"
ipv4:
$ref: "https://ucentral.io/schema/v1/interfaces/ipv4/"
ipv6:
ref: "https://ucentral.io/schema/v1/interfaces/ipv6/"
ssids:
$ref: "https://ucentral.io/schema/v1/interfaces/ssids/"

40
new/merge-schema.py Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python3
import yaml
import json
def schema_filename(list):
file = list.split("v1/")
file.pop(0)
return file[0].replace("/", ".") + "yml"
def schema_load(filename):
with open(filename) as stream:
try:
schema = yaml.safe_load(stream)
return schema
except yaml.YAMLError as exc:
print(exc)
def schema_compile(input, output, tiny):
for k in input:
if tiny and k == "description":
continue
if isinstance(input[k], dict):
if k not in output:
output[k] = {}
schema_compile(input[k], output[k], tiny)
elif k == "$ref" and input[k].startswith("https://"):
output.update(schema_compile(schema_load(schema_filename(input[k])), {}, tiny))
elif k == "$ref" and not tiny:
output["properties"] = {"reference": {"type": "string"}}
else:
output[k] = input[k]
return output
def schema_generate(filename, tiny):
with open(filename, 'w') as outfile:
json.dump(schema_compile(schema_load("ucentral.yml"), {}, tiny), outfile, ensure_ascii = tiny and False or True, indent = tiny and 0 or 4)
schema_generate('ucentral.schema.json', 1)
schema_generate('ucentral.schema.pretty.json', 0)

36
new/metrics.yml Normal file
View File

@@ -0,0 +1,36 @@
description:
There are several types of mertics that shall be reported in certain
intervals. This section provides a granual configuration.
type: object
properties:
statistics:
description:
Statistics are traffic counters, neighbor tables, ...
type: object
properties:
interval:
description:
The reporting interval defined in seconds.
type: number
types:
description:
A list of names of subsystems that shall be reported periodically.
type: array
items:
types: string
health:
description:
Health check gets executed periodically and will report a health value
between 0-100 indicating how healthy the device thinks it is
type: object
properties:
interval:
description:
The reporting interval defined in seconds.
type: number
types:
description:
A list of names of subsystems that shall be reported periodically.
type: array
items:
types: string

16
new/radios.he.yml Normal file
View File

@@ -0,0 +1,16 @@
description:
This section describes the HE specific configuration options of the BSS.
properties:
multiple-bssid:
description:
Enabling this option will make the PHY broadcast its BSSs using the multiple BSSID beacon IE.
type: boolean
ema:
description:
Enableing this option will make the PHY broadcast its multiple BSSID beacons using EMA.
type: boolean
bss-color:
description:
This enables BSS Coloring on the PHY. setting it to 0 disables the feature 1-63 sets the color
and 64 will make hostapd pick a random color.
type: boolean

102
new/radios.yml Normal file
View File

@@ -0,0 +1,102 @@
description:
Describe a physical radio on the AP. A radio s be parent to several VAPs.
They all share the same physical properties.
type: array
items:
type: object
properties:
band:
type: string
enum:
- 2
- 5
- 5u
- 5l
- 6
bandwidth:
description:
Specifies a narrow channel width in MHz, possible values are: 5, 10, 20.
type: number
enum:
- 5
- 10
- 20
channel:
description:
Specifies the wireless channel to use. A value of 0 starts the ACS
algorithm.
type: number
maximum: 171
minimum: 0
country:
description:
Specifies the country code, affects the available channels and
transmission powers.
type: string
maxLength: 2
minLength: 2
channel-mode:
description:
Define the ideal channel mode that the radio shall use. This can be 802.11n, 802.11ac
or 802.11ax. This is just a hint for the AP. If the requested value is not supported
then the AP will use the highest common denominator.
type: string
enum:
- HT
- VHT
- HE
channel-width:
description:
The channel width that the radio shall use. This is just a hint for the AP. If the
requested value is not supported then the AP will use the highest common denominator.
type: string
enum:
- 20
- 40
- 80
- 160
- 8080
require-mode:
description:
Sations that do no fulfill these HT modes will be rejected.
type: array
items:
type: string
enum:
- HT
- VHT
- HE
mimo:
description:
This option allows configuring the antenna pairs that shall be used.
This is just a hint for the AP. If the requested value is not supported
then the AP will use the highest common denominator.
type: string
enum:
- 1x1
- 2x2
- 3x3
- 4x4
- 5x5
- 6x6
- 7x7
- 8x8
tx-power:
description:
This option specifies the transmission power in dBm
type: number
maximum: 30
minimum: 0
legacy-rates:
description:
Allow legacy 802.11b data rates.
type: boolean
default: false
he-settings:
$ref: "https://ucentral.io/schema/v1/radios/he/"
hostapd-iface-raw:
description:
This array allows passing raw hostapd.conf lines.
type: array
items:
type: string

10
new/services.lldp.yml Normal file
View File

@@ -0,0 +1,10 @@
type: object
properties:
describe:
description:
The LLDP description field. If set to "auto" it will be derived from unit.name.
type: string
location:
description:
The LLDP location field. If set to "auto" it will be derived from unit.location.
type: string

28
new/services.log.yml Normal file
View File

@@ -0,0 +1,28 @@
description:
This section can be used to configure remote syslog support.
type: object
properties:
host:
description:
IP address of a syslog server to which the log messages should be
sent in addition to the local destination.
type: string
port:
description:
Port number of the remote syslog server specified with log_ip.
type: number
maximum: 65535
minimum: 100
proto:
description:
Sets the protocol to use for the connection, either tcp or udp.
type: string
enum:
- tcp
- udp
size:
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
minimum: 32

9
new/services.mdns.yml Normal file
View File

@@ -0,0 +1,9 @@
description:
This section can be used to configure the MDNS server.
type: object
properties:
enable:
description:
Enable this option if you would like to enable the MDNS server on the unit.
type: boolean
default: false

11
new/services.ntp.yml Normal file
View File

@@ -0,0 +1,11 @@
type: object
description:
This section can be used to setup the upstream NTP servers.
properties:
servers:
description:
This is an array of URL/IP of the upstream NTP servers that the unit shall use to
acquire its current time.
type: array
items:
type: string

21
new/services.rtty.yml Normal file
View File

@@ -0,0 +1,21 @@
description:
This section can be used to setup a SSH server on the AP.
type: object
properties:
enable:
description:
Shall the service be enabled.
type: boolean
host:
description:
The server that the AP shal to connect to.
type: string
port:
description:
This option defines the port that we connect to.
type: number
maximum: 65535
token:
description:
The security token that we use to authenticate with the server.
type: string

26
new/services.ssh.yml Normal file
View File

@@ -0,0 +1,26 @@
description:
This section can be used to setup a SSH server on the AP.
type: object
properties:
enable:
description:
Enable this option if you would like to enable the SSH server on the unit.
type: boolean
default: false
port:
description:
This option defines which port the SSH server shall be available on.
type: number
maximum: 65535
authorized-keys:
description:
This allows the upload of public ssh keys. Keys need to be seperated by a
newline.
type: array
items:
type: string
password-authentication:
description:
This option defines if password authentication shall be enabled. If set
to false, only ssh key based authentication is possible.
type: boolean

View File

@@ -0,0 +1,8 @@
description:
This section describes the band steering behaviour of the unit.
type: object
properties:
network:
description:
The network that shall be used to communicate with the other peers.
type: string

19
new/services.yml Normal file
View File

@@ -0,0 +1,19 @@
description:
This section describes all of the services that may be present on the AP.
Each service is then referenced via its name inside an interface, ssid, ...
type: object
properties:
lldp:
$ref: "https://ucentral.io/schema/v1/services/lldp/"
ssh:
$ref: "https://ucentral.io/schema/v1/services/ssh/"
ntp:
$ref: "https://ucentral.io/schema/v1/services/ntp/"
mdns:
$ref: "https://ucentral.io/schema/v1/services/mdns/"
rtty:
$ref: "https://ucentral.io/schema/v1/services/rtty/"
log:
$ref: "https://ucentral.io/schema/v1/services/log/"
wifi-steering:
$ref: "https://ucentral.io/schema/v1/services/wifi-steering/"

21
new/ucentral.yml Normal file
View File

@@ -0,0 +1,21 @@
$id: https://openwrt.org/ucentral.schema.json
$schema: http://json-schema.org/draft-07/schema#
description: OpenWrt uCentral schema
type: object
properties:
unit:
$ref: "https://ucentral.io/schema/v1/unit/"
globals:
$ref: "https://ucentral.io/schema/v1/globals/"
definitions:
$ref: "https://ucentral.io/schema/v1/definitions/"
radios:
$ref: "https://ucentral.io/schema/v1/radios/"
interfaces:
$ref: "https://ucentral.io/schema/v1/interfaces/"
services:
$ref: "https://ucentral.io/schema/v1/services/"
metrics:
$ref: "https://ucentral.io/schema/v1/metrics/"
config-raw:
$ref: "https://ucentral.io/schema/v1/config-raw/"

19
new/unit.yml Normal file
View File

@@ -0,0 +1,19 @@
description:
A device has certain properties that describe its identity and location.
These properties are described inside this object.
type: object
properties:
name:
description:
This is a free text field, stating the administrative name of the
device. It may contain spaces and special characters.
type: string
location:
description:
This is a free text field, stating the location of the device. It
may contain spaces and special characters.
type: string
timezone:
description:
This allows you to change the TZ of the device.
type: string