diff options
-rw-r--r-- | lib/snmp/doc/src/notes.xml | 64 | ||||
-rw-r--r-- | lib/snmp/doc/src/snmpm.xml | 1 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm.erl | 622 | ||||
-rw-r--r-- | lib/snmp/test/snmp_manager_test.erl | 217 | ||||
-rw-r--r-- | lib/snmp/test/snmp_manager_user.erl | 318 | ||||
-rw-r--r-- | lib/snmp/test/snmp_manager_user_old.erl | 126 | ||||
-rw-r--r-- | lib/snmp/test/snmp_manager_user_test.erl | 2 | ||||
-rw-r--r-- | lib/snmp/test/snmp_test_lib.erl | 2 | ||||
-rw-r--r-- | lib/snmp/test/snmp_test_manager.erl | 8 | ||||
-rw-r--r-- | lib/snmp/vsn.mk | 2 | ||||
-rw-r--r-- | lib/stdlib/src/otp_internal.erl | 84 |
11 files changed, 393 insertions, 1053 deletions
diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 442837d57d..b6b8751f6c 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -126,6 +126,70 @@ <section> + <title>SNMP Development Toolkit 4.23</title> + <p>Version 4.23 supports code replacement in runtime from/to + version 4.22, + 4.21.7 4.21.6 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1 and 4.21. </p> + + <section> + <title>Improvements and new features</title> + <p>-</p> + +<!-- + <list type="bulleted"> + <item> + <p>[agent] Documenting previously existing but undocumented function, + <seealso marker="snmp_generic#get_table_info">snmp_generic:get_table_info/2</seealso>. </p> + <p>Own Id: OTP-9942</p> + </item> + + </list> +--> + + </section> + + <section> + <title>Fixed Bugs and Malfunctions</title> + <p>-</p> + + <!-- + <list type="bulleted"> + <item> + <p>[agent] Simultaneous + <seealso marker="snmpa#backup">snmpa:backup/1,2</seealso> + calls can interfere. + The master agent did not check if a backup was already in + progress when a backup request was accepted. </p> + <p>Own Id: OTP-9884</p> + <p>Aux Id: Seq 11995</p> + </item> + + </list> + --> + + </section> + + <section> + <title>Incompatibilities</title> +<!-- + <p>-</p> +--> + + <list type="bulleted"> + <item> + <p>[manager] The old Addr-and-Port based API functions, previously + long deprecated and marked for deletion in R16B, has now been + removed. </p> + <p>Own Id: OTP-10027</p> + </item> + + </list> + </section> + + </section> <!-- 4.23 --> + + + <section> <title>SNMP Development Toolkit 4.22</title> <p>Version 4.22 supports code replacement in runtime from/to version 4.21.7 4.21.6 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1 and 4.21. </p> diff --git a/lib/snmp/doc/src/snmpm.xml b/lib/snmp/doc/src/snmpm.xml index e6e188d5d5..07fdd208ff 100644 --- a/lib/snmp/doc/src/snmpm.xml +++ b/lib/snmp/doc/src/snmpm.xml @@ -279,7 +279,6 @@ sec_level = noAuthNoPriv | authNoPriv | authPriv <fsummary>Register this agent</fsummary> <type> <v>UserId = term()</v> - <v>Addr = ip_address()</v> <v>TargetName = target_name()</v> <v>Config = [agent_config()]</v> <v>agent_config() = {Item, Val}</v> diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl index f590892c66..6ac0115dad 100644 --- a/lib/snmp/src/manager/snmpm.erl +++ b/lib/snmp/src/manager/snmpm.erl @@ -107,63 +107,9 @@ async_get_bulk/5, async_get_bulk/6, async_get_bulk/7, async_get_bulk/8 ]). -%% Backward compatibility exports (API version "1") --deprecated({agent_info, 3}). --deprecated({update_agent_info, 5}). --deprecated({g, 3}). --deprecated({g, 4}). --deprecated({g, 5}). --deprecated({g, 6}). --deprecated({g, 7}). --deprecated({ag, 3}). --deprecated({ag, 4}). --deprecated({ag, 5}). --deprecated({ag, 6}). --deprecated({ag, 7}). --deprecated({gn, 3}). --deprecated({gn, 4}). --deprecated({gn, 5}). --deprecated({gn, 6}). --deprecated({gn, 7}). --deprecated({agn, 3}). --deprecated({agn, 4}). --deprecated({agn, 5}). --deprecated({agn, 6}). --deprecated({agn, 7}). --deprecated({gb, 5}). --deprecated({gb, 6}). --deprecated({gb, 7}). --deprecated({gb, 8}). --deprecated({gb, 9}). --deprecated({agb, 5}). --deprecated({agb, 6}). --deprecated({agb, 7}). --deprecated({agb, 8}). --deprecated({agb, 9}). --deprecated({s, 3}). --deprecated({s, 4}). --deprecated({s, 5}). --deprecated({s, 6}). --deprecated({s, 7}). --deprecated({as, 3}). --deprecated({as, 4}). --deprecated({as, 5}). --deprecated({as, 6}). --deprecated({as, 7}). --export([ - agent_info/3, update_agent_info/5, - g/3, g/4, g/5, g/6, g/7, - ag/3, ag/4, ag/5, ag/6, ag/7, - gn/3, gn/4, gn/5, gn/6, gn/7, - agn/3, agn/4, agn/5, agn/6, agn/7, - gb/5, gb/6, gb/7, gb/8, gb/9, - agb/5, agb/6, agb/7, agb/8, agb/9, - s/3, s/4, s/5, s/6, s/7, - as/3, as/4, as/5, as/6, as/7 - ]). - %% Application internal export -export([start_link/3, snmpm_start_verify/2, snmpm_start_verify/3]). +-export([target_name/1, target_name/2]). -include_lib("snmp/src/misc/snmp_debug.hrl"). @@ -439,32 +385,16 @@ unregister_agent(UserId, Addr, Port) -> Error end. + agent_info(TargetName, Item) -> snmpm_config:agent_info(TargetName, Item). -%% Backward compatibility -agent_info(Addr, Port, Item) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - agent_info(TargetName, Item); - Error -> - Error - end. - update_agent_info(UserId, TargetName, Info) when is_list(Info) -> snmpm_config:update_agent_info(UserId, TargetName, Info). update_agent_info(UserId, TargetName, Item, Val) -> update_agent_info(UserId, TargetName, [{Item, Val}]). -%% Backward compatibility functions -update_agent_info(UserId, Addr, Port, Item, Val) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - update_agent_info(UserId, TargetName, Item, Val); - Error -> - Error - end. which_agents() -> snmpm_config:which_agents(). @@ -552,55 +482,6 @@ sync_get(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -g(UserId, Addr, Oids) -> - g(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). - -g(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> - g(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - -g(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> - g(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -g(UserId, Addr, Oids, Timeout) - when is_list(Oids) andalso is_integer(Timeout) -> - g(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids, Timeout). - -g(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get(UserId, TargetName, CtxName, Oids); - Error -> - Error - end; - -g(UserId, Addr, Port, Oids, Timeout) - when is_integer(Port) andalso is_list(Oids) andalso is_integer(Timeout) -> - g(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Timeout); - -g(UserId, Addr, CtxName, Oids, Timeout) - when is_list(CtxName) andalso is_list(Oids) andalso is_integer(Timeout) -> - g(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Timeout). - -g(UserId, Addr, Port, CtxName, Oids, Timeout) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get(UserId, TargetName, CtxName, Oids, Timeout); - Error -> - Error - end. - -g(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - %% --- asynchroneous get-request --- %% @@ -637,55 +518,6 @@ async_get(UserId, TargetName, Context, Oids, Expire, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -ag(UserId, Addr, Oids) -> - ag(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). - -ag(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> - ag(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -ag(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> - ag(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - -ag(UserId, Addr, Oids, Expire) when is_list(Oids) andalso is_integer(Expire) -> - ag(UserId, Addr, ?DEFAULT_AGENT_PORT, ?DEFAULT_CONTEXT, Oids, Expire). - -ag(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids); - Error -> - Error - end; - -ag(UserId, Addr, Port, Oids, Expire) - when is_integer(Port) andalso is_list(Oids) andalso is_integer(Expire) -> - ag(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Expire); - -ag(UserId, Addr, CtxName, Oids, Expire) - when is_list(CtxName) andalso is_list(Oids) andalso is_integer(Expire) -> - ag(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Expire). - -ag(UserId, Addr, Port, CtxName, Oids, Expire) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids, Expire); - Error -> - Error - end. - -ag(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- synchroneous get_next-request --- %% @@ -719,55 +551,6 @@ sync_get_next(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -gn(UserId, Addr, Oids) -> - gn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). - -gn(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> - gn(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - -gn(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> - gn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -gn(UserId, Addr, Oids, Timeout) - when is_list(Oids) andalso is_integer(Timeout) -> - gn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids, Timeout). - -gn(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids); - Error -> - Error - end; - -gn(UserId, Addr, Port, Oids, Timeout) - when is_integer(Port) andalso is_list(Oids) andalso is_integer(Timeout) -> - gn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Timeout); -gn(UserId, Addr, CtxName, Oids, Timeout) - when is_list(CtxName) andalso is_list(Oids) andalso is_integer(Timeout) -> - gn(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Timeout). - -gn(UserId, Addr, Port, CtxName, Oids, Timeout) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids, Timeout); - Error -> - Error - end. - -gn(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- asynchroneous get_next-request --- %% @@ -801,56 +584,6 @@ async_get_next(UserId, TargetName, Context, Oids, Expire, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -agn(UserId, Addr, Oids) -> - agn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). - -agn(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> - agn(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - -agn(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> - agn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -agn(UserId, Addr, Oids, Expire) - when is_list(Oids) andalso is_integer(Expire) -> - agn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids, Expire). - -agn(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids); - Error -> - Error - end; - -agn(UserId, Addr, Port, Oids, Expire) - when is_integer(Port) andalso is_list(Oids) andalso is_integer(Expire) -> - agn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Expire); -agn(UserId, Addr, CtxName, Oids, Expire) - when is_list(CtxName) andalso is_list(CtxName) andalso is_integer(Expire) -> - agn(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Expire). - -agn(UserId, Addr, Port, CtxName, Oids, Expire) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids, Expire); - Error -> - Error - end. - -agn(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids, Expire, - ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- synchroneous set-request --- %% @@ -884,64 +617,6 @@ sync_set(UserId, TargetName, Context, VarsAndVals, Timeout, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -s(UserId, Addr, VarsAndVals) -> - s(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals). - -s(UserId, Addr, Port, VarsAndVals) - when is_integer(Port) andalso is_list(VarsAndVals) -> - s(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals); - -s(UserId, Addr, CtxName, VarsAndVals) - when is_list(CtxName) andalso is_list(VarsAndVals) -> - s(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, VarsAndVals); - -s(UserId, Addr, VarsAndVals, Timeout) - when is_list(VarsAndVals) andalso is_integer(Timeout) -> - s(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals, Timeout). - -s(UserId, Addr, Port, CtxName, VarsAndVals) - when is_integer(Port) andalso - is_list(CtxName) andalso - is_list(VarsAndVals) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_set(UserId, TargetName, CtxName, VarsAndVals); - Error -> - Error - end; - -s(UserId, Addr, Port, VarsAndVals, Timeout) - when is_integer(Port) andalso - is_list(VarsAndVals) andalso - is_integer(Timeout) -> - s(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals, Timeout); - -s(UserId, Addr, CtxName, VarsAndVals, Timeout) - when is_list(CtxName) andalso - is_list(VarsAndVals) andalso - is_integer(Timeout) -> - s(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, VarsAndVals, Timeout). - -s(UserId, Addr, Port, CtxName, VarsAndVals, Timeout) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout); - Error -> - Error - end. - -s(UserId, Addr, Port, CtxName, VarsAndVals, Timeout, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- asynchroneous set-request --- %% @@ -975,63 +650,6 @@ async_set(UserId, TargetName, Context, VarsAndVals, Expire, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -as(UserId, Addr, VarsAndVals) -> - as(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals). - -as(UserId, Addr, Port, VarsAndVals) - when is_integer(Port) andalso is_list(VarsAndVals) -> - as(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals); - -as(UserId, Addr, CtxName, VarsAndVals) - when is_list(CtxName) andalso is_list(VarsAndVals) -> - as(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, VarsAndVals); - -as(UserId, Addr, VarsAndVals, Expire) - when is_list(VarsAndVals) andalso is_integer(Expire) -> - as(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals, Expire). - -as(UserId, Addr, Port, CtxName, VarsAndVals) - when is_integer(Port) andalso - is_list(CtxName) andalso - is_list(VarsAndVals) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals); - Error -> - Error - end; - -as(UserId, Addr, Port, VarsAndVals, Expire) - when is_integer(Port) andalso - is_list(VarsAndVals) andalso - is_integer(Expire) -> - as(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals, Expire); - -as(UserId, Addr, CtxName, VarsAndVals, Expire) - when is_list(CtxName) andalso - is_list(VarsAndVals) andalso - is_integer(Expire) -> - as(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, VarsAndVals, Expire). - -as(UserId, Addr, Port, CtxName, VarsAndVals, Expire) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals, Expire); - Error -> - Error - end. - -as(UserId, Addr, Port, CtxName, VarsAndVals, Expire, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals, Expire, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - %% --- synchroneous get-bulk --- %% @@ -1091,162 +709,6 @@ sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Timeout, %% </BACKWARD-COMPAT> -%% <DEPRECATED> -gb(UserId, Addr, NonRep, MaxRep, Oids) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n Oids: ~p", - %% [UserId, Addr, NonRep, MaxRep, Oids]), - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids). - -gb(UserId, Addr, Port, NonRep, MaxRep, Oids) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n Oids: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, Oids]), - gb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids); - -gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p", - %% [UserId, Addr, NonRep, MaxRep, CtxName, Oids]), - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids); - -gb(UserId, Addr, NonRep, MaxRep, Oids, Timeout) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Timeout) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p", - %% [UserId, Addr, NonRep, MaxRep, Oids, Timeout]), - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids, Timeout). - -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids]), - case target_name(Addr, Port) of - {ok, TargetName} -> - %% p("gb -> TargetName: ~p", [TargetName]), - sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids); - Error -> - Error - end; - -gb(UserId, Addr, Port, NonRep, MaxRep, Oids, Timeout) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Timeout) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, Oids, Timeout]), - gb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Timeout); - -gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids, Timeout) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) andalso - is_integer(Timeout) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p", - %% [UserId, Addr, NonRep, MaxRep, CtxName, Oids, Timeout]), - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids, - Timeout). - -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout]), - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Timeout); - Error -> - Error - end. - -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p" - %% "~n ExtraInfo: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo]), - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- asynchroneous get-bulk --- %% @@ -1291,81 +753,6 @@ async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Expire, %% </BACKWARD-COMPAT> -%% <DEPRECATED> -agb(UserId, Addr, NonRep, MaxRep, Oids) -> - agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids). - -agb(UserId, Addr, Port, NonRep, MaxRep, Oids) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) -> - agb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids); - -agb(UserId, Addr, NonRep, MaxRep, CtxName, Oids) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) -> - agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids); - -agb(UserId, Addr, NonRep, MaxRep, Oids, Expire) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Expire) -> - agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids, Expire). - -agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep), - is_list(CtxName) andalso - is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids); - Error -> - Error - end; - -agb(UserId, Addr, Port, NonRep, MaxRep, Oids, Expire) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Expire) -> - agb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Expire); - -agb(UserId, Addr, NonRep, MaxRep, CtxName, Oids, Expire) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) andalso - is_integer(Expire) -> - agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids). - -agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Expire) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Expire); - Error -> - Error - end. - -agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Expire, - ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - cancel_async_request(UserId, ReqId) -> snmpm_server:cancel_async_request(UserId, ReqId). @@ -1457,7 +844,7 @@ sys_up_time() -> format_reason(Reason) -> format_reason("", Reason). -format_reason(Prefix, Reason) when is_integer(Prefix) and (Prefix >= 0) -> +format_reason(Prefix, Reason) when is_integer(Prefix) andalso (Prefix >= 0) -> format_reason(lists:duplicate(Prefix, $ ), Reason); format_reason(Prefix, Reason) when is_list(Prefix) -> case (catch do_format_reason(Prefix, Reason)) of @@ -1691,6 +1078,9 @@ format_vb_value(Prefix, _Type, Val) -> %% --- Internal utility functions --- %% +target_name(Addr) -> + target_name(Addr, ?DEFAULT_AGENT_PORT). + target_name(Addr, Port) -> snmpm_config:agent_info(Addr, Port, target_name). diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl index c374a2f0a6..dedbae5ce4 100644 --- a/lib/snmp/test/snmp_manager_test.erl +++ b/lib/snmp/test/snmp_manager_test.erl @@ -174,7 +174,26 @@ end_per_suite(Config) when is_list(Config) -> init_per_testcase(Case, Config) when is_list(Config) -> io:format(user, "~n~n*** INIT ~w:~w ***~n~n", [?MODULE,Case]), - init_per_testcase2(Case, Config). + %% This version of the API, based on Addr and Port, has been deprecated + DeprecatedApiCases = + [ + simple_sync_get1, + simple_async_get1, + simple_sync_get_next1, + simple_async_get_next1, + simple_sync_set1, + simple_async_set1, + simple_sync_get_bulk1, + simple_async_get_bulk1, + misc_async1 + ], + case lists:member(Case, DeprecatedApiCases) of + true -> + %% ?SKIP(api_no_longer_supported); + {skip, api_no_longer_supported}; + false -> + init_per_testcase2(Case, Config) + end. init_per_testcase2(Case, Config) -> ?DBG("init_per_testcase2 -> ~p", [erlang:nodes()]), @@ -226,18 +245,6 @@ init_per_testcase2(Case, Config) -> Conf2. init_per_testcase3(Case, Config) -> - ApiCases01 = - [ - simple_sync_get1, - simple_async_get1, - simple_sync_get_next1, - simple_async_get_next1, - simple_sync_set1, - simple_async_set1, - simple_sync_get_bulk1, - simple_async_get_bulk1, - misc_async1 - ], ApiCases02 = [ simple_sync_get2, @@ -273,7 +280,6 @@ init_per_testcase3(Case, Config) -> inform_swarm, report ] ++ - ApiCases01 ++ ApiCases02 ++ ApiCases03, case lists:member(Case, Cases) of @@ -319,18 +325,6 @@ end_per_testcase(Case, Config) when is_list(Config) -> Conf2. end_per_testcase2(Case, Config) -> - ApiCases01 = - [ - simple_sync_get1, - simple_async_get1, - simple_sync_get_next1, - simple_async_get_next1, - simple_sync_set1, - simple_async_set1, - simple_sync_get_bulk1, - simple_async_get_bulk1, - misc_async1 - ], ApiCases02 = [ simple_sync_get2, @@ -366,7 +360,6 @@ end_per_testcase2(Case, Config) -> inform_swarm, report ] ++ - ApiCases01 ++ ApiCases02 ++ ApiCases03, case lists:member(Case, Cases) of @@ -1596,12 +1589,14 @@ register_agent3(Config) when is_list(Config) -> simple_sync_get1(doc) -> ["Simple sync get-request - Old style (Addr & Port)"]; simple_sync_get1(suite) -> []; simple_sync_get1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, ssg1), p("starting with Config: ~p~n", [Config]), Node = ?config(manager_node, Config), - Addr = ?config(ip, Config), + Addr = ?config(manager_agent_target_name, Config), Port = ?AGENT_PORT, p("issue get-request without loading the mib"), @@ -1757,6 +1752,8 @@ simple_async_get1(doc) -> ["Simple (async) get-request - Old style (Addr & Port)"]; simple_async_get1(suite) -> []; simple_async_get1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, sag1), p("starting with Config: ~p~n", [Config]), @@ -1972,6 +1969,8 @@ simple_sync_get_next1(doc) -> ["Simple (sync) get_next-request - " "Old style (Addr & Port)"]; simple_sync_get_next1(suite) -> []; simple_sync_get_next1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, ssgn1), p("starting with Config: ~p~n", [Config]), @@ -2264,6 +2263,8 @@ simple_async_get_next1(doc) -> ["Simple (async) get_next-request - " "Old style (Addr & Port)"]; simple_async_get_next1(suite) -> []; simple_async_get_next1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, ssgn1), p("starting with Config: ~p~n", [Config]), @@ -2516,6 +2517,8 @@ simple_sync_set1(doc) -> ["Simple (sync) set-request - " "Old style (Addr & Port)"]; simple_sync_set1(suite) -> []; simple_sync_set1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, sss1), p("starting with Config: ~p~n", [Config]), @@ -2686,6 +2689,8 @@ simple_async_set1(doc) -> ["Simple (async) set-request - " "Old style (Addr & Port)"]; simple_async_set1(suite) -> []; simple_async_set1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, sas1), p("starting with Config: ~p~n", [Config]), @@ -2896,6 +2901,8 @@ simple_sync_get_bulk1(doc) -> ["Simple (sync) get_bulk-request - " "Old style (Addr & Port)"]; simple_sync_get_bulk1(suite) -> []; simple_sync_get_bulk1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, ssgb1), p("starting with Config: ~p~n", [Config]), @@ -3261,6 +3268,8 @@ simple_async_get_bulk1(doc) -> ["Simple (async) get_bulk-request - " "Old style (Addr & Port)"]; simple_async_get_bulk1(suite) -> []; simple_async_get_bulk1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, sagb1), p("starting with Config: ~p~n", [Config]), @@ -3605,6 +3614,8 @@ misc_async1(doc) -> ["Misc (async) request(s) - " "Old style (Addr & Port)"]; misc_async1(suite) -> []; misc_async1(Config) when is_list(Config) -> + ?SKIP(api_no_longer_supported), + process_flag(trap_exit, true), put(tname, ms1), p("starting with Config: ~p~n", [Config]), @@ -5591,29 +5602,35 @@ fin_mgr_user(Conf) -> init_mgr_user_data1(Conf) -> Node = ?config(manager_node, Conf), - Addr = ?config(ip, Conf), - Port = ?AGENT_PORT, - ?line ok = mgr_user_register_agent(Node, Addr, Port), + TargetName = ?config(manager_agent_target_name, Conf), + Addr = ?config(ip, Conf), + Port = ?AGENT_PORT, + ?line ok = mgr_user_register_agent(Node, TargetName, + [{address, Addr}, + {port, Port}, + {engine_id, "agentEngine"}]), Agents = mgr_user_which_own_agents(Node), ?DBG("Own agents: ~p", [Agents]), - ?line {ok, DefAgentConf} = mgr_user_agent_info(Node, Addr, Port, all), + ?line {ok, DefAgentConf} = mgr_user_agent_info(Node, TargetName, all), ?DBG("Default agent config: ~n~p", [DefAgentConf]), - ?line ok = mgr_user_update_agent_info(Node, Addr, Port, + ?line ok = mgr_user_update_agent_info(Node, TargetName, community, "all-rights"), - ?line ok = mgr_user_update_agent_info(Node, Addr, Port, + ?line ok = mgr_user_update_agent_info(Node, TargetName, sec_name, "all-rights"), - ?line ok = mgr_user_update_agent_info(Node, Addr, Port, + ?line ok = mgr_user_update_agent_info(Node, TargetName, engine_id, "agentEngine"), - ?line ok = mgr_user_update_agent_info(Node, Addr, Port, + ?line ok = mgr_user_update_agent_info(Node, TargetName, max_message_size, 1024), - ?line {ok, AgentConf} = mgr_user_agent_info(Node, Addr, Port, all), + ?line {ok, AgentConf} = mgr_user_agent_info(Node, TargetName, all), ?DBG("Updated agent config: ~n~p", [AgentConf]), Conf. init_mgr_user_data2(Conf) -> + ?DBG("init_mgr_user_data2 -> entry with" + "~n Conf: ~p", [Conf]), Node = ?config(manager_node, Conf), TargetName = ?config(manager_agent_target_name, Conf), Addr = ?config(ip, Conf), @@ -5641,9 +5658,8 @@ init_mgr_user_data2(Conf) -> fin_mgr_user_data1(Conf) -> Node = ?config(manager_node, Conf), - Addr = ?config(ip, Conf), - Port = ?AGENT_PORT, - mgr_user_unregister_agent(Node, Addr, Port), + TargetName = ?config(manager_agent_target_name, Conf), + mgr_user_unregister_agent(Node, TargetName), mgr_user_which_own_agents(Node), Conf. @@ -5670,33 +5686,41 @@ mgr_user_stop(Node) -> %% mgr_user_register_agent(Node, Addr, ?AGENT_PORT, []). mgr_user_register_agent(Node, TargetName, Conf) when is_list(TargetName) andalso is_list(Conf) -> - rcall(Node, snmp_manager_user, register_agent, [TargetName, Conf]); -mgr_user_register_agent(Node, Addr, Port) -> - mgr_user_register_agent(Node, Addr, Port, []). -mgr_user_register_agent(Node, Addr, Port, Conf) -> - rcall(Node, snmp_manager_user, register_agent, [Addr, Port, Conf]). + rcall(Node, snmp_manager_user, register_agent, [TargetName, Conf]). +%% <REMOVED-IN-R16B> +%% mgr_user_register_agent(Node, Addr, Port) -> +%% mgr_user_register_agent(Node, Addr, Port, []). +%% mgr_user_register_agent(Node, Addr, Port, Conf) -> +%% rcall(Node, snmp_manager_user, register_agent, [Addr, Port, Conf]). +%% </REMOVED-IN-R16B> %% mgr_user_unregister_agent(Node) -> %% mgr_user_unregister_agent(Node, ?LOCALHOST(), ?AGENT_PORT). -mgr_user_unregister_agent(Node, Addr_or_TargetName) -> - rcall(Node, snmp_manager_user, unregister_agent, [Addr_or_TargetName]). -mgr_user_unregister_agent(Node, Addr, Port) -> - rcall(Node, snmp_manager_user, unregister_agent, [Addr, Port]). - -mgr_user_agent_info(Node, Addr_or_TargetName, Item) when is_atom(Item) -> - rcall(Node, snmp_manager_user, agent_info, [Addr_or_TargetName, Item]). -mgr_user_agent_info(Node, Addr, Port, Item) when is_atom(Item) -> - rcall(Node, snmp_manager_user, agent_info, [Addr, Port, Item]). +mgr_user_unregister_agent(Node, TargetName) when is_list(TargetName) -> + rcall(Node, snmp_manager_user, unregister_agent, [TargetName]). +%% <REMOVED-IN-R16B> +%% mgr_user_unregister_agent(Node, Addr, Port) -> +%% rcall(Node, snmp_manager_user, unregister_agent, [Addr, Port]). +%% </REMOVED-IN-R16B> + +mgr_user_agent_info(Node, TargetName, Item) + when is_list(TargetName) andalso is_atom(Item) -> + rcall(Node, snmp_manager_user, agent_info, [TargetName, Item]). +%% <REMOVED-IN-R16B> +%% mgr_user_agent_info(Node, Addr, Port, Item) when is_atom(Item) -> +%% rcall(Node, snmp_manager_user, agent_info, [Addr, Port, Item]). +%% </REMOVED-IN-R16B> %% mgr_user_update_agent_info(Node, Item, Val) when atom(Item) -> %% mgr_user_update_agent_info(Node, ?LOCALHOST(), ?AGENT_PORT, Item, Val). -mgr_user_update_agent_info(Node, Addr_or_TargetName, Item, Val) - when is_atom(Item) -> - rcall(Node, snmp_manager_user, update_agent_info, - [Addr_or_TargetName, Item, Val]). -mgr_user_update_agent_info(Node, Addr, Port, Item, Val) when is_atom(Item) -> - rcall(Node, snmp_manager_user, update_agent_info, - [Addr, Port, Item, Val]). +mgr_user_update_agent_info(Node, TargetName, Item, Val) + when is_list(TargetName) andalso is_atom(Item) -> + rcall(Node, snmp_manager_user, update_agent_info, [TargetName, Item, Val]). +%% <REMOVED-IN-R16B> +%% mgr_user_update_agent_info(Node, Addr, Port, Item, Val) when is_atom(Item) -> +%% rcall(Node, snmp_manager_user, update_agent_info, +%% [Addr, Port, Item, Val]). +%% </REMOVED-IN-R16B> %% mgr_user_which_all_agents(Node) -> %% rcall(Node, snmp_manager_user, which_all_agents, []). @@ -5709,89 +5733,112 @@ mgr_user_load_mib(Node, Mib) -> %% mgr_user_sync_get(Node, Oids) -> %% mgr_user_sync_get(Node, ?LOCALHOST(), ?AGENT_PORT, Oids). -mgr_user_sync_get(Node, Addr_or_TargetName, Oids) -> - rcall(Node, snmp_manager_user, sync_get, [Addr_or_TargetName, Oids]). +mgr_user_sync_get(Node, TargetName, Oids) when is_list(TargetName) -> + rcall(Node, snmp_manager_user, sync_get, [TargetName, Oids]). +%% <REMOVED-IN-R16B> mgr_user_sync_get(Node, Addr, Port, Oids) -> rcall(Node, snmp_manager_user, sync_get, [Addr, Port, Oids]). +%% </REMOVED-IN-R16B> -mgr_user_sync_get2(Node, TargetName, Oids, SendOpts) -> +mgr_user_sync_get2(Node, TargetName, Oids, SendOpts) when is_list(TargetName) -> rcall(Node, snmp_manager_user, sync_get2, [TargetName, Oids, SendOpts]). %% mgr_user_async_get(Node, Oids) -> %% mgr_user_async_get(Node, ?LOCALHOST(), ?AGENT_PORT, Oids). -mgr_user_async_get(Node, Addr_or_TargetName, Oids) -> - rcall(Node, snmp_manager_user, async_get, [Addr_or_TargetName, Oids]). +mgr_user_async_get(Node, TargetName, Oids) when is_list(TargetName) -> + rcall(Node, snmp_manager_user, async_get, [TargetName, Oids]). +%% <REMOVED-IN-R16B> mgr_user_async_get(Node, Addr, Port, Oids) -> rcall(Node, snmp_manager_user, async_get, [Addr, Port, Oids]). +%% </REMOVED-IN-R16B> -mgr_user_async_get2(Node, TargetName, Oids, SendOpts) -> +mgr_user_async_get2(Node, TargetName, Oids, SendOpts) + when is_list(TargetName) -> rcall(Node, snmp_manager_user, async_get2, [TargetName, Oids, SendOpts]). %% mgr_user_sync_get_next(Node, Oids) -> %% mgr_user_sync_get_next(Node, ?LOCALHOST(), ?AGENT_PORT, Oids). -mgr_user_sync_get_next(Node, Addr_or_TargetName, Oids) -> - rcall(Node, snmp_manager_user, sync_get_next, [Addr_or_TargetName, Oids]). +mgr_user_sync_get_next(Node, TargetName, Oids) when is_list(TargetName) -> + rcall(Node, snmp_manager_user, sync_get_next, [TargetName, Oids]). +%% <REMOVED-IN-R16B> mgr_user_sync_get_next(Node, Addr, Port, Oids) -> rcall(Node, snmp_manager_user, sync_get_next, [Addr, Port, Oids]). +%% </REMOVED-IN-R16B> -mgr_user_sync_get_next2(Node, TargetName, Oids, SendOpts) -> +mgr_user_sync_get_next2(Node, TargetName, Oids, SendOpts) + when is_list(TargetName) -> rcall(Node, snmp_manager_user, sync_get_next2, [TargetName, Oids, SendOpts]). %% mgr_user_async_get_next(Node, Oids) -> %% mgr_user_async_get_next(Node, ?LOCALHOST(), ?AGENT_PORT, Oids). -mgr_user_async_get_next(Node, Addr_or_TargetName, Oids) -> - rcall(Node, snmp_manager_user, async_get_next, [Addr_or_TargetName, Oids]). +mgr_user_async_get_next(Node, TargetName, Oids) when is_list(TargetName) -> + rcall(Node, snmp_manager_user, async_get_next, [TargetName, Oids]). +%% <REMOVED-IN-R16B> mgr_user_async_get_next(Node, Addr, Port, Oids) -> rcall(Node, snmp_manager_user, async_get_next, [Addr, Port, Oids]). +%% </REMOVED-IN-R16B> -mgr_user_async_get_next2(Node, TargetName, Oids, SendOpts) -> +mgr_user_async_get_next2(Node, TargetName, Oids, SendOpts) + when is_list(TargetName) -> rcall(Node, snmp_manager_user, async_get_next2, [TargetName, Oids, SendOpts]). %% mgr_user_sync_set(Node, VAV) -> %% mgr_user_sync_set(Node, ?LOCALHOST(), ?AGENT_PORT, VAV). -mgr_user_sync_set(Node, Addr_or_TargetName, VAV) -> - rcall(Node, snmp_manager_user, sync_set, [Addr_or_TargetName, VAV]). +mgr_user_sync_set(Node, TargetName, VAV) when is_list(TargetName) -> + rcall(Node, snmp_manager_user, sync_set, [TargetName, VAV]). +%% <REMOVED-IN-R16B> mgr_user_sync_set(Node, Addr, Port, VAV) -> rcall(Node, snmp_manager_user, sync_set, [Addr, Port, VAV]). +%% </REMOVED-IN-R16B> -mgr_user_sync_set2(Node, TargetName, VAV, SendOpts) -> +mgr_user_sync_set2(Node, TargetName, VAV, SendOpts) when is_list(TargetName) -> rcall(Node, snmp_manager_user, sync_set2, [TargetName, VAV, SendOpts]). %% mgr_user_async_set(Node, VAV) -> %% mgr_user_async_set(Node, ?LOCALHOST(), ?AGENT_PORT, VAV). -mgr_user_async_set(Node, Addr_or_TargetName, VAV) -> - rcall(Node, snmp_manager_user, async_set, [Addr_or_TargetName, VAV]). +mgr_user_async_set(Node, TargetName, VAV) when is_list(TargetName) -> + rcall(Node, snmp_manager_user, async_set, [TargetName, VAV]). +%% <REMOVED-IN-R16B> mgr_user_async_set(Node, Addr, Port, VAV) -> rcall(Node, snmp_manager_user, async_set, [Addr, Port, VAV]). +%% </REMOVED-IN-R16B> -mgr_user_async_set2(Node, TargetName, VAV, SendOpts) -> +mgr_user_async_set2(Node, TargetName, VAV, SendOpts) when is_list(TargetName) -> rcall(Node, snmp_manager_user, async_set2, [TargetName, VAV, SendOpts]). %% mgr_user_sync_get_bulk(Node, NonRep, MaxRep, Oids) -> %% mgr_user_sync_get_bulk(Node, ?LOCALHOST(), ?AGENT_PORT, %% NonRep, MaxRep, Oids). -mgr_user_sync_get_bulk(Node, Addr_or_TargetName, NonRep, MaxRep, Oids) -> +mgr_user_sync_get_bulk(Node, TargetName, NonRep, MaxRep, Oids) + when is_list(TargetName) -> rcall(Node, snmp_manager_user, sync_get_bulk, - [Addr_or_TargetName, NonRep, MaxRep, Oids]). + [TargetName, NonRep, MaxRep, Oids]). +%% <REMOVED-IN-R16B> mgr_user_sync_get_bulk(Node, Addr, Port, NonRep, MaxRep, Oids) -> rcall(Node, snmp_manager_user, sync_get_bulk, [Addr, Port, NonRep, MaxRep, Oids]). +%% </REMOVED-IN-R16B> -mgr_user_sync_get_bulk2(Node, TargetName, NonRep, MaxRep, Oids, SendOpts) -> +mgr_user_sync_get_bulk2(Node, TargetName, NonRep, MaxRep, Oids, SendOpts) + when is_list(TargetName) -> rcall(Node, snmp_manager_user, sync_get_bulk2, [TargetName, NonRep, MaxRep, Oids, SendOpts]). %% mgr_user_async_get_bulk(Node, NonRep, MaxRep, Oids) -> %% mgr_user_async_get_bulk(Node, ?LOCALHOST(), ?AGENT_PORT, %% NonRep, MaxRep, Oids). -mgr_user_async_get_bulk(Node, Addr_or_TargetName, NonRep, MaxRep, Oids) -> +mgr_user_async_get_bulk(Node, TargetName, NonRep, MaxRep, Oids) + when is_list(TargetName) -> rcall(Node, snmp_manager_user, async_get_bulk, - [Addr_or_TargetName, NonRep, MaxRep, Oids]). + [TargetName, NonRep, MaxRep, Oids]). +%% <REMOVED-IN-R16B> mgr_user_async_get_bulk(Node, Addr, Port, NonRep, MaxRep, Oids) -> rcall(Node, snmp_manager_user, async_get_bulk, [Addr, Port, NonRep, MaxRep, Oids]). +%% </REMOVED-IN-R16B> -mgr_user_async_get_bulk2(Node, TargetName, NonRep, MaxRep, Oids, SendOpts) -> +mgr_user_async_get_bulk2(Node, TargetName, NonRep, MaxRep, Oids, SendOpts) + when is_list(TargetName) -> rcall(Node, snmp_manager_user, async_get_bulk2, [TargetName, NonRep, MaxRep, Oids, SendOpts]). diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index 1b62b04960..4e789bbaec 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2011. All Rights Reserved. +%% Copyright Ericsson AB 2005-2012. 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 @@ -44,20 +44,20 @@ info/0, system_info/0, simulate_crash/1, - register_agent/2, register_agent/3, - unregister_agent/1, unregister_agent/2, - agent_info/2, agent_info/3, - update_agent_info/3, update_agent_info/4, + register_agent/2, + unregister_agent/1, + agent_info/2, + update_agent_info/3, which_all_agents/0, which_own_agents/0, load_mib/1, unload_mib/1, - sync_get/1, sync_get/2, sync_get/3, sync_get2/3, - async_get/1, async_get/2, async_get/3, async_get2/3, - sync_get_next/1, sync_get_next/2, sync_get_next/3, sync_get_next2/3, - async_get_next/1, async_get_next/2, async_get_next/3, async_get_next2/3, - sync_set/1, sync_set/2, sync_set/3, sync_set2/3, - async_set/1, async_set/2, async_set/3, async_set2/3, - sync_get_bulk/3, sync_get_bulk/4, sync_get_bulk/5, sync_get_bulk2/5, - async_get_bulk/3, async_get_bulk/4, async_get_bulk/5, async_get_bulk2/5, + sync_get/1, sync_get/2, sync_get2/3, + async_get/1, async_get/2, async_get2/3, + sync_get_next/1, sync_get_next/2, sync_get_next2/3, + async_get_next/1, async_get_next/2, async_get_next2/3, + sync_set/1, sync_set/2, sync_set2/3, + async_set/1, async_set/2, async_set2/3, + sync_get_bulk/3, sync_get_bulk/4, sync_get_bulk2/5, + async_get_bulk/3, async_get_bulk/4, async_get_bulk2/5, name_to_oid/1, oid_to_name/1, purify_oid/1 ]). @@ -73,15 +73,11 @@ -export([ handle_error/3, - handle_agent/4, + handle_agent/5, handle_pdu/4, handle_trap/3, handle_inform/3, - handle_report/3, - handle_pdu/5, % For backwards compatibillity - handle_trap/4, % For backwards compatibillity - handle_inform/4, % For backwards compatibillity - handle_report/4 % For backwards compatibillity + handle_report/3 ]). @@ -126,27 +122,16 @@ simulate_crash(Reason) -> register_agent(TargetName, Config) when is_list(TargetName) andalso is_list(Config) -> - call({register_agent, TargetName, Config}); -register_agent(Addr, Port) -> - register_agent(Addr, Port, []). - -register_agent(Addr, Port, Conf) -> - call({register_agent, Addr, Port, Conf}). + call({register_agent, TargetName, Config}). unregister_agent(TargetName) -> call({unregister_agent, TargetName}). -unregister_agent(Addr, Port) -> - call({unregister_agent, Addr, Port}). agent_info(TargetName, Item) -> call({agent_info, TargetName, Item}). -agent_info(Addr, Port, Item) -> - call({agent_info, Addr, Port, Item}). update_agent_info(TargetName, Item, Val) -> call({update_agent_info, TargetName, Item, Val}). -update_agent_info(Addr, Port, Item, Val) -> - call({update_agent_info, Addr, Port, Item, Val}). which_all_agents() -> call(which_all_agents). @@ -165,11 +150,8 @@ unload_mib(Mib) -> sync_get(Oids) -> call({sync_get, Oids}). -sync_get(Addr_or_TargetName, Oids) -> - call({sync_get, Addr_or_TargetName, Oids}). - -sync_get(Addr, Port, Oids) -> - call({sync_get, Addr, Port, Oids}). +sync_get(TargetName, Oids) -> + call({sync_get, TargetName, Oids}). sync_get2(TargetName, Oids, SendOpts) -> call({sync_get2, TargetName, Oids, SendOpts}). @@ -180,11 +162,8 @@ sync_get2(TargetName, Oids, SendOpts) -> async_get(Oids) -> call({async_get, Oids}). -async_get(Addr_or_TargetName, Oids) -> - call({async_get, Addr_or_TargetName, Oids}). - -async_get(Addr, Port, Oids) -> - call({async_get, Addr, Port, Oids}). +async_get(TargetName, Oids) -> + call({async_get, TargetName, Oids}). async_get2(TargetName, Oids, SendOpts) -> call({async_get2, TargetName, Oids, SendOpts}). @@ -194,11 +173,8 @@ async_get2(TargetName, Oids, SendOpts) -> sync_get_next(Oids) -> call({sync_get_next, Oids}). -sync_get_next(Addr_or_TargetName, Oids) -> - call({sync_get_next, Addr_or_TargetName, Oids}). - -sync_get_next(Addr, Port, Oids) -> - call({sync_get_next, Addr, Port, Oids}). +sync_get_next(TargetName, Oids) -> + call({sync_get_next, TargetName, Oids}). sync_get_next2(TargetName, Oids, SendOpts) -> call({sync_get_next2, TargetName, Oids, SendOpts}). @@ -208,11 +184,8 @@ sync_get_next2(TargetName, Oids, SendOpts) -> async_get_next(Oids) -> call({async_get_next, Oids}). -async_get_next(Addr_or_TargetName, Oids) -> - call({async_get_next, Addr_or_TargetName, Oids}). - -async_get_next(Addr, Port, Oids) -> - call({async_get_next, Addr, Port, Oids}). +async_get_next(TargetName, Oids) -> + call({async_get_next, TargetName, Oids}). async_get_next2(TargetName, Oids, SendOpts) -> call({async_get_next2, TargetName, Oids, SendOpts}). @@ -222,11 +195,8 @@ async_get_next2(TargetName, Oids, SendOpts) -> sync_set(VAV) -> call({sync_set, VAV}). -sync_set(Addr_or_TargetName, VAV) -> - call({sync_set, Addr_or_TargetName, VAV}). - -sync_set(Addr, Port, VAV) -> - call({sync_set, Addr, Port, VAV}). +sync_set(TargetName, VAV) -> + call({sync_set, TargetName, VAV}). sync_set2(TargetName, VAV, SendOpts) -> call({sync_set2, TargetName, VAV, SendOpts}). @@ -236,11 +206,8 @@ sync_set2(TargetName, VAV, SendOpts) -> async_set(VAV) -> call({async_set, VAV}). -async_set(Addr_or_TargetName, VAV) -> - call({async_set, Addr_or_TargetName, VAV}). - -async_set(Addr, Port, VAV) -> - call({async_set, Addr, Port, VAV}). +async_set(TargetName, VAV) -> + call({async_set, TargetName, VAV}). async_set2(TargetName, VAV, SendOpts) -> call({async_set2, TargetName, VAV, SendOpts}). @@ -250,11 +217,8 @@ async_set2(TargetName, VAV, SendOpts) -> sync_get_bulk(NonRep, MaxRep, Oids) -> call({sync_get_bulk, NonRep, MaxRep, Oids}). -sync_get_bulk(Addr_or_TargetName, NonRep, MaxRep, Oids) -> - call({sync_get_bulk, Addr_or_TargetName, NonRep, MaxRep, Oids}). - -sync_get_bulk(Addr, Port, NonRep, MaxRep, Oids) -> - call({sync_get_bulk, Addr, Port, NonRep, MaxRep, Oids}). +sync_get_bulk(TargetName, NonRep, MaxRep, Oids) -> + call({sync_get_bulk, TargetName, NonRep, MaxRep, Oids}). sync_get_bulk2(TargetName, NonRep, MaxRep, Oids, SendOpts) -> call({sync_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}). @@ -264,11 +228,8 @@ sync_get_bulk2(TargetName, NonRep, MaxRep, Oids, SendOpts) -> async_get_bulk(NonRep, MaxRep, Oids) -> call({async_get_bulk, NonRep, MaxRep, Oids}). -async_get_bulk(Addr_or_TargetName, NonRep, MaxRep, Oids) -> - call({async_get_bulk, Addr_or_TargetName, NonRep, MaxRep, Oids}). - -async_get_bulk(Addr, Port, NonRep, MaxRep, Oids) -> - call({async_get_bulk, Addr, Port, NonRep, MaxRep, Oids}). +async_get_bulk(TargetName, NonRep, MaxRep, Oids) -> + call({async_get_bulk, TargetName, NonRep, MaxRep, Oids}). async_get_bulk2(TargetName, NonRep, MaxRep, Oids, SendOpts) -> call({async_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}). @@ -340,24 +301,12 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{register_agent, Addr, Port, Conf}, From, Ref} -> - d("loop -> received register_agent request"), - Res = snmpm:register_agent(Id, Addr, Port, Conf), - reply(From, Res, Ref), - loop(S); - {{unregister_agent, TargetName}, From, Ref} -> d("loop -> received unregister_agent request"), Res = snmpm:unregister_agent(Id, TargetName), reply(From, Res, Ref), loop(S); - {{unregister_agent, Addr, Port}, From, Ref} -> - d("loop -> received unregister_agent request"), - Res = snmpm:unregister_agent(Id, Addr, Port), - reply(From, Res, Ref), - loop(S); - {{agent_info, TargetName, Item}, From, Ref} -> d("loop -> received agent_info request with" "~n TargetName: ~p" @@ -368,15 +317,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{agent_info, Addr, Port, Item}, From, Ref} -> - d("loop -> received agent_info request with" - "~n Addr: ~p" - "~n Port: ~p" - "~n Item: ~p", [Addr, Port, Item]), - Res = snmpm:agent_info(Addr, Port, Item), - reply(From, Res, Ref), - loop(S); - {{update_agent_info, TargetName, Item, Val}, From, Ref} -> d("loop -> received update_agent_info request with" "~n TargetName: ~p" @@ -386,16 +326,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{update_agent_info, Addr, Port, Item, Val}, From, Ref} -> - d("loop -> received update_agent_info request with" - "~n Addr: ~p" - "~n Port: ~p" - "~n Item: ~p" - "~n Val: ~p", [Addr, Port, Item, Val]), - Res = snmpm:update_agent_info(Id, Addr, Port, Item, Val), - reply(From, Res, Ref), - loop(S); - {which_all_agents, From, Ref} -> d("loop -> received which_all_agents request"), Res = snmpm:which_agents(), @@ -452,23 +382,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{sync_get, Addr, Oids}, From, Ref} -> - d("loop -> received sync_get request with" - "~n Addr: ~p" - "~n Oids: ~p", [Addr, Oids]), - Res = snmpm:g(Id, Addr, Oids), - reply(From, Res, Ref), - loop(S); - - {{sync_get, Addr, Port, Oids}, From, Ref} -> - d("loop -> received sync_get request with" - "~n Addr: ~p" - "~n Port: ~p" - "~n Oids: ~p", [Addr, Port, Oids]), - Res = snmpm:g(Id, Addr, Port, Oids), - reply(From, Res, Ref), - loop(S); - %% %% -- (async) get-request -- @@ -500,18 +413,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{async_get, Addr, Oids}, From, Ref} -> - d("loop -> received async_get request"), - Res = snmpm:ag(Id, Addr, Oids), - reply(From, Res, Ref), - loop(S); - - {{async_get, Addr, Port, Oids}, From, Ref} -> - d("loop -> received async_get request"), - Res = snmpm:ag(Id, Addr, Port, Oids), - reply(From, Res, Ref), - loop(S); - %% %% -- (sync) get_next-request -- @@ -543,18 +444,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{sync_get_next, Addr, Oids}, From, Ref} -> - d("loop -> received sync_get_next request"), - Res = snmpm:gn(Id, Addr, Oids), - reply(From, Res, Ref), - loop(S); - - {{sync_get_next, Addr, Port, Oids}, From, Ref} -> - d("loop -> received sync_get_next request"), - Res = snmpm:gn(Id, Addr, Port, Oids), - reply(From, Res, Ref), - loop(S); - %% %% -- (async) get_next-request -- @@ -586,18 +475,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{async_get_next, Addr, Oids}, From, Ref} -> - d("loop -> received async_get_next request"), - Res = snmpm:agn(Id, Addr, Oids), - reply(From, Res, Ref), - loop(S); - - {{async_get_next, Addr, Port, Oids}, From, Ref} -> - d("loop -> received async_get_next request"), - Res = snmpm:agn(Id, Addr, Port, Oids), - reply(From, Res, Ref), - loop(S); - %% %% -- (sync) set-request -- @@ -626,18 +503,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{sync_set, Addr, VAV}, From, Ref} -> - d("loop -> received sync_set request"), - Res = snmpm:s(Id, Addr, VAV), - reply(From, Res, Ref), - loop(S); - - {{sync_set, Addr, Port, VAV}, From, Ref} -> - d("loop -> received sync_set request"), - Res = snmpm:s(Id, Addr, Port, VAV), - reply(From, Res, Ref), - loop(S); - %% %% -- (async) set-request -- @@ -666,18 +531,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{async_set, Addr, VAV}, From, Ref} -> - d("loop -> received async_set request"), - Res = snmpm:as(Id, Addr, VAV), - reply(From, Res, Ref), - loop(S); - - {{async_set, Addr, Port, VAV}, From, Ref} -> - d("loop -> received async_set request"), - Res = snmpm:as(Id, Addr, Port, VAV), - reply(From, Res, Ref), - loop(S); - %% %% -- (sync) get-bulk-request -- @@ -718,27 +571,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{sync_get_bulk, Addr, NonRep, MaxRep, Oids}, From, Ref} -> - d("loop -> received sync_get_bulk request with" - "~n Addr: ~p" - "~n NonRep: ~w" - "~n MaxRep: ~w" - "~n Oids: ~p", [Addr, NonRep, MaxRep, Oids]), - Res = snmpm:gb(Id, Addr, NonRep, MaxRep, Oids), - reply(From, Res, Ref), - loop(S); - - {{sync_get_bulk, Addr, Port, NonRep, MaxRep, Oids}, From, Ref} -> - d("loop -> received sync_get_bulk request with" - "~n Addr: ~p" - "~n Port: ~w" - "~n NonRep: ~w" - "~n MaxRep: ~w" - "~n Oids: ~p", [Addr, Port, NonRep, MaxRep, Oids]), - Res = snmpm:gb(Id, Addr, Port, NonRep, MaxRep, Oids), - reply(From, Res, Ref), - loop(S); - %% %% -- (async) get-bulk-request -- @@ -779,27 +611,6 @@ loop(#state{parent = Parent, id = Id} = S) -> reply(From, Res, Ref), loop(S); - {{async_get_bulk, Addr, NonRep, MaxRep, Oids}, From, Ref} -> - d("loop -> received async_get_bulk request with" - "~n Addr: ~p" - "~n NonRep: ~w" - "~n MaxRep: ~w" - "~n Oids: ~p", [Addr, NonRep, MaxRep, Oids]), - Res = snmpm:agb(Id, Addr, NonRep, MaxRep, Oids), - reply(From, Res, Ref), - loop(S); - - {{async_get_bulk, Addr, Port, NonRep, MaxRep, Oids}, From, Ref} -> - d("loop -> received async_get_bulk request with" - "~n Addr: ~p" - "~n Port: ~w" - "~n NonRep: ~w" - "~n MaxRep: ~w" - "~n Oids: ~p", [Addr, Port, NonRep, MaxRep, Oids]), - Res = snmpm:agb(Id, Addr, Port, NonRep, MaxRep, Oids), - reply(From, Res, Ref), - loop(S); - %% %% -- logical name translation -- @@ -846,12 +657,6 @@ loop(#state{parent = Parent, id = Id} = S) -> Parent ! {async_event, ReqId, {pdu, SnmpResponse}}, loop(S); - %% For backwards compatibillity - {handle_pdu, _Pid, _Addr, _Port, ReqId, SnmpResponse} -> - d("loop -> received pdu callback from manager for ~w", [ReqId]), - Parent ! {async_event, ReqId, {pdu, SnmpResponse}}, - loop(S); - {handle_trap, _Pid, TargetName, SnmpTrap} -> d("loop -> received trap callback from manager for " "~n ~p", @@ -860,15 +665,6 @@ loop(#state{parent = Parent, id = Id} = S) -> Parent ! {async_event, TargetName, {trap, SnmpTrap}}, loop(S); - %% For backwards compatibillity - {handle_trap, _Pid, Addr, Port, SnmpTrap} -> - d("loop -> received trap callback from manager for " - "~n ~p:~w", - "~n ~p", - [Addr, Port, SnmpTrap]), - Parent ! {async_event, {Addr, Port}, {trap, SnmpTrap}}, - loop(S); - {handle_inform, Pid, TargetName, SnmpInform} -> d("loop -> received inform callback from manager for " "~n ~p", @@ -877,15 +673,6 @@ loop(#state{parent = Parent, id = Id} = S) -> Parent ! {async_event, TargetName, {inform, Pid, SnmpInform}}, loop(S); - %% For backwards compatibillity - {handle_inform, Pid, Addr, Port, SnmpInform} -> - d("loop -> received inform callback from manager for " - "~n ~p:~w", - "~n ~p", - [Addr, Port, SnmpInform]), - Parent ! {async_event, {Addr, Port}, {inform, Pid, SnmpInform}}, - loop(S); - {handle_report, _Pid, TargetName, SnmpReport} -> d("loop -> received report callback from manager for " "~n ~p", @@ -894,15 +681,6 @@ loop(#state{parent = Parent, id = Id} = S) -> Parent ! {async_event, TargetName, {report, SnmpReport}}, loop(S); - %% For backwards compatibillity - {handle_report, _Pid, Addr, Port, SnmpReport} -> - d("loop -> received report callback from manager for " - "~n ~p:~w", - "~n ~p", - [Addr, Port, SnmpReport]), - Parent ! {async_event, {Addr, Port}, {report, SnmpReport}}, - loop(S); - {'EXIT', Parent, Reason} -> d("received exit signal from parent: ~n~p", [Reason]), info("received exit signal from parent: ~n~p", [Reason]), @@ -981,8 +759,8 @@ handle_error(ReqId, Reason, UserPid) -> ignore. -handle_agent(Addr, Port, SnmpInfo, UserPid) -> - UserPid ! {handle_agent, self(), Addr, Port, SnmpInfo}, +handle_agent(Addr, Port, SnmpInfo, UserPid, UserData) -> + UserPid ! {handle_agent, self(), Addr, Port, SnmpInfo, UserData}, ignore. @@ -990,22 +768,10 @@ handle_pdu(TargetName, ReqId, SnmpResponse, UserPid) -> UserPid ! {handle_pdu, self(), TargetName, ReqId, SnmpResponse}, ignore. -%% For backwards compatibillity -handle_pdu(Addr, Port, ReqId, SnmpResponse, UserPid) -> - UserPid ! {handle_pdu, self(), Addr, Port, ReqId, SnmpResponse}, - ignore. - - handle_trap(TargetName, SnmpTrap, UserPid) -> UserPid ! {handle_trap, self(), TargetName, SnmpTrap}, ok. -%% For backwards compatibillity -handle_trap(Addr, Port, SnmpTrap, UserPid) -> - UserPid ! {handle_trap, self(), Addr, Port, SnmpTrap}, - ok. - - handle_inform(TargetName, SnmpInform, UserPid) -> UserPid ! {handle_inform, self(), TargetName, SnmpInform}, receive @@ -1015,26 +781,10 @@ handle_inform(TargetName, SnmpInform, UserPid) -> ok end. -%% For backwards compatibillity -handle_inform(Addr, Port, SnmpInform, UserPid) -> - UserPid ! {handle_inform, self(), Addr, Port, SnmpInform}, - receive - {handle_inform_no_response, {Addr, Port}} -> - no_reply; - {handle_inform_response, {Addr, Port}} -> - ok - end. - - handle_report(TargetName, SnmpReport, UserPid) -> UserPid ! {handle_report, self(), TargetName, SnmpReport}, ok. -%% For backwards compatibillity -handle_report(Addr, Port, SnmpReport, UserPid) -> - UserPid ! {handle_report, self(), Addr, Port, SnmpReport}, - ok. - %%---------------------------------------------------------------------- %% Debug diff --git a/lib/snmp/test/snmp_manager_user_old.erl b/lib/snmp/test/snmp_manager_user_old.erl index 6280cef51f..9f951bf64d 100644 --- a/lib/snmp/test/snmp_manager_user_old.erl +++ b/lib/snmp/test/snmp_manager_user_old.erl @@ -107,10 +107,20 @@ unregister_agent(Addr, Port) -> snmpm:unregister_agent(?USER_ID, Addr, Port). agent_info(Addr, Port, Item) -> - snmpm:agent_info(?USER_ID, Addr, Port, Item). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:agent_info(TargetName, Item); + Error -> + Error + end. update_agent_info(Addr, Port, Item, Val) -> - snmpm:update_agent_info(?USER_ID, Addr, Port, Item, Val). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:update_agent_info(?USER_ID, TargetName, Item, Val); + Error -> + Error + end. which_agents() -> snmpm:which_agents(). @@ -128,73 +138,153 @@ unload_mib(Mib) -> %% -- sync_get(Addr, Oids) -> - snmpm:g(?USER_ID, Addr, Oids). + case snmpm:target_name(Addr) of + {ok, TargetName} -> + snmpm:sync_get2(?USER_ID, TargetName, Oids); + Error -> + Error + end. sync_get(Addr, Port, Oids) -> - snmpm:g(?USER_ID, Addr, Port, Oids). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:sync_get2(?USER_ID, TargetName, Oids); + Error -> + Error + end. %% -- async_get(Addr, Oids) -> - snmpm:ag(?USER_ID, Addr, Oids). + case snmpm:target_name(Addr) of + {ok, TargetName} -> + snmpm:async_get2(?USER_ID, TargetName, Oids); + Error -> + Error + end. async_get(Addr, Port, Oids) -> - snmpm:ag(?USER_ID, Addr, Port, Oids). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:async_get2(?USER_ID, TargetName, Oids); + Error -> + Error + end. %% -- sync_get_next(Addr, Oids) -> - snmpm:gn(?USER_ID, Addr, Oids). + case snmpm:target_name(Addr) of + {ok, TargetName} -> + snmpm:sync_get_next2(?USER_ID, TargetName, Oids); + Error -> + Error + end. sync_get_next(Addr, Port, Oids) -> - snmpm:gn(?USER_ID, Addr, Port, Oids). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:sync_get_next2(?USER_ID, TargetName, Oids); + Error -> + Error + end. %% -- async_get_next(Addr, Oids) -> - snmpm:agn(?USER_ID, Addr, Oids). + case snmpm:target_name(Addr) of + {ok, TargetName} -> + snmpm:async_get_next2(?USER_ID, TargetName, Oids); + Error -> + Error + end. async_get_next(Addr, Port, Oids) -> - snmpm:agn(?USER_ID, Addr, Port, Oids). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:async_get_next2(?USER_ID, TargetName, Oids); + Error -> + Error + end. %% -- sync_set(Addr, VAV) -> - snmpm:s(?USER_ID, Addr, VAV). + case snmpm:target_name(Addr) of + {ok, TargetName} -> + snmpm:sync_set2(?USER_ID, TargetName, VAV); + Error -> + Error + end. sync_set(Addr, Port, VAV) -> - snmpm:s(?USER_ID, Addr, Port, VAV). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:sync_set2(?USER_ID, TargetName, VAV); + Error -> + Error + end. %% -- async_set(Addr, VAV) -> - snmpm:as(?USER_ID, Addr, VAV). + case snmpm:target_name(Addr) of + {ok, TargetName} -> + snmpm:async_set2(?USER_ID, TargetName, VAV); + Error -> + Error + end. async_set(Addr, Port, VAV) -> - snmpm:as(?USER_ID, Addr, Port, VAV). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:async_set2(?USER_ID, TargetName, VAV); + Error -> + Error + end. %% -- sync_get_bulk(Addr, NonRep, MaxRep, Oids) -> - snmpm:gb(?USER_ID, Addr, NonRep, MaxRep, Oids). + case snmpm:target_name(Addr) of + {ok, TargetName} -> + snmpm:sync_get_bulk2(?USER_ID, TargetName, NonRep, MaxRep, Oids); + Error -> + Error + end. sync_get_bulk(Addr, Port, NonRep, MaxRep, Oids) -> - snmpm:gb(?USER_ID, Addr, Port, NonRep, MaxRep, Oids). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:sync_get_bulk2(?USER_ID, TargetName, NonRep, MaxRep, Oids); + Error -> + Error + end. %% -- async_get_bulk(Addr, NonRep, MaxRep, Oids) -> - snmpm:agb(?USER_ID, Addr, NonRep, MaxRep, Oids). + case snmpm:target_name(Addr) of + {ok, TargetName} -> + snmpm:async_get_bulk2(?USER_ID, TargetName, NonRep, MaxRep, Oids); + Error -> + Error + end. async_get_bulk(Addr, Port, NonRep, MaxRep, Oids) -> - snmpm:agb(?USER_ID, Addr, Port, NonRep, MaxRep, Oids). + case snmpm:target_name(Addr, Port) of + {ok, TargetName} -> + snmpm:async_get_bulk2(?USER_ID, TargetName, NonRep, MaxRep, Oids); + Error -> + Error + end. %% -- diff --git a/lib/snmp/test/snmp_manager_user_test.erl b/lib/snmp/test/snmp_manager_user_test.erl index fefa1ad713..41d5c50b19 100644 --- a/lib/snmp/test/snmp_manager_user_test.erl +++ b/lib/snmp/test/snmp_manager_user_test.erl @@ -36,7 +36,7 @@ %% -compile(export_all). -export([ -all/0,groups/0,init_per_group/2,end_per_group/2, + all/0,groups/0,init_per_group/2,end_per_group/2, init_per_testcase/2, end_per_testcase/2, diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl index e327456bc4..f0abae73e8 100644 --- a/lib/snmp/test/snmp_test_lib.erl +++ b/lib/snmp/test/snmp_test_lib.erl @@ -324,7 +324,7 @@ fail(Reason, Mod, Line) -> skip(Reason, Module, Line) -> String = lists:flatten(io_lib:format("Skipping ~p(~p): ~p~n", [Module, Line, Reason])), - exit({skipped, String}). + exit({skip, String}). %% ---------------------------------------------------------------- diff --git a/lib/snmp/test/snmp_test_manager.erl b/lib/snmp/test/snmp_test_manager.erl index 4cc6d36acc..0df2350d58 100644 --- a/lib/snmp/test/snmp_test_manager.erl +++ b/lib/snmp/test/snmp_test_manager.erl @@ -43,7 +43,7 @@ %% Manager callback API: -export([ handle_error/3, - handle_agent/4, + handle_agent/5, handle_pdu/4, handle_trap/3, handle_inform/3, @@ -239,7 +239,7 @@ handle_info({snmp_error, ReqId, Reason}, P ! {snmp_error, ReqId, Reason}, {noreply, State}; -handle_info({snmp_agent, Addr, Port, Info, Pid}, +handle_info({snmp_agent, Addr, Port, Info, Pid, _UserData}, #state{parent = P} = State) -> error_msg("detected new agent: " "~n Addr: ~w" @@ -326,8 +326,8 @@ handle_error(ReqId, Reason, Pid) -> ignore. -handle_agent(Addr, Port, SnmpInfo, Pid) -> - Pid ! {snmp_agent, Addr, Port, SnmpInfo, self()}, +handle_agent(Addr, Port, SnmpInfo, Pid, UserData) -> + Pid ! {snmp_agent, Addr, Port, SnmpInfo, self(), UserData}, receive {snmp_agent_reply, Reply, Pid} -> Reply diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index b90dbe4eef..8145e415f3 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -18,6 +18,6 @@ # %CopyrightEnd% APPLICATION = snmp -SNMP_VSN = 4.22.1 +SNMP_VSN = 4.23 PRE_VSN = APP_VSN = "$(APPLICATION)-$(SNMP_VSN)$(PRE_VSN)" diff --git a/lib/stdlib/src/otp_internal.erl b/lib/stdlib/src/otp_internal.erl index cddf345c76..88985ea1d0 100644 --- a/lib/stdlib/src/otp_internal.erl +++ b/lib/stdlib/src/otp_internal.erl @@ -78,89 +78,89 @@ obsolete_1(snmp, N, A) -> end; obsolete_1(snmpm, agent_info, 3) -> - {deprecated, {snmpm, agent_info, 2}, "R16B"}; + {removed, {snmpm, agent_info, 2}, "R16B"}; obsolete_1(snmpm, update_agent_info, 5) -> - {deprecated, {snmpm, update_agent_info, 4}, "R16B"}; + {removed, {snmpm, update_agent_info, 4}, "R16B"}; obsolete_1(snmpm, g, 3) -> - {deprecated, {snmpm, sync_get, 3}, "R16B"}; + {removed, {snmpm, sync_get, 3}, "R16B"}; obsolete_1(snmpm, g, 4) -> - {deprecated, {snmpm, sync_get, [3,4]}, "R16B"}; + {removed, {snmpm, sync_get, [3,4]}, "R16B"}; obsolete_1(snmpm, g, 5) -> - {deprecated, {snmpm, sync_get, [4,5]}, "R16B"}; + {removed, {snmpm, sync_get, [4,5]}, "R16B"}; obsolete_1(snmpm, g, 6) -> - {deprecated, {snmpm, sync_get, [5,6]}, "R16B"}; + {removed, {snmpm, sync_get, [5,6]}, "R16B"}; obsolete_1(snmpm, g, 7) -> - {deprecated, {snmpm, sync_get, 6}, "R16B"}; + {removed, {snmpm, sync_get, 6}, "R16B"}; obsolete_1(snmpm, ag, 3) -> - {deprecated, {snmpm, async_get, 3}, "R16B"}; + {removed, {snmpm, async_get, 3}, "R16B"}; obsolete_1(snmpm, ag, 4) -> - {deprecated, {snmpm, async_get, [3,4]}, "R16B"}; + {removed, {snmpm, async_get, [3,4]}, "R16B"}; obsolete_1(snmpm, ag, 5) -> - {deprecated, {snmpm, async_get, [4,5]}, "R16B"}; + {removed, {snmpm, async_get, [4,5]}, "R16B"}; obsolete_1(snmpm, ag, 6) -> - {deprecated, {snmpm, async_get, [5,6]}, "R16B"}; + {removed, {snmpm, async_get, [5,6]}, "R16B"}; obsolete_1(snmpm, ag, 7) -> - {deprecated, {snmpm, async_get, 6}, "R16B"}; + {removed, {snmpm, async_get, 6}, "R16B"}; obsolete_1(snmpm, gn, 3) -> - {deprecated, {snmpm, sync_get_next, 3}, "R16B"}; + {removed, {snmpm, sync_get_next, 3}, "R16B"}; obsolete_1(snmpm, gn, 4) -> - {deprecated, {snmpm, sync_get_next, [3,4]}, "R16B"}; + {removed, {snmpm, sync_get_next, [3,4]}, "R16B"}; obsolete_1(snmpm, gn, 5) -> - {deprecated, {snmpm, sync_get_next, [4,5]}, "R16B"}; + {removed, {snmpm, sync_get_next, [4,5]}, "R16B"}; obsolete_1(snmpm, gn, 6) -> - {deprecated, {snmpm, sync_get_next, [5,6]}, "R16B"}; + {removed, {snmpm, sync_get_next, [5,6]}, "R16B"}; obsolete_1(snmpm, gn, 7) -> - {deprecated, {snmpm, sync_get_next, 6}, "R16B"}; + {removed, {snmpm, sync_get_next, 6}, "R16B"}; obsolete_1(snmpm, agn, 3) -> - {deprecated, {snmpm, async_get_next, 3}, "R16B"}; + {removed, {snmpm, async_get_next, 3}, "R16B"}; obsolete_1(snmpm, agn, 4) -> - {deprecated, {snmpm, async_get_next, [3,4]}, "R16B"}; + {removed, {snmpm, async_get_next, [3,4]}, "R16B"}; obsolete_1(snmpm, agn, 5) -> - {deprecated, {snmpm, async_get_next, [4,5]}, "R16B"}; + {removed, {snmpm, async_get_next, [4,5]}, "R16B"}; obsolete_1(snmpm, agn, 6) -> - {deprecated, {snmpm, async_get_next, [5,6]}, "R16B"}; + {removed, {snmpm, async_get_next, [5,6]}, "R16B"}; obsolete_1(snmpm, agn, 7) -> - {deprecated, {snmpm, async_get_next, 6}, "R16B"}; + {removed, {snmpm, async_get_next, 6}, "R16B"}; obsolete_1(snmpm, s, 3) -> - {deprecated, {snmpm, sync_set, 3}, "R16B"}; + {removed, {snmpm, sync_set, 3}, "R16B"}; obsolete_1(snmpm, s, 4) -> - {deprecated, {snmpm, sync_set, [3,4]}, "R16B"}; + {removed, {snmpm, sync_set, [3,4]}, "R16B"}; obsolete_1(snmpm, s, 5) -> - {deprecated, {snmpm, sync_set, [4,5]}, "R16B"}; + {removed, {snmpm, sync_set, [4,5]}, "R16B"}; obsolete_1(snmpm, s, 6) -> - {deprecated, {snmpm, sync_set, [5,6]}, "R16B"}; + {removed, {snmpm, sync_set, [5,6]}, "R16B"}; obsolete_1(snmpm, s, 7) -> - {deprecated, {snmpm, sync_set, 6}, "R16B"}; + {removed, {snmpm, sync_set, 6}, "R16B"}; obsolete_1(snmpm, as, 3) -> - {deprecated, {snmpm, async_set, 3}, "R16B"}; + {removed, {snmpm, async_set, 3}, "R16B"}; obsolete_1(snmpm, as, 4) -> - {deprecated, {snmpm, async_set, [3,4]}, "R16B"}; + {removed, {snmpm, async_set, [3,4]}, "R16B"}; obsolete_1(snmpm, as, 5) -> - {deprecated, {snmpm, async_set, [4,5]}, "R16B"}; + {removed, {snmpm, async_set, [4,5]}, "R16B"}; obsolete_1(snmpm, as, 6) -> - {deprecated, {snmpm, async_set, [5,6]}, "R16B"}; + {removed, {snmpm, async_set, [5,6]}, "R16B"}; obsolete_1(snmpm, as, 7) -> - {deprecated, {snmpm, async_set, 6}, "R16B"}; + {removed, {snmpm, async_set, 6}, "R16B"}; obsolete_1(snmpm, gb, 5) -> - {deprecated, {snmpm, sync_get_bulk, 5}, "R16B"}; + {removed, {snmpm, sync_get_bulk, 5}, "R16B"}; obsolete_1(snmpm, gb, 6) -> - {deprecated, {snmpm, sync_get_bulk, [5,6]}, "R16B"}; + {removed, {snmpm, sync_get_bulk, [5,6]}, "R16B"}; obsolete_1(snmpm, gb, 7) -> - {deprecated, {snmpm, sync_get_bulk, [6,7]}, "R16B"}; + {removed, {snmpm, sync_get_bulk, [6,7]}, "R16B"}; obsolete_1(snmpm, gb, 8) -> - {deprecated, {snmpm, sync_get_bulk, [7,8]}, "R16B"}; + {removed, {snmpm, sync_get_bulk, [7,8]}, "R16B"}; obsolete_1(snmpm, gb, 9) -> - {deprecated, {snmpm, sync_get_bulk, 8}, "R16B"}; + {removed, {snmpm, sync_get_bulk, 8}, "R16B"}; obsolete_1(snmpm, agb, 5) -> - {deprecated, {snmpm, async_get_bulk, 5}, "R16B"}; + {removed, {snmpm, async_get_bulk, 5}, "R16B"}; obsolete_1(snmpm, agb, 6) -> - {deprecated, {snmpm, async_get_bulk, [5,6]}, "R16B"}; + {removed, {snmpm, async_get_bulk, [5,6]}, "R16B"}; obsolete_1(snmpm, agb, 7) -> - {deprecated, {snmpm, async_get_bulk, [6,7]}, "R16B"}; + {removed, {snmpm, async_get_bulk, [6,7]}, "R16B"}; obsolete_1(snmpm, agb, 8) -> - {deprecated, {snmpm, async_get_bulk, [7,8]}, "R16B"}; + {removed, {snmpm, async_get_bulk, [7,8]}, "R16B"}; obsolete_1(snmpm, agb, 9) -> - {deprecated, {snmpm, async_get_bulk, 8}, "R16B"}; + {removed, {snmpm, async_get_bulk, 8}, "R16B"}; %% *** MEGACO *** |