mirror of
https://github.com/Telecominfraproject/ols-ucentral-schema.git
synced 2025-11-01 10:37:48 +00:00
47 lines
1.3 KiB
Python
Executable File
47 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import json
|
|
|
|
merge = {
|
|
"$id": "https://openwrt.org/ucentral.schema.json",
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"description": "OpenWrt uCentral schema",
|
|
"type": "object",
|
|
"properties": {
|
|
"uuid": { "type": "integer" }
|
|
}
|
|
}
|
|
|
|
def schema_merge(name, path):
|
|
try:
|
|
with open(path) as infile:
|
|
schema = json.load(infile)
|
|
merge["properties"] = { **merge["properties"], **schema["properties"]}
|
|
print(f"merged {path} as {name}")
|
|
except:
|
|
print(f"failed to merge {path}")
|
|
|
|
def schema_write():
|
|
try:
|
|
with open(f"ucentral.schema.json", 'w') as outfile:
|
|
json.dump(merge, outfile, indent=True, sort_keys=True)
|
|
except:
|
|
print("failed to write ucentral.schema.json")
|
|
|
|
schema_merge("network", "network.schema")
|
|
schema_merge("phy", "wifi-phy.schema")
|
|
schema_merge("ssid", "wifi-ssid.schema")
|
|
schema_merge("wifi-vlan", "wifi-vlan.schema")
|
|
schema_merge("system", "system.schema")
|
|
schema_merge("log", "log.schema")
|
|
schema_merge("ntp", "ntp.schema")
|
|
schema_merge("ssh", "ssh.schema")
|
|
schema_merge("steer", "steer.schema")
|
|
schema_merge("poe", "poe.schema")
|
|
schema_merge("lldp", "lldp.schema")
|
|
schema_merge("rtty", "rtty.schema")
|
|
schema_merge("stats", "stats.schema")
|
|
schema_merge("mqtt", "mqtt.schema")
|
|
schema_merge("captive", "captive.schema")
|
|
schema_write()
|