EnumerationLookup()

The EnumerationLookup(); rule retrieves a value from the DNCIM enumeration table. The data in the enumeration table is downloaded when the Discovery engine, ncp_disco, is first started and then accessed directly by the rule, thereby enabling fast data retrieval.

The enumerations available for lookup are determined by the entry in the dbModel.access table within the ModelNcimDb.cfg configuration file; for example:
insert into dbModel.access
(
    EnumGroupFilter,
    TransactionLength,
    WebTopDataSource
)
values
(
    "enumGroup in ('ASN' , 'sysServices', 'ifAdminStatus', 'ifOperStatus', 'sysServices', 'ifType', 'ifOperStatusToOperationalStatus','entPhysicalClass', 'cefcFRUPowerAdminStatus', 'cefcFRUPowerOperStatus', 'TruthValue','TruthValueString', 'entSensorType', 'entSensorScale', 'entSensorStatus', 'cefcModuleAdminStatus', 'cefcModuleOperStatus', 'ipForwarding', 'cefcPowerRedundancyMode', 'EntityType', 'ospfIfState', 'ospfIfType', 'dot3StatsDuplexStatus', 'accessProtocol', 'cdmDuplex', 'OperationalStatusEnum')",
    0,
    "NCOMS"
);

Syntax

The EnumerationLookup(); statement uses the following syntax.

EnumerationLookup ( evalClause ] );

Arguments

The following table lists the properties of the arguments of this stitcher rule.
Table 1. Arguments of EnumerationLookup();
Argument Description Accepts constants Accepts variables Accepts eval clauses
evalClause Defines the details for the lookup eval statement. Yes For the first argument. No
The full definition of evalClause is as follows:
resultStr = EnumerationLookup( eval(text, 'LOOKUP( $key, &&enum _group [ , optional_default ] )') );
Where:
  • key is the value to use to perform the enumeration string lookup operation.
  • enum _group is the name of enumeration group to look in.
  • optional_default is the value to use if the lookup operation returns null.

Example

The following examples show how to use this rule.

text protocol = NULL;
protocol = EnumerationLookup( eval(text, 'LOOKUP( &m_LocalNbr->m_Protocol, &&accessProtocol, `IPv4`)') );

int keyVal = 1; text truthStr = NULL; truthStr = EnumerationLookup( eval(text, 'LOOKUP( $keyVal, &&TruthValueString )') );

int ifType = 6; text ifTypeString = NULL; ifTypeString = EnumerationLookup( eval(text, 'LOOKUP( $ifType, &&ifType )') );
Note: This rule does not use the standard record stack. Normally the ampersand sign & accesses the record at the top of the stack, double ampersand && the second from top, triple ampersand &&& the third, and so on. With this rule the record stack used only contains two records; therefore, the ampersand & refers to the record on the top of the normal stack as before, but double ampersand && refers to the record containing the static enumeration data downloaded when discovery was first started.

Returns

This rule returns the text string relating to the desired enumeration.