aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/snmp/test/snmp_manager_test.erl82
-rw-r--r--lib/snmp/test/snmp_manager_user.erl15
2 files changed, 84 insertions, 13 deletions
diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl
index d638047701..808d10f116 100644
--- a/lib/snmp/test/snmp_manager_test.erl
+++ b/lib/snmp/test/snmp_manager_test.erl
@@ -83,6 +83,7 @@
simple_sync_set3/1,
simple_async_set1/1,
simple_async_set2/1,
+ simple_async_set3/1,
simple_sync_get_bulk1/1,
simple_sync_get_bulk2/1,
@@ -245,7 +246,8 @@ init_per_testcase3(Case, Config) ->
simple_async_get3,
simple_sync_get_next3,
simple_async_get_next3,
- simple_sync_set3
+ simple_sync_set3,
+ simple_async_set3
],
Cases =
[
@@ -335,7 +337,8 @@ end_per_testcase2(Case, Config) ->
simple_async_get3,
simple_sync_get_next3,
simple_async_get_next3,
- simple_sync_set3
+ simple_sync_set3,
+ simple_async_set3
],
Cases =
[
@@ -446,7 +449,8 @@ groups() ->
simple_sync_set2,
simple_sync_set3,
simple_async_set1,
- simple_async_set2
+ simple_async_set2,
+ simple_async_set3
]
},
{bulk_tests, [],
@@ -2553,31 +2557,40 @@ simple_async_set2(Config) when is_list(Config) ->
?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
?line ok = agent_load_mib(AgentNode, Test2Mib),
- Exec = fun(X) ->
- async_s_exec2(MgrNode, TargetName, X)
- end,
+ Set =
+ fun(Oids) ->
+ async_s_exec2(MgrNode, TargetName, Oids)
+ end,
+ PostVerify = fun(Res) -> Res end,
+
+ do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify).
+do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify) ->
Requests =
[
{1,
[{?sysName_instance, s, "Arne Anka"}],
- Exec,
+ Set,
fun(X) ->
- sas_verify(X, [?sysName_instance])
+ PostVerify(sas_verify(X, [?sysName_instance]))
end},
{2,
[{?sysLocation_instance, s, "Stockholm"},
{?sysName_instance, s, "Arne Anka"}],
- Exec,
+ Set,
fun(X) ->
- sas_verify(X, [?sysLocation_instance, ?sysName_instance])
+ PostVerify(sas_verify(X,
+ [?sysLocation_instance,
+ ?sysName_instance]))
end},
{3,
[{[sysName, 0], "Gothenburg"},
{[sysLocation, 0], "Sune Anka"}],
- Exec,
+ Set,
fun(X) ->
- sas_verify(X, [?sysName_instance, ?sysLocation_instance])
+ PostVerify(sas_verify(X,
+ [?sysName_instance,
+ ?sysLocation_instance]))
end}
],
@@ -2598,6 +2611,48 @@ async_s_exec2(Node, TargetName, VAVs) ->
%%======================================================================
+simple_async_set3(doc) ->
+ ["Simple (async) set-request - Version 3 API (TargetName with send-opts)"];
+simple_async_set3(suite) -> [];
+simple_async_set3(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ put(tname, sas3),
+ p("starting with Config: ~p~n", [Config]),
+
+ MgrNode = ?config(manager_node, Config),
+ AgentNode = ?config(agent_node, Config),
+ TargetName = ?config(manager_agent_target_name, Config),
+
+ ?line ok = mgr_user_load_mib(MgrNode, std_mib()),
+ Test2Mib = test2_mib(Config),
+ ?line ok = mgr_user_load_mib(MgrNode, Test2Mib),
+ ?line ok = agent_load_mib(AgentNode, Test2Mib),
+
+ Self = self(),
+ Msg = simple_async_set3,
+ Fun = fun() -> Self ! Msg end,
+ Extra = {?SNMPM_EXTRA_INFO_TAG, Fun},
+ SendOpts =
+ [
+ {extra, Extra}
+ ],
+
+ Set =
+ fun(Oids) ->
+ async_s_exec3(MgrNode, TargetName, Oids, SendOpts)
+ end,
+ PostVerify = fun(ok) -> receive Msg -> ok end;
+ (Res) -> Res
+ end,
+
+ do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify).
+
+async_s_exec3(Node, TargetName, VAVs, SendOpts) ->
+ mgr_user_async_set2(Node, TargetName, VAVs, SendOpts).
+
+
+%%======================================================================
+
simple_sync_get_bulk1(doc) -> ["Simple (sync) get_bulk-request - "
"Old style (Addr & Port)"];
simple_sync_get_bulk1(suite) -> [];
@@ -5335,6 +5390,9 @@ mgr_user_async_set(Node, Addr_or_TargetName, VAV) ->
mgr_user_async_set(Node, Addr, Port, VAV) ->
rcall(Node, snmp_manager_user, async_set, [Addr, Port, VAV]).
+mgr_user_async_set2(Node, TargetName, VAV, SendOpts) ->
+ rcall(Node, snmp_manager_user, async_set2, [TargetName, VAV, SendOpts]).
+
%% mgr_user_sync_get_bulk(Node, NonRep, MaxRep, Oids) ->
%% mgr_user_sync_get_bulk(Node, ?LOCALHOST(), ?AGENT_PORT,
%% NonRep, MaxRep, Oids).
diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl
index 7c4bdbfb0a..34f0779e9c 100644
--- a/lib/snmp/test/snmp_manager_user.erl
+++ b/lib/snmp/test/snmp_manager_user.erl
@@ -55,7 +55,7 @@
sync_get_next/1, sync_get_next/2, sync_get_next/3, sync_get_next2/3,
async_get_next/1, async_get_next/2, async_get_next/3, async_get_next2/3,
sync_set/1, sync_set/2, sync_set/3, sync_set2/3,
- async_set/1, async_set/2, async_set/3,
+ async_set/1, async_set/2, async_set/3, async_set2/3,
sync_get_bulk/3, sync_get_bulk/4, sync_get_bulk/5,
async_get_bulk/3, async_get_bulk/4, async_get_bulk/5,
name_to_oid/1, oid_to_name/1,
@@ -242,6 +242,9 @@ async_set(Addr_or_TargetName, VAV) ->
async_set(Addr, Port, VAV) ->
call({async_set, Addr, Port, VAV}).
+async_set2(TargetName, VAV, SendOpts) ->
+ call({async_set2, TargetName, VAV, SendOpts}).
+
%% --
sync_get_bulk(NonRep, MaxRep, Oids) ->
@@ -634,6 +637,16 @@ loop(#state{parent = Parent, id = Id} = S) ->
%% -- (async) set-request --
%%
+ {{async_set2, TargetName, VAV, SendOpts}, From, Ref}
+ when is_list(TargetName) ->
+ d("loop -> received async_set2 request with"
+ "~n TargetName: ~p"
+ "~n VAV: ~p"
+ "~n SendOpts: ~p", [TargetName, VAV, SendOpts]),
+ Res = snmpm:async_set2(Id, TargetName, VAV, SendOpts),
+ reply(From, Res, Ref),
+ loop(S);
+
{{async_set, VAV}, From, Ref} ->
d("loop -> received async_set request"),
Res = [snmpm:async_set(Id, TargetName, VAV) ||