From bd7410308177659ad15c770d6d4700219bbe6978 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 30 Nov 2010 18:36:39 +0100 Subject: First version. No documentation and no testing. --- lib/snmp/src/compile/snmpc.erl | 6 ++++++ lib/snmp/src/compile/snmpc.hrl | 15 ++++++++++++++- lib/snmp/src/compile/snmpc_mib_gram.yrl | 25 ++++++++++++++++++++++++- lib/snmp/vsn.mk | 21 ++++++++++++++++++++- 4 files changed, 64 insertions(+), 3 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index a7f2cdc2bc..0f90d541e8 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -921,6 +921,12 @@ definitions_loop([{#mc_notification{name = TrapName, snmpc_lib:add_cdata(#cdata.traps, [Notif]), definitions_loop(T, Data); +definitions_loop([{#mc_agent_capabilities{name = Name},Line}|T], Data) -> + ?vlog2("defloop -> agent_capabilities:" + "~n Name: ~p", [Name], Line), + ensure_macro_imported('AGENT-CAPABILITIES', Line), + definitions_loop(T, Data); + definitions_loop([{#mc_module_compliance{name = Name},Line}|T], Data) -> ?vlog2("defloop -> module_compliance:" "~n Name: ~p", [Name], Line), diff --git a/lib/snmp/src/compile/snmpc.hrl b/lib/snmp/src/compile/snmpc.hrl index eb896cde6b..5dd8d9a139 100644 --- a/lib/snmp/src/compile/snmpc.hrl +++ b/lib/snmp/src/compile/snmpc.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2010. 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 @@ -103,6 +103,19 @@ ). +-record(mc_agent_capabilities, + {name, + product_release, + status, + description, + reference, + module, + name_assign + } + ). + + + -record(mc_module_compliance, {name, status, diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index 1957f52936..3536b538df 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. 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 @@ -59,6 +59,7 @@ newtypename objectidentifier objectname objecttypev1 +prodrelpart range_num referpart size @@ -101,6 +102,7 @@ textualconvention objectgroup notificationgroup modulecompliance +agentcapabilities modulepart modules module @@ -161,6 +163,8 @@ integer variable atom string quote '{' '}' '::=' ':' '=' ',' '.' '(' ')' ';' '|' 'CONTACT-INFO' 'MODULE-IDENTITY' 'NOTIFICATION-TYPE' +'PRODUCT-RELEASE' +'AGENT-CAPABILITIES' 'MODULE-COMPLIANCE' 'OBJECT-GROUP' 'NOTIFICATION-GROUP' @@ -505,6 +509,7 @@ definitionv2 -> notification : '$1'. definitionv2 -> objectgroup : '$1'. definitionv2 -> notificationgroup : '$1'. definitionv2 -> modulecompliance : '$1'. +definitionv2 -> agentcapabilities : '$1'. listofdefinitionsv2 -> '$empty' : [] . listofdefinitionsv2 -> listofdefinitionsv2 definitionv2 : ['$2' | '$1']. @@ -540,6 +545,15 @@ modulecompliance -> objectname 'MODULE-COMPLIANCE' 'STATUS' statusv2 '$7', '$8'), {MC, line_of('$2')}. +agentcapabilities -> objectname 'AGENT-CAPABILITIES' + 'PRODUCT-RELEASE' prodrelpart 'STATUS' statusv2 + description referpart modulepart nameassign : + MC = make_agent_capabilities('$1', '$4', '$6', '$7', + '$8', '$9', '$10'), + {MC, line_of('$2')}. + +prodrelpart -> string : $1. + modulepart -> '$empty'. modulepart -> modules. @@ -744,6 +758,15 @@ make_notification(Name, Vars, Status, Desc, Ref, NA) -> reference = Ref, name_assign = NA}. +make_agent_capabilities(Name, ProdRel, Status, Desc, Ref, Mod, NA) -> + #mc_agent_capabilities{name = Name, + product_release = ProdRel, + status = Status, + description = Desc, + reference = Ref, + module = Mod, + name_assign = NA}. + make_module_compliance(Name, Status, Desc, Ref, Mod, NA) -> #mc_module_compliance{name = Name, status = Status, diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 1229b12ae2..12a9d8ed3c 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -1,3 +1,22 @@ -SNMP_VSN = 4.18 +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2010. 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 +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +SNMP_VSN = 4.19 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -- cgit v1.2.3 From 5210341783f4c3ca9611c7ea5e630fde4d067f10 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 2 Dec 2010 21:02:12 +0100 Subject: Really time to go home checkin. --- lib/snmp/src/compile/snmpc.erl | 50 +++++++++- lib/snmp/src/compile/snmpc.hrl | 19 +++- lib/snmp/src/compile/snmpc_lib.erl | 5 +- lib/snmp/src/compile/snmpc_mib_gram.yrl | 131 +++++++++++++++++++++++++-- lib/snmp/src/compile/snmpc_tok.erl | 9 +- lib/snmp/test/modules.mk | 1 + lib/snmp/test/snmp_compiler_test.erl | 15 +++ lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib | 131 +++++++++++++++++++++++++++ 8 files changed, 344 insertions(+), 17 deletions(-) create mode 100644 lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index 0f90d541e8..84c9c46fc9 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -921,10 +921,42 @@ definitions_loop([{#mc_notification{name = TrapName, snmpc_lib:add_cdata(#cdata.traps, [Notif]), definitions_loop(T, Data); -definitions_loop([{#mc_agent_capabilities{name = Name},Line}|T], Data) -> - ?vlog2("defloop -> agent_capabilities:" - "~n Name: ~p", [Name], Line), +definitions_loop([{#mc_agent_capabilities{name = Name, + status = Status, + description = Desc, + reference = Ref, + modules = Mods, + name_assign = {Parent, SubIdx}},Line}|T], Data) -> + ?vlog2("defloop -> agent_capabilities ~p:" + "~n Status: ~p" + "~n Desc: ~p" + "~n Parent: ~p" + "~n SubIndex: ~p", + [Name, Status, Desc, Parent, SubIdx], Line), ensure_macro_imported('AGENT-CAPABILITIES', Line), + snmpc_lib:register_oid(Line, Name, Parent, SubIdx), + NewME = snmpc_lib:makeInternalNode2(false, Name), + Description = make_description(Desc), + Reference = + case Ref of + undefined -> + []; + _ -> + [{reference, Ref}] + end, + Modules = + case Mods of + undefined -> + []; + [] -> + []; + _ -> + [{modules, Mods}] + end, + AssocList = Reference ++ Modules, + NewME2 = NewME#me{description = Description, + assocList = AssocList}, + snmpc_lib:add_cdata(#cdata.mes, [NewME2]), definitions_loop(T, Data); definitions_loop([{#mc_module_compliance{name = Name},Line}|T], Data) -> @@ -1334,22 +1366,26 @@ save(Filename, MibName, Options) -> parse(FileName) -> + ?vtrace("parse -> start tokenizer for ~p", [FileName]), case snmpc_tok:start_link(reserved_words(), [{file, FileName ++ ".mib"}, {forget_stringdata, true}]) of {error,ReasonStr} -> snmpc_lib:error(lists:flatten(ReasonStr),[]); {ok, TokPid} -> + ?vtrace("parse -> tokenizer start, now get tokens", []), Toks = snmpc_tok:get_all_tokens(TokPid), + ?vtrace("parse -> tokens: ~p", [Toks]), set_version(Toks), %% io:format("parse -> lexical analysis: ~n~p~n", [Toks]), - %% t("parse -> lexical analysis: ~n~p", [Toks]), + %% ?vtrace("parse -> lexical analysis: ~n~p", [Toks]), CDataArg = case lists:keysearch(module, 1, get(options)) of {value, {module, M}} -> {module, M}; _ -> {file, FileName ++ ".funcs"} end, put(cdata,snmpc_lib:make_cdata(CDataArg)), + ?vtrace("parse -> stop tokenizer and then do the actual parse", []), snmpc_tok:stop(TokPid), Res = if is_list(Toks) -> @@ -1357,7 +1393,7 @@ parse(FileName) -> true -> Toks end, - %% t("parse -> parsed: ~n~p", [Res]), + ?vtrace("parse -> parsed result: ~n~p", [Res]), case Res of {ok, PData} -> {ok, PData}; @@ -1449,6 +1485,10 @@ reserved_words() -> 'NOTIFICATION-GROUP', 'NOTIFICATIONS', 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES', + 'PRODUCT-RELEASE', + 'SUPPORTS', + 'INCLUDES', 'MODULE', 'MANDATORY-GROUPS', 'GROUP', diff --git a/lib/snmp/src/compile/snmpc.hrl b/lib/snmp/src/compile/snmpc.hrl index 5dd8d9a139..254ede51af 100644 --- a/lib/snmp/src/compile/snmpc.hrl +++ b/lib/snmp/src/compile/snmpc.hrl @@ -109,11 +109,28 @@ status, description, reference, - module, + modules, name_assign } ). +-record(mc_ac_object_variation, + {name, + syntax, + write_syntax, + access, + creation, + default_value, + description + } + ). + +-record(mc_ac_notification_variation, + {name, + access, + description + } + ). -record(mc_module_compliance, diff --git a/lib/snmp/src/compile/snmpc_lib.erl b/lib/snmp/src/compile/snmpc_lib.erl index 4490412e84..4f71c47bfa 100644 --- a/lib/snmp/src/compile/snmpc_lib.erl +++ b/lib/snmp/src/compile/snmpc_lib.erl @@ -306,7 +306,10 @@ import_mib({{'SNMPv2-TC', ImportsFromMib},Line}) -> Macros = ['TEXTUAL-CONVENTION'], import_built_in_loop(ImportsFromMib,Nodes,Types,Macros,'SNMPv2-TC',Line); import_mib({{'SNMPv2-CONF', ImportsFromMib},Line}) -> - Macros = ['OBJECT-GROUP','NOTIFICATION-GROUP','MODULE-COMPLIANCE'], + Macros = ['OBJECT-GROUP', + 'NOTIFICATION-GROUP', + 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES'], import_built_in_loop(ImportsFromMib,[],[],Macros,'SNMPv2-CONF',Line); import_mib({{'RFC1155-SMI', ImportsFromMib},Line}) -> Nodes = [makeInternalNode(internet, [1,3,6,1]), diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index 3536b538df..7af27ba816 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -59,7 +59,7 @@ newtypename objectidentifier objectname objecttypev1 -prodrelpart +prodrel range_num referpart size @@ -103,6 +103,17 @@ objectgroup notificationgroup modulecompliance agentcapabilities +ac_status +ac_modulepart +ac_modules +ac_module +ac_modulenamepart +ac_variationpart +ac_variations +ac_variation +ac_accesspart +ac_access +ac_creationpart modulepart modules module @@ -165,6 +176,10 @@ integer variable atom string quote '{' '}' '::=' ':' '=' ',' '.' '(' ')' ';' '|' 'NOTIFICATION-TYPE' 'PRODUCT-RELEASE' 'AGENT-CAPABILITIES' +'INCLUDES' +'SUPPORTS' +'VARIATION' +'CREATION-REQUIRES' 'MODULE-COMPLIANCE' 'OBJECT-GROUP' 'NOTIFICATION-GROUP' @@ -255,6 +270,8 @@ import_stuff -> 'MODULE-IDENTITY' : ensure_ver(2,'$1'), {builtin, 'MODULE-IDENTITY'}. import_stuff -> 'NOTIFICATION-TYPE' : ensure_ver(2,'$1'), {builtin, 'NOTIFICATION-TYPE'}. +import_stuff -> 'AGENT-CAPABILITIES' + : ensure_ver(2,'$1'), {builtin, 'AGENT-CAPABILITIES'}. import_stuff -> 'MODULE-COMPLIANCE' : ensure_ver(2,'$1'), {builtin, 'MODULE-COMPLIANCE'}. import_stuff -> 'NOTIFICATION-GROUP' @@ -545,14 +562,56 @@ modulecompliance -> objectname 'MODULE-COMPLIANCE' 'STATUS' statusv2 '$7', '$8'), {MC, line_of('$2')}. + agentcapabilities -> objectname 'AGENT-CAPABILITIES' - 'PRODUCT-RELEASE' prodrelpart 'STATUS' statusv2 - description referpart modulepart nameassign : - MC = make_agent_capabilities('$1', '$4', '$6', '$7', - '$8', '$9', '$10'), - {MC, line_of('$2')}. + 'PRODUCT-RELEASE' prodrel + 'STATUS' ac_status + description referpart ac_modulepart nameassign : + AC = make_agent_capabilities('$1', '$4', '$6', '$7', + '$8', '$9', '$10'), + {AC, line_of('$2')}. + +prodrel -> string : lists:reverse(val('$1')). + +ac_status -> atom : ac_status('$1'). + +ac_modulepart -> ac_modules : lists:reverse('$1'). +ac_modulepart -> '$empty' : []. + +ac_modules -> ac_module : ['$1']. +ac_modules -> ac_modules ac_module : ['$2' | '$1']. + +ac_module -> 'SUPPORTS' ac_modulenamepart 'INCLUDES' '{' objects '}' ac_variationpart : + {'$2', '$5', '$7'}. + +ac_modulenamepart -> mibname : '$1'. +ac_modulenamepart -> '$empty' : undefined. + +ac_variationpart -> '$empty' : []. +ac_variationpart -> ac_variations : lists:reverse('$1'). + +ac_variations -> ac_variation : ['$1']. +ac_variations -> ac_variations ac_variation : ['$2' | '$1']. + +%% ac_variation -> ac_objectvariation. +%% ac_variation -> ac_notificationvariation. + +ac_variation -> 'VARIATION' objectname syntaxpart writesyntaxpart ac_accesspart ac_creationpart defvalpart description : + make_ac_variation('$2', '$3', '$4', '$5', '$6', '$7', '$8'). + +%% ac_objectvariation -> 'VARIATION' objectname syntaxpart writesyntaxpart ac_accesspart ac_creationpart ac_defvalpart description : +%% make_ac_object_variation('$2', '$3', '$4', '$5', '$6', '$7', '$8'). + +%% ac_notificationvariation -> 'VARIATION' objectname ac_accesspart description : +%% make_ac_notification_variation('$2', '$3', '$4'). + +ac_accesspart -> 'ACCESS' ac_access : '$2'. +ac_accesspart -> '$empty' : undefined. + +ac_access -> atom: ac_access('$1'). -prodrelpart -> string : $1. +ac_creationpart -> 'CREATION-REQUIRES' '{' objects '}' : lists:reverse('$3'). +ac_creationpart -> '$empty' : []. modulepart -> '$empty'. modulepart -> modules. @@ -669,6 +728,14 @@ statusv2(Tok) -> "syntax error before: " ++ atom_to_list(Else)) end. +ac_status(Tok) -> + case val(Tok) of + current -> current; + obsolete -> obsolete; + Else -> return_error(line_of(Tok), + "syntax error before: " ++ atom_to_list(Else)) + end. + accessv1(Tok) -> case val(Tok) of 'read-only' -> 'read-only'; @@ -690,6 +757,18 @@ accessv2(Tok) -> "syntax error before: " ++ atom_to_list(Else)) end. +ac_access(Tok) -> + case val(Tok) of + 'not-implemented' -> 'not-implemented'; % only for notifications + 'accessible-for-notify' -> 'accessible-for-notify'; + 'read-only' -> 'read-only'; + 'read-write' -> 'read-write'; + 'read-create' -> 'read-create'; + 'write-only' -> 'write-only'; % for backward-compatibility only + Else -> return_error(line_of(Tok), + "syntax error before: " ++ atom_to_list(Else)) + end. + %% --------------------------------------------------------------------- %% Various basic record build functions %% --------------------------------------------------------------------- @@ -758,15 +837,49 @@ make_notification(Name, Vars, Status, Desc, Ref, NA) -> reference = Ref, name_assign = NA}. -make_agent_capabilities(Name, ProdRel, Status, Desc, Ref, Mod, NA) -> +make_agent_capabilities(Name, ProdRel, Status, Desc, Ref, Mods, NA) -> #mc_agent_capabilities{name = Name, product_release = ProdRel, status = Status, description = Desc, reference = Ref, - module = Mod, + modules = Mods, name_assign = NA}. +make_ac_variation(Name, + undefined = _Syntax, + undefined = _WriteSyntax, + Access, + undefined = _Creation, + undefined = _DefVal, + Desc) -> +%% io:format("make_ac_variation -> entry with" +%% "~n Name: ~p" +%% "~n Access: ~p" +%% "~n Desc: ~p" +%% "~n", [Name, Access, Desc]), + #mc_ac_notification_variation{name = Name, + access = Access, + description = Desc}; + +make_ac_variation(Name, Syntax, WriteSyntax, Access, Creation, DefVal, Desc) -> +%% io:format("make_ac_variation -> entry with" +%% "~n Name: ~p" +%% "~n Syntax: ~p" +%% "~n WriteSyntax: ~p" +%% "~n Access: ~p" +%% "~n Creation: ~p" +%% "~n DefVal: ~p" +%% "~n Desc: ~p" +%% "~n", [Name, Syntax, WriteSyntax, Access, Creation, DefVal, Desc]), + #mc_ac_object_variation{name = Name, + syntax = Syntax, + write_syntax = WriteSyntax, + access = Access, + creation = Creation, + default_value = DefVal, + description = Desc}. + make_module_compliance(Name, Status, Desc, Ref, Mod, NA) -> #mc_module_compliance{name = Name, status = Status, diff --git a/lib/snmp/src/compile/snmpc_tok.erl b/lib/snmp/src/compile/snmpc_tok.erl index 6b99e7ae43..e238b256d0 100644 --- a/lib/snmp/src/compile/snmpc_tok.erl +++ b/lib/snmp/src/compile/snmpc_tok.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. 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 @@ -37,6 +37,8 @@ -export([null_get_line/0, format_error/1, terminate/2, handle_call/3, init/1, test/0]). +-include("snmpc_lib.hrl"). + %%---------------------------------------------------------------------- %% Reserved_words: list of KeyWords. Example: ['IF', 'BEGIN', ..., 'GOTO'] @@ -130,6 +132,10 @@ test() -> 'current','deprecated','not-accessible','obsolete', 'read-create','read-only','read-write', 'IMPORTS', 'FROM', 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES', + 'PRODUCT-RELEASE', + 'SUPPORTS', + 'INCLUDES', 'DisplayString', 'PhysAddress', 'MacAddress', @@ -225,6 +231,7 @@ get_all_tokens(Str,Toks) -> case catch tokenise(Str) of {error, ErrorInfo} -> {error, ErrorInfo}; {Token, RestChars} when is_tuple(Token) -> + %% ?vtrace("get_all_tokens -> Token: ~p", [Token]), get_all_tokens(RestChars, [Token|Toks]) end. diff --git a/lib/snmp/test/modules.mk b/lib/snmp/test/modules.mk index 6a0c3e9481..b90c6af482 100644 --- a/lib/snmp/test/modules.mk +++ b/lib/snmp/test/modules.mk @@ -62,6 +62,7 @@ COMPILER_MIB_FILES = \ OTP8574-MIB MIB_FILES = \ + AC-TEST-MIB.mib \ OLD-SNMPEA-MIB.mib \ OLD-SNMPEA-MIB-v2.mib \ Klas1.mib \ diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index ad77b01362..e2925ed6ed 100644 --- a/lib/snmp/test/snmp_compiler_test.erl +++ b/lib/snmp/test/snmp_compiler_test.erl @@ -44,6 +44,7 @@ oid_conflicts/1, imports/1, module_identity/1, + agent_capabilities/1, tickets/1, otp_6150/1, @@ -96,6 +97,7 @@ all(suite) -> oid_conflicts, imports, module_identity, + agent_capabilities, tickets ]. @@ -169,6 +171,19 @@ module_identity(Config) when is_list(Config) -> ?SKIP(not_yet_implemented). +agent_capabilities(suite) -> + []; +agent_capabilities(Config) when is_list(Config) -> + put(tname,agent_capabilities), + p("starting with Config: ~p~n", [Config]), + + Dir = ?config(comp_dir, Config), + Mib = join(Dir,"AC-TEST-MIB.mib"), + ?line {ok, Mib} = snmpc:compile(Mib, [{outdir, Dir}, {verbosity,trace}]), + io:format("agent_capabilities -> Mib: ~n~p~n", [Mib]), + ok. + + otp_6150(suite) -> []; otp_6150(Config) when is_list(Config) -> diff --git a/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib b/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib new file mode 100644 index 0000000000..58defbe1cf --- /dev/null +++ b/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib @@ -0,0 +1,131 @@ +-- +-- AC-TEST-MIB.mib +-- MIB generated by MG-SOFT Visual MIB Builder Version 5.0 Build 250 +-- Tuesday, November 30, 2010 at 23:03:18 +-- + + AC-TEST-MIB DEFINITIONS ::= BEGIN + + IMPORTS + otpExpr + FROM OTP-REG + OBJECT-GROUP, AGENT-CAPABILITIES + FROM SNMPv2-CONF + Integer32, OBJECT-TYPE, MODULE-IDENTITY, OBJECT-IDENTITY + FROM SNMPv2-SMI; + + + acTestModule MODULE-IDENTITY + LAST-UPDATED "201011302230Z" -- November 30, 2010 at 22:30 GMT + ORGANIZATION + "Ac Test Co." + CONTACT-INFO + "developer@small.company." + DESCRIPTION + "Ac Test module." + ::= { reg 1 } + + + +-- +-- Node definitions +-- + + acTest OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Test area." + ::= { otpExpr 4321 } + + + reg OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Registrations." + ::= { acTest 1 } + + + mib OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Objects." + ::= { acTest 2 } + + + someObject OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Description." + ::= { mib 1 } + + + oneMore OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Description." + ::= { mib 2 } + + + grp OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Groups + ." + ::= { acTest 3 } + + + basicGrp OBJECT-GROUP + OBJECTS { someObject } + STATUS current + DESCRIPTION + "Basic set of objects." + ::= { grp 1 } + + + allObjects OBJECT-GROUP + OBJECTS { someObject, oneMore } + STATUS current + DESCRIPTION + "Complete set." + ::= { grp 2 } + + + cap OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Capabilities." + ::= { acTest 5 } + + + basicAgent AGENT-CAPABILITIES + PRODUCT-RELEASE + "Product release v1." + STATUS current + DESCRIPTION + "Basic agent." + SUPPORTS AC-TEST-MIB + INCLUDES { basicGrp } + ::= { cap 1 } + + + fullAgent AGENT-CAPABILITIES + PRODUCT-RELEASE + "Product release v2." + STATUS current + DESCRIPTION + "Full featured agent." + SUPPORTS AC-TEST-MIB + INCLUDES { allObjects } + ::= { cap 2 } + + + + END + +-- +-- AC-TEST-MIB.mib +-- -- cgit v1.2.3 From 66dc042ce9a0e888cfdb8f1b0f5a2e9d4d046f9e Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 3 Dec 2010 14:44:12 +0100 Subject: Changed compiler version (to 3.2). --- lib/snmp/include/snmp_types.hrl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/include/snmp_types.hrl b/lib/snmp/include/snmp_types.hrl index 1fd6d153c9..4adb24361c 100644 --- a/lib/snmp/include/snmp_types.hrl +++ b/lib/snmp/include/snmp_types.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2010. 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 @@ -192,7 +192,7 @@ %%---------------------------------------------------------------------- -record(mib, {misc = [], - mib_format_version = "3.1", + mib_format_version = "3.2", name = "", module_identity, %% Not in SMIv1, and only with +module_identity mes = [], -- cgit v1.2.3 From 314e80f58bbee2924bf61bdc7b987750d58ca2ef Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 3 Dec 2010 16:13:18 +0100 Subject: Typed more of the info. Also added more of it in the compiled mib. Also prepared for future module_compilance addition. --- lib/snmp/src/compile/snmpc.erl | 12 ++--- lib/snmp/src/compile/snmpc.hrl | 20 +++++++++ lib/snmp/src/compile/snmpc_mib_gram.yrl | 79 +++++++++++++++++++-------------- lib/snmp/test/snmp_compiler_test.erl | 18 +++++--- 4 files changed, 84 insertions(+), 45 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index 84c9c46fc9..d6abf273a1 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -1366,18 +1366,17 @@ save(Filename, MibName, Options) -> parse(FileName) -> - ?vtrace("parse -> start tokenizer for ~p", [FileName]), +%% ?vtrace("parse -> start tokenizer for ~p", [FileName]), case snmpc_tok:start_link(reserved_words(), [{file, FileName ++ ".mib"}, {forget_stringdata, true}]) of {error,ReasonStr} -> snmpc_lib:error(lists:flatten(ReasonStr),[]); {ok, TokPid} -> - ?vtrace("parse -> tokenizer start, now get tokens", []), +%% ?vtrace("parse -> tokenizer start, now get tokens", []), Toks = snmpc_tok:get_all_tokens(TokPid), - ?vtrace("parse -> tokens: ~p", [Toks]), +%% ?vtrace("parse -> tokens: ~p", [Toks]), set_version(Toks), - %% io:format("parse -> lexical analysis: ~n~p~n", [Toks]), %% ?vtrace("parse -> lexical analysis: ~n~p", [Toks]), CDataArg = case lists:keysearch(module, 1, get(options)) of @@ -1385,7 +1384,8 @@ parse(FileName) -> _ -> {file, FileName ++ ".funcs"} end, put(cdata,snmpc_lib:make_cdata(CDataArg)), - ?vtrace("parse -> stop tokenizer and then do the actual parse", []), +%% ?vtrace("parse -> stop tokenizer and then do the actual parse", +%% []), snmpc_tok:stop(TokPid), Res = if is_list(Toks) -> @@ -1393,7 +1393,7 @@ parse(FileName) -> true -> Toks end, - ?vtrace("parse -> parsed result: ~n~p", [Res]), +%% ?vtrace("parse -> parsed result: ~n~p", [Res]), case Res of {ok, PData} -> {ok, PData}; diff --git a/lib/snmp/src/compile/snmpc.hrl b/lib/snmp/src/compile/snmpc.hrl index 254ede51af..76508486fd 100644 --- a/lib/snmp/src/compile/snmpc.hrl +++ b/lib/snmp/src/compile/snmpc.hrl @@ -132,6 +132,13 @@ } ). +-record(mc_ac_module, + {name, + groups, + variation + } + ). + -record(mc_module_compliance, {name, @@ -143,6 +150,19 @@ } ). +-record(mc_mc_compliance_group, + {name, + description + } + ). + +-record(mc_mc_module, + {name, + mandatory, + compliance + } + ). + -record(mc_object_group, {name, diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index 7af27ba816..5b91cb5d01 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -114,15 +114,15 @@ ac_variation ac_accesspart ac_access ac_creationpart -modulepart -modules -module -modulenamepart -mandatorypart -compliancepart -compliances -compliance -compliancegroup +mc_modulepart +mc_modules +mc_module +mc_modulenamepart +mc_mandatorypart +mc_compliancepart +mc_compliances +mc_compliance +mc_compliancegroup object syntaxpart writesyntaxpart @@ -557,7 +557,7 @@ notificationgroup -> objectname 'NOTIFICATION-GROUP' 'NOTIFICATIONS' '{' {NG, line_of('$2')}. modulecompliance -> objectname 'MODULE-COMPLIANCE' 'STATUS' statusv2 - description referpart modulepart nameassign : + description referpart mc_modulepart nameassign : MC = make_module_compliance('$1', '$4', '$5', '$6', '$7', '$8'), {MC, line_of('$2')}. @@ -582,7 +582,7 @@ ac_modules -> ac_module : ['$1']. ac_modules -> ac_modules ac_module : ['$2' | '$1']. ac_module -> 'SUPPORTS' ac_modulenamepart 'INCLUDES' '{' objects '}' ac_variationpart : - {'$2', '$5', '$7'}. + make_ac_module('$2', '$5', '$7'). ac_modulenamepart -> mibname : '$1'. ac_modulenamepart -> '$empty' : undefined. @@ -599,44 +599,40 @@ ac_variations -> ac_variations ac_variation : ['$2' | '$1']. ac_variation -> 'VARIATION' objectname syntaxpart writesyntaxpart ac_accesspart ac_creationpart defvalpart description : make_ac_variation('$2', '$3', '$4', '$5', '$6', '$7', '$8'). -%% ac_objectvariation -> 'VARIATION' objectname syntaxpart writesyntaxpart ac_accesspart ac_creationpart ac_defvalpart description : -%% make_ac_object_variation('$2', '$3', '$4', '$5', '$6', '$7', '$8'). - -%% ac_notificationvariation -> 'VARIATION' objectname ac_accesspart description : -%% make_ac_notification_variation('$2', '$3', '$4'). - ac_accesspart -> 'ACCESS' ac_access : '$2'. ac_accesspart -> '$empty' : undefined. ac_access -> atom: ac_access('$1'). ac_creationpart -> 'CREATION-REQUIRES' '{' objects '}' : lists:reverse('$3'). -ac_creationpart -> '$empty' : []. +ac_creationpart -> '$empty' : []. -modulepart -> '$empty'. -modulepart -> modules. +mc_modulepart -> '$empty' : []. +mc_modulepart -> mc_modules : lists:reverse('$1'). -modules -> module. -modules -> modules module. +mc_modules -> mc_module. +mc_modules -> mc_modules mc_module. -module -> 'MODULE' modulenamepart mandatorypart compliancepart. +mc_module -> 'MODULE' mc_modulenamepart mc_mandatorypart mc_compliancepart : + make_mc_module('$2', '$3', '$4'). -modulenamepart -> mibname. -modulenamepart -> '$empty'. +mc_modulenamepart -> mibname : '$1'. +mc_modulenamepart -> '$empty' : undefined. -mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}'. -mandatorypart -> '$empty'. +mc_mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}' : lists:reverse('$3'). +mc_mandatorypart -> '$empty' : []. -compliancepart -> compliances. -compliancepart -> '$empty'. +mc_compliancepart -> mc_compliances. +mc_compliancepart -> '$empty'. -compliances -> compliance. -compliances -> compliances compliance. +mc_compliances -> mc_compliance. +mc_compliances -> mc_compliances mc_compliance. -compliance -> compliancegroup. -compliance -> object. +mc_compliance -> mc_compliancegroup. +mc_compliance -> object. -compliancegroup -> 'GROUP' objectname description. +mc_compliancegroup -> 'GROUP' objectname description : + make_mc_compliance_group('$2', '$3'). object -> 'OBJECT' objectname syntaxpart writesyntaxpart accesspart description. @@ -880,6 +876,12 @@ make_ac_variation(Name, Syntax, WriteSyntax, Access, Creation, DefVal, Desc) -> default_value = DefVal, description = Desc}. +make_ac_module(Name, Grps, Var) -> + #mc_ac_module{name = Name, + groups = Grps, + variation = Var}. + + make_module_compliance(Name, Status, Desc, Ref, Mod, NA) -> #mc_module_compliance{name = Name, status = Status, @@ -888,6 +890,15 @@ make_module_compliance(Name, Status, Desc, Ref, Mod, NA) -> module = Mod, name_assign = NA}. +make_mc_module(Name, Mand, Compl) -> + #mc_mc_module{name = Name, + mandatory = Mand, + compliance = Compl}. + +make_mc_compliance_group(Name, Desc) -> + #mc_mc_compliance_group{name = Name, + description = Desc}. + make_object_group(Name, Objs, Status, Desc, Ref, NA) -> #mc_object_group{name = Name, objects = Objs, diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index e2925ed6ed..09fc417af4 100644 --- a/lib/snmp/test/snmp_compiler_test.erl +++ b/lib/snmp/test/snmp_compiler_test.erl @@ -79,10 +79,10 @@ init_per_testcase(_Case, Config) when is_list(Config) -> MibDir = join(lists:reverse(["snmp_test_data"|RL])), CompDir = join(Dir, "comp_dir/"), ?line ok = file:make_dir(CompDir), - [{comp_dir, CompDir},{mib_dir, MibDir}|Config]. + [{comp_dir, CompDir}, {mib_dir, MibDir} | Config]. fin_per_testcase(_Case, Config) when is_list(Config) -> - CompDir = ?config(comp_dir, Config), + CompDir = ?config(comp_dir, Config), ?line ok = ?DEL_DIR(CompDir), lists:keydelete(comp_dir, 1, Config). @@ -177,9 +177,17 @@ agent_capabilities(Config) when is_list(Config) -> put(tname,agent_capabilities), p("starting with Config: ~p~n", [Config]), - Dir = ?config(comp_dir, Config), - Mib = join(Dir,"AC-TEST-MIB.mib"), - ?line {ok, Mib} = snmpc:compile(Mib, [{outdir, Dir}, {verbosity,trace}]), + SnmpPrivDir = code:priv_dir(snmp), + SnmpMibsDir = join(SnmpPrivDir, "mibs"), + OtpMibsPrivDir = code:priv_dir(otp_mibs), + OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), + Dir = ?config(mib_dir, Config), + AcMib = join(Dir,"AC-TEST-MIB.mib"), + ?line {ok, Mib} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), io:format("agent_capabilities -> Mib: ~n~p~n", [Mib]), ok. -- cgit v1.2.3 From c5c4c480f559b805a73d31448e211235da1a2098 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 3 Dec 2010 16:40:27 +0100 Subject: The parser exports even more of the module-complience data for future use. In later stages, the compiler curently dropps this info. --- lib/snmp/src/compile/snmpc.erl | 7 +++-- lib/snmp/src/compile/snmpc.hrl | 23 +++++++++----- lib/snmp/src/compile/snmpc_mib_gram.yrl | 56 +++++++++++++++++++-------------- 3 files changed, 52 insertions(+), 34 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index d6abf273a1..af6e39d058 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -933,18 +933,19 @@ definitions_loop([{#mc_agent_capabilities{name = Name, "~n Parent: ~p" "~n SubIndex: ~p", [Name, Status, Desc, Parent, SubIdx], Line), + update_status(Name, Status), ensure_macro_imported('AGENT-CAPABILITIES', Line), snmpc_lib:register_oid(Line, Name, Parent, SubIdx), - NewME = snmpc_lib:makeInternalNode2(false, Name), + NewME = snmpc_lib:makeInternalNode2(false, Name), Description = make_description(Desc), - Reference = + Reference = case Ref of undefined -> []; _ -> [{reference, Ref}] end, - Modules = + Modules = case Mods of undefined -> []; diff --git a/lib/snmp/src/compile/snmpc.hrl b/lib/snmp/src/compile/snmpc.hrl index 76508486fd..f349cae3f2 100644 --- a/lib/snmp/src/compile/snmpc.hrl +++ b/lib/snmp/src/compile/snmpc.hrl @@ -114,6 +114,13 @@ } ). +-record(mc_ac_module, + {name, + groups, + variation + } + ). + -record(mc_ac_object_variation, {name, syntax, @@ -132,13 +139,6 @@ } ). --record(mc_ac_module, - {name, - groups, - variation - } - ). - -record(mc_module_compliance, {name, @@ -156,6 +156,15 @@ } ). +-record(mc_mc_object, + {name, + syntax, + write_syntax, + access, + description + } + ). + -record(mc_mc_module, {name, mandatory, diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index 5b91cb5d01..18e9b4f1f2 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -102,6 +102,17 @@ textualconvention objectgroup notificationgroup modulecompliance +mc_modulepart +mc_modules +mc_module +mc_modulenamepart +mc_mandatorypart +mc_compliancepart +mc_compliances +mc_compliance +mc_compliancegroup +mc_object +mc_accesspart agentcapabilities ac_status ac_modulepart @@ -114,19 +125,8 @@ ac_variation ac_accesspart ac_access ac_creationpart -mc_modulepart -mc_modules -mc_module -mc_modulenamepart -mc_mandatorypart -mc_compliancepart -mc_compliances -mc_compliance -mc_compliancegroup -object syntaxpart writesyntaxpart -accesspart fsyntax defbitsvalue defbitsnames @@ -622,28 +622,29 @@ mc_modulenamepart -> '$empty' : undefined. mc_mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}' : lists:reverse('$3'). mc_mandatorypart -> '$empty' : []. -mc_compliancepart -> mc_compliances. -mc_compliancepart -> '$empty'. +mc_compliancepart -> mc_compliances : lists:reverse('$1'). +mc_compliancepart -> '$empty' : []. -mc_compliances -> mc_compliance. -mc_compliances -> mc_compliances mc_compliance. +mc_compliances -> mc_compliance : '$1'. +mc_compliances -> mc_compliances mc_compliance : ['$2' | '$1']. -mc_compliance -> mc_compliancegroup. -mc_compliance -> object. +mc_compliance -> mc_compliancegroup : '$1'. +mc_compliance -> mc_object : '$1'. mc_compliancegroup -> 'GROUP' objectname description : make_mc_compliance_group('$2', '$3'). -object -> 'OBJECT' objectname syntaxpart writesyntaxpart accesspart description. +mc_object -> 'OBJECT' objectname syntaxpart writesyntaxpart mc_accesspart description : + make_mc_object('$2', '$3', '$4', '$5', '$6'). -syntaxpart -> 'SYNTAX' syntax. -syntaxpart -> '$empty'. +syntaxpart -> 'SYNTAX' syntax : '$2'. +syntaxpart -> '$empty' : undefined. -writesyntaxpart -> 'WRITE-SYNTAX' syntax. -writesyntaxpart -> '$empty'. +writesyntaxpart -> 'WRITE-SYNTAX' syntax : '$2'. +writesyntaxpart -> '$empty' : undefined. -accesspart -> 'MIN-ACCESS' accessv2. -accesspart -> '$empty'. +mc_accesspart -> 'MIN-ACCESS' accessv2 : '$2'. +mc_accesspart -> '$empty' : undefined. objecttypev2 -> objectname 'OBJECT-TYPE' 'SYNTAX' syntax @@ -899,6 +900,13 @@ make_mc_compliance_group(Name, Desc) -> #mc_mc_compliance_group{name = Name, description = Desc}. +make_mc_object(Name, Syntax, WriteSyntax, Access, Desc) -> + #mc_mc_object{name = Name, + syntax = Syntax, + write_syntax = WriteSyntax, + access = Access, + description = Desc}. + make_object_group(Name, Objs, Status, Desc, Ref, NA) -> #mc_object_group{name = Name, objects = Objs, -- cgit v1.2.3 From e9f9a77ddba0ed8089840e6080b18fa60e1566de Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 3 Dec 2010 17:26:39 +0100 Subject: Fixed release notes and appup file. --- lib/snmp/doc/src/notes.xml | 36 +++++++++++++++++++++++++++++------- lib/snmp/src/app/snmp.appup.src | 8 ++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 493e7aa092..0c43be695f 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -32,23 +32,45 @@ notes.xml +
+ SNMP Development Toolkit 4.19 +

Version 4.19 supports code replacement in runtime from/to + version 4.18, 4.17.1, 4.17.

+ +
+ Improvements and new features + + +

[compiler] Added support for the textual convention + AGENT-CAPABILITIES, exported by the SNMPv2-CONF mib.

+

The reference and modules part(s) are + stored in the assocList of the mib-entry record + (me).

+

Own Id: OTP-8966

+
+
+
+ +
+ Fixed Bugs and Malfunctions +

-

+
+ +
+
SNMP 4.18
Fixed Bugs and Malfunctions -

- When the function FilterMod:accept_recv/2 returned false - the SNMP agent stopped collecting messages from UDP.

-

- Own Id: OTP-8761

+

Cosmetic prep for R14B (plain) release.

-
+ -
+
SNMP Development Toolkit 4.17.1

Version 4.17.1 supports code replacement in runtime from/to version 4.17, 4.16.2, 4.16.1, 4.16, 4.15, 4.14 and 4.13.5.

diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 2375e3df70..9bb4846c6e 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,6 +22,10 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.18", + [ + ] + }, {"4.17.1", [ {load_module, snmp_community_mib, soft_purge, soft_purge, []}, @@ -66,6 +70,10 @@ %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.18", + [ + ] + }, {"4.17.1", [ {load_module, snmp_community_mib, soft_purge, soft_purge, []}, -- cgit v1.2.3 From 0c86f27f70a46e2c28bd70ac8d4406fb8ceaf5dd Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 6 Dec 2010 14:27:25 +0100 Subject: Added print operations for tables vacmSecurityToGroupTable and vacmViewTreeFamilyTable. There is still vacmAccessTable and vacmContextTable. --- lib/snmp/src/agent/snmp_target_mib.erl | 9 +-- lib/snmp/src/agent/snmp_view_based_acm_mib.erl | 86 ++++++++++++++++++++++++++ lib/snmp/vsn.mk | 2 +- 3 files changed, 90 insertions(+), 7 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/agent/snmp_target_mib.erl b/lib/snmp/src/agent/snmp_target_mib.erl index 3c32d1f59f..033dfdd92e 100644 --- a/lib/snmp/src/agent/snmp_target_mib.erl +++ b/lib/snmp/src/agent/snmp_target_mib.erl @@ -591,12 +591,9 @@ snmpTargetAddrTable(print) -> ?'snmpTargetAddrRowStatus_active' -> active; _ -> undefined end, - Prefix, - element(?snmpTargetAddrEngineId, Row), - Prefix, - element(?snmpTargetAddrTMask, Row), - Prefix, - element(?snmpTargetAddrMMS, Row)])) + Prefix, element(?snmpTargetAddrEngineId, Row), + Prefix, element(?snmpTargetAddrTMask, Row), + Prefix, element(?snmpTargetAddrMMS, Row)])) end, snmpa_mib_lib:print_table(Table, DB, FOI, PrintRow); %% Op == new | delete diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index 657207b36e..9aff0f9810 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -348,6 +348,49 @@ vacmContextTable(Op, Arg1, Arg2) -> snmp_framework_mib:intContextTable(Op, Arg1, Arg2). +vacmSecurityToGroupTable(print) -> + Table = vacmSecurityToGroupTable, + DB = db(Table), + FOI = foi(Table), + PrintRow = + fun(Prefix, Row) -> + lists:flatten( + io_lib:format("~sSecurityModel: ~p (~w)" + "~sSecurityName: ~p" + "~sGroupName: ~p" + "~sStorageType: ~p (~w)" + "~sStatus: ~p (~w)", + [Prefix, element(?vacmSecurityModel, Row), + case element(?vacmSecurityModel, Row) of + ?SEC_ANY -> any; + ?SEC_V1 -> v1; + ?SEC_V2C -> v2c; + ?SEC_USM -> usm; + _ -> undefined + end, + Prefix, element(?vacmSecurityName, Row), + Prefix, element(?vacmGroupName, Row), + Prefix, element(?vacmSecurityToGroupStorageType, Row), + case element(?vacmSecurityToGroupStorageType, Row) of + ?'vacmSecurityToGroupStorageType_readOnly' -> readOnly; + ?'vacmSecurityToGroupStorageType_permanent' -> permanent; + ?'vacmSecurityToGroupStorageType_nonVolatile' -> nonVolatile; + ?'vacmSecurityToGroupStorageType_volatile' -> volatile; + ?'vacmSecurityToGroupStorageType_other' -> other; + _ -> undefined + end, + Prefix, element(?vacmSecurityToGroupStatus, Row), + case element(?vacmSecurityToGroupStatus, Row) of + ?'vacmSecurityToGroupStatus_destroy' -> destroy; + ?'vacmSecurityToGroupStatus_createAndWait' -> createAndWait; + ?'vacmSecurityToGroupStatus_createAndGo' -> createAndGo; + ?'vacmSecurityToGroupStatus_notReady' -> notReady; + ?'vacmSecurityToGroupStatus_notInService' -> notInService; + ?'vacmSecurityToGroupStatus_active' -> active; + _ -> undefined + end])) + end, + snmpa_mib_lib:print_table(Table, DB, FOI, PrintRow); vacmSecurityToGroupTable(Op) -> snmp_generic:table_func(Op, db(vacmSecurityToGroupTable)). @@ -719,6 +762,49 @@ vacmViewSpinLock(set, NewVal) -> {vacmViewSpinLock, volatile}). +vacmViewTreeFamilyTable(print) -> + Table = vacmViewTreeFamilyTable, + DB = db(Table), + FOI = foi(Table), + PrintRow = + fun(Prefix, Row) -> + lists:flatten( + io_lib:format("~sViewName: ~p" + "~sSubtree: ~p" + "~sMask: ~p" + "~sType: ~p (~w)" + "~sStorageType: ~p (~w)" + "~sStatus: ~p (~w)", + [Prefix, element(?vacmViewTreeFamilyViewName, Row), + Prefix, element(?vacmViewTreeFamilySubtree, Row), + Prefix, element(?vacmViewTreeFamilyMask, Row), + Prefix, element(?vacmViewTreeFamilyType, Row), + case element(?vacmViewTreeFamilyType, Row) of + ?vacmViewTreeFamilyType_included -> included; + ?vacmViewTreeFamilyType_excluded -> excluded; + _ -> undefined + end, + Prefix, element(?vacmViewTreeFamilyStorageType, Row), + case element(?vacmViewTreeFamilyStorageType, Row) of + ?vacmViewTreeFamilyStorageType_readOnly -> readOnly; + ?vacmViewTreeFamilyStorageType_permanent -> permanent; + ?vacmViewTreeFamilyStorageType_nonVolatile -> nonVolatile; + ?vacmViewTreeFamilyStorageType_volatile -> volatile; + ?vacmViewTreeFamilyStorageType_other -> other; + _ -> undefined + end, + Prefix, element(?vacmViewTreeFamilyStatus, Row), + case element(?vacmViewTreeFamilyStatus, Row) of + ?vacmViewTreeFamilyStatus_destroy -> destroy; + ?vacmViewTreeFamilyStatus_createAndWait -> createAndWait; + ?vacmViewTreeFamilyStatus_createAndGo -> createAndGo; + ?vacmViewTreeFamilyStatus_notReady -> notReady; + ?vacmViewTreeFamilyStatus_notInService -> notInService; + ?vacmViewTreeFamilyStatus_active -> active; + _ -> undefined + end])) + end, + snmpa_mib_lib:print_table(Table, DB, FOI, PrintRow); vacmViewTreeFamilyTable(Op) -> snmp_generic:table_func(Op, db(vacmViewTreeFamilyTable)). vacmViewTreeFamilyTable(get_next, RowIndex, Cols) -> diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 1229b12ae2..ac9a192f5d 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -1,3 +1,3 @@ -SNMP_VSN = 4.18 +SNMP_VSN = 4.19 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -- cgit v1.2.3 From fc649b12007a5d9a895c9bbcc4a3ede76085e35d Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 6 Dec 2010 16:02:57 +0100 Subject: For the table vacmAccessTable, when performing the is_set_ok and set opteration(s), all values of the vacmAccessSecurityModel column was incorrectly translated to "any". --- lib/snmp/doc/src/notes.xml | 74 ++++++++++++++++++++++---- lib/snmp/src/agent/snmp_view_based_acm_mib.erl | 12 ++--- lib/snmp/src/app/snmp.appup.src | 10 ++++ lib/snmp/vsn.mk | 21 +++++++- 4 files changed, 99 insertions(+), 18 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 493e7aa092..ae429d0751 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -32,23 +32,75 @@ notes.xml -
SNMP 4.18 +
+ SNMP Development Toolkit 4.18.1 +

