Versionen im Vergleich

Schlüssel

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


Deutsch

Beschreibung:

Mit dem folgenden Add-in Skript können Sie Routen zur Konfiguration von LANCOM Geräten mit LCOS hinzufügen.

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
 Funktion zum Anlegen von Routen
    var
addVRRPEntry
 addRoute = function
(routerID, routerIP, mainPrio, backupPrio, remoteSite, comment)
 (DestinationIP, IpMask, RtgTag, AdminDistance, PeerOrIP, Distance, Masquerade, Active, Comment) {
       
var table1_2_8_21_2 =
 var TableRouting = config.getTableByOid("1.2.8.
21.
2"); // Setup/IP-Router/IP-Routing-Table
       
var table_1_2_8_21_2_row_1 = table1_2_8_21_2
 var TableRouting_row = TableRouting.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", "");
    }
};
 TableRouting_row.setByOid(1, DestinationIP);        //[1] IP-Address     : 15 chars from 1234567890.
        TableRouting_row.setByOid(2, IpMask);               //[2] IP-Netmask     : 15 chars from 1234567890.
        TableRouting_row.setByOid(8, RtgTag);               //[8] Rtg-tag        : 5 chars from 1234567890
        TableRouting_row.setByOid(9, AdminDistance);        //[9] Admin-Distance : 3 chars from 1234567890
        TableRouting_row.setByOid(3, PeerOrIP);             //[3] Peer-or-IP     : 21 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789 (lower case characters are converted to upper case)
        TableRouting_row.setByOid(4, Distance);             //[4] Distance       : 2 chars from 1234567890
        TableRouting_row.setByOid(5, Masquerade);           //[5] Masquerade     : No (0), on (1), intranet (2)  - numbers has to be used
        TableRouting_row.setByOid(6, Active);               //[6] Active         : No (1), Yes (0), Semi (2)     - numbers has to be used
        TableRouting_row.setByOid(7, Comment);              //[7] Comment        : 64 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz `
        TableRouting.addOrMerge(TableRouting_row);
    };

    //Anlegen der Routen    
    addRoute("123.123.123", "255.255.255.255", "0", "0", "INTERNET", "0", "1", "0", "Route xy");

}

Add-in als JSON-Datei:

View file
nameadd_routes_lcos.json
height150


Englisch

Description:

Addin als JSON-Datei:

With the following Addin script you can add routes to the configuration of LANCOM devices using LCOS.

...

english

List of used ariables:

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)

{



   
// Funktion zum Anlegen von Routen

 
  var addRoute = function (DestinationIP, IpMask, RtgTag, AdminDistance, PeerOrIP, Distance, Masquerade, Active, Comment) {

     
  
var TableRouting = config.getTableByOid("1.2.8.2"); // Setup/IP-Router/IP-Routing-Table

       
var TableRouting_row = TableRouting.createNewRow();

       
TableRouting_row.setByOid(1, DestinationIP);       
 //[1] IP-Address   
  : 15 chars from 1234567890.

     
  TableRouting_row.setByOid(2, IpMask);             
  //[2] IP-Netmask   
  : 15 chars from 1234567890.

       
TableRouting_row.setByOid(8, RtgTag);               
//[8] Rtg-tag       
 : 5 chars from 1234567890

     
  TableRouting_row.setByOid(9, AdminDistance);       
 //[9] Admin-Distance : 3 chars from 1234567890

       
TableRouting_row.setByOid(3, PeerOrIP);           
  //[3] Peer-or-IP   
  
: 21 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789 (lower case characters are converted to upper case)

     
  
TableRouting_row.setByOid(4, Distance);           
  //[4] Distance     
  : 2 chars from 1234567890

       
TableRouting_row.setByOid(5, Masquerade);           
//[5] Masquerade     
: No (0), on (1), intranet (2) 
 - numbers has to be used 

     
  
TableRouting_row.setByOid(6, Active);           
    //[6] Active         
: No (1), Yes (0), Semi (2)   
  - numbers has to be used

       
TableRouting_row.setByOid(7, Comment);           
   //[7] Comment       
 : 64 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz `

     
  
TableRouting.addOrMerge(TableRouting_row);

   
};


 
  
//Anlegen der Routen   
 
    addRoute("123.123.123", "255.255.255.255", "0", "0", "INTERNET", "0", "1", "0", "Route xy");
}


}

Add-in as JSON file:

View file
nameadd_routes_lcos.json
height250150