Versionen im Vergleich

Schlüssel

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

...

Deutsch

Beschreibung:

Mit dem folgenden Add-in Skript können Sie SNMP (SNMPv1, SNMPv2 oder SNMPv3) auf Access Points mit LCOS LX konfigurieren.

Liste der verwendeten Variablen:

VariableBeschreibung




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.setScalarByOid("13.2.9.37", "6"); //enable SNMPv2 and SNMPv3

    // Do not change the following functions !

    // function to create a SNMP Community
    var createSnmpCommunity = function (Name, SecurityName, Status) {
        var SNMPCommunity = config.getTableByOid("13.2.9.27");
        var SNMPCommunityEntry = SNMPCommunity.createNewRow();
        SNMPCommunityEntry.setByOid("1", Name);
        SNMPCommunityEntry.setByOid("3", SecurityName);
        SNMPCommunityEntry.setByOid("8", Status);                       // Active (1), Inactive (2)
        SNMPCommunity.addOrMerge(SNMPCommunityEntry);
    }

    // function to create a SNMP Group
    var createSnmpGroup = function (SecurityModel, SecurityName, GroupName, Status) {
        var SNMPGroup = config.getTableByOid("13.2.9.28");
        var SNMPGroupEntry = SNMPGroup.createNewRow();
        SNMPGroupEntry.setByOid("1", SecurityModel);                  // Any // Any (0), (0), SNMPv1 (1), SNMPv2_C (2), SNMPv3_USM (3)
        SNMPGroupEntry.setByOid("2", SecurityName);
        SNMPGroupEntry.setByOid("3", GroupName);
        SNMPGroupEntry.setByOid("5", Status);                         // Active (1), Inactive (2)
        SNMPGroup.addOrMerge(SNMPGroupEntry);
    }

    // function to create a SNMP Views
    var createSnmpViews = function (ViewsName, OidSubtree, Type, Status) {
        var SNMPViews = config.getTableByOid("13.2.9.30");
        var SNMPViewsEntry = SNMPViews.createNewRow();
        SNMPViewsEntry.setByOid("1", ViewsName);
        SNMPViewsEntry.setByOid("3", OidSubtree);
        SNMPViewsEntry.setByOid("4", Type);                         // Included (1), Excluded (2)
        SNMPViewsEntry.setByOid("6", Status);                       // Active (1), Inactive (2)
        SNMPViewsSNMPViews.addOrMerge(SNMPViewsEntry);
    }

    // function to create a SNMP Accesses
    var createSnmpAccesses = function (GroupName, SecurityModel, MinSecurityLevel, ReadViewName, WriteViewName, NotifyViewName, Status) {
        var SNMPAccesses = config.getTableByOid("13.2.9.29");
        var SNMPAccessesEntry = SNMPAccesses.createNewRow();
        SNMPAccessesEntry.setByOid("1", GroupName);
        SNMPAccessesEntry.setByOid("3", SecurityModel);             // // Any (0), SNMPv1 (1), SNMPv2_C (2), SNMPv3_USM (3)
        SNMPAccessesEntry.setByOid("10", MinSecurityLevel);         // NoAuthNoPriv (0), AuthNoPriv (1), AuthPriv (3)
        SNMPAccessesEntry.setByOid("5", ReadViewName);
        SNMPAccessesEntry.setByOid("6", WriteViewName);
        SNMPAccessesEntry.setByOid("7", NotifyViewName);
        SNMPAccessesEntry.setByOid("8", Status);                    // Active (1), Inactive (2)
        SNMPAccesses.addOrMerge(SNMPAccessesEntry);
    }

    // function to create a SNMP User
    var createSnmpUser = function (UserName, AuthenticationProtocol, AuthenticationPasswordType, AuthenticationPassword, PrivacyProtocol, PrivacyPasswordType, PrivacyPassword, Status) {
        var SNMPUseres = config.getTableByOid("13.2.9.32");
        var SNMPUserEntry = SNMPUser.createNewRow();
        SNMPUserEntrySNMPUserEntry.setByOid("2", UserName);
        SNMPUserEntry.setByOid("5", AuthenticationProtocol);        // None (1), HMAC-MD5 (2), HMAC-SHA (3), HMAC-SHA224 (4), HMAC-SHA256 (5), HMAC-SHA384 (6), HMAC-SHA512 (7)
        SNMPUserEntry.setByOid("14", AuthenticationPasswordType);   // Plaintext (1), Masterkey (2)
        SNMPUserEntry.setByOid("6", AuthenticationPassword);
        SNMPUserEntry.setByOid("8", PrivacyProtocol);               // None (1), DES (2), AES128 (3), AES192 (20), AES256 (21)
        SNMPUserEntry.setByOid("15", PrivacyPasswordType);          // Plaintext (1), Masterkey (2)
        SNMPUserEntry.setByOid("9", PrivacyPassword);
        SNMPUserEntry.setByOid("13", Status);                        // Active (1), Inactive (2)
      SNMPUser.  SNMPUser.addOrMerge(SNMPUserEntry);
    }

    // function to create a SNMP Target Adresses
    var createSnmpTargetAdresses = function (Name, TransportAddress, ParameterName, Status) {
        var SNMPTargetAdresses = config.getTableByOid("13.2.9.34");
        var SNMPTargetAdressesEntry = SNMPTargetAdresses.createNewRow();
        SNMPTargetAdressesEntry.setByOid("1", Name);
        SNMPTargetAdressesEntry.setByOid("3", TransportAddress);
        SNMPTargetAdressesEntrySNMPTargetAdressesEntry.setByOid("7", ParameterName);
        SNMPTargetAdressesEntry.setByOid("9", Status);              // Active (1), Inactive (2)
        SNMPTargetAdresses.addOrMerge(SNMPTargetAdressesEntry);
    }

    // function to create a SNMP Target Params
    var createSnmpTargetParams = function (Name, MessageProcessingModel, SecurityModel, SecurityName, SecurityLevel, Status) {
        var SNMPTargetParams = config.getTableByOid("13.2.9.35");
        var SNMPTargetParamsEntry = SNMPTargetParams.createNewRow();
        SNMPTargetParamsEntry.setByOid("1", Name);
        SNMPTargetParamsEntry.setByOid("2", MessageProcessingModel);    // SNMPv1 (0), SNMPv2_C (1), SNMPv3 (3)
        SNMPTargetParamsEntry.setByOid("3", SecurityModel);             // Any (0), SNMPv1 (1), SNMPv2_C (2), SNMPv3_USM (3)
        SNMPTargetParamsEntry.setByOid("4", SecurityName);
        SNMPTargetParamsEntrySNMPTargetParamsEntry.setByOid("5", SecurityLevel);             // NoAuthNoPriv (0), AuthNoPriv (1), AuthPriv (3)
        SNMPTargetParamsEntry.setByOid("7", Status);                    // Active (1), Inactive (2)
        SNMPTargetParams.addOrMerge(SNMPTargetParamsEntry);
    }

    // After this command you can call the functions and fill them with data

    createSnmpCommunity("Name", "SecurityName", "Status");
    createSnmpGroup("SecurityModel", "SecurityName", "GroupName", "Status");
    createSnmpViews("ViewsName", "OidSubtree", "Type", "Status");
    createSnmpAccesses("GroupName", "SecurityModel", "MinSecurityLevel", "ReadViewName", "WriteViewName", "NotifyViewName", "Status");
    createSnmpUser("UserName", "AuthenticationProtocol", "AuthenticationPasswordType", "AuthenticationPassword", "PrivacyProtocol", "PrivacyPasswordType", "PrivacyPassword", "Status");
    createSnmpTargetAdresses("Name", "TransportAddress", "ParameterName", "Status");
    createSnmpTargetParams("Name", "MessageProcessingModel", "SecurityModel", "SecurityName", "SecurityLevel", "Status");
};

