Description: 

With the following Addin script you can configure RSTP on a LANCOM XS-51xx / XS-61xx or GS-45xx series switch.

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) {



    config.addScriptLine( "configure" );                                 // switch to configure mode
    config.addScriptLine( "spanning-tree mode rstp" );                   // activates RSTP

    // Set the Priority and Failover Link
    if (config.getScalarByOid( "2.1.5" ) == "SIFI-SW50" )                     // IF Device Name
    {
        config.addScriptLine( "spanning-tree mst priority 0 12288" );     // setzt die bridge priority auf 3000 (HEX) // für RZ/Labor
        //config.addScriptLine ("spanning-tree mst priority 0 20480");    // setzt die bridge priority auf 5000 (HEX) // für Distris an Schulen

        //config.addScriptLine ("interface 1/0/20");
        //config.addScriptLine ("spanning-tree cost 5000");               // set external transport cost 5000 on Port 1/0/1
        //config.addScriptLine ("exit");                                  // exit interface
    }

    // Set the Priority and Failover Link
    if (config.getScalarByOid( "2.1.5" ) == "Konfigverteiler" )                     // IF Device Name
    {
        config.addScriptLine( "spanning-tree mst priority 0 12288" );     // setzt die bridge priority auf 3000 (HEX) // für RZ/Labor
        //config.addScriptLine ("spanning-tree mst priority 0 20480");    // setzt die bridge priority auf 5000 (HEX) // für Distris an Schulen

        //config.addScriptLine ("interface 1/0/20");
        //config.addScriptLine ("spanning-tree cost 5000");               // set external transport cost 5000 on Port 1/0/1
        //config.addScriptLine ("exit");                                  // exit interface
    }

    config.addScriptLine( "exit" );                                     // exit configure mode

};

Add-in as JSON file:

rstp_xs_switches.json