From 222afd7d267e59fbf0c38b331ca9572e5c0efa2a Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 19 Sep 2021 11:59:06 +0200 Subject: [PATCH] schema: implement missing pass-point functionality Signed-off-by: John Crispin --- schema/interface.ssid.pass-point.yml | 56 +++++++++ schemareader.uc | 162 +++++++++++++++++++++++++++ ucentral.schema.json | 47 +++++++- 3 files changed, 264 insertions(+), 1 deletion(-) diff --git a/schema/interface.ssid.pass-point.yml b/schema/interface.ssid.pass-point.yml index 8efeced..77e763e 100644 --- a/schema/interface.ssid.pass-point.yml +++ b/schema/interface.ssid.pass-point.yml @@ -87,6 +87,62 @@ properties: type: array items: type: string + access-network-type: + description: + Indicate the type of network. This is part of the interworking IE. + type: integer + maximum: 15 + default: 0 + internet: + description: + Whether the network provides connectivity to the Internet + type: boolean + default: true + asra: + description: + Additional Step Required for Access. + type: boolean + default: false + esr: + description: + Emergency services reachable. + type: boolean + default: false + uesa: + description: + Unauthenticated emergency service accessible. + type: boolean + default: false + hessid: + description: + Homogeneous ESS identifier + type: string + example: 00:11:22:33:44:55 + roaming-consortium: + description: + Roaming Consortium OIs can be configured here. Each OI is between 3 and 15 + octets and is configured as a hexstring. + type: array + items: + type: string + disable-dgaf: + description: + Disable Downstream Group-Addressed Forwarding. This can be used to configure + a network where no group-addressed frames are allowed. + type: boolean + default: false + ipaddr-type-available: + description: + IP Address Type Availability. + type: integer + maximum: 255 + connection-capability: + description: + This can be used to advertise what type of IP traffic can be sent through the + hotspot. + type: array + items: + type: string icons: description: The operator icons. diff --git a/schemareader.uc b/schemareader.uc index 3a70fde..4d2fba5 100644 --- a/schemareader.uc +++ b/schemareader.uc @@ -2941,6 +2941,168 @@ function instantiateInterfaceSsidPassPoint(location, value, errors) { obj.friendly_name = parseFriendlyName(location + "/friendly-name", value["friendly-name"], errors); } + function parseAccessNetworkType(location, value, errors) { + if (type(value) in [ "int", "double" ]) { + if (value > 15) + push(errors, [ location, "must be lower than or equal to 15" ]); + + } + + if (type(value) != "int") + push(errors, [ location, "must be of type integer" ]); + + return value; + } + + if (exists(value, "access-network-type")) { + obj.access_network_type = parseAccessNetworkType(location + "/access-network-type", value["access-network-type"], errors); + } + else { + obj.access_network_type = 0; + } + + function parseInternet(location, value, errors) { + if (type(value) != "bool") + push(errors, [ location, "must be of type boolean" ]); + + return value; + } + + if (exists(value, "internet")) { + obj.internet = parseInternet(location + "/internet", value["internet"], errors); + } + else { + obj.internet = true; + } + + function parseAsra(location, value, errors) { + if (type(value) != "bool") + push(errors, [ location, "must be of type boolean" ]); + + return value; + } + + if (exists(value, "asra")) { + obj.asra = parseAsra(location + "/asra", value["asra"], errors); + } + else { + obj.asra = false; + } + + function parseEsr(location, value, errors) { + if (type(value) != "bool") + push(errors, [ location, "must be of type boolean" ]); + + return value; + } + + if (exists(value, "esr")) { + obj.esr = parseEsr(location + "/esr", value["esr"], errors); + } + else { + obj.esr = false; + } + + function parseUesa(location, value, errors) { + if (type(value) != "bool") + push(errors, [ location, "must be of type boolean" ]); + + return value; + } + + if (exists(value, "uesa")) { + obj.uesa = parseUesa(location + "/uesa", value["uesa"], errors); + } + else { + obj.uesa = false; + } + + function parseHessid(location, value, errors) { + if (type(value) != "string") + push(errors, [ location, "must be of type string" ]); + + return value; + } + + if (exists(value, "hessid")) { + obj.hessid = parseHessid(location + "/hessid", value["hessid"], errors); + } + + function parseRoamingConsortium(location, value, errors) { + if (type(value) == "array") { + function parseItem(location, value, errors) { + if (type(value) != "string") + push(errors, [ location, "must be of type string" ]); + + return value; + } + + return map(value, (item, i) => parseItem(location + "/" + i, item, errors)); + } + + if (type(value) != "array") + push(errors, [ location, "must be of type array" ]); + + return value; + } + + if (exists(value, "roaming-consortium")) { + obj.roaming_consortium = parseRoamingConsortium(location + "/roaming-consortium", value["roaming-consortium"], errors); + } + + function parseDisableDgaf(location, value, errors) { + if (type(value) != "bool") + push(errors, [ location, "must be of type boolean" ]); + + return value; + } + + if (exists(value, "disable-dgaf")) { + obj.disable_dgaf = parseDisableDgaf(location + "/disable-dgaf", value["disable-dgaf"], errors); + } + else { + obj.disable_dgaf = false; + } + + function parseIpaddrTypeAvailable(location, value, errors) { + if (type(value) in [ "int", "double" ]) { + if (value > 255) + push(errors, [ location, "must be lower than or equal to 255" ]); + + } + + if (type(value) != "int") + push(errors, [ location, "must be of type integer" ]); + + return value; + } + + if (exists(value, "ipaddr-type-available")) { + obj.ipaddr_type_available = parseIpaddrTypeAvailable(location + "/ipaddr-type-available", value["ipaddr-type-available"], errors); + } + + function parseConnectionCapability(location, value, errors) { + if (type(value) == "array") { + function parseItem(location, value, errors) { + if (type(value) != "string") + push(errors, [ location, "must be of type string" ]); + + return value; + } + + return map(value, (item, i) => parseItem(location + "/" + i, item, errors)); + } + + if (type(value) != "array") + push(errors, [ location, "must be of type array" ]); + + return value; + } + + if (exists(value, "connection-capability")) { + obj.connection_capability = parseConnectionCapability(location + "/connection-capability", value["connection-capability"], errors); + } + function parseIcons(location, value, errors) { if (type(value) == "array") { function parseItem(location, value, errors) { diff --git a/ucentral.schema.json b/ucentral.schema.json index d4b4ab6..ff0ecbf 100644 --- a/ucentral.schema.json +++ b/ucentral.schema.json @@ -104,7 +104,7 @@ "type": "object", "patternProperties": { ".+": { - "$ref": "#/interface/ssid/encryption", + "$ref": "#/$defs/interface.ssid.encryption", "additionalProperties": false } } @@ -1147,6 +1147,51 @@ "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": {