diff options
Diffstat (limited to 'lib/snmp/test/snmp_agent_SUITE.erl')
-rw-r--r-- | lib/snmp/test/snmp_agent_SUITE.erl | 2200 |
1 files changed, 1050 insertions, 1150 deletions
diff --git a/lib/snmp/test/snmp_agent_SUITE.erl b/lib/snmp/test/snmp_agent_SUITE.erl index bf942715cd..36c47f00f1 100644 --- a/lib/snmp/test/snmp_agent_SUITE.erl +++ b/lib/snmp/test/snmp_agent_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2022. All Rights Reserved. +%% Copyright Ericsson AB 2003-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -524,10 +524,11 @@ suite() -> [{ct_hooks, [ts_install_cth]}]. all() -> - %% This is a temporary messure to ensure that we can + %% This is a temporary measure to ensure that we can %% test the socket backend without effecting *all* %% applications on *all* machines. %% This flag is set only for *one* host. + %% case ?TEST_INET_BACKENDS() of case ?TEST_INET_BACKENDS() of true -> [ @@ -679,8 +680,8 @@ otp16649_gen_cases() -> init_per_suite(Config0) when is_list(Config0) -> ?IPRINT("init_per_suite -> entry with" - "~n Config: ~p" - "~n Nodes: ~p" + "~n Config: ~p" + "~n Nodes: ~p" "~n explicit inet backend: ~p" "~n test inet backends: ~p", [Config0, erlang:nodes(), @@ -709,7 +710,7 @@ init_per_suite(Config0) when is_list(Config0) -> ?IPRINT("init_per_suite -> end when" "~n Config: ~p" "~n Nodes: ~p", [Config4, erlang:nodes()]), - + Config4 end. @@ -721,7 +722,7 @@ end_per_suite(Config0) when is_list(Config0) -> case snmp_test_mgr_counter_server:stop() of {ok, Counters} -> - ?IPRINT("end_per_suite -> sucessfully stopped counter server" + ?IPRINT("end_per_suite -> successfully stopped counter server" "~n Counters: ~p", [Counters]); {error, Reason} -> @@ -761,25 +762,56 @@ init_per_group(GroupName, Config0) -> Config1. -init_per_group2(inet_backend_default = _GroupName, Config) -> - snmp_test_lib:init_group_top_dir(default, [{socket_create_opts, []} | Config]); -init_per_group2(inet_backend_inet = _GroupName, Config) -> +init_per_group2(inet_backend_default = _GroupName, Config0) -> + Config1 = [{socket_create_opts, []} | Config0], + case ?EXPLICIT_INET_BACKEND() of + true -> + ?LIB:init_group_top_dir(default, Config1); + false -> + %% For a "standard" test (that is if we do not run the "extended" + %% inet backends test) then we should always run this group! + %% So, if we have an extended test, *then* (and only then) + %% check the factor. + case ?TEST_INET_BACKENDS() of + true -> + case lists:keysearch(snmp_factor, 1, Config0) of + {value, {snmp_factor, Factor}} when (Factor < 3) -> + ?LIB:init_group_top_dir(default, Config1); + _ -> + {skip, "Machine too slow"} + end; + _ -> + ?LIB:init_group_top_dir(default, Config1) + end + end; +init_per_group2(inet_backend_inet = _GroupName, Config0) -> case ?EXPLICIT_INET_BACKEND() of true -> %% The environment trumps us, %% so only the default group should be run! {skip, "explicit inet backend"}; false -> - snmp_test_lib:init_group_top_dir(inet, [{socket_create_opts, [{inet_backend, inet}]} | Config]) + case lists:keysearch(snmp_factor, 1, Config0) of + {value, {snmp_factor, Factor}} when (Factor < 5) -> + Config1 = [{socket_create_opts, [{inet_backend, inet}]} | + Config0], + ?LIB:init_group_top_dir(inet, Config1); + _ -> + {skip, "Machine too slow"} + end end; -init_per_group2(inet_backend_socket = _GroupName, Config) -> +init_per_group2(inet_backend_socket = _GroupName, Config0) -> case ?EXPLICIT_INET_BACKEND() of true -> %% The environment trumps us, - %% so only the default group should be run! + %% so only the *default* group should be run! {skip, "explicit inet backend"}; false -> - snmp_test_lib:init_group_top_dir(socket, [{socket_create_opts, [{inet_backend, socket}]} | Config]) + %% Always run this unless a backend has been explicitly + %% configured (since this is really what we want to test). + Config1 = [{socket_create_opts, [{inet_backend, socket}]} | + Config0], + ?LIB:init_group_top_dir(socket, Config1) end; init_per_group2(major_tcs = GroupName, Config) -> init_all(snmp_test_lib:init_group_top_dir(GroupName, Config)); @@ -873,7 +905,7 @@ init_per_group2(GroupName, Config) -> init_per_group_ipv6(GroupName, Config, Init) -> %% <OS-CONDITIONAL-SKIP> - %% This is a higly questionable test. + %% This is a highly questionable test. %% But until we have time to figure out what IPv6 issues %% are actually causing the failures... OSSkipable = [{unix, @@ -1330,7 +1362,7 @@ stop_agent(Config) -> create_tables(SaNode) -> - %% ?line {atomic, ok} = mnesia:create_table([{name, friendsTable2}, + %% {atomic, ok} = mnesia:create_table([{name, friendsTable2}, %% {ram_copies, [SaNode]}, %% {snmp, [{key, integer}]}, %% {attributes, [a1,a2,a3]}]), @@ -1338,7 +1370,7 @@ create_tables(SaNode) -> {ram_copies, [SaNode]}, {snmp, [{key, integer}]}, {attributes, [a1,a2,a3]}]), - %% ?line {atomic, ok} = mnesia:create_table([{name, kompissTable2}, + %% {atomic, ok} = mnesia:create_table([{name, kompissTable2}, %% {ram_copies, [SaNode]}, %% {snmp, [{key, integer}]}, %% {attributes, [a1,a2,a3]}]), @@ -1346,7 +1378,7 @@ create_tables(SaNode) -> {ram_copies, [SaNode]}, {snmp, [{key, integer}]}, {attributes, [a1,a2,a3]}]), - %% ?line {atomic, ok} = mnesia:create_table([{name, snmp_variables}, + %% {atomic, ok} = mnesia:create_table([{name, snmp_variables}, %% {attributes, [a1,a2]}]), mnesia_create_table_or_fail([{name, snmp_variables}, {attributes, [a1,a2]}]), @@ -1526,14 +1558,14 @@ init_mib_storage_ets(Config) when is_list(Config) -> init_mib_storage_dets(Config) when is_list(Config) -> ?IPRINT("init_mib_storage_dets -> entry"), - ?line AgentDbDir = ?GCONF(agent_db_dir, Config), + AgentDbDir = ?GCONF(agent_db_dir, Config), MibStorage = {mib_storage, [{module, snmpa_mib_storage_dets}, {options, [{dir, AgentDbDir}]}]}, init_ms(Config, [MibStorage]). init_mib_storage_mnesia(Config) when is_list(Config) -> ?IPRINT("init_mib_storage_mnesia -> entry"), - ?line AgentNode = ?GCONF(snmp_master, Config), + AgentNode = ?GCONF(snmp_master, Config), MibStorage = {mib_storage, [{module, snmpa_mib_storage_mnesia}, {options, [{nodes, [AgentNode]}]}]}, init_ms(Config, [MibStorage]). @@ -1542,12 +1574,12 @@ init_ms(Config, Opts) when is_list(Config) -> ?IPRINT("init_ms -> entry with" "~n Config: ~p" "~n Opts: ~p", [Config, Opts]), - ?line SaNode = ?GCONF(snmp_sa, Config), - ?line create_tables(SaNode), - ?line AgentConfDir = ?GCONF(agent_conf_dir, Config), - ?line MgrDir = ?GCONF(mgr_dir, Config), - ?line Ip = ?GCONF(ip, Config), - ?line config([v1], MgrDir, AgentConfDir, + SaNode = ?GCONF(snmp_sa, Config), + create_tables(SaNode), + AgentConfDir = ?GCONF(agent_conf_dir, Config), + MgrDir = ?GCONF(mgr_dir, Config), + Ip = ?GCONF(ip, Config), + config([v1], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip)), MasterAgentVerbosity = {agent_verbosity, trace}, MibsVerbosity = {mib_server, [{verbosity, trace}]}, @@ -1566,7 +1598,7 @@ init_ms(Config, Opts) when is_list(Config) -> %% init_size_check_ms(Config, [MibStorage]). init_size_check_msm(Config) when is_list(Config) -> - ?line AgentNode = ?GCONF(snmp_master, Config), + AgentNode = ?GCONF(snmp_master, Config), MibStorage = {mib_storage, [{module, snmpa_mib_storage_mnesia}, {options, [{nodes, [AgentNode]}]}]}, init_size_check_ms(Config, [MibStorage]). @@ -1594,19 +1626,19 @@ init_size_check_ms(Config, Opts) when is_list(Config) -> AgentConfDir = ?GCONF(agent_conf_dir, Config), MgrDir = ?GCONF(mgr_dir, Config), Ip = ?GCONF(ip, Config), - ?line ok = config([v3], MgrDir, AgentConfDir, + ok = config([v3], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip)), [{vsn, v3} | start_v3_agent(Config, Opts)]. init_varm_mib_storage_dets(Config) when is_list(Config) -> ?IPRINT("init_varm_mib_storage_dets -> entry"), - ?line SaNode = ?GCONF(snmp_sa, Config), - ?line create_tables(SaNode), - ?line AgentDbDir = ?GCONF(agent_db_dir, Config), - ?line AgentConfDir = ?GCONF(agent_conf_dir, Config), - ?line MgrDir = ?GCONF(mgr_dir, Config), - ?line Ip = ?GCONF(ip, Config), - ?line config([v1], MgrDir, AgentConfDir, + SaNode = ?GCONF(snmp_sa, Config), + create_tables(SaNode), + AgentDbDir = ?GCONF(agent_db_dir, Config), + AgentConfDir = ?GCONF(agent_conf_dir, Config), + MgrDir = ?GCONF(mgr_dir, Config), + Ip = ?GCONF(ip, Config), + config([v1], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip)), MibStorage = {mib_storage, [{module, snmpa_mib_storage_dets}, {options, [{dir, AgentDbDir}]}]}, @@ -1621,14 +1653,14 @@ init_varm_mib_storage_dets(Config) when is_list(Config) -> init_varm_mib_storage_mnesia(Config) when is_list(Config) -> ?IPRINT("init_varm_mib_storage_mnesia -> entry"), - ?line SaNode = ?GCONF(snmp_sa, Config), - ?line create_tables(SaNode), - ?line AgentConfDir = ?GCONF(agent_conf_dir, Config), - ?line MgrDir = ?GCONF(mgr_dir, Config), - ?line Ip = ?GCONF(ip, Config), - ?line config([v1], MgrDir, AgentConfDir, + SaNode = ?GCONF(snmp_sa, Config), + create_tables(SaNode), + AgentConfDir = ?GCONF(agent_conf_dir, Config), + MgrDir = ?GCONF(mgr_dir, Config), + Ip = ?GCONF(ip, Config), + config([v1], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip)), - ?line AgentNode = ?GCONF(snmp_master, Config), + AgentNode = ?GCONF(snmp_master, Config), MibStorage = {mib_storage, [{module, snmpa_mib_storage_mnesia}, {options, [{nodes, [AgentNode]}]}]}, MasterAgentVerbosity = {agent_verbosity, trace}, @@ -1803,49 +1835,47 @@ 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), ?IPRINT("mib server size check..."), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), - ?line load_master_std("OTP-SNMPEA-MIB"), - ?line load_master_std("SNMP-COMMUNITY-MIB"), - ?line load_master_std("SNMP-FRAMEWORK-MIB"), - ?line load_master_std("SNMP-MPD-MIB"), - ?line load_master_std("SNMP-NOTIFICATION-MIB"), - ?line load_master_std("SNMP-TARGET-MIB"), - ?line load_master_std("SNMP-USER-BASED-SM-MIB"), - ?line load_master_std("SNMP-VIEW-BASED-ACM-MIB"), - ?line load_master_std("SNMPv2-MIB"), - ?line load_master_std("SNMPv2-TM"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), + load_master_std("OTP-SNMPEA-MIB"), + load_master_std("SNMP-COMMUNITY-MIB"), + load_master_std("SNMP-FRAMEWORK-MIB"), + load_master_std("SNMP-MPD-MIB"), + load_master_std("SNMP-NOTIFICATION-MIB"), + load_master_std("SNMP-TARGET-MIB"), + load_master_std("SNMP-USER-BASED-SM-MIB"), + load_master_std("SNMP-VIEW-BASED-ACM-MIB"), + load_master_std("SNMPv2-MIB"), + load_master_std("SNMPv2-TM"), ?SLEEP(2000), - ?line display_memory_usage(), + display_memory_usage(), - ?line unload_master("OTP-SNMPEA-MIB"), - ?line unload_master("SNMP-COMMUNITY-MIB"), - ?line unload_master("SNMP-FRAMEWORK-MIB"), - ?line unload_master("SNMP-MPD-MIB"), - ?line unload_master("SNMP-NOTIFICATION-MIB"), - ?line unload_master("SNMP-TARGET-MIB"), - ?line unload_master("SNMP-USER-BASED-SM-MIB"), - ?line unload_master("SNMP-VIEW-BASED-ACM-MIB"), - ?line unload_master("SNMPv2-MIB"), - ?line unload_master("SNMPv2-TM"), + unload_master("OTP-SNMPEA-MIB"), + unload_master("SNMP-COMMUNITY-MIB"), + unload_master("SNMP-FRAMEWORK-MIB"), + unload_master("SNMP-MPD-MIB"), + unload_master("SNMP-NOTIFICATION-MIB"), + unload_master("SNMP-TARGET-MIB"), + unload_master("SNMP-USER-BASED-SM-MIB"), + unload_master("SNMP-VIEW-BASED-ACM-MIB"), + unload_master("SNMPv2-MIB"), + unload_master("SNMPv2-TM"), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), ok. -varm_mib_start(suite) -> []; varm_mib_start(Config) when is_list(Config) -> ?P(varm_mib_start), ?IPRINT("varm_mib_start -> entry"), @@ -1862,16 +1892,16 @@ varm_mib_start(Config) when is_list(Config) -> %% Load all the mibs HardwiredMibs = loaded_mibs(), ?DBG("varm_mib_start -> load all mibs", []), - ?line load_master_std("SNMP-COMMUNITY-MIB"), - ?line load_master_std("SNMP-FRAMEWORK-MIB"), - ?line load_master_std("SNMP-TARGET-MIB"), - ?line load_master_std("SNMP-NOTIFICATION-MIB"), + load_master_std("SNMP-COMMUNITY-MIB"), + load_master_std("SNMP-FRAMEWORK-MIB"), + load_master_std("SNMP-TARGET-MIB"), + load_master_std("SNMP-NOTIFICATION-MIB"), %% Unload the hardwired mibs ?DBG("varm_mib_start -> sleep some (before unloading hardwired mibs)", []), ?SLEEP(1000), ?DBG("varm_mib_start -> unload (hardwired) mibs", []), - ?line unload_mibs(HardwiredMibs), %% unload hardwired + unload_mibs(HardwiredMibs), %% unload hardwired ?DBG("varm_mib_start -> sleep some (before stopping agent)", []), ?SLEEP(1000), @@ -1908,51 +1938,50 @@ 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), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), - ?line load_master_std("OTP-SNMPEA-MIB"), - ?line load_master_std("SNMP-COMMUNITY-MIB"), - ?line load_master_std("SNMP-FRAMEWORK-MIB"), - ?line load_master_std("SNMP-MPD-MIB"), - ?line load_master_std("SNMP-NOTIFICATION-MIB"), - ?line load_master_std("SNMP-TARGET-MIB"), - ?line load_master_std("SNMP-VIEW-BASED-ACM-MIB"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), + load_master_std("OTP-SNMPEA-MIB"), + load_master_std("SNMP-COMMUNITY-MIB"), + load_master_std("SNMP-FRAMEWORK-MIB"), + load_master_std("SNMP-MPD-MIB"), + load_master_std("SNMP-NOTIFICATION-MIB"), + load_master_std("SNMP-TARGET-MIB"), + load_master_std("SNMP-VIEW-BASED-ACM-MIB"), ?SLEEP(2000), - ?line display_memory_usage(), + display_memory_usage(), ?DBG("ms_me_of -> find ~w from SNMP-COMMUNITY-MIB", [?snmpTrapCommunity_instance]), - ?line ok = me_of(?snmpTrapCommunity_instance), + ok = me_of(?snmpTrapCommunity_instance), ?DBG("ms_me_of -> find ~w from SNMP-VIEW-BASED-ACM-MIB", [?vacmViewSpinLock_instance]), - ?line ok = me_of(?vacmViewSpinLock_instance), + ok = me_of(?vacmViewSpinLock_instance), ?DBG("ms_me_of -> find ~w from SNMP-USER-BASED-SM-MIB", [?usmStatsNotInTimeWindows_instance]), - ?line {error, _} = me_of(?usmStatsNotInTimeWindows_instance), + {error, _} = me_of(?usmStatsNotInTimeWindows_instance), - ?line unload_master("OTP-SNMPEA-MIB"), - ?line unload_master("SNMP-COMMUNITY-MIB"), - ?line unload_master("SNMP-FRAMEWORK-MIB"), - ?line unload_master("SNMP-MPD-MIB"), - ?line unload_master("SNMP-NOTIFICATION-MIB"), - ?line unload_master("SNMP-TARGET-MIB"), - ?line unload_master("SNMP-VIEW-BASED-ACM-MIB"), + unload_master("OTP-SNMPEA-MIB"), + unload_master("SNMP-COMMUNITY-MIB"), + unload_master("SNMP-FRAMEWORK-MIB"), + unload_master("SNMP-MPD-MIB"), + unload_master("SNMP-NOTIFICATION-MIB"), + unload_master("SNMP-TARGET-MIB"), + unload_master("SNMP-VIEW-BASED-ACM-MIB"), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), ok. @@ -1979,52 +2008,51 @@ me_of(Oid) -> end. -ms_mib_of(suite) -> []; ms_mib_of(Config) when is_list(Config) -> ?P(ms_mib_of), init_case(Config), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), - ?line load_master_std("OTP-SNMPEA-MIB"), - ?line load_master_std("SNMP-COMMUNITY-MIB"), - ?line load_master_std("SNMP-FRAMEWORK-MIB"), - ?line load_master_std("SNMP-MPD-MIB"), - ?line load_master_std("SNMP-NOTIFICATION-MIB"), - ?line load_master_std("SNMP-TARGET-MIB"), - ?line load_master_std("SNMP-VIEW-BASED-ACM-MIB"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), + load_master_std("OTP-SNMPEA-MIB"), + load_master_std("SNMP-COMMUNITY-MIB"), + load_master_std("SNMP-FRAMEWORK-MIB"), + load_master_std("SNMP-MPD-MIB"), + load_master_std("SNMP-NOTIFICATION-MIB"), + load_master_std("SNMP-TARGET-MIB"), + load_master_std("SNMP-VIEW-BASED-ACM-MIB"), ?SLEEP(2000), - ?line display_memory_usage(), + display_memory_usage(), ?DBG("ms_mib_of -> find ~w from SNMP-COMMUNITY-MIB", [?snmpTrapCommunity_instance]), - ?line ok = mib_of(?snmpTrapCommunity_instance, 'SNMP-COMMUNITY-MIB'), + ok = mib_of(?snmpTrapCommunity_instance, 'SNMP-COMMUNITY-MIB'), ?DBG("ms_mib_of -> find ~w from SNMP-VIEW-BASED-ACM-MIB", [?vacmViewSpinLock_instance]), - ?line ok = mib_of(?vacmViewSpinLock_instance, 'SNMP-VIEW-BASED-ACM-MIB'), + ok = mib_of(?vacmViewSpinLock_instance, 'SNMP-VIEW-BASED-ACM-MIB'), ?DBG("ms_mib_of -> find ~w from SNMP-USER-BASED-SM-MIB", [?usmStatsNotInTimeWindows_instance]), - ?line {error, _} = mib_of(?usmStatsNotInTimeWindows_instance, + {error, _} = mib_of(?usmStatsNotInTimeWindows_instance, 'SNMP-USER-BASED-SM-MIB'), - ?line unload_master("OTP-SNMPEA-MIB"), - ?line unload_master("SNMP-COMMUNITY-MIB"), - ?line unload_master("SNMP-FRAMEWORK-MIB"), - ?line unload_master("SNMP-MPD-MIB"), - ?line unload_master("SNMP-NOTIFICATION-MIB"), - ?line unload_master("SNMP-TARGET-MIB"), - ?line unload_master("SNMP-VIEW-BASED-ACM-MIB"), + unload_master("OTP-SNMPEA-MIB"), + unload_master("SNMP-COMMUNITY-MIB"), + unload_master("SNMP-FRAMEWORK-MIB"), + unload_master("SNMP-MPD-MIB"), + unload_master("SNMP-NOTIFICATION-MIB"), + unload_master("SNMP-TARGET-MIB"), + unload_master("SNMP-VIEW-BASED-ACM-MIB"), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), ok. @@ -2062,7 +2090,6 @@ misc_cases() -> create_local_db_dir ]. -app_info(suite) -> []; app_info(Config) when is_list(Config) -> ?P(app_info), SnmpDir = app_dir(snmp), @@ -2100,8 +2127,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 -> @@ -2114,20 +2139,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 @@ -2142,7 +2160,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() -> @@ -2254,13 +2272,13 @@ v1_cases_ipv6() -> ]. init_v1(Config) when is_list(Config) -> - ?line SaNode = ?config(snmp_sa, Config), - ?line create_tables(SaNode), - ?line AgentConfDir = ?config(agent_conf_dir, Config), - ?line MgrDir = ?config(mgr_dir, Config), - ?line Ip = ?config(ip, Config), - ?line IpFamily = config_ipfamily(Config), - ?line config( + SaNode = ?config(snmp_sa, Config), + create_tables(SaNode), + AgentConfDir = ?config(agent_conf_dir, Config), + MgrDir = ?config(mgr_dir, Config), + Ip = ?config(ip, Config), + IpFamily = config_ipfamily(Config), + config( [v1], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip), IpFamily), [{vsn, v1} | start_v1_agent(Config)]. @@ -2462,7 +2480,7 @@ init_v3(Config) when is_list(Config) -> MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), IpFamily = config_ipfamily(Config), - ?line ok = + ok = config( [v3], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip), IpFamily), @@ -2495,7 +2513,7 @@ init_mt(Config, MT) when is_list(Config) -> AgentConfDir = ?config(agent_conf_dir, Config), MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), - ?line ok = config([v2], MgrDir, AgentConfDir, + ok = config([v2], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip)), [{vsn, v2} | start_multi_threaded_agent(Config, MT)]. @@ -2574,7 +2592,6 @@ init_old() -> -simple(suite) -> []; simple(Config) when is_list(Config) -> ?P(simple), init_case(Config), @@ -2586,7 +2603,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), @@ -2600,7 +2616,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}), @@ -2609,12 +2624,12 @@ big(Config) when is_list(Config) -> {SaNode, _MgrNode, _MibDir} = init_case(Config), ?NPRINT("Starting subagent..."), - ?line pong = net_adm:ping(SaNode), + pong = net_adm:ping(SaNode), - ?line {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1"), + {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1"), ?DBG("big -> SA: ~p", [SA]), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), snmpa:dump_mibs(), snmpa:dump_mibs("dumped_mibs.txt"), @@ -2622,15 +2637,14 @@ big(Config) when is_list(Config) -> try_test(big_test), - ?line stop_subagent(SA), - ?line unload_master("OLD-SNMPEA-MIB"). + stop_subagent(SA), + unload_master("OLD-SNMPEA-MIB"). 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 @@ -2638,110 +2652,102 @@ big2(Config) when is_list(Config) -> {SaNode, _MgrNode, _MibDir} = init_case(Config), ?NPRINT("Starting subagent..."), - ?line pong = net_adm:ping(SaNode), + pong = net_adm:ping(SaNode), - ?line {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1-v2"), - ?line load_master("OLD-SNMPEA-MIB-v2"), - ?line init_old(), + {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1-v2"), + load_master("OLD-SNMPEA-MIB-v2"), + init_old(), try_test(big_test), - ?line stop_subagent(SA), - ?line unload_master("OLD-SNMPEA-MIB-v2"). + stop_subagent(SA), + unload_master("OLD-SNMPEA-MIB-v2"). 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), - ?line load_master("Test1"), + load_master("Test1"), try_test(multi_threaded_test), - ?line unload_master("Test1"). + unload_master("Test1"). -mt_trap(suite) -> []; mt_trap(Config) when is_list(Config) -> ?P(mt_trap), init_case(Config), MA = whereis(snmp_master_agent), MT = ?config(multi_threaded, Config), - ?line load_master("Test1"), - ?line load_master("TestTrapv2"), + load_master("Test1"), + load_master("TestTrapv2"), try_test(mt_trap_test, [MA, MT]), - ?line unload_master("TestTrapv2"), - ?line unload_master("Test1"), + unload_master("TestTrapv2"), + unload_master("Test1"), ok. -v2_types(suite) -> []; v2_types(Config) when is_list(Config) -> ?P(v2_types), init_case(Config), - ?line load_master("Test1"), + load_master("Test1"), try_test(types_v2_test), - ?line unload_master("Test1"). + unload_master("Test1"). v2_types_3(X) -> ?P(v2_types_3), v2_types(X). -implied(suite) -> []; implied(Config) when is_list(Config) -> ?P(implied), init_case(Config), MA = whereis(snmp_master_agent), - ?line load_master("Test1"), + load_master("Test1"), try_test(implied_test,[MA]), - ?line unload_master("Test1"). + unload_master("Test1"). implied_3(X) -> ?P(implied_3), implied(X). -sparse_table(suite) -> []; sparse_table(Config) when is_list(Config) -> ?P(sparse_table), init_case(Config), - ?line load_master("Test1"), + load_master("Test1"), try_test(sparse_table_test), - ?line unload_master("Test1"). + unload_master("Test1"). 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), MA = whereis(snmp_master_agent), - ?line load_master("Test1"), + load_master("Test1"), try_test(cnt_64_test, [MA]), - ?line unload_master("Test1"). + unload_master("Test1"). 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), - ?line load_master("Test1"), + load_master("Test1"), try_test(opaque_test), - ?line unload_master("Test1"). + unload_master("Test1"). 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"), @@ -2753,27 +2759,27 @@ change_target_addr_config(Config) when is_list(Config) -> MA = whereis(snmp_master_agent), ?IPRINT("change_target_addr_config -> load TestTrap"), - ?line load_master("TestTrap"), + load_master("TestTrap"), ?IPRINT("change_target_addr_config -> set trace verbosity for local_db"), - ?line snmpa:verbosity(local_db,trace), + snmpa:verbosity(local_db,trace), - %% First send some traps that will arive att the original manager + %% First send some traps that will arrive att the original manager ?IPRINT("change_target_addr_config -> send trap"), try_test(ma_trap1, [MA]), ?IPRINT("change_target_addr_config -> set silence verbosity for local_db"), - ?line snmpa:verbosity(local_db, silence), + snmpa:verbosity(local_db, silence), %% Start new dummy listener ?IPRINT("change_target_addr_config -> start dummy manager"), - ?line {ok,Pid,NewPort} = dummy_manager_start(MA), + {ok,Pid,NewPort} = dummy_manager_start(MA), %% Reconfigure ?IPRINT("change_target_addr_config -> reconfigure"), AgentConfDir = ?config(agent_conf_dir, Config), - ?line rewrite_target_addr_conf(AgentConfDir, NewPort), - ?line snmp_target_mib:reconfigure(AgentConfDir), + rewrite_target_addr_conf(AgentConfDir, NewPort), + snmp_target_mib:reconfigure(AgentConfDir), %% Send the trap again ?IPRINT("change_target_addr_config -> send trap again"), @@ -2783,13 +2789,13 @@ change_target_addr_config(Config) when is_list(Config) -> catch dummy_manager_await_trap2_ack(), ?IPRINT("change_target_addr_config -> stop dummy manager"), - ?line ok = dummy_manager_stop(Pid), + ok = dummy_manager_stop(Pid), ?IPRINT("change_target_addr_config -> reset target address config"), - ?line reset_target_addr_conf(AgentConfDir), + reset_target_addr_conf(AgentConfDir), ?IPRINT("change_target_addr_config -> unload TestTrap"), - ?line unload_master("TestTrap"). + unload_master("TestTrap"). dummy_manager_start(MA) -> @@ -2838,7 +2844,7 @@ dummy_manager_await_trap2_ack() -> {received_trap, _Trap} -> ?IPRINT("dummy_manager_await_trap2 -> received trap: ~p", [_Trap]), %% Note: - %% Without this sleep the v2_inform_i testcase failes! There + %% Without this sleep the v2_inform_i testcase fails! There %% is no relation between these two test cases as far as I %% able to figure out... ?SLEEP(60000), @@ -2892,7 +2898,7 @@ dummy_manager_loop(P,S,MA) -> %% -ifdef(snmp_log). dummy_manager_message_sz(B) when is_binary(B) -> - size(B); + byte_size(B); dummy_manager_message_sz(L) when is_list(L) -> length(L); dummy_manager_message_sz(_) -> @@ -2913,49 +2919,57 @@ dummy_manager_handle_message(Bytes) -> end. -api(suite) -> []; api(Config) when is_list(Config) -> ?P(api), init_case(Config), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), try_test(api_test, [node()]), - ?line unload_master("OLD-SNMPEA-MIB"). + unload_master("OLD-SNMPEA-MIB"). 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), - ?line {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1"), + ?NPRINT("try start subagent..."), + {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1"), + ?NPRINT("try test case load_test_sa..."), try_test(load_test_sa), ?NPRINT("Testing unregister subagent..."), MA = whereis(snmp_master_agent), rpc:call(SaNode, snmpa, unregister_subagent, [MA, SA]), + ?NPRINT("try test case unreg_test..."), try_test(unreg_test), ?NPRINT("Loading previous subagent mib in master and testing..."), - ?line ok = snmpa:load_mib(MA, join(MibDir, "Klas1")), + ok = snmpa:load_mib(MA, join(MibDir, "Klas1")), + ?NPRINT("try test case load_test..."), try_test(load_test), ?NPRINT("Unloading previous subagent mib in master and testing..."), - ?line ok = snmpa:unload_mib(MA, join(MibDir, "Klas1")), + ok = snmpa:unload_mib(MA, join(MibDir, "Klas1")), + ?NPRINT("try test case unreg_test..."), try_test(unreg_test), ?NPRINT("Testing register subagent..."), - rpc:call(SaNode, snmpa, register_subagent, - [MA, ?klas1, SA]), + rpc:call(SaNode, snmpa, register_subagent, [MA, ?klas1, SA]), + ?NPRINT("try test case load_test_sa..."), try_test(load_test_sa), - ?line stop_subagent(SA), - try_test(unreg_test). + ?NPRINT("try stop subagent..."), + stop_subagent(SA), + ?NPRINT("try test case unreg_test..."), + try_test(unreg_test), + + ?NPRINT("done"), + ok. subagent_2(X) -> ?P(subagent_2), subagent(X). @@ -2970,15 +2984,14 @@ subagent_3(X) -> subagent(X). -mnesia(suite) -> []; mnesia(Config) when is_list(Config) -> ?P(mnesia), {SaNode, _MgrNode, _MibDir} = init_case(Config), ?NPRINT("Starting subagent with mnesia impl..."), {ok, SA} = start_subagent(SaNode, ?klas2, "Klas2"), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), try_test(big_test_2), @@ -2986,8 +2999,8 @@ mnesia(Config) when is_list(Config) -> MA = whereis(snmp_master_agent), rpc:call(SaNode, snmpa, unregister_subagent, [MA, SA]), try_test(unreg_test), - ?line unload_master("OLD-SNMPEA-MIB"), - ?line stop_subagent(SA). + unload_master("OLD-SNMPEA-MIB"), + stop_subagent(SA). mnesia_2(X) -> ?P(mnesia_2), mnesia(X). @@ -3030,9 +3043,9 @@ mul_cases_3() -> init_mul(Config) when is_list(Config) -> {SaNode, _MgrNode, _MibDir} = init_case(Config), - ?line {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1"), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1"), + load_master("OLD-SNMPEA-MIB"), + init_old(), [{mul_sub, SA} | Config]. finish_mul(Config) when is_list(Config) -> @@ -3040,11 +3053,10 @@ finish_mul(Config) when is_list(Config) -> SA = ?config(mul_sub, Config), - ?line unload_master("OLD-SNMPEA-MIB"), - ?line stop_subagent(SA), + unload_master("OLD-SNMPEA-MIB"), + 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), @@ -3057,7 +3069,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), @@ -3070,7 +3081,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), @@ -3083,7 +3093,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), @@ -3096,7 +3105,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), @@ -3109,7 +3117,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), @@ -3122,14 +3129,13 @@ 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), ?DBG("sa_register -> start subagent", []), ?NPRINT("start subagent..."), - ?line {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1"), + {ok, SA} = start_subagent(SaNode, ?klas1, "Klas1"), ?DBG("sa_register -> unregister subagent", []), ?NPRINT("Testing unregister subagent (2)..."), @@ -3153,14 +3159,13 @@ sa_register(Config) when is_list(Config) -> ?NPRINT("stop subagent..."), ?DBG("sa_register -> stop subagent", []), - ?line stop_subagent(SA). + stop_subagent(SA). 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). @@ -3169,14 +3174,14 @@ trap1(Config) -> {SaNode, _MgrNode, _MibDir} = init_case(Config), ?NPRINT("start subagent..."), - ?line {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), + {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), ?NPRINT("Testing trap sending from master agent..."), MA = whereis(snmp_master_agent), ?NPRINT("load TestTrap & TestTrapv2..."), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("TestTrap"), + load_master("TestTrapv2"), ?NPRINT("Testing trap sending from master-agent..."), try_test(ma_trap1, [MA]), @@ -3190,13 +3195,12 @@ trap1(Config) -> try_test(sa_trap3, [SA]), ?NPRINT("unload TestTrap & TestTrapv2..."), - ?line unload_master("TestTrap"), - ?line unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("TestTrapv2"), ?NPRINT("stop subagent..."), - ?line stop_subagent(SA). + stop_subagent(SA). -v2_trap(suite) -> []; v2_trap(Config) when is_list(Config) -> ?P(v2_trap), trap2(Config). @@ -3205,14 +3209,14 @@ trap2(Config) -> {SaNode, _MgrNode, _MibDir} = init_case(Config), ?NPRINT("start subagent..."), - ?line {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), + {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), ?NPRINT("Testing trap sending from master agent..."), MA = whereis(snmp_master_agent), ?NPRINT("load TestTrap & TestTrapv2..."), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("TestTrap"), + load_master("TestTrapv2"), ?NPRINT("Testing trap sending from master-agent..."), try_test(ma_v2_trap1, [MA]), @@ -3228,13 +3232,12 @@ trap2(Config) -> try_test(sa_v1_2_v2_trap3, [SA]), ?NPRINT("unload TestTrap & TestTrapv2..."), - ?line unload_master("TestTrap"), - ?line unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("TestTrapv2"), ?NPRINT("stop subagent..."), - ?line stop_subagent(SA). + stop_subagent(SA). -v3_trap(suite) -> []; v3_trap(Config) when is_list(Config) -> %% <CONDITIONAL-SKIP> Skippable = [{unix, [darwin]}], @@ -3273,7 +3276,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). @@ -3284,19 +3286,19 @@ inform_i(Config) -> MA = whereis(snmp_master_agent), ?NPRINT("load TestTrap & TestTrapv2..."), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("TestTrap"), + load_master("TestTrapv2"), ?NPRINT("Testing inform sending from master agent... " - "~nNOTE! This test takes a few minutes (10) to complete."), + "~n NOTE! This test takes a few minutes (10) to complete."), try_test(ma_v2_inform1, [MA]), try_test(ma_v2_inform2, [MA]), try_test(ma_v2_inform3, [MA]), ?NPRINT("unload TestTrap & TestTrapv2..."), - ?line unload_master("TestTrap"), - ?line unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("TestTrapv2"), ok. v3_inform_i(X) -> @@ -3310,17 +3312,16 @@ 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), ?NPRINT("load OLD-SNMPEA-MIB..."), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), ?NPRINT("start subagent..."), - ?line {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), + {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), ?NPRINT("Testing sa bad value (is_set_ok)..."), try_test(sa_errs_bad_value), @@ -3332,7 +3333,7 @@ sa_error(Config) when is_list(Config) -> try_test(sa_too_big), ?NPRINT("unload OLD-SNMPEA-MIB..."), - ?line unload_master("OLD-SNMPEA-MIB"), + unload_master("OLD-SNMPEA-MIB"), ?NPRINT("stop subagent..."), stop_subagent(SA). @@ -3352,17 +3353,16 @@ 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), MA = whereis(snmp_master_agent), ?NPRINT("start subagent (1)..."), - ?line {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), + {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), ?NPRINT("Loading another subagent mib (Klas1)..."), - ?line ok = snmpa:load_mib(SA, MibDir ++ "Klas1"), + ok = snmpa:load_mib(SA, MibDir ++ "Klas1"), ?NPRINT("register subagent..."), rpc:call(SaNode, snmpa, register_subagent, [MA, ?klas1, SA]), @@ -3379,7 +3379,7 @@ next_across_sa(Config) when is_list(Config) -> try_test(unreg_test), ?NPRINT("Starting another subagent (2) "), - ?line {ok, SA2} = start_subagent(SaNode, ?klas1, "Klas1"), + {ok, SA2} = start_subagent(SaNode, ?klas1, "Klas1"), ?NPRINT("Testing next across subagent (wrong prefix from SA)..."), try_test(next_across_sa_test), @@ -3404,7 +3404,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), @@ -3412,30 +3411,30 @@ undo(Config) when is_list(Config) -> MA = whereis(snmp_master_agent), ?NPRINT("start subagent (1)..."), - ?line {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), + {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), ?NPRINT("Load Klas3 & Klas4..."), - ?line ok = snmpa:load_mib(MA, join(MibDir, "Klas3")), - ?line ok = snmpa:load_mib(MA, join(MibDir, "Klas4")), + ok = snmpa:load_mib(MA, join(MibDir, "Klas3")), + ok = snmpa:load_mib(MA, join(MibDir, "Klas4")), ?NPRINT("Testing undo phase at master agent..."), try_test(undo_test), try_test(api_test2), ?NPRINT("Unload Klas3..."), - ?line ok = snmpa:unload_mib(MA, join(MibDir, "Klas3")), + ok = snmpa:unload_mib(MA, join(MibDir, "Klas3")), ?NPRINT("Testing bad return values from instrum. funcs..."), try_test(bad_return), ?NPRINT("Unload Klas4..."), - ?line ok = snmpa:unload_mib(MA, join(MibDir, "Klas4")), + ok = snmpa:unload_mib(MA, join(MibDir, "Klas4")), ?NPRINT("Testing undo phase at subagent..."), - ?line ok = snmpa:load_mib(SA, join(MibDir, "Klas3")), - ?line ok = snmpa:load_mib(SA, join(MibDir, "Klas4")), - ?line ok = snmpa:register_subagent(MA, ?klas3, SA), - ?line ok = snmpa:register_subagent(MA, ?klas4, SA), + ok = snmpa:load_mib(SA, join(MibDir, "Klas3")), + ok = snmpa:load_mib(SA, join(MibDir, "Klas4")), + ok = snmpa:register_subagent(MA, ?klas3, SA), + ok = snmpa:register_subagent(MA, ?klas4, SA), try_test(undo_test), try_test(api_test3), @@ -3461,47 +3460,44 @@ undo_3(X) -> undo(X). %% Req. Test2 -v1_processing(suite) -> []; v1_processing(Config) when is_list(Config) -> ?P(v1_processing), ?DBG("v1_processing -> entry", []), init_case(Config), ?NPRINT("Load Test2..."), - ?line load_master("Test2"), + load_master("Test2"), try_test(v1_proc), ?NPRINT("Unload Test2..."), - ?line unload_master("Test2"). + unload_master("Test2"). %% Req. Test2 -v2_processing(suite) -> []; v2_processing(Config) when is_list(Config) -> ?P(v2_processing), init_case(Config), ?NPRINT("Load Test2..."), - ?line load_master("Test2"), + load_master("Test2"), try_test(v2_proc), ?NPRINT("Unload Test2..."), - ?line unload_master("Test2"). + unload_master("Test2"). %% Req. Test2 -v3_processing(suite) -> []; v3_processing(Config) when is_list(Config) -> ?P(v3_processing), init_case(Config), ?NPRINT("Load Test2..."), - ?line load_master("Test2"), + load_master("Test2"), try_test(v2_proc), % same as v2! ?NPRINT("Unload Test2..."), - ?line unload_master("Test2"). + unload_master("Test2"). %% We'll try get/set/trap and inform for all the auth & priv protocols. @@ -3523,31 +3519,30 @@ 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], %% From rfc2274 appendix A.3.1 - ?line KMd5_1 = snmp:passwd2localized_key(md5, "maplesyrup", EID), - ?line [16#52,16#6f,16#5e,16#ed,16#9f,16#cc,16#e2,16#6f, + KMd5_1 = snmp:passwd2localized_key(md5, "maplesyrup", EID), + [16#52,16#6f,16#5e,16#ed,16#9f,16#cc,16#e2,16#6f, 16#89,16#64,16#c2,16#93,16#07,16#87,16#d8,16#2b] = KMd5_1, %% From rfc2274 appendix A.3.2 - ?line KSHA_1 = snmp:passwd2localized_key(sha, "maplesyrup", EID), - ?line [16#66,16#95,16#fe,16#bc,16#92,16#88,16#e3,16#62,16#82,16#23, + KSHA_1 = snmp:passwd2localized_key(sha, "maplesyrup", EID), + [16#66,16#95,16#fe,16#bc,16#92,16#88,16#e3,16#62,16#82,16#23, 16#5f,16#c7,16#15,16#1f,16#12,16#84,16#97,16#b3,16#8f,16#3f] = KSHA_1, %% From rfc2274, appendix A.5.1 - ?line KMd5_2 = snmp:passwd2localized_key(md5, "newsyrup", EID), - ?line [16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, + KMd5_2 = snmp:passwd2localized_key(md5, "newsyrup", EID), + [16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, 16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, 16#88,16#05,16#61,16#51,16#41,16#67,16#6c,16#c9, 16#19,16#61,16#74,16#e7,16#42,16#a3,16#25,16#51] = snmp_user_based_sm_mib:mk_key_change(md5, KMd5_1, KMd5_2, 16, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]), %% From rfc2274, appendix A.5.2 - ?line KSHA_2 = snmp:passwd2localized_key(sha, "newsyrup", EID), - ?line [16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, + KSHA_2 = snmp:passwd2localized_key(sha, "newsyrup", EID), + [16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, 16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, 16#00,16#00,16#00,16#00,16#9c,16#10,16#17,16#f4, 16#fd,16#48,16#3d,16#2d,16#e8,16#d5,16#fa,16#db, @@ -3556,7 +3551,7 @@ v3_crypto_basic(_Config) -> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]), KSHA_1t = lists:sublist(KSHA_1, 16), KSHA_2t = lists:sublist(KSHA_2, 16), - ?line [16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, + [16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, 16#00,16#00,16#00,16#00,16#00,16#00,16#00,16#00, 16#7e,16#f8,16#d8,16#a4,16#c9,16#cd,16#b2,16#6b, 16#47,16#59,16#1c,16#d8,16#52,16#ff,16#88,16#b5] = @@ -3564,15 +3559,14 @@ v3_crypto_basic(_Config) -> [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]), %% Try with correct random - ?line Kc1 = snmp_user_based_sm_mib:mk_key_change(md5, KMd5_1, KMd5_2), - ?line KMd5_2 = snmp_user_based_sm_mib:extract_new_key(md5, KMd5_1, Kc1), - ?line Kc2 = snmp_user_based_sm_mib:mk_key_change(sha, KSHA_1, KSHA_2), - ?line KSHA_2 = snmp_user_based_sm_mib:extract_new_key(sha, KSHA_1, Kc2), + Kc1 = snmp_user_based_sm_mib:mk_key_change(md5, KMd5_1, KMd5_2), + KMd5_2 = snmp_user_based_sm_mib:extract_new_key(md5, KMd5_1, Kc1), + Kc2 = snmp_user_based_sm_mib:mk_key_change(sha, KSHA_1, KSHA_2), + KSHA_2 = snmp_user_based_sm_mib:extract_new_key(sha, KSHA_1, Kc2), ok. -v3_md5_auth(suite) -> []; v3_md5_auth(Config) when is_list(Config) -> ?P(v3_md5_auth), init_case(Config), @@ -3580,26 +3574,25 @@ v3_md5_auth(Config) when is_list(Config) -> ?NPRINT("Testing MD5 authentication...takes a few seconds..."), AgentConfDir = ?config(agent_conf_dir, Config), - ?line rewrite_target_params_conf(AgentConfDir, "authMD5", authNoPriv), - ?line snmp_target_mib:reconfigure(AgentConfDir), + rewrite_target_params_conf(AgentConfDir, "authMD5", authNoPriv), + snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, {ma_v2_trap1, [MA]}, {v3_inform_sync, [MA]}]], [{sec_level, authNoPriv}, {user, "authMD5"}]), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentConfDir). + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), + reset_target_params_conf(AgentConfDir). -v3_sha_auth(suite) -> []; v3_sha_auth(Config) when is_list(Config) -> ?P(v3_sha_auth), init_case(Config), @@ -3607,28 +3600,27 @@ v3_sha_auth(Config) when is_list(Config) -> ?NPRINT("Testing SHA authentication...takes a few seconds..."), AgentConfDir = ?config(agent_conf_dir, Config), - ?line rewrite_target_params_conf(AgentConfDir, "authSHA", authNoPriv), - ?line snmp_target_mib:reconfigure(AgentConfDir), + rewrite_target_params_conf(AgentConfDir, "authSHA", authNoPriv), + snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), snmp_user_based_sm_mib:usmUserTable(print), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, {ma_v2_trap1, [MA]}, {v3_inform_sync, [MA]}]], [{sec_level, authNoPriv}, {user, "authSHA"}]), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentConfDir). + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), + reset_target_params_conf(AgentConfDir). -v3_sha224_auth(suite) -> []; v3_sha224_auth(Config) when is_list(Config) -> ?P(v3_sha224_auth), init_case(Config), @@ -3636,28 +3628,27 @@ v3_sha224_auth(Config) when is_list(Config) -> ?NPRINT("Testing SHA224 authentication...takes a few seconds..."), AgentConfDir = ?config(agent_conf_dir, Config), - ?line rewrite_target_params_conf(AgentConfDir, "authSHA224", authNoPriv), - ?line snmp_target_mib:reconfigure(AgentConfDir), + rewrite_target_params_conf(AgentConfDir, "authSHA224", authNoPriv), + snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), snmp_user_based_sm_mib:usmUserTable(print), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, {ma_v2_trap1, [MA]}, {v3_inform_sync, [MA]}]], [{sec_level, authNoPriv}, {user, "authSHA224"}]), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentConfDir). + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), + reset_target_params_conf(AgentConfDir). -v3_sha256_auth(suite) -> []; v3_sha256_auth(Config) when is_list(Config) -> ?P(v3_sha256_auth), init_case(Config), @@ -3665,28 +3656,27 @@ v3_sha256_auth(Config) when is_list(Config) -> ?NPRINT("Testing SHA256 authentication...takes a few seconds..."), AgentConfDir = ?config(agent_conf_dir, Config), - ?line rewrite_target_params_conf(AgentConfDir, "authSHA256", authNoPriv), - ?line snmp_target_mib:reconfigure(AgentConfDir), + rewrite_target_params_conf(AgentConfDir, "authSHA256", authNoPriv), + snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), snmp_user_based_sm_mib:usmUserTable(print), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, {ma_v2_trap1, [MA]}, {v3_inform_sync, [MA]}]], [{sec_level, authNoPriv}, {user, "authSHA256"}]), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentConfDir). + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), + reset_target_params_conf(AgentConfDir). -v3_sha384_auth(suite) -> []; v3_sha384_auth(Config) when is_list(Config) -> ?P(v3_sha384_auth), init_case(Config), @@ -3694,28 +3684,27 @@ v3_sha384_auth(Config) when is_list(Config) -> ?NPRINT("Testing SHA authentication...takes a few seconds..."), AgentConfDir = ?config(agent_conf_dir, Config), - ?line rewrite_target_params_conf(AgentConfDir, "authSHA384", authNoPriv), - ?line snmp_target_mib:reconfigure(AgentConfDir), + rewrite_target_params_conf(AgentConfDir, "authSHA384", authNoPriv), + snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), snmp_user_based_sm_mib:usmUserTable(print), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, {ma_v2_trap1, [MA]}, {v3_inform_sync, [MA]}]], [{sec_level, authNoPriv}, {user, "authSHA384"}]), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentConfDir). + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), + reset_target_params_conf(AgentConfDir). -v3_sha512_auth(suite) -> []; v3_sha512_auth(Config) when is_list(Config) -> ?P(v3_sha512_auth), init_case(Config), @@ -3723,28 +3712,27 @@ v3_sha512_auth(Config) when is_list(Config) -> ?NPRINT("Testing SHA512 authentication...takes a few seconds..."), AgentConfDir = ?config(agent_conf_dir, Config), - ?line rewrite_target_params_conf(AgentConfDir, "authSHA512", authNoPriv), - ?line snmp_target_mib:reconfigure(AgentConfDir), + rewrite_target_params_conf(AgentConfDir, "authSHA512", authNoPriv), + snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), snmp_user_based_sm_mib:usmUserTable(print), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, {ma_v2_trap1, [MA]}, {v3_inform_sync, [MA]}]], [{sec_level, authNoPriv}, {user, "authSHA512"}]), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentConfDir). + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), + reset_target_params_conf(AgentConfDir). -v3_des_priv(suite) -> []; v3_des_priv(Config) when is_list(Config) -> ?P(v3_des_priv), init_case(Config), @@ -3752,26 +3740,26 @@ v3_des_priv(Config) when is_list(Config) -> ?NPRINT("Testing DES encryption...takes a few seconds..."), AgentConfDir = ?config(agent_conf_dir, Config), - ?line rewrite_target_params_conf(AgentConfDir, "privDES", authPriv), - ?line snmp_target_mib:reconfigure(AgentConfDir), + rewrite_target_params_conf(AgentConfDir, "privDES", authPriv), + snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), snmp_user_based_sm_mib:usmUserTable(print), - ?line load_master("Test2"), - ?line load_master("TestTrap"), - ?line load_master("TestTrapv2"), + load_master("Test2"), + load_master("TestTrap"), + load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, {ma_v2_trap1, [MA]}, {v3_inform_sync, [MA]}]], [{sec_level, authPriv}, {user, "privDES"}]), - ?line unload_master("TestTrapv2"), - ?line unload_master("TestTrap"), - ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentConfDir). + unload_master("TestTrapv2"), + unload_master("TestTrap"), + unload_master("Test2"), + reset_target_params_conf(AgentConfDir). %% -define(usmStatsNotInTimeWindows_instance, [1,3,6,1,6,3,15,1,1,2,0]). @@ -3786,18 +3774,17 @@ v3_sync(Funcs) -> v3_inform_sync(MA) -> ?DBG("v3_sync -> entry with MA: ~p => Send notification",[MA]), - ?line snmpa:send_notification(MA, testTrapv22, no_receiver, + snmpa:send_notification(MA, testTrapv22, no_receiver, "standard inform", []), %% Make sure agent is in sync with mgr... ?DBG("v3_sync -> wait some time: ",[]), ?SLEEP(20000), % more than 1500*10 in target_addr.conf ?DBG("v3_sync -> await response",[]), - ?line ?expect2({inform, true}, + ?expect2({inform, true}, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?system ++ [0,1]}]). -v2_caps(suite) -> []; v2_caps(Config) when is_list(Config) -> ?P(v2_caps), init_case(Config), @@ -3808,13 +3795,13 @@ v2_caps_3(X) -> ?P(v2_caps_3), v2_caps(X). v2_caps_i(Node) -> - ?line Idx = rpc:call(Node, snmpa, add_agent_caps, [[1,2,3,4,5], "test cap"]), + Idx = rpc:call(Node, snmpa, add_agent_caps, [[1,2,3,4,5], "test cap"]), g([[sysORID, Idx], [sysORDescr, Idx]]), - ?line ?expect1([{[sysORID, Idx], [1,2,3,4,5]}, + ?expect1([{[sysORID, Idx], [1,2,3,4,5]}, {[sysORDescr, Idx], "test cap"}]), - ?line rpc:call(Node, snmpa, del_agent_caps, [Idx]), + rpc:call(Node, snmpa, del_agent_caps, [Idx]), g([[sysORID, Idx]]), - ?line ?expect1([{[sysORID, Idx], noSuchInstance}]). + ?expect1([{[sysORID, Idx], noSuchInstance}]). %% Req. Test2 @@ -3830,85 +3817,85 @@ v1_proc() -> v1_get_p() -> %% 4.1.2:1 g([[test2]]), - ?line ?expect3(noSuchName, 1, [{[test2], 'NULL'}]), + ?expect3(noSuchName, 1, [{[test2], 'NULL'}]), g([[tDescr]]), - ?line ?expect3(noSuchName, 1, [{[tDescr], 'NULL'}]), + ?expect3(noSuchName, 1, [{[tDescr], 'NULL'}]), g([[tDescr2,0]]), - ?line ?expect3(noSuchName, 1, [{[tDescr2,0], 'NULL'}]), + ?expect3(noSuchName, 1, [{[tDescr2,0], 'NULL'}]), g([[tDescr3,0]]), - ?line ?expect3(noSuchName, 1, [{[tDescr3,0], 'NULL'}]), + ?expect3(noSuchName, 1, [{[tDescr3,0], 'NULL'}]), g([[tDescr4,0]]), - ?line ?expect3(noSuchName, 1, [{[tDescr4,0], 'NULL'}]), + ?expect3(noSuchName, 1, [{[tDescr4,0], 'NULL'}]), g([[sysDescr, 0], [tDescr,0]]), % Outside mibview - ?line ?expect3(noSuchName, 2, [{[sysDescr, 0], 'NULL'}, + ?expect3(noSuchName, 2, [{[sysDescr, 0], 'NULL'}, {[tDescr,0], 'NULL'}]), g([[sysDescr,3]]), - ?line ?expect3(noSuchName, 1, [{[sysDescr, 3], 'NULL'}]), + ?expect3(noSuchName, 1, [{[sysDescr, 3], 'NULL'}]), %% 4.1.2:2 g([[tTable]]), - ?line ?expect3(noSuchName, 1, [{[tTable], 'NULL'}]), + ?expect3(noSuchName, 1, [{[tTable], 'NULL'}]), g([[tEntry]]), - ?line ?expect3(noSuchName, 1, [{[tEntry], 'NULL'}]), + ?expect3(noSuchName, 1, [{[tEntry], 'NULL'}]), %% 4.1.2:3 g([[tTooBig, 0]]), - ?line ?expect3(tooBig, 0, [{[tTooBig, 0], 'NULL'}]), + ?expect3(tooBig, 0, [{[tTooBig, 0], 'NULL'}]), %% 4.1.2:4 g([[tGenErr1, 0]]), - ?line ?expect3(genErr, 1, [{[tGenErr1, 0], 'NULL'}]), + ?expect3(genErr, 1, [{[tGenErr1, 0], 'NULL'}]), g([[tGenErr2, 0]]), - ?line ?expect3(genErr, 1, [{[tGenErr2, 0], 'NULL'}]), + ?expect3(genErr, 1, [{[tGenErr2, 0], 'NULL'}]), g([[sysDescr, 0], [tGenErr3, 0]]), - ?line ?expect3(genErr, 2, [{[sysDescr, 0], 'NULL'}, + ?expect3(genErr, 2, [{[sysDescr, 0], 'NULL'}, {[tGenErr3, 0], 'NULL'}]). v1_get_next_p() -> %% 4.1.3:1 gn([[1,3,7,1]]), - ?line ?expect3(noSuchName, 1, [{[1,3,7,1], 'NULL'}]), + ?expect3(noSuchName, 1, [{[1,3,7,1], 'NULL'}]), gn([[tDescr2]]), - ?line ?expect3(tooBig, 0, any), + ?expect3(tooBig, 0, any), %% 4.1.3:2 gn([[tTooBig]]), io:format("We currently don't handle tooBig correct!!!\n"), - ?line ?expect3(tooBig, 0, any), + ?expect3(tooBig, 0, any), %% 4.1.3:3 gn([[tGenErr1]]), - ?line ?expect3(genErr, 1, any), + ?expect3(genErr, 1, any), gn([[tGenErr2]]), - ?line ?expect3(genErr, 1, any), + ?expect3(genErr, 1, any), gn([[sysDescr], [tGenErr3]]), - ?line ?expect3(genErr, 2, any). + ?expect3(genErr, 2, any). v1_set_p() -> %% 4.1.5:1 s([{[1,3,7,0], i, 4}]), - ?line ?expect3(noSuchName, 1, [{[1,3,7,0], 4}]), + ?expect3(noSuchName, 1, [{[1,3,7,0], 4}]), s([{[tDescr,0], s, "outside mibview"}]), - ?line ?expect3(noSuchName, 1, [{[tDescr,0], "outside mibview"}]), + ?expect3(noSuchName, 1, [{[tDescr,0], "outside mibview"}]), s([{[tDescr3,0], s, "read-only"}]), - ?line ?expect3(noSuchName, 1, [{[tDescr3,0], "read-only"}]), + ?expect3(noSuchName, 1, [{[tDescr3,0], "read-only"}]), s([{[tDescr3], s, "noSuchObject"}]), - ?line ?expect3(noSuchName, 1, [{[tDescr3], "noSuchObject"}]), + ?expect3(noSuchName, 1, [{[tDescr3], "noSuchObject"}]), s([{[tDescr3,1], s, "noSuchInstance"}]), - ?line ?expect3(noSuchName, 1, [{[tDescr3,1], "noSuchInstance"}]), + ?expect3(noSuchName, 1, [{[tDescr3,1], "noSuchInstance"}]), s([{[tDescr2,0], s, "inconsistentName"}]), - ?line ?expect3(noSuchName, 1, [{[tDescr2,0], "inconsistentName"}]), + ?expect3(noSuchName, 1, [{[tDescr2,0], "inconsistentName"}]), %% 4.1.5:2 s([{[tDescr2, 0], i, 4}]), - ?line ?expect3(badValue, 1, [{[tDescr2, 0], 4}]), + ?expect3(badValue, 1, [{[tDescr2, 0], 4}]), s([{[tDescr2, 0], s, "badValue"}]), - ?line ?expect3(badValue, 1, [{[tDescr2, 0], "badValue"}]), + ?expect3(badValue, 1, [{[tDescr2, 0], "badValue"}]), %% 4.1.5:3 %% The standard is quite incorrect here. The resp pdu was too big. In @@ -3918,14 +3905,14 @@ v1_set_p() -> %% of the std-like original value. s([{[tTooBig, 0], s, ?tooBigStr}]), %% according to std: -% ?line ?expect3(tooBig, 0, [{[tTooBig, 0], ?tooBigStr}]), - ?line ?expect3(tooBig, 0, [{[tTooBig, 0], 'NULL'}]), +% ?expect3(tooBig, 0, [{[tTooBig, 0], ?tooBigStr}]), + ?expect3(tooBig, 0, [{[tTooBig, 0], 'NULL'}]), %% 4.1.5:4 s([{[tDescr2, 0], s, "is_set_ok_fail"}]), - ?line ?expect3(genErr, 1, [{[tDescr2, 0], "is_set_ok_fail"}]), + ?expect3(genErr, 1, [{[tDescr2, 0], "is_set_ok_fail"}]), s([{[tDescr2, 0], s, "commit_fail"}]), - ?line ?expect3(genErr, 1, [{[tDescr2, 0], "commit_fail"}]). + ?expect3(genErr, 1, [{[tDescr2, 0], "commit_fail"}]). %% Req. Test2 v2_proc() -> @@ -3941,94 +3928,94 @@ v2_get_p() -> %% 4.2.1:2 ?DBG("v2_get_p -> entry",[]), g([[test2]]), - ?line ?expect1([{[test2], noSuchObject}]), + ?expect1([{[test2], noSuchObject}]), g([[tDescr]]), - ?line ?expect1([{[tDescr], noSuchObject}]), + ?expect1([{[tDescr], noSuchObject}]), g([[tDescr4,0]]), - ?line ?expect1([{[tDescr4,0], noSuchObject}]), + ?expect1([{[tDescr4,0], noSuchObject}]), g([[sysDescr, 0], [tDescr,0]]), % Outside mibview - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {[tDescr,0], noSuchObject}]), g([[tTable]]), - ?line ?expect1([{[tTable], noSuchObject}]), + ?expect1([{[tTable], noSuchObject}]), g([[tEntry]]), - ?line ?expect1([{[tEntry], noSuchObject}]), + ?expect1([{[tEntry], noSuchObject}]), %% 4.2.1:3 g([[tDescr2,0]]), %% instrum ret noSuchName!!! - ?line ?expect1([{[tDescr2,0], noSuchInstance}]), + ?expect1([{[tDescr2,0], noSuchInstance}]), g([[tDescr3,0]]), - ?line ?expect1([{[tDescr3,0], noSuchInstance}]), + ?expect1([{[tDescr3,0], noSuchInstance}]), g([[sysDescr,3]]), - ?line ?expect1([{[sysDescr, 3], noSuchInstance}]), + ?expect1([{[sysDescr, 3], noSuchInstance}]), g([[tIndex,1]]), - ?line ?expect1([{[tIndex, 1], noSuchInstance}]), + ?expect1([{[tIndex, 1], noSuchInstance}]), %% 4.2.1 - any other error: genErr g([[tGenErr1, 0]]), - ?line ?expect3(genErr, 1, [{[tGenErr1, 0], 'NULL'}]), + ?expect3(genErr, 1, [{[tGenErr1, 0], 'NULL'}]), g([[tGenErr2, 0]]), - ?line ?expect3(genErr, 1, [{[tGenErr2, 0], 'NULL'}]), + ?expect3(genErr, 1, [{[tGenErr2, 0], 'NULL'}]), g([[sysDescr, 0], [tGenErr3, 0]]), - ?line ?expect3(genErr, 2, [{[sysDescr, 0], 'NULL'}, + ?expect3(genErr, 2, [{[sysDescr, 0], 'NULL'}, {[tGenErr3, 0], 'NULL'}]), %% 4.2.1 - tooBig g([[tTooBig, 0]]), - ?line ?expect3(tooBig, 0, []). + ?expect3(tooBig, 0, []). v2_get_next_p() -> %% 4.2.2:2 ?DBG("v2_get_next_p -> entry",[]), gn([[1,3,7,1]]), - ?line ?expect1([{[1,3,7,1], endOfMibView}]), + ?expect1([{[1,3,7,1], endOfMibView}]), gn([[sysDescr], [1,3,7,1]]), - ?line ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, {[1,3,7,1], endOfMibView}]), gn([[tCnt2, 1]]), - ?line ?expect1([{[tCnt2,2], 100}]), + ?expect1([{[tCnt2,2], 100}]), gn([[tCnt2, 2]]), - ?line ?expect1([{[tCnt2,2], endOfMibView}]), + ?expect1([{[tCnt2,2], endOfMibView}]), %% 4.2.2 - any other error: genErr gn([[tGenErr1]]), - ?line ?expect3(genErr, 1, [{[tGenErr1], 'NULL'}]), + ?expect3(genErr, 1, [{[tGenErr1], 'NULL'}]), gn([[tGenErr2]]), - ?line ?expect3(genErr, 1, [{[tGenErr2], 'NULL'}]), + ?expect3(genErr, 1, [{[tGenErr2], 'NULL'}]), gn([[sysDescr], [tGenErr3]]), - ?line ?expect3(genErr, 2, [{[sysDescr], 'NULL'}, + ?expect3(genErr, 2, [{[sysDescr], 'NULL'}, {[tGenErr3], 'NULL'}]), %% 4.2.2 - tooBig gn([[tTooBig]]), - ?line ?expect3(tooBig, 0, []). + ?expect3(tooBig, 0, []). v2_get_bulk_p() -> %% 4.2.3 ?DBG("v2_get_bulk_p -> entry",[]), gb(1, 1, []), - ?line ?expect1([]), + ?expect1([]), gb(-1, 1, []), - ?line ?expect1([]), + ?expect1([]), gb(-1, -1, []), - ?line ?expect1([]), + ?expect1([]), gb(-1, -1, []), - ?line ?expect1([]), + ?expect1([]), gb(2, 0, [[sysDescr], [1,3,7,1]]), - ?line ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, {[1,3,7,1], endOfMibView}]), gb(1, 2, [[sysDescr], [1,3,7,1]]), - ?line ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, {[1,3,7,1], endOfMibView}]), gb(0, 2, [[sysDescr], [1,3,7,1]]), - ?line ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, {[1,3,7,1], endOfMibView}, {[sysObjectID, 0], [1,2,3]}, {[1,3,7,1], endOfMibView}]), gb(2, 2, [[sysDescr], [1,3,7,1], [sysDescr], [1,3,7,1]]), - ?line ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, {[1,3,7,1], endOfMibView}, {[sysDescr, 0], "Erlang SNMP agent"}, {[1,3,7,1], endOfMibView}, @@ -4036,19 +4023,19 @@ v2_get_bulk_p() -> {[1,3,7,1], endOfMibView}]), gb(1, 2, [[sysDescr], [sysDescr], [tTooBig]]), - ?line ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr, 0], "Erlang SNMP agent"}, {[sysDescr, 0], "Erlang SNMP agent"}]), gb(1,12, [[tDescr2], [sysDescr]]), % next one after tDescr2 is tTooBig. - ?line ?expect1([]), + ?expect1([]), gb(2,2, [[sysDescr], [sysObjectID], [tGenErr1], [sysDescr]]), - ?line ?expect3(genErr, 3, [{[sysDescr], 'NULL'}, + ?expect3(genErr, 3, [{[sysDescr], 'NULL'}, {[sysObjectID], 'NULL'}, {[tGenErr1], 'NULL'}, {[sysDescr], 'NULL'}]), gb(0, 2, [[tCnt2, 1]]), - ?line ?expect1([{[tCnt2,2], 100}, + ?expect1([{[tCnt2,2], 100}, {[tCnt2,2], endOfMibView}]). @@ -4056,68 +4043,68 @@ v2_set_p() -> %% 4.2.5:1 ?DBG("v2_set_p -> entry",[]), s([{[1,3,7,0], i, 4}]), - ?line ?expect3(noAccess, 1, [{[1,3,7,0], 4}]), + ?expect3(noAccess, 1, [{[1,3,7,0], 4}]), s([{[tDescr,0], s, "outside mibview"}]), - ?line ?expect3(noAccess, 1, [{[tDescr,0], "outside mibview"}]), + ?expect3(noAccess, 1, [{[tDescr,0], "outside mibview"}]), %% 4.2.5:2 s([{[1,3,6,1,0], s, "noSuchObject"}]), - ?line ?expect3(notWritable, 1, [{[1,3,6,1,0], "noSuchObject"}]), + ?expect3(notWritable, 1, [{[1,3,6,1,0], "noSuchObject"}]), %% 4.2.5:3 s([{[tDescr2, 0], i, 4}]), - ?line ?expect3(wrongType, 1, [{[tDescr2, 0], 4}]), + ?expect3(wrongType, 1, [{[tDescr2, 0], 4}]), s([{[tDescr2, 0], s, "badValue"}]), - ?line ?expect3(badValue, 1, [{[tDescr2, 0], "badValue"}]), + ?expect3(badValue, 1, [{[tDescr2, 0], "badValue"}]), %% 4.2.5:4 s([{[tStr, 0], s, ""}]), - ?line ?expect3(wrongLength, 1, [{[tStr, 0], ""}]), + ?expect3(wrongLength, 1, [{[tStr, 0], ""}]), s([{[tStr, 0], s, "12345"}]), - ?line ?expect3(wrongLength, 1, [{[tStr, 0], "12345"}]), + ?expect3(wrongLength, 1, [{[tStr, 0], "12345"}]), %% 4.2.5:5 - N/A %% 4.2.5:6 s([{[tInt1, 0], i, 0}]), - ?line ?expect3(wrongValue, 1, [{[tInt1, 0], 0}]), + ?expect3(wrongValue, 1, [{[tInt1, 0], 0}]), s([{[tInt1, 0], i, 5}]), - ?line ?expect3(wrongValue, 1, [{[tInt1, 0], 5}]), + ?expect3(wrongValue, 1, [{[tInt1, 0], 5}]), s([{[tInt2, 0], i, 0}]), - ?line ?expect3(wrongValue, 1, [{[tInt2, 0], 0}]), + ?expect3(wrongValue, 1, [{[tInt2, 0], 0}]), s([{[tInt2, 0], i, 5}]), - ?line ?expect3(wrongValue, 1, [{[tInt2, 0], 5}]), + ?expect3(wrongValue, 1, [{[tInt2, 0], 5}]), s([{[tInt3, 0], i, 5}]), - ?line ?expect3(wrongValue, 1, [{[tInt3, 0], 5}]), + ?expect3(wrongValue, 1, [{[tInt3, 0], 5}]), %% 4.2.5:7 s([{[tDescrX, 1, 1], s, "noCreation"}]), - ?line ?expect3(noCreation, 1, [{[tDescrX, 1, 1], "noCreation"}]), + ?expect3(noCreation, 1, [{[tDescrX, 1, 1], "noCreation"}]), %% 4.2.5:8 s([{[tDescrX, 1, 2], s, "inconsistentName"}]), - ?line ?expect3(inconsistentName, 1, + ?expect3(inconsistentName, 1, [{[tDescrX, 1, 2], "inconsistentName"}]), %% 4.2.5:9 s([{[tCnt, 1, 2], i, 5}]), - ?line ?expect3(notWritable, 1, [{[tCnt, 1, 2], 5}]), + ?expect3(notWritable, 1, [{[tCnt, 1, 2], 5}]), s([{[tDescr3,0], s, "read-only"}]), - ?line ?expect3(notWritable, 1, [{[tDescr3,0], "read-only"}]), + ?expect3(notWritable, 1, [{[tDescr3,0], "read-only"}]), %% 4.2.5:10 s([{[tDescr2,0], s, "inconsistentValue"}]), - ?line ?expect3(inconsistentValue, 1, + ?expect3(inconsistentValue, 1, [{[tDescr2,0], "inconsistentValue"}]), %% 4.2.5:11 s([{[tDescr2,0], s, "resourceUnavailable"}]), - ?line ?expect3(resourceUnavailable, 1, + ?expect3(resourceUnavailable, 1, [{[tDescr2,0],"resourceUnavailable"}]), %% 4.2.5:12 s([{[tDescr2, 0], s, "is_set_ok_fail"}]), - ?line ?expect3(genErr, 1, [{[tDescr2, 0], "is_set_ok_fail"}]). + ?expect3(genErr, 1, [{[tDescr2, 0], "is_set_ok_fail"}]). %% commitFailed and undoFailed is tested by the 'undo' case. @@ -4131,26 +4118,26 @@ table_test() -> Key1c4 = [intCommunityAccess,get(mip),is("public")], EndKey = [intCommunityEntry,[9],get(mip),is("public")], gn([[intCommunityEntry]]), - ?line ?expect1([{Key1c3, 2}]), + ?expect1([{Key1c3, 2}]), gn([[intCommunityTable]]), - ?line ?expect1([{Key1c3, 2}]), + ?expect1([{Key1c3, 2}]), gn([[community]]), - ?line ?expect1([{Key1c3, 2}]), + ?expect1([{Key1c3, 2}]), gn([[otpSnmpeaMIB]]), - ?line ?expect1([{Key1c3, 2}]), + ?expect1([{Key1c3, 2}]), gn([[ericsson]]), - ?line ?expect1([{Key1c3, 2}]), + ?expect1([{Key1c3, 2}]), gn([Key1c3]), - ?line ?expect1([{Key2c3, 2}]), + ?expect1([{Key2c3, 2}]), gn([Key2c3]), - ?line ?expect1([{Key1c4, 2}]), + ?expect1([{Key1c4, 2}]), gn([EndKey]), AgentIp = [intAgentIpAddress,0], - ?line ?expect1([{AgentIp, any}]), + ?expect1([{AgentIp, any}]), g([Key1c3]), - ?line ?expect1([{Key1c3, 2}]), + ?expect1([{Key1c3, 2}]), g([EndKey]), - ?line ?v1_2(?expect3(noSuchName, 1, any), + ?v1_2(?expect3(noSuchName, 1, any), ?expect1([{EndKey, noSuchObject}])), io:format("Testing row creation/deletion on communityTable...~n"), @@ -4158,33 +4145,33 @@ table_test() -> NewKeyc4 = [intCommunityAccess,get(mip),is("test")], NewKeyc5 = [intCommunityStatus,get(mip),is("test")], s([{NewKeyc5, ?createAndGo}]), - ?line ?expect3(?v1_2(badValue, inconsistentValue), 1, any), + ?expect3(?v1_2(badValue, inconsistentValue), 1, any), s([{NewKeyc5, ?createAndGo}, {NewKeyc3, 2}, {NewKeyc4, 2}]), - ?line ?expect1([{NewKeyc5, ?createAndGo},{NewKeyc3, 2}, {NewKeyc4, 2}]), + ?expect1([{NewKeyc5, ?createAndGo},{NewKeyc3, 2}, {NewKeyc4, 2}]), g([NewKeyc4]), - ?line ?expect1([{NewKeyc4, 2}]), + ?expect1([{NewKeyc4, 2}]), s([{NewKeyc5, ?destroy}]), - ?line ?expect1([{NewKeyc5, ?destroy}]), + ?expect1([{NewKeyc5, ?destroy}]), s([{NewKeyc4, 2}]), - ?line ?expect3(?v1_2(noSuchName, inconsistentName), 1, [{NewKeyc4, 2}]), + ?expect3(?v1_2(noSuchName, inconsistentName), 1, [{NewKeyc4, 2}]), s([{NewKeyc5, ?createAndWait}]), - ?line ?expect1([{NewKeyc5, ?createAndWait}]), + ?expect1([{NewKeyc5, ?createAndWait}]), g([NewKeyc5]), - ?line ?expect1([{NewKeyc5, ?notReady}]), + ?expect1([{NewKeyc5, ?notReady}]), s([{NewKeyc4, 2}]), - ?line ?expect1([{NewKeyc4, 2}]), + ?expect1([{NewKeyc4, 2}]), g([NewKeyc5]), - ?line ?expect1([{NewKeyc5, ?notReady}]), + ?expect1([{NewKeyc5, ?notReady}]), s([{NewKeyc3, 2}]), - ?line ?expect1([{NewKeyc3, 2}]), + ?expect1([{NewKeyc3, 2}]), g([NewKeyc5]), - ?line ?expect1([{NewKeyc5, ?notInService}]), + ?expect1([{NewKeyc5, ?notInService}]), s([{NewKeyc5, ?active}]), - ?line ?expect1([{NewKeyc5, ?active}]), + ?expect1([{NewKeyc5, ?active}]), s([{NewKeyc5, ?destroy}]), - ?line ?expect1([{NewKeyc5, ?destroy}]), + ?expect1([{NewKeyc5, ?destroy}]), s([{NewKeyc3, 3}]), - ?line ?expect3(?v1_2(noSuchName, inconsistentName), 1, [{NewKeyc3, 3}]), + ?expect3(?v1_2(noSuchName, inconsistentName), 1, [{NewKeyc3, 3}]), otp_1128_test(), ok. @@ -4192,46 +4179,45 @@ table_test() -> simple_standard_test() -> ?DBG("simple_standard_test -> entry",[]), gn([[1,1]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), gn([[1,3]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), gn([[1,3,6]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), gn([[1,3,6,1]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), gn([[1,3,6,1,2]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), gn([[1,3,6,1,2,1]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), gn([[1,3,6,1,2,1,1]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), gn([[sysDescr]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), g([[sysDescr,0]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}]), g([[sysDescr]]), - ?line ?v1_2(?expect3(noSuchName, 1, any), + ?v1_2(?expect3(noSuchName, 1, any), ?expect1([{[sysDescr], noSuchObject}])), g([[1,6,7,0]]), - ?line ?v1_2(?expect3(noSuchName, 1, any), + ?v1_2(?expect3(noSuchName, 1, any), ?expect1([{[1,6,7,0], noSuchObject}])), gn([[1,13]]), - ?line ?v1_2(?expect3(noSuchName,1, any), + ?v1_2(?expect3(noSuchName,1, any), ?expect1([{[1,13], endOfMibView}])), s([{[sysLocation, 0], "new_value"}]), - ?line ?expect1([{[sysLocation, 0], "new_value"}]), + ?expect1([{[sysLocation, 0], "new_value"}]), g([[sysLocation, 0]]), - ?line ?expect1([{[sysLocation, 0], "new_value"}]), + ?expect1([{[sysLocation, 0], "new_value"}]), io:format("Testing noSuchName and badValue...~n"), s([{[sysServices,0], 3}]), - ?line ?expect3(?v1_2(noSuchName, notWritable), 1, any), + ?expect3(?v1_2(noSuchName, notWritable), 1, any), s([{[sysLocation, 0], i, 3}]), - ?line ?expect3(?v1_2(badValue, wrongType), 1, any), + ?expect3(?v1_2(badValue, wrongType), 1, any), ?DBG("simple_standard_test -> done",[]), 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), @@ -4280,11 +4266,11 @@ db_notify_client(Config) when is_list(Config) -> db_notify_client_test() -> ?DBG("set first new sysLocation",[]), s([{[sysLocation, 0], "new_value"}]), - ?line ?expect1([{[sysLocation, 0], "new_value"}]), + ?expect1([{[sysLocation, 0], "new_value"}]), ?DBG("set second new sysLocation",[]), s([{[sysLocation, 0], "new_value"}]), - ?line ?expect1([{[sysLocation, 0], "new_value"}]). + ?expect1([{[sysLocation, 0], "new_value"}]). %% Callback function notify(Pid, What) -> @@ -4300,23 +4286,23 @@ big_test() -> ?DBG("big_test -> testing simple next/get/set @ subagent...",[]), gn([[klas1]]), - ?line ?expect1([{[fname,0], ""}]), + ?expect1([{[fname,0], ""}]), g([[fname,0]]), - ?line ?expect1([{[fname,0], ""}]), + ?expect1([{[fname,0], ""}]), s([{[fname,0], s, "test set"}]), - ?line ?expect1([{[fname,0], "test set"}]), + ?expect1([{[fname,0], "test set"}]), g([[fname,0]]), - ?line ?expect1([{[fname,0], "test set"}]), + ?expect1([{[fname,0], "test set"}]), ?DBG("big_test -> " "testing next from last instance in master to subagent...",[]), gn([[?v1_2(sysServices, sysORLastChange),0]]), - ?line ?expect1([{[fname,0], "test set"}]), + ?expect1([{[fname,0], "test set"}]), gn([[1,1], [?v1_2(sysServices, sysORLastChange),0]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {[fname,0], "test set"}]), s([{[fname,0], s, ""}]), - ?line ?expect1([{[fname,0], ""}]), + ?expect1([{[fname,0], ""}]), table_test(), @@ -4324,14 +4310,14 @@ big_test() -> _FTab = [friendsEntry], s([{[friendsEntry, [2, 3]], s, "kompis3"}, {[friendsEntry, [3, 3]], i, ?createAndGo}]), - ?line ?expect1([{[friendsEntry, [2, 3]], "kompis3"}, + ?expect1([{[friendsEntry, [2, 3]], "kompis3"}, {[friendsEntry, [3, 3]], ?createAndGo}]), g([[friendsEntry, [2, 3]], [friendsEntry, [3, 3]]]), - ?line ?expect1([{[friendsEntry, [2, 3]], "kompis3"}, + ?expect1([{[friendsEntry, [2, 3]], "kompis3"}, {[friendsEntry, [3, 3]], ?active}]), s([{[friendsEntry, [3, 3]], i, ?destroy}]), - ?line ?expect1([{[friendsEntry, [3, 3]], ?destroy}]), + ?expect1([{[friendsEntry, [3, 3]], ?destroy}]), otp_1131_test(), @@ -4339,28 +4325,28 @@ big_test() -> []), s([{[kompissEntry, [1, 3]], s, "kompis3"}, {[kompissEntry, [2, 3]], i, ?createAndGo}]), - ?line ?expect1([{[kompissEntry, [1, 3]], "kompis3"}, + ?expect1([{[kompissEntry, [1, 3]], "kompis3"}, {[kompissEntry, [2, 3]], ?createAndGo}]), g([[kompissEntry, [1, 3]], [kompissEntry, [2, 3]]]), - ?line ?expect1([{[kompissEntry, [1, 3]], "kompis3"}, + ?expect1([{[kompissEntry, [1, 3]], "kompis3"}, {[kompissEntry, [2, 3]], ?active}]), gn([[kompissEntry, [1]], [kompissEntry, [2]]]), - ?line ?expect1([{[kompissEntry, [1, 3]], "kompis3"}, + ?expect1([{[kompissEntry, [1, 3]], "kompis3"}, {[kompissEntry, [2, 3]], ?active}]), s([{[kompissEntry, [1, 2]], s, "kompis3"}, {[kompissEntry, [2, 2]], i, ?createAndGo}]), - ?line ?expect1([{[kompissEntry, [1, 2]], "kompis3"}, + ?expect1([{[kompissEntry, [1, 2]], "kompis3"}, {[kompissEntry, [2, 2]], ?createAndGo}]), gn([[kompissEntry, [1, 1]], [kompissEntry, [2, 1]]]), - ?line ?expect1([{[kompissEntry, [1, 2]], "kompis3"}, + ?expect1([{[kompissEntry, [1, 2]], "kompis3"}, {[kompissEntry, [2, 2]], ?active}]), s([{[kompissEntry, [2, 3]], i, ?destroy}]), - ?line ?expect1([{[kompissEntry, [2, 3]], ?destroy}]), + ?expect1([{[kompissEntry, [2, 3]], ?destroy}]), s([{[kompissEntry, [2, 2]], i, ?destroy}]), - ?line ?expect1([{[kompissEntry, [2, 2]], ?destroy}]), + ?expect1([{[kompissEntry, [2, 2]], ?destroy}]), ?DBG("big_test -> done",[]), ok. @@ -4371,21 +4357,21 @@ big_test_2() -> ?NPRINT("Testing simple next/get/set @ subagent (2)..."), gn([[klas2]]), - ?line ?expect1([{[fname2,0], ""}]), + ?expect1([{[fname2,0], ""}]), g([[fname2,0]]), - ?line ?expect1([{[fname2,0], ""}]), + ?expect1([{[fname2,0], ""}]), s([{[fname2,0], s, "test set"}]), - ?line ?expect1([{[fname2,0], "test set"}]), + ?expect1([{[fname2,0], "test set"}]), g([[fname2,0]]), - ?line ?expect1([{[fname2,0], "test set"}]), + ?expect1([{[fname2,0], "test set"}]), otp_1298_test(), ?NPRINT("Testing next from last object in master to subagent (2)..."), gn([[?v1_2(sysServices, sysORLastChange),0]]), - ?line ?expect1([{[fname2,0], "test set"}]), + ?expect1([{[fname2,0], "test set"}]), gn([[1,1], [?v1_2(sysServices, sysORLastChange),0]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {[fname2,0], "test set"}]), table_test(), @@ -4394,40 +4380,40 @@ big_test_2() -> _FTab = [friendsEntry2], s([{[friendsEntry2, [2, 3]], s, "kompis3"}, {[friendsEntry2, [3, 3]], i, ?createAndGo}]), - ?line ?expect1([{[friendsEntry2, [2, 3]], "kompis3"}, + ?expect1([{[friendsEntry2, [2, 3]], "kompis3"}, {[friendsEntry2, [3, 3]], ?createAndGo}]), g([[friendsEntry2, [2, 3]], [friendsEntry2, [3, 3]]]), - ?line ?expect1([{[friendsEntry2, [2, 3]], "kompis3"}, + ?expect1([{[friendsEntry2, [2, 3]], "kompis3"}, {[friendsEntry2, [3, 3]], ?active}]), s([{[friendsEntry2, [3, 3]], i, ?destroy}]), - ?line ?expect1([{[friendsEntry2, [3, 3]], ?destroy}]), + ?expect1([{[friendsEntry2, [3, 3]], ?destroy}]), ?NPRINT("Adding two rows in subagent table with special INDEX (2)"), s([{[kompissEntry2, [1, 3]], s, "kompis3"}, {[kompissEntry2, [2, 3]], i, ?createAndGo}]), - ?line ?expect1([{[kompissEntry2, [1, 3]], "kompis3"}, + ?expect1([{[kompissEntry2, [1, 3]], "kompis3"}, {[kompissEntry2, [2, 3]], ?createAndGo}]), g([[kompissEntry2, [1, 3]], [kompissEntry2, [2, 3]]]), - ?line ?expect1([{[kompissEntry2, [1, 3]], "kompis3"}, + ?expect1([{[kompissEntry2, [1, 3]], "kompis3"}, {[kompissEntry2, [2, 3]], ?active}]), gn([[kompissEntry2, [1]], [kompissEntry2, [2]]]), - ?line ?expect1([{[kompissEntry2, [1, 3]], "kompis3"}, + ?expect1([{[kompissEntry2, [1, 3]], "kompis3"}, {[kompissEntry2, [2, 3]], ?active}]), s([{[kompissEntry2, [1, 2]], s, "kompis3"}, {[kompissEntry2, [2, 2]], i, ?createAndGo}]), - ?line ?expect1([{[kompissEntry2, [1, 2]], "kompis3"}, + ?expect1([{[kompissEntry2, [1, 2]], "kompis3"}, {[kompissEntry2, [2, 2]], ?createAndGo}]), gn([[kompissEntry2, [1, 1]], [kompissEntry2, [2, 1]]]), - ?line ?expect1([{[kompissEntry2, [1, 2]], "kompis3"}, + ?expect1([{[kompissEntry2, [1, 2]], "kompis3"}, {[kompissEntry2, [2, 2]], ?active}]), s([{[kompissEntry2, [2, 3]], i, ?destroy}]), - ?line ?expect1([{[kompissEntry2, [2, 3]], ?destroy}]), + ?expect1([{[kompissEntry2, [2, 3]], ?destroy}]), s([{[kompissEntry2, [2, 2]], i, ?destroy}]), - ?line ?expect1([{[kompissEntry2, [2, 2]], ?destroy}]), + ?expect1([{[kompissEntry2, [2, 2]], ?destroy}]), ok. %% Req. Test1 @@ -4436,26 +4422,26 @@ multi_threaded_test() -> g([[multiStr,0]]), Pid = get_multi_pid(), g([[sysUpTime,0]]), - ?line ?expect1([{[sysUpTime,0], any}]), + ?expect1([{[sysUpTime,0], any}]), s([{[sysLocation, 0], s, "pelle"}]), - ?line ?expect1([{[sysLocation, 0], "pelle"}]), + ?expect1([{[sysLocation, 0], "pelle"}]), Pid ! continue, - ?line ?expect1([{[multiStr,0], "ok"}]), + ?expect1([{[multiStr,0], "ok"}]), s([{[multiStr, 0], s, "block"}]), Pid2 = get_multi_pid(), g([[sysUpTime,0]]), - ?line ?expect1([{[sysUpTime,0], any}]), + ?expect1([{[sysUpTime,0], any}]), g([[multiStr,0]]), Pid3 = get_multi_pid(), g([[sysUpTime,0]]), - ?line ?expect1([{[sysUpTime,0], any}]), + ?expect1([{[sysUpTime,0], any}]), s([{[sysLocation, 0], s, "kalle"}]), Pid3 ! continue, - ?line ?expect1([{[multiStr,0], "ok"}]), + ?expect1([{[multiStr,0], "ok"}]), Pid2 ! continue, - ?line ?expect1([{[multiStr,0], "block"}]), - ?line ?expect1([{[sysLocation,0], "kalle"}]). + ?expect1([{[multiStr,0], "block"}]), + ?expect1([{[sysLocation,0], "kalle"}]). %% Req. Test1, TestTrapv2 mt_trap_test(MA, MT) -> @@ -4463,12 +4449,12 @@ mt_trap_test(MA, MT) -> ?IPRINT("mt_trap_test(01) -> issue testTrapv22 (standard trap)", []), snmpa:send_trap(MA, testTrapv22, "standard trap"), ?IPRINT("mt_trap_test(02) -> await v2trap", []), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?system ++ [0,1]}]), %% multi-threaded = true %% This will *lock* the 'main thread' of a multi-threaded agent, - %% the worker state will be 'busy'. Therefor when a new request + %% the worker state will be 'busy'. Therefore when a new request %% arrives a new *temporary* worker will be spawned. ?IPRINT("mt_trap_test(03) -> issue mtTrap (standard trap)", []), snmpa:send_trap(MA, mtTrap, "standard trap"), @@ -4477,7 +4463,7 @@ mt_trap_test(MA, MT) -> g([[sysUpTime,0]]), ?IPRINT("mt_trap_test(06) -> await sysUpTime", []), - ?line ?expect1([{[sysUpTime,0], any}]), + ?expect1([{[sysUpTime,0], any}]), %% This will *only* work if multi-threaded is 'true', not 'extended' %% since in the latter case all notifications are serialized through @@ -4488,7 +4474,7 @@ mt_trap_test(MA, MT) -> ?IPRINT("mt_trap_test(07) -> issue testTrapv22 (standard trap)", []), snmpa:send_trap(MA, testTrapv22, "standard trap"), ?IPRINT("mt_trap_test(08) -> await v2trap", []), - ?line ?expect2(v2trap, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?system ++ [0,1]}]); true -> @@ -4499,7 +4485,7 @@ mt_trap_test(MA, MT) -> Pid ! continue, ?IPRINT("mt_trap_test(10) -> await v2trap", []), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?testTrap ++ [2]}, {[multiStr,0], "ok"}]), ?IPRINT("mt_trap_test(11) -> done", []), @@ -4509,7 +4495,7 @@ mt_trap_test(MA, MT) -> get_multi_pid() -> get_multi_pid(10). get_multi_pid(0) -> - ?line ?FAIL(no_global_name); + ?FAIL(no_global_name); get_multi_pid(N) -> ?SLEEP(1000), case global:whereis_name(snmp_multi_tester) of @@ -4522,26 +4508,26 @@ types_v2_test() -> ?NPRINT("Testing v2 types..."), s([{[bits1,0], 2#10}]), - ?line ?expect1([{[bits1,0], ?str(2#10)}]), + ?expect1([{[bits1,0], ?str(2#10)}]), g([[bits1,0]]), - ?line ?expect1([{[bits1,0], ?str(2#101)}]), + ?expect1([{[bits1,0], ?str(2#101)}]), s([{[bits2,0], 2#11000000110}]), - ?line ?expect1([{[bits2,0], ?str(2#11000000110)}]), + ?expect1([{[bits2,0], ?str(2#11000000110)}]), g([[bits2,0]]), - ?line ?expect1([{[bits2,0], ?str(2#11000000110)}]), + ?expect1([{[bits2,0], ?str(2#11000000110)}]), g([[bits3,0]]), - ?line ?expect3(genErr, 1, any), + ?expect3(genErr, 1, any), g([[bits4,0]]), - ?line ?expect3(genErr, 1, any), + ?expect3(genErr, 1, any), s([{[bits1,0], s, [2#10]}]), - ?line ?expect3(?v1_2(badValue, wrongValue), 1, any), + ?expect3(?v1_2(badValue, wrongValue), 1, any), s([{[bits2,0], 2#11001001101010011}]), - ?line ?expect3(?v1_2(badValue, wrongValue), 1, any). + ?expect3(?v1_2(badValue, wrongValue), 1, any). %% Req. Test1 @@ -4557,52 +4543,52 @@ implied_test(MA) -> Idx2 = "qq", ?DBG("implied_test -> (send) create row 1 '~s' in table 1",[Idx1]), s([{[testStatus, Idx1], i, ?createAndGo}, {[testDescr, Idx1],s,"row 1"}]), - ?line ?expect1([{[testStatus, Idx1], ?createAndGo}, + ?expect1([{[testStatus, Idx1], ?createAndGo}, {[testDescr, Idx1], "row 1"}]), ?DBG("implied_test -> (send) create row 2 '~s' in table 1",[Idx2]), s([{[testStatus, Idx2], i, ?createAndGo}, {[testDescr, Idx2],s,"row 2"}]), - ?line ?expect1([{[testStatus, Idx2], ?createAndGo}, + ?expect1([{[testStatus, Idx2], ?createAndGo}, {[testDescr, Idx2], "row 2"}]), ?DBG("implied_test -> get-next(testDescr)",[]), gn([[testDescr]]), - ?line ?expect1([{[testDescr,Idx1], "row 1"}]), + ?expect1([{[testDescr,Idx1], "row 1"}]), ?DBG("implied_test -> get-next(testDescr) of row 1",[]), gn([[testDescr,Idx1]]), - ?line ?expect1([{[testDescr,Idx2], "row 2"}]), + ?expect1([{[testDescr,Idx2], "row 2"}]), % Delete the rows ?DBG("implied_test -> (send) delete row 1 '~s' from table 1",[Idx1]), s([{[testStatus, Idx1], i, ?destroy}]), - ?line ?expect1([{[testStatus, Idx1], ?destroy}]), + ?expect1([{[testStatus, Idx1], ?destroy}]), ?DBG("implied_test -> (send) delete row 2 '~s' from table 1",[Idx2]), s([{[testStatus, Idx2], i, ?destroy}]), - ?line ?expect1([{[testStatus, Idx2], ?destroy}]), + ?expect1([{[testStatus, Idx2], ?destroy}]), %% Try the same in other table Idx3 = [1, "apa"], Idx4 = [1, "qq"], ?DBG("implied_test -> (send) create row 1 '~s' in table 2",[Idx3]), s([{[testStatus2, Idx3], i, ?createAndGo}, {[testDescr2,Idx3],s,"row 1"}]), - ?line ?expect1([{[testStatus2, Idx3], ?createAndGo}, + ?expect1([{[testStatus2, Idx3], ?createAndGo}, {[testDescr2, Idx3], "row 1"}]), ?DBG("implied_test -> (send) create row 2 '~s' in table 2",[Idx4]), s([{[testStatus2, Idx4], i, ?createAndGo}, {[testDescr2,Idx4],s,"row 2"}]), - ?line ?expect1([{[testStatus2, Idx4], ?createAndGo}, + ?expect1([{[testStatus2, Idx4], ?createAndGo}, {[testDescr2, Idx4], "row 2"}]), ?DBG("implied_test -> get-next(testDescr2)",[]), gn([[testDescr2]]), - ?line ?expect1([{[testDescr2,Idx3], "row 1"}]), + ?expect1([{[testDescr2,Idx3], "row 1"}]), ?DBG("implied_test -> get-next(testDescr2) of row 1",[]), gn([[testDescr2,Idx3]]), - ?line ?expect1([{[testDescr2,Idx4], "row 2"}]), + ?expect1([{[testDescr2,Idx4], "row 2"}]), % Delete the rows ?DBG("implied_test -> (send) delete row 1 '~s' from table 2",[Idx3]), s([{[testStatus2, Idx3], i, ?destroy}]), - ?line ?expect1([{[testStatus2, Idx3], ?destroy}]), + ?expect1([{[testStatus2, Idx3], ?destroy}]), ?DBG("implied_test -> (send) delete row 2 '~s' from table 2",[Idx4]), s([{[testStatus2, Idx4], i, ?destroy}]), - ?line ?expect1([{[testStatus2, Idx4], ?destroy}]), + ?expect1([{[testStatus2, Idx4], ?destroy}]), snmpa:verbosity(MA, log), @@ -4620,25 +4606,25 @@ sparse_table_test() -> Idx2 = 2, s([{[sparseStatus, Idx1], i, ?createAndGo}, {[sparseDescr, Idx1], s, "row 1"}]), - ?line ?expect1([{[sparseStatus, Idx1], ?createAndGo}, + ?expect1([{[sparseStatus, Idx1], ?createAndGo}, {[sparseDescr, Idx1], "row 1"}]), s([{[sparseStatus, Idx2], i, ?createAndGo}, {[sparseDescr, Idx2], s, "row 2"}]), - ?line ?expect1([{[sparseStatus, Idx2], ?createAndGo}, + ?expect1([{[sparseStatus, Idx2], ?createAndGo}, {[sparseDescr, Idx2], "row 2"}]), ?v1_2(gn([[sparseIndex], [sparseDescr,Idx1], [sparseDescr,Idx2], [sparseStatus,Idx1], [sparseStatus,Idx2]]), gb(0,5,[[sparseIndex]])), - ?line ?expect1([{[sparseDescr,Idx1], "row 1"}, + ?expect1([{[sparseDescr,Idx1], "row 1"}, {[sparseDescr,Idx2], "row 2"}, {[sparseStatus,Idx1], ?active}, {[sparseStatus,Idx2], ?active}, {[sparseStr,0], "slut"}]), %% Delete the rows s([{[sparseStatus, Idx1], i, ?destroy}]), - ?line ?expect1([{[sparseStatus, Idx1], ?destroy}]), + ?expect1([{[sparseStatus, Idx1], ?destroy}]), s([{[sparseStatus, Idx2], i, ?destroy}]), - ?line ?expect1([{[sparseStatus, Idx2], ?destroy}]). + ?expect1([{[sparseStatus, Idx2], ?destroy}]). %% Req. Test1 @@ -4653,12 +4639,12 @@ cnt_64_test(MA) -> ?DBG("get cnt64",[]), g([[cnt64,0]]), ?DBG("await response",[]), - ?line ?v1_2(?expect3(noSuchName, 1, any), + ?v1_2(?expect3(noSuchName, 1, any), ?expect1([{[cnt64,0],18446744073709551615}])), ?DBG("get-next cnt64",[]), gn([[cnt64]]), ?DBG("await response",[]), - ?line ?v1_2(?expect1([{[cnt64Str,0], "after cnt64"}]), + ?v1_2(?expect1([{[cnt64Str,0], "after cnt64"}]), ?expect1([{[cnt64,0],18446744073709551615}])), ?DBG("send cntTrap",[]), snmpa:send_trap(MA,cntTrap,"standard trap",[ @@ -4667,7 +4653,7 @@ cnt_64_test(MA) -> {sysLocation, "here"} ]), ?DBG("await response",[]), - ?line ?v1_2(?expect5(trap, [test], 6, 1, [{[sysContact,0], "pelle"}, + ?v1_2(?expect5(trap, [test], 6, 1, [{[sysContact,0], "pelle"}, {[sysLocation,0], "here"}]), ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?testTrap ++ [1]}, @@ -4681,26 +4667,26 @@ cnt_64_test(MA) -> ?DBG("create row (cntStatus): ~p",[Idx1]), s([{[cntStatus, Idx1], i, ?createAndGo}]), ?DBG("await response",[]), - ?line ?expect1([{[cntStatus, Idx1], ?createAndGo}]), + ?expect1([{[cntStatus, Idx1], ?createAndGo}]), ?DBG("create row (cntStatus): ~p",[Idx2]), s([{[cntStatus, Idx2], i, ?createAndGo}]), ?DBG("await response",[]), - ?line ?expect1([{[cntStatus, Idx2], ?createAndGo}]), + ?expect1([{[cntStatus, Idx2], ?createAndGo}]), ?DBG("get-next (cntIndex)",[]), gn([[cntIndex]]), ?DBG("await response",[]), - ?line ?v1_2(?expect1([{[cntStatus,Idx1], ?active}]), + ?v1_2(?expect1([{[cntStatus,Idx1], ?active}]), ?expect1([{[cntCnt,Idx1], 0}])), % Delete the rows ?DBG("delete row (cntStatus): ~p",[Idx1]), s([{[cntStatus, Idx1], i, ?destroy}]), ?DBG("await response",[]), - ?line ?expect1([{[cntStatus, Idx1], ?destroy}]), + ?expect1([{[cntStatus, Idx1], ?destroy}]), ?DBG("delete row (cntStatus): ~p",[Idx2]), s([{[cntStatus, Idx2], i, ?destroy}]), ?DBG("await response",[]), - ?line ?expect1([{[cntStatus, Idx2], ?destroy}]), + ?expect1([{[cntStatus, Idx2], ?destroy}]), catch snmpa:verbosity(MA, log), ?DBG("done",[]), ok. @@ -4709,40 +4695,40 @@ cnt_64_test(MA) -> opaque_test() -> ?NPRINT("Testing Opaque datatype..."), g([[opaqueObj,0]]), - ?line ?expect1([{[opaqueObj,0], "opaque-data"}]). + ?expect1([{[opaqueObj,0], "opaque-data"}]). %% Req. OLD-SNMPEA-MIB api_test(MaNode) -> - ?line {value, OID} = rpc:call(MaNode, snmpa, name_to_oid, + {value, OID} = rpc:call(MaNode, snmpa, name_to_oid, [intAgentIpAddress]), - ?line {value, intAgentIpAddress} = rpc:call(MaNode, snmpa, + {value, intAgentIpAddress} = rpc:call(MaNode, snmpa, oid_to_name, [OID]), - ?line false = rpc:call(MaNode, snmpa, name_to_oid, [intAgentIpAddres]), - ?line false = rpc:call(MaNode, snmpa, oid_to_name, + false = rpc:call(MaNode, snmpa, name_to_oid, [intAgentIpAddres]), + false = rpc:call(MaNode, snmpa, oid_to_name, [[1,5,32,3,54,3,3,34,4]]), - ?line {value, 2} = rpc:call(MaNode, snmpa, enum_to_int, + {value, 2} = rpc:call(MaNode, snmpa, enum_to_int, [intViewType, excluded]), - ?line {value, excluded} = rpc:call(MaNode, snmpa, int_to_enum, + {value, excluded} = rpc:call(MaNode, snmpa, int_to_enum, [intViewType, 2]), - ?line false = rpc:call(MaNode, snmpa, enum_to_int, [intViewType, exclude]), - ?line false = rpc:call(MaNode, snmpa, enum_to_int, + false = rpc:call(MaNode, snmpa, enum_to_int, [intViewType, exclude]), + false = rpc:call(MaNode, snmpa, enum_to_int, [intAgentIpAddress, exclude]), - ?line false = rpc:call(MaNode, snmpa, enum_to_int, + false = rpc:call(MaNode, snmpa, enum_to_int, [intAgentIpAddre, exclude]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, [intViewType, 3]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, [intAgentIpAddress, 2]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, [intAgentIpAddre, 2]), - ?line {value, active} = rpc:call(MaNode, snmpa, + false = rpc:call(MaNode, snmpa, int_to_enum, [intViewType, 3]), + false = rpc:call(MaNode, snmpa, int_to_enum, [intAgentIpAddress, 2]), + false = rpc:call(MaNode, snmpa, int_to_enum, [intAgentIpAddre, 2]), + {value, active} = rpc:call(MaNode, snmpa, int_to_enum, ['RowStatus', ?active]), - ?line {value, ?destroy} = rpc:call(MaNode, snmpa, + {value, ?destroy} = rpc:call(MaNode, snmpa, enum_to_int, ['RowStatus', destroy]), - ?line false = rpc:call(MaNode, snmpa, + false = rpc:call(MaNode, snmpa, enum_to_int, ['RowStatus', xxxdestroy]), - ?line false = rpc:call(MaNode, snmpa, + false = rpc:call(MaNode, snmpa, enum_to_int, ['xxRowStatus', destroy]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, ['RowStatus', 25]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, ['xxRowStatus', 1]), - ?line case snmp:date_and_time() of + false = rpc:call(MaNode, snmpa, int_to_enum, ['RowStatus', 25]), + false = rpc:call(MaNode, snmpa, int_to_enum, ['xxRowStatus', 1]), + case snmp:date_and_time() of List when is_list(List), length(List) == 8 -> ok; List when is_list(List), length(List) == 11 -> ok end. @@ -4750,42 +4736,42 @@ api_test(MaNode) -> %% Req. Klas3 api_test2() -> g([[fname3,0]]), - ?line ?expect1([{[fname3,0], "ok"}]), + ?expect1([{[fname3,0], "ok"}]), g([[fname4,0]]), - ?line ?expect1([{[fname4,0], 1}]). + ?expect1([{[fname4,0], 1}]). api_test3() -> g([[fname3,0]]), - ?line ?expect1([{[fname3,0], "ok"}]). + ?expect1([{[fname3,0], "ok"}]). unreg_test() -> gn([[?v1_2(sysServices, sysORLastChange),0]]), - ?line ?expect1([{[snmpInPkts, 0], any}]). + ?expect1([{[snmpInPkts, 0], any}]). load_test() -> gn([[?v1_2(sysServices, sysORLastChange),0]]), - ?line ?expect1([{[fname,0], ""}]). + ?expect1([{[fname,0], ""}]). %% Req. Klas1 load_test_sa() -> gn([[?v1_2(sysServices,sysORLastChange), 0]]), - ?line ?expect1([{[fname,0], any}]). + ?expect1([{[fname,0], any}]). %% Req. system group, Klas1, OLD-SNMPEA-MIB do_mul_get() -> Key1c3 = [intCommunityEntry,[3],get(mip),is("public")], Key1c4 = [intCommunityEntry,[4],get(mip),is("public")], s([{[fname,0], s, "test set"}]), - ?line ?expect1([{[fname,0], "test set"}]), + ?expect1([{[fname,0], "test set"}]), g([[sysDescr,0], Key1c4, [fname,0],Key1c3,[sysName,0]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {Key1c4, 2}, {[fname,0], "test set"}, {Key1c3, 2}, {[sysName,0], "test"}]), g([[1,3,7,1], Key1c4, [sysDescr,0], [1,3,7,2], Key1c3, [sysDescr,0]]), - ?line ?v1_2(?expect3(noSuchName, [1,4], any), + ?v1_2(?expect3(noSuchName, [1,4], any), ?expect1([{[1,3,7,1], noSuchObject}, {Key1c4, 2}, {[sysDescr,0], "Erlang SNMP agent"}, @@ -4798,16 +4784,16 @@ do_mul_get_err() -> Key1c3 = [intCommunityEntry,[3],get(mip),is("public")], Key1c4 = [intCommunityEntry,[4],get(mip),is("public")], s([{[fname,0], s, "test set"}]), - ?line ?expect1([{[fname,0], "test set"}]), + ?expect1([{[fname,0], "test set"}]), g([[sysDescr,0],Key1c4,[fname,0], Key1c3, [sysName,2]]), - ?line ?v1_2(?expect3(noSuchName, 5, any), + ?v1_2(?expect3(noSuchName, 5, any), ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {Key1c4, 2}, {[fname,0], "test set"}, {Key1c3, 2}, {[sysName,2], noSuchInstance}])), g([[sysDescr,0],Key1c4,[fname3,0], Key1c3, [sysName,1]]), - ?line ?v1_2(?expect3(noSuchName, [3,5], any), + ?v1_2(?expect3(noSuchName, [3,5], any), ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {Key1c4, 2}, {[fname3,0], noSuchObject}, @@ -4822,9 +4808,9 @@ do_mul_next() -> Key1c3 = [intCommunityEntry,[3],get(mip),is("public")], Key1c4 = [intCommunityEntry,[4],get(mip),is("public")], s([{[fname,0], s, "test set"}]), - ?line ?expect1([{[fname,0], "test set"}]), + ?expect1([{[fname,0], "test set"}]), gn([[sysDescr], Key1c4s, [fname],Key1c3s,[sysName]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {Key1c4, 2}, {[fname,0], "test set"}, {Key1c3, 2}, {[sysName,0], "test"}]). @@ -4835,9 +4821,9 @@ do_mul_next_err() -> Key1c3 = [intCommunityEntry,[3],get(mip),is("public")], Key1c4 = [intCommunityEntry,[4],get(mip),is("public")], s([{[fname,0], s, "test set"}]), - ?line ?expect1([{[fname,0], "test set"}]), + ?expect1([{[fname,0], "test set"}]), gn([[sysDescr], Key1c4s, [1,3,6,999], [fname],[1,3,90], Key1c3s,[sysName]]), - ?line ?v1_2(?expect3(noSuchName, [3,5], any), + ?v1_2(?expect3(noSuchName, [3,5], any), ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {Key1c4, 2}, {[1,3,6,999], endOfMibView}, @@ -4859,7 +4845,7 @@ do_mul_set() -> {NewKeyc5, ?createAndGo}, {NewKeyc4, 2}, {[friendsEntry, [3, 3]], ?createAndGo}]), - ?line ?expect1([{[friendsEntry, [2, 3]], "kompis3"}, + ?expect1([{[friendsEntry, [2, 3]], "kompis3"}, {NewKeyc3, 2}, {[sysLocation,0], "new_value"}, {NewKeyc5, ?createAndGo}, @@ -4868,14 +4854,14 @@ do_mul_set() -> g([[friendsEntry, [2, 3]], [sysLocation,0], [friendsEntry, [3, 3]]]), - ?line ?expect1([{[friendsEntry, [2, 3]], "kompis3"}, + ?expect1([{[friendsEntry, [2, 3]], "kompis3"}, {[sysLocation,0], "new_value"}, {[friendsEntry, [3, 3]], ?active}]), g([NewKeyc4]), - ?line ?expect1([{NewKeyc4, 2}]), + ?expect1([{NewKeyc4, 2}]), s([{[friendsEntry, [3, 3]], ?destroy}, {NewKeyc5, ?destroy}]), - ?line ?expect1([{[friendsEntry, [3, 3]], ?destroy}, + ?expect1([{[friendsEntry, [3, 3]], ?destroy}, {NewKeyc5, ?destroy}]). %% Req. system group, Klas1, OLD-SNMPEA-MIB @@ -4890,46 +4876,46 @@ do_mul_set_err() -> {NewKeyc5, ?createAndGo}, {NewKeyc4, 2}, {[friendsEntry, [3, 3]], ?createAndGo}]), - ?line ?expect3(?v1_2(noSuchName, notWritable), 3, any), + ?expect3(?v1_2(noSuchName, notWritable), 3, any), g([[friendsEntry, [2, 3]]]), - ?line ?v1_2(?expect3(noSuchName, 1, any), + ?v1_2(?expect3(noSuchName, 1, any), ?expect1([{[friendsEntry, [2,3]], noSuchInstance}])), g([NewKeyc4]), - ?line ?v1_2(?expect3(noSuchName, 1, any), + ?v1_2(?expect3(noSuchName, 1, any), ?expect1([{NewKeyc4, noSuchInstance}])). %% Req. SA-MIB sa_mib() -> g([[sa, [2,0]]]), - ?line ?expect1([{[sa, [2,0]], 3}]), + ?expect1([{[sa, [2,0]], 3}]), s([{[sa, [1,0]], s, "sa_test"}]), - ?line ?expect1([{[sa, [1,0]], "sa_test"}]), + ?expect1([{[sa, [1,0]], "sa_test"}]), ok. ma_trap1(MA) -> ok = snmpa:send_trap(MA, testTrap2, "standard trap"), - ?line ?expect5(trap, [system], 6, 1, [{[system, [4,0]], + ?expect5(trap, [system], 6, 1, [{[system, [4,0]], "{mbj,eklas}@erlang.ericsson.se"}]), ok = snmpa:send_trap(MA, testTrap1, "standard trap"), - ?line ?expect5(trap, [1,2,3] , 1, 0, [{[system, [4,0]], + ?expect5(trap, [1,2,3] , 1, 0, [{[system, [4,0]], "{mbj,eklas}@erlang.ericsson.se"}]), ok. ma_trap2(MA) -> snmpa:send_trap(MA,testTrap2,"standard trap",[{sysContact,"pelle"}]), - ?line ?expect5(trap, [system], 6, 1, [{[system, [4,0]], "pelle"}]), + ?expect5(trap, [system], 6, 1, [{[system, [4,0]], "pelle"}]), ok. ma_v2_2_v1_trap(MA) -> snmpa:send_trap(MA,testTrapv22,"standard trap",[{sysContact,"pelle"}]), - ?line ?expect5(trap, [system], 6, 1, [{[system, [4,0]], "pelle"}]), + ?expect5(trap, [system], 6, 1, [{[system, [4,0]], "pelle"}]), ok. ma_v2_2_v1_trap2(MA) -> snmpa:send_trap(MA,linkUp,"standard trap",[{ifIndex, [1], 1}, {ifAdminStatus, [1], 1}, {ifOperStatus, [1], 2}]), - ?line ?expect5(trap, [1,2,3], 3, 0, [{[ifIndex, 1], 1}, + ?expect5(trap, [1,2,3], 3, 0, [{[ifIndex, 1], 1}, {[ifAdminStatus, 1], 1}, {[ifOperStatus, 1], 2}]), ok. @@ -4949,7 +4935,7 @@ sa_trap1(SA) -> %% io:format("sa_trap1 -> SA trap send: " %% "~n TSRes: ~p" %% "~n", [TSRes]), - ?line ?expect5(trap, [ericsson], 6, 1, [{[system, [4,0]], + ?expect5(trap, [ericsson], 6, 1, [{[system, [4,0]], "{mbj,eklas}@erlang.ericsson.se"}, {[sa, [1,0]], "sa_test"}]), snmpa:verbosity(SA, {subagents, silence}), @@ -4957,14 +4943,14 @@ sa_trap1(SA) -> sa_trap2(SA) -> snmpa:send_trap(SA, saTrap, "standard trap",[{sysContact,"pelle"}]), - ?line ?expect5(trap, [ericsson], 6, 1, [{[system, [4,0]], "pelle"}, + ?expect5(trap, [ericsson], 6, 1, [{[system, [4,0]], "pelle"}, {[sa, [1,0]], "sa_test"}]), ok. sa_trap3(SA) -> snmpa:send_trap(SA, saTrap2, "standard trap", [{intViewSubtree, [4], [1,2,3,4]}]), - ?line ?expect5(trap, [ericsson], 6, 2, [{[system, [4,0]], + ?expect5(trap, [ericsson], 6, 2, [{[system, [4,0]], "{mbj,eklas}@erlang.ericsson.se"}, {[sa, [1,0]], "sa_test"}, {[intViewSubtree,4],[1,2,3,4]}]), @@ -4974,25 +4960,23 @@ ma_v2_trap1(MA) -> ?DBG("ma_v2_traps -> entry with MA = ~p => " "send standard trap: testTrapv22",[MA]), snmpa:send_trap(MA, testTrapv22, "standard trap"), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?system ++ [0,1]}]), ?DBG("ma_v2_traps -> send standard trap: testTrapv21",[]), snmpa:send_trap(MA, testTrapv21, "standard trap"), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?snmp ++ [1]}]), ok. ma_v2_trap2(MA) -> snmpa:send_trap(MA,testTrapv22,"standard trap",[{sysContact,"pelle"}]), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, - {[snmpTrapOID, 0], ?system ++ [0,1]}, - {[system, [4,0]], "pelle"}]). + ?expect2(v2trap, [{[sysUpTime, 0], any}, + {[snmpTrapOID, 0], ?system ++ [0,1]}, + {[system, [4,0]], "pelle"}]). %% Note: This test case takes a while... actually a couple of minutes. ma_v2_inform1(MA) -> - ?DBG("ma_v2_inform1 -> entry with" - "~n MA = ~p => " - "~n send notification: testTrapv22", [MA]), + ?IPRINT("begin ma_v2_inform1 (MA: ~p)", [MA]), CmdExpectInform = fun(_No, Response) -> @@ -5145,9 +5129,7 @@ ma_v2_inform1(MA) -> %% Note: This test case takes a while... actually a couple of minutes. ma_v2_inform2(MA) -> - ?DBG("ma_v2_inform2 -> entry with" - "~n MA = ~p => " - "~n send notification: testTrapv22", [MA]), + ?IPRINT("begin ma_v2_inform2 (MA: ~p)", [MA]), CmdExpectInform = fun(_No, Response) -> @@ -5244,9 +5226,7 @@ ma_v2_inform2(MA) -> %% Note: This test case takes a while... actually a couple of minutes. ma_v2_inform3(MA) -> - ?DBG("ma_v2_inform3 -> entry with" - "~n MA = ~p => " - "~n send notification: testTrapv22", [MA]), + ?IPRINT("begin ma_v2_inform3 (MA: ~p)", [MA]), CmdExpectInform = fun(_No, Response) -> @@ -5389,10 +5369,10 @@ command_handler([{_No, _Desc, Cmd}|Rest]) -> %% command_handler(Rest); %% {error, Reason} -> %% ?EPRINT("command_handler -> ~w error: ~n~p", [_No, Reason]), - %% ?line ?FAIL(Reason); + %% ?FAIL(Reason); %% Error -> %% ?EPRINT("command_handler -> ~w unexpected: ~n~p", [_No, Error]), - %% ?line ?FAIL({unexpected_command_result, Error}) + %% ?FAIL({unexpected_command_result, Error}) %% end. try Cmd() of ok -> @@ -5404,7 +5384,7 @@ command_handler([{_No, _Desc, Cmd}|Rest]) -> if (SysEvs =:= []) -> ?EPRINT("command_handler -> ~w error: ~n~p", [_No, Reason]), - ?line ?FAIL(Reason); + ?FAIL(Reason); true -> ?WPRINT("command_handler -> " "failed when we got system events: " @@ -5420,7 +5400,7 @@ command_handler([{_No, _Desc, Cmd}|Rest]) -> (SysEvs =:= []) -> ?EPRINT("command_handler -> " "~w unexpected: ~n~p", [_No, Error]), - ?line ?FAIL({unexpected_command_result, Error}); + ?FAIL({unexpected_command_result, Error}); true -> ?WPRINT("command_handler -> " "unexpected when we got system events: " @@ -5431,32 +5411,32 @@ command_handler([{_No, _Desc, Cmd}|Rest]) -> end catch C:E:S -> - ?IPRINT("command_handler -> command ~w catched", [_No]), + ?IPRINT("command_handler -> command ~w caught", [_No]), SysEvs = snmp_test_global_sys_monitor:events(), if (SysEvs =:= []) -> - ?EPRINT("command_handler -> ~w catched: " + ?EPRINT("command_handler -> ~w caught: " "~n Class: ~p" "~n Error: ~p" "~n Stack: ~p", [_No, C, E, S]), - ?line ?FAIL({catched_command_result, {C, E, S}}); + ?FAIL({catched_command_result, {C, E, S}}); true -> ?WPRINT("command_handler -> " - "catched when we got system events: " - "~n Catched: " + "caught when we got system events: " + "~n Caught: " "~n Class: ~p" "~n Error: ~p" "~n Stack: ~p" "~n Sys Events: ~p" "~n", [C, E, S, SysEvs]), - ?SKIP([{catched, {C, E, S}}, {system_events, SysEvs}]) + ?SKIP([{caught, {C, E, S}}, {system_events, SysEvs}]) end end. ma_v1_2_v2_trap(MA) -> snmpa:send_trap(MA,linkDown,"standard trap",[{ifIndex, [1], 1}]), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?snmpTraps ++ [3]}, {[ifIndex, 1], 1}, {[snmpTrapEnterprise, 0], [1,2,3]}]). @@ -5464,7 +5444,7 @@ ma_v1_2_v2_trap(MA) -> ma_v1_2_v2_trap2(MA) -> snmpa:send_trap(MA,testTrap2,"standard trap",[{sysContact,"pelle"}]), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?system ++ [0,1]}, {[system, [4,0]], "pelle"}, {[snmpTrapEnterprise, 0], ?system}]). @@ -5473,7 +5453,7 @@ ma_v1_2_v2_trap2(MA) -> sa_v1_2_v2_trap1(SA) -> snmpa:verbosity(SA, {subagents, trace}), snmpa:send_trap(SA, saTrap, "standard trap"), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?ericsson ++ [0, 1]}, {[system, [4,0]], "{mbj,eklas}@erlang.ericsson.se"}, @@ -5485,7 +5465,7 @@ sa_v1_2_v2_trap1(SA) -> sa_v1_2_v2_trap2(SA) -> snmpa:verbosity(SA, {subagents, trace}), snmpa:send_trap(SA, saTrap, "standard trap",[{sysContact,"pelle"}]), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?ericsson ++ [0, 1]}, {[system, [4,0]], "pelle"}, {[sa, [1,0]], "sa_test"}, @@ -5498,7 +5478,7 @@ sa_v1_2_v2_trap3(SA) -> snmpa:verbosity(SA, {subagents, trace}), snmpa:send_trap(SA, saTrap2, "standard trap", [{intViewSubtree, [4], [1,2,3,4]}]), - ?line ?expect2(v2trap, [{[sysUpTime, 0], any}, + ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], ?ericsson ++ [0, 2]}, {[system, [4,0]], "{mbj,eklas}@erlang.ericsson.se"}, @@ -5518,14 +5498,14 @@ sa_errs_bad_value() -> {[sa, [2,0]], 5}, % badValue (i is_set_ok) {NewKeyc5, ?createAndGo}, {NewKeyc4, 2}]), - ?line ?expect3(badValue, 2, any), + ?expect3(badValue, 2, any), s([{NewKeyc3, 2}, {[sa, [2,0]], 6}, % wrongValue (i is_set_ok) {NewKeyc5, ?createAndGo}, {NewKeyc4, 2}]), - ?line ?expect3(?v1_2(badValue, wrongValue), 2, any), + ?expect3(?v1_2(badValue, wrongValue), 2, any), g([NewKeyc4]), - ?line ?v1_2(?expect3(noSuchName, 1, any), + ?v1_2(?expect3(noSuchName, 1, any), ?expect1([{NewKeyc4, noSuchInstance}])). %% Req. SA-MIB, OLD-SNMPEA-MIB @@ -5535,22 +5515,22 @@ sa_errs_gen_err() -> NewKeyc5 = [intCommunityEntry,[5],get(mip),is("test")], s([{NewKeyc3, 2},{NewKeyc4, 2}, {NewKeyc5, ?createAndGo}, {[sa, [3,0]], 5}]), - ?line ?expect3(genErr, 4, any), + ?expect3(genErr, 4, any), % The row might have been added; we don't know. % (as a matter of fact we do - it is added, because the agent % first sets its own vars, and then th SAs. Lets destroy it. s([{NewKeyc5, ?destroy}]), - ?line ?expect1([{NewKeyc5, ?destroy}]). + ?expect1([{NewKeyc5, ?destroy}]). %% Req. SA-MIB, OLD-SNMPEA-MIB sa_too_big() -> g([[sa, [4,0]]]), - ?line ?expect1(tooBig). + ?expect1(tooBig). %% Req. Klas1, system group, snmp group (v1/v2) next_across_sa_test() -> gn([[sysDescr],[klas1,5]]), - ?line ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, + ?expect1([{[sysDescr,0], "Erlang SNMP agent"}, {[snmpInPkts, 0], any}]). %% snmp_test_mgr:s([{[fStatus3, 1], 4}, {[fname3,0], "ok"}]). -> noError @@ -5562,40 +5542,40 @@ next_across_sa_test() -> %% Req. Klas3, Klas4 undo_test() -> s([{[fStatus3, 1], 4}, {[fname3,0], "ok"}]), - ?line ?expect1([{[fStatus3, 1], 4}, {[fname3,0], "ok"}]), + ?expect1([{[fStatus3, 1], 4}, {[fname3,0], "ok"}]), s([{[fStatus3, 1], 4}, {[fname3,0], "hoj"}]), - ?line ?expect3(?v1_2(badValue, inconsistentValue), 2, any), + ?expect3(?v1_2(badValue, inconsistentValue), 2, any), s([{[fStatus3, 3], 4}, {[fname3,0], "hoj"}]), - ?line ?expect3(?v1_2(genErr, undoFailed), 1, any), + ?expect3(?v1_2(genErr, undoFailed), 1, any), s([{[fStatus3, 4], 4}, {[fname3,0], "ok"}]), - ?line ?expect3(?v1_2(genErr, commitFailed), 1, any), -% unfortunatly we don't know if we'll get undoFailed or commitFailed. + ?expect3(?v1_2(genErr, commitFailed), 1, any), +% unfortunately we don't know if we'll get undoFailed or commitFailed. % it depends on which order the agent traverses the varbind list. % s([{[fStatus3, 4], 4}, {[fname3,0], "ufail"}]), -% ?line expect(5, ?v1_2(genErr, undoFailed), 1, any), +% expect(5, ?v1_2(genErr, undoFailed), 1, any), s([{[fStatus3, 1], 4}, {[fname3,0], "xfail"}]), - ?line ?expect3(genErr, 2, any). + ?expect3(genErr, 2, any). %% Req. Klas3, Klas4 bad_return() -> g([[fStatus4,4], [fName4,4]]), - ?line ?expect3(genErr, 2, any), + ?expect3(genErr, 2, any), g([[fStatus4,5], [fName4,5]]), - ?line ?expect3(genErr, 1, any), + ?expect3(genErr, 1, any), g([[fStatus4,6], [fName4,6]]), - ?line ?expect3(genErr, 2, any), + ?expect3(genErr, 2, any), gn([[fStatus4,7], [fName4,7]]), - ?line ?expect3(genErr, 2, any), + ?expect3(genErr, 2, any), gn([[fStatus4,8], [fName4,8]]), - ?line ?expect3(genErr, 1, any), + ?expect3(genErr, 1, any), gn([[fStatus4,9], [fName4,9]]), - ?line ?expect3(genErr, 2, any). + ?expect3(genErr, 2, any). %%%----------------------------------------------------------------- @@ -5630,7 +5610,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), @@ -5671,9 +5650,9 @@ snmp_standard_mib(Config) when is_list(Config) -> %% Req. SNMP-STANDARD-MIB standard_mib_a() -> - ?line [OutPkts] = get_req(2, [[snmpOutPkts,0]]), - ?line [OutPkts2] = get_req(3, [[snmpOutPkts,0]]), - ?line OutPkts2 = OutPkts + 1, + [OutPkts] = get_req(2, [[snmpOutPkts,0]]), + [OutPkts2] = get_req(3, [[snmpOutPkts,0]]), + OutPkts2 = OutPkts + 1, %% There are some more counters we could test here, but it's not that %% important, since they are removed from SNMPv2-MIB. ok. @@ -5683,27 +5662,27 @@ std_mib_init() -> %% disable authentication failure traps. (otherwise w'd get many of %% them - this is also a test to see that it works). s([{[snmpEnableAuthenTraps,0], 2}]), - ?line ?expect1([{[snmpEnableAuthenTraps, 0], 2}]). + ?expect1([{[snmpEnableAuthenTraps, 0], 2}]). %% Req. SNMP-STANDARD-MIB | SNMPv2-MIB std_mib_finish() -> %% enable again s([{[snmpEnableAuthenTraps,0], 1}]), - ?line ?expect1([{[snmpEnableAuthenTraps, 0], 1}]). + ?expect1([{[snmpEnableAuthenTraps, 0], 1}]). %% Req. SNMP-STANDARD-MIB standard_mib_test_finish() -> %% force a authenticationFailure (should result in a trap) std_mib_write(), %% check that we got a trap - ?line ?expect5(trap, [1,2,3], 4, 0, []). + ?expect5(trap, [1,2,3], 4, 0, []). %% Req. SNMP-STANDARD-MIB | SNMPv2-MIB std_mib_read() -> ?DBG("std_mib_read -> entry", []), g([[sysUpTime,0]]), % try a bad <something>; msg dropped, no reply ?DBG("std_mib_read -> await timeout (i.e. no reply)", []), - ?line ?expect1(timeout). % make sure we don't get a trap! + ?expect1(timeout). % make sure we don't get a trap! %% Req. SNMP-STANDARD-MIB | SNMPv2-MIB @@ -5731,7 +5710,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"), @@ -5763,7 +5741,7 @@ snmpv2_mib_2(Config) when is_list(Config) -> ?DBG("snmpv2_mib_2 -> check counters",[]), try_test(std_mib_c, [Bad]), - ?DBG("snmpv2_mib_2 -> get som counters",[]), + ?DBG("snmpv2_mib_2 -> get some counters",[]), try_test(snmpv2_mib_a), ?DBG("snmpv2_mib_2 -> enable auth traps, and await some",[]), @@ -5790,7 +5768,6 @@ standard_mibs3_cases() -> %% Req. SNMPv2-MIB -snmpv2_mib_3(suite) -> []; snmpv2_mib_3(Config) when is_list(Config) -> %% <CONDITIONAL-SKIP> Skippable = [{unix, [darwin]}], @@ -5820,31 +5797,31 @@ snmpv2_mib_test_finish() -> %% check that we got a trap ?DBG("ma_v2_inform -> await trap",[]), - ?line ?expect2(v2trap, [{[sysUpTime,0], any}, + ?expect2(v2trap, [{[sysUpTime,0], any}, {[snmpTrapOID,0], ?authenticationFailure}]), %% and the the inform ?DBG("ma_v2_inform -> await inform",[]), - ?line ?expect2({inform,true}, [{[sysUpTime,0], any}, + ?expect2({inform,true}, [{[sysUpTime,0], any}, {[snmpTrapOID,0],?authenticationFailure}]). %% Req. SNMP-STANDARD-MIB | SNMPv2-MIB std_mib_a() -> - ?line [InPkts] = get_req(2, [[snmpInPkts,0]]), - ?line [InPkts2] = get_req(3, [[snmpInPkts,0]]), - ?line InPkts2 = InPkts + 1, + [InPkts] = get_req(2, [[snmpInPkts,0]]), + [InPkts2] = get_req(3, [[snmpInPkts,0]]), + InPkts2 = InPkts + 1, - ?line [InBadVsns] = get_req(4, [[snmpInBadVersions,0]]), + [InBadVsns] = get_req(4, [[snmpInBadVersions,0]]), InBadVsns. %% Req. SNMP-STANDARD-MIB | SNMPv2-MIB std_mib_b(InBadVsns) -> - ?line [InBadVsns2] = get_req(1, [[snmpInBadVersions,0]]), - ?line InBadVsns2 = InBadVsns + 1, - ?line [InPkts] = get_req(2, [[snmpInPkts,0]]), - ?line [InPkts2] = get_req(3, [[snmpInPkts,0]]), - ?line InPkts2 = InPkts + 1, - ?line [InBadCommunityNames, InBadCommunityUses, InASNErrs] = + [InBadVsns2] = get_req(1, [[snmpInBadVersions,0]]), + InBadVsns2 = InBadVsns + 1, + [InPkts] = get_req(2, [[snmpInPkts,0]]), + [InPkts2] = get_req(3, [[snmpInPkts,0]]), + InPkts2 = InPkts + 1, + [InBadCommunityNames, InBadCommunityUses, InASNErrs] = get_req(4, [[snmpInBadCommunityNames,0], [snmpInBadCommunityUses,0], [snmpInASNParseErrs, 0]]), @@ -5852,25 +5829,25 @@ std_mib_b(InBadVsns) -> %% Req. SNMP-STANDARD-MIB | SNMPv2-MIB std_mib_c({InBadCommunityNames, InBadCommunityUses, InASNErrs}) -> - ?line [InBadCommunityNames2, InBadCommunityUses2, InASNErrs2] = + [InBadCommunityNames2, InBadCommunityUses2, InASNErrs2] = get_req(1, [[snmpInBadCommunityNames,0], [snmpInBadCommunityUses,0], [snmpInASNParseErrs, 0]]), - ?line InBadCommunityNames2 = InBadCommunityNames + 1, - ?line InBadCommunityUses2 = InBadCommunityUses + 1, - ?line InASNErrs2 = InASNErrs + 1. + InBadCommunityNames2 = InBadCommunityNames + 1, + InBadCommunityUses2 = InBadCommunityUses + 1, + InASNErrs2 = InASNErrs + 1. %% Req. SNMPv2-MIB snmpv2_mib_a() -> - ?line [SetSerial] = get_req(2, [[snmpSetSerialNo,0]]), + [SetSerial] = get_req(2, [[snmpSetSerialNo,0]]), s([{[snmpSetSerialNo,0], SetSerial}, {[sysLocation, 0], "val2"}]), - ?line ?expect1([{[snmpSetSerialNo,0], SetSerial}, + ?expect1([{[snmpSetSerialNo,0], SetSerial}, {[sysLocation, 0], "val2"}]), s([{[sysLocation, 0], "val3"}, {[snmpSetSerialNo,0], SetSerial}]), - ?line ?expect3(inconsistentValue, 2, + ?expect3(inconsistentValue, 2, [{[sysLocation, 0], "val3"}, {[snmpSetSerialNo,0], SetSerial}]), - ?line ["val2"] = get_req(5, [[sysLocation,0]]), + ["val2"] = get_req(5, [[sysLocation,0]]), ok. @@ -5879,13 +5856,12 @@ 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), - ?line load_master_std("SNMP-COMMUNITY-MIB"), + load_master_std("SNMP-COMMUNITY-MIB"), try_test(snmp_community_mib_test), - ?line unload_master("SNMP-COMMUNITY-MIB"). + unload_master("SNMP-COMMUNITY-MIB"). snmp_community_mib_2(X) -> ?P(snmp_community_mib_2), snmp_community_mib(X). @@ -5898,17 +5874,15 @@ 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), - ?line load_master_std("SNMP-FRAMEWORK-MIB"), + load_master_std("SNMP-FRAMEWORK-MIB"), try_test(snmp_framework_mib_test), - ?line unload_master("SNMP-FRAMEWORK-MIB"). + unload_master("SNMP-FRAMEWORK-MIB"). 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), @@ -5921,7 +5895,7 @@ snmp_framework_mib_3(Config) when is_list(Config) -> %% the same as the number of seconds we sleep (5 in this case). %% But because, on some (slow or/and high loaded) hosts, the actual %% time we sleep could be a lot larger (due to, for instance, scheduling). -%% Therefor we must take that into account when we check if the +%% Therefore we must take that into account when we check if the %% Engine Time diff (between the two checks) is acceptably. snmp_framework_mib_test() -> @@ -5935,13 +5909,13 @@ snmp_framework_mib_test() -> ]), Sleep = 5, - ?line ["agentEngine"] = get_req(1, [[snmpEngineID,0]]), + ["agentEngine"] = get_req(1, [[snmpEngineID,0]]), T1 = snmp_misc:now(ms), - ?line [EngineTime] = get_req(2, [[snmpEngineTime,0]]), + [EngineTime] = get_req(2, [[snmpEngineTime,0]]), T2 = snmp_misc:now(ms), ?SLEEP(?SECS(Sleep)), T3 = snmp_misc:now(ms), - ?line [EngineTime2] = get_req(3, [[snmpEngineTime,0]]), + [EngineTime2] = get_req(3, [[snmpEngineTime,0]]), T4 = snmp_misc:now(ms), %% Ok, we tried to sleep 5 seconds, but how long did we actually sleep @@ -5988,18 +5962,18 @@ snmp_framework_mib_test() -> ?EPRINT("snmp_framework_mib -> (High) Engine Time diff (~w) too large: " "~n ~w < ~w", [EngineTimeDiff, HighEngineTime, EngineTime2]), - ?line ?FAIL({too_large_diff, EngineTime, EngineTime2}); + ?FAIL({too_large_diff, EngineTime, EngineTime2}); (LowEngineTime > EngineTime2) -> ?EPRINT("snmp_framework_mib -> (Low) Engine Time diff (~w) too large: " "~n ~w > ~w", [EngineTimeDiff, LowEngineTime, EngineTime2]), - ?line ?FAIL({too_large_diff, EngineTime, EngineTime2}); + ?FAIL({too_large_diff, EngineTime, EngineTime2}); true -> ok end, T5 = snmp_misc:now(ms), - ?line case get_req(4, [[snmpEngineBoots,0]]) of + case get_req(4, [[snmpEngineBoots,0]]) of [Boots] when is_integer(Boots) -> T6 = snmp_misc:now(ms), ?IPRINT("snmp_framework_mib -> " @@ -6016,7 +5990,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]}], @@ -6033,7 +6006,7 @@ snmp_mpd_mib_3(Config) when is_list(Config) -> %% Req. SNMP-MPD-MIB snmp_mpd_mib_a() -> - ?line [UnknownSecs, InvalidMsgs] = + [UnknownSecs, InvalidMsgs] = get_req(1, [[snmpUnknownSecurityModels,0], [snmpInvalidMsgs,0]]), Pdu = #pdu{type = 'get-request', @@ -6044,7 +6017,7 @@ snmp_mpd_mib_a() -> SPdu = #scopedPdu{contextEngineID = "agentEngine", contextName = "", data = Pdu}, - ?line SPDUBytes = snmp_pdus:enc_scoped_pdu(SPdu), + SPDUBytes = snmp_pdus:enc_scoped_pdu(SPdu), V3Hdr1 = #v3_hdr{msgID = 21, msgMaxSize = 484, msgFlags = [7], @@ -6059,38 +6032,37 @@ snmp_mpd_mib_a() -> data = SPDUBytes}, Message2 = #message{version = 'version-3', vsn_hdr = V3Hdr2, data = SPDUBytes}, - ?line MsgBytes1 = snmp_pdus:enc_message_only(Message1), - ?line MsgBytes2 = snmp_pdus:enc_message_only(Message2), + MsgBytes1 = snmp_pdus:enc_message_only(Message1), + MsgBytes2 = snmp_pdus:enc_message_only(Message2), snmp_test_mgr:send_bytes(MsgBytes1), snmp_test_mgr:send_bytes(MsgBytes2), - ?line [UnknownSecs2, InvalidMsgs2, UnknownPDUHs] = + [UnknownSecs2, InvalidMsgs2, UnknownPDUHs] = get_req(1, [[snmpUnknownSecurityModels,0], [snmpInvalidMsgs,0], [snmpUnknownPDUHandlers, 0]]), - ?line UnknownSecs2 = UnknownSecs + 1, - ?line InvalidMsgs2 = InvalidMsgs + 1, + UnknownSecs2 = UnknownSecs + 1, + InvalidMsgs2 = InvalidMsgs + 1, UnknownPDUHs. -define(snmpUnknownPDUHandlers_instance, [1,3,6,1,6,3,11,2,1,3,0]). snmp_mpd_mib_b() -> g([[sysUpTime,0]]), - ?line ?expect2(report, [{?snmpUnknownPDUHandlers_instance, any}]). + ?expect2(report, [{?snmpUnknownPDUHandlers_instance, any}]). snmp_mpd_mib_c(UnknownPDUHs) -> - ?line [UnknownPDUHs2] = get_req(1, [[snmpUnknownPDUHandlers, 0]]), - ?line UnknownPDUHs2 = UnknownPDUHs + 1, + [UnknownPDUHs2] = get_req(1, [[snmpUnknownPDUHandlers, 0]]), + UnknownPDUHs2 = UnknownPDUHs + 1, ok. -snmp_target_mib(suite) -> []; snmp_target_mib(Config) when is_list(Config) -> ?P(snmp_target_mib), init_case(Config), - ?line load_master_std("SNMP-TARGET-MIB"), + load_master_std("SNMP-TARGET-MIB"), try_test(snmp_target_mib_test), - ?line unload_master("SNMP-TARGET-MIB"). + unload_master("SNMP-TARGET-MIB"). snmp_target_mib_2(X) -> ?P(snmp_target_mib_2), snmp_target_mib(X). @@ -6100,13 +6072,12 @@ 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), - ?line load_master_std("SNMP-NOTIFICATION-MIB"), + load_master_std("SNMP-NOTIFICATION-MIB"), try_test(snmp_notification_mib_test), - ?line unload_master("SNMP-NOTIFICATION-MIB"). + unload_master("SNMP-NOTIFICATION-MIB"). snmp_notification_mib_2(X) -> ?P(snmp_notification_mib_2), snmp_notification_mib(X). @@ -6123,16 +6094,15 @@ 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), - ?line load_master_std("SNMP-VIEW-BASED-ACM-MIB"), - ?line load_master("Test2"), + load_master_std("SNMP-VIEW-BASED-ACM-MIB"), + load_master("Test2"), snmp_view_based_acm_mib(), - ?line unload_master("Test2"), - ?line unload_master("SNMP-VIEW-BASED-ACM-MIB"). + unload_master("Test2"), + unload_master("SNMP-VIEW-BASED-ACM-MIB"). snmp_view_based_acm_mib_2(X) -> ?P(snmp_view_based_acm_mib_2), @@ -6167,7 +6137,7 @@ snmp_view_based_acm_mib() -> v3 -> {?SEC_USM, ?SEC_V1} end, ?DBG("assign rights for 'no-rights'",[]), - ?line try_test(use_no_rights, [], Opts), + try_test(use_no_rights, [], Opts), %% Now, add a mapping from "no-rights" -> "no-rights-group" GRow1Status = [vacmSecurityToGroupStatus,[SecMod, 9,"no-rights"]], @@ -6175,25 +6145,25 @@ snmp_view_based_acm_mib() -> [{[vacmGroupName, [SecMod, 9,"no-rights"]], "no-rights-group"}, {GRow1Status, ?createAndGo}], ?DBG("set '~p'",[GRow1]), - ?line try_test(do_set, [GRow1]), + try_test(do_set, [GRow1]), ?DBG("assign rights for 'no-rights'",[]), - ?line try_test(use_no_rights, [], Opts), + try_test(use_no_rights, [], Opts), - %% Create a mapping for another sec model, and make sure it dosn't + %% Create a mapping for another sec model, and make sure it doesn't %% give us access GRow2Status = [vacmSecurityToGroupStatus,[InvSecMod, 9,"no-rights"]], GRow2 = [{[vacmGroupName, [InvSecMod, 9, "no-rights"]], "initial"}, {GRow2Status, ?createAndGo}], ?DBG("set '~p'",[GRow2]), - ?line try_test(do_set, [GRow2]), + try_test(do_set, [GRow2]), ?DBG("assign rights for 'no-rights'",[]), - ?line try_test(use_no_rights, [], Opts), + try_test(use_no_rights, [], Opts), %% Delete that row - ?line try_test(del_row, [GRow2Status]), + try_test(del_row, [GRow2Status]), RVName = "rv_name", WVName = "wv_name", @@ -6206,7 +6176,7 @@ snmp_view_based_acm_mib() -> {[vacmAccessWriteViewName, ARow1Idx], WVName}, {ARow1Status, ?createAndGo}], - %% This access row would give acces, if InvSecMod was valid. + %% This access row would give access, if InvSecMod was valid. ARow2Idx = [15 | "no-rights-group"] ++ [0, InvSecMod, 1], ARow2Status = [vacmAccessStatus, ARow2Idx], ARow2 = [{[vacmAccessContextMatch, ARow2Idx], 1}, @@ -6214,18 +6184,18 @@ snmp_view_based_acm_mib() -> {[vacmAccessWriteViewName, ARow2Idx], "internet"}, {ARow2Status, ?createAndGo}], - ?line try_test(do_set, [ARow2]), + try_test(do_set, [ARow2]), - ?line try_test(use_no_rights, [], Opts), + try_test(use_no_rights, [], Opts), %% Delete that row - ?line try_test(del_row, [ARow2Status]), + try_test(del_row, [ARow2Status]), %% Add valid row - ?line try_test(do_set, [ARow1]), + try_test(do_set, [ARow1]), - ?line try_test(use_no_rights, [], Opts), + try_test(use_no_rights, [], Opts), %% Create the view family VRow1Idx = mk_ln(RVName) ++ mk_ln(?xDescr), % object access @@ -6237,32 +6207,32 @@ snmp_view_based_acm_mib() -> VRow3Status = [vacmViewTreeFamilyStatus, VRow3Idx], VRow4Status = [vacmViewTreeFamilyStatus, VRow4Idx], - ?line try_test(add_row, [VRow1Status]), - ?line try_test(add_row, [VRow2Status]), - ?line try_test(add_row, [VRow3Status]), + try_test(add_row, [VRow1Status]), + try_test(add_row, [VRow2Status]), + try_test(add_row, [VRow3Status]), %% We're supposed to have access now... - ?line try_test(use_rights, [], Opts), + try_test(use_rights, [], Opts), %% Change Row3 to Row4 - ?line try_test(del_row, [VRow3Status]), - ?line try_test(add_row, [VRow4Status]), + try_test(del_row, [VRow3Status]), + try_test(add_row, [VRow4Status]), %% We should still have access... - ?line try_test(use_rights, [], Opts), + try_test(use_rights, [], Opts), %% Delete rows - ?line try_test(del_row, [GRow1Status]), + try_test(del_row, [GRow1Status]), - ?line try_test(use_no_rights, [], Opts), + try_test(use_no_rights, [], Opts), %% Delete rest of rows - ?line try_test(del_row, [ARow1Status]), - ?line try_test(del_row, [VRow1Status]), - ?line try_test(del_row, [VRow2Status]), - ?line try_test(del_row, [VRow4Status]), + try_test(del_row, [ARow1Status]), + try_test(del_row, [VRow1Status]), + try_test(del_row, [VRow2Status]), + try_test(del_row, [VRow4Status]), - ?line try_test(use_no_rights, [], Opts), + try_test(use_no_rights, [], Opts), snmpa:verbosity(master_agent,log). do_set(Row) -> @@ -6318,7 +6288,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]}], @@ -6330,7 +6299,7 @@ snmp_user_based_sm_mib_3(Config) when is_list(Config) -> init_case(Config), _AgentDir = ?config(agent_conf_dir, Config), - ?line load_master_std("SNMP-USER-BASED-SM-MIB"), + load_master_std("SNMP-USER-BASED-SM-MIB"), %% The newUser used here already has VACM access. @@ -6339,10 +6308,10 @@ snmp_user_based_sm_mib_3(Config) when is_list(Config) -> [{sec_level, authPriv}, {user, "privDES"}]), %% Try to use the new user - ?line load_master("Test2"), + load_master("Test2"), try_test(v3_sync, [[{usm_use_user, []}]], [{sec_level, authPriv}, {user, "newUser"}]), - ?line unload_master("Test2"), + unload_master("Test2"), ShaKey1 = snmp:passwd2localized_key(sha, "new sha password", "agentEngine"), DesKey1 = lists:sublist(ShaKey1, 16), @@ -6353,55 +6322,55 @@ snmp_user_based_sm_mib_3(Config) when is_list(Config) -> %% Try to use the new keys MgrDir = ?config(mgr_dir, Config), - ?line rewrite_usm_mgr(MgrDir, ShaKey1, DesKey1), - ?line load_master("Test2"), + rewrite_usm_mgr(MgrDir, ShaKey1, DesKey1), + load_master("Test2"), try_test(v3_sync, [[{usm_use_user, []}]], [{sec_level, authPriv}, {user, "newUser"}]), - ?line unload_master("Test2"), + unload_master("Test2"), ShaKey2 = snmp:passwd2localized_key(sha, "newer password", "agentEngine"), DesKey2 = lists:sublist(ShaKey2, 16), %% Change the new user's keys - 2 - ?line try_test(v3_sync, + try_test(v3_sync, [[{usm_key_change2, [ShaKey1, DesKey1, ShaKey2, DesKey2]}]], [{sec_level, authPriv}, {user, "newUser"}]), %% Try to use the new keys reset_usm_mgr(MgrDir), - ?line rewrite_usm_mgr(MgrDir, ShaKey2, DesKey2), - ?line load_master("Test2"), - ?line try_test(v3_sync, [[{usm_use_user, []}]], + rewrite_usm_mgr(MgrDir, ShaKey2, DesKey2), + load_master("Test2"), + try_test(v3_sync, [[{usm_use_user, []}]], [{sec_level, authPriv}, {user, "newUser"}]), - ?line unload_master("Test2"), + unload_master("Test2"), reset_usm_mgr(MgrDir), %% Change the new user's keys - 3 - ?line try_test(v3_sync, + try_test(v3_sync, [[{usm_key_change3, [ShaKey2, DesKey2, ShaKey1, DesKey1]}]], [{sec_level, authPriv}, {user, "privDES"}]), %% Try to use the new keys - ?line rewrite_usm_mgr(MgrDir, ShaKey1, DesKey1), - ?line load_master("Test2"), + rewrite_usm_mgr(MgrDir, ShaKey1, DesKey1), + load_master("Test2"), try_test(v3_sync, [[{usm_use_user, []}]], [{sec_level, authPriv}, {user, "newUser"}]), - ?line unload_master("Test2"), + unload_master("Test2"), reset_usm_mgr(MgrDir), %% Try some read requests - ?line try_test(v3_sync, [[{usm_read, []}]], + try_test(v3_sync, [[{usm_read, []}]], [{sec_level, authPriv}, {user, "privDES"}]), %% Delete the new user - ?line try_test(v3_sync, [[{usm_del_user, []}]], + try_test(v3_sync, [[{usm_del_user, []}]], [{sec_level, authPriv}, {user, "privDES"}]), %% Try some bad requests - ?line try_test(v3_sync, [[{usm_bad, []}]], + try_test(v3_sync, [[{usm_bad, []}]], [{sec_level, authPriv}, {user, "privDES"}]), - ?line unload_master("SNMP-USER-BASED-SM-MIB"). + unload_master("SNMP-USER-BASED-SM-MIB"). -define(usmUserSecurityName, [1,3,6,1,6,3,15,1,2,2,1,3]). @@ -6410,8 +6379,8 @@ usm_add_user1() -> RowPointer = ?usmUserSecurityName ++ [11|"agentEngine"] ++ [7|"privDES"], Vbs1 = [{[usmUserCloneFrom, NewRowIndex], RowPointer}, {[usmUserStatus, NewRowIndex], ?createAndGo}], - ?line s(Vbs1), - ?line ?expect1(Vbs1), + s(Vbs1), + ?expect1(Vbs1), ok. usm_use_user() -> @@ -6430,7 +6399,7 @@ usm_key_change1(ShaKey, DesKey) -> Vbs1 = [{[usmUserAuthKeyChange, NewRowIndex], ShaKeyChange}, {[usmUserPrivKeyChange, NewRowIndex], DesKeyChange}], s(Vbs1), - ?line ?expect1(Vbs1). + ?expect1(Vbs1). %% Change own private keys usm_key_change2(OldShaKey, OldDesKey, ShaKey, DesKey) -> @@ -6444,7 +6413,7 @@ usm_key_change2(OldShaKey, OldDesKey, ShaKey, DesKey) -> Vbs1 = [{[usmUserOwnAuthKeyChange, NewRowIndex], ShaKeyChange}, {[usmUserOwnPrivKeyChange, NewRowIndex], DesKeyChange}], s(Vbs1), - ?line ?expect1(Vbs1). + ?expect1(Vbs1). %% Change other's public keys usm_key_change3(OldShaKey, OldDesKey, ShaKey, DesKey) -> @@ -6457,27 +6426,27 @@ usm_key_change3(OldShaKey, OldDesKey, ShaKey, DesKey) -> DesKey), Vbs1 = [{[usmUserOwnAuthKeyChange, NewRowIndex], ShaKeyChange}], s(Vbs1), - ?line ?expect3(noAccess, 1, any), + ?expect3(noAccess, 1, any), Vbs2 = [{[usmUserOwnPrivKeyChange, NewRowIndex], DesKeyChange}], s(Vbs2), - ?line ?expect3(noAccess, 1, any), + ?expect3(noAccess, 1, any), Vbs3 = [{[usmUserAuthKeyChange, NewRowIndex], ShaKeyChange}, {[usmUserPrivKeyChange, NewRowIndex], DesKeyChange}], s(Vbs3), - ?line ?expect1(Vbs3), + ?expect1(Vbs3), ok. usm_read() -> NewRowIndex = [11,"agentEngine", 7, "newUser"], - ?line g([[usmUserSecurityName, NewRowIndex], + g([[usmUserSecurityName, NewRowIndex], [usmUserCloneFrom, NewRowIndex], [usmUserAuthKeyChange, NewRowIndex], [usmUserOwnAuthKeyChange, NewRowIndex], [usmUserPrivKeyChange, NewRowIndex], [usmUserOwnPrivKeyChange, NewRowIndex]]), - ?line ?expect1([{[usmUserSecurityName, NewRowIndex], "newUser"}, + ?expect1([{[usmUserSecurityName, NewRowIndex], "newUser"}, {[usmUserCloneFrom, NewRowIndex], [0,0]}, {[usmUserAuthKeyChange, NewRowIndex], ""}, {[usmUserOwnAuthKeyChange, NewRowIndex], ""}, @@ -6490,8 +6459,8 @@ usm_read() -> usm_del_user() -> NewRowIndex = [11,"agentEngine", 7, "newUser"], Vbs1 = [{[usmUserStatus, NewRowIndex], ?destroy}], - ?line s(Vbs1), - ?line ?expect1(Vbs1), + s(Vbs1), + ?expect1(Vbs1), ok. -define(usmUserCloneFrom, [1,3,6,1,6,3,15,1,2,2,1,4]). @@ -6511,32 +6480,32 @@ usm_bad() -> RowPointer1 = ?usmUserSecurityName ++ [11|"agentEngine"] ++ [7|"privDOS"], Vbs1 = [{[usmUserCloneFrom, NewRowIndex], RowPointer1}, {[usmUserStatus, NewRowIndex], ?createAndGo}], - ?line s(Vbs1), - ?line ?expect3(inconsistentName, 1, any), + s(Vbs1), + ?expect3(inconsistentName, 1, any), RowPointer2 = ?usmUserCloneFrom ++ [11|"agentEngine"] ++ [7|"privDES"], Vbs2 = [{[usmUserCloneFrom, NewRowIndex], RowPointer2}, {[usmUserStatus, NewRowIndex], ?createAndGo}], - ?line s(Vbs2), - ?line ?expect3(wrongValue, 1, any), + s(Vbs2), + ?expect3(wrongValue, 1, any), RowPointer3 = ?usmUserSecurityName ++ [11|"agentEngine"] ++ [7|"privDES"], Vbs3 = [{[usmUserCloneFrom, NewRowIndex], RowPointer3}, {[usmUserStatus, NewRowIndex], ?createAndGo}], - ?line s(Vbs3), - ?line ?expect1(Vbs3), - ?line s([{[usmUserAuthProtocol, NewRowIndex], ?usmNoAuthProtocol}]), - ?line ?expect3(inconsistentValue, 1, any), - ?line s([{[usmUserAuthProtocol, NewRowIndex], ?usmHMACMD5AuthProtocol}]), - ?line ?expect3(inconsistentValue, 1, any), - ?line s([{[usmUserAuthProtocol, NewRowIndex], ?usmDESPrivProtocol}]), - ?line ?expect3(wrongValue, 1, any), - ?line s([{[usmUserPrivProtocol, NewRowIndex], ?usmHMACSHAAuthProtocol}]), - ?line ?expect3(wrongValue, 1, any), + s(Vbs3), + ?expect1(Vbs3), + s([{[usmUserAuthProtocol, NewRowIndex], ?usmNoAuthProtocol}]), + ?expect3(inconsistentValue, 1, any), + s([{[usmUserAuthProtocol, NewRowIndex], ?usmHMACMD5AuthProtocol}]), + ?expect3(inconsistentValue, 1, any), + s([{[usmUserAuthProtocol, NewRowIndex], ?usmDESPrivProtocol}]), + ?expect3(wrongValue, 1, any), + s([{[usmUserPrivProtocol, NewRowIndex], ?usmHMACSHAAuthProtocol}]), + ?expect3(wrongValue, 1, any), Vbs4 = [{[usmUserStatus, NewRowIndex], ?destroy}], - ?line s(Vbs4), - ?line ?expect1(Vbs4), + s(Vbs4), + ?expect1(Vbs4), ok. @@ -6545,7 +6514,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"), @@ -6556,40 +6524,39 @@ loop_mib_1(Config) when is_list(Config) -> "\tMgrNode: ~p~n" "\tMibDir: ~p",[_SaNode, _MgrNode, _MibDir]), ?DBG("loop_mib_1 -> load mib SNMP-COMMUNITY-MIB",[]), - ?line load_master_std("SNMP-COMMUNITY-MIB"), + load_master_std("SNMP-COMMUNITY-MIB"), ?DBG("loop_mib_1 -> load mib SNMP-MPD-MIB",[]), - ?line load_master_std("SNMP-MPD-MIB"), + load_master_std("SNMP-MPD-MIB"), ?DBG("loop_mib_1 -> load mib SNMP-TARGET-MIB",[]), - ?line load_master_std("SNMP-TARGET-MIB"), + load_master_std("SNMP-TARGET-MIB"), ?DBG("loop_mib_1 -> load mib SNMP-NOTIFICATION-MIB",[]), - ?line load_master_std("SNMP-NOTIFICATION-MIB"), + load_master_std("SNMP-NOTIFICATION-MIB"), ?DBG("loop_mib_1 -> load mib SNMP-FRAMEWORK-MIB",[]), - ?line load_master_std("SNMP-FRAMEWORK-MIB"), + load_master_std("SNMP-FRAMEWORK-MIB"), ?DBG("loop_mib_1 -> load mib SNMP-VIEW-BASED-ACM-MIB",[]), - ?line load_master_std("SNMP-VIEW-BASED-ACM-MIB"), + load_master_std("SNMP-VIEW-BASED-ACM-MIB"), ?DBG("loop_mib_1 -> try",[]), try_test(loop_mib_1_test), ?DBG("loop_mib_1 -> unload mib SNMP-COMMUNITY-MIB",[]), - ?line unload_master("SNMP-COMMUNITY-MIB"), + unload_master("SNMP-COMMUNITY-MIB"), ?DBG("loop_mib_1 -> unload mib SNMP-MPD-MIB",[]), - ?line unload_master("SNMP-MPD-MIB"), + unload_master("SNMP-MPD-MIB"), ?DBG("loop_mib_1 -> unload mib SNMP-TARGET-MIB",[]), - ?line unload_master("SNMP-TARGET-MIB"), + unload_master("SNMP-TARGET-MIB"), ?DBG("loop_mib_1 -> unload mib SNMP-NOTIFICATION-MIB",[]), - ?line unload_master("SNMP-NOTIFICATION-MIB"), + unload_master("SNMP-NOTIFICATION-MIB"), ?DBG("loop_mib_1 -> unload mib SNMP-FRAMEWORK-MIB",[]), - ?line unload_master("SNMP-FRAMEWORK-MIB"), + unload_master("SNMP-FRAMEWORK-MIB"), ?DBG("loop_mib_1 -> unload mib SNMP-VIEW-BASED-ACM-MIB",[]), - ?line unload_master("SNMP-VIEW-BASED-ACM-MIB"), + unload_master("SNMP-VIEW-BASED-ACM-MIB"), %% snmpa:verbosity(master_agent,log), %% snmpa:verbosity(mib_server,silence), ?IPRINT("loop_mib_1 -> done"), ok. -loop_mib_2(suite) -> []; loop_mib_2(Config) when is_list(Config) -> ?P(loop_mib_2), ?IPRINT("loop_mib_2 -> initiate case"), @@ -6599,27 +6566,26 @@ loop_mib_2(Config) when is_list(Config) -> "\tMgrNode: ~p~n" "\tMibDir: ~p", [_SaNode, _MgrNode, _MibDir]), ?DBG("loop_mib_2 -> load mibs",[]), - ?line load_master_std("SNMP-COMMUNITY-MIB"), - ?line load_master_std("SNMP-MPD-MIB"), - ?line load_master_std("SNMP-TARGET-MIB"), - ?line load_master_std("SNMP-NOTIFICATION-MIB"), - ?line load_master_std("SNMP-FRAMEWORK-MIB"), - ?line load_master_std("SNMP-VIEW-BASED-ACM-MIB"), + load_master_std("SNMP-COMMUNITY-MIB"), + load_master_std("SNMP-MPD-MIB"), + load_master_std("SNMP-TARGET-MIB"), + load_master_std("SNMP-NOTIFICATION-MIB"), + load_master_std("SNMP-FRAMEWORK-MIB"), + load_master_std("SNMP-VIEW-BASED-ACM-MIB"), try_test(loop_mib_2_test), ?DBG("loop_mib_2 -> unload mibs",[]), - ?line unload_master("SNMP-COMMUNITY-MIB"), - ?line unload_master("SNMP-MPD-MIB"), - ?line unload_master("SNMP-TARGET-MIB"), - ?line unload_master("SNMP-NOTIFICATION-MIB"), - ?line unload_master("SNMP-FRAMEWORK-MIB"), - ?line unload_master("SNMP-VIEW-BASED-ACM-MIB"), + unload_master("SNMP-COMMUNITY-MIB"), + unload_master("SNMP-MPD-MIB"), + unload_master("SNMP-TARGET-MIB"), + unload_master("SNMP-NOTIFICATION-MIB"), + unload_master("SNMP-FRAMEWORK-MIB"), + unload_master("SNMP-VIEW-BASED-ACM-MIB"), ?IPRINT("loop_mib_2 -> done"), ok. -loop_mib_3(suite) -> []; loop_mib_3(Config) when is_list(Config) -> ?P(loop_mib_3), ?IPRINT("loop_mib_3 -> initiate case"), @@ -6629,18 +6595,18 @@ loop_mib_3(Config) when is_list(Config) -> "\tMgrNode: ~p~n" "\tMibDir: ~p", [_SaNode, _MgrNode, _MibDir]), ?DBG("loop_mib_3 -> load mibs",[]), - ?line load_master_std("SNMP-TARGET-MIB"), - ?line load_master_std("SNMP-NOTIFICATION-MIB"), - ?line load_master_std("SNMP-VIEW-BASED-ACM-MIB"), - ?line load_master_std("SNMP-USER-BASED-SM-MIB"), + load_master_std("SNMP-TARGET-MIB"), + load_master_std("SNMP-NOTIFICATION-MIB"), + load_master_std("SNMP-VIEW-BASED-ACM-MIB"), + load_master_std("SNMP-USER-BASED-SM-MIB"), try_test(loop_mib_3_test), ?DBG("loop_mib_3 -> unload mibs",[]), - ?line unload_master("SNMP-TARGET-MIB"), - ?line unload_master("SNMP-NOTIFICATION-MIB"), - ?line unload_master("SNMP-VIEW-BASED-ACM-MIB"), - ?line unload_master("SNMP-USER-BASED-SM-MIB"), + unload_master("SNMP-TARGET-MIB"), + unload_master("SNMP-NOTIFICATION-MIB"), + unload_master("SNMP-VIEW-BASED-ACM-MIB"), + unload_master("SNMP-USER-BASED-SM-MIB"), ?IPRINT("loop_mib_3 -> done"), ok. @@ -6649,8 +6615,8 @@ loop_mib_3(Config) when is_list(Config) -> loop_mib_1_test() -> ?IPRINT("loop_mib_1_test -> entry"), N = loop_it_1([1,1], 0), - ?IPRINT("found ~w varibles", [N]), - ?line N = if N < 100 -> 100; + ?IPRINT("found ~w variables", [N]), + N = if N < 100 -> 100; true -> N end. @@ -6668,7 +6634,7 @@ loop_it_1(Oid, N) -> "expected intermediate (get-next) result: " "~n NOid: ~p" "~n Value: ~p", [NOid, _Value]), - ?line [_Value2] = get_req(1, [NOid]), % must not be same + [_Value2] = get_req(1, [NOid]), % must not be same ?IPRINT("loop_it_1_test -> expected intermediate (get) result: " "~n Value2: ~p", [_Value2]), loop_it_1(NOid, N+1); @@ -6679,7 +6645,7 @@ loop_it_1(Oid, N) -> varbinds = Vbs} -> ?EPRINT("loop_it_1_test -> unexpected (get-response) vbs: " "~n Vbs: ~p", [Vbs]), - ?line ?FAIL({unexpected_vbs, + ?FAIL({unexpected_vbs, [{get_next_oid, Oid}, {counter, N}, {varbinds, Vbs}]}); @@ -6699,7 +6665,7 @@ loop_it_1(Oid, N) -> "~n Err: ~p" "~n Idx: ~p" "~n Vbs: ~p", [Err, Idx, Vbs]), - ?line ?FAIL({unexpected_pdu, + ?FAIL({unexpected_pdu, [{get_next_oid, Oid}, {counter, N}, {error_status, Err}, @@ -6715,7 +6681,7 @@ loop_it_1(Oid, N) -> "~n Err: ~p" "~n Idx: ~p" "~n Vbs: ~p", [Type, Err, Idx, Vbs]), - ?line ?FAIL({unexpected_pdu, + ?FAIL({unexpected_pdu, [{get_next_oid, Oid}, {counter, N}, {type, Type}, @@ -6735,7 +6701,7 @@ loop_it_1(Oid, N) -> (SysEvs =:= []) -> ?EPRINT("loop_it_1_test -> error: " "~n ~p", [Reason]), - ?line ?FAIL([{get_next_oid, Oid}, + ?FAIL([{get_next_oid, Oid}, {counter, N}, {reason, Reason}]); @@ -6750,12 +6716,12 @@ loop_it_1(Oid, N) -> end. -%% Req. As many mibs all possible +%% Req. As many mibs as possible loop_mib_2_test() -> ?IPRINT("loop_mib_2_test -> entry"), N = loop_it_2([1,1], 0), - ?IPRINT("found ~w varibles", [N]), - ?line N = if N < 100 -> 100; + ?IPRINT("found ~w variables", [N]), + N = if N < 100 -> 100; true -> N end. @@ -6781,7 +6747,7 @@ loop_it_2(Oid, N) -> "expected intermediate (get-next) result: " "~n NOid: ~p" "~n Value: ~p", [NOid, _Value]), - ?line [_Value2] = get_req(1, [NOid]), % must not be same + [_Value2] = get_req(1, [NOid]), % must not be same ?IPRINT("loop_it_2 -> expected intermediate (get) result: " "~n Value2: ~p", [_Value2]), loop_it_2(NOid, N+1); @@ -6792,7 +6758,7 @@ loop_it_2(Oid, N) -> varbinds = Vbs} -> ?EPRINT("loop_it_2 -> unexpected (get-response) vbs: " "~n Vbs: ~p", [Vbs]), - ?line ?FAIL({unexpected_vbs, + ?FAIL({unexpected_vbs, [{get_next_oid, Oid}, {counter, N}, {varbinds, Vbs}]}); @@ -6805,7 +6771,7 @@ loop_it_2(Oid, N) -> "~n ES: ~p" "~n EI: ~p" "~n Vbs: ~p", [ES, EI, Vbs]), - ?line ?FAIL({unexpected_pdu, + ?FAIL({unexpected_pdu, [{get_next_oid, Oid}, {counter, N}, {error_status, ES}, @@ -6821,7 +6787,7 @@ loop_it_2(Oid, N) -> "~n ES: ~p" "~n EI: ~p" "~n Vbs: ~p", [Type, ES, EI, Vbs]), - ?line ?FAIL({unexpected_pdu, + ?FAIL({unexpected_pdu, [{get_next_oid, Oid}, {counter, N}, {type, Type}, @@ -6839,18 +6805,22 @@ loop_it_2(Oid, N) -> SysEvs = snmp_test_global_sys_monitor:events(), if (SysEvs =:= []) -> - ?EPRINT("loop_it_2 -> error: " - "~n ~p", [Reason]), - ?line ?FAIL([{get_next_oid, Oid}, - {counter, N}, - {reason, Reason}]); + ?EPRINT("loop_it_2 -> error *without* system events: " + "~n Oid: ~p" + "~n N: ~p" + "~n Reason: ~p", [Oid, N,Reason]), + ?FAIL([{get_next_oid, Oid}, + {counter, N}, + {reason, Reason}]); - true -> + true -> ?WPRINT("loop_it_2 -> " - "error when we got system events: " + "error *with* system events: " + "~n Oid: ~p" + "~n N: ~p" "~n Reason: ~p" "~n Sys Events: ~p" - "~n", [Reason, SysEvs]), + "~n", [Oid, N, Reason, SysEvs]), ?SKIP([{reason, Reason}, {system_events, SysEvs}]) end end. @@ -6922,15 +6892,14 @@ 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), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), try_test(otp_1128_test), - ?line unload_master("OLD-SNMPEA-MIB"), + unload_master("OLD-SNMPEA-MIB"), ok. otp_1128_2(X) -> ?P(otp_1128_2), otp_1128(X). @@ -6945,15 +6914,15 @@ otp_1128_test() -> NewKeyc5 = [intCommunityStatus,get(mip),is("test")], s([{NewKeyc5, ?createAndWait}, {NewKeyc4, 2}]), - ?line ?expect1([{NewKeyc5, ?createAndWait}, {NewKeyc4, 2}]), + ?expect1([{NewKeyc5, ?createAndWait}, {NewKeyc4, 2}]), g([NewKeyc5]), - ?line ?expect1([{NewKeyc5, ?notReady}]), + ?expect1([{NewKeyc5, ?notReady}]), s([{NewKeyc5, ?active}, {NewKeyc3, 2}]), - ?line ?expect1([{NewKeyc5, ?active}, {NewKeyc3, 2}]), + ?expect1([{NewKeyc5, ?active}, {NewKeyc3, 2}]), g([NewKeyc5]), - ?line ?expect1([{NewKeyc5, ?active}]), + ?expect1([{NewKeyc5, ?active}]), s([{NewKeyc5, ?destroy}]), - ?line ?expect1([{NewKeyc5, ?destroy}]), + ?expect1([{NewKeyc5, ?destroy}]), ok. @@ -6961,13 +6930,12 @@ 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), - ?line load_master("Klas3"), + load_master("Klas3"), try_test(otp_1129_i, [node()]), - ?line unload_master("Klas3"), + unload_master("Klas3"), ok. otp_1129_2(X) -> ?P(otp_1129_2), otp_1129(X). @@ -6986,14 +6954,13 @@ 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), - ?line load_master("Klas1"), + load_master("Klas1"), try_test(otp_1131_test), - ?line unload_master("Klas1"). + unload_master("Klas1"). otp_1131_2(X) -> ?P(otp_1131_2), otp_1131(X). @@ -7046,7 +7013,7 @@ otp_1131_test() -> io:format("Testing bug reported in ticket OTP-1131...~n"), s([{[friendsEntry, [2, 3, 1]], s, "kompis3"}, {[friendsEntry, [3, 3, 1]], i, ?createAndGo}]), - ?line ?expect3(?v1_2(noSuchName, noCreation), 2, any), + ?expect3(?v1_2(noSuchName, noCreation), 2, any), ok. @@ -7054,11 +7021,10 @@ 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), - ?line {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), + {ok, SA} = start_subagent(SaNode, ?sa, "SA-MIB"), try_test(otp_1162_test), stop_subagent(SA). @@ -7068,7 +7034,7 @@ otp_1162_3(X) -> ?P(otp_1162_3), otp_1162(X). otp_1162_test() -> s([{[sa, [2,0]], 6}]), % wrongValue (i is_set_ok) - ?line ?expect3(?v1_2(badValue, wrongValue), 1, any), + ?expect3(?v1_2(badValue, wrongValue), 1, any), ok. @@ -7076,15 +7042,14 @@ 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), - ?line load_master("Klas3"), - ?line load_master("Klas4"), + load_master("Klas3"), + load_master("Klas4"), try_test(otp_1222_test), - ?line unload_master("Klas3"), - ?line unload_master("Klas4"), + unload_master("Klas3"), + unload_master("Klas4"), ok. otp_1222_2(X) -> ?P(otp_1222_2), otp_1222(X). @@ -7094,9 +7059,9 @@ otp_1222_3(X) -> ?P(otp_1222_3), otp_1222(X). otp_1222_test() -> io:format("Testing bug reported in ticket OTP-1222...~n"), s([{[fStatus4,1], 4}, {[fName4,1], 1}]), - ?line ?expect3(genErr, 0, any), + ?expect3(genErr, 0, any), s([{[fStatus4,2], 4}, {[fName4,2], 1}]), - ?line ?expect3(genErr, 0, any), + ?expect3(genErr, 0, any), ok. @@ -7104,14 +7069,13 @@ 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), - ?line load_master("Klas2"), + load_master("Klas2"), try_test(otp_1298_test), - ?line unload_master("Klas2"), + unload_master("Klas2"), ok. otp_1298_2(X) -> ?P(otp_1298_2), otp_1298(X). @@ -7121,7 +7085,7 @@ otp_1298_3(X) -> ?P(otp_1298_3), otp_1298(X). otp_1298_test() -> io:format("Testing bug reported in ticket OTP-1298...~n"), s([{[fint,0], -1}]), - ?line ?expect1([{[fint,0], -1}]), + ?expect1([{[fint,0], -1}]), ok. @@ -7129,14 +7093,13 @@ 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), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), try_test(otp_1331_test), - ?line unload_master("OLD-SNMPEA-MIB"), + unload_master("OLD-SNMPEA-MIB"), ok. otp_1331_2(X) -> ?P(otp_1331_2), otp_1331(X). @@ -7146,7 +7109,7 @@ otp_1331_3(X) -> ?P(otp_1331_3), otp_1331(X). otp_1331_test() -> NewKeyc5 = [intCommunityStatus,[127,32,0,0],is("test")], s([{NewKeyc5, ?destroy}]), - ?line ?expect1([{NewKeyc5, ?destroy}]), + ?expect1([{NewKeyc5, ?destroy}]), ok. @@ -7154,14 +7117,13 @@ 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), - ?line load_master("Klas2"), + load_master("Klas2"), try_test(otp_1338_test), - ?line unload_master("Klas2"). + unload_master("Klas2"). otp_1338_2(X) -> ?P(otp_1338_2), otp_1338(X). @@ -7169,9 +7131,9 @@ otp_1338_3(X) -> ?P(otp_1338_3), otp_1338(X). otp_1338_test() -> s([{[kStatus2, 7], i, ?createAndGo}]), - ?line ?expect1([{[kStatus2, 7], ?createAndGo}]), + ?expect1([{[kStatus2, 7], ?createAndGo}]), g([[kName2, 7]]), - ?line ?expect1([{[kName2, 7], "JJJ"}]). + ?expect1([{[kName2, 7], "JJJ"}]). %%----------------------------------------------------------------- @@ -7179,13 +7141,12 @@ 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), - ?line load_master("Klas4"), + load_master("Klas4"), try_test(otp_1342_test), - ?line unload_master("Klas4"), + unload_master("Klas4"), ok. otp_1342_2(X) -> ?P(otp_1342_2), otp_1342(X). @@ -7196,7 +7157,7 @@ otp_1342_test() -> s([{[fIndex5, 1], i, 1}, {[fName5, 1], i, 3}, {[fStatus5, 1], i, ?createAndGo}]), - ?line ?expect3(?v1_2(noSuchName, noCreation), 3, any), + ?expect3(?v1_2(noSuchName, noCreation), 3, any), ok. @@ -7206,14 +7167,13 @@ 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), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), try_test(otp_1366_test), - ?line unload_master("OLD-SNMPEA-MIB"), + unload_master("OLD-SNMPEA-MIB"), ok. otp_1366_2(X) -> ?P(otp_1366_2), otp_1366(X). @@ -7229,7 +7189,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), @@ -7265,7 +7224,7 @@ otp_2776_test() -> {10, false, Dt10_invalid}, {11, false, Dt11_invalid}], - ?line ok = validate_dat(L). + ok = validate_dat(L). validate_dat(L) -> validate_dat(L,[]). @@ -7296,14 +7255,13 @@ 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), - ?line load_master("Test1"), - ?line init_old(), + load_master("Test1"), + init_old(), try_test(otp_2979_test), - ?line unload_master("Test1"). + unload_master("Test1"). otp_2979_2(X) -> ?P(otp_2979_2), otp_2979(X). @@ -7311,33 +7269,32 @@ otp_2979_3(X) -> ?P(otp_2979_3), otp_2979(X). otp_2979_test() -> gn([[sparseDescr], [sparseStatus]]), - ?line ?expect1([{[sparseStr,0], "slut"}, + ?expect1([{[sparseStr,0], "slut"}, {[sparseStr,0], "slut"}]), ok. %%----------------------------------------------------------------- %% Ticket: OTP-3187 -%% Slogan: get-next on vacmAccessTable for colums > 5 returns +%% 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), - ?line load_master_std("SNMP-VIEW-BASED-ACM-MIB"), + load_master_std("SNMP-VIEW-BASED-ACM-MIB"), otp_3187_test(), - ?line unload_master("SNMP-VIEW-BASED-ACM-MIB"). + unload_master("SNMP-VIEW-BASED-ACM-MIB"). otp_3187_2(X) -> ?P(otp_3187_2), otp_3187(X). otp_3187_3(X) -> ?P(otp_3187_3), otp_3187(X). otp_3187_test() -> - ?line Elements = + Elements = snmp_view_based_acm_mib:vacmAccessTable(get_next,[],[4,5,6]), lists:foreach(fun(E) -> - ?line if E == endOfTable -> + if E == endOfTable -> ?FAIL(endOfTable); true -> ok end @@ -7347,7 +7304,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 +7311,7 @@ otp_3542(Config) when is_list(Config) -> otp_3542_test() -> io:format("SNMP v3 discovery...~n"), - ?line Res = snmp_test_mgr:d(), + Res = snmp_test_mgr:d(), io:format("SNMP v3 discovery result: ~p~n",[Res]). @@ -7363,57 +7319,56 @@ 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), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), try_test(otp_3725_test, [node()]), - ?line unload_master("OLD-SNMPEA-MIB"). + unload_master("OLD-SNMPEA-MIB"). %% Req. OLD-SNMPEA-MIB otp_3725_test(MaNode) -> io:format("Testing feature requested in ticket OTP-3725...~n"), - ?line rpc:call(MaNode,snmpa,verbosity,[symbolic_store,trace]), - ?line Db = rpc:call(MaNode, snmpa, get_symbolic_store_db, []), + rpc:call(MaNode,snmpa,verbosity,[symbolic_store,trace]), + Db = rpc:call(MaNode, snmpa, get_symbolic_store_db, []), ?DBG("otp_3725_test -> Db = ~p", [Db]), - ?line {value, OID} = rpc:call(MaNode, snmpa, name_to_oid, + {value, OID} = rpc:call(MaNode, snmpa, name_to_oid, [Db, intAgentIpAddress]), ?DBG("otp_3725_test -> name_to_oid for ~p: ~p", [intAgentIpAddress,OID]), - ?line {value, intAgentIpAddress} = rpc:call(MaNode, snmpa, oid_to_name, + {value, intAgentIpAddress} = rpc:call(MaNode, snmpa, oid_to_name, [Db,OID]), ?DBG("otp_3725_test -> oid_to_name for ~p: ~p", [OID, intAgentIpAddress]), - ?line false = rpc:call(MaNode, snmpa, name_to_oid, [Db, intAgentIpAddres]), - ?line false = rpc:call(MaNode, snmpa, oid_to_name, + false = rpc:call(MaNode, snmpa, name_to_oid, [Db, intAgentIpAddres]), + false = rpc:call(MaNode, snmpa, oid_to_name, [Db, [1,5,32,3,54,3,3,34,4]]), - ?line {value, 2} = rpc:call(MaNode, snmpa, enum_to_int, + {value, 2} = rpc:call(MaNode, snmpa, enum_to_int, [Db, intViewType, excluded]), - ?line {value, excluded} = rpc:call(MaNode, snmpa, int_to_enum, + {value, excluded} = rpc:call(MaNode, snmpa, int_to_enum, [Db, intViewType, 2]), - ?line false = rpc:call(MaNode, snmpa, enum_to_int, + false = rpc:call(MaNode, snmpa, enum_to_int, [Db, intViewType, exclude]), - ?line false = rpc:call(MaNode, snmpa, enum_to_int, + false = rpc:call(MaNode, snmpa, enum_to_int, [Db, intAgentIpAddress, exclude]), - ?line false = rpc:call(MaNode, snmpa, enum_to_int, + false = rpc:call(MaNode, snmpa, enum_to_int, [Db, intAgentIpAddre, exclude]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, [Db, intViewType, 3]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, + false = rpc:call(MaNode, snmpa, int_to_enum, [Db, intViewType, 3]), + false = rpc:call(MaNode, snmpa, int_to_enum, [Db, intAgentIpAddress, 2]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, + false = rpc:call(MaNode, snmpa, int_to_enum, [Db, intAgentIpAddre, 2]), - ?line {value, active} = rpc:call(MaNode, snmpa, int_to_enum, + {value, active} = rpc:call(MaNode, snmpa, int_to_enum, [Db, 'RowStatus', ?active]), - ?line {value, ?destroy} = rpc:call(MaNode, snmpa, enum_to_int, + {value, ?destroy} = rpc:call(MaNode, snmpa, enum_to_int, [Db, 'RowStatus', destroy]), - ?line false = rpc:call(MaNode, snmpa, enum_to_int, + false = rpc:call(MaNode, snmpa, enum_to_int, [Db, 'RowStatus', xxxdestroy]), - ?line false = rpc:call(MaNode, snmpa, enum_to_int, + false = rpc:call(MaNode, snmpa, enum_to_int, [Db, 'xxRowStatus', destroy]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, [Db, 'RowStatus', 25]), - ?line false = rpc:call(MaNode, snmpa, int_to_enum, [Db, 'xxRowStatus', 1]), + false = rpc:call(MaNode, snmpa, int_to_enum, [Db, 'RowStatus', 25]), + false = rpc:call(MaNode, snmpa, int_to_enum, [Db, 'xxRowStatus', 1]), ok. @@ -7425,10 +7380,10 @@ otp_3725_test(MaNode) -> otp_4394_init(Config) when is_list(Config) -> ?DBG("otp_4394_init -> entry with" "~n Config: ~p", [Config]), - ?line AgentConfDir = ?config(agent_conf_dir, Config), - ?line MgrDir = ?config(mgr_dir, Config), - ?line Ip = ?config(ip, Config), - ?line otp_4394_config(AgentConfDir, MgrDir, Ip), + AgentConfDir = ?config(agent_conf_dir, Config), + MgrDir = ?config(mgr_dir, Config), + Ip = ?config(ip, Config), + otp_4394_config(AgentConfDir, MgrDir, Ip), MasterAgentVerbosity = {master_agent_verbosity, trace}, NetIfVerbosity = {net_if_verbosity, trace}, Opts = [MasterAgentVerbosity, NetIfVerbosity], @@ -7441,21 +7396,21 @@ otp_4394_config(AgentConfDir, MgrDir, Ip0) -> "~n Ip0: ~p", [AgentConfDir, MgrDir, Ip0]), Vsn = [v1], Ip = tuple_to_list(Ip0), - ?line snmp_config:write_agent_snmp_files(AgentConfDir, Vsn, Ip, + snmp_config:write_agent_snmp_files(AgentConfDir, Vsn, Ip, ?TRAP_UDP, Ip, 4000, "OTP-4394 test"), - ?line case update_usm(Vsn, AgentConfDir) of + case update_usm(Vsn, AgentConfDir) of true -> - ?line copy_file(join(AgentConfDir, "usm.conf"), + copy_file(join(AgentConfDir, "usm.conf"), join(MgrDir, "usm.conf")), - ?line update_usm_mgr(Vsn, MgrDir); + update_usm_mgr(Vsn, MgrDir); false -> - ?line ok + ok end, C1 = {"a", "all-rights", "initial", "", "pc"}, C2 = {"c", "secret", "secret_name", "", "secret_tag"}, - ?line write_community_conf(AgentConfDir, [C1, C2]), - ?line update_vacm(Vsn, AgentConfDir), + write_community_conf(AgentConfDir, [C1, C2]), + update_vacm(Vsn, AgentConfDir), Ta1 = {"shelob v1", [134,138,177,177], 5000, 1500, 3, %% Use Ip and modify "pc1", @@ -7469,9 +7424,9 @@ otp_4394_config(AgentConfDir, MgrDir, Ip0) -> "target_v1", "", %% [255,255,255,255,0,0], [], 2048}, - ?line write_target_addr_conf(AgentConfDir, [Ta1, Ta2]), - ?line write_target_params_conf(AgentConfDir, Vsn), - ?line write_notify_conf(AgentConfDir), + write_target_addr_conf(AgentConfDir, [Ta1, Ta2]), + write_target_params_conf(AgentConfDir, Vsn), + write_notify_conf(AgentConfDir), ok. otp_4394_finish(Config) when is_list(Config) -> @@ -7481,7 +7436,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", []), @@ -7519,10 +7473,10 @@ otp_7157_init(Config) when is_list(Config) -> ?DBG("init_otp_7157 -> entry with" "~n Config: ~p", [Config]), - ?line AgentConfDir = ?config(agent_conf_dir, Config), - ?line MgrDir = ?config(mgr_dir, Config), - ?line Ip = ?config(ip, Config), - ?line config([v2], MgrDir, AgentConfDir, + AgentConfDir = ?config(agent_conf_dir, Config), + MgrDir = ?config(mgr_dir, Config), + Ip = ?config(ip, Config), + config([v2], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip)), MasterAgentVerbosity = {master_agent_verbosity, trace}, NetIfVerbosity = {net_if_verbosity, trace}, @@ -7537,15 +7491,14 @@ 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", []), init_case(Config), MA = whereis(snmp_master_agent), - ?line load_master("Test1"), + load_master("Test1"), try_test(otp_7157_test, [MA]), - ?line unload_master("Test1"), + unload_master("Test1"), ?DBG("otp_7157 -> done", []), ok. @@ -7562,7 +7515,7 @@ otp_7157_test(MA) -> ?DBG("await response",[]), %% We don't really care about the values, just the vb order. - ?line ok = ?expect2(v2trap, [{[sysUpTime, 0], any}, + ok = ?expect2(v2trap, [{[sysUpTime, 0], any}, {[snmpTrapOID, 0], any}, {[sysContact, 0], any}, {[cnt64, 0], any}, @@ -7588,108 +7541,80 @@ 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", []), - - TC = fun() -> - otp_16092_simple_start_and_stop(Config, default, success) - end, + otp_16092_simple_start_and_stop(?FUNCTION_NAME, + Config, default, success). - Result = otp_16092_try(TC), - ?DBG("otp_16092_simple_start_and_stop1 -> done: " - "~n ~p", [Result]), - - 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", []), - - TC = fun() -> - otp_16092_simple_start_and_stop(Config, [], success) - end, + otp_16092_simple_start_and_stop(?FUNCTION_NAME, + Config, [], success). - Result = otp_16092_try(TC), - ?DBG("otp_16092_simple_start_and_stop2 -> done: " - "~n ~p", [Result]), - - 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", []), - - TC = fun() -> - otp_16092_simple_start_and_stop(Config, - 'this-should-be-ignored', - success) - end, - - Result = otp_16092_try(TC), - - ?DBG("otp_16092_simple_start_and_stop3 -> done: " - "~n ~p", [Result]), - - Result. + otp_16092_simple_start_and_stop(?FUNCTION_NAME, + Config, + 'this-should-be-ignored', + success). -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", []), - - TC = fun() -> - otp_16092_simple_start_and_stop(Config, - ['this-should-fail'], - failure) - end, - - Result = otp_16092_try(TC), - - ?DBG("otp_16092_simple_start_and_stop4 -> done: " - "~n ", [Result]), - - Result. - - -otp_16092_try(TC) -> - try TC() of - Any -> - Any - catch - _:{skip, _} = SKIP -> - SKIP - end. - -otp_16092_simple_start_and_stop(Config, ESO, Expected) -> - ?line ConfDir = ?config(agent_conf_dir, Config), - ?line DbDir = ?config(agent_db_dir, Config), - - ?NPRINT("try start agent node"), - {ok, Node} = ?ALIB:start_node(agent_16092), - - Vsns = [v1], - IP = tuple_to_list(?config(ip, Config)), - ManagerIP = IP, - TrapPort = ?TRAP_UDP, - AgentIP = IP, - AgentPort = 4000, - SysName = "test", - ok = snmp_config:write_agent_snmp_files( - ConfDir, Vsns, ManagerIP, TrapPort, AgentIP, AgentPort, SysName), - - ConfOpts = [{dir, ConfDir}, - {force_load, false}, - {verbosity, trace}], - NiOpts = + otp_16092_simple_start_and_stop(?FUNCTION_NAME, + Config, + ['this-should-fail'], + failure). + +otp_16092_simple_start_and_stop(CaseName, Config, ESO, Expected) + when is_atom(CaseName) -> + Pre = fun() -> + [D|_] = lists:reverse(atom_to_list(CaseName)), + Digit = [D], + + ?NPRINT("try start agent node"), + {ok, Peer, Node} = ?START_PEER(Digit ++ "-agent"), + + ?NPRINT("try write config to file"), + ConfDir = ?config(agent_conf_dir, Config), + DbDir = ?config(agent_db_dir, Config), + Vsns = [v1], + IP = tuple_to_list(?config(ip, Config)), + ManagerIP = IP, + TrapPort = ?TRAP_UDP, + AgentIP = IP, + AgentPort = 4000, + SysName = "test", + ok = snmp_config:write_agent_snmp_files(ConfDir, Vsns, + ManagerIP, TrapPort, + AgentIP, AgentPort, + SysName), + + #{eso => ESO, + vsns => Vsns, + db_dir => DbDir, + conf_opts => [{dir, ConfDir}, + {force_load, false}, + {verbosity, trace}], + node => Node, + peer => Peer, + expected => Expected} + end, + Case = fun(State) -> + do_otp_16092_simple_start_and_stop(State) + end, + Post = fun(#{node := Node, + peer := Peer}) -> + ?NPRINT("try stop agent node ~p", [Node]), + ?STOP_PEER(Peer) + end, + ?TC_TRY(CaseName, Pre, Case, Post). + +do_otp_16092_simple_start_and_stop(#{eso := ESO, + vsns := Vsns, + db_dir := DbDir, + conf_opts := ConfOpts, + node := Node, + expected := Expected} = _State) -> + NiOpts = case ESO of default -> [{verbosity, trace}]; @@ -7705,15 +7630,9 @@ 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), - - ?SLEEP(1000), - ?NPRINT("done"), ok. - otp16092_try_start_and_stop_agent(Node, Opts, Expected) -> ?IPRINT("try start snmp (agent) supervisor (on ~p) - expect ~p", [Node, Expected]), @@ -7794,9 +7713,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 @@ -7846,12 +7764,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]), @@ -7867,7 +7787,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, @@ -7890,14 +7809,14 @@ otp8395({fin, Config}) when is_list(Config) -> %% ?DBG("otp8395(fin) -> stop agent node", []), - stop_node(AgentNode), + ?STOP_PEER(?config(agent_peer, Config)), %% - %% Stop the manager node %% ?DBG("otp8395(fin) -> stop manager node", []), - stop_node(ManagerNode), + ?STOP_PEER(?config(manager_peer, Config)), wd_stop(Config); @@ -8156,7 +8075,7 @@ otp16649(N, Config) -> AgentNode = ?config(agent_node, Config), ManagerNode = ?config(manager_node, Config), - ?line AInfo = rpc:call(AgentNode, snmpa, info, []), + AInfo = rpc:call(AgentNode, snmpa, info, []), ?IPRINT("Agent Info: " "~n ~p", [AInfo]), @@ -8189,25 +8108,25 @@ otp16649(N, Config) -> AgentTrapPortNo = otp16649_which_trap_port_no(TIs), ?IPRINT("(mgr) register user"), - ?line ok = otp16649_mgr_reg_user(ManagerNode), + ok = otp16649_mgr_reg_user(ManagerNode), ?IPRINT("(mgr) register agent"), TargetBase = "otp16649-agent-", ReqTarget = TargetBase ++ "req", TrapTarget = TargetBase ++ "trap", - ?line ok = otp16649_mgr_reg_agent(ManagerNode, + ok = otp16649_mgr_reg_agent(ManagerNode, ?config(ipfamily, Config), ?config(tdomain, Config), ReqTarget, AgentReqPortNo), - ?line ok = otp16649_mgr_reg_agent(ManagerNode, + ok = otp16649_mgr_reg_agent(ManagerNode, ?config(ipfamily, Config), ?config(tdomain, Config), TrapTarget, AgentTrapPortNo), ?IPRINT("(mgr) simple (sync) get request"), Oids = [?sysObjectID_instance, ?sysDescr_instance, ?sysUpTime_instance], - ?line ok = case otp16649_mgr_get_req(ManagerNode, Oids) of + ok = case otp16649_mgr_get_req(ManagerNode, Oids) of {ok, {noError, 0, ReplyOids}, _} -> ?IPRINT("(mgr) simple (sync) successful reply: " "~n ~p", [ReplyOids]), @@ -8224,10 +8143,10 @@ otp16649(N, Config) -> ?IPRINT("load TestTrap..."), MibDir = ?config(mib_dir, Config), - ?line ok = otp16649_agent_load_mib(AgentNode, MibDir, "TestTrap"), + ok = otp16649_agent_load_mib(AgentNode, MibDir, "TestTrap"), ?IPRINT("(agent) send trap (testTrap2)"), - ?line ok = otp16649_agent_send_trap(AgentNode, testTrap2), + ok = otp16649_agent_send_trap(AgentNode, testTrap2), TDomain = ?config(tdomain, Config), @@ -8245,7 +8164,7 @@ otp16649(N, Config) -> case TDomain of transportDomainUdpIpv4 -> ?IPRINT("TIMEOUT"), - ?line exit(timeout); + exit(timeout); transportDomainUdpIpv6 -> ?IPRINT("expected timeout - " "v1 trap's can only be sent on IPv4 domains"), @@ -8255,10 +8174,10 @@ otp16649(N, Config) -> ?IPRINT("load TestTrapv2..."), - ?line ok = otp16649_agent_load_mib(AgentNode, MibDir, "TestTrapv2"), + ok = otp16649_agent_load_mib(AgentNode, MibDir, "TestTrapv2"), ?IPRINT("(agent) send trap (testTrapv22)"), - ?line ok = otp16649_agent_send_trap(AgentNode, testTrapv22), + ok = otp16649_agent_send_trap(AgentNode, testTrapv22), receive {handle_trap, From_v2, TrapTarget, @@ -8270,7 +8189,7 @@ otp16649(N, Config) -> after 5000 -> ?IPRINT("TIMEOUT"), - ?line exit(timeout) + exit(timeout) end, ?IPRINT("done"), @@ -8287,10 +8206,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 @@ -8340,16 +8257,18 @@ otp16649_init(N, AgentPreTransports, Config) -> AgentPreTransports2 = [F(T) || T <- AgentPreTransports], ?IPRINT("write agent config files"), - ?line ok = snmp_config:write_agent_snmp_files( + ok = snmp_config:write_agent_snmp_files( AgentConfDir, Vsns, TransportDomain, {ManagerIP, ?MGR_PORT}, AgentPreTransports2, "test"), ?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]), @@ -8364,15 +8283,15 @@ otp16649_init(N, AgentPreTransports, Config) -> MgrTopDir = ?config(manager_top_dir, Config), MgrDbDir = filename:join(MgrTopDir, "db/"), MgrConfDir = filename:join(MgrTopDir, "conf/"), - ?line ok = file:make_dir(MgrConfDir), + ok = file:make_dir(MgrConfDir), MgrDbDir = filename:join(MgrTopDir, "db/"), - ?line ok = file:make_dir(MgrDbDir), + ok = file:make_dir(MgrDbDir), MgrLogDir = filename:join(MgrTopDir, "log/"), - ?line ok = file:make_dir(MgrLogDir), + ok = file:make_dir(MgrLogDir), ?IPRINT("write manager config files"), MgrTransports = [{TransportDomain, {ManagerIP0, ?MGR_PORT}}], - ?line ok = snmp_config:write_manager_snmp_files( + ok = snmp_config:write_manager_snmp_files( MgrConfDir, MgrTransports, ?MGR_MMS, ?MGR_ENGINE_ID), @@ -8382,19 +8301,12 @@ otp16649_init(N, AgentPreTransports, Config) -> {manager_log_dir, MgrLogDir} | Config2], ?IPRINT("start manager"), - ?line ok = start_manager(Config3), + ok = start_manager(Config3), ?DBG("otp16649_init -> done when" "~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" @@ -8402,14 +8314,13 @@ 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, %% so logs and files can be closed in the proper way). %% - ?line AgentTopSup = ?config(agent_sup, Config), + AgentTopSup = ?config(agent_sup, Config), stop_standalone_agent(AgentTopSup), @@ -8425,7 +8336,7 @@ otp16649_fin(N, Config) when is_integer(N) -> %% ?DBG("otp16649_fin -> stop manager node", []), - stop_node(ManagerNode), + peer:stop(?config(manager_peer, Config)), %% @@ -8433,7 +8344,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), @@ -8624,7 +8535,7 @@ start_agent(Config, Opts) -> process_flag(trap_exit, true), - ?line {ok, AgentTopSup} = start_standalone_agent(AgentNode, AgentConfig), + {ok, AgentTopSup} = start_standalone_agent(AgentNode, AgentConfig), [{agent_sup, AgentTopSup} | Config]. @@ -8719,7 +8630,7 @@ start_manager(Config) -> {net_if, [{verbosity, trace}]}, {note_store, [{verbosity, trace}]}, {config, [{verbosity, trace}, {dir, ConfDir}, {db_dir, DbDir}]}], - ?line ok = start_standalone_manager(Node, Opts). + ok = start_standalone_manager(Node, Opts). start_standalone_manager(Node, Config) -> @@ -8756,18 +8667,17 @@ 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), - ?line load_master("OLD-SNMPEA-MIB"), - ?line init_old(), + load_master("OLD-SNMPEA-MIB"), + init_old(), try_test(do_info, [node()]), - ?line unload_master("OLD-SNMPEA-MIB"). + unload_master("OLD-SNMPEA-MIB"). do_info(MaNode) -> - ?line Info = rpc:call(MaNode, snmpa, info, []), + Info = rpc:call(MaNode, snmpa, info, []), ?DBG("info_test1 -> Info: ~n~p", [Info]), Keys = [vsns, stats_counters, @@ -8854,15 +8764,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 %%%----------------------------------------------------------------- @@ -9075,14 +8976,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 @@ -9134,6 +9033,7 @@ init_v1_agent(Config) -> Config2 = start_agent([{host, Host}, {ip, Ip}, + {agent_peer, AgentPeer}, {agent_node, AgentNode}, {agent_host, AgentHost}, {agent_ip, AgentIP}, @@ -9141,6 +9041,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]), %% -- @@ -9151,7 +9052,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, @@ -9170,7 +9070,7 @@ fin_v1_agent(Config) -> %% - %% Stop the agent node %% - stop_node(AgentNode), + peer:stop(?config(agent_peer, Config)), %% SubAgentNode = ?config(sub_agent_node, Config), @@ -9180,7 +9080,7 @@ fin_v1_agent(Config) -> %% - %% Stop the manager node %% - stop_node(ManagerNode), + peer:stop(?config(manager_peer, Config)), wd_stop(Config). |