From 32aa680d7b2a06299f2cf37d54496060fff1b44a Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 14 Apr 2011 09:07:04 +0200 Subject: Final version of the (new) API. --- lib/snmp/test/snmp_manager_user.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index b0e192344d..71fdebb67b 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -847,7 +847,11 @@ call(Req, To) when is_integer(To) -> {error, timeout} end. -reply(Pid, Reply, Ref) -> +reply(Pid, Reply, Ref) -> + d("reply -> entry with" + "~n Pid: ~p" + "~n Reply: ~p" + "~n Ref: ~p", [Pid, Reply, Ref]), Pid ! {Reply, Ref}. cast(Msg) -> -- cgit v1.2.3 From c733034aa59ee536b166e2c676bb0239ee62b1a6 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 14 Apr 2011 12:27:04 +0200 Subject: First test case for request API version 3. --- lib/snmp/test/snmp_manager_user.erl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index 71fdebb67b..af0d7839a8 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -50,7 +50,7 @@ update_agent_info/3, update_agent_info/4, which_all_agents/0, which_own_agents/0, load_mib/1, unload_mib/1, - sync_get/1, sync_get/2, sync_get/3, + sync_get/1, sync_get/2, sync_get/3, sync_get2/3, async_get/1, async_get/2, async_get/3, sync_get_next/1, sync_get_next/2, sync_get_next/3, async_get_next/1, async_get_next/2, async_get_next/3, @@ -171,6 +171,10 @@ sync_get(Addr_or_TargetName, Oids) -> sync_get(Addr, Port, Oids) -> call({sync_get, Addr, Port, Oids}). +sync_get2(TargetName, Oids, SendOpts) -> + call({sync_get2, TargetName, Oids, SendOpts}). + + %% -- async_get(Oids) -> @@ -400,6 +404,16 @@ loop(#state{parent = Parent, id = Id} = S) -> %% -- (sync) get-request -- %% + {{sync_get2, TargetName, Oids, SendOpts}, From, Ref} + when is_list(TargetName) -> + d("loop -> received sync_get2 request with" + "~n TargetName: ~p" + "~n Oids: ~p" + "~n SendOpts: ~p", [TargetName, Oids, SendOpts]), + Res = snmpm:sync_get2(Id, TargetName, Oids, SendOpts), + reply(From, Res, Ref), + loop(S); + %% No agent specified, so send it to all of them {{sync_get, Oids}, From, Ref} -> d("loop -> received sync_get request " -- cgit v1.2.3 From efacc58e49d5b25dc4b1c74e5f8330c9f26a4511 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 14 Apr 2011 15:07:59 +0200 Subject: Async get test case for version 3 request API. --- lib/snmp/test/snmp_manager_user.erl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index af0d7839a8..d4c2574b17 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -51,7 +51,7 @@ which_all_agents/0, which_own_agents/0, load_mib/1, unload_mib/1, sync_get/1, sync_get/2, sync_get/3, sync_get2/3, - async_get/1, async_get/2, async_get/3, + async_get/1, async_get/2, async_get/3, async_get2/3, sync_get_next/1, sync_get_next/2, sync_get_next/3, async_get_next/1, async_get_next/2, async_get_next/3, sync_set/1, sync_set/2, sync_set/3, @@ -186,6 +186,9 @@ async_get(Addr_or_TargetName, Oids) -> async_get(Addr, Port, Oids) -> call({async_get, Addr, Port, Oids}). +async_get2(TargetName, Oids, SendOpts) -> + call({async_get2, TargetName, Oids, SendOpts}). + %% -- sync_get_next(Oids) -> @@ -453,6 +456,16 @@ loop(#state{parent = Parent, id = Id} = S) -> %% -- (async) get-request -- %% + {{async_get2, TargetName, Oids, SendOpts}, From, Ref} + when is_list(TargetName) -> + d("loop -> received async_get request with" + "~n TargetName: ~p" + "~n Oids: ~p" + "~n SendOpts: ~p", [TargetName, Oids, SendOpts]), + Res = snmpm:async_get2(Id, TargetName, Oids, SendOpts), + reply(From, Res, Ref), + loop(S); + %% No agent specified, so send it to all of them {{async_get, Oids}, From, Ref} -> d("loop -> received async_get request"), -- cgit v1.2.3 From be8ad07f8247d3b223846059eca6ab7192f6402b Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 14 Apr 2011 15:47:45 +0200 Subject: Sync get-next test case for version 3 request API. --- lib/snmp/test/snmp_manager_user.erl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index d4c2574b17..21543e4194 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -52,7 +52,7 @@ load_mib/1, unload_mib/1, sync_get/1, sync_get/2, sync_get/3, sync_get2/3, async_get/1, async_get/2, async_get/3, async_get2/3, - sync_get_next/1, sync_get_next/2, sync_get_next/3, + 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, sync_set/1, sync_set/2, sync_set/3, async_set/1, async_set/2, async_set/3, @@ -200,6 +200,9 @@ sync_get_next(Addr_or_TargetName, Oids) -> sync_get_next(Addr, Port, Oids) -> call({sync_get_next, Addr, Port, Oids}). +sync_get_next2(TargetName, Oids, SendOpts) -> + call({sync_get_next2, TargetName, Oids, SendOpts}). + %% -- async_get_next(Oids) -> @@ -499,6 +502,16 @@ loop(#state{parent = Parent, id = Id} = S) -> %% -- (sync) get_next-request -- %% + {{sync_get_next2, TargetName, Oids, SendOpts}, From, Ref} + when is_list(TargetName) -> + d("loop -> received sync_get_next request with" + "~n TargetName: ~p" + "~n Oids: ~p" + "~n SendOpts: ~p", [TargetName, Oids, SendOpts]), + Res = snmpm:sync_get_next2(Id, TargetName, Oids, SendOpts), + reply(From, Res, Ref), + loop(S); + %% No agent specified, so send it to all of them {{sync_get_next, Oids}, From, Ref} -> d("loop -> received sync_get_next request"), -- cgit v1.2.3 From ceb31ba2c09943bf2580f1cc9403905422a7dd44 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 14 Apr 2011 16:35:14 +0200 Subject: Async get-next test cases for version 3 request API. --- lib/snmp/test/snmp_manager_user.erl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index 21543e4194..cb3f57ad1c 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -53,7 +53,7 @@ sync_get/1, sync_get/2, sync_get/3, sync_get2/3, async_get/1, async_get/2, async_get/3, async_get2/3, 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_next/1, async_get_next/2, async_get_next/3, async_get_next2/3, sync_set/1, sync_set/2, sync_set/3, async_set/1, async_set/2, async_set/3, sync_get_bulk/3, sync_get_bulk/4, sync_get_bulk/5, @@ -214,6 +214,9 @@ async_get_next(Addr_or_TargetName, Oids) -> async_get_next(Addr, Port, Oids) -> call({async_get_next, Addr, Port, Oids}). +async_get_next2(TargetName, Oids, SendOpts) -> + call({async_get_next2, TargetName, Oids, SendOpts}). + %% -- sync_set(VAV) -> @@ -545,6 +548,16 @@ loop(#state{parent = Parent, id = Id} = S) -> %% -- (async) get_next-request -- %% + {{async_get_next2, TargetName, Oids, SendOpts}, From, Ref} + when is_list(TargetName) -> + d("loop -> received async_get_next request with" + "~n TargetName: ~p" + "~n Oids: ~p" + "~n SendOpts: ~p", [TargetName, Oids, SendOpts]), + Res = snmpm:async_get_next2(Id, TargetName, Oids, SendOpts), + reply(From, Res, Ref), + loop(S); + %% No agent specified, so send it to all of them {{async_get_next, Oids}, From, Ref} -> d("loop -> received async_get_next request"), -- cgit v1.2.3 From fe2f0b21b8da7e7a83c74d5bb174d52bfcd380bd Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 14 Apr 2011 17:11:03 +0200 Subject: Sync set test case for version 2 request API. --- lib/snmp/test/snmp_manager_user.erl | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index cb3f57ad1c..7c4bdbfb0a 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -54,7 +54,7 @@ async_get/1, async_get/2, async_get/3, async_get2/3, 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_set/1, sync_set/2, sync_set/3, sync_set2/3, async_set/1, async_set/2, async_set/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, @@ -228,6 +228,9 @@ sync_set(Addr_or_TargetName, VAV) -> sync_set(Addr, Port, VAV) -> call({sync_set, Addr, Port, VAV}). +sync_set2(TargetName, VAV, SendOpts) -> + call({sync_set2, TargetName, VAV, SendOpts}). + %% -- async_set(VAV) -> @@ -464,7 +467,7 @@ loop(#state{parent = Parent, id = Id} = S) -> {{async_get2, TargetName, Oids, SendOpts}, From, Ref} when is_list(TargetName) -> - d("loop -> received async_get request with" + d("loop -> received async_get2 request with" "~n TargetName: ~p" "~n Oids: ~p" "~n SendOpts: ~p", [TargetName, Oids, SendOpts]), @@ -507,7 +510,7 @@ loop(#state{parent = Parent, id = Id} = S) -> {{sync_get_next2, TargetName, Oids, SendOpts}, From, Ref} when is_list(TargetName) -> - d("loop -> received sync_get_next request with" + d("loop -> received sync_get_next2 request with" "~n TargetName: ~p" "~n Oids: ~p" "~n SendOpts: ~p", [TargetName, Oids, SendOpts]), @@ -550,7 +553,7 @@ loop(#state{parent = Parent, id = Id} = S) -> {{async_get_next2, TargetName, Oids, SendOpts}, From, Ref} when is_list(TargetName) -> - d("loop -> received async_get_next request with" + d("loop -> received async_get_next2 request with" "~n TargetName: ~p" "~n Oids: ~p" "~n SendOpts: ~p", [TargetName, Oids, SendOpts]), @@ -591,6 +594,16 @@ loop(#state{parent = Parent, id = Id} = S) -> %% -- (sync) set-request -- %% + {{sync_set2, TargetName, VAV, SendOpts}, From, Ref} + when is_list(TargetName) -> + d("loop -> received sync_set2 request with" + "~n TargetName: ~p" + "~n VAV: ~p" + "~n SendOpts: ~p", [TargetName, VAV, SendOpts]), + Res = snmpm:sync_set2(Id, TargetName, VAV, SendOpts), + reply(From, Res, Ref), + loop(S); + {{sync_set, VAV}, From, Ref} -> d("loop -> received sync_set request"), Res = [snmpm:sync_set(Id, TargetName, VAV) || -- cgit v1.2.3 From 625b265bfe3ba77f7554f8e7a7be29abff9eaaba Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 15 Apr 2011 10:37:44 +0200 Subject: Async set test case for version 3 request API. --- lib/snmp/test/snmp_manager_user.erl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') 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) || -- cgit v1.2.3 From 4bdcd8b56cc6446012542db1df5fba893f0f38f0 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 15 Apr 2011 11:06:59 +0200 Subject: Sync get-bulk test case for version 3 of the request API. --- lib/snmp/test/snmp_manager_user.erl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index 34f0779e9c..c2b5886c4a 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -56,7 +56,7 @@ 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_set2/3, - sync_get_bulk/3, sync_get_bulk/4, sync_get_bulk/5, + sync_get_bulk/3, sync_get_bulk/4, sync_get_bulk/5, sync_get_bulk2/5, async_get_bulk/3, async_get_bulk/4, async_get_bulk/5, name_to_oid/1, oid_to_name/1, purify_oid/1 @@ -256,6 +256,9 @@ sync_get_bulk(Addr_or_TargetName, NonRep, MaxRep, Oids) -> sync_get_bulk(Addr, Port, NonRep, MaxRep, Oids) -> call({sync_get_bulk, Addr, Port, NonRep, MaxRep, Oids}). +sync_get_bulk2(TargetName, NonRep, MaxRep, Oids, SendOpts) -> + call({sync_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}). + %% -- async_get_bulk(NonRep, MaxRep, Oids) -> @@ -677,6 +680,20 @@ loop(#state{parent = Parent, id = Id} = S) -> %% -- (sync) get-bulk-request -- %% + {{sync_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}, From, Ref} + when is_list(TargetName) -> + d("loop -> received sync_get_bulk request with" + "~n TargetName: ~p" + "~n NonRep: ~w" + "~n MaxRep: ~w" + "~n Oids: ~p" + "~n SendOpts: ~p", + [TargetName, NonRep, MaxRep, Oids, SendOpts]), + Res = snmpm:sync_get_bulk2(Id, TargetName, + NonRep, MaxRep, Oids, SendOpts), + reply(From, Res, Ref), + loop(S); + %% No agent specified, so send it to all of them {{sync_get_bulk, NonRep, MaxRep, Oids}, From, Ref} -> d("loop -> received sync_get_bulk request with" -- cgit v1.2.3 From f794bf0043b8955f74061b004dcb056ab0952815 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 15 Apr 2011 12:01:11 +0200 Subject: Async get-bulk test case for version 3 request API. --- lib/snmp/test/snmp_manager_user.erl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_manager_user.erl') diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index c2b5886c4a..30b5dd1fc7 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -57,7 +57,7 @@ sync_set/1, sync_set/2, sync_set/3, sync_set2/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, sync_get_bulk2/5, - async_get_bulk/3, async_get_bulk/4, async_get_bulk/5, + async_get_bulk/3, async_get_bulk/4, async_get_bulk/5, async_get_bulk2/5, name_to_oid/1, oid_to_name/1, purify_oid/1 ]). @@ -270,6 +270,9 @@ async_get_bulk(Addr_or_TargetName, NonRep, MaxRep, Oids) -> async_get_bulk(Addr, Port, NonRep, MaxRep, Oids) -> call({async_get_bulk, Addr, Port, NonRep, MaxRep, Oids}). +async_get_bulk2(TargetName, NonRep, MaxRep, Oids, SendOpts) -> + call({async_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}). + %% -- name_to_oid(Name) -> @@ -741,6 +744,20 @@ loop(#state{parent = Parent, id = Id} = S) -> %% -- (async) get-bulk-request -- %% + {{async_get_bulk2, TargetName, NonRep, MaxRep, Oids, SendOpts}, + From, Ref} when is_list(TargetName) -> + d("loop -> received async_get_bulk2 request with" + "~n TargetName: ~p" + "~n NonRep: ~w" + "~n MaxRep: ~w" + "~n Oids: ~p" + "~n SendOpts: ~p", + [TargetName, NonRep, MaxRep, Oids, SendOpts]), + Res = snmpm:async_get_bulk2(Id, TargetName, + NonRep, MaxRep, Oids, SendOpts), + reply(From, Res, Ref), + loop(S); + %% No agent specified, so send it to all of them {{async_get_bulk, NonRep, MaxRep, Oids}, From, Ref} -> d("loop -> received async_get_bulk request with" -- cgit v1.2.3