aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/compile/snmpc.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-02-18 19:18:12 +0100
committerMicael Karlberg <[email protected]>2011-02-18 19:18:12 +0100
commitd7c6e2781c64e5e75add8a89d1b553bd5e9283f1 (patch)
tree308101a1677baeb9c6f602aff72e10ca06f1e68b /lib/snmp/src/compile/snmpc.erl
parent439262b1a593a98cba7ed25e9453bf026696ebcc (diff)
downloadotp-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/compile/snmpc.erl')
-rw-r--r--lib/snmp/src/compile/snmpc.erl137
1 files changed, 104 insertions, 33 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,