mirror of
https://github.com/Telecominfraproject/ols-ucentral-schema.git
synced 2025-10-30 17:47:59 +00:00
ucentral-schema: reorganize the structure of the new schema folder
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,7 +1,6 @@
|
|||||||
*.schema
|
*.schema
|
||||||
docs/
|
docs/
|
||||||
new/ucentral.schema.json
|
|
||||||
new/ucentral.schema.pretty.json
|
|
||||||
new/docs/
|
new/docs/
|
||||||
new/central.schema.json
|
schema.new/ucentral.schema.json
|
||||||
new/ucentral.schema.pretty.json
|
schema.new/ucentral.schema.pretty.json
|
||||||
|
schema.new/ucentral.state.pretty.json
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
./merge-schema.py
|
|
||||||
mkdir -p docs
|
|
||||||
generate-schema-doc --config expand_buttons=true ucentral.schema.pretty.json docs/ucentral-schema.html
|
|
||||||
8
schema.new/generate.sh
Executable file
8
schema.new/generate.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
./merge-schema.py schema config ucentral.yml ucentral.schema.json 1
|
||||||
|
./merge-schema.py schema config ucentral.yml ucentral.schema.pretty.json 0
|
||||||
|
./merge-schema.py state state state.yml ucentral.state.pretty.json 0
|
||||||
|
mkdir -p docs
|
||||||
|
generate-schema-doc --config expand_buttons=true ucentral.schema.pretty.json docs/ucentral-schema.html
|
||||||
|
generate-schema-doc --config expand_buttons=true ucentral.state.pretty.json docs/ucentral-state.html
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
import yaml
|
import yaml
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -9,11 +10,12 @@ def schema_filename(list):
|
|||||||
return file[0].replace("/", ".") + "yml"
|
return file[0].replace("/", ".") + "yml"
|
||||||
|
|
||||||
def entity_name(uri):
|
def entity_name(uri):
|
||||||
name = uri.replace("https://ucentral.io/schema/v1/", "").rstrip("/")
|
name = uri.replace("https://ucentral.io/" + sys.argv[1] + "/v1/", "").rstrip("/")
|
||||||
return name.replace("/", ".")
|
return name.replace("/", ".")
|
||||||
|
|
||||||
def schema_load(filename):
|
def schema_load(filename):
|
||||||
with open(filename) as stream:
|
print(sys.argv[2] + "/" + filename)
|
||||||
|
with open(sys.argv[2] + "/" + filename) as stream:
|
||||||
try:
|
try:
|
||||||
schema = yaml.safe_load(stream)
|
schema = yaml.safe_load(stream)
|
||||||
return schema
|
return schema
|
||||||
@@ -38,12 +40,15 @@ def schema_compile(input, output, definitions, tiny):
|
|||||||
output[k] = input[k]
|
output[k] = input[k]
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def schema_generate(filename, tiny):
|
def schema_generate():
|
||||||
with open(filename, 'w') as outfile:
|
with open(sys.argv[4], 'w') as outfile:
|
||||||
|
tiny = int(sys.argv[5])
|
||||||
defs = {}
|
defs = {}
|
||||||
schema = schema_compile(schema_load("ucentral.yml"), {}, defs, tiny)
|
schema = schema_compile(schema_load(sys.argv[3]), {}, defs, tiny)
|
||||||
schema["definitions"] = defs
|
schema["definitions"] = defs
|
||||||
json.dump(schema, outfile, ensure_ascii = tiny and False or True, indent = tiny and 0 or 4)
|
json.dump(schema, outfile, ensure_ascii = tiny and False or True, indent = tiny and 0 or 4)
|
||||||
|
|
||||||
schema_generate('ucentral.schema.json', 1)
|
if len(sys.argv) != 6:
|
||||||
schema_generate('ucentral.schema.pretty.json', 0)
|
raise Exception("Invalid parameters");
|
||||||
|
|
||||||
|
schema_generate()
|
||||||
30
schema.new/state/interface.clients.yml
Normal file
30
schema.new/state/interface.clients.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
description:
|
||||||
|
An explanation about the purpose of this instance.
|
||||||
|
properties:
|
||||||
|
ipv4_addresses:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
An explanation about the purpose of this
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
ipv6_addresses:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
An explanation about the purpose of this
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
mac:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
An explanation about the purpose of this
|
||||||
|
ports:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
An explanation about the purpose of this
|
||||||
|
items:
|
||||||
|
description:
|
||||||
|
An explanation about the purpose
|
||||||
|
type: string
|
||||||
41
schema.new/state/interface.counter.yml
Normal file
41
schema.new/state/interface.counter.yml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
type: object
|
||||||
|
description:
|
||||||
|
This section contains the traffic counters of the logical interface. Entries
|
||||||
|
that have a value of 0 will not be included.
|
||||||
|
properties:
|
||||||
|
collisions:
|
||||||
|
type: number
|
||||||
|
multicast:
|
||||||
|
type: number
|
||||||
|
rx_bytes:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of bytes received.
|
||||||
|
rx_packets:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of packets received.
|
||||||
|
rx_error:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of receive errors.
|
||||||
|
rx_dropped:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of received packets that were dropped.
|
||||||
|
tx_bytes:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of bytes transmitted.
|
||||||
|
tx_packets:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of packets transmitted.
|
||||||
|
tx_error:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of transmit errors.
|
||||||
|
tx_dropped:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of transmitted packets that were dropped.
|
||||||
7
schema.new/state/interface.ipv4-address.yml
Normal file
7
schema.new/state/interface.ipv4-address.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
type: array
|
||||||
|
description:
|
||||||
|
The list of IPv4 addresses being used by this logical interface.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
An IPv4 addreess.
|
||||||
22
schema.new/state/interface.ipv4-lease.yml
Normal file
22
schema.new/state/interface.ipv4-lease.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
description:
|
||||||
|
This section describes an IPv4 lease that we have served
|
||||||
|
properties:
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The IPv4 that has been assigned to the networking client.
|
||||||
|
assigned:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The unix time stamp when this lease was assigned.
|
||||||
|
hostname:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The hostname that the client included in his request.
|
||||||
|
mac:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The MAC address of the client that this lease was assigned to.
|
||||||
12
schema.new/state/interface.ipv6-address.yml
Normal file
12
schema.new/state/interface.ipv6-address.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
description:
|
||||||
|
An IPv6 address assigned to this logical interface.
|
||||||
|
properties:
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
description: The actual IPv6 address/mask
|
||||||
|
valid:
|
||||||
|
type: number
|
||||||
|
description: How much longer this delegation is valid for.
|
||||||
17
schema.new/state/interface.ipv6-lease.yml
Normal file
17
schema.new/state/interface.ipv6-lease.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
type: array
|
||||||
|
description:
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
description:
|
||||||
|
This section describes an IPv6 lease that we have served.
|
||||||
|
properties:
|
||||||
|
addresses:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
A list of all IPv6 addresses that were assigned to this host.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
hostname:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The hostname that the client sent in its solicit message.
|
||||||
30
schema.new/state/interface.lldp.yml
Normal file
30
schema.new/state/interface.lldp.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
description:
|
||||||
|
A list of all LLDP peers that this logical interface is connected to.
|
||||||
|
properties:
|
||||||
|
capability:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
The device capabilities that our neighbour is announcing.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The chassis description that our neighbour is announcing.
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The chassis ID/MAC that our neighbour is announcing.
|
||||||
|
management_ips:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
The management IPs that our neighbour is announcing.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
port:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The physical network port that we see this neighbour on.
|
||||||
36
schema.new/state/interface.ssid.association.yml
Normal file
36
schema.new/state/interface.ssid.association.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
type: array
|
||||||
|
description:
|
||||||
|
A list all OBSS that this BSS is connected to. The contained entries
|
||||||
|
depend opertational mode.
|
||||||
|
* AP - all associated stationd
|
||||||
|
* STA - the remote AP
|
||||||
|
* mesh - all mesh peers that we can see
|
||||||
|
* wds - the remote wds peer
|
||||||
|
items:
|
||||||
|
description: An explanation about the purpose
|
||||||
|
of this instance.
|
||||||
|
properties:
|
||||||
|
bssid:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The BSSID of the remote BSS.
|
||||||
|
rssi:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The RX signal strength of the remore BSS. (dBm)
|
||||||
|
rx_bytes:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of bytes received.
|
||||||
|
rx_packets:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of packets received.
|
||||||
|
tx_bytes:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of bytes transmitted.
|
||||||
|
tx_failed:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of packets transmitted.
|
||||||
34
schema.new/state/interface.ssid.yml
Normal file
34
schema.new/state/interface.ssid.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
description:
|
||||||
|
This section contains the current state of a SSID being brodcasted or
|
||||||
|
connected to by this device.
|
||||||
|
properties:
|
||||||
|
bssid:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The BSSID used by this BSS instance.
|
||||||
|
ssid:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The SSID that we are broadcasting or connecting to.
|
||||||
|
mode:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The operational mode of the BSS.
|
||||||
|
enum:
|
||||||
|
- ap
|
||||||
|
- sta
|
||||||
|
- mesh
|
||||||
|
- wds
|
||||||
|
radio:
|
||||||
|
type: object
|
||||||
|
description:
|
||||||
|
A reference to the section describing the physical radio within this
|
||||||
|
document. (#/radios/X)
|
||||||
|
properties:
|
||||||
|
ref:
|
||||||
|
type: string
|
||||||
|
associations:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/ssid/association/"
|
||||||
45
schema.new/state/interface.yml
Normal file
45
schema.new/state/interface.yml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
type: array
|
||||||
|
description:
|
||||||
|
An array containing the runtime state of all logical interfaces.items:
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
uptime:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of seconds since the interface was brought up.
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The administrative name of this logical interface. This field is
|
||||||
|
freetext
|
||||||
|
ntp_server:
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
The upstream NTP server being used by this interface.
|
||||||
|
ipv4_leasetime:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
This is the leasetime if the IPv4 address of this logical interface was
|
||||||
|
acquired via DHCPv4.
|
||||||
|
dns_servers:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
The list of remote DNS servers that this logical interface uses for
|
||||||
|
domain name resolution.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
ipv4_addresses:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/ipv4-address/"
|
||||||
|
ipv4_leases:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/ipv4-lease/"
|
||||||
|
ipv6_addresses:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/ipv6-address/"
|
||||||
|
ipv6_leases:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/ipv6-lease/"
|
||||||
|
counters:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/counter/"
|
||||||
|
ssids:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/ssid/"
|
||||||
|
lldp_neighbours:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/lldp/"
|
||||||
28
schema.new/state/radio.yml
Normal file
28
schema.new/state/radio.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
type: array
|
||||||
|
description:
|
||||||
|
An array containing the current operational state of all wifi radios that the
|
||||||
|
unit has.
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
channel_width:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The channel width currently being used.
|
||||||
|
enum:
|
||||||
|
- 20
|
||||||
|
- 40
|
||||||
|
- 80
|
||||||
|
- 160
|
||||||
|
- 320
|
||||||
|
frequencies:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
The list of channels frquencies, that the unit is currently operating
|
||||||
|
on. Anything other than 20MHz will list several frequencies here.
|
||||||
|
items:
|
||||||
|
type: number
|
||||||
|
tx_power:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The currently configure TX power of the radio in dBm.
|
||||||
11
schema.new/state/state.yml
Normal file
11
schema.new/state/state.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
$id: https://openwrt.org/ucentral.state.json
|
||||||
|
$schema: http://json-schema.org/draft-07/schema#
|
||||||
|
description: OpenWrt uCentral state schema
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
unit:
|
||||||
|
$ref: "https://ucentral.io/state/v1/unit/"
|
||||||
|
radios:
|
||||||
|
$ref: "https://ucentral.io/state/v1/radio/"
|
||||||
|
interfaces:
|
||||||
|
$ref: "https://ucentral.io/state/v1/interface/"
|
||||||
32
schema.new/state/unit.yml
Normal file
32
schema.new/state/unit.yml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
type: object
|
||||||
|
description:
|
||||||
|
This section describes the current state of the OS running on the device.
|
||||||
|
properties:
|
||||||
|
load:
|
||||||
|
type: array
|
||||||
|
description:
|
||||||
|
This array hold 3 values describing the average system load for the last
|
||||||
|
1, 5 and 15 minutes.
|
||||||
|
items:
|
||||||
|
type: number
|
||||||
|
localtime:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
This property contains the current unix time of the device.
|
||||||
|
memory:
|
||||||
|
type: object
|
||||||
|
description:
|
||||||
|
This section describes the current memory uasge of the device.
|
||||||
|
properties:
|
||||||
|
free:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The amount of free memory.
|
||||||
|
total:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The total amount of memory.
|
||||||
|
uptime:
|
||||||
|
type: number
|
||||||
|
description:
|
||||||
|
The number of seconds since the unit last booted..
|
||||||
Reference in New Issue
Block a user