Version 4.18.1 supports code replacement in runtime from/to + version 4.18, 4.17.1 and 4.17.

+ +
+ Improvements and new features +

-

+
+ +
+ Reported Fixed Bugs and Malfunctions + + +

[agent] For the table vacmAccessTable, + when performing a is_set_ok or a set opteration, + all values of the vacmAccessSecurityModel column was + incorrectly translated to any.

+ +

Own Id: OTP-8980

+
+
+
+ +
+ Incompatibilities +

-

+
+
+ + +
+ SNMP Development Toolkit 4.18 +

Version 4.18 supports code replacement in runtime from/to + version 4.17.1 and 4.17.

+ +
+ Improvements and new features + + +

Prepared for R14B release.

+
+
+
Fixed Bugs and Malfunctions - +

-

+ +
+ +
+ Incompatibilities +

-

+
-
-
+
SNMP Development Toolkit 4.17.1

Version 4.17.1 supports code replacement in runtime from/to version 4.17, 4.16.2, 4.16.1, 4.16, 4.15, 4.14 and 4.13.5.

@@ -62,8 +114,8 @@ Reported Fixed Bugs and Malfunctions -

When the function FilterMod:accept_recv/2 - returned false the SNMP agent stopped collecting messages from UDP.

+

[agent] When the function FilterMod:accept_recv/2 returned false + the SNMP agent stopped collecting messages from UDP.

Own Id: OTP-8761

diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index 657207b36e..c0bc727c68 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -402,13 +402,13 @@ verify_vacmSecurityToGroupTable_cols([{Col, Val0}|Cols], Acc) -> verify_vacmSecurityToGroupTable_col(?vacmSecurityModel, Model) -> case Model of any -> ?SEC_ANY; - v1 -> ?SEC_ANY; - v2c -> ?SEC_ANY; - usm -> ?SEC_ANY; + v1 -> ?SEC_V1; + v2c -> ?SEC_V2C; + usm -> ?SEC_USM; ?SEC_ANY -> ?SEC_ANY; - ?SEC_V1 -> ?SEC_ANY; - ?SEC_V2C -> ?SEC_ANY; - ?SEC_USM -> ?SEC_ANY; + ?SEC_V1 -> ?SEC_V1; + ?SEC_V2C -> ?SEC_V2C; + ?SEC_USM -> ?SEC_USM; _ -> ?vlog("verification of vacmSecurityModel(~w) ~p failed", [?vacmSecurityModel, Model]), diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 2375e3df70..03a0044908 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,6 +22,11 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.18", + [ + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []} + ] + }, {"4.17.1", [ {load_module, snmp_community_mib, soft_purge, soft_purge, []}, @@ -66,6 +71,11 @@ %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.18", + [ + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []} + ] + }, {"4.17.1", [ {load_module, snmp_community_mib, soft_purge, soft_purge, []}, diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 1229b12ae2..67cc05687d 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -1,3 +1,22 @@ -SNMP_VSN = 4.18 +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2010. 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 +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +SNMP_VSN = 4.18.1 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -- cgit v1.2.3 From 5d01e37654bda53b0c81a654936abbaeb0e2f7d9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 6 Dec 2010 16:07:00 +0100 Subject: For the table vacmAccessTable, when performing the is_set_ok and set opteration(s), all values of the vacmAccessSecurityModel column was incorrectly translated to "any". --- lib/snmp/doc/src/notes.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index ae429d0751..f3bb9d25ea 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -47,8 +47,8 @@

[agent] For the table vacmAccessTable, - when performing a is_set_ok or a set opteration, - all values of the vacmAccessSecurityModel column was + when performing the is_set_ok and set opteration(s), + all values of the vacmAccessSecurityModel column was incorrectly translated to any.

+ +
SNMP 4.18
Fixed Bugs and Malfunctions -

- When the function FilterMod:accept_recv/2 returned false - the SNMP agent stopped collecting messages from UDP.

-

- Own Id: OTP-8761

+

Prepared for R14B.

-
+
-
+
SNMP Development Toolkit 4.17.1

Version 4.17.1 supports code replacement in runtime from/to version 4.17, 4.16.2, 4.16.1, 4.16, 4.15, 4.14 and 4.13.5.

diff --git a/lib/snmp/doc/src/snmp_view_based_acm_mib.xml b/lib/snmp/doc/src/snmp_view_based_acm_mib.xml index ffea256608..d595f6b93b 100644 --- a/lib/snmp/doc/src/snmp_view_based_acm_mib.xml +++ b/lib/snmp/doc/src/snmp_view_based_acm_mib.xml @@ -4,7 +4,7 @@
- 19992009 + 19992010 Ericsson AB. All Rights Reserved. @@ -38,7 +38,10 @@ SNMP-VIEW-BASED-ACM-MIB, and functions for configuring the database.

The configuration files are described in the SNMP User's Manual.

+ + + configure(ConfDir) -> void() @@ -48,27 +51,24 @@

This function is called from the supervisor at system - start-up. -

+ start-up.

Inserts all data in the configuration files into the - database and destroys all old rows with StorageType - volatile. The rows created from the configuration file - will have StorageType nonVolatile. -

-

All snmp counters are set to zero. -

+ database and destroys all old rows with StorageType + volatile. The rows created from the configuration file + will have StorageType nonVolatile.

+

All snmp counters are set to zero.

If an error is found in the configuration file, it is - reported using the function config_err/2 of the error - report module, and the function fails with the reason - configuration_error. -

+ reported using the function config_err/2 of the error + report module, and the function fails with the reason + configuration_error.

ConfDir is a string which points to the directory - where the configuration files are found. -

-

The configuration file read is: vacm.conf. -

+ where the configuration files are found.

+

The configuration file read is: vacm.conf.

+ +
+ reconfigure(ConfDir) -> void() Configure the SNMP-VIEW-BASED-ACM-MIB @@ -88,18 +88,20 @@

All snmp counters are set to zero.

If an error is found in the configuration file, it is - reported using the function config_err/2 of the error - report module, and the function fails with the reason + reported using the function + config_err/2 + of the error report module, and the function fails with the reason configuration_error.

ConfDir is a string which points to the directory where the configuration files are found.

-

The configuration file read is: vacm.conf. - -

+

The configuration file read is: vacm.conf.

+ +
+ add_sec2group(SecModel, SecName, GroupName) -> Ret Add one security to group definition @@ -113,10 +115,13 @@

Adds a security to group definition to the agent config. - Equivalent to one vacmSecurityToGroup-line in the vacm.conf file.

+ Equivalent to one vacmSecurityToGroup-line in the + vacm.conf file.

+
+ delete_sec2group(Key) -> Ret Delete one security to group definition @@ -127,9 +132,11 @@

Delete a security to group definition from the agent config.

+
+ add_access(GroupName, Prefix, SecModel, SecLevel, Match, RV, WV, NV) -> Ret Add one access definition @@ -148,10 +155,12 @@

Adds a access definition to the agent config. - Equivalent to one vacmAccess-line in the vacm.conf file.

- + Equivalent to one vacmAccess-line in the vacm.conf file.

+ +
+ delete_access(Key) -> Ret Delete one access definition @@ -161,10 +170,12 @@ Reason = term() -

Delete a access definition from the agent config.

- +

Delete a access definition from the agent config.

+ +
+ add_view_tree_fam(ViewIndex, SubTree, Status, Mask) -> Ret Add one view tree family definition @@ -178,11 +189,14 @@ Reason = term() -

Adds a view tree family definition to the agent config. - Equivalent to one vacmViewTreeFamily-line in the vacm.conf file.

- +

Adds a view tree family definition to the agent config. + Equivalent to one vacmViewTreeFamily-line in the + vacm.conf file.

+ +
+ delete_view_tree_fam(Key) -> Ret Delete one view tree family definition diff --git a/lib/snmp/doc/src/snmpa_error.xml b/lib/snmp/doc/src/snmpa_error.xml index a7312e8b24..4dbafdfbb7 100644 --- a/lib/snmp/doc/src/snmpa_error.xml +++ b/lib/snmp/doc/src/snmpa_error.xml @@ -4,7 +4,7 @@
- 20022009 + 20022010 Ericsson AB. All Rights Reserved. @@ -51,6 +51,8 @@ error_report_mod, see configuration parameters.

+ + @@ -67,8 +69,11 @@

Format and Args are as in io:format(Format, Args).

+ +
+ user_err(Format, Args) -> void() Called if a user related error occurs diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index 657207b36e..5e188c74c5 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -181,6 +181,8 @@ init_tabs(Sec2Group, Access, View) -> snmpa_local_db:table_delete(db(vacmSecurityToGroupTable)), snmpa_local_db:table_create(db(vacmSecurityToGroupTable)), init_sec2group_table(Sec2Group), + ?vdebug("create vacm access table",[]), + snmpa_vacm:cleanup(), init_access_table(Access), ?vdebug("create vacm view-tree-family table",[]), snmpa_local_db:table_delete(db(vacmViewTreeFamilyTable)), diff --git a/lib/snmp/src/agent/snmpa_vacm.erl b/lib/snmp/src/agent/snmpa_vacm.erl index 2eacea4301..91cecfcd1e 100644 --- a/lib/snmp/src/agent/snmpa_vacm.erl +++ b/lib/snmp/src/agent/snmpa_vacm.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-2010. 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 @@ -21,7 +21,7 @@ -export([get_mib_view/5]). -export([init/1, init/2, backup/1]). -export([delete/1, get_row/1, get_next_row/1, insert/1, insert/2, - dump_table/0]). + cleanup/0, dump_table/0]). -include("SNMPv2-TC.hrl"). -include("SNMP-VIEW-BASED-ACM-MIB.hrl"). @@ -256,6 +256,10 @@ delete(Key) -> ets:delete(snmpa_vacm, Key), dump_table(). + +cleanup() -> + ets:delete_all_objects(snmpa_vacm). + dump_table(true) -> dump_table(); dump_table(_) -> diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 2375e3df70..fafbf79bb7 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,6 +22,12 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.18", + [ + {load_module, snmpa_vacm, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmpa_vacm]} + ] + }, {"4.17.1", [ {load_module, snmp_community_mib, soft_purge, soft_purge, []}, @@ -66,6 +72,12 @@ %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.18", + [ + {load_module, snmpa_vacm, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmpa_vacm]} + ] + }, {"4.17.1", [ {load_module, snmp_community_mib, soft_purge, soft_purge, []}, diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 1229b12ae2..67cc05687d 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -1,3 +1,22 @@ -SNMP_VSN = 4.18 +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2010. 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 +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +SNMP_VSN = 4.18.1 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -- cgit v1.2.3 From e67b8b37c5aabe83f8872fcf71e865591af5552b Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 8 Dec 2010 16:05:42 +0100 Subject: Added preliminary veariable support. --- lib/snmp/src/agent/snmp_view_based_acm_mib.erl | 6 ++ lib/snmp/src/agent/snmpa.erl | 103 ++++++++++++++++++++----- 2 files changed, 89 insertions(+), 20 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index f91262ab57..f98b799631 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -781,6 +781,12 @@ split_cols([Col | Cols], PreCols) when Col =< 3 -> split_cols(Cols, PreCols) -> {PreCols, Cols}. +vacmViewSpinLock(print) -> + case vacmViewSpinLock(get) of + {value, Val} -> io:format("vacmViewSpinLock => ~p~n", [Val]); + Error -> io:format("vacmViewSpinLock => ERROR: ~p~n", [Error]) + end; + vacmViewSpinLock(new) -> snmp_generic:variable_func(new, {vacmViewSpinLock, volatile}), {A1,A2,A3} = erlang:now(), diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index f109741759..88417b19fe 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -105,7 +105,7 @@ set_request_limit/1, set_request_limit/2 ]). --export([print_tables/0, print_tables/1]). +-export([print_mib_info/0, print_mib_tables/0, print_mib_variables/0]). -include("snmpa_atl.hrl"). @@ -285,31 +285,94 @@ whereis_mib(Agent, Mib) when is_atom(Mib) -> %% - -print_tables() -> - Tables = [ - {snmp_view_based_acm_mib, [vacmAccessTable, - vacmSecurityToGroupTable, - vacmViewTreeFamilyTable]}, - {snmp_target_mib, [snmpTargetAddrTable, snmpTargetParamsTable]}, - {snmp_community_mib, [snmpCommunityTable]}, - {snmp_notification_mib, [snmpNotifyTable]}, - {snmp_user_based_sm_mib, [usmUserTable]} - ], - print_tables(Tables). - -print_tables([]) -> - ok; -print_tables([{Mod, Tables}|MibTables]) when is_atom(Mod) andalso is_list(Tables) -> +mibs_info() -> + [ + {snmp_view_based_acm_mib, + [ + vacmAccessTable, + vacmSecurityToGroupTable, + vacmViewTreeFamilyTable + ], + [ + vacmViewSpinLock + ]}, + {snmp_target_mib, + [ + snmpTargetAddrTable, + snmpTargetParamsTable + ], + [ + snmpTargetSpinLock + ]}, + {snmp_community_mib, + [ + snmpCommunityTable + ], + []}, + {snmp_notification_mib, + [ + snmpNotifyTable + ], + []}, + {snmp_user_based_sm_mib, + [ + usmUserTable + ], + [ + usmUserSpinLock + ]}]. + +print_mib_info() -> + MibsInfo = mibs_info(), + print_mib_info(MibsInfo). + +print_mib_info([{Mod, Tables, Variables} | MibsInfo]) -> + io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), + print_variables(Mod, Variables), print_tables(Mod, Tables), - print_tables(MibTables); -print_tables([_|MibTables]) -> - print_tables(MibTables). + print_mib_info(MibsInfo). -print_tables(Mod, Tables) -> + +print_mib_tables() -> + Tables = [{Mod, Tabs} || {Mod, Tabs, _Vars} <- mibs_info()], + print_mib_tables(Tables). + +print_mib_tables([]) -> + ok; +print_mib_tables([{Mod, Tabs}|MibTabs]) when is_atom(Mod) andalso is_list(Tabs) -> + print_mib_tables(Mod, Tabs), + print_mib_tables(MibTabs); +print_mib_tables([_|MibTabs]) -> + print_mib_tables(MibTabs). + +print_mib_tables(Mod, Tables) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), + print_tables(Mod, Tables). + +print_tables(Mod, Tables) -> [(catch Mod:Table(print)) || Table <- Tables]. +print_mib_variables() -> + Variables = [{Mod, Vars} || {Mod, _Tabs, Vars} <- mibs_info()], + print_mib_variables(Variables). + +print_mib_variables([]) -> + ok; +print_mib_variables([{Mod, Vars}|MibVars]) when is_atom(Mod) andalso is_list(Vars) -> + print_mib_variables(Mod, Vars), + print_mib_variables(MibVars); +print_mib_variables([_|MibVars]) -> + print_mib_variables(MibVars). + +print_mib_variables(Mod, Vars) -> + io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), + print_variables(Mod, Vars). + +print_variables(Mod, Variables) -> + [(catch Mod:Variable(print)) || Variable <- Variables]. + + make_pretty_mib(snmp_view_based_acm_mib) -> "SNMP-VIEW-BASED-ACM-MIB"; make_pretty_mib(snmp_target_mib) -> -- cgit v1.2.3 From 9a5ba00578bd2b2d04d8814f8a228ff7bed1c18f Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 8 Dec 2010 18:42:41 +0100 Subject: Added utility variable print function, and utilized it in view-mib. --- lib/snmp/src/agent/snmp_view_based_acm_mib.erl | 20 ++++++------ lib/snmp/src/agent/snmpa.erl | 18 ++++++----- lib/snmp/src/agent/snmpa_mib_lib.erl | 44 +++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 19 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index f98b799631..659babaf94 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -782,32 +782,30 @@ split_cols(Cols, PreCols) -> {PreCols, Cols}. vacmViewSpinLock(print) -> - case vacmViewSpinLock(get) of - {value, Val} -> io:format("vacmViewSpinLock => ~p~n", [Val]); - Error -> io:format("vacmViewSpinLock => ERROR: ~p~n", [Error]) - end; + VarAndValue = [{vacmViewSpinLock, vacmViewSpinLock(get)}], + snmpa_mib_lib:print_variables(VarAndValue); vacmViewSpinLock(new) -> - snmp_generic:variable_func(new, {vacmViewSpinLock, volatile}), + snmp_generic:variable_func(new, volatile_db(vacmViewSpinLock)), {A1,A2,A3} = erlang:now(), random:seed(A1,A2,A3), Val = random:uniform(2147483648) - 1, - snmp_generic:variable_func(set, Val, {vacmViewSpinLock, volatile}); + snmp_generic:variable_func(set, Val, volatile_db(vacmViewSpinLock)); vacmViewSpinLock(delete) -> ok; vacmViewSpinLock(get) -> - snmp_generic:variable_func(get, {vacmViewSpinLock, volatile}). + snmp_generic:variable_func(get, volatile_db(vacmViewSpinLock)). vacmViewSpinLock(is_set_ok, NewVal) -> - case snmp_generic:variable_func(get, {vacmViewSpinLock, volatile}) of + case snmp_generic:variable_func(get, volatile_db(vacmViewSpinLock)) of {value, NewVal} -> noError; _ -> inconsistentValue end; vacmViewSpinLock(set, NewVal) -> snmp_generic:variable_func(set, (NewVal + 1) rem 2147483648, - {vacmViewSpinLock, volatile}). + volatile_db(vacmViewSpinLock)). vacmViewTreeFamilyTable(print) -> @@ -942,7 +940,9 @@ do_get_vacmAccessTable(Key0, Acc) -> -db(X) -> snmpa_agent:db(X). +db(X) -> snmpa_agent:db(X). +volatile_db(X) -> {X, volatile}. + fa(vacmSecurityToGroupTable) -> ?vacmGroupName; fa(vacmViewTreeFamilyTable) -> ?vacmViewTreeFamilyMask. diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 88417b19fe..8ad2a83de4 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -328,8 +328,8 @@ print_mib_info() -> print_mib_info([{Mod, Tables, Variables} | MibsInfo]) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), - print_variables(Mod, Variables), - print_tables(Mod, Tables), + print_mib_variables2(Mod, Variables), + print_mib_tables2(Mod, Tables), print_mib_info(MibsInfo). @@ -339,7 +339,8 @@ print_mib_tables() -> print_mib_tables([]) -> ok; -print_mib_tables([{Mod, Tabs}|MibTabs]) when is_atom(Mod) andalso is_list(Tabs) -> +print_mib_tables([{Mod, Tabs}|MibTabs]) + when is_atom(Mod) andalso is_list(Tabs) -> print_mib_tables(Mod, Tabs), print_mib_tables(MibTabs); print_mib_tables([_|MibTabs]) -> @@ -347,9 +348,9 @@ print_mib_tables([_|MibTabs]) -> print_mib_tables(Mod, Tables) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), - print_tables(Mod, Tables). + print_mib_tables2(Mod, Tables). -print_tables(Mod, Tables) -> +print_mib_tables2(Mod, Tables) -> [(catch Mod:Table(print)) || Table <- Tables]. @@ -359,7 +360,8 @@ print_mib_variables() -> print_mib_variables([]) -> ok; -print_mib_variables([{Mod, Vars}|MibVars]) when is_atom(Mod) andalso is_list(Vars) -> +print_mib_variables([{Mod, Vars}|MibVars]) + when is_atom(Mod) andalso is_list(Vars) -> print_mib_variables(Mod, Vars), print_mib_variables(MibVars); print_mib_variables([_|MibVars]) -> @@ -367,9 +369,9 @@ print_mib_variables([_|MibVars]) -> print_mib_variables(Mod, Vars) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), - print_variables(Mod, Vars). + print_mib_variables2(Mod, Vars). -print_variables(Mod, Variables) -> +print_mib_variables2(Mod, Variables) -> [(catch Mod:Variable(print)) || Variable <- Variables]. diff --git a/lib/snmp/src/agent/snmpa_mib_lib.erl b/lib/snmp/src/agent/snmpa_mib_lib.erl index 441228b9ee..22057b4547 100644 --- a/lib/snmp/src/agent/snmpa_mib_lib.erl +++ b/lib/snmp/src/agent/snmpa_mib_lib.erl @@ -19,7 +19,8 @@ -module(snmpa_mib_lib). -export([table_cre_row/3, table_del_row/2]). --export([get_table/2, print_table/3, print_table/4, print_tables/1]). +-export([get_table/2]). +-export([print_variables/1, print_table/3, print_table/4, print_tables/1]). -export([gc_tab/3, gc_tab/5]). -include("SNMPv2-TC.hrl"). @@ -81,6 +82,47 @@ get_table(NameDb, FOI, Oid, Acc) -> end. +print_variables(Variables) when is_list(Variables) -> + Variables2 = print_variables_prefixify(Variables), + lists:foreach(fun({Variable, ValueResult, Prefix}) -> + print_variable(Variable, ValueResult, Prefix) + end, Variables2), + ok. + +print_variable(Variable, {value, Val}, Prefix) when is_atom(Variable) -> + io:format("~w~s => ~p~n", [Variable, Prefix, Val]); +print_variable(Variable, Error, Prefix) when is_atom(Variable) -> + io:format("~w~s => ERROR: ~p~n", [Variable, Prefix, Error]). + +print_variables_prefixify(Variables) -> + MaxVarLength = print_variables_maxlength(Variables), + print_variables_prefixify(Variables, MaxVarLength, []). + +print_variables_prefixify([], _MaxVarLength, Acc) -> + lists:reverse(Acc); +print_variables_prefixify([{Var, Res}|Variables], MaxVarLength, Acc) -> + Prefix = make_variable_print_prefix(Var, MaxVarLength), + print_variables_prefixify(Variables, MaxVarLength, + [{Var, Res, Prefix}|Acc]). + +make_variable_print_prefix(Var, MaxVarLength) -> + lists:duplicate(MaxVarLength - length(atom_to_list(Var)) + 1, $ ). + +print_variables_maxlength(Variables) -> + print_variables_maxlength(Variables, 0). + +print_variables_maxlength([], MaxLength) -> + MaxLength; +print_variables_maxlength([{Var, _}|Variables], MaxLength) when is_atom(Var) -> + VarLen = length(atom_to_list(Var)), + if + VarLen > MaxLength -> + print_variables_maxlength(Variables, VarLen); + true -> + print_variables_maxlength(Variables, MaxLength) + end. + + print_tables(Tables) when is_list(Tables) -> lists:foreach(fun({Table, DB, FOI, PrintRow}) -> print_table(Table, DB, FOI, PrintRow) -- cgit v1.2.3 From 9a80a4f0064af1773bf73df86d3534049a61e373 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 9 Dec 2010 12:19:36 +0100 Subject: First preliminary addition of the test config (there are still a bunch of hard coded paths and stuff). No sed'ing yet... --- lib/snmp/test/test_config/Makefile | 130 +++++++++++++++++++++ lib/snmp/test/test_config/agent/agent.conf.src | 20 ++++ lib/snmp/test/test_config/agent/community.conf.src | 16 +++ lib/snmp/test/test_config/agent/context.conf.src | 15 +++ lib/snmp/test/test_config/agent/notify.conf.src | 14 +++ lib/snmp/test/test_config/agent/standard.conf.src | 22 ++++ .../test/test_config/agent/target_addr.conf.src | 22 ++++ .../test/test_config/agent/target_params.conf.src | 12 ++ lib/snmp/test/test_config/agent/vacm.conf.src | 28 +++++ lib/snmp/test/test_config/manager/manager.conf.src | 16 +++ lib/snmp/test/test_config/manager/usm.conf.src | 8 ++ lib/snmp/test/test_config/modules.mk | 37 ++++++ lib/snmp/test/test_config/sys-agent.config.src | 42 +++++++ lib/snmp/test/test_config/sys-manager.config.src | 55 +++++++++ lib/snmp/test/test_config/sys.config.src | 67 +++++++++++ 15 files changed, 504 insertions(+) create mode 100644 lib/snmp/test/test_config/Makefile create mode 100644 lib/snmp/test/test_config/agent/agent.conf.src create mode 100644 lib/snmp/test/test_config/agent/community.conf.src create mode 100644 lib/snmp/test/test_config/agent/context.conf.src create mode 100644 lib/snmp/test/test_config/agent/notify.conf.src create mode 100644 lib/snmp/test/test_config/agent/standard.conf.src create mode 100644 lib/snmp/test/test_config/agent/target_addr.conf.src create mode 100644 lib/snmp/test/test_config/agent/target_params.conf.src create mode 100644 lib/snmp/test/test_config/agent/vacm.conf.src create mode 100644 lib/snmp/test/test_config/manager/manager.conf.src create mode 100644 lib/snmp/test/test_config/manager/usm.conf.src create mode 100644 lib/snmp/test/test_config/modules.mk create mode 100644 lib/snmp/test/test_config/sys-agent.config.src create mode 100644 lib/snmp/test/test_config/sys-manager.config.src create mode 100644 lib/snmp/test/test_config/sys.config.src (limited to 'lib/snmp') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile new file mode 100644 index 0000000000..187a0ca901 --- /dev/null +++ b/lib/snmp/test/test_config/Makefile @@ -0,0 +1,130 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. 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 +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk + +VSN = $(SNMP_VSN) + + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +include modules.mk + +SYS_CONFIG_SRCS = $(SYS_CONFIG_FILES:%=%.src) +AGENT_CONFIG_SRCS = $(AGENT_CONFIG_FILES:%=%.src) +MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_FILES:%=%.src) + + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH) + + +# ---------------------------------------------------- +# SNMP FLAGS +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +tests debug opt: $(SYS_CONFIG_FILES) $(AGENT_CONFIG_FILES) $(MANAGER_CONFIG_FILES) + +clean: + rm -f $(SYS_CONFIG_FILES) + rm -f $(AGENT_CONFIG_FILES) + rm -f $(MANAGER_CONFIG_FILES) + rm -f core + +docs: + + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: + +release_tests_spec: opt + $(INSTALL_DIR) $(RELSYSDIR) + chmod -f -R u+w $(RELSYSDIR) + $(INSTALL_DIR) $(RELSYSDIR)/agent + chmod -f -R u+w $(RELSYSDIR)/agent + $(INSTALL_DIR) $(RELSYSDIR)/agent/conf + chmod -f -R u+w $(RELSYSDIR)/agent/conf + $(INSTALL_DIR) $(RELSYSDIR)/agent/db + chmod -f -R u+w $(RELSYSDIR)/agent/db + $(INSTALL_DIR) $(RELSYSDIR)/agent/log + chmod -f -R u+w $(RELSYSDIR)/agent/log + $(INSTALL_DIR) $(RELSYSDIR)/manager + chmod -f -R u+w $(RELSYSDIR)/manager + $(INSTALL_DIR) $(RELSYSDIR)/manager/conf + chmod -f -R u+w $(RELSYSDIR)/manager/conf + $(INSTALL_DIR) $(RELSYSDIR)/manager/db + chmod -f -R u+w $(RELSYSDIR)/manager/db + $(INSTALL_DIR) $(RELSYSDIR)/manager/log + chmod -f -R u+w $(RELSYSDIR)/manager/log + $(INSTALL_DATA) $(SYS_CONFIG_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(AGENT_CONFIG_FILES) $(RELSYSDIR)/agent/conf + $(INSTALL_DATA) $(MANAGER_CONFIG_FILES) $(RELSYSDIR)/manager/conf + +release_docs_spec: + + +info: + @echo "SNMP_DEBUG = $(SNMP_DEBUG)" + @echo "SNMP_FLAGS = $(SNMP_FLAGS)" + @echo "" + @echo "SNMP_MIB_DIR = $(SNMP_MIB_DIR)" + @echo "MIB_SOURCE = $(MIB_SOURCE)" + @echo "MIB_TARGETS = $(MIB_TARGETS)" + @echo "SNMP_MIB_FLAGS = $(SNMP_MIB_FLAGS)" + @echo "" + @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)" + @echo "" + @echo "RELSYSDIR = $(RELSYSDIR)" + @echo "" + @echo "SOURCE = $(SOURCE)" + @echo "" + @echo "TARGET_FILES = $(TARGET_FILES)" + @echo "" + @echo "EMAKEFILE = $(EMAKEFILE)" + @echo "MAKE_EMAKE = $(MAKE_EMAKE)" + @echo "BUILDTARGET = $(BUILDTARGET)" + @echo "RELTEST_FILES = $(RELTEST_FILES)" + @echo "" + + diff --git a/lib/snmp/test/test_config/agent/agent.conf.src b/lib/snmp/test/test_config/agent/agent.conf.src new file mode 100644 index 0000000000..53830dbc3e --- /dev/null +++ b/lib/snmp/test/test_config/agent/agent.conf.src @@ -0,0 +1,20 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 +%% This file defines the Agent local configuration info +%% The data is inserted into the snmpEngine* variables defined +%% in SNMP-FRAMEWORK-MIB, and the intAgent* variables defined +%% in OTP-SNMPEA-MIB. +%% Each row is a 2-tuple: +%% {AgentVariable, Value}. +%% For example +%% {intAgentUDPPort, 4000}. +%% The ip address for the agent is sent as id in traps. +%% {intAgentIpAddress, [127,42,17,5]}. +%% {snmpEngineID, "agentEngine"}. +%% {snmpEngineMaxMessageSize, 484}. +%% + + +{intAgentUDPPort, 4000}. +{intAgentIpAddress, [127,0,0,1]}. +{snmpEngineID, "foo"}. +{snmpEngineMaxMessageSize, 484}. diff --git a/lib/snmp/test/test_config/agent/community.conf.src b/lib/snmp/test/test_config/agent/community.conf.src new file mode 100644 index 0000000000..4661267950 --- /dev/null +++ b/lib/snmp/test/test_config/agent/community.conf.src @@ -0,0 +1,16 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 +%% This file defines the community info which maps to VACM parameters. +%% The data is inserted into the snmpCommunityTable defined +%% in SNMP-COMMUNITY-MIB. +%% Each row is a 5-tuple: +%% {CommunityIndex, CommunityName, SecurityName, ContextName, TransportTag}. +%% For example +%% {"1", "public", "initial", "", ""}. +%% {"2", "secret", "secret_name", "", "tag"}. +%% {"3", "bridge1", "initial", "bridge1", ""}. +%% + + +{"public", "public", "initial", "", ""}. +{"all-rights", "all-rights", "all-rights", "", ""}. +{"standard trap", "standard trap", "initial", "", ""}. diff --git a/lib/snmp/test/test_config/agent/context.conf.src b/lib/snmp/test/test_config/agent/context.conf.src new file mode 100644 index 0000000000..56000d0308 --- /dev/null +++ b/lib/snmp/test/test_config/agent/context.conf.src @@ -0,0 +1,15 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 +%% This file defines the contexts known to the agent. +%% The data is inserted into the vacmContextTable defined +%% in SNMP-VIEW-BASED-ACM-MIB. +%% Each row is a string: +%% ContextName. +%% +%% The empty string is the default context. +%% For example +%% "bridge1". +%% "bridge2". +%% + + +"". diff --git a/lib/snmp/test/test_config/agent/notify.conf.src b/lib/snmp/test/test_config/agent/notify.conf.src new file mode 100644 index 0000000000..b63668f4fd --- /dev/null +++ b/lib/snmp/test/test_config/agent/notify.conf.src @@ -0,0 +1,14 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 +%% This file defines the notification parameters. +%% The data is inserted into the snmpNotifyTable defined +%% in SNMP-NOTIFICATION-MIB. +%% The Name is used as CommunityString for v1 and v2c. +%% Each row is a 3-tuple: +%% {Name, Tag, Type}. +%% For example +%% {"standard trap", "std_trap", trap}. +%% {"standard inform", "std_inform", inform}. +%% + + +{"stadard_trap", "std_trap", trap}. diff --git a/lib/snmp/test/test_config/agent/standard.conf.src b/lib/snmp/test/test_config/agent/standard.conf.src new file mode 100644 index 0000000000..9bcca18b5e --- /dev/null +++ b/lib/snmp/test/test_config/agent/standard.conf.src @@ -0,0 +1,22 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 +%% This file defines the STANDARD-MIB info. +%% Each row is a 2-tuple: +%% {StandardVariable, Value}. +%% For example +%% {sysDescr, "Erlang SNMP agent"}. +%% {sysObjectID, [1,2,3]}. +%% {sysContact, "{mbj,eklas}@erlang.ericsson.se"}. +%% {sysName, "test"}. +%% {sysLocation, "erlang"}. +%% {sysServices, 72}. +%% {snmpEnableAuthenTraps, enabled}. +%% + + +{sysDescr, "Erlang SNMP agent"}. +{sysObjectID, [1,2,3]}. +{sysContact, "{mbj,eklas}@erlang.ericsson.se"}. +{sysLocation, "erlang"}. +{sysServices, 72}. +{snmpEnableAuthenTraps, disabled}. +{sysName, "foo"}. diff --git a/lib/snmp/test/test_config/agent/target_addr.conf.src b/lib/snmp/test/test_config/agent/target_addr.conf.src new file mode 100644 index 0000000000..2c7a6a15ad --- /dev/null +++ b/lib/snmp/test/test_config/agent/target_addr.conf.src @@ -0,0 +1,22 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 +%% This file defines the target address parameters. +%% The data is inserted into the snmpTargetAddrTable defined +%% in SNMP-TARGET-MIB, and in the snmpTargetAddrExtTable defined +%% in SNMP-COMMUNITY-MIB. +%% Each row is a 10-tuple: +%% {Name, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId, +%% TMask, MaxMessageSize}. +%% The EngineId value is only used if Inform-Requests are sent to this +%% target. If Informs are not sent, this value is ignored, and can be +%% e.g. an empty string. However, if Informs are sent, it is essential +%% that the value of EngineId matches the value of the target's +%% actual snmpEngineID. +%% For example +%% {"1.2.3.4 v1", [1,2,3,4], 162, +%% 1500, 3, "std_inform", "otp_v2", "", +%% [127,0,0,0], 2048}. +%% + + +{"127.0.0.1 v2", [127,0,0,1], 5000, 1500, 3, "std_trap", "target_v2", "", [], 2048}. +{"127.0.0.1 v2.2", [127,0,0,1], 5000, 1500, 3, "std_inform", "target_v2", "", [], 2048}. diff --git a/lib/snmp/test/test_config/agent/target_params.conf.src b/lib/snmp/test/test_config/agent/target_params.conf.src new file mode 100644 index 0000000000..8e89b91d81 --- /dev/null +++ b/lib/snmp/test/test_config/agent/target_params.conf.src @@ -0,0 +1,12 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 +%% This file defines the target parameters. +%% The data is inserted into the snmpTargetParamsTable defined +%% in SNMP-TARGET-MIB. +%% Each row is a 5-tuple: +%% {Name, MPModel, SecurityModel, SecurityName, SecurityLevel}. +%% For example +%% {"target_v3", v3, usm, "", noAuthNoPriv}. +%% + + +{"target_v2", v2c, v2c, "initial", noAuthNoPriv}. diff --git a/lib/snmp/test/test_config/agent/vacm.conf.src b/lib/snmp/test/test_config/agent/vacm.conf.src new file mode 100644 index 0000000000..c7dc5170c2 --- /dev/null +++ b/lib/snmp/test/test_config/agent/vacm.conf.src @@ -0,0 +1,28 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 +%% This file defines the Mib Views. +%% The data is inserted into the vacm* tables defined +%% in SNMP-VIEW-BASED-ACM-MIB. +%% Each row is one of 3 tuples; one for each table in the MIB: +%% {vacmSecurityToGroup, SecModel, SecName, GroupName}. +%% {vacmAccess, GroupName, Prefix, SecModel, SecLevel, Match, RV, WV, NV}. +%% {vacmViewTreeFamily, ViewIndex, ViewSubtree, ViewStatus, ViewMask}. +%% For example +%% {vacmSecurityToGroup, v2c, "initial", "initial"}. +%% {vacmSecurityToGroup, usm, "initial", "initial"}. +%% read/notify access to system +%% {vacmAccess, "initial", "", any, noAuthNoPriv, exact, +%% "system", "", "system"}. +%% {vacmViewTreeFamily, "system", [1,3,6,1,2,1,1], included, null}. +%% {vacmViewTreeFamily, "exmib", [1,3,6,1,3], included, null}. % for EX1-MIB +%% {vacmViewTreeFamily, "internet", [1,3,6,1], included, null}. +%% + + +{vacmSecurityToGroup, v2c, "initial", "initial"}. +{vacmSecurityToGroup, v2c, "all-rights", "all-rights"}. +{vacmAccess, "initial", "", any, noAuthNoPriv, exact, "restricted", "", "restricted"}. +{vacmAccess, "initial", "", usm, authNoPriv, exact, "internet", "internet", "internet"}. +{vacmAccess, "initial", "", usm, authPriv, exact, "internet", "internet", "internet"}. +{vacmAccess, "all-rights", "", any, noAuthNoPriv, exact, "internet", "internet", "internet"}. +{vacmViewTreeFamily, "restricted", [1,3,6,1], included, null}. +{vacmViewTreeFamily, "internet", [1,3,6,1], included, null}. diff --git a/lib/snmp/test/test_config/manager/manager.conf.src b/lib/snmp/test/test_config/manager/manager.conf.src new file mode 100644 index 0000000000..164e5507c6 --- /dev/null +++ b/lib/snmp/test/test_config/manager/manager.conf.src @@ -0,0 +1,16 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:05 +%% This file defines the Manager local configuration info +%% Each row is a 2-tuple: +%% {Variable, Value}. +%% For example +%% {port, 5000}. +%% {address, [127,42,17,5]}. +%% {engine_id, "managerEngine"}. +%% {max_message_size, 484}. +%% + + +{port, 5000}. +{address, [127,0,0,1]}. +{engine_id, "foo"}. +{max_message_size, 484}. diff --git a/lib/snmp/test/test_config/manager/usm.conf.src b/lib/snmp/test/test_config/manager/usm.conf.src new file mode 100644 index 0000000000..39122cab5c --- /dev/null +++ b/lib/snmp/test/test_config/manager/usm.conf.src @@ -0,0 +1,8 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:05 +%% This file defines the usm users the manager handles +%% Each row is a 6 or 7-tuple: +%% {EngineID, UserName, AuthP, AuthKey, PrivP, PrivKey} +%% {EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey} +%% + + diff --git a/lib/snmp/test/test_config/modules.mk b/lib/snmp/test/test_config/modules.mk new file mode 100644 index 0000000000..54e6e22966 --- /dev/null +++ b/lib/snmp/test/test_config/modules.mk @@ -0,0 +1,37 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 2004-2010. 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 +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +SYS_CONFIG_FILES = \ + sys.config \ + sys-agent.config \ + sys-manager.config + +AGENT_CONFIG_FILES = \ + agent/agent.conf \ + agent/community.conf \ + agent/context.conf \ + agent/notify.conf \ + agent/standard.conf \ + agent/target_addr.conf \ + agent/target_params.conf \ + agent/vacm.conf + +MANAGER_CONFIG_FILES = \ + manager/manager.conf \ + manager/usm.conf diff --git a/lib/snmp/test/test_config/sys-agent.config.src b/lib/snmp/test/test_config/sys-agent.config.src new file mode 100644 index 0000000000..9df2c6a6bc --- /dev/null +++ b/lib/snmp/test/test_config/sys-agent.config.src @@ -0,0 +1,42 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +[{snmp, + [ + {agent, + [ + {priority, normal}, + {versions, [v2]}, + {db_dir, "/ldisk/bmk/tests/snmp/seq10689/a/db"}, + {mib_storage, ets}, +%% {agent_mib_storage, volatile}, + {agent_mib_storage, persistent}, + {target_cache, [{verbosity,silence}]}, + {symbolic_store, [{verbosity,silence}]}, + {local_db, [{repair,true},{auto_save,5000},{verbosity,silence}]}, + {error_report_module, snmpa_error_logger}, + {agent_type, master}, + {agent_verbosity, trace}, + {audit_trail_log, [{type, read}, + {dir, "/ldisk/bmk/tests/snmp/seq10689/a/log"}, + {size, {10240,10}}]}, + {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/a/conf"}, + {force_load, true}, + {verbosity, trace}]}, + {multi_threaded, true}, + {mib_server, [{mibentry_override, false}, + {trapentry_override, false}, + {cache, true}, + {verbosity, trace}]}, + {note_store, [{timeout,30000}, {verbosity,silence}]}, + {supervisor, [{verbosity,silence}]}, + {net_if, [{module, snmpa_net_if}, + {verbosity, silence}, + {options, [{bind_to, true}, + {no_reuse, false}, + {req_limit, infinity}, + {sndbuf, 32000}, + {recbuf, 32000}]}]} + ] + } + ] + } +]. diff --git a/lib/snmp/test/test_config/sys-manager.config.src b/lib/snmp/test/test_config/sys-manager.config.src new file mode 100644 index 0000000000..dc795e31ab --- /dev/null +++ b/lib/snmp/test/test_config/sys-manager.config.src @@ -0,0 +1,55 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +[{snmp, + [ +%% {agent, +%% [ +%% {priority, normal}, +%% {versions, [v2]}, +%% {db_dir, "/home/eklajoh/tmp/snmp-config-2/a/"}, +%% {mib_storage, ets}, +%% {agent_mib_storage, volatile}, +%% {target_cache, [{verbosity,silence}]}, +%% {symbolic_store, [{verbosity,silence}]}, +%% {local_db, [{repair,true},{auto_save,5000},{verbosity,silence}]}, +%% {error_report_module, snmpa_error_logger}, +%% {agent_type, master}, +%% {agent_verbosity, silence}, +%% {config, [{dir, "/home/eklajoh/tmp/snmp-config-2/a/"}, {force_load, true}, {verbosity, silence}]}, +%% {multi_threaded, false}, +%% {mib_server, [{mibentry_override,false},{trapentry_override,false},{verbosity,silence}]}, +%% {note_store, [{timeout,30000},{verbosity,silence}]}, +%% {net_if, [{module,snmpa_net_if},{verbosity,silence},{options,[{bind_to,true},{no_reuse,false},{req_limit,infinity}]}]} +%% ] +%% }, + {manager, + [ + {priority, normal}, + {versions, [v1,v2,v3]}, + {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/m/conf"}, + {verbosity, trace}, + {db_dir, "/ldisk/bmk/tests/snmp/seq10689/m/db"}, + {repair, true}, + {auto_save, 5000}]}, + {inform_request_behaviour, user}, + {mibs, []}, + {server, [{timeout, 30000}, + {verbosity, trace}]}, + {note_store, [{timeout,30000}, + {verbosity,silence}]}, + {audit_trail_log, [{type, read}, + {dir, "/ldisk/bmk/tests/snmp/seq10689/m/log"}, + {size, {10240,10}}]}, + {net_if, [{module,snmpm_net_if}, + {verbosity, trace}, + {options, [{bind_to, true}, + {no_reuse, false}, +% {sndbuf, 32000}, + {recbuf, 45000} +]}]}, + {def_user_mod, snmpm_user_default}, + {def_user_data, undefined} + ] + } + ] + } +]. diff --git a/lib/snmp/test/test_config/sys.config.src b/lib/snmp/test/test_config/sys.config.src new file mode 100644 index 0000000000..5a0fa0624b --- /dev/null +++ b/lib/snmp/test/test_config/sys.config.src @@ -0,0 +1,67 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +[{snmp, + [ + {agent, + [ + {priority, normal}, + {versions, [v2]}, + {db_dir, "/ldisk/bmk/tests/snmp/seq10689/a/db"}, + {mib_storage, ets}, + {agent_mib_storage, volatile}, + {target_cache, [{verbosity,silence}]}, + {symbolic_store, [{verbosity,silence}]}, + {local_db, [{repair,true},{auto_save,5000},{verbosity,silence}]}, + {error_report_module, snmpa_error_logger}, + {agent_type, master}, + {agent_verbosity, silence}, + {audit_trail_log, [{type, read}, + {dir, "/ldisk/bmk/tests/snmp/seq10689/a/log"}, + {size, {10240,10}}]}, + {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/a/conf"}, + {force_load, true}, + {verbosity, silence}]}, + {multi_threaded, false}, + {mib_server, [{mibentry_override, false}, + {trapentry_override, false}, + {verbosity, silence}]}, + {note_store, [{timeout,30000},{verbosity,silence}]}, + {net_if, [{module, snmpa_net_if}, + {verbosity, silence}, + {options, [{bind_to, true}, + {no_reuse, false}, + {req_limit, infinity}, + {sndbuf, 32000}, + {recbuf, 32000}]}]} + ] + }, + {manager, + [ + {priority, normal}, + {versions, [v2]}, + {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/m/conf"}, + {verbosity, silence}, + {db_dir, "/ldisk/bmk/tests/snmp/seq10689/m/db"}, + {repair, true}, + {auto_save, 5000}]}, + {inform_request_behaviour, auto}, + {mibs, []}, + {server, [{timeout, 30000}, + {verbosity, silence}]}, + {note_store, [{timeout, 30000}, + {verbosity, silence}]}, + {audit_trail_log, [{type, read}, + {dir, "/ldisk/bmk/tests/snmp/seq10689/m/log"}, + {size, {10240,10}}]}, + {net_if, [{module,snmpm_net_if}, + {verbosity, silence}, + {options, [{bind_to, true}, + {no_reuse, false}, + {recbuf, 33000}, + {sndbuf, 34000}]}]}, + {def_user_mod, snmpm_user_default}, + {def_user_data, undefined} + ] + } + ] + } +]. -- cgit v1.2.3 From add572241ac6085f1dc1062ae6ca351737ec43eb Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 9 Dec 2010 12:30:02 +0100 Subject: Added preliminary make targets for config file building (sed'ing). --- lib/snmp/test/test_config/Makefile | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 187a0ca901..250c594af6 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -70,6 +70,15 @@ clean: docs: +$(SYS_CONFIG_FILES): $(SYS_CONFIG_SRCS) + @echo "sys: $< -> $@" + +$(AGENT_CONFIG_FILES): $(AGENT_CONFIG_SRCS) + @echo "agent: $< -> $@" + +$(MANAGER_CONFIG_FILES): $(MANAGER_CONFIG_SRCS) + @echo "manager: $< -> $@" + # ---------------------------------------------------- # Release Target @@ -105,26 +114,14 @@ release_docs_spec: info: - @echo "SNMP_DEBUG = $(SNMP_DEBUG)" - @echo "SNMP_FLAGS = $(SNMP_FLAGS)" - @echo "" - @echo "SNMP_MIB_DIR = $(SNMP_MIB_DIR)" - @echo "MIB_SOURCE = $(MIB_SOURCE)" - @echo "MIB_TARGETS = $(MIB_TARGETS)" - @echo "SNMP_MIB_FLAGS = $(SNMP_MIB_FLAGS)" - @echo "" - @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)" - @echo "" - @echo "RELSYSDIR = $(RELSYSDIR)" - @echo "" - @echo "SOURCE = $(SOURCE)" + @echo "SYS_CONFIG_SRCS = $(SYS_CONFIG_SRCS)" + @echo "SYS_CONFIG_FILES = $(SYS_CONFIG_FILES)" @echo "" - @echo "TARGET_FILES = $(TARGET_FILES)" + @echo "AGENT_CONFIG_SRCS = $(AGENT_CONFIG_SRCS)" + @echo "AGENT_CONFIG_FILES = $(AGENT_CONFIG_FILES)" @echo "" - @echo "EMAKEFILE = $(EMAKEFILE)" - @echo "MAKE_EMAKE = $(MAKE_EMAKE)" - @echo "BUILDTARGET = $(BUILDTARGET)" - @echo "RELTEST_FILES = $(RELTEST_FILES)" + @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" + @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" @echo "" -- cgit v1.2.3 From ec857328b0ece6a676633a3bd647a4ce37703469 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 9 Dec 2010 18:44:04 +0100 Subject: First preliminary sedding... --- lib/snmp/test/test_config/.gitignore | 18 ++++++++ lib/snmp/test/test_config/Makefile | 56 +++++++++++++++++++----- lib/snmp/test/test_config/agent/agent.conf.src | 2 +- lib/snmp/test/test_config/modules.mk | 3 ++ lib/snmp/test/test_config/sys-agent.config.src | 9 ++-- lib/snmp/test/test_config/sys-manager.config.src | 32 +++----------- lib/snmp/test/test_config/sys.config.src | 15 ++++--- lib/snmp/test/test_config/test_config.erl | 27 ++++++++++++ 8 files changed, 112 insertions(+), 50 deletions(-) create mode 100644 lib/snmp/test/test_config/.gitignore create mode 100644 lib/snmp/test/test_config/test_config.erl (limited to 'lib/snmp') diff --git a/lib/snmp/test/test_config/.gitignore b/lib/snmp/test/test_config/.gitignore new file mode 100644 index 0000000000..60d564fe4d --- /dev/null +++ b/lib/snmp/test/test_config/.gitignore @@ -0,0 +1,18 @@ +# Sys config files (Generated) +/sys.config +/sys-agent.config +/sys-manager.config + +# Agent config files (Generated) +/agent/agent.conf +/agent/community.conf +/agent/context.conf +/agent/notify.conf +/agent/standard.conf +/agent/target_addr.conf +/agent/target_params.conf +/agent/vacm.conf + +# Manager config files (Generated) +/manager/manager.conf +/manager/usm.conf diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 250c594af6..064c9f4689 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -29,55 +29,82 @@ include ../../vsn.mk VSN = $(SNMP_VSN) +# ---------------------------------------------------- +# Configured variables +# ---------------------------------------------------- +# PERL = @PERL@ +PERL = perl + + # ---------------------------------------------------- # Target Specs # ---------------------------------------------------- include modules.mk +ERL_TARGETS = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) + SYS_CONFIG_SRCS = $(SYS_CONFIG_FILES:%=%.src) AGENT_CONFIG_SRCS = $(AGENT_CONFIG_FILES:%=%.src) MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_FILES:%=%.src) +CONFIG_FILES = \ + $(SYS_CONFIG_FILES) \ + $(AGENT_CONFIG_FILES) \ + $(MANAGER_CONFIG_FILES) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH) +TARGETS = \ + $(ERL_TARGETS) \ + $(CONFIG_FILES) # ---------------------------------------------------- -# SNMP FLAGS +# Release directory specification # ---------------------------------------------------- +ifeq ($(TESTROOT),) +TESTROOT=/tmp +endif +RELSYSDIR = $(TESTROOT) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- +EBIN = . + +ERL_COMPILE_FLAGS += +'{parse_transform,sys_pre_attributes}' \ + +'{attribute,insert,app_vsn,$(APP_VSN)}' + +ifeq ($(ADDR),) +ADDR = $(shell erl -noshell -s test_config ip_address -s init stop) +endif + # ---------------------------------------------------- # Targets # ---------------------------------------------------- -tests debug opt: $(SYS_CONFIG_FILES) $(AGENT_CONFIG_FILES) $(MANAGER_CONFIG_FILES) +tests debug opt: $(TARGETS) clean: - rm -f $(SYS_CONFIG_FILES) - rm -f $(AGENT_CONFIG_FILES) - rm -f $(MANAGER_CONFIG_FILES) + rm -f $(CONFIG_FILES) + rm -f $(ERL_TARGETS) rm -f core docs: $(SYS_CONFIG_FILES): $(SYS_CONFIG_SRCS) - @echo "sys: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%DIR%?$(RELSYSDIR)? ' < $< > $@ $(AGENT_CONFIG_FILES): $(AGENT_CONFIG_SRCS) - @echo "agent: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ $(MANAGER_CONFIG_FILES): $(MANAGER_CONFIG_SRCS) - @echo "manager: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ # ---------------------------------------------------- @@ -114,6 +141,9 @@ release_docs_spec: info: + @echo "" + @echo "RELSYSDIR = $(RELSYSDIR)" + @echo "" @echo "SYS_CONFIG_SRCS = $(SYS_CONFIG_SRCS)" @echo "SYS_CONFIG_FILES = $(SYS_CONFIG_FILES)" @echo "" @@ -123,5 +153,7 @@ info: @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" @echo "" + @echo "ADDR = $(ADDR)" + @echo "" diff --git a/lib/snmp/test/test_config/agent/agent.conf.src b/lib/snmp/test/test_config/agent/agent.conf.src index 53830dbc3e..900e6a4282 100644 --- a/lib/snmp/test/test_config/agent/agent.conf.src +++ b/lib/snmp/test/test_config/agent/agent.conf.src @@ -15,6 +15,6 @@ {intAgentUDPPort, 4000}. -{intAgentIpAddress, [127,0,0,1]}. +{intAgentIpAddress, %ADDR%}. {snmpEngineID, "foo"}. {snmpEngineMaxMessageSize, 484}. diff --git a/lib/snmp/test/test_config/modules.mk b/lib/snmp/test/test_config/modules.mk index 54e6e22966..956bb54af3 100644 --- a/lib/snmp/test/test_config/modules.mk +++ b/lib/snmp/test/test_config/modules.mk @@ -35,3 +35,6 @@ AGENT_CONFIG_FILES = \ MANAGER_CONFIG_FILES = \ manager/manager.conf \ manager/usm.conf + +MODULES = \ + test_config diff --git a/lib/snmp/test/test_config/sys-agent.config.src b/lib/snmp/test/test_config/sys-agent.config.src index 9df2c6a6bc..eb6b0916ff 100644 --- a/lib/snmp/test/test_config/sys-agent.config.src +++ b/lib/snmp/test/test_config/sys-agent.config.src @@ -1,11 +1,12 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +%% This is an example sys config file for starting the snmp application +%% with only a agent running. [{snmp, [ {agent, [ {priority, normal}, {versions, [v2]}, - {db_dir, "/ldisk/bmk/tests/snmp/seq10689/a/db"}, + {db_dir, "%DIR%/agent/db"}, {mib_storage, ets}, %% {agent_mib_storage, volatile}, {agent_mib_storage, persistent}, @@ -16,9 +17,9 @@ {agent_type, master}, {agent_verbosity, trace}, {audit_trail_log, [{type, read}, - {dir, "/ldisk/bmk/tests/snmp/seq10689/a/log"}, + {dir, "%DIR%/agent/log"}, {size, {10240,10}}]}, - {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/a/conf"}, + {config, [{dir, "%DIR%/agent/conf"}, {force_load, true}, {verbosity, trace}]}, {multi_threaded, true}, diff --git a/lib/snmp/test/test_config/sys-manager.config.src b/lib/snmp/test/test_config/sys-manager.config.src index dc795e31ab..4366263084 100644 --- a/lib/snmp/test/test_config/sys-manager.config.src +++ b/lib/snmp/test/test_config/sys-manager.config.src @@ -1,33 +1,14 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +%% This is an example sys config file for starting the snmp application +%% with only a manager running. [{snmp, [ -%% {agent, -%% [ -%% {priority, normal}, -%% {versions, [v2]}, -%% {db_dir, "/home/eklajoh/tmp/snmp-config-2/a/"}, -%% {mib_storage, ets}, -%% {agent_mib_storage, volatile}, -%% {target_cache, [{verbosity,silence}]}, -%% {symbolic_store, [{verbosity,silence}]}, -%% {local_db, [{repair,true},{auto_save,5000},{verbosity,silence}]}, -%% {error_report_module, snmpa_error_logger}, -%% {agent_type, master}, -%% {agent_verbosity, silence}, -%% {config, [{dir, "/home/eklajoh/tmp/snmp-config-2/a/"}, {force_load, true}, {verbosity, silence}]}, -%% {multi_threaded, false}, -%% {mib_server, [{mibentry_override,false},{trapentry_override,false},{verbosity,silence}]}, -%% {note_store, [{timeout,30000},{verbosity,silence}]}, -%% {net_if, [{module,snmpa_net_if},{verbosity,silence},{options,[{bind_to,true},{no_reuse,false},{req_limit,infinity}]}]} -%% ] -%% }, {manager, [ {priority, normal}, {versions, [v1,v2,v3]}, - {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/m/conf"}, + {config, [{dir, "%DIR%/manager/conf"}, {verbosity, trace}, - {db_dir, "/ldisk/bmk/tests/snmp/seq10689/m/db"}, + {db_dir, "%DIR%/manager/db"}, {repair, true}, {auto_save, 5000}]}, {inform_request_behaviour, user}, @@ -37,15 +18,14 @@ {note_store, [{timeout,30000}, {verbosity,silence}]}, {audit_trail_log, [{type, read}, - {dir, "/ldisk/bmk/tests/snmp/seq10689/m/log"}, + {dir, "%DIR%/manager/log"}, {size, {10240,10}}]}, {net_if, [{module,snmpm_net_if}, {verbosity, trace}, {options, [{bind_to, true}, {no_reuse, false}, % {sndbuf, 32000}, - {recbuf, 45000} -]}]}, + {recbuf, 45000}]}]}, {def_user_mod, snmpm_user_default}, {def_user_data, undefined} ] diff --git a/lib/snmp/test/test_config/sys.config.src b/lib/snmp/test/test_config/sys.config.src index 5a0fa0624b..7e4e3b0acd 100644 --- a/lib/snmp/test/test_config/sys.config.src +++ b/lib/snmp/test/test_config/sys.config.src @@ -1,11 +1,12 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +%% This is an example sys config file for starting the snmp application +%% with both an agent and a manager running. [{snmp, [ {agent, [ {priority, normal}, {versions, [v2]}, - {db_dir, "/ldisk/bmk/tests/snmp/seq10689/a/db"}, + {db_dir, "%DIR%/agent/db"}, {mib_storage, ets}, {agent_mib_storage, volatile}, {target_cache, [{verbosity,silence}]}, @@ -15,9 +16,9 @@ {agent_type, master}, {agent_verbosity, silence}, {audit_trail_log, [{type, read}, - {dir, "/ldisk/bmk/tests/snmp/seq10689/a/log"}, + {dir, "%DIR%/agent/log"}, {size, {10240,10}}]}, - {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/a/conf"}, + {config, [{dir, "%DIR%/agent/conf"}, {force_load, true}, {verbosity, silence}]}, {multi_threaded, false}, @@ -38,9 +39,9 @@ [ {priority, normal}, {versions, [v2]}, - {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/m/conf"}, + {config, [{dir, "%DIR%/manager/conf"}, {verbosity, silence}, - {db_dir, "/ldisk/bmk/tests/snmp/seq10689/m/db"}, + {db_dir, "%DIR%/manager/db"}, {repair, true}, {auto_save, 5000}]}, {inform_request_behaviour, auto}, @@ -50,7 +51,7 @@ {note_store, [{timeout, 30000}, {verbosity, silence}]}, {audit_trail_log, [{type, read}, - {dir, "/ldisk/bmk/tests/snmp/seq10689/m/log"}, + {dir, "%DIR%/manager/log"}, {size, {10240,10}}]}, {net_if, [{module,snmpm_net_if}, {verbosity, silence}, diff --git a/lib/snmp/test/test_config/test_config.erl b/lib/snmp/test/test_config/test_config.erl new file mode 100644 index 0000000000..2a94bf5e8d --- /dev/null +++ b/lib/snmp/test/test_config/test_config.erl @@ -0,0 +1,27 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2002-2010. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +-module(test_config). + +-export([ip_address/0]). + +ip_address() -> + {ok, Hostname} = inet:gethostname(), + {ok, Address} = inet:getaddr(Hostname, inet), + io:format("~w", [tuple_to_list(Address)]). -- cgit v1.2.3 From d49bdb7c372c93d5b8007cbc016a587d91539fe9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 13:41:38 +0100 Subject: "Completed" sed'ing of config files. --- lib/snmp/test/test_config/Makefile | 36 +++++++++++++++++----- lib/snmp/test/test_config/agent/agent.conf.src | 1 - lib/snmp/test/test_config/agent/community.conf.src | 1 - lib/snmp/test/test_config/agent/context.conf.src | 1 - lib/snmp/test/test_config/agent/notify.conf.src | 1 - lib/snmp/test/test_config/agent/standard.conf.src | 15 +++++---- .../test/test_config/agent/target_addr.conf.src | 5 ++- .../test/test_config/agent/target_params.conf.src | 1 - lib/snmp/test/test_config/agent/vacm.conf.src | 1 - lib/snmp/test/test_config/manager/manager.conf.src | 2 +- lib/snmp/test/test_config/snmp_test_config.erl | 32 +++++++++++++++++++ lib/snmp/test/test_config/test_config.erl | 27 ---------------- 12 files changed, 71 insertions(+), 52 deletions(-) create mode 100644 lib/snmp/test/test_config/snmp_test_config.erl delete mode 100644 lib/snmp/test/test_config/test_config.erl (limited to 'lib/snmp') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 064c9f4689..446e7d8adf 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -68,7 +68,7 @@ RELSYSDIR = $(TESTROOT) # ---------------------------------------------------- -# FLAGS +# FLAGS AND VARIABLES # ---------------------------------------------------- EBIN = . @@ -77,9 +77,26 @@ ERL_COMPILE_FLAGS += +'{parse_transform,sys_pre_attributes}' \ +'{attribute,insert,app_vsn,$(APP_VSN)}' ifeq ($(ADDR),) -ADDR = $(shell erl -noshell -s test_config ip_address -s init stop) +ADDR = $(shell erl -noshell -s snmp_test_config ip_address -s init stop) endif +ifeq ($(TARGET_NAME_PRE),) +TARGET_NAME_PRE = $(shell erl -noshell -s snmp_test_config ip_address2 -s init stop) +endif + +ifeq ($(SYS_CONTACT),) +SYS_CONTACT = foo@bar.ericsson.se +endif + +ifeq ($(SYS_LOCATION),) +SYS_LOCATION = Erlang/OTP +endif + +ifeq ($(SYS_NAME),) +SYS_NAME = FOO +endif + + # ---------------------------------------------------- # Targets @@ -94,15 +111,19 @@ clean: docs: -$(SYS_CONFIG_FILES): $(SYS_CONFIG_SRCS) +%.config: %.config.src @echo "$< -> $@" $(PERL) -p -e 's?%DIR%?$(RELSYSDIR)? ' < $< > $@ -$(AGENT_CONFIG_FILES): $(AGENT_CONFIG_SRCS) +agent/%.conf: agent/%.conf.src @echo "$< -> $@" - $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ + sed -e 's?%ADDR%?$(ADDR)? ' \ + -e 's?%SYS_CONTACT%?$(SYS_CONTACT)? ' \ + -e 's?%SYS_LOCATION%?$(SYS_LOCATION)? ' \ + -e 's?%SYS_NAME%?$(SYS_NAME)? ' \ + -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' < $< > $@ -$(MANAGER_CONFIG_FILES): $(MANAGER_CONFIG_SRCS) +manager/%.conf: manager/%.conf.src @echo "$< -> $@" $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ @@ -153,7 +174,8 @@ info: @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" @echo "" - @echo "ADDR = $(ADDR)" + @echo "ADDR = $(ADDR)" + @echo "TARGET_NAME_PRE = $(TARGET_NAME_PRE)" @echo "" diff --git a/lib/snmp/test/test_config/agent/agent.conf.src b/lib/snmp/test/test_config/agent/agent.conf.src index 900e6a4282..2977cd49f8 100644 --- a/lib/snmp/test/test_config/agent/agent.conf.src +++ b/lib/snmp/test/test_config/agent/agent.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the Agent local configuration info %% The data is inserted into the snmpEngine* variables defined %% in SNMP-FRAMEWORK-MIB, and the intAgent* variables defined diff --git a/lib/snmp/test/test_config/agent/community.conf.src b/lib/snmp/test/test_config/agent/community.conf.src index 4661267950..8dccb929c9 100644 --- a/lib/snmp/test/test_config/agent/community.conf.src +++ b/lib/snmp/test/test_config/agent/community.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the community info which maps to VACM parameters. %% The data is inserted into the snmpCommunityTable defined %% in SNMP-COMMUNITY-MIB. diff --git a/lib/snmp/test/test_config/agent/context.conf.src b/lib/snmp/test/test_config/agent/context.conf.src index 56000d0308..ea8b5a97eb 100644 --- a/lib/snmp/test/test_config/agent/context.conf.src +++ b/lib/snmp/test/test_config/agent/context.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the contexts known to the agent. %% The data is inserted into the vacmContextTable defined %% in SNMP-VIEW-BASED-ACM-MIB. diff --git a/lib/snmp/test/test_config/agent/notify.conf.src b/lib/snmp/test/test_config/agent/notify.conf.src index b63668f4fd..164fd25b95 100644 --- a/lib/snmp/test/test_config/agent/notify.conf.src +++ b/lib/snmp/test/test_config/agent/notify.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the notification parameters. %% The data is inserted into the snmpNotifyTable defined %% in SNMP-NOTIFICATION-MIB. diff --git a/lib/snmp/test/test_config/agent/standard.conf.src b/lib/snmp/test/test_config/agent/standard.conf.src index 9bcca18b5e..31e04e7695 100644 --- a/lib/snmp/test/test_config/agent/standard.conf.src +++ b/lib/snmp/test/test_config/agent/standard.conf.src @@ -1,11 +1,10 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the STANDARD-MIB info. %% Each row is a 2-tuple: %% {StandardVariable, Value}. %% For example %% {sysDescr, "Erlang SNMP agent"}. %% {sysObjectID, [1,2,3]}. -%% {sysContact, "{mbj,eklas}@erlang.ericsson.se"}. +%% {sysContact, "foo@bar.ericsson.se"}. %% {sysName, "test"}. %% {sysLocation, "erlang"}. %% {sysServices, 72}. @@ -13,10 +12,10 @@ %% -{sysDescr, "Erlang SNMP agent"}. -{sysObjectID, [1,2,3]}. -{sysContact, "{mbj,eklas}@erlang.ericsson.se"}. -{sysLocation, "erlang"}. -{sysServices, 72}. +{sysDescr, "Erlang SNMP agent"}. +{sysObjectID, [1,2,3]}. +{sysContact, "%SYS_CONTACT%"}. +{sysLocation, "%SYS_LOCATION%"}. +{sysServices, 72}. {snmpEnableAuthenTraps, disabled}. -{sysName, "foo"}. +{sysName, "%SYS_NAME%"}. diff --git a/lib/snmp/test/test_config/agent/target_addr.conf.src b/lib/snmp/test/test_config/agent/target_addr.conf.src index 2c7a6a15ad..740df74ecf 100644 --- a/lib/snmp/test/test_config/agent/target_addr.conf.src +++ b/lib/snmp/test/test_config/agent/target_addr.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the target address parameters. %% The data is inserted into the snmpTargetAddrTable defined %% in SNMP-TARGET-MIB, and in the snmpTargetAddrExtTable defined @@ -18,5 +17,5 @@ %% -{"127.0.0.1 v2", [127,0,0,1], 5000, 1500, 3, "std_trap", "target_v2", "", [], 2048}. -{"127.0.0.1 v2.2", [127,0,0,1], 5000, 1500, 3, "std_inform", "target_v2", "", [], 2048}. +{"%TARGET_NAME_PRE% v2", %ADDR%, 5000, 1500, 3, "std_trap", "target_v2", "", [], 2048}. +{"%TARGET_NAME_PRE% v2.2", %ADDR%, 5000, 1500, 3, "std_inform", "target_v2", "", [], 2048}. diff --git a/lib/snmp/test/test_config/agent/target_params.conf.src b/lib/snmp/test/test_config/agent/target_params.conf.src index 8e89b91d81..a4a535baa2 100644 --- a/lib/snmp/test/test_config/agent/target_params.conf.src +++ b/lib/snmp/test/test_config/agent/target_params.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the target parameters. %% The data is inserted into the snmpTargetParamsTable defined %% in SNMP-TARGET-MIB. diff --git a/lib/snmp/test/test_config/agent/vacm.conf.src b/lib/snmp/test/test_config/agent/vacm.conf.src index c7dc5170c2..86271443ad 100644 --- a/lib/snmp/test/test_config/agent/vacm.conf.src +++ b/lib/snmp/test/test_config/agent/vacm.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the Mib Views. %% The data is inserted into the vacm* tables defined %% in SNMP-VIEW-BASED-ACM-MIB. diff --git a/lib/snmp/test/test_config/manager/manager.conf.src b/lib/snmp/test/test_config/manager/manager.conf.src index 164e5507c6..7d4104ded2 100644 --- a/lib/snmp/test/test_config/manager/manager.conf.src +++ b/lib/snmp/test/test_config/manager/manager.conf.src @@ -11,6 +11,6 @@ {port, 5000}. -{address, [127,0,0,1]}. +{address, %ADDR%}. {engine_id, "foo"}. {max_message_size, 484}. diff --git a/lib/snmp/test/test_config/snmp_test_config.erl b/lib/snmp/test/test_config/snmp_test_config.erl new file mode 100644 index 0000000000..8d2005d061 --- /dev/null +++ b/lib/snmp/test/test_config/snmp_test_config.erl @@ -0,0 +1,32 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2002-2010. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +-module(test_config). + +-export([ip_address/0, ip_address2/0]). + +ip_address() -> + {ok, Hostname} = inet:gethostname(), + {ok, Address} = inet:getaddr(Hostname, inet), + io:format("~w", [tuple_to_list(Address)]). + +ip_address2() -> + {ok, Hostname} = inet:gethostname(), + {ok, {A1, A2, A3, A4}} = inet:getaddr(Hostname, inet), + io:format("~w.~w.~w.~w", [A1, A2, A3, A4]). diff --git a/lib/snmp/test/test_config/test_config.erl b/lib/snmp/test/test_config/test_config.erl deleted file mode 100644 index 2a94bf5e8d..0000000000 --- a/lib/snmp/test/test_config/test_config.erl +++ /dev/null @@ -1,27 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2010. 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 -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% - --module(test_config). - --export([ip_address/0]). - -ip_address() -> - {ok, Hostname} = inet:gethostname(), - {ok, Address} = inet:getaddr(Hostname, inet), - io:format("~w", [tuple_to_list(Address)]). -- cgit v1.2.3 From 58620c2052e07490beb44a4bd1a8fbb5ebc028ac Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 14:17:30 +0100 Subject: Various cosmetic (print) fixes. Wrong module names used for the utility module in the test_config dir. --- lib/snmp/src/agent/snmp_community_mib.erl | 4 +++- lib/snmp/src/agent/snmpa.erl | 7 +++++-- lib/snmp/src/agent/snmpa_mib_lib.erl | 9 ++++++--- lib/snmp/test/test_config/Makefile | 2 -- lib/snmp/test/test_config/modules.mk | 2 +- lib/snmp/test/test_config/snmp_test_config.erl | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/agent/snmp_community_mib.erl b/lib/snmp/src/agent/snmp_community_mib.erl index 8f0f4cad73..5644a43345 100644 --- a/lib/snmp/src/agent/snmp_community_mib.erl +++ b/lib/snmp/src/agent/snmp_community_mib.erl @@ -336,6 +336,8 @@ get_target_addr_ext_mms(TDomain, TAddress, Key) -> get_target_addr_ext_mms(TDomain, TAddress, NextKey) end end. + + %%----------------------------------------------------------------- %% Instrumentation Functions %%----------------------------------------------------------------- @@ -347,7 +349,7 @@ snmpCommunityTable(print) -> PrintRow = fun(Prefix, Row) -> lists:flatten( - io_lib:format("~sIndex: ~p" + io_lib:format("~sIndex: ~p" "~n~sName: ~p" "~n~sSecurityName: ~p" "~n~sContextEngineID: ~p" diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 8ad2a83de4..c09435c03b 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -326,6 +326,9 @@ print_mib_info() -> MibsInfo = mibs_info(), print_mib_info(MibsInfo). +print_mib_info([]) -> + io:format("~n", []), + ok; print_mib_info([{Mod, Tables, Variables} | MibsInfo]) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), print_mib_variables2(Mod, Variables), @@ -379,9 +382,9 @@ make_pretty_mib(snmp_view_based_acm_mib) -> "SNMP-VIEW-BASED-ACM-MIB"; make_pretty_mib(snmp_target_mib) -> "SNMP-TARGET-MIB"; -make_pretty_mib(snmp_target_mib) -> +make_pretty_mib(snmp_community_mib) -> "SNMP-COMMUNITY-MIB"; -make_pretty_mib(snmp_target_mib) -> +make_pretty_mib(snmp_notification_mib) -> "SNMP-NOTIFICATION-MIB"; make_pretty_mib(snmp_target_mib) -> "SNMP-USER-BASED-SM-MIB"; diff --git a/lib/snmp/src/agent/snmpa_mib_lib.erl b/lib/snmp/src/agent/snmpa_mib_lib.erl index 22057b4547..700bdd1a6e 100644 --- a/lib/snmp/src/agent/snmpa_mib_lib.erl +++ b/lib/snmp/src/agent/snmpa_mib_lib.erl @@ -90,9 +90,9 @@ print_variables(Variables) when is_list(Variables) -> ok. print_variable(Variable, {value, Val}, Prefix) when is_atom(Variable) -> - io:format("~w~s => ~p~n", [Variable, Prefix, Val]); + io:format("~w~s=> ~p~n", [Variable, Prefix, Val]); print_variable(Variable, Error, Prefix) when is_atom(Variable) -> - io:format("~w~s => ERROR: ~p~n", [Variable, Prefix, Error]). + io:format("~w~s=> [e] ~p~n", [Variable, Prefix, Error]). print_variables_prefixify(Variables) -> MaxVarLength = print_variables_maxlength(Variables), @@ -139,10 +139,13 @@ print_table(Table, DB, FOI, PrintRow) -> print_table(Table, TableInfo, PrintRow). print_table(Table, TableInfo, PrintRow) when is_function(PrintRow, 2) -> - io:format("~w => ~n", [Table]), + io:format("~w =>", [Table]), do_print_table(TableInfo, PrintRow). +do_print_table({ok, [] = _TableInfo}, _PrintRow) -> + io:format(" -~n", []); do_print_table({ok, TableInfo}, PrintRow) when is_function(PrintRow, 2) -> + io:format("~n", []), lists:foreach(fun({RowIdx, Row}) -> io:format(" ~w => ~n~s~n", [RowIdx, PrintRow(" ", Row)]) diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 446e7d8adf..c02bb5c601 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -32,8 +32,6 @@ VSN = $(SNMP_VSN) # ---------------------------------------------------- # Configured variables # ---------------------------------------------------- -# PERL = @PERL@ -PERL = perl # ---------------------------------------------------- diff --git a/lib/snmp/test/test_config/modules.mk b/lib/snmp/test/test_config/modules.mk index 956bb54af3..ee8b68d4eb 100644 --- a/lib/snmp/test/test_config/modules.mk +++ b/lib/snmp/test/test_config/modules.mk @@ -37,4 +37,4 @@ MANAGER_CONFIG_FILES = \ manager/usm.conf MODULES = \ - test_config + snmp_test_config diff --git a/lib/snmp/test/test_config/snmp_test_config.erl b/lib/snmp/test/test_config/snmp_test_config.erl index 8d2005d061..550a276c4c 100644 --- a/lib/snmp/test/test_config/snmp_test_config.erl +++ b/lib/snmp/test/test_config/snmp_test_config.erl @@ -17,7 +17,7 @@ %% %CopyrightEnd% %% --module(test_config). +-module(snmp_test_config). -export([ip_address/0, ip_address2/0]). -- cgit v1.2.3 From fee3f48c37432c7ea28f2e8c9eb4eacac4422db9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 15:54:25 +0100 Subject: Added variables from STANDARD-MIB (including counters). Also some minor fixes. --- lib/snmp/src/agent/snmp_standard_mib.erl | 266 ++++++++++++++++++++++++++ lib/snmp/src/agent/snmp_target_mib.erl | 4 + lib/snmp/src/agent/snmp_user_based_sm_mib.erl | 5 + lib/snmp/src/agent/snmpa.erl | 57 +++++- 4 files changed, 327 insertions(+), 5 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/agent/snmp_standard_mib.erl b/lib/snmp/src/agent/snmp_standard_mib.erl index 639172401d..7292d5b98e 100644 --- a/lib/snmp/src/agent/snmp_standard_mib.erl +++ b/lib/snmp/src/agent/snmp_standard_mib.erl @@ -40,6 +40,28 @@ sys_object_id/1, sys_object_id/2, sys_or_table/3, variable_func/1, variable_func/2, inc/1, inc/2]). +-export([sysDescr/1, sysContact/1, sysName/1, sysLocation/1, + sysServices/1, sysUpTime/1, snmpEnableAuthenTraps/1, + sysObjectID/1, + snmpInPkts/1, snmpOutPkts/1, + snmpInBadVersions/1, + snmpInBadCommunityNames/1, snmpInBadCommunityUses/1, + snmpInASNParseErrs/1, + snmpInTooBigs/1, + snmpInNoSuchNames/1, snmpInBadValues/1, + snmpInReadOnlys/1, snmpInGenErrs/1, + snmpInTotalReqVars/1, snmpInTotalSetVars/1, + snmpInGetRequests/1, snmpInSetRequests/1, + snmpInGetNexts/1, + snmpInGetResponses/1, snmpInTraps/1, + snmpOutTooBigs/1, + snmpOutNoSuchNames/1, + snmpOutBadValues/1, + snmpOutGenErrs/1, + snmpOutGetRequests/1, snmpOutSetRequests/1, + snmpOutGetNexts/1, + snmpOutGetResponses/1, + snmpOutTraps/1]). -export([dummy/1, snmp_set_serial_no/1, snmp_set_serial_no/2]). -export([add_agent_caps/2, del_agent_caps/1, get_agent_caps/0]). -export([check_standard/1]). @@ -202,18 +224,252 @@ variable_func(get, Name) -> inc(Name) -> inc(Name, 1). inc(Name, N) -> ets:update_counter(snmp_agent_table, Name, N). + +sysDescr(print) -> + VarAndValue = [{sysDescr, sysDescr(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysDescr(get) -> + VarDB = db(sysDescr), + snmp_generic:variable_get(VarDB). + + +sysContact(print) -> + VarAndValue = [{sysContact, sysContact(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysContact(get) -> + VarDB = db(sysContact), + snmp_generic:variable_get(VarDB). + + +sysName(print) -> + VarAndValue = [{sysName, sysName(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysName(get) -> + VarDB = db(sysName), + snmp_generic:variable_get(VarDB). + + +sysLocation(print) -> + VarAndValue = [{sysLocation, sysLocation(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysLocation(get) -> + VarDB = db(sysLocation), + snmp_generic:variable_get(VarDB). + + +sysServices(print) -> + VarAndValue = [{sysServices, sysServices(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysServices(get) -> + VarDB = db(sysServices), + snmp_generic:variable_get(VarDB). + + +snmpInPkts(print) -> + gen_counter(print, snmpInPkts); +snmpInPkts(get) -> + gen_counter(get, snmpInPkts). + + +snmpOutPkts(print) -> + gen_counter(print, snmpOutPkts); +snmpOutPkts(get) -> + gen_counter(get, snmpOutPkts). + + +snmpInASNParseErrs(print) -> + gen_counter(print, snmpInASNParseErrs); +snmpInASNParseErrs(get) -> + gen_counter(get, snmpInASNParseErrs). + + +snmpInBadCommunityNames(print) -> + gen_counter(print, snmpInBadCommunityNames); +snmpInBadCommunityNames(get) -> + gen_counter(get, snmpInBadCommunityNames). + + +snmpInBadCommunityUses(print) -> + gen_counter(print, snmpInBadCommunityUses); + +snmpInBadCommunityUses(get) -> + gen_counter(get, snmpInBadCommunityUses). + + +snmpInBadVersions(print) -> + gen_counter(print, snmpInBadVersions); +snmpInBadVersions(get) -> + gen_counter(get, snmpInBadVersions). + + +snmpInTooBigs(print) -> + gen_counter(print, snmpInTooBigs); +snmpInTooBigs(get) -> + gen_counter(get, snmpInTooBigs). + + +snmpInNoSuchNames(print) -> + gen_counter(print, snmpInNoSuchNames); +snmpInNoSuchNames(get) -> + gen_counter(get, snmpInNoSuchNames). + + +snmpInBadValues(print) -> + gen_counter(print, snmpInBadValues); +snmpInBadValues(get) -> + gen_counter(get, snmpInBadValues). + + +snmpInReadOnlys(print) -> + gen_counter(print, snmpInReadOnlys); +snmpInReadOnlys(get) -> + gen_counter(get, snmpInReadOnlys). + + +snmpInGenErrs(print) -> + gen_counter(print, snmpInGenErrs); +snmpInGenErrs(get) -> + gen_counter(get, snmpInGenErrs). + + +snmpInTotalReqVars(print) -> + gen_counter(print, snmpInTotalReqVars); +snmpInTotalReqVars(get) -> + gen_counter(get, snmpInTotalReqVars). + + +snmpInTotalSetVars(print) -> + gen_counter(print, snmpInTotalSetVars); +snmpInTotalSetVars(get) -> + gen_counter(get, snmpInTotalSetVars). + + +snmpInGetRequests(print) -> + gen_counter(print, snmpInGetRequests); +snmpInGetRequests(get) -> + gen_counter(get, snmpInGetRequests). + + +snmpInSetRequests(print) -> + gen_counter(print, snmpInSetRequests); +snmpInSetRequests(get) -> + gen_counter(get, snmpInSetRequests). + + +snmpInGetNexts(print) -> + gen_counter(print, snmpInGetNexts); +snmpInGetNexts(get) -> + gen_counter(get, snmpInGetNexts). + + +snmpInGetResponses(print) -> + gen_counter(print, snmpInGetResponses); +snmpInGetResponses(get) -> + gen_counter(get, snmpInGetResponses). + + +snmpInTraps(print) -> + gen_counter(print, snmpInTraps); +snmpInTraps(get) -> + gen_counter(get, snmpInTraps). + + +snmpOutTooBigs(print) -> + gen_counter(print, snmpOutTooBigs); +snmpOutTooBigs(get) -> + gen_counter(get, snmpOutTooBigs). + + +snmpOutNoSuchNames(print) -> + gen_counter(print, snmpOutNoSuchNames); +snmpOutNoSuchNames(get) -> + gen_counter(get, snmpOutNoSuchNames). + + +snmpOutBadValues(print) -> + gen_counter(print, snmpOutBadValues); +snmpOutBadValues(get) -> + gen_counter(get, snmpOutBadValues). + + +snmpOutGenErrs(print) -> + gen_counter(print, snmpOutGenErrs); +snmpOutGenErrs(get) -> + gen_counter(get, snmpOutGenErrs). + + +snmpOutGetRequests(print) -> + gen_counter(print, snmpOutGetRequests); +snmpOutGetRequests(get) -> + gen_counter(get, snmpOutGetRequests). + + +snmpOutSetRequests(print) -> + gen_counter(print, snmpOutSetRequests); +snmpOutSetRequests(get) -> + gen_counter(get, snmpOutSetRequests). + + +snmpOutGetNexts(print) -> + gen_counter(print, snmpOutGetNexts); +snmpOutGetNexts(get) -> + gen_counter(get, snmpOutGetNexts). + + +snmpOutGetResponses(print) -> + gen_counter(print, snmpOutGetResponses); +snmpOutGetResponses(get) -> + gen_counter(get, snmpOutGetResponses). + + +snmpOutTraps(print) -> + gen_counter(print, snmpOutTraps); +snmpOutTraps(get) -> + gen_counter(get, snmpOutTraps). + + +gen_counter(print, Counter) -> + Val = gen_counter(get, Counter), + VarAndValue = [{Counter, Val}], + snmpa_mib_lib:print_variables(VarAndValue); + +gen_counter(get, Counter) -> + variable_func(get, Counter). + + %%----------------------------------------------------------------- %% This is the instrumentation function for sysUpTime. %%----------------------------------------------------------------- +sysUpTime(print) -> + sys_up_time(print). + sys_up_time() -> snmpa:sys_up_time(). +sys_up_time(print) -> + VarAndValue = [{sysUpTime, sys_up_time(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + sys_up_time(get) -> {value, snmpa:sys_up_time()}. + %%----------------------------------------------------------------- %% This is the instrumentation function for snmpEnableAuthenTraps %%----------------------------------------------------------------- + +snmpEnableAuthenTraps(print) -> + snmp_enable_authen_traps(print). + +snmp_enable_authen_traps(print) -> + VarAndValue = [{snmpEnableAuthenTraps, snmp_enable_authen_traps(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + snmp_enable_authen_traps(new) -> snmp_generic:variable_func(new, db(snmpEnableAuthenTraps)); @@ -226,9 +482,17 @@ snmp_enable_authen_traps(get) -> snmp_enable_authen_traps(set, NewVal) -> snmp_generic:variable_func(set, NewVal, db(snmpEnableAuthenTraps)). + %%----------------------------------------------------------------- %% This is the instrumentation function for sysObjectId %%----------------------------------------------------------------- +sysObjectID(print) -> + sys_object_id(print). + +sys_object_id(print) -> + VarAndValue = [{sysObjectID, sys_object_id(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + sys_object_id(new) -> snmp_generic:variable_func(new, db(sysObjectID)); @@ -241,6 +505,7 @@ sys_object_id(get) -> sys_object_id(set, NewVal) -> snmp_generic:variable_func(set, NewVal, db(sysObjectID)). + %%----------------------------------------------------------------- %% This is a dummy instrumentation function for objects like %% snmpTrapOID, that is accessible-for-notify, with different @@ -249,6 +514,7 @@ sys_object_id(set, NewVal) -> %%----------------------------------------------------------------- dummy(_Op) -> ok. + %%----------------------------------------------------------------- %% This is the instrumentation function for snmpSetSerialNo. %% It is always volatile. diff --git a/lib/snmp/src/agent/snmp_target_mib.erl b/lib/snmp/src/agent/snmp_target_mib.erl index 033dfdd92e..270a5fd5b6 100644 --- a/lib/snmp/src/agent/snmp_target_mib.erl +++ b/lib/snmp/src/agent/snmp_target_mib.erl @@ -511,6 +511,10 @@ set_target_engine_id(TargetAddrName, EngineId) -> %%----------------------------------------------------------------- %% Instrumentation Functions %%----------------------------------------------------------------- +snmpTargetSpinLock(print) -> + VarAndValue = [{snmpTargetSpinLock, snmpTargetSpinLock(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + snmpTargetSpinLock(new) -> snmp_generic:variable_func(new, {snmpTargetSpinLock, volatile}), {A1,A2,A3} = erlang:now(), diff --git a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl index f40bb1a5b9..4c3f27c4ef 100644 --- a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl +++ b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl @@ -374,6 +374,11 @@ get_user_from_security_name(EngineID, SecName) -> %%----------------------------------------------------------------- %% Instrumentation Functions %%----------------------------------------------------------------- + +usmUserSpinLock(print) -> + VarAndValue = [{usmUserSpinLock, usmUserSpinLock(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + usmUserSpinLock(new) -> snmp_generic:variable_func(new, {usmUserSpinLock, volatile}), {A1,A2,A3} = erlang:now(), diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index c09435c03b..8ca057892c 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -287,6 +287,46 @@ whereis_mib(Agent, Mib) when is_atom(Mib) -> mibs_info() -> [ + {snmp_standard_mib, + [], + [ + sysDescr, + sysObjectID, + sysContact, + sysName, + sysLocation, + sysServices, + snmpEnableAuthenTraps, + sysUpTime, + snmpInPkts, + snmpOutPkts, + snmpInBadVersions, + snmpInBadCommunityNames, + snmpInBadCommunityUses, + snmpInASNParseErrs, + snmpInTooBigs, + snmpInNoSuchNames, + snmpInBadValues, + snmpInReadOnlys, + snmpInGenErrs, + snmpInTotalReqVars, + snmpInTotalSetVars, + snmpInGetRequests, + snmpInSetRequests, + snmpInGetNexts, + snmpInGetResponses, + snmpInTraps, + snmpOutTooBigs, + snmpOutNoSuchNames, + snmpOutBadValues, + snmpOutGenErrs, + snmpOutGetRequests, + snmpOutSetRequests, + snmpOutGetNexts, + snmpOutGetResponses, + snmpOutTraps + ] + }, {snmp_view_based_acm_mib, [ vacmAccessTable, @@ -295,7 +335,8 @@ mibs_info() -> ], [ vacmViewSpinLock - ]}, + ] + }, {snmp_target_mib, [ snmpTargetAddrTable, @@ -303,12 +344,14 @@ mibs_info() -> ], [ snmpTargetSpinLock - ]}, + ] + }, {snmp_community_mib, [ snmpCommunityTable ], - []}, + [] + }, {snmp_notification_mib, [ snmpNotifyTable @@ -320,7 +363,9 @@ mibs_info() -> ], [ usmUserSpinLock - ]}]. + ] + } + ]. print_mib_info() -> MibsInfo = mibs_info(), @@ -386,8 +431,10 @@ make_pretty_mib(snmp_community_mib) -> "SNMP-COMMUNITY-MIB"; make_pretty_mib(snmp_notification_mib) -> "SNMP-NOTIFICATION-MIB"; -make_pretty_mib(snmp_target_mib) -> +make_pretty_mib(snmp_user_based_sm_mib) -> "SNMP-USER-BASED-SM-MIB"; +make_pretty_mib(snmp_standard_mib) -> + "STANDARD-MIB"; make_pretty_mib(Mod) -> atom_to_list(Mod). -- cgit v1.2.3 From a0e4728a5e8e366c83e8229cefc63ba92151a86d Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 16:21:08 +0100 Subject: Cosmetic stuff (when to newline, intending, ..). --- lib/snmp/src/agent/snmp_standard_mib.erl | 15 +++++++++++---- lib/snmp/src/agent/snmpa.erl | 14 +++++++++++--- lib/snmp/src/agent/snmpa_mib_lib.erl | 8 +------- 3 files changed, 23 insertions(+), 14 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/agent/snmp_standard_mib.erl b/lib/snmp/src/agent/snmp_standard_mib.erl index 7292d5b98e..b6834d278c 100644 --- a/lib/snmp/src/agent/snmp_standard_mib.erl +++ b/lib/snmp/src/agent/snmp_standard_mib.erl @@ -446,7 +446,9 @@ gen_counter(get, Counter) -> %% This is the instrumentation function for sysUpTime. %%----------------------------------------------------------------- sysUpTime(print) -> - sys_up_time(print). + sys_up_time(print); +sysUpTime(get) -> + sys_up_time(get). sys_up_time() -> snmpa:sys_up_time(). @@ -464,7 +466,10 @@ sys_up_time(get) -> %%----------------------------------------------------------------- snmpEnableAuthenTraps(print) -> - snmp_enable_authen_traps(print). + snmp_enable_authen_traps(print); +snmpEnableAuthenTraps(get) -> + snmp_enable_authen_traps(get). + snmp_enable_authen_traps(print) -> VarAndValue = [{snmpEnableAuthenTraps, snmp_enable_authen_traps(get)}], @@ -484,10 +489,12 @@ snmp_enable_authen_traps(set, NewVal) -> %%----------------------------------------------------------------- -%% This is the instrumentation function for sysObjectId +%% This is the instrumentation function for sysObjectID %%----------------------------------------------------------------- sysObjectID(print) -> - sys_object_id(print). + sys_object_id(print); +sysObjectID(get) -> + sys_object_id(get). sys_object_id(print) -> VarAndValue = [{sysObjectID, sys_object_id(get)}], diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 8ca057892c..3c214874fe 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -378,6 +378,7 @@ print_mib_info([{Mod, Tables, Variables} | MibsInfo]) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), print_mib_variables2(Mod, Variables), print_mib_tables2(Mod, Tables), + io:format("~n", []), print_mib_info(MibsInfo). @@ -394,9 +395,12 @@ print_mib_tables([{Mod, Tabs}|MibTabs]) print_mib_tables([_|MibTabs]) -> print_mib_tables(MibTabs). +print_mib_tables(_Mod, [] = _Tables) -> + ok; print_mib_tables(Mod, Tables) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), - print_mib_tables2(Mod, Tables). + print_mib_tables2(Mod, Tables), + io:format("~n", []). print_mib_tables2(Mod, Tables) -> [(catch Mod:Table(print)) || Table <- Tables]. @@ -415,12 +419,16 @@ print_mib_variables([{Mod, Vars}|MibVars]) print_mib_variables([_|MibVars]) -> print_mib_variables(MibVars). +print_mib_variables(_Mod, [] = _Vars) -> + ok; print_mib_variables(Mod, Vars) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), - print_mib_variables2(Mod, Vars). + print_mib_variables2(Mod, Vars), + io:format("~n", []). print_mib_variables2(Mod, Variables) -> - [(catch Mod:Variable(print)) || Variable <- Variables]. + Vars = [{Var, (catch Mod:Var(get))} || Var <- Variables], + snmpa_mib_lib:print_variables(Vars). make_pretty_mib(snmp_view_based_acm_mib) -> diff --git a/lib/snmp/src/agent/snmpa_mib_lib.erl b/lib/snmp/src/agent/snmpa_mib_lib.erl index 700bdd1a6e..cb96ff8056 100644 --- a/lib/snmp/src/agent/snmpa_mib_lib.erl +++ b/lib/snmp/src/agent/snmpa_mib_lib.erl @@ -129,11 +129,6 @@ print_tables(Tables) when is_list(Tables) -> end, Tables), ok. -%% print_table(Table, DB, FOI, PrintRow) -> -%% TableInfo = get_table(DB(Table), FOI(Table)), -%% print_table(Table, TableInfo, PrintRow), -%% ok. - print_table(Table, DB, FOI, PrintRow) -> TableInfo = get_table(DB, FOI), print_table(Table, TableInfo, PrintRow). @@ -149,8 +144,7 @@ do_print_table({ok, TableInfo}, PrintRow) when is_function(PrintRow, 2) -> lists:foreach(fun({RowIdx, Row}) -> io:format(" ~w => ~n~s~n", [RowIdx, PrintRow(" ", Row)]) - end, TableInfo), - io:format("~n", []); + end, TableInfo); do_print_table({error, {invalid_rowindex, BadRowIndex, []}}, _PrintRow) -> io:format("Error: Bad rowindex ~w~n", [BadRowIndex]); do_print_table({error, {invalid_rowindex, BadRowIndex, TableInfo}}, PrintRow) -> -- cgit v1.2.3 From 8e9ef38dd36c771dff0d477fa7999d34b72e8a7a Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 17:50:38 +0100 Subject: Added counter (variables) for usm. Also added config file for usm. And more sed'ing... --- lib/snmp/src/agent/snmp_framework_mib.erl | 12 +++++ lib/snmp/src/agent/snmp_user_based_sm_mib.erl | 55 ++++++++++++++++++++++ lib/snmp/src/agent/snmp_view_based_acm_mib.erl | 4 ++ lib/snmp/src/agent/snmpa.erl | 22 +++++++-- lib/snmp/test/test_config/.gitignore | 1 + lib/snmp/test/test_config/Makefile | 26 ++++++++-- lib/snmp/test/test_config/agent/agent.conf.src | 2 +- lib/snmp/test/test_config/agent/usm.conf.src | 17 +++++++ lib/snmp/test/test_config/manager/manager.conf.src | 2 +- lib/snmp/test/test_config/manager/usm.conf.src | 1 + lib/snmp/test/test_config/modules.mk | 1 + lib/snmp/test/test_config/sys-agent.config.src | 2 +- lib/snmp/test/test_config/sys.config.src | 4 +- 13 files changed, 138 insertions(+), 11 deletions(-) create mode 100644 lib/snmp/test/test_config/agent/usm.conf.src (limited to 'lib/snmp') diff --git a/lib/snmp/src/agent/snmp_framework_mib.erl b/lib/snmp/src/agent/snmp_framework_mib.erl index d9bf7e8551..0d7866d94d 100644 --- a/lib/snmp/src/agent/snmp_framework_mib.erl +++ b/lib/snmp/src/agent/snmp_framework_mib.erl @@ -373,15 +373,27 @@ intAgentUDPPort(Op) -> intAgentIpAddress(Op) -> snmp_generic:variable_func(Op, db(intAgentIpAddress)). +snmpEngineID(print) -> + VarAndValue = [{snmpEngineID, snmpEngineID(get)}], + snmpa_mib_lib:print_variables(VarAndValue); snmpEngineID(Op) -> snmp_generic:variable_func(Op, db(snmpEngineID)). +snmpEngineMaxMessageSize(print) -> + VarAndValue = [{snmpEngineMaxMessageSize, snmpEngineMaxMessageSize(get)}], + snmpa_mib_lib:print_variables(VarAndValue); snmpEngineMaxMessageSize(Op) -> snmp_generic:variable_func(Op, db(snmpEngineMaxMessageSize)). +snmpEngineBoots(print) -> + VarAndValue = [{snmpEngineBoots, snmpEngineBoots(get)}], + snmpa_mib_lib:print_variables(VarAndValue); snmpEngineBoots(Op) -> snmp_generic:variable_func(Op, db(snmpEngineBoots)). +snmpEngineTime(print) -> + VarAndValue = [{snmpEngineTime, snmpEngineTime(get)}], + snmpa_mib_lib:print_variables(VarAndValue); snmpEngineTime(get) -> {value, get_engine_time()}. diff --git a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl index 4c3f27c4ef..69cebc858b 100644 --- a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl +++ b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl @@ -26,6 +26,12 @@ table_next/2, is_engine_id_known/1, get_user/2, get_user_from_security_name/2, mk_key_change/3, mk_key_change/5, extract_new_key/3, mk_random/1]). +-export([usmStatsUnsupportedSecLevels/1, + usmStatsNotInTimeWindows/1, + usmStatsUnknownUserNames/1, + usmStatsUnknownEngineIDs/1, + usmStatsWrongDigests/1, + usmStatsDecryptionErrors/1]). -export([add_user/1, add_user/13, delete_user/1]). %% Internal @@ -303,6 +309,54 @@ gc_tabs() -> %%----------------------------------------------------------------- %% Counter functions %%----------------------------------------------------------------- + +usmStatsUnsupportedSecLevels(print) -> + VarAndValue = [{usmStatsUnsupportedSecLevels, + usmStatsUnsupportedSecLevels(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsUnsupportedSecLevels(get) -> + get_counter(usmStatsUnsupportedSecLevels). + +usmStatsNotInTimeWindows(print) -> + VarAndValue = [{usmStatsNotInTimeWindows, usmStatsNotInTimeWindows(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsNotInTimeWindows(get) -> + get_counter(usmStatsNotInTimeWindows). + +usmStatsUnknownUserNames(print) -> + VarAndValue = [{usmStatsUnknownUserNames, usmStatsUnknownUserNames(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsUnknownUserNames(get) -> + get_counter(usmStatsUnknownUserNames). + +usmStatsUnknownEngineIDs(print) -> + VarAndValue = [{usmStatsUnknownEngineIDs, usmStatsUnknownEngineIDs(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsUnknownEngineIDs(get) -> + get_counter(usmStatsUnknownEngineIDs). + +usmStatsWrongDigests(print) -> + VarAndValue = [{usmStatsWrongDigests, usmStatsWrongDigests(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsWrongDigests(get) -> + get_counter(usmStatsWrongDigests). + +usmStatsDecryptionErrors(print) -> + VarAndValue = [{usmStatsDecryptionErrors, usmStatsDecryptionErrors(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsDecryptionErrors(get) -> + get_counter(usmStatsDecryptionErrors). + + +get_counter(Name) -> + case (catch ets:lookup(snmp_agent_table, Name)) of + [{_, Val}] -> + {value, Val}; + _ -> + genErr + end. + + init_vars() -> lists:map(fun maybe_create_var/1, vars()). maybe_create_var(Var) -> @@ -323,6 +377,7 @@ vars() -> usmStatsDecryptionErrors ]. + %%----------------------------------------------------------------- %% API functions %%----------------------------------------------------------------- diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index 659babaf94..74acda2f21 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -749,6 +749,7 @@ do_get_next(RowIndex, Cols) -> end end. + %%----------------------------------------------------------------- %% Functions to manipulate vacmAccessRows. %%----------------------------------------------------------------- @@ -939,6 +940,9 @@ do_get_vacmAccessTable(Key0, Acc) -> end. +%%----------------------------------------------------------------- +%% Wrappers +%%----------------------------------------------------------------- db(X) -> snmpa_agent:db(X). volatile_db(X) -> {X, volatile}. diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 3c214874fe..22fbd33add 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -327,6 +327,16 @@ mibs_info() -> snmpOutTraps ] }, + {snmp_framework_mib, + [ + ], + [ + snmpEngineID, + snmpEngineBoots, + snmpEngineTime, + snmpEngineMaxMessageSize + ] + }, {snmp_view_based_acm_mib, [ vacmAccessTable, @@ -362,7 +372,13 @@ mibs_info() -> usmUserTable ], [ - usmUserSpinLock + usmUserSpinLock, + usmStatsUnsupportedSecLevels, + usmStatsNotInTimeWindows, + usmStatsUnknownUserNames, + usmStatsUnknownEngineIDs, + usmStatsWrongDigests, + usmStatsDecryptionErrors ] } ]. @@ -441,8 +457,8 @@ make_pretty_mib(snmp_notification_mib) -> "SNMP-NOTIFICATION-MIB"; make_pretty_mib(snmp_user_based_sm_mib) -> "SNMP-USER-BASED-SM-MIB"; -make_pretty_mib(snmp_standard_mib) -> - "STANDARD-MIB"; +make_pretty_mib(snmp_framework_mib) -> + "SNMP-FRAMEWORK-MIB"; make_pretty_mib(Mod) -> atom_to_list(Mod). diff --git a/lib/snmp/test/test_config/.gitignore b/lib/snmp/test/test_config/.gitignore index 60d564fe4d..fc2d5dbadf 100644 --- a/lib/snmp/test/test_config/.gitignore +++ b/lib/snmp/test/test_config/.gitignore @@ -11,6 +11,7 @@ /agent/standard.conf /agent/target_addr.conf /agent/target_params.conf +/agent/usm.conf /agent/vacm.conf # Manager config files (Generated) diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index c02bb5c601..4953de7fe8 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -94,6 +94,22 @@ ifeq ($(SYS_NAME),) SYS_NAME = FOO endif +ifeq ($(AGENT_ENGINE_ID),) +AGENT_ENGINE_ID = Agent engine of $(USER) +endif + +ifeq ($(AGENT_USM_ENGINE_ID),) +AGENT_USM_ENGINE_ID = $(AGENT_ENGINE_ID) +endif + +ifeq ($(MANAGER_ENGINE_ID),) +MANAGER_ENGINE_ID = Manager engine of $(USER) +endif + +ifeq ($(MANAGER_USM_ENGINE_ID),) +MANAGER_USM_ENGINE_ID = $(MANAGER_ENGINE_ID) +endif + # ---------------------------------------------------- @@ -119,11 +135,15 @@ agent/%.conf: agent/%.conf.src -e 's?%SYS_CONTACT%?$(SYS_CONTACT)? ' \ -e 's?%SYS_LOCATION%?$(SYS_LOCATION)? ' \ -e 's?%SYS_NAME%?$(SYS_NAME)? ' \ - -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' < $< > $@ + -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' \ + -e 's?%ENGINE_ID%?\"$(AGENT_ENGINE_ID)\"? ' \ + -e 's?%USM_ENGINE_ID%?\"$(AGENT_USM_ENGINE_ID)\"? ' < $< > $@ manager/%.conf: manager/%.conf.src @echo "$< -> $@" - $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ + sed -e 's?%ADDR%?$(ADDR)? ' \ + -e 's?%ENGINE_ID%?\"$(MANAGER_ENGINE_ID)\"? ' \ + -e 's?%USM_ENGINE_ID%?\"$(MANAGER_USM_ENGINE_ID)\"? ' < $< > $@ # ---------------------------------------------------- @@ -133,7 +153,7 @@ include $(ERL_TOP)/make/otp_release_targets.mk release_spec: -release_tests_spec: opt +release_tests_spec: clean opt $(INSTALL_DIR) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) $(INSTALL_DIR) $(RELSYSDIR)/agent diff --git a/lib/snmp/test/test_config/agent/agent.conf.src b/lib/snmp/test/test_config/agent/agent.conf.src index 2977cd49f8..1fe95cc72d 100644 --- a/lib/snmp/test/test_config/agent/agent.conf.src +++ b/lib/snmp/test/test_config/agent/agent.conf.src @@ -15,5 +15,5 @@ {intAgentUDPPort, 4000}. {intAgentIpAddress, %ADDR%}. -{snmpEngineID, "foo"}. +{snmpEngineID, %ENGINE_ID%}. {snmpEngineMaxMessageSize, 484}. diff --git a/lib/snmp/test/test_config/agent/usm.conf.src b/lib/snmp/test/test_config/agent/usm.conf.src new file mode 100644 index 0000000000..0409084048 --- /dev/null +++ b/lib/snmp/test/test_config/agent/usm.conf.src @@ -0,0 +1,17 @@ +%% This file defines the security parameters for the user-based +%% security model. +%% The data is inserted into the usmUserTable defined +%% in SNMP-USER-BASED-SM-MIB. +%% Each row is a 13-tuple: +%% {EngineID, UserName, SecName, Clone, AuthP, AuthKeyC, OwnAuthKeyC, +%% PrivP, PrivKeyC, OwnPrivKeyC, Public, AuthKey, PrivKey}. +%% For example +%% {"agentEngine", "initial", "initial", zeroDotZero, +%% usmNoAuthProtocol, "", "", usmNoPrivProtocol, "", "", "", +%% "", ""}. +%% + + +{%USM_ENGINE_ID%, "initial", "initial", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [160,66,33,136,178,59,246,214,102,63,131,131,54,14,221,177], ""}. +{%USM_ENGINE_ID%, "templateMD5", "templateMD5", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [160,66,33,136,178,59,246,214,102,63,131,131,54,14,221,177], ""}. +{%USM_ENGINE_ID%, "templateSHA", "templateSHA", zeroDotZero, usmHMACSHAAuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [199,94,239,13,229,135,141,77,124,129,65,189,230,240,115,163,239,15,13,242], ""}. diff --git a/lib/snmp/test/test_config/manager/manager.conf.src b/lib/snmp/test/test_config/manager/manager.conf.src index 7d4104ded2..c38a61b13c 100644 --- a/lib/snmp/test/test_config/manager/manager.conf.src +++ b/lib/snmp/test/test_config/manager/manager.conf.src @@ -12,5 +12,5 @@ {port, 5000}. {address, %ADDR%}. -{engine_id, "foo"}. +{engine_id, %ENGINE_ID%}. {max_message_size, 484}. diff --git a/lib/snmp/test/test_config/manager/usm.conf.src b/lib/snmp/test/test_config/manager/usm.conf.src index 39122cab5c..a558c86710 100644 --- a/lib/snmp/test/test_config/manager/usm.conf.src +++ b/lib/snmp/test/test_config/manager/usm.conf.src @@ -5,4 +5,5 @@ %% {EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey} %% +{%USM_ENGINE_ID%, "initial", usmNoAuthProtocol, "", usmNoPrivProtocol, ""}. diff --git a/lib/snmp/test/test_config/modules.mk b/lib/snmp/test/test_config/modules.mk index ee8b68d4eb..3d084cef01 100644 --- a/lib/snmp/test/test_config/modules.mk +++ b/lib/snmp/test/test_config/modules.mk @@ -30,6 +30,7 @@ AGENT_CONFIG_FILES = \ agent/standard.conf \ agent/target_addr.conf \ agent/target_params.conf \ + agent/usm.conf \ agent/vacm.conf MANAGER_CONFIG_FILES = \ diff --git a/lib/snmp/test/test_config/sys-agent.config.src b/lib/snmp/test/test_config/sys-agent.config.src index eb6b0916ff..46a458203d 100644 --- a/lib/snmp/test/test_config/sys-agent.config.src +++ b/lib/snmp/test/test_config/sys-agent.config.src @@ -5,7 +5,7 @@ {agent, [ {priority, normal}, - {versions, [v2]}, + {versions, [v1,v2,v3]}, {db_dir, "%DIR%/agent/db"}, {mib_storage, ets}, %% {agent_mib_storage, volatile}, diff --git a/lib/snmp/test/test_config/sys.config.src b/lib/snmp/test/test_config/sys.config.src index 7e4e3b0acd..b2cd399883 100644 --- a/lib/snmp/test/test_config/sys.config.src +++ b/lib/snmp/test/test_config/sys.config.src @@ -5,7 +5,7 @@ {agent, [ {priority, normal}, - {versions, [v2]}, + {versions, [v1,v2,v3]}, {db_dir, "%DIR%/agent/db"}, {mib_storage, ets}, {agent_mib_storage, volatile}, @@ -38,7 +38,7 @@ {manager, [ {priority, normal}, - {versions, [v2]}, + {versions, [v1,v2,v3]}, {config, [{dir, "%DIR%/manager/conf"}, {verbosity, silence}, {db_dir, "%DIR%/manager/db"}, -- cgit v1.2.3 From 6bd03dbc48e148d1fcad13d2301231507e49c77d Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 16 Dec 2010 14:44:18 +0100 Subject: Added dumping of data after (snmpa_vacm) cleanup call. --- lib/snmp/src/agent/snmp_view_based_acm_mib.erl | 7 ++++++- lib/snmp/src/agent/snmpa_vacm.erl | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index 5e188c74c5..f0c4a16cee 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -181,13 +181,18 @@ init_tabs(Sec2Group, Access, View) -> snmpa_local_db:table_delete(db(vacmSecurityToGroupTable)), snmpa_local_db:table_create(db(vacmSecurityToGroupTable)), init_sec2group_table(Sec2Group), + ?vdebug("create vacm access table",[]), snmpa_vacm:cleanup(), init_access_table(Access), + ?vdebug("create vacm view-tree-family table",[]), snmpa_local_db:table_delete(db(vacmViewTreeFamilyTable)), snmpa_local_db:table_create(db(vacmViewTreeFamilyTable)), - init_view_table(View). + init_view_table(View), + + ?vdebug("table(s) initiated",[]), + ok. init_sec2group_table([Row | T]) -> % ?vtrace("init security-to-group table: " diff --git a/lib/snmp/src/agent/snmpa_vacm.erl b/lib/snmp/src/agent/snmpa_vacm.erl index 91cecfcd1e..892dc265f1 100644 --- a/lib/snmp/src/agent/snmpa_vacm.erl +++ b/lib/snmp/src/agent/snmpa_vacm.erl @@ -258,7 +258,8 @@ delete(Key) -> cleanup() -> - ets:delete_all_objects(snmpa_vacm). + ets:delete_all_objects(snmpa_vacm), + dump_table(). dump_table(true) -> dump_table(); -- cgit v1.2.3 From dd7ad660645d57201b78b21ecb93c16662345b75 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 17 Dec 2010 10:50:23 +0100 Subject: Prep for dev (notes, vsn.mk and appup). --- lib/snmp/doc/src/notes.xml | 56 +++++++++++++++++++++++++++++++++-------- lib/snmp/src/app/snmp.appup.src | 8 ++++++ lib/snmp/vsn.mk | 2 +- 3 files changed, 55 insertions(+), 11 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 493e7aa092..1a84bad1ad 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -32,23 +32,58 @@ notes.xml
-
SNMP 4.18 +
+ SNMP Development Toolkit 4.19 +

Version 4.19 supports code replacement in runtime from/to + version 4.18, 4.17.1 and 4.17.

+ +
+ Improvements and new features + + + +

[snmpc] Added a MIB compiler escript, + snmpc.

+

Own Id: OTP-9004

+
+
+
+ +
+ Reported Fixed Bugs and Malfunctions +

-

+ +
+ +
+ Incompatibilities +

-

+
+
+ +
SNMP 4.18
Fixed Bugs and Malfunctions -

- When the function FilterMod:accept_recv/2 returned false - the SNMP agent stopped collecting messages from UDP.

-

- Own Id: OTP-8761

+

Prep for R14B release.

+
-
- -
+
SNMP Development Toolkit 4.17.1

Version 4.17.1 supports code replacement in runtime from/to version 4.17, 4.16.2, 4.16.1, 4.16, 4.15, 4.14 and 4.13.5.

@@ -63,7 +98,8 @@

When the function FilterMod:accept_recv/2 - returned false the SNMP agent stopped collecting messages from UDP.

+ returned false the SNMP agent stopped collecting + messages from UDP.

Own Id: OTP-8761

diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 2375e3df70..9bb4846c6e 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,6 +22,10 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.18", + [ + ] + }, {"4.17.1", [ {load_module, snmp_community_mib, soft_purge, soft_purge, []}, @@ -66,6 +70,10 @@ %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.18", + [ + ] + }, {"4.17.1", [ {load_module, snmp_community_mib, soft_purge, soft_purge, []}, diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 1229b12ae2..ac9a192f5d 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -1,3 +1,3 @@ -SNMP_VSN = 4.18 +SNMP_VSN = 4.19 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -- cgit v1.2.3 From e4faae6550be391faf6294992980b8f28ab69656 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Sun, 19 Dec 2010 01:25:28 +0100 Subject: Added the first skeleton of a MIB compiler frontend escript. --- lib/snmp/src/compile/Makefile | 14 ++++- lib/snmp/src/compile/depend.mk | 3 + lib/snmp/src/compile/modules.mk | 3 + lib/snmp/src/compile/snmpc.src | 129 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 lib/snmp/src/compile/snmpc.src (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/Makefile b/lib/snmp/src/compile/Makefile index 4be60e1835..1f1086eae1 100644 --- a/lib/snmp/src/compile/Makefile +++ b/lib/snmp/src/compile/Makefile @@ -20,6 +20,7 @@ include $(ERL_TOP)/make/target.mk EBIN = ../../ebin +BIN = ../../bin include $(ERL_TOP)/make/$(TARGET)/otp.mk @@ -44,9 +45,11 @@ RELSYSDIR = $(RELEASE_PATH)/lib/snmp-$(VSN) include modules.mk +ESCRIPT_BIN = $(ESCRIPT_SRC:%.src=$(BIN)/%) + ERL_FILES = $(MODULES:%=%.erl) -TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(ESCRIPT_BIN) GENERATED_PARSER = $(PARSER_MODULE:%=%.erl) @@ -97,8 +100,12 @@ info: @echo "" @echo "EBIN: $(EBIN)" @echo "" + @echo "ESCRIPT_SRC: $(ESCRIPT_SRC)" + @echo "ESCRIPT_BIN: $(ESCRIPT_BIN)" + @echo "" @echo "" + # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- @@ -107,6 +114,7 @@ parser: $(PARSER_TARGET) $(GENERATED_PARSER): $(PARSER_SRC) + # ---------------------------------------------------- # Release Target # ---------------------------------------------------- @@ -115,9 +123,11 @@ include $(ERL_TOP)/make/otp_release_targets.mk release_spec: opt $(INSTALL_DIR) $(RELSYSDIR)/src $(INSTALL_DIR) $(RELSYSDIR)/src/compiler - $(INSTALL_DATA) $(PARSER_SRC) $(ERL_FILES) $(INTERNAL_HRL_FILES) $(RELSYSDIR)/src/compiler + $(INSTALL_DATA) $(ESCRIPT_SRC) $(PARSER_SRC) $(ERL_FILES) $(INTERNAL_HRL_FILES) $(RELSYSDIR)/src/compiler $(INSTALL_DIR) $(RELSYSDIR)/ebin $(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin + $(INSTALL_DIR) $(RELSYSDIR)/bin + $(INSTALL_SCRIPT) $(ESCRIPT_BIN) $(RELSYSDIR)/bin release_docs_spec: diff --git a/lib/snmp/src/compile/depend.mk b/lib/snmp/src/compile/depend.mk index 75af1bf293..74eb6e0864 100644 --- a/lib/snmp/src/compile/depend.mk +++ b/lib/snmp/src/compile/depend.mk @@ -44,3 +44,6 @@ $(EBIN)/snmpc_mib_gram.$(EMULATOR): \ ../../include/snmp_types.hrl \ snmpc_mib_gram.erl +$(BIN)/snmpc: snmpc.src + $(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ + chmod 755 $@ diff --git a/lib/snmp/src/compile/modules.mk b/lib/snmp/src/compile/modules.mk index 6365b0e694..ca78e2e6a9 100644 --- a/lib/snmp/src/compile/modules.mk +++ b/lib/snmp/src/compile/modules.mk @@ -21,6 +21,9 @@ PARSER_SRC = snmpc_mib_gram.yrl PARSER_MODULE = $(PARSER_SRC:%.yrl=%) +ESCRIPT_SRC = \ + snmpc.src + MODULES = \ $(PARSER_MODULE) \ snmpc \ diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src new file mode 100644 index 0000000000..bafcc79150 --- /dev/null +++ b/lib/snmp/src/compile/snmpc.src @@ -0,0 +1,129 @@ +#!/usr/bin/env escript +%% -*- erlang -*- +%% + +-record(state, + { + version = %VSN%, + mib_file, + outdir = "./", + db = volatile, + include_dirs = ["./"], + include_lib_dirs = [], + deprecated = true, + group_check = true, + description = false, + reference = false, + imports = false, + module_identity = false, + module, + no_defs = false, + relaxed_row_name_assigne_check, + verbosity + }). + +%% --o Dir [defaults to "./"] +%% --i Dir [defaults to "./"] +%% --il Dir +%% --gc +%% --db DB [defaults to volatile] +%% --dep +%% --desc +%% --ref +%% --imp +%% --mi +%% --mod Mod +%% --nd +%% --rrnac +%% --version +%% --verbosity V +main(Args) when is_list(Args) -> + case (catch process_args(Args)) of + ok -> + usage(); + {ok, State} when is_record(State, state) -> + io:format("snmpc: ~p~n", [State]); + {ok, Str} when is_list(Str) -> + io:format("~s~n~n", [Str]), + halt(1); + {error, ReasonStr} -> + usage(ReasonStr) + end; +main(_) -> + usage(). + +process_args([]) -> + {error, lists:flatten(io_lib:format("No MIB-file", []))}; +process_args(Args) -> + %% CWD = "./", + process_args(Args, #state{}). + +process_args([], State) -> + {ok, State}; +process_args(["--help"|_Args], _State) -> + ok; +process_args(["--version"|_Args], State) -> + {ok, lists:flatten(io_lib:format("snmpc ~s", [State#state.version]))}; +process_args(["--verbosity", Verbosity0|Args], #state{verbosity = V} = State) + when (V =:= undefined) -> + Verbosity = list_to_atom(Verbosity0), + case lists:member(Verbosity, [trace,debug,log,info,silence]) of + true -> + process_args(Args, State#state{verbosity = Verbosity}); + false -> + e(lists:flatten(io_lib:format("Unknown verbosity: ~s", [Verbosity0]))) + end; +process_args(["--verbosity"|_Args], #state{verbosity = V}) + when (V =/= undefined) -> + e(lists:flatten(io_lib:format("Verbosity already set to ~w", [V]))); +process_args([Arg|Args], State) -> + io:format("Arg: ~p~n", [Arg]), + process_args(Args, State). + +usage(ReasonStr) -> + io:format("ERROR: ~s~n", [ReasonStr]), + usage(). + +usage() -> + io:format("Usage: snmpc [options] MIB.mib" + "~nOptions:" + "~n --help - Prints this info." + "~n --version - Prints compiler version." + "~n --verbosity - Print debug info." + "~n verbosity = trace | debug | log | info | silence" + "~n Defaults to silence." + "~n --warnings - Print warning messages." + "~n --i - Add this dir to the list of dirs that will be" + "~n searched for imported (compiled) MIB files." + "~n The current workin dir will always be included. " + "~n --il - Add this dir to the list of dirs that will be" + "~n searched for imported (compiled) MIB files." + "~n It assumes that the first element in the dir name" + "~n correspond to an OTP application. For example snmp/mibs/" + "~n The current workin dir and the /priv/mibs " + "~n are always listed last the includ path. " + "~n --db - Database ro used for the defaul instrumentation." + "~n Defaults to volatile." + "~n --deprecated - Keep deprecated definition(s)." + "~n If not specified the compiler will ignore" + "~n deprecated definitions." + "~n --description - The DESCRIPTION field will be included." + "~n --reference - The REFERENCE field will be included." + "~n --imports - The IMPORTS field will be included." + "~n --module_id - The MODULE-IDENTITY field will be included." + "~n --module + throw({error, Reason}). -- cgit v1.2.3 From 7cd1a358ed784e8872dcc7fa6c6f719401b12f52 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 17 Feb 2011 11:23:33 +0100 Subject: Some cosmetic changes... --- lib/snmp/doc/src/snmp_agent_config_files.xml | 11 ++++++----- lib/snmp/vsn.mk | 21 ++++++++++++++++++++- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/snmp_agent_config_files.xml b/lib/snmp/doc/src/snmp_agent_config_files.xml index 0bab563f87..b62269d506 100644 --- a/lib/snmp/doc/src/snmp_agent_config_files.xml +++ b/lib/snmp/doc/src/snmp_agent_config_files.xml @@ -4,7 +4,7 @@
- 19972009 + 19972011 Ericsson AB. All Rights Reserved. @@ -178,11 +178,12 @@ community.conf. It must be present if the agent is configured for SNMPv1 or SNMPv2c.

+

An SNMP community is a relationship between an SNMP + agent and a set of SNMP managers that defines authentication, access + control and proxy characteristics.

The corresponding table is snmpCommunityTable in the - SNMP-COMMUNITY-MIB. -

-

Each entry is a term: -

+ SNMP-COMMUNITY-MIB.

+

Each entry is a term:

{CommunityIndex, CommunityName, SecurityName, ContextName, TransportTag}.

CommunityIndex is a non-empty string. diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 1229b12ae2..e70c97dcb8 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -1,3 +1,22 @@ -SNMP_VSN = 4.18 +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2011. 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 +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +SNMP_VSN = 4.19 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -- cgit v1.2.3 From dd99864e18829150951285d3819096e04ebda3de Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 17 Feb 2011 12:02:54 +0100 Subject: No auto-import of erlang:error/1,2. --- lib/snmp/test/snmp_appup_test.erl | 4 +++- lib/snmp/test/snmp_test_mgr_misc.erl | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/test/snmp_appup_test.erl b/lib/snmp/test/snmp_appup_test.erl index 18509526cf..756636f79c 100644 --- a/lib/snmp/test/snmp_appup_test.erl +++ b/lib/snmp/test/snmp_appup_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-2011. 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 @@ -30,6 +30,8 @@ ]). +-compile({no_auto_import, [error/1]}). + -include("test_server.hrl"). -include("snmp_test_lib.hrl"). diff --git a/lib/snmp/test/snmp_test_mgr_misc.erl b/lib/snmp/test/snmp_test_mgr_misc.erl index ef1ba0b948..fc6dedd96d 100644 --- a/lib/snmp/test/snmp_test_mgr_misc.erl +++ b/lib/snmp/test/snmp_test_mgr_misc.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. 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 @@ -33,6 +33,8 @@ %% internal exports -export([init_packet/10]). +-compile({no_auto_import, [error/2]}). + -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). -- cgit v1.2.3 From b16c705cb08743333dba26f036ff44cf7d4b7da8 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 17 Feb 2011 18:49:32 +0100 Subject: Fixed release notes. --- lib/snmp/doc/src/notes.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index cb41ca8e3a..3fe39c4d03 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -4,7 +4,7 @@
- 19962010 + 19962011 Ericsson AB. All Rights Reserved. @@ -50,10 +50,10 @@ snmp_view_based_acm_mib:reconfigure/1 on a running node, the table vacmAccessTable was not properly cleaned. - This means that if some entries in the vacm.conf file was removed + This meant that if some entries in the vacm.conf file was removed (compared to the current config), - while others where modified and/or added, the removed entrie(s), - would still exist in the vacmAccessTable.

