Previous section.

Inter-domain Management: Specification Translation

Inter-domain Management: Specification Translation
Copyright © 1997 The Open Group

Mapping of SNMPv1 Traps

SNMPv1 Traps

Although the mapping of tables for SNMPv2 can also be applied to the SNMPv1 specs, the same can not be said for SNMPv1 traps. The SNMP-to-IDL mapping addresses the MIB specification written for SNMPv2.

SNMPv1 traps definitions are different from SNMPv2 Notification in specification as well as in the PDU structure. In SNMPv1, traps are defined using TRAP-TYPE macros (see TRAP-TYPE Macro in SNMPv1 ) which are described in RFC1215.


ourcompany OBJECT IDENTIFIER ::= { enterprises 9999 }
myAlarm TRAP-TYPE
ENTERPRISE ourcompany
VARIABLES { alarmReason }
DESCRIPTION ""
::= 1


Table: TRAP-TYPE Macro in SNMPv1

The SNMPv1Trap.idl file (see SNMPv1Trap.idl File ) is defined to support conversion of traps in SNMPv1 to OMG Event Services specification and vice-versa. This file describes data types (SNMPv1_TrapInfo) and interfaces (SNMPv1_Notification and PullSNMPv1_Notification) to support conversion of SNMPv1 traps to untyped events in the CORBA domain.

The data types are defined based on the data structure of Trap PDU in SNMPv1 and the TRAP-TYPE macro defined in RFC1215. A CORBA-based object implementation can ignore the first two parameters of SNMPv1_TrapInfo (agent_ip_address and community_name) of the event information. In that case, the CORBA/SNMP gateway must set them before forwarding an event in the CORBA domain as a trap in the SNMP domain.

Mapping of TRAP-TYPE Macro in SNMPv1

The mapping of TRAP-TYPE macro for SNMPv1 specification to IDL operation is similar to the mapping of NOTIFICATION-TYPE macro in SNMPv2 specification. In both cases, a set of operations are generated within the scope of the SnmpNotifications and the PullSnmpNotifications interfaces. The VARIABLES clause is mapped in the same way as the OBJECTS clause in the NOTIFICATION-TYPE macro. Since the TRAP-TYPE macro does not assign any OID to the trap definition, an OID is created based on the ENTERPRISE clause and the integer value of the macro. The other difference is that the parameters of the IDL operation are generated based on the SNMPv1 Trap PDU as described in Mapping of SNMPv1 Traps .

Deriving Repository ID of IDL Operations for Traps

It is necessary to assign a repository ID for IDL operations for Traps using #pragma ID, such that it is possible to recover the information about the enterprise and the specific trap type in the SNMP domain from a trap originated in the CORBA domain.

The repository ID is derived based on the value of the ENTERPRISE clause of the TRAP-TYPE macro and the integer value of the invocation of the macro. The repository ID is formed using the following format.

"<enterprise-oid>.Traps.<trap-type-macro-value>::<push|pull|try>"

Mapping of TRAP-TYPE Macros for Generic Traps

In order to support SNMPv1 generic traps using typed interfaces for event communication in the CORBA domain, a set of operations are defined based on the usage examples in section 2.2.2 of RFC1215.

Example: Generic Traps

The following example illustrates the mapping of the TRAP-TYPE macros (as defined in RFC1215) for generic traps. Although the Repository ID for the generic traps are defined based on Deriving Repository ID of IDL Operations for Traps , it is necessary to convert the enterprise oid to the sysObjectID (as described in section 2.1.1 of RFC1215) at the gateway. Thus, a CORBA/SNMP gateway has to detect if a trap in the SNMP domain or event in the CORBA domain is based on a generic trap before forwarding it to the other domain. Since the ENTERPRISE clause of a generic trap is always RFC1213.snmp (1.3.6.1.2.1.11), it is easy to detect if an event is based on a generic trap by looking at the Repository ID of the operations in the CORBA domain. Similarly if the generic-trap in an SNMPv1 PDU is one of the generic trap types, it can easily generate the Repository ID of the corresponding IDL operation from the SNMPv1 Trap-PDU.
SNMPv1-GenericTraps DEFINITIONS ::= BEGIN
 ....
coldStart NOTIFICATION-TYPE
    ENTERPRISE snmp
    DESCRIPTION
    "A coldStart trap signifies that the
        SNMPv2 entity, acting in an agent role,
        is reinitializing itself such that its
        configuration may be altered."
    ::= 0
    
warmStart NOTIFICATION-TYPE
    ENTERPRISE snmp
    DESCRIPTION
    "A warmStart trap signifies that the
        SNMPv2 entity, acting in an agent role,
        is reinitializing itself such that its
        configuration is unaltered."
    ::= 1
    
linkDown NOTIFICATION-TYPE
    ENTERPRISE snmp
    VARIABLES { ifIndex }
    DESCRIPTION
    "A linkDown trap signifies that the
        SNMPv2 entity, acting in an agent role,
        recognizes a failure in one of the
        communication links represented in its
        configuration."
    ::= 2
    
linkUp NOTIFICATION-TYPE
    ENTERPRISE snmp
    VARIABLES { ifIndex }
    DESCRIPTION
    "A linkUp trap signifies that the
        SNMPv2 entity, acting in an agent role,
        recognizes that one of the communication
        links represented in its configuration
        has come up."
    ::= 3

    ....
