aboutsummaryrefslogtreecommitdiffstats
path: root/lib/megaco
diff options
context:
space:
mode:
Diffstat (limited to 'lib/megaco')
-rw-r--r--lib/megaco/Makefile11
-rw-r--r--lib/megaco/doc/src/megaco_edist_compress.xml8
-rw-r--r--lib/megaco/doc/src/megaco_encoder.xml11
-rw-r--r--lib/megaco/doc/src/megaco_user.xml2
-rw-r--r--lib/megaco/examples/simple/megaco_simple_mgc.erl19
-rw-r--r--lib/megaco/src/app/megaco.app.src1
-rw-r--r--lib/megaco/src/app/megaco.erl16
-rw-r--r--lib/megaco/src/binary/megaco_binary_encoder_lib.erl7
-rw-r--r--lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl4
-rw-r--r--lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl4
-rw-r--r--lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl4
-rw-r--r--lib/megaco/src/binary/megaco_binary_name_resolver_v1.erl4
-rw-r--r--lib/megaco/src/binary/megaco_binary_name_resolver_v2.erl4
-rw-r--r--lib/megaco/src/binary/megaco_binary_name_resolver_v3.erl4
-rw-r--r--lib/megaco/src/engine/depend.mk6
-rw-r--r--lib/megaco/src/engine/megaco_edist_compress.erl25
-rw-r--r--lib/megaco/src/engine/megaco_encoder.erl118
-rw-r--r--lib/megaco/src/engine/megaco_messenger.erl4
-rw-r--r--lib/megaco/src/engine/megaco_user.erl386
-rw-r--r--lib/megaco/src/engine/modules.mk3
-rw-r--r--lib/megaco/src/text/megaco_text_gen_prev3a.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_gen_prev3b.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_gen_prev3c.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_gen_v1.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_gen_v2.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_gen_v3.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_mini_parser.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_parser_prev3a.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_parser_prev3b.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_parser_prev3c.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_parser_v1.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_parser_v2.hrl3
-rw-r--r--lib/megaco/src/text/megaco_text_parser_v3.hrl3
-rw-r--r--lib/megaco/test/megaco_examples_test.erl326
-rw-r--r--lib/megaco/test/megaco_mess_test.erl59
-rw-r--r--lib/megaco/test/megaco_mib_test.erl186
-rw-r--r--lib/megaco/test/megaco_test_lib.erl104
-rw-r--r--lib/megaco/test/megaco_test_lib.hrl9
-rw-r--r--lib/megaco/test/megaco_timer_test.erl26
-rw-r--r--lib/megaco/test/megaco_trans_test.erl1847
40 files changed, 2093 insertions, 1144 deletions
diff --git a/lib/megaco/Makefile b/lib/megaco/Makefile
index 1d0bb6778c..f385df6a5c 100644
--- a/lib/megaco/Makefile
+++ b/lib/megaco/Makefile
@@ -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.
@@ -206,11 +206,18 @@ $(APP_TAR_FILE): $(APP_DIR)
dialyzer_plt: $(DIA_PLT)
-$(DIA_PLT):
+$(DIA_PLT): Makefile
@echo "Building $(APPLICATION) plt file"
@dialyzer --build_plt \
--output_plt $@ \
-r ../$(APPLICATION)/ebin \
+ ../../lib/kernel/ebin \
+ ../../lib/stdlib/ebin \
+ ../../lib/runtime_tools/ebin \
+ ../../lib/asn1/ebin \
+ ../../lib/debugger/ebin \
+ ../../lib/et/ebin \
+ ../../erts/preloaded/ebin \
--output $(DIA_ANALYSIS) \
--verbose
diff --git a/lib/megaco/doc/src/megaco_edist_compress.xml b/lib/megaco/doc/src/megaco_edist_compress.xml
index 16443e469c..8461c59a00 100644
--- a/lib/megaco/doc/src/megaco_edist_compress.xml
+++ b/lib/megaco/doc/src/megaco_edist_compress.xml
@@ -43,8 +43,8 @@
<name since="">Module:encode(R, Version) -> T</name>
<fsummary>Encode (compress) a megaco component.</fsummary>
<type>
- <v>R = megaco_message() | transaction() | action_reply() | action_request() | command_request()</v>
- <v>Version = integer()</v>
+ <v>R = megaco_encoder:megaco_message() | megaco_encoder:transaction() | megaco_encoder:action_reply() | megaco_encoder:action_request() | megaco_encoder:command_request()</v>
+ <v>Version = megaco_encoder:protocol_version()</v>
<v>T = term()</v>
</type>
<desc>
@@ -57,8 +57,8 @@
<fsummary>Decode (decompress) a megaco component.</fsummary>
<type>
<v>T = term()</v>
- <v>Version = integer()</v>
- <v>R = megaco_message() | transaction() | action_reply() | action_request() | command_request()</v>
+ <v>Version = megaco_encoder:protocol_version()</v>
+ <v>R = megaco_encoder:megaco_message() | megaco_encoder:transaction() | megaco_encoder:action_reply() | megaco_encoder:action_request() | megaco_encoder:command_request()</v>
</type>
<desc>
<p>Decompress a megaco component. </p>
diff --git a/lib/megaco/doc/src/megaco_encoder.xml b/lib/megaco/doc/src/megaco_encoder.xml
index cc8270440b..0632a55d48 100644
--- a/lib/megaco/doc/src/megaco_encoder.xml
+++ b/lib/megaco/doc/src/megaco_encoder.xml
@@ -42,7 +42,16 @@
<section>
<title>DATA TYPES</title>
+ <note>
+ <p>Note that the actual definition of (some of) these records depend on
+ the megaco protocol version used. For instance, the
+ <c>'TransactionReply'</c> record
+ has two more fields in version 3, so a simple erlang type definition
+ cannot be made here. </p>
+ </note>
<code type="none"><![CDATA[
+protocol_version() = integer()
+segment_no() = integer()
megaco_message() = #'MegacoMessage{}'
transaction() = {transactionRequest, transaction_request()} |
{transactionPending, transaction_reply()} |
@@ -57,6 +66,8 @@ transaction_ack() = #'TransactionAck'{}
segment_reply() = #'SegmentReply'{}
action_request() = #'ActionRequest'{}
action_reply() = #'ActionReply'{}
+command_request() = #'CommandRequest'{}
+error_desc() = #'ErrorDescriptor'{}
]]></code>
<marker id="encode_message"></marker>
diff --git a/lib/megaco/doc/src/megaco_user.xml b/lib/megaco/doc/src/megaco_user.xml
index 198f2aa24c..56d4d51cde 100644
--- a/lib/megaco/doc/src/megaco_user.xml
+++ b/lib/megaco/doc/src/megaco_user.xml
@@ -165,7 +165,7 @@ protocol_version() = integer() ]]></code>
<funcs>
<func>
<name since="">handle_connect(ConnHandle, ProtocolVersion) -> ok | error | {error,ErrorDescr}</name>
- <name since="">handle_connect(ConnHandle, ProtocolVersion, Extra]) -> ok | error | {error,ErrorDescr}</name>
+ <name since="">handle_connect(ConnHandle, ProtocolVersion, Extra) -> ok | error | {error,ErrorDescr}</name>
<fsummary>Invoked when a new connection is established</fsummary>
<type>
<v>ConnHandle = conn_handle()</v>
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/src/app/megaco.app.src b/lib/megaco/src/app/megaco.app.src
index c54c80351c..5fb7273b4a 100644
--- a/lib/megaco/src/app/megaco.app.src
+++ b/lib/megaco/src/app/megaco.app.src
@@ -107,6 +107,7 @@
megaco_udp,
megaco_udp_server,
megaco_udp_sup,
+ megaco_user,
megaco_user_default
]},
{registered, [megaco_config, megaco_monitor,
diff --git a/lib/megaco/src/app/megaco.erl b/lib/megaco/src/app/megaco.erl
index f0c209fd6c..9ed042401b 100644
--- a/lib/megaco/src/app/megaco.erl
+++ b/lib/megaco/src/app/megaco.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.
@@ -94,6 +94,11 @@
%% This is for XREF
-deprecated([{format_versions, 1, eventually}]).
+-export_type([
+ void/0
+ ]).
+
+-type void() :: term().
-include("megaco_internal.hrl").
@@ -686,13 +691,8 @@ sys_info() ->
[{arch, SysArch}, {ver, SysVer}].
os_info() ->
- V = os:version(),
- case os:type() of
- {OsFam, OsName} ->
- [{fam, OsFam}, {name, OsName}, {ver, V}];
- OsFam ->
- [{fam, OsFam}, {ver, V}]
- end.
+ {OsFam, OsName} = os:type(),
+ [{fam, OsFam}, {name, OsName}, {ver, os:version()}].
ms() ->
ms1().
diff --git a/lib/megaco/src/binary/megaco_binary_encoder_lib.erl b/lib/megaco/src/binary/megaco_binary_encoder_lib.erl
index 5e9836dc48..fdbb42c2f8 100644
--- a/lib/megaco/src/binary/megaco_binary_encoder_lib.erl
+++ b/lib/megaco/src/binary/megaco_binary_encoder_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -141,6 +141,7 @@ encode_transaction(_EC, T, _AsnMod, _TransMod, _Type) ->
TransMod :: atom(),
Type :: atom()) ->
{'ok', binary()} | {'error', any()}.
+-dialyzer({nowarn_function, do_encode_transaction/5}). % Future compat
do_encode_transaction([native], _Trans, _AsnMod, _TransMod, binary) ->
%% asn1rt:encode(AsnMod, element(1, T), T);
{error, not_implemented};
@@ -173,6 +174,7 @@ do_encode_transaction(EC, _Trans, _AsnMod, _TransMod, _Type) ->
TransMod :: atom(),
Type :: atom()) ->
{'ok', binary()} | {'error', any()}.
+-dialyzer({nowarn_function, encode_action_requests/5}). % Future compat
encode_action_requests([native], _ARs, _AsnMod, _TransMod, binary) ->
%% asn1rt:encode(AsnMod, element(1, T), T);
{error, not_implemented};
@@ -203,6 +205,7 @@ encode_action_requests(EC, _ARs, _AsnMod, _TransMod, _Type) ->
TransMod :: atom(),
Type :: atom()) ->
{'ok', binary()} | {'error', any()}.
+-dialyzer({nowarn_function, encode_action_request/5}). % Future compat
encode_action_request([native], _AR, _AsnMod, _TransMod, binary) ->
%% asn1rt:encode(AsnMod, element(1, T), T);
{error, not_implemented};
@@ -226,6 +229,8 @@ encode_action_request(EC, _AR, _AsnMod, _TransMod, _Type) ->
%% Convert a ActionReply record into a binary
%% Return {ok, DeepIoList} | {error, Reason}
%%----------------------------------------------------------------------
+
+-dialyzer({nowarn_function, encode_action_reply/5}). % Future compat
encode_action_reply([native], _ARs, _AsnMod, _TransMod, binary) ->
%% asn1rt:encode(AsnMod, element(1, T), T);
{error, not_implemented};
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl
index af97056d5d..f9e3fe39e3 100644
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl
+++ b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2004-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.
@@ -1715,7 +1715,7 @@ decode_nt({event_parameter, Item}, SubItem) ->
[16#00, 16#01] -> "cs"
end;
[16#00, 16#06] -> % Event qualert
- case Item of
+ case SubItem of
[16#00, 16#01] -> "th"
end
end;
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl
index b543abe7c8..141225f501 100644
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl
+++ b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -1715,7 +1715,7 @@ decode_nt({event_parameter, Item}, SubItem) ->
[16#00, 16#01] -> "cs"
end;
[16#00, 16#06] -> % Event qualert
- case Item of
+ case SubItem of
[16#00, 16#01] -> "th"
end
end;
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl
index 827cb3920b..b27a0be26e 100644
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl
+++ b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -1716,7 +1716,7 @@ decode_nt({event_parameter, Item}, SubItem) ->
[16#00, 16#01] -> "cs"
end;
[16#00, 16#06] -> % Event qualert
- case Item of
+ case SubItem of
[16#00, 16#01] -> "th"
end
end;
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_v1.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_v1.erl
index 1fba60fed6..aba64bb9f2 100644
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_v1.erl
+++ b/lib/megaco/src/binary/megaco_binary_name_resolver_v1.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2000-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2000-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.
@@ -1325,7 +1325,7 @@ decode_nt({event_parameter, Item}, SubItem) ->
[16#00, 16#01] -> "cs"
end;
[16#00, 16#06] -> % Event qualert
- case Item of
+ case SubItem of
[16#00, 16#01] -> "th"
end
end;
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_v2.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_v2.erl
index 45b9b32772..dd07f8b404 100644
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_v2.erl
+++ b/lib/megaco/src/binary/megaco_binary_name_resolver_v2.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.
@@ -1393,7 +1393,7 @@ decode_nt({event_parameter, Item}, SubItem) ->
[16#00, 16#01] -> "cs"
end;
[16#00, 16#06] -> % Event qualert
- case Item of
+ case SubItem of
[16#00, 16#01] -> "th"
end
end;
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_v3.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_v3.erl
index f1482bc252..a8c4211235 100644
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_v3.erl
+++ b/lib/megaco/src/binary/megaco_binary_name_resolver_v3.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -1728,7 +1728,7 @@ decode_nt({event_parameter, Item}, SubItem) ->
[16#00, 16#01] -> "cs"
end;
[16#00, 16#06] -> % Event qualert
- case Item of
+ case SubItem of
[16#00, 16#01] -> "th"
end
end;
diff --git a/lib/megaco/src/engine/depend.mk b/lib/megaco/src/engine/depend.mk
index 96ee337e3a..ba919659db 100644
--- a/lib/megaco/src/engine/depend.mk
+++ b/lib/megaco/src/engine/depend.mk
@@ -2,7 +2,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.
@@ -78,6 +78,10 @@ $(EBIN)/megaco_transport.$(EMULATOR): megaco_transport.erl
$(EBIN)/megaco_user.$(EMULATOR): megaco_user.erl
+$(EBIN)/megaco_user.$(EMULATOR): megaco_user.erl \
+ ../../include/megaco.hrl \
+ ../../include/megaco_message_v1.hrl
+
$(EBIN)/megaco_user_default.$(EMULATOR): megaco_user_default.erl \
../../include/megaco.hrl \
../../include/megaco_message_v1.hrl
diff --git a/lib/megaco/src/engine/megaco_edist_compress.erl b/lib/megaco/src/engine/megaco_edist_compress.erl
index 987a5ec717..968ab6f16e 100644
--- a/lib/megaco/src/engine/megaco_edist_compress.erl
+++ b/lib/megaco/src/engine/megaco_edist_compress.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2007-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.
@@ -25,10 +25,21 @@
-module(megaco_edist_compress).
--export([behaviour_info/1]).
+-callback encode(R, Version) -> T when
+ R :: megaco_encoder:megaco_message() |
+ megaco_encoder:transaction() |
+ megaco_encoder:action_reply() |
+ megaco_encoder:action_request() |
+ megaco_encoder:command_request(),
+ Version :: megaco_encoder:protocol_version(),
+ T :: term().
+
+-callback decode(T, Version) -> R when
+ T :: term(),
+ Version :: megaco_encoder:protocol_version() | dynamic,
+ R :: megaco_encoder:megaco_message() |
+ megaco_encoder:transaction() |
+ megaco_encoder:action_reply() |
+ megaco_encoder:action_request() |
+ megaco_encoder:command_request().
-behaviour_info(callbacks) ->
- [{encode,2},
- {decode,2}];
-behaviour_info(_) ->
- undefined.
diff --git a/lib/megaco/src/engine/megaco_encoder.erl b/lib/megaco/src/engine/megaco_encoder.erl
index 7ade349083..dd5a3458fc 100644
--- a/lib/megaco/src/engine/megaco_encoder.erl
+++ b/lib/megaco/src/engine/megaco_encoder.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.
@@ -25,14 +25,108 @@
-module(megaco_encoder).
--export([behaviour_info/1]).
-
-behaviour_info(callbacks) ->
- [{encode_message, 3},
- {decode_message, 3},
- {decode_mini_message, 3},
- {encode_transaction, 3},
- {encode_action_requests, 3},
- {encode_action_reply, 3}];
-behaviour_info(_) ->
- undefined.
+-export_type([
+ protocol_version/0,
+ segment_no/0,
+ megaco_message/0,
+ transaction/0,
+ transaction_request/0,
+ transaction_pending/0,
+ transaction_reply/0,
+ transaction_response_ack/0,
+ transaction_ack/0,
+ segment_reply/0,
+ action_request/0,
+ action_reply/0,
+ command_request/0,
+ error_desc/0
+ ]).
+
+
+-include("megaco_message_internal.hrl").
+
+-type protocol_version() :: integer().
+-type segment_no() :: integer().
+-type megaco_message() :: #'MegacoMessage'{}.
+-type transaction() :: {transactionRequest, transaction_request()} |
+ {transactionPending, transaction_reply()} |
+ {transactionReply, transaction_pending()} |
+ {transactionResponseAck, transaction_response_ack()} |
+ {segmentReply, segment_reply()}.
+-type transaction_request() :: #'TransactionRequest'{}.
+-type transaction_pending() :: #'TransactionPending'{}.
+%% The problem with TransactionReply is that its definition depend
+%% on which version of the protocol we are using. As of version 3,
+%% it has two more fields.
+%% -type transaction_reply() :: #'TransactionReply'{}.
+-type transaction_reply() :: {'TransactionReply', _, _} |
+ {'TransactionReply', _, _, _, _}.
+-type transaction_response_ack() :: [transaction_ack()].
+-type transaction_ack() :: #'TransactionAck'{}.
+-type segment_reply() :: #'SegmentReply'{}.
+%% -type action_request() :: #'ActionRequest'{}.
+-type action_request() :: {'ActionRequest', _, _, _, _}.
+%% -type action_reply() :: #'ActionReply'{}.
+-type action_reply() :: {'ActionReply', _, _, _}.
+%% -type command_request() :: #'CommandRequest'{}.
+-type command_request() :: {'CommandRequest', _, _, _}.
+-type error_desc() :: #'ErrorDescriptor'{}.
+
+-callback encode_message(EncodingConfig,
+ Version,
+ Message) -> {ok, Bin} | Error when
+ EncodingConfig :: list(),
+ Version :: protocol_version(),
+ Message :: megaco_message(),
+ Bin :: binary(),
+ Error :: term().
+
+-callback decode_message(EncodingConfig,
+ Version,
+ Bin) -> {ok, Message} | Error when
+ EncodingConfig :: list(),
+ Version :: protocol_version() | dynamic,
+ Bin :: binary(),
+ Message :: megaco_message(),
+ Error :: term().
+
+-callback decode_mini_message(EncodingConfig,
+ Version,
+ Bin) -> {ok, Message} | Error when
+ EncodingConfig :: list(),
+ Version :: protocol_version() | dynamic,
+ Bin :: binary(),
+ Message :: megaco_message(),
+ Error :: term().
+
+-callback encode_transaction(EncodingConfig,
+ Version,
+ Transaction) -> {ok, Bin} | {error, Reason} when
+ EncodingConfig :: list(),
+ Version :: protocol_version(),
+ Transaction :: transaction(),
+ Bin :: binary(),
+ Reason :: not_implemented | term().
+
+-callback encode_action_requests(EncodingConfig,
+ Version,
+ ARs) -> {ok, Bin} | {error, Reason} when
+ EncodingConfig :: list(),
+ Version :: protocol_version(),
+ ARs :: [action_request()],
+ Bin :: binary(),
+ Reason :: not_implemented | term().
+
+-callback encode_action_reply(EncodingConfig,
+ Version,
+ AR) -> {ok, Bin} | {error, Reason} when
+ EncodingConfig :: list(),
+ Version :: protocol_version(),
+ AR :: action_reply(),
+ Bin :: binary(),
+ Reason :: not_implemented | term().
+
+-optional_callbacks(
+ [
+ encode_action_reply/3 % Only used if segementation is used
+ ]).
diff --git a/lib/megaco/src/engine/megaco_messenger.erl b/lib/megaco/src/engine/megaco_messenger.erl
index 1d462b2140..2a9ecee2a7 100644
--- a/lib/megaco/src/engine/megaco_messenger.erl
+++ b/lib/megaco/src/engine/megaco_messenger.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.
@@ -1391,7 +1391,7 @@ prepare_request(ConnData, T, Rest, AckList, ReqList, Extra) ->
%% don't restart the reply_timer.
ConnData2 = ConnData#conn_data{protocol_version = Version},
?report_trace(ConnData2,
- "re-send trans reply", [T | {bytes, Bin}]),
+ "re-send trans reply", [T, {bytes, Bin}]),
case megaco_messenger_misc:send_message(ConnData2, true, Bin) of
{ok, _} ->
ok;
diff --git a/lib/megaco/src/engine/megaco_user.erl b/lib/megaco/src/engine/megaco_user.erl
new file mode 100644
index 0000000000..47fb1a119d
--- /dev/null
+++ b/lib/megaco/src/engine/megaco_user.erl
@@ -0,0 +1,386 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2019-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.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+%%
+%%-------------------------------------------------------------------------
+%% Purpose: Megaco user behaviour module
+%%
+%% This callback functions are the default! Its possible for the user to
+%% provide a arbitrary number of "extra" arguments via the user_args
+%% config option.
+%% So, for instance, the handle_connect/2 could instead become
+%% handle_connect/4 if the user sets the user_args option to [foo, bar].
+%% This means that its impossible to define a proper behaviour.
+%% So what we do here is to define a behaviour with the "default interface"
+%% (the user_args option has the [] as the default value) and set them
+%% all to be optional!
+%%-------------------------------------------------------------------------
+
+-module(megaco_user).
+
+-export_type([
+ receive_handle/0,
+ conn_handle/0,
+ megaco_timer/0
+ ]).
+
+-include_lib("megaco/include/megaco.hrl").
+%% -include_lib("megaco/include/megaco_message_v1.hrl").
+
+-type receive_handle() :: #megaco_receive_handle{}.
+-type conn_handle() :: #megaco_conn_handle{}.
+-type megaco_timer() :: infinity | non_neg_integer() | #megaco_incr_timer{}.
+
+-callback handle_connect(ConnHandle, ProtocolVersion) ->
+ ok | error | {error, ErrorDescr} when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ ErrorDescr :: megaco_encoder:error_desc().
+-callback handle_connect(ConnHandle, ProtocolVersion, Extra) ->
+ ok | error | {error, ErrorDescr} when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ Extra :: term(),
+ ErrorDescr :: megaco_encoder:error_desc().
+
+-callback handle_disconnect(ConnHandle, ProtocolVersion, Reason) ->
+ megaco:void() when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ Reason :: term().
+
+-callback handle_syntax_error(ReceiveHandle, ProtocolVersion, DefaultED) ->
+ reply | {reply, ED} | no_reply | {no_reply, ED} when
+ ReceiveHandle :: receive_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ DefaultED :: megaco_encoder:error_desc(),
+ ED :: megaco_encoder:error_desc().
+-callback handle_syntax_error(ReceiveHandle, ProtocolVersion, DefaultED, Extra) ->
+ reply | {reply, ED} | no_reply | {no_reply, ED} when
+ ReceiveHandle :: receive_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ DefaultED :: megaco_encoder:error_desc(),
+ ED :: megaco_encoder:error_desc(),
+ Extra :: term().
+
+-callback handle_message_error(ConnHandle, ProtocolVersion, ErrorDescr) ->
+ megaco:void() when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ ErrorDescr :: megaco_encoder:error_desc().
+-callback handle_message_error(ConnHandle, ProtocolVersion, ErrorDescr, Extra) ->
+ megaco:void() when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ ErrorDescr :: megaco_encoder:error_desc(),
+ Extra :: term().
+
+-callback handle_trans_request(ConnHandle, ProtocolVersion, ActionRequests) ->
+ Pending | Reply | ignore_trans_request when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ ActionRequests :: [megaco_encoder:action_request()],
+ Pending :: {pending, ReqData},
+ ReqData :: term(),
+ Reply :: {AckAction, ActualReply} |
+ {AckAction, ActualReply, SendOptions},
+ AckAction :: discard_ack |
+ {handle_ack, AckData} |
+ {handle_pending_ack, AckData} |
+ {handle_sloppy_ack, AckData},
+ ActualReply :: [megaco_encoder:action_reply()] |
+ megaco_encoder:error_desc(),
+ AckData :: term(),
+ SendOptions :: [SendOption],
+ SendOption :: {reply_timer, megaco_timer()} |
+ {send_handle, term()} |
+ {protocol_version, integer()}.
+-callback handle_trans_request(ConnHandle,
+ ProtocolVersion,
+ ActionRequests,
+ Extra) ->
+ Pending | Reply | ignore_trans_request when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ ActionRequests :: [megaco_encoder:action_request()],
+ Extra :: term(),
+ Pending :: {pending, ReqData},
+ ReqData :: term(),
+ Reply :: {AckAction, ActualReply} |
+ {AckAction, ActualReply, SendOptions},
+ AckAction :: discard_ack |
+ {handle_ack, AckData} |
+ {handle_pending_ack, AckData} |
+ {handle_sloppy_ack, AckData},
+ ActualReply :: [megaco_encoder:action_reply()] |
+ megaco_encoder:error_desc(),
+ AckData :: term(),
+ SendOptions :: [SendOption],
+ SendOption :: {reply_timer, megaco_timer()} |
+ {send_handle, term()} |
+ {protocol_version, integer()}.
+
+-callback handle_trans_long_request(ConnHandle, ProtocolVersion, ReqData) ->
+ Reply when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ ReqData :: term(),
+ Reply :: {AckAction, ActualReply} |
+ {AckAction, ActualReply, SendOptions},
+ AckAction :: discard_ack |
+ {handle_ack, AckData} |
+ {handle_sloppy_ack, AckData},
+ ActualReply :: [megaco_encoder:action_reply()] |
+ megaco_encoder:error_desc(),
+ AckData :: term(),
+ SendOptions :: [SendOption],
+ SendOption :: {reply_timer, megaco_timer()} |
+ {send_handle, term()} |
+ {protocol_version, megaco_encoder:protocol_version()}.
+-callback handle_trans_long_request(ConnHandle, ProtocolVersion, ReqData, Extra) ->
+ Reply when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ ReqData :: term(),
+ Extra :: term(),
+ Reply :: {AckAction, ActualReply} |
+ {AckAction, ActualReply, SendOptions},
+ AckAction :: discard_ack |
+ {handle_ack, AckData} |
+ {handle_sloppy_ack, AckData},
+ ActualReply :: [megaco_encoder:action_reply()] |
+ megaco_encoder:error_desc(),
+ AckData :: term(),
+ SendOptions :: [SendOption],
+ SendOption :: {reply_timer, megaco_timer()} |
+ {send_handle, term()} |
+ {protocol_version, megaco_encoder:protocol_version()}.
+
+-callback handle_trans_reply(ConnHandle,
+ ProtocolVersion,
+ UserReply,
+ ReplyData) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ UserReply :: Success | Failure,
+ ReplyData :: term(),
+ Success :: {ok, Result},
+ Result :: TransactionResult | SegmentResult,
+ TransactionResult :: [megaco_encoder:action_reply()],
+ SegmentResult :: {megaco_encoder:segment_no(),
+ LastSegment,
+ [megaco_encoder:action_reply()]},
+ Failure :: {error, Reason} |
+ {error, ReplyNo, Reason},
+ Reason :: TransactionReason |
+ SegmentReason |
+ UserCancelReason |
+ SendReason |
+ OtherReason,
+ TransactionReason :: megaco_encoder:error_desc(),
+ SegmentReason :: {megaco_encoder:segment_no(),
+ LastSegment,
+ megaco_encoder:error_desc()},
+ OtherReason :: timeout |
+ {segment_timeout, MissingSegments} |
+ exceeded_recv_pending_limit | term(),
+ LastSegment :: boolean(),
+ MissingSegments :: [megaco_encoder:segment_no()],
+ UserCancelReason :: {user_cancel, ReasonForUserCancel},
+ ReasonForUserCancel :: term(),
+ SendReason :: SendCancelledReason | SendFailedReason,
+ SendCancelledReason :: {send_message_cancelled,
+ ReasonForSendCancel},
+ ReasonForSendCancel :: term(),
+ SendFailedReason :: {send_message_failed, ReasonForSendFailure},
+ ReasonForSendFailure :: term(),
+ ReplyNo :: pos_integer().
+-callback handle_trans_reply(ConnHandle,
+ ProtocolVersion,
+ UserReply,
+ ReplyData,
+ Extra) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ UserReply :: Success | Failure,
+ ReplyData :: term(),
+ Extra :: term(),
+ Success :: {ok, Result},
+ Result :: TransactionResult | SegmentResult,
+ TransactionResult :: [megaco_encoder:action_reply()],
+ SegmentResult :: {megaco_encoder:segment_no(),
+ LastSegment,
+ [megaco_encoder:action_reply()]},
+ Failure :: {error, Reason} |
+ {error, ReplyNo, Reason},
+ Reason :: TransactionReason |
+ SegmentReason |
+ UserCancelReason |
+ SendReason |
+ OtherReason,
+ TransactionReason :: megaco_encoder:error_desc(),
+ SegmentReason :: {megaco_encoder:segment_no(),
+ LastSegment,
+ megaco_encoder:error_desc()},
+ OtherReason :: timeout |
+ {segment_timeout, MissingSegments} |
+ exceeded_recv_pending_limit | term(),
+ LastSegment :: boolean(),
+ MissingSegments :: [megaco_encoder:segment_no()],
+ UserCancelReason :: {user_cancel, ReasonForUserCancel},
+ ReasonForUserCancel :: term(),
+ SendReason :: SendCancelledReason | SendFailedReason,
+ SendCancelledReason :: {send_message_cancelled,
+ ReasonForSendCancel},
+ ReasonForSendCancel :: term(),
+ SendFailedReason :: {send_message_failed, ReasonForSendFailure},
+ ReasonForSendFailure :: term(),
+ ReplyNo :: pos_integer().
+
+
+-callback handle_trans_ack(ConnHandle,
+ ProtocolVersion,
+ AckStatus,
+ AckData) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ AckStatus :: ok | {error, Reason},
+ AckData :: term(),
+ Reason :: UserCancelReason | SendReason | OtherReason,
+ UserCancelReason :: {user_cancel, ReasonForUserCancel},
+ ReasonForUserCancel :: term(),
+ SendReason :: SendCancelledReason | SendFailedReason,
+ SendCancelledReason :: {send_message_cancelled, ReasonForSendCancel},
+ ReasonForSendCancel :: term(),
+ SendFailedReason :: {send_message_failed, ReasonForSendFailure},
+ ReasonForSendFailure :: term(),
+ OtherReason :: term().
+-callback handle_trans_ack(ConnHandle,
+ ProtocolVersion,
+ AckStatus,
+ AckData,
+ Extra) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ AckStatus :: ok | {error, Reason},
+ AckData :: term(),
+ Extra :: term(),
+ Reason :: UserCancelReason | SendReason | OtherReason,
+ UserCancelReason :: {user_cancel, ReasonForUserCancel},
+ ReasonForUserCancel :: term(),
+ SendReason :: SendCancelledReason | SendFailedReason,
+ SendCancelledReason :: {send_message_cancelled, ReasonForSendCancel},
+ ReasonForSendCancel :: term(),
+ SendFailedReason :: {send_message_failed, ReasonForSendFailure},
+ ReasonForSendFailure :: term(),
+ OtherReason :: term().
+
+-callback handle_unexpected_trans(ConnHandle, ProtocolVersion, Trans) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ Trans :: megaco_encoder:transaction_pending() |
+ megaco_encoder:transaction_reply() |
+ megaco_encoder:transaction_response_ack().
+-callback handle_unexpected_trans(ConnHandle, ProtocolVersion, Trans, Extra) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ Trans :: megaco_encoder:transaction_pending() |
+ megaco_encoder:transaction_reply() |
+ megaco_encoder:transaction_response_ack(),
+ Extra :: term().
+
+-callback handle_trans_request_abort(ConnHandle,
+ ProtocolVersion,
+ TransNo,
+ Pid) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ TransNo :: integer(),
+ Pid :: undefined | pid().
+-callback handle_trans_request_abort(ConnHandle,
+ ProtocolVersion,
+ TransNo,
+ Pid,
+ Extra) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ TransNo :: integer(),
+ Pid :: undefined | pid(),
+ Extra :: term().
+
+-callback handle_segment_reply(ConnHandle,
+ ProtocolVersion,
+ TransNo,
+ SegNo,
+ SegCompl) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ TransNo :: integer(),
+ SegNo :: integer(),
+ SegCompl :: asn1_NOVALUE | 'NULL'.
+-callback handle_segment_reply(ConnHandle,
+ ProtocolVersion,
+ TransNo,
+ SegNo,
+ SegCompl,
+ Extra) ->
+ ok when
+ ConnHandle :: conn_handle(),
+ ProtocolVersion :: megaco_encoder:protocol_version(),
+ TransNo :: integer(),
+ SegNo :: megaco_encoder:segment_no(),
+ SegCompl :: asn1_NOVALUE | 'NULL',
+ Extra :: term().
+
+-optional_callbacks(
+ [
+ %% The actual number of arguments to *all* functions,
+ %% depend of the user_args config option.
+ handle_connect/2,
+ handle_connect/3,
+ handle_disconnect/3,
+ handle_syntax_error/3,
+ handle_syntax_error/4,
+ handle_message_error/3,
+ handle_message_error/4,
+ handle_trans_request/3,
+ handle_trans_request/4,
+ handle_trans_long_request/3,
+ handle_trans_long_request/4,
+ handle_trans_reply/4,
+ handle_trans_reply/5,
+ handle_trans_ack/4,
+ handle_trans_ack/5,
+ handle_unexpected_trans/3,
+ handle_unexpected_trans/4,
+ handle_trans_request_abort/4,
+ handle_trans_request_abort/5,
+ handle_segment_reply/5,
+ handle_segment_reply/6
+ ]).
diff --git a/lib/megaco/src/engine/modules.mk b/lib/megaco/src/engine/modules.mk
index b74a096e40..a7f82c1836 100644
--- a/lib/megaco/src/engine/modules.mk
+++ b/lib/megaco/src/engine/modules.mk
@@ -2,7 +2,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.
@@ -21,6 +21,7 @@
BEHAVIOUR_MODULES = \
megaco_edist_compress \
megaco_encoder \
+ megaco_user \
megaco_transport
MODULES = \
diff --git a/lib/megaco/src/text/megaco_text_gen_prev3a.hrl b/lib/megaco/src/text/megaco_text_gen_prev3a.hrl
index db7507fd27..4f3c83c6c5 100644
--- a/lib/megaco/src/text/megaco_text_gen_prev3a.hrl
+++ b/lib/megaco/src/text/megaco_text_gen_prev3a.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2017. All Rights Reserved.
+%% Copyright Ericsson AB 2004-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.
@@ -2841,6 +2841,7 @@ enc_integer(Val, _State, Min, Max) ->
enc_list(List, State) ->
enc_list(List, State, fun(_S) -> ?COMMA_INDENT(_S) end, false).
+-dialyzer({nowarn_function, enc_list/4}). % Future compat
enc_list([], _State, _SepEncoder, _NeedsSep) ->
[];
enc_list([{Elems, ElemEncoder} | Tail], State, SepEncoder, NeedsSep) ->
diff --git a/lib/megaco/src/text/megaco_text_gen_prev3b.hrl b/lib/megaco/src/text/megaco_text_gen_prev3b.hrl
index d5f29025c8..de64f8bbdf 100644
--- a/lib/megaco/src/text/megaco_text_gen_prev3b.hrl
+++ b/lib/megaco/src/text/megaco_text_gen_prev3b.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2017. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -2862,6 +2862,7 @@ enc_integer(Val, _State, Min, Max) ->
enc_list(List, State) ->
enc_list(List, State, fun(_S) -> ?COMMA_INDENT(_S) end, false).
+-dialyzer({nowarn_function, enc_list/4}). % Future compat
enc_list([], _State, _SepEncoder, _NeedsSep) ->
[];
enc_list([{Elems, ElemEncoder} | Tail], State, SepEncoder, NeedsSep) ->
diff --git a/lib/megaco/src/text/megaco_text_gen_prev3c.hrl b/lib/megaco/src/text/megaco_text_gen_prev3c.hrl
index 6452be25d0..f73318161f 100644
--- a/lib/megaco/src/text/megaco_text_gen_prev3c.hrl
+++ b/lib/megaco/src/text/megaco_text_gen_prev3c.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2017. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -3338,6 +3338,7 @@ enc_integer(Val, _State, Min, Max) ->
enc_list(List, State) ->
enc_list(List, State, fun(_S) -> ?COMMA_INDENT(_S) end, false).
+-dialyzer({nowarn_function, enc_list/4}). % Future compat
enc_list([], _State, _SepEncoder, _NeedsSep) ->
[];
enc_list([{Elems, ElemEncoder} | Tail], State, SepEncoder, NeedsSep) ->
diff --git a/lib/megaco/src/text/megaco_text_gen_v1.hrl b/lib/megaco/src/text/megaco_text_gen_v1.hrl
index 38a0f6fd6b..6da9ea94ff 100644
--- a/lib/megaco/src/text/megaco_text_gen_v1.hrl
+++ b/lib/megaco/src/text/megaco_text_gen_v1.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2000-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2000-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.
@@ -2303,6 +2303,7 @@ enc_integer(Val, _State, Min, Max) ->
enc_list(List, State) ->
enc_list(List, State, fun(_S) -> ?COMMA_INDENT(_S) end, false).
+-dialyzer({nowarn_function, enc_list/4}). % Future compat
enc_list([], _State, _SepEncoder, _NeedsSep) ->
[];
enc_list([{Elems, ElemEncoder} | Tail], State, SepEncoder, NeedsSep) ->
diff --git a/lib/megaco/src/text/megaco_text_gen_v2.hrl b/lib/megaco/src/text/megaco_text_gen_v2.hrl
index d9443fb2e1..23afa85800 100644
--- a/lib/megaco/src/text/megaco_text_gen_v2.hrl
+++ b/lib/megaco/src/text/megaco_text_gen_v2.hrl
@@ -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.
@@ -2689,6 +2689,7 @@ enc_integer(Val, _State, Min, Max) ->
enc_list(List, State) ->
enc_list(List, State, fun(_S) -> ?COMMA_INDENT(_S) end, false).
+-dialyzer({nowarn_function, enc_list/4}). % Future compat
enc_list([], _State, _SepEncoder, _NeedsSep) ->
[];
enc_list([{Elems, ElemEncoder} | Tail], State, SepEncoder, NeedsSep) ->
diff --git a/lib/megaco/src/text/megaco_text_gen_v3.hrl b/lib/megaco/src/text/megaco_text_gen_v3.hrl
index dc1f2b9665..e440ec6651 100644
--- a/lib/megaco/src/text/megaco_text_gen_v3.hrl
+++ b/lib/megaco/src/text/megaco_text_gen_v3.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -3353,6 +3353,7 @@ enc_integer(Val, _State, Min, Max) ->
enc_list(List, State) ->
enc_list(List, State, fun(_S) -> ?COMMA_INDENT(_S) end, false).
+-dialyzer({nowarn_function, enc_list/4}). % Future compat
enc_list([], _State, _SepEncoder, _NeedsSep) ->
[];
enc_list([{Elems, ElemEncoder} | Tail], State, SepEncoder, NeedsSep) ->
diff --git a/lib/megaco/src/text/megaco_text_mini_parser.hrl b/lib/megaco/src/text/megaco_text_mini_parser.hrl
index 487958af08..72d8168abf 100644
--- a/lib/megaco/src/text/megaco_text_mini_parser.hrl
+++ b/lib/megaco/src/text/megaco_text_mini_parser.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2004-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.
@@ -1167,6 +1167,7 @@ ensure_pathName({_TokenTag, _Line, Text}) ->
% #'PropertyParm'{name = lists:reverse(Name),
% value = [lists:reverse(Value)]}.
+-dialyzer({nowarn_function, ensure_uint/3}). % Future compat
ensure_uint({_TokenTag, Line, Val}, Min, Max) when is_integer(Val) ->
if
is_integer(Min) andalso (Val >= Min) ->
diff --git a/lib/megaco/src/text/megaco_text_parser_prev3a.hrl b/lib/megaco/src/text/megaco_text_parser_prev3a.hrl
index edda850c3a..d7e847993a 100644
--- a/lib/megaco/src/text/megaco_text_parser_prev3a.hrl
+++ b/lib/megaco/src/text/megaco_text_parser_prev3a.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2004-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.
@@ -1589,6 +1589,7 @@ ensure_uint(Token, Min, Max) ->
-ifdef(megaco_parser_inline).
-compile({inline,[{ensure_uint,4}]}).
-endif.
+-dialyzer({nowarn_function, ensure_uint/4}). % Future compat
ensure_uint(Val, Min, Max, Line) ->
if
is_integer(Min) andalso (Val >= Min) ->
diff --git a/lib/megaco/src/text/megaco_text_parser_prev3b.hrl b/lib/megaco/src/text/megaco_text_parser_prev3b.hrl
index 4eaa3733c4..479f963c70 100644
--- a/lib/megaco/src/text/megaco_text_parser_prev3b.hrl
+++ b/lib/megaco/src/text/megaco_text_parser_prev3b.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -1635,6 +1635,7 @@ ensure_uint(Token, Min, Max) ->
-ifdef(megaco_parser_inline).
-compile({inline,[{ensure_uint,4}]}).
-endif.
+-dialyzer({nowarn_function, ensure_uint/4}). % Future compat
ensure_uint(Val, Min, Max, Line) ->
if
is_integer(Min) andalso (Val >= Min) ->
diff --git a/lib/megaco/src/text/megaco_text_parser_prev3c.hrl b/lib/megaco/src/text/megaco_text_parser_prev3c.hrl
index d2faad09d9..3ed9582308 100644
--- a/lib/megaco/src/text/megaco_text_parser_prev3c.hrl
+++ b/lib/megaco/src/text/megaco_text_parser_prev3c.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -1898,6 +1898,7 @@ ensure_uint(Token, Min, Max) ->
-ifdef(megaco_parser_inline).
-compile({inline,[{ensure_uint,4}]}).
-endif.
+-dialyzer({nowarn_function, ensure_uint/4}). % Future compat
ensure_uint(Val, Min, Max, Line) ->
if
is_integer(Min) andalso (Val >= Min) ->
diff --git a/lib/megaco/src/text/megaco_text_parser_v1.hrl b/lib/megaco/src/text/megaco_text_parser_v1.hrl
index f48ac745f0..3a19debba0 100644
--- a/lib/megaco/src/text/megaco_text_parser_v1.hrl
+++ b/lib/megaco/src/text/megaco_text_parser_v1.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2000-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2000-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.
@@ -1337,6 +1337,7 @@ ensure_uint(Token, Min, Max) ->
-ifdef(megaco_parser_inline).
-compile({inline,[{ensure_uint,4}]}).
-endif.
+-dialyzer({nowarn_function, ensure_uint/4}). % Future compat
ensure_uint(Val, Min, Max, Line) ->
if
is_integer(Min) andalso (Val >= Min) ->
diff --git a/lib/megaco/src/text/megaco_text_parser_v2.hrl b/lib/megaco/src/text/megaco_text_parser_v2.hrl
index f3c2f69193..270541d111 100644
--- a/lib/megaco/src/text/megaco_text_parser_v2.hrl
+++ b/lib/megaco/src/text/megaco_text_parser_v2.hrl
@@ -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.
@@ -1563,6 +1563,7 @@ ensure_uint(Token, Min, Max) ->
-ifdef(megaco_parser_inline).
-compile({inline,[{ensure_uint,4}]}).
-endif.
+-dialyzer({nowarn_function, ensure_uint/4}). % Future compat
ensure_uint(Val, Min, Max, Line) ->
if
is_integer(Min) andalso (Val >= Min) ->
diff --git a/lib/megaco/src/text/megaco_text_parser_v3.hrl b/lib/megaco/src/text/megaco_text_parser_v3.hrl
index 38822e4952..7b8fff2080 100644
--- a/lib/megaco/src/text/megaco_text_parser_v3.hrl
+++ b/lib/megaco/src/text/megaco_text_parser_v3.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2005-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.
@@ -1920,6 +1920,7 @@ ensure_uint(Token, Min, Max) ->
-ifdef(megaco_parser_inline).
-compile({inline,[{ensure_uint,4}]}).
-endif.
+-dialyzer({nowarn_function, ensure_uint/4}). % Future compat
ensure_uint(Val, Min, Max, Line) ->
if
is_integer(Min) andalso (Val >= Min) ->
diff --git a/lib/megaco/test/megaco_examples_test.erl b/lib/megaco/test/megaco_examples_test.erl
index 45a6c5011a..10ca0375f6 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", [?FTS() | A]);
d(_, _F, _A) ->
ok.
diff --git a/lib/megaco/test/megaco_mess_test.erl b/lib/megaco/test/megaco_mess_test.erl
index 7af6f26bf1..d3216c2a6d 100644
--- a/lib/megaco/test/megaco_mess_test.erl
+++ b/lib/megaco/test/megaco_mess_test.erl
@@ -597,6 +597,7 @@ request_and_no_reply(Config) when is_list(Config) ->
ET = [{text,tcp}, {text,udp}, {binary,tcp}, {binary,udp}],
{ok, Mgc} =
?MGC_START(MgcNode, {deviceName, "ctrl"}, ET, [], ?MGC_VERBOSITY),
+ ?SLEEP(?SECONDS(1)),
i("[MG] start"),
Mg1Mid = {deviceName, "mg1"},
@@ -621,9 +622,13 @@ request_and_no_reply(Config) when is_list(Config) ->
{pending_timer, PendingTmr},
{reply_timer, ReplyTmr}],
{ok, Mg1} = ?MG_START(Mg1Node, Mg1Mid, text, tcp, MgConfig, ?MG_VERBOSITY),
+ ?SLEEP(?SECONDS(1)),
{ok, Mg2} = ?MG_START(Mg2Node, Mg2Mid, text, udp, MgConfig, ?MG_VERBOSITY),
+ ?SLEEP(?SECONDS(1)),
{ok, Mg3} = ?MG_START(Mg3Node, Mg3Mid, binary, tcp, MgConfig, ?MG_VERBOSITY),
+ ?SLEEP(?SECONDS(1)),
{ok, Mg4} = ?MG_START(Mg4Node, Mg4Mid, binary, udp, MgConfig, ?MG_VERBOSITY),
+ ?SLEEP(?SECONDS(1)),
d("MG1 user info: ~p", [?MG_USER_INFO(Mg1, all)]),
d("MG1 conn info: ~p", [?MG_CONN_INFO(Mg1, all)]),
@@ -639,55 +644,68 @@ request_and_no_reply(Config) when is_list(Config) ->
d("service change result: ~p", [ServChRes1]),
d("MG1 user info: ~p", [?MG_USER_INFO(Mg1, all)]),
d("MG1 conn info: ~p", [?MG_CONN_INFO(Mg1, all)]),
+ ?SLEEP(?SECONDS(1)),
i("[MG2] connect to the MGC (service change)"),
ServChRes2 = ?MG_SERV_CHANGE(Mg2),
d("service change result: ~p", [ServChRes2]),
d("MG2 user info: ~p", [?MG_USER_INFO(Mg2, all)]),
d("MG2 conn info: ~p", [?MG_CONN_INFO(Mg2, all)]),
+ ?SLEEP(?SECONDS(1)),
i("[MG3] connect to the MGC (service change)"),
ServChRes3 = ?MG_SERV_CHANGE(Mg3),
d("service change result: ~p", [ServChRes3]),
d("MG3 user info: ~p", [?MG_USER_INFO(Mg3, all)]),
d("MG3 conn info: ~p", [?MG_CONN_INFO(Mg3, all)]),
+ ?SLEEP(?SECONDS(1)),
i("[MG4] connect to the MGC (service change)"),
ServChRes4 = ?MG_SERV_CHANGE(Mg4),
d("service change result: ~p", [ServChRes4]),
d("MG4 user info: ~p", [?MG_USER_INFO(Mg4, all)]),
d("MG4 conn info: ~p", [?MG_CONN_INFO(Mg4, all)]),
+ ?SLEEP(?SECONDS(1)),
d("tell the MGC to ignore requests"),
?MGC_REQ_PEND(Mgc, infinity),
+ ?SLEEP(?SECONDS(1)),
d("[MG1] send the notify"),
?MG_NOTIF_REQ(Mg1),
+ ?SLEEP(?SECONDS(1)),
d("[MG2] send the notify"),
?MG_NOTIF_REQ(Mg2),
+ ?SLEEP(?SECONDS(1)),
d("[MG3] send the notify"),
?MG_NOTIF_REQ(Mg3),
+ ?SLEEP(?SECONDS(1)),
d("[MG4] send the notify"),
?MG_NOTIF_REQ(Mg4),
+ ?SLEEP(?SECONDS(1)),
d("[MG1] await notify reply"),
{ok, {_Vsn1, {error, timeout}}} = ?MG_AWAIT_NOTIF_REP(Mg1),
d("[MG1] received expected reply"),
+ ?SLEEP(?SECONDS(1)),
d("[MG2] await notify reply"),
{ok, {_Vsn2, {error, timeout}}} = ?MG_AWAIT_NOTIF_REP(Mg2),
d("[MG2] received expected reply"),
+ ?SLEEP(?SECONDS(1)),
d("[MG3] await notify reply"),
{ok, {_Vsn3, {error, timeout}}} = ?MG_AWAIT_NOTIF_REP(Mg3),
d("[MG3] received expected reply"),
+ ?SLEEP(?SECONDS(1)),
d("[MG4] await notify reply"),
{ok, {_Vsn4, {error, timeout}}} = ?MG_AWAIT_NOTIF_REP(Mg4),
d("[MG4] received expected reply"),
+ ?SLEEP(?SECONDS(1)),
d("MG1 user info: ~p", [?MG_USER_INFO(Mg1, all)]),
d("MG1 conn info: ~p", [?MG_CONN_INFO(Mg1, all)]),
@@ -13711,38 +13729,36 @@ 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, PRE, FMT, ARGS) ->
+ print(Severity, get(verbosity), erlang:timestamp(), get(tc), PRE, FMT, ARGS).
print(Severity, Verbosity, Ts, Tc, P, F, A) ->
print(printable(Severity,Verbosity), Ts, Tc, P, F, A).
-print(true, Ts, Tc, P, F, A) ->
- io:format("*** [~s] ~s ~p ~s:~w ***"
- "~n " ++ F ++ "~n",
- [format_timestamp(Ts), P, self(), get(sname), Tc | A]);
+print(true, TS, TC, P, F, A) ->
+ S = ?F("*** [~s] ~s ~p ~s:~w ***"
+ "~n " ++ F ++ "~n",
+ [megaco:format_timestamp(TS), P, self(), get(sname), TC | A]),
+ io:format("~s", [S]),
+ io:format(user, "~s", [S]);
print(_, _, _, _, _, _) ->
ok.
-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).
+
+printable(_, debug) -> true;
+printable(info, info) -> true;
+printable(_,_) -> false.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -13752,13 +13768,6 @@ to(To, Start) ->
%% Time in milli seconds
mtime() ->
- {A,B,C} = erlang:now(),
+ {A,B,C} = erlang:timestamp(),
A*1000000000+B*1000+(C div 1000).
-%% random_init() ->
-%% {A,B,C} = now(),
-%% random:seed(A,B,C).
-
-%% random() ->
-%% 10 * random:uniform(50).
-
diff --git a/lib/megaco/test/megaco_mib_test.erl b/lib/megaco/test/megaco_mib_test.erl
index d644d6bc09..06ac7c08ed 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), ?FTS() | A]);
print(_, _, _, _) ->
ok.
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+progress(F) ->
+ progress(F, []).
+
+progress(F, A) ->
+ io:format(user, "~s " ++ F ++ "~n", [?FTS()|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..409f8d52e5 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,8 @@
-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(FTS(), megaco:format_timestamp(erlang:timestamp())).
+
diff --git a/lib/megaco/test/megaco_timer_test.erl b/lib/megaco/test/megaco_timer_test.erl
index 34479f7838..d3e8e27636 100644
--- a/lib/megaco/test/megaco_timer_test.erl
+++ b/lib/megaco/test/megaco_timer_test.erl
@@ -332,7 +332,7 @@ integer_timer_start_and_expire(Config) when is_list(Config) ->
receive
{timeout, Timeout} ->
ok
- after Timeout + 100 ->
+ after Timeout + 500 ->
tmr_stop(Ref),
error(no_timeout)
end,
@@ -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.
@@ -438,21 +443,6 @@ print1(_, _, _, _) ->
print(Prefix, F, A) ->
io:format("*** [~s] ~s ~p ~s:~w ***"
"~n " ++ F ++ "~n",
- [formated_timestamp(), Prefix, self(), get(sname), get(tc) | A]).
+ [?FTS(), Prefix, self(), get(sname), get(tc) | 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).
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).