Profiles
Vendor Lua hooks for devices manager (TR-069 and USP CPEs).
How Lua scripts are executed by Oktopus: Scripts
Profiles define the mapping between device-specific data models (TR-069/USP) and the Oktopus common API, enabling QoE analysis and dynamic UI generation.
Function Contract
All Lua hooks should return two values:
-- success
return value, nil
-- failure
return nil, "error message"Notes:
For
get_*payload builders, return CWMP XML asstring.For
parse_*, return a Lua table compatible with expected Go resource structs.For metadata/capabilities, return string/boolean/table depending on function.
Shared Helper (optional)
local function response_to_map(response)
local out = {}
for _, param in ipairs(response.list or {}) do
out[param.name] = param.value
end
return out
endFunctions
get_vendor()
Returns the vendor label used by the API.
Protocol:
CWMP and USP
Params:
None.
Return:
value:stringerr:nilorstring
Example:
get_data_model()
Returns the data model handled by the script.
Protocol:
CWMP
Params:
None.
Return:
value:string(for example:TR-098,TR-181)err:nilorstring
Example:
get_device_capabilities()
Defines which resources/features are enabled for this model.
Protocol:
CWMP and USP
Params:
None.
Return:
value:tablewith capability keyserr:nilorstring
Example:
get_device_specs()
Defines device behavior details (for example traceroute wait time).
Protocol:
CWMP and USP
Params:
None.
Return:
value:tableerr:nilorstring
Example:
is_real_time()
Indicates whether this model should be treated as real-time for operations.
Protocol:
CWMP
Params:
None.
Return:
value:booleanerr:nilorstring
Example:
get_radio()
Builds CWMP payload to fetch radio data.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(CWMP XML)err:nilorstring
Example:
parse_radio(response)
Parses CWMP response into radio resource list.
Protocol:
CWMP and USP
Params:
response[table]CWMP response (response.list)
Return:
value:table([]Radio)err:nilorstring
Example:
set_radio(radios)
Builds CWMP payload to update radio configuration.
Protocol:
CWMP and USP
Params:
radios[table]radio list
Return:
value:string(CWMP XML)err:nilorstring
Example:
get_ssid()
Builds CWMP payload to fetch SSID data.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(CWMP XML)err:nilorstring
Example:
parse_ssid(response)
Parses CWMP response into SSID resource list.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table([]Ssid)err:nilorstring
Example:
set_ssid(ssids)
Builds CWMP payload to update SSID configuration.
Protocol:
CWMP and USP
Params:
ssids[table]
Return:
value:string(CWMP XML)err:nilorstring
Example:
get_site_survey_diagnostic_state()
Returns site survey diagnostic state.
Protocol:
CWMP and USP
Params:
None.
Return:
value:stringerr:nilorstring
Example:
set_site_survey_diagnostic_state()
Sets site survey diagnostic state to Requested.
Protocol:
USP
Params:
None.
Return:
value:stringerr:nilorstring
Example:
get_site_survey_results()
Builds payload to fetch site survey results.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_site_survey(response)
Parses site survey result set.
Protocol:
CWMP e USP
Params:
response[table]
Return:
value:table(map[string][]NeighborSites)err:nilorstring
Example:
get_connected_devices()
Builds payload to fetch connected devices.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_connected_devices(response)
Parses connected devices response.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table(ConnectedDevices)err:nilorstring
Example:
set_speed_test(test)
Builds payload to configure speed test.
Protocol:
CWMP and USP
Params:
test[table]
Return:
value:string(XML)err:nilorstring
Example:
get_speed_test_result(speed_test_type)
Builds payload to fetch speed test result.
Protocol:
CWMP and USP
Params:
speed_test_type[string](downloadorupload)
Return:
value:string(XML)err:nilorstring
Example:
parse_get_speed_test_result(speed_test_type, response)
Parses speed test result.
Protocol:
CWMP and USP
Params:
speed_test_type[string]response[table]
Return:
value:table(Speedtest)err:nilorstring
Example:
get_download_diagnostic_state()
Returns download diagnostic state path or state marker for the model.
Protocol:
CWMP
Params:
None.
Return:
value:stringerr:nilorstring
Example:
get_upload_diagnostic_state()
Returns upload diagnostic state path or state marker for the model.
Protocol:
CWMP
Params:
None.
Return:
value:stringerr:nilorstring
Example:
get_statistics()
Builds payload to fetch statistics.
Protocol:
CWMP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_statistics(response)
Parses statistics response.
Protocol:
CWMP
Params:
response[table]
Return:
value:table(map[string][]Stats)err:nilorstring
Example:
get_interface_wan()
Builds payload to fetch WAN interfaces.
Protocol:
CWMP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
get_interface_lan()
Builds payload to fetch LAN interfaces.
Protocol:
CWMP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_interface_wan(response)
Parses WAN interfaces response.
Params:
response[table]
Return:
value:table(map[string]Port)err:nilorstring
Example:
parse_get_interface_lan(response)
Parses LAN interfaces response.
Protocol:
CWMP
Params:
response[table]
Return:
value:table(map[string]Port)err:nilorstring
Example:
get_wan_options()
Returns WAN configuration options supported by the model.
Protocol:
CWMP
Params:
None.
Return:
value:table([]WanOptions)err:nilorstring
Example:
get_port()
Builds payload to fetch TR-098/TR-181 ports.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_port(response)
Parses TR-098/TR-181 ports response.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table(map[string]Port)err:nilorstring
Example:
set_port(ports)
Builds payload to update port configuration.
Protocol:
CWMP and USP
Params:
ports[table]
Return:
value:string(XML)err:nilorstring
Example:
add_port(port)
Builds payload to add a new port/object.
Protocol:
CWMP
Params:
port[table]
Return:
value:string(XML)err:nilorstring
Example:
get_bridge()
Builds payload to fetch bridge data.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_bridge(response)
Parses bridge response.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table([]Bridge)err:nilorstring
Example:
set_bridge(bridges)
Builds payload to update bridge configuration.
Protocol:
CWMP and USP
Params:
bridges[table]
Return:
value:string(XML)err:nilorstring
Example:
get_ping()
Builds payload to fetch ping diagnostics config.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_ping(response)
Parses ping diagnostics config.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table(Ping)err:nilorstring
Example:
get_ping_diagnostic_state()
Returns ping diagnostic state path/state.
Protocol:
CWMP and USP
Params:
None.
Return:
value:stringerr:nilorstring
Example:
set_ping(ping)
Builds payload to execute/update ping diagnostics.
Protocol:
CWMP and USP
Params:
ping[table]
Return:
value:string(XML)err:nilorstring
Example:
get_ping_result()
Builds payload to fetch ping result.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_ping_result(response)
Parses ping result response.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table(PingResult)err:nilorstring
Example:
get_traceroute()
Builds payload to fetch traceroute diagnostics config.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_traceroute(response)
Parses traceroute diagnostics config.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table(Traceroute)err:nilorstring
Example:
get_traceroute_diagnostic_state()
Returns traceroute diagnostic state path/state.
Protocol:
CWMP and USP
Params:
None.
Return:
value:stringerr:nilorstring
Example:
set_traceroute(traceroute)
Builds payload to execute/update traceroute diagnostics.
Protocol:
CWMP and USP
Params:
traceroute[table]
Return:
value:string(XML)err:nilorstring
Example:
get_traceroute_result_number_of_hops()
Returns the parameter path/state used to read hop count.
Protocol:
CWMP
Params:
None.
Return:
value:stringerr:nilorstring
Example:
get_traceroute_result(number_of_hops)
Builds payload to fetch traceroute hop details.
Protocol:
CWMP and USP
Params:
number_of_hops[integer]
Return:
value:string(XML)err:nilorstring
Example:
parse_get_traceroute_result(response)
Parses traceroute result response.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table(TracerouteResult)err:nilorstring
Example:
get_hwinfo()
Builds payload to fetch hardware information.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_hwinfo(response)
Parses hardware information response.
Protocol:
CWMP
Params:
response[table]
Return:
value:table(Hwinfo)err:nilorstring
Example:
get_pon()
Builds payload to fetch PON information.
Protocol:
CWMP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_pon(response)
Parses PON information response.
Protocol:
CWMP
Params:
response[table]
Return:
value:table(Pon)err:nilorstring
Example:
get_voice()
Builds payload to fetch voice accounts/lines.
Protocol:
CWMP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_voice(response)
Parses voice data response.
Protocol:
CWMP
Params:
response[table]
Return:
value:table([]Voice)err:nilorstring
Example:
set_voice(voice)
Builds payload to update voice profile settings.
Protocol:
CWMP
Params:
voice[table]
Return:
value:string(XML)err:nilorstring
Example:
set_line(line)
Builds payload to update voice line settings.
Protocol:
CWMP
Params:
line[table]
Return:
value:string(XML)err:nilorstring
Example:
get_cellular()
Builds payload to fetch cellular information.
Protocol:
CWMP and USP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_get_cellular(response)
Parses cellular information response.
Protocol:
CWMP and USP
Params:
response[table]
Return:
value:table([]Cellular)err:nilorstring
Example:
set_cellular(cellular)
Builds payload to update cellular settings.
Protocol:
CWMP and USP
Params:
cellular[table]
Return:
value:string(XML)err:nilorstring
Example:
get_xdsl()
Builds payload to fetch xDSL information.
Protocol:
CWMP
Params:
None.
Return:
value:string(XML)err:nilorstring
Example:
parse_xdsl(response)
Parses xDSL information response.
Protocol:
CWMP
Params:
response[table]
Return:
value:table([]XDSL)err:nilorstring
Example:
Last updated
Was this helpful?