Add-in als JSON-Datei:

View file
nameLX_SNMP.json
height150

...

Englisch

Description:

With the following Add-in script you can configure SNMP (SNMPv1, SNMPv2 or SNMPv3) on Access Points using LCOS LX.

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.setScalarByOid("13.2.9.37",
"6");
//enable
SNMPv2
and
SNMPv3
SNMPv3

    //
Do
not
change
the
following
functions
!
!

    //
function
to
create
a
SNMP
Community var createSnmpCommunity = function
Community
    var createSnmpCommunity = function (Name,
SecurityName,
Status)
{ var SNMPCommunity =
{
        varSNMPCommunity = config.getTableByOid("13.2.9.27");
var SNMPCommunityEntry =

        varSNMPCommunityEntry = SNMPCommunity.createNewRow();

        SNMPCommunityEntry.setByOid("1",
Name);

        SNMPCommunityEntry.setByOid("3",
SecurityName);

        SNMPCommunityEntry.setByOid("8",
Status);
// Active
                      // Active (1),
Inactive
(2)

        SNMPCommunity.addOrMerge(SNMPCommunityEntry);
} // function to create a SNMP Group var createSnmpGroup = function (SecurityModel, SecurityName, GroupName, Status) { var SNMPGroup =

    }

    // function to create a SNMP Group
    var createSnmpGroup = function (SecurityModel, SecurityName, GroupName, Status) {
        varSNMPGroup = config.getTableByOid("13.2.9.28");
var SNMPGroupEntry =

        varSNMPGroupEntry = SNMPGroup.createNewRow();

        SNMPGroupEntry.setByOid("1",
SecurityModel);
// Any
                 // Any (0),
SNMPv1
(1),
SNMPv2_C
(2),
SNMPv3_USM
(3)

        SNMPGroupEntry.setByOid("2",
SecurityName);

        SNMPGroupEntry.setByOid("3",
GroupName);

        SNMPGroupEntry.setByOid("5",
Status);
// Active
                        // Active (1),
Inactive
(2)

        SNMPGroup.addOrMerge(SNMPGroupEntry);
} // function to create a SNMP Views var createSnmpViews = function (ViewsName, OidSubtree, Type, Status) { var SNMPViews =

    }

    // function to create a SNMP Views
    var createSnmpViews = function (ViewsName, OidSubtree, Type, Status) {
        varSNMPViews = config.getTableByOid("13.2.9.30");
var SNMPViewsEntry =

        varSNMPViewsEntry = SNMPViews.createNewRow();

        SNMPViewsEntry.setByOid("1",
ViewsName);

        SNMPViewsEntry.setByOid("3",
OidSubtree);

        SNMPViewsEntry.setByOid("4",
Type);
// Included
                        // Included (1),
Excluded
(2)

        SNMPViewsEntry.setByOid("6",
Status);
// Active
                      // Active (1),
Inactive
(2)

        SNMPViews.addOrMerge(SNMPViewsEntry);
} // function to create a SNMP Accesses var createSnmpAccesses = function (GroupName, SecurityModel, MinSecurityLevel, ReadViewName, WriteViewName, NotifyViewName, Status) { var SNMPAccesses =

    }

    // function to create a SNMP Accesses
    var createSnmpAccesses = function (GroupName, SecurityModel, MinSecurityLevel, ReadViewName, WriteViewName, NotifyViewName, Status) {
        varSNMPAccesses = config.getTableByOid("13.2.9.29");
var SNMPAccessesEntry =

        varSNMPAccessesEntry = SNMPAccesses.createNewRow();

        SNMPAccessesEntry.setByOid("1",
GroupName);

        SNMPAccessesEntry.setByOid("3",
SecurityModel);
// Any
            // Any (0),
SNMPv1
(1),
SNMPv2_C
(2),
SNMPv3_USM
(3)

        SNMPAccessesEntry.setByOid("10",
MinSecurityLevel);
        //
NoAuthNoPriv
(0),
AuthNoPriv
(1),
AuthPriv
(3)

        SNMPAccessesEntry.setByOid("5",
ReadViewName);

        SNMPAccessesEntry.setByOid("6",
WriteViewName);

        SNMPAccessesEntry.setByOid("7",
NotifyViewName);

        SNMPAccessesEntry.setByOid("8",
Status);
// Active
                   // Active (1),
Inactive
(2)

        SNMPAccesses.addOrMerge(SNMPAccessesEntry);
} // function to create a SNMP User var createSnmpUser = function (UserName, AuthenticationProtocol, AuthenticationPasswordType, AuthenticationPassword, PrivacyProtocol, PrivacyPasswordType, PrivacyPassword, Status) { var SNMPUseres =

    }

    // function to create a SNMP User
    var createSnmpUser = function (UserName, AuthenticationProtocol, AuthenticationPasswordType, AuthenticationPassword, PrivacyProtocol, PrivacyPasswordType, PrivacyPassword, Status) {
        varSNMPUseres = config.getTableByOid("13.2.9.32");
var SNMPUserEntry =

        varSNMPUserEntry = SNMPUser.createNewRow();

        SNMPUserEntry.setByOid("2",
UserName);

        SNMPUserEntry.setByOid("5",
AuthenticationProtocol);
       //
None
(1),
HMAC-MD5
(2),
HMAC-SHA
(3),
HMAC-SHA224
(4),
HMAC-SHA256
(5),
HMAC-SHA384
(6),
HMAC-SHA512
(7)

        SNMPUserEntry.setByOid("14",
AuthenticationPasswordType);
  //
Plaintext
(1),
Masterkey
(2)

        SNMPUserEntry.setByOid("6",
AuthenticationPassword);

        SNMPUserEntry.setByOid("8",
PrivacyProtocol);
// None
              // None (1),
DES
(2),
AES128
(3),
AES192
(20),
AES256
(21)

        SNMPUserEntry.setByOid("15",
PrivacyPasswordType);
         //
Plaintext
(1),
Masterkey
(2)

        SNMPUserEntry.setByOid("9",
PrivacyPassword);

        SNMPUserEntry.setByOid("13",
Status);
// Active
                       // Active (1),
Inactive
(2)

        SNMPUser.addOrMerge(SNMPUserEntry);
} // function to create a SNMP Target Adresses var createSnmpTargetAdresses = function (Name, TransportAddress, ParameterName, Status) { var SNMPTargetAdresses =

    }

    // function to create a SNMP Target Adresses
    var createSnmpTargetAdresses = function (Name, TransportAddress, ParameterName, Status) {
        varSNMPTargetAdresses = config.getTableByOid("13.2.9.34");
var SNMPTargetAdressesEntry =

        varSNMPTargetAdressesEntry = SNMPTargetAdresses.createNewRow();

        SNMPTargetAdressesEntry.setByOid("1",
Name);

        SNMPTargetAdressesEntry.setByOid("3",
TransportAddress);

        SNMPTargetAdressesEntry.setByOid("7",
ParameterName);

        SNMPTargetAdressesEntry.setByOid("9",
Status);
// Active
             // Active (1),
Inactive
(2)

        SNMPTargetAdresses.addOrMerge(SNMPTargetAdressesEntry);
} // function to create a SNMP Target Params var createSnmpTargetParams = function (Name, MessageProcessingModel, SecurityModel, SecurityName, SecurityLevel, Status) { var SNMPTargetParams =

    }

    // function to create a SNMP Target Params
    var createSnmpTargetParams = function (Name, MessageProcessingModel, SecurityModel, SecurityName, SecurityLevel, Status) {
        varSNMPTargetParams = config.getTableByOid("13.2.9.35");
var SNMPTargetParamsEntry =

        varSNMPTargetParamsEntry = SNMPTargetParams.createNewRow();

        SNMPTargetParamsEntry.setByOid("1",
Name);

        SNMPTargetParamsEntry.setByOid("2",
MessageProcessingModel);
   //
SNMPv1
(0),
SNMPv2_C
(1),
SNMPv3
(3)

        SNMPTargetParamsEntry.setByOid("3",
SecurityModel);
// Any
            // Any (0),
SNMPv1
(1),
SNMPv2_C
(2),
SNMPv3_USM
(3)

        SNMPTargetParamsEntry.setByOid("4",
SecurityName);

        SNMPTargetParamsEntry.setByOid("5",
SecurityLevel);
// NoAuthNoPriv
            // NoAuthNoPriv (0),
AuthNoPriv
(1),
AuthPriv
(3)

        SNMPTargetParamsEntry.setByOid("7",
Status);
// Active
                   // Active (1),
Inactive
(2)

        SNMPTargetParams.addOrMerge(SNMPTargetParamsEntry);
} // After this command you can call the functions and fill them with data

    }

    // After this command you can call the functions and fill them with data

    createSnmpCommunity("Name",
"SecurityName",
"Status");

    createSnmpGroup("SecurityModel",
"SecurityName",
"GroupName",
"Status");

    createSnmpViews("ViewsName",
"OidSubtree",
"Type",
"Status");

    createSnmpAccesses("GroupName",
"SecurityModel",
"MinSecurityLevel",
"ReadViewName",
"WriteViewName",
"NotifyViewName",
"Status");

    createSnmpUser("UserName",
"AuthenticationProtocol",
"AuthenticationPasswordType",
"AuthenticationPassword",
"PrivacyProtocol",
"PrivacyPasswordType",
"PrivacyPassword",
"Status");

    createSnmpTargetAdresses("Name",
"TransportAddress",
"ParameterName",
"Status");

    createSnmpTargetParams("Name",
"MessageProcessingModel",
"SecurityModel",
"SecurityName",
"SecurityLevel",
"Status");

};

Addin as JSON file:

View file
nameLX_SNMP.json
height150

...