diff options
author | Micael Karlberg <[email protected]> | 2019-07-01 18:02:51 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-07-01 18:02:51 +0200 |
commit | 8781ca54cfb98d57c6d539bfc7b2004b233943cd (patch) | |
tree | 9b07e1352bc6aa0d13fc7be89eaa40c0d48bbcb3 | |
parent | 4381bf5c3e921152d6e8c9d75a9b27013d51da7b (diff) | |
parent | 7d9c066dcac3d2be64a8723bd5fa5580df6ed6a9 (diff) | |
download | otp-8781ca54cfb98d57c6d539bfc7b2004b233943cd.tar.gz otp-8781ca54cfb98d57c6d539bfc7b2004b233943cd.tar.bz2 otp-8781ca54cfb98d57c6d539bfc7b2004b233943cd.zip |
Merge branch 'bmk/megaco/20190701/test_case_improvements' into maint
-rw-r--r-- | lib/megaco/examples/simple/megaco_simple_mgc.erl | 19 | ||||
-rw-r--r-- | lib/megaco/test/megaco_examples_test.erl | 326 | ||||
-rw-r--r-- | lib/megaco/test/megaco_mib_test.erl | 186 | ||||
-rw-r--r-- | lib/megaco/test/megaco_test_lib.erl | 104 | ||||
-rw-r--r-- | lib/megaco/test/megaco_test_lib.hrl | 8 | ||||
-rw-r--r-- | lib/megaco/test/megaco_timer_test.erl | 19 | ||||
-rw-r--r-- | lib/megaco/test/megaco_trans_test.erl | 1847 |
7 files changed, 1461 insertions, 1048 deletions
diff --git a/lib/megaco/examples/simple/megaco_simple_mgc.erl b/lib/megaco/examples/simple/megaco_simple_mgc.erl index f324e17a3a..8a78262b86 100644 --- a/lib/megaco/examples/simple/megaco_simple_mgc.erl +++ b/lib/megaco/examples/simple/megaco_simple_mgc.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -193,15 +193,17 @@ stop(Mid) -> d("stop -> entry with~n Mid: ~p", [Mid]), Disco = fun(CH) -> d("stop -> CH: ~p", [CH]), - Reason = stopped_by_user, - Pid = megaco:conn_info(CH, control_pid), - SendMod = megaco:conn_info(CH, send_mod), + Reason = stopped_by_user, + Pid = megaco:conn_info(CH, control_pid), + SendMod = megaco:conn_info(CH, send_mod), SendHandle = megaco:conn_info(CH, send_handle), d("stop -> disconnect", []), megaco:disconnect(CH, Reason), + d("stop -> cancel", []), - megaco:cancel(CH, Reason), + megaco:cancel(CH, Reason), % see handle_disconnect + d("stop -> close transport" "~n SendMod: ~p" "~n SendHandle: ~p", [SendMod, SendHandle]), @@ -247,6 +249,7 @@ handle_disconnect(ConnHandle, ProtocolVersion, Reason) -> "~n ProtocolVersion: ~p" "~n Reason: ~p" "", [ConnHandle, ProtocolVersion, Reason]), + info_msg("handle_disconnect - cancel outstanding messages~n"), megaco:cancel(ConnHandle, Reason), % Cancel the outstanding messages ok. @@ -443,6 +446,12 @@ get_arg(Key, Args) -> %% DEBUGGING %%---------------------------------------------------------------------- +info_msg(F) -> + info_msg(F, []). +info_msg(F, A) -> + io:format("~p MGC: " ++ F ++ "~n", [self()|A]). + + d(F) -> d(F, []). diff --git a/lib/megaco/test/megaco_examples_test.erl b/lib/megaco/test/megaco_examples_test.erl index 45a6c5011a..815e315c27 100644 --- a/lib/megaco/test/megaco_examples_test.erl +++ b/lib/megaco/test/megaco_examples_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. +%% Copyright Ericsson AB 2001-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -31,6 +31,8 @@ -include_lib("megaco/include/megaco.hrl"). -include_lib("megaco/include/megaco_message_v1.hrl"). +-define(LIB, megaco_test_lib). + t() -> megaco_test_lib:t(?MODULE). t(Case) -> megaco_test_lib:t({?MODULE, Case}). @@ -56,9 +58,19 @@ load_examples() -> {error, Reason} -> {error, Reason}; Dir -> - [code:load_abs(filename:join([Dir, examples, simple, M])) || M <- example_modules()] + SimpleDir = filename:join([Dir, examples, simple]), + case code:add_path(SimpleDir) of + true -> + ok; + {error, What} -> + error_logger:error_msg("failed adding examples path: " + "~n ~p" + "~n", [What]), + {error, {failed_add_path, What}} + end end. + purge_examples() -> case code:lib_dir(megaco) of {error, Reason} -> @@ -67,6 +79,7 @@ purge_examples() -> [code:purge(M) || M <- example_modules()] end. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case @@ -87,94 +100,263 @@ end_per_group(_GroupName, Config) -> simple(suite) -> []; simple(Config) when is_list(Config) -> - ?ACQUIRE_NODES(1, Config), - d("simple -> proxy start",[]), - ProxyPid = megaco_test_lib:proxy_start({?MODULE, ?LINE}), + process_flag(trap_exit, true), + d("simple -> create node name(s)"), + [_Local, MGC, MG] = ?LIB:mk_nodes(3), %% Grrr + Nodes = [MGC, MG], + + d("simple -> start nodes"), + ok = ?LIB:start_nodes(Nodes, ?MODULE, ?LINE), + + MGCId = "MGC", + MGId = "MG", + + d("simple -> MGC proxy start (on ~p)", [MGC]), + MGCProxy = megaco_test_lib:proxy_start(MGC, "MGC"), + ?SLEEP(1000), + + d("simple -> MG proxy start (on ~p)", [MG]), + MGProxy = megaco_test_lib:proxy_start(MG, "MG"), + ?SLEEP(1000), + + MegacoStart = fun() -> megaco:start() end, + MegacoStartVerify = + fun(_, ok) -> ok; + (Id, Else) -> ?ERROR({failed_starting_megaco, Id, Else}) + end, - d("simple -> start megaco",[]), - ?VERIFY(ok, megaco:start()), + d("simple -> start MGC megaco"), + exec(MGCProxy, MGCId, MegacoStart, + fun(Res) -> MegacoStartVerify(MGCId, Res) end), + %% ?APPLY(MGCProxy, fun() -> ok = megaco:start() end), + ?SLEEP(1000), - d("simple -> start mgc",[]), - ?APPLY(ProxyPid, fun() -> megaco_simple_mgc:start() end), + d("simple -> start MG megaco"), + exec(MGProxy, MGId, MegacoStart, + fun(Res) -> MegacoStartVerify(MGId, Res) end), + %% ?APPLY(MGProxy, fun() -> ok = megaco:start() end), + ?SLEEP(1000), + + d("simple -> start mgc"), + start_mgc(MGCProxy), + ?SLEEP(1000), + + d("simple -> verify MGC info (no mg)"), + info(MGCProxy), + ?SLEEP(1000), + + d("simple -> verify MGC system_info(users) (no mg)"), + users(MGCProxy), + ?SLEEP(1000), + + d("simple -> start mg"), + start_mg(MGProxy), + ?SLEEP(1000), + + d("simple -> verify MGC info (mg)"), + info(MGCProxy), + ?SLEEP(1000), + + d("simple -> verify MGC system_info(users) (mg)"), + users(MGCProxy), + ?SLEEP(1000), + + d("simple -> verify MG info"), + info(MGProxy), + ?SLEEP(1000), + + d("simple -> verify MG system_info(users)"), + users(MGProxy), + ?SLEEP(1000), + + d("simple -> stop mgc"), + exec(MGCProxy, MGCId, + fun() -> megaco_simple_mgc:stop() end, + fun([_]) -> ok; + (L) when is_list(L) -> + ?ERROR({invalid_users, L}); + (X) -> + ?ERROR({invalid_result, X}) + end), + %% ?VERIFY(5, length()), + ?SLEEP(1000), + + d("simple -> verify MGC info (no mgc)"), + info(MGCProxy), + ?SLEEP(1000), + + d("simple -> verify MG info (no mgc)"), + info(MGProxy), + ?SLEEP(1000), + + d("simple -> verify MGC system_info(users) (no mgc)",[]), + users(MGCProxy), + ?SLEEP(1000), + + d("simple -> verify MG system_info(users) (no mgc)",[]), + users(MGProxy), + ?SLEEP(1000), + + MegacoStop = fun() -> megaco:stop() end, + MegacoStopVerify = + fun(_, ok) -> ok; + (Id, Else) -> ?ERROR({failed_stop_megaco, Id, Else}) + end, + + d("simple -> stop MG megaco",[]), + exec(MGProxy, MGId, MegacoStop, + fun(Res) -> MegacoStopVerify(MGId, Res) end), + %% ?VERIFY(ok, megaco:stop()), + ?SLEEP(1000), + + d("simple -> stop MGC megaco",[]), + exec(MGCProxy, MGCId, MegacoStop, + fun(Res) -> MegacoStopVerify(MGCId, Res) end), + %% ?VERIFY(ok, megaco:stop()), + ?SLEEP(1000), + + d("simple -> kill (exit) MG Proxy: ~p", [MGProxy]), + MGProxy ! {stop, self(), normal}, + receive + {'EXIT', MGProxy, _} -> + d("simple -> MG Proxy terminated"), + ok + end, + + d("simple -> kill (exit) MGC Proxy: ~p", [MGCProxy]), + MGCProxy ! {stop, self(), normal}, + receive + {'EXIT', MGCProxy, _} -> + d("simple -> MGC Proxy terminated"), + ok + end, + + d("simple -> stop ~p", [MGC]), + slave:stop(MGC), + + d("simple -> stop ~p", [MG]), + slave:stop(MG), + + d("simple -> done", []), + ok. + + +exec(Proxy, Id, Cmd, Verify) -> + ?APPLY(Proxy, Cmd), + receive + {res, Id, Res} -> + Verify(Res) + end. + + +start_mgc(Proxy) -> + ?APPLY(Proxy, + fun() -> + try megaco_simple_mgc:start() of + Res -> + Res + catch + C:E:S -> + {error, {{catched, C, E, S}}, code:get_path()} + end + end), receive {res, _, {ok, MgcAll}} when is_list(MgcAll) -> MgcBad = [MgcRes || MgcRes <- MgcAll, element(1, MgcRes) /= ok], ?VERIFY([], MgcBad), - %% MgcGood = MgcAll -- MgcBad, - %% MgcRecHandles = [MgcRH || {ok, _MgcPort, MgcRH} <- MgcGood], - - d("simple -> start mg",[]), - ?APPLY(ProxyPid, fun() -> megaco_simple_mg:start() end), - receive - {res, _, MgList} when is_list(MgList) andalso (length(MgList) =:= 4) -> - d("simple -> received res: ~p",[MgList]), - Verify = - fun({_MgMid, {TransId, Res}}) when TransId =:= 1 -> - case Res of - {ok, [AR]} when is_record(AR, 'ActionReply') -> - case AR#'ActionReply'.commandReply of - [{serviceChangeReply, SCR}] -> - case SCR#'ServiceChangeReply'.serviceChangeResult of - {serviceChangeResParms, MgcMid} when MgcMid /= asn1_NOVALUE -> - ok; - Error -> - ?ERROR(Error) - end; - Error -> - ?ERROR(Error) - end; - Error -> - ?ERROR(Error) - end; - (Error) -> - ?ERROR(Error) - end, - lists:map(Verify, MgList); - Error -> - ?ERROR(Error) - end; + ok; Error -> ?ERROR(Error) - end, - d("simple -> verify info()",[]), - info(), - d("simple -> verify system_info(users)",[]), - users(), - d("simple -> stop mgc",[]), - ?VERIFY(5, length(megaco_simple_mgc:stop())), - d("simple -> verify system_info(users)",[]), - users(), - d("simple -> stop megaco",[]), - ?VERIFY(ok, megaco:stop()), - d("simple -> kill (exit) ProxyPid: ~p",[ProxyPid]), - exit(ProxyPid, shutdown), % Controlled kill of transport supervisors + end. - ok. +start_mg(Proxy) -> + ?APPLY(Proxy, fun() -> + try megaco_simple_mg:start() of + Res -> + Res + catch + C:E:S -> + {error, {{catched, C, E, S}}, code:get_path()} + end + end), + receive + {res, _, MGs} when is_list(MGs) andalso (length(MGs) =:= 4) -> + verify_mgs(MGs); + Error -> + ?ERROR(Error) + end. -info() -> - case (catch megaco:info()) of - {'EXIT', _} = Error -> - ?ERROR(Error); - Info -> - ?LOG("Ok, ~p~n", [Info]) +verify_mgs(MGs) -> + Verify = + fun({_MgMid, {TransId, Res}}) when (TransId =:= 1) -> + case Res of + {ok, [AR]} when is_record(AR, 'ActionReply') -> + case AR#'ActionReply'.commandReply of + [{serviceChangeReply, SCR}] -> + case SCR#'ServiceChangeReply'.serviceChangeResult of + {serviceChangeResParms, MgcMid} + when (MgcMid =/= asn1_NOVALUE) -> + ok; + Error -> + ?ERROR(Error) + end; + Error -> + ?ERROR(Error) + end; + Error -> + ?ERROR(Error) + end; + (Error) -> + ?ERROR(Error) + end, + lists:map(Verify, MGs). + + +info(Proxy) -> + ?APPLY(Proxy, + fun() -> + try megaco:info() of + I -> I + catch + C:E:S -> + {error, {C, E, S}} + end + end), + receive + {res, _, Info} when is_list(Info) -> + ?LOG("Ok, ~p~n", [Info]); + {res, _, Error} -> + ?ERROR(Error) end. -users() -> - case (catch megaco:system_info(users)) of - {'EXIT', _} = Error -> - ?ERROR(Error); - Users -> - ?LOG("Ok, ~p~n", [Users]) + +users(Proxy) -> + ?APPLY(Proxy, + fun() -> + try megaco:system_info(users) of + I -> I + catch + C:E:S -> + {error, {C, E, S}} + end + end), + receive + {res, _, Info} when is_list(Info) -> + ?LOG("Ok, ~p~n", [Info]); + {res, _, Error} -> + ?ERROR(Error) end. -d(F,A) -> - d(get(dbg),F,A). +d(F) -> + d(F, []). +d(F, A) -> + d(get(dbg), F, A). -d(true,F,A) -> - io:format("DBG: " ++ F ++ "~n",A); +d(true, F, A) -> + io:format("DBG: ~s " ++ F ++ "~n", [?FT() | A]); d(_, _F, _A) -> ok. diff --git a/lib/megaco/test/megaco_mib_test.erl b/lib/megaco/test/megaco_mib_test.erl index d644d6bc09..a19e2acbd1 100644 --- a/lib/megaco/test/megaco_mib_test.erl +++ b/lib/megaco/test/megaco_mib_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2016. All Rights Reserved. +%% Copyright Ericsson AB 2002-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -24,7 +24,32 @@ %%---------------------------------------------------------------------- -module(megaco_mib_test). --compile(export_all). +-export([ + t/0, t/1, + + all/0, + groups/0, + init_per_testcase/2, + end_per_testcase/2, + init_per_group/2, + end_per_group/2, + + plain/1, + connect/1, + traffic/1, + + mg/3, + mgc/3, + + handle_connect/3, + handle_disconnect/4, + handle_syntax_error/4, + handle_message_error/4, + handle_trans_request/4, + handle_trans_long_request/4, + handle_trans_reply/5, + handle_trans_ack/5 + ]). -include("megaco_test_lib.hrl"). -include_lib("megaco/include/megaco.hrl"). @@ -54,6 +79,7 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). %% Test server callbacks init_per_testcase(Case, Config) -> + progress("init_per_testcase -> ~w", [Case]), process_flag(trap_exit, true), case Case of traffic -> @@ -65,6 +91,7 @@ init_per_testcase(Case, Config) -> end. end_per_testcase(Case, Config) -> + progress("end_per_testcase -> ~w", [Case]), process_flag(trap_exit, false), megaco_test_lib:end_per_testcase(Case, Config). @@ -197,6 +224,7 @@ connect(Config) when is_list(Config) -> put(verbosity, ?TEST_VERBOSITY), put(sname, "TEST"), i("connect -> starting"), + progress("start nodes"), MgcNode = make_node_name(mgc), Mg1Node = make_node_name(mg1), Mg2Node = make_node_name(mg2), @@ -209,67 +237,85 @@ connect(Config) when is_list(Config) -> %% Start the MGC and MGs ET = [{text,tcp}, {text,udp}, {binary,tcp}, {binary,udp}], + progress("start MGC"), {ok, Mgc} = start_mgc(MgcNode, {deviceName, "ctrl"}, ET, ?MGC_VERBOSITY), + progress("start MG1"), {ok, Mg1} = start_mg(Mg1Node, {deviceName, "mg1"}, text, tcp, ?MG_VERBOSITY), + progress("start MG2"), {ok, Mg2} = start_mg(Mg2Node, {deviceName, "mg2"}, binary, udp, ?MG_VERBOSITY), %% Collect the initial statistics (should be zero if anything) + progress("collect initial MG1 stats"), {ok, Mg1Stats0} = get_stats(Mg1, 1), d("connect -> stats for Mg1: ~n~p", [Mg1Stats0]), + progress("collect initial MG2 stats"), {ok, Mg2Stats0} = get_stats(Mg2, 1), d("connect -> stats for Mg2: ~n~p", [Mg2Stats0]), + progress("collect initial MGC stats"), {ok, MgcStats0} = get_stats(Mgc, 1), d("connect -> stats for Mgc: ~n~p", [MgcStats0]), %% Ask Mg1 to do a service change + progress("perform MG1 service change"), {ok, Res1} = service_change(Mg1), d("connect -> (Mg1) service change result: ~p", [Res1]), %% Collect the statistics + progress("collect MG1 statustics (after service change)"), {ok, Mg1Stats1} = get_stats(Mg1, 1), d("connect -> stats for Mg1: ~n~p", [Mg1Stats1]), + progress("collect MGC statistics (after MG1 service change)"), {ok, MgcStats1} = get_stats(Mgc, 1), d("connect -> stats (1) for Mgc: ~n~p", [MgcStats1]), {ok, MgcStats2} = get_stats(Mgc, 2), d("connect -> stats (2) for Mgc: ~n~p", [MgcStats2]), %% Ask Mg2 to do a service change + progress("perform MG2 service change"), {ok, Res2} = service_change(Mg2), d("connect -> (Mg2) service change result: ~p", [Res2]), %% Collect the statistics + progress("collect MG2 statustics (after service change)"), {ok, Mg2Stats1} = get_stats(Mg2, 1), d("connect -> stats for Mg1: ~n~p", [Mg2Stats1]), + progress("collect MGC statistics (after MG2 service change)"), {ok, MgcStats3} = get_stats(Mgc, 1), d("connect -> stats (1) for Mgc: ~n~p", [MgcStats3]), {ok, MgcStats4} = get_stats(Mgc, 2), d("connect -> stats (2) for Mgc: ~n~p", [MgcStats4]), %% Tell Mg1 to stop + progress("stop MG1"), stop(Mg1), %% Collect the statistics + progress("collect MGC statistics (after MG1 stop)"), {ok, MgcStats5} = get_stats(Mgc, 1), d("connect -> stats (1) for Mgc: ~n~p", [MgcStats5]), {ok, MgcStats6} = get_stats(Mgc, 2), d("connect -> stats (2) for Mgc: ~n~p", [MgcStats6]), %% Tell Mg2 to stop + progress("stop MG2"), stop(Mg2), %% Collect the statistics + progress("collect MGC statistics (after MG2 stop)"), {ok, MgcStats7} = get_stats(Mgc, 1), d("connect -> stats (1) for Mgc: ~n~p", [MgcStats7]), {ok, MgcStats8} = get_stats(Mgc, 2), d("connect -> stats (2) for Mgc: ~n~p", [MgcStats8]), %% Tell Mgc to stop + progress("stop MGC"), stop(Mgc), i("connect -> done", []), + progress("done"), ok. @@ -284,6 +330,7 @@ traffic(Config) when is_list(Config) -> put(verbosity, ?TEST_VERBOSITY), put(sname, "TEST"), i("traffic -> starting"), + progress("start nodes"), MgcNode = make_node_name(mgc), Mg1Node = make_node_name(mg1), Mg2Node = make_node_name(mg2), @@ -302,11 +349,13 @@ traffic(Config) when is_list(Config) -> %% Start the MGC and MGs i("traffic -> start the MGC"), + progress("start MGC"), ET = [{text,tcp}, {text,udp}, {binary,tcp}, {binary,udp}], {ok, Mgc} = start_mgc(MgcNode, {deviceName, "ctrl"}, ET, ?MGC_VERBOSITY), i("traffic -> start and connect the MGs"), + progress("start and connect MGs"), MgConf0 = [{Mg1Node, "mg1", text, tcp}, {Mg2Node, "mg2", text, udp}, {Mg3Node, "mg3", binary, tcp}, @@ -315,36 +364,42 @@ traffic(Config) when is_list(Config) -> %% Collect and check the MGs statistics i("traffic -> collect and check the MGs stats"), + progress("collect and verify MGs (initial) stats"), traffic_verify_mg_stats(MgConf, 1, 1), %% Collect and check the MGC statistics - i("traffic -> collect and check the MGC stats"), + i("traffic -> collect and check the MGC (initial) stats"), + progress("collect and verify MGC stats"), {ok, MgcStats1} = get_stats(Mgc, 1), d("traffic -> stats (1) for Mgc: ~n~p~n", [MgcStats1]), traffic_verify_mgc_stats(Mgc, 1, 1), - sleep(1000), + ?SLEEP(1000), %% And apply some load - i("traffic -> apply traffic load"), + i("traffic -> apply traffic load (1)"), + progress("apply some load (1)"), ok = traffic_apply_load(MgConf), %% Await completion of load part and the collect traffic - i("traffic -> await load competion"), + i("traffic -> await load (1) competion"), + progress("await load (1) completion"), ok = traffic_await_load_complete(MgConf), - sleep(1000), + ?SLEEP(1000), i("traffic -> collect and check the MGs statistics"), + progress("collect and verify MGs (after load 1) stats"), traffic_verify_mg_stats(MgConf, 1 + ?LOAD_COUNTER_START, 1 + ?LOAD_COUNTER_START), i("traffic -> collect and check the MGC statistics"), + progress("collect and verify MGC (after load 1) stats"), {ok, MgcStats3} = get_stats(Mgc, 1), d("traffic -> stats (1) for Mgc: ~n~p~n", [MgcStats3]), traffic_verify_mgc_stats(Mgc, @@ -352,60 +407,70 @@ traffic(Config) when is_list(Config) -> 1 + ?LOAD_COUNTER_START), - sleep(1000), + ?SLEEP(1000), %% Reset counters i("traffic -> reset the MGs statistics"), + progress("reset MGs stats"), traffic_reset_mg_stats(MgConf), i("traffic -> collect and check the MGs statistics"), + progress("collect and verify MGs (after reset) stats"), traffic_verify_mg_stats(MgConf, 0, 0), i("traffic -> reset the MGC statistics"), + progress("reset MGC stats"), traffic_reset_mgc_stats(Mgc), i("traffic -> collect and check the MGC statistics"), + progress("collect and verify MGC (after reset) stats"), traffic_verify_mgc_stats(Mgc, 0, 0), - sleep(1000), + ?SLEEP(1000), %% And apply some load - i("traffic -> apply traffic load"), + i("traffic -> apply traffic load (2)"), + progress("apply some load (2)"), ok = traffic_apply_load(MgConf), %% Await completion of load part and the collect traffic - i("traffic -> await load competion"), + i("traffic -> await load (2) competion"), + progress("await load (2) completion"), ok = traffic_await_load_complete(MgConf), - sleep(1000), + ?SLEEP(1000), i("traffic -> collect and check the MGs statistics"), + progress("collect and verify MGs (after load 2) stats"), traffic_verify_mg_stats(MgConf, ?LOAD_COUNTER_START, ?LOAD_COUNTER_START), i("traffic -> collect and check the MGC statistics"), + progress("collect and verify MGC (after load 2) stats"), traffic_verify_mgc_stats(Mgc, ?LOAD_COUNTER_START, ?LOAD_COUNTER_START), - sleep(1000), + ?SLEEP(1000), %% Tell MGs to stop i("traffic -> stop the MGs"), + progress("stop MGs"), traffic_stop_mg(MgConf), - sleep(1000), + ?SLEEP(1000), %% Collect the statistics i("traffic -> collect the MGC statistics"), + progress("collect and verify MGC (after MGs stop) stats"), {ok, MgcStats7} = get_stats(Mgc, 1), d("traffic -> stats (1) for Mgc: ~n~p~n", [MgcStats7]), {ok, MgcStats8} = get_stats(Mgc, 2), @@ -413,9 +478,11 @@ traffic(Config) when is_list(Config) -> %% Tell Mgc to stop i("traffic -> stop the MGC"), + progress("stop MGC"), stop(Mgc), i("traffic -> done", []), + progress("done"), ok. @@ -516,10 +583,15 @@ traffic_verify_get_stats(S, Stats) -> traffic_verify_counter(Name, Counter, Counters, Expected) -> case lists:keysearch(Counter, 1, Counters) of {value, {Counter, Expected}} -> + i("counter ~w verified for ~p", [Counter, Name]), ok; {value, {Counter, Val}} -> + i("counter ~w *not* verified for ~p: " + "~n Expected: ~w" + "~n Actual: ~w", [Counter, Name, Expected, Val]), exit({illegal_counter_value, Counter, Val, Expected, Name}); false -> + i("counter ~w *not* found for ~p", [Counter, Name]), exit({not_found, Counter, Counters, Name, Expected}) end. @@ -536,8 +608,7 @@ traffic_connect_mg(Node, Name, Coding, Trans) -> %% Ask the MGs to do a service change {ok, Res} = service_change(Pid), - d("traffic_connect_mg -> (~s) service change result: ~p", [Name,Res]), - + d("traffic_connect_mg -> (~s) service change result: ~p", [Name, Res]), Pid. @@ -549,7 +620,9 @@ traffic_get_mg_stats([], Acc) -> lists:reverse(Acc); traffic_get_mg_stats([{Name, Pid}|Mgs], Acc) -> {ok, Stats} = get_stats(Pid, 1), - d("traffic_get_mg_stats -> stats for ~s: ~n~p~n", [Name, Stats]), + d("traffic_get_mg_stats -> stats for ~s: " + "~n ~p" + "~n", [Name, Stats]), traffic_get_mg_stats(Mgs, [{Name, Stats}|Acc]). @@ -903,7 +976,7 @@ mgc_tcp_create_listen(Sup, Opts, MaxN, N, _InitialReason) ok -> Sup; {error, {could_not_start_listener, {gen_tcp_listen, eaddrinuse} = Reason}} -> - sleep(N * 200), + ?SLEEP(N * 200), mgc_tcp_create_listen(Sup, Opts, MaxN, N + 1, Reason); {error, Reason} -> throw({error, {failed_starting_tcp_listen, Reason}}); @@ -1044,7 +1117,6 @@ mg(Parent, Verbosity, Config) -> mg_init(Config) -> d("mg_init -> entry"), - random_init(), Mid = get_conf(local_mid, Config), RI = get_conf(receive_info, Config), d("mg_init -> start megaco"), @@ -1088,12 +1160,12 @@ mg_loop(#mg{state = State} = S) -> %% Give me statistics {statistics, 1, Parent} when S#mg.parent == Parent -> i("mg_loop(~p) -> got request for statistics 1", [State]), - {ok, Gen} = megaco:get_stats(), - CH = S#mg.conn_handle, - Reason = {statistics, CH}, - Pid = megaco:conn_info(CH, control_pid), - SendMod = megaco:conn_info(CH, send_mod), - SendHandle = megaco:conn_info(CH, send_handle), + {ok, Gen} = megaco:get_stats(), + CH = S#mg.conn_handle, + Reason = {statistics, CH}, + Pid = megaco:conn_info(CH, control_pid), + SendMod = megaco:conn_info(CH, send_mod), + SendHandle = megaco:conn_info(CH, send_handle), {ok, Trans} = case SendMod of megaco_tcp -> megaco_tcp:get_stats(SendHandle); @@ -1247,13 +1319,16 @@ mg_start_udp(MgcPort, RH) -> d("start udp transport"), case megaco_udp:start_transport() of {ok, Sup} -> - {ok, LocalHost} = inet:gethostname(), + %% Some linux (Ubuntu) has "crap" in their /etc/hosts, that + %% causes problem for us in this case (UDP). So we can't use + %% local host. Try instead to "figure out" tha actual address... + LocalAddr = which_local_addr(), Opts = [{port, 0}, {receive_handle, RH}], case megaco_udp:open(Sup, Opts) of {ok, Handle, ControlPid} -> MgcMid = preliminary_mid, SendHandle = megaco_udp:create_send_handle(Handle, - LocalHost, + LocalAddr, MgcPort), {ok, ConnHandle} = megaco:connect(RH, MgcMid, @@ -1528,10 +1603,6 @@ request(Pid, Request) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -sleep(X) -> - receive after X -> ok end. - - error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). @@ -1583,6 +1654,44 @@ get_conf(Key, Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +which_local_addr() -> + case inet:getifaddrs() of + {ok, IFs} -> + which_local_addr(IFs); + {error, Reason} -> + i("Failed get local address: " + "~n ~p", [Reason]), + ?SKIP({failed_get_local_addr, Reason}) + end. + +which_local_addr([]) -> + ?SKIP(failed_get_local_addr); +which_local_addr([{"lo" = _IfName, _IfOpts}|IFs]) -> + which_local_addr(IFs); +which_local_addr([{"br-" ++ _ = _IfName, _IfOpts}|IFs]) -> + which_local_addr(IFs); +which_local_addr([{"docker" ++ _ = _IfName, _IfOpts}|IFs]) -> + which_local_addr(IFs); +which_local_addr([{_IfName, IfOpts}|IFs]) -> + case which_local_addr2(IfOpts) of + {ok, Addr} -> + Addr; + error -> + which_local_addr(IFs) + end. + + +which_local_addr2([]) -> + error; +which_local_addr2([{addr, Addr}|_]) + when (size(Addr) =:= 4) andalso (element(1, Addr) =/= 127) -> + {ok, Addr}; +which_local_addr2([_|T]) -> + which_local_addr2(T). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + i(F) -> i(F, []). @@ -1605,19 +1714,22 @@ print(Severity, Verbosity, P, F, A) -> print(printable(Severity,Verbosity), P, F, A). print(true, P, F, A) -> - io:format("~s~p:~s: " ++ F ++ "~n", [P, self(), get(sname) | A]); + io:format("~s~p:~s:~s: " ++ F ++ "~n", [P, self(), get(sname), ?FT() | A]); print(_, _, _, _) -> ok. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +progress(F) -> + progress(F, []). + +progress(F, A) -> + io:format(user, "~s " ++ F ++ "~n", [?FT()|A]). -random_init() -> - {A,B,C} = now(), - random:seed(A,B,C). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% random() -> - 10 * random:uniform(50). + 10 * rand:uniform(50). apply_load_timer() -> erlang:send_after(random(), self(), apply_load_timeout). diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl index 3934a3a957..0617b96456 100644 --- a/lib/megaco/test/megaco_test_lib.erl +++ b/lib/megaco/test/megaco_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. +%% Copyright Ericsson AB 1999-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -26,7 +26,47 @@ -module(megaco_test_lib). --compile(export_all). +%% -compile(export_all). + +-export([ + log/4, + error/3, + + sleep/1, + hours/1, minutes/1, seconds/1, + formated_timestamp/0, format_timestamp/1, + + skip/3, + non_pc_tc_maybe_skip/4, + os_based_skip/1, + + flush/0, + still_alive/1, + watchdog/2, + + display_alloc_info/0, + display_system_info/1, display_system_info/2, display_system_info/3, + + tickets/1, + prepare_test_case/5, + + t/1, + groups/1, + init_suite/2, + end_suite/2, + init_group/3, + end_group/3, + t/2, + init_per_testcase/2, + end_per_testcase/2, + + proxy_start/1, proxy_start/2, + + mk_nodes/1, + start_nodes/3 + ]). + +-export([do_eval/4, proxy_init/2]). -include("megaco_test_lib.hrl"). @@ -53,6 +93,13 @@ minutes(N) -> trunc(N * 1000 * 60). seconds(N) -> trunc(N * 1000). +formated_timestamp() -> + format_timestamp(os:timestamp()). + +format_timestamp(TS) -> + megaco:format_timestamp(TS). + + %% ---------------------------------------------------------------- %% Conditional skip of testcases %% @@ -367,7 +414,7 @@ eval(Mod, Fun, Config) -> Flag = process_flag(trap_exit, true), put(megaco_test_server, true), Config2 = Mod:init_per_testcase(Fun, Config), - Pid = spawn_link(?MODULE, do_eval, [self(), Mod, Fun, Config2]), + Pid = spawn_link(fun() -> do_eval(self(), Mod, Fun, Config2) end), R = wait_for_evaluator(Pid, Mod, Fun, Config2, []), Mod:end_per_testcase(Fun, Config2), erase(megaco_test_server), @@ -719,6 +766,7 @@ still_alive(Pid) -> end end. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% The proxy process @@ -730,32 +778,51 @@ proxy_start(Node, ProxyId) -> proxy_init(ProxyId, Controller) -> process_flag(trap_exit, true), - ?LOG("[~p] proxy started by ~p~n",[ProxyId, Controller]), + IdStr = proxyid2string(ProxyId), + put(id, IdStr), + ?LOG("[~s] proxy started by ~p~n", [IdStr, Controller]), proxy_loop(ProxyId, Controller). proxy_loop(OwnId, Controller) -> receive {'EXIT', Controller, Reason} -> - p("proxy_loop -> received exit from controller" + pprint("proxy_loop -> received exit from controller" + "~n Reason: ~p", [Reason]), + exit(Reason); + {stop, Controller, Reason} -> + p("proxy_loop -> received stop from controller" "~n Reason: ~p" "~n", [Reason]), exit(Reason); + {apply, Fun} -> - p("proxy_loop -> received apply request~n", []), + pprint("proxy_loop -> received apply request"), Res = Fun(), - p("proxy_loop -> apply result: " - "~n ~p" - "~n", [Res]), + pprint("proxy_loop -> apply result: " + "~n ~p", [Res]), Controller ! {res, OwnId, Res}, proxy_loop(OwnId, Controller); OtherMsg -> - p("proxy_loop -> received unknown message: " - "~n OtherMsg: ~p" - "~n", [OtherMsg]), + pprint("proxy_loop -> received unknown message: " + "~n ~p", [OtherMsg]), Controller ! {msg, OwnId, OtherMsg}, proxy_loop(OwnId, Controller) end. +proxyid2string(Id) when is_list(Id) -> + Id; +proxyid2string(Id) when is_atom(Id) -> + atom_to_list(Id); +proxyid2string(Id) -> + f("~p", [Id]). + +pprint(F) -> + pprint(F, []). + +pprint(F, A) -> + io:format("[~s] ~p ~s " ++ F ++ "~n", + [get(id), self(), formated_timestamp() | A]). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Test server callbacks @@ -837,7 +904,7 @@ reset_kill_timer(Config) -> end. watchdog(Pid, Time) -> - erlang:now(), + _ = os:timestamp(), receive stop -> ok @@ -897,7 +964,10 @@ default_config() -> [{nodes, default_nodes()}, {ts, megaco}]. default_nodes() -> - mk_nodes(2, []). + mk_nodes(3, []). + +mk_nodes(N) when (N > 0) -> + mk_nodes(N, []). mk_nodes(0, Nodes) -> Nodes; @@ -937,5 +1007,11 @@ start_nodes([Node | Nodes], File, Line) -> start_nodes([], _File, _Line) -> ok. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +f(F, A) -> + lists:flatten(io_lib:format(F, A)). + p(F, A) -> io:format("~p~w:" ++ F ++ "~n", [self(), ?MODULE |A]). diff --git a/lib/megaco/test/megaco_test_lib.hrl b/lib/megaco/test/megaco_test_lib.hrl index 79a1493c40..19103c0a79 100644 --- a/lib/megaco/test/megaco_test_lib.hrl +++ b/lib/megaco/test/megaco_test_lib.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. +%% Copyright Ericsson AB 1999-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -32,6 +32,8 @@ -define(ERROR(Reason), megaco_test_lib:error(Reason, ?MODULE, ?LINE)). +-define(F(FMT, ARGS), lists:flatten(io_lib:format(FMT, ARGS))). + -define(OS_BASED_SKIP(Skippable), megaco_test_lib:os_based_skip(Skippable)). @@ -80,9 +82,7 @@ -define(SLEEP(MSEC), megaco_test_lib:sleep(MSEC)). --define(M(), megaco_test_lib:millis()). --define(MDIFF(A,B), megaco_test_lib:millis_diff(A,B)). - -define(HOURS(T), megaco_test_lib:hours(T)). -define(MINUTES(T), megaco_test_lib:minutes(T)). -define(SECONDS(T), megaco_test_lib:seconds(T)). +-define(FT(), megaco_test_lib:formated_timestamp()). diff --git a/lib/megaco/test/megaco_timer_test.erl b/lib/megaco/test/megaco_timer_test.erl index 34479f7838..b60e8581cd 100644 --- a/lib/megaco/test/megaco_timer_test.erl +++ b/lib/megaco/test/megaco_timer_test.erl @@ -359,7 +359,12 @@ integer_timer_start_and_stop(Config) when is_list(Config) -> {timeout, Timeout} -> error(bad_timeout) after Timeout - 100 -> - tmr_stop(Ref) + case tmr_stop(Ref) of + ok -> + ok; + CancelRes -> + ?SKIP({cancel_failed, CancelRes}) + end end, %% Make sure it does not reach us after we attempted to stop it. @@ -446,13 +451,5 @@ print(Prefix, F, A) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% formated_timestamp() -> - format_timestamp(now()). - -format_timestamp({_N1, _N2, N3} = Now) -> - {Date, Time} = calendar:now_to_datetime(Now), - {YYYY,MM,DD} = Date, - {Hour,Min,Sec} = Time, - FormatDate = - io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", - [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), - lists:flatten(FormatDate). + megaco:format_timestamp(os:timestamp()). + diff --git a/lib/megaco/test/megaco_trans_test.erl b/lib/megaco/test/megaco_trans_test.erl index 9786307860..fb44a3c6e6 100644 --- a/lib/megaco/test/megaco_trans_test.erl +++ b/lib/megaco/test/megaco_trans_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2016. All Rights Reserved. +%% Copyright Ericsson AB 2003-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -27,7 +27,46 @@ %%---------------------------------------------------------------------- -module(megaco_trans_test). --compile(export_all). +%% -compile(export_all). +-export([ + all/0, + groups/0, + init_per_group/2, end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + + single_ack/1, + multi_ack_timeout/1, + multi_ack_maxcount/1, + + single_trans_req/1, + multi_trans_req_timeout/1, + multi_trans_req_maxcount1/1, + multi_trans_req_maxcount2/1, + multi_trans_req_maxsize1/1, + multi_trans_req_maxsize2/1, + + single_trans_req_and_ack/1, + multi_trans_req_and_ack_timeout/1, + multi_trans_req_and_ack_ackmaxcount/1, + multi_trans_req_and_ack_reqmaxcount/1, + multi_trans_req_and_ack_maxsize1/1, + multi_trans_req_and_ack_maxsize2/1, + + single_trans_req_and_pending/1, + multi_trans_req_and_pending/1, + multi_trans_req_and_ack_and_pending/1, + multi_ack_and_pending/1, + + multi_trans_req_and_reply/1, + multi_trans_req_and_ack_and_reply/1, + multi_ack_and_reply/1, + + otp_7192_1/1, + otp_7192_2/1, + otp_7192_3/1, + + t/0, t/1 + ]). -include("megaco_test_lib.hrl"). -include_lib("megaco/include/megaco.hrl"). @@ -44,44 +83,42 @@ -define(A5555, ["11111111", "11111111", "00000000"]). -define(A5556, ["11111111", "11111111", "11111111"]). --define(MGC_START(Pid, Mid, ET, Verb), - megaco_test_mgc:start(Pid, Mid, ET, Verb)). --define(MGC_STOP(Pid), megaco_test_mgc:stop(Pid)). --define(MGC_GET_STATS(Pid, No), megaco_test_mgc:get_stats(Pid, No)). --define(MGC_RESET_STATS(Pid), megaco_test_mgc:reset_stats(Pid)). --define(MGC_REQ_DISC(Pid,To), megaco_test_mgc:request_discard(Pid,To)). --define(MGC_REQ_PEND(Pid,To), megaco_test_mgc:request_pending(Pid,To)). --define(MGC_REQ_HAND(Pid), megaco_test_mgc:request_handle(Pid)). --define(MGC_REQ_HANDS(Pid), megaco_test_mgc:request_handle_sloppy(Pid)). --define(MGC_UPDATE_UI(Pid,Tag,Val), - megaco_test_mgc:update_user_info(Pid,Tag,Val)). --define(MGC_UPDATE_CI(Pid,Tag,Val), - megaco_test_mgc:update_conn_info(Pid,Tag,Val)). --define(MGC_USER_INFO(Pid,Tag), megaco_test_mgc:user_info(Pid,Tag)). --define(MGC_CONN_INFO(Pid,Tag), megaco_test_mgc:conn_info(Pid,Tag)). --define(MGC_ACK_INFO(Pid,To), megaco_test_mgc:ack_info(Pid,To)). --define(MGC_REQ_INFO(Pid,To), megaco_test_mgc:req_info(Pid,To)). +-define(MG, megaco_test_mg). +-define(MGC, megaco_test_mgc). + +-define(MGC_START(Pid, Mid, ET, Verb), ?MGC:start(Pid, Mid, ET, Verb)). +-define(MGC_STOP(Pid), ?MGC:stop(Pid)). +-define(MGC_GET_STATS(Pid, No), ?MGC:get_stats(Pid, No)). +-define(MGC_RESET_STATS(Pid), ?MGC:reset_stats(Pid)). +-define(MGC_REQ_DISC(Pid,To), ?MGC:request_discard(Pid,To)). +-define(MGC_REQ_PEND(Pid,To), ?MGC:request_pending(Pid,To)). +-define(MGC_REQ_HAND(Pid), ?MGC:request_handle(Pid)). +-define(MGC_REQ_HANDS(Pid), ?MGC:request_handle_sloppy(Pid)). +-define(MGC_UPDATE_UI(Pid,Tag,Val), ?MGC:update_user_info(Pid,Tag,Val)). +-define(MGC_UPDATE_CI(Pid,Tag,Val), ?MGC:update_conn_info(Pid,Tag,Val)). +-define(MGC_USER_INFO(Pid,Tag), ?MGC:user_info(Pid,Tag)). +-define(MGC_CONN_INFO(Pid,Tag), ?MGC:conn_info(Pid,Tag)). +-define(MGC_ACK_INFO(Pid,To), ?MGC:ack_info(Pid,To)). +-define(MGC_REQ_INFO(Pid,To), ?MGC:req_info(Pid,To)). -define(MG_START(Pid, Mid, Enc, Transp, Conf, Verb), - megaco_test_mg:start(Pid, Mid, Enc, Transp, Conf, Verb)). --define(MG_STOP(Pid), megaco_test_mg:stop(Pid)). --define(MG_GET_STATS(Pid), megaco_test_mg:get_stats(Pid)). --define(MG_RESET_STATS(Pid), megaco_test_mg:reset_stats(Pid)). --define(MG_SERV_CHANGE(Pid), megaco_test_mg:service_change(Pid)). --define(MG_NOTIF_RAR(Pid), megaco_test_mg:notify_request_and_reply(Pid)). --define(MG_NOTIF_REQ(Pid), megaco_test_mg:notify_request(Pid)). --define(MG_NOTIF_AR(Pid), megaco_test_mg:await_notify_reply(Pid)). --define(MG_CANCEL(Pid,R), megaco_test_mg:cancel_request(Pid,R)). --define(MG_APPLY_LOAD(Pid,CntStart), megaco_test_mg:apply_load(Pid,CntStart)). --define(MG_UPDATE_UI(Pid,Tag,Val), - megaco_test_mg:update_user_info(Pid,Tag,Val)). --define(MG_UPDATE_CI(Pid,Tag,Val), - megaco_test_mg:update_conn_info(Pid,Tag,Val)). --define(MG_USER_INFO(Pid,Tag), megaco_test_mg:user_info(Pid,Tag)). --define(MG_CONN_INFO(Pid,Tag), megaco_test_mg:conn_info(Pid,Tag)). --define(MG_GRP_REQ(Pid,N), megaco_test_mg:group_requests(Pid,N)). --define(MG_ACK_INFO(Pid,To), megaco_test_mg:ack_info(Pid,To)). --define(MG_REP_INFO(Pid,To), megaco_test_mg:rep_info(Pid,To)). + ?MG:start(Pid, Mid, Enc, Transp, Conf, Verb)). +-define(MG_STOP(Pid), ?MG:stop(Pid)). +-define(MG_GET_STATS(Pid), ?MG:get_stats(Pid)). +-define(MG_RESET_STATS(Pid), ?MG:reset_stats(Pid)). +-define(MG_SERV_CHANGE(Pid), ?MG:service_change(Pid)). +-define(MG_NOTIF_RAR(Pid), ?MG:notify_request_and_reply(Pid)). +-define(MG_NOTIF_REQ(Pid), ?MG:notify_request(Pid)). +-define(MG_NOTIF_AR(Pid), ?MG:await_notify_reply(Pid)). +-define(MG_CANCEL(Pid,R), ?MG:cancel_request(Pid,R)). +-define(MG_APPLY_LOAD(Pid,CntStart), ?MG:apply_load(Pid,CntStart)). +-define(MG_UPDATE_UI(Pid,Tag,Val), ?MG:update_user_info(Pid,Tag,Val)). +-define(MG_UPDATE_CI(Pid,Tag,Val), ?MG:update_conn_info(Pid,Tag,Val)). +-define(MG_USER_INFO(Pid,Tag), ?MG:user_info(Pid,Tag)). +-define(MG_CONN_INFO(Pid,Tag), ?MG:conn_info(Pid,Tag)). +-define(MG_GRP_REQ(Pid,N), ?MG:group_requests(Pid,N)). +-define(MG_ACK_INFO(Pid,To), ?MG:ack_info(Pid,To)). +-define(MG_REP_INFO(Pid,To), ?MG:rep_info(Pid,To)). t() -> megaco_test_lib:t(?MODULE). t(Case) -> megaco_test_lib:t({?MODULE, Case}). @@ -104,35 +141,77 @@ end_per_testcase(Case, Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> - [{group, ack}, {group, trans_req}, - {group, trans_req_and_ack}, {group, pending}, - {group, reply}, {group, tickets}]. + [{group, ack}, + {group, trans_req}, + {group, trans_req_and_ack}, + {group, pending}, + {group, reply}, + {group, tickets}]. groups() -> - [{ack, [], - [single_ack, multi_ack_timeout, multi_ack_maxcount]}, - {trans_req, [], - [single_trans_req, multi_trans_req_timeout, - multi_trans_req_maxcount1, multi_trans_req_maxcount2, - multi_trans_req_maxsize1, multi_trans_req_maxsize2]}, - {trans_req_and_ack, [], - [single_trans_req_and_ack, - multi_trans_req_and_ack_timeout, - multi_trans_req_and_ack_ackmaxcount, - multi_trans_req_and_ack_reqmaxcount, - multi_trans_req_and_ack_maxsize1, - multi_trans_req_and_ack_maxsize2]}, - {pending, [], - [single_trans_req_and_pending, - multi_trans_req_and_pending, - multi_trans_req_and_ack_and_pending, - multi_ack_and_pending]}, - {reply, [], - [multi_trans_req_and_reply, - multi_trans_req_and_ack_and_reply, - multi_ack_and_reply]}, - {tickets, [], [{group, otp_7192}]}, - {otp_7192, [], [otp_7192_1, otp_7192_2, otp_7192_3]}]. + [ + {ack, [], ack_cases()}, + {trans_req, [], trans_req_cases()}, + {trans_req_and_ack, [], trans_req_and_ack_cases()}, + {pending, [], pending_cases()}, + {reply, [], reply_cases()}, + {tickets, [], tickets_cases()}, + {otp_7192, [], otp_7192_cases()} + ]. + +ack_cases() -> + [ + single_ack, + multi_ack_timeout, + multi_ack_maxcount + ]. + +trans_req_cases() -> + [ + single_trans_req, + multi_trans_req_timeout, + multi_trans_req_maxcount1, + multi_trans_req_maxcount2, + multi_trans_req_maxsize1, + multi_trans_req_maxsize2 + ]. + +trans_req_and_ack_cases() -> + [ + single_trans_req_and_ack, + multi_trans_req_and_ack_timeout, + multi_trans_req_and_ack_ackmaxcount, + multi_trans_req_and_ack_reqmaxcount, + multi_trans_req_and_ack_maxsize1, + multi_trans_req_and_ack_maxsize2 + ]. + +pending_cases() -> + [ + single_trans_req_and_pending, + multi_trans_req_and_pending, + multi_trans_req_and_ack_and_pending, + multi_ack_and_pending + ]. + +reply_cases() -> + [ + multi_trans_req_and_reply, + multi_trans_req_and_ack_and_reply, + multi_ack_and_reply + ]. + +tickets_cases() -> + [ + {group, otp_7192} + ]. + +otp_7192_cases() -> + [ + otp_7192_1, + otp_7192_2, + otp_7192_3 + ]. init_per_group(_GroupName, Config) -> Config. @@ -156,8 +235,8 @@ single_ack(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -231,8 +310,8 @@ multi_ack_timeout(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -308,8 +387,8 @@ multi_ack_maxcount(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -393,8 +472,8 @@ single_trans_req(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -628,26 +707,26 @@ str_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -str_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = str_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% str_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = str_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). str_mgc_notify_reply_ar(Cid, TermId) -> NR = cre_notifyReply([TermId]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -str_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = str_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% str_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = str_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -778,12 +857,12 @@ str_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -str_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = str_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% str_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = str_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). str_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -794,12 +873,12 @@ str_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -str_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = str_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% str_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = str_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -827,8 +906,8 @@ multi_trans_req_timeout(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -1063,26 +1142,26 @@ mtrt_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrt_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrt_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrt_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrt_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrt_mgc_notify_reply_ar(Cid, TermId) -> NR = cre_notifyReply([TermId]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtrt_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrt_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrt_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrt_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -1224,12 +1303,12 @@ mtrt_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrt_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrt_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrt_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrt_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrt_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -1240,12 +1319,12 @@ mtrt_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrt_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrt_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrt_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrt_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -1273,8 +1352,8 @@ multi_trans_req_maxcount1(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -1509,26 +1588,26 @@ mtrmc1_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrmc1_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrmc1_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrmc1_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrmc1_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrmc1_mgc_notify_reply_ar(Cid, TermId) -> NR = cre_notifyReply([TermId]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtrmc1_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrmc1_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrmc1_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrmc1_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -1675,12 +1754,12 @@ mtrmc1_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrmc1_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrmc1_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrmc1_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrmc1_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrmc1_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -1691,12 +1770,12 @@ mtrmc1_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrmc1_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrmc1_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrmc1_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrmc1_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -1725,8 +1804,8 @@ multi_trans_req_maxcount2(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -1978,13 +2057,13 @@ mtrmc2_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrmc2_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrmc2_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrmc2_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrmc2_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrmc2_mgc_notify_reply_ar1(Cid, Tid) -> NR = cre_notifyReply([Tid]), @@ -1995,13 +2074,13 @@ mtrmc2_mgc_notify_reply_ar2(Cid, Tids) -> CRs = [cre_cmdReply(cre_notifyReply([Tid])) || Tid <- Tids], cre_actionReply(Cid, CRs). -mtrmc2_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrmc2_mgc_notify_reply_ar1(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrmc2_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrmc2_mgc_notify_reply_ar1(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -2163,12 +2242,12 @@ mtrmc2_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrmc2_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrmc2_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrmc2_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrmc2_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrmc2_mg_notify_request_ar1(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -2194,12 +2273,12 @@ mtrmc2_mg_notify_request_ar2(Rid, Tid, Cid) -> CRs = [F(N) || N <- Ns], cre_actionReq(Cid, CRs). -mtrmc2_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrmc2_mg_notify_request_ar1(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrmc2_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrmc2_mg_notify_request_ar1(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -2229,8 +2308,8 @@ multi_trans_req_maxsize1(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -2466,26 +2545,26 @@ mtrms1_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrms1_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrms1_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrms1_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrms1_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrms1_mgc_notify_reply_ar1(Cid, Tid) -> NR = cre_notifyReply([Tid]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtrms1_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrms1_mgc_notify_reply_ar1(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrms1_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrms1_mgc_notify_reply_ar1(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -2633,12 +2712,12 @@ mtrms1_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrms1_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrms1_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrms1_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrms1_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrms1_mg_notify_request_ar1(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -2649,18 +2728,16 @@ mtrms1_mg_notify_request_ar1(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrms1_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrms1_mg_notify_request_ar1(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrms1_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrms1_mg_notify_request_ar1(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrms1_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). @@ -2681,8 +2758,8 @@ multi_trans_req_maxsize2(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -2934,13 +3011,13 @@ mtrms2_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrms2_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrms2_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrms2_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrms2_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrms2_mgc_notify_reply_ar1(Cid, Tid) -> NR = cre_notifyReply([Tid]), @@ -2951,13 +3028,13 @@ mtrms2_mgc_notify_reply_ar2(Cid, Tids) -> CRs = [cre_cmdReply(cre_notifyReply([Tid])) || Tid <- Tids], cre_actionReply(Cid, CRs). -mtrms2_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrms2_mgc_notify_reply_ar1(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrms2_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrms2_mgc_notify_reply_ar1(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -3115,12 +3192,12 @@ mtrms2_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrms2_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrms2_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrms2_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrms2_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrms2_mg_notify_request_ar1(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -3146,18 +3223,16 @@ mtrms2_mg_notify_request_ar2(Rid, Tid, Cid) -> CRs = [F(N) || N <- Ns], cre_actionReq(Cid, CRs). -mtrms2_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrms2_mg_notify_request_ar1(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrms2_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrms2_mg_notify_request_ar1(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrms2_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -3175,8 +3250,8 @@ single_trans_req_and_ack(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -3439,26 +3514,26 @@ straa_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -straa_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = straa_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% straa_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = straa_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). straa_mgc_notify_reply_ar(Cid, TermId) -> NR = cre_notifyReply([TermId]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -straa_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = straa_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% straa_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = straa_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -3605,12 +3680,12 @@ straa_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -straa_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = straa_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% straa_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = straa_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). straa_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -3621,12 +3696,12 @@ straa_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -straa_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = straa_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% straa_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = straa_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -3634,9 +3709,7 @@ straa_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% straa_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). @@ -3656,8 +3729,8 @@ multi_trans_req_and_ack_timeout(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -3926,26 +3999,26 @@ mtrtaat_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrtaat_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrtaat_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaat_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrtaat_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaat_mgc_notify_reply_ar(Cid, TermId) -> NR = cre_notifyReply([TermId]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtrtaat_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrtaat_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaat_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrtaat_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -4098,12 +4171,12 @@ mtrtaat_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaat_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrtaat_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaat_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrtaat_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaat_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -4114,12 +4187,12 @@ mtrtaat_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaat_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrtaat_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaat_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrtaat_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -4127,9 +4200,7 @@ mtrtaat_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% mtrtaat_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -4147,8 +4218,8 @@ multi_trans_req_and_ack_ackmaxcount(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -4422,26 +4493,26 @@ mtrtaaamc_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrtaaamc_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrtaaamc_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaaamc_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrtaaamc_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaaamc_mgc_notify_reply_ar(Cid, TermId) -> NR = cre_notifyReply([TermId]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtrtaaamc_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrtaaamc_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaaamc_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrtaaamc_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -4596,12 +4667,12 @@ mtrtaaamc_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaaamc_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrtaaamc_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaaamc_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrtaaamc_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaaamc_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -4612,12 +4683,12 @@ mtrtaaamc_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaaamc_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrtaaamc_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaaamc_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrtaaamc_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -4625,9 +4696,7 @@ mtrtaaamc_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% mtrtaaamc_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -4645,8 +4714,8 @@ multi_trans_req_and_ack_reqmaxcount(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -4919,26 +4988,26 @@ mtrtaarac_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrtaarac_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrtaarac_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaarac_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrtaarac_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaarac_mgc_notify_reply_ar(Cid, TermId) -> NR = cre_notifyReply([TermId]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtrtaarac_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrtaarac_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaarac_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrtaarac_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -5093,12 +5162,12 @@ mtrtaarac_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaarac_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrtaarac_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaarac_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrtaarac_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaarac_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -5109,12 +5178,12 @@ mtrtaarac_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaarac_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrtaarac_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaarac_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrtaarac_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -5142,8 +5211,8 @@ multi_trans_req_and_ack_maxsize1(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -5416,26 +5485,26 @@ mtrtaams1_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrtaams1_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrtaams1_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaams1_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrtaams1_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaams1_mgc_notify_reply_ar(Cid, TermId) -> NR = cre_notifyReply([TermId]), CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtrtaams1_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrtaams1_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaams1_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrtaams1_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -5589,12 +5658,12 @@ mtrtaams1_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaams1_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrtaams1_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaams1_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrtaams1_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaams1_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -5605,12 +5674,12 @@ mtrtaams1_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaams1_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrtaams1_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaams1_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrtaams1_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -5618,9 +5687,7 @@ mtrtaams1_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% mtrtaams1_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -5638,8 +5705,8 @@ multi_trans_req_and_ack_maxsize2(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -5915,13 +5982,13 @@ mtrtaams2_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtrtaams2_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtrtaams2_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaams2_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtrtaams2_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaams2_mgc_notify_reply_ar1(Cid, TermId) -> NR = cre_notifyReply([TermId]), @@ -5932,13 +5999,13 @@ mtrtaams2_mgc_notify_reply_ar2(Cid, Tids) -> CRs = [cre_cmdReply(cre_notifyReply([Tid])) || Tid <- Tids], cre_actionReply(Cid, CRs). -mtrtaams2_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtrtaams2_mgc_notify_reply_ar1(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaams2_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtrtaams2_mgc_notify_reply_ar1(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -6093,12 +6160,12 @@ mtrtaams2_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtrtaams2_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtrtaams2_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaams2_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtrtaams2_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtrtaams2_mg_notify_request_ar1(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -6124,12 +6191,12 @@ mtrtaams2_mg_notify_request_ar2(Rid, Tid, Cid) -> CRs = [F(N) || N <- Ns], cre_actionReq(Cid, CRs). -mtrtaams2_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtrtaams2_mg_notify_request_ar1(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtrtaams2_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtrtaams2_mg_notify_request_ar1(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -6137,9 +6204,7 @@ mtrtaams2_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% mtrtaams2_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -6177,8 +6242,8 @@ multi_trans_req_and_ack_and_pending(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -6469,13 +6534,13 @@ mtraaap_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtraaap_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtraaap_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtraaap_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtraaap_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtraaap_mgc_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "44000000"), @@ -6491,13 +6556,13 @@ mtraaap_mgc_notify_reply_ar(Cid, TermId) -> CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtraaap_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtraaap_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtraaap_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtraaap_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -6639,38 +6704,38 @@ mtraaap_mg_verify_service_change_reply(Else) -> "~n Else: ~p~n", [Else]), {error, Else, ok}. -mtraaap_mg_verify_notify_request_fun() -> - fun(Ev) -> - mtraaap_mg_verify_notify_request(Ev) - end. - -mtraaap_mg_verify_notify_request( - {handle_trans_request, _, ?VERSION, [AR]}) -> - io:format("mtraaap_mg_verify_notify_request -> ok" - "~n AR: ~p~n", [AR]), - case AR of - #'ActionRequest'{contextId = 1 = Cid, - commandRequests = [CR]} -> - #'CommandRequest'{command = Cmd} = CR, - {notifyReq, NR} = Cmd, - #'NotifyRequest'{terminationID = [Tid], - observedEventsDescriptor = OED, - errorDescriptor = asn1_NOVALUE} = NR, - #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, - #'ObservedEvent'{eventName = "al/of"} = OE, - Reply = {discard_ack, [mtraaap_mg_notify_reply_ar(Cid, Tid)]}, - {ok, 3000, AR, Reply}; - _ -> - ED = mtraaap_err_desc(AR), - ErrReply = {discard_ack, ED}, - {error, AR, ErrReply} - end; -mtraaap_mg_verify_notify_request(Else) -> - io:format("mtraaap_mg_verify_notify_request:fun -> unknown" - "~n Else: ~p~n", [Else]), - ED = mtraaap_err_desc(Else), - ErrReply = {discard_ack, ED}, - {error, Else, ErrReply}. +%% mtraaap_mg_verify_notify_request_fun() -> +%% fun(Ev) -> +%% mtraaap_mg_verify_notify_request(Ev) +%% end. + +%% mtraaap_mg_verify_notify_request( +%% {handle_trans_request, _, ?VERSION, [AR]}) -> +%% io:format("mtraaap_mg_verify_notify_request -> ok" +%% "~n AR: ~p~n", [AR]), +%% case AR of +%% #'ActionRequest'{contextId = 1 = Cid, +%% commandRequests = [CR]} -> +%% #'CommandRequest'{command = Cmd} = CR, +%% {notifyReq, NR} = Cmd, +%% #'NotifyRequest'{terminationID = [Tid], +%% observedEventsDescriptor = OED, +%% errorDescriptor = asn1_NOVALUE} = NR, +%% #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, +%% #'ObservedEvent'{eventName = "al/of"} = OE, +%% Reply = {discard_ack, [mtraaap_mg_notify_reply_ar(Cid, Tid)]}, +%% {ok, 3000, AR, Reply}; +%% _ -> +%% ED = mtraaap_err_desc(AR), +%% ErrReply = {discard_ack, ED}, +%% {error, AR, ErrReply} +%% end; +%% mtraaap_mg_verify_notify_request(Else) -> +%% io:format("mtraaap_mg_verify_notify_request:fun -> unknown" +%% "~n Else: ~p~n", [Else]), +%% ED = mtraaap_err_desc(Else), +%% ErrReply = {discard_ack, ED}, +%% {error, Else, ErrReply}. mtraaap_mg_verify_notify_reply({handle_trans_reply, _CH, ?VERSION, {ok, [AR]}, _}) -> @@ -6691,17 +6756,17 @@ mtraaap_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtraaap_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtraaap_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtraaap_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtraaap_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). -mtraaap_mg_notify_reply_ar(Cid, TermId) -> - NR = cre_notifyReply([TermId]), - CR = cre_cmdReply(NR), - cre_actionReply(Cid, [CR]). +%% mtraaap_mg_notify_reply_ar(Cid, TermId) -> +%% NR = cre_notifyReply([TermId]), +%% CR = cre_cmdReply(NR), +%% cre_actionReply(Cid, [CR]). mtraaap_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -6712,12 +6777,12 @@ mtraaap_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtraaap_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtraaap_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtraaap_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtraaap_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -6725,9 +6790,7 @@ mtraaap_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% mtraaap_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -6765,8 +6828,8 @@ multi_trans_req_and_ack_and_reply(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE), @@ -7061,13 +7124,13 @@ mtraaar_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -mtraaar_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = mtraaar_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtraaar_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = mtraaar_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). mtraaar_mgc_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "44000000"), @@ -7083,13 +7146,13 @@ mtraaar_mgc_notify_reply_ar(Cid, TermId) -> CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -mtraaar_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = mtraaar_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtraaar_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = mtraaar_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -7232,38 +7295,38 @@ mtraaar_mg_verify_service_change_reply(Else) -> "~n Else: ~p~n", [Else]), {error, Else, ok}. -mtraaar_mg_verify_notify_request_fun() -> - fun(Ev) -> - mtraaar_mg_verify_notify_request(Ev) - end. - -mtraaar_mg_verify_notify_request( - {handle_trans_request, _, ?VERSION, [AR]}) -> - io:format("mtraaar_mg_verify_notify_request -> ok" - "~n AR: ~p~n", [AR]), - case AR of - #'ActionRequest'{contextId = 1 = Cid, - commandRequests = [CR]} -> - #'CommandRequest'{command = Cmd} = CR, - {notifyReq, NR} = Cmd, - #'NotifyRequest'{terminationID = [Tid], - observedEventsDescriptor = OED, - errorDescriptor = asn1_NOVALUE} = NR, - #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, - #'ObservedEvent'{eventName = "al/of"} = OE, - Reply = {discard_ack, [mtraaar_mg_notify_reply_ar(Cid, Tid)]}, - {ok, AR, Reply}; - _ -> - ED = mtraaar_err_desc(AR), - ErrReply = {discard_ack, ED}, - {error, AR, ErrReply} - end; -mtraaar_mg_verify_notify_request(Else) -> - io:format("mtraaar_mg_verify_notify_request -> unknown" - "~n Else: ~p~n", [Else]), - ED = mtraaar_err_desc(Else), - ErrReply = {discard_ack, ED}, - {error, Else, ErrReply}. +%% mtraaar_mg_verify_notify_request_fun() -> +%% fun(Ev) -> +%% mtraaar_mg_verify_notify_request(Ev) +%% end. + +%% mtraaar_mg_verify_notify_request( +%% {handle_trans_request, _, ?VERSION, [AR]}) -> +%% io:format("mtraaar_mg_verify_notify_request -> ok" +%% "~n AR: ~p~n", [AR]), +%% case AR of +%% #'ActionRequest'{contextId = 1 = Cid, +%% commandRequests = [CR]} -> +%% #'CommandRequest'{command = Cmd} = CR, +%% {notifyReq, NR} = Cmd, +%% #'NotifyRequest'{terminationID = [Tid], +%% observedEventsDescriptor = OED, +%% errorDescriptor = asn1_NOVALUE} = NR, +%% #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, +%% #'ObservedEvent'{eventName = "al/of"} = OE, +%% Reply = {discard_ack, [mtraaar_mg_notify_reply_ar(Cid, Tid)]}, +%% {ok, AR, Reply}; +%% _ -> +%% ED = mtraaar_err_desc(AR), +%% ErrReply = {discard_ack, ED}, +%% {error, AR, ErrReply} +%% end; +%% mtraaar_mg_verify_notify_request(Else) -> +%% io:format("mtraaar_mg_verify_notify_request -> unknown" +%% "~n Else: ~p~n", [Else]), +%% ED = mtraaar_err_desc(Else), +%% ErrReply = {discard_ack, ED}, +%% {error, Else, ErrReply}. mtraaar_mg_verify_notify_reply({handle_trans_reply, _CH, ?VERSION, {ok, [AR]}, _}) -> @@ -7284,17 +7347,17 @@ mtraaar_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtraaar_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = mtraaar_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtraaar_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = mtraaar_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). -mtraaar_mg_notify_reply_ar(Cid, TermId) -> - NR = cre_notifyReply([TermId]), - CR = cre_cmdReply(NR), - cre_actionReply(Cid, [CR]). +%% mtraaar_mg_notify_reply_ar(Cid, TermId) -> +%% NR = cre_notifyReply([TermId]), +%% CR = cre_cmdReply(NR), +%% cre_actionReply(Cid, [CR]). mtraaar_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -7305,12 +7368,12 @@ mtraaar_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -mtraaar_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = mtraaar_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% mtraaar_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = mtraaar_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -7318,9 +7381,7 @@ mtraaar_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% mtraaar_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -7348,8 +7409,8 @@ otp_7192_1(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), MgMid = {deviceName,"mg"}, @@ -7643,13 +7704,13 @@ otp71921_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -otp71921_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = otp71921_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp71921_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = otp71921_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). otp71921_mgc_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "44000000"), @@ -7665,13 +7726,13 @@ otp71921_mgc_notify_reply_ar(Cid, TermId) -> CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -otp71921_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = otp71921_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp71921_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = otp71921_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -7813,38 +7874,38 @@ otp71921_mg_verify_service_change_reply(Else) -> "~n Else: ~p~n", [Else]), {error, Else, ok}. -otp71921_mg_verify_notify_request_fun() -> - fun(Ev) -> - otp71921_mg_verify_notify_request(Ev) - end. - -otp71921_mg_verify_notify_request( - {handle_trans_request, _, ?VERSION, [AR]}) -> - io:format("otp71921_mg_verify_notify_request -> ok" - "~n AR: ~p~n", [AR]), - case AR of - #'ActionRequest'{contextId = 1 = Cid, - commandRequests = [CR]} -> - #'CommandRequest'{command = Cmd} = CR, - {notifyReq, NR} = Cmd, - #'NotifyRequest'{terminationID = [Tid], - observedEventsDescriptor = OED, - errorDescriptor = asn1_NOVALUE} = NR, - #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, - #'ObservedEvent'{eventName = "al/of"} = OE, - Reply = {discard_ack, [otp71921_mg_notify_reply_ar(Cid, Tid)]}, - {ok, AR, Reply}; - _ -> - ED = otp71921_err_desc(AR), - ErrReply = {discard_ack, ED}, - {error, AR, ErrReply} - end; -otp71921_mg_verify_notify_request(Else) -> - io:format("otp71921_mg_verify_notify_request -> unknown" - "~n Else: ~p~n", [Else]), - ED = otp71921_err_desc(Else), - ErrReply = {discard_ack, ED}, - {error, Else, ErrReply}. +%% otp71921_mg_verify_notify_request_fun() -> +%% fun(Ev) -> +%% otp71921_mg_verify_notify_request(Ev) +%% end. + +%% otp71921_mg_verify_notify_request( +%% {handle_trans_request, _, ?VERSION, [AR]}) -> +%% io:format("otp71921_mg_verify_notify_request -> ok" +%% "~n AR: ~p~n", [AR]), +%% case AR of +%% #'ActionRequest'{contextId = 1 = Cid, +%% commandRequests = [CR]} -> +%% #'CommandRequest'{command = Cmd} = CR, +%% {notifyReq, NR} = Cmd, +%% #'NotifyRequest'{terminationID = [Tid], +%% observedEventsDescriptor = OED, +%% errorDescriptor = asn1_NOVALUE} = NR, +%% #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, +%% #'ObservedEvent'{eventName = "al/of"} = OE, +%% Reply = {discard_ack, [otp71921_mg_notify_reply_ar(Cid, Tid)]}, +%% {ok, AR, Reply}; +%% _ -> +%% ED = otp71921_err_desc(AR), +%% ErrReply = {discard_ack, ED}, +%% {error, AR, ErrReply} +%% end; +%% otp71921_mg_verify_notify_request(Else) -> +%% io:format("otp71921_mg_verify_notify_request -> unknown" +%% "~n Else: ~p~n", [Else]), +%% ED = otp71921_err_desc(Else), +%% ErrReply = {discard_ack, ED}, +%% {error, Else, ErrReply}. otp71921_mg_verify_notify_reply({handle_trans_reply, _CH, ?VERSION, {ok, [AR]}, _}) -> @@ -7865,17 +7926,17 @@ otp71921_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -otp71921_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = otp71921_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp71921_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = otp71921_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). -otp71921_mg_notify_reply_ar(Cid, TermId) -> - NR = cre_notifyReply([TermId]), - CR = cre_cmdReply(NR), - cre_actionReply(Cid, [CR]). +%% otp71921_mg_notify_reply_ar(Cid, TermId) -> +%% NR = cre_notifyReply([TermId]), +%% CR = cre_cmdReply(NR), +%% cre_actionReply(Cid, [CR]). otp71921_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -7886,12 +7947,12 @@ otp71921_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -otp71921_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = otp71921_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp71921_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = otp71921_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -7919,8 +7980,8 @@ otp_7192_2(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), MgMid = {deviceName,"mg"}, @@ -8213,13 +8274,13 @@ otp71922_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -otp71922_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = otp71922_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp71922_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = otp71922_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). otp71922_mgc_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "44000000"), @@ -8235,13 +8296,13 @@ otp71922_mgc_notify_reply_ar(Cid, TermId) -> CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -otp71922_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = otp71922_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp71922_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = otp71922_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -8379,38 +8440,38 @@ otp71922_mg_verify_service_change_reply(Else) -> "~n Else: ~p~n", [Else]), {error, Else, ok}. -otp71922_mg_verify_notify_request_fun() -> - fun(Ev) -> - otp71922_mg_verify_notify_request(Ev) - end. - -otp71922_mg_verify_notify_request( - {handle_trans_request, _, ?VERSION, [AR]}) -> - io:format("otp71922_mg_verify_notify_request -> ok" - "~n AR: ~p~n", [AR]), - case AR of - #'ActionRequest'{contextId = 1 = Cid, - commandRequests = [CR]} -> - #'CommandRequest'{command = Cmd} = CR, - {notifyReq, NR} = Cmd, - #'NotifyRequest'{terminationID = [Tid], - observedEventsDescriptor = OED, - errorDescriptor = asn1_NOVALUE} = NR, - #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, - #'ObservedEvent'{eventName = "al/of"} = OE, - Reply = {discard_ack, [otp71922_mg_notify_reply_ar(Cid, Tid)]}, - {ok, AR, Reply}; - _ -> - ED = otp71922_err_desc(AR), - ErrReply = {discard_ack, ED}, - {error, AR, ErrReply} - end; -otp71922_mg_verify_notify_request(Else) -> - io:format("otp71922_mg_verify_notify_request -> unknown" - "~n Else: ~p~n", [Else]), - ED = otp71922_err_desc(Else), - ErrReply = {discard_ack, ED}, - {error, Else, ErrReply}. +%% otp71922_mg_verify_notify_request_fun() -> +%% fun(Ev) -> +%% otp71922_mg_verify_notify_request(Ev) +%% end. + +%% otp71922_mg_verify_notify_request( +%% {handle_trans_request, _, ?VERSION, [AR]}) -> +%% io:format("otp71922_mg_verify_notify_request -> ok" +%% "~n AR: ~p~n", [AR]), +%% case AR of +%% #'ActionRequest'{contextId = 1 = Cid, +%% commandRequests = [CR]} -> +%% #'CommandRequest'{command = Cmd} = CR, +%% {notifyReq, NR} = Cmd, +%% #'NotifyRequest'{terminationID = [Tid], +%% observedEventsDescriptor = OED, +%% errorDescriptor = asn1_NOVALUE} = NR, +%% #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, +%% #'ObservedEvent'{eventName = "al/of"} = OE, +%% Reply = {discard_ack, [otp71922_mg_notify_reply_ar(Cid, Tid)]}, +%% {ok, AR, Reply}; +%% _ -> +%% ED = otp71922_err_desc(AR), +%% ErrReply = {discard_ack, ED}, +%% {error, AR, ErrReply} +%% end; +%% otp71922_mg_verify_notify_request(Else) -> +%% io:format("otp71922_mg_verify_notify_request -> unknown" +%% "~n Else: ~p~n", [Else]), +%% ED = otp71922_err_desc(Else), +%% ErrReply = {discard_ack, ED}, +%% {error, Else, ErrReply}. otp71922_mg_verify_notify_reply({handle_trans_reply, _CH, ?VERSION, {ok, [AR]}, _}) -> @@ -8431,17 +8492,17 @@ otp71922_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -otp71922_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = otp71922_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp71922_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = otp71922_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). -otp71922_mg_notify_reply_ar(Cid, TermId) -> - NR = cre_notifyReply([TermId]), - CR = cre_cmdReply(NR), - cre_actionReply(Cid, [CR]). +%% otp71922_mg_notify_reply_ar(Cid, TermId) -> +%% NR = cre_notifyReply([TermId]), +%% CR = cre_cmdReply(NR), +%% cre_actionReply(Cid, [CR]). otp71922_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -8452,12 +8513,12 @@ otp71922_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -otp71922_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = otp71922_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp71922_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = otp71922_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -8465,9 +8526,7 @@ otp71922_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% otp71922_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -8485,8 +8544,8 @@ otp_7192_3(Config) when is_list(Config) -> MgcNode = make_node_name(mgc), MgNode = make_node_name(mg), d("start nodes: " - "~n MgcNode: ~p" - "~n MgNode: ~p", + "~n MGC Node: ~p" + "~n MG Node: ~p", [MgcNode, MgNode]), MgMid = {deviceName,"mg"}, @@ -8779,13 +8838,13 @@ otp72923_mgc_service_change_reply_ar(Mid, Cid) -> CR = cre_cmdReply(SCR), cre_actionReply(Cid, [CR]). -otp72923_mgc_service_change_reply_msg(Mid, TransId, Cid) -> - AR = otp72923_mgc_service_change_reply_ar(Mid, Cid), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp72923_mgc_service_change_reply_msg(Mid, TransId, Cid) -> +%% AR = otp72923_mgc_service_change_reply_ar(Mid, Cid), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). otp72923_mgc_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "44000000"), @@ -8801,13 +8860,13 @@ otp72923_mgc_notify_reply_ar(Cid, TermId) -> CR = cre_cmdReply(NR), cre_actionReply(Cid, [CR]). -otp72923_mgc_notify_reply(Mid, TransId, Cid, TermId) -> - AR = otp72923_mgc_notify_reply_ar(Cid, TermId), - TRes = cre_transResult([AR]), - TR = cre_transReply(TransId, TRes), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp72923_mgc_notify_reply(Mid, TransId, Cid, TermId) -> +%% AR = otp72923_mgc_notify_reply_ar(Cid, TermId), +%% TRes = cre_transResult([AR]), +%% TR = cre_transReply(TransId, TRes), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -8946,38 +9005,38 @@ otp72923_mg_verify_service_change_reply(Else) -> "~n Else: ~p~n", [Else]), {error, Else, ok}. -otp72923_mg_verify_notify_request_fun() -> - fun(Ev) -> - otp72923_mg_verify_notify_request(Ev) - end. - -otp72923_mg_verify_notify_request( - {handle_trans_request, _, ?VERSION, [AR]}) -> - io:format("otp72923_mg_verify_notify_request -> ok" - "~n AR: ~p~n", [AR]), - case AR of - #'ActionRequest'{contextId = 1 = Cid, - commandRequests = [CR]} -> - #'CommandRequest'{command = Cmd} = CR, - {notifyReq, NR} = Cmd, - #'NotifyRequest'{terminationID = [Tid], - observedEventsDescriptor = OED, - errorDescriptor = asn1_NOVALUE} = NR, - #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, - #'ObservedEvent'{eventName = "al/of"} = OE, - Reply = {discard_ack, [otp72923_mg_notify_reply_ar(Cid, Tid)]}, - {ok, AR, Reply}; - _ -> - ED = otp72923_err_desc(AR), - ErrReply = {discard_ack, ED}, - {error, AR, ErrReply} - end; -otp72923_mg_verify_notify_request(Else) -> - io:format("otp72923_mg_verify_notify_request -> unknown" - "~n Else: ~p~n", [Else]), - ED = otp72923_err_desc(Else), - ErrReply = {discard_ack, ED}, - {error, Else, ErrReply}. +%% otp72923_mg_verify_notify_request_fun() -> +%% fun(Ev) -> +%% otp72923_mg_verify_notify_request(Ev) +%% end. + +%% otp72923_mg_verify_notify_request( +%% {handle_trans_request, _, ?VERSION, [AR]}) -> +%% io:format("otp72923_mg_verify_notify_request -> ok" +%% "~n AR: ~p~n", [AR]), +%% case AR of +%% #'ActionRequest'{contextId = 1 = Cid, +%% commandRequests = [CR]} -> +%% #'CommandRequest'{command = Cmd} = CR, +%% {notifyReq, NR} = Cmd, +%% #'NotifyRequest'{terminationID = [Tid], +%% observedEventsDescriptor = OED, +%% errorDescriptor = asn1_NOVALUE} = NR, +%% #'ObservedEventsDescriptor'{observedEventLst = [OE]} = OED, +%% #'ObservedEvent'{eventName = "al/of"} = OE, +%% Reply = {discard_ack, [otp72923_mg_notify_reply_ar(Cid, Tid)]}, +%% {ok, AR, Reply}; +%% _ -> +%% ED = otp72923_err_desc(AR), +%% ErrReply = {discard_ack, ED}, +%% {error, AR, ErrReply} +%% end; +%% otp72923_mg_verify_notify_request(Else) -> +%% io:format("otp72923_mg_verify_notify_request -> unknown" +%% "~n Else: ~p~n", [Else]), +%% ED = otp72923_err_desc(Else), +%% ErrReply = {discard_ack, ED}, +%% {error, Else, ErrReply}. otp72923_mg_verify_notify_reply({handle_trans_reply, _CH, ?VERSION, {ok, [AR]}, _}) -> @@ -8998,17 +9057,17 @@ otp72923_mg_service_change_request_ar(_Mid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -otp72923_mg_service_change_request_msg(Mid, TransId, Cid) -> - AR = otp72923_mg_service_change_request_ar(Mid, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp72923_mg_service_change_request_msg(Mid, TransId, Cid) -> +%% AR = otp72923_mg_service_change_request_ar(Mid, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). -otp72923_mg_notify_reply_ar(Cid, TermId) -> - NR = cre_notifyReply([TermId]), - CR = cre_cmdReply(NR), - cre_actionReply(Cid, [CR]). +%% otp72923_mg_notify_reply_ar(Cid, TermId) -> +%% NR = cre_notifyReply([TermId]), +%% CR = cre_cmdReply(NR), +%% cre_actionReply(Cid, [CR]). otp72923_mg_notify_request_ar(Rid, Tid, Cid) -> TT = cre_timeNotation("19990729", "22000000"), @@ -9019,12 +9078,12 @@ otp72923_mg_notify_request_ar(Rid, Tid, Cid) -> CR = cre_cmdReq(CMD), cre_actionReq(Cid, [CR]). -otp72923_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> - AR = otp72923_mg_notify_request_ar(Rid, TermId, Cid), - TR = cre_transReq(TransId, [AR]), - Trans = cre_transaction(TR), - Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), - cre_megacoMessage(Mess). +%% otp72923_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> +%% AR = otp72923_mg_notify_request_ar(Rid, TermId, Cid), +%% TR = cre_transReq(TransId, [AR]), +%% Trans = cre_transaction(TR), +%% Mess = cre_message(?VERSION, Mid, cre_transactions([Trans])), +%% cre_megacoMessage(Mess). %% @@ -9032,9 +9091,7 @@ otp72923_notify_request_msg(Mid, TransId, Rid, TermId, Cid) -> %% otp72923_err_desc(T) -> - EC = ?megaco_internal_gateway_error, - ET = lists:flatten(io_lib:format("~w",[T])), - #'ErrorDescriptor'{errorCode = EC, errorText = ET}. + cre_ErrDesc(T). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -9065,10 +9122,10 @@ cre_timeNotation(D,T) -> cre_obsEvent(Name, Not) -> #'ObservedEvent'{eventName = Name, timeNotation = Not}. -cre_obsEvent(Name, Not, Par) -> - #'ObservedEvent'{eventName = Name, - timeNotation = Not, - eventParList = Par}. +%% cre_obsEvent(Name, Not, Par) -> +%% #'ObservedEvent'{eventName = Name, +%% timeNotation = Not, +%% eventParList = Par}. cre_obsEvsDesc(Id, EvList) -> #'ObservedEventsDescriptor'{requestId = Id, @@ -9090,9 +9147,9 @@ cre_actionReq(CtxId, CmdReqs) when is_list(CmdReqs) -> #'ActionRequest'{contextId = CtxId, commandRequests = CmdReqs}. -cre_transReq(TransId, ARs) when is_list(ARs) -> - #'TransactionRequest'{transactionId = TransId, - actions = ARs}. +%% cre_transReq(TransId, ARs) when is_list(ARs) -> +%% #'TransactionRequest'{transactionId = TransId, +%% actions = ARs}. %% -- @@ -9120,14 +9177,14 @@ cre_actionReply(CtxId, CmdRep) -> #'ActionReply'{contextId = CtxId, commandReply = CmdRep}. -cre_transResult(ED) when is_record(ED, 'ErrorDescriptor') -> - {transactionError, ED}; -cre_transResult([AR|_] = ARs) when is_record(AR, 'ActionReply') -> - {actionReplies, ARs}. +%% cre_transResult(ED) when is_record(ED, 'ErrorDescriptor') -> +%% {transactionError, ED}; +%% cre_transResult([AR|_] = ARs) when is_record(AR, 'ActionReply') -> +%% {actionReplies, ARs}. -cre_transReply(TransId, Res) -> - #'TransactionReply'{transactionId = TransId, - transactionResult = Res}. +%% cre_transReply(TransId, Res) -> +%% #'TransactionReply'{transactionId = TransId, +%% transactionResult = Res}. %% -- @@ -9136,48 +9193,48 @@ cre_serviceChangeProf(Name, Ver) when is_list(Name) andalso is_integer(Ver) -> #'ServiceChangeProfile'{profileName = Name, version = Ver}. -cre_transaction(Trans) when is_record(Trans, 'TransactionRequest') -> - {transactionRequest, Trans}; -cre_transaction(Trans) when is_record(Trans, 'TransactionPending') -> - {transactionPending, Trans}; -cre_transaction(Trans) when is_record(Trans, 'TransactionReply') -> - {transactionReply, Trans}; -cre_transaction(Trans) when is_record(Trans, 'TransactionAck') -> - {transactionResponseAck, Trans}. - -cre_transactions(Trans) when is_list(Trans) -> - {transactions, Trans}. - -cre_message(Version, Mid, Body) -> - #'Message'{version = Version, - mId = Mid, - messageBody = Body}. - -cre_megacoMessage(Mess) -> - #'MegacoMessage'{mess = Mess}. +%% cre_transaction(Trans) when is_record(Trans, 'TransactionRequest') -> +%% {transactionRequest, Trans}; +%% cre_transaction(Trans) when is_record(Trans, 'TransactionPending') -> +%% {transactionPending, Trans}; +%% cre_transaction(Trans) when is_record(Trans, 'TransactionReply') -> +%% {transactionReply, Trans}; +%% cre_transaction(Trans) when is_record(Trans, 'TransactionAck') -> +%% {transactionResponseAck, Trans}. + +%% cre_transactions(Trans) when is_list(Trans) -> +%% {transactions, Trans}. + +%% cre_message(Version, Mid, Body) -> +%% #'Message'{version = Version, +%% mId = Mid, +%% messageBody = Body}. + +%% cre_megacoMessage(Mess) -> +%% #'MegacoMessage'{mess = Mess}. %% %% Common functions %% -encode_msg_fun(Mod, Conf) -> - fun(M) -> - Mod:encode_message(Conf, M) - end. -encode_msg_fun(Mod, Conf, Ver) -> - fun(M) -> - Mod:encode_message(Conf, Ver, M) - end. - -decode_msg_fun(Mod, Conf) -> - fun(M) -> - Mod:decode_message(Conf, M) - end. -decode_msg_fun(Mod, Conf, Ver) -> - fun(M) -> - Mod:decode_message(Conf, Ver, M) - end. +%% encode_msg_fun(Mod, Conf) -> +%% fun(M) -> +%% Mod:encode_message(Conf, M) +%% end. +%% encode_msg_fun(Mod, Conf, Ver) -> +%% fun(M) -> +%% Mod:encode_message(Conf, Ver, M) +%% end. + +%% decode_msg_fun(Mod, Conf) -> +%% fun(M) -> +%% Mod:decode_message(Conf, M) +%% end. +%% decode_msg_fun(Mod, Conf, Ver) -> +%% fun(M) -> +%% Mod:decode_message(Conf, Ver, M) +%% end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -9193,7 +9250,7 @@ await_ack(User, N, Timeout, Expected) when (N > 0) andalso is_integer(Timeout) - d("await_ack -> received another ack"), await_ack(User, N-1, Timeout - (tim() - T), Expected); {ack_received, User, UnExpected} -> - d("await_ack -> unexpected ack result: ~p", [UnExpected]), + e("await_ack -> unexpected ack result: ~p", [UnExpected]), exit({unexpected_ack_result, UnExpected, Expected}) after Timeout -> exit({await_ack_timeout, N}) @@ -9205,72 +9262,42 @@ await_ack(User, N, infinity, Expected) when N > 0 -> d("await_ack -> received another ack"), await_ack(User, N-1, infinity, Expected); {ack_received, User, UnExpected} -> - d("await_ack -> unexpected ack result: ~p", [UnExpected]), + e("await_ack -> unexpected ack result: ~p", [UnExpected]), exit({unexpected_ack_result, UnExpected, Expected}) end. -await_req(_User, 0, Timeout) -> - d("await_req -> done when Timeout = ~p", [Timeout]), - ok; -await_req(User, N, Timeout) when (N > 0) andalso is_integer(Timeout) -> - d("await_req -> entry with N: ~p, Timeout: ~p", [N,Timeout]), - T = tim(), - receive - {req_received, User, ARs} -> - d("await_req -> received req(s) when N = ~w", [N]), - N1 = await_req1(N, ARs), - await_req(User, N1, Timeout - (tim() - T)) - after Timeout -> - exit({await_req_timeout, N}) - end; -await_req(User, N, infinity) when N > 0 -> - d("await_req -> entry with N: ~p", [N]), - receive - {req_received, User, ARs} -> - d("await_req -> received req(s) when N = ~2",[N]), - N1 = await_req1(N, ARs), - await_req(User, N1, infinity) - end. - -await_req1(N, []) when N >= 0 -> - N; -await_req1(N, [AR|ARs]) when (N > 0) andalso is_record(AR, 'ActionRequest') -> - await_req1(N-1, ARs); -await_req1(N, ARs) -> - exit({unexpected_req_result, N, ARs}). - -% await_rep(_User, 0, Timeout) -> -% d("await_rep -> done when Timeout = ~p", [Timeout]), -% ok; -% await_rep(User, N, Timeout) when N > 0, integer(Timeout) -> -% d("await_rep -> entry with N: ~p, Timeout: ~p", [N,Timeout]), -% T = tim(), -% receive -% {rep_received, User, ARs} -> -% d("await_rep -> received rep(s)"), -% N1 = await_rep1(N, ARs), -% await_rep(User, N1, Timeout - (tim() - T)) -% after Timeout -> -% exit({await_rep_timeout, N}) -% end; -% await_rep(User, N, infinity) when N > 0 -> -% d("await_rep -> entry with N: ~p", [N]), -% receive -% {rep_received, User, ARs} -> -% d("await_rep -> received rep(s)"), -% N1 = await_rep1(N, ARs), -% await_rep(User, N1, infinity) -% end. - -% await_rep1(N, []) when N >= 0 -> -% N; -% await_rep1(N, [AR|ARs]) when N > 0, record(AR, 'ActionReply') -> -% await_rep1(N-1, ARs); -% await_rep1(N, ARs) -> -% exit({unexpected_rep_result, N, ARs}). +%% await_req(_User, 0, Timeout) -> +%% d("await_req -> done when Timeout = ~p", [Timeout]), +%% ok; +%% await_req(User, N, Timeout) when (N > 0) andalso is_integer(Timeout) -> +%% d("await_req -> entry with N: ~p, Timeout: ~p", [N,Timeout]), +%% T = tim(), +%% receive +%% {req_received, User, ARs} -> +%% d("await_req -> received req(s) when N = ~w", [N]), +%% N1 = await_req1(N, ARs), +%% await_req(User, N1, Timeout - (tim() - T)) +%% after Timeout -> +%% exit({await_req_timeout, N}) +%% end; +%% await_req(User, N, infinity) when N > 0 -> +%% d("await_req -> entry with N: ~p", [N]), +%% receive +%% {req_received, User, ARs} -> +%% d("await_req -> received req(s) when N = ~2",[N]), +%% N1 = await_req1(N, ARs), +%% await_req(User, N1, infinity) +%% end. + +%% await_req1(N, []) when N >= 0 -> +%% N; +%% await_req1(N, [AR|ARs]) when (N > 0) andalso is_record(AR, 'ActionRequest') -> +%% await_req1(N-1, ARs); +%% await_req1(N, ARs) -> +%% exit({unexpected_req_result, N, ARs}). tim() -> - {A,B,C} = erlang:now(), + {A,B,C} = erlang:timestamp(), A*1000000000+B*1000+(C div 1000). @@ -9291,7 +9318,8 @@ await_completion(Ids) -> d("OK => Reply: ~n~p", [Reply]), ok; {error, Reply} -> - d("ERROR => Reply: ~n~p", [Reply]), + e("await completion failed: " + "~n ~p", [Reply]), ?ERROR({failed, Reply}) end. @@ -9301,7 +9329,9 @@ await_completion(Ids, Timeout) -> d("OK => Reply: ~n~p", [Reply]), ok; {error, Reply} -> - d("ERROR => Reply: ~n~p", [Reply]), + e("await completion failed: " + "~n ~p" + "~n ~p", [Timeout, Reply]), ?ERROR({failed, Reply}) end. @@ -9310,64 +9340,71 @@ await_completion(Ids, Timeout) -> sleep(X) -> receive after X -> ok end. -error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). +%% error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% e(F) -> +%% e(F, []). + +e(F, A) -> + print(error, "ERR", F, A). + + i(F) -> i(F, []). i(F, A) -> - print(info, get(verbosity), now(), get(tc), "INF", F, A). + print(info, "INF", F, A). d(F) -> d(F, []). d(F, A) -> - print(debug, get(verbosity), now(), get(tc), "DBG", F, A). + print(debug, "DBG", F, A). -printable(_, debug) -> true; -printable(info, info) -> true; -printable(_,_) -> false. +print(Severity, P, F, A) -> + print2(printable(Severity), P, F, A). -print(Severity, Verbosity, Ts, Tc, P, F, A) -> - print(printable(Severity,Verbosity), Ts, Tc, P, F, A). +printable(Sev) -> + printable(Sev, get(verbosity)). -print(true, Ts, Tc, P, F, A) -> - io:format("*** [~s] ~s ~p ~s:~w ***" - "~n " ++ F ++ "~n", - [format_timestamp(Ts), P, self(), get(tc), Tc | A]); -print(_, _, _, _, _, _) -> +printable(_, debug) -> true; +printable(info, info) -> true; +printable(error, _) -> true; +printable(_,_) -> false. + + +print2(true, P, F, A) -> + TS = erlang:timestamp(), + TC = get(tc), + S = ?F("*** [~s] ~s ~p ~w ***" + "~n " ++ F ++ "~n" + "~n", [megaco:format_timestamp(TS), P, self(), TC | A]), + io:format("~s", [S]), + io:format(user, "~s", [S]); +print2(_, _, _, _) -> ok. p(F, A) -> io:format("*** [~s] ***" "~n " ++ F ++ "~n", - [format_timestamp(now()) | A]). + [megaco:format_timestamp(erlang:timestamp()) | A]). -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -random_init() -> - {A,B,C} = now(), - random:seed(A,B,C). -random() -> - 10 * random:uniform(50). +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -apply_load_timer() -> - erlang:send_after(random(), self(), apply_load_timeout). +%% random_init() -> +%% {A,B,C} = erlang:timestamp(), +%% random:seed(A,B,C). +%% random() -> +%% 10 * random:uniform(50). -format_timestamp({_N1, _N2, N3} = Now) -> - {Date, Time} = calendar:now_to_datetime(Now), - {YYYY,MM,DD} = Date, - {Hour,Min,Sec} = Time, - FormatDate = - io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", - [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), - lists:flatten(FormatDate). +%% apply_load_timer() -> +%% erlang:send_after(random(), self(), apply_load_timeout). |