diff options
author | Micael Karlberg <[email protected]> | 2011-02-18 19:18:12 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-02-18 19:18:12 +0100 |
commit | d7c6e2781c64e5e75add8a89d1b553bd5e9283f1 (patch) | |
tree | 308101a1677baeb9c6f602aff72e10ca06f1e68b /lib/snmp/src | |
parent | 439262b1a593a98cba7ed25e9453bf026696ebcc (diff) | |
download | otp-d7c6e2781c64e5e75add8a89d1b553bd5e9283f1.tar.gz otp-d7c6e2781c64e5e75add8a89d1b553bd5e9283f1.tar.bz2 otp-d7c6e2781c64e5e75add8a89d1b553bd5e9283f1.zip |
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.
...
Diffstat (limited to 'lib/snmp/src')
-rw-r--r-- | lib/snmp/src/compile/snmpc.erl | 137 | ||||
-rw-r--r-- | lib/snmp/src/compile/snmpc.hrl | 4 | ||||
-rw-r--r-- | lib/snmp/src/compile/snmpc_mib_gram.yrl | 34 |
3 files changed, 131 insertions, 44 deletions
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) -> |