mirror of
https://github.com/Telecominfraproject/ols-ucentral-schema.git
synced 2025-10-29 17:22:23 +00:00
renderer: add facebook-wifi support
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
48
renderer/templates/services/facebook_wifi.uc
Normal file
48
renderer/templates/services/facebook_wifi.uc
Normal file
@@ -0,0 +1,48 @@
|
||||
{% if (!services.is_present("fbwifi")) return %}
|
||||
{% let interfaces = services.lookup_interfaces("facebook-wifi") %}
|
||||
{% let enable = length(interfaces) %}
|
||||
{% services.set_enabled("fbwifi", enable) %}
|
||||
{% if (!enable) return %}
|
||||
|
||||
# Facebook-wifi service configuration
|
||||
|
||||
set fbwifi.main.enabled=1
|
||||
set fbwifi.main.zone={{ s(ethernet.calculate_name(interfaces[0])) }}
|
||||
set fbwifi.main.gateway_token='FBWIFI:GATEWAY|{{ facebook_wifi.vendor_id }}|{{ facebook_wifi.gateway_id }}|{{ facebook_wifi.secret }}'
|
||||
|
||||
set uhttpd.main=uhttpd
|
||||
add_list uhttpd.main.listen_http='0.0.0.0:80'
|
||||
add_list uhttpd.main.listen_http='[::]:80'
|
||||
add_list uhttpd.main.listen_https='0.0.0.0:443'
|
||||
add_list uhttpd.main.listen_https='[::]:443'
|
||||
set uhttpd.main.redirect_https='0'
|
||||
set uhttpd.main.home='/www'
|
||||
set uhttpd.main.max_requests='3'
|
||||
set uhttpd.main.max_connections='100'
|
||||
set uhttpd.main.cgi_prefix='/cgi-bin'
|
||||
add_list uhttpd.main.lua_prefix='/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua'
|
||||
set uhttpd.main.script_timeout='60'
|
||||
set uhttpd.main.network_timeout='30'
|
||||
set uhttpd.main.http_keepalive='20'
|
||||
set uhttpd.main.tcp_keepalive='1'
|
||||
set uhttpd.main.cert='/tmp/fbwifi/https_server_cert'
|
||||
set uhttpd.main.key='/tmp/fbwifi/https_server_key'
|
||||
set uhttpd.main.json_script='/usr/share/fbwifi/uhttpd.json'
|
||||
set uhttpd.main.rfc1918_filter='0'
|
||||
|
||||
set firewall.fbwifi=include
|
||||
set firewall.fbwifi.enabled=1
|
||||
set firewall.fbwifi.family=ipv4
|
||||
set firewall.fbwifi.path=/usr/share/fbwifi/firewall.include
|
||||
set firewall.fbwifi.reload=1
|
||||
set firewall.fbwifi.type=script
|
||||
|
||||
set uhttpd.fbwifi_redirect=uhttpd
|
||||
set uhttpd.fbwifi_redirect.enabled=1
|
||||
set uhttpd.fbwifi_redirect.listen_http='0.0.0.0:2060'
|
||||
set uhttpd.fbwifi_redirect.listen_https='0.0.0.0:2061'
|
||||
set uhttpd.fbwifi_redirect.cert='/tmp/fbwifi/https_server_cert'
|
||||
set uhttpd.fbwifi_redirect.key='/tmp/fbwifi/https_server_key'
|
||||
set uhttpd.fbwifi_redirect.json_script='/tmp/fbwifi/uhttpd-redirect.json'
|
||||
|
||||
add_list dhcp.@dnsmasq[0].rebind_domain=fbwifigateway.net
|
||||
16
schema/service.facebook-wifi.yml
Normal file
16
schema/service.facebook-wifi.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
description:
|
||||
This section describes the FaceBook Wifi behaviour of the unit.
|
||||
type: object
|
||||
properties:
|
||||
vendor-id:
|
||||
description:
|
||||
The Vendors ID.
|
||||
type: string
|
||||
gateway-id:
|
||||
description:
|
||||
The Gateways ID.
|
||||
type: string
|
||||
secret:
|
||||
description:
|
||||
The Device specific secret
|
||||
type: string
|
||||
@@ -33,5 +33,7 @@ properties:
|
||||
$ref: "https://ucentral.io/schema/v1/service/wifi-steering/"
|
||||
quality-of-service:
|
||||
$ref: "https://ucentral.io/schema/v1/service/quality-of-service/"
|
||||
facebook-wifi:
|
||||
$ref: "https://ucentral.io/schema/v1/service/facebook-wifi/"
|
||||
airtime-policies:
|
||||
$ref: "https://ucentral.io/schema/v1/service/airtime-policies/"
|
||||
|
||||
@@ -4762,6 +4762,52 @@ function instantiateServiceQualityOfService(location, value, errors) {
|
||||
return value;
|
||||
}
|
||||
|
||||
function instantiateServiceFacebookWifi(location, value, errors) {
|
||||
if (type(value) == "object") {
|
||||
let obj = {};
|
||||
|
||||
function parseVendorId(location, value, errors) {
|
||||
if (type(value) != "string")
|
||||
push(errors, [ location, "must be of type string" ]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
if (exists(value, "vendor-id")) {
|
||||
obj.vendor_id = parseVendorId(location + "/vendor-id", value["vendor-id"], errors);
|
||||
}
|
||||
|
||||
function parseGatewayId(location, value, errors) {
|
||||
if (type(value) != "string")
|
||||
push(errors, [ location, "must be of type string" ]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
if (exists(value, "gateway-id")) {
|
||||
obj.gateway_id = parseGatewayId(location + "/gateway-id", value["gateway-id"], errors);
|
||||
}
|
||||
|
||||
function parseSecret(location, value, errors) {
|
||||
if (type(value) != "string")
|
||||
push(errors, [ location, "must be of type string" ]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
if (exists(value, "secret")) {
|
||||
obj.secret = parseSecret(location + "/secret", value["secret"], errors);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
if (type(value) != "object")
|
||||
push(errors, [ location, "must be of type object" ]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function instantiateServiceAirtimePolicies(location, value, errors) {
|
||||
if (type(value) == "object") {
|
||||
let obj = {};
|
||||
@@ -4875,6 +4921,10 @@ function instantiateService(location, value, errors) {
|
||||
obj.quality_of_service = instantiateServiceQualityOfService(location + "/quality-of-service", value["quality-of-service"], errors);
|
||||
}
|
||||
|
||||
if (exists(value, "facebook-wifi")) {
|
||||
obj.facebook_wifi = instantiateServiceFacebookWifi(location + "/facebook-wifi", value["facebook-wifi"], errors);
|
||||
}
|
||||
|
||||
if (exists(value, "airtime-policies")) {
|
||||
obj.airtime_policies = instantiateServiceAirtimePolicies(location + "/airtime-policies", value["airtime-policies"], errors);
|
||||
}
|
||||
|
||||
@@ -1815,6 +1815,20 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"service.facebook-wifi": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"vendor-id": {
|
||||
"type": "string"
|
||||
},
|
||||
"gateway-id": {
|
||||
"type": "string"
|
||||
},
|
||||
"secret": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"service.airtime-policies": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1881,6 +1895,9 @@
|
||||
"quality-of-service": {
|
||||
"$ref": "#/$defs/service.quality-of-service"
|
||||
},
|
||||
"facebook-wifi": {
|
||||
"$ref": "#/$defs/service.facebook-wifi"
|
||||
},
|
||||
"airtime-policies": {
|
||||
"$ref": "#/$defs/service.airtime-policies"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user