LUALoriotPro WEB site

LoriotPro scripting documentation
Extensions for LUA language

Table of contents Search function

Print the current page Mail this  link UTUBE Channel version française

lp.GetBRC - Perform a SNMP Get with VLAN context

value,buffer = lp.GetBRC(ip,"oid",vlanid);

Description

Perform a SNMP GET of a single object "oid" on the specified IP addresse in the specified VLAN number

This function is used in Cisco VLAN architecture to query object of a specific MIB instance

Parameters

ip - This is a character string of the IP address x.x.x.x. This address should be imperatively defined in the LoriotPro directory

"oid" - This is a character string of the SNMP oid to query. This OID should be imperatively define in the LoriotPro MIB database (the MIB tree)

vlanid - The VLAN number

Return Values

value                         The numeric value if the SNMP ‘oid’ is a integer/gauge… else 0 if it is a string. 

‘buffer’                       The result of the SNMP GET as a character string. 

’doted_iod’       The MIB object in ‘doted’ format(1.3.2.3…) 

’name_oid’        The name of the MIB object.

nil                      Nil if an error occurs.

Example

In the following example we collecte the list of VLAN on a Cisco switch. We use after this list to collecte information on VLAN.

-- function to collect VLAN List

function GetVlanTab(ip,tab)

a=lp.GetRows(ip,"vtpvlantype,vtpvlanname","Vlan");

      if a~=nil then

            for j=0,(a-1) do

                  tab["vlantype-"..j]=Vlan["vtpvlantype-"..j];

                  tab["vlanname-"..j]=Vlan["vtpvlanname-"..j];

                  tab["vlan-"..j]=string.sub(Vlan["I-"..j],4);

            end

            return a;

      end

      return 0;

end

----- start

tab={};

a=GetVlanTab(lp_host,tab);

 

      if a~= nil then

            for j=0,(a-1) do

            --result=FindSWIfFromMac(ip,tab["vlan-"..j]);

            zz=tab["vlan-"..j];

            lp.Print("Found Vlan : ",zz," type : ", tab["vlantype-"..j],"\n");

           value,buffer,doted,nominal=lp.GetBRC(lp_host,"dot1dbasetype.0",zz);

       lp.Print("Value received : ",value,"\n");

       lp.Print("buffer received : ",buffer,"\n");

       lp.Print("doted received : ",doted,"\n");

       lp.Print("nominal received : ",nominal,"\n");

 

            end

      else

            lp.Print("No Vlan Found\n");

            return 1;

      end

 

get in vlan context


www.loriotpro.com