diff options
author | Micael Karlberg <[email protected]> | 2011-05-16 10:09:25 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-05-16 10:09:25 +0200 |
commit | 3e907e4468651206b8c6c97290e37a5a82102e2f (patch) | |
tree | b9a39fe5fc37c32313f7ae89f2f98a4a68ccfd40 /lib/snmp/test/snmp_pdus_test.erl | |
parent | b19a2c6648e65b5ad1b8a0351928856fad941f99 (diff) | |
parent | c2a1108ff4cfdb2a5763349e4f505bed49871cc8 (diff) | |
download | otp-3e907e4468651206b8c6c97290e37a5a82102e2f.tar.gz otp-3e907e4468651206b8c6c97290e37a5a82102e2f.tar.bz2 otp-3e907e4468651206b8c6c97290e37a5a82102e2f.zip |
OTP-9022: Fixed endode/decode of values of type Counter32.
OTP-9088: [agent] Added support for sending traps to IPv6 targets.
OTP-9119: [agent] To be able to handle multiple engine-id(s) when
sending trap(s), the function
snmp_community_mib:add_community/6 has been added.
OTP-9162: [manager] The API for snmp requests has been augmented to
allow the caller to override some configuration.
OTP-9174: [manager] The old API functions (for get and set
requests) are now officially deprecated.
OTP-9183: [agent] Pass extra info through the agent to the net-if
process when sending notifications.
OTP-9208: Added type specs for functions that do not return.
Kostis Sagonas
Merge branch 'bmk/snmp/snmp420_integration' into dev
Diffstat (limited to 'lib/snmp/test/snmp_pdus_test.erl')
-rw-r--r-- | lib/snmp/test/snmp_pdus_test.erl | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/lib/snmp/test/snmp_pdus_test.erl b/lib/snmp/test/snmp_pdus_test.erl index ef510ad62e..197797c816 100644 --- a/lib/snmp/test/snmp_pdus_test.erl +++ b/lib/snmp/test/snmp_pdus_test.erl @@ -38,6 +38,8 @@ otp7575/1, otp8563/1, + otp9022/1, + init_per_testcase/2, end_per_testcase/2 ]). @@ -75,7 +77,7 @@ all() -> [{group, tickets}]. groups() -> - [{tickets, [], [otp7575, otp8563]}]. + [{tickets, [], [otp7575, otp8563, otp9022]}]. init_per_group(_GroupName, Config) -> Config. @@ -169,7 +171,56 @@ otp8563(Config) when is_list(Config) -> Unexpected7 -> exit({unexpected_encode_result, Unexpected7, Val7}) end, - + + ok. + + +otp9022(suite) -> []; +otp9022(doc) -> ["OTP-9022"]; +otp9022(Config) when is_list(Config) -> + Val1 = 16#7fffffff, + io:format("try encode and decode ~w~n", [Val1]), + Enc1 = snmp_pdus:enc_value('Counter32', Val1), + {{'Counter32', Val1}, []} = snmp_pdus:dec_value(Enc1), + + Val2 = Val1 + 1, + io:format("try encode and decode ~w~n", [Val2]), + Enc2 = snmp_pdus:enc_value('Counter32', Val2), + {{'Counter32', Val2}, []} = snmp_pdus:dec_value(Enc2), + + Val3 = Val2 + 1, + io:format("try encode and decode ~w~n", [Val3]), + Enc3 = snmp_pdus:enc_value('Counter32', Val3), + {{'Counter32', Val3}, []} = snmp_pdus:dec_value(Enc3), + + Val4 = 16#fffffffe, + io:format("try encode and decode ~w~n", [Val4]), + Enc4 = snmp_pdus:enc_value('Counter32', Val4), + {{'Counter32', Val4}, []} = snmp_pdus:dec_value(Enc4), + + Val5 = Val4 + 1, + io:format("try encode and decode ~w~n", [Val5]), + Enc5 = snmp_pdus:enc_value('Counter32', Val5), + {{'Counter32', Val5}, []} = snmp_pdus:dec_value(Enc5), + + Val6 = 16#ffffffff + 1, + io:format("try and fail to encode ~w~n", [Val6]), + case (catch snmp_pdus:enc_value('Counter32', Val6)) of + {'EXIT', {error, {bad_counter32, Val6}}} -> + ok; + Unexpected6 -> + exit({unexpected_encode_result, Unexpected6, Val6}) + end, + + Val7 = -1, + io:format("try and fail to encode ~w~n", [Val7]), + case (catch snmp_pdus:enc_value('Counter32', Val7)) of + {'EXIT', {error, {bad_counter32, Val7}}} -> + ok; + Unexpected7 -> + exit({unexpected_encode_result, Unexpected7, Val7}) + end, + ok. |