summaryrefslogtreecommitdiff
path: root/lib/snmp
diff options
context:
space:
mode:
authorMaxim Fedorov <maximfca@gmail.com>2021-11-17 20:50:25 -0800
committerMaxim Fedorov <maximfca@gmail.com>2022-01-31 09:43:48 -0800
commita9d76c5cf7d1dbf3f0f18f01bc9df4bd15c57045 (patch)
tree7c63256325ad3846f9aa39b2f2fd82ea4e82e6d6 /lib/snmp
parentb9ba20502ce97a8cdbba92ecf1ce8660b3769bc7 (diff)
downloaderlang-a9d76c5cf7d1dbf3f0f18f01bc9df4bd15c57045.tar.gz
[snmp] peer-ify application
Replace test_server:start_node with ?CT_PEER. Clean up unused test case callbacks (e.g. `testcase(suite)`) while I'm at it.
Diffstat (limited to 'lib/snmp')
-rw-r--r--lib/snmp/test/snmp_agent_SUITE.erl164
-rw-r--r--lib/snmp/test/snmp_agent_mibs_SUITE.erl32
-rw-r--r--lib/snmp/test/snmp_agent_test_lib.erl62
-rw-r--r--lib/snmp/test/snmp_manager_SUITE.erl444
-rw-r--r--lib/snmp/test/snmp_test_lib.erl12
-rw-r--r--lib/snmp/test/snmp_test_lib.hrl8
6 files changed, 224 insertions, 498 deletions
diff --git a/lib/snmp/test/snmp_agent_SUITE.erl b/lib/snmp/test/snmp_agent_SUITE.erl
index 9f13d6d240..a90a537f6a 100644
--- a/lib/snmp/test/snmp_agent_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_SUITE.erl
@@ -1795,7 +1795,6 @@ msm_varm_mib_start(X) ->
?P(msm_varm_mib_start),
varm_mib_start(X).
-ms_size_check(suite) -> [];
ms_size_check(Config) when is_list(Config) ->
?P(ms_size_check),
init_case(Config),
@@ -1837,7 +1836,6 @@ ms_size_check(Config) when is_list(Config) ->
ok.
-varm_mib_start(suite) -> [];
varm_mib_start(Config) when is_list(Config) ->
?P(varm_mib_start),
?IPRINT("varm_mib_start -> entry"),
@@ -1900,7 +1898,6 @@ varm_mib_start(Config) when is_list(Config) ->
-define(vacmViewSpinLock_instance, [1,3,6,1,6,3,16,1,5,1,0]).
-define(usmStatsNotInTimeWindows_instance, [1,3,6,1,6,3,15,1,1,2,0]).
-ms_me_of(suite) -> [];
ms_me_of(Config) when is_list(Config) ->
?P(ms_me_of),
init_case(Config),
@@ -1971,7 +1968,6 @@ me_of(Oid) ->
end.
-ms_mib_of(suite) -> [];
ms_mib_of(Config) when is_list(Config) ->
?P(ms_mib_of),
init_case(Config),
@@ -2054,7 +2050,6 @@ misc_cases() ->
create_local_db_dir
].
-app_info(suite) -> [];
app_info(Config) when is_list(Config) ->
?P(app_info),
SnmpDir = app_dir(snmp),
@@ -2092,8 +2087,6 @@ create_local_db_dir(Config) when is_list(Config) ->
erlang:unique_integer([positive])},
[As,Bs,Cs] = [integer_to_list(I) || I <- tuple_to_list(T)],
DbDir = filename:join([DataDir, As, Bs, Cs]),
- Name = list_to_atom(atom_to_list(create_local_db_dir)
- ++"_"++As++"_"++Bs++"_"++Cs),
?IPRINT("try ensuring db-dir does not exist"),
try del_dir(DbDir, 3) of
ok ->
@@ -2106,20 +2099,13 @@ create_local_db_dir(Config) when is_list(Config) ->
"~n Stack: ~p", [C, E, S]),
throw({skip, "Failed pre db-dir cleanup"})
end,
- ?IPRINT("try start node ~p", [Name]),
- case ?ALIB:start_node(Name) of
- {ok, Node} ->
- {DbDir, Node};
- {error, Reason} ->
- ?WPRINT("Failed starting node ~p:"
- "~n ~p", [Reason]),
- throw({skip, ?F("Failed starting node ~p", [Name])})
- end
+ {ok, Peer, Node} = ?START_PEER(""),
+ {DbDir, Peer, Node}
end,
Case = fun do_create_local_db_dir/1,
- Post = fun({DbDir, Node}) ->
+ Post = fun({DbDir, Peer, Node}) ->
?IPRINT("try stop node ~p", [Node]),
- ?ALIB:stop_node(Node),
+ peer:stop(Peer),
?IPRINT("try delete db-dir"),
try del_dir(DbDir, 3)
catch
@@ -2134,7 +2120,7 @@ create_local_db_dir(Config) when is_list(Config) ->
end,
?TC_TRY(create_local_db_dir, Pre, Case, Post).
-do_create_local_db_dir({DbDir, Node}) ->
+do_create_local_db_dir({DbDir, _Peer, Node}) ->
?P(create_local_db_dir),
%% first start with a nonexisting DbDir
Fun1 = fun() ->
@@ -2566,7 +2552,6 @@ init_old() ->
-simple(suite) -> [];
simple(Config) when is_list(Config) ->
?P(simple),
init_case(Config),
@@ -2578,7 +2563,6 @@ simple(Config) when is_list(Config) ->
simple_2(X) -> ?P(simple_2), simple(X).
-simple_bi(suite) -> [];
simple_bi(Config) when is_list(Config) ->
?P(simple_bi),
init_case(Config),
@@ -2592,7 +2576,6 @@ simple_bi(Config) when is_list(Config) ->
simple_3(X) ->
?P(simple_3), simple(X).
-big(suite) -> [];
big(Config) when is_list(Config) ->
?P(big),
%% put(sname, {?MODULE, big}),
@@ -2622,7 +2605,6 @@ big_2(X) -> ?P(big_2), big(X).
big_3(X) -> ?P(big_3), big(X).
-big2(suite) -> [];
big2(Config) when is_list(Config) ->
?P(big2),
%% This is exactly the same tests as 'big', but with the
@@ -2644,7 +2626,6 @@ big2_2(X) -> ?P(big2_2), big2(X).
big2_3(X) -> ?P(big2_3), big2(X).
-multi_threaded(suite) -> [];
multi_threaded(Config) when is_list(Config) ->
?P(multi_threaded),
init_case(Config),
@@ -2653,7 +2634,6 @@ multi_threaded(Config) when is_list(Config) ->
try_test(multi_threaded_test),
?line unload_master("Test1").
-mt_trap(suite) -> [];
mt_trap(Config) when is_list(Config) ->
?P(mt_trap),
init_case(Config),
@@ -2667,7 +2647,6 @@ mt_trap(Config) when is_list(Config) ->
?line unload_master("Test1"),
ok.
-v2_types(suite) -> [];
v2_types(Config) when is_list(Config) ->
?P(v2_types),
init_case(Config),
@@ -2679,7 +2658,6 @@ v2_types(Config) when is_list(Config) ->
v2_types_3(X) -> ?P(v2_types_3), v2_types(X).
-implied(suite) -> [];
implied(Config) when is_list(Config) ->
?P(implied),
init_case(Config),
@@ -2692,7 +2670,6 @@ implied(Config) when is_list(Config) ->
implied_3(X) -> ?P(implied_3), implied(X).
-sparse_table(suite) -> [];
sparse_table(Config) when is_list(Config) ->
?P(sparse_table),
init_case(Config),
@@ -2705,7 +2682,6 @@ sparse_table_2(X) -> ?P(sparse_table_2), sparse_table(X).
sparse_table_3(X) -> ?P(sparse_table_3), sparse_table(X).
-cnt_64(suite) -> [];
cnt_64(Config) when is_list(Config) ->
?P(cnt_64),
init_case(Config),
@@ -2719,7 +2695,6 @@ cnt_64_2(X) -> ?P(cnt_64_2), cnt_64(X).
cnt_64_3(X) -> ?P(cnt_64_3), cnt_64(X).
-opaque(suite) -> [];
opaque(Config) when is_list(Config) ->
?P(opaque),
init_case(Config),
@@ -2733,7 +2708,6 @@ opaque_2(X) -> ?P(opaque_2), opaque(X).
opaque_3(X) -> ?P(opaque_2), opaque(X).
-change_target_addr_config(suite) -> [];
change_target_addr_config(Config) when is_list(Config) ->
?P(change_target_addr_config),
?IPRINT("change_target_addr_config -> entry"),
@@ -2905,7 +2879,6 @@ dummy_manager_handle_message(Bytes) ->
end.
-api(suite) -> [];
api(Config) when is_list(Config) ->
?P(api),
init_case(Config),
@@ -2920,7 +2893,6 @@ api_2(X) -> ?P(api_2), api(X).
api_3(X) -> ?P(api_3), api(X).
-subagent(suite) -> [];
subagent(Config) when is_list(Config) ->
?P(subagent),
{SaNode, _MgrNode, MibDir} = init_case(Config),
@@ -2962,7 +2934,6 @@ subagent_3(X) ->
subagent(X).
-mnesia(suite) -> [];
mnesia(Config) when is_list(Config) ->
?P(mnesia),
{SaNode, _MgrNode, _MibDir} = init_case(Config),
@@ -3036,7 +3007,6 @@ finish_mul(Config) when is_list(Config) ->
?line stop_subagent(SA),
lists:keydelete(mul_sub, 1, Config).
-mul_get(suite) -> [];
mul_get(Config) when is_list(Config) ->
?P(mul_get),
init_case(Config),
@@ -3049,7 +3019,6 @@ mul_get_2(X) -> ?P(mul_get_2), mul_get(X).
mul_get_3(X) -> ?P(mul_get_3), mul_get(X).
-mul_get_err(suite) -> [];
mul_get_err(Config) when is_list(Config) ->
?P(mul_get_err),
init_case(Config),
@@ -3062,7 +3031,6 @@ mul_get_err_2(X) -> ?P(mul_get_err_2), mul_get_err(X).
mul_get_err_3(X) -> ?P(mul_get_err_3), mul_get_err(X).
-mul_next(suite) -> [];
mul_next(Config) when is_list(Config) ->
?P(mul_next),
init_case(Config),
@@ -3075,7 +3043,6 @@ mul_next_2(X) -> ?P(mul_next_2), mul_next(X).
mul_next_3(X) -> ?P(mul_next_3), mul_next(X).
-mul_next_err(suite) -> [];
mul_next_err(Config) when is_list(Config) ->
?P(mul_next_err),
init_case(Config),
@@ -3088,7 +3055,6 @@ mul_next_err_2(X) -> ?P(mul_next_err_2), mul_next_err(X).
mul_next_err_3(X) -> ?P(mul_next_err_3), mul_next_err(X).
-mul_set(suite) -> [];
mul_set(Config) when is_list(Config) ->
?P(mul_set),
init_case(Config),
@@ -3101,7 +3067,6 @@ mul_set_2(X) -> ?P(mul_set_2), mul_set(X).
mul_set_3(X) -> ?P(mul_set_3), mul_set(X).
-mul_set_err(suite) -> [];
mul_set_err(Config) when is_list(Config) ->
?P(mul_set_err),
init_case(Config),
@@ -3114,7 +3079,6 @@ mul_set_err_2(X) -> ?P(mul_set_err_2), mul_set_err(X).
mul_set_err_3(X) -> ?P(mul_set_err_3), mul_set_err(X).
-sa_register(suite) -> [];
sa_register(Config) when is_list(Config) ->
?P(sa_register),
{SaNode, _MgrNode, MibDir} = init_case(Config),
@@ -3152,7 +3116,6 @@ sa_register_2(X) -> ?P(sa_register_2), sa_register(X).
sa_register_3(X) -> ?P(sa_register_3), sa_register(X).
-v1_trap(suite) -> [];
v1_trap(Config) when is_list(Config) ->
?P(v1_trap),
trap1(Config).
@@ -3188,7 +3151,6 @@ trap1(Config) ->
?NPRINT("stop subagent..."),
?line stop_subagent(SA).
-v2_trap(suite) -> [];
v2_trap(Config) when is_list(Config) ->
?P(v2_trap),
trap2(Config).
@@ -3226,7 +3188,6 @@ trap2(Config) ->
?NPRINT("stop subagent..."),
?line stop_subagent(SA).
-v3_trap(suite) -> [];
v3_trap(Config) when is_list(Config) ->
%% <CONDITIONAL-SKIP>
Skippable = [{unix, [darwin]}],
@@ -3265,7 +3226,6 @@ v2_inform_cases() ->
v2_inform_i
].
-v2_inform_i(suite) -> [];
v2_inform_i(Config) when is_list(Config) ->
?P(v2_inform_i),
inform_i(Config).
@@ -3302,7 +3262,6 @@ v3_inform_i(X) ->
inform_i(X).
-sa_error(suite) -> [];
sa_error(Config) when is_list(Config) ->
?P(sa_error),
{SaNode, _MgrNode, _MibDir} = init_case(Config),
@@ -3344,7 +3303,6 @@ sa_error_3(X) ->
sa_error(X).
-next_across_sa(suite) -> [];
next_across_sa(Config) when is_list(Config) ->
?P(next_across_sa),
{SaNode, _MgrNode, MibDir} = init_case(Config),
@@ -3396,7 +3354,6 @@ next_across_sa_3(X) ->
next_across_sa(X).
-undo(suite) -> [];
undo(Config) when is_list(Config) ->
?P(undo),
{SaNode, _MgrNode, MibDir} = init_case(Config),
@@ -3453,7 +3410,6 @@ undo_3(X) ->
undo(X).
%% Req. Test2
-v1_processing(suite) -> [];
v1_processing(Config) when is_list(Config) ->
?P(v1_processing),
?DBG("v1_processing -> entry", []),
@@ -3468,7 +3424,6 @@ v1_processing(Config) when is_list(Config) ->
?line unload_master("Test2").
%% Req. Test2
-v2_processing(suite) -> [];
v2_processing(Config) when is_list(Config) ->
?P(v2_processing),
init_case(Config),
@@ -3482,7 +3437,6 @@ v2_processing(Config) when is_list(Config) ->
?line unload_master("Test2").
%% Req. Test2
-v3_processing(suite) -> [];
v3_processing(Config) when is_list(Config) ->
?P(v3_processing),
init_case(Config),
@@ -3515,7 +3469,6 @@ v3_security_cases() ->
].
-v3_crypto_basic(suite) -> [];
v3_crypto_basic(_Config) ->
?P(v3_crypto_basic),
EID = [0,0,0,0,0,0,0,0,0,0,0,2],
@@ -3564,7 +3517,6 @@ v3_crypto_basic(_Config) ->
-v3_md5_auth(suite) -> [];
v3_md5_auth(Config) when is_list(Config) ->
?P(v3_md5_auth),
init_case(Config),
@@ -3591,7 +3543,6 @@ v3_md5_auth(Config) when is_list(Config) ->
?line unload_master("Test2"),
?line reset_target_params_conf(AgentConfDir).
-v3_sha_auth(suite) -> [];
v3_sha_auth(Config) when is_list(Config) ->
?P(v3_sha_auth),
init_case(Config),
@@ -3620,7 +3571,6 @@ v3_sha_auth(Config) when is_list(Config) ->
?line unload_master("Test2"),
?line reset_target_params_conf(AgentConfDir).
-v3_sha224_auth(suite) -> [];
v3_sha224_auth(Config) when is_list(Config) ->
?P(v3_sha224_auth),
init_case(Config),
@@ -3649,7 +3599,6 @@ v3_sha224_auth(Config) when is_list(Config) ->
?line unload_master("Test2"),
?line reset_target_params_conf(AgentConfDir).
-v3_sha256_auth(suite) -> [];
v3_sha256_auth(Config) when is_list(Config) ->
?P(v3_sha256_auth),
init_case(Config),
@@ -3678,7 +3627,6 @@ v3_sha256_auth(Config) when is_list(Config) ->
?line unload_master("Test2"),
?line reset_target_params_conf(AgentConfDir).
-v3_sha384_auth(suite) -> [];
v3_sha384_auth(Config) when is_list(Config) ->
?P(v3_sha384_auth),
init_case(Config),
@@ -3707,7 +3655,6 @@ v3_sha384_auth(Config) when is_list(Config) ->
?line unload_master("Test2"),
?line reset_target_params_conf(AgentConfDir).
-v3_sha512_auth(suite) -> [];
v3_sha512_auth(Config) when is_list(Config) ->
?P(v3_sha512_auth),
init_case(Config),
@@ -3736,7 +3683,6 @@ v3_sha512_auth(Config) when is_list(Config) ->
?line unload_master("Test2"),
?line reset_target_params_conf(AgentConfDir).
-v3_des_priv(suite) -> [];
v3_des_priv(Config) when is_list(Config) ->
?P(v3_des_priv),
init_case(Config),
@@ -3789,7 +3735,6 @@ v3_inform_sync(MA) ->
{[snmpTrapOID, 0], ?system ++ [0,1]}]).
-v2_caps(suite) -> [];
v2_caps(Config) when is_list(Config) ->
?P(v2_caps),
init_case(Config),
@@ -4223,7 +4168,6 @@ simple_standard_test() ->
ok.
%% This is run in the agent node
-db_notify_client(suite) -> [];
db_notify_client(Config) when is_list(Config) ->
?P(db_notify_client),
{_SaNode, _MgrNode, _MibDir} = init_case(Config),
@@ -5622,7 +5566,6 @@ standard_mibs_cases_ipv6() ->
%% For this test, the agent is configured for v1.
%% o Test the counters and control objects in SNMP-STANDARD-MIB
%%-----------------------------------------------------------------
-snmp_standard_mib(suite) -> [];
snmp_standard_mib(Config) when is_list(Config) ->
?P(snmp_standard_mib),
init_case(Config),
@@ -5723,7 +5666,6 @@ standard_mibs2_cases() ->
%% For this test, the agent is configured for v2 and v3.
%% o Test the counters and control objects in SNMPv2-MIB
%%-----------------------------------------------------------------
-snmpv2_mib_2(suite) -> [];
snmpv2_mib_2(Config) when is_list(Config) ->
?P(snmpv2_mib_2),
?IPRINT("snmpv2_mib_2 -> start"),
@@ -5782,7 +5724,6 @@ standard_mibs3_cases() ->
%% Req. SNMPv2-MIB
-snmpv2_mib_3(suite) -> [];
snmpv2_mib_3(Config) when is_list(Config) ->
%% <CONDITIONAL-SKIP>
Skippable = [{unix, [darwin]}],
@@ -5871,7 +5812,6 @@ snmpv2_mib_a() ->
%% in SNMPv2-MIB and STANDARD-MIB.
%% o Test add/deletion of rows.
%%-----------------------------------------------------------------
-snmp_community_mib(suite) -> [];
snmp_community_mib(Config) when is_list(Config) ->
?P(snmp_community_mib),
init_case(Config),
@@ -5890,7 +5830,6 @@ snmp_community_mib_test() ->
%%-----------------------------------------------------------------
%% o Test engine boots / time
%%-----------------------------------------------------------------
-snmp_framework_mib(suite) -> [];
snmp_framework_mib(Config) when is_list(Config) ->
?P(snmp_framework_mib),
init_case(Config),
@@ -5900,7 +5839,6 @@ snmp_framework_mib(Config) when is_list(Config) ->
snmp_framework_mib_2(X) -> ?P(snmp_framework_mib_2), snmp_framework_mib(X).
-snmp_framework_mib_3(suite) -> [];
snmp_framework_mib_3(Config) when is_list(Config) ->
?P(snmp_framework_mib_3),
init_case(Config),
@@ -6008,7 +5946,6 @@ snmp_framework_mib_test() ->
%%-----------------------------------------------------------------
%% o Test the counters
%%-----------------------------------------------------------------
-snmp_mpd_mib_3(suite) -> [];
snmp_mpd_mib_3(Config) when is_list(Config) ->
%% <CONDITIONAL-SKIP>
Skippable = [{unix, [darwin]}],
@@ -6076,7 +6013,6 @@ snmp_mpd_mib_c(UnknownPDUHs) ->
ok.
-snmp_target_mib(suite) -> [];
snmp_target_mib(Config) when is_list(Config) ->
?P(snmp_target_mib),
init_case(Config),
@@ -6092,7 +6028,6 @@ snmp_target_mib_test() ->
?NPRINT("NOT YET IMPLEMENTED"),
nyi.
-snmp_notification_mib(suite) -> [];
snmp_notification_mib(Config) when is_list(Config) ->
?P(snmp_notification_mib),
init_case(Config),
@@ -6115,7 +6050,6 @@ snmp_notification_mib_test() ->
%% o add/delete views and try them
%% o try boundaries
%%-----------------------------------------------------------------
-snmp_view_based_acm_mib(suite) -> [];
snmp_view_based_acm_mib(Config) when is_list(Config) ->
?P(snmp_view_based_acm_mib),
init_case(Config),
@@ -6310,7 +6244,6 @@ mk_ln(X) ->
%% o test all combinations of protocols
%% o try bad ops; check counters
%%-----------------------------------------------------------------
-snmp_user_based_sm_mib_3(suite) -> [];
snmp_user_based_sm_mib_3(Config) when is_list(Config) ->
%% <CONDITIONAL-SKIP>
Skippable = [{unix, [darwin]}],
@@ -6537,7 +6470,6 @@ usm_bad() ->
%% works.
%% Load all std mibs that are not loaded by default.
%%-----------------------------------------------------------------
-loop_mib_1(suite) -> [];
loop_mib_1(Config) when is_list(Config) ->
?P(loop_mib_1),
?IPRINT("loop_mib_1 -> initiate case"),
@@ -6581,7 +6513,6 @@ loop_mib_1(Config) when is_list(Config) ->
ok.
-loop_mib_2(suite) -> [];
loop_mib_2(Config) when is_list(Config) ->
?P(loop_mib_2),
?IPRINT("loop_mib_2 -> initiate case"),
@@ -6611,7 +6542,6 @@ loop_mib_2(Config) when is_list(Config) ->
ok.
-loop_mib_3(suite) -> [];
loop_mib_3(Config) when is_list(Config) ->
?P(loop_mib_3),
?IPRINT("loop_mib_3 -> initiate case"),
@@ -6914,7 +6844,6 @@ reported_bugs3_cases() ->
%% Ticket: OTP-1128
%% Slogan: Bug in handling of createAndWait set-requests.
%%-----------------------------------------------------------------
-otp_1128(suite) -> [];
otp_1128(Config) when is_list(Config) ->
?P(otp_1128),
init_case(Config),
@@ -6953,7 +6882,6 @@ otp_1128_test() ->
%% Ticket: OTP-1129, OTP-1169
%% Slogan: snmpa:int_to_enum crashes on bad oids
%%-----------------------------------------------------------------
-otp_1129(suite) -> [];
otp_1129(Config) when is_list(Config) ->
?P(otp_1129),
init_case(Config),
@@ -6978,7 +6906,6 @@ otp_1129_i(MaNode) ->
%% setrequest is of bad type, e.g. an INDEX {INTEGER},
%% and RowIdenx [3,2].
%%-----------------------------------------------------------------
-otp_1131(suite) -> [];
otp_1131(Config) when is_list(Config) ->
?P(otp_1131),
init_case(Config),
@@ -7046,7 +6973,6 @@ otp_1131_test() ->
%% Ticket: OTP-1162
%% Slogan: snmp_agent can't handle wrongValue from instrum.func
%%-----------------------------------------------------------------
-otp_1162(suite) -> [];
otp_1162(Config) when is_list(Config) ->
?P(otp_1162),
{SaNode, _MgrNode, _MibDir} = init_case(Config),
@@ -7068,7 +6994,6 @@ otp_1162_test() ->
%% Ticket: OTP-1222
%% Slogan: snmp agent crash if faulty index is returned from instrum
%%-----------------------------------------------------------------
-otp_1222(suite) -> [];
otp_1222(Config) when is_list(Config) ->
?P(otp_1222),
init_case(Config),
@@ -7096,7 +7021,6 @@ otp_1222_test() ->
%% Ticket: OTP-1298
%% Slogan: Negative INTEGER values are treated as positive.
%%-----------------------------------------------------------------
-otp_1298(suite) -> [];
otp_1298(Config) when is_list(Config) ->
?P(otp_1298),
init_case(Config),
@@ -7121,7 +7045,6 @@ otp_1298_test() ->
%% Ticket: OTP-1331
%% Slogan: snmp_generic should return noError when deleting non-ex row
%%-----------------------------------------------------------------
-otp_1331(suite) -> [];
otp_1331(Config) when is_list(Config) ->
?P(otp_1331),
init_case(Config),
@@ -7146,7 +7069,6 @@ otp_1331_test() ->
%% Ticket: OTP-1338
%% Slogan: snmp bug in initialisation of default values for mnesia tabs
%%-----------------------------------------------------------------
-otp_1338(suite) -> [];
otp_1338(Config) when is_list(Config) ->
?P(otp_1338),
init_case(Config),
@@ -7171,7 +7093,6 @@ otp_1338_test() ->
%% Slogan: default impl of snmp table can't handle bad index access,
%% Set when INDEX is read-write gets into an infinite loop!
%%-----------------------------------------------------------------
-otp_1342(suite) -> [];
otp_1342(Config) when is_list(Config) ->
?P(otp_1342),
init_case(Config),
@@ -7198,7 +7119,6 @@ otp_1342_test() ->
%% Note: NYI! We need a way to tell the test server that we need
%% mgrs on two different machines.
%%-----------------------------------------------------------------
-otp_1366(suite) -> [];
otp_1366(Config) when is_list(Config) ->
?P(otp_1366),
init_case(Config),
@@ -7221,7 +7141,6 @@ otp_1366_test() ->
%% Ticket: OTP-2776
%% Slogan: snmp:validate_date_and_time() fails when time is 00:00
%%-----------------------------------------------------------------
-otp_2776(suite) -> [];
otp_2776(Config) when is_list(Config) ->
?P(otp_2776),
init_case(Config),
@@ -7288,7 +7207,6 @@ validate_dat2(Id, E, Dat) ->
%% Slogan: get-next on more than 1 column in an empty table
%% returns bad response.
%%-----------------------------------------------------------------
-otp_2979(suite) -> [];
otp_2979(Config) when is_list(Config) ->
?P(otp_2979),
init_case(Config),
@@ -7313,7 +7231,6 @@ otp_2979_test() ->
%% Slogan: get-next on vacmAccessTable for columns > 5 returns
%% endOfTable - should return value.
%%-----------------------------------------------------------------
-otp_3187(suite) -> [];
otp_3187(Config) when is_list(Config) ->
?P(otp_3187),
init_case(Config),
@@ -7339,7 +7256,6 @@ otp_3187_test() ->
%% Ticket: OTP-3542
%% Slogan:
%%-----------------------------------------------------------------
-otp_3542(suite) -> [];
otp_3542(Config) when is_list(Config) ->
?P(otp_3542),
init_case(Config),
@@ -7355,7 +7271,6 @@ otp_3542_test() ->
%% Ticket: OTP-3725
%% Slogan: Slow response time on snmpa:int_to_enum
%%-----------------------------------------------------------------
-otp_3725(suite) -> [];
otp_3725(Config) when is_list(Config) ->
?P(otp_3725),
init_case(Config),
@@ -7473,7 +7388,6 @@ otp_4394_finish(Config) when is_list(Config) ->
erase(mgr_node),
lists:keydelete(vsn, 1, C1).
-otp_4394(suite) -> [];
otp_4394(Config) ->
?P(otp_4394),
?DBG("otp_4394 -> entry", []),
@@ -7529,7 +7443,6 @@ otp_7157_finish(Config) when is_list(Config) ->
erase(mgr_node),
lists:keydelete(vsn, 1, C1).
-otp_7157(suite) -> [];
otp_7157(Config) ->
?P(otp_7157),
?DBG("otp_7157 -> entry", []),
@@ -7580,7 +7493,6 @@ otp16092_cases() ->
otp_16092_simple_start_and_stop4 % invalid content
].
-otp_16092_simple_start_and_stop1(suite) -> [];
otp_16092_simple_start_and_stop1(Config) ->
?P(otp_16092_simple_start_and_stop1),
?DBG("otp_16092_simple_start_and_stop1 -> entry", []),
@@ -7597,7 +7509,6 @@ otp_16092_simple_start_and_stop1(Config) ->
Result.
-otp_16092_simple_start_and_stop2(suite) -> [];
otp_16092_simple_start_and_stop2(Config) ->
?P(otp_16092_simple_start_and_stop2),
?DBG("otp_16092_simple_start_and_stop2 -> entry", []),
@@ -7614,7 +7525,6 @@ otp_16092_simple_start_and_stop2(Config) ->
Result.
-otp_16092_simple_start_and_stop3(suite) -> [];
otp_16092_simple_start_and_stop3(Config) ->
?P(otp_16092_simple_start_and_stop3),
?DBG("otp_16092_simple_start_and_stop3 -> entry", []),
@@ -7633,7 +7543,6 @@ otp_16092_simple_start_and_stop3(Config) ->
Result.
-otp_16092_simple_start_and_stop4(suite) -> [];
otp_16092_simple_start_and_stop4(Config) ->
?P(otp_16092_simple_start_and_stop4),
?DBG("otp_16092_simple_start_and_stop4 -> entry", []),
@@ -7666,7 +7575,7 @@ otp_16092_simple_start_and_stop(Config, ESO, Expected) ->
?line DbDir = ?config(agent_db_dir, Config),
?NPRINT("try start agent node"),
- {ok, Node} = ?ALIB:start_node(agent_16092),
+ {ok, Peer, Node} = ?START_PEER("-agent"),
Vsns = [v1],
IP = tuple_to_list(?config(ip, Config)),
@@ -7698,7 +7607,7 @@ otp_16092_simple_start_and_stop(Config, ESO, Expected) ->
otp16092_try_start_and_stop_agent(Node, Opts, Expected),
?NPRINT("try stop agent node ~p", [Node]),
- ?ALIB:stop_node(Node),
+ peer:stop(Peer),
?SLEEP(1000),
@@ -7786,9 +7695,8 @@ otp8395({init, Config}) when is_list(Config) ->
%% --
%% Start nodes
%%
- FName = ?FUNCTION_NAME,
- {ok, AgentNode} = start_node(mk_node_name(FName, agent)),
- {ok, ManagerNode} = start_node(mk_node_name(FName, manager)),
+ {ok, AgentPeer, AgentNode} = ?START_PEER("-agent"),
+ {ok, ManagerPeer, ManagerNode} = ?START_PEER("-manager"),
%% --
%% Mnesia init
@@ -7838,12 +7746,14 @@ otp8395({init, Config}) when is_list(Config) ->
Config2 = start_agent([{host, Host},
{ip, Ip},
{ipfamily, IpFamily},
+ {agent_peer, AgentPeer},
{agent_node, AgentNode},
{agent_host, AgentHost},
{agent_ip, AgentIP},
%% {sub_agent_node, SubAgentNode},
%% {sub_agent_host, SubAgentHost},
- %% {sub_agent_ip, SubAgentIP},
+ %% {sub_agent_ip, SubAgentIP},
+ {manager_peer, ManagerPeer},
{manager_node, ManagerNode},
{manager_host, ManagerHost},
{manager_ip, ManagerIP}|Config]),
@@ -7859,7 +7769,6 @@ otp8395({fin, Config}) when is_list(Config) ->
"~n Config: ~p", [Config]),
AgentNode = ?config(agent_node, Config),
- ManagerNode = ?config(manager_node, Config),
%% -
%% Stop agent (this is the nice way to do it,
@@ -7882,14 +7791,14 @@ otp8395({fin, Config}) when is_list(Config) ->
%%
?DBG("otp8395(fin) -> stop agent node", []),
- stop_node(AgentNode),
+ peer:stop(?config(agent_peer, Config)),
%% -
%% Stop the manager node
%%
?DBG("otp8395(fin) -> stop manager node", []),
- stop_node(ManagerNode),
+ peer:stop(?config(manager_peer, Config)),
wd_stop(Config);
@@ -8279,10 +8188,8 @@ otp16649_init(N, AgentPreTransports, Config) ->
%% Start nodes
%%
- ?IPRINT("start (agent and mansger) nodes"),
-
- {ok, AgentNode} = start_node(otp16649_mk_name(N, agent)),
- {ok, ManagerNode} = start_node(otp16649_mk_name(N, manager)),
+ {ok, AgentPeer, AgentNode} = ?START_PEER("-agent"),
+ {ok, ManagerPeer, ManagerNode} = ?START_PEER("-manager"),
%% --
%% Misc
@@ -8339,9 +8246,11 @@ otp16649_init(N, AgentPreTransports, Config) ->
?IPRINT("start agent"),
Config2 = start_agent([{host, Host},
+ {agent_peer, AgentPeer},
{agent_node, AgentNode},
{agent_host, AgentHost},
{agent_ip, AgentIP},
+ {manager_peer, ManagerPeer},
{manager_node, ManagerNode},
{manager_host, ManagerHost},
{manager_ip, ManagerIP}|Config]),
@@ -8380,13 +8289,6 @@ otp16649_init(N, AgentPreTransports, Config) ->
"~n Config2: ~p", [Config3]),
[{agent_raw_transports, AgentPreTransports} | Config3].
-mk_node_name(FName, Post) when is_atom(FName) andalso is_atom(Post) ->
- list_to_atom(?F("~w_~w", [FName, Post])).
-
-otp16649_mk_name(N, Post) when is_integer(N) andalso is_atom(Post) ->
- mk_node_name(otp16649, list_to_atom(?F("~w_~w", [N, Post]))).
-%% list_to_atom(?F("otp16649_~w_~w", [N, Post])).
-
otp16649_fin(N, Config) when is_integer(N) ->
?IPRINT("otp16649_fin -> entry with"
@@ -8394,7 +8296,6 @@ otp16649_fin(N, Config) when is_integer(N) ->
"~n Config: ~p", [N, Config]),
ManagerNode = ?config(manager_node, Config),
- AgentNode = ?config(agent_node, Config),
%% -
%% Stop agent (this is the nice way to do it,
@@ -8417,7 +8318,7 @@ otp16649_fin(N, Config) when is_integer(N) ->
%%
?DBG("otp16649_fin -> stop manager node", []),
- stop_node(ManagerNode),
+ peer:stop(?config(manager_peer, Config)),
%%
@@ -8425,7 +8326,7 @@ otp16649_fin(N, Config) when is_integer(N) ->
%%
?DBG("otp16649_fin -> stop agent node", []),
- stop_node(AgentNode),
+ peer:stop(?config(agent_peer, Config)),
?DBG("otp16649_fin -> done", []),
Config1 = lists:keydelete(manager_node, 1, Config),
@@ -8748,7 +8649,6 @@ nkill(Pid, Reason, N) when N > 0 ->
%% Slogan: info test
%%-----------------------------------------------------------------
-info_test(suite) -> [];
info_test(Config) when is_list(Config) ->
?P(info_test),
init_case(Config),
@@ -8846,15 +8746,6 @@ get_next_req(Vars) ->
?ALIB:get_next_req(Vars).
-start_node(Name) ->
- ?ALIB:start_node(Name).
-
-stop_node(undefined) ->
- ok;
-stop_node(Node) ->
- ?ALIB:stop_node(Node).
-
-
%%%-----------------------------------------------------------------
%%% Configuration
%%%-----------------------------------------------------------------
@@ -9067,14 +8958,12 @@ lists_key1search(Key, List) when is_atom(Key) ->
init_v1_agent(Config) ->
%% --
%% Start nodes
- %%
-
- FName = ?config(fname, Config),
- {ok, AgentNode} = start_node(mk_node_name(FName, agent)),
+ %%
+ {ok, AgentPeer, AgentNode} = ?START_PEER("-agent"),
%% We don't use a manager in this test but the (common) config
%% function takes an argument that is derived from this
- {ok, ManagerNode} = start_node(mk_node_name(FName, manager)),
+ {ok, ManagerPeer, ManagerNode} = ?START_PEER("-manager"),
%% --
%% Mnesia init
@@ -9126,6 +9015,7 @@ init_v1_agent(Config) ->
Config2 = start_agent([{host, Host},
{ip, Ip},
+ {agent_peer, AgentPeer},
{agent_node, AgentNode},
{agent_host, AgentHost},
{agent_ip, AgentIP},
@@ -9133,6 +9023,7 @@ init_v1_agent(Config) ->
%% We need this here since without it
%% fin_v1_agent will not be able to stop!
+ {manager_peer, ManagerPeer},
{manager_node, ManagerNode}|Config]),
%% --
@@ -9143,7 +9034,6 @@ init_v1_agent(Config) ->
fin_v1_agent(Config) ->
AgentNode = ?config(agent_node, Config),
- ManagerNode = ?config(manager_node, Config),
%% -
%% Stop agent (this is the nice way to do it,
@@ -9162,7 +9052,7 @@ fin_v1_agent(Config) ->
%% -
%% Stop the agent node
%%
- stop_node(AgentNode),
+ peer:stop(?config(agent_peer, Config)),
%% SubAgentNode = ?config(sub_agent_node, Config),
@@ -9172,7 +9062,7 @@ fin_v1_agent(Config) ->
%% -
%% Stop the manager node
%%
- stop_node(ManagerNode),
+ peer:stop(?config(manager_peer, Config)),
wd_stop(Config).
diff --git a/lib/snmp/test/snmp_agent_mibs_SUITE.erl b/lib/snmp/test/snmp_agent_mibs_SUITE.erl
index 9788b7edf5..db4699e6a9 100644
--- a/lib/snmp/test/snmp_agent_mibs_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_mibs_SUITE.erl
@@ -215,7 +215,6 @@ end_per_testcase1(_Case, Config) when is_list(Config) ->
%% Test functions
%%======================================================================
-start_and_stop(suite) -> [];
start_and_stop(Config) when is_list(Config) ->
tc_try(start_and_start,
fun() -> do_start_and_stop(Config) end).
@@ -237,7 +236,6 @@ do_start_and_stop(_Config) ->
%% ---------------------------------------------------------------------
-load_unload(suite) -> [];
load_unload(Config) when is_list(Config) ->
tc_try(load_unload,
fun() -> do_load_unload(Config) end).
@@ -296,15 +294,11 @@ do_load_unload(Config) ->
%% ---------------------------------------------------------------------
-size_check_ets1(suite) ->
- [];
size_check_ets1(Config) when is_list(Config) ->
MibStorage = [{module, snmpa_mib_storage_ets}],
do_size_check(size_check_ets1,
[{mib_storage, MibStorage}|Config]).
-size_check_ets2(suite) ->
- [];
size_check_ets2(Config) when is_list(Config) ->
Dir = ?config(db_dir, Config),
MibStorage = [{module, snmpa_mib_storage_ets},
@@ -312,8 +306,6 @@ size_check_ets2(Config) when is_list(Config) ->
do_size_check(size_check_ets2,
[{mib_storage, MibStorage}|Config]).
-size_check_ets2_bad_file1(suite) ->
- [];
size_check_ets2_bad_file1(Config) when is_list(Config) ->
Dir = ?config(db_dir, Config),
%% Ensure that the bad file does not cause any problems (action = clear)
@@ -323,8 +315,6 @@ size_check_ets2_bad_file1(Config) when is_list(Config) ->
do_size_check(size_check_ets2_bad_file1,
[{mib_storage, MibStorage}|Config]).
-size_check_ets3(suite) ->
- [];
size_check_ets3(Config) when is_list(Config) ->
Dir = ?config(db_dir, Config),
MibStorage = [{module, snmpa_mib_storage_ets},
@@ -333,8 +323,6 @@ size_check_ets3(Config) when is_list(Config) ->
do_size_check(size_check_ets3,
[{mib_storage, MibStorage}|Config]).
-size_check_ets3_bad_file1(suite) ->
- [];
size_check_ets3_bad_file1(Config) when is_list(Config) ->
Dir = ?config(db_dir, Config),
%% Ensure that the bad file does not cause any problems (action = clear)
@@ -345,8 +333,6 @@ size_check_ets3_bad_file1(Config) when is_list(Config) ->
do_size_check(size_check_ets3_bad_file1,
[{mib_storage, MibStorage}|Config]).
-size_check_dets(suite) ->
- [];
size_check_dets(Config) when is_list(Config) ->
Dir = ?config(db_dir, Config),
MibStorage = [{module, snmpa_mib_storage_dets},
@@ -354,8 +340,6 @@ size_check_dets(Config) when is_list(Config) ->
do_size_check(size_check_dets,
[{mib_storage, MibStorage}|Config]).
-size_check_mnesia(suite) ->
- [];
size_check_mnesia(Config) when is_list(Config) ->
MibStorage = [{module, snmpa_mib_storage_mnesia},
{options, [{nodes, []}]}],
@@ -427,7 +411,6 @@ do_size_check(Config) ->
%% ---------------------------------------------------------------------
-me_lookup(suite) -> [];
me_lookup(Config) when is_list(Config) ->
tc_try(me_lookup,
fun() -> do_me_lookup(Config) end).
@@ -484,7 +467,6 @@ do_me_lookup(Config) ->
%% ---------------------------------------------------------------------
-which_mib(suite) -> [];
which_mib(Config) when is_list(Config) ->
tc_try(which_mib,
fun() -> do_which_mib(Config) end).
@@ -544,7 +526,6 @@ do_which_mib(Config) ->
%% ---------------------------------------------------------------------
-cache_test(suite) -> [];
cache_test(Config) when is_list(Config) ->
tc_try(cache_test,
fun() -> do_cache_test(Config) end).
@@ -1093,11 +1074,11 @@ tc_try(Name, TC) ->
tc_try(Name, Init, TC)
when is_atom(Name) andalso is_function(Init, 0) andalso is_function(TC, 0) ->
Pre = fun() ->
- {ok, Node} = ?ALIB:start_node(unique(Name)),
+ {ok, Peer, Node} = ?START_PEER(atom_to_list(Name)),
ok = run_on(Node, Init),
- Node
+ {Peer, Node}
end,
- Case = fun(Node) ->
+ Case = fun({_Peer, Node}) ->
monitor_node(Node, true),
Pid = spawn_link(Node, TC),
receive
@@ -1125,7 +1106,7 @@ tc_try(Name, Init, TC)
exit(Reason)
end
end,
- Post = fun(Node) ->
+ Post = fun({Peer, Node}) ->
receive
{nodedown, Node} ->
?NPRINT("node ~p (already) stopped", [Node]),
@@ -1133,7 +1114,7 @@ tc_try(Name, Init, TC)
after 0 ->
monitor_node(Node, true),
?NPRINT("try stop node ~p", [Node]),
- ?STOP_NODE(Node),
+ peer:stop(Peer),
receive
{nodedown, Node} ->
?NPRINT("node ~p stopped", [Node]),
@@ -1156,9 +1137,6 @@ run_on(Node, F) when is_atom(Node) andalso is_function(F, 0) ->
monitor_node(Node, false),
Reason
end.
-
-unique(PreName) ->
- list_to_atom(?F("~w_~w", [PreName, erlang:system_time(millisecond)])).
%% --
diff --git a/lib/snmp/test/snmp_agent_test_lib.erl b/lib/snmp/test/snmp_agent_test_lib.erl
index 393b5dce57..f4e3c5d864 100644
--- a/lib/snmp/test/snmp_agent_test_lib.erl
+++ b/lib/snmp/test/snmp_agent_test_lib.erl
@@ -33,8 +33,6 @@
start_subagent/3, stop_subagent/1,
start_sub_sup/1, start_sub_sup/2,
- start_node/1, stop_node/1,
-
load_master/1, load_master_std/1, unload_master/1,
loaded_mibs/0, unload_mibs/1,
@@ -131,11 +129,16 @@ init_all(Config) when is_list(Config) ->
%%
?IPRINT("init_all -> start sub-agent node"),
- ?line {ok, SaNode} = start_node(snmp_sa),
+ Args = ["-s", "snmp_test_sys_monitor", "start", "-s", "global", "sync"],
+
+ {ok, SaPeer, SaNode} = ?CT_PEER(#{name => ?CT_PEER_NAME(snmp_sa), args => Args}),
+ unlink(SaPeer), %% must unlink, otherwise peer will exit before test case
?IPRINT("init_all -> start manager node"),
- ?line {ok, MgrNode} = start_node(snmp_mgr),
+ {ok, MgrPeer, MgrNode} = ?CT_PEER(#{name => ?CT_PEER_NAME(snmp_mgr), args => Args}),
+ unlink(MgrPeer), %% must unlink, otherwise peer will exit before test case
+ global:sync(),
%% --
%% Create necessary files ( and dirs )
@@ -216,8 +219,10 @@ init_all(Config) when is_list(Config) ->
?IPRINT("init_all -> done when"
"~n Nodes: ~p", [nodes()]),
- [{snmp_sa, SaNode},
- {snmp_mgr, MgrNode},
+ [{snmp_sa, SaNode},
+ {snmp_sa_peer, SaPeer},
+ {snmp_mgr, MgrNode},
+ {snmp_mgr_peer, MgrPeer},
{snmp_master, node()},
{agent_dir, AgentDir ++ "/"},
{agent_db_dir, AgentDbDir ++ "/"},
@@ -237,14 +242,12 @@ finish_all(Config) when is_list(Config) ->
"~n Config: ~p"
"~n Nodes: ~p", [Config, nodes()]),
- SaNode = ?config(snmp_sa, Config),
- MgrNode = ?config(snmp_mgr, Config),
+ SaPeer = ?config(snmp_sa_peer, Config),
+ MgrPeer = ?config(snmp_mgr_peer, Config),
- ?IPRINT("finish_all -> stop sub-agent node ~p", [SaNode]),
- stop_node(SaNode),
+ peer:stop(SaPeer),
- ?IPRINT("finish_all -> stop manager node ~p", [MgrNode]),
- stop_node(MgrNode),
+ peer:stop(MgrPeer),
?IPRINT("finish_all -> stop mnesia application"),
application:stop(mnesia),
@@ -1627,41 +1630,6 @@ get_next_req(Vars) ->
Response.
-%% --- start and stop nodes ---
-
-start_node(Name) ->
- ?IPRINT("start_node -> entry with"
- "~n Name: ~p"
- "~n when"
- "~n hostname of this node: ~p",
- [Name, list_to_atom(?HOSTNAME(node()))]),
-
- Pa = filename:dirname(code:which(?MODULE)),
- ?DBG("start_node -> Pa: ~p", [Pa]),
-
- A = " -pa " ++ Pa ++
- " -s " ++ atom_to_list(snmp_test_sys_monitor) ++ " start" ++
- " -s global sync",
- case ?START_NODE(Name, A) of
- {ok, Node} ->
- ?DBG("start_node -> Node: ~p", [Node]),
- global:sync(),
- {ok, Node};
- {error, Reason} ->
- ?WPRINT("start_node -> failed starting node ~p:"
- "~n Reason: ~p", [Name, Reason]),
- ?line ?SKIP({failed_start_node, Reason});
- Else ->
- ?EPRINT("start_node -> failed starting node ~p:"
- "~n ~p", [Name, Else]),
- ?line ?FAIL(Else)
- end.
-
-
-stop_node(Node) ->
- ?IPRINT("stop_node -> Node: ~p", [Node]),
- ?STOP_NODE(Node).
-
%%%-----------------------------------------------------------------
%%% Configuration
diff --git a/lib/snmp/test/snmp_manager_SUITE.erl b/lib/snmp/test/snmp_manager_SUITE.erl
index 27ae47016e..584d935f0d 100644
--- a/lib/snmp/test/snmp_manager_SUITE.erl
+++ b/lib/snmp/test/snmp_manager_SUITE.erl
@@ -62,9 +62,9 @@
register_user1/1,
- register_agent_old/1,
- register_agent2/1,
- register_agent3/1,
+ register_agent_old/0, register_agent_old/1,
+ register_agent2/0, register_agent2/1,
+ register_agent3/0, register_agent3/1,
info/1,
usm_priv_aes/1,
@@ -73,30 +73,30 @@
usm_sha384_priv_aes/1,
usm_sha512_priv_aes/1,
- simple_sync_get3/1,
- simple_async_get3/1,
+ simple_sync_get3/0, simple_sync_get3/1,
+ simple_async_get3/0, simple_async_get3/1,
- simple_sync_get_next3/1,
- simple_async_get_next3_cbp_def/1,
- simple_async_get_next3_cbp_temp/1,
- simple_async_get_next3_cbp_perm/1,
+ simple_sync_get_next3/0, simple_sync_get_next3/1,
+ simple_async_get_next3_cbp_def/0, simple_async_get_next3_cbp_def/1,
+ simple_async_get_next3_cbp_temp/0, simple_async_get_next3_cbp_temp/1,
+ simple_async_get_next3_cbp_perm/0, simple_async_get_next3_cbp_perm/1,
- simple_sync_set3/1,
- simple_async_set3_cbp_def/1,
- simple_async_set3_cbp_temp/1,
- simple_async_set3_cbp_perm/1,
+ simple_sync_set3/0, simple_sync_set3/1,
+ simple_async_set3_cbp_def/0, simple_async_set3_cbp_def/1,
+ simple_async_set3_cbp_temp/0, simple_async_set3_cbp_temp/1,
+ simple_async_set3_cbp_perm/0, simple_async_set3_cbp_perm/1,
- simple_sync_get_bulk3/1,
- simple_async_get_bulk3_cbp_def/1,
- simple_async_get_bulk3_cbp_temp/1,
- simple_async_get_bulk3_cbp_perm/1,
-
- simple_v3_exchange_md5/1,
- simple_v3_exchange_sha/1,
- simple_v3_exchange_sha224/1,
- simple_v3_exchange_sha256/1,
- simple_v3_exchange_sha384/1,
- simple_v3_exchange_sha512/1,
+ simple_sync_get_bulk3/0, simple_sync_get_bulk3/1,
+ simple_async_get_bulk3_cbp_def/0, simple_async_get_bulk3_cbp_def/1,
+ simple_async_get_bulk3_cbp_temp/0, simple_async_get_bulk3_cbp_temp/1,
+ simple_async_get_bulk3_cbp_perm/0, simple_async_get_bulk3_cbp_perm/1,
+
+ simple_v3_exchange_md5/0, simple_v3_exchange_md5/1,
+ simple_v3_exchange_sha/0, simple_v3_exchange_sha/1,
+ simple_v3_exchange_sha224/0, simple_v3_exchange_sha224/1,
+ simple_v3_exchange_sha256/0, simple_v3_exchange_sha256/1,
+ simple_v3_exchange_sha384/0, simple_v3_exchange_sha384/1,
+ simple_v3_exchange_sha512/0, simple_v3_exchange_sha512/1,
discovery/1,
@@ -113,9 +113,9 @@
report/1,
- otp8015_1/1,
+ otp8015_1/0, otp8015_1/1,
- otp8395_1/1
+ otp8395_1/0, otp8395_1/1
]).
@@ -654,18 +654,18 @@ init_per_testcase2(Case, Config) ->
?DBG("init [~w] Nodes [2]: ~p", [Case, erlang:nodes()]),
Conf2.
-init_per_testcase3(simple_v3_exchange_md5 = _Case, Config) ->
- init_v3_testcase([{auth_alg, md5} | Config]);
-init_per_testcase3(simple_v3_exchange_sha = _Case, Config) ->
- init_v3_testcase([{auth_alg, sha} | Config]);
-init_per_testcase3(simple_v3_exchange_sha224 = _Case, Config) ->
- init_v3_testcase([{auth_alg, sha224} | Config]);
-init_per_testcase3(simple_v3_exchange_sha256 = _Case, Config) ->
- init_v3_testcase([{auth_alg, sha256} | Config]);
-init_per_testcase3(simple_v3_exchange_sha384 = _Case, Config) ->
- init_v3_testcase([{auth_alg, sha384} | Config]);
-init_per_testcase3(simple_v3_exchange_sha512 = _Case, Config) ->
- init_v3_testcase([{auth_alg, sha512} | Config]);
+init_per_testcase3(simple_v3_exchange_md5 = Case, Config) ->
+ init_v3_testcase(Case, [{auth_alg, md5} | Config]);
+init_per_testcase3(simple_v3_exchange_sha = Case, Config) ->
+ init_v3_testcase(Case, [{auth_alg, sha} | Config]);
+init_per_testcase3(simple_v3_exchange_sha224 = Case, Config) ->
+ init_v3_testcase(Case, [{auth_alg, sha224} | Config]);
+init_per_testcase3(simple_v3_exchange_sha256 = Case, Config) ->
+ init_v3_testcase(Case, [{auth_alg, sha256} | Config]);
+init_per_testcase3(simple_v3_exchange_sha384 = Case, Config) ->
+ init_v3_testcase(Case, [{auth_alg, sha384} | Config]);
+init_per_testcase3(simple_v3_exchange_sha512 = Case, Config) ->
+ init_v3_testcase(Case, [{auth_alg, sha512} | Config]);
init_per_testcase3(Case, Config) ->
ApiCases02 =
[
@@ -744,8 +744,8 @@ init_per_testcase3(Case, Config) ->
end,
%% We don't need to try catch this (init_agent)
%% since we have a try catch "higher up"...
- Conf3 = init_agent(Conf2),
- Conf4 = try init_manager(AutoInform, Conf3)
+ Conf3 = init_agent(Case, Conf2),
+ Conf4 = try init_manager(Case, AutoInform, Conf3)
catch AC:AE:_ ->
%% Ouch we need to clean up:
%% The init_agent starts an agent node!
@@ -771,9 +771,9 @@ init_per_testcase3(Case, Config) ->
Config
end.
-init_v3_testcase(Conf) ->
- Conf2 = init_v3_agent(Conf),
- Conf3 = try init_v3_manager(Conf2)
+init_v3_testcase(Case, Conf) ->
+ Conf2 = init_v3_agent(Case, Conf),
+ Conf3 = try init_v3_manager(Case, Conf2)
catch AC:AE:AS ->
%% Ouch we need to clean up:
%% The init_agent starts an agent node!
@@ -896,7 +896,6 @@ end_per_testcase2(Case, Config) ->
%% Test functions
%%======================================================================
-simple_start_and_stop1(suite) -> [];
simple_start_and_stop1(Config) when is_list(Config) ->
?TC_TRY(simple_start_and_stop1,
fun() -> do_simple_start_and_stop1(Config) end).
@@ -930,17 +929,16 @@ do_simple_start_and_stop1(Config) ->
%%======================================================================
-simple_start_and_stop2(suite) -> [];
simple_start_and_stop2(Config) when is_list(Config) ->
Pre = fun() ->
- ManagerNode = start_manager_node(),
+ ManagerNode = start_node(simple_start_and_stop2),
[ManagerNode]
end,
Case = fun(State) -> do_simple_start_and_stop2(State, Config) end,
- Post = fun([ManagerNode]) -> stop_node(ManagerNode) end,
+ Post = fun([{ManagerPeer, _ManagerNode}]) -> peer:stop(ManagerPeer) end,
?TC_TRY(simple_start_and_stop2, Pre, Case, Post).
-do_simple_start_and_stop2([ManagerNode], Config) ->
+do_simple_start_and_stop2([{_ManagerPeer, ManagerNode}], Config) ->
?IPRINT("starting with Config: "
"~n ~p"
"~n", [Config]),
@@ -981,7 +979,6 @@ do_simple_start_and_stop2([ManagerNode], Config) ->
%%======================================================================
-simple_start_and_stop3(suite) -> [];
simple_start_and_stop3(Config) when is_list(Config) ->
?TC_TRY(simple_start_and_stop3,
fun() -> do_simple_start_and_stop3(Config) end).
@@ -1021,7 +1018,6 @@ do_simple_start_and_stop3(Config) ->
%%======================================================================
-simple_start_and_monitor_crash1(suite) -> [];
simple_start_and_monitor_crash1(Config) when is_list(Config) ->
?TC_TRY(simple_start_and_monitor_crash1,
fun() -> do_simple_start_and_monitor_crash1(Config) end).
@@ -1085,7 +1081,6 @@ do_simple_start_and_monitor_crash1(Config) ->
%%======================================================================
-simple_start_and_monitor_crash2(suite) -> [];
simple_start_and_monitor_crash2(Config) when is_list(Config) ->
Cond = fun() -> case os:type() of
{unix, netbsd} ->
@@ -1191,7 +1186,6 @@ simulate_crash(NumKills, _) ->
%%======================================================================
-notify_started01(suite) -> [];
notify_started01(Config) when is_list(Config) ->
?TC_TRY(notify_started01,
fun() -> do_notify_started01(Config) end).
@@ -1283,7 +1277,6 @@ snmpm_starter(Opts, To) ->
%%======================================================================
-notify_started02(suite) -> [];
notify_started02(Config) when is_list(Config) ->
?TC_TRY(notify_started02,
fun() -> notify_started02_cond(Config) end,
@@ -1509,7 +1502,6 @@ ns02_ctrl_loop(Opts, N) ->
%%======================================================================
-info(suite) -> [];
info(Config) when is_list(Config) ->
Pre = fun() ->
SCO = ?config(socket_create_opts, Config),
@@ -1612,7 +1604,6 @@ verify_info([{Key, SubKeys}|Keys], Info) ->
%% USM privacy fails with AES in OTP 22.2.3. Test to prevent
%% regression in future releases.
%%
-usm_priv_aes(suite) -> [];
usm_priv_aes(Config) when is_list(Config) ->
Pre = fun() ->
SCO = ?config(socket_create_opts, Config),
@@ -1645,7 +1636,6 @@ usm_priv_aes(Config) when is_list(Config) ->
%%======================================================================
-usm_sha224_priv_aes(suite) -> [];
usm_sha224_priv_aes(Config) when is_list(Config) ->
Pre = fun() ->
SCO = ?config(socket_create_opts, Config),
@@ -1678,7 +1668,6 @@ usm_sha224_priv_aes(Config) when is_list(Config) ->
%%======================================================================
-usm_sha256_priv_aes(suite) -> [];
usm_sha256_priv_aes(Config) when is_list(Config) ->
Pre = fun() ->
SCO = ?config(socket_create_opts, Config),
@@ -1711,7 +1700,6 @@ usm_sha256_priv_aes(Config) when is_list(Config) ->
%%======================================================================
-usm_sha384_priv_aes(suite) -> [];
usm_sha384_priv_aes(Config) when is_list(Config) ->
Pre = fun() ->
SCO = ?config(socket_create_opts, Config),
@@ -1744,7 +1732,6 @@ usm_sha384_priv_aes(Config) when is_list(Config) ->
%%======================================================================
-usm_sha512_priv_aes(suite) -> [];
usm_sha512_priv_aes(Config) when is_list(Config) ->
Pre = fun() ->
SCO = ?config(socket_create_opts, Config),
@@ -1921,17 +1908,16 @@ do_usm_priv_aes(AuthAlg, Config) ->
%%======================================================================
-register_user1(suite) -> [];
register_user1(Config) when is_list(Config) ->
Pre = fun() ->
- ManagerNode = start_manager_node(),
+ ManagerNode = start_node(register_user1),
[ManagerNode]
end,
Case = fun(State) -> do_register_user1(State, Config) end,
- Post = fun([ManagerNode]) -> stop_node(ManagerNode) end,
+ Post = fun([{ManagerPeer, _ManagerNode}]) -> peer:stop(ManagerPeer) end,
?TC_TRY(register_user1, Pre, Case, Post).
-do_register_user1([ManagerNode], Config) ->
+do_register_user1([{_ManagerPeer, ManagerNode}], Config) ->
?IPRINT("starting with Config: "
"~n ~p"
"~n", [Config]),
@@ -2019,20 +2005,19 @@ verify_users(ActualUsers0, [User|RegUsers]) ->
%%======================================================================
-register_agent_old(doc) ->
- ["Test registration of agents with the OLD interface functions"];
-register_agent_old(suite) ->
- [];
+register_agent_old() ->
+ [{doc, "Test registration of agents with the OLD interface functions"}].
+
register_agent_old(Config) when is_list(Config) ->
Pre = fun() ->
- ManagerNode = start_manager_node(),
+ ManagerNode = start_node(register_agent_old),
[ManagerNode]
end,
Case = fun(State) -> do_register_agent_old(State, Config) end,
- Post = fun([ManagerNode]) -> stop_node(ManagerNode) end,
+ Post = fun([{ManagerPeer, _ManagerNode}]) -> peer:stop(ManagerPeer) end,
?TC_TRY(register_agent_old, Pre, Case, Post).
-do_register_agent_old([ManagerNode], Config) ->
+do_register_agent_old([{_ManagerPeer, ManagerNode}], Config) ->
?IPRINT("starting with Config: "
"~n ~p"
"~n", [Config]),
@@ -2154,20 +2139,19 @@ do_register_agent_old([ManagerNode], Config) ->
%%======================================================================
-register_agent2(doc) ->
- ["Test registration of agents with the NEW interface functions"];
-register_agent2(suite) ->
- [];
+register_agent2() ->
+ [{doc, "Test registration of agents with the NEW interface functions"}].
+
register_agent2(Config) when is_list(Config) ->
Pre = fun() ->
- ManagerNode = start_manager_node(),
+ ManagerNode = start_node(register_agent2),
[ManagerNode]
end,
Case = fun(State) -> do_register_agent2(State, Config) end,
- Post = fun([ManagerNode]) -> stop_node(ManagerNode) end,
+ Post = fun([{ManagerPeer, _ManagerNode}]) -> peer:stop(ManagerPeer) end,
?TC_TRY(register_agent2, Pre, Case, Post).
-do_register_agent2([ManagerNode], Config) ->
+do_register_agent2([{_ManagerPeer, ManagerNode}], Config) ->
?IPRINT("starting with Config: "
"~n ~p", [Config]),
@@ -2299,21 +2283,20 @@ do_register_agent2([ManagerNode], Config) ->
%%======================================================================
-register_agent3(doc) ->
- ["Test registration of agents with the NEW interface functions "
- "and specifying transport domain"];
-register_agent3(suite) ->
- [];
+register_agent3() ->
+ [{doc, "Test registration of agents with the NEW interface functions "
+ "and specifying transport domain"}].
+
register_agent3(Config) when is_list(Config) ->
Pre = fun() ->
- ManagerNode = start_manager_node(),
+ ManagerNode = start_node(register_agent3),
[ManagerNode]
end,
Case = fun(State) -> do_register_agent3(State, Config) end,
- Post = fun([ManagerNode]) -> stop_node(ManagerNode) end,
+ Post = fun([{ManagerPeer, _ManagerNode}]) -> peer:stop(ManagerPeer) end,
?TC_TRY(register_agent3, Pre, Case, Post).
-do_register_agent3([ManagerNode], Config) ->
+do_register_agent3([{_ManagerPeer, ManagerNode}], Config) ->
?IPRINT("starting with Config: "
"~n ~p", [Config]),
@@ -2451,9 +2434,9 @@ do_register_agent3([ManagerNode], Config) ->
%%======================================================================
-simple_sync_get3(doc) ->
- ["Simple sync get-request - Version 3 API (TargetName and send-opts)"];
-simple_sync_get3(suite) -> [];
+simple_sync_get3() ->
+ [{doc, "Simple sync get-request - Version 3 API (TargetName and send-opts)"}].
+
simple_sync_get3(Config) when is_list(Config) ->
?TC_TRY(simple_sync_get3,
fun() -> do_simple_sync_get3(Config) end).
@@ -2582,9 +2565,9 @@ sag_verify_vbs([Vb|_], [E|_]) ->
%%======================================================================
-simple_async_get3(doc) ->
- ["Simple (async) get-request - Version 3 API (TargetName and send-opts)"];
-simple_async_get3(suite) -> [];
+simple_async_get3() ->
+ [{doc, "Simple (async) get-request - Version 3 API (TargetName and send-opts)"}].
+
simple_async_get3(Config) when is_list(Config) ->
?TC_TRY(simple_async_get3,
fun() -> do_simple_async_get3(Config) end).
@@ -2715,10 +2698,10 @@ check_ssgn_vbs([Vb|_], [E|_]) ->
%%======================================================================
-simple_sync_get_next3(doc) ->
- ["Simple (sync) get_next-request - "
- "Version 3 API (TargetName with send-opts)"];
-simple_sync_get_next3(suite) -> [];
+simple_sync_get_next3() ->
+ [{doc, "Simple (sync) get_next-request - "
+ "Version 3 API (TargetName with send-opts)"}].
+
simple_sync_get_next3(Config) when is_list(Config) ->
process_flag(trap_exit, true),
put(tname, ssgn3),
@@ -2850,24 +2833,24 @@ do_simple_get_next(N, Node, TargetName, Oids, Verify, GetNext, PostVerify) ->
%%======================================================================
-simple_async_get_next3_cbp_def(doc) ->
- ["Simple (async) get_next-request - "
- "Version 3 API (TargetName with send-opts)"];
-simple_async_get_next3_cbp_def(suite) -> [];
+simple_async_get_next3_cbp_def() ->
+ [{doc, "Simple (async) get_next-request - "
+ "Version 3 API (TargetName with send-opts)"}].
+
simple_async_get_next3_cbp_def(Config) when is_list(Config) ->
simple_async_get_next3(ssgn2_cbp_def, Config).
-simple_async_get_next3_cbp_temp(doc) ->
- ["Simple (async) get_next-request - "
- "Version 3 API (TargetName with send-opts)"];
-simple_async_get_next3_cbp_temp(suite) -> [];
+simple_async_get_next3_cbp_temp() ->
+ [{doc, "Simple (async) get_next-request - "
+ "Version 3 API (TargetName with send-opts)"}].
+
simple_async_get_next3_cbp_temp(Config) when is_list(Config) ->
simple_async_get_next3(ssgn2_cbp_temp, Config).
-simple_async_get_next3_cbp_perm(doc) ->
- ["Simple (async) get_next-request - "
- "Version 3 API (TargetName with send-opts)"];
-simple_async_get_next3_cbp_perm(suite) -> [];
+simple_async_get_next3_cbp_perm() ->
+ [{doc, "Simple (async) get_next-request - "
+ "Version 3 API (TargetName with send-opts)"}].
+
simple_async_get_next3_cbp_perm(Config) when is_list(Config) ->
simple_async_get_next3(ssgn2_cbp_perm, Config).
@@ -3012,9 +2995,9 @@ value_of_vavs([{_Oid, Val}|VAVs], Acc) ->
%%======================================================================
-simple_sync_set3(doc) ->
- ["Simple (sync) set-request - Version 3 API (TargetName with send-opts)"];
-simple_sync_set3(suite) -> [];
+simple_sync_set3() ->
+ [{doc, "Simple (sync) set-request - Version 3 API (TargetName with send-opts)"}].
+
simple_sync_set3(Config) when is_list(Config) ->
?TC_TRY(simple_sync_set3,
fun() -> do_simple_sync_set3(Config) end).
@@ -3127,21 +3110,21 @@ sas_verify_vbs([Vb|_], [E|_]) ->
%%======================================================================
-simple_async_set3_cbp_def(doc) ->
- ["Simple (async) set-request - Version 3 API (TargetName with send-opts)"];
-simple_async_set3_cbp_def(suite) -> [];
+simple_async_set3_cbp_def() ->
+ [{doc, "Simple (async) set-request - Version 3 API (TargetName with send-opts)"}].
+
simple_async_set3_cbp_def(Config) when is_list(Config) ->
simple_async_set3(sas3_cbp_def, Config).
-simple_async_set3_cbp_temp(doc) ->
- ["Simple (async) set-request - Version 3 API (TargetName with send-opts)"];
-simple_async_set3_cbp_temp(suite) -> [];
+simple_async_set3_cbp_temp() ->
+ [{doc, "Simple (async) set-request - Version 3 API (TargetName with send-opts)"}].
+
simple_async_set3_cbp_temp(Config) when is_list(Config) ->
simple_async_set3(sas3_cbp_temp, Config).
-simple_async_set3_cbp_perm(doc) ->
- ["Simple (async) set-request - Version 3 API (TargetName with send-opts)"];
-simple_async_set3_cbp_perm(suite) -> [];
+simple_async_set3_cbp_perm() ->
+ [{doc, "Simple (async) set-request - Version 3 API (TargetName with send-opts)"}].
+
simple_async_set3_cbp_perm(Config) when is_list(Config) ->
simple_async_set3(sas3_cbp_perm, Config).
@@ -3270,10 +3253,10 @@ check_ssgb_vbs([R|_], [E|_]) ->
%%======================================================================
-simple_sync_get_bulk3(doc) ->
- ["Simple (sync) get_bulk-request - "
- "Version 3 API (TargetName with send-opts)"];
-simple_sync_get_bulk3(suite) -> [];
+simple_sync_get_bulk3() ->
+ [{doc, "Simple (sync) get_bulk-request - "
+ "Version 3 API (TargetName with send-opts)"}].
+
simple_sync_get_bulk3(Config) when is_list(Config) ->
?TC_TRY(simple_sync_get_bulk3,
fun() -> do_simple_sync_get_bulk3(Config) end).
@@ -3440,10 +3423,10 @@ do_simple_get_bulk3(N,
%%======================================================================
-simple_async_get_bulk3_cbp_def(doc) ->
- ["Simple (async) get_bulk-request - "
- "Version 3 API (TargetName with send-opts)"];
-simple_async_get_bulk3_cbp_def(suite) -> [];
+simple_async_get_bulk3_cbp_def() ->
+ [{doc, "Simple (async) get_bulk-request - "
+ "Version 3 API (TargetName with send-opts)"}].
+
simple_async_get_bulk3_cbp_def(Config) when is_list(Config) ->
simple_async_get_bulk3(sagb3_cbp_def, Config).
@@ -3618,59 +3601,59 @@ async_gb_exec3(Node, TargetName, {NR, MR, Oids}, SendOpts) ->
%%======================================================================
-simple_async_get_bulk3_cbp_temp(doc) ->
- ["Simple (async) get_bulk-request - "
- "Version 3 API (TargetName with send-opts)"];
-simple_async_get_bulk3_cbp_temp(suite) -> [];
+simple_async_get_bulk3_cbp_temp() ->
+ [{doc, "Simple (async) get_bulk-request - "
+ "Version 3 API (TargetName with send-opts)"}].
+
simple_async_get_bulk3_cbp_temp(Config) when is_list(Config) ->
simple_async_get_bulk3(sagb3_cbp_temp, Config).
%%======================================================================
-simple_async_get_bulk3_cbp_perm(doc) ->
- ["Simple (async) get_bulk-request - "
- "Version 3 API (TargetName with send-opts)"];
-simple_async_get_bulk3_cbp_perm(suite) -> [];
+simple_async_get_bulk3_cbp_perm() ->
+ [{doc, "Simple (async) get_bulk-request - "
+ "Version 3 API (TargetName with send-opts)"}].
+
simple_async_get_bulk3_cbp_perm(Config) when is_list(Config) ->
simple_async_get_bulk3(sagb3_cbp_perm, Config).
%%======================================================================
-simple_v3_exchange_md5(doc) ->
- ["Simple message exchange using v3 (MD5) messages"];
-simple_v3_exchange_md5(suite) -> [];
+simple_v3_exchange_md5() ->
+ [{doc, "Simple message exchange using v3 (MD5) messages"}].
+
simple_v3_exchange_md5(Config) when is_list(Config) ->
simple_v3_exchange(Config).
-simple_v3_exchange_sha(doc) ->
- ["Simple message exchange using v3 (SHA) messages"];
-simple_v3_exchange_sha(suite) -> [];
+simple_v3_exchange_sha() ->
+ [{doc, "Simple message exchange using v3 (SHA) messages"}].
+
simple_v3_exchange_sha(Config) when is_list(Config) ->
simple_v3_exchange(Config).
-simple_v3_exchange_sha224(doc) ->
- ["Simple message exchange using v3 (SHA224) messages"];
-simple_v3_exchange_sha224(suite) -> [];
+simple_v3_exchange_sha224() ->
+ [{doc, "Simple message exchange using v3 (SHA224) messages"}].
+
simple_v3_exchange_sha224(Config) when is_list(Config) ->
simple_v3_exchange(Config).
-simple_v3_exchange_sha256(doc) ->
- ["Simple message exchange using v3 (SHA256) messages"];
-simple_v3_exchange_sha256(suite) -> [];
+simple_v3_exchange_sha256() ->
+ [{doc, "Simple message exchange using v3 (SHA256) messages"}].
+
simple_v3_exchange_sha256(Config) when is_list(Config) ->
simple_v3_exchange(Config).
-simple_v3_exchange_sha384(doc) ->
- ["Simple message exchange using v3 (SHA384) messages"];
-simple_v3_exchange_sha384(suite) -> [];
+simple_v3_exchange_sha384() ->
+ [{doc, "Simple message exchange using v3 (SHA384) messages"}].
+
simple_v3_exchange_sha384(Config) when is_list(Config) ->
simple_v3_exchange(Config).
-simple_v3_exchange_sha512(doc) ->
- ["Simple message exchange using v3 (SHA512) messages"];
-simple_v3_exchange_sha512(suite) -> [];
+simple_v3_exchange_sha512() ->
+ [{doc, "Simple message exchange using v3 (SHA512) messages"}].
+
simple_v3_exchange_sha512(Config) when is_list(Config) ->
simple_v3_exchange(Config).
@@ -3707,7 +3690,6 @@ simple_v3_exchange(Config) when is_list(Config) ->
%%======================================================================
-discovery(suite) -> [];
discovery(Config) when is_list(Config) ->
?SKIP(not_yet_implemented).
@@ -3772,7 +3754,6 @@ verify_trap(Trap, [{Id, Verifier}|Verifiers]) ->
%%======================================================================
-trap1(suite) -> [];
trap1(Config) when is_list(Config) ->
?TC_TRY(trap1,
fun() -> do_trap1(Config) end).
@@ -3933,7 +3914,6 @@ do_trap1(Config) ->
%%======================================================================
-trap2(suite) -> [];
trap2(Config) when is_list(Config) ->
?TC_TRY(trap2,
fun() -> do_trap2(Config) end).
@@ -4132,7 +4112,6 @@ do_trap2(Config) ->
%%======================================================================
-inform1(suite) -> [];
inform1(Config) when is_list(Config) ->
?TC_TRY(inform1,
fun() -> do_inform1(Config) end).
@@ -4266,7 +4245,6 @@ do_inform1(Config) ->
%%======================================================================
-inform2(suite) -> [];
inform2(Config) when is_list(Config) ->
?TC_TRY(inform2,
fun() -> do_inform2(Config) end).
@@ -4444,7 +4422,6 @@ do_inform2(Config) ->
%%======================================================================
-inform3(suite) -> [];
inform3(Config) when is_list(Config) ->
?TC_TRY(inform3,
fun() -> do_inform3(Config) end).
@@ -4584,7 +4561,6 @@ do_inform3(Config) ->
%%======================================================================
-inform4(suite) -> [];
inform4(Config) when is_list(Config) ->
?TC_TRY(inform4,
fun() -> do_inform4(Config) end).
@@ -4709,15 +4685,12 @@ do_inform4(Config) ->
%%
%% Test: ts:run(snmp, snmp_manager_test, inform_swarm_cbp_def, [batch]).
-inform_swarm_cbp_def(suite) -> [];
inform_swarm_cbp_def(Config) when is_list(Config) ->
inform_swarm(is_cbp_def, 1500, Config).
-inform_swarm_cbp_temp(suite) -> [];
inform_swarm_cbp_temp(Config) when is_list(Config) ->
inform_swarm(is_cbp_temp, 1500, Config).
-inform_swarm_cbp_perm(suite) -> [];
inform_swarm_cbp_perm(Config) when is_list(Config) ->
inform_swarm(is_cbp_perm, 1800, Config).
@@ -4900,7 +4873,6 @@ inform_swarm_collector(N, SentAckCnt, RecvCnt, RespCnt, Timeout) ->
%%======================================================================
-report(suite) -> [];
report(Config) when is_list(Config) ->
?SKIP(not_yet_implemented).
@@ -4908,8 +4880,9 @@ report(Config) when is_list(Config) ->
%%======================================================================
-otp8015_1(doc) -> ["OTP-8015:1 - testing the new api-function."];
-otp8015_1(suite) -> [];
+otp8015_1() ->
+ [{doc, "OTP-8015:1 - testing the new api-function."}].
+
otp8015_1(Config) when is_list(Config) ->
Pre = fun() ->
SCO = ?config(socket_create_opts, Config),
@@ -4965,8 +4938,9 @@ do_otp8015_1(Config) ->
%%======================================================================
-otp8395_1(doc) -> ["OTP-8395:1 - simple get with ATL sequence numbering."];
-otp8395_1(suite) -> [];
+otp8395_1() ->
+ [{doc, "OTP-8395:1 - simple get with ATL sequence numbering."}].
+
otp8395_1(Config) when is_list(Config) ->
?TC_TRY(otp8395_1,
fun() -> do_otp8395_1(Config) end).
@@ -5089,7 +5063,7 @@ command_handler([{No, Desc, Cmd}|Cmds]) ->
%% -- Misc manager functions --
-init_manager(AutoInform, Config) ->
+init_manager(Case, AutoInform, Config) ->
?IPRINT("init_manager -> entry with"
"~n AutoInform: ~p"
@@ -5099,7 +5073,7 @@ init_manager(AutoInform, Config) ->
%% Start node
%%
- ?line Node = start_manager_node(),
+ {Peer, Node} = start_node(lists:concat([Case, "-mgr"])),
%% The point with this (try catch block) is to be
%% able to do some cleanup in case we fail to
@@ -5128,7 +5102,7 @@ init_manager(AutoInform, Config) ->
_ ->
user
end,
- Conf = [{manager_node, Node}, {irb, IRB} | Config],
+ Conf = [{manager_node, Node}, {manager_peer, Peer}, {irb, IRB} | Config],
Vsns = [v1,v2,v3],
start_manager(Node, Vsns, Conf)
end
@@ -5138,7 +5112,7 @@ init_manager(AutoInform, Config) ->
"~n Reason: ~p"
"~n StackTrace: ~p", [Reason, S]),
%% And now, *try* to cleanup
- (catch stop_node(Node)),
+ (catch peer:stop(Peer)),
erlang:raise(C, E, S);
C:E:S ->
?EPRINT("Failure during manager start: "
@@ -5146,11 +5120,11 @@ init_manager(AutoInform, Config) ->
"~n Error: ~p"
"~n StackTrace: ~p", [C, E, S]),
%% And now, *try* to cleanup
- (catch stop_node(Node)),
+ (catch peer:stop(Peer)),
?FAIL({failed_starting_manager, C, E, S})
end.
-init_v3_manager(Config) ->
+init_v3_manager(Case, Config) ->
?IPRINT("init_v3_manager -> entry with"
"~n Config: ~p", [Config]),
@@ -5159,8 +5133,7 @@ init_v3_manager(Config) ->
%% Start node
%%
- %% ?line Node = self(),
- ?line Node = start_unique_manager_node(),
+ {Peer, Node} = start_node(lists:concat([Case, "-v3mgr"])),
%% The point with this (try catch block) is to be
%% able to do some cleanup in case we fail to
@@ -5186,7 +5159,7 @@ init_v3_manager(Config) ->
?line ok = write_manager_config(transport, Config),
IRB = auto,
- Conf = [{manager_node, Node}, {irb, IRB} | Config],
+ Conf = [{manager_node, Node}, {manager_peer, Peer}, {irb, IRB} | Config],
Vsns = [v3],
start_manager(Node, Vsns, Conf)
end
@@ -5196,7 +5169,7 @@ init_v3_manager(Config) ->
"~n Reason: ~p"
"~n StackTrace: ~p", [Reason, S]),
%% And now, *try* to cleanup
- (catch stop_node(Node)),
+ (catch peer:stop(Peer)),
erlang:raise(C, E, S);
C:E:S ->
?EPRINT("Failure during manager start: "
@@ -5204,7 +5177,7 @@ init_v3_manager(Config) ->
"~n Error: ~p"
"~n StackTrace: ~p", [C, E, S]),
%% And now, *try* to cleanup
- (catch stop_node(Node)),
+ (catch peer:stop(Peer)),
?FAIL({failed_starting_manager, C, E, S})
end.
@@ -5215,7 +5188,7 @@ fin_manager(Config) ->
Node = ?config(manager_node, Config),
StopMgrRes = stop_manager(Node),
StopCryptoRes = fin_crypto(Node),
- StopNode = stop_node(Node),
+ StopNode = peer:stop(?config(manager_peer, Config)),
?IPRINT("fin_manager -> stop apps and (mgr node ~p) node results: "
"~n SNMP Mgr: ~p"
"~n Crypto: ~p"
@@ -5226,7 +5199,7 @@ fin_manager(Config) ->
%% -- Misc agent functions --
-init_agent(Config) ->
+init_agent(Case, Config) ->
?IPRINT("init_agent -> entry with"
"~n Config: ~p", [Config]),
@@ -5240,7 +5213,7 @@ init_agent(Config) ->
%% Start node
%%
- ?line Node = start_agent_node(),
+ {Peer, Node} = start_node(lists:concat([Case, "-agent"])),
%% The point with this (try catch block) is to be
%% able to do some cleanup in case we fail to
@@ -5272,7 +5245,7 @@ init_agent(Config) ->
Vsns = [v1,v2],
?line ok = write_agent_config(Vsns, Config),
- Conf = [{agent_node, Node},
+ Conf = [{agent_node, Node}, {agent_peer, Peer},
{mib_dir, MibDir} | Config],
%%
@@ -5287,7 +5260,7 @@ init_agent(Config) ->
"~n Reason: ~p"
"~n StackTrace: ~p", [Reason, S]),
%% And now, *try* to cleanup
- (catch stop_node(Node)),
+ (catch peer:stop(Peer)),
erlang:raise(C, E, S);
C:E:S ->
?EPRINT("Failure during agent start: "
@@ -5295,12 +5268,12 @@ init_agent(Config) ->
"~n Error: ~p"
"~n StackTrace: ~p", [C, E, S]),
%% And now, *try* to cleanup
- (catch stop_node(Node)),
+ (catch peer:stop(Peer)),
?FAIL({failed_starting_agent, C, E, S})
end.
-init_v3_agent(Config) ->
+init_v3_agent(Case, Config) ->
?IPRINT("init_v3_agent -> entry with"
"~n Config: ~p", [Config]),
@@ -5315,7 +5288,7 @@ init_v3_agent(Config) ->
%%
%% ?line Node = self(),
- ?line Node = start_unique_agent_node(),
+ ?line {Peer, Node} = start_node(lists:concat([Case, "-v3agent"])),
%% The point with this (try catch block) is to be
%% able to do some cleanup in case we fail to
@@ -5340,7 +5313,7 @@ init_v3_agent(Config) ->
Vsns = [v3],
?line ok = write_agent_config(Vsns, Config),
- Conf = [{agent_node, Node},
+ Conf = [{agent_node, Node}, {agent_peer, Peer},
{mib_dir, MibDir} | Config],
%%
@@ -5355,7 +5328,7 @@ init_v3_agent(Config) ->
"~n Reason: ~p"
"~n StackTrace: ~p", [Reason, S]),
%% And now, *try* to cleanup
- (catch stop_node(Node)),
+ (catch peer:stop(Peer)),
erlang:raise(C, E, S);
C:E:S ->
?EPRINT("Failure during agent start: "
@@ -5363,7 +5336,7 @@ init_v3_agent(Config) ->
"~n Error: ~p"
"~n StackTrace: ~p", [C, E, S]),
%% And now, *try* to cleanup
- (catch stop_node(Node)),
+ (catch peer:stop(Peer)),
?FAIL({failed_starting_agent, C, E, S})
end.
@@ -5373,7 +5346,7 @@ fin_agent(Config) ->
StopAgentRes = stop_agent(Node),
StopCryptoRes = fin_crypto(Node),
StopMnesiaRes = fin_mnesia(Node),
- StopNode = stop_node(Node),
+ StopNode = peer:stop(?config(agent_peer, Config)),
?IPRINT("fin_agent -> stop apps and (agent node ~p) node results: "
"~n SNMP Agent: ~p"
"~n Crypto: ~p"
@@ -5386,7 +5359,7 @@ fin_v3_agent(Config) ->
Node = ?config(agent_node, Config),
StopAgentRes = stop_agent(Node),
StopCryptoRes = fin_crypto(Node),
- StopNode = stop_node(Node),
+ StopNode = peer:stop(?config(agent_peer, Config)),
?IPRINT("fin_agent -> stop apps and (agent node ~p) node results: "
"~n SNMP Agent: ~p"
"~n Crypto: ~p"
@@ -6100,87 +6073,12 @@ agent_info(Node) ->
%% -- Misc node operation wrapper functions --
-unique(PreName) ->
- list_to_atom(?F("~w_~w", [PreName, erlang:system_time(millisecond)])).
-
-start_agent_node() ->
- start_node(snmp_agent).
-
-start_unique_agent_node() ->
- start_unique_node(snmp_agent).
-
-start_manager_node() ->
- start_node(snmp_manager).
-
-start_unique_manager_node() ->
- start_unique_node(snmp_manager).
-
-%% Generate a "unique" (node-) name and start a node with this name.
-start_unique_node(BaseName) when is_atom(BaseName) ->
- start_node(unique(BaseName), false).
-
-start_node(Name) ->
- start_node(Name, true).
-start_node(Name, Retry) ->
-
- ?IPRINT("start_node -> entry with"
- "~n Name: ~p"
- "~n when"
- "~n hostname of this node: ~p",
- [Name, list_to_atom(?HOSTNAME(node()))]),
-
- Pa = filename:dirname(code:which(?MODULE)),
-
- A = " -pa " ++ Pa ++
- " -s " ++ atom_to_list(snmp_test_sys_monitor) ++ " start" ++
- " -s global sync",
- try ?START_NODE(Name, A) of
- {ok, Node} ->
- global:sync(),
- Node;
- {error, timeout} ->
- ?EPRINT("Failed starting node ~p: timeout", [Name]),
- ?line ?FAIL({error_starting_node, Name, timeout});
- {error, {already_running, Node}} when (Retry =:= true) ->
- %% Ouch
- %% Either we previously failed to (properly) stop the node
- %% or it was a failed start, that reported failure (for instance
- %% timeout) but actually succeeded. Regardless, we don't know
- %% the state of this node, so (try) stop it and then (re-) try
- %% start again.
- ?WPRINT("Failed starting node ~p: Already Running - try stop", [Node]),
- case ?STOP_NODE(Node) of
- true ->
- ?IPRINT("Successfully stopped old node ~p", [Node]),
- start_node(Name, false);
- false ->
- ?EPRINT("Failed stop old node ~p", [Node]),
- ?line ?FAIL({error_starting_node, Node, Retry, already_running})
- end;
- {error, {already_running, Node}} ->
- ?EPRINT("Failed starting node ~p: Already Running", [Node]),
- ?line ?FAIL({error_starting_node, Node, Retry, already_running});
- {error, Reason} ->
- ?EPRINT("Failed starting node ~p: ~p", [Name, Reason]),
- ?line ?FAIL({error_starting_node, Name, Reason})
- catch
- exit:{suite_failed, Reason} ->
- ?EPRINT("(suite) Failed starting node ~p: ~p", [Name, Reason]),
- ?line ?FAIL({failed_starting_node, Name, Reason})
- end.
-
-
-stop_node(Node) when (Node =:= self()) ->
- ok;%?line ?FAIL({stop_own_node, Node});
-stop_node(Node) ->
- case ?STOP_NODE(Node) of
- true ->
- ok;
- false ->
- ?line ?FAIL({failed_stop_node, Node})
- end.
-
-
+start_node(Case) ->
+ Args = ["-s", "snmp_test_sys_monitor", "start", "-s", "global", "sync"],
+ Name = peer:random_name(lists:concat([?MODULE, "-", Case])),
+ {ok, Peer, Node} = ?CT_PEER(#{name => Name, args => Args}),
+ global:sync(),
+ {Peer, Node}.
%% -- Misc config wrapper functions --
diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl
index 52355b9a19..89ee9aea33 100644
--- a/lib/snmp/test/snmp_test_lib.erl
+++ b/lib/snmp/test/snmp_test_lib.erl
@@ -41,8 +41,7 @@
-export([hours/1, minutes/1, seconds/1, sleep/1]).
-export([flush_mqueue/0, mqueue/0, mqueue/1, trap_exit/0, trap_exit/1]).
-export([ping/1, local_nodes/0, nodes_on/1]).
--export([start_node/2, stop_node/1]).
--export([is_app_running/1,
+-export([is_app_running/1,
is_crypto_running/0, is_mnesia_running/0, is_snmp_running/0,
ensure_not_running/3]).
-export([crypto_start/0, crypto_support/0]).
@@ -2468,15 +2467,6 @@ nodes_on(Host) when is_list(Host) ->
net_adm:world_list([list_to_atom(Host)]).
-start_node(Name, Args) ->
- Opts = [{cleanup, false}, {args, Args}],
- test_server:start_node(Name, peer, Opts).
-
-
-stop_node(Node) ->
- test_server:stop_node(Node).
-
-
%% ----------------------------------------------------------------
%% Application and Crypto utility functions
%%
diff --git a/lib/snmp/test/snmp_test_lib.hrl b/lib/snmp/test/snmp_test_lib.hrl
index ea7732eba8..0678696c04 100644
--- a/lib/snmp/test/snmp_test_lib.hrl
+++ b/lib/snmp/test/snmp_test_lib.hrl
@@ -103,9 +103,6 @@
-define(PING(N), ?LIB:ping(N)).
-define(LNODES(), ?LIB:local_nodes()).
-define(NODES(H), ?LIB:nodes_on(H)).
--define(START_NODE(N,A), ?LIB:start_node(N,A)).
--define(STOP_NODE(N), ?LIB:stop_node(N)).
-
%% - Application and Crypto utility macros -
@@ -158,3 +155,8 @@
-define(FTS(), snmp_misc:formated_timestamp()).
-define(FTS(TS), snmp_misc:format_timestamp(TS)).
+%% This needs to be a macro-definition to capture ?FUNCTION_NAME and ?MODULE.
+-define (START_PEER(Kind), ?CT_PEER(#{
+ name => ?CT_PEER_NAME(atom_to_list(?FUNCTION_NAME) ++ Kind),
+ args => ["-s", "snmp_test_sys_monitor", "start", "-s", "global", "sync"]
+})).