mirror of
https://github.com/Telecominfraproject/ols-ucentral-schema.git
synced 2025-11-02 19:18:05 +00:00
@@ -1,11 +1,11 @@
|
||||
# usync-json-schema
|
||||
Collection of json schemas and utpl files used by usync for validating
|
||||
# ucentral-json-schema
|
||||
Collection of json schemas and utpl files used by ucentral for validating
|
||||
the datamodel and rendering incoming cfg json into uci batch sequences.
|
||||
|
||||
### Dependencies:
|
||||
In order to run the test cases you will need the following tools
|
||||
* utpl
|
||||
* usync-jsonschema
|
||||
* ucentral-jsonschema
|
||||
* jsonlint-php
|
||||
* pip3 install jsonschema2md
|
||||
* pip3 install json-schema-for-humans
|
||||
|
||||
@@ -65,7 +65,7 @@ for (key in cfg) {
|
||||
if (key in ["uuid", "ssid"])
|
||||
continue;
|
||||
try {
|
||||
include(sprintf("cfg_%s.tpl", key));
|
||||
include(sprintf("cfg_%s.uc", key));
|
||||
} catch (e) {
|
||||
failed = true;
|
||||
fails[key] = e;
|
||||
@@ -75,7 +75,7 @@ for (key in cfg) {
|
||||
|
||||
if (failed) {
|
||||
ctx = ubus.connect();
|
||||
ctx.call("usync", "log", {"error": "failed to apply config", "data": fails});
|
||||
ctx.call("ucentral", "log", {"error": "failed to apply config", "data": fails});
|
||||
ctx.disconnect();
|
||||
exit(1);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
{%
|
||||
if (!cmd.url) {
|
||||
warn("usync-upgrade: invalid FW URL\n");
|
||||
warn("ucentral-upgrade: invalid FW URL\n");
|
||||
return;
|
||||
}
|
||||
path = "/tmp/usync.upgrade";
|
||||
path = "/tmp/ucentral.upgrade";
|
||||
fs.popen(sprintf('wget %s -O %s', cmd.url, path), 'r').close();
|
||||
|
||||
ctx = ubus.connect();
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
if (!fw.valid) {
|
||||
ctx = ubus.connect();
|
||||
ctx.call("usync", "log", {"error": "firmware file validation failed", "data": fw});
|
||||
warn("usync-upgrade: firmware file validation failed\n");
|
||||
ctx.call("ucentral", "log", {"error": "firmware file validation failed", "data": fw});
|
||||
warn("ucentral-upgrade: firmware file validation failed\n");
|
||||
return;
|
||||
}
|
||||
fs.popen(sprintf('/sbin/sysupgrade %s', path), 'r').close();
|
||||
@@ -12,5 +12,5 @@ yaml2json schema/wifi-ssid.yml wifi-ssid.schema
|
||||
yaml2json schema/steer.yml steer.schema
|
||||
./merge-schema.py
|
||||
mkdir -p docs
|
||||
jsonschema2md usync.schema.json docs/usync-schema.md
|
||||
generate-schema-doc usync.schema.json docs/usync-schema.html
|
||||
jsonschema2md ucentral.schema.json docs/ucentral-schema.md
|
||||
generate-schema-doc ucentral.schema.json docs/ucentral-schema.html
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import json
|
||||
|
||||
merge = {
|
||||
"$id": "https://openwrt.org/usync.schema.json",
|
||||
"$id": "https://openwrt.org/ucentral.schema.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"description": "OpenWrt uSync schema",
|
||||
"description": "OpenWrt uCentral schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"uuid": { "type": "integer" }
|
||||
@@ -23,10 +23,10 @@ def schema_merge(name, path):
|
||||
|
||||
def schema_write():
|
||||
try:
|
||||
with open(f"usync.schema.json", 'w') as outfile:
|
||||
with open(f"ucentral.schema.json", 'w') as outfile:
|
||||
json.dump(merge, outfile, indent=True)
|
||||
except:
|
||||
print("failed to write usync.schema.json")
|
||||
print("failed to write ucentral.schema.json")
|
||||
|
||||
schema_merge("network", "network.schema")
|
||||
schema_merge("phy", "wifi-phy.schema")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$id": "https://openwrt.org/usync.schema.json",
|
||||
"$id": "https://openwrt.org/ucentral.schema.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"description": "OpenWrt uSync schema",
|
||||
"description": "OpenWrt uCentral schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"uuid": {
|
||||
Reference in New Issue
Block a user