Use of the LOOKUP keyword to enable lookup tables

The LOOKUP keyword allows the use of lookup tables and enables the use of a default human-readable return value in the event of a lookup failure.

Example 1

The following example describes a lookup operation on the ifAdminStatus MIB variable, in which ifAdminStatus strings are mapped to their enumerated values.

{
        ifAdminStatus =
        {
                up = 1,
                down = 2,
                testing = 3
        }
}

Example 2

The following eval clause performs a lookup of the enumerated value of the string up within this record and returns a value of 1. The default return value in the event of a lookup failure is NULL.

eval( text, 'LOOKUP( ’up’,&ifAdminStatus )'

Example 3

In this clause, no default human-readable return value in the event of a lookup failure has been provided. This is therefore equivalent to the eval clause shown below:

eval( text, ( ’&ifAdminStatus->up’ )

Example 4

The following eval clause performs a lookup of the enumerated value of the string dummy within this record and provides the option of a default human-readable return value. The string dummy does not exist in the record and therefore this clause returns the defined human-readable return value of unknown.

eval( text, 'LOOKUP( ’dummy’,&ifAdminStatus, ’unknown’)'