Description:

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.

List of used variables:

VariableDescription




Add-in code:

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {



    // /Setup/TCP-IP/Network-list/
    var networkList = config.getTableByOid("1.2.7.30");

    if (context.device.type.indexOf("1793") >= 0         // filter specific device type(s)
        || 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); //Netzwerkname
        row.setByOid("2", context.location.gatewayIp);     //IP-Addresse
        row.setByOid("3", context.location.subnetMask);    //IP-Netzmaske
        row.setByOid("4", context.network.tag);            //VLAN-ID
        row.setByOid("5", "259");                          //Schnittstelle (Siehe unten)
        row.setByOid("6", "0");                            //Quellprüfung (strict (1), loose (0))
        row.setByOid("7", "1");                            //Schnittstellentyp (1 = INTRANET)
        row.setByOid("8", context.network.tag);            //Rtg-Tag
        row.setByOid("9", "");                             //Kommentar
        networkList.addOrMerge(row);
    } else if (context.device.type.indexOf("1906") >= 0) { // filter specific device type(s)

        var row = networkList.createNewRow();
        row.setByOid("1", context.network.configNameLong); //Netzwerkname
        row.setByOid("2", context.location.gatewayIp);     //IP-Addresse
        row.setByOid("3", context.location.subnetMask);    //IP-Netzmaske
        row.setByOid("4", context.network.tag);            //VLAN-ID
        row.setByOid("5", "257");                          //Schnittstelle (Siehe unten)
        row.setByOid("6", "0");                            //Quellprüfung (strict (1), loose (0))
        row.setByOid("7", "1");                            //Schnittstellentyp (Disabled (0), Intranet (1), DMZ (2))
        row.setByOid("8", context.network.tag);            //Rtg-Tag
        row.setByOid("9", "");                             //Kommentar
        networkList.addOrMerge(row);
    }
};

//[  5] Interface    :  LAN-1 (256), LAN-2 (257), LAN-3 (258), LAN-4 (259)
//      WLC-TUNNEL-1 (1792), WLC-TUNNEL-2 (1793), WLC-TUNNEL-3 (1794), WLC-TUNNEL-4 (1795), WLC-TUNNEL-5 (1796), WLC-TUNNEL-6 (1797), WLC-TUNNEL-7 (1798), WLC-TUNNEL-8 (1799)
//      WLC-TUNNEL-9 (1800), WLC-TUNNEL-10 (1801), WLC-TUNNEL-11 (1802), WLC-TUNNEL-12 (1803), WLC-TUNNEL-13 (1804), WLC-TUNNEL-14 (1805), WLC-TUNNEL-15 (1806), WLC-TUNNEL-16 (1807)
//      WLC-TUNNEL-AUTOWDS (1824), GRE-TUNNEL-1 (2304), GRE-TUNNEL-2 (2305), GRE-TUNNEL-3 (2306), GRE-TUNNEL-4 (2307), GRE-TUNNEL-5 (2308), GRE-TUNNEL-6 (2309), GRE-TUNNEL-7 (2310)
//      GRE-TUNNEL-8 (2311), BUNDLE-1 (2048), BUNDLE-2 (2049), L2TP-ETHERNET-1 (2560), L2TP-ETHERNET-2 (2561), L2TP-ETHERNET-3 (2562), L2TP-ETHERNET-4 (2563), L2TP-ETHERNET-5 (2564)
//      L2TP-ETHERNET-6 (2565), L2TP-ETHERNET-7 (2566), L2TP-ETHERNET-8 (2567), L2TP-ETHERNET-9 (2568), L2TP-ETHERNET-10 (2569), L2TP-ETHERNET-11 (2570), L2TP-ETHERNET-12 (2571)
//      L2TP-ETHERNET-13 (2572), L2TP-ETHERNET-14 (2573), L2TP-ETHERNET-15 (2574), L2TP-ETHERNET-16 (2575), XDSL-1 (2816), BRG-1 (1536), BRG-2 (1537), BRG-3 (1538), BRG-4 (1539)
//      BRG-5 (1540), BRG-6 (1541), BRG-7 (1542), BRG-8 (1543), any (65535)

Addin as JSON file:

reconfigure_network.json