Change Masquerading Settings in Routing Table
With the following Addin script you can change the masquerading settings in the routing table of LCOS routers.
Needed Variable: context.vars.RoutingTablePeer
/**
* @param {Config} config
* @param {Context} context
* Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {
if (context.device.isGateway) {
// Auslesen der Routen mit Gegenstelle Internet
var rows = config.getTableByOid("1.2.8.2").getRows();
// turn result into a list for filtering below:
var list = [];
for (var i = 0; i < rows.length; i++) {
list.push(rows[i]);
}
// Ändern der Maskierung zu un-maskiert
list.filter(function (row) {
// find matching rows
var peer = row.getByOid("3");
return peer == context.vars.RoutingTablePeer;
}).forEach(function (row) {
row.setByOid(5, "2");
});
}
};