aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/test
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2010-02-03 18:00:01 +0000
committerErlang/OTP <[email protected]>2010-02-03 18:00:01 +0000
commit76e9c68368dfd9ec20181939511e2baf93fc73d9 (patch)
treeefa2d2273ba3edec9d43caffbe778c7fc868d5b5 /lib/snmp/test
parent3e74a8a1af84d923ddcdc8c0f0a2e51298267f8f (diff)
downloadotp-76e9c68368dfd9ec20181939511e2baf93fc73d9.tar.gz
otp-76e9c68368dfd9ec20181939511e2baf93fc73d9.tar.bz2
otp-76e9c68368dfd9ec20181939511e2baf93fc73d9.zip
OTP-8395: Sequence number in Audit Trail Logs.
Diffstat (limited to 'lib/snmp/test')
-rw-r--r--lib/snmp/test/snmp_agent_test.erl475
-rw-r--r--lib/snmp/test/snmp_log_test.erl299
-rw-r--r--lib/snmp/test/snmp_manager_config_test.erl184
-rw-r--r--lib/snmp/test/snmp_manager_test.erl96
-rw-r--r--lib/snmp/test/snmp_test_mgr.erl10
5 files changed, 941 insertions, 123 deletions
diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl
index 53b35058e1..af0581150a 100644
--- a/lib/snmp/test/snmp_agent_test.erl
+++ b/lib/snmp/test/snmp_agent_test.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2003-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2003-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -32,6 +32,8 @@
-include("snmp_test_lib.hrl").
-define(SNMP_USE_V3, true).
-include_lib("snmp/include/snmp_types.hrl").
+-include_lib("snmp/src/agent/snmpa_atl.hrl").
+
%% -include_lib("snmp/include/SNMP-COMMUNITY-MIB.hrl").
%% -include_lib("snmp/include/SNMP-VIEW-BASED-ACM-MIB.hrl").
%% -include_lib("snmp/include/SNMP-USER-BASED-SM-MIB.hrl").
@@ -84,16 +86,18 @@
all(suite) ->
- {req,
- [
- mnesia,
- distribution,
- {local_slave_nodes, 2},
- {time, 360}
- ],
- [{conf, init_all, cases(), finish_all}]}.
+ Reqs = [mnesia, distribution, {local_slave_nodes, 2}, {time, 360}],
+ Conf1 = [{conf, init_all, cases(), finish_all}],
+ Conf2 = [tickets2],
+ {req, Reqs, Conf1 ++ Conf2}.
+init_per_testcase(otp8395 = Case, Config) when is_list(Config) ->
+ ?DBG("init_per_testcase -> entry with"
+ "~n Case: ~p"
+ "~n Config: ~p", [Case, Config]),
+ Config2 = init_per_testcase2(Case, init_suite(Config)),
+ otp8395({init, Config2});
init_per_testcase(otp_7157_test = _Case, Config) when is_list(Config) ->
?DBG("init_per_testcase -> entry with"
"~n Case: ~p"
@@ -119,6 +123,8 @@ init_per_testcase(_Case, Config) when is_list(Config) ->
Dog = ?WD_START(?MINS(6)),
[{watchdog, Dog}|Config].
+fin_per_testcase(otp8395, Config) when is_list(Config) ->
+ otp8395({fin, Config});
fin_per_testcase(_Case, Config) when is_list(Config) ->
?DBG("fin_per_testcase -> entry with"
"~n Case: ~p"
@@ -127,6 +133,97 @@ fin_per_testcase(_Case, Config) when is_list(Config) ->
?WD_STOP(Dog),
Config.
+
+init_suite(Config) ->
+ ?DBG("init_suite -> entry with"
+ "~n Config: ~p", [Config]),
+
+ %% Suite root dir for test suite
+ PrivDir = ?config(priv_dir, Config),
+
+ %% Create top-directory for this sub-suite
+ SuiteTopDir = filename:join([PrivDir, ?MODULE]),
+ case file:make_dir(SuiteTopDir) of
+ ok ->
+ ok;
+ {error, eexist} ->
+ %% This can happen since this is not really a
+ %% suite-init function.
+ ok;
+ {error, Reason} ->
+ ?FAIL({failed_creating_suite_top_dir, SuiteTopDir, Reason})
+ end,
+
+
+ %% --
+ %% Fix config (data-dir is not correct):
+ %%
+
+ Config1 = fix_data_dir(Config),
+ %% Config1 = Config,
+
+ %% Mib-dirs
+ MibDir = ?config(data_dir, Config1),
+ StdMibDir = filename:join([code:priv_dir(snmp), "mibs"]),
+
+ Config2 = [{suite_top_dir, SuiteTopDir},
+ {mib_dir, MibDir},
+ {std_mib_dir, StdMibDir} | Config1],
+
+ ?DBG("init_suite -> done when"
+ "~n Config2: ~p", [Config2]),
+ Config2.
+
+%% end_per_suite(Config) ->
+end_suite(Config) ->
+ Config.
+
+fix_data_dir(Config) ->
+ DataDir0 = ?config(data_dir, Config),
+ DataDir1 = filename:split(filename:absname(DataDir0)),
+ [_|DataDir2] = lists:reverse(DataDir1),
+ DataDir = filename:join(lists:reverse(DataDir2) ++ [?snmp_test_data]),
+ Config1 = lists:keydelete(data_dir, 1, Config),
+ [{data_dir, DataDir} | Config1].
+
+
+init_per_testcase2(Case, Config) ->
+ SuiteToDir = ?config(suite_top_dir, Config),
+
+ %% Create top-directory for this test-case
+ CaseTopDir = filename:join([SuiteToDir, Case]),
+ ok = file:make_dir(CaseTopDir),
+
+ %% Create agent top-dir(s)
+ AgentTopDir = filename:join([CaseTopDir, agent]),
+ ok = file:make_dir(AgentTopDir),
+ AgentConfDir = filename:join([AgentTopDir, config]),
+ ok = file:make_dir(AgentConfDir),
+ AgentDbDir = filename:join([AgentTopDir, db]),
+ ok = file:make_dir(AgentDbDir),
+ AgentLogDir = filename:join([AgentTopDir, log]),
+ ok = file:make_dir(AgentLogDir),
+
+ %% Create sub-agent top-dir(s)
+ SubAgentTopDir = filename:join([CaseTopDir, sub_agent]),
+ ok = file:make_dir(SubAgentTopDir),
+
+ %% Create manager top-dir(s)
+ ManagerTopDir = filename:join([CaseTopDir, manager]),
+ ok = file:make_dir(ManagerTopDir),
+
+ [{case_top_dir, CaseTopDir},
+ {agent_top_dir, AgentTopDir},
+ {agent_conf_dir, AgentConfDir},
+ {agent_db_dir, AgentDbDir},
+ {agent_log_dir, AgentLogDir},
+ {sub_agent_top_dir, SubAgentTopDir},
+ {manager_top_dir, ManagerTopDir} | Config].
+
+fin_per_testcase2(_Case, Config) ->
+ Config.
+
+
cases() ->
case ?OSTYPE() of
vxworks ->
@@ -138,7 +235,7 @@ cases() ->
test_v1_v2,
test_multi_threaded,
mib_storage,
- tickets
+ tickets1
];
_Else ->
[
@@ -149,7 +246,7 @@ cases() ->
test_v3,
test_multi_threaded,
mib_storage,
- tickets
+ tickets1
]
end.
@@ -5071,12 +5168,20 @@ reported_bugs_3(suite) ->
%% These are (ticket) test cases where the initiation has to be done
%% individually.
-tickets(suite) ->
+tickets1(suite) ->
[
otp_4394,
otp_7157
].
+
+tickets2(suite) ->
+ [
+ otp8395
+ ].
+
+
+
%%-----------------------------------------------------------------
%% Ticket: OTP-1128
%% Slogan: Bug in handling of createAndWait set-requests.
@@ -5624,10 +5729,9 @@ otp_4394_test1() ->
otp_7157(suite) ->
- {req, [], {conf,
- init_otp_7157,
- [otp_7157_test],
- finish_otp_7157}}.
+ Reqs = [],
+ Conf = [{conf, init_otp_7157, [otp_7157_test], finish_otp_7157}],
+ {req, Reqs, Conf}.
init_otp_7157(Config) when is_list(Config) ->
%% <CONDITIONAL-SKIP>
@@ -5691,6 +5795,337 @@ otp_7157_test1(MA) ->
%%-----------------------------------------------------------------
+%% Extra test cases
+%% These cases are started in the new way
+%%-----------------------------------------------------------------
+
+otp8395({init, Config}) when is_list(Config) ->
+ ?DBG("otp8395(init) -> entry with"
+ "~n Config: ~p", [Config]),
+
+ %% --
+ %% Start nodes
+ %%
+
+ {ok, AgentNode} = start_node(agent),
+ %% {ok, SubAgentNode} = start_node(sub_agent),
+ {ok, ManagerNode} = start_node(manager),
+
+ %% --
+ %% Mnesia init
+ %%
+
+ AgentDbDir = ?config(agent_db_dir, Config),
+ AgentMnesiaDir = filename:join([AgentDbDir, "mnesia"]),
+ mnesia_init(AgentNode, AgentMnesiaDir),
+
+%% SubAgentDir = ?config(sub_agent_dir, Config),
+%% SubAgentMnesiaDir = filename:join([SubAgentDir, "mnesia"]),
+%% mnesia_init(SubAgentNode, SubAgentMnesiaDir),
+
+ %% ok = mnesia_create_schema(AgentNode, [AgentNode, SubAgentNode]),
+ %% ok = mnesia:create_schema([AgentNode, SubAgentNode]),
+ mnesia_create_schema(AgentNode, [AgentNode]),
+
+ mnesia_start(AgentNode),
+ %% mnesia_start(SubAgentNode),
+
+ %% --
+ %% Host & IP
+ %%
+
+ AgentHost = ?HOSTNAME(AgentNode),
+ %% SubAgentHost = ?HPSTNAME(SubAgentNode),
+ ManagerHost = ?HOSTNAME(ManagerNode),
+
+ Host = snmp_test_lib:hostname(),
+ Ip = ?LOCALHOST(),
+ {ok, AgentIP0} = snmp_misc:ip(AgentHost),
+ AgentIP = tuple_to_list(AgentIP0),
+ %% {ok, SubAgentIP0} = snmp_misc:ip(SubAgentHost),
+ %% SubAgentIP = tuple_to_list(SubAgentIP0),
+ {ok, ManagerIP0} = snmp_misc:ip(ManagerHost),
+ ManagerIP = tuple_to_list(ManagerIP0),
+
+
+ %% --
+ %% Write agent config
+ %%
+
+ Vsns = [v1],
+ AgentConfDir = ?config(agent_conf_dir, Config),
+ ManagerConfDir = ?config(manager_top_dir, Config),
+ snmp_agent_test_lib:config(Vsns,
+ ManagerConfDir, AgentConfDir,
+ ManagerIP, AgentIP),
+
+
+ %% --
+ %% Start the agent
+ %%
+
+ Config2 = start_agent([{host, Host},
+ {ip, Ip},
+ {agent_node, AgentNode},
+ {agent_host, AgentHost},
+ {agent_ip, AgentIP},
+ %% {sub_agent_node, SubAgentNode},
+ %% {sub_agent_host, SubAgentHost},
+ %% {sub_agent_ip, SubAgentIP},
+ {manager_node, ManagerNode},
+ {manager_host, ManagerHost},
+ {manager_ip, ManagerIP}|Config]),
+
+ %% --
+ %% Create watchdog
+ %%
+
+ Dog = ?WD_START(?MINS(1)),
+
+ [{watchdog, Dog} | Config2];
+
+otp8395({fin, Config}) when is_list(Config) ->
+ ?DBG("otp8395(fin) -> entry with"
+ "~n Config: ~p", [Config]),
+
+ AgentNode = ?config(agent_node, Config),
+ ManagerNode = ?config(manager_node, Config),
+
+ %% -
+ %% Stop agent (this is the nice way to do it,
+ %% so logs and files can be closed in the proper way).
+ %%
+
+ AgentSup = ?config(agent_sup, Config),
+ ?DBG("otp8395(fin) -> stop (stand-alone) agent: ~p", [AgentSup]),
+ stop_stdalone_agent(AgentSup),
+
+ %% -
+ %% Stop mnesia
+ %%
+ ?DBG("otp8395(fin) -> stop mnesia", []),
+ mnesia_stop(AgentNode),
+
+
+ %% -
+ %% Stop the agent node
+ %%
+
+ ?DBG("otp8395(fin) -> stop agent node", []),
+ stop_node(AgentNode),
+
+
+%% SubAgentNode = ?config(sub_agent_node, Config),
+%% stop_node(SubAgentNode),
+
+
+ %% -
+ %% Stop the manager node
+ %%
+
+ ?DBG("otp8395(fin) -> stop manager node", []),
+ stop_node(ManagerNode),
+
+ Dog = ?config(watchdog, Config),
+ ?WD_STOP(Dog),
+ lists:keydelete(watchdog, 1, Config);
+
+otp8395(doc) ->
+ "OTP-8395 - ATL with sequence numbering. ";
+
+otp8395(Config) when is_list(Config) ->
+ ?DBG("otp8395 -> entry with"
+ "~n Config: ~p", [Config]),
+
+ ?SLEEP(1000),
+
+ %% This is just to dirty trick for the ***old*** test-code
+ put(mgr_node, ?config(manager_node, Config)),
+ put(mgr_dir, ?config(manager_top_dir, Config)),
+ put(mib_dir, ?config(mib_dir, Config)),
+ put(vsn, v1),
+ put(master_host, ?config(agent_host, Config)),
+ try_test(simple_standard_test),
+
+ ?SLEEP(1000),
+ AgentNode = ?config(agent_node, Config),
+ AgentLogDir = ?config(agent_log_dir, Config),
+ OutFile = filename:join([AgentLogDir, "otp8395.txt"]),
+ {ok, LogInfo} = rpc:call(AgentNode, snmpa, log_info, []),
+ ?DBG("otp8395 -> LogInfo: ~p", [LogInfo]),
+
+%% SyncRes = rpc:call(AgentNode, snmp, log_sync, [?audit_trail_log_name]),
+%% ?DBG("otp8395 -> SyncRes: ~p", [SyncRes]),
+
+ ok = agent_log_validation(AgentNode),
+ LTTRes =
+ rpc:call(AgentNode, snmpa, log_to_txt, [AgentLogDir, [], OutFile]),
+ ?DBG("otp8395 -> LTTRes: ~p", [LTTRes]),
+
+ ?SLEEP(1000),
+ ?DBG("otp8395 -> done", []),
+ ok.
+
+
+agent_log_validation(Node) ->
+ rpc:call(Node, ?MODULE, agent_log_validation, []).
+
+agent_log_validation() ->
+ put(sname, otp8308),
+ put(verbosity, trace),
+ snmp_log:validate(?audit_trail_log_name, true).
+
+mnesia_init(Node, Dir) ->
+ rpc:call(Node, ?MODULE, mnesia_init, [Dir]).
+
+mnesia_init(Dir) ->
+ ok = application:load(mnesia),
+ application_controller:set_env(mnesia, dir, Dir).
+
+mnesia_create_schema(Node, Nodes) ->
+ rpc:call(Node, mnesia, create_schema, [Nodes]).
+
+mnesia_start(Node) ->
+ rpc:call(Node, application, start, [mnesia]).
+
+mnesia_start() ->
+ application:start(mnesia).
+
+mnesia_stop(Node) ->
+ rpc:call(Node, application, stop, [mnesia]).
+
+mnesia_stop() ->
+ application:start(mnesia).
+
+
+start_agent(Config) ->
+ start_agent(Config, []).
+
+start_agent(Config, Opts) ->
+
+ %% Directories
+ ConfDir = ?config(agent_conf_dir, Config),
+ DbDir = ?config(agent_db_dir, Config),
+ LogDir = ?config(agent_log_dir, Config),
+
+ Vsns = [v1],
+
+ AgentConfig = process_agent_options(ConfDir, DbDir, LogDir, Vsns, Opts),
+
+ %% Nodes
+ AgentNode = ?config(agent_node, Config),
+ %% ManagerNode = ?config(manager_node, Config),
+
+ process_flag(trap_exit,true),
+
+ AgentTopSup = start_stdalone_agent(AgentNode, AgentConfig),
+
+ [{agent_sup, AgentTopSup} | Config].
+
+
+process_agent_options(ConfDir, DbDir, LogDir, Vsns, Opts) ->
+ Defaults =
+ [{agent_type, master},
+ {agent_verbosity, trace},
+ {priority, normal},
+ {versions, Vsns},
+ {db_dir, DbDir},
+ {mib_storage, ets},
+ {local_db, [{repair, true},
+ {auto_save, 5000},
+ {verbosity, log}]},
+ {error_report_module, snmpa_error_logger},
+ {config, [{dir, ConfDir},
+ {force_load, true},
+ {verbosity, trace}]},
+ {multi_threaded, true},
+ {mib_server, [{mibentry_override, false},
+ {trapentry_override, false},
+ {verbosity, info}]},
+ {target_cache, [{verbosity,info}]},
+ {symbolic_store, [{verbosity,log}]},
+ {note_store, [{timeout,30000}, {verbosity,log}]},
+ {net_if, [{module, snmpa_net_if},
+ {verbosity, trace},
+ {options, [{bind_to, false},
+ {no_reuse, false},
+ {req_limit, infinity}]}]},
+ {audit_trail_log, [{type, read_write},
+ {dir, LogDir},
+ {size, {10240,20}},
+ {repair, true},
+ {seqno, true}]}],
+
+ process_options(Defaults, Opts).
+
+process_options(Defaults, _Opts) ->
+ %% process_options(Defaults, Opts, []).
+ Defaults.
+
+%% process_options([], _Opts, Acc) ->
+%% lists:reverse(Acc);
+%% process_options([{Key, DefaultValue}|Defaults], Opts, Acc) ->
+%% case lists:keysearch(Key, 1, Opts) of
+%% {value, {Key, Value}} when is_list->
+
+
+snmp_app_env_init(Node, Entity, Conf) ->
+ rpc:call(Node, snmp_app_env_init, [Entity, Conf]).
+
+snmp_app_env_init(Entity, Conf) ->
+ application:unload(snmp),
+ application:load(snmp),
+ application:set_env(snmp, Entity, Conf).
+
+start_stdalone_agent(Node, Config) ->
+ rpc:call(Node, ?MODULE, start_stdalone_agent, [Config]).
+
+start_stdalone_agent(Config) ->
+ case snmpa_supervisor:start_link(normal, Config) of
+ {ok, AgentTopSup} ->
+ unlink(AgentTopSup),
+ AgentTopSup;
+ {error, {already_started, AgentTopSup}} ->
+ AgentTopSup
+ end.
+
+stop_stdalone_agent(Pid) when (node(Pid) =/= node()) ->
+ MRef = erlang:monitor(process, Pid),
+ rpc:call(node(Pid), ?MODULE, stop_stdalone_agent, [Pid]),
+ receive
+ {'DOWN', MRef, process, Pid, Info} ->
+ ?DBG("received expected DOWN message "
+ "regarding snmp agent supervisor: "
+ "~n Info: ~p", [Info]),
+ ok
+ after 5000 ->
+ ?DBG("no DOWN message "
+ "regarding snmp agent supervisor within time", []),
+ ok
+ end;
+stop_stdalone_agent(Pid) ->
+ ?DBG("attempting to terminate agent top-supervisor: ~p", [Pid]),
+ nkill(Pid, kill).
+
+
+nkill(Pid, Reason) ->
+ nkill(Pid, Reason, 10).
+
+nkill(Pid, Reason, N) when N > 0 ->
+ case (catch erlang:process_info(Pid)) of
+ Info when is_list(Info) ->
+ ?DBG("Info for process to kill: "
+ "~n Info: ~p", [Info]),
+ exit(Pid, Reason),
+ ?SLEEP(1000),
+ nkill(Pid, Reason, N-1);
+ _ ->
+ ?DBG("No process info => already dead?", []),
+ ok
+ end.
+
+
+%%-----------------------------------------------------------------
%% Slogan: info test
%%-----------------------------------------------------------------
diff --git a/lib/snmp/test/snmp_log_test.erl b/lib/snmp/test/snmp_log_test.erl
index b4694fd9ab..91bdc3e849 100644
--- a/lib/snmp/test/snmp_log_test.erl
+++ b/lib/snmp/test/snmp_log_test.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2003-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2003-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -45,20 +45,30 @@
all/1,
open_and_close/1,
open_write_and_close/1,
+ open_write_and_close1/1,
+ open_write_and_close2/1,
+ open_write_and_close3/1,
+ open_write_and_close4/1,
+ log_to_io/1,
log_to_io1/1,
log_to_io2/1,
+ log_to_txt/1,
log_to_txt1/1,
- log_to_txt2/1
+ log_to_txt2/1,
+ log_to_txt3/1
]).
+
%%----------------------------------------------------------------------
%% Internal exports
%%----------------------------------------------------------------------
-export([
log_writer_main/5,
- log_reader_main/1
+ log_reader_main/1,
+ next_seqno/2
]).
+
%%----------------------------------------------------------------------
%% Macros
%%----------------------------------------------------------------------
@@ -102,10 +112,32 @@ all(suite) ->
[
open_and_close,
open_write_and_close,
+ log_to_io,
+ log_to_txt
+ ].
+
+
+open_write_and_close(suite) ->
+ [
+ open_write_and_close1,
+ open_write_and_close2,
+ open_write_and_close3,
+ open_write_and_close4
+ ].
+
+
+log_to_io(suite) ->
+ [
log_to_io1,
- log_to_io2,
+ log_to_io2
+ ].
+
+
+log_to_txt(suite) ->
+ [
log_to_txt1,
- log_to_txt2
+ log_to_txt2,
+ log_to_txt3
].
@@ -132,24 +164,129 @@ open_and_close(Config) when is_list(Config) ->
%%======================================================================
-open_write_and_close(suite) -> [];
-open_write_and_close(Config) when is_list(Config) ->
- p(open_write_and_close),
- put(sname,open_write_and_close),
+open_write_and_close1(suite) ->
+ [];
+open_write_and_close1(doc) ->
+ "Open a plain (no sequence-numbering) log file";
+open_write_and_close1(Config) when is_list(Config) ->
+ p(open_write_and_close1),
+ put(sname,open_write_and_close1),
+ put(verbosity,trace),
+ ?DBG("open_write_and_close1 -> start", []),
+
+ SeqNoGen = none,
+ ?line ok = open_write_and_close(SeqNoGen, Config),
+
+ ?DBG("open_write_and_close1 -> done", []),
+ ok.
+
+
+%%======================================================================
+
+open_write_and_close2(suite) ->
+ [];
+open_write_and_close2(doc) ->
+ "Open a log file with sequence-numbering explicitly disabled";
+open_write_and_close2(Config) when is_list(Config) ->
+ p(open_write_and_close2),
+ put(sname,open_write_and_close2),
+ put(verbosity,trace),
+ ?DBG("open_write_and_close2 -> start", []),
+
+ SeqNoGen = disabled,
+ ?line ok = open_write_and_close(SeqNoGen, Config),
+
+ ?DBG("open_write_and_close2 -> done", []),
+ ok.
+
+
+%%======================================================================
+
+open_write_and_close3(suite) ->
+ [];
+open_write_and_close3(doc) ->
+ "Open a log file with sequence-numbering using MFA";
+open_write_and_close3(Config) when is_list(Config) ->
+ p(open_write_and_close3),
+ put(sname,open_write_and_close3),
+ put(verbosity,trace),
+ ?DBG("open_write_and_close2 -> start", []),
+
+ seqno_init(),
+ SeqNoGen = {?MODULE, next_seqno, [10, 100]},
+ ?line ok = open_write_and_close(SeqNoGen, Config),
+ seqno_finish(),
+
+ ?DBG("open_write_and_close2 -> done", []),
+ ok.
+
+
+%%======================================================================
+
+open_write_and_close4(suite) ->
+ [];
+open_write_and_close4(doc) ->
+ "Open a log file with sequence-numbering using fun";
+open_write_and_close4(Config) when is_list(Config) ->
+ p(open_write_and_close4),
+ put(sname,open_write_and_close4),
put(verbosity,trace),
- ?DBG("open_write_and_close -> start", []),
+ ?DBG("open_write_and_close2 -> start", []),
+
+ seqno_init(),
+ SeqNoGen = fun() -> next_seqno(10, 100) end,
+ ?line ok = open_write_and_close(SeqNoGen, Config),
+ seqno_finish(),
+
+ ?DBG("open_write_and_close2 -> done", []),
+ ok.
+
+
+%%======================================================================
+
+seqno_init() ->
+ ets:new(snmp_log_test_seqno_tab, [named_table, set, protected]).
+
+seqno_finish() ->
+ ets:delete(snmp_log_test_seqno_tab).
+
+next_seqno(Initial, Max) ->
+ Key = seqno,
+ Position = 2,
+ Increment = 1,
+ Threshold = Max,
+ SetValue = Initial,
+ UpdateOp = {Position, Increment, Threshold, SetValue},
+ Tab = snmp_log_test_seqno_tab,
+ case (catch ets:update_counter(Tab, Key, UpdateOp)) of
+ {'EXIT', {badarg, _}} ->
+ ets:insert(Tab, {seqno, Initial}),
+ Initial;
+ Next when is_integer(Next) ->
+ Next
+ end.
+
+open_write_and_close(SeqNoGen, Config) ->
+ ?DBG("open_write_and_close1 -> start", []),
Dir = ?config(log_dir, Config),
Name = "snmp_test",
File = join(Dir, "snmp_test.log"),
Size = {1024, 10},
Repair = true,
?DBG("open_write_and_close -> create log", []),
- ?line {ok, Log} = snmp_log:create(Name, File, Size, Repair),
+
+ ?line {ok, Log} =
+ case SeqNoGen of
+ none ->
+ snmp_log:create(Name, File, Size, Repair);
+ _ ->
+ snmp_log:create(Name, File, SeqNoGen, Size, Repair)
+ end,
Vsn = 'version-2',
Community = "all-rights",
- ?DBG("open_write_and_close -> create messages to log", []),
+ ?DBG("open_write_and_close1 -> create messages to log", []),
%% A request
?line Req = get_next_request(Vsn, Community, [1,1], 1, 235779012),
@@ -162,7 +299,7 @@ open_write_and_close(Config) when is_list(Config) ->
Msgs = lists:flatten(lists:duplicate(1002,[Req,Rep])),
%% And now log them:
- ?DBG("open_write_and_close -> log ~p messages, ~p bytes",
+ ?DBG("open_write_and_close1 -> log ~p messages, ~p bytes",
[length(Msgs), size(list_to_binary(Msgs))]),
Addr = ?LOCALHOST(),
Port = 162,
@@ -172,11 +309,11 @@ open_write_and_close(Config) when is_list(Config) ->
lists:foreach(Logger, Msgs),
check_notify(),
- ?DBG("open_write_and_close -> display info", []),
+ ?DBG("open_write_and_close1 -> display info", []),
?line {ok, Info} = snmp_log:info(Log),
display_info(Info),
- ?DBG("open_write_and_close -> close log", []),
+ ?DBG("open_write_and_close1 -> close log", []),
?line ok = snmp_log:close(Log),
?DBG("open_write_and_close -> done", []),
@@ -308,18 +445,58 @@ log_to_txt1(Config) when is_list(Config) ->
put(sname,l2t1),
put(verbosity,trace),
?DBG("log_to_txt1 -> start", []),
+
+ Name = "snmp_test_l2t1",
+ SeqNoGen = disabled,
+ ?line ok = log_to_txt(Name, SeqNoGen, Config),
+
+ ?DBG("log_to_txt1 -> done", []),
+ ok.
+
+
+
+%%======================================================================
+
+log_to_txt2(suite) -> [];
+log_to_txt2(Config) when is_list(Config) ->
+ p(log_to_txt2),
+ put(sname,l2t2),
+ put(verbosity,trace),
+ ?DBG("log_to_txt2 -> start", []),
+
+ Name = "snmp_test_l2t2",
+ seqno_init(),
+ SeqNoGen = {?MODULE, next_seqno, [1, 100]},
+ ?line ok = log_to_txt(Name, SeqNoGen, Config),
+ seqno_finish(),
+
+ ?DBG("log_to_txt2 -> done", []),
+ ok.
+
+
+
+%%======================================================================
+
+log_to_txt(Name, SeqNoGen, Config) when is_list(Config) ->
+ ?DBG("log_to_txt -> entry", []),
Dir = ?config(log_dir, Config),
- Name = "snmp_test_l2t1",
- File = join(Dir, "snmp_test_l2t1.log"),
+ File = join(Dir, Name ++ ".log"),
Size = {10240, 10},
Repair = true,
- ?DBG("log_to_txt1 -> create log", []),
- ?line {ok, Log} = snmp_log:create(Name, File, Size, Repair),
- ?DBG("log_to_txt1 -> create messages to log", []),
+ ?DBG("log_to_txt -> create log", []),
+ ?line {ok, Log} =
+ case SeqNoGen of
+ none ->
+ snmp_log:create(Name, File, Size, Repair);
+ _ ->
+ snmp_log:create(Name, File, SeqNoGen, Size, Repair)
+ end,
+
+ ?DBG("log_to_txt -> create messages to log", []),
Msgs = messages(),
- ?DBG("log_to_txt1 -> create logger funs", []),
+ ?DBG("log_to_txt -> create logger funs", []),
Addr = ?LOCALHOST(),
Port = 162,
Logger = fun(Packet) ->
@@ -332,42 +509,42 @@ log_to_txt1(Config) when is_list(Config) ->
end,
To = lists:duplicate(20, 5000),
- ?DBG("log_to_txt1 -> log the messages", []),
+ ?DBG("log_to_txt -> log the messages", []),
Start = calendar:local_time(),
lists:foreach(BatchLogger, To),
Stop = calendar:local_time(),
- ?DBG("log_to_txt1 -> display info", []),
+ ?DBG("log_to_txt -> display info", []),
?line {ok, Info} = snmp_log:info(Log),
display_info(Info),
Out1 = join(Dir, "snmp_text-1.txt"),
- ?DBG("log_to_txt1 -> do the convert to a text file when"
+ ?DBG("log_to_txt -> do the convert to a text file when"
"~n Out1: ~p", [Out1]),
?line ok = snmp:log_to_txt(Dir, [], Out1, Log, File),
?line {ok, #file_info{size = Size1}} = file:read_file_info(Out1),
- ?DBG("log_to_txt1 -> text file size: ~p", [Size1]),
+ ?DBG("log_to_txt -> text file size: ~p", [Size1]),
validate_size(Size1),
Out2 = join(Dir, "snmp_text-2.txt"),
- ?DBG("log_to_txt1 -> do the convert to a text file when"
+ ?DBG("log_to_txt -> do the convert to a text file when"
"~n Start: ~p"
"~n Stop: ~p"
"~n Out2: ~p", [Start, Stop, Out2]),
?line ok = snmp:log_to_txt(Dir, [], Out2, Log, File, Start, Stop),
?line {ok, #file_info{size = Size2}} = file:read_file_info(Out2),
- ?DBG("log_to_txt1 -> text file size: ~p", [Size2]),
+ ?DBG("log_to_txt -> text file size: ~p", [Size2]),
validate_size(Size2, {le, Size1}),
%% Calculate new start / stop times...
GStart = calendar:datetime_to_gregorian_seconds(Start),
- ?DBG("log_to_txt1 -> GStart: ~p", [GStart]),
+ ?DBG("log_to_txt -> GStart: ~p", [GStart]),
GStop = calendar:datetime_to_gregorian_seconds(Stop),
- ?DBG("log_to_txt1 -> GStop: ~p", [GStop]),
+ ?DBG("log_to_txt -> GStop: ~p", [GStop]),
Diff4 = (GStop - GStart) div 4,
- ?DBG("log_to_txt1 -> Diff4: ~p", [Diff4]),
+ ?DBG("log_to_txt -> Diff4: ~p", [Diff4]),
GStart2 = GStart + Diff4,
GStop2 = GStop - Diff4,
if
@@ -381,20 +558,20 @@ log_to_txt1(Config) when is_list(Config) ->
Stop2 = calendar:gregorian_seconds_to_datetime(GStop2),
Out3 = join(Dir, "snmp_text-3.txt"),
- ?DBG("log_to_txt1 -> do the convert to a text file when"
+ ?DBG("log_to_txt -> do the convert to a text file when"
"~n Start2: ~p"
"~n Stop2: ~p"
"~n Out3: ~p", [Start2, Stop2, Out3]),
?line ok = snmp:log_to_txt(Dir, [], Out3, Log, File, Start2, Stop2),
?line {ok, #file_info{size = Size3}} = file:read_file_info(Out3),
- ?DBG("log_to_txt1 -> text file size: ~p", [Size3]),
+ ?DBG("log_to_txt -> text file size: ~p", [Size3]),
validate_size(Size3, {l, Size1}),
- ?DBG("log_to_txt1 -> close log", []),
+ ?DBG("log_to_txt -> close log", []),
?line ok = snmp_log:close(Log),
- ?DBG("log_to_txt1 -> done", []),
+ ?DBG("log_to_txt -> done", []),
ok.
@@ -405,19 +582,21 @@ log_to_txt1(Config) when is_list(Config) ->
%%
%% Test: ts:run(snmp, snmp_log_test, log_to_txt2, [batch]).
-log_to_txt2(suite) -> [];
-log_to_txt2(doc) -> "Log to txt file from a different process than which "
- "opened and wrote the log";
-log_to_txt2(Config) when is_list(Config) ->
+log_to_txt3(suite) ->
+ [];
+log_to_txt3(doc) ->
+ "Log to txt file from a different process than which "
+ "opened and wrote the log";
+log_to_txt3(Config) when is_list(Config) ->
process_flag(trap_exit, true),
- p(log_to_txt2),
- put(sname,l2t2),
+ p(log_to_txt3),
+ put(sname,l2t3),
put(verbosity,trace),
- ?DBG("log_to_txt2 -> start", []),
+ ?DBG("log_to_txt3 -> start", []),
Dir = ?config(log_dir, Config),
- Name = "snmp_test_l2t2",
- LogFile = join(Dir, "snmp_test_l2t2.log"),
- TxtFile = join(Dir, "snmp_test_l2t2.txt"),
+ Name = "snmp_test_l2t3",
+ LogFile = join(Dir, "snmp_test_l2t3.log"),
+ TxtFile = join(Dir, "snmp_test_l2t3.txt"),
Meg = 1024*1024,
Size = {10*Meg, 10},
Repair = true,
@@ -425,22 +604,22 @@ log_to_txt2(Config) when is_list(Config) ->
StdMibDir = filename:join(code:priv_dir(snmp), "mibs") ++ "/",
Mibs = [join(StdMibDir, "SNMPv2-MIB")],
- ?DBG("log_to_txt2 -> create log writer process", []),
+ ?DBG("log_to_txt3 -> create log writer process", []),
?line {ok, Log, Logger} = log_writer_start(Name, LogFile, Size, Repair),
- ?DBG("log_to_txt2 -> create log reader process", []),
+ ?DBG("log_to_txt3 -> create log reader process", []),
?line {ok, Reader} = log_reader_start(),
- ?DBG("log_to_txt2 -> wait some time", []),
+ ?DBG("log_to_txt3 -> wait some time", []),
?SLEEP(5000),
- ?DBG("log_to_txt2 -> display log info", []),
+ ?DBG("log_to_txt3 -> display log info", []),
?line log_writer_info(Logger),
- ?DBG("log_to_txt2 -> instruct the log writer to sleep some", []),
+ ?DBG("log_to_txt3 -> instruct the log writer to sleep some", []),
?line ok = log_writer_sleep(Logger, 5000),
- ?DBG("log_to_txt2 -> instruct the log reader to log to txt", []),
+ ?DBG("log_to_txt3 -> instruct the log reader to log to txt", []),
Res =
log_reader_log_to(Reader,
fun() ->
@@ -457,25 +636,25 @@ log_to_txt2(Config) when is_list(Config) ->
case Res of
{ok, Info} ->
- ?DBG("log_to_txt2 -> ~n Info: ~p", [Info]),
+ ?DBG("log_to_txt3 -> ~n Info: ~p", [Info]),
?line {ok, #file_info{size = FileSize}} =
file:read_file_info(TxtFile),
- ?DBG("log_to_txt2 -> text file size: ~p", [FileSize]),
+ ?DBG("log_to_txt3 -> text file size: ~p", [FileSize]),
validate_size(FileSize);
{Error, Info} ->
- ?DBG("log_to_txt2 -> log to txt failed: "
+ ?DBG("log_to_txt3 -> log to txt failed: "
"~n Error: ~p"
"~n Info: ~p", [Error, Info]),
?line ?FAIL({log_lo_txt_failed, Error, Info})
end,
- ?DBG("log_to_txt2 -> instruct the log writer to stop", []),
+ ?DBG("log_to_txt3 -> instruct the log writer to stop", []),
?line log_writer_stop(Logger),
- ?DBG("log_to_txt2 -> instruct the log reader to stop", []),
+ ?DBG("log_to_txt3 -> instruct the log reader to stop", []),
?line log_reader_stop(Reader),
- ?DBG("log_to_txt2 -> done", []),
+ ?DBG("log_to_txt3 -> done", []),
ok.
diff --git a/lib/snmp/test/snmp_manager_config_test.erl b/lib/snmp/test/snmp_manager_config_test.erl
index 51325996e6..fcb3d7e30c 100644
--- a/lib/snmp/test/snmp_manager_config_test.erl
+++ b/lib/snmp/test/snmp_manager_config_test.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -86,7 +86,12 @@
stats_create_and_increment/1,
tickets/1,
- otp_7219/1
+ otp_7219/1,
+ otp_8395/1,
+ otp_8395_1/1,
+ otp_8395_2/1,
+ otp_8395_3/1,
+ otp_8395_4/1
]).
@@ -2295,7 +2300,8 @@ loop(N, _, F) when (N > 0) andalso is_function(F) ->
tickets(suite) ->
[
- otp_7219
+ otp_7219,
+ otp_8395
].
@@ -2347,6 +2353,170 @@ otp_7219(Config) when is_list(Config) ->
ok.
+
+otp_8395(suite) ->
+ [
+ otp_8395_1,
+ otp_8395_2,
+ otp_8395_3,
+ otp_8395_4
+ ].
+
+otp_8395_1(suite) -> [];
+otp_8395_1(doc) ->
+ "OTP-8395(1)";
+otp_8395_1(Conf) when is_list(Conf) ->
+ put(tname, otp_8395_1),
+ p("start"),
+ process_flag(trap_exit, true),
+ otp8395(Conf, false, ok),
+ ok.
+
+otp_8395_2(suite) -> [];
+otp_8395_2(doc) ->
+ "OTP-8395(2)";
+otp_8395_2(Conf) when is_list(Conf) ->
+ put(tname, otp_8395_2),
+ p("start"),
+ process_flag(trap_exit, true),
+ otp8395(Conf, true, ok),
+ ok.
+
+otp_8395_3(suite) -> [];
+otp_8395_3(doc) ->
+ "OTP-8395(3)";
+otp_8395_3(Conf) when is_list(Conf) ->
+ put(tname, otp_8395_3),
+ p("start"),
+ process_flag(trap_exit, true),
+ otp8395(Conf, gurka, error),
+ ok.
+
+otp8395(Conf, SeqNoVal, Expect) ->
+ ConfDir = ?config(manager_conf_dir, Conf),
+ DbDir = ?config(manager_db_dir, Conf),
+ LogDir = ?config(manager_log_dir, Conf),
+ StdMibDir = filename:join(code:priv_dir(snmp), "mibs") ++ "/",
+
+ write_manager_conf(ConfDir),
+
+ %% Third set of options (no versions):
+ p("all options"),
+ NetIfOpts = [{module, snmpm_net_if},
+ {verbosity, trace},
+ {options, [{recbuf, 30000},
+ {bind_to, false},
+ {no_reuse, false}]}],
+ ServerOpts = [{timeout, 10000}, {verbosity, trace}],
+ NoteStoreOpts = [{timeout, 20000}, {verbosity, trace}],
+ ConfigOpts = [{dir, ConfDir}, {verbosity, trace}, {db_dir, DbDir}],
+ Mibs = [join(StdMibDir, "SNMP-NOTIFICATION-MIB"),
+ join(StdMibDir, "SNMP-USER-BASED-SM-MIB")],
+ Prio = normal,
+ ATL = [{type, read_write},
+ {dir, LogDir},
+ {size, {10,10240}},
+ {repair, true},
+ {seqno, SeqNoVal}],
+ Vsns = [v1,v2,v3],
+ Opts = [{config, ConfigOpts},
+ {net_if, NetIfOpts},
+ {server, ServerOpts},
+ {note_store, NoteStoreOpts},
+ {audit_trail_log, ATL},
+ {priority, Prio},
+ {mibs, Mibs},
+ {versions, Vsns}],
+
+ case config_start(Opts) of
+ {ok, _Pid} when (Expect =:= ok) ->
+ ?line ok = config_stop(),
+ ok;
+ {ok, _Pid} when (Expect =/= ok) ->
+ config_stop(),
+ exit({unexpected_started_config, SeqNoVal});
+ _Error when (Expect =/= ok) ->
+ ok;
+ Error when (Expect =:= ok) ->
+ exit({unexpected_failed_starting_config, SeqNoVal, Error})
+ end,
+ p("done"),
+ ok.
+
+
+otp_8395_4(suite) -> [];
+otp_8395_4(doc) ->
+ "OTP-8395(4)";
+otp_8395_4(Conf) when is_list(Conf) ->
+ put(tname, otp_8395_4),
+ p("start"),
+ process_flag(trap_exit, true),
+
+ snmp:print_version_info(),
+
+ ConfDir = ?config(manager_conf_dir, Conf),
+ DbDir = ?config(manager_db_dir, Conf),
+ LogDir = ?config(manager_log_dir, Conf),
+ StdMibDir = filename:join(code:priv_dir(snmp), "mibs") ++ "/",
+
+ write_manager_conf(ConfDir),
+
+ %% Third set of options (no versions):
+ p("all options"),
+ NetIfOpts = [{module, snmpm_net_if},
+ {verbosity, trace},
+ {options, [{recbuf, 30000},
+ {bind_to, false},
+ {no_reuse, false}]}],
+ ServerOpts = [{timeout, 10000}, {verbosity, trace}],
+ NoteStoreOpts = [{timeout, 20000}, {verbosity, trace}],
+ ConfigOpts = [{dir, ConfDir}, {verbosity, trace}, {db_dir, DbDir}],
+ Mibs = [join(StdMibDir, "SNMP-NOTIFICATION-MIB"),
+ join(StdMibDir, "SNMP-USER-BASED-SM-MIB")],
+ Prio = normal,
+ ATL = [{type, read_write},
+ {dir, LogDir},
+ {size, {10,10240}},
+ {repair, true},
+ {seqno, true}],
+ Vsns = [v1,v2,v3],
+ Opts = [{config, ConfigOpts},
+ {net_if, NetIfOpts},
+ {server, ServerOpts},
+ {note_store, NoteStoreOpts},
+ {audit_trail_log, ATL},
+ {priority, Prio},
+ {mibs, Mibs},
+ {versions, Vsns}],
+
+ ?line {ok, _Pid} = config_start(Opts),
+
+ Counter = otp_8395_4,
+ Initial = 10,
+ Increment = 2,
+ Max = 20,
+
+ %% At this call the counter does *not* exist. The call creates
+ %% it with the initial value!
+
+ Val1 = Initial,
+ Val1 = otp8395_incr_counter(Counter, Initial, Increment, Max),
+
+ %% Now it exist, make sure another call does the expected increment
+
+ Val2 = Initial + Increment,
+ Val2 = otp8395_incr_counter(Counter, Initial, Increment, Max),
+
+ ?line ok = config_stop(),
+
+ p("done"),
+ ok.
+
+
+otp8395_incr_counter(Counter, Initial, Increment, Max) ->
+ snmpm_config:increment_counter(Counter, Initial, Increment, Max).
+
+
%%======================================================================
%% Internal functions
%%======================================================================
diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl
index 31cc095349..518b8b34de 100644
--- a/lib/snmp/test/snmp_manager_test.erl
+++ b/lib/snmp/test/snmp_manager_test.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2003-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2003-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -111,7 +111,9 @@
tickets/1,
otp8015/1,
- otp8015_1/1
+ otp8015_1/1,
+ otp8395/1,
+ otp8395_1/1
]).
@@ -240,18 +242,22 @@ init_per_testcase3(Case, Config) ->
simple_async_set2,
simple_sync_get_bulk2,
simple_async_get_bulk2,
- misc_async2
+ misc_async2,
+ otp8395_1
],
- Cases = [
- trap1,
- trap2,
- inform1,
- inform2,
- inform3,
- inform4,
- inform_swarm,
- report
- ] ++ OldApiCases ++ NewApiCases,
+ Cases =
+ [
+ trap1,
+ trap2,
+ inform1,
+ inform2,
+ inform3,
+ inform4,
+ inform_swarm,
+ report
+ ] ++
+ OldApiCases ++
+ NewApiCases,
case lists:member(Case, Cases) of
true ->
NoAutoInformCases = [inform1, inform2, inform3, inform_swarm],
@@ -265,6 +271,8 @@ init_per_testcase3(Case, Config) ->
{agent_verbosity, info},
{agent_net_if_verbosity, info}],
Verb ++ Config;
+ Case =:= otp8395_1 ->
+ [{manager_atl_seqno, true} | Config];
true ->
Config
end,
@@ -315,18 +323,22 @@ fin_per_testcase2(Case, Config) ->
simple_async_set2,
simple_sync_get_bulk2,
simple_async_get_bulk2,
- misc_async2
+ misc_async2,
+ otp8395_1
],
- Cases = [
- trap1,
- trap2,
- inform1,
- inform2,
- inform3,
- inform4,
- inform_swarm,
- report
- ] ++ OldApiCases ++ NewApiCases,
+ Cases =
+ [
+ trap1,
+ trap2,
+ inform1,
+ inform2,
+ inform3,
+ inform4,
+ inform_swarm,
+ report
+ ] ++
+ OldApiCases ++
+ NewApiCases,
case lists:member(Case, Cases) of
true ->
Conf1 = case lists:member(Case, NewApiCases) of
@@ -446,7 +458,8 @@ event_tests(suite) ->
tickets(suite) ->
[
- otp8015
+ otp8015,
+ otp8395
].
otp8015(suite) ->
@@ -454,6 +467,11 @@ otp8015(suite) ->
otp8015_1
].
+otp8395(suite) ->
+ [
+ otp8395_1
+ ].
+
%%======================================================================
%% Test functions
@@ -1372,6 +1390,9 @@ simple_sync_get2(suite) -> [];
simple_sync_get2(Config) when is_list(Config) ->
process_flag(trap_exit, true),
put(tname, ssg2),
+ do_simple_get(Config).
+
+do_simple_get(Config) ->
p("starting with Config: ~p~n", [Config]),
Node = ?config(manager_node, Config),
@@ -1386,7 +1407,7 @@ simple_sync_get2(Config) when is_list(Config) ->
Oids2 = [[sysObjectID, 0], [sysDescr, 0], [sysUpTime, 0]],
?line ok = do_simple_get(Node, TargetName, Oids2),
ok.
-
+
do_simple_get(Node, TargetName, Oids) ->
?line {ok, Reply, Rem} = mgr_user_sync_get(Node, TargetName, Oids),
@@ -4438,6 +4459,16 @@ otp8015_1(Config) when is_list(Config) ->
%%======================================================================
+
+otp8395_1(doc) -> ["OTP-8395:1 - simple get with ATL sequence numbering."];
+otp8395_1(suite) -> [];
+otp8395_1(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, otp8395_1),
+ do_simple_get(Config).
+
+
+%%======================================================================
%% async snmp utility functions
%%======================================================================
@@ -5063,12 +5094,15 @@ start_manager(Node, Vsns, Conf0, Opts) ->
ServerVerbosity = get_opt(manager_server_verbosity, Conf0, trace),
NetIfVerbosity = get_opt(manager_net_if_verbosity, Conf0, trace),
+ AtlSeqNo = get_opt(manager_atl_seqno, Conf0, false),
+
Env = [{versions, Vsns},
{inform_request_behaviour, IRB},
{audit_trail_log, [{type, read_write},
{dir, AtlDir},
{size, {10240, 10}},
- {repair, true}]},
+ {repair, true},
+ {seqno, AtlSeqNo}]},
{config, [{dir, ConfDir},
{db_dir, DbDir},
{verbosity, ConfigVerbosity}]},
diff --git a/lib/snmp/test/snmp_test_mgr.erl b/lib/snmp/test/snmp_test_mgr.erl
index 085dc8600f..84bdc6b04f 100644
--- a/lib/snmp/test/snmp_test_mgr.erl
+++ b/lib/snmp/test/snmp_test_mgr.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%