+ while others where modified and/or added, the removed entrie(s) + would still exist in the vacmAccessTable table.

Own Id: OTP-8981

Aux Id: Seq 11750

-- cgit v1.2.3 From 59bb06ecfad98e38a849740fc0388668bb9a1eeb Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 18 Feb 2011 13:47:39 +0100 Subject: Fixed "some things". Also added a *lot* of debug printouts... --- lib/snmp/src/compile/snmpc_mib_gram.yrl | 153 +++++++++++++++++++++++--------- 1 file changed, 111 insertions(+), 42 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index 18e9b4f1f2..8be8375280 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -231,8 +231,8 @@ mib -> mibname 'DEFINITIONS' implies 'BEGIN' defs = Defs}. v1orv2 -> moduleidentity listofdefinitionsv2 : - {v2_mib, ['$1'|lists:reverse('$2')]}. -v1orv2 -> listofdefinitions : {v1_mib, lists:reverse('$1')}. + {v2_mib, ['$1'|lrev(v1orv2_mod, '$2')]}. +v1orv2 -> listofdefinitions : {v1_mib, lrev(v1orv2_list, '$1')}. definition -> objectidentifier : '$1'. definition -> objecttypev1 : '$1'. @@ -250,7 +250,7 @@ imports -> imports_from_one_mib : ['$1']. imports -> imports_from_one_mib imports : ['$1' | '$2']. imports_from_one_mib -> listofimports 'FROM' variable : - {{val('$3'), lists:reverse('$1')}, line_of('$2')}. + {{val('$3'), lrev(imports, '$1')}, line_of('$2')}. listofimports -> import_stuff : ['$1']. listofimports -> listofimports ',' import_stuff : ['$3' | '$1']. @@ -317,7 +317,7 @@ import_stuff -> 'TAddress' traptype -> objectname 'TRAP-TYPE' 'ENTERPRISE' objectname varpart description referpart implies integer : - Trap = make_trap('$1', '$4', lists:reverse('$5'), + Trap = make_trap('$1', '$4', lrev(trap, '$5'), '$6', '$7', val('$9')), {Trap, line_of('$2')}. @@ -345,7 +345,7 @@ newtype -> newtypename implies syntax : {NT, line_of('$2')}. tableentrydefinition -> newtypename implies 'SEQUENCE' '{' fields '}' : - Seq = make_sequence('$1', lists:reverse('$5')), + Seq = make_sequence('$1', lrev(table_entry, '$5')), {Seq, line_of('$3')}. % returns: list of {, } @@ -429,9 +429,9 @@ variables -> variables ',' objectname : ['$3' | '$1']. implies -> '::=' : '$1'. implies -> ':' ':' '=' : w("Sloppy asignment on line ~p", [line_of('$1')]), '$1'. -descriptionfield -> string : lists:reverse(val('$1')). +descriptionfield -> string : lrev(descriptionfield, val('$1')). descriptionfield -> '$empty' : undefined. -description -> 'DESCRIPTION' string : lists:reverse(val('$2')). +description -> 'DESCRIPTION' string : lrev(description, val('$2')). description -> '$empty' : undefined. displaypart -> 'DISPLAY-HINT' string : display_hint('$2') . @@ -439,7 +439,7 @@ displaypart -> '$empty' : undefined . % returns: {indexes, undefined} % | {indexes, IndexList} where IndexList is a list of aliasnames. -indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lists:reverse('$3')}. +indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lrev(index, '$3')}. indexpartv1 -> '$empty' : {indexes, undefined}. indextypesv1 -> indextypev1 : ['$1']. @@ -458,13 +458,13 @@ defvalpart -> 'DEFVAL' '{' integer '}' : {defval, val('$3')}. defvalpart -> 'DEFVAL' '{' atom '}' : {defval, val('$3')}. defvalpart -> 'DEFVAL' '{' '{' defbitsvalue '}' '}' : {defval, '$4'}. defvalpart -> 'DEFVAL' '{' quote atom '}' - : {defval, make_defval_for_string(line_of('$1'), lists:reverse(val('$3')), + : {defval, make_defval_for_string(line_of('$1'), lrev(defval_atom, val('$3')), val('$4'))}. defvalpart -> 'DEFVAL' '{' quote variable '}' - : {defval, make_defval_for_string(line_of('$1'), lists:reverse(val('$3')), + : {defval, make_defval_for_string(line_of('$1'), lrev(defval_variable, val('$3')), val('$4'))}. defvalpart -> 'DEFVAL' '{' string '}' - : {defval, lists:reverse(val('$3'))}. + : {defval, lrev(defval_string, val('$3'))}. defvalpart -> '$empty' : undefined. defbitsvalue -> defbitsnames : '$1'. @@ -482,7 +482,7 @@ accessv1 -> atom: accessv1('$1'). statusv1 -> atom : statusv1('$1'). -referpart -> 'REFERENCE' string : lists:reverse(val('$2')). +referpart -> 'REFERENCE' string : lrev(refer, val('$2')). referpart -> '$empty' : undefined. @@ -501,20 +501,20 @@ moduleidentity -> mibid 'MODULE-IDENTITY' {MI, line_of('$2')}. mibid -> atom : val('$1'). -last_updated -> string : lists:reverse(val('$1')) . -oranization -> string : lists:reverse(val('$1')) . -contact_info -> string : lists:reverse(val('$1')) . +last_updated -> string : lrev(last_upd, val('$1')) . +oranization -> string : lrev(org, val('$1')) . +contact_info -> string : lrev(contact, val('$1')) . revisionpart -> '$empty' : [] . -revisionpart -> revisions : lists:reverse('$1') . +revisionpart -> revisions : lrev(revision, '$1') . revisions -> revision : ['$1'] . revisions -> revisions revision : ['$2' | '$1'] . revision -> 'REVISION' revision_string 'DESCRIPTION' revision_desc : make_revision('$2', '$4') . -revision_string -> string : lists:reverse(val('$1')) . -revision_desc -> string : lists:reverse(val('$1')) . +revision_string -> string : lrev(revision_str, val('$1')) . +revision_desc -> string : lrev(revision_desc, val('$1')) . definitionv2 -> objectidentifier : '$1'. definitionv2 -> objecttypev2 : '$1'. @@ -558,8 +558,19 @@ notificationgroup -> objectname 'NOTIFICATION-GROUP' 'NOTIFICATIONS' '{' modulecompliance -> objectname 'MODULE-COMPLIANCE' 'STATUS' statusv2 description referpart mc_modulepart nameassign : + io:format("modulecompliance -> " + "~n '$1': ~p" + "~n '$4': ~p" + "~n '$5': ~p" + "~n '$6': ~p" + "~n '$7': ~p" + "~n '$8': ~p" + "~n", ['$1', '$4', '$5', '$6', '$7', '$8']), MC = make_module_compliance('$1', '$4', '$5', '$6', '$7', '$8'), + io:format("modulecompliance -> " + "~n MC: ~p" + "~n", [MC]), {MC, line_of('$2')}. @@ -571,15 +582,15 @@ agentcapabilities -> objectname 'AGENT-CAPABILITIES' '$8', '$9', '$10'), {AC, line_of('$2')}. -prodrel -> string : lists:reverse(val('$1')). +prodrel -> string : lrev(prodrel, val('$1')). ac_status -> atom : ac_status('$1'). -ac_modulepart -> ac_modules : lists:reverse('$1'). +ac_modulepart -> ac_modules : lrev(ac_module, '$1'). ac_modulepart -> '$empty' : []. -ac_modules -> ac_module : ['$1']. -ac_modules -> ac_modules ac_module : ['$2' | '$1']. +ac_modules -> ac_module : '$1'. +ac_modules -> ac_modules ac_module : ['$2' | ['$1']]. ac_module -> 'SUPPORTS' ac_modulenamepart 'INCLUDES' '{' objects '}' ac_variationpart : make_ac_module('$2', '$5', '$7'). @@ -588,10 +599,10 @@ ac_modulenamepart -> mibname : '$1'. ac_modulenamepart -> '$empty' : undefined. ac_variationpart -> '$empty' : []. -ac_variationpart -> ac_variations : lists:reverse('$1'). +ac_variationpart -> ac_variations : lrev(ac_variation, '$1'). -ac_variations -> ac_variation : ['$1']. -ac_variations -> ac_variations ac_variation : ['$2' | '$1']. +ac_variations -> ac_variation : '$1'. +ac_variations -> ac_variations ac_variation : ['$2' | ['$1']]. %% ac_variation -> ac_objectvariation. %% ac_variation -> ac_notificationvariation. @@ -604,37 +615,78 @@ ac_accesspart -> '$empty' : undefined. ac_access -> atom: ac_access('$1'). -ac_creationpart -> 'CREATION-REQUIRES' '{' objects '}' : lists:reverse('$3'). -ac_creationpart -> '$empty' : []. - -mc_modulepart -> '$empty' : []. -mc_modulepart -> mc_modules : lists:reverse('$1'). - -mc_modules -> mc_module. -mc_modules -> mc_modules mc_module. +ac_creationpart -> 'CREATION-REQUIRES' '{' objects '}' : + io:format("ac_creationpart -> $3: ~p~n", ['$3']), + lrev(ac_creation, '$3'). +ac_creationpart -> '$empty' : + []. + +mc_modulepart -> '$empty' : + io:format("mc_modulepart -> empty~n", []), []. +mc_modulepart -> mc_modules : + io:format("mc_modulepart -> $1: ~p~n", ['$1']), + lrev(mc_modulepart, '$1'). + +mc_modules -> mc_module: + io:format("mc_modules -> (module) $1: ~p~n", ['$1']), + ['$1']. +mc_modules -> mc_modules mc_module: + io:format("mc_modules -> (modules module)" + "~n $1: ~p" + "~n $2: ~p" + "~n", ['$1', '$2']), + ['$1' | ['$2']]. mc_module -> 'MODULE' mc_modulenamepart mc_mandatorypart mc_compliancepart : + io:format("mc_module -> " + "~n $2: ~p" + "~n $3: ~p" + "~n $4: ~p" + "~n", ['$2', '$3', '$4']), make_mc_module('$2', '$3', '$4'). mc_modulenamepart -> mibname : '$1'. mc_modulenamepart -> '$empty' : undefined. -mc_mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}' : lists:reverse('$3'). -mc_mandatorypart -> '$empty' : []. +mc_mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}' : + io:format("mc_mandatorypart -> $3: ~p~n", ['$3']), + lrev(mc_mandatorypart, '$3'). +mc_mandatorypart -> '$empty' : + io:format("mc_mandatorypart -> empty~n", []), + []. -mc_compliancepart -> mc_compliances : lists:reverse('$1'). -mc_compliancepart -> '$empty' : []. +mc_compliancepart -> mc_compliances : + io:format("mc_compliancepart -> $1: ~p~n", ['$1']), + lrev(mc_compliancepart, '$1'). +mc_compliancepart -> '$empty' : + io:format("mc_compliancepart -> empty~n", []), + []. mc_compliances -> mc_compliance : '$1'. -mc_compliances -> mc_compliances mc_compliance : ['$2' | '$1']. +mc_compliances -> mc_compliances mc_compliance : ['$2' | ['$1']]. -mc_compliance -> mc_compliancegroup : '$1'. -mc_compliance -> mc_object : '$1'. +mc_compliance -> mc_compliancegroup : + io:format("mc_compliance -> (compliancegroup) ~p~n", ['$1']), + '$1'. +mc_compliance -> mc_object : + io:format("mc_compliance -> (object) ~p~n", ['$1']), + '$1'. mc_compliancegroup -> 'GROUP' objectname description : + io:format("mc_compliancegroup -> " + "~n $2: ~p" + "~n $3: ~p" + "~n", ['$2', '$3']), make_mc_compliance_group('$2', '$3'). mc_object -> 'OBJECT' objectname syntaxpart writesyntaxpart mc_accesspart description : + io:format("mc_object -> " + "~n $2: ~p" + "~n $3: ~p" + "~n $4: ~p" + "~n $5: ~p" + "~n $6: ~p" + "~n", ['$2', '$3', '$4', '$5', '$6']), make_mc_object('$2', '$3', '$4', '$5', '$6'). syntaxpart -> 'SYNTAX' syntax : '$2'. @@ -659,7 +711,7 @@ objecttypev2 -> objectname 'OBJECT-TYPE' '$11', '$12', Kind, '$15'), {OT, line_of('$2')}. -indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lists:reverse('$3')}. +indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lrev(indexv2, '$3')}. indexpartv2 -> 'AUGMENTS' '{' entry '}' : {augments, '$3'}. indexpartv2 -> '$empty' : {indexes, undefined}. @@ -684,7 +736,7 @@ notification -> objectname 'NOTIFICATION-TYPE' objectspart Not = make_notification('$1','$3','$5', '$7', '$8', '$9'), {Not, line_of('$2')}. -objectspart -> 'OBJECTS' '{' objects '}' : lists:reverse('$3'). +objectspart -> 'OBJECTS' '{' objects '}' : lrev(objects, '$3'). objectspart -> '$empty' : []. objects -> objectname : ['$1']. @@ -1123,6 +1175,23 @@ filter_v2imports(_,Type) -> {type, Type}. w(F, A) -> ?vwarning(F, A). +lrev(Tag, L) when is_list(L) -> + io:format("lrev -> try reverse list ~p: " + "~n ~p" + "~n", [Tag, L]), + case (catch lists:reverse(L)) of + RevL when is_list(RevL) -> + RevL; + {'EXIT', Reason} -> + io:format("lrev -> failed reversing list: " + "~n ~p" + "~n", [Reason]), + exit({failed_reversing_list, Reason}) + end; +lrev(Tag, X) -> + exit({bad_list, Tag, X}). + + %i(F, A) -> % io:format("~w:" ++ F ++ "~n", [?MODULE|A]). -- cgit v1.2.3 From 21017ea91338cd3f14f3957869e4bba1780c39df Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 18 Feb 2011 14:28:47 +0100 Subject: Fixed mc_compliancepart rule (improper list). --- lib/snmp/src/compile/snmpc_mib_gram.yrl | 190 ++++++++++++++++---------------- 1 file changed, 96 insertions(+), 94 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index 8be8375280..b817b66df3 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. 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 @@ -80,7 +80,7 @@ revisions listofdefinitionsv2 mibid last_updated -oranization +organization contact_info revision revision_string @@ -231,8 +231,8 @@ mib -> mibname 'DEFINITIONS' implies 'BEGIN' defs = Defs}. v1orv2 -> moduleidentity listofdefinitionsv2 : - {v2_mib, ['$1'|lrev(v1orv2_mod, '$2')]}. -v1orv2 -> listofdefinitions : {v1_mib, lrev(v1orv2_list, '$1')}. + {v2_mib, ['$1'|lreverse(v1orv2_mod, '$2')]}. +v1orv2 -> listofdefinitions : {v1_mib, lreverse(v1orv2_list, '$1')}. definition -> objectidentifier : '$1'. definition -> objecttypev1 : '$1'. @@ -250,7 +250,7 @@ imports -> imports_from_one_mib : ['$1']. imports -> imports_from_one_mib imports : ['$1' | '$2']. imports_from_one_mib -> listofimports 'FROM' variable : - {{val('$3'), lrev(imports, '$1')}, line_of('$2')}. + {{val('$3'), lreverse(imports_from_one_mib, '$1')}, line_of('$2')}. listofimports -> import_stuff : ['$1']. listofimports -> listofimports ',' import_stuff : ['$3' | '$1']. @@ -317,7 +317,7 @@ import_stuff -> 'TAddress' traptype -> objectname 'TRAP-TYPE' 'ENTERPRISE' objectname varpart description referpart implies integer : - Trap = make_trap('$1', '$4', lrev(trap, '$5'), + Trap = make_trap('$1', '$4', lreverse(traptype, '$5'), '$6', '$7', val('$9')), {Trap, line_of('$2')}. @@ -345,7 +345,7 @@ newtype -> newtypename implies syntax : {NT, line_of('$2')}. tableentrydefinition -> newtypename implies 'SEQUENCE' '{' fields '}' : - Seq = make_sequence('$1', lrev(table_entry, '$5')), + Seq = make_sequence('$1', lreverse(tableentrydefinition, '$5')), {Seq, line_of('$3')}. % returns: list of {, } @@ -429,9 +429,9 @@ variables -> variables ',' objectname : ['$3' | '$1']. implies -> '::=' : '$1'. implies -> ':' ':' '=' : w("Sloppy asignment on line ~p", [line_of('$1')]), '$1'. -descriptionfield -> string : lrev(descriptionfield, val('$1')). +descriptionfield -> string : lreverse(descriptionfield, val('$1')). descriptionfield -> '$empty' : undefined. -description -> 'DESCRIPTION' string : lrev(description, val('$2')). +description -> 'DESCRIPTION' string : lreverse(description, val('$2')). description -> '$empty' : undefined. displaypart -> 'DISPLAY-HINT' string : display_hint('$2') . @@ -439,7 +439,7 @@ displaypart -> '$empty' : undefined . % returns: {indexes, undefined} % | {indexes, IndexList} where IndexList is a list of aliasnames. -indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lrev(index, '$3')}. +indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lreverse(indexpartv1, '$3')}. indexpartv1 -> '$empty' : {indexes, undefined}. indextypesv1 -> indextypev1 : ['$1']. @@ -457,14 +457,16 @@ parentintegers -> atom '(' integer ')' parentintegers : [val('$3') | '$5']. defvalpart -> 'DEFVAL' '{' integer '}' : {defval, val('$3')}. defvalpart -> 'DEFVAL' '{' atom '}' : {defval, val('$3')}. defvalpart -> 'DEFVAL' '{' '{' defbitsvalue '}' '}' : {defval, '$4'}. -defvalpart -> 'DEFVAL' '{' quote atom '}' - : {defval, make_defval_for_string(line_of('$1'), lrev(defval_atom, val('$3')), - val('$4'))}. -defvalpart -> 'DEFVAL' '{' quote variable '}' - : {defval, make_defval_for_string(line_of('$1'), lrev(defval_variable, val('$3')), - val('$4'))}. -defvalpart -> 'DEFVAL' '{' string '}' - : {defval, lrev(defval_string, val('$3'))}. +defvalpart -> 'DEFVAL' '{' quote atom '}' : + {defval, make_defval_for_string(line_of('$1'), + lreverse(defvalpart_quote_atom, val('$3')), + val('$4'))}. +defvalpart -> 'DEFVAL' '{' quote variable '}' : + {defval, make_defval_for_string(line_of('$1'), + lreverse(defvalpart_quote_variable, val('$3')), + val('$4'))}. +defvalpart -> 'DEFVAL' '{' string '}' : + {defval, lreverse(defvalpart_string, val('$3'))}. defvalpart -> '$empty' : undefined. defbitsvalue -> defbitsnames : '$1'. @@ -482,7 +484,7 @@ accessv1 -> atom: accessv1('$1'). statusv1 -> atom : statusv1('$1'). -referpart -> 'REFERENCE' string : lrev(refer, val('$2')). +referpart -> 'REFERENCE' string : lreverse(referpart, val('$2')). referpart -> '$empty' : undefined. @@ -492,7 +494,7 @@ referpart -> '$empty' : undefined. %%---------------------------------------------------------------------- moduleidentity -> mibid 'MODULE-IDENTITY' 'LAST-UPDATED' last_updated - 'ORGANIZATION' oranization + 'ORGANIZATION' organization 'CONTACT-INFO' contact_info 'DESCRIPTION' descriptionfield revisionpart nameassign : @@ -501,20 +503,20 @@ moduleidentity -> mibid 'MODULE-IDENTITY' {MI, line_of('$2')}. mibid -> atom : val('$1'). -last_updated -> string : lrev(last_upd, val('$1')) . -oranization -> string : lrev(org, val('$1')) . -contact_info -> string : lrev(contact, val('$1')) . +last_updated -> string : lreverse(last_updated, val('$1')) . +organization -> string : lreverse(organization, val('$1')) . +contact_info -> string : lreverse(contact_info, val('$1')) . revisionpart -> '$empty' : [] . -revisionpart -> revisions : lrev(revision, '$1') . +revisionpart -> revisions : lreverse(revisionpart, '$1') . revisions -> revision : ['$1'] . revisions -> revisions revision : ['$2' | '$1'] . revision -> 'REVISION' revision_string 'DESCRIPTION' revision_desc : make_revision('$2', '$4') . -revision_string -> string : lrev(revision_str, val('$1')) . -revision_desc -> string : lrev(revision_desc, val('$1')) . +revision_string -> string : lreverse(revision_string, val('$1')) . +revision_desc -> string : lreverse(revision_desc, val('$1')) . definitionv2 -> objectidentifier : '$1'. definitionv2 -> objecttypev2 : '$1'. @@ -558,19 +560,19 @@ notificationgroup -> objectname 'NOTIFICATION-GROUP' 'NOTIFICATIONS' '{' modulecompliance -> objectname 'MODULE-COMPLIANCE' 'STATUS' statusv2 description referpart mc_modulepart nameassign : - io:format("modulecompliance -> " - "~n '$1': ~p" - "~n '$4': ~p" - "~n '$5': ~p" - "~n '$6': ~p" - "~n '$7': ~p" - "~n '$8': ~p" - "~n", ['$1', '$4', '$5', '$6', '$7', '$8']), +%% io:format("modulecompliance -> " +%% "~n '$1': ~p" +%% "~n '$4': ~p" +%% "~n '$5': ~p" +%% "~n '$6': ~p" +%% "~n '$7': ~p" +%% "~n '$8': ~p" +%% "~n", ['$1', '$4', '$5', '$6', '$7', '$8']), MC = make_module_compliance('$1', '$4', '$5', '$6', '$7', '$8'), - io:format("modulecompliance -> " - "~n MC: ~p" - "~n", [MC]), +%% io:format("modulecompliance -> " +%% "~n MC: ~p" +%% "~n", [MC]), {MC, line_of('$2')}. @@ -582,11 +584,11 @@ agentcapabilities -> objectname 'AGENT-CAPABILITIES' '$8', '$9', '$10'), {AC, line_of('$2')}. -prodrel -> string : lrev(prodrel, val('$1')). +prodrel -> string : lreverse(prodrel, val('$1')). ac_status -> atom : ac_status('$1'). -ac_modulepart -> ac_modules : lrev(ac_module, '$1'). +ac_modulepart -> ac_modules : lreverse(ac_modulepart, '$1'). ac_modulepart -> '$empty' : []. ac_modules -> ac_module : '$1'. @@ -599,7 +601,7 @@ ac_modulenamepart -> mibname : '$1'. ac_modulenamepart -> '$empty' : undefined. ac_variationpart -> '$empty' : []. -ac_variationpart -> ac_variations : lrev(ac_variation, '$1'). +ac_variationpart -> ac_variations : lreverse(ac_variationpart, '$1'). ac_variations -> ac_variation : '$1'. ac_variations -> ac_variations ac_variation : ['$2' | ['$1']]. @@ -616,77 +618,88 @@ ac_accesspart -> '$empty' : undefined. ac_access -> atom: ac_access('$1'). ac_creationpart -> 'CREATION-REQUIRES' '{' objects '}' : - io:format("ac_creationpart -> $3: ~p~n", ['$3']), - lrev(ac_creation, '$3'). +%% io:format("ac_creationpart -> $3: ~p~n", ['$3']), + lreverse(ac_creationpart, '$3'). ac_creationpart -> '$empty' : []. mc_modulepart -> '$empty' : - io:format("mc_modulepart -> empty~n", []), []. +%% io:format("mc_modulepart -> empty~n", []), + []. mc_modulepart -> mc_modules : - io:format("mc_modulepart -> $1: ~p~n", ['$1']), - lrev(mc_modulepart, '$1'). +%% io:format("mc_modulepart -> $1: ~p~n", ['$1']), + lreverse(mc_modulepart, '$1'). mc_modules -> mc_module: - io:format("mc_modules -> (module) $1: ~p~n", ['$1']), +%% io:format("mc_modules -> (module) $1: ~p~n", ['$1']), ['$1']. mc_modules -> mc_modules mc_module: - io:format("mc_modules -> (modules module)" - "~n $1: ~p" - "~n $2: ~p" - "~n", ['$1', '$2']), +%% io:format("mc_modules -> (modules module)" +%% "~n $1: ~p" +%% "~n $2: ~p" +%% "~n", ['$1', '$2']), ['$1' | ['$2']]. mc_module -> 'MODULE' mc_modulenamepart mc_mandatorypart mc_compliancepart : - io:format("mc_module -> " - "~n $2: ~p" - "~n $3: ~p" - "~n $4: ~p" - "~n", ['$2', '$3', '$4']), +%% io:format("mc_module -> " +%% "~n $2: ~p" +%% "~n $3: ~p" +%% "~n $4: ~p" +%% "~n", ['$2', '$3', '$4']), make_mc_module('$2', '$3', '$4'). mc_modulenamepart -> mibname : '$1'. mc_modulenamepart -> '$empty' : undefined. mc_mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}' : - io:format("mc_mandatorypart -> $3: ~p~n", ['$3']), - lrev(mc_mandatorypart, '$3'). +%% io:format("mc_mandatorypart -> $3: ~p~n", ['$3']), + lreverse(mc_mandatorypart, '$3'). mc_mandatorypart -> '$empty' : - io:format("mc_mandatorypart -> empty~n", []), +%% io:format("mc_mandatorypart -> empty~n", []), []. mc_compliancepart -> mc_compliances : - io:format("mc_compliancepart -> $1: ~p~n", ['$1']), - lrev(mc_compliancepart, '$1'). +%% i("mc_compliancepart -> " +%% "~n $1: ~p", ['$1']), + lreverse(mc_compliancepart, '$1'). mc_compliancepart -> '$empty' : - io:format("mc_compliancepart -> empty~n", []), +%% i("mc_compliancepart -> empty", []), []. -mc_compliances -> mc_compliance : '$1'. -mc_compliances -> mc_compliances mc_compliance : ['$2' | ['$1']]. +mc_compliances -> mc_compliance : +%% i("mc_compliances -> " +%% "~n $1: ~p", ['$1']), + ['$1']. +mc_compliances -> mc_compliance mc_compliances : +%% i("mc_compliances -> " +%% "~n $1: ~p" +%% "~n $2: ~p", ['$1', '$2']), + ['$1' | '$2']. mc_compliance -> mc_compliancegroup : - io:format("mc_compliance -> (compliancegroup) ~p~n", ['$1']), +%% i("mc_compliance -> " +%% "~n [compliancegroup] $1: ~p", ['$1']), '$1'. mc_compliance -> mc_object : - io:format("mc_compliance -> (object) ~p~n", ['$1']), +%% i("mc_compliance -> " +%% "~n [object] $1: ~p", ['$1']), '$1'. mc_compliancegroup -> 'GROUP' objectname description : - io:format("mc_compliancegroup -> " - "~n $2: ~p" - "~n $3: ~p" - "~n", ['$2', '$3']), +%% i("mc_compliancegroup -> " +%% "~n $2: ~p" +%% "~n $3: ~p" +%% "~n", ['$2', '$3']), make_mc_compliance_group('$2', '$3'). mc_object -> 'OBJECT' objectname syntaxpart writesyntaxpart mc_accesspart description : - io:format("mc_object -> " - "~n $2: ~p" - "~n $3: ~p" - "~n $4: ~p" - "~n $5: ~p" - "~n $6: ~p" - "~n", ['$2', '$3', '$4', '$5', '$6']), +%% i("mc_object -> " +%% "~n $2: ~p" +%% "~n $3: ~p" +%% "~n $4: ~p" +%% "~n $5: ~p" +%% "~n $6: ~p" +%% "~n", ['$2', '$3', '$4', '$5', '$6']), make_mc_object('$2', '$3', '$4', '$5', '$6'). syntaxpart -> 'SYNTAX' syntax : '$2'. @@ -711,7 +724,7 @@ objecttypev2 -> objectname 'OBJECT-TYPE' '$11', '$12', Kind, '$15'), {OT, line_of('$2')}. -indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lrev(indexv2, '$3')}. +indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lreverse(indexpartv2, '$3')}. indexpartv2 -> 'AUGMENTS' '{' entry '}' : {augments, '$3'}. indexpartv2 -> '$empty' : {indexes, undefined}. @@ -736,7 +749,7 @@ notification -> objectname 'NOTIFICATION-TYPE' objectspart Not = make_notification('$1','$3','$5', '$7', '$8', '$9'), {Not, line_of('$2')}. -objectspart -> 'OBJECTS' '{' objects '}' : lrev(objects, '$3'). +objectspart -> 'OBJECTS' '{' objects '}' : lreverse(objectspart, '$3'). objectspart -> '$empty' : []. objects -> objectname : ['$1']. @@ -1175,23 +1188,12 @@ filter_v2imports(_,Type) -> {type, Type}. w(F, A) -> ?vwarning(F, A). -lrev(Tag, L) when is_list(L) -> - io:format("lrev -> try reverse list ~p: " - "~n ~p" - "~n", [Tag, L]), - case (catch lists:reverse(L)) of - RevL when is_list(RevL) -> - RevL; - {'EXIT', Reason} -> - io:format("lrev -> failed reversing list: " - "~n ~p" - "~n", [Reason]), - exit({failed_reversing_list, Reason}) - end; -lrev(Tag, X) -> +lreverse(_Tag, L) when is_list(L) -> + lists:reverse(L); +lreverse(Tag, X) -> exit({bad_list, Tag, X}). -%i(F, A) -> -% io:format("~w:" ++ F ++ "~n", [?MODULE|A]). +%% i(F, A) -> +%% io:format("~w:" ++ F ++ "~n", [?MODULE|A]). -- cgit v1.2.3 From 439262b1a593a98cba7ed25e9453bf026696ebcc Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 18 Feb 2011 14:44:23 +0100 Subject: Fixed mc_modules and ac_variations. --- lib/snmp/src/compile/snmpc_mib_gram.yrl | 59 ++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 19 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index b817b66df3..b322b45022 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -600,17 +600,38 @@ ac_module -> 'SUPPORTS' ac_modulenamepart 'INCLUDES' '{' objects '}' ac_variatio ac_modulenamepart -> mibname : '$1'. ac_modulenamepart -> '$empty' : undefined. -ac_variationpart -> '$empty' : []. -ac_variationpart -> ac_variations : lreverse(ac_variationpart, '$1'). - -ac_variations -> ac_variation : '$1'. -ac_variations -> ac_variations ac_variation : ['$2' | ['$1']]. +ac_variationpart -> '$empty' : +%% i("ac_variationpart -> empty", []), + []. +ac_variationpart -> ac_variations : +%% i("ac_variationpart -> " +%% "~n $1: ~p", ['$1']), + lreverse(ac_variationpart, '$1'). + +ac_variations -> ac_variation : +%% i("ac_variations -> " +%% "~n $1: ~p", ['$1']), + ['$1']. +ac_variations -> ac_variation ac_variations : +%% i("ac_variations -> " +%% "~n $1: ~p" +%% "~n $2: ~p", ['$1', '$2']), + ['$1' | '$2']. %% ac_variation -> ac_objectvariation. %% ac_variation -> ac_notificationvariation. ac_variation -> 'VARIATION' objectname syntaxpart writesyntaxpart ac_accesspart ac_creationpart defvalpart description : - make_ac_variation('$2', '$3', '$4', '$5', '$6', '$7', '$8'). +%% i("mc_module -> " +%% "~n $2: ~p" +%% "~n $3: ~p" +%% "~n $4: ~p" +%% "~n $5: ~p" +%% "~n $6: ~p" +%% "~n $7: ~p" +%% "~n $8: ~p" +%% "~n", ['$2', '$3', '$4', '$5', '$6', '$7', '$8']), + make_ac_variation('$2', '$3', '$4', '$5', '$6', '$7', '$8'). ac_accesspart -> 'ACCESS' ac_access : '$2'. ac_accesspart -> '$empty' : undefined. @@ -630,22 +651,22 @@ mc_modulepart -> mc_modules : %% io:format("mc_modulepart -> $1: ~p~n", ['$1']), lreverse(mc_modulepart, '$1'). -mc_modules -> mc_module: -%% io:format("mc_modules -> (module) $1: ~p~n", ['$1']), +mc_modules -> mc_module : +%% i("mc_modules -> " +%% "~n $1: ~p", ['$1']), ['$1']. -mc_modules -> mc_modules mc_module: -%% io:format("mc_modules -> (modules module)" -%% "~n $1: ~p" -%% "~n $2: ~p" -%% "~n", ['$1', '$2']), - ['$1' | ['$2']]. +mc_modules -> mc_module mc_modules : +%% i("mc_modules -> (modules module)" +%% "~n $1: ~p" +%% "~n $2: ~p", ['$1', '$2']), + ['$1' | '$2']. mc_module -> 'MODULE' mc_modulenamepart mc_mandatorypart mc_compliancepart : -%% io:format("mc_module -> " -%% "~n $2: ~p" -%% "~n $3: ~p" -%% "~n $4: ~p" -%% "~n", ['$2', '$3', '$4']), +%% i("mc_module -> " +%% "~n $2: ~p" +%% "~n $3: ~p" +%% "~n $4: ~p" +%% "~n", ['$2', '$3', '$4']), make_mc_module('$2', '$3', '$4'). mc_modulenamepart -> mibname : '$1'. -- cgit v1.2.3 From d7c6e2781c64e5e75add8a89d1b553bd5e9283f1 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 18 Feb 2011 19:18:12 +0100 Subject: Lost of fixes... *) Update release notes (with regard to module_compliance) *) New compiler options: agent_capabilities and module_compliance *) Update mib compiler option description (new options for agent_capabilities and module_compliance) *) New test case for module_compliance. *) Added test mib for module_complianc test case. *) Added some options for the MIB makefile. ... --- lib/snmp/doc/src/notes.xml | 17 ++- lib/snmp/doc/src/snmpc.xml | 43 ++++++- lib/snmp/mibs/Makefile.in | 26 +++- lib/snmp/src/compile/snmpc.erl | 137 ++++++++++++++++----- lib/snmp/src/compile/snmpc.hrl | 4 +- lib/snmp/src/compile/snmpc_mib_gram.yrl | 34 ++++-- lib/snmp/test/modules.mk | 3 +- lib/snmp/test/snmp_compiler_test.erl | 77 ++++++++++-- lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib | 173 +++++++++++++++++++++++++++ 9 files changed, 452 insertions(+), 62 deletions(-) create mode 100644 lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 0c43be695f..e9c7bef68f 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -4,7 +4,7 @@
- 19962010 + 19962011 Ericsson AB. All Rights Reserved. @@ -42,10 +42,21 @@

