diff options
author | Raimo Niskanen <[email protected]> | 2014-05-21 15:09:05 +0200 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2014-07-25 12:15:16 +0200 |
commit | 5b99573e288d3798414958975db41daf5509c0fb (patch) | |
tree | 73807557d07309ff8c8ad679866c36b75c746939 /lib/snmp | |
parent | aa8f929cb3810b2c5ed67b44392d26131857f8e6 (diff) | |
download | otp-5b99573e288d3798414958975db41daf5509c0fb.tar.gz otp-5b99573e288d3798414958975db41daf5509c0fb.tar.bz2 otp-5b99573e288d3798414958975db41daf5509c0fb.zip |
Fix log validation and fix some testcases
Diffstat (limited to 'lib/snmp')
-rw-r--r-- | lib/snmp/src/misc/snmp_log.erl | 19 | ||||
-rw-r--r-- | lib/snmp/test/snmp_agent_test.erl | 48 |
2 files changed, 19 insertions, 48 deletions
diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl index a1fd392676..4b22281b89 100644 --- a/lib/snmp/src/misc/snmp_log.erl +++ b/lib/snmp/src/misc/snmp_log.erl @@ -231,7 +231,20 @@ validate(Log, SeqNoReq) validate_seqno(PrevSN, SeqNo), {Timestamp, SeqNo}; - ({Timestamp, _Packet, _Addr, _Port}, {PrevTS, _PrevSN}) when SeqNoReq =:= true -> + ({Timestamp, SeqNo, _Packet, _AddrStr}, {PrevTS, PrevSN}) + when is_integer(SeqNo) -> + ?vtrace("validating log entry when" + "~n Timestamp: ~p" + "~n SeqNo: ~p" + "~n PrevTS: ~p" + "~n PrevSN: ~p", + [Timestamp, SeqNo, PrevTS, PrevSN]), + validate_timestamp(PrevTS, Timestamp), + validate_seqno(PrevSN, SeqNo), + {Timestamp, SeqNo}; + + ({Timestamp, _Packet, _Addr, _Port}, {PrevTS, _PrevSN}) + when SeqNoReq =:= true -> ?vtrace("validating log entry when" "~n Timestamp: ~p" "~n PrevTS: ~p", @@ -969,8 +982,8 @@ get_type(#pdu{type = Type}) -> Type. -ip(Domain, Addr) -> - snmp_conf:mk_addr_string(Domain, Addr). +%% ip(Domain, Addr) -> +%% snmp_conf:mk_addr_string(Domain, Addr). %% ip({A,B,C,D}) -> %% io_lib:format("~w.~w.~w.~w", [A,B,C,D]). diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl index 6b8d0802d0..9db2e67edd 100644 --- a/lib/snmp/test/snmp_agent_test.erl +++ b/lib/snmp/test/snmp_agent_test.erl @@ -297,12 +297,7 @@ %% tickets2 otp8395/1, - otp9884/1, - - %% IPV6 - ipv6_processing/1, - ipv6_trap/1 - + otp9884/1 ]). %% Internal exports @@ -545,8 +540,7 @@ groups() -> {tickets1, [], tickets1_cases()}, {tickets2, [], tickets2_cases()}, {otp4394, [], [otp_4394]}, - {otp7157, [], [otp_7157]}, - {ipv6, [], [ipv6_processing, ipv6_trap]} + {otp7157, [], [otp_7157]} ]. @@ -651,13 +645,6 @@ init_per_group(mib_storage_dets = GroupName, Config) -> init_mib_storage_dets(snmp_test_lib:init_group_top_dir(GroupName, Config)); init_per_group(mib_storage_ets = GroupName, Config) -> init_mib_storage_ets(snmp_test_lib:init_group_top_dir(GroupName, Config)); -init_per_group(ipv6 = GroupName, Config) -> - case ct:require(ipv6_hosts) of - ok -> - ipv6_init(snmp_test_lib:init_group_top_dir(GroupName, Config)); - _ -> - {skip, "Host does not support IPV6"} - end; init_per_group(GroupName, Config) -> snmp_test_lib:init_group_top_dir(GroupName, Config). @@ -770,16 +757,6 @@ init_per_testcase1(v3_inform_i = _Case, Config) when is_list(Config) -> "~n Config: ~p", [_Case, Config]), Dog = ?WD_START(?MINS(10)), [{watchdog, Dog} | Config ]; -init_per_testcase1(ipv6_processing = Case, Config) when is_list(Config) -> - ?DBG("init_per_testcase1 -> entry with" - "~n Case: ~p" - "~n Config: ~p", [Case, Config]), - ipv6_processing({init, init_per_testcase2(Case, Config)}); -init_per_testcase1(ipv6_trap = Case, Config) when is_list(Config) -> - ?DBG("init_per_testcase1 -> entry with" - "~n Case: ~p" - "~n Config: ~p", [Case, Config]), - ipv6_trap({init, init_per_testcase2(Case, Config)}); init_per_testcase1(_Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" @@ -868,8 +845,7 @@ cases() -> {group, test_v3_ipv6}, {group, test_multi_threaded}, {group, mib_storage}, - {group, tickets1}, - {group, ipv6} + {group, tickets1} ]. @@ -6881,24 +6857,6 @@ otp9884_await_backup_completion(First, Second) -> throw({error, {bad_completion, First, Second}}). %%----------------------------------------------------------------- -ipv6_processing({init, Config}) when is_list(Config)-> - init_v1_agent([{ipfamily, inet6} | Config]); -ipv6_processing({fin, Config}) when is_list(Config) -> - fin_v1_agent(Config); -ipv6_processing(Config) when is_list(Config) -> - v1_processing(Config). - -%%----------------------------------------------------------------- - -ipv6_trap({init, Config}) when is_list(Config)-> - init_v1_agent([{ipfamily, inet6} | Config]); -ipv6_trap({fin, Config}) when is_list(Config) -> - fin_v1_agent(Config); -ipv6_trap(Config) when is_list(Config) -> - v1_trap(Config). - -%%----------------------------------------------------------------- - agent_log_validation(Node) -> rpc:call(Node, ?MODULE, agent_log_validation, []). |