From 3e8aa3462a151d6b528bab917bfa7b4aab021ba5 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 14 Mar 2014 18:41:23 +0100 Subject: [snmp/agent] Fixed request id generation When testing the agent, it is started and then used for a series (v1, v2, v3, ...) of tests. But the individual test cases are use one instance of the test manager. Because of this, the requerst id cannot be a counter starting from 1 or any counter for that matter. Instead every request id was generated using random. But this is obiously not a guarantee fo uniqueness, it merely makes it unlikely that the request ids will be reused. To get around this problem (without having to rewrite the entire agent test suite) a simple (global) counter server is introduced. It is started at the start of the agent test suite (init_per_suite) and stopped at the end (end_per_suite). --- lib/snmp/test/snmp_test_mgr.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/snmp/test/snmp_test_mgr.erl') diff --git a/lib/snmp/test/snmp_test_mgr.erl b/lib/snmp/test/snmp_test_mgr.erl index 40fcbce8f1..d4eb00ff91 100644 --- a/lib/snmp/test/snmp_test_mgr.erl +++ b/lib/snmp/test/snmp_test_mgr.erl @@ -657,7 +657,8 @@ make_vb(Oid) -> #varbind{oid = Oid, variabletype = 'NULL', value = 'NULL'}. make_request_id() -> - random:uniform(16#FFFFFFF-1). + %% random:uniform(16#FFFFFFF-1). + snmp_test_mgr_counter_server:increment(mgr_request_id, 1, 1, 2147483647). echo_pdu(PDU, MiniMIB) -> io:format("~s", [snmp_misc:format_pdu(PDU, MiniMIB)]). -- cgit v1.2.3