[compiler] Added support for the textual convention - AGENT-CAPABILITIES, exported by the SNMPv2-CONF mib.

+ AGENT-CAPABILITIES, exported by the SNMPv2-CONF mib.

The reference and modules part(s) are stored in the assocList of the mib-entry record - (me).

+ (me). + Only handled if the option agent_capabilities + is provided to the compiler.

+

Also added ("full") support for MODULE-COMPLIANCE, + which is handled in a similar way. + Only handled if the option module_compliance + is provided to the compiler.

+

See compile/2 + for more info.

+

For backward compatibillity, the MIBs provided with + this appliaction are not compiled with these + options.

Own Id: OTP-8966

diff --git a/lib/snmp/doc/src/snmpc.xml b/lib/snmp/doc/src/snmpc.xml index fbd0950c69..e33828326a 100644 --- a/lib/snmp/doc/src/snmpc.xml +++ b/lib/snmp/doc/src/snmpc.xml @@ -4,7 +4,7 @@
- 20042010 + 20042011 Ericsson AB. All Rights Reserved. @@ -37,6 +37,7 @@

The module snmpc contains interface functions to the SNMP toolkit MIB compiler.

+ @@ -47,7 +48,7 @@ File = string() Options = [opt()] - opt() = db() | relaxed_row_name_assign_check() | deprecated() | description() | reference() | group_check() | i() | il() | imports() | module() | module_identity() | outdir() | no_defs() | verbosity() | warnings() + opt() = db() | relaxed_row_name_assign_check() | deprecated() | description() | reference() | group_check() | i() | il() | imports() | module() | module_identity() | module_compliance() | agent_capabilities() | outdir() | no_defs() | verbosity() | warnings() db() = {db, volatile|persistent|mnesia} deprecated() = {deprecated, bool()} relaxed_row_name_assign_check() = relaxed_row_name_assign_check @@ -59,6 +60,8 @@ imports() = imports module() = {module, atom()} module_identity() = module_identity + module_compliance() = module_compliance + agent_capabilities() = agent_capabilities no_defs() = no_defs outdir() = {outdir, dir()} verbosity() = {verbosity, silence|warning|info|log|debug|trace} @@ -77,6 +80,7 @@ be used for the default instrumentation.