END

maps to the following IDL:

// File name is SNMPv1_GenericTraps.idl
module SNMPv1_GenericTraps
{
 ..............
  struct IfIndexType {
    ASN1_ObjectIdentifier var_name;
      // IDL Scoped-Name of the object
    ASN1_ObjectIdentifier var_index;
      // Only Instance Info part
    ASN1_INTEGER var_value;
  };

  struct LinkDownType {
    IfIndexType ifIndex;
  };

  struct LinkUpType {
    IfIndexType ifIndex;
  };

  interface SnmpNotifications {
    // for typed-push event communication
    void coldStart (
      in string agent_ip_address,
      in string community_name,
      in ASN1_ObjectIdentifier snmp_context,
      in RFC1155_SMI::TimeTicksType event_time
    );
    #pragma ID coldStart "1.3.6.1.2.1.11.Traps.0::push"

    void warmStart (
      in string agent_ip_address,
      in string community_name,
      in RFC1155_SMI::TimeTicksType event_time
    );
    #pragma ID warmStart "1.3.6.1.2.1.11.Traps.1::push"

    void linkDown (
      in string agent_ip_address,
      in string community_name,
      in RFC1155_SMI::TimeTicksType event_time,
      in LinkDownType notification_info
    );
    #pragma ID linkDown "1.3.6.1.2.1.11.Traps.2::push"

    void linkUp (
      in string agent_ip_address,
      in string community_name,
      in RFC1155_SMI::TimeTicksType event_time,
      in LinkUpType notification_info
    );
    #pragma ID linkUp "1.3.6.1.2.1.11.Traps.3::push"
  };

  interface PullSnmpNotifications {
    // for typed-pull event communication
    void pull_coldStart (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time
    );
    #pragma ID pull_coldStart "1.3.6.1.2.1.11.Traps.0::pull"

    boolean try_coldStart (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time
    );
    #pragma ID try_coldStart "1.3.6.1.2.1.11.Traps.0::try"

    void pull_warmStart (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time
    );
    #pragma ID pull_warmStart "1.3.6.1.2.1.11.Traps.1::pull"

    boolean try_warmStart (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time
    );
    #pragma ID try_warmStart "1.3.6.1.2.1.11.Traps.1::try"

    void pull_linkdown (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time,
      out LinkDownType notification_info
    );
    #pragma ID pull_linkDown "1.3.6.1.2.1.11.Traps.2::pull"

    boolean try_linkdown (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time,
      out LinkDownType notification_info
    );
    #pragma ID try_linkDown "1.3.6.1.2.1.11.Traps.2::try"

    void pull_linkUp (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time,
      out LinkUpType notification_info
    );
    #pragma ID pull_linkUp "1.3.6.1.2.1.11.Traps.3::pull"

    boolean try_linkUp (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time,
      out LinkUpType notification_info
    );
    #pragma ID try_linkUp "1.3.6.1.2.1.11.Traps.3::try"
  };
}; // End of module SNMPv2_MIB

Example: Enterprise-specific Trap

The following example illustrates the mapping of the enterprise-specific traps in SNMPv1 information modules.
SNMPv1-TrapExamples DEFINITIONS ::= BEGIN
  ....
  ourcompany OBJECT IDENTIFIER
        ::= { enterprises 9999 }
  myAlarm TRAP-TYPE -- notice that they use
                    -- a TRAP-TYPE macro
    ENTERPRISE ourcompany
  VARIABLES { alarmReason }
  DESCRIPTION ""
        ::= 1 -- Repository ID of this trap
              -- is derived by concatenating
              -- the OID in ENTERPRISE clause,
              -- "Traps" string,
              -- and the Id number
END

maps to:


module SNMPv1_TrapExamples
{
  typedef sequence<octet, 255> DisplayString;
  struct AlarmReasonType {
          // Derived from variables in Object Clause
    ASN1_ObjectIdentifier var_name;
          // IDL Scoped-Name of the object
    ASN1_ObjectIdentifier var_index;
          // Only Instance Info part 
    DisplayString var_value;
  };
  struct MyAlarmType {
          // Derived from variables in Object Clause
    AlarmReasonType alarmReason;
  };

  interface SnmpNotifications {
          // for typed-push event communication
    void myAlarm (
      in string agent_ip_address,
      in string community_name,
      in RFC1155_SMI::TimeTicksType event_time,
      in MyAlarmType notification_info
    );
    #pragma ID myAlarm "1.3.6.1.4.1.11.9999.Traps.1::push"
  };

  interface PullSnmpNotifications {
    // follow the SNMPv2 notification
    // macro mapping for operations in
    // PullSnmpNotifications interface.
    void pull_myAlarm (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time,
      out MyAlarmType notification_info
    );
    #pragma ID pull_myAlarm "1.3.6.1.4.1.11.9999.Traps.1::pull"
        
      boolean try_myAlarm (
      out string agent_ip_address,
      out string community_name,
      out RFC1155_SMI::TimeTicksType event_time,
      out MyAlarmType notification_info
    );
    #pragma ID try_myAlarm "1.3.6.1.4.1.11.9999.Traps.1::try"
  };
}; // End of SNMPv1_TrapExamples module

Why not acquire a nicely bound hard copy?
Click here to return to the publication details or order a copy of this publication.

Contents Next section Index