aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2010-12-08 16:05:42 +0100
committerMicael Karlberg <[email protected]>2010-12-08 16:05:42 +0100
commite67b8b37c5aabe83f8872fcf71e865591af5552b (patch)
tree24901a3c050d484eb41b32d344dd3364e9de6fe6 /lib/snmp/src
parent339e1f1a3189a5a16dd1ba8c2a7137ff671f839b (diff)
downloadotp-e67b8b37c5aabe83f8872fcf71e865591af5552b.tar.gz
otp-e67b8b37c5aabe83f8872fcf71e865591af5552b.tar.bz2
otp-e67b8b37c5aabe83f8872fcf71e865591af5552b.zip
Added preliminary veariable support.
Diffstat (limited to 'lib/snmp/src')
-rw-r--r--lib/snmp/src/agent/snmp_view_based_acm_mib.erl6
-rw-r--r--lib/snmp/src/agent/snmpa.erl103
2 files changed, 89 insertions, 20 deletions
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) ->