From d9e63bfb1a4a452ad8eb7a9e62d5127a666e2845 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 4 Feb 2013 19:08:56 +0100 Subject: [snmp/compiler] MIB compiler did not handle forward index ref The MIB compiler could not handle a table index refering to an object defined later in the MIB. --- lib/snmp/src/compile/snmpc.erl | 51 ++++++++++++++++++++++++++++++++++---- lib/snmp/src/compile/snmpc_lib.erl | 35 +++++++++++++++++++------- 2 files changed, 72 insertions(+), 14 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index 5e6b81f1ec..b238214798 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -562,8 +562,10 @@ definitions_loop([{#mc_object_type{name = NameOfTable, units = Eunits}, {ColMEs, RestObjs} = define_cols(ColsEtc, 1, FieldList, NameOfEntry, NameOfTable, []), + AfterIdxTypes = after_indexes_type(IndexingInfo, RestObjs), + after_indexes_type(IndexingInfo, RestObjs), TableInfo = snmpc_lib:make_table_info(Eline, NameOfTable, - IndexingInfo, ColMEs), + IndexingInfo, AfterIdxTypes, ColMEs), snmpc_lib:add_cdata(#cdata.mes, [TableEntryME, TableME#me{assocList=[{table_info, @@ -644,8 +646,9 @@ definitions_loop([{#mc_object_type{name = NameOfTable, units = Eunits}, {ColMEs, RestObjs} = define_cols(ColsEtc, 1, FieldList, NameOfEntry, NameOfTable, []), + AfterIdxTypes = after_indexes_type(IndexingInfo, RestObjs), TableInfo = snmpc_lib:make_table_info(Eline, NameOfTable, - IndexingInfo, ColMEs), + IndexingInfo, AfterIdxTypes, ColMEs), snmpc_lib:add_cdata(#cdata.mes, [TableEntryME, TableME#me{assocList=[{table_info, @@ -720,8 +723,9 @@ definitions_loop([{#mc_object_type{name = NameOfTable, units = Eunits}, {ColMEs, RestObjs} = define_cols(ColsEtc, 1, FieldList, NameOfEntry, NameOfTable, []), + AfterIdxTypes = after_indexes_type(IndexingInfo, RestObjs), TableInfo = snmpc_lib:make_table_info(Eline, NameOfTable, - IndexingInfo, ColMEs), + IndexingInfo, AfterIdxTypes, ColMEs), snmpc_lib:add_cdata(#cdata.mes, [TableEntryME, TableME#me{assocList=[{table_info, @@ -1205,6 +1209,12 @@ safe_elem(N,T) -> X -> X end. + +%% An table index is either: +%% a) part of the table +%% b) not part of the table and defined *before* the table +%% c) not part of the table and defined *after* the table + %% A correct column define_cols([{#mc_object_type{name = NameOfCol, syntax = Type1, @@ -1379,14 +1389,45 @@ define_cols(Rest, _SubIndex,_,_,_,ColMEs) -> snmpc_lib:print_error("Corrupt table definition.",[]), {ColMEs,Rest}. + +%% Table indexes can either be: +%% a) part of the table (a column) +%% b) not part of the table and defined *before* the table +%% c) not part of the table and defined *after* the table + +after_indexes_type({indexes, Indexes}, Objs) -> + after_indexes_type2(Indexes, Objs); +after_indexes_type(_, _) -> + []. + +after_indexes_type2(Indexes, Objs) -> + after_indexes_type2(Indexes, Objs, []). + +after_indexes_type2([], _Objs, IndexesASN1types) -> + IndexesASN1types; +after_indexes_type2([Index|Indexes], Objs, Acc) -> + Acc2 = after_indexes_type3(Index, Objs, Acc), + after_indexes_type2(Indexes, Objs, Acc2). + +after_indexes_type3(_Index, [], Acc) -> + Acc; +after_indexes_type3(Index, + [{#mc_object_type{name = Index, + syntax = Syntax},_}|_], Acc) -> + ASN1 = snmpc_lib:make_ASN1type(Syntax), + [{Index, ASN1}|Acc]; +after_indexes_type3(Index, [_|Objs], Acc) -> + after_indexes_type3(Index, Objs, Acc). + + + ensure_macro_imported(dummy, _Line) -> ok; ensure_macro_imported(Macro, Line) -> Macros = (get(cdata))#cdata.imported_macros, case lists:member(Macro, Macros) of true -> ok; false -> - snmpc_lib:print_error("Macro ~p not imported.", [Macro], - Line) + snmpc_lib:print_error("Macro ~p not imported.", [Macro], Line) end. test_table(NameOfTable, Taccess, Kind, _Tindex, Tline) -> diff --git a/lib/snmp/src/compile/snmpc_lib.erl b/lib/snmp/src/compile/snmpc_lib.erl index 3652054298..5a661cf194 100644 --- a/lib/snmp/src/compile/snmpc_lib.erl +++ b/lib/snmp/src/compile/snmpc_lib.erl @@ -24,7 +24,7 @@ -compile({no_auto_import,[error/2]}). -export([test_father/4, make_ASN1type/1, import/1, makeInternalNode2/2, is_consistent/1, resolve_defval/1, make_variable_info/1, - check_trap_name/3, make_table_info/4, get_final_mib/2, set_dir/2, + check_trap_name/3, make_table_info/5, get_final_mib/2, set_dir/2, look_at/1, add_cdata/2, check_object_group/4, check_notification_group/4, check_notification/3, @@ -707,7 +707,8 @@ check_trap_name(EnterpriseName, Line, MEs) -> %% This information is needed to be able to create default instrumentation %% functions for tables. %%---------------------------------------------------------------------- -make_table_info(Line, TableName, {augments, SrcTableEntry}, ColumnMEs) -> + +make_table_info(Line, TableName, {augments, SrcTableEntry}, _, ColumnMEs) -> ColMEs = lists:keysort(#me.oid, ColumnMEs), Nbr_of_Cols = length(ColMEs), MEs = ColMEs ++ (get(cdata))#cdata.mes, @@ -726,16 +727,18 @@ make_table_info(Line, TableName, {augments, SrcTableEntry}, ColumnMEs) -> first_accessible = FirstAcc, not_accessible = NoAccs, index_types = Aug}; -make_table_info(Line, TableName, {indexes, []}, _ColumnMEs) -> +make_table_info(Line, TableName, {indexes, []}, _, _ColumnMEs) -> print_error("Table ~w lacks indexes.", [TableName],Line), #table_info{}; -make_table_info(Line, TableName, {indexes, Indexes}, ColumnMEs) -> +make_table_info(Line, TableName, {indexes, Indexes}, AfterIdxTypes, + ColumnMEs) -> ColMEs = lists:keysort(#me.oid, ColumnMEs), NonImpliedIndexes = lists:map(fun non_implied_name/1, Indexes), test_read_create_access(ColMEs, Line, dummy), NonIndexCol = test_index_positions(Line, NonImpliedIndexes, ColMEs), Nbr_of_Cols = length(ColMEs), - ASN1Indexes = find_asn1_types_for_indexes(Indexes, ColMEs, Line), + ASN1Indexes = find_asn1_types_for_indexes(Indexes, + AfterIdxTypes, ColMEs, Line), FA = first_accessible(TableName, ColMEs), StatCol = find_status_col(Line, TableName, ColMEs), NoAccs = list_not_accessible(NonIndexCol,ColMEs), @@ -819,11 +822,17 @@ get_defvals(ColMEs) -> lists:filter(fun drop_undefined/1, lists:map(fun column_and_defval/1, ColMEs))). -find_asn1_types_for_indexes(Indexes, ColMEs,Line) -> - MEs = ColMEs ++ (get(cdata))#cdata.mes, +find_asn1_types_for_indexes(Indexes, AfterIdxTypes, ColMEs, Line) -> + ?vtrace("find_asn1_types_for_indexes -> " + "~n Indexes: ~p" + "~n ColMEs: ~p" + "~n Line: ~p", [Indexes, ColMEs, Line]), + MEs = ColMEs ++ (get(cdata))#cdata.mes ++ + [#me{aliasname = Idx, asn1_type = Type} || {Idx, Type} <- + AfterIdxTypes], test_implied(Indexes, Line), lists:map(fun (ColumnName) -> - translate_type(get_asn1_type(ColumnName, MEs,Line)) + translate_type(get_asn1_type(ColumnName, MEs, Line)) end, Indexes). @@ -849,7 +858,11 @@ column_and_defval(#me{oid = Oid, assocList = AssocList}) -> end. %% returns: an asn1_type if ColME is an indexfield, otherwise undefined. -get_asn1_type({implied,ColumnName}, MEs, Line) -> +get_asn1_type({implied, ColumnName}, MEs, Line) -> + ?vtrace("get_asn1_type(implied) -> " + "~n ColumnName: ~p" + "~n MEs: ~p" + "~n Line: ~p", [ColumnName, MEs, Line]), case lookup(ColumnName, MEs) of {value,#me{asn1_type=A}} when A#asn1_type.bertype =:= 'OCTET STRING' -> @@ -862,6 +875,10 @@ get_asn1_type({implied,ColumnName}, MEs, Line) -> [Shit], Line) end; get_asn1_type(ColumnName, MEs, Line) -> + ?vtrace("get_asn1_type -> " + "~n ColumnName: ~p" + "~n MEs: ~p" + "~n Line: ~p", [ColumnName, MEs, Line]), case lookup(ColumnName, MEs) of {value,ME} -> ME#me.asn1_type; false -> error("Can't find object ~p. Used as INDEX in table.", -- cgit v1.2.3 From 19bb4c1bc496ae36aa112f7137be5acf4dfd2c4f Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 5 Feb 2013 11:36:20 +0100 Subject: [snmp/compiler] Add the mib (ALARM-MIB) --- lib/snmp/test/test-mibs/ALARM-MIB.mib | 1214 +++++++++++++++++++++++++++++++++ 1 file changed, 1214 insertions(+) create mode 100644 lib/snmp/test/test-mibs/ALARM-MIB.mib (limited to 'lib/snmp') diff --git a/lib/snmp/test/test-mibs/ALARM-MIB.mib b/lib/snmp/test/test-mibs/ALARM-MIB.mib new file mode 100644 index 0000000000..18e43d4b4b --- /dev/null +++ b/lib/snmp/test/test-mibs/ALARM-MIB.mib @@ -0,0 +1,1214 @@ +ALARM-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, + Integer32, Unsigned32, Gauge32, + TimeTicks, Counter32, Counter64, + IpAddress, Opaque, mib-2, + zeroDotZero + FROM SNMPv2-SMI -- [RFC2578] + DateAndTime, + RowStatus, RowPointer, + TEXTUAL-CONVENTION + FROM SNMPv2-TC -- [RFC2579] + SnmpAdminString + FROM SNMP-FRAMEWORK-MIB -- [RFC3411] + InetAddressType, InetAddress + FROM INET-ADDRESS-MIB -- [RFC3291] + MODULE-COMPLIANCE, OBJECT-GROUP, + NOTIFICATION-GROUP + FROM SNMPv2-CONF -- [RFC2580] + ZeroBasedCounter32 + FROM RMON2-MIB; -- [RFC2021] + + alarmMIB MODULE-IDENTITY + LAST-UPDATED "200409090000Z" -- September 09, 2004 + ORGANIZATION "IETF Distributed Management Working Group" + CONTACT-INFO + "WG EMail: disman@ietf.org + Subscribe: disman-request@ietf.org + http://www.ietf.org/html.charters/disman-charter.html + + + + + Chair: Randy Presuhn + randy_presuhn@mindspring.com + + Editors: Sharon Chisholm + Nortel Networks + PO Box 3511 Station C + Ottawa, Ont. K1Y 4H7 + Canada + schishol@nortelnetworks.com + + Dan Romascanu + Avaya + Atidim Technology Park, Bldg. #3 + Tel Aviv, 61131 + Israel + Tel: +972-3-645-8414 + Email: dromasca@avaya.com" + DESCRIPTION + "The MIB module describes a generic solution + to model alarms and to store the current list + of active alarms. + + Copyright (C) The Internet Society (2004). The + initial version of this MIB module was published + in RFC 3877. For full legal notices see the RFC + itself. Supplementary information may be available on: + http://www.ietf.org/copyrights/ianamib.html" + REVISION "200409090000Z" -- September 09, 2004 + DESCRIPTION + "Initial version, published as RFC 3877." + ::= { mib-2 118 } + +alarmObjects OBJECT IDENTIFIER ::= { alarmMIB 1 } + +alarmNotifications OBJECT IDENTIFIER ::= { alarmMIB 0 } + +alarmModel OBJECT IDENTIFIER ::= { alarmObjects 1 } + +alarmActive OBJECT IDENTIFIER ::= { alarmObjects 2 } + +alarmClear OBJECT IDENTIFIER ::= { alarmObjects 3 } + +-- Textual Conventions + + -- ResourceId is intended to be a general textual convention + -- that can be used outside of the set of MIBs related to + -- Alarm Management. + + + + + +ResourceId ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "A unique identifier for this resource. + + The type of the resource can be determined by looking + at the OID that describes the resource. + + Resources must be identified in a consistent manner. + For example, if this resource is an interface, this + object MUST point to an ifIndex and if this resource + is a physical entity [RFC2737], then this MUST point + to an entPhysicalDescr, given that entPhysicalIndex + is not accessible. In general, the value is the + name of the instance of the first accessible columnar + object in the conceptual row of a table that is + meaningful for this resource type, which SHOULD + be defined in an IETF standard MIB." + SYNTAX OBJECT IDENTIFIER + + -- LocalSnmpEngineOrZeroLenStr is intended to be a general + -- textual convention that can be used outside of the set of + -- MIBs related to Alarm Management. + + LocalSnmpEngineOrZeroLenStr ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "An SNMP Engine ID or a zero-length string. The + instantiation of this textual convention will provide + guidance on when this will be an SNMP Engine ID and + when it will be a zero lengths string" + SYNTAX OCTET STRING (SIZE(0 | 5..32)) + +-- Alarm Model + +alarmModelLastChanged OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime at the time of the last + creation, deletion or modification of an entry in + the alarmModelTable. + + If the number and content of entries has been unchanged + since the last re-initialization of the local network + management subsystem, then the value of this object + MUST be zero." + + + + + ::= { alarmModel 1 } + +alarmModelTable OBJECT-TYPE + SYNTAX SEQUENCE OF AlarmModelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of information about possible alarms on the system, + and how they have been modelled." + ::= { alarmModel 2 } + +alarmModelEntry OBJECT-TYPE + SYNTAX AlarmModelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Entries appear in this table for each possible alarm state. + This table MUST be persistent across system reboots." + INDEX { alarmListName, alarmModelIndex, alarmModelState } + ::= { alarmModelTable 1 } + +AlarmModelEntry ::= SEQUENCE { + alarmModelIndex Unsigned32, + alarmModelState Unsigned32, + alarmModelNotificationId OBJECT IDENTIFIER, + alarmModelVarbindIndex Unsigned32, + alarmModelVarbindValue Integer32, + alarmModelDescription SnmpAdminString, + alarmModelSpecificPointer RowPointer, + alarmModelVarbindSubtree OBJECT IDENTIFIER, + alarmModelResourcePrefix OBJECT IDENTIFIER, + alarmModelRowStatus RowStatus + } + +alarmModelIndex OBJECT-TYPE + SYNTAX Unsigned32 (1..4294967295) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An integer that acts as an alarm Id + to uniquely identify each alarm + within the named alarm list. " + ::= { alarmModelEntry 1 } + +alarmModelState OBJECT-TYPE + SYNTAX Unsigned32 (1..4294967295) + MAX-ACCESS not-accessible + STATUS current + + + + + DESCRIPTION + "A value of 1 MUST indicate a clear alarm state. + The value of this object MUST be less than the + alarmModelState of more severe alarm states for + this alarm. The value of this object MUST be more + than the alarmModelState of less severe alarm states + for this alarm." + ::= { alarmModelEntry 2 } + +alarmModelNotificationId OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The NOTIFICATION-TYPE object identifier of this alarm + state transition. If there is no notification associated + with this alarm state, the value of this object MUST be + '0.0'" + DEFVAL { zeroDotZero } + ::= { alarmModelEntry 3 } + +alarmModelVarbindIndex OBJECT-TYPE + SYNTAX Unsigned32 + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The index into the varbind listing of the notification + indicated by alarmModelNotificationId which helps + signal that the given alarm has changed state. + If there is no applicable varbind, the value of this + object MUST be zero. + + Note that the value of alarmModelVarbindIndex acknowledges + the existence of the first two obligatory varbinds in + the InformRequest-PDU and SNMPv2-Trap-PDU (sysUpTime.0 + and snmpTrapOID.0). That is, a value of 2 refers to + the snmpTrapOID.0. + + If the incoming notification is instead an SNMPv1 Trap-PDU, + then an appropriate value for sysUpTime.0 or snmpTrapOID.0 + shall be determined by using the rules in section 3.1 of + [RFC3584]" + DEFVAL { 0 } + ::= { alarmModelEntry 4 } + +alarmModelVarbindValue OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-create + + + + + STATUS current + DESCRIPTION + "The value that the varbind indicated by + alarmModelVarbindIndex takes to indicate + that the alarm has entered this state. + + If alarmModelVarbindIndex has a value of 0, so + MUST alarmModelVarbindValue. + " + DEFVAL { 0 } + ::= { alarmModelEntry 5 } + +alarmModelDescription OBJECT-TYPE + SYNTAX SnmpAdminString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "A brief description of this alarm and state suitable + to display to operators." + DEFVAL { "" } + ::= { alarmModelEntry 6 } + +alarmModelSpecificPointer OBJECT-TYPE + SYNTAX RowPointer + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "If no additional, model-specific Alarm MIB is supported by + the system the value of this object is `0.0'and attempts + to set it to any other value MUST be rejected appropriately. + + When a model-specific Alarm MIB is supported, this object + MUST refer to the first accessible object in a corresponding + row of the model definition in one of these model-specific + MIB and attempts to set this object to { 0 0 } or any other + value MUST be rejected appropriately." + DEFVAL { zeroDotZero } + ::= { alarmModelEntry 7 } + + alarmModelVarbindSubtree OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The name portion of each VarBind in the notification, + in order, is compared to the value of this object. + If the name is equal to or a subtree of the value + of this object, for purposes of computing the value + + + + + of AlarmActiveResourceID the 'prefix' will be the + matching portion, and the 'indexes' will be any + remainder. The examination of varbinds ends with + the first match. If the value of this object is 0.0, + then the first varbind, or in the case of v2, the + first varbind after the timestamp and the trap + OID, will always be matched. + " + DEFVAL { zeroDotZero } + ::= { alarmModelEntry 8 } + + alarmModelResourcePrefix OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The value of AlarmActiveResourceId is computed + by appending any indexes extracted in accordance + with the description of alarmModelVarbindSubtree + onto the value of this object. If this object's + value is 0.0, then the 'prefix' extracted is used + instead. + " + DEFVAL { zeroDotZero } + ::= { alarmModelEntry 9 } + +alarmModelRowStatus OBJECT-TYPE + SYNTAX RowStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "Control for creating and deleting entries. Entries may be + modified while active. Alarms whose alarmModelRowStatus is + not active will not appear in either the alarmActiveTable + or the alarmClearTable. Setting this object to notInService + cannot be used as an alarm suppression mechanism. Entries + that are notInService will disappear as described in RFC2579. + + This row can not be modified while it is being + referenced by a value of alarmActiveModelPointer. In these + cases, an error of `inconsistentValue' will be returned to + the manager. + + This entry may be deleted while it is being + referenced by a value of alarmActiveModelPointer. This results + in the deletion of this entry and entries in the active alarms + referencing this entry via an alarmActiveModelPointer. + + + + + + As all read-create objects in this table have a DEFVAL clause, + there is no requirement that any object be explicitly set + before this row can become active. Note that a row consisting + only of default values is not very meaningful." + ::= { alarmModelEntry 10 } + +-- Active Alarm Table -- + +alarmActiveLastChanged OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime at the time of the last + creation or deletion of an entry in the alarmActiveTable. + If the number of entries has been unchanged since the + last re-initialization of the local network management + subsystem, then this object contains a zero value." + ::= { alarmActive 1 } + + alarmActiveOverflow OBJECT-TYPE + SYNTAX Counter32 + UNITS "active alarms" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of active alarms that have not been put into + the alarmActiveTable since system restart as a result + of extreme resource constraints." + ::= { alarmActive 5 } + +alarmActiveTable OBJECT-TYPE + SYNTAX SEQUENCE OF AlarmActiveEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of Active Alarms entries." + ::= { alarmActive 2 } + +alarmActiveEntry OBJECT-TYPE + SYNTAX AlarmActiveEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Entries appear in this table when alarms are raised. They + are removed when the alarm is cleared. + + If under extreme resource constraint the system is unable to + + + + + add any more entries into this table, then the + alarmActiveOverflow statistic will be increased by one." + INDEX { alarmListName, alarmActiveDateAndTime, + alarmActiveIndex } + ::= { alarmActiveTable 1 } + +AlarmActiveEntry ::= SEQUENCE { + alarmListName SnmpAdminString, + alarmActiveDateAndTime DateAndTime, + alarmActiveIndex Unsigned32, + alarmActiveEngineID LocalSnmpEngineOrZeroLenStr, + alarmActiveEngineAddressType InetAddressType, + alarmActiveEngineAddress InetAddress, + alarmActiveContextName SnmpAdminString, + alarmActiveVariables Unsigned32, + alarmActiveNotificationID OBJECT IDENTIFIER, + alarmActiveResourceId ResourceId, + alarmActiveDescription SnmpAdminString, + alarmActiveLogPointer RowPointer, + alarmActiveModelPointer RowPointer, + alarmActiveSpecificPointer RowPointer } + +alarmListName OBJECT-TYPE + SYNTAX SnmpAdminString (SIZE(0..32)) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The name of the list of alarms. This SHOULD be the same as + nlmLogName if the Notification Log MIB [RFC3014] is supported. + This SHOULD be the same as, or contain as a prefix, the + applicable snmpNotifyFilterProfileName if the + SNMP-NOTIFICATION-MIB DEFINITIONS [RFC3413] is supported. + + An implementation may allow multiple named alarm lists, up to + some implementation-specific limit (which may be none). A + zero-length list name is reserved for creation and deletion + by the managed system, and MUST be used as the default log + name by systems that do not support named alarm lists." + ::= { alarmActiveEntry 1 } + +alarmActiveDateAndTime OBJECT-TYPE + SYNTAX DateAndTime + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The local date and time when the error occurred. + + This object facilitates retrieving all instances of + + + + + alarms that have been raised or have changed state + since a given point in time. + + Implementations MUST include the offset from UTC, + if available. Implementation in environments in which + the UTC offset is not available is NOT RECOMMENDED." + ::= { alarmActiveEntry 2 } + +alarmActiveIndex OBJECT-TYPE + SYNTAX Unsigned32 (1..4294967295) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A strictly monotonically increasing integer which + acts as the index of entries within the named alarm + list. It wraps back to 1 after it reaches its + maximum value." + ::= { alarmActiveEntry 3 } + +alarmActiveEngineID OBJECT-TYPE + SYNTAX LocalSnmpEngineOrZeroLenStr + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The identification of the SNMP engine at which the alarm + originated. If the alarm is from an SNMPv1 system this + object is a zero length string." + ::= { alarmActiveEntry 4 } + +alarmActiveEngineAddressType OBJECT-TYPE + SYNTAX InetAddressType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object indicates what type of address is stored in + the alarmActiveEngineAddress object - IPv4, IPv6, DNS, etc." + ::= { alarmActiveEntry 5 } + +alarmActiveEngineAddress OBJECT-TYPE + SYNTAX InetAddress + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The address of the SNMP engine on which the alarm is + occurring. + + This object MUST always be instantiated, even if the list + can contain alarms from only one engine." + + + + + ::= { alarmActiveEntry 6 } + +alarmActiveContextName OBJECT-TYPE + SYNTAX SnmpAdminString (SIZE(0..32)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The name of the SNMP MIB context from which the alarm came. + For SNMPv1 alarms this is the community string from the Trap. + Note that care MUST be taken when selecting community + strings to ensure that these can be represented as a + well-formed SnmpAdminString. Community or Context names + that are not well-formed SnmpAdminStrings will be mapped + to zero length strings. + + If the alarm's source SNMP engine is known not to support + multiple contexts, this object is a zero length string." + ::= { alarmActiveEntry 7 } + +alarmActiveVariables OBJECT-TYPE + SYNTAX Unsigned32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of variables in alarmActiveVariableTable for this + alarm." + ::= { alarmActiveEntry 8 } + +alarmActiveNotificationID OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The NOTIFICATION-TYPE object identifier of the alarm + state transition that is occurring." + ::= { alarmActiveEntry 9 } + +alarmActiveResourceId OBJECT-TYPE + SYNTAX ResourceId + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object identifies the resource under alarm. + + If there is no corresponding resource, then + the value of this object MUST be 0.0." + ::= { alarmActiveEntry 10 } + + + + + +alarmActiveDescription OBJECT-TYPE + SYNTAX SnmpAdminString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object provides a textual description of the + active alarm. This text is generated dynamically by the + notification generator to provide useful information + to the human operator. This information SHOULD + provide information allowing the operator to locate + the resource for which this alarm is being generated. + This information is not intended for consumption by + automated tools." + ::= { alarmActiveEntry 11 } + +alarmActiveLogPointer OBJECT-TYPE + SYNTAX RowPointer + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A pointer to the corresponding row in a + notification logging MIB where the state change + notification for this active alarm is logged. + If no log entry applies to this active alarm, + then this object MUST have the value of 0.0" + ::= { alarmActiveEntry 12 } + +alarmActiveModelPointer OBJECT-TYPE + SYNTAX RowPointer + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A pointer to the corresponding row in the + alarmModelTable for this active alarm. This + points not only to the alarm model being + instantiated, but also to the specific alarm + state that is active." + ::= { alarmActiveEntry 13 } + +alarmActiveSpecificPointer OBJECT-TYPE + SYNTAX RowPointer + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "If no additional, model-specific, Alarm MIB is supported by + the system this object is `0.0'. When a model-specific Alarm + MIB is supported, this object is the instance pointer to the + specific model-specific active alarm list." + + + + + ::= { alarmActiveEntry 14 } + +-- Active Alarm Variable Table -- + +alarmActiveVariableTable OBJECT-TYPE + SYNTAX SEQUENCE OF AlarmActiveVariableEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of variables to go with active alarm entries." + ::= { alarmActive 3 } + +alarmActiveVariableEntry OBJECT-TYPE + SYNTAX AlarmActiveVariableEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Entries appear in this table when there are variables in + the varbind list of a corresponding alarm in + alarmActiveTable. + + Entries appear in this table as though + the trap/notification had been transported using a + SNMPv2-Trap-PDU, as defined in [RFC3416] - i.e., the + alarmActiveVariableIndex 1 will always be sysUpTime + and alarmActiveVariableIndex 2 will always be + snmpTrapOID. + + If the incoming notification is instead an SNMPv1 Trap-PDU and + the value of alarmModelVarbindIndex is 1 or 2, an appropriate + value for sysUpTime.0 or snmpTrapOID.0 shall be determined + by using the rules in section 3.1 of [RFC3584]." + INDEX { alarmListName, alarmActiveIndex, + alarmActiveVariableIndex } + ::= { alarmActiveVariableTable 1 } + +AlarmActiveVariableEntry ::= SEQUENCE { + alarmActiveVariableIndex Unsigned32, + alarmActiveVariableID OBJECT IDENTIFIER, + alarmActiveVariableValueType INTEGER, + alarmActiveVariableCounter32Val Counter32, + alarmActiveVariableUnsigned32Val Unsigned32, + alarmActiveVariableTimeTicksVal TimeTicks, + alarmActiveVariableInteger32Val Integer32, + alarmActiveVariableOctetStringVal OCTET STRING, + alarmActiveVariableIpAddressVal IpAddress, + alarmActiveVariableOidVal OBJECT IDENTIFIER, + alarmActiveVariableCounter64Val Counter64, + + + + + alarmActiveVariableOpaqueVal Opaque } + +alarmActiveVariableIndex OBJECT-TYPE + SYNTAX Unsigned32 (1..4294967295) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A strictly monotonically increasing integer, starting at + 1 for a given alarmActiveIndex, for indexing variables + within the active alarm variable list. " + ::= { alarmActiveVariableEntry 1 } + +alarmActiveVariableID OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The alarm variable's object identifier." + ::= { alarmActiveVariableEntry 2 } + +alarmActiveVariableValueType OBJECT-TYPE + SYNTAX INTEGER { + counter32(1), + unsigned32(2), + timeTicks(3), + integer32(4), + ipAddress(5), + octetString(6), + objectId(7), + counter64(8), + opaque(9) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of the value. One and only one of the value + objects that follow is used for a given row in this table, + based on this type." + ::= { alarmActiveVariableEntry 3 } + +alarmActiveVariableCounter32Val OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'counter32'." + ::= { alarmActiveVariableEntry 4 } + + + + + +alarmActiveVariableUnsigned32Val OBJECT-TYPE + SYNTAX Unsigned32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'unsigned32'." + ::= { alarmActiveVariableEntry 5 } + +alarmActiveVariableTimeTicksVal OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'timeTicks'." + ::= { alarmActiveVariableEntry 6 } + +alarmActiveVariableInteger32Val OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'integer32'." + ::= { alarmActiveVariableEntry 7 } + +alarmActiveVariableOctetStringVal OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..65535)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'octetString'." + ::= { alarmActiveVariableEntry 8 } + +alarmActiveVariableIpAddressVal OBJECT-TYPE + SYNTAX IpAddress + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'ipAddress'." + ::= { alarmActiveVariableEntry 9 } + +alarmActiveVariableOidVal OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'objectId'." + ::= { alarmActiveVariableEntry 10 } + + + + + +alarmActiveVariableCounter64Val OBJECT-TYPE + SYNTAX Counter64 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'counter64'." + ::= { alarmActiveVariableEntry 11 } + +alarmActiveVariableOpaqueVal OBJECT-TYPE + SYNTAX Opaque + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when alarmActiveVariableType is 'opaque'. + + Note that although RFC2578 [RFC2578] forbids the use + of Opaque in 'standard' MIB modules, this particular + usage is driven by the need to be able to accurately + represent any well-formed notification, and justified + by the need for backward compatibility." + ::= { alarmActiveVariableEntry 12 } + +-- Statistics -- + +alarmActiveStatsTable OBJECT-TYPE + SYNTAX SEQUENCE OF AlarmActiveStatsEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table represents the alarm statistics + information." + ::= { alarmActive 4 } + +alarmActiveStatsEntry OBJECT-TYPE + SYNTAX AlarmActiveStatsEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Statistics on the current active alarms." + INDEX { alarmListName } + + ::= { alarmActiveStatsTable 1 } + +AlarmActiveStatsEntry ::= + SEQUENCE { + alarmActiveStatsActiveCurrent Gauge32, + alarmActiveStatsActives ZeroBasedCounter32, + alarmActiveStatsLastRaise TimeTicks, + + + + + alarmActiveStatsLastClear TimeTicks + } + +alarmActiveStatsActiveCurrent OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of currently active alarms on the system." + ::= { alarmActiveStatsEntry 1 } + +alarmActiveStatsActives OBJECT-TYPE + SYNTAX ZeroBasedCounter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of active alarms since system restarted." + ::= { alarmActiveStatsEntry 2 } + +alarmActiveStatsLastRaise OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime at the time of the last + alarm raise for this alarm list. + If no alarm raises have occurred since the + last re-initialization of the local network management + subsystem, then this object contains a zero value." + ::= { alarmActiveStatsEntry 3 } + +alarmActiveStatsLastClear OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime at the time of the last + alarm clear for this alarm list. + If no alarm clears have occurred since the + last re-initialization of the local network management + subsystem, then this object contains a zero value." + ::= { alarmActiveStatsEntry 4 } + +-- Alarm Clear + +alarmClearMaximum OBJECT-TYPE + SYNTAX Unsigned32 + MAX-ACCESS read-write + + + + + STATUS current + DESCRIPTION + "This object specifies the maximum number of cleared + alarms to store in the alarmClearTable. When this + number is reached, the cleared alarms with the + earliest clear time will be removed from the table." + ::= { alarmClear 1 } + +alarmClearTable OBJECT-TYPE + SYNTAX SEQUENCE OF AlarmClearEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains information on + cleared alarms." + ::= { alarmClear 2 } + +alarmClearEntry OBJECT-TYPE + SYNTAX AlarmClearEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Information on a cleared alarm." + INDEX { alarmListName, alarmClearDateAndTime, +alarmClearIndex } + + ::= { alarmClearTable 1 } + +AlarmClearEntry ::= + SEQUENCE { + alarmClearIndex Unsigned32, + alarmClearDateAndTime DateAndTime, + alarmClearEngineID LocalSnmpEngineOrZeroLenStr, + alarmClearEngineAddressType InetAddressType, + alarmClearEngineAddress InetAddress, + alarmClearContextName SnmpAdminString, + alarmClearNotificationID OBJECT IDENTIFIER, + alarmClearResourceId ResourceId, + alarmClearLogIndex Unsigned32, + alarmClearModelPointer RowPointer + } + +alarmClearIndex OBJECT-TYPE + SYNTAX Unsigned32 (1..4294967295) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An integer which acts as the index of entries within + + + + + the named alarm list. It wraps back to 1 after it + reaches its maximum value. + + This object has the same value as the alarmActiveIndex that + this alarm instance had when it was active." + ::= { alarmClearEntry 1 } + +alarmClearDateAndTime OBJECT-TYPE + SYNTAX DateAndTime + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The local date and time when the alarm cleared. + + This object facilitates retrieving all instances of + alarms that have been cleared since a given point in time. + + Implementations MUST include the offset from UTC, + if available. Implementation in environments in which + the UTC offset is not available is NOT RECOMMENDED." + ::= { alarmClearEntry 2 } + +alarmClearEngineID OBJECT-TYPE + SYNTAX LocalSnmpEngineOrZeroLenStr + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The identification of the SNMP engine at which the alarm + originated. If the alarm is from an SNMPv1 system this + object is a zero length string." + ::= { alarmClearEntry 3 } + +alarmClearEngineAddressType OBJECT-TYPE + SYNTAX InetAddressType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object indicates what type of address is stored in + the alarmActiveEngineAddress object - IPv4, IPv6, DNS, etc." + ::= { alarmClearEntry 4 } + +alarmClearEngineAddress OBJECT-TYPE + SYNTAX InetAddress + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The Address of the SNMP engine on which the alarm was + occurring. This is used to identify the source of an SNMPv1 + + + + + trap, since an alarmActiveEngineId cannot be extracted from the + SNMPv1 trap PDU. + + This object MUST always be instantiated, even if the list + can contain alarms from only one engine." + ::= { alarmClearEntry 5 } + +alarmClearContextName OBJECT-TYPE + SYNTAX SnmpAdminString (SIZE(0..32)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The name of the SNMP MIB context from which the alarm came. + For SNMPv1 traps this is the community string from the Trap. + Note that care needs to be taken when selecting community + strings to ensure that these can be represented as a + well-formed SnmpAdminString. Community or Context names + that are not well-formed SnmpAdminStrings will be mapped + to zero length strings. + + If the alarm's source SNMP engine is known not to support + multiple contexts, this object is a zero length string." + ::= { alarmClearEntry 6 } + +alarmClearNotificationID OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The NOTIFICATION-TYPE object identifier of the alarm + clear." + ::= { alarmClearEntry 7 } + +alarmClearResourceId OBJECT-TYPE + SYNTAX ResourceId + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object identifies the resource that was under alarm. + + If there is no corresponding resource, then + the value of this object MUST be 0.0." + ::= { alarmClearEntry 8 } + +alarmClearLogIndex OBJECT-TYPE + SYNTAX Unsigned32 (0..4294967295) + MAX-ACCESS read-only + STATUS current + + + + + DESCRIPTION + "This number MUST be the same as the log index of the + applicable row in the notification log MIB, if it exists. + If no log index applies to the trap, then this object + MUST have the value of 0." + ::= { alarmClearEntry 9 } + +alarmClearModelPointer OBJECT-TYPE + SYNTAX RowPointer + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A pointer to the corresponding row in the + alarmModelTable for this cleared alarm." + ::= { alarmClearEntry 10 } + +-- Notifications + +alarmActiveState NOTIFICATION-TYPE + OBJECTS { alarmActiveModelPointer, + alarmActiveResourceId } + STATUS current + DESCRIPTION + "An instance of the alarm indicated by + alarmActiveModelPointer has been raised + against the entity indicated by + alarmActiveResourceId. + + The agent must throttle the generation of + consecutive alarmActiveState traps so that there is at + least a two-second gap between traps of this + type against the same alarmActiveModelPointer and + alarmActiveResourceId. When traps are throttled, + they are dropped, not queued for sending at a future time. + + A management application should periodically check + the value of alarmActiveLastChanged to detect any + missed alarmActiveState notification-events, e.g., + due to throttling or transmission loss." + ::= { alarmNotifications 2 } + +alarmClearState NOTIFICATION-TYPE + OBJECTS { alarmActiveModelPointer, + alarmActiveResourceId } + STATUS current + DESCRIPTION + "An instance of the alarm indicated by + alarmActiveModelPointer has been cleared against + + + + + the entity indicated by alarmActiveResourceId. + + The agent must throttle the generation of + consecutive alarmActiveClear traps so that there is at + least a two-second gap between traps of this + type against the same alarmActiveModelPointer and + alarmActiveResourceId. When traps are throttled, + they are dropped, not queued for sending at a future time. + + A management application should periodically check + the value of alarmActiveLastChanged to detect any + missed alarmClearState notification-events, e.g., + due to throttling or transmission loss." + ::= { alarmNotifications 3 } + +-- Conformance + +alarmConformance OBJECT IDENTIFIER ::= { alarmMIB 2 } + +alarmCompliances OBJECT IDENTIFIER ::= { alarmConformance 1 } + +alarmCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for systems supporting + the Alarm MIB." + MODULE -- this module + MANDATORY-GROUPS { + alarmActiveGroup, + alarmModelGroup + } + GROUP alarmActiveStatsGroup + DESCRIPTION + "This group is optional." + GROUP alarmClearGroup + DESCRIPTION + "This group is optional." + GROUP alarmNotificationsGroup + DESCRIPTION + "This group is optional." + ::= { alarmCompliances 1 } + +alarmGroups OBJECT IDENTIFIER ::= { alarmConformance 2 } + +alarmModelGroup OBJECT-GROUP + OBJECTS { + alarmModelLastChanged, + alarmModelNotificationId, + + + + + alarmModelVarbindIndex, + alarmModelVarbindValue, + alarmModelDescription, + alarmModelSpecificPointer, + alarmModelVarbindSubtree, + alarmModelResourcePrefix, + alarmModelRowStatus + } + STATUS current + DESCRIPTION + "Alarm model group." + ::= { alarmGroups 1} + +alarmActiveGroup OBJECT-GROUP + OBJECTS { + alarmActiveLastChanged, + alarmActiveOverflow, + alarmActiveEngineID, + alarmActiveEngineAddressType, + alarmActiveEngineAddress, + alarmActiveContextName, + alarmActiveVariables, + alarmActiveNotificationID, + alarmActiveResourceId, + alarmActiveDescription, + alarmActiveLogPointer, + alarmActiveModelPointer, + alarmActiveSpecificPointer, + alarmActiveVariableID, + alarmActiveVariableValueType, + alarmActiveVariableCounter32Val, + alarmActiveVariableUnsigned32Val, + alarmActiveVariableTimeTicksVal, + alarmActiveVariableInteger32Val, + alarmActiveVariableOctetStringVal, + alarmActiveVariableIpAddressVal, + alarmActiveVariableOidVal, + alarmActiveVariableCounter64Val, + alarmActiveVariableOpaqueVal + } + STATUS current + DESCRIPTION + "Active Alarm list group." + ::= { alarmGroups 2} + + alarmActiveStatsGroup OBJECT-GROUP + OBJECTS { + alarmActiveStatsActives, + + + + + alarmActiveStatsActiveCurrent, + alarmActiveStatsLastRaise, + alarmActiveStatsLastClear + } + STATUS current + DESCRIPTION + "Active alarm summary group." + ::= { alarmGroups 3} + +alarmClearGroup OBJECT-GROUP + OBJECTS { + alarmClearMaximum, + alarmClearEngineID, + alarmClearEngineAddressType, + alarmClearEngineAddress, + alarmClearContextName, + alarmClearNotificationID, + alarmClearResourceId, + alarmClearLogIndex, + alarmClearModelPointer + } + STATUS current + DESCRIPTION + "Cleared alarm group." + ::= { alarmGroups 4} + +alarmNotificationsGroup NOTIFICATION-GROUP + NOTIFICATIONS { alarmActiveState, alarmClearState } + STATUS current + DESCRIPTION + "The collection of notifications that can be used to + model alarms for faults lacking pre-existing + notification definitions." + ::= { alarmGroups 6 } + +END -- cgit v1.2.3 From da552424b6fb40a453baad36a9aad00154cb61fc Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 5 Feb 2013 12:17:17 +0100 Subject: [snmp/compiler] Proper release nodes --- lib/snmp/doc/src/notes.xml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 7fe6425f52..8d280fb3a1 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -77,6 +77,12 @@

Own Id: OTP-10799

+ +

[compiler] The MIB compiler could not handle a table index + that was defined later in the MIB.

+

Own Id: OTP-10808

+
+ -- cgit v1.2.3 From 67a171c8608d8bad19d4b9a22e5fa072f0d2d891 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 5 Feb 2013 14:57:13 +0100 Subject: [snmp/compiler] Add test case and test mib --- lib/snmp/test/snmp_compiler_test.erl | 28 +++++- lib/snmp/test/snmp_test_data/OTP10808-MIB.mib | 137 ++++++++++++++++++++++++++ 2 files changed, 161 insertions(+), 4 deletions(-) create mode 100644 lib/snmp/test/snmp_test_data/OTP10808-MIB.mib (limited to 'lib/snmp') diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index 4c5a945984..1840d37dfd 100644 --- a/lib/snmp/test/snmp_compiler_test.erl +++ b/lib/snmp/test/snmp_compiler_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2012. All Rights Reserved. +%% Copyright Ericsson AB 2003-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -54,7 +54,8 @@ otp_6150/1, otp_8574/1, otp_8595/1, - otp_10799/1 + otp_10799/1, + otp_10808/1 ]). @@ -133,7 +134,7 @@ all() -> ]. groups() -> - [{tickets, [], [otp_6150, otp_8574, otp_8595, otp_10799]}]. + [{tickets, [], [otp_6150, otp_8574, otp_8595, otp_10799, otp_10808]}]. init_per_group(_GroupName, Config) -> Config. @@ -387,7 +388,7 @@ otp_8595(Config) when is_list(Config) -> snmpc:compile(MibFile, [{outdir, Dir}, {verbosity, trace}, {group_check, false}]), - io:format("otp_8595 -> Mib: ~n~p~n", [Mib]), + p("Mib: ~n~p~n", [Mib]), ok. @@ -408,6 +409,25 @@ otp_10799(Config) when is_list(Config) -> ok. +%%====================================================================== + +otp_10808(suite) -> + []; +otp_10808(Config) when is_list(Config) -> + put(tname, otp10808), + p("starting with Config: ~p~n", [Config]), + + Dir = ?config(case_top_dir, Config), + MibDir = ?config(mib_dir, Config), + MibFile = join(MibDir, "OTP10808-MIB.mib"), + ?line {ok, Mib} = + snmpc:compile(MibFile, [{outdir, Dir}, + {verbosity, trace}, + {group_check, false}]), + p("Mib: ~n~p~n", [Mib]), + ok. + + %%====================================================================== augments_extra_info(suite) -> diff --git a/lib/snmp/test/snmp_test_data/OTP10808-MIB.mib b/lib/snmp/test/snmp_test_data/OTP10808-MIB.mib new file mode 100644 index 0000000000..99c099e316 --- /dev/null +++ b/lib/snmp/test/snmp_test_data/OTP10808-MIB.mib @@ -0,0 +1,137 @@ +OTP10808-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, enterprises, IpAddress FROM SNMPv2-SMI + RowStatus FROM SNMPv2-TC + ; + +otp10808MIB MODULE-IDENTITY + LAST-UPDATED "1004200000Z" + ORGANIZATION "Erlang/OTP" + CONTACT-INFO "www.erlang.org" + DESCRIPTION "The MIB module is used for testing a compiler feature" + ::= { otpSnmp 1 } + +ericsson OBJECT IDENTIFIER ::= { enterprises 193 } +otp OBJECT IDENTIFIER ::= { ericsson 19 } +otpApplications OBJECT IDENTIFIER ::= { otp 3 } +otpSnmp OBJECT IDENTIFIER ::= { otpApplications 3 } + +testMIBObjects OBJECT IDENTIFIER ::= { otp10808MIB 1 } + +testMIBObjectGroup OBJECT IDENTIFIER ::= { testMIBObjects 1 } + +-- Example Table 1 + +example-Table1 OBJECT-TYPE + SYNTAX SEQUENCE OF ExampleEntry1 + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION "Example table 1" + ::= { testMIBObjectGroup 1 } + +example-Entry1 OBJECT-TYPE + SYNTAX ExampleEntry1 + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION "Example table 1 entry" + INDEX { exampleIndex2, exampleIndex1 } + ::= { example-Table1 1 } + +ExampleEntry1 ::= SEQUENCE { + exampleIndex1 INTEGER, + exampleColumn1 OCTET STRING, + exampleNotAccessible1 OCTET STRING, + exampleRowStatus1 RowStatus +} + +exampleIndex1 OBJECT-TYPE + SYNTAX INTEGER (1..100) + MAX-ACCESS read-write + STATUS current + DESCRIPTION "The second index for this entry." + ::= { example-Entry1 1 } + +exampleColumn1 OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Example table column" + ::= { example-Entry1 2 } + +exampleNotAccessible1 OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Example table column" + ::= { example-Entry1 3 } + +exampleRowStatus1 OBJECT-TYPE + SYNTAX RowStatus + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Example table RowStatus" + ::= { example-Entry1 4 } + + +-- Example Table 2 + +example-Table2 OBJECT-TYPE + SYNTAX SEQUENCE OF ExampleEntry2 + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION "Example table 2" + ::= { testMIBObjectGroup 2 } + +example-Entry2 OBJECT-TYPE + SYNTAX ExampleEntry2 + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION "Example table entry" + INDEX { exampleIndex2 } + ::= { example-Table2 1 } + +ExampleEntry2 ::= SEQUENCE { + exampleIndex2 INTEGER, + exampleColumn2 OCTET STRING, + exampleNotAccessible2 OCTET STRING, + exampleRowStatus2 RowStatus +} + +exampleIndex2 OBJECT-TYPE + SYNTAX INTEGER (1..100) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The index for this entry of table 2 + (and first index of table 1)." + ::= { example-Entry2 1 } + +exampleColumn2 OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Example table column" + ::= { example-Entry2 2 } + +exampleNotAccessible2 OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Example table column" + ::= { example-Entry2 3 } + +exampleRowStatus2 OBJECT-TYPE + SYNTAX RowStatus + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Example table RowStatus" + ::= { example-Entry2 4 } + +END -- cgit v1.2.3 From 74533aeafd2c7f5ff877329e0c56bd512a95204f Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 5 Feb 2013 14:57:44 +0100 Subject: [snmp/compiler] Improved debug printouts --- lib/snmp/src/compile/snmpc.erl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index b238214798..d94810bc0a 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -516,7 +516,7 @@ definitions_loop([{#mc_object_type{name = NameOfTable, fields = FieldList}, Sline}|ColsEtc], Data) -> - ?vlog("defloop -> " + ?vlog("defloop(~w) -> " "[object_type(sequence_of),object_type(type,[1]),sequence]:" "~n NameOfTable: ~p" "~n SeqName: ~p" @@ -535,7 +535,8 @@ definitions_loop([{#mc_object_type{name = NameOfTable, "~n Eline: ~p" "~n FieldList: ~p" "~n Sline: ~p", - [NameOfTable,SeqName,Taccess,Kind,Tstatus, + [?LINE, + NameOfTable,SeqName,Taccess,Kind,Tstatus, Tindex,Tunits,Tline, NameOfEntry,TEline,IndexingInfo,Estatus,Eunits,Ref,Eline, FieldList,Sline]), @@ -563,7 +564,6 @@ definitions_loop([{#mc_object_type{name = NameOfTable, {ColMEs, RestObjs} = define_cols(ColsEtc, 1, FieldList, NameOfEntry, NameOfTable, []), AfterIdxTypes = after_indexes_type(IndexingInfo, RestObjs), - after_indexes_type(IndexingInfo, RestObjs), TableInfo = snmpc_lib:make_table_info(Eline, NameOfTable, IndexingInfo, AfterIdxTypes, ColMEs), snmpc_lib:add_cdata(#cdata.mes, @@ -597,7 +597,7 @@ definitions_loop([{#mc_object_type{name = NameOfTable, Sline}|ColsEtc], #dldata{relaxed_row_name_assign_check = true} = Data) when is_integer(Idx) andalso (Idx > 1) -> - ?vlog("defloop -> " + ?vlog("defloop(~w) -> " "[object_type(sequence_of),object_type(type,[~w]),sequence]:" "~n NameOfTable: ~p" "~n SeqName: ~p" @@ -616,7 +616,8 @@ definitions_loop([{#mc_object_type{name = NameOfTable, "~n Eline: ~p" "~n FieldList: ~p" "~n Sline: ~p", - [Idx, + [?LINE, + Idx, NameOfTable,SeqName,Taccess,Kind,Tstatus, Tindex,Tunits,Tline, NameOfEntry,TEline,IndexingInfo,Estatus,Eunits,Ref,Eline, @@ -676,7 +677,7 @@ definitions_loop([{#mc_object_type{name = NameOfTable, {#mc_sequence{name = SeqName, fields = FieldList}, Sline}|ColsEtc], Data) -> - ?vlog("defloop -> " + ?vlog("defloop(~w) -> " "[object_type(sequence_of),object_type(type),sequence(fieldList)]:" "~n NameOfTable: ~p" "~n SeqName: ~p" @@ -695,7 +696,8 @@ definitions_loop([{#mc_object_type{name = NameOfTable, "~n Eline: ~p" "~n FieldList: ~p" "~n Sline: ~p", - [NameOfTable,SeqName,Taccess,Kind,Tstatus, + [?LINE, + NameOfTable,SeqName,Taccess,Kind,Tstatus, Tindex,Tunits,Tline, NameOfEntry,IndexingInfo,Estatus,BadOID,Eunits,Ref,Eline, FieldList,Sline]), @@ -817,7 +819,7 @@ definitions_loop([{#mc_module_identity{name = NewVarName, "~n Desc: ~p" "~n Revs0: ~p" "~n Parent: ~p" - "~n SubIndex: ~p", + "~n SubIndex: ~w", [NewVarName, LU, Org, CI, Desc, Revs0, Parent, SubIndex], Line), ensure_macro_imported('MODULE-IDENTITY', Line), snmpc_lib:register_oid(Line, NewVarName, Parent, SubIndex), @@ -843,7 +845,7 @@ definitions_loop([{#mc_internal{name = NewVarName, "~n NewVarName: ~p" "~n Macro: ~p" "~n Parent: ~p" - "~n SubIndex: ~p", + "~n SubIndex: ~w", [NewVarName, Macro, Parent, SubIndex], Line), ensure_macro_imported(Macro, Line), snmpc_lib:register_oid(Line, NewVarName, Parent, SubIndex), -- cgit v1.2.3