Default is volatile.

+

The option deprecated specifies if a deprecated definition should be kept or not. If the option is @@ -84,6 +88,7 @@ definitions.

Default is true.

+

The option relaxed_row_name_assign_check, if present, specifies that the row name assign check shall not be done @@ -94,12 +99,14 @@

By default it is not included, but if this option is present it will be.

+

The option description specifies if the text of the DESCRIPTION field will be included or not.

By default it is not included, but if this option is present it will be.

+

The option reference specifies if the text of the REFERENCE field, when found in a table definition, @@ -108,18 +115,21 @@ it will be. The reference text will be placed in the allocList field of the mib-entry record (#me{}) for the table.

+

The option group_check specifies whether the mib compiler should check the OBJECT-GROUP macro and the NOTIFICATION-GROUP macro for correctness or not.

Default is true.

+

The option i specifies the path to search for imported (compiled) MIB files. The directories should be strings with a trailing directory delimiter.

Default is ["./"].

+

The option il (include_lib) also specifies a list of directories to search for imported MIBs. It @@ -132,11 +142,13 @@ /priv/mibs/]]> are always listed last in the include path.

+

The option imports, if present, specifies that the IMPORT statement of the MIB shall be included in the compiled mib.

+

The option module, if present, specifies the name of a module which implements all instrumentation @@ -145,11 +157,29 @@ functions must be the same as the corresponding managed object it implements.

