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
ourcompany OBJECT IDENTIFIER ::= { enterprises 9999 } |
---|
myAlarm TRAP-TYPE |
ENTERPRISE ourcompany |
VARIABLES { alarmReason } |
DESCRIPTION "" |
::= 1 |
The SNMPv1Trap.idl file (see
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.
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>"
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
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:
Contents | Next section | Index |