Oid vs Script
As shown in the Configuration Process, we have two ways of manipulating the configuration of a device with Add-Ins.
- by Object Id (Oid): this modifies the config data provided by the previous config concepts
- by Script-Lines: this is sent to and executed on the device itself
- by API Method: send requests to the API for UF Add-ins
config.[...]ByOid(...) |
config.addScriptLine(...) |
ufAPI.Method |
|
---|---|---|---|
LCOS | ✅ | ✅* | ❌ |
LCOS-SX | ✅ | ✅* | ❌ |
LCOS-LX | ✅ | ❌ | ❌ |
LCOS-FX | ❌ | ❌ | ✅ |
*
device specific terminal syntax
Object Id (Oid)
Each configuration value or table is specified by a machine readable Object Id, short oid. The oid is a sequence of numbers separated by dots (the following example denots the cron-table):
1.2.11.20
To modify the configuration data you can either get/set single values (scalars) or tables/rows.
Scalars
Scalars are single values in the configuration.
exports.main = function (config, context) {
var value = config.getScalarByOid("1.2.3.4.5.1");
config.setScalarByOid("1.2.3.4.5.2", "test");
};
Tables
Tables can have a fixed or a dynamic number of rows.
exports.main = function (config, context) {
var table = config.getTableByOid("1.2.3.4.5.3");
var rows = table.getRows(); // array of rows
var row = table.createNewRow(); //create a new empty row
table.addOrMerge(row); // add/merge this row into table
};
Script-Line
To execute a script on the device after applying the configuration you need to use the addScriptLine
syntax:
exports.main = function (config, context) {
config.addScriptLine("cd /2/3/4/5/2");
config.addScriptLine("set 1 test");
};
The example above sets the same value as the scalar example above. The first number is ommitted, as well as the .
translated to /
compared to the oid notation.
In this case we will not see the values in the UI in the detailed config when previewing, but in the preview of the script that will be executed on the device.
In contrast to the setting of values via oid, we can also use the humane readble notation, e.g. config.addScriptLine("cd /Setup/WAN/DSL-Broadband-Peers")
.