+

The option module_identity, if present, specifies that the info part of the MODULE-IDENTITY statement of the MIB shall be included in the compiled mib.

+ + +

The option module_compliance, if present, specifies + that the MODULE-COMPLIANCE statement of the MIB shall be included + (with a mib-entry record) in the compiled mib. The mib-entry record + of the module-compliance will contain reference and module + part(s) this info in the assocList field).

+
+ + +

The option agent_capabilities, if present, specifies + that the AGENT-CAPABILITIES statement of the MIB shall be included + (with a mib-entry record) in the compiled mib. The mib-entry record + of the agent-capabilitie will contain reference and modules + part(s) this info in the assocList field).

+
+

The option no_defs, if present, specifies that if a managed object does not have an instrumentation @@ -157,6 +187,7 @@ be used, instead this is reported as an error, and the compilation aborts.

+

The option verbosity specifies the verbosity of the SNMP mib compiler. I.e. if warning, info, log, debug @@ -166,11 +197,13 @@ option verbosity is silence, warning messages will still be shown.

+

The option warnings specifies whether warning messages should be shown.

Default is true.

+

The MIB compiler understands both SMIv1 and SMIv2 MIBs. It uses the MODULE-IDENTITY statement to determine if the MIB is @@ -185,8 +218,11 @@ have to be specified to erlc using the syntax +term. See erlc(1) for details.

+ + + is_consistent(Mibs) -> ok | {error, Reason} Check for OID conflicts between MIBs @@ -198,8 +234,11 @@

Checks for multiple usage of object identifiers and traps between MIBs.

+ +
+ mib_to_hrl(MibName) -> ok | {error, Reason} Generate constants for the objects in the MIB diff --git a/lib/snmp/mibs/Makefile.in b/lib/snmp/mibs/Makefile.in index b85a8b0767..7aefb0ea34 100644 --- a/lib/snmp/mibs/Makefile.in +++ b/lib/snmp/mibs/Makefile.in @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2009. All Rights Reserved. +# Copyright Ericsson AB 1996-2011. 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 @@ -108,20 +108,28 @@ TARGET_FILES = \ # FLAGS # ---------------------------------------------------- -SNMP_FLAGS += -pa ../ebin +version +SNMP_FLAGS += -pa ../ebin +version ifneq ($(MIBS_VERBOSITY),) -SNMP_FLAGS += +'{verbosity,$(MIBS_VERBOSITY)}' +SNMP_FLAGS += +'{verbosity, $(MIBS_VERBOSITY)}' endif -ifneq ($(MIBS_REFERENCE),) +ifeq ($(MIBS_REFERENCE),true) SNMP_FLAGS += +reference endif -ifneq ($(MIBS_OPTIONS),) +ifeq ($(MIBS_OPTIONS),true) SNMP_FLAGS += +options endif +ifeq ($(MIBS_MC),true) +SNMP_FLAGS += +module_compliance +endif + +ifeq ($(MIBS_AC),true) +SNMP_FLAGS += +agent_capabilities +endif + # ---------------------------------------------------- # Targets @@ -148,6 +156,14 @@ conf: cd ..; $(MAKE) conf info: + @echo "MIBS_REFERENCE = $(MIBS_REFERENCE)" + @echo "" + @echo "MIBS_OPTIONS = $(MIBS_OPTIONS)" + @echo "" + @echo "MIBS_MC = $(MIBS_MC)" + @echo "" + @echo "MIBS_AC = $(MIBS_AC)" + @echo "" @echo "SNMP_FLAGS = $(SNMP_FLAGS)" @echo "" @echo "MIBS = $(MIBS)" diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index af6e39d058..a3a893dd51 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. 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 @@ -112,6 +112,8 @@ compile(FileName) -> %% description %% reference %% imports +%% agent_capabilities +%% module_compliance %% module_identity %% {module, string()} %% no_defs @@ -203,6 +205,10 @@ get_options([imports|Opts], Formats, Args) -> get_options(Opts, ["~n imports"|Formats], Args); get_options([module_identity|Opts], Formats, Args) -> get_options(Opts, ["~n module_identity"|Formats], Args); +get_options([module_compliance|Opts], Formats, Args) -> + get_options(Opts, ["~n module_compliance"|Formats], Args); +get_options([agent_capabilities|Opts], Formats, Args) -> + get_options(Opts, ["~n agent_capabilities"|Formats], Args); get_options([relaxed_row_name_assign_check|Opts], Formats, Args) -> get_options(Opts, ["~n relaxed_row_name_assign_check"|Formats], Args); get_options([_|Opts], Formats, Args) -> @@ -288,6 +294,10 @@ check_options([imports| T]) -> check_options(T); check_options([module_identity| T]) -> check_options(T); +check_options([module_compliance| T]) -> + check_options(T); +check_options([agent_capabilities| T]) -> + check_options(T); check_options([relaxed_row_name_assign_check| T]) -> check_options(T); check_options([{module, M} | T]) when is_atom(M) -> @@ -315,6 +325,12 @@ get_description(Options) -> get_reference(Options) -> get_bool_option(reference, Options). +get_agent_capabilities(Options) -> + get_bool_option(agent_capabilities, Options). + +get_module_compliance(Options) -> + get_bool_option(module_compliance, Options). + get_relaxed_row_name_assign_check(Options) -> lists:member(relaxed_row_name_assign_check, Options). @@ -387,10 +403,12 @@ get_verbosity(Options) -> init(From, MibFileName, Options) -> {A,B,C} = now(), random:seed(A,B,C), - put(options, Options), - put(verbosity, get_verbosity(Options)), - put(description, get_description(Options)), - put(reference, get_reference(Options)), + put(options, Options), + put(verbosity, get_verbosity(Options)), + put(description, get_description(Options)), + put(reference, get_reference(Options)), + put(agent_capabilities, get_agent_capabilities(Options)), + put(module_compliance, get_module_compliance(Options)), File = filename:rootname(MibFileName, ".mib"), put(filename, filename:basename(File ++ ".mib")), R = case catch c_impl(File) of @@ -930,42 +948,95 @@ definitions_loop([{#mc_agent_capabilities{name = Name, ?vlog2("defloop -> agent_capabilities ~p:" "~n Status: ~p" "~n Desc: ~p" + "~n Ref: ~p" + "~n Mods: ~p" "~n Parent: ~p" "~n SubIndex: ~p", - [Name, Status, Desc, Parent, SubIdx], Line), - update_status(Name, Status), + [Name, Status, Desc, Ref, Mods, Parent, SubIdx], Line), ensure_macro_imported('AGENT-CAPABILITIES', Line), - snmpc_lib:register_oid(Line, Name, Parent, SubIdx), - NewME = snmpc_lib:makeInternalNode2(false, Name), - Description = make_description(Desc), - Reference = - case Ref of - undefined -> - []; - _ -> - [{reference, Ref}] - end, - Modules = - case Mods of - undefined -> - []; - [] -> - []; - _ -> - [{modules, Mods}] - end, - AssocList = Reference ++ Modules, - NewME2 = NewME#me{description = Description, - assocList = AssocList}, - snmpc_lib:add_cdata(#cdata.mes, [NewME2]), + case get(agent_capabilities) of + true -> + update_status(Name, Status), + snmpc_lib:register_oid(Line, Name, Parent, SubIdx), + NewME = snmpc_lib:makeInternalNode2(false, Name), + Description = make_description(Desc), + Reference = + case Ref of + undefined -> + []; + _ -> + [{reference, Ref}] + end, + Modules = + case Mods of + undefined -> + []; + [] -> + []; + _ -> + [{modules, Mods}] + end, + AssocList = Reference ++ Modules, + NewME2 = NewME#me{description = Description, + assocList = AssocList}, + snmpc_lib:add_cdata(#cdata.mes, [NewME2]); + _ -> + ok + end, definitions_loop(T, Data); -definitions_loop([{#mc_module_compliance{name = Name},Line}|T], Data) -> - ?vlog2("defloop -> module_compliance:" - "~n Name: ~p", [Name], Line), +definitions_loop([{#mc_module_compliance{name = Name, + status = Status, + description = Desc, + reference = Ref, + modules = Mods, + name_assign = {Parent, SubIdx}},Line}|T], Data) -> + ?vlog2("defloop -> module_compliance: ~p" + "~n Status: ~p" + "~n Desc: ~p" + "~n Ref: ~p" + "~n Mods: ~p" + "~n Parent: ~p" + "~n SubIndex: ~p", + [Name, Status, Desc, Ref, Mods, Parent, SubIdx], Line), ensure_macro_imported('MODULE-COMPLIANCE', Line), + case get(module_compliance) of + true -> + update_status(Name, Status), + snmpc_lib:register_oid(Line, Name, Parent, SubIdx), + NewME = snmpc_lib:makeInternalNode2(false, Name), + Description = make_description(Desc), + Reference = + case Ref of + undefined -> + []; + _ -> + [{reference, Ref}] + end, + Modules = + case Mods of + undefined -> + []; + [] -> + []; + _ -> + [{modules, Mods}] + end, + AssocList = Reference ++ Modules, + NewME2 = NewME#me{description = Description, + assocList = AssocList}, + snmpc_lib:add_cdata(#cdata.mes, [NewME2]); + _ -> + ok + end, definitions_loop(T, Data); +%% definitions_loop([{#mc_module_compliance{name = Name},Line}|T], Data) -> +%% ?vlog2("defloop -> module_compliance:" +%% "~n Name: ~p", [Name], Line), +%% ensure_macro_imported('MODULE-COMPLIANCE', Line), +%% definitions_loop(T, Data); + definitions_loop([{#mc_object_group{name = Name, objects = GroupObjects, status = Status, diff --git a/lib/snmp/src/compile/snmpc.hrl b/lib/snmp/src/compile/snmpc.hrl index f349cae3f2..1c0808d065 100644 --- a/lib/snmp/src/compile/snmpc.hrl +++ b/lib/snmp/src/compile/snmpc.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. 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 @@ -145,7 +145,7 @@ status, description, reference, - module, + modules, name_assign } ). diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index b322b45022..a0c59059d2 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -588,13 +588,29 @@ prodrel -> string : lreverse(prodrel, val('$1')). ac_status -> atom : ac_status('$1'). -ac_modulepart -> ac_modules : lreverse(ac_modulepart, '$1'). -ac_modulepart -> '$empty' : []. +ac_modulepart -> ac_modules : +%% i("ac_modulepart -> " +%% "~n $1: ~p", ['$1']), + lreverse(ac_modulepart, '$1'). +ac_modulepart -> '$empty' : +%% i("ac_modulepart -> empty", []), + []. -ac_modules -> ac_module : '$1'. -ac_modules -> ac_modules ac_module : ['$2' | ['$1']]. +ac_modules -> ac_module : +%% i("ac_modules -> " +%% "~n $1: ~p", ['$1']), + ['$1']. +ac_modules -> ac_module ac_modules : +%% i("ac_modules -> " +%% "~n $1: ~p" +%% "~n $2: ~p", ['$1', '$2']), + ['$1' | '$2']. ac_module -> 'SUPPORTS' ac_modulenamepart 'INCLUDES' '{' objects '}' ac_variationpart : +%% i("ac_module -> " +%% "~n $2: ~p" +%% "~n $5: ~p" +%% "~n $7: ~p", ['$2', '$5', '$7']), make_ac_module('$2', '$5', '$7'). ac_modulenamepart -> mibname : '$1'. @@ -645,10 +661,10 @@ ac_creationpart -> '$empty' : []. mc_modulepart -> '$empty' : -%% io:format("mc_modulepart -> empty~n", []), +%% i("mc_modulepart -> empty", []), []. mc_modulepart -> mc_modules : -%% io:format("mc_modulepart -> $1: ~p~n", ['$1']), +%% i("mc_modulepart -> $1: ~p", ['$1']), lreverse(mc_modulepart, '$1'). mc_modules -> mc_module : @@ -656,7 +672,7 @@ mc_modules -> mc_module : %% "~n $1: ~p", ['$1']), ['$1']. mc_modules -> mc_module mc_modules : -%% i("mc_modules -> (modules module)" +%% i("mc_modules -> " %% "~n $1: ~p" %% "~n $2: ~p", ['$1', '$2']), ['$1' | '$2']. @@ -969,12 +985,12 @@ make_ac_module(Name, Grps, Var) -> variation = Var}. -make_module_compliance(Name, Status, Desc, Ref, Mod, NA) -> +make_module_compliance(Name, Status, Desc, Ref, Mods, NA) -> #mc_module_compliance{name = Name, status = Status, description = Desc, reference = Ref, - module = Mod, + modules = Mods, name_assign = NA}. make_mc_module(Name, Mand, Compl) -> diff --git a/lib/snmp/test/modules.mk b/lib/snmp/test/modules.mk index b90c6af482..eacc749b53 100644 --- a/lib/snmp/test/modules.mk +++ b/lib/snmp/test/modules.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2004-2010. All Rights Reserved. +# Copyright Ericsson AB 2004-2011. 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 @@ -63,6 +63,7 @@ COMPILER_MIB_FILES = \ MIB_FILES = \ AC-TEST-MIB.mib \ + MC-TEST-MIB.mib \ OLD-SNMPEA-MIB.mib \ OLD-SNMPEA-MIB-v2.mib \ Klas1.mib \ diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index 09fc417af4..592b3efee2 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-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-2011. 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 @@ -45,6 +45,7 @@ imports/1, module_identity/1, agent_capabilities/1, + module_compliance/1, tickets/1, otp_6150/1, @@ -98,6 +99,7 @@ all(suite) -> imports, module_identity, agent_capabilities, + module_compliance, tickets ]. @@ -183,12 +185,73 @@ agent_capabilities(Config) when is_list(Config) -> OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), Dir = ?config(mib_dir, Config), AcMib = join(Dir,"AC-TEST-MIB.mib"), - ?line {ok, Mib} = snmpc:compile(AcMib, [options, - version, - {i, [SnmpMibsDir, OtpMibsMibsDir]}, - {outdir, Dir}, - {verbosity, trace}]), - io:format("agent_capabilities -> Mib: ~n~p~n", [Mib]), + ?line {ok, MibFile1} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib1} = snmp_misc:read_mib(MibFile1), + ?line {ok, MibFile2} = snmpc:compile(AcMib, [options, + version, + agent_capabilities, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib2} = snmp_misc:read_mib(MibFile2), + MEDiff = Mib2#mib.mes -- Mib1#mib.mes, + %% This is a rather pathetic test, but it is somthing... + io:format("agent_capabilities -> " + "~n MEDiff: ~p" + "~n Mib1: ~p" + "~n Mib2: ~p" + "~n", [MEDiff, Mib1, Mib2]), + case length(MEDiff) of + 2 -> + ok; + _BadLen -> + exit({unexpected_mes, MEDiff}) + end, + ok. + + +module_compliance(suite) -> + []; +module_compliance(Config) when is_list(Config) -> + put(tname,module_compliance), + p("starting with Config: ~p~n", [Config]), + + SnmpPrivDir = code:priv_dir(snmp), + SnmpMibsDir = join(SnmpPrivDir, "mibs"), + OtpMibsPrivDir = code:priv_dir(otp_mibs), + OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), + Dir = ?config(mib_dir, Config), + AcMib = join(Dir,"MC-TEST-MIB.mib"), + ?line {ok, MibFile1} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib1} = snmp_misc:read_mib(MibFile1), + ?line {ok, MibFile2} = snmpc:compile(AcMib, [options, + version, + module_compliance, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib2} = snmp_misc:read_mib(MibFile2), + MEDiff = Mib2#mib.mes -- Mib1#mib.mes, + %% This is a rather pathetic test, but it is somthing... + io:format("agent_capabilities -> " + "~n MEDiff: ~p" + "~n Mib1: ~p" + "~n Mib2: ~p" + "~n", [MEDiff, Mib1, Mib2]), + case length(MEDiff) of + 1 -> + ok; + _BadLen -> + exit({unexpected_mes, MEDiff}) + end, ok. diff --git a/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib b/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib new file mode 100644 index 0000000000..cadaa6f891 --- /dev/null +++ b/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib @@ -0,0 +1,173 @@ +MC-TEST-MIB DEFINITIONS ::= BEGIN + +IMPORTS + otpExpr + FROM OTP-REG + MODULE-IDENTITY, OBJECT-TYPE, + mib-2, NOTIFICATION-TYPE, OBJECT-IDENTITY + FROM SNMPv2-SMI + TDomain, TAddress, DisplayString, TEXTUAL-CONVENTION, + AutonomousType, RowPointer, TimeStamp, + RowStatus, StorageType + FROM SNMPv2-TC + MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP + FROM SNMPv2-CONF; + +mcTestModule MODULE-IDENTITY + LAST-UPDATED "9605160000Z" + ORGANIZATION "MC Test Co." + CONTACT-INFO + "developer@small.company." + DESCRIPTION + "MC Test module." + ::= { reg 1 } + +mcObjects OBJECT IDENTIFIER ::= { mcTestModule 1 } + +-- MIB contains one group + +mcMisc OBJECT IDENTIFIER ::= { mcObjects 1 } +mcGeneral OBJECT IDENTIFIER ::= { mcObjects 2 } + + +mcTest OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Test area." + ::= { otpExpr 4322 } + + +reg OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Registrations." + ::= { mcTest 1 } + + +mcTable OBJECT-TYPE + SYNTAX SEQUENCE OF McEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains one row per physical entity. There is + always at least one row for an 'overall' physical entity." + ::= { mcMisc 1 } + +mcEntry OBJECT-TYPE + SYNTAX McEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table entry..." + INDEX { mcIndex } + ::= { mcTable 1 } + +McEntry ::= SEQUENCE { + mcIndex INTEGER, + mcName DisplayString, + mcStorageType StorageType, + mcRowStatus RowStatus +} + +mcIndex OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The index for this entry." + ::= { mcEntry 1 } + +mcName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Name of... " + ::= { mcEntry 2 } + + +mcStorageType OBJECT-TYPE + SYNTAX StorageType + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The storage type for this conceptual row." + DEFVAL { nonVolatile } + ::= { mcEntry 3 } + +mcRowStatus OBJECT-TYPE + SYNTAX RowStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this conceptual row..." + ::= { mcEntry 4 } + + +-- last change time stamp for the whole MIB +mcTimeStamp OBJECT-TYPE + SYNTAX TimeStamp + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The sysUpTime value when of the last time *anything* in the + MIB was changed. " + ::= { mcGeneral 1 } + +-- Entity MIB Trap Definitions +mcTraps OBJECT IDENTIFIER ::= { mcTestModule 2 } +mcTrapPrefix OBJECT IDENTIFIER ::= { mcTraps 0 } + +mcConfigChange NOTIFICATION-TYPE + STATUS current + DESCRIPTION + "An mcConfigChange trap is sent when the value of + entLastChangeTime changes..." + ::= { mcTrapPrefix 1 } + +-- conformance information +mcConformance OBJECT IDENTIFIER ::= { mcTestModule 3 } + +mcCompliances OBJECT IDENTIFIER ::= { mcConformance 1 } +mcGroups OBJECT IDENTIFIER ::= { mcConformance 2 } + +-- compliance statements + + +mcCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for SNMP entities which implement + the MC Test MIB." + MODULE -- this module + MANDATORY-GROUPS { mcGeneralGroup, + mcNotificationsGroup } + ::= { mcCompliances 1 } + +-- MIB groupings + +mcGeneralGroup OBJECT-GROUP + OBJECTS { + mcName, + mcStorageType, + mcRowStatus, + mcTimeStamp + } + STATUS current + DESCRIPTION + "The collection of objects which are used to represent + general information..." + ::= { mcGroups 1 } + +mcNotificationsGroup NOTIFICATION-GROUP + NOTIFICATIONS { mcConfigChange } + STATUS current + DESCRIPTION + "The collection of notifications..." + ::= { mcGroups 2 } + + +END + + + -- cgit v1.2.3 From 031613986bf597c879cefbd64581b5fbd7cfb2ea Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Sat, 19 Feb 2011 20:59:41 +0100 Subject: Fixed spelling and such things... Please enter the commit message for your changes. Lines starting --- lib/snmp/src/compile/snmpc.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src index bafcc79150..5ad88eacc8 100644 --- a/lib/snmp/src/compile/snmpc.src +++ b/lib/snmp/src/compile/snmpc.src @@ -102,7 +102,7 @@ usage() -> "~n correspond to an OTP application. For example snmp/mibs/" "~n The current workin dir and the /priv/mibs " "~n are always listed last the includ path. " - "~n --db - Database ro used for the defaul instrumentation." + "~n --db - Database to used for the default instrumentation." "~n Defaults to volatile." "~n --deprecated - Keep deprecated definition(s)." "~n If not specified the compiler will ignore" @@ -111,7 +111,7 @@ usage() -> "~n --reference - The REFERENCE field will be included." "~n --imports - The IMPORTS field will be included." "~n --module_id - The MODULE-IDENTITY field will be included." - "~n --module - The module which implements all the instrumentation" "~n functions. " "~n The name of the of all instrumentation functions" "~n must be the same as the corresponding managed object" -- cgit v1.2.3 From 95280cc9c09187465d423fd3481b3aa4310c4bab Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 22 Feb 2011 10:32:00 +0100 Subject: Prep for release: snmp-4.19 --- lib/snmp/doc/src/notes.xml | 8 ++++---- lib/snmp/vsn.mk | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 3fe39c4d03..39aff4e28a 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -1,4 +1,4 @@ - + @@ -33,8 +33,8 @@
- SNMP Development Toolkit 4.18.1 -

Version 4.18.1 supports code replacement in runtime from/to + SNMP Development Toolkit 4.19 +

Version 4.19 supports code replacement in runtime from/to version 4.18, 4.17.1 and 4.17.

@@ -64,7 +64,7 @@ Incompatibilities

-

-
+
SNMP 4.18 diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 67cc05687d..617f0fce62 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -17,6 +17,6 @@ # # %CopyrightEnd% -SNMP_VSN = 4.18.1 +SNMP_VSN = 4.19 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -- cgit v1.2.3 From 197d6abd8b6efb30c6237133ed08bf379f29cb84 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 22 Feb 2011 10:37:18 +0100 Subject: Prep for release: snmp-4.19 --- lib/snmp/doc/src/notes.xml | 10 +++++----- lib/snmp/vsn.mk | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index f3bb9d25ea..c42d62f013 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -1,4 +1,4 @@ - + @@ -33,8 +33,8 @@
- SNMP Development Toolkit 4.18.1 -

Version 4.18.1 supports code replacement in runtime from/to + SNMP Development Toolkit 4.19 +

Version 4.19 supports code replacement in runtime from/to version 4.18, 4.17.1 and 4.17.

@@ -47,7 +47,7 @@

[agent] For the table vacmAccessTable, - when performing the is_set_ok and set opteration(s), + when performing the is_set_ok and set operation(s), all values of the vacmAccessSecurityModel column was incorrectly translated to any.

+
diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 67cc05687d..617f0fce62 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -17,6 +17,6 @@ # # %CopyrightEnd% -SNMP_VSN = 4.18.1 +SNMP_VSN = 4.19 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -- cgit v1.2.3 From 9b824d59d33094b013058090729c1c4b98200716 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 22 Feb 2011 19:11:26 +0100 Subject: Backup commit (time to go home)... --- lib/snmp/src/compile/snmpc.src | 230 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 203 insertions(+), 27 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src index 5ad88eacc8..61d7a0b04f 100644 --- a/lib/snmp/src/compile/snmpc.src +++ b/lib/snmp/src/compile/snmpc.src @@ -2,47 +2,57 @@ %% -*- erlang -*- %% +-include_lib("kernel/include/file.hrl"). + -record(state, { - version = %VSN%, + version = "%VSN%", mib_file, outdir = "./", db = volatile, include_dirs = ["./"], include_lib_dirs = [], - deprecated = true, - group_check = true, - description = false, - reference = false, - imports = false, - module_identity = false, + deprecated = false, + group_check = true, + description = false, + reference = false, + imports = false, + module_identity = false, + module_compliance = false, + agent_capabilities = false, module, - no_defs = false, - relaxed_row_name_assigne_check, - verbosity + no_defaults = false, + relaxed_row_name_assigne_check = false, + %% The default verbosity (silence) will be filled in + %% during argument processing. + verbosity, + warnings = false }). %% --o Dir [defaults to "./"] %% --i Dir [defaults to "./"] %% --il Dir -%% --gc +%% --sgc %% --db DB [defaults to volatile] %% --dep %% --desc %% --ref %% --imp %% --mi +%% --mc +%% --ac %% --mod Mod %% --nd %% --rrnac %% --version %% --verbosity V +%% --warnings main(Args) when is_list(Args) -> case (catch process_args(Args)) of ok -> usage(); {ok, State} when is_record(State, state) -> - io:format("snmpc: ~p~n", [State]); + compile(State); {ok, Str} when is_list(Str) -> io:format("~s~n~n", [Str]), halt(1); @@ -52,14 +62,101 @@ main(Args) when is_list(Args) -> main(_) -> usage(). +compile(State) -> + io:format("snmpc: ~p~n", [State]), + File = mk_file(State), + Options = mk_options(State), + case snmpc:compile(File, Options) of + {ok, BinFileName} -> + io:format("BinFileName: ~p~n", [BinFileName]), + ok; + {error, Reason} -> + io:format("Reason: ~p~n", [Reason]), + ok + end. + +mk_file(#state{mib_file = MIB}) -> + MIB -- ".mib". + +mk_options(#state{outdir = OutDir, + db = DB, + include_dirs = IDs, + include_lib_dirs = ILDs, + deprecated = Dep, + group_check = GC, + description = Desc, + reference = Ref, + imports = Imp, + module_identity = MI, + module_compliance = MC, + agent_capabilities = AC, + module = Mod, + no_defaults = ND, + relaxed_row_name_assigne_check = RRNAC, + %% The default verbosity (silence) will be filled in + %% during argument processing. + verbosity = V, + warnings = W}) -> + [{outdir, OutDir}, + {db, DB}, + {i, IDs}, + {il, ILDs}, + {group_check, GC}, + {verbosity, V}, + {warnings, W}, + {deprecated, Dep}] ++ + if + (Mod =/= undefined) -> + [{module, Mod}]; + true -> + [] + end ++ + maybe_option(ND, no_defs) ++ + maybe_option(RRNAC, relaxed_row_name_assign_check) ++ + maybe_option(Desc, description) ++ + maybe_option(Ref, reference) ++ + maybe_option(Imp, imports) ++ + maybe_option(MI, module_identity) ++ + maybe_option(MC, module_compliance) ++ + maybe_option(AC, agent_capabilities). + +maybe_option(true, Opt) -> [Opt]; +maybe_option(_, _) -> []. + process_args([]) -> - {error, lists:flatten(io_lib:format("No MIB-file", []))}; + e("No input file"); process_args(Args) -> - %% CWD = "./", process_args(Args, #state{}). -process_args([], State) -> - {ok, State}; +process_args([], #state{verbosity = Verbosity0, mib_file = MIB} = State) -> + if + (MIB =:= undefined) -> + e("No input file"); + true -> + Verbosity = + case Verbosity0 of + undefined -> + silence; + _ -> + Verbosity0 + end, + IPath = lists:reverse(State#state.include_dirs), + IlPath = lists:reverse(State#state.include_lib_dirs), + {ok, State#state{verbosity = Verbosity, + include_dirs = IPath, + include_lib_dirs = IlPath}} + end; +process_args([MIB], State) -> + case (catch file:read_file_info(MIB)) of + {ok, #file_info{type = regular}} -> + {ok, State#state{mib_file = MIB}}; + {ok, #file_info{type = BadType}} -> + e(lists:flatten(io_lib:format("~s not a file: ~w", [MIB, BadType]))); + {error, enoent} -> + e(lists:flatten(io_lib:format("No such file: ~s", [MIB]))); + _ -> + e(lists:flatten(io_lib:format("Bad file: ~s", [MIB]))) + end; process_args(["--help"|_Args], _State) -> ok; process_args(["--version"|_Args], State) -> @@ -76,9 +173,70 @@ process_args(["--verbosity", Verbosity0|Args], #state{verbosity = V} = State) process_args(["--verbosity"|_Args], #state{verbosity = V}) when (V =/= undefined) -> e(lists:flatten(io_lib:format("Verbosity already set to ~w", [V]))); -process_args([Arg|Args], State) -> - io:format("Arg: ~p~n", [Arg]), - process_args(Args, State). +process_args(["--warnings"|Args], State) -> + process_args(Args, State#state{warnings = true}); +process_args(["--o", Dir|Args], State) -> + case (catch file:read_file_info(Dir)) of + {ok, #file_info{type = directory}} -> + process_args(Args, State#state{outdir = Dir}); + {ok, #file_info{type = BadType}} -> + e(lists:flatten(io_lib:format("Not a directory: ~p (~w)", [Dir, BadType]))); + _ -> + e(lists:flatten(io_lib:format("Bad directory: ~p", [Dir]))) + end; +process_args(["--i", Dir|Args], State) -> + case (catch file:read_file_info(Dir)) of + {ok, #file_info{type = directory}} -> + IPath = [Dir | State#state.include_dirs], + process_args(Args, State#state{include_dirs = IPath}); + {ok, #file_info{type = BadType}} -> + e(lists:flatten(io_lib:format("Not a directory: ~p (~w)", [Dir, BadType]))); + _ -> + e(lists:flatten(io_lib:format("Bad directory: ~p", [Dir]))) + end; +process_args(["--il", Dir|Args], State) -> + case (catch file:read_file_info(Dir)) of + {ok, #file_info{type = directory}} -> + IlPath = [Dir | State#state.include_lib_dirs], + process_args(Args, State#state{include_lib_dirs = IlPath}); + {ok, #file_info{type = BadType}} -> + e(lists:flatten(io_lib:format("Not a directory: ~p (~w)", [Dir, BadType]))); + _ -> + e(lists:flatten(io_lib:format("Bad directory: ~p", [Dir]))) + end; +process_args(["--db", DB0|Args], State) -> + DB = list_to_atom(DB0), + case lists:member(DB, [volatile,persistent,mnesia]) of + true -> + process_args(Args, State#state{db = DB}); + false -> + e(lists:flatten(io_lib:format("Invalid db: ~s", [DB0]))) + end; +process_args(["--dep"|Args], State) -> + process_args(Args, State#state{deprecated = true}); +process_args(["--sgc"|Args], State) -> + process_args(Args, State#state{group_check = false}); +process_args(["--desc"|Args], State) -> + process_args(Args, State#state{description = true}); +process_args(["--ref"|Args], State) -> + process_args(Args, State#state{reference = true}); +process_args(["--imp"|Args], State) -> + process_args(Args, State#state{imports = true}); +process_args(["--mi"|Args], State) -> + process_args(Args, State#state{module_identity = true}); +process_args(["--mod", Module0|Args], #state{module = M} = State) + when (M =:= undefined) -> + Module = list_to_atom(Module0), + process_args(Args, State#state{module = Module}); +process_args(["--mod"|_Args], #state{module = M}) + when (M =/= undefined) -> + e(lists:flatten(io_lib:format("Module already set to ~w", [M]))); +process_args(["--nd"|Args], State) -> + process_args(Args, State#state{no_defaults = true}); +process_args(["--rrnac"|Args], State) -> + process_args(Args, State#state{relaxed_row_name_assigne_check = true}); +process_args([Arg|Args], _State) when Args =/= [] -> + e(lists:flatten(io_lib:format("Unknown option: ~s", [Arg]))). usage(ReasonStr) -> io:format("ERROR: ~s~n", [ReasonStr]), @@ -93,10 +251,12 @@ usage() -> "~n verbosity = trace | debug | log | info | silence" "~n Defaults to silence." "~n --warnings - Print warning messages." + "~n --o - The output dir." + "~n Defaults to current working dir." "~n --i - Add this dir to the list of dirs that will be" "~n searched for imported (compiled) MIB files." "~n The current workin dir will always be included. " - "~n --il - Add this dir to the list of dirs that will be" + "~n --il - Add this dir to the list of dirs that will be" "~n searched for imported (compiled) MIB files." "~n It assumes that the first element in the dir name" "~n correspond to an OTP application. For example snmp/mibs/" @@ -104,22 +264,37 @@ usage() -> "~n are always listed last the includ path. " "~n --db - Database to used for the default instrumentation." "~n Defaults to volatile." - "~n --deprecated - Keep deprecated definition(s)." + "~n --sgc - This option (skip group check), if present, disables " + "~n the \"group check\" of the mib compiler. " + "~n That is, should the OBJECT-GROUP and the NOTIFICATION-GROUP " + "~n macro(s) be checked for correctness or not. " + "~n By default the check is done. " + "~n --dep - Keep deprecated definition(s)." "~n If not specified the compiler will ignore" "~n deprecated definitions." - "~n --description - The DESCRIPTION field will be included." - "~n --reference - The REFERENCE field will be included." - "~n --imports - The IMPORTS field will be included." - "~n --module_id - The MODULE-IDENTITY field will be included." - "~n --module - The module which implements all the instrumentation" + "~n --desc - The DESCRIPTION field will be included." + "~n --ref - The REFERENCE field will be included." + "~n --imp - The IMPORTS field will be included." + "~n --mi - The MODULE-IDENTITY field will be included." + "~n --mc - The MODULE-COMPLIANCE field will be included." + "~n --ac - The AGENT-CAPABILITIES field will be included." + "~n --mod - The module which implements all the instrumentation" "~n functions. " "~n The name of the of all instrumentation functions" "~n must be the same as the corresponding managed object" "~n it implements." - "~n --no_defs - The default instrumentation functions will *not* be used" + "~n --nd - The default instrumentation functions will *not* be used" "~n if a managed object have no instrumentation function. " "~n Instead this will be reported as an error, and the " "~n compilation aborts. " + "~n --rrnac - This option, if present, specifies that the row name " + "~n assign check shall not be done strictly according to" + "~n the SMI (which allows only the value 1). " + "~n With this option, all values gŕeater than zero is allowed" + "~n (>= 1). This means that the error will be converted to " + "~n a warning. " + "~n By default it is not included, but if this option is " + "~n is present it will be. " "~n " "~n", []), halt(1). @@ -127,3 +302,4 @@ usage() -> e(Reason) -> throw({error, Reason}). + -- cgit v1.2.3 From 1ffc9f43fe3e80428389636a2e9ba5bf101338f2 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 09:51:29 +0100 Subject: Fixed MIB file name making... --- lib/snmp/src/compile/snmpc.src | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src index 61d7a0b04f..f4336a3264 100644 --- a/lib/snmp/src/compile/snmpc.src +++ b/lib/snmp/src/compile/snmpc.src @@ -67,8 +67,7 @@ compile(State) -> File = mk_file(State), Options = mk_options(State), case snmpc:compile(File, Options) of - {ok, BinFileName} -> - io:format("BinFileName: ~p~n", [BinFileName]), + {ok, _BinFileName} -> ok; {error, Reason} -> io:format("Reason: ~p~n", [Reason]), @@ -76,7 +75,9 @@ compile(State) -> end. mk_file(#state{mib_file = MIB}) -> - MIB -- ".mib". + DirName = filename:dirname(MIB), + BaseName = filename:basename(MIB, ".mib"), + filename:join(DirName, BaseName). mk_options(#state{outdir = OutDir, db = DB, -- cgit v1.2.3 From ec1eba2f8daff87ca84a17e738fc3b9480c42517 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 10:12:35 +0100 Subject: Fixed verbosity. --- lib/snmp/src/compile/snmpc.src | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src index f4336a3264..4581339015 100644 --- a/lib/snmp/src/compile/snmpc.src +++ b/lib/snmp/src/compile/snmpc.src @@ -1,6 +1,27 @@ #!/usr/bin/env escript %% -*- erlang -*- %% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2009. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% SNMP MIB compiler frontend +%% + +-mode(compile). -include_lib("kernel/include/file.hrl"). @@ -25,10 +46,13 @@ relaxed_row_name_assigne_check = false, %% The default verbosity (silence) will be filled in %% during argument processing. - verbosity, - warnings = false + verbosity, + warnings = false }). + +%% ------------------------------------------------------------------------ +%% Valid arguments: %% --o Dir [defaults to "./"] %% --i Dir [defaults to "./"] %% --il Dir @@ -75,7 +99,7 @@ compile(State) -> end. mk_file(#state{mib_file = MIB}) -> - DirName = filename:dirname(MIB), + DirName = filename:dirname(MIB), BaseName = filename:basename(MIB, ".mib"), filename:join(DirName, BaseName). @@ -150,7 +174,7 @@ process_args([], #state{verbosity = Verbosity0, mib_file = MIB} = State) -> process_args([MIB], State) -> case (catch file:read_file_info(MIB)) of {ok, #file_info{type = regular}} -> - {ok, State#state{mib_file = MIB}}; + process_args([], State#state{mib_file = MIB}); {ok, #file_info{type = BadType}} -> e(lists:flatten(io_lib:format("~s not a file: ~w", [MIB, BadType]))); {error, enoent} -> -- cgit v1.2.3 From 7299063ec2daa38318d0d60fd1fe981c06758020 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 11:43:34 +0100 Subject: Fixed document encoding. --- lib/snmp/doc/src/snmpc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/snmpc.xml b/lib/snmp/doc/src/snmpc.xml index e33828326a..771629492d 100644 --- a/lib/snmp/doc/src/snmpc.xml +++ b/lib/snmp/doc/src/snmpc.xml @@ -1,4 +1,4 @@ - + -- cgit v1.2.3 From 984e0b99fb38d4b4a4bd18e8e1d1abfc7859d80d Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 11:44:47 +0100 Subject: Now also handling generation of header files. --- lib/snmp/src/compile/snmpc.src | 108 ++++++++++++++++++++---------- lib/snmp/src/compile/snmpc_mib_to_hrl.erl | 3 +- 2 files changed, 76 insertions(+), 35 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src index 4581339015..03044c6454 100644 --- a/lib/snmp/src/compile/snmpc.src +++ b/lib/snmp/src/compile/snmpc.src @@ -28,7 +28,7 @@ -record(state, { version = "%VSN%", - mib_file, + file, % .mib or .bin depending on which are compiled outdir = "./", db = volatile, include_dirs = ["./"], @@ -88,40 +88,72 @@ main(_) -> compile(State) -> io:format("snmpc: ~p~n", [State]), - File = mk_file(State), - Options = mk_options(State), - case snmpc:compile(File, Options) of - {ok, _BinFileName} -> - ok; - {error, Reason} -> - io:format("Reason: ~p~n", [Reason]), - ok + case mk_file(State) of + {mib, File} -> + Options = mk_mib_options(State), + case mib2bin(File, Options) of + {ok, _BinFileName} -> + ok; + {error, Reason} -> + io:format("ERROR: Failed compiling mib: " + "~n ~p~n", [Reason]), + halt(1) + end; + {bin, File} -> + Options = mk_hrl_options(State), + case bin2hrl(File, Options) of + ok -> + ok; + {error, Reason} -> + io:format("ERROR: Failed generating hrl from mib: " + "~n ~p~n", [Reason]), + halt(1) + end end. -mk_file(#state{mib_file = MIB}) -> +mib2bin(MibFileName, Options) -> + snmpc:compile(MibFileName, Options). + +bin2hrl(BinFileName, {OutDir, Verbosity}) -> + MibName = filename:basename(BinFileName), + BinFile = BinFileName ++ ".bin", + HrlFile = filename:join(OutDir, MibName) ++ ".hrl", + put(verbosity, Verbosity), + snmpc_mib_to_hrl:convert(BinFile, HrlFile, MibName). + + +mk_file(#state{file = MIB}) -> DirName = filename:dirname(MIB), - BaseName = filename:basename(MIB, ".mib"), - filename:join(DirName, BaseName). + case filename:extension(MIB) of + ".mib" -> + BaseName = filename:basename(MIB, ".mib"), + {mib, filename:join(DirName, BaseName)}; + ".bin" -> + BaseName = filename:basename(MIB, ".bin"), + {bin, filename:join(DirName, BaseName)}; + BadExt -> + e(lists:flatten(io_lib:format("Unsupported file type: ~s", [BadExt]))) + end. -mk_options(#state{outdir = OutDir, - db = DB, - include_dirs = IDs, - include_lib_dirs = ILDs, - deprecated = Dep, - group_check = GC, - description = Desc, - reference = Ref, - imports = Imp, - module_identity = MI, - module_compliance = MC, - agent_capabilities = AC, - module = Mod, - no_defaults = ND, - relaxed_row_name_assigne_check = RRNAC, - %% The default verbosity (silence) will be filled in - %% during argument processing. - verbosity = V, - warnings = W}) -> +mk_mib_options(#state{outdir = OutDir, + db = DB, + include_dirs = IDs, + include_lib_dirs = ILDs, + deprecated = Dep, + group_check = GC, + description = Desc, + reference = Ref, + imports = Imp, + module_identity = MI, + module_compliance = MC, + agent_capabilities = AC, + module = Mod, + no_defaults = ND, + relaxed_row_name_assigne_check = RRNAC, + %% The default verbosity (silence) will be filled in + %% during argument processing. + verbosity = V, + warnings = W}) -> [{outdir, OutDir}, {db, DB}, {i, IDs}, @@ -148,12 +180,18 @@ mk_options(#state{outdir = OutDir, maybe_option(true, Opt) -> [Opt]; maybe_option(_, _) -> []. + +mk_hrl_options(#state{outdir = OutDir, + verbosity = Verbosity}) -> + {OutDir, Verbosity}. + + process_args([]) -> e("No input file"); process_args(Args) -> process_args(Args, #state{}). -process_args([], #state{verbosity = Verbosity0, mib_file = MIB} = State) -> +process_args([], #state{verbosity = Verbosity0, file = MIB} = State) -> if (MIB =:= undefined) -> e("No input file"); @@ -174,7 +212,7 @@ process_args([], #state{verbosity = Verbosity0, mib_file = MIB} = State) -> process_args([MIB], State) -> case (catch file:read_file_info(MIB)) of {ok, #file_info{type = regular}} -> - process_args([], State#state{mib_file = MIB}); + process_args([], State#state{file = MIB}); {ok, #file_info{type = BadType}} -> e(lists:flatten(io_lib:format("~s not a file: ~w", [MIB, BadType]))); {error, enoent} -> @@ -268,7 +306,9 @@ usage(ReasonStr) -> usage(). usage() -> - io:format("Usage: snmpc [options] MIB.mib" + io:format("Usage: snmpc [options] MIB.mib|MIB.bin" + "~nCompile a MIB (.mib -> .bin) or generate an erlang header " + "~nfile from a compiled MIB file (.bin -> .hrl)" "~nOptions:" "~n --help - Prints this info." "~n --version - Prints compiler version." diff --git a/lib/snmp/src/compile/snmpc_mib_to_hrl.erl b/lib/snmp/src/compile/snmpc_mib_to_hrl.erl index 07bd29231b..decc1ce557 100644 --- a/lib/snmp/src/compile/snmpc_mib_to_hrl.erl +++ b/lib/snmp/src/compile/snmpc_mib_to_hrl.erl @@ -24,7 +24,8 @@ -include("snmpc_lib.hrl"). %% External exports --export([convert/1, compile/3]). +-export([convert/1, convert/3, compile/3]). + %%----------------------------------------------------------------- %% Func: convert/1 -- cgit v1.2.3 From fe1a4d17ee6558f466c49bfaea25c3a0b4ca9936 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 11:58:16 +0100 Subject: Initial fix of release notes (bad notes for version 4.18). --- lib/snmp/doc/src/notes.xml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 493e7aa092..015e2628f4 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -1,10 +1,10 @@ - +
- 19962010 + 19962011 Ericsson AB. All Rights Reserved. @@ -37,18 +37,14 @@
Fixed Bugs and Malfunctions -

- When the function FilterMod:accept_recv/2 returned false - the SNMP agent stopped collecting messages from UDP.

-

- Own Id: OTP-8761

+

Cosmetic prep for R14B (plain) release.

-
+
-
+
SNMP Development Toolkit 4.17.1

Version 4.17.1 supports code replacement in runtime from/to version 4.17, 4.16.2, 4.16.1, 4.16, 4.15, 4.14 and 4.13.5.

@@ -63,7 +59,8 @@

When the function FilterMod:accept_recv/2 - returned false the SNMP agent stopped collecting messages from UDP.

+ returned false the SNMP agent stopped collecting + messages from UDP.

Own Id: OTP-8761

-- cgit v1.2.3 From ae806f1663d47569876b3abc0998ee3387c7abd2 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 16:12:36 +0100 Subject: Updated release notes and the documentation. Also added entry in the appup file. --- lib/snmp/doc/src/notes.xml | 52 +++++++++++++++++- lib/snmp/doc/src/snmp_config.xml | 42 ++++----------- lib/snmp/doc/src/snmpa.xml | 37 ++++++++++++- lib/snmp/src/app/snmp.appup.src | 114 +++++++++++++++------------------------ 4 files changed, 139 insertions(+), 106 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 015e2628f4..3d76fdeaf6 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -32,6 +32,56 @@ notes.xml +
+ SNMP Development Toolkit 4.19 +

Version 4.19 supports code replacement in runtime from/to + version 4.18.

+ +
+ Improvements and new features + + + +

[agent] Added a "complete" set of (snmp) table and variable + print functions, for each mib handled by the SNMP (agent) + application. This will be usefull when debugging a running agent.

+

See + print_mib_info/0, + print_mib_tables/0 + and + print_mib_variables/0 + for more info.

+

Own Id: OTP-8977

+
+ +
+ +
+ +
+ Reported Fixed Bugs and Malfunctions +

-

+ +
+ +
+ Incompatibilities +

-

+
+
+ +
SNMP 4.18
Fixed Bugs and Malfunctions @@ -42,7 +92,7 @@
-
+
SNMP Development Toolkit 4.17.1 diff --git a/lib/snmp/doc/src/snmp_config.xml b/lib/snmp/doc/src/snmp_config.xml index 769b908adc..4e41cb5037 100644 --- a/lib/snmp/doc/src/snmp_config.xml +++ b/lib/snmp/doc/src/snmp_config.xml @@ -1,4 +1,4 @@ - + @@ -1004,36 +1004,16 @@ ok

Another usefull way to debug the agent is to pretty-print the content of - some of the (MIB-) tables handled directly by the agent. This can be done - for the following tables:

- - - -

-
- - - -

-
- - - -

-
- - - -

-
- - - -

-
- -
- + all the tables and/or variables handled directly by the agent. + This can be done by simply calling:

+

+

See + print_mib_info/0, + print_mib_tables/0 + or + print_mib_variables/0 + for more info.

+
diff --git a/lib/snmp/doc/src/snmpa.xml b/lib/snmp/doc/src/snmpa.xml index f546724a78..1d680e80f5 100644 --- a/lib/snmp/doc/src/snmpa.xml +++ b/lib/snmp/doc/src/snmpa.xml @@ -1,10 +1,10 @@ - +
- 20042010 + 20042011 Ericsson AB. All Rights Reserved. @@ -1252,6 +1252,39 @@ snmp_agent:register_subagent(SA1,[1,2,3], SA2).

This is a utility function, that can be useful when e.g. debugging instrumentation functions.

+ + + + + + print_mib_info() -> void() + Print mib info + +

Prints the content of all the (snmp) tables and variables + for all mibs handled by the snmp agent.

+ + +
+
+ + + print_mib_tables() -> void() + Print mib tables + +

Prints the content of all the (snmp) tables + for all mibs handled by the snmp agent.

+ + +
+
+ + + print_mib_variables() -> void() + Print mib variables + +

Prints the content of all the (snmp) variables + for all mibs handled by the snmp agent.

+
diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 2375e3df70..24f3b2e755 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,43 +22,28 @@ %% ----- U p g r a d e ------------------------------------------------------- [ - {"4.17.1", + {"4.18", [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} + {load_module, snmpa, soft_purge, soft_purge, + [snmp_community_mib, + snmp_framework_mib, + snmp_standard_mib, + snmp_target_mib, + snmp_user_based_sm_mib, + snmp_view_based_acm_mib]}, + {load_module, snmp_community_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmps_mib_lib, soft_purge, soft_purge, []} ] } ], @@ -66,43 +51,28 @@ %% ------D o w n g r a d e --------------------------------------------------- [ - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", + {"4.18", [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} + {load_module, snmpa, soft_purge, soft_purge, + [snmp_community_mib, + snmp_framework_mib, + snmp_standard_mib, + snmp_target_mib, + snmp_user_based_sm_mib, + snmp_view_based_acm_mib]}, + {load_module, snmp_community_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmps_mib_lib, soft_purge, soft_purge, []} ] } ] -- cgit v1.2.3 From 866edfa8a5510189ee7e0b1584edb5582ba7a589 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 17:46:50 +0100 Subject: Final update to release notes and the appup file. --- lib/snmp/doc/src/notes.xml | 12 +++++-- lib/snmp/src/app/snmp.appup.src | 78 ----------------------------------------- 2 files changed, 10 insertions(+), 80 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index e9c7bef68f..41825df276 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -1,4 +1,4 @@ - + @@ -35,7 +35,7 @@
SNMP Development Toolkit 4.19

Version 4.19 supports code replacement in runtime from/to - version 4.18, 4.17.1, 4.17.

+ version 4.18.

Improvements and new features @@ -67,8 +67,15 @@

-

+ +
+ Incompatibilities +

-

+
+
+
SNMP 4.18
Fixed Bugs and Malfunctions @@ -81,6 +88,7 @@
+
SNMP Development Toolkit 4.17.1

Version 4.17.1 supports code replacement in runtime from/to diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 9bb4846c6e..4f76095c04 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -25,45 +25,6 @@ {"4.18", [ ] - }, - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} - ] } ], @@ -73,45 +34,6 @@ {"4.18", [ ] - }, - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} - ] } ] }. -- cgit v1.2.3 From 205d55b2ee2afe70a9cbac6da15c8b985c76f2ab Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 17:55:21 +0100 Subject: Final update of appup filer (forgot about the read_mib macro used by the snmp_misc module). --- lib/snmp/src/app/snmp.appup.src | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/snmp') diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 4f76095c04..ea39a7c30a 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -24,6 +24,7 @@ [ {"4.18", [ + {load_module, snmp_misc, soft_purge, soft_purge, []} ] } ], @@ -33,6 +34,7 @@ [ {"4.18", [ + {load_module, snmp_misc, soft_purge, soft_purge, []} ] } ] -- cgit v1.2.3 From bb3fef253dc2e1253d7c422c1d9846d13135f847 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 21:00:48 +0100 Subject: Updated release notes and appup file. --- lib/snmp/doc/src/notes.xml | 4 +-- lib/snmp/src/app/snmp.appup.src | 80 +---------------------------------------- 2 files changed, 3 insertions(+), 81 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index c42d62f013..7010b3c641 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -4,7 +4,7 @@

- 19962010 + 19962011 Ericsson AB. All Rights Reserved. @@ -35,7 +35,7 @@
SNMP Development Toolkit 4.19

Version 4.19 supports code replacement in runtime from/to - version 4.18, 4.17.1 and 4.17.

+ version 4.18.

Improvements and new features diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 03a0044908..13a84d4ab1 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-2011. 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 @@ -26,45 +26,6 @@ [ {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []} ] - }, - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} - ] } ], @@ -75,45 +36,6 @@ [ {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []} ] - }, - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} - ] } ] }. -- cgit v1.2.3 From ca6e87e84dae13b6ebe15ca67bf98a0245f25857 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 23:07:52 +0100 Subject: Fixed release notes and appup file. --- lib/snmp/doc/src/notes.xml | 2 +- lib/snmp/src/app/snmp.appup.src | 78 ----------------------------------------- 2 files changed, 1 insertion(+), 79 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 39aff4e28a..4896a62bb4 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -35,7 +35,7 @@
SNMP Development Toolkit 4.19

Version 4.19 supports code replacement in runtime from/to - version 4.18, 4.17.1 and 4.17.

+ version 4.18.

Improvements and new features diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index fafbf79bb7..0c1d6655ef 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -27,45 +27,6 @@ {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmpa_vacm]} ] - }, - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} - ] } ], @@ -77,45 +38,6 @@ {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmpa_vacm]} ] - }, - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} - ] } ] }. -- cgit v1.2.3 From 9d435667a3450de2ad819d1fd9d75c5cf6e4c355 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 23:11:42 +0100 Subject: Fixed release notes and appup file. --- lib/snmp/doc/src/notes.xml | 2 +- lib/snmp/src/app/snmp.appup.src | 78 ----------------------------------------- 2 files changed, 1 insertion(+), 79 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index f84991aa79..b89f5c54e1 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -35,7 +35,7 @@
SNMP Development Toolkit 4.19

Version 4.19 supports code replacement in runtime from/to - version 4.18, 4.17.1 and 4.17.

+ version 4.18.

Improvements and new features diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 9bb4846c6e..4f76095c04 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -25,45 +25,6 @@ {"4.18", [ ] - }, - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} - ] } ], @@ -73,45 +34,6 @@ {"4.18", [ ] - }, - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} - ] } ] }. -- cgit v1.2.3 From cf8a23cd0017d2206926a4445736029a05a7a0dd Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 23:18:27 +0100 Subject: Fixed release notes (almost, since this change will not actually be part of the release notes) and appup file. --- lib/snmp/doc/src/notes.xml | 23 ++++++++----- lib/snmp/src/app/snmp.appup.src | 74 ++--------------------------------------- 2 files changed, 16 insertions(+), 81 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 493e7aa092..03881f1823 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -1,10 +1,10 @@ - +
- 19962010 + 19962011 Ericsson AB. All Rights Reserved. @@ -33,22 +33,27 @@
SNMP 4.18 +
+ Improvements and new features +

-

+
Fixed Bugs and Malfunctions -

- When the function FilterMod:accept_recv/2 returned false - the SNMP agent stopped collecting messages from UDP.

-

- Own Id: OTP-8761

+

Cosmetic prep for R14B (plain) release.

-
+
+ Incompatibilities +

-

+
+
+ -
+
SNMP Development Toolkit 4.17.1

Version 4.17.1 supports code replacement in runtime from/to version 4.17, 4.16.2, 4.16.1, 4.16, 4.15, 4.14 and 4.13.5.

diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 2375e3df70..4f76095c04 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,43 +22,8 @@ %% ----- U p g r a d e ------------------------------------------------------- [ - {"4.17.1", + {"4.18", [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} ] } ], @@ -66,43 +31,8 @@ %% ------D o w n g r a d e --------------------------------------------------- [ - {"4.17.1", - [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []} - ] - }, - {"4.17", + {"4.18", [ - {load_module, snmp_community_mib, soft_purge, soft_purge, []}, - {load_module, snmp_framework_mib, soft_purge, soft_purge, []}, - {load_module, snmp_generic, soft_purge, soft_purge, []}, - {load_module, snmp_notification_mib, soft_purge, soft_purge, []}, - {load_module, snmp_standard_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpa_conf, soft_purge, soft_purge, []}, - {update, snmpa_target_cache, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_usm, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmpm_conf, soft_purge, soft_purge, []}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {load_module, snmpm_usm, soft_purge, soft_purge, []}, - {load_module, snmpa_net_if, soft_purge, soft_purge, []} ] } ] -- cgit v1.2.3 From d9ca1a4e66bed40b4bf4ed7b9e734192d6f6d00a Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 23 Feb 2011 23:20:56 +0100 Subject: Wrong tag for note (snmpc instead of compiler)... --- lib/snmp/doc/src/notes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index b89f5c54e1..3af9f27e62 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -64,7 +64,7 @@ -

[snmpc] Added a MIB compiler escript, +

[compiler] Added a MIB compiler (frontend) escript, snmpc.

Own Id: OTP-9004

-- cgit v1.2.3 From f00e9a7a31e7b58f1ac9e8f6e36183a5173f7eab Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 1 Mar 2011 10:43:43 +0100 Subject: Fixed wrong link (to non-existing snmpc ref-manual). --- lib/snmp/doc/src/notes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/snmp') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 665c78f603..2efeb8ae3f 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -77,7 +77,7 @@

[compiler] Added a MIB compiler (frontend) escript, - snmpc.

+ snmpc.

Own Id: OTP-9004

-- cgit v1.2.3 From cf7f5f99f46708db185d927d0c7681fc4f6f3a0e Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 1 Mar 2011 18:00:33 +0100 Subject: Fixed an error detected by dialyzer: The second argument to the definitions_loop function should be the record dldata and not the atome false... --- lib/snmp/src/compile/snmpc.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/snmp') diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index c4b3d7090f..195c238184 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.erl @@ -894,12 +894,12 @@ definitions_loop([{#mc_object_type{name = NameOfEntry, definitions_loop([{#mc_notification{name = TrapName, status = deprecated}, Line}|T], - false) -> + #dldata{deprecated = false} = Data) -> ?vinfo2("defloop -> notification ~w is deprecated => ignored", [TrapName], Line), update_status(TrapName, deprecated), ensure_macro_imported('NOTIFICATION-TYPE', Line), - definitions_loop(T, false); + definitions_loop(T, Data); definitions_loop([{#mc_notification{name = TrapName, status = obsolete}, Line}|T], -- cgit v1.2.3