Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Seiteneigenschaften


Deutsch

Beschreibung:

Dieses Skript ändert die Parameter von dem Netzwerk, das in der Netzwerkdefinition der LMC konfiguriert wurde, nämlich genau das, auf das das Skript angewendet wurde. Wählen Netzwerke aus der LMC z.B. immer LAN-1 aus, so ist es mit dem Skript möglich, das zu ändern.

Zusätzlich wurde in dieses Software-Skript eine if-Schleife eingebaut, die je nach Gerät unterschiedliche Werte setzt. Wenn Sie z.B. statt context.network.configNameLong Ihren eigenen Netzwerknamen verwenden, wird das Netzwerk auch angelegt und passt die Parameter aus dem LMC-Netzwerk nicht an.

Liste der verwendeten Variablen:

VariableBeschreibung




Add-

In

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) {
    // Function to create VRRP Entry
    var addVRRPEntry = function (routerID, routerIP, mainPrio, backupPrio, remoteSite, comment) {
        var table1_2_8_21_2 = config.getTableByOid("1.2.8.21.2");
        var table_1_2_8_21_2_row_1 = table1_2_8_21_2.createNewRow();
        table_1_2_8_21_2_row_1.setByOid(1, routerID);
        table_1_2_8_21_2_row_1.setByOid(2, routerIP);
        table_1_2_8_21_2_row_1.setByOid(3, mainPrio);
        table_1_2_8_21_2_row_1.setByOid(4, backupPrio);
        table_1_2_8_21_2_row_1.setByOid(5, remoteSite);
        table_1_2_8_21_2_row_1.setByOid(6, comment);
        table1_2_8_21_2.addOrMerge(table_1_2_8_21_2_row_1);
    };
    // If Statement to only create VRRP Entry, if device has the variable VRRP_Prio
    if (context.vars.VRRP_PRIO != "") {
        config.setScalarByOid("1.2.8.21.1", "1");
        // Function Call to create a new Entry
        addVRRPEntry("1", "10.10.10.254", context.vars.VRRP_PRIO, "0", "INTERNET", "");
    }
};

Addin als JSON-Datei:

View file
namereconfigure_network.json
height150


english
Englisch

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 =
{
    // Function to create VRRP Entry
    var addVRRPEntry = function (routerID, routerIP, mainPrio, backupPrio, remoteSite, comment) {
        var table1_2_8_21_2 = config.getTableByOid("1.2.
7
8.21.
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)
2");
        var table_1_2_8_21_2_row_1 = table1_2_8_21_2.createNewRow();
        table_1_2_8_21_2_row_1.setByOid(1, routerID);
        table_1_2_8_21_2_row_1.setByOid(2, routerIP);
        table_1_2_8_21_2_row_1.setByOid(3, mainPrio);
        table_1_2_8_21_2_row_1.setByOid(4, backupPrio);
        table_1_2_8_21_2_row_1.setByOid(5, remoteSite);
        table_1_2_8_21_2_row_1.setByOid(6, comment);
        table1_2_8_21_2.addOrMerge(table_1_2_8_21_2_row_1);
    };
    // If Statement to only create VRRP Entry, if device has the variable VRRP_Prio
    if (context.vars.VRRP_PRIO != "") {
        config.setScalarByOid("1.2.8.21.1", "1");
        // Function Call to create a new Entry
        addVRRPEntry("1", "10.10.10.254", context.vars.VRRP_PRIO, "0", "INTERNET", "");
    }
};

Addin as JSON file:

View file
namereconfigure_network.json
height150