From 6312c7b1d8a41743b3bbae947be9b8bac108916d Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Sun, 8 Jan 2023 10:46:29 -0800 Subject: [PATCH] https://telecominfraproject.atlassian.net/browse/WIFI-12068 Signed-off-by: stephb9959 --- CMakeLists.txt | 2 +- build | 2 +- src/framework/ALBserver.cpp | 8 +- src/framework/ConfigurationValidator.cpp | 5195 ++++++++++---------- src/framework/MicroService.cpp | 2 + src/framework/MicroService.h | 2 + src/framework/MicroServiceErrorHandler.h | 42 + src/framework/MicroServiceFuncs.cpp | 5 + src/framework/MicroServiceFuncs.h | 1 + src/framework/RESTAPI_Handler.h | 16 +- src/framework/UI_WebSocketClientServer.cpp | 6 +- src/framework/ow_constants.h | 61 +- 12 files changed, 2740 insertions(+), 2602 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97ed064..14f1167 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.13) -project(owsec VERSION 2.8.0) +project(owsec VERSION 2.9.0) set(CMAKE_CXX_STANDARD 17) diff --git a/build b/build index dc7b54a..d8263ee 100644 --- a/build +++ b/build @@ -1 +1 @@ -33 \ No newline at end of file +2 \ No newline at end of file diff --git a/src/framework/ALBserver.cpp b/src/framework/ALBserver.cpp index 4f3e1b1..5e2bf47 100644 --- a/src/framework/ALBserver.cpp +++ b/src/framework/ALBserver.cpp @@ -51,7 +51,13 @@ namespace OpenWifi { poco_information(Logger(),"Starting..."); Running_=true; Port_ = (int)MicroServiceConfigGetInt("alb.port",15015); - Socket_ = std::make_unique(Port_); + Poco::Net::IPAddress Addr(Poco::Net::IPAddress::wildcard( + Poco::Net::Socket::supportsIPv6() ? Poco::Net::AddressFamily::IPv6 + : Poco::Net::AddressFamily::IPv4)); + Poco::Net::SocketAddress SockAddr(Addr, Port_); + Poco::Net::ServerSocket ClientSocket(SockAddr, 64); + + Socket_ = std::make_unique(SockAddr, Port_); auto Params = new Poco::Net::HTTPServerParams; Params->setName("ws:alb"); Server_ = std::make_unique(new ALBRequestHandlerFactory(Logger()), *Socket_, Params); diff --git a/src/framework/ConfigurationValidator.cpp b/src/framework/ConfigurationValidator.cpp index 2154f0f..b95ead0 100644 --- a/src/framework/ConfigurationValidator.cpp +++ b/src/framework/ConfigurationValidator.cpp @@ -19,2599 +19,2608 @@ namespace OpenWifi { static const std::string GitUCentralJSONSchemaFile{ - "https://raw.githubusercontent.com/blogic/ucentral-schema/main/ucentral.schema.json"}; + "https://raw.githubusercontent.com/Telecominfraproject/wlan-ucentral-schema/main/ucentral.schema.json"}; static json DefaultUCentralSchema = R"( - { - "$id": "https://openwrt.org/ucentral.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "uuid": { - "type": "integer" - }, - "unit": { - "$ref": "#/$defs/unit" - }, - "globals": { - "$ref": "#/$defs/globals" - }, - "definitions": { - "$ref": "#/$defs/definitions" - }, - "ethernet": { - "type": "array", - "items": { - "$ref": "#/$defs/ethernet" - } - }, - "switch": { - "$ref": "#/$defs/switch" - }, - "radiosgrep": { - "type": "array", - "items": { - "$ref": "#/$defs/radio" - } - }, - "interfaces": { - "type": "array", - "items": { - "$ref": "#/$defs/interface" - } - }, - "services": { - "$ref": "#/$defs/service" - }, - "metrics": { - "$ref": "#/$defs/metrics" - }, - "config-raw": { - "$ref": "#/$defs/config-raw" - }, - "third-party": { - "type": "object", - "additionalProperties": true - } - }, - "$defs": { - "unit": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "hostname": { - "type": "string", - "format": "hostname" - }, - "location": { - "type": "string" - }, - "timezone": { - "type": "string", - "examples": [ - "UTC", - "EST5", - "CET-1CEST,M3.5.0,M10.5.0/3" - ] - }, - "leds-active": { - "type": "boolean", - "default": true - }, - "random-password": { - "type": "boolean", - "default": false - } - } - }, - "globals.wireless-multimedia.class-selector": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "CS0", - "CS1", - "CS2", - "CS3", - "CS4", - "CS5", - "CS6", - "CS7", - "AF11", - "AF12", - "AF13", - "AF21", - "AF22", - "AF23", - "AF31", - "AF32", - "AF33", - "AF41", - "AF42", - "AF43", - "DF", - "EF", - "VA", - "LE" - ] - } - }, - "globals.wireless-multimedia.table": { - "type": "object", - "additionalProperties": false, - "properties": { - "UP0": { - "$ref": "#/$defs/globals.wireless-multimedia.class-selector" - }, - "UP1": { - "$ref": "#/$defs/globals.wireless-multimedia.class-selector" - }, - "UP2": { - "$ref": "#/$defs/globals.wireless-multimedia.class-selector" - }, - "UP3": { - "$ref": "#/$defs/globals.wireless-multimedia.class-selector" - }, - "UP4": { - "$ref": "#/$defs/globals.wireless-multimedia.class-selector" - }, - "UP5": { - "$ref": "#/$defs/globals.wireless-multimedia.class-selector" - }, - "UP6": { - "$ref": "#/$defs/globals.wireless-multimedia.class-selector" - }, - "UP7": { - "$ref": "#/$defs/globals.wireless-multimedia.class-selector" - } - } - }, - "globals.wireless-multimedia.profile": { - "type": "object", - "additionalProperties": false, - "properties": { - "profile": { - "type": "string", - "enum": [ - "enterprise", - "rfc8325", - "3gpp" - ] - } - } - }, - "globals": { - "type": "object", - "properties": { - "ipv4-network": { - "type": "string", - "format": "uc-cidr4", - "examples": [ - "192.168.0.0/16" - ] - }, - "ipv6-network": { - "type": "string", - "format": "uc-cidr6", - "examples": [ - "fdca:1234:4567::/48" - ] - }, - "wireless-multimedia": { - "anyOf": [{ - "$ref": "#/$defs/globals.wireless-multimedia.table" - }, - { - "$ref": "#/$defs/globals.wireless-multimedia.profile" - } - ] - } - } - }, - "definitions": { - "type": "object", - "properties": { - "wireless-encryption": { - "type": "object", - "patternProperties": { - ".+": { - "$ref": "#/$defs/interface.ssid.encryption", - "additionalProperties": false - } - } - } - } - }, - "ethernet": { - "type": "object", - "properties": { - "select-ports": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "LAN1", - "LAN2", - "LAN3", - "LAN4", - "LAN*", - "WAN*", - "*" - ] - } - }, - "speed": { - "type": "integer", - "enum": [ - 10, - 100, - 1000, - 2500, - 5000, - 10000 - ] - }, - "duplex": { - "type": "string", - "enum": [ - "half", - "full" - ] - }, - "services": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "quality-of-service" - ] - } - } - } - }, - "switch": { - "type": "object", - "properties": { - "port-mirror": { - "type": "object", - "properties": { - "monitor-ports": { - "type": "array", - "items": { - "type": "string" - } - }, - "analysis-port": { - "type": "string" - } - } - }, - "loop-detection": { - "type": "object", - "properties": { - "protocol": { - "type": "string", - "enum": [ - "rstp" - ], - "default": "rstp" - }, - "roles": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "upstream", - "downstream" - ] - } - } - } - } - } - }, - "radio.rates": { - "type": "object", - "properties": { - "beacon": { - "type": "integer", - "default": 6000, - "enum": [ - 0, - 1000, - 2000, - 5500, - 6000, - 9000, - 11000, - 12000, - 18000, - 24000, - 36000, - 48000, - 54000 - ] - }, - "multicast": { - "type": "integer", - "default": 24000, - "enum": [ - 0, - 1000, - 2000, - 5500, - 6000, - 9000, - 11000, - 12000, - 18000, - 24000, - 36000, - 48000, - 54000 - ] - } - } - }, - "radio.he": { - "type": "object", - "properties": { - "multiple-bssid": { - "type": "boolean", - "default": false - }, - "ema": { - "type": "boolean", - "default": false - }, - "bss-color": { - "type": "integer", - "default": 64 - } - } - }, - "radio": { - "type": "object", - "properties": { - "band": { - "type": "string", - "enum": [ - "2G", - "5G", - "5G-lower", - "5G-upper", - "6G" - ] - }, - "bandwidth": { - "type": "integer", - "enum": [ - 5, - 10, - 20 - ] - }, - "channel": { - "oneOf": [{ - "type": "integer", - "maximum": 196, - "minimum": 1 - }, - { - "type": "string", - "const": "auto" - } - ] - }, - "valid-channels": { - "type": "array", - "items": { - "type": "integer", - "maximum": 196, - "minimum": 1 - } - }, - "country": { - "type": "string", - "maxLength": 2, - "minLength": 2, - "examples": [ - "US" - ] - }, - "allow-dfs": { - "type": "boolean", - "default": true - }, - "channel-mode": { - "type": "string", - "enum": [ - "HT", - "VHT", - "HE" - ], - "default": "HE" - }, - "channel-width": { - "type": "integer", - "enum": [ - 20, - 40, - 80, - 160, - 8080 - ], - "default": 80 - }, - "require-mode": { - "type": "string", - "enum": [ - "HT", - "VHT", - "HE" - ] - }, - "mimo": { - "type": "string", - "enum": [ - "1x1", - "2x2", - "3x3", - "4x4", - "5x5", - "6x6", - "7x7", - "8x8" - ] - }, - "tx-power": { - "type": "integer", - "maximum": 30, - "minimum": 0 - }, - "legacy-rates": { - "type": "boolean", - "default": false - }, - "beacon-interval": { - "type": "integer", - "default": 100, - "maximum": 65535, - "minimum": 15 - }, - "dtim-period": { - "type": "integer", - "default": 2, - "maximum": 255, - "minimum": 1 - }, - "maximum-clients": { - "type": "integer", - "example": 64 - }, - "rates": { - "$ref": "#/$defs/radio.rates" - }, - "he-settings": { - "$ref": "#/$defs/radio.he" - }, - "hostapd-iface-raw": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "ap_table_expiration_time=3600", - "device_type=6-0050F204-1", - "ieee80211h=1", - "rssi_ignore_probe_request=-75", - "time_zone=EST5", - "uuid=12345678-9abc-def0-1234-56789abcdef0", - "venue_url=1:http://www.example.com/info-eng", - "wpa_deny_ptk0_rekey=0" - ] - } - } - } - }, - "interface.vlan": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "maximum": 4050 - }, - "proto": { - "decription": "The L2 vlan tag that shall be added (1q,1ad ) ", - "type": "string", - "enum": [ - "802.1ad", - "802.1q" - ], - "default": "802.1q" - } - } - }, - "interface.bridge": { - "type": "object", - "properties": { - "mtu": { - "type": "integer", - "maximum": 65535, - "minimum": 256, - "examples": [ - 1500 - ] - }, - "tx-queue-len": { - "type": "integer", - "examples": [ - 5000 - ] - }, - "isolate-ports": { - "type": "boolean", - "default": false - } - } - }, - "interface.ethernet": { - "type": "object", - "properties": { - "select-ports": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "LAN1", - "LAN2", - "LAN3", - "LAN4", - "LAN*", - "WAN*", - "*" - ] - } - }, - "multicast": { - "type": "boolean", - "default": true - }, - "learning": { - "type": "boolean", - "default": true - }, - "isolate": { - "type": "boolean", - "default": false - }, - "macaddr": { - "type": "string", - "format": "uc-mac" - }, - "reverse-path-filter": { - "type": "boolean", - "default": false - }, - "vlan-tag": { - "type": "string", - "enum": [ - "tagged", - "un-tagged", - "auto" - ], - "default": "auto" - } - } - }, - "interface.ipv4.dhcp": { - "type": "object", - "properties": { - "lease-first": { - "type": "integer", - "examples": [ - 10 - ] - }, - "lease-count": { - "type": "integer", - "examples": [ - 100 - ] - }, - "lease-time": { - "type": "string", - "format": "uc-timeout", - "default": "6h" - }, - "relay-server": { - "type": "string", - "format": "ipv4", - "example": "192.168.2.1" - }, - "circuit-id-format": { - "type": "string", - "example": [ - "\\{Interface\\}:\\{VLAN-Id\\}:\\{SSID\\}:\\{Model\\}:\\{Name\\}:\\{AP-MAC\\}:\\{Location\\}", - "\\{AP-MAC\\};\\{SSID\\};\\{Crypto\\}", - "\\{Name\\} \\{ESSID\\}" - ] - }, - "remote-id-format": { - "type": "string", - "example": [ - "\\{Client-MAC-hex\\} \\{SSID\\}", - "\\{AP-MAC-hex\\} \\{SSID\\}" - ] - } - } - }, - "interface.ipv4.dhcp-lease": { - "type": "object", - "properties": { - "macaddr": { - "type": "string", - "format": "uc-mac", - "examples": [ - "00:11:22:33:44:55" - ] - }, - "static-lease-offset": { - "type": "integer", - "examples": [ - 10 - ] - }, - "lease-time": { - "type": "string", - "format": "uc-timeout", - "default": "6h" - }, - "publish-hostname": { - "type": "boolean", - "default": true - } - } - }, - "interface.ipv4.port-forward": { - "type": "object", - "properties": { - "protocol": { - "type": "string", - "enum": [ - "tcp", - "udp", - "any" - ], - "default": "any" - }, - "external-port": { - "type": [ - "integer", - "string" - ], - "minimum": 0, - "maximum": 65535, - "format": "uc-portrange" - }, - "internal-address": { - "type": "string", - "format": "ipv4", - "example": "0.0.0.120" - }, - "internal-port": { - "type": [ - "integer", - "string" - ], - "minimum": 0, - "maximum": 65535, - "format": "uc-portrange" - } - }, - "required": [ - "external-port", - "internal-address" - ] - }, - "interface.ipv4": { - "type": "object", - "properties": { - "addressing": { - "type": "string", - "enum": [ - "dynamic", - "static" - ], - "examples": [ - "static" - ] - }, - "subnet": { - "type": "string", - "format": "uc-cidr4", - "examples": [ - "auto/24" - ] - }, - "gateway": { - "type": "string", - "format": "ipv4", - "examples": [ - "192.168.1.1" - ] - }, - "send-hostname": { - "type": "boolean", - "default": true, - "examples": [ - true - ] - }, - "use-dns": { - "type": "array", - "items": { - "type": "string", - "format": "ipv4", - "examples": [ - "8.8.8.8", - "4.4.4.4" - ] - } - }, - "dhcp": { - "$ref": "#/$defs/interface.ipv4.dhcp" - }, - "dhcp-leases": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ipv4.dhcp-lease" - } - }, - "port-forward": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ipv4.port-forward" - } - } - } - }, - "interface.ipv6.dhcpv6": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "hybrid", - "stateless", - "stateful", - "relay" - ] - }, - "announce-dns": { - "type": "array", - "items": { - "type": "string", - "format": "ipv6" - } - }, - "filter-prefix": { - "type": "string", - "format": "uc-cidr6", - "default": "::/0" - } - } - }, - "interface.ipv6.port-forward": { - "type": "object", - "properties": { - "protocol": { - "type": "string", - "enum": [ - "tcp", - "udp", - "any" - ], - "default": "any" - }, - "external-port": { - "type": [ - "integer", - "string" - ], - "minimum": 0, - "maximum": 65535, - "format": "uc-portrange" - }, - "internal-address": { - "type": "string", - "format": "ipv6", - "example": "::1234:abcd" - }, - "internal-port": { - "type": [ - "integer", - "string" - ], - "minimum": 0, - "maximum": 65535, - "format": "uc-portrange" - } - }, - "required": [ - "external-port", - "internal-address" - ] - }, - "interface.ipv6.traffic-allow": { - "type": "object", - "properties": { - "protocol": { - "type": "string", - "default": "any" - }, - "source-address": { - "type": "string", - "format": "uc-cidr6", - "example": "2001:db8:1234:abcd::/64", - "default": "::/0" - }, - "source-ports": { - "type": "array", - "minItems": 1, - "items": { - "type": [ - "integer", - "string" - ], - "minimum": 0, - "maximum": 65535, - "format": "uc-portrange" - } - }, - "destination-address": { - "type": "string", - "format": "ipv6", - "example": "::1000" - }, - "destination-ports": { - "type": "array", - "minItems": 1, - "items": { - "type": [ - "integer", - "string" - ], - "minimum": 0, - "maximum": 65535, - "format": "uc-portrange" - } - } - }, - "required": [ - "destination-address" - ] - }, - "interface.ipv6": { - "type": "object", - "properties": { - "addressing": { - "type": "string", - "enum": [ - "dynamic", - "static" - ] - }, - "subnet": { - "type": "string", - "format": "uc-cidr6", - "examples": [ - "auto/64" - ] - }, - "gateway": { - "type": "string", - "format": "ipv6", - "examples": [ - "2001:db8:123:456::1" - ] - }, - "prefix-size": { - "type": "integer", - "maximum": 64, - "minimum": 0 - }, - "dhcpv6": { - "$ref": "#/$defs/interface.ipv6.dhcpv6" - }, - "port-forward": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ipv6.port-forward" - } - }, - "traffic-allow": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ipv6.traffic-allow" - } - } - } - }, - "interface.broad-band.wwan": { - "type": "object", - "properties": { - "protocol": { - "type": "string", - "const": "wwan" - }, - "modem-type": { - "type": "string", - "enum": [ - "qmi", - "mbim", - "wwan" - ] - }, - "access-point-name": { - "type": "string" - }, - "authentication-type": { - "type": "string", - "enum": [ - "none", - "pap", - "chap", - "pap-chap" - ], - "default": "none" - }, - "pin-code": { - "type": "string" - }, - "user-name": { - "type": "string" - }, - "password": { - "type": "string" - }, - "packet-data-protocol": { - "type": "string", - "enum": [ - "ipv4", - "ipv6", - "dual-stack" - ], - "default": "dual-stack" - } - } - }, - "interface.broad-band.pppoe": { - "type": "object", - "properties": { - "protocol": { - "type": "string", - "const": "pppoe" - }, - "user-name": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "interface.broad-band": { - "oneOf": [{ - "$ref": "#/$defs/interface.broad-band.wwan" - }, - { - "$ref": "#/$defs/interface.broad-band.pppoe" - } - ] - }, - "interface.captive": { - "type": "object", - "properties": { - "gateway-name": { - "type": "string", - "default": "uCentral - Captive Portal" - }, - "gateway-fqdn": { - "type": "string", - "format": "uc-fqdn", - "default": "ucentral.splash" - }, - "max-clients": { - "type": "integer", - "default": 32 - }, - "upload-rate": { - "type": "integer", - "default": 0 - }, - "download-rate": { - "type": "integer", - "default": 0 - }, - "upload-quota": { - "type": "integer", - "default": 0 - }, - "download-quota": { - "type": "integer", - "default": 0 - } - } - }, - "interface.ssid.encryption": { - "type": "object", - "properties": { - "proto": { - "type": "string", - "enum": [ - "none", - "psk", - "psk2", - "psk-mixed", - "psk2-radius", - "wpa", - "wpa2", - "wpa-mixed", - "sae", - "sae-mixed", - "wpa3", - "wpa3-192", - "wpa3-mixed" - ], - "examples": [ - "psk2" - ] - }, - "key": { - "type": "string", - "maxLength": 63, - "minLength": 8 - }, - "ieee80211w": { - "type": "string", - "enum": [ - "disabled", - "optional", - "required" - ], - "default": "disabled" - } - } - }, - "interface.ssid.multi-psk": { - "type": "object", - "properties": { - "mac": { - "type": "string", - "format": "uc-mac" - }, - "key": { - "type": "string", - "maxLength": 63, - "minLength": 8 - }, - "vlan-id": { - "type": "integer", - "maximum": 4096, - "examples": [ - 3, - 100, - 200, - 4094 - ] - } - } - }, - "interface.ssid.rrm": { - "type": "object", - "properties": { - "neighbor-reporting": { - "type": "boolean", - "default": false - }, - "reduced-neighbor-reporting": { - "type": "boolean", - "default": false - }, - "lci": { - "type": "string" - }, - "civic-location": { - "type": "string" - }, - "ftm-responder": { - "type": "boolean", - "default": false - }, - "stationary-ap": { - "type": "boolean", - "default": false - } - } - }, - "interface.ssid.rate-limit": { - "type": "object", - "properties": { - "ingress-rate": { - "type": "integer", - "default": 0 - }, - "egress-rate": { - "type": "integer", - "default": 0 - } - } - }, - "interface.ssid.roaming": { - "type": "object", - "properties": { - "message-exchange": { - "type": "string", - "enum": [ - "air", - "ds" - ], - "default": "ds" - }, - "generate-psk": { - "type": "boolean", - "default": false - }, - "domain-identifier": { - "type": "string", - "maxLength": 4, - "minLength": 4, - "examples": [ - "abcd" - ] - }, - "pmk-r0-key-holder": { - "type": "string", - "example": "14:DD:20:47:14:E4,14DD204714E4,00112233445566778899aabbccddeeff" - }, - "pmk-r1-key-holder": { - "type": "string", - "example": "14:DD:20:47:14:E4,14DD204714E4,00112233445566778899aabbccddeeff" - } - } - }, - "interface.ssid.radius.local-user": { - "type": "object", - "properties": { - "mac": { - "type": "string", - "format": "uc-mac" - }, - "user-name": { - "type": "string", - "minLength": 1 - }, - "password": { - "type": "string", - "maxLength": 63, - "minLength": 8 - }, - "vlan-id": { - "type": "integer", - "maximum": 4096, - "examples": [ - 3, - 100, - 200, - 4094 - ] - } - } - }, - "interface.ssid.radius.local": { - "type": "object", - "properties": { - "server-identity": { - "type": "string", - "default": "uCentral" - }, - "users": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ssid.radius.local-user" - } - } - } - }, - "interface.ssid.radius.server": { - "type": "object", - "properties": { - "host": { - "type": "string", - "format": "uc-host", - "examples": [ - "192.168.1.10" - ] - }, - "port": { - "type": "integer", - "maximum": 65535, - "minimum": 1024, - "examples": [ - 1812 - ] - }, - "secret": { - "type": "string", - "examples": [ - "secret" - ] - }, - "request-attribute": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "maximum": 255, - "minimum": 1 - }, - "value": { - "anyOf": [{ - "type": "integer", - "maximum": 4294967295, - "minimum": 0 - }, - { - "type": "string" - } - ] - } - }, - "examples": [{ - "id": 27, - "value": 900 - }, - { - "id": 32, - "value": "My NAS ID" - }, - { - "id": 56, - "value": 1004 - }, - { - "id": 126, - "value": "Example Operator" - } - ] - }, - "examples": [ - "126:s:Operator" - ] - } - } - }, - "interface.ssid.radius": { - "type": "object", - "properties": { - "nas-identifier": { - "type": "string" - }, - "chargeable-user-id": { - "type": "boolean", - "default": false - }, - "local": { - "$ref": "#/$defs/interface.ssid.radius.local" - }, - "dynamic-authorization": { - "type": "object", - "properties": { - "host": { - "type": "string", - "format": "uc-ip", - "examples": [ - "192.168.1.10" - ] - }, - "port": { - "type": "integer", - "maximum": 65535, - "minimum": 1024, - "examples": [ - 1812 - ] - }, - "secret": { - "type": "string", - "examples": [ - "secret" - ] - } - } - }, - "authentication": { - "allOf": [{ - "$ref": "#/$defs/interface.ssid.radius.server" - }, - { - "type": "object", - "properties": { - "mac-filter": { - "type": "boolean", - "default": false - } - } - } - ] - }, - "accounting": { - "allOf": [{ - "$ref": "#/$defs/interface.ssid.radius.server" - }, - { - "type": "object", - "properties": { - "interval": { - "type": "integer", - "maximum": 600, - "minimum": 60, - "default": 60 - } - } - } - ] - } - } - }, - "interface.ssid.certificates": { - "type": "object", - "properties": { - "use-local-certificates": { - "type": "boolean", - "default": false - }, - "ca-certificate": { - "type": "string" - }, - "certificate": { - "type": "string" - }, - "private-key": { - "type": "string" - }, - "private-key-password": { - "type": "string" - } - } - }, - "interface.ssid.pass-point": { - "type": "object", - "properties": { - "venue-name": { - "type": "array", - "items": { - "type": "string" - } - }, - "venue-group": { - "type": "integer", - "maximum": 32 - }, - "venue-type": { - "type": "integer", - "maximum": 32 - }, - "venue-url": { - "type": "array", - "items": { - "type": "string", - "format": "uri" - } - }, - "auth-type": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "terms-and-conditions", - "online-enrollment", - "http-redirection", - "dns-redirection" - ] - }, - "uri": { - "type": "string", - "format": "uri", - "examples": [ - "https://operator.example.org/wireless-access/terms-and-conditions.html", - "http://www.example.com/redirect/me/here/" - ] - } - }, - "minLength": 2, - "maxLength": 2 - }, - "domain-name": { - "type": "array", - "items": { - "type": "string", - "format": "hostname" - } - }, - "nai-realm": { - "type": "array", - "items": { - "type": "string" - } - }, - "osen": { - "type": "boolean" - }, - "anqp-domain": { - "type": "integer", - "maximum": 65535, - "minimum": 0 - }, - "anqp-3gpp-cell-net": { - "type": "array", - "items": { - "type": "string" - } - }, - "friendly-name": { - "type": "array", - "items": { - "type": "string" - } - }, - "access-network-type": { - "type": "integer", - "maximum": 15, - "default": 0 - }, - "internet": { - "type": "boolean", - "default": true - }, - "asra": { - "type": "boolean", - "default": false - }, - "esr": { - "type": "boolean", - "default": false - }, - "uesa": { - "type": "boolean", - "default": false - }, - "hessid": { - "type": "string", - "example": "00:11:22:33:44:55" - }, - "roaming-consortium": { - "type": "array", - "items": { - "type": "string" - } - }, - "disable-dgaf": { - "type": "boolean", - "default": false - }, - "ipaddr-type-available": { - "type": "integer", - "maximum": 255 - }, - "connection-capability": { - "type": "array", - "items": { - "type": "string" - } - }, - "icons": { - "type": "array", - "items": { - "type": "object", - "properties": { - "width": { - "type": "integer", - "examples": [ - 64 - ] - }, - "height": { - "type": "integer", - "examples": [ - 64 - ] - }, - "type": { - "type": "string", - "examples": [ - "image/png" - ] - }, - "icon": { - "type": "string", - "format": "uc-base64" - }, - "language": { - "type": "string", - "pattern": "^[a-z][a-z][a-z]$", - "examples": [ - "eng", - "fre", - "ger", - "ita" - ] - } - }, - "examples": [{ - "width": 32, - "height": 32, - "type": "image/png", - "language": "eng", - "icon": "R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" - }] - } - }, - "wan-metrics": { - "type": "object", - "properties": { - "info": { - "type": "string", - "enum": [ - "up", - "down", - "testing" - ] - }, - "downlink": { - "type": "integer" - }, - "uplink": { - "type": "integer" - } - } - } - } - }, - "interface.ssid.quality-thresholds": { - "type": "object", - "properties": { - "probe-request-rssi": { - "type": "integer" - }, - "association-request-rssi": { - "type": "integer" - } - } - }, - "interface.ssid": { - "type": "object", - "properties": { - "purpose": { - "type": "string", - "enum": [ - "user-defined", - "onboarding-ap", - "onboarding-sta" - ], - "default": "user-defined" - }, - "name": { - "type": "string", - "maxLength": 32, - "minLength": 1 - }, - "wifi-bands": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "2G", - "5G", - "5G-lower", - "5G-upper", - "6G" - ] - } - }, - "bss-mode": { - "type": "string", - "enum": [ - "ap", - "sta", - "mesh", - "wds-ap", - "wds-sta", - "wds-repeater" - ], - "default": "ap" - }, - "bssid": { - "type": "string", - "format": "uc-mac" - }, - "hidden-ssid": { - "type": "boolean" - }, - "isolate-clients": { - "type": "boolean" - }, - "power-save": { - "type": "boolean" - }, - "rts-threshold": { - "type": "integer", - "maximum": 65535, - "minimum": 1 - }, - "broadcast-time": { - "type": "boolean" - }, - "unicast-conversion": { - "type": "boolean" - }, - "services": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "wifi-steering" - ] - } - }, - "maximum-clients": { - "type": "integer", - "example": 64 - }, - "proxy-arp": { - "type": "boolean", - "default": true - }, - "disassoc-low-ack": { - "decription": "Disassociate stations based on excessive transmission failures or other indications of connection loss.", - "type": "boolean", - "default": false - }, - "vendor-elements": { - "decription": "This option allows embedding custom vendor specific IEs inside the beacons of a BSS in AP mode.", - "type": "string" - }, - "fils-discovery-interval": { - "type": "integer", - "default": 20, - "maximum": 10000 - }, - "encryption": { - "$ref": "#/$defs/interface.ssid.encryption" - }, - "multi-psk": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ssid.multi-psk" - } - }, - "rrm": { - "$ref": "#/$defs/interface.ssid.rrm" - }, - "rate-limit": { - "$ref": "#/$defs/interface.ssid.rate-limit" - }, - "roaming": { - "$ref": "#/$defs/interface.ssid.roaming" - }, - "radius": { - "$ref": "#/$defs/interface.ssid.radius" - }, - "certificates": { - "$ref": "#/$defs/interface.ssid.certificates" - }, - "pass-point": { - "$ref": "#/$defs/interface.ssid.pass-point" - }, - "quality-thresholds": { - "$ref": "#/$defs/interface.ssid.quality-thresholds" - }, - "hostapd-bss-raw": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "ap_table_expiration_time=3600", - "device_type=6-0050F204-1", - "ieee80211h=1", - "rssi_ignore_probe_request=-75", - "time_zone=EST5", - "uuid=12345678-9abc-def0-1234-56789abcdef0", - "venue_url=1:http://www.example.com/info-eng", - "wpa_deny_ptk0_rekey=0" - ] - } - } - } - }, - "interface.tunnel.mesh": { - "type": "object", - "properties": { - "proto": { - "type": "string", - "const": "mesh" - } - } - }, - "interface.tunnel.vxlan": { - "type": "object", - "properties": { - "proto": { - "type": "string", - "const": "vxlan" - }, - "peer-address": { - "type": "string", - "format": "ipv4", - "example": "192.168.100.1" - }, - "peer-port": { - "type": "integer", - "maximum": 65535, - "minimum": 1, - "examples": [ - 4789 - ] - } - } - }, - "interface.tunnel.l2tp": { - "type": "object", - "properties": { - "proto": { - "type": "string", - "const": "l2tp" - }, - "server": { - "type": "string", - "format": "ipv4", - "example": "192.168.100.1" - }, - "user-name": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "interface.tunnel.gre": { - "type": "object", - "properties": { - "proto": { - "type": "string", - "const": "gre" - }, - "peer-address": { - "type": "string", - "format": "ipv4", - "example": "192.168.100.1" - } - } - }, - "interface.tunnel": { - "oneOf": [{ - "$ref": "#/$defs/interface.tunnel.mesh" - }, - { - "$ref": "#/$defs/interface.tunnel.vxlan" - }, - { - "$ref": "#/$defs/interface.tunnel.l2tp" - }, - { - "$ref": "#/$defs/interface.tunnel.gre" - } - ] - }, - "interface": { - "type": "object", - "properties": { - "name": { - "type": "string", - "examples": [ - "LAN" - ] - }, - "role": { - "type": "string", - "enum": [ - "upstream", - "downstream" - ] - }, - "isolate-hosts": { - "type": "boolean" - }, - "metric": { - "type": "integer", - "maximum": 4294967295, - "minimum": 0 - }, - "services": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "ssh", - "lldp" - ] - } - }, - "vlan": { - "$ref": "#/$defs/interface.vlan" - }, - "bridge": { - "$ref": "#/$defs/interface.bridge" - }, - "ethernet": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ethernet" - } - }, - "ipv4": { - "$ref": "#/$defs/interface.ipv4" - }, - "ipv6": { - "$ref": "#/$defs/interface.ipv6" - }, - "broad-band": { - "$ref": "#/$defs/interface.broad-band" - }, - "captive": { - "$ref": "#/$defs/interface.captive" - }, - "ssids": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ssid" - } - }, - "tunnel": { - "$ref": "#/$defs/interface.tunnel" - } - } - }, - "service.lldp": { - "type": "object", - "properties": { - "describe": { - "type": "string", - "default": "uCentral Access Point" - }, - "location": { - "type": "string", - "default": "uCentral Network" - } - } - }, - "service.ssh": { - "type": "object", - "properties": { - "port": { - "type": "integer", - "maximum": 65535, - "default": 22 - }, - "authorized-keys": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC0ghdSd2D2y08TFowZLMZn3x1/Djw3BkNsIeHt/Z+RaXwvfV1NQAnNdaOngMT/3uf5jZtYxhpl+dbZtRhoUPRvKflKBeFHYBqjZVzD3r4ns2Ofm2UpHlbdOpMuy9oeTSCeF0IKZZ6szpkvSirQogeP2fe9KRkzQpiza6YxxaJlWw== user@example", - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ4FDjyCsg+1Mh2C5G7ibR3z0Kw1dU57kfXebLRwS6CL bob@work", - "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBP/JpJ/KHtKKImzISBDwLO0/EwytIr4pGZQXcP6GCSHchLMyfjf147KNlF9gC+3FibzqKH02EiQspVhRgfuK6y0= alice@home" - ] - } - }, - "password-authentication": { - "type": "boolean", - "default": true - } - } - }, - "service.ntp": { - "type": "object", - "properties": { - "servers": { - "type": "array", - "items": { - "type": "string", - "format": "uc-host" - }, - "examples": [ - "0.openwrt.pool.ntp.org" - ] - }, - "local-server": { - "type": "boolean", - "examples": [ - true - ] - } - } - }, - "service.mdns": { - "type": "object", - "properties": { - "enable": { - "type": "boolean", - "default": false - } - } - }, - "service.rtty": { - "type": "object", - "properties": { - "host": { - "type": "string", - "format": "uc-host", - "examples": [ - "192.168.1.10" - ] - }, - "port": { - "type": "integer", - "maximum": 65535, - "default": 5912 - }, - "token": { - "type": "string", - "maxLength": 32, - "minLength": 32, - "examples": [ - "01234567890123456789012345678901" - ] - } - } - }, - "service.log": { - "type": "object", - "properties": { - "host": { - "type": "string", - "format": "uc-host", - "examples": [ - "192.168.1.10" - ] - }, - "port": { - "type": "integer", - "maximum": 65535, - "minimum": 100, - "examples": [ - 2000 - ] - }, - "proto": { - "type": "string", - "enum": [ - "tcp", - "udp" - ], - "default": "udp" - }, - "size": { - "type": "integer", - "minimum": 32, - "default": 1000 - }, - "priority": { - "type": "integer", - "minimum": 0, - "default": 7 - } - } - }, - "service.http": { - "type": "object", - "properties": { - "http-port": { - "type": "integer", - "maximum": 65535, - "minimum": 1, - "default": 80 - } - } - }, - "service.igmp": { - "type": "object", - "properties": { - "enable": { - "type": "boolean", - "default": false - } - } - }, - "service.ieee8021x": { - "type": "object", - "properties": { - "ca-certificate": { - "type": "string" - }, - "use-local-certificates": { - "type": "boolean", - "default": false - }, - "server-certificate": { - "type": "string" - }, - "private-key": { - "type": "string" - }, - "users": { - "type": "array", - "items": { - "$ref": "#/$defs/interface.ssid.radius.local-user" - } - } - } - }, - "service.radius-proxy": { - "type": "object", - "properties": { - "realms": { - "type": "array", - "items": { - "type": "object", - "properties": { - "realm": { - "type": "string", - "default": "*" - }, - "auto-discover": { - "type": "boolean", - "default": false - }, - "host": { - "type": "string", - "format": "uc-host", - "examples": [ - "192.168.1.10" - ] - }, - "port": { - "type": "integer", - "maximum": 65535, - "default": 2083 - }, - "secret": { - "type": "string" - }, - "use-local-certificates": { - "type": "boolean", - "default": false - }, - "ca-certificate": { - "type": "string" - }, - "certificate": { - "type": "string" - }, - "private-key": { - "type": "string" - }, - "private-key-password": { - "type": "string" - } - } - } - } - } - }, - "service.online-check": { - "type": "object", - "properties": { - "ping-hosts": { - "type": "array", - "items": { - "type": "string", - "format": "uc-host", - "examples": [ - "192.168.1.10" - ] - } - }, - "download-hosts": { - "type": "array", - "items": { - "type": "string", - "examples": [ - "www.example.org" - ] - } - }, - "check-interval": { - "type": "number", - "default": 60 - }, - "check-threshold": { - "type": "number", - "default": 1 - }, - "action": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "wifi", - "leds" - ] - } - } - } - }, - "service.open-flow": { - "type": "object", - "properties": { - "controller": { - "type": "string", - "format": "uc-ip", - "example": "192.168.10.1" - }, - "datapath-description": { - "type": "string", - "example": "Building 2, Floor 6, AP 2" - }, - "mode": { - "type": "string", - "enum": [ - "pssl", - "ptcp", - "ssl", - "tcp" - ], - "default": "ssl" - }, - "port": { - "type": "integer", - "maximum": 65535, - "default": 6653 - }, - "ca-certificate": { - "type": "string" - }, - "ssl-certificate": { - "type": "string" - }, - "private-key": { - "type": "string" - } - } - }, - "service.data-plane": { - "type": "object", - "properties": { - "ingress-filters": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "program": { - "type": "string", - "format": "uc-base64" - } - } - } - } - } - }, - "service.wifi-steering": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "local", - "cloud" - ], - "examples": [ - "local" - ] - }, - "assoc-steering": { - "type": "boolean", - "default": false - }, - "required-snr": { - "type": "integer", - "default": 0 - }, - "required-probe-snr": { - "type": "integer", - "default": 0 - }, - "required-roam-snr": { - "type": "integer", - "default": 0 - }, - "load-kick-threshold": { - "type": "integer", - "default": 0 - }, - "auto-channel": { - "type": "boolean", - "default": false - }, - "ipv6": { - "type": "boolean", - "default": false - } - } - }, - "service.quality-of-service.class-selector": { - "type": "string", - "enum": [ - "CS0", - "CS1", - "CS2", - "CS3", - "CS4", - "CS5", - "CS6", - "CS7", - "AF11", - "AF12", - "AF13", - "AF21", - "AF22", - "AF23", - "AF31", - "AF32", - "AF33", - "AF41", - "AF42", - "AF43", - "DF", - "EF", - "VA", - "LE" - ] - }, - "service.quality-of-service": { - "type": "object", - "properties": { - "select-ports": { - "type": "array", - "items": { - "type": "string", - "default": "WAN" - } - }, - "bandwidth-up": { - "type": "integer", - "default": 0 - }, - "bandwidth-down": { - "type": "integer", - "default": 0 - }, - "bulk-detection": { - "type": "object", - "properties": { - "dscp": { - "$ref": "#/$defs/service.quality-of-service.class-selector", - "default": "CS0" - }, - "packets-per-second": { - "type": "number", - "default": 0 - } - } - }, - "classifier": { - "type": "array", - "items": { - "type": "object", - "properties": { - "dscp": { - "$ref": "#/$defs/service.quality-of-service.class-selector", - "default": "CS1" - }, - "ports": { - "type": "array", - "items": { - "type": "object", - "properties": { - "protocol": { - "type": "string", - "enum": [ - "any", - "tcp", - "udp" - ], - "default": "any" - }, - "port": { - "type": "integer" - }, - "range-end": { - "type": "integer" - }, - "reclassify": { - "type": "boolean", - "default": true - } - } - } - }, - "dns": { - "type": "array", - "items": { - "type": "object", - "properties": { - "fqdn": { - "type": "string", - "format": "uc-fqdn" - }, - "suffix-matching": { - "type": "boolean", - "default": true - }, - "reclassify": { - "type": "boolean", - "default": true - } - } - } - } - } - } - } - } - }, - "service.facebook-wifi": { - "type": "object", - "properties": { - "vendor-id": { - "type": "string" - }, - "gateway-id": { - "type": "string" - }, - "secret": { - "type": "string" - } - } - }, - "service.airtime-fairness": { - "type": "object", - "properties": { - "voice-weight": { - "type": "number", - "default": 4 - }, - "packet-threshold": { - "type": "number", - "default": 100 - }, - "bulk-threshold": { - "type": "number", - "default": 50 - }, - "priority-threshold": { - "type": "number", - "default": 30 - }, - "weight-normal": { - "type": "number", - "default": 256 - }, - "weight-priority": { - "type": "number", - "default": 394 - }, - "weight-bulk": { - "type": "number", - "default": 128 - } - } - }, - "service": { - "type": "object", - "properties": { - "lldp": { - "$ref": "#/$defs/service.lldp" - }, - "ssh": { - "$ref": "#/$defs/service.ssh" - }, - "ntp": { - "$ref": "#/$defs/service.ntp" - }, - "mdns": { - "$ref": "#/$defs/service.mdns" - }, - "rtty": { - "$ref": "#/$defs/service.rtty" - }, - "log": { - "$ref": "#/$defs/service.log" - }, - "http": { - "$ref": "#/$defs/service.http" - }, - "igmp": { - "$ref": "#/$defs/service.igmp" - }, - "ieee8021x": { - "$ref": "#/$defs/service.ieee8021x" - }, - "radius-proxy": { - "$ref": "#/$defs/service.radius-proxy" - }, - "online-check": { - "$ref": "#/$defs/service.online-check" - }, - "open-flow": { - "$ref": "#/$defs/service.open-flow" - }, - "data-plane": { - "$ref": "#/$defs/service.data-plane" - }, - "wifi-steering": { - "$ref": "#/$defs/service.wifi-steering" - }, - "quality-of-service": { - "$ref": "#/$defs/service.quality-of-service" - }, - "facebook-wifi": { - "$ref": "#/$defs/service.facebook-wifi" - }, - "airtime-fairness": { - "$ref": "#/$defs/service.airtime-fairness" - } - } - }, - "metrics.statistics": { - "type": "object", - "properties": { - "interval": { - "type": "integer" - }, - "types": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "ssids", - "lldp", - "clients" - ] - } - } - } - }, - "metrics.health": { - "type": "object", - "properties": { - "interval": { - "type": "integer", - "minimum": 60 - } - } - }, - "metrics.wifi-frames": { - "type": "object", - "properties": { - "filters": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "probe", - "auth", - "assoc", - "disassoc", - "deauth", - "local-deauth", - "inactive-deauth", - "key-mismatch", - "beacon-report", - "radar-detected" - ] - } - } - } - }, - "metrics.dhcp-snooping": { - "type": "object", - "properties": { - "filters": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "ack", - "discover", - "offer", - "request", - "solicit", - "reply", - "renew" - ] - } - } - } - }, - "metrics": { - "type": "object", - "properties": { - "statistics": { - "$ref": "#/$defs/metrics.statistics" - }, - "health": { - "$ref": "#/$defs/metrics.health" - }, - "wifi-frames": { - "$ref": "#/$defs/metrics.wifi-frames" - }, - "dhcp-snooping": { - "$ref": "#/$defs/metrics.dhcp-snooping" - } - } - }, - "config-raw": { - "type": "array", - "items": { - "type": "array", - "minItems": 2, - "items": { - "type": "string" - }, - "examples": [ - [ - "set", - "system.@system[0].timezone", - "GMT0" - ], - [ - "delete", - "firewall.@zone[0]" - ], - [ - "delete", - "dhcp.wan" - ], - [ - "add", - "dhcp", - "dhcp" - ], - [ - "add-list", - "system.ntp.server", - "0.pool.example.org" - ], - [ - "del-list", - "system.ntp.server", - "1.openwrt.pool.ntp.org" - ] - ] - } - } - } + "$id": "https://openwrt.org/ucentral.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "uuid": { + "type": "integer" + }, + "unit": { + "$ref": "#/$defs/unit" + }, + "globals": { + "$ref": "#/$defs/globals" + }, + "definitions": { + "$ref": "#/$defs/definitions" + }, + "ethernet": { + "type": "array", + "items": { + "$ref": "#/$defs/ethernet" + } + }, + "switch": { + "$ref": "#/$defs/switch" + }, + "radios": { + "type": "array", + "items": { + "$ref": "#/$defs/radio" + } + }, + "interfaces": { + "type": "array", + "items": { + "$ref": "#/$defs/interface" + } + }, + "services": { + "$ref": "#/$defs/service" + }, + "metrics": { + "$ref": "#/$defs/metrics" + }, + "config-raw": { + "$ref": "#/$defs/config-raw" + }, + "third-party": { + "type": "object", + "additionalProperties": true + } + }, + "$defs": { + "unit": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "hostname": { + "type": "string", + "format": "hostname" + }, + "location": { + "type": "string" + }, + "timezone": { + "type": "string", + "examples": [ + "UTC", + "EST5", + "CET-1CEST,M3.5.0,M10.5.0/3" + ] + }, + "leds-active": { + "type": "boolean", + "default": true + }, + "random-password": { + "type": "boolean", + "default": false + } + } + }, + "globals.wireless-multimedia.class-selector": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "CS0", + "CS1", + "CS2", + "CS3", + "CS4", + "CS5", + "CS6", + "CS7", + "AF11", + "AF12", + "AF13", + "AF21", + "AF22", + "AF23", + "AF31", + "AF32", + "AF33", + "AF41", + "AF42", + "AF43", + "DF", + "EF", + "VA", + "LE" + ] + } + }, + "globals.wireless-multimedia.table": { + "type": "object", + "additionalProperties": false, + "properties": { + "UP0": { + "$ref": "#/$defs/globals.wireless-multimedia.class-selector" + }, + "UP1": { + "$ref": "#/$defs/globals.wireless-multimedia.class-selector" + }, + "UP2": { + "$ref": "#/$defs/globals.wireless-multimedia.class-selector" + }, + "UP3": { + "$ref": "#/$defs/globals.wireless-multimedia.class-selector" + }, + "UP4": { + "$ref": "#/$defs/globals.wireless-multimedia.class-selector" + }, + "UP5": { + "$ref": "#/$defs/globals.wireless-multimedia.class-selector" + }, + "UP6": { + "$ref": "#/$defs/globals.wireless-multimedia.class-selector" + }, + "UP7": { + "$ref": "#/$defs/globals.wireless-multimedia.class-selector" + } + } + }, + "globals.wireless-multimedia.profile": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "enum": [ + "enterprise", + "rfc8325", + "3gpp" + ] + } + } + }, + "globals": { + "type": "object", + "properties": { + "ipv4-network": { + "type": "string", + "format": "uc-cidr4", + "examples": [ + "192.168.0.0/16" + ] + }, + "ipv6-network": { + "type": "string", + "format": "uc-cidr6", + "examples": [ + "fdca:1234:4567::/48" + ] + }, + "wireless-multimedia": { + "anyOf": [ + { + "$ref": "#/$defs/globals.wireless-multimedia.table" + }, + { + "$ref": "#/$defs/globals.wireless-multimedia.profile" + } + ] + } + } + }, + "definitions": { + "type": "object", + "properties": { + "wireless-encryption": { + "type": "object", + "patternProperties": { + ".+": { + "$ref": "#/$defs/interface.ssid.encryption", + "additionalProperties": false + } + } + } + } + }, + "ethernet": { + "type": "object", + "properties": { + "select-ports": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "LAN1", + "LAN2", + "LAN3", + "LAN4", + "LAN*", + "WAN*", + "*" + ] + } + }, + "speed": { + "type": "integer", + "enum": [ + 10, + 100, + 1000, + 2500, + 5000, + 10000 + ] + }, + "duplex": { + "type": "string", + "enum": [ + "half", + "full" + ] + }, + "services": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "quality-of-service" + ] + } + } + } + }, + "switch": { + "type": "object", + "properties": { + "port-mirror": { + "type": "object", + "properties": { + "monitor-ports": { + "type": "array", + "items": { + "type": "string" + } + }, + "analysis-port": { + "type": "string" + } + } + }, + "loop-detection": { + "type": "object", + "properties": { + "protocol": { + "type": "string", + "enum": [ + "rstp" + ], + "default": "rstp" + }, + "roles": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "upstream", + "downstream" + ] + } + } + } + } + } + }, + "radio.rates": { + "type": "object", + "properties": { + "beacon": { + "type": "integer", + "default": 6000, + "enum": [ + 0, + 1000, + 2000, + 5500, + 6000, + 9000, + 11000, + 12000, + 18000, + 24000, + 36000, + 48000, + 54000 + ] + }, + "multicast": { + "type": "integer", + "default": 24000, + "enum": [ + 0, + 1000, + 2000, + 5500, + 6000, + 9000, + 11000, + 12000, + 18000, + 24000, + 36000, + 48000, + 54000 + ] + } + } + }, + "radio.he": { + "type": "object", + "properties": { + "multiple-bssid": { + "type": "boolean", + "default": false + }, + "ema": { + "type": "boolean", + "default": false + }, + "bss-color": { + "type": "integer", + "default": 64 + } + } + }, + "radio": { + "type": "object", + "properties": { + "band": { + "type": "string", + "enum": [ + "2G", + "5G", + "5G-lower", + "5G-upper", + "6G" + ] + }, + "bandwidth": { + "type": "integer", + "enum": [ + 5, + 10, + 20 + ] + }, + "channel": { + "oneOf": [ + { + "type": "integer", + "maximum": 196, + "minimum": 1 + }, + { + "type": "string", + "const": "auto" + } + ] + }, + "valid-channels": { + "type": "array", + "items": { + "type": "integer", + "maximum": 196, + "minimum": 1 + } + }, + "country": { + "type": "string", + "maxLength": 2, + "minLength": 2, + "examples": [ + "US" + ] + }, + "allow-dfs": { + "type": "boolean", + "default": true + }, + "channel-mode": { + "type": "string", + "enum": [ + "HT", + "VHT", + "HE" + ], + "default": "HE" + }, + "channel-width": { + "type": "integer", + "enum": [ + 20, + 40, + 80, + 160, + 8080 + ], + "default": 80 + }, + "require-mode": { + "type": "string", + "enum": [ + "HT", + "VHT", + "HE" + ] + }, + "mimo": { + "type": "string", + "enum": [ + "1x1", + "2x2", + "3x3", + "4x4", + "5x5", + "6x6", + "7x7", + "8x8" + ] + }, + "tx-power": { + "type": "integer", + "maximum": 30, + "minimum": 0 + }, + "legacy-rates": { + "type": "boolean", + "default": false + }, + "beacon-interval": { + "type": "integer", + "default": 100, + "maximum": 65535, + "minimum": 15 + }, + "dtim-period": { + "type": "integer", + "default": 2, + "maximum": 255, + "minimum": 1 + }, + "maximum-clients": { + "type": "integer", + "example": 64 + }, + "rates": { + "$ref": "#/$defs/radio.rates" + }, + "he-settings": { + "$ref": "#/$defs/radio.he" + }, + "hostapd-iface-raw": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "ap_table_expiration_time=3600", + "device_type=6-0050F204-1", + "ieee80211h=1", + "rssi_ignore_probe_request=-75", + "time_zone=EST5", + "uuid=12345678-9abc-def0-1234-56789abcdef0", + "venue_url=1:http://www.example.com/info-eng", + "wpa_deny_ptk0_rekey=0" + ] + } + } + } + }, + "interface.vlan": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "maximum": 4050 + }, + "proto": { + "decription": "The L2 vlan tag that shall be added (1q,1ad ) ", + "type": "string", + "enum": [ + "802.1ad", + "802.1q" + ], + "default": "802.1q" + } + } + }, + "interface.bridge": { + "type": "object", + "properties": { + "mtu": { + "type": "integer", + "maximum": 65535, + "minimum": 256, + "examples": [ + 1500 + ] + }, + "tx-queue-len": { + "type": "integer", + "examples": [ + 5000 + ] + }, + "isolate-ports": { + "type": "boolean", + "default": false + } + } + }, + "interface.ethernet": { + "type": "object", + "properties": { + "select-ports": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "LAN1", + "LAN2", + "LAN3", + "LAN4", + "LAN*", + "WAN*", + "*" + ] + } + }, + "multicast": { + "type": "boolean", + "default": true + }, + "learning": { + "type": "boolean", + "default": true + }, + "isolate": { + "type": "boolean", + "default": false + }, + "macaddr": { + "type": "string", + "format": "uc-mac" + }, + "reverse-path-filter": { + "type": "boolean", + "default": false + }, + "vlan-tag": { + "type": "string", + "enum": [ + "tagged", + "un-tagged", + "auto" + ], + "default": "auto" + } + } + }, + "interface.ipv4.dhcp": { + "type": "object", + "properties": { + "lease-first": { + "type": "integer", + "examples": [ + 10 + ] + }, + "lease-count": { + "type": "integer", + "examples": [ + 100 + ] + }, + "lease-time": { + "type": "string", + "format": "uc-timeout", + "default": "6h" + }, + "relay-server": { + "type": "string", + "format": "ipv4", + "example": "192.168.2.1" + }, + "circuit-id-format": { + "type": "string", + "example": [ + "\\{Interface\\}:\\{VLAN-Id\\}:\\{SSID\\}:\\{Model\\}:\\{Name\\}:\\{AP-MAC\\}:\\{Location\\}", + "\\{AP-MAC\\};\\{SSID\\};\\{Crypto\\}", + "\\{Name\\} \\{ESSID\\}" + ] + }, + "remote-id-format": { + "type": "string", + "example": [ + "\\{Client-MAC-hex\\} \\{SSID\\}", + "\\{AP-MAC-hex\\} \\{SSID\\}" + ] + } + } + }, + "interface.ipv4.dhcp-lease": { + "type": "object", + "properties": { + "macaddr": { + "type": "string", + "format": "uc-mac", + "examples": [ + "00:11:22:33:44:55" + ] + }, + "static-lease-offset": { + "type": "integer", + "examples": [ + 10 + ] + }, + "lease-time": { + "type": "string", + "format": "uc-timeout", + "default": "6h" + }, + "publish-hostname": { + "type": "boolean", + "default": true + } + } + }, + "interface.ipv4.port-forward": { + "type": "object", + "properties": { + "protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "any" + ], + "default": "any" + }, + "external-port": { + "type": [ + "integer", + "string" + ], + "minimum": 0, + "maximum": 65535, + "format": "uc-portrange" + }, + "internal-address": { + "type": "string", + "format": "ipv4", + "example": "0.0.0.120" + }, + "internal-port": { + "type": [ + "integer", + "string" + ], + "minimum": 0, + "maximum": 65535, + "format": "uc-portrange" + } + }, + "required": [ + "external-port", + "internal-address" + ] + }, + "interface.ipv4": { + "type": "object", + "properties": { + "addressing": { + "type": "string", + "enum": [ + "dynamic", + "static" + ], + "examples": [ + "static" + ] + }, + "subnet": { + "type": "string", + "format": "uc-cidr4", + "examples": [ + "auto/24" + ] + }, + "gateway": { + "type": "string", + "format": "ipv4", + "examples": [ + "192.168.1.1" + ] + }, + "send-hostname": { + "type": "boolean", + "default": true, + "examples": [ + true + ] + }, + "use-dns": { + "type": "array", + "items": { + "type": "string", + "format": "ipv4", + "examples": [ + "8.8.8.8", + "4.4.4.4" + ] + } + }, + "dhcp": { + "$ref": "#/$defs/interface.ipv4.dhcp" + }, + "dhcp-leases": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ipv4.dhcp-lease" + } + }, + "port-forward": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ipv4.port-forward" + } + } + } + }, + "interface.ipv6.dhcpv6": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "hybrid", + "stateless", + "stateful", + "relay" + ] + }, + "announce-dns": { + "type": "array", + "items": { + "type": "string", + "format": "ipv6" + } + }, + "filter-prefix": { + "type": "string", + "format": "uc-cidr6", + "default": "::/0" + } + } + }, + "interface.ipv6.port-forward": { + "type": "object", + "properties": { + "protocol": { + "type": "string", + "enum": [ + "tcp", + "udp", + "any" + ], + "default": "any" + }, + "external-port": { + "type": [ + "integer", + "string" + ], + "minimum": 0, + "maximum": 65535, + "format": "uc-portrange" + }, + "internal-address": { + "type": "string", + "format": "ipv6", + "example": "::1234:abcd" + }, + "internal-port": { + "type": [ + "integer", + "string" + ], + "minimum": 0, + "maximum": 65535, + "format": "uc-portrange" + } + }, + "required": [ + "external-port", + "internal-address" + ] + }, + "interface.ipv6.traffic-allow": { + "type": "object", + "properties": { + "protocol": { + "type": "string", + "default": "any" + }, + "source-address": { + "type": "string", + "format": "uc-cidr6", + "example": "2001:db8:1234:abcd::/64", + "default": "::/0" + }, + "source-ports": { + "type": "array", + "minItems": 1, + "items": { + "type": [ + "integer", + "string" + ], + "minimum": 0, + "maximum": 65535, + "format": "uc-portrange" + } + }, + "destination-address": { + "type": "string", + "format": "ipv6", + "example": "::1000" + }, + "destination-ports": { + "type": "array", + "minItems": 1, + "items": { + "type": [ + "integer", + "string" + ], + "minimum": 0, + "maximum": 65535, + "format": "uc-portrange" + } + } + }, + "required": [ + "destination-address" + ] + }, + "interface.ipv6": { + "type": "object", + "properties": { + "addressing": { + "type": "string", + "enum": [ + "dynamic", + "static" + ] + }, + "subnet": { + "type": "string", + "format": "uc-cidr6", + "examples": [ + "auto/64" + ] + }, + "gateway": { + "type": "string", + "format": "ipv6", + "examples": [ + "2001:db8:123:456::1" + ] + }, + "prefix-size": { + "type": "integer", + "maximum": 64, + "minimum": 0 + }, + "dhcpv6": { + "$ref": "#/$defs/interface.ipv6.dhcpv6" + }, + "port-forward": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ipv6.port-forward" + } + }, + "traffic-allow": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ipv6.traffic-allow" + } + } + } + }, + "interface.broad-band.wwan": { + "type": "object", + "properties": { + "protocol": { + "type": "string", + "const": "wwan" + }, + "modem-type": { + "type": "string", + "enum": [ + "qmi", + "mbim", + "wwan" + ] + }, + "access-point-name": { + "type": "string" + }, + "authentication-type": { + "type": "string", + "enum": [ + "none", + "pap", + "chap", + "pap-chap" + ], + "default": "none" + }, + "pin-code": { + "type": "string" + }, + "user-name": { + "type": "string" + }, + "password": { + "type": "string" + }, + "packet-data-protocol": { + "type": "string", + "enum": [ + "ipv4", + "ipv6", + "dual-stack" + ], + "default": "dual-stack" + } + } + }, + "interface.broad-band.pppoe": { + "type": "object", + "properties": { + "protocol": { + "type": "string", + "const": "pppoe" + }, + "user-name": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "interface.broad-band": { + "oneOf": [ + { + "$ref": "#/$defs/interface.broad-band.wwan" + }, + { + "$ref": "#/$defs/interface.broad-band.pppoe" + } + ] + }, + "interface.captive": { + "type": "object", + "properties": { + "gateway-name": { + "type": "string", + "default": "uCentral - Captive Portal" + }, + "gateway-fqdn": { + "type": "string", + "format": "uc-fqdn", + "default": "ucentral.splash" + }, + "max-clients": { + "type": "integer", + "default": 32 + }, + "upload-rate": { + "type": "integer", + "default": 0 + }, + "download-rate": { + "type": "integer", + "default": 0 + }, + "upload-quota": { + "type": "integer", + "default": 0 + }, + "download-quota": { + "type": "integer", + "default": 0 + } + } + }, + "interface.ssid.encryption": { + "type": "object", + "properties": { + "proto": { + "type": "string", + "enum": [ + "none", + "psk", + "psk2", + "psk-mixed", + "psk2-radius", + "wpa", + "wpa2", + "wpa-mixed", + "sae", + "sae-mixed", + "wpa3", + "wpa3-192", + "wpa3-mixed" + ], + "examples": [ + "psk2" + ] + }, + "key": { + "type": "string", + "maxLength": 63, + "minLength": 8 + }, + "ieee80211w": { + "type": "string", + "enum": [ + "disabled", + "optional", + "required" + ], + "default": "disabled" + } + } + }, + "interface.ssid.multi-psk": { + "type": "object", + "properties": { + "mac": { + "type": "string", + "format": "uc-mac" + }, + "key": { + "type": "string", + "maxLength": 63, + "minLength": 8 + }, + "vlan-id": { + "type": "integer", + "maximum": 4096, + "examples": [ + 3, + 100, + 200, + 4094 + ] + } + } + }, + "interface.ssid.rrm": { + "type": "object", + "properties": { + "neighbor-reporting": { + "type": "boolean", + "default": false + }, + "reduced-neighbor-reporting": { + "type": "boolean", + "default": false + }, + "lci": { + "type": "string" + }, + "civic-location": { + "type": "string" + }, + "ftm-responder": { + "type": "boolean", + "default": false + }, + "stationary-ap": { + "type": "boolean", + "default": false + } + } + }, + "interface.ssid.rate-limit": { + "type": "object", + "properties": { + "ingress-rate": { + "type": "integer", + "default": 0 + }, + "egress-rate": { + "type": "integer", + "default": 0 + } + } + }, + "interface.ssid.roaming": { + "type": "object", + "properties": { + "message-exchange": { + "type": "string", + "enum": [ + "air", + "ds" + ], + "default": "ds" + }, + "generate-psk": { + "type": "boolean", + "default": false + }, + "domain-identifier": { + "type": "string", + "maxLength": 4, + "minLength": 4, + "examples": [ + "abcd" + ] + }, + "pmk-r0-key-holder": { + "type": "string", + "example": "14:DD:20:47:14:E4,14DD204714E4,00112233445566778899aabbccddeeff" + }, + "pmk-r1-key-holder": { + "type": "string", + "example": "14:DD:20:47:14:E4,14DD204714E4,00112233445566778899aabbccddeeff" + } + } + }, + "interface.ssid.radius.local-user": { + "type": "object", + "properties": { + "mac": { + "type": "string", + "format": "uc-mac" + }, + "user-name": { + "type": "string", + "minLength": 1 + }, + "password": { + "type": "string", + "maxLength": 63, + "minLength": 8 + }, + "vlan-id": { + "type": "integer", + "maximum": 4096, + "examples": [ + 3, + 100, + 200, + 4094 + ] + } + } + }, + "interface.ssid.radius.local": { + "type": "object", + "properties": { + "server-identity": { + "type": "string", + "default": "uCentral" + }, + "users": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ssid.radius.local-user" + } + } + } + }, + "interface.ssid.radius.server": { + "type": "object", + "properties": { + "host": { + "type": "string", + "format": "uc-host", + "examples": [ + "192.168.1.10" + ] + }, + "port": { + "type": "integer", + "maximum": 65535, + "minimum": 1024, + "examples": [ + 1812 + ] + }, + "secret": { + "type": "string", + "examples": [ + "secret" + ] + }, + "request-attribute": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "maximum": 255, + "minimum": 1 + }, + "value": { + "anyOf": [ + { + "type": "integer", + "maximum": 4294967295, + "minimum": 0 + }, + { + "type": "string" + } + ] + } + }, + "examples": [ + { + "id": 27, + "value": 900 + }, + { + "id": 32, + "value": "My NAS ID" + }, + { + "id": 56, + "value": 1004 + }, + { + "id": 126, + "value": "Example Operator" + } + ] + }, + "examples": [ + "126:s:Operator" + ] + } + } + }, + "interface.ssid.radius": { + "type": "object", + "properties": { + "nas-identifier": { + "type": "string" + }, + "chargeable-user-id": { + "type": "boolean", + "default": false + }, + "local": { + "$ref": "#/$defs/interface.ssid.radius.local" + }, + "dynamic-authorization": { + "type": "object", + "properties": { + "host": { + "type": "string", + "format": "uc-ip", + "examples": [ + "192.168.1.10" + ] + }, + "port": { + "type": "integer", + "maximum": 65535, + "minimum": 1024, + "examples": [ + 1812 + ] + }, + "secret": { + "type": "string", + "examples": [ + "secret" + ] + } + } + }, + "authentication": { + "allOf": [ + { + "$ref": "#/$defs/interface.ssid.radius.server" + }, + { + "type": "object", + "properties": { + "mac-filter": { + "type": "boolean", + "default": false + } + } + } + ] + }, + "accounting": { + "allOf": [ + { + "$ref": "#/$defs/interface.ssid.radius.server" + }, + { + "type": "object", + "properties": { + "interval": { + "type": "integer", + "maximum": 600, + "minimum": 60, + "default": 60 + } + } + } + ] + } + } + }, + "interface.ssid.certificates": { + "type": "object", + "properties": { + "use-local-certificates": { + "type": "boolean", + "default": false + }, + "ca-certificate": { + "type": "string" + }, + "certificate": { + "type": "string" + }, + "private-key": { + "type": "string" + }, + "private-key-password": { + "type": "string" + } + } + }, + "interface.ssid.pass-point": { + "type": "object", + "properties": { + "venue-name": { + "type": "array", + "items": { + "type": "string" + } + }, + "venue-group": { + "type": "integer", + "maximum": 32 + }, + "venue-type": { + "type": "integer", + "maximum": 32 + }, + "venue-url": { + "type": "array", + "items": { + "type": "string", + "format": "uri" + } + }, + "auth-type": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "terms-and-conditions", + "online-enrollment", + "http-redirection", + "dns-redirection" + ] + }, + "uri": { + "type": "string", + "format": "uri", + "examples": [ + "https://operator.example.org/wireless-access/terms-and-conditions.html", + "http://www.example.com/redirect/me/here/" + ] + } + }, + "minLength": 2, + "maxLength": 2 + }, + "domain-name": { + "type": "array", + "items": { + "type": "string", + "format": "hostname" + } + }, + "nai-realm": { + "type": "array", + "items": { + "type": "string" + } + }, + "osen": { + "type": "boolean" + }, + "anqp-domain": { + "type": "integer", + "maximum": 65535, + "minimum": 0 + }, + "anqp-3gpp-cell-net": { + "type": "array", + "items": { + "type": "string" + } + }, + "friendly-name": { + "type": "array", + "items": { + "type": "string" + } + }, + "access-network-type": { + "type": "integer", + "maximum": 15, + "default": 0 + }, + "internet": { + "type": "boolean", + "default": true + }, + "asra": { + "type": "boolean", + "default": false + }, + "esr": { + "type": "boolean", + "default": false + }, + "uesa": { + "type": "boolean", + "default": false + }, + "hessid": { + "type": "string", + "example": "00:11:22:33:44:55" + }, + "roaming-consortium": { + "type": "array", + "items": { + "type": "string" + } + }, + "disable-dgaf": { + "type": "boolean", + "default": false + }, + "ipaddr-type-available": { + "type": "integer", + "maximum": 255 + }, + "connection-capability": { + "type": "array", + "items": { + "type": "string" + } + }, + "icons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "width": { + "type": "integer", + "examples": [ + 64 + ] + }, + "height": { + "type": "integer", + "examples": [ + 64 + ] + }, + "type": { + "type": "string", + "examples": [ + "image/png" + ] + }, + "icon": { + "type": "string", + "format": "uc-base64" + }, + "language": { + "type": "string", + "pattern": "^[a-z][a-z][a-z]$", + "examples": [ + "eng", + "fre", + "ger", + "ita" + ] + } + }, + "examples": [ + { + "width": 32, + "height": 32, + "type": "image/png", + "language": "eng", + "icon": "R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" + } + ] + } + }, + "wan-metrics": { + "type": "object", + "properties": { + "info": { + "type": "string", + "enum": [ + "up", + "down", + "testing" + ] + }, + "downlink": { + "type": "integer" + }, + "uplink": { + "type": "integer" + } + } + } + } + }, + "interface.ssid.quality-thresholds": { + "type": "object", + "properties": { + "probe-request-rssi": { + "type": "integer" + }, + "association-request-rssi": { + "type": "integer" + } + } + }, + "interface.ssid": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "enum": [ + "user-defined", + "onboarding-ap", + "onboarding-sta" + ], + "default": "user-defined" + }, + "name": { + "type": "string", + "maxLength": 32, + "minLength": 1 + }, + "wifi-bands": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "2G", + "5G", + "5G-lower", + "5G-upper", + "6G" + ] + } + }, + "bss-mode": { + "type": "string", + "enum": [ + "ap", + "sta", + "mesh", + "wds-ap", + "wds-sta", + "wds-repeater" + ], + "default": "ap" + }, + "bssid": { + "type": "string", + "format": "uc-mac" + }, + "hidden-ssid": { + "type": "boolean" + }, + "isolate-clients": { + "type": "boolean" + }, + "power-save": { + "type": "boolean" + }, + "rts-threshold": { + "type": "integer", + "maximum": 65535, + "minimum": 1 + }, + "broadcast-time": { + "type": "boolean" + }, + "unicast-conversion": { + "type": "boolean" + }, + "services": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "wifi-steering" + ] + } + }, + "maximum-clients": { + "type": "integer", + "example": 64 + }, + "proxy-arp": { + "type": "boolean", + "default": true + }, + "disassoc-low-ack": { + "decription": "Disassociate stations based on excessive transmission failures or other indications of connection loss.", + "type": "boolean", + "default": false + }, + "vendor-elements": { + "decription": "This option allows embedding custom vendor specific IEs inside the beacons of a BSS in AP mode.", + "type": "string" + }, + "fils-discovery-interval": { + "type": "integer", + "default": 20, + "maximum": 10000 + }, + "encryption": { + "$ref": "#/$defs/interface.ssid.encryption" + }, + "multi-psk": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ssid.multi-psk" + } + }, + "rrm": { + "$ref": "#/$defs/interface.ssid.rrm" + }, + "rate-limit": { + "$ref": "#/$defs/interface.ssid.rate-limit" + }, + "roaming": { + "$ref": "#/$defs/interface.ssid.roaming" + }, + "radius": { + "$ref": "#/$defs/interface.ssid.radius" + }, + "certificates": { + "$ref": "#/$defs/interface.ssid.certificates" + }, + "pass-point": { + "$ref": "#/$defs/interface.ssid.pass-point" + }, + "quality-thresholds": { + "$ref": "#/$defs/interface.ssid.quality-thresholds" + }, + "hostapd-bss-raw": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "ap_table_expiration_time=3600", + "device_type=6-0050F204-1", + "ieee80211h=1", + "rssi_ignore_probe_request=-75", + "time_zone=EST5", + "uuid=12345678-9abc-def0-1234-56789abcdef0", + "venue_url=1:http://www.example.com/info-eng", + "wpa_deny_ptk0_rekey=0" + ] + } + } + } + }, + "interface.tunnel.mesh": { + "type": "object", + "properties": { + "proto": { + "type": "string", + "const": "mesh" + } + } + }, + "interface.tunnel.vxlan": { + "type": "object", + "properties": { + "proto": { + "type": "string", + "const": "vxlan" + }, + "peer-address": { + "type": "string", + "format": "ipv4", + "example": "192.168.100.1" + }, + "peer-port": { + "type": "integer", + "maximum": 65535, + "minimum": 1, + "examples": [ + 4789 + ] + } + } + }, + "interface.tunnel.l2tp": { + "type": "object", + "properties": { + "proto": { + "type": "string", + "const": "l2tp" + }, + "server": { + "type": "string", + "format": "ipv4", + "example": "192.168.100.1" + }, + "user-name": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "interface.tunnel.gre": { + "type": "object", + "properties": { + "proto": { + "type": "string", + "const": "gre" + }, + "peer-address": { + "type": "string", + "format": "ipv4", + "example": "192.168.100.1" + } + } + }, + "interface.tunnel": { + "oneOf": [ + { + "$ref": "#/$defs/interface.tunnel.mesh" + }, + { + "$ref": "#/$defs/interface.tunnel.vxlan" + }, + { + "$ref": "#/$defs/interface.tunnel.l2tp" + }, + { + "$ref": "#/$defs/interface.tunnel.gre" + } + ] + }, + "interface": { + "type": "object", + "properties": { + "name": { + "type": "string", + "examples": [ + "LAN" + ] + }, + "role": { + "type": "string", + "enum": [ + "upstream", + "downstream" + ] + }, + "isolate-hosts": { + "type": "boolean" + }, + "metric": { + "type": "integer", + "maximum": 4294967295, + "minimum": 0 + }, + "services": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "ssh", + "lldp" + ] + } + }, + "vlan": { + "$ref": "#/$defs/interface.vlan" + }, + "bridge": { + "$ref": "#/$defs/interface.bridge" + }, + "ethernet": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ethernet" + } + }, + "ipv4": { + "$ref": "#/$defs/interface.ipv4" + }, + "ipv6": { + "$ref": "#/$defs/interface.ipv6" + }, + "broad-band": { + "$ref": "#/$defs/interface.broad-band" + }, + "captive": { + "$ref": "#/$defs/interface.captive" + }, + "ssids": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ssid" + } + }, + "tunnel": { + "$ref": "#/$defs/interface.tunnel" + } + } + }, + "service.lldp": { + "type": "object", + "properties": { + "describe": { + "type": "string", + "default": "uCentral Access Point" + }, + "location": { + "type": "string", + "default": "uCentral Network" + } + } + }, + "service.ssh": { + "type": "object", + "properties": { + "port": { + "type": "integer", + "maximum": 65535, + "default": 22 + }, + "authorized-keys": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC0ghdSd2D2y08TFowZLMZn3x1/Djw3BkNsIeHt/Z+RaXwvfV1NQAnNdaOngMT/3uf5jZtYxhpl+dbZtRhoUPRvKflKBeFHYBqjZVzD3r4ns2Ofm2UpHlbdOpMuy9oeTSCeF0IKZZ6szpkvSirQogeP2fe9KRkzQpiza6YxxaJlWw== user@example", + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ4FDjyCsg+1Mh2C5G7ibR3z0Kw1dU57kfXebLRwS6CL bob@work", + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBP/JpJ/KHtKKImzISBDwLO0/EwytIr4pGZQXcP6GCSHchLMyfjf147KNlF9gC+3FibzqKH02EiQspVhRgfuK6y0= alice@home" + ] + } + }, + "password-authentication": { + "type": "boolean", + "default": true + } + } + }, + "service.ntp": { + "type": "object", + "properties": { + "servers": { + "type": "array", + "items": { + "type": "string", + "format": "uc-host" + }, + "examples": [ + "0.openwrt.pool.ntp.org" + ] + }, + "local-server": { + "type": "boolean", + "examples": [ + true + ] + } + } + }, + "service.mdns": { + "type": "object", + "properties": { + "enable": { + "type": "boolean", + "default": false + } + } + }, + "service.rtty": { + "type": "object", + "properties": { + "host": { + "type": "string", + "format": "uc-host", + "examples": [ + "192.168.1.10" + ] + }, + "port": { + "type": "integer", + "maximum": 65535, + "default": 5912 + }, + "token": { + "type": "string", + "maxLength": 32, + "minLength": 32, + "examples": [ + "01234567890123456789012345678901" + ] + } + } + }, + "service.log": { + "type": "object", + "properties": { + "host": { + "type": "string", + "format": "uc-host", + "examples": [ + "192.168.1.10" + ] + }, + "port": { + "type": "integer", + "maximum": 65535, + "minimum": 100, + "examples": [ + 2000 + ] + }, + "proto": { + "type": "string", + "enum": [ + "tcp", + "udp" + ], + "default": "udp" + }, + "size": { + "type": "integer", + "minimum": 32, + "default": 1000 + }, + "priority": { + "type": "integer", + "minimum": 0, + "default": 7 + } + } + }, + "service.http": { + "type": "object", + "properties": { + "http-port": { + "type": "integer", + "maximum": 65535, + "minimum": 1, + "default": 80 + } + } + }, + "service.igmp": { + "type": "object", + "properties": { + "enable": { + "type": "boolean", + "default": false + } + } + }, + "service.ieee8021x": { + "type": "object", + "properties": { + "ca-certificate": { + "type": "string" + }, + "use-local-certificates": { + "type": "boolean", + "default": false + }, + "server-certificate": { + "type": "string" + }, + "private-key": { + "type": "string" + }, + "users": { + "type": "array", + "items": { + "$ref": "#/$defs/interface.ssid.radius.local-user" + } + } + } + }, + "service.radius-proxy": { + "type": "object", + "properties": { + "realms": { + "type": "array", + "items": { + "type": "object", + "properties": { + "realm": { + "type": "string", + "default": "*" + }, + "auto-discover": { + "type": "boolean", + "default": false + }, + "host": { + "type": "string", + "format": "uc-host", + "examples": [ + "192.168.1.10" + ] + }, + "port": { + "type": "integer", + "maximum": 65535, + "default": 2083 + }, + "secret": { + "type": "string" + }, + "use-local-certificates": { + "type": "boolean", + "default": false + }, + "ca-certificate": { + "type": "string" + }, + "certificate": { + "type": "string" + }, + "private-key": { + "type": "string" + }, + "private-key-password": { + "type": "string" + } + } + } + } + } + }, + "service.online-check": { + "type": "object", + "properties": { + "ping-hosts": { + "type": "array", + "items": { + "type": "string", + "format": "uc-host", + "examples": [ + "192.168.1.10" + ] + } + }, + "download-hosts": { + "type": "array", + "items": { + "type": "string", + "examples": [ + "www.example.org" + ] + } + }, + "check-interval": { + "type": "number", + "default": 60 + }, + "check-threshold": { + "type": "number", + "default": 1 + }, + "action": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "wifi", + "leds" + ] + } + } + } + }, + "service.open-flow": { + "type": "object", + "properties": { + "controller": { + "type": "string", + "format": "uc-ip", + "example": "192.168.10.1" + }, + "datapath-description": { + "type": "string", + "example": "Building 2, Floor 6, AP 2" + }, + "mode": { + "type": "string", + "enum": [ + "pssl", + "ptcp", + "ssl", + "tcp" + ], + "default": "ssl" + }, + "port": { + "type": "integer", + "maximum": 65535, + "default": 6653 + }, + "ca-certificate": { + "type": "string" + }, + "ssl-certificate": { + "type": "string" + }, + "private-key": { + "type": "string" + } + } + }, + "service.data-plane": { + "type": "object", + "properties": { + "ingress-filters": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "program": { + "type": "string", + "format": "uc-base64" + } + } + } + } + } + }, + "service.wifi-steering": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "local", + "cloud" + ], + "examples": [ + "local" + ] + }, + "assoc-steering": { + "type": "boolean", + "default": false + }, + "required-snr": { + "type": "integer", + "default": 0 + }, + "required-probe-snr": { + "type": "integer", + "default": 0 + }, + "required-roam-snr": { + "type": "integer", + "default": 0 + }, + "load-kick-threshold": { + "type": "integer", + "default": 0 + }, + "auto-channel": { + "type": "boolean", + "default": false + }, + "ipv6": { + "type": "boolean", + "default": false + } + } + }, + "service.quality-of-service.class-selector": { + "type": "string", + "enum": [ + "CS0", + "CS1", + "CS2", + "CS3", + "CS4", + "CS5", + "CS6", + "CS7", + "AF11", + "AF12", + "AF13", + "AF21", + "AF22", + "AF23", + "AF31", + "AF32", + "AF33", + "AF41", + "AF42", + "AF43", + "DF", + "EF", + "VA", + "LE" + ] + }, + "service.quality-of-service": { + "type": "object", + "properties": { + "select-ports": { + "type": "array", + "items": { + "type": "string", + "default": "WAN" + } + }, + "bandwidth-up": { + "type": "integer", + "default": 0 + }, + "bandwidth-down": { + "type": "integer", + "default": 0 + }, + "bulk-detection": { + "type": "object", + "properties": { + "dscp": { + "$ref": "#/$defs/service.quality-of-service.class-selector", + "default": "CS0" + }, + "packets-per-second": { + "type": "number", + "default": 0 + } + } + }, + "classifier": { + "type": "array", + "items": { + "type": "object", + "properties": { + "dscp": { + "$ref": "#/$defs/service.quality-of-service.class-selector", + "default": "CS1" + }, + "ports": { + "type": "array", + "items": { + "type": "object", + "properties": { + "protocol": { + "type": "string", + "enum": [ + "any", + "tcp", + "udp" + ], + "default": "any" + }, + "port": { + "type": "integer" + }, + "range-end": { + "type": "integer" + }, + "reclassify": { + "type": "boolean", + "default": true + } + } + } + }, + "dns": { + "type": "array", + "items": { + "type": "object", + "properties": { + "fqdn": { + "type": "string", + "format": "uc-fqdn" + }, + "suffix-matching": { + "type": "boolean", + "default": true + }, + "reclassify": { + "type": "boolean", + "default": true + } + } + } + } + } + } + } + } + }, + "service.facebook-wifi": { + "type": "object", + "properties": { + "vendor-id": { + "type": "string" + }, + "gateway-id": { + "type": "string" + }, + "secret": { + "type": "string" + } + } + }, + "service.airtime-fairness": { + "type": "object", + "properties": { + "voice-weight": { + "type": "number", + "default": 4 + }, + "packet-threshold": { + "type": "number", + "default": 100 + }, + "bulk-threshold": { + "type": "number", + "default": 50 + }, + "priority-threshold": { + "type": "number", + "default": 30 + }, + "weight-normal": { + "type": "number", + "default": 256 + }, + "weight-priority": { + "type": "number", + "default": 394 + }, + "weight-bulk": { + "type": "number", + "default": 128 + } + } + }, + "service": { + "type": "object", + "properties": { + "lldp": { + "$ref": "#/$defs/service.lldp" + }, + "ssh": { + "$ref": "#/$defs/service.ssh" + }, + "ntp": { + "$ref": "#/$defs/service.ntp" + }, + "mdns": { + "$ref": "#/$defs/service.mdns" + }, + "rtty": { + "$ref": "#/$defs/service.rtty" + }, + "log": { + "$ref": "#/$defs/service.log" + }, + "http": { + "$ref": "#/$defs/service.http" + }, + "igmp": { + "$ref": "#/$defs/service.igmp" + }, + "ieee8021x": { + "$ref": "#/$defs/service.ieee8021x" + }, + "radius-proxy": { + "$ref": "#/$defs/service.radius-proxy" + }, + "online-check": { + "$ref": "#/$defs/service.online-check" + }, + "open-flow": { + "$ref": "#/$defs/service.open-flow" + }, + "data-plane": { + "$ref": "#/$defs/service.data-plane" + }, + "wifi-steering": { + "$ref": "#/$defs/service.wifi-steering" + }, + "quality-of-service": { + "$ref": "#/$defs/service.quality-of-service" + }, + "facebook-wifi": { + "$ref": "#/$defs/service.facebook-wifi" + }, + "airtime-fairness": { + "$ref": "#/$defs/service.airtime-fairness" + } + } + }, + "metrics.statistics": { + "type": "object", + "properties": { + "interval": { + "type": "integer" + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "ssids", + "lldp", + "clients" + ] + } + } + } + }, + "metrics.health": { + "type": "object", + "properties": { + "interval": { + "type": "integer", + "minimum": 60 + } + } + }, + "metrics.wifi-frames": { + "type": "object", + "properties": { + "filters": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "probe", + "auth", + "assoc", + "disassoc", + "deauth", + "local-deauth", + "inactive-deauth", + "key-mismatch", + "beacon-report", + "radar-detected" + ] + } + } + } + }, + "metrics.dhcp-snooping": { + "type": "object", + "properties": { + "filters": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "ack", + "discover", + "offer", + "request", + "solicit", + "reply", + "renew" + ] + } + } + } + }, + "metrics": { + "type": "object", + "properties": { + "statistics": { + "$ref": "#/$defs/metrics.statistics" + }, + "health": { + "$ref": "#/$defs/metrics.health" + }, + "wifi-frames": { + "$ref": "#/$defs/metrics.wifi-frames" + }, + "dhcp-snooping": { + "$ref": "#/$defs/metrics.dhcp-snooping" + } + } + }, + "config-raw": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "string" + }, + "examples": [ + [ + "set", + "system.@system[0].timezone", + "GMT0" + ], + [ + "delete", + "firewall.@zone[0]" + ], + [ + "delete", + "dhcp.wan" + ], + [ + "add", + "dhcp", + "dhcp" + ], + [ + "add-list", + "system.ntp.server", + "0.pool.example.org" + ], + [ + "del-list", + "system.ntp.server", + "1.openwrt.pool.ntp.org" + ] + ] + } + } + } } )"_json; @@ -2630,12 +2639,12 @@ static json DefaultUCentralSchema = R"( return; std::string GitSchema; - if(MicroServiceConfigGetBool("ucentral.datamodel.internal",true)) { + // if(MicroServiceConfigGetBool("ucentral.datamodel.internal",true)) { RootSchema_ = DefaultUCentralSchema; poco_information(Logger(),"Using uCentral validation from built-in default."); Initialized_ = Working_ = true; return; - } + // } try { auto GitURI = MicroServiceConfigGetString("ucentral.datamodel.uri",GitUCentralJSONSchemaFile); @@ -2749,7 +2758,7 @@ static json DefaultUCentralSchema = R"( if(std::regex_match(value,host_regex)) return; throw std::invalid_argument(value + " is not a proper FQDN."); - } else if(format == "fqdn") { + } else if(format == "fqdn" || format=="uc-fqdn") { if(std::regex_match(value,host_regex)) return; throw std::invalid_argument(value + " is not a proper FQDN."); diff --git a/src/framework/MicroService.cpp b/src/framework/MicroService.cpp index 721da32..5112e58 100644 --- a/src/framework/MicroService.cpp +++ b/src/framework/MicroService.cpp @@ -365,6 +365,8 @@ namespace OpenWifi { LoadMyConfig(); + AllowExternalMicroServices_ = ConfigGetBool("allowexternalmicroservices",true); + InitializeSubSystemServers(); ServerApplication::initialize(self); DaemonPostInitialization(self); diff --git a/src/framework/MicroService.h b/src/framework/MicroService.h index 03f1d76..cda0aa3 100644 --- a/src/framework/MicroService.h +++ b/src/framework/MicroService.h @@ -163,6 +163,7 @@ namespace OpenWifi { static void SetSQLLogs(bool UseAsync, bool AllowWebSocket, const std::string & FormatterPattern); static void SetSyslogLogs(bool UseAsync, bool AllowWebSocket, const std::string & FormatterPattern); static void SetFileLogs(bool UseAsync, bool AllowWebSocket, const std::string & FormatterPattern, const std::string & root_env_var); + inline bool AllowExternalMicroServices() const { return AllowExternalMicroServices_; } private: static MicroService * instance_; @@ -193,6 +194,7 @@ namespace OpenWifi { SubSystemVec SubSystems_; bool NoAPISecurity_=false; bool NoBuiltInCrypto_=false; + bool AllowExternalMicroServices_=false; Poco::JWT::Signer Signer_; Poco::Logger &Logger_; Poco::ThreadPool TimerPool_{"timer:pool",2,32}; diff --git a/src/framework/MicroServiceErrorHandler.h b/src/framework/MicroServiceErrorHandler.h index 3a78aba..03de471 100644 --- a/src/framework/MicroServiceErrorHandler.h +++ b/src/framework/MicroServiceErrorHandler.h @@ -102,6 +102,48 @@ namespace OpenWifi { E.displayText(), E.message(), E.what())); + } catch (const Poco::TimeoutException &E) { + poco_error(App_.logger(), fmt::format("Poco::TimeoutException thr_name={} thr_id={} code={} text={} msg={} what={}", + t_name, t_id, E.code(), + E.displayText(), + E.message(), + E.what())); + } catch (const Poco::NoThreadAvailableException &E) { + poco_error(App_.logger(), fmt::format("Poco::NoThreadAvailableException thr_name={} thr_id={} code={} text={} msg={} what={}", + t_name, t_id, E.code(), + E.displayText(), + E.message(), + E.what())); + } catch (const Poco::OutOfMemoryException &E) { + poco_error(App_.logger(), fmt::format("Poco::OutOfMemoryException thr_name={} thr_id={} code={} text={} msg={} what={}", + t_name, t_id, E.code(), + E.displayText(), + E.message(), + E.what())); + } catch (const Poco::BadCastException &E) { + poco_error(App_.logger(), fmt::format("Poco::BadCastException thr_name={} thr_id={} code={} text={} msg={} what={}", + t_name, t_id, E.code(), + E.displayText(), + E.message(), + E.what())); + } catch (const Poco::DataException &E) { + poco_error(App_.logger(), fmt::format("Poco::DataException thr_name={} thr_id={} code={} text={} msg={} what={}", + t_name, t_id, E.code(), + E.displayText(), + E.message(), + E.what())); + } catch (const Poco::PoolOverflowException &E) { + poco_error(App_.logger(), fmt::format("Poco::PoolOverflowException thr_name={} thr_id={} code={} text={} msg={} what={}", + t_name, t_id, E.code(), + E.displayText(), + E.message(), + E.what())); + } catch (const Poco::SystemException &E) { + poco_error(App_.logger(), fmt::format("Poco::SystemException thr_name={} thr_id={} code={} text={} msg={} what={}", + t_name, t_id, E.code(), + E.displayText(), + E.message(), + E.what())); } catch (const Poco::RuntimeException &E) { poco_error(App_.logger(), fmt::format("Poco::RuntimeException thr_name={} thr_id={} code={} text={} msg={} what={}", t_name, t_id, E.code(), diff --git a/src/framework/MicroServiceFuncs.cpp b/src/framework/MicroServiceFuncs.cpp index 590cc9c..193d119 100644 --- a/src/framework/MicroServiceFuncs.cpp +++ b/src/framework/MicroServiceFuncs.cpp @@ -118,4 +118,9 @@ namespace OpenWifi { void MicroServiceDeleteOverrideConfiguration() { return MicroService::instance().DeleteOverrideConfiguration(); } + + bool AllowExternalMicroServices() { + return MicroService::instance().AllowExternalMicroServices(); + } + } diff --git a/src/framework/MicroServiceFuncs.h b/src/framework/MicroServiceFuncs.h index b246b92..aef4d50 100644 --- a/src/framework/MicroServiceFuncs.h +++ b/src/framework/MicroServiceFuncs.h @@ -53,4 +53,5 @@ namespace OpenWifi { std::string MicroServiceSign(Poco::JWT::Token &T, const std::string &Algo); std::string MicroServiceGetPublicAPIEndPoint(); void MicroServiceDeleteOverrideConfiguration(); + bool AllowExternalMicroServices(); } diff --git a/src/framework/RESTAPI_Handler.h b/src/framework/RESTAPI_Handler.h index 1d74b80..17e73de 100644 --- a/src/framework/RESTAPI_Handler.h +++ b/src/framework/RESTAPI_Handler.h @@ -302,7 +302,7 @@ namespace OpenWifi { Response->setChunkedTransferEncoding(true); Response->setContentType("application/json"); auto Origin = Request->find("Origin"); - if (Origin != Request->end()) { + if (Origin != Request->end() && !AllowExternalMicroServices()) { Response->set("Access-Control-Allow-Origin", Origin->second); } else { Response->set("Access-Control-Allow-Origin", "*"); @@ -322,7 +322,7 @@ namespace OpenWifi { Response->setVersion(Poco::Net::HTTPMessage::HTTP_1_1); Response->setChunkedTransferEncoding(true); auto Origin = Request->find("Origin"); - if (Origin != Request->end()) { + if (Origin != Request->end() && !AllowExternalMicroServices()) { Response->set("Access-Control-Allow-Origin", Origin->second); } else { Response->set("Access-Control-Allow-Origin", "*"); @@ -633,6 +633,18 @@ namespace OpenWifi { ReturnObject(Answer); } + template void Object(const char *Name, const std::vector & Objects) { + Poco::JSON::Object Answer; + RESTAPI_utils::field_to_json(Answer,Name,Objects); + ReturnObject(Answer); + } + + template void Object(const T &O) { + Poco::JSON::Object Answer; + O.to_json(Answer); + ReturnObject(Answer); + } + Poco::Logger & Logger() { return Logger_; } virtual void DoGet() = 0 ; diff --git a/src/framework/UI_WebSocketClientServer.cpp b/src/framework/UI_WebSocketClientServer.cpp index 35032bc..912687a 100644 --- a/src/framework/UI_WebSocketClientServer.cpp +++ b/src/framework/UI_WebSocketClientServer.cpp @@ -119,7 +119,7 @@ namespace OpenWifi { } bool UI_WebSocketClientServer::SendToUser(const std::string &UserName, std::uint64_t id, const std::string &Payload) { - std::lock_guard G(Mutex_); + std::lock_guard G(LocalMutex_); for(const auto &Client:Clients_) { if(Client.second->UserName_ == UserName) { @@ -139,7 +139,7 @@ namespace OpenWifi { } void UI_WebSocketClientServer::SendToAll(std::uint64_t id, const std::string &Payload) { - std::lock_guard G(Mutex_); + std::lock_guard G(LocalMutex_); for(const auto &Client:Clients_) { try { @@ -189,7 +189,6 @@ namespace OpenWifi { void UI_WebSocketClientServer::OnSocketReadable([[maybe_unused]] const Poco::AutoPtr &pNf) { UI_WebSocketClientServer::ClientList::iterator Client; - std::lock_guard G(LocalMutex_); try { @@ -295,6 +294,7 @@ namespace OpenWifi { void UI_WebSocketClientServer::OnSocketShutdown([[maybe_unused]] const Poco::AutoPtr &pNf) { try { + std::lock_guard G(LocalMutex_); auto Client = Clients_.find(pNf->socket().impl()->sockfd()); if (Client == end(Clients_)) return; diff --git a/src/framework/ow_constants.h b/src/framework/ow_constants.h index 803c330..ceaf163 100644 --- a/src/framework/ow_constants.h +++ b/src/framework/ow_constants.h @@ -231,7 +231,9 @@ namespace OpenWifi::RESTAPI::Errors { static const struct msg DeviceIsRestricted{1151,"Device is protected by regulation. This function is not allowed."}; static const struct msg InvalidURI{1152,"Invalid URI."}; static const struct msg InvalidScriptSelection{1153,"Only script or scriptId must be specified. Not both."}; -} + + static const struct msg NoDeviceStatisticsYet{1154,"Device statistics not available yet."}; + } @@ -526,6 +528,63 @@ namespace OpenWifi::uCentralProtocol::Events { }; } +namespace OpenWifi::APCommands { + enum class Commands:uint8_t { + capabilities, + logs, + healthchecks, + statistics, + status, + rtty, + configure, + upgrade, + reboot, + factory, + leds, + trace, + request, + wifiscan, + eventqueue, + telemetry, + ping, + script, + unknown + }; + + inline static const std::vector uCentralAPCommands { + RESTAPI::Protocol::CAPABILITIES, + RESTAPI::Protocol::LOGS, + RESTAPI::Protocol::HEALTHCHECKS, + RESTAPI::Protocol::STATISTICS, + RESTAPI::Protocol::STATUS, + RESTAPI::Protocol::RTTY, + RESTAPI::Protocol::CONFIGURE, + RESTAPI::Protocol::UPGRADE, + RESTAPI::Protocol::REBOOT, + RESTAPI::Protocol::FACTORY, + RESTAPI::Protocol::LEDS, + RESTAPI::Protocol::TRACE, + RESTAPI::Protocol::REQUEST, + RESTAPI::Protocol::WIFISCAN, + RESTAPI::Protocol::EVENTQUEUE, + RESTAPI::Protocol::TELEMETRY, + RESTAPI::Protocol::PING, + RESTAPI::Protocol::SCRIPT}; + + inline const char * to_string(Commands Cmd) { + return uCentralAPCommands[(uint8_t)Cmd]; + } + + inline Commands to_apcommand(const char *cmd) { + for(auto i=(uint8_t)Commands::capabilities;i!=(uint8_t)Commands::unknown;++i) { + if(strcmp(uCentralAPCommands[i],cmd)==0) + return (Commands)i; + } + return Commands::unknown; + } + +} + namespace OpenWifi::Provisioning::DeviceClass { static const char * ANY = "any";