diff options
Diffstat (limited to 'lib/snmp')
-rw-r--r-- | lib/snmp/doc/src/notes.xml | 6 | ||||
-rw-r--r-- | lib/snmp/src/agent/snmpa_usm.erl | 17 | ||||
-rw-r--r-- | lib/snmp/src/app/snmp.appup.src | 8 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm_usm.erl | 5 | ||||
-rw-r--r-- | lib/snmp/test/snmp_agent_test.erl | 161 |
5 files changed, 144 insertions, 53 deletions
diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index ae00c42a7c..c507965cd8 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -81,6 +81,12 @@ <p>Own Id: OTP-9174</p> </item> + <item> + <p>Added type specs for functions that do not return. </p> + <p>Kostis Sagonas</p> + <p>Own Id: OTP-9208</p> + </item> + </list> </section> diff --git a/lib/snmp/src/agent/snmpa_usm.erl b/lib/snmp/src/agent/snmpa_usm.erl index f35d1f1916..6f54307f9f 100644 --- a/lib/snmp/src/agent/snmpa_usm.erl +++ b/lib/snmp/src/agent/snmpa_usm.erl @@ -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 @@ -330,7 +330,6 @@ non_authoritative(SecName, end end. - is_auth(?usmNoAuthProtocol, _, _, _, SecName, _, _, _, _) -> % 3.2.5 error(usmStatsUnsupportedSecLevels, ?usmStatsUnsupportedSecLevels_instance, SecName); % OTP-5464 @@ -613,8 +612,7 @@ authenticate_outgoing(Message, UsmSecParams, end, ?vtrace("authenticate_outgoing -> encode message only",[]), snmp_pdus:enc_message_only(Message2). - - + %%----------------------------------------------------------------- %% Auth and priv algorithms @@ -753,14 +751,19 @@ set_engine_latest_time(SnmpEngineID, EngineTime) -> %%----------------------------------------------------------------- %% Utility functions %%----------------------------------------------------------------- +-spec error(term()) -> no_return(). error(Reason) -> throw({error, Reason}). +-spec error(term(), term()) -> no_return(). error(Reason, ErrorInfo) -> throw({error, Reason, ErrorInfo}). +-spec error(term(), term(), term()) -> no_return(). error(Variable, Oid, SecName) -> error(Variable, Oid, SecName, []). + +-spec error(term(), term(), term(), [term()]) -> no_return(). error(Variable, Oid, SecName, Opts) -> Val = inc(Variable), ErrorInfo = {#varbind{oid = Oid, @@ -772,7 +775,6 @@ error(Variable, Oid, SecName, Opts) -> inc(Name) -> ets:update_counter(snmp_agent_table, Name, 1). - get_counter(Name) -> case (catch ets:lookup(snmp_agent_table, Name)) of [{_, Val}] -> @@ -780,8 +782,3 @@ get_counter(Name) -> _ -> 0 end. - - - - - diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 1efb888730..4c2de0fcf4 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -25,6 +25,8 @@ {"4.19", [ {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {load_module, snmpa_usm, soft_purge, soft_purge, []}, + {load_module, snmpm_usm, soft_purge, soft_purge, []}, {load_module, snmp_conf, soft_purge, soft_purge, []}, {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_conf]}, {load_module, snmp_misc, soft_purge, soft_purge, []}, @@ -51,6 +53,8 @@ {"4.18", [ {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {load_module, snmpa_usm, soft_purge, soft_purge, []}, + {load_module, snmpm_usm, soft_purge, soft_purge, []}, {load_module, snmp_misc, soft_purge, soft_purge, []}, {load_module, snmp_conf, soft_purge, soft_purge, []}, {load_module, snmp_config, soft_purge, soft_purge, [snmp_conf]}, @@ -101,6 +105,8 @@ {"4.19", [ {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {load_module, snmpa_usm, soft_purge, soft_purge, []}, + {load_module, snmpm_usm, soft_purge, soft_purge, []}, {load_module, snmp_conf, soft_purge, soft_purge, []}, {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_conf]}, {load_module, snmp_misc, soft_purge, soft_purge, []}, @@ -129,6 +135,8 @@ {"4.18", [ {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {load_module, snmpa_usm, soft_purge, soft_purge, []}, + {load_module, snmpm_usm, soft_purge, soft_purge, []}, {load_module, snmp_misc, soft_purge, soft_purge, []}, {load_module, snmp_conf, soft_purge, soft_purge, []}, {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_conf]}, diff --git a/lib/snmp/src/manager/snmpm_usm.erl b/lib/snmp/src/manager/snmpm_usm.erl index 449127844a..ef2070a90e 100644 --- a/lib/snmp/src/manager/snmpm_usm.erl +++ b/lib/snmp/src/manager/snmpm_usm.erl @@ -476,14 +476,19 @@ set_engine_latest_time(SnmpEngineID, EngineTime) -> %%----------------------------------------------------------------- %% Utility functions %%----------------------------------------------------------------- +-spec error(term()) -> no_return(). error(Reason) -> throw({error, Reason}). +-spec error(term(), term()) -> no_return(). error(Reason, ErrorInfo) -> throw({error, Reason, ErrorInfo}). +-spec error(term(), term(), term()) -> no_return(). error(Variable, Oid, SecName) -> error(Variable, Oid, SecName, []). + +-spec error(term(), term(), term(), [term()]) -> no_return(). error(Variable, Oid, SecName, Opts) -> Val = inc(Variable), ErrorInfo = {#varbind{oid = Oid, diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl index cf4d5523bf..acf62f5646 100644 --- a/lib/snmp/test/snmp_agent_test.erl +++ b/lib/snmp/test/snmp_agent_test.erl @@ -81,13 +81,12 @@ case get(vsn) of v1 -> V1; v2 -> V2; - _ -> V3 + _ -> V3 end). all() -> - Reqs = [mnesia, distribution, {local_slave_nodes, 2}, - {time, 360}], + %% Reqs = [mnesia, distribution, {local_slave_nodes, 2}, {time, 360}], Conf1 = [{group, all_tcs}], Conf2 = [{group, tickets2}], Conf1 ++ Conf2. @@ -95,62 +94,138 @@ all() -> groups() -> [{all_tcs, [], cases()}, {mib_storage, [], - [{group, mib_storage_ets}, {group, mib_storage_dets}, + [ + {group, mib_storage_ets}, + {group, mib_storage_dets}, {group, mib_storage_mnesia}, {group, mib_storage_size_check_ets}, {group, mib_storage_size_check_dets}, {group, mib_storage_size_check_mnesia}, {group, mib_storage_varm_dets}, - {group, mib_storage_varm_mnesia}]}, - {mib_storage_ets, [], mib_storage_ets_cases()}, - {mib_storage_dets, [], mib_storage_dets_cases()}, - {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, - {mib_storage_size_check_ets, [], mse_size_check_cases()}, + {group, mib_storage_varm_mnesia} + ] + }, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], mse_size_check_cases()}, {mib_storage_size_check_dets, [], msd_size_check_cases()}, {mib_storage_size_check_mnesia, [], msm_size_check_cases()}, - {mib_storage_varm_dets, [], varm_mib_storage_dets_cases()}, - {mib_storage_varm_mnesia, [], varm_mib_storage_mnesia_cases()}, - {misc, [], misc_cases()}, {test_v1, [], v1_cases()}, - {test_v2, [], v2_cases()}, - {test_v1_v2, [], v1_v2_cases()}, - {test_v3, [], v3_cases()}, - {test_multi_threaded, [], mt_cases()}, - {multiple_reqs, [], mul_cases()}, - {multiple_reqs_2, [], mul_cases_2()}, - {v2_inform, [], [v2_inform_i]}, + {mib_storage_varm_dets, [], varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], varm_mib_storage_mnesia_cases()}, + {misc, [], misc_cases()}, + {test_v1, [], v1_cases()}, + {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], + [ + v2_inform_i + ] + }, {v3_security, [], - [v3_crypto_basic, v3_md5_auth, v3_sha_auth, - v3_des_priv]}, + [ + v3_crypto_basic, + v3_md5_auth, + v3_sha_auth, + v3_des_priv + ] + }, {standard_mibs, [], - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, snmp_target_mib, - snmp_notification_mib, snmp_view_based_acm_mib]}, + [ + snmp_standard_mib, + snmp_community_mib, + snmp_framework_mib, + snmp_target_mib, + snmp_notification_mib, + snmp_view_based_acm_mib + ] + }, {standard_mibs_2, [], - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, snmp_target_mib_2, - snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + [ + snmpv2_mib_2, + snmp_community_mib_2, + snmp_framework_mib_2, + snmp_target_mib_2, + snmp_notification_mib_2, + snmp_view_based_acm_mib_2 + ] + }, {standard_mibs_3, [], - [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + [ + snmpv2_mib_3, + snmp_framework_mib_3, + snmp_mpd_mib_3, + snmp_target_mib_3, + snmp_notification_mib_3, + snmp_view_based_acm_mib_3, + snmp_user_based_sm_mib_3 + ] + }, {reported_bugs, [], - [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, - otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, - otp_2979, otp_3187, otp_3725]}, + [ + otp_1128, + otp_1129, + otp_1131, + otp_1162, + otp_1222, + otp_1298, + otp_1331, + otp_1338, + otp_1342, + otp_2776, + otp_2979, + otp_3187, + otp_3725 + ] + }, {reported_bugs_2, [], - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + [ + otp_1128_2, + otp_1129_2, + otp_1131_2, + otp_1162_2, + otp_1222_2, + otp_1298_2, + otp_1331_2, + otp_1338_2, + otp_1342_2, + otp_2776_2, + otp_2979_2, + otp_3187_2 + ] + }, {reported_bugs_3, [], - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]}, - {tickets1, [], [{group, otp_4394}, {group, otp_7157}]}, + [ + otp_1128_3, + otp_1129_3, + otp_1131_3, + otp_1162_3, + otp_1222_3, + otp_1298_3, + otp_1331_3, + otp_1338_3, + otp_1342_3, + otp_2776_3, + otp_2979_3, + otp_3187_3, + otp_3542 + ] + }, + {tickets1, [], + [ + {group, otp_4394}, + {group, otp_7157} + ] + }, {tickets2, [], [otp8395]}, {otp_4394, [], [otp_4394_test]}, - {otp_7157, [], - begin Reqs = [], Conf = [otp_7157_test], Conf end}]. + {otp_7157, [], [otp_7157_test] + } + ]. init_per_group(all_tcs, Config) -> init_all(Config); |