This script changes the parameters from the network that was configured in the network definition of the LMC, namely exactly that on which the script was applied. Select networks from the LMC e.g. always LAN-1
off, with the script it is possible to change that. In addition, an if
loop was built into this software script, which sets different values depending on the device. For example, if you use your own network name, instead of context.network.configNameLong
, the network is also created and does not adapt the parameters from the LMC network.
exports.main = function (config, context) {
var networkList = config.getTableByOid("1.2.7.30");
if (context.device.type.indexOf("1793") >= 0
|| context.device.type.indexOf("1790") >= 0
|| context.device.type.indexOf("4000") >= 0
|| context.device.type.indexOf("vRouter") >= 0) {
var row = networkList.createNewRow();
row.setByOid("1", context.network.configNameLong);
row.setByOid("2", context.location.gatewayIp);
row.setByOid("3", context.location.subnetMask);
row.setByOid("4", context.network.tag);
row.setByOid("5", "259");
row.setByOid("6", "0");
row.setByOid("7", "1");
row.setByOid("8", context.network.tag);
row.setByOid("9", "");
networkList.addOrMerge(row);
} else if (context.device.type.indexOf("1906") >= 0) {
var row = networkList.createNewRow();
row.setByOid("1", context.network.configNameLong);
row.setByOid("2", context.location.gatewayIp);
row.setByOid("3", context.location.subnetMask);
row.setByOid("4", context.network.tag);
row.setByOid("5", "257");
row.setByOid("6", "0");
row.setByOid("7", "1");
row.setByOid("8", context.network.tag);
row.setByOid("9", "");
networkList.addOrMerge(row);
}
};
|
---|