diff options
Diffstat (limited to 'lib/megaco')
90 files changed, 3251 insertions, 2377 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/configure.in b/lib/megaco/configure.in index eaa875d0a3..bae6144abe 100644 --- a/lib/megaco/configure.in +++ b/lib/megaco/configure.in @@ -22,10 +22,6 @@ dnl dnl define([AC_CACHE_LOAD], )dnl dnl define([AC_CACHE_SAVE], )dnl -if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then - # We do not want to use a common cache! - cache_file=/dev/null -fi AC_INIT(vsn.mk) @@ -42,11 +38,14 @@ else host_os=win32 fi - dnl ---------------------------------------------------------------------- dnl Checks for programs. dnl ---------------------------------------------------------------------- +AC_PROG_CC + +LM_WINDOWS_ENVIRONMENT + AC_DEFUN(ERL_REENTRANT_FLEX, [flex_compile='$LEX -R -Pconftest -oconftest.c conftest.flex 1>&AC_FD_CC' changequote(253, 273)dnl @@ -188,111 +187,7 @@ CFLAGS="$CFLAGS $sanitizers" LDFLAGS="$LDFLAGS $sanitizers" ]) -dnl -dnl If ${ERL_TOP}/make/otp_ded.mk.in exists and contains DED_MK_VSN > 0, -dnl every thing releted to compiling Dynamic Erlang Drivers can be found -dnl in $(ERL_TOP)/make/$(TARGET)/ded.mk at compile time. If not, try to -dnl figure these things out. -dnl - -AC_MSG_CHECKING([for usable Dynamic Erlang Driver configuration]) -[ - ded_mk_in="${ERL_TOP}/make/otp_ded.mk.in" - ded_mk_vsn= - test -r "$ded_mk_in" && - ded_mk_vsn=`sed -n "s/^DED_MK_VSN[ ]*=[ ]*\(.*\)/\1/p" < "$ded_mk_in"` - test "$ded_mk_vsn" != "" || ded_mk_vsn=0 -] - -if test $ded_mk_vsn -gt 0; then - -HAVE_USABLE_OTP_DED_MK=yes -AC_MSG_RESULT([yes]) - -CC=false -AC_SUBST(CC) -DED_LD=false -AC_SUBST(DED_LD) - -else dnl --- begin no usable otp_ded.mk.in --- - -HAVE_USABLE_OTP_DED_MK=no -AC_MSG_RESULT([no]) - -dnl -dnl C compiler (related) defs -dnl - -AC_PROG_CC - -dnl -dnl Flags to the C compiler -dnl - -if test "X$host" = "Xwin32"; then - DED_CFLAGS="$CFLAGS" -else - case $host_os in - darwin*) - CFLAGS="$CFLAGS -fno-common" - ;; - esac - - if test "x$GCC" = xyes; then - DED_CFLAGS="$CFLAGS -fPIC $DED_CFLAGS" - else - DED_CFLAGS="$CFLAGS $DED_CFLAGS" - fi -fi - -dnl emulator includes needed -DED_INCLUDES="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host -I${ERL_TOP}/erts/include/internal -I${ERL_TOP}/erts/include/internal/$host -I${ERL_TOP}/erts/emulator/sys/$ERLANG_OSTYPE" - -DED_THR_DEFS="-D_THREAD_SAFE -D_REENTRANT" - -case $host_os in - win32) - DED_LDFLAGS="-dll" - ;; - solaris2*|sysv4*) - DED_LDFLAGS="-G" - ;; - aix4*) - DED_LDFLAGS="-G -bnoentry -bexpall" - ;; - freebsd2*) - # Non-ELF GNU linker - DED_LDFLAGS="-Bshareable" - ;; - darwin*) - # Mach-O linker, a shared lib and a loadable - # object file is not the same thing. - DED_LDFLAGS="-bundle -flat_namespace -undefined suppress" - DED_LD="$CC" - ;; - *) - # assume GNU linker and ELF - DED_LDFLAGS="-shared" - ;; -esac - -AC_CHECK_PROGS(DED_LD, [$LD ld.sh]) -AC_CHECK_TOOL(DED_LD, ld, no_ld) -if test "$DED_LD" = no_ld; then - AC_MSG_ERROR([ld is required to build the flex scanner!]) -fi - -AC_MSG_CHECKING(for linker flags for loadable drivers) -DED_LDFLAGS="$LDFLAGS $DED_LDFLAGS" -AC_MSG_RESULT([$DED_LDFLAGS]) - -fi dnl --- end no usable otp_ded.mk.in --- - -AC_SUBST(HAVE_USABLE_OTP_DED_MK) -AC_SUBST(DED_CFLAGS) -AC_SUBST(DED_INCLUDES) -AC_SUBST(DED_THR_DEFS) -AC_SUBST(DED_LDFLAGS) +ERL_DED AC_CHECK_PROG(PERL, perl, perl, no_perl) if test "$PERL" = no_perl; then diff --git a/lib/megaco/doc/src/Makefile b/lib/megaco/doc/src/Makefile index 8b9ce31d0e..5e085b60b0 100644 --- a/lib/megaco/doc/src/Makefile +++ b/lib/megaco/doc/src/Makefile @@ -1,7 +1,7 @@ -# +# # %CopyrightBegin% # -# Copyright Ericsson AB 2000-2016. All Rights Reserved. +# Copyright Ericsson AB 2000-2018. 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. @@ -43,7 +43,7 @@ include files.mk # ---------------------------------------------------- XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) + $(XML_PART_FILES) $(XML_CHAPTER_FILES) INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) @@ -70,10 +70,6 @@ HTML_REF_MAN_FILE = $(HTMLDIR)/index.html TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf -INDEX_FILE = index.html -INDEX_SRC = $(INDEX_FILE).src -INDEX_TARGET = $(DOCDIR)/$(INDEX_FILE) - STANDARD_DIR = ../standard STANDARDS = $(STANDARD_DIR)/rfc3525.txt \ $(STANDARD_DIR)/rfc4234.txt \ @@ -81,10 +77,10 @@ STANDARDS = $(STANDARD_DIR)/rfc3525.txt \ $(STANDARD_DIR)/implementors_guide_v10-13.pdf # ---------------------------------------------------- -# FLAGS +# FLAGS # ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += +XML_FLAGS += +DVIPS_FLAGS += # ---------------------------------------------------- @@ -101,7 +97,7 @@ $(HTMLDIR)/%.png: %.png docs: pdf html man -ldocs: local_docs $(INDEX_TARGET) +ldocs: local_docs $(TOP_PDF_FILE): $(XML_FILES) @@ -118,25 +114,18 @@ clean_man: clean_html: rm -rf $(HTMLDIR)/* + rm -rf $(XMLDIR) imgs: $(IMG_FILES:%=$(HTMLDIR)/%) -man: $(MAN3_FILES) - -$(INDEX_TARGET): $(INDEX_SRC) $(APP_FILE) - sed -e 's/%VSN%/$(VSN)/' \ - -e 's/%ERLANG_SITE%/www\.erlang\.se\//' \ - -e 's/%UP_ONE_LEVEL%/..\/..\/..\/doc\/index.html/' \ - -e 's/%OFF_PRINT%/pdf\/megaco-$(VSN).pdf/' $< > $@ +man: $(MAN3_FILES) -debug opt: +debug opt: info: @echo "->Makefile<-" @echo "" - @echo "INDEX_FILE = $(INDEX_FILE)" - @echo "INDEX_SRC = $(INDEX_SRC)" - @echo "INDEX_TARGET = $(INDEX_TARGET)" + @echo "HTML_REF_MAN_FILE = $(HTML_REF_MAN_FILE)" @echo "" @echo "XML_APPLICATION_FILES = $(XML_APPLICATION_FILES)" @echo "XML_PART_FILES = $(XML_PART_FILES)" @@ -158,7 +147,7 @@ info: # ---------------------------------------------------- # Release Target -# ---------------------------------------------------- +# ---------------------------------------------------- include $(ERL_TOP)/make/otp_release_targets.mk release_docs_spec: docs @@ -193,4 +182,3 @@ $(HTMLDIR)/megaco_transport_mechanisms.html: megaco_transport_mechanisms.xml $(HTMLDIR)/megaco_transport.html: megaco_transport.xml $(HTMLDIR)/megaco_udp.html: megaco_udp.xml $(HTMLDIR)/megaco_user.html: megaco_user.xml - diff --git a/lib/megaco/doc/src/book.gif b/lib/megaco/doc/src/book.gif Binary files differdeleted file mode 100644 index 94b3868792..0000000000 --- a/lib/megaco/doc/src/book.gif +++ /dev/null diff --git a/lib/megaco/doc/src/book.xml b/lib/megaco/doc/src/book.xml index 47ad9b6a5e..06ff315de7 100644 --- a/lib/megaco/doc/src/book.xml +++ b/lib/megaco/doc/src/book.xml @@ -4,14 +4,14 @@ <book xmlns:xi="http://www.w3.org/2001/XInclude"> <header titlestyle="normal"> <copyright> - <year>2000</year><year>2016</year> + <year>2000</year><year>2018</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> 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 @@ -19,7 +19,7 @@ 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. - + </legalnotice> <title>Megaco/H.248</title> @@ -46,4 +46,3 @@ </releasenotes> <index></index> </book> - diff --git a/lib/megaco/doc/src/fascicules.xml b/lib/megaco/doc/src/fascicules.xml deleted file mode 100644 index 37feca543f..0000000000 --- a/lib/megaco/doc/src/fascicules.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE fascicules SYSTEM "fascicules.dtd"> - -<fascicules> - <fascicule file="part" href="part_frame.html" entry="no"> - User's Guide - </fascicule> - <fascicule file="ref_man" href="ref_man_frame.html" entry="yes"> - Reference Manual - </fascicule> - <fascicule file="part_notes" href="part_notes_frame.html" entry="no"> - Release Notes - </fascicule> - <fascicule file="" href="../../../../doc/print.html" entry="no"> - Off-Print - </fascicule> -</fascicules> - diff --git a/lib/megaco/doc/src/files.mk b/lib/megaco/doc/src/files.mk index 5e7d849ab6..e40889c3fb 100644 --- a/lib/megaco/doc/src/files.mk +++ b/lib/megaco/doc/src/files.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2001-2016. All Rights Reserved. +# Copyright Ericsson AB 2001-2017. 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. @@ -36,9 +36,7 @@ XML_REF3_FILES = \ megaco_udp.xml XML_PART_FILES = \ - part.xml \ - part_notes.xml \ - part_notes_history.xml + part.xml XML_EXTRA_FILES = \ notes_history.xml @@ -61,11 +59,6 @@ IMG_FILES = \ single_node_config.gif \ distr_node_config.gif \ megaco_sys_arch.gif \ - user_guide.gif \ - note.gif \ - notes.gif \ - ref_man.gif \ - book.gif \ MG-startup_flow_noMID.gif \ MGC_startup_call_flow.gif \ MG_startup_call_flow.gif \ diff --git a/lib/megaco/doc/src/index.html.src b/lib/megaco/doc/src/index.html.src deleted file mode 100644 index b3ff9c3ae7..0000000000 --- a/lib/megaco/doc/src/index.html.src +++ /dev/null @@ -1,113 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<!-- This file is obsolete --> -<HTML> -<!-- - ``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. - - The Initial Developer of the Original Code is Ericsson Utvecklings AB. - Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings - AB. All Rights Reserved.'' - - $Id$ ---> -<HEAD> -<TITLE>Megaco %VSN%</TITLE> -</HEAD> - -<BODY BGCOLOR="#FFFFFF"> - -<CENTER> -<A HREF="http://%ERLANG_SITE%"> - <IMG ALT="Erlang/OTP" BORDER=0 SRC="html/min_head.gif"> -</A><BR> - -<FONT SIZE="-1"> -[<A HREF="%UP_ONE_LEVEL%">Up</A> | -<A HREF="http://%ERLANG_SITE%">Erlang/OTP</A>] -</FONT><BR> - -<P><FONT SIZE="+3">Megaco</FONT><BR> -Version %VSN% -</CENTER> - -<P><TABLE> -<TR> -<TD> -<!-- IMG ALIGN=LEFT ALT="MEGACO" SRC="html/megaco.gif" --> -</TD> - -<TD> - <p>The <STRONG>Megaco</STRONG> application is a framework -for building applications on top of the Megaco/H.248 protocol.</p> -</TD> -</TR> -</TABLE> - -<P><CENTER> -<TABLE CELLPADDING=15> -<TR> -<TD ALIGN=CENTER> -<A HREF="html/users_guide.html"> - <IMG ALT="User's Guide" BORDER=0 SRC="html/user_guide.gif"> -</A> -<BR> -<FONT SIZE="-1"> -<A HREF="html/users_guide.html">User's Guide</A> -</FONT> -</TD> - -<TD ALIGN=CENTER> -<A HREF="html/index.html"> - <IMG ALT="Reference Manual" BORDER=0 SRC="html/ref_man.gif"> -</A> -<BR> -<FONT SIZE="-1"> -<A HREF="html/index.html">Reference Manual</A> -</FONT> -</TD> - -</TR> - -<TR> -<TD ALIGN=CENTER> -<A HREF="html/release_notes.html"> - <IMG ALT="Release Notes" BORDER=0 SRC="html/notes.gif"> -</A> -<BR> -<FONT SIZE="-1"> -<A HREF="html/release_notes.html">Release Notes</A> -</FONT> -</TD> - -<TD ALIGN=CENTER> -<A HREF="%OFF_PRINT%"> - <IMG ALT="Off-Print" BORDER=0 SRC="html/book.gif"> -</A> -<BR> -<FONT SIZE="-1"> -<A HREF="%OFF_PRINT%">Off-Print</A> -</FONT> -</TD> -</TR> -</TABLE> -</CENTER> - -<P><CENTER> -<HR> -<FONT SIZE="-1"> -Copyright © 1991-2001 -<A HREF="http://www.erlang.se/">Ericsson Utvecklings AB</A> -</FONT> -</CENTER> -</BODY> -</HTML> diff --git a/lib/megaco/doc/src/megaco.xml b/lib/megaco/doc/src/megaco.xml index d4a7451bfc..c7bcdfcd6f 100644 --- a/lib/megaco/doc/src/megaco.xml +++ b/lib/megaco/doc/src/megaco.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco.xml</file> </header> - <module>megaco</module> + <module since="">megaco</module> <modulesummary>Main API of the Megaco application</modulesummary> <description> <p>Interface module for the Megaco application</p> @@ -135,7 +135,7 @@ megaco_incr_timer() = #megaco_incr_timer{} <funcs> <func> - <name>start() -> ok | {error, Reason}</name> + <name since="">start() -> ok | {error, Reason}</name> <fsummary>Starts the Megaco application</fsummary> <type> <v>Reason = term()</v> @@ -153,7 +153,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>stop() -> ok | {error, Reason}</name> + <name since="">stop() -> ok | {error, Reason}</name> <fsummary>Stops the Megaco application</fsummary> <type> <v>Reason = term()</v> @@ -166,7 +166,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>start_user(UserMid, Config) -> ok | {error, Reason}</name> + <name since="">start_user(UserMid, Config) -> ok | {error, Reason}</name> <fsummary>Initial configuration of a user</fsummary> <type> <v>UserMid = megaco_mid()</v> @@ -188,7 +188,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>stop_user(UserMid) -> ok | {error, Reason}</name> + <name since="">stop_user(UserMid) -> ok | {error, Reason}</name> <fsummary>Delete the configuration of a user</fsummary> <type> <v>UserMid = megaco_mid()</v> @@ -203,8 +203,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>user_info(UserMid) -> [{Item, Value}]</name> - <name>user_info(UserMid, Item) -> Value | exit(Reason)</name> + <name since="">user_info(UserMid) -> [{Item, Value}]</name> + <name since="">user_info(UserMid, Item) -> Value | exit(Reason)</name> <fsummary>Lookup user information</fsummary> <type> <v>Handle = user_info_handle()</v> @@ -703,7 +703,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>update_user_info(UserMid, Item, Value) -> ok | {error, Reason}</name> + <name since="">update_user_info(UserMid, Item, Value) -> ok | {error, Reason}</name> <fsummary>Update information about a user</fsummary> <type> <v>UserMid = megaco_mid() </v> @@ -721,8 +721,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>conn_info(ConnHandle) -> [{Item, Value}]</name> - <name>conn_info(ConnHandle, Item) -> Value | exit(Reason)</name> + <name since="">conn_info(ConnHandle) -> [{Item, Value}]</name> + <name since="">conn_info(ConnHandle, Item) -> Value | exit(Reason)</name> <fsummary>Lookup information about an active connection</fsummary> <type> <v>ConnHandle = #megaco_conn_handle{}</v> @@ -1222,7 +1222,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>update_conn_info(ConnHandle, Item, Value) -> ok | {error, Reason}</name> + <name since="">update_conn_info(ConnHandle, Item, Value) -> ok | {error, Reason}</name> <fsummary>Update information about an active connection</fsummary> <type> <v>ConnHandle = #megaco_conn_handle{}</v> @@ -1241,8 +1241,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>system_info() -> [{Item, Value}] | exit(Reason)</name> - <name>system_info(Item) -> Value | exit(Reason)</name> + <name since="">system_info() -> [{Item, Value}] | exit(Reason)</name> + <name since="">system_info(Item) -> Value | exit(Reason)</name> <fsummary>Lookup system information</fsummary> <type> <v>Item = system_info_item()</v> @@ -1289,7 +1289,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>info() -> Info</name> + <name since="">info() -> Info</name> <fsummary>All the information of the application</fsummary> <type> <v>Info = [{Key, Value}]</v> @@ -1311,8 +1311,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>connect(ReceiveHandle, RemoteMid, SendHandle, ControlPid) -> {ok, ConnHandle} | {error, Reason}</name> - <name>connect(ReceiveHandle, RemoteMid, SendHandle, ControlPid, Extra) -> {ok, ConnHandle} | {error, Reason}</name> + <name since="">connect(ReceiveHandle, RemoteMid, SendHandle, ControlPid) -> {ok, ConnHandle} | {error, Reason}</name> + <name since="">connect(ReceiveHandle, RemoteMid, SendHandle, ControlPid, Extra) -> {ok, ConnHandle} | {error, Reason}</name> <fsummary>Establish a "virtual" connection</fsummary> <type> <v>ReceiveHandle = #megaco_receive_handle{}</v> @@ -1436,7 +1436,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>disconnect(ConnHandle, DiscoReason) -> ok | {error, ErrReason}</name> + <name since="">disconnect(ConnHandle, DiscoReason) -> ok | {error, ErrReason}</name> <fsummary>Tear down a "virtual" connection</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -1454,7 +1454,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>call(ConnHandle, Actions, Options) -> {ProtocolVersion, UserReply}</name> + <name since="">call(ConnHandle, Actions, Options) -> {ProtocolVersion, UserReply}</name> <fsummary>Sends one or more transaction request(s) and waits for the reply</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -1545,7 +1545,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>cast(ConnHandle, Actions, Options) -> ok | {error, Reason}</name> + <name since="">cast(ConnHandle, Actions, Options) -> ok | {error, Reason}</name> <fsummary>Sends one or more transaction request(s) but does NOT wait for a reply</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -1582,7 +1582,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>encode_actions(ConnHandle, Actions, Options) -> {ok, BinOrBins} | {error, Reason}</name> + <name since="">encode_actions(ConnHandle, Actions, Options) -> {ok, BinOrBins} | {error, Reason}</name> <fsummary>Encode action requests for one or more transaction request(s)</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -1607,9 +1607,9 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>token_tag2string(Tag) -> Result</name> - <name>token_tag2string(Tag, EncoderMod) -> Result</name> - <name>token_tag2string(Tag, EncoderMod, Version) -> Result</name> + <name since="">token_tag2string(Tag) -> Result</name> + <name since="">token_tag2string(Tag, EncoderMod) -> Result</name> + <name since="">token_tag2string(Tag, EncoderMod, Version) -> Result</name> <fsummary>Convert a token tag to a string</fsummary> <type> <v>Tag = atom()</v> @@ -1635,7 +1635,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>cancel(ConnHandle, CancelReason) -> ok | {error, ErrReason}</name> + <name since="">cancel(ConnHandle, CancelReason) -> ok | {error, ErrReason}</name> <fsummary>Cancel all outstanding messages for this connection</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -1655,8 +1655,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>process_received_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) -> ok</name> - <name>process_received_message(ReceiveHandle, ControlPid, SendHandle, BinMsg, Extra) -> ok</name> + <name since="">process_received_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) -> ok</name> + <name since="">process_received_message(ReceiveHandle, ControlPid, SendHandle, BinMsg, Extra) -> ok</name> <fsummary>Process a received message</fsummary> <type> <v>ReceiveHandle = #megaco_receive_handle{}</v> @@ -1755,8 +1755,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>receive_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) -> ok</name> - <name>receive_message(ReceiveHandle, ControlPid, SendHandle, BinMsg, Extra) -> ok</name> + <name since="">receive_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) -> ok</name> + <name since="">receive_message(ReceiveHandle, ControlPid, SendHandle, BinMsg, Extra) -> ok</name> <fsummary>Process a received message</fsummary> <type> <v>ReceiveHandle = #megaco_receive_handle{}</v> @@ -1783,7 +1783,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>parse_digit_map(DigitMapBody) -> {ok, ParsedDigitMap} | {error, Reason}</name> + <name since="">parse_digit_map(DigitMapBody) -> {ok, ParsedDigitMap} | {error, Reason}</name> <fsummary>Parses a digit map body</fsummary> <type> <v>DigitMapBody = string()</v> @@ -1802,8 +1802,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>eval_digit_map(DigitMap) -> {ok, MatchResult} | {error, Reason}</name> - <name>eval_digit_map(DigitMap, Timers) -> {ok, MatchResult} | {error, Reason}</name> + <name since="">eval_digit_map(DigitMap) -> {ok, MatchResult} | {error, Reason}</name> + <name since="">eval_digit_map(DigitMap, Timers) -> {ok, MatchResult} | {error, Reason}</name> <fsummary>Collect digit map letters according to the digit map</fsummary> <type> <v>DigitMap = #'DigitMapValue'{} | parsed_digit_map()</v> @@ -1839,7 +1839,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>report_digit_event(DigitMapEvalPid, Events) -> ok | {error, Reason}</name> + <name since="">report_digit_event(DigitMapEvalPid, Events) -> ok | {error, Reason}</name> <fsummary>Send one or more events to the event collector process</fsummary> <type> <v>DigitMapEvalPid = pid()</v> @@ -1866,7 +1866,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>test_digit_event(DigitMap, Events) -> {ok, Kind, Letters} | {error, Reason}</name> + <name since="">test_digit_event(DigitMap, Events) -> {ok, Kind, Letters} | {error, Reason}</name> <fsummary>Feed digit map collector with events and return the result</fsummary> <type> <v>DigitMap = #'DigitMapValue'{} | parsed_digit_map()</v> @@ -1900,7 +1900,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>encode_sdp(SDP) -> {ok, PP} | {error, Reason}</name> + <name since="">encode_sdp(SDP) -> {ok, PP} | {error, Reason}</name> <fsummary>Encode an SDP construct</fsummary> <type> <v>SDP = sdp_property_parm() | sdp_property_group() | sdp_property_groups() | asn1_NOVALUE</v> @@ -1929,7 +1929,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>decode_sdp(PP) -> {ok, SDP} | {error, Reason}</name> + <name since="">decode_sdp(PP) -> {ok, SDP} | {error, Reason}</name> <fsummary>Decode an property parameter construct</fsummary> <type> <v>PP = property_parm() | property_group() | property_groups() | asn1_NOVALUE</v> @@ -1969,7 +1969,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>get_sdp_record_from_PropertGroup(Type, PG) -> [sdp()]</name> + <name since="">get_sdp_record_from_PropertGroup(Type, PG) -> [sdp()]</name> <fsummary>Get all sdp records of a certain type from a property group</fsummary> <type> <v>Type = v | c | m | o | a | b | t | r | z | k | s | i | u | e | p</v> @@ -1986,8 +1986,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>versions1() -> {ok, VersionInfo} | {error, Reason}</name> - <name>versions2() -> {ok, Info} | {error, Reason}</name> + <name since="">versions1() -> {ok, VersionInfo} | {error, Reason}</name> + <name since="">versions2() -> {ok, Info} | {error, Reason}</name> <fsummary>Retreive various system and application info</fsummary> <type> <v>VersionInfo = [version_info()]</v> @@ -2007,8 +2007,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>print_version_info() -> void()</name> - <name>print_version_info(VersionInfo) -> void()</name> + <name since="">print_version_info() -> void()</name> + <name since="">print_version_info(VersionInfo) -> void()</name> <fsummary>Formated print of result of the versions functions</fsummary> <type> <v>VersionInfo = [version_info()]</v> @@ -2029,7 +2029,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>enable_trace(Level, Destination) -> void()</name> + <name since="">enable_trace(Level, Destination) -> void()</name> <fsummary>Start megaco tracing</fsummary> <type> <v>Level = max | min | 0 <= integer() <= 100</v> @@ -2057,7 +2057,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>disable_trace() -> void()</name> + <name since="">disable_trace() -> void()</name> <fsummary>Stop megaco tracing</fsummary> <desc> <p>This function is used to stop megaco tracing.</p> @@ -2065,7 +2065,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </desc> </func> <func> - <name>set_trace(Level) -> void()</name> + <name since="">set_trace(Level) -> void()</name> <fsummary>Change megaco trace level</fsummary> <type> <v>Level = max | min | 0 <= integer() <= 100</v> @@ -2081,10 +2081,10 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>get_stats() -> {ok, TotalStats} | {error, Reason}</name> - <name>get_stats(GlobalCounter) -> {ok, CounterStats} | {error, Reason}</name> - <name>get_stats(ConnHandle) -> {ok, ConnHandleStats} | {error, Reason}</name> - <name>get_stats(ConnHandle, Counter) -> {ok, integer()} | {error, Reason}</name> + <name since="">get_stats() -> {ok, TotalStats} | {error, Reason}</name> + <name since="">get_stats(GlobalCounter) -> {ok, CounterStats} | {error, Reason}</name> + <name since="">get_stats(ConnHandle) -> {ok, ConnHandleStats} | {error, Reason}</name> + <name since="">get_stats(ConnHandle, Counter) -> {ok, integer()} | {error, Reason}</name> <fsummary></fsummary> <type> <v>TotalStats = [total_stats()]</v> @@ -2110,8 +2110,8 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>reset_stats() -> void()</name> - <name>reset_stats(ConnHandle) -> void()</name> + <name since="">reset_stats() -> void()</name> + <name since="">reset_stats(ConnHandle) -> void()</name> <fsummary></fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -2123,7 +2123,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>test_request(ConnHandle, Version, EncodingMod, EncodingConfig, Actions) -> {MegaMsg, EncodeRes}</name> + <name since="">test_request(ConnHandle, Version, EncodingMod, EncodingConfig, Actions) -> {MegaMsg, EncodeRes}</name> <fsummary>Tests if the Actions argument is correct</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -2150,7 +2150,7 @@ megaco_incr_timer() = #megaco_incr_timer{} </func> <func> - <name>test_reply(ConnHandle, Version, EncodingMod, EncodingConfig, Reply) -> {MegaMsg, EncodeRes}</name> + <name since="">test_reply(ConnHandle, Version, EncodingMod, EncodingConfig, Reply) -> {MegaMsg, EncodeRes}</name> <fsummary>Tests if the Reply argument is correct</fsummary> <type> <v>ConnHandle = conn_handle()</v> diff --git a/lib/megaco/doc/src/megaco_codec_meas.xml b/lib/megaco/doc/src/megaco_codec_meas.xml index 13cc3eb834..5184fe392e 100644 --- a/lib/megaco/doc/src/megaco_codec_meas.xml +++ b/lib/megaco/doc/src/megaco_codec_meas.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_codec_meas.xml</file> </header> - <module>megaco_codec_meas</module> + <module since="">megaco_codec_meas</module> <modulesummary>This module implements a simple megaco codec measurement tool.</modulesummary> <description> <p>This module implements a simple megaco codec measurement tool.</p> @@ -43,8 +43,8 @@ <funcs> <func> - <name>start() -> void()</name> - <name>start(MessagePackage) -> void()</name> + <name since="">start() -> void()</name> + <name since="">start(MessagePackage) -> void()</name> <fsummary></fsummary> <type> <v>MessagePackageRaw = message_package()</v> diff --git a/lib/megaco/doc/src/megaco_codec_mstone1.xml b/lib/megaco/doc/src/megaco_codec_mstone1.xml index 2ff959a648..507a790c71 100644 --- a/lib/megaco/doc/src/megaco_codec_mstone1.xml +++ b/lib/megaco/doc/src/megaco_codec_mstone1.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_codec_mstone1.xml</file> </header> - <module>megaco_codec_mstone1</module> + <module since="">megaco_codec_mstone1</module> <modulesummary>This module implements a simple megaco codec-based performance tool.</modulesummary> <description> <p>This module implements the <em>mstone1</em> tool, @@ -44,9 +44,9 @@ <funcs> <func> - <name>start() -> void()</name> - <name>start(MessagePackage) -> void()</name> - <name>start(MessagePackage, Factor) -> void()</name> + <name since="">start() -> void()</name> + <name since="">start(MessagePackage) -> void()</name> + <name since="">start(MessagePackage, Factor) -> void()</name> <fsummary></fsummary> <type> <v>MessagePackage = message_package()</v> @@ -63,9 +63,9 @@ </func> <func> - <name>start_flex() -> void()</name> - <name>start_flex(MessagePackage) -> void()</name> - <name>start_flex(MessagePackage, Factor) -> void()</name> + <name since="">start_flex() -> void()</name> + <name since="">start_flex(MessagePackage) -> void()</name> + <name since="">start_flex(MessagePackage, Factor) -> void()</name> <fsummary></fsummary> <type> <v>MessagePackage = message_package()</v> @@ -83,9 +83,9 @@ </func> <func> - <name>start_only_drv() -> void()</name> - <name>start_only_drv(MessagePackage) -> void()</name> - <name>start_only_drv(MessagePackage, Factor) -> void()</name> + <name since="">start_only_drv() -> void()</name> + <name since="">start_only_drv(MessagePackage) -> void()</name> + <name since="">start_only_drv(MessagePackage, Factor) -> void()</name> <fsummary></fsummary> <type> <v>MessagePackage = message_package()</v> @@ -105,9 +105,9 @@ </func> <func> - <name>start_no_drv() -> void()</name> - <name>start_no_drv(MessagePackage) -> void()</name> - <name>start_no_drv(MessagePackage, Factor) -> void()</name> + <name since="">start_no_drv() -> void()</name> + <name since="">start_no_drv(MessagePackage) -> void()</name> + <name since="">start_no_drv(MessagePackage, Factor) -> void()</name> <fsummary></fsummary> <type> <v>MessagePackage = message_package()</v> diff --git a/lib/megaco/doc/src/megaco_codec_mstone2.xml b/lib/megaco/doc/src/megaco_codec_mstone2.xml index 3da30d4f99..03990f5c3d 100644 --- a/lib/megaco/doc/src/megaco_codec_mstone2.xml +++ b/lib/megaco/doc/src/megaco_codec_mstone2.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_codec_mstone2.xml</file> </header> - <module>megaco_codec_mstone2</module> + <module since="">megaco_codec_mstone2</module> <modulesummary>This module implements a simple megaco codec-based performance tool.</modulesummary> <description> <p>This module implements the <em>mstone2</em> tool, @@ -44,8 +44,8 @@ <funcs> <func> - <name>start() -> void()</name> - <name>start(MessagePackage) -> void()</name> + <name since="">start() -> void()</name> + <name since="">start(MessagePackage) -> void()</name> <fsummary></fsummary> <type> <v>MessagePackage = message_package()</v> diff --git a/lib/megaco/doc/src/megaco_codec_transform.xml b/lib/megaco/doc/src/megaco_codec_transform.xml index 26b83c3799..392868fdfa 100644 --- a/lib/megaco/doc/src/megaco_codec_transform.xml +++ b/lib/megaco/doc/src/megaco_codec_transform.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_codec_transform.xml</file> </header> - <module>megaco_codec_transform</module> + <module since="">megaco_codec_transform</module> <modulesummary>Megaco message transformation utility.</modulesummary> <description> @@ -45,8 +45,8 @@ <funcs> <func> - <name>export_messages() -> void()</name> - <name>export_messages(MessagePackage) -> void()</name> + <name since="">export_messages() -> void()</name> + <name since="">export_messages(MessagePackage) -> void()</name> <fsummary></fsummary> <type> <v>MessagePackage = atom()</v> diff --git a/lib/megaco/doc/src/megaco_edist_compress.xml b/lib/megaco/doc/src/megaco_edist_compress.xml index d5c7c7224d..8461c59a00 100644 --- a/lib/megaco/doc/src/megaco_edist_compress.xml +++ b/lib/megaco/doc/src/megaco_edist_compress.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_edist_compress.xml</file> </header> - <module>megaco_edist_compress</module> + <module since="">megaco_edist_compress</module> <modulesummary>Megaco erlang dist compress behaviour.</modulesummary> <description> <p>The following functions should be exported from a @@ -40,11 +40,11 @@ </description> <funcs> <func> - <name>Module:encode(R, Version) -> T</name> + <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> @@ -53,12 +53,12 @@ </desc> </func> <func> - <name>Module:decode(T, Version) -> R</name> + <name since="">Module:decode(T, Version) -> R</name> <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 13c6ed324b..0632a55d48 100644 --- a/lib/megaco/doc/src/megaco_encoder.xml +++ b/lib/megaco/doc/src/megaco_encoder.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_encoder.xml</file> </header> - <module>megaco_encoder</module> + <module since="">megaco_encoder</module> <modulesummary>Megaco encoder behaviour.</modulesummary> <description> <p>The following functions should be exported from a @@ -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> @@ -64,7 +75,7 @@ action_reply() = #'ActionReply'{} <funcs> <func> - <name>Module:encode_message(EncodingConfig, Version, Message) -> {ok, Bin} | Error</name> + <name since="">Module:encode_message(EncodingConfig, Version, Message) -> {ok, Bin} | Error</name> <fsummary>Encode a megaco message.</fsummary> <type> <v>EncodingConfig = list()</v> @@ -81,7 +92,7 @@ action_reply() = #'ActionReply'{} </func> <func> - <name>Module:decode_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error</name> + <name since="">Module:decode_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error</name> <fsummary>Decode a megaco message.</fsummary> <type> <v>EncodingConfig = list()</v> @@ -104,7 +115,7 @@ action_reply() = #'ActionReply'{} </func> <func> - <name>Module:decode_mini_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error</name> + <name since="">Module:decode_mini_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error</name> <fsummary>Perform a minimal decode of a megaco message.</fsummary> <type> <v>EncodingConfig = list()</v> @@ -129,7 +140,7 @@ action_reply() = #'ActionReply'{} </func> <func> - <name>Module:encode_transaction(EncodingConfig, Version, Transaction) -> OK | Error</name> + <name since="">Module:encode_transaction(EncodingConfig, Version, Transaction) -> OK | Error</name> <fsummary>Encode a megaco transaction.</fsummary> <type> <v>EncodingConfig = list()</v> @@ -155,7 +166,7 @@ action_reply() = #'ActionReply'{} </func> <func> - <name>Module:encode_action_requests(EncodingConfig, Version, ARs) -> OK | Error</name> + <name since="">Module:encode_action_requests(EncodingConfig, Version, ARs) -> OK | Error</name> <fsummary>Encode megaco action requests.</fsummary> <type> <v>EncodingConfig = list()</v> @@ -181,7 +192,7 @@ action_reply() = #'ActionReply'{} </func> <func> - <name>Module:encode_action_reply(EncodingConfig, Version, AR) -> OK | Error</name> + <name since="">Module:encode_action_reply(EncodingConfig, Version, AR) -> OK | Error</name> <fsummary>Encode a megaco action reply.</fsummary> <type> <v>EncodingConfig = list()</v> diff --git a/lib/megaco/doc/src/megaco_flex_scanner.xml b/lib/megaco/doc/src/megaco_flex_scanner.xml index 0856f3f429..121a7fbcff 100644 --- a/lib/megaco/doc/src/megaco_flex_scanner.xml +++ b/lib/megaco/doc/src/megaco_flex_scanner.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_flex_scanner.xml</file> </header> - <module>megaco_flex_scanner</module> + <module since="">megaco_flex_scanner</module> <modulesummary>Interface module to the flex scanner linked in driver.</modulesummary> <description> <p>This module contains the public interface to the flex scanner @@ -72,7 +72,7 @@ megaco_version() = integer() >= 1 <funcs> <func> - <name>start() -> {ok, PortOrPorts} | {error, Reason}</name> + <name since="">start() -> {ok, PortOrPorts} | {error, Reason}</name> <fsummary></fsummary> <type> <v>PortOrPorts = megaco_ports()</v> @@ -94,7 +94,7 @@ megaco_version() = integer() >= 1 </func> <func> - <name>stop(PortOrPorts) -> stopped</name> + <name since="">stop(PortOrPorts) -> stopped</name> <fsummary></fsummary> <type> <v>PortOrPorts = megaco_ports()</v> @@ -108,7 +108,7 @@ megaco_version() = integer() >= 1 </func> <func> - <name>is_reentrant_enabled() -> Boolean</name> + <name since="">is_reentrant_enabled() -> Boolean</name> <fsummary></fsummary> <type> <v>Boolean = boolean()</v> @@ -121,7 +121,7 @@ megaco_version() = integer() >= 1 </func> <func> - <name>is_scanner_port(Port, PortOrPorts) -> Boolean</name> + <name since="">is_scanner_port(Port, PortOrPorts) -> Boolean</name> <fsummary></fsummary> <type> <v>Port = port()</v> @@ -137,7 +137,7 @@ megaco_version() = integer() >= 1 </func> <func> - <name>scan(Binary, PortOrPorts) -> {ok, Tokens, Version, LatestLine} | {error, Reason, LatestLine} </name> + <name since="">scan(Binary, PortOrPorts) -> {ok, Tokens, Version, LatestLine} | {error, Reason, LatestLine} </name> <fsummary></fsummary> <type> <v>Binary = binary()</v> diff --git a/lib/megaco/doc/src/megaco_tcp.xml b/lib/megaco/doc/src/megaco_tcp.xml index 77aee32f6c..63713b2c56 100644 --- a/lib/megaco/doc/src/megaco_tcp.xml +++ b/lib/megaco/doc/src/megaco_tcp.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_tcp.xml</file> </header> - <module>megaco_tcp</module> + <module since="">megaco_tcp</module> <modulesummary>Interface module to TPKT transport protocol for Megaco/H.248.</modulesummary> <description> <p>This module contains the public interface to the TPKT (TCP/IP) version @@ -40,7 +40,7 @@ </description> <funcs> <func> - <name>start_transport() -> {ok, TransportRef}</name> + <name since="">start_transport() -> {ok, TransportRef}</name> <fsummary></fsummary> <type> <v>TransportRef = pid()</v> @@ -51,7 +51,7 @@ </desc> </func> <func> - <name>listen(TransportRef, ListenPortSpecList) -> ok</name> + <name since="">listen(TransportRef, ListenPortSpecList) -> ok</name> <fsummary></fsummary> <type> <v>TransportRef = pid() | regname()</v> @@ -65,7 +65,7 @@ </desc> </func> <func> - <name>connect(TransportRef, OptionList) -> {ok, Handle, ControlPid} | {error, Reason}</name> + <name since="">connect(TransportRef, OptionList) -> {ok, Handle, ControlPid} | {error, Reason}</name> <fsummary></fsummary> <type> <v>TransportRef = pid() | regname()</v> @@ -86,7 +86,7 @@ </desc> </func> <func> - <name>close(Handle) -> ok</name> + <name since="">close(Handle) -> ok</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -96,7 +96,7 @@ </desc> </func> <func> - <name>socket(Handle) -> Socket</name> + <name since="">socket(Handle) -> Socket</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -109,7 +109,7 @@ </desc> </func> <func> - <name>send_message(Handle, Message) -> ok</name> + <name since="">send_message(Handle, Message) -> ok</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -120,7 +120,7 @@ </desc> </func> <func> - <name>block(Handle) -> ok</name> + <name since="">block(Handle) -> ok</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -130,7 +130,7 @@ </desc> </func> <func> - <name>unblock(Handle) -> ok</name> + <name since="">unblock(Handle) -> ok</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -141,7 +141,7 @@ </desc> </func> <func> - <name>upgrade_receive_handle(ControlPid) -> ok</name> + <name since="">upgrade_receive_handle(ControlPid) -> ok</name> <fsummary></fsummary> <type> <v>ControlPid = pid()</v> @@ -153,9 +153,9 @@ </desc> </func> <func> - <name>get_stats() -> {ok, TotalStats} | {error, Reason}</name> - <name>get_stats(SendHandle) -> {ok, SendHandleStats} | {error, Reason}</name> - <name>get_stats(SendHandle, Counter) -> {ok, CounterStats} | {error, Reason}</name> + <name since="">get_stats() -> {ok, TotalStats} | {error, Reason}</name> + <name since="">get_stats(SendHandle) -> {ok, SendHandleStats} | {error, Reason}</name> + <name since="">get_stats(SendHandle, Counter) -> {ok, CounterStats} | {error, Reason}</name> <fsummary></fsummary> <type> <v>TotalStats = [send_handle_stats()]</v> @@ -173,8 +173,8 @@ </desc> </func> <func> - <name>reset_stats() -> void()</name> - <name>reset_stats(SendHandle) -> void()</name> + <name since="">reset_stats() -> void()</name> + <name since="">reset_stats(SendHandle) -> void()</name> <fsummary></fsummary> <type> <v>SendHandle = send_handle()</v> diff --git a/lib/megaco/doc/src/megaco_transport.xml b/lib/megaco/doc/src/megaco_transport.xml index 3002e9b74e..ba8c794750 100644 --- a/lib/megaco/doc/src/megaco_transport.xml +++ b/lib/megaco/doc/src/megaco_transport.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_transport.xml</file> </header> - <module>megaco_transport</module> + <module since="">megaco_transport</module> <modulesummary>Megaco transport behaviour.</modulesummary> <description> <p>The following functions should be exported from a @@ -54,8 +54,8 @@ </description> <funcs> <func> - <name>Module:send_message(Handle, Msg) -> ok | {cancel, Reason} | Error</name> - <name>Module:send_message(Handle, Msg, Resend) -> ok | {cancel, Reason} | Error</name> + <name since="">Module:send_message(Handle, Msg) -> ok | {cancel, Reason} | Error</name> + <name since="">Module:send_message(Handle, Msg, Resend) -> ok | {cancel, Reason} | Error</name> <fsummary>Send a megaco message.</fsummary> <type> <v>Handle = term()</v> @@ -99,7 +99,7 @@ </func> <func> - <name>Module:resend_message(Handle, Msg) -> ok | {cancel, Reason} | Error</name> + <name since="">Module:resend_message(Handle, Msg) -> ok | {cancel, Reason} | Error</name> <fsummary>Re-send a megaco message.</fsummary> <type> <v>Handle = term()</v> diff --git a/lib/megaco/doc/src/megaco_udp.xml b/lib/megaco/doc/src/megaco_udp.xml index b2559c77d5..3d776c19b6 100644 --- a/lib/megaco/doc/src/megaco_udp.xml +++ b/lib/megaco/doc/src/megaco_udp.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_udp.xml</file> </header> - <module>megaco_udp</module> + <module since="">megaco_udp</module> <modulesummary>Interface module to UDP transport protocol for Megaco/H.248.</modulesummary> <description> <p>This module contains the public interface to the UDP/IP version @@ -40,7 +40,7 @@ </description> <funcs> <func> - <name>start_transport() -> {ok, TransportRef}</name> + <name since="">start_transport() -> {ok, TransportRef}</name> <fsummary></fsummary> <type> <v>TransportRef = pid()</v> @@ -51,7 +51,7 @@ </desc> </func> <func> - <name>open(TransportRef, OptionList) -> {ok, Handle, ControlPid} | {error, Reason}</name> + <name since="">open(TransportRef, OptionList) -> {ok, Handle, ControlPid} | {error, Reason}</name> <fsummary></fsummary> <type> <v>TransportRef = pid() | regname()</v> @@ -73,7 +73,7 @@ </desc> </func> <func> - <name>close(Handle, Msg) -> ok</name> + <name since="">close(Handle, Msg) -> ok</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -84,7 +84,7 @@ </desc> </func> <func> - <name>socket(Handle) -> Socket</name> + <name since="">socket(Handle) -> Socket</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -97,7 +97,7 @@ </desc> </func> <func> - <name>create_send_handle(Handle, Host, Port) -> send_handle()</name> + <name since="">create_send_handle(Handle, Host, Port) -> send_handle()</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -110,7 +110,7 @@ </desc> </func> <func> - <name>send_message(SendHandle, Msg) -> ok</name> + <name since="">send_message(SendHandle, Msg) -> ok</name> <fsummary></fsummary> <type> <v>SendHandle = send_handle()</v> @@ -125,7 +125,7 @@ </desc> </func> <func> - <name>block(Handle) -> ok</name> + <name since="">block(Handle) -> ok</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -135,7 +135,7 @@ </desc> </func> <func> - <name>unblock(Handle) -> ok</name> + <name since="">unblock(Handle) -> ok</name> <fsummary></fsummary> <type> <v>Handle = socket_handle()</v> @@ -146,7 +146,7 @@ </desc> </func> <func> - <name>upgrade_receive_handle(ControlPid, NewHandle) -> ok</name> + <name since="">upgrade_receive_handle(ControlPid, NewHandle) -> ok</name> <fsummary></fsummary> <type> <v>ControlPid = pid()</v> @@ -160,9 +160,9 @@ </desc> </func> <func> - <name>get_stats() -> {ok, TotalStats} | {error, Reason}</name> - <name>get_stats(SendHandle) -> {ok, SendHandleStats} | {error, Reason}</name> - <name>get_stats(SendHandle, Counter) -> {ok, CounterStats} | {error, Reason}</name> + <name since="">get_stats() -> {ok, TotalStats} | {error, Reason}</name> + <name since="">get_stats(SendHandle) -> {ok, SendHandleStats} | {error, Reason}</name> + <name since="">get_stats(SendHandle, Counter) -> {ok, CounterStats} | {error, Reason}</name> <fsummary></fsummary> <type> <v>TotalStats = [total_stats()]</v> @@ -180,8 +180,8 @@ </desc> </func> <func> - <name>reset_stats() -> void()</name> - <name>reset_stats(SendHandle) -> void()</name> + <name since="">reset_stats() -> void()</name> + <name since="">reset_stats(SendHandle) -> void()</name> <fsummary></fsummary> <type> <v>SendHandle = send_handle()</v> diff --git a/lib/megaco/doc/src/megaco_user.xml b/lib/megaco/doc/src/megaco_user.xml index 067be15fe0..56d4d51cde 100644 --- a/lib/megaco/doc/src/megaco_user.xml +++ b/lib/megaco/doc/src/megaco_user.xml @@ -32,7 +32,7 @@ <rev>%VSN%</rev> <file>megaco_user.xml</file> </header> - <module>megaco_user</module> + <module since="">megaco_user</module> <modulesummary>Callback module for users of the Megaco application</modulesummary> <description> <p>This module defines the callback behaviour of Megaco users. A @@ -164,8 +164,8 @@ protocol_version() = integer() ]]></code> <funcs> <func> - <name>handle_connect(ConnHandle, ProtocolVersion) -> ok | error | {error,ErrorDescr}</name> - <name>handle_connect(ConnHandle, ProtocolVersion, Extra]) -> ok | error | {error,ErrorDescr}</name> + <name since="">handle_connect(ConnHandle, ProtocolVersion) -> 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> @@ -202,7 +202,7 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_disconnect(ConnHandle, ProtocolVersion, Reason) -> ok</name> + <name since="">handle_disconnect(ConnHandle, ProtocolVersion, Reason) -> ok</name> <fsummary>Invoked when a connection is teared down</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -220,8 +220,8 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_syntax_error(ReceiveHandle, ProtocolVersion, DefaultED) -> reply | {reply, ED} | no_reply | {no_reply, ED} </name> - <name>handle_syntax_error(ReceiveHandle, ProtocolVersion, DefaultED, Extra) -> reply | {reply, ED} | no_reply | {no_reply, ED} </name> + <name since="">handle_syntax_error(ReceiveHandle, ProtocolVersion, DefaultED) -> reply | {reply, ED} | no_reply | {no_reply, ED} </name> + <name since="">handle_syntax_error(ReceiveHandle, ProtocolVersion, DefaultED, Extra) -> reply | {reply, ED} | no_reply | {no_reply, ED} </name> <fsummary>Invoked when a received message had syntax errors</fsummary> <type> <v>ReceiveHandle = receive_handle()</v> @@ -258,8 +258,8 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_message_error(ConnHandle, ProtocolVersion, ErrorDescr) -> ok</name> - <name>handle_message_error(ConnHandle, ProtocolVersion, ErrorDescr, Extra) -> ok</name> + <name since="">handle_message_error(ConnHandle, ProtocolVersion, ErrorDescr) -> ok</name> + <name since="">handle_message_error(ConnHandle, ProtocolVersion, ErrorDescr, Extra) -> ok</name> <fsummary>Invoked when a received message just contains an error</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -291,8 +291,8 @@ protocol_version() = integer() ]]></code> <!-- <func> - <name>handle_segment_error(ConnHandle, ProtocolVersion, TransId, SegmentError) -> ok</name> - <name>handle_segment_error(ConnHandle, ProtocolVersion, TransId, SegmentError, Extra) -> ok</name> + <name since="">handle_segment_error(ConnHandle, ProtocolVersion, TransId, SegmentError) -> ok</name> + <name since="">handle_segment_error(ConnHandle, ProtocolVersion, TransId, SegmentError, Extra) -> ok</name> <fsummary>Invoked when a segment error has been detected</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -316,8 +316,8 @@ protocol_version() = integer() ]]></code> --> <func> - <name>handle_trans_request(ConnHandle, ProtocolVersion, ActionRequests) -> pending() | reply() | ignore_trans_request</name> - <name>handle_trans_request(ConnHandle, ProtocolVersion, ActionRequests, Extra) -> pending() | reply() | ignore_trans_request</name> + <name since="">handle_trans_request(ConnHandle, ProtocolVersion, ActionRequests) -> pending() | reply() | ignore_trans_request</name> + <name since="">handle_trans_request(ConnHandle, ProtocolVersion, ActionRequests, Extra) -> pending() | reply() | ignore_trans_request</name> <fsummary>Invoked for each transaction request</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -420,8 +420,8 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_trans_long_request(ConnHandle, ProtocolVersion, ReqData) -> reply()</name> - <name>handle_trans_long_request(ConnHandle, ProtocolVersion, ReqData, Extra) -> reply()</name> + <name since="">handle_trans_long_request(ConnHandle, ProtocolVersion, ReqData) -> reply()</name> + <name since="">handle_trans_long_request(ConnHandle, ProtocolVersion, ReqData, Extra) -> reply()</name> <fsummary>Optionally invoked for a time consuming transaction request</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -460,8 +460,8 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_trans_reply(ConnHandle, ProtocolVersion, UserReply, ReplyData) -> ok</name> - <name>handle_trans_reply(ConnHandle, ProtocolVersion, UserReply, ReplyData, Extra) -> ok</name> + <name since="">handle_trans_reply(ConnHandle, ProtocolVersion, UserReply, ReplyData) -> ok</name> + <name since="">handle_trans_reply(ConnHandle, ProtocolVersion, UserReply, ReplyData, Extra) -> ok</name> <fsummary>Optionally invoked for a transaction reply</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -593,8 +593,8 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_trans_ack(ConnHandle, ProtocolVersion, AckStatus, AckData) -> ok</name> - <name>handle_trans_ack(ConnHandle, ProtocolVersion, AckStatus, AckData, Extra) -> ok</name> + <name since="">handle_trans_ack(ConnHandle, ProtocolVersion, AckStatus, AckData) -> ok</name> + <name since="">handle_trans_ack(ConnHandle, ProtocolVersion, AckStatus, AckData, Extra) -> ok</name> <fsummary>Optionally invoked for a transaction acknowledgement</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -658,8 +658,8 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_unexpected_trans(ConnHandle, ProtocolVersion, Trans) -> ok</name> - <name>handle_unexpected_trans(ConnHandle, ProtocolVersion, Trans, Extra) -> ok</name> + <name since="">handle_unexpected_trans(ConnHandle, ProtocolVersion, Trans) -> ok</name> + <name since="">handle_unexpected_trans(ConnHandle, ProtocolVersion, Trans, Extra) -> ok</name> <fsummary>Invoked when an unexpected message is received</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -685,8 +685,8 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_trans_request_abort(ConnHandle, ProtocolVersion, TransNo, Pid) -> ok</name> - <name>handle_trans_request_abort(ConnHandle, ProtocolVersion, TransNo, Pid, Extra) -> ok</name> + <name since="">handle_trans_request_abort(ConnHandle, ProtocolVersion, TransNo, Pid) -> ok</name> + <name since="">handle_trans_request_abort(ConnHandle, ProtocolVersion, TransNo, Pid, Extra) -> ok</name> <fsummary>Invoked when an transaction request has been aborted</fsummary> <type> <v>ConnHandle = conn_handle()</v> @@ -710,8 +710,8 @@ protocol_version() = integer() ]]></code> </func> <func> - <name>handle_segment_reply(ConnHandle, ProtocolVersion, TransNo, SegNo, SegCompl) -> ok</name> - <name>handle_segment_reply(ConnHandle, ProtocolVersion, TransNo, SegNo, SegCompl, Extra) -> ok</name> + <name since="">handle_segment_reply(ConnHandle, ProtocolVersion, TransNo, SegNo, SegCompl) -> ok</name> + <name since="">handle_segment_reply(ConnHandle, ProtocolVersion, TransNo, SegNo, SegCompl, Extra) -> ok</name> <fsummary>Segment Reply Indication</fsummary> <type> <v>ConnHandle = conn_handle()</v> diff --git a/lib/megaco/doc/src/note.gif b/lib/megaco/doc/src/note.gif Binary files differdeleted file mode 100644 index 6fffe30419..0000000000 --- a/lib/megaco/doc/src/note.gif +++ /dev/null diff --git a/lib/megaco/doc/src/notes.gif b/lib/megaco/doc/src/notes.gif Binary files differdeleted file mode 100644 index e000cca26a..0000000000 --- a/lib/megaco/doc/src/notes.gif +++ /dev/null diff --git a/lib/megaco/doc/src/notes.xml b/lib/megaco/doc/src/notes.xml index a05a339003..6f33ae390c 100644 --- a/lib/megaco/doc/src/notes.xml +++ b/lib/megaco/doc/src/notes.xml @@ -4,14 +4,14 @@ <chapter> <header> <copyright> - <year>2000</year><year>2016</year> + <year>2000</year><year>2017</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> 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 @@ -19,9 +19,9 @@ 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. - + </legalnotice> - + <title>Megaco Release Notes</title> <prepared>Lars Thorsén, Håkan Mattsson, Micael Karlberg</prepared> <docno></docno> @@ -35,9 +35,77 @@ bugfixes for every release of Megaco. Each release of Megaco thus constitutes one section in this document. The title of each section is the version number of Megaco.</p> - - - <section><title>Megaco 3.18.1</title> + + + <section><title>Megaco 3.18.5</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Minor updates to build system necessary due to move of + configuration of <c>crypto</c> application.</p> + <p> + Own Id: OTP-15262 Aux Id: OTP-15129 </p> + </item> + <item> + <p> + Minor adjustments made to build system for parallel + configure.</p> + <p> + Own Id: OTP-15340 Aux Id: OTP-14625 </p> + </item> + </list> + </section> + +</section> + +<section><title>Megaco 3.18.4</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Improved documentation.</p> + <p> + Own Id: OTP-15190</p> + </item> + </list> + </section> + +</section> + +<section><title>Megaco 3.18.3</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> Removed all old unused files in the documentation. + </p> + <p> + Own Id: OTP-14475 Aux Id: ERL-409, PR-1493 </p> + </item> + </list> + </section> + +</section> + +<section><title>Megaco 3.18.2</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Typos have been fixed.</p> + <p> + Own Id: OTP-14387</p> + </item> + </list> + </section> + +</section> + +<section><title>Megaco 3.18.1</title> <section><title>Improvements and New Features</title> <list> @@ -127,7 +195,7 @@ </item> </list> </section> - + </section> <section><title>Megaco 3.17.0.2</title> @@ -143,7 +211,7 @@ </item> </list> </section> - + </section> <section><title>Megaco 3.17.0.1</title> @@ -175,7 +243,7 @@ <list type="bulleted"> <item> <p>Allow whitespaces in installation path. </p> - <p>It is now possible to give configure and make an + <p>It is now possible to give configure and make an installation/release path with whitespaces in it. </p> <p>Own Id: OTP-10107</p> </item> @@ -187,24 +255,24 @@ <section> <title>Fixed bugs and malfunctions</title> - + <!-- <p>-</p> --> - + <list type="bulleted"> <item> - <p>Buffer overrun error while flex scanner processing + <p>Buffer overrun error while flex scanner processing property parm groups. </p> - <p>This error occured only for large messages if a - buffer realloc was needed while processing the + <p>This error occured only for large messages if a + buffer realloc was needed while processing the property parm groups. </p> <p>Own Id: OTP-10998</p> <p>Aux Id: Seq 12263</p> </item> - + </list> - + </section> <section> @@ -214,10 +282,10 @@ <!-- <list type="bulleted"> <item> - <p>A number of binary encoding alternatives has been removed. + <p>A number of binary encoding alternatives has been removed. The binary encoding option <c>driver</c> has been removed - since this (the use of the asn1 linked in driver) is - now default and there is now way to <em>not</em> use it. + since this (the use of the asn1 linked in driver) is + now default and there is now way to <em>not</em> use it. See <seealso marker="megaco_encode#binary_config">configuration of binary encoding</seealso> for more info. </p> </item> @@ -255,19 +323,19 @@ <section> <title>Fixed bugs and malfunctions</title> - + <p>-</p> - + <!-- <list type="bulleted"> <item> <p>Fixing miscellaneous things detected by dialyzer. </p> <p>Own Id: OTP-9075</p> </item> - + </list> --> - + </section> <section> @@ -278,10 +346,10 @@ <list type="bulleted"> <item> - <p>A number of binary encoding alternatives has been removed. + <p>A number of binary encoding alternatives has been removed. The binary encoding option <c>driver</c> has been removed - since this (the use of the asn1 linked in driver) is - now default and there is now way to <em>not</em> use it. + since this (the use of the asn1 linked in driver) is + now default and there is now way to <em>not</em> use it. See <seealso marker="megaco_encode#binary_config">configuration of binary encoding</seealso> for more info. </p> </item> @@ -307,7 +375,7 @@ <list type="bulleted"> <item> <p>Allow whitespaces in installation path. </p> - <p>It is now possible to give configure and make an + <p>It is now possible to give configure and make an installation/release path with whitespaces in it. </p> <p>Own Id: OTP-10107</p> </item> @@ -317,8 +385,8 @@ </item> <item> - <p>Removed use of deprecated system flag, - <c>global_haeps_size</c>, in the measurement tool + <p>Removed use of deprecated system flag, + <c>global_haeps_size</c>, in the measurement tool <c>mstone1</c>. </p> </item> @@ -328,19 +396,19 @@ <section> <title>Fixed bugs and malfunctions</title> - + <p>-</p> - + <!-- <list type="bulleted"> <item> <p>Fixing miscellaneous things detected by dialyzer. </p> <p>Own Id: OTP-9075</p> </item> - + </list> --> - + </section> <section> @@ -350,8 +418,8 @@ <!-- <list type="bulleted"> <item> - <p>Due to the change in the flex driver API, - we may no longer be able to build and/or use + <p>Due to the change in the flex driver API, + we may no longer be able to build and/or use the flex driver without reentrant support. </p> <p>Own Id: OTP-9795</p> </item> @@ -385,8 +453,8 @@ </item> <item> - <p>Removed use of deprecated system flag, - <c>scheduler_bind_type</c>, in the measurement tool + <p>Removed use of deprecated system flag, + <c>scheduler_bind_type</c>, in the measurement tool <c>mstone1</c>. </p> <p>Own Id: OTP-9949</p> </item> @@ -397,19 +465,19 @@ <section> <title>Fixed bugs and malfunctions</title> - + <p>-</p> - + <!-- <list type="bulleted"> <item> <p>Fixing miscellaneous things detected by dialyzer. </p> <p>Own Id: OTP-9075</p> </item> - + </list> --> - + </section> <section> @@ -419,8 +487,8 @@ <!-- <list type="bulleted"> <item> - <p>Due to the change in the flex driver API, - we may no longer be able to build and/or use + <p>Due to the change in the flex driver API, + we may no longer be able to build and/or use the flex driver without reentrant support. </p> <p>Own Id: OTP-9795</p> </item> @@ -452,8 +520,8 @@ </item> <item> - <p>ASN.1 no longer makes use of a driver to accelerate encode/decode, - instead it uses NIFs. The encoding config option is <em>still</em> + <p>ASN.1 no longer makes use of a driver to accelerate encode/decode, + instead it uses NIFs. The encoding config option is <em>still</em> the same, i.e. <c>driver</c>. </p> <p>Own Id: OTP-9672</p> </item> @@ -476,19 +544,19 @@ <section> <title>Fixed bugs and malfunctions</title> - + <p>-</p> - + <!-- <list type="bulleted"> <item> <p>Fixing miscellaneous things detected by dialyzer. </p> <p>Own Id: OTP-9075</p> </item> - + </list> --> - + </section> <section> @@ -498,8 +566,8 @@ <!-- <list type="bulleted"> <item> - <p>Due to the change in the flex driver API, - we may no longer be able to build and/or use + <p>Due to the change in the flex driver API, + we may no longer be able to build and/or use the flex driver without reentrant support. </p> <p>Own Id: OTP-9795</p> </item> @@ -536,19 +604,19 @@ <section> <title>Fixed bugs and malfunctions</title> - + <p>-</p> - + <!-- <list type="bulleted"> <item> <p>Fixing miscellaneous things detected by dialyzer. </p> <p>Own Id: OTP-9075</p> </item> - + </list> --> - + </section> </section> <!-- 3.15.1.1 --> @@ -567,8 +635,8 @@ <!-- <list type="bulleted"> <item> - <p>Updated the - <seealso marker="megaco_performance">performance</seealso> + <p>Updated the + <seealso marker="megaco_performance">performance</seealso> chapter. </p> <p>Own Id: OTP-8696</p> </item> @@ -622,7 +690,7 @@ <!-- <list type="bulleted"> <item> - <p>Eliminated a possible race condition while creating + <p>Eliminated a possible race condition while creating pending counters. </p> <p>Own Id: OTP-8634</p> <p>Aux Id: Seq 11579</p> @@ -651,8 +719,8 @@ <list type="bulleted"> <item> - <p>Updated the - <seealso marker="megaco_performance">performance</seealso> + <p>Updated the + <seealso marker="megaco_performance">performance</seealso> chapter. </p> <p>Own Id: OTP-8696</p> </item> @@ -679,14 +747,14 @@ <item> <p>Fix shared libraries installation. </p> - <p>The flex shared lib(s) were incorrectly installed as data + <p>The flex shared lib(s) were incorrectly installed as data files. </p> <p>Peter Lemenkov</p> <p>Own Id: OTP-8627</p> </item> <item> - <p>Eliminated a possible race condition while creating + <p>Eliminated a possible race condition while creating pending counters. </p> <p>Own Id: OTP-8634</p> <p>Aux Id: Seq 11579</p> @@ -742,14 +810,14 @@ <item> <p>Fix shared libraries installation. </p> - <p>The flex shared lib(s) were incorrectly installed as data + <p>The flex shared lib(s) were incorrectly installed as data files. </p> <p>Peter Lemenkov</p> <p>Own Id: OTP-8627</p> </item> <item> - <p>Eliminated a possible race condition while creating + <p>Eliminated a possible race condition while creating pending counters. </p> <p>Own Id: OTP-8634</p> <p>Aux Id: Seq 11579</p> @@ -777,18 +845,18 @@ <list type="bulleted"> <item> - <p>Various changes to configure and makefile(s) to facilitate cross + <p>Various changes to configure and makefile(s) to facilitate cross compilation (and other build system improvements). </p> <p>Own Id: OTP-8323</p> </item> <item> - <p>Added a help target in the test Makefile to explain - the most useful make targets, used when testing the + <p>Added a help target in the test Makefile to explain + the most useful make targets, used when testing the application using the test-server provided with megaco.</p> <p>Own Id: OTP-8362</p> </item> - + <item> <p>Adapted megaco_filter to the new internal format.</p> <p>Own Id: OTP-8403</p> @@ -805,16 +873,16 @@ <list type="bulleted"> <item> - <p>Callbacks, when the callback module is unknown (undefined), + <p>Callbacks, when the callback module is unknown (undefined), results in warning messages. </p> <p>A race condition scenario. As part of a cancelation operation, replies with waiting acknowledgements is cancelled. This includes - informing the user (via a call to the handle_trans_ack callback - function). It is possible that at this point the connection data - has been removed, which makes it impossible for megaco to - perform this operation, resulting in the warning message. The - solution is to also store the callback module with the other - reply information, to be used when cleaning up after a + informing the user (via a call to the handle_trans_ack callback + function). It is possible that at this point the connection data + has been removed, which makes it impossible for megaco to + perform this operation, resulting in the warning message. The + solution is to also store the callback module with the other + reply information, to be used when cleaning up after a cancelation. </p> <p>Own Id: OTP-8328</p> <p>Aux Id: Seq 11384</p> @@ -848,8 +916,8 @@ </item> <item> - <p>The documentation is now built with open source tools - (<em>xsltproc</em> and <em>fop</em>) that exists on most + <p>The documentation is now built with open source tools + (<em>xsltproc</em> and <em>fop</em>) that exists on most platforms. One visible change is that the frames are removed.</p> <p>Own Id: OTP-8249</p> </item> @@ -895,11 +963,4 @@ </section> </section> <!-- 3.13 --> - - <!-- section> - <title>Release notes history</title> - <p>For information about older versions see - <url href="part_notes_history_frame.html">release notes history</url>.</p - </section> --> </chapter> - diff --git a/lib/megaco/doc/src/part_notes.xml b/lib/megaco/doc/src/part_notes.xml deleted file mode 100644 index 7a838c5718..0000000000 --- a/lib/megaco/doc/src/part_notes.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE part SYSTEM "part.dtd"> - -<part xmlns:xi="http://www.w3.org/2001/XInclude"> - <header> - <copyright> - <year>2000</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>Megaco/H.248 Release Notes</title> - <prepared>Lars Thorsén, Håkan Mattsson, Micael Karlberg</prepared> - <docno></docno> - <date>2007-06-15</date> - <rev>%VSN%</rev> - <file>part_notes.xml</file> - </header> - <description> - <p>The Megaco application is a framework for building - applications on top of the Megaco/H.248 protocol.</p> - <p>For information about older versions see - <url href="part_notes_history_frame.html">release notes history</url>.</p> - </description> - <xi:include href="notes.xml"/> -</part> - diff --git a/lib/megaco/doc/src/part_notes_history.xml b/lib/megaco/doc/src/part_notes_history.xml deleted file mode 100644 index 0d8f1f2fb5..0000000000 --- a/lib/megaco/doc/src/part_notes_history.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE part SYSTEM "part.dtd"> - -<part> - <header> - <copyright> - <year>2006</year><year>2016</year> - <holder>Ericsson AB. All Rights Reserved.</holder> - </copyright> - <legalnotice> - 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. - - </legalnotice> - - <title>Megaco Release Notes History</title> - <prepared>Micael Karklberg</prepared> - <responsible>OTP</responsible> - <docno></docno> - <approved>OTP</approved> - <checked></checked> - <date>2007-06-15</date> - <rev>A</rev> - <file>part_notes_history.xml</file> - </header> - <description> - <p>The Megaco application is a framework for building - applications on top of the Megaco/H.248 protocol.</p> - </description> - <include file="notes_history"></include> -</part> - diff --git a/lib/megaco/doc/src/ref_man.gif b/lib/megaco/doc/src/ref_man.gif Binary files differdeleted file mode 100644 index b13c4efd53..0000000000 --- a/lib/megaco/doc/src/ref_man.gif +++ /dev/null diff --git a/lib/megaco/doc/src/user_guide.gif b/lib/megaco/doc/src/user_guide.gif Binary files differdeleted file mode 100644 index e6275a803d..0000000000 --- a/lib/megaco/doc/src/user_guide.gif +++ /dev/null diff --git a/lib/megaco/doc/src/warning.gif b/lib/megaco/doc/src/warning.gif Binary files differdeleted file mode 100644 index 96af52360e..0000000000 --- a/lib/megaco/doc/src/warning.gif +++ /dev/null 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/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in index c37ad4d702..26d2ddd44c 100644 --- a/lib/megaco/src/flex/Makefile.in +++ b/lib/megaco/src/flex/Makefile.in @@ -31,25 +31,6 @@ include ../../vsn.mk VSN=$(MEGACO_VSN) # ---------------------------------------------------- -# Dynamic Erlang Driver -# ---------------------------------------------------- -HAVE_USABLE_OTP_DED_MK = @HAVE_USABLE_OTP_DED_MK@ - -ifeq ($(HAVE_USABLE_OTP_DED_MK),yes) -# otp_ded.mk will be used on R13B04 and later -include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk -else -# megacos configure provide the info instead -DED_CC = @CC@ -DED__NOWARN_NOTHR_CFLAGS = @DED_CFLAGS@ -DED_THR_DEFS = @DED_THR_DEFS@ -DED_LD = @DED_LD@ -DED_LDFLAGS = @DED_LDFLAGS@ -DED_INCLUDES = @DED_INCLUDES@ -DED_EXT = so -endif - -# ---------------------------------------------------- # The following variables differ on different systems, we set # reasonable defaults, if something different is needed it should # be set for that system only. @@ -57,20 +38,19 @@ endif FLEX_VSN = $(shell flex --version) -TMP_CFLAGS = $(DED__NOWARN_NOTHR_CFLAGS) @OTP_EXTRA_FLAGS@ +TMP_CFLAGS = @DED_BASIC_CFLAGS@ @OTP_EXTRA_FLAGS@ ifeq ($(TYPE),valgrind) CFLAGS = $(subst -O2, , $(TMP_CFLAGS)) -DVALGRIND else CFLAGS = $(TMP_CFLAGS) endif -CC = $(DED_CC) -CFLAGS_MT = $(CFLAGS) $(DED_THR_DEFS) -LD = $(DED_LD) -LDFLAGS = $(DED_LDFLAGS) +CC = @DED_CC@ +CFLAGS_MT = $(CFLAGS) @DED_THR_DEFS@ +LD = @DED_LD@ +LDFLAGS = @DED_LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ PERL = @PERL@ -ERLANG_OSTYPE = @ERLANG_OSTYPE@ # Shall we build the flex scanner or not. # We assume that it does not exist on windows... @@ -143,8 +123,8 @@ ifeq ($(findstring win32,$(TARGET)), win32) FLEX_SCANNER_SO = SOLIBS = $(FLEX_SCANNER_SO) else -FLEX_SCANNER_SO = $(LIBDIR)/$(STD_DRV).$(DED_EXT) -FLEX_SCANNER_MT_SO = $(LIBDIR)/$(MT_DRV).$(DED_EXT) +FLEX_SCANNER_SO = $(LIBDIR)/$(STD_DRV).@DED_EXT@ +FLEX_SCANNER_MT_SO = $(LIBDIR)/$(MT_DRV).@DED_EXT@ SOLIBS = $(FLEX_SCANNER_SO) $(FLEX_SCANNER_MT_SO) endif @@ -179,7 +159,7 @@ else CFLAGS += -DMFS_FLEX_DEBUG=0 endif -CFLAGS += $(DED_INCLUDES) -I$(ERL_TOP)/erts/$(TARGET) $(DRV_FLAGS) -funroll-loops -Wall +CFLAGS += @DED_INCLUDE@ -I$(ERL_TOP)/erts/$(TARGET) $(DRV_FLAGS) -funroll-loops -Wall #ifneq ($(FLEX_VSN),) #CFLAGS += -DFLEX_VERSION="$(FLEX_VSN)" @@ -398,10 +378,10 @@ $(OBJDIR)/$(MT_DRV).o: $(MT_DRV).c # No need to link with -lfl as we have also defined %option noyywrap - # and having -lfl doesn't work under Darwin for some reason. - Sean -$(LIBDIR)/$(STD_DRV).$(DED_EXT): $(OBJDIR)/$(STD_DRV).o +$(LIBDIR)/$(STD_DRV).@DED_EXT@: $(OBJDIR)/$(STD_DRV).o $(V_colon)@echo "linking std driver:" $(V_LD) $(LDFLAGS) -o $@ $< -$(LIBDIR)/$(MT_DRV).$(DED_EXT): $(OBJDIR)/$(MT_DRV).o +$(LIBDIR)/$(MT_DRV).@DED_EXT@: $(OBJDIR)/$(MT_DRV).o $(V_colon)@echo "linking multi-threaded driver:" $(V_LD) $(LDFLAGS) -o $@ $< diff --git a/lib/megaco/src/text/megaco_text_gen_prev3a.hrl b/lib/megaco/src/text/megaco_text_gen_prev3a.hrl index ae4a990779..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-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. @@ -424,7 +424,7 @@ enc_TransactionReply(#'TransactionReply'{transactionId = Tid, transactionResult = Res, %% These fields are actually not %% supported in this implementation, - %% but because the messanger module + %% but because the messenger module %% cannot see any diff between the %% various v3 implementations... segmentNumber = asn1_NOVALUE, @@ -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 e7fb85d137..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-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. @@ -424,7 +424,7 @@ enc_TransactionReply(#'TransactionReply'{transactionId = Tid, transactionResult = Res, %% These fields are actually not %% supported in this implementation, - %% but because the messanger module + %% but because the messenger module %% cannot see any diff between the %% various v3 implementations... segmentNumber = asn1_NOVALUE, @@ -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 722e97a743..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-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. @@ -434,7 +434,7 @@ enc_TransactionReply(#'TransactionReply'{transactionId = Tid, transactionResult = Res, %% These fields are actually not %% supported in this implementation, - %% but because the messanger module + %% but because the messenger module %% cannot see any diff between the %% various v3 implementations... segmentNumber = asn1_NOVALUE, @@ -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/Makefile b/lib/megaco/test/Makefile index 4ddd73eea1..b4e31765b8 100644 --- a/lib/megaco/test/Makefile +++ b/lib/megaco/test/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. @@ -102,6 +102,9 @@ endif ERL_COMPILE_FLAGS += $(MEGACO_ERL_COMPILE_FLAGS) +# We have a behaviour in the test catalog (megaco_test_generator) +ERL_COMPILE_FLAGS += -pa ../../megaco/test + ERL_PATH = -pa ../../megaco/examples/simple \ -pa ../../megaco/ebin \ -pa ../../et/ebin diff --git a/lib/megaco/test/megaco_SUITE.erl b/lib/megaco/test/megaco_SUITE.erl index 38590f9fee..f7b8ffe032 100644 --- a/lib/megaco/test/megaco_SUITE.erl +++ b/lib/megaco/test/megaco_SUITE.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. @@ -25,7 +25,21 @@ -module(megaco_SUITE). --compile(export_all). +-export([ + suite/0, + all/0, + groups/0, + + init_per_suite/1, + end_per_suite/1, + init_per_group/2, + end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + t/0, t/1, + init/0 + ]). -include("megaco_test_lib.hrl"). -include_lib("megaco/include/megaco.hrl"). @@ -96,6 +110,20 @@ groups() -> {flex, [], [{megaco_flex_test, all}]}]. init_per_suite(Config) -> + io:format("~w:init_per_suite -> entry with" + "~n Config: ~p" + "~n OS Type: ~p" + "~n OS Version: ~s" + "~n", + [?MODULE, + Config, + os:type(), + case os:version() of + {Major, Minor, Release} -> + ?F("~w.~w.~w", [Major, Minor, Release]); + Str when is_list(Str) -> + Str + end]), Config. end_per_suite(_Config) -> diff --git a/lib/megaco/test/megaco_actions_test.erl b/lib/megaco/test/megaco_actions_test.erl index fcbe4f12fa..498e5c91cb 100644 --- a/lib/megaco/test/megaco_actions_test.erl +++ b/lib/megaco/test/megaco_actions_test.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. @@ -20,13 +20,30 @@ %% %%---------------------------------------------------------------------- -%% Purpose: Verify that it is possible to separatelly encode +%% Purpose: Verify that it is possible to separately encode %% the action requests list. Do this with all codec's %% that supports partial encode. %%---------------------------------------------------------------------- -module(megaco_actions_test). --compile(export_all). +-export([ + all/0, + groups/0, + + init_per_group/2, + end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + t/0, t/1, + + pretty_text/1, + flex_pretty_text/1, + compact_text/1, + flex_compact_text/1, + erl_dist/1, + erl_dist_mc/1 + ]). -include("megaco_test_lib.hrl"). -include_lib("megaco/include/megaco.hrl"). @@ -364,9 +381,6 @@ sleep(X) -> receive after X -> ok end. -error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% i(F) -> @@ -376,8 +390,8 @@ i(F, A) -> print(info, get(verbosity), "", F, A). -d(F) -> - d(F, []). +%% d(F) -> +%% d(F, []). d(F, A) -> print(debug, get(verbosity), "DBG: ", F, A). @@ -391,20 +405,10 @@ 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] ~s ~p ~s ***" + "~n " ++ F ++ "~n", + [?FTS(), P, self(), get(sname) | A]); print(_, _, _, _) -> ok. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -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). - diff --git a/lib/megaco/test/megaco_app_test.erl b/lib/megaco/test/megaco_app_test.erl index 981d93f5dd..fff2d8c7d4 100644 --- a/lib/megaco/test/megaco_app_test.erl +++ b/lib/megaco/test/megaco_app_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. @@ -20,29 +20,42 @@ %%---------------------------------------------------------------------- %% Purpose: Verify the application specifics of the Megaco application %%---------------------------------------------------------------------- + -module(megaco_app_test). --compile(export_all). +-export([ + all/0, + + app/0, app/1, + appup/0, appup/1 + ]). -include_lib("common_test/include/ct.hrl"). + %%-------------------------------------------------------------------- %% Common Test interface functions ----------------------------------- %%-------------------------------------------------------------------- + all() -> [ app, appup ]. + %%-------------------------------------------------------------------- %% Test Cases -------------------------------------------------------- %%-------------------------------------------------------------------- + app() -> [{doc, "Test that the megaco app file is ok"}]. app(Config) when is_list(Config) -> ok = test_server:app_test(megaco). + + %%-------------------------------------------------------------------- + appup() -> [{doc, "Test that the megaco appup file is ok"}]. appup(Config) when is_list(Config) -> diff --git a/lib/megaco/test/megaco_appup_test.erl b/lib/megaco/test/megaco_appup_test.erl index 8dc3ad51a0..a06d274844 100644 --- a/lib/megaco/test/megaco_appup_test.erl +++ b/lib/megaco/test/megaco_appup_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. @@ -22,8 +22,23 @@ %%---------------------------------------------------------------------- -module(megaco_appup_test). --compile(export_all). --compile({no_auto_import,[error/1]}). +-export([ + all/0, + groups/0, + + init_per_suite/1, + end_per_suite/1, + + init_per_group/2, + end_per_group/2, + + init_per_testcase/2, + end_per_testcase/2, + + appup_file/1 + ]). + +-compile({no_auto_import, [error/1]}). -include_lib("common_test/include/ct.hrl"). -include("megaco_test_lib.hrl"). @@ -76,6 +91,10 @@ end_per_testcase(_Case, Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Perform a simple check of the appup file +appup_file(suite) -> + []; +appup_file(doc) -> + ["Perform a simple check of the appup file"]; appup_file(Config) when is_list(Config) -> ok = ?t:appup_test(megaco). diff --git a/lib/megaco/test/megaco_call_flow_test.erl b/lib/megaco/test/megaco_call_flow_test.erl index eb4574862d..03caf705ba 100644 --- a/lib/megaco/test/megaco_call_flow_test.erl +++ b/lib/megaco/test/megaco_call_flow_test.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. @@ -38,7 +38,85 @@ -module(megaco_call_flow_test). --compile(export_all). +-export([ + all/0, + groups/0, + + init_per_group/2, + end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + pretty/1, + compact/1, + pretty_flex/1, + compact_flex/1, + bin/1, + ber/1, + per/1, + standard_erl/1, + compressed_erl/1, + + t/0, t/1 + + ]). + +-export([ + msg1/0, msg1/1, + msg2/0, msg2/1, + msg3/0, msg3/1, + msg4/0, msg4/1, + msg5a/0, msg5a/1, + msg5b/0, msg5b/1, + msg6/0, msg6/1, + msg7/0, msg7/1, + msg9/0, msg9/1, + msg10/0, msg10/1, + msg11/0, msg11/1, + msg12/0, msg12/1, + msg13/0, msg13/1, + msg14/0, msg14/1, + msg15/0, msg15/1, + msg16/0, msg16/1, + msg17a/0, msg17a/1, + msg17b/0, msg17b/1, + msg18a/0, msg18a/1, + msg18b/0, msg18b/1, + msg18c/0, msg18c/1, + msg18d/0, msg18d/1, + msg19a/0, msg19a/1, + msg19b/0, msg19b/1, + msg20/0, msg20/1, + msg21/0, msg21/1, + msg22a/0, msg22a/1, + msg22b/0, msg22b/1, + msg23a/0, msg23a/1, + msg23b/0, msg23b/1 + + ]). + +-export([ + encoders/0, + msg_sizes/0, + coding_times/0, + encoding_times/0, + decoding_times/0, + coding_times_stat/0, + encoding_times_stat/0, + decoding_times_stat/0, + size_stat/0, + gnuplot_gif/0, + gnuplot_size_gif/0, + + gen_byte_msg/2, + gen_header_file_binary/1, + gen_ber_header/0, + gen_ber_bin_header/0, + gen_per_header/0, + single_meter/4, + count/2 + ]). + -include_lib("megaco/include/megaco.hrl"). -include_lib("megaco/include/megaco_message_v1.hrl"). -include("megaco_test_lib.hrl"). @@ -53,16 +131,20 @@ init_per_testcase(Case, Config) -> end_per_testcase(Case, Config) -> megaco_test_lib:end_per_testcase(Case, Config). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case all() -> - [{group, text}, {group, binary}]. + [{group, text}, {group, binary}, {group, erl}]. groups() -> - [{text, [], [pretty, compact]}, - {flex, [], [pretty_flex, compact_flex]}, - {binary, [], [bin, ber, per]}]. + [ + {text, [], [pretty, compact]}, + {flex, [], [pretty_flex, compact_flex]}, + {binary, [], [bin, ber, per]}, + {erl, [], [standard_erl, compressed_erl]} + ]. init_per_group(_GroupName, Config) -> Config. diff --git a/lib/megaco/test/megaco_codec_test.erl b/lib/megaco/test/megaco_codec_test.erl index 007136f83e..0dfbabcc81 100644 --- a/lib/megaco/test/megaco_codec_test.erl +++ b/lib/megaco/test/megaco_codec_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. @@ -25,7 +25,18 @@ -module(megaco_codec_test). --compile(export_all). +-export([ + all/0, + groups/0, + + init_per_group/2, + end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + t/0, t/1, + init/0 + ]). -include("megaco_test_lib.hrl"). -include_lib("megaco/include/megaco.hrl"). diff --git a/lib/megaco/test/megaco_codec_test_lib.erl b/lib/megaco/test/megaco_codec_test_lib.erl index 6eee5caaaa..7a3d4e6cf8 100644 --- a/lib/megaco/test/megaco_codec_test_lib.erl +++ b/lib/megaco/test/megaco_codec_test_lib.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. @@ -993,15 +993,15 @@ expect_exec([#expect_instruction{description = Desc, skip({What, Why}) when is_atom(What) andalso is_list(Why) -> Reason = lists:flatten(io_lib:format("~p: ~s", [What, Why])), - exit({skipped, Reason}); + ?SKIP(Reason); skip({What, Why}) -> Reason = lists:flatten(io_lib:format("~p: ~p", [What, Why])), - exit({skipped, Reason}); + ?SKIP(Reason); skip(Reason) when is_list(Reason) -> - exit({skipped, Reason}); + ?SKIP(Reason); skip(Reason1) -> Reason2 = lists:flatten(io_lib:format("~p", [Reason1])), - exit({skipped, Reason2}). + ?SKIP(Reason2). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_config_test.erl b/lib/megaco/test/megaco_config_test.erl index 02e06a722a..d46806927a 100644 --- a/lib/megaco/test/megaco_config_test.erl +++ b/lib/megaco/test/megaco_config_test.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. @@ -25,7 +25,24 @@ -module(megaco_config_test). --compile(export_all). +-export([ + all/0, + groups/0, + + init_per_group/2, + end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + config/1, + transaction_id_counter_mg/1, + transaction_id_counter_mgc/1, + otp_7216/1, + otp_8167/1, + otp_8183/1, + + t/0, t/1 + ]). -include("megaco_test_lib.hrl"). -include_lib("megaco/include/megaco.hrl"). @@ -37,6 +54,19 @@ t(Case) -> megaco_test_lib:t({?MODULE, Case}). min(M) -> timer:minutes(M). %% Test server callbacks +init_per_testcase(Case, Config) when (Case =:= otp_7216) orelse + (Case =:= otp_8167) orelse + (Case =:= otp_8183) -> + i("try starting megaco_config"), + case megaco_config:start_link() of + {ok, _} -> + C = lists:keydelete(tc_timeout, 1, Config), + do_init_per_testcase(Case, [{tc_timeout, min(3)}|C]); + {error, Reason} -> + i("Failed starting megaco_config: " + "~n ~p", [Reason]), + {skip, ?F("Failed starting config: ~p", [Reason])} + end; init_per_testcase(Case, Config) -> C = lists:keydelete(tc_timeout, 1, Config), do_init_per_testcase(Case, [{tc_timeout, min(3)}|C]). @@ -45,6 +75,12 @@ do_init_per_testcase(Case, Config) -> process_flag(trap_exit, true), megaco_test_lib:init_per_testcase(Case, Config). +end_per_testcase(Case, Config) when (Case =:= otp_7216) orelse + (Case =:= otp_8167) orelse + (Case =:= otp_8183) -> + (catch megaco_config:stop()), + process_flag(trap_exit, false), + megaco_test_lib:end_per_testcase(Case, Config); end_per_testcase(Case, Config) -> process_flag(trap_exit, false), megaco_test_lib:end_per_testcase(Case, Config). @@ -60,14 +96,17 @@ end_per_testcase(Case, Config) -> %% Top test case all() -> - [config, {group, transaction_id_counter}, - {group, tickets}]. + [ + config, + {group, transaction_id_counter}, + {group, tickets} + ]. groups() -> - [{transaction_id_counter, [], - [transaction_id_counter_mg, - transaction_id_counter_mgc]}, - {tickets, [], [otp_7216, otp_8167, otp_8183]}]. + [ + {transaction_id_counter, [], transaction_id_counter_cases()}, + {tickets, [], tickets_cases()} + ]. init_per_group(_GroupName, Config) -> Config. @@ -75,6 +114,19 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. +transaction_id_counter_cases() -> + [ + transaction_id_counter_mg, + transaction_id_counter_mgc + ]. + +tickets_cases() -> + [ + otp_7216, + otp_8167, + otp_8183 + ]. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Config test case @@ -736,9 +788,6 @@ otp_7216(Config) when is_list(Config) -> put(tc, otp_7216), p("start"), - p("start the megaco config process"), - megaco_config:start_link(), - LocalMid1 = {deviceName, "local-mid-1"}, %% LocalMid2 = {deviceName, "local-mid-2"}, RemoteMid1 = {deviceName, "remote-mid-1"}, @@ -859,9 +908,6 @@ otp_8167(Config) when is_list(Config) -> put(tc, otp8167), p("start"), - p("start the megaco config process"), - megaco_config:start_link(), - LocalMid1 = {deviceName, "local-mid-1"}, LocalMid2 = {deviceName, "local-mid-2"}, RemoteMid1 = {deviceName, "remote-mid-1"}, @@ -981,9 +1027,6 @@ otp_8183(Config) when is_list(Config) -> put(tc, otp8183), p("start"), - p("start the megaco config process"), - megaco_config:start_link(), - LocalMid1 = {deviceName, "local-mid-1"}, LocalMid2 = {deviceName, "local-mid-2"}, RemoteMid1 = {deviceName, "remote-mid-1"}, @@ -1122,28 +1165,18 @@ i(F) -> i(F, []). i(F, A) -> - print(info, get(verbosity), now(), get(tc), "INF", F, A). + print(info, get(verbosity), get(tc), "INF", F, A). printable(_, debug) -> true; printable(info, info) -> true; printable(_,_) -> false. -print(Severity, Verbosity, Ts, Tc, P, F, A) -> - print(printable(Severity,Verbosity), Ts, Tc, P, F, A). +print(Severity, Verbosity, Tc, P, F, A) -> + print(printable(Severity,Verbosity), Tc, P, F, A). -print(true, Ts, Tc, P, F, A) -> +print(true, Tc, P, F, A) -> io:format("*** [~s] ~s ~p ~s:~w ***" "~n " ++ F ++ "~n", - [format_timestamp(Ts), P, self(), get(sname), Tc | A]); -print(_, _, _, _, _, _) -> + [?FTS(), P, self(), get(sname), Tc | A]); +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). - diff --git a/lib/megaco/test/megaco_digit_map_test.erl b/lib/megaco/test/megaco_digit_map_test.erl index 998e829b67..e03d38497c 100644 --- a/lib/megaco/test/megaco_digit_map_test.erl +++ b/lib/megaco/test/megaco_digit_map_test.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. @@ -24,7 +24,27 @@ %%---------------------------------------------------------------------- -module(megaco_digit_map_test). --compile(export_all). +-export([ + all/0, + groups/0, + + init_per_group/2, + end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + otp_5750_01/1, + otp_5750_02/1, + otp_5799_01/1, + otp_5826_01/1, + otp_5826_02/1, + otp_5826_03/1, + otp_7449_1/1, + otp_7449_2/1, + + t/0, t/1 + ]). + -include("megaco_test_lib.hrl"). @@ -44,16 +64,18 @@ end_per_testcase(Case, Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> - [{group, tickets}]. + [ + {group, tickets} + ]. groups() -> - [{tickets, [], - [{group, otp_5750}, {group, otp_5799}, - {group, otp_5826}, {group, otp_7449}]}, - {otp_5750, [], [otp_5750_01, otp_5750_02]}, - {otp_5799, [], [otp_5799_01]}, - {otp_5826, [], [otp_5826_01, otp_5826_02, otp_5826_03]}, - {otp_7449, [], [otp_7449_1, otp_7449_2]}]. + [ + {tickets, [], tickets_cases()}, + {otp_5750, [], otp_5750_cases()}, + {otp_5799, [], otp_5799_cases()}, + {otp_5826, [], otp_5826_cases()}, + {otp_7449, [], otp_7449_cases()} + ]. init_per_group(_GroupName, Config) -> Config. @@ -62,6 +84,38 @@ end_per_group(_GroupName, Config) -> Config. +tickets_cases() -> + [ + {group, otp_5750}, + {group, otp_5799}, + {group, otp_5826}, + {group, otp_7449} + ]. + +otp_5750_cases() -> + [ + otp_5750_01, + otp_5750_02 + ]. + +otp_5799_cases() -> + [ + otp_5799_01 + ]. + +otp_5826_cases() -> + [ + otp_5826_01, + otp_5826_02, + otp_5826_03 + ]. + +otp_7449_cases() -> + [ + otp_7449_1, + otp_7449_2 + ]. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/megaco/test/megaco_examples_test.erl b/lib/megaco/test/megaco_examples_test.erl index 45a6c5011a..fdf9fe29ff 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. @@ -25,12 +25,27 @@ -module(megaco_examples_test). --compile(export_all). +-export([ + all/0, + groups/0, + + init_per_group/2, + end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + simple/1, + + t/0, t/1 + ]). + -include("megaco_test_lib.hrl"). -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 +71,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 +92,7 @@ purge_examples() -> [code:purge(M) || M <- example_modules()] end. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case @@ -87,94 +113,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 megaco",[]), - ?VERIFY(ok, megaco:start()), + d("simple -> start nodes"), + ok = ?LIB:start_nodes(Nodes, ?MODULE, ?LINE), - d("simple -> start mgc",[]), - ?APPLY(ProxyPid, fun() -> megaco_simple_mgc:start() end), + 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 MGC megaco"), + exec(MGCProxy, MGCId, MegacoStart, + fun(Res) -> MegacoStartVerify(MGCId, Res) end), + %% ?APPLY(MGCProxy, fun() -> ok = megaco:start() end), + ?SLEEP(1000), + + 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_flex_test.erl b/lib/megaco/test/megaco_flex_test.erl index 999d1abc6c..27c46a3b47 100644 --- a/lib/megaco/test/megaco_flex_test.erl +++ b/lib/megaco/test/megaco_flex_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2016. All Rights Reserved. +%% Copyright Ericsson AB 2008-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. @@ -219,18 +219,5 @@ p(F, A) -> TC = get(tc), io:format("*** [~s] ~p ~w ***" "~n " ++ F ++ "~n", - [formated_timestamp(), self(), TC | A]). - -formated_timestamp() -> - format_timestamp(erlang: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). - + [?FTS(), self(), TC | A]). diff --git a/lib/megaco/test/megaco_load_test.erl b/lib/megaco/test/megaco_load_test.erl index 511e5a2e8e..9cce9e70ce 100644 --- a/lib/megaco/test/megaco_load_test.erl +++ b/lib/megaco/test/megaco_load_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. @@ -24,7 +24,33 @@ %%---------------------------------------------------------------------- -module(megaco_load_test). --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_user_light_load/1, + single_user_medium_load/1, + single_user_heavy_load/1, + single_user_extreme_load/1, + + multi_user_light_load/1, + multi_user_medium_load/1, + multi_user_heavy_load/1, + multi_user_extreme_load/1, + + t/0, t/1 + ]). + +-export([ + do_multi_load/3, + multi_load_collector/7 + ]). + -include("megaco_test_lib.hrl"). -include_lib("megaco/include/megaco.hrl"). @@ -66,8 +92,6 @@ t() -> megaco_test_lib:t(?MODULE). t(Case) -> megaco_test_lib:t({?MODULE, Case}). -min(M) -> timer:minutes(M). - %% Test server callbacks init_per_testcase(single_user_light_load = Case, Config) -> C = lists:keydelete(tc_timeout, 1, Config), @@ -108,15 +132,33 @@ end_per_testcase(Case, Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> - [single_user_light_load, - single_user_medium_load, single_user_heavy_load, - single_user_extreme_load, multi_user_light_load, - multi_user_medium_load, multi_user_heavy_load, - multi_user_extreme_load]. + [ + {group, single}, + {group, multi} + ]. groups() -> - []. - + [ + {single, [], single_cases()}, + {multi, [], multi_cases()} + ]. + +single_cases() -> + [ + single_user_light_load, + single_user_medium_load, + single_user_heavy_load, + single_user_extreme_load + ]. + +multi_cases() -> + [ + multi_user_light_load, + multi_user_medium_load, + multi_user_heavy_load, + multi_user_extreme_load + ]. + init_per_group(_GroupName, Config) -> Config. @@ -326,6 +368,17 @@ load_controller(Config, Fun) when is_list(Config) and is_function(Fun) -> d("load_controller -> " "loader [~p] terminated with ok~n", [Loader]), ok; + {'EXIT', Loader, {skipped, {fatal, Reason, File, Line}}} -> + i("load_controller -> " + "loader [~p] terminated with fatal skip" + "~n Reason: ~p" + "~n At: ~p:~p", [Loader, Reason, File, Line]), + ?SKIP(Reason); + {'EXIT', Loader, {skipped, Reason}} -> + i("load_controller -> " + "loader [~p] terminated with skip" + "~n Reason: ~p", [Loader, Reason]), + ?SKIP(Reason); {'EXIT', Loader, Reason} -> i("load_controller -> " "loader [~p] terminated with" @@ -629,14 +682,6 @@ make_mids([MgNode|MgNodes], Mids) -> exit("Test node must be started with '-sname'") end. -tim() -> - {A,B,C} = erlang:now(), - A*1000000000+B*1000+(C div 1000). - -sleep(X) -> receive after X -> ok end. - -error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). - maybe_display_system_info(NumLoaders) when NumLoaders > 50 -> [{display_system_info, timer:seconds(2)}]; maybe_display_system_info(NumLoaders) when NumLoaders > 10 -> @@ -647,50 +692,32 @@ maybe_display_system_info(_) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +min(M) -> timer:minutes(M). + i(F) -> i(F, []). i(F, A) -> - print(info, get(verbosity), now(), get(tc), "INF", F, A). + print(info, get(verbosity), get(tc), "INF", F, A). d(F) -> d(F, []). d(F, A) -> - print(debug, get(verbosity), now(), get(tc), "DBG", F, A). + print(debug, get(verbosity), get(tc), "DBG", F, A). printable(_, debug) -> true; printable(info, info) -> true; printable(_,_) -> false. -print(Severity, Verbosity, Ts, Tc, P, F, A) -> - print(printable(Severity,Verbosity), Ts, Tc, P, F, A). +print(Severity, Verbosity, Tc, P, F, A) -> + print(printable(Severity,Verbosity), Tc, P, F, A). -print(true, Ts, Tc, P, F, A) -> +print(true, Tc, P, F, A) -> io:format("*** [~s] ~s ~p ~s:~w ***" "~n " ++ F ++ "~n", - [format_timestamp(Ts), P, self(), get(sname), Tc | A]); -print(_, _, _, _, _, _) -> + [?FTS(), P, self(), get(sname), Tc | A]); +print(_, _, _, _, _) -> ok. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -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). - -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_mess_test.erl b/lib/megaco/test/megaco_mess_test.erl index 7af6f26bf1..3fd39a9e58 100644 --- a/lib/megaco/test/megaco_mess_test.erl +++ b/lib/megaco/test/megaco_mess_test.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. @@ -281,6 +281,8 @@ -define(VERSION, 1). +-define(USER_MOD, megaco_mess_user_test). + -define(TEST_VERBOSITY, debug). -define(MGC_VERBOSITY, debug). -define(MG_VERBOSITY, debug). @@ -303,26 +305,48 @@ -define(MG_NOTIF_RAR(Pid), megaco_test_mg:notify_request_and_reply(Pid)). -define(SEND(Expr), - ?VERIFY(ok, megaco_mess_user_test:apply_proxy(fun() -> Expr end))). + ?VERIFY(ok, ?USER_MOD:apply_proxy(fun() -> Expr end))). -define(USER(Expected, Reply), - megaco_mess_user_test:reply(?MODULE, - ?LINE, - fun(Actual) -> - case ?VERIFY(Expected, Actual) of - Expected -> {ok, Reply}; - UnExpected -> {error, {reply_verify, - ?MODULE, - ?LINE, - UnExpected}} - end - end)). - -%% t() -> megaco_test_lib:t(?MODULE). -%% t(Case) -> megaco_test_lib:t({?MODULE, Case}). - - -min(M) -> timer:minutes(M). + ?USER_MOD:reply(?MODULE, + ?LINE, + fun(Actual) -> + case ?VERIFY(Expected, Actual) of + Expected -> {ok, Reply}; + UnExpected -> {error, {reply_verify, + ?MODULE, + ?LINE, + UnExpected}} + end + end)). + +%% Some generator (utility) macros +-define(GM_START(), megaco_start). +-define(GM_STOP(), megaco_stop). +-define(GM_START_USER(M, RI, C), {megaco_start_user, M, RI, C}). +-define(GM_START_USER(M, RI), ?GM_START_USER(M, RI, [])). +-define(GM_STOP_USER(), megaco_stop_user). +-define(GMSI(I), {megaco_system_info, I}). +-define(GMSI_USERS(), ?GMSI(users)). +-define(GMSI_CONNS(), ?GMSI(connections)). +-define(GMCAST(Reqs, Opts), {megaco_cast, Reqs, Opts}). +-define(GMCAST(Reqs), ?GMCAST(Reqs, [])). +-define(GMCB(CB, VF), {megaco_callback, CB, VF}). +-define(GMCB_CONNECT(VF), ?GMCB(handle_connect, VF)). +-define(GMCB_TRANS_REP(VF), ?GMCB(handle_trans_reply, VF)). +-define(GMT(T), {megaco_trace, T}). +-define(GMT_ENABLE(), ?GMT(enable)). +-define(GMT_DISABLE(), ?GMT(disable)). +-define(GD(D), {debug, D}). +-define(GD_ENABLE(), ?GD(true)). +-define(GD_DISABLE(), ?GD(false)). +-define(GS(T), {sleep, T}). + +-define(GSND(T, D), {send, T, D}). +-define(GERCV(T, VF, TO), {expect_receive, T, {VF, TO}}). + + +min(M) -> ?MINS(M). %% Test server callbacks init_per_testcase(otp_7189 = Case, Config) -> @@ -396,8 +420,19 @@ groups() -> init_per_suite(Config) -> io:format("~w:init_per_suite -> entry with" - "~n Config: ~p" - "~n", [?MODULE, Config]), + "~n Config: ~p" + "~n OS Type: ~p" + "~n OS Version: ~s" + "~n", + [?MODULE, + Config, + os:type(), + case os:version() of + {Major, Minor, Release} -> + ?F("~w.~w.~w", [Major, Minor, Release]); + Str when is_list(Str) -> + Str + end]), Config. end_per_suite(_Config) -> @@ -491,12 +526,12 @@ request_and_reply_plain(suite) -> request_and_reply_plain(Config) when is_list(Config) -> ?ACQUIRE_NODES(1, Config), d("request_and_reply_plain -> start proxy",[]), - megaco_mess_user_test:start_proxy(), + ?USER_MOD:start_proxy(), PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), MgcMid = ipv4_mid(), - UserMod = megaco_mess_user_test, + UserMod = ?USER_MOD, d("request_and_reply_plain -> start megaco app",[]), ?VERIFY(ok, application:start(megaco)), UserConfig = [{user_mod, UserMod}, {send_mod, UserMod}, @@ -564,6 +599,7 @@ request_and_reply_plain(Config) when is_list(Config) -> ok. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% OTP-4760 @@ -597,6 +633,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 +658,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 +680,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)]), @@ -1697,9 +1751,6 @@ rarpaop_mg_event_sequence(Port, EncMod, EncConf) -> ScrVerifyFun = ?rarpaop_mg_verify_service_change_rep_msg_fun(), PendVerifyFun = ?rarpaop_mg_verify_pending_msg_fun(TransId), NrVerifyFun = ?rarpaop_mg_verify_notify_rep_msg_fun(TransId, TermId), -%% ScrVerifyFun = rarpaop_mg_verify_service_change_rep_msg_fun(), -%% PendVerifyFun = rarpaop_mg_verify_pending_msg_fun(TransId), -%% NrVerifyFun = rarpaop_mg_verify_notify_rep_msg_fun(TransId, TermId), EvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -2341,9 +2392,6 @@ strar_mg_event_sequence(text, tcp) -> ConnectVerify = ?strar_mg_verify_handle_connect_fun(), ServiceChangeReplyVerify = ?strar_mg_verify_service_change_reply_fun(), NotifyReplyVerify = ?strar_mg_verify_notify_reply_fun(), -%% ConnectVerify = strar_mg_verify_handle_connect_fun(), -%% ServiceChangeReplyVerify = strar_mg_verify_service_change_reply_fun(), -%% NotifyReplyVerify = fun strar_mg_verify_notify_reply/1, EvSeq = [ {debug, true}, megaco_start, @@ -3419,9 +3467,6 @@ raraa_mg_event_sequence(text, tcp) -> ScrVerifyFun = ?raraa_mg_verify_service_change_rep_msg_fun(), NrVerifyFun = ?raraa_mg_verify_notify_rep_msg_fun(TermId, TransId, ReqId, CtxId), -%% ScrVerifyFun = raraa_mg_verify_service_change_rep_msg_fun(), -%% NrVerifyFun = raraa_mg_verify_notify_rep_msg_fun(TermId, -%% TransId, ReqId, CtxId), EvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -4030,9 +4075,6 @@ rarana_mg_event_sequence(text, tcp) -> ScrVerifyFun = ?rarana_mg_verify_service_change_rep_msg_fun(), NrVerifyFun = ?rarana_mg_verify_notify_rep_msg_fun(TermId, TransId, ReqId, CtxId), -%% ScrVerifyFun = rarana_mg_verify_service_change_rep_msg_fun(), -%% NrVerifyFun = rarana_mg_verify_notify_rep_msg_fun(TermId, -%% TransId, ReqId, CtxId), EvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -4645,9 +4687,6 @@ rarala_mg_event_sequence(text, tcp) -> ScrVerifyFun = ?rarala_mg_verify_service_change_rep_msg_fun(), NrVerifyFun = ?rarala_mg_verify_notify_rep_msg_fun(TermId, TransId, ReqId, CtxId), -%% ScrVerifyFun = rarala_mg_verify_service_change_rep_msg_fun(), -%% NrVerifyFun = rarala_mg_verify_notify_rep_msg_fun(TermId, -%% TransId, ReqId, CtxId), EvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -5280,15 +5319,6 @@ trarar_mg_event_sequence(text, tcp) -> ?trarar_mg_verify_notify_rep_msg_fun(TermId, 2, 3, 3), NrVerifyFun4 = ?trarar_mg_verify_notify_rep_msg_fun(TermId, 2, 4, 4), -%% ScrVerifyFun = trarar_mg_verify_service_change_rep_msg_fun(), -%% NrVerifyFun1 = -%% trarar_mg_verify_notify_rep_msg_fun(TermId, 2, 1, 1), -%% NrVerifyFun2 = -%% trarar_mg_verify_notify_rep_msg_fun(TermId, 2, 2, 2), -%% NrVerifyFun3 = -%% trarar_mg_verify_notify_rep_msg_fun(TermId, 2, 3, 3), -%% NrVerifyFun4 = -%% trarar_mg_verify_notify_rep_msg_fun(TermId, 2, 4, 4), EvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -5965,11 +5995,6 @@ pap_mg_event_sequence(text, tcp) -> ?pap_mg_verify_pending_msg_fun(TransId), NrVerifyFun = ?pap_mg_verify_notify_rep_msg_fun(TermId, TransId, ReqId, CtxId), -%% ScrVerifyFun = pap_mg_verify_service_change_rep_msg_fun(), -%% PendingVerifyFun = -%% pap_mg_verify_pending_msg_fun(TransId), -%% NrVerifyFun = -%% pap_mg_verify_notify_rep_msg_fun(TermId, TransId, ReqId, CtxId), EvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -6362,10 +6387,6 @@ rapalr_mgc_event_sequence(text, tcp) -> NrVerifyFun = ?rapalr_mgc_verify_notify_req_msg_fun(TermId, TransId, ReqId, CtxId), AckVerifyFun = ?rapalr_mgc_verify_trans_ack_msg_fun(TransId), -%% ScrVerifyFun = rapalr_mgc_verify_service_change_req_msg_fun(), -%% NrVerifyFun = -%% rapalr_mgc_verify_notify_req_msg_fun(TermId, TransId, ReqId, CtxId), -%% AckVerifyFun = rapalr_mgc_verify_trans_ack_msg_fun(TransId), EvSeq = [{debug, false}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -6848,12 +6869,12 @@ dist(Config) when is_list(Config) -> ?SKIP("Needs a re-write..."), [_Local, Dist] = ?ACQUIRE_NODES(2, Config), d("dist -> start proxy",[]), - megaco_mess_user_test:start_proxy(), + ?USER_MOD:start_proxy(), PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), MgcMid = ipv4_mid(), - UserMod = megaco_mess_user_test, + UserMod = ?USER_MOD, d("dist -> start megaco app",[]), ?VERIFY(ok, application:start(megaco)), UserConfig = [{user_mod, UserMod}, {send_mod, UserMod}, @@ -6959,7 +6980,7 @@ dist(Config) when is_list(Config) -> ?RECEIVE([]), d("dist -> stop proxy",[]), - megaco_mess_user_test:stop_proxy(), + ?USER_MOD:stop_proxy(), d("dist -> done", []), ok. @@ -7426,9 +7447,6 @@ otp_5805_mg_event_sequence(text, tcp) -> ?otp_5805_mg_verify_service_change_rep_msg_fun(), EDVerify = ?otp_5805_mg_verify_error_descriptor_msg_fun(), -%% ServiceChangeReplyVerifyFun = -%% otp_5805_mg_verify_service_change_rep_msg_fun(), -%% EDVerify = otp_5805_mg_verify_error_descriptor_msg_fun(), MgEvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -7921,8 +7939,6 @@ otp_5881_mgc_event_sequence(text, tcp) -> %% Pending = otp_5881_pending_msg(Mid,2), ServiceChangeVerifyFun = ?otp_5881_mgc_verify_service_change_req_msg_fun(), NotifyReqVerifyFun = ?otp_5881_mgc_verify_notify_req_msg_fun(), -%% ServiceChangeVerifyFun = otp_5881_verify_service_change_req_msg_fun(), -%% NotifyReqVerifyFun = otp_5881_verify_notify_request_fun(), MgcEvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -8193,8 +8209,6 @@ otp_5887_mgc_event_sequence(text, tcp) -> NotifyReply = otp_5887_notify_reply_msg(Mid, 2, 0, TermId), ServiceChangeVerifyFun = ?otp_5887_mgc_verify_service_change_req_msg_fun(), NotifyReqVerifyFun = ?otp_5887_mgc_verify_notify_req_msg_fun(), -%% ServiceChangeVerifyFun = otp_5887_verify_service_change_req_msg_fun(), -%% NotifyReqVerifyFun = otp_5887_verify_notify_request_fun(), MgcEvSeq = [{debug, true}, {decode, DecodeFun}, {encode, EncodeFun}, @@ -8344,7 +8358,7 @@ otp_6253(Config) when is_list(Config) -> MgMid = ipv4_mid(4711), ?VERIFY(ok, application:start(megaco)), - ?VERIFY(ok, megaco:start_user(MgMid, [{send_mod, megaco_mess_user_test}, + ?VERIFY(ok, megaco:start_user(MgMid, [{send_mod, ?USER_MOD}, {request_timer, infinity}, {reply_timer, infinity}])), @@ -8650,8 +8664,6 @@ otp_6275_mgc_event_sequence(text, tcp) -> NotifyReq = otp_6275_mgc_notify_request_msg(Mid, 2, 1, TermId, 1), SCRVerifyFun = ?otp_6275_mgc_verify_service_change_req_msg_fun(), NotifyReplyVerifyFun = ?otp_6275_mgc_verify_notify_rep_msg_fun(), -%% SCRVerifyFun = otp_6275_mgc_verify_service_change_req_fun(), -%% NotifyReplyVerifyFun = otp_6275_mgc_verify_notify_reply_fun(), MgcEvSeq = [{debug, true}, {decode, DecodeFun}, @@ -10997,12 +11009,12 @@ otp_6865_request_and_reply_plain_extra1(Config) when is_list(Config) -> ok = megaco_tc_controller:insert(extra_transport_info, ExtraInfo), d("start proxy",[]), - megaco_mess_user_test:start_proxy(), + ?USER_MOD:start_proxy(), PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), MgcMid = ipv4_mid(), - UserMod = megaco_mess_user_test, + UserMod = ?USER_MOD, d("start megaco app",[]), ?VERIFY(ok, application:start(megaco)), UserConfig = [{user_mod, UserMod}, {send_mod, UserMod}, @@ -12268,15 +12280,15 @@ otp_7189_mg_event_sequence(text, tcp) -> ?otp_7189_mg_verify_service_change_rep_msg_fun(), NotifyReqVerify = ?otp_7189_mg_verify_notify_req_msg_fun(TermId, TransId, ReqId, CtxId), EvSeq = [ - {debug, true}, + ?GD_ENABLE(), {decode, DecodeFun}, {encode, EncodeFun}, {connect, 2944}, - {send, "service-change-request", ServiceChangeReq}, - {expect_receive, "service-change-reply", {ServiceChangeReplyVerifyFun, 2000}}, - {expect_receive, "notify request", {NotifyReqVerify, 2000}}, - {sleep, 100}, - {send, "pending", Pending}, + ?GSND("service-change-request", ServiceChangeReq), + ?GERCV("service-change-reply", ServiceChangeReplyVerifyFun, ?SECS(5)), + ?GERCV("notify request", NotifyReqVerify, ?SECS(5)), + ?GS(100), + ?GSND("pending", Pending), {expect_closed, timer:seconds(120)}, disconnect ], @@ -12514,7 +12526,7 @@ otp_7259(Config) when is_list(Config) -> megaco_test_generic_transport:incomming_message(Pid, NotifyReply), d("[MG] await the generator reply"), - await_completion([MgId], 5000), + await_completion([MgId], 7000), %% Tell Mg to stop i("[MG] stop generator"), @@ -12814,13 +12826,13 @@ otp_7713(Config) when is_list(Config) -> i("starting"), d("start proxy",[]), - megaco_mess_user_test:start_proxy(), + ?USER_MOD:start_proxy(), Extra = otp7713_extra, PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), MgcMid = ipv4_mid(), - UserMod = megaco_mess_user_test, + UserMod = ?USER_MOD, d("start megaco app",[]), ?VERIFY(ok, application:start(megaco)), UserConfig = [{user_mod, UserMod}, {send_mod, UserMod}, @@ -12936,10 +12948,11 @@ otp_8183_request1(Config) when is_list(Config) -> i("wait some before issuing the notify reply (twice)"), sleep(500), - i("send the notify reply, twice times"), + i("send the notify reply - twice"), NotifyReply = otp_8183_r1_mgc_notify_reply_msg(MgcMid, TransId2, Cid2, TermId2), megaco_test_generic_transport:incomming_message(Pid, NotifyReply), + sleep(100), %% This is to "make sure" the events come in the "right" order megaco_test_generic_transport:incomming_message(Pid, NotifyReply), d("await the generator reply"), @@ -13210,13 +13223,33 @@ otp_8183_r1_mg_verify_notify_rep_fun(Nr) -> end. -endif. -otp_8183_r1_mg_verify_notify_rep(Nr, +otp_8183_r1_mg_verify_notify_rep( + Nr, {handle_trans_reply, _CH, ?VERSION, {ok, Nr, [AR]}, _}) -> io:format("otp_8183_r1_mg_verify_notify_rep -> ok" "~n Nr: ~p" "~n AR: ~p" "~n", [Nr, AR]), {ok, AR, ok}; +otp_8183_r1_mg_verify_notify_rep( + ExpNr, + {handle_trans_reply, _CH, ?VERSION, {ok, ActNr, [AR]}, _}) -> + io:format("otp_8183_r1_mg_verify_notify_rep -> error" + "~n Expected Nr: ~p" + "~n Actual Nr: ~p" + "~n AR: ~p" + "~n", [ExpNr, ActNr, AR]), + Error = {unexpected_nr, ExpNr, ActNr}, + {error, Error, ok}; +otp_8183_r1_mg_verify_notify_rep( + Nr, + {handle_trans_reply, _CH, ?VERSION, Res, _}) -> + io:format("otp_8183_r1_mg_verify_notify_rep -> error" + "~n Nr: ~p" + "~n Res: ~p" + "~n", [Nr, Res]), + Error = {unexpected_result, Nr, Res}, + {error, Error, ok}; otp_8183_r1_mg_verify_notify_rep(Nr, Else) -> io:format("otp_8183_r1_mg_verify_notify_rep -> unknown" "~n Nr: ~p" @@ -13711,38 +13744,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 +13783,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_mess_user_test.erl b/lib/megaco/test/megaco_mess_user_test.erl index b5a554112e..d2a9c0f290 100644 --- a/lib/megaco/test/megaco_mess_user_test.erl +++ b/lib/megaco/test/megaco_mess_user_test.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. @@ -86,13 +86,13 @@ reply(Mod, Line, Fun) when is_function(Fun) -> {?MODULE, Pid, UserCallback} -> UserReply = Fun(UserCallback), Pid ! {?MODULE, self(), UserReply}, - UserReply; - Other -> - megaco_test_lib:error(Other, Mod, Line), - {error, Other} -%% after 1000 -> -%% megaco_test_lib:error(timeout, Mod, Line), -%% {error, timeout} + UserReply%% ; + %% Other -> + %% megaco_test_lib:error(Other, Mod, Line), + %% {error, Other} + after 10000 -> + megaco_test_lib:error(timeout, Mod, Line), + {error, timeout} end. call(UserCallback) -> diff --git a/lib/megaco/test/megaco_mib_test.erl b/lib/megaco/test/megaco_mib_test.erl index d644d6bc09..9d1d408f18 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 statistics (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 statistics (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]). @@ -678,7 +751,7 @@ mgc_init(Config) -> d("mgc_init -> entry"), Mid = get_conf(local_mid, Config), RI = get_conf(receive_info, Config), - d("mgc_init -> start megaco"), + i("mgc_init -> start megaco"), application:start(megaco), d("mgc_init -> start megaco user"), megaco:start_user(Mid, []), @@ -690,7 +763,7 @@ mgc_init(Config) -> RH = megaco:user_info(Mid,receive_handle), d("mgc_init -> parse receive info"), ListenTo = mgc_parse_receive_info(RI, RH), - d("mgc_init -> start transports"), + i("mgc_init -> start transport(s)"), {Tcp, Udp} = mgc_start_transports(ListenTo), {Mid, Tcp, Udp}. @@ -875,7 +948,7 @@ mgc_start_transports([{_Port, RH}|_ListenTo], _TcpSup, _UdpSup) -> mgc_start_tcp(RH, Port, undefined) -> - d("start tcp transport"), + i("start tcp transport"), case megaco_tcp:start_transport() of {ok, Sup} -> mgc_start_tcp(RH, Port, Sup); @@ -883,7 +956,7 @@ mgc_start_tcp(RH, Port, undefined) -> throw({error, {failed_starting_tcp_transport, Else}}) end; mgc_start_tcp(RH, Port, Sup) when is_pid(Sup) -> - d("tcp listen on ~p", [Port]), + i("tcp listen on ~p", [Port]), Opts = [{port, Port}, {receive_handle, RH}, {tcp_options, [{nodelay, true}]}], @@ -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}}); @@ -913,7 +986,7 @@ mgc_tcp_create_listen(Sup, Opts, MaxN, N, _InitialReason) mgc_start_udp(RH, Port, undefined) -> - d("start udp transport"), + i("start udp transport"), case megaco_udp:start_transport() of {ok, Sup} -> mgc_start_udp(RH, Port, Sup); @@ -921,7 +994,7 @@ mgc_start_udp(RH, Port, undefined) -> throw({error, {failed_starting_udp_transport, Else}}) end; mgc_start_udp(RH, Port, Sup) -> - d("open udp ~p", [Port]), + i("open udp ~p", [Port]), Opts = [{port, Port}, {receive_handle, RH}], case megaco_udp:open(Sup, Opts) of {ok, _SendHandle, _ControlPid} -> @@ -1044,10 +1117,9 @@ 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"), + i("mg_init -> start megaco"), application:start(megaco), d("mg_init -> start megaco user"), megaco:start_user(Mid, []), @@ -1059,7 +1131,7 @@ mg_init(Config) -> RH = megaco:user_info(Mid,receive_handle), d("mg_init -> parse receive info"), {MgcPort,RH1} = mg_parse_receive_info(RI, RH), - d("mg_init -> start transport with"), + i("mg_init -> start transport(s)"), ConnHandle = mg_start_transport(MgcPort, RH1), {Mid, ConnHandle}. @@ -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); @@ -1183,16 +1255,6 @@ mg_close_conn(CH) -> SendMod -> exit(Pid, Reason) end. -% display_tuple(T) when tuple(T), size(T) > 0 -> -% i("size(T): ~p", [size(T)]), -% display_tuple(T,1). - -% display_tuple(T,P) when P > size(T) -> -% ok; -% display_tuple(T,P) -> -% i("T[~p]: ~p", [P,element(P,T)]), -% display_tuple(T,P+1). - mg_parse_receive_info(RI, RH) -> d("mg_parse_receive_info -> get encoding module"), @@ -1220,7 +1282,7 @@ mg_start_transport(_, #megaco_receive_handle{send_mod = Mod}) -> mg_start_tcp(MgcPort, RH) -> - d("start tcp transport"), + i("start tcp transport"), case megaco_tcp:start_transport() of {ok, Sup} -> {ok, LocalHost} = inet:gethostname(), @@ -1244,16 +1306,19 @@ mg_start_tcp(MgcPort, RH) -> mg_start_udp(MgcPort, RH) -> - d("start udp transport"), + i("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 +1593,6 @@ request(Pid, Request) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -sleep(X) -> - receive after X -> ok end. - - error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). @@ -1583,6 +1644,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 +1704,23 @@ 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("~s " ++ F ++ "~n", [?FTS()|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_mreq_test.erl b/lib/megaco/test/megaco_mreq_test.erl index e6a5ed3181..ba20329ab3 100644 --- a/lib/megaco/test/megaco_mreq_test.erl +++ b/lib/megaco/test/megaco_mreq_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. @@ -24,7 +24,21 @@ %%---------------------------------------------------------------------- -module(megaco_mreq_test). --compile(export_all). +-export([ + all/0, + groups/0, + + init_per_group/2, + end_per_group/2, + init_per_testcase/2, + end_per_testcase/2, + + req_and_rep/1, + req_and_pending/1, + req_and_cancel/1, + + t/0, t/1 + ]). -include("megaco_test_lib.hrl"). -include_lib("megaco/include/megaco.hrl"). @@ -51,16 +65,19 @@ -define(MG_START(Pid, Mid, Enc, Transp, Verb), megaco_test_mg:start(Pid, Mid, Enc, Transp, Verb)). --define(MG_STOP(Pid), megaco_test_mg:stop(Pid)). --define(MG_GET_STATS(Pid, No), megaco_test_mg:get_stats(Pid, No)). --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_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)). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + t() -> megaco_test_lib:t(?MODULE). t(Case) -> megaco_test_lib:t({?MODULE, Case}). @@ -74,6 +91,7 @@ end_per_testcase(Case, Config) -> process_flag(trap_exit, false), megaco_test_lib:end_per_testcase(Case, Config). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> @@ -228,7 +246,7 @@ req_and_rep_stop_mg(MGs) -> req_and_rep_get_mg_stats([], Acc) -> lists:reverse(Acc); req_and_rep_get_mg_stats([{Name, Pid}|Mgs], Acc) -> - {ok, Stats} = ?MG_GET_STATS(Pid, 1), + {ok, Stats} = ?MG_GET_STATS(Pid), d("req_and_rep_get_mg_stats -> stats for ~s: ~n~p~n", [Name, Stats]), req_and_rep_get_mg_stats(Mgs, [{Name, Stats}|Acc]). @@ -399,11 +417,13 @@ req_and_cancel(Config) when is_list(Config) -> req_and_cancel_analyze_result({ok,{_PV,Res}}) -> - d("req_and_cancel -> notify request result: ~n ~p", [Res]), + i("req_and_cancel -> notify request result: ~n ~p", [Res]), req_and_cancel_analyze_result2(Res); req_and_cancel_analyze_result(Unexpected) -> exit({unexpected_result,Unexpected}). +req_and_cancel_analyze_result2({error,{user_cancel,req_and_cancel}}) -> + ok; req_and_cancel_analyze_result2([]) -> ok; req_and_cancel_analyze_result2([{error,{user_cancel,req_and_cancel}}|Res]) -> @@ -429,9 +449,6 @@ sleep(X) -> receive after X -> ok end. -error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% i(F) -> @@ -441,8 +458,8 @@ i(F, A) -> print(info, get(verbosity), "", F, A). -d(F) -> - d(F, []). +%% d(F) -> +%% d(F, []). d(F, A) -> print(debug, get(verbosity), "DBG: ", F, A). @@ -456,20 +473,9 @@ 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] ~s ~p ~s ***" + "~n " ++ F ++ "~n", + [?FTS(), P, self(), get(sname) | A]); print(_, _, _, _) -> ok. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -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). - diff --git a/lib/megaco/test/megaco_pending_limit_test.erl b/lib/megaco/test/megaco_pending_limit_test.erl index ef3b7e51cf..e0c0468d99 100644 --- a/lib/megaco/test/megaco_pending_limit_test.erl +++ b/lib/megaco/test/megaco_pending_limit_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. @@ -2065,23 +2065,12 @@ await_completion(Ids) -> ?ERROR({failed, Reply}) end. -%% await_completion(Ids, Timeout) -> -%% case megaco_test_generator_lib:await_completion(Ids, Timeout) of -%% {ok, Reply} -> -%% d("OK => Reply: ~n~p", [Reply]), -%% ok; -%% {error, Reply} -> -%% d("ERROR => Reply: ~n~p", [Reply]), -%% ?ERROR({failed, Reply}) -%% end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sleep(X) -> receive after X -> ok end. -%% error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2089,49 +2078,30 @@ i(F) -> i(F, []). i(F, A) -> - print(info, get(verbosity), now(), get(tc), "INF", F, A). + print(info, get(verbosity), get(tc), "INF", F, A). d(F) -> d(F, []). d(F, A) -> - print(debug, get(verbosity), now(), get(tc), "DBG", F, A). + print(debug, get(verbosity), get(tc), "DBG", F, A). printable(_, debug) -> true; printable(info, info) -> true; printable(_,_) -> false. -print(Severity, Verbosity, Ts, Tc, P, F, A) -> - print(printable(Severity,Verbosity), Ts, Tc, P, F, A). +print(Severity, Verbosity, Tc, P, F, A) -> + print(printable(Severity,Verbosity), Tc, P, F, A). -print(true, Ts, Tc, P, F, A) -> +print(true, Tc, P, F, A) -> io:format("*** [~s] ~s ~p ~s:~w ***" "~n " ++ F ++ "~n", - [format_timestamp(Ts), P, self(), get(sname), Tc | A]); -print(_, _, _, _, _, _) -> + [?FTS(), P, self(), get(sname), Tc | A]); +print(_, _, _, _, _) -> ok. -%% print(F, A) -> -%% io:format("*** [~s] ***" -%% "~n " ++ F ++ "~n", -%% [format_timestamp(now()) | A]). - -format_timestamp(Now) -> megaco:format_timestamp(Now). - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% 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). - - - diff --git a/lib/megaco/test/megaco_segment_test.erl b/lib/megaco/test/megaco_segment_test.erl index ddb8b9f06b..47f708a14b 100644 --- a/lib/megaco/test/megaco_segment_test.erl +++ b/lib/megaco/test/megaco_segment_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2016. All Rights Reserved. +%% Copyright Ericsson AB 2006-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. @@ -7718,29 +7718,9 @@ await_completion(Ids) -> ?ERROR({failed, Reply}) end. -%% await_completion(Ids, Timeout) -> -%% case megaco_test_generator_lib:await_completion(Ids, Timeout) of -%% {ok, Reply} -> -%% d("OK => Reply: ~n~p", [Reply]), -%% ok; -%% {error, {OK, ERROR}} -> -%% d("ERROR => " -%% "~n OK: ~p" -%% "~n ERROR: ~p", [OK, ERROR]), -%% ?ERROR({failed, ERROR}); -%% {error, Reply} -> -%% d("ERROR => Reply: ~n~p", [Reply]), -%% ?ERROR({failed, Reply}) -%% end. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% tim() -> -%% {A,B,C} = erlang:now(), -%% A*1000000000+B*1000+(C div 1000). - - make_node_name(Name) -> case string:tokens(atom_to_list(node()), [$@]) of [_,Host] -> @@ -7754,8 +7734,6 @@ make_node_name(Name) -> sleep(X) -> receive after X -> ok end. -%% error_msg(F,A) -> error_logger:error_msg(F ++ "~n",A). - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -7763,44 +7741,31 @@ i(F) -> i(F, []). i(F, A) -> - print(info, get(verbosity), now(), get(tc), "INF", F, A). + print(info, get(verbosity), get(tc), "INF", F, A). d(F) -> d(F, []). d(F, A) -> - print(debug, get(verbosity), now(), get(tc), "DBG", F, A). + print(debug, get(verbosity), get(tc), "DBG", F, A). printable(_, debug) -> true; printable(info, info) -> true; printable(_,_) -> false. -print(Severity, Verbosity, Ts, Tc, P, F, A) -> - print(printable(Severity,Verbosity), Ts, Tc, P, F, A). +print(Severity, Verbosity, Tc, P, F, A) -> + print(printable(Severity, Verbosity), Tc, P, F, A). -print(true, Ts, Tc, P, F, A) -> +print(true, Tc, P, F, A) -> io:format("*** [~s] ~s ~p ~s:~w ***" "~n " ++ F ++ "~n", - [format_timestamp(Ts), P, self(), get(sname), Tc | A]); -print(_, _, _, _, _, _) -> + [?FTS(), P, self(), get(sname), Tc | A]); +print(_, _, _, _, _) -> ok. -format_timestamp(Now) -> megaco:format_timestamp(Now). - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% 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). - - diff --git a/lib/megaco/test/megaco_tcp_test.erl b/lib/megaco/test/megaco_tcp_test.erl index a1865ad690..cc66a40f43 100644 --- a/lib/megaco/test/megaco_tcp_test.erl +++ b/lib/megaco/test/megaco_tcp_test.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. @@ -117,15 +117,39 @@ end_per_testcase(Case, Config) -> %% Test case definitions %%====================================================================== all() -> - [{group, start}, {group, sending}, {group, errors}]. + [ + {group, start}, + {group, sending}, + {group, errors} + ]. groups() -> - [{start, [], - [start_normal, start_invalid_opt, start_and_stop]}, - {sending, [], [sendreceive, block_unblock]}, - {errors, [], - [socket_failure, accept_process, accept_supervisor, - connection_supervisor, tcp_server]}]. + [{start, [], start_cases()}, + {sending, [], sending_cases()}, + {errors, [], errors_cases()}]. + +start_cases() -> + [ + start_normal, + start_invalid_opt, + start_and_stop + ]. + +sending_cases() -> + [ + sendreceive, + block_unblock + ]. + +errors_cases() -> + [ + socket_failure, + accept_process, + accept_supervisor, + connection_supervisor, + tcp_server + ]. + init_per_group(_GroupName, Config) -> Config. @@ -196,17 +220,8 @@ start_and_stop(Config) when is_list(Config) -> Client = client_start_command_handler(ClientNode, ClientCmds), p("client command handler started: ~p", [Client]), - ok = - receive - {listening, Server} -> - p("received listening message from server [~p] => " - "send continue to client [~p]~n", [Server, Client]), - Client ! {continue, self()}, - ok - after 5000 -> - {error, server_timeout} - end, - + await_server_listening(Server, Client), + await_command_handler_completion([Server, Client], timer:seconds(20)), p("done"), ok. @@ -335,16 +350,7 @@ sendreceive(Config) when is_list(Config) -> Client = client_start_command_handler(ClientNode, ClientCmds), p("client command handler started: ~p", [Client]), - ok = - receive - {listening, Server} -> - p("received listening message from server [~p] => " - "send continue to client [~p]~n", [Server, Client]), - Client ! {continue, self()}, - ok - after 5000 -> - {error, server_timeout} - end, + await_server_listening(Server, Client), await_command_handler_completion([Server, Client], timer:seconds(20)), p("done"), @@ -544,27 +550,9 @@ block_unblock(Config) when is_list(Config) -> Client = client_start_command_handler(ClientNode, ClientCmds), p("client command handler started: ~p", [Client]), - ok = - receive - {listening, Server} -> - p("received listening message from server [~p] => " - "send continue to client [~p]~n", [Server, Client]), - Client ! {continue, self()}, - ok - after 5000 -> - {error, server_timeout} - end, - - ok = - receive - {blocked, Client} -> - p("received blocked message from client [~p] => " - "send continue to server [~p]~n", [Client, Server]), - Server ! {continue, self()}, - ok - after 5000 -> - {error, timeout} - end, + await_server_listening(Server, Client), + + await_client_blocked(Server, Client), await_command_handler_completion([Server, Client], timer:seconds(30)), p("done"), @@ -908,6 +896,42 @@ process_received_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) %% Internal functions %%====================================================================== +await_server_listening(Server, Client) -> + receive + {listening, Server} -> + p("received listening message from server [~p] => " + "send continue to client [~p]" + "~n", [Server, Client]), + Client ! {continue, self()}, + ok + after 5000 -> + %% There is no normal reason why this should take any time. + %% Normally, this takes a few milli seconds. So, if we are not + %% up and running after 5 seconds, we give up and skip!! + exit(Server, kill), + exit(Client, kill), + ?SKIP("Server timeout (listen)") + end. + + +await_client_blocked(Server, Client) -> + receive + {blocked, Client} -> + p("received blocked message from client [~p] => " + "send continue to server [~p]~n", [Client, Server]), + Server ! {continue, self()}, + ok + after 5000 -> + %% There is no normal reason why this should take any time. + %% Normally, this takes a few milli seconds. So, if we are not + %% up and running after 5 seconds, we give up and skip!! + exit(Client, kill), + exit(Server, kill), + ?SKIP("Client timeout (blocked)") + end. + + + %% ------- Server command handler and utility functions ---------- server_start_command_handler(Node, Commands) -> @@ -1214,23 +1238,14 @@ p(F, A) -> p(S, F, A) when is_list(S) -> io:format("*** [~s] ~p ~s ***" "~n " ++ F ++ "~n", - [format_timestamp(now()), self(), S | A]); + [?FTS(), self(), S | A]); p(_S, F, A) -> io:format("*** [~s] ~p ~s *** " "~n " ++ F ++ "~n", - [format_timestamp(now()), self(), "undefined" | A]). + [?FTS(), self(), "undefined" | A]). ms() -> - {A,B,C} = erlang:now(), - A*1000000000+B*1000+(C div 1000). - + erlang:monotonic_time(milli_seconds). + -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_test_deliver.erl b/lib/megaco/test/megaco_test_deliver.erl index 78033f0e36..c042d9c9a7 100644 --- a/lib/megaco/test/megaco_test_deliver.erl +++ b/lib/megaco/test/megaco_test_deliver.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. @@ -186,4 +186,4 @@ i(F) -> i(F, []). i(F, A) -> - io:format("~p ~w:" ++ F ++ "~n", [self(), ?MODULE | A]). + io:format("*** [~s] ~p ~w:" ++ F ++ "~n", [?FTS(), self(), ?MODULE | A]). diff --git a/lib/megaco/test/megaco_test_generator.erl b/lib/megaco/test/megaco_test_generator.erl index 63f66bda07..8ea7f5ddf7 100644 --- a/lib/megaco/test/megaco_test_generator.erl +++ b/lib/megaco/test/megaco_test_generator.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. @@ -47,7 +47,6 @@ print/3, print/4 ]). --export([behaviour_info/1]). %% Internal exports -export([start/4]). @@ -65,6 +64,7 @@ -include_lib("megaco/include/megaco.hrl"). +-include("megaco_test_lib.hrl"). %%---------------------------------------------------------------------- @@ -90,15 +90,32 @@ %%% API %%%========================================================================= -behaviour_info(callbacks) -> - [ - {init, 1}, - {handle_parse, 2}, - {handle_exec, 2}, - {terminate, 2} - ]; -behaviour_info(_Other) -> - undefined. +-callback init(Args) -> {ok, State} | {error, Reason} when + Args :: term(), + State :: term(), + Reason :: term(). + +-callback handle_parse(Instruction, State) -> + {ok, NewInstruction, NewState} | + {error, Reason} when + Instruction :: term(), + State :: term(), + NewInstruction :: term(), + NewState :: term(), + Reason :: term(). + +-callback handle_exec(Instruction, State) -> + {ok, NewState} | + {error, Reason} when + Instruction :: term(), + State :: term(), + NewState :: term(), + Reason :: term(). + +-callback terminate(Reason, State) -> + megaco:void() when + Reason :: term(), + State :: term(). %%---------------------------------------------------------------------- @@ -533,22 +550,13 @@ print(P, F, A) -> print([], undefined, F, A) -> io:format("*** [~s] ~p *** " ++ "~n " ++ F ++ "~n", - [format_timestamp(now()),self()|A]); + [?FTS(), self() | A]); print(P, undefined, F, A) -> io:format("*** [~s] ~p ~s *** " ++ "~n " ++ F ++ "~n", - [format_timestamp(now()),self(),P|A]); + [?FTS(), self(), P | A]); print(P, N, F, A) -> io:format("*** [~s] ~p ~s~s *** " ++ "~n " ++ F ++ "~n", - [format_timestamp(now()),self(),N,P|A]). - + [?FTS(), self(), N, P | A]). -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_test_generic_transport.erl b/lib/megaco/test/megaco_test_generic_transport.erl index 3185e4c6b6..cd387f748a 100644 --- a/lib/megaco/test/megaco_test_generic_transport.erl +++ b/lib/megaco/test/megaco_test_generic_transport.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. @@ -59,7 +59,7 @@ receive_handle}). -include_lib("megaco/include/megaco.hrl"). -%% -include("megaco_test_lib.hrl"). +-include("megaco_test_lib.hrl"). -define(SERVER, ?MODULE). @@ -335,21 +335,11 @@ d(F) -> d(F, []). d(F, A) -> - print(now(), F, A). + print(F, A). -print(Ts, F, A) -> +print(F, A) -> io:format("*** [~s] GENERIC TRANSPORT [~p] ***" "~n " ++ F ++ "~n", - [format_timestamp(Ts), self() | A]). - -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). - + [?FTS(), self() | A]). diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl index 3934a3a957..7c8c287e7c 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 %% @@ -271,9 +318,9 @@ t({Mod, {group, Name} = Group, Groups}, Config) [Name, Error]), [{failed, {Mod, Group}, Error}] catch - exit:{skipped, SkipReason} -> + exit:{skip, SkipReason} -> io:format(" => skipping group: ~p~n", [SkipReason]), - [{skipped, {Mod, Group}, SkipReason, 0}]; + [{skip, {Mod, Group}, SkipReason, 0}]; error:undef -> [t({Mod, Case, Groups}, Config) || Case <- GroupsAndCases]; @@ -336,9 +383,9 @@ t(Mod, Config) when is_atom(Mod) -> io:format(" => suite init failed: ~p~n", [Error]), [{failed, {Mod, init_per_suite}, Error}] catch - exit:{skipped, SkipReason} -> + exit:{skip, SkipReason} -> io:format(" => skipping suite: ~p~n", [SkipReason]), - [{skipped, {Mod, init_per_suite}, SkipReason, 0}]; + [{skip, {Mod, init_per_suite}, SkipReason, 0}]; error:undef -> [t({Mod, Case, Groups}, Config) || Case <- Cases]; T:E -> @@ -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), @@ -411,10 +458,10 @@ wait_for_evaluator(Pid, Mod, Fun, Config, Errors, AccTime) -> megaco:report_event(20, Mod, ?MODULE, Label ++ " failed", [TestCase, Config, {return, Fail}, Errors]), {failed, {Mod,Fun}, Fail, Time}; - {'EXIT', Pid, {skipped, Reason}, Time} -> + {'EXIT', Pid, {skip, Reason}, Time} -> megaco:report_event(20, Mod, ?MODULE, Label ++ " skipped", - [TestCase, Config, {skipped, Reason}]), - {skipped, {Mod, Fun}, Errors, Time}; + [TestCase, Config, {skip, Reason}]), + {skip, {Mod, Fun}, Errors, Time}; {'EXIT', Pid, Reason, Time} -> megaco:report_event(20, Mod, ?MODULE, Label ++ " crashed", [TestCase, Config, {'EXIT', Reason}]), @@ -445,14 +492,14 @@ do_eval(ReplyTo, Mod, Fun, Config) -> error:undef -> %% p("do_eval -> error - undef", []), ReplyTo ! {'EXIT', self(), undef, 0}; - exit:{skipped, Reason} -> + exit:{skip, Reason} -> %% p("do_eval -> exit - skipped" %% "~n Reason: ~p", [Reason]), T2 = os:timestamp(), Time = timer:now_diff(T2, T1), display_tc_time(Time), display_system_info("after (skipped)", Mod, Fun), - ReplyTo ! {'EXIT', self(), {skipped, Reason}, Time}; + ReplyTo ! {'EXIT', self(), {skip, Reason}, Time}; exit:{suite_failed, Reason} -> %% p("do_eval -> exit - suite-failed" %% "~n Reason: ~p", [Reason]), @@ -569,9 +616,9 @@ display_result(Res) when is_list(Res) -> Ok = [{MF, Time} || {ok, MF, _, Time} <- Res], Nyi = [MF || {nyi, MF, _, _Time} <- Res], SkippedGrps = [{{M,G}, Reason} || - {skipped, {M, {group, G}}, Reason, _Time} <- Res], + {skip, {M, {group, G}}, Reason, _Time} <- Res], SkippedCases = [{MF, Reason} || - {skipped, {_M, F} = MF, Reason, _Time} <- Res, + {skip, {_M, F} = MF, Reason, _Time} <- Res, is_atom(F)], FailedGrps = [{{M,G}, Reason} || {failed, {M, {group, G}}, Reason, _Time} <- Res], @@ -683,15 +730,18 @@ log(Format, Args, Mod, Line) -> [self(), Mod, Line] ++ Args) end. +skip(Reason) -> + exit({skip, Reason}). + skip(Actual, File, Line) -> - log("Skipping test case~n", [], File, Line), - String = lists:flatten(io_lib:format("Skipping test case ~p(~p): ~p~n", - [File, Line, Actual])), - exit({skipped, String}). + log("Skipping test case: ~p~n", [Actual], File, Line), + String = f("~p(~p): ~p~n", [File, Line, Actual]), + skip(String). fatal_skip(Actual, File, Line) -> error(Actual, File, Line), - exit({skipped, {fatal, Actual, File, Line}}). + skip({fatal, Actual, File, Line}). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -703,7 +753,8 @@ flush() -> after 1000 -> [] end. - + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Check if process is alive and kicking still_alive(Pid) -> @@ -719,6 +770,7 @@ still_alive(Pid) -> end end. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% The proxy process @@ -730,32 +782,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 +908,7 @@ reset_kill_timer(Config) -> end. watchdog(Pid, Time) -> - erlang:now(), + _ = os:timestamp(), receive stop -> ok @@ -897,7 +968,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; @@ -918,11 +992,14 @@ node_to_name_and_host(Node) -> start_nodes([Node | Nodes], File, Line) -> case net_adm:ping(Node) of pong -> + p("node ~p already running", [Node]), start_nodes(Nodes, File, Line); pang -> [Name, Host] = node_to_name_and_host(Node), + p("try start node ~p", [Node]), case slave:start_link(Host, Name) of {ok, NewNode} when NewNode =:= Node -> + p("node ~p started - now set path, cwd and sync", [Node]), Path = code:get_path(), {ok, Cwd} = file:get_cwd(), true = rpc:call(Node, code, set_path, [Path]), @@ -931,11 +1008,18 @@ start_nodes([Node | Nodes], File, Line) -> {_, []} = rpc:multicall(global, sync, []), start_nodes(Nodes, File, Line); Other -> + p("failed starting node ~p: ~p", [Node, Other]), fatal_skip({cannot_start_node, Node, Other}, File, Line) end end; 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]). + io:format("~s ~p " ++ F ++ "~n", [?FTS(), self() | A]). diff --git a/lib/megaco/test/megaco_test_lib.hrl b/lib/megaco/test/megaco_test_lib.hrl index 79a1493c40..546ecaab9a 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. @@ -80,9 +80,11 @@ -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(MINS(T), megaco_test_lib:minutes(T)). +-define(MINUTES(T), ?MINS(T)). +-define(SECS(T), megaco_test_lib:seconds(T)). +-define(SECONDS(T), ?SECS(T)). +-define(FTS(), megaco:format_timestamp(erlang:timestamp())). +-define(FTS(TS), megaco:format_timestamp(TS)). +-define(F(F,A), lists:flatten(io_lib:format(F, A))). diff --git a/lib/megaco/test/megaco_test_megaco_generator.erl b/lib/megaco/test/megaco_test_megaco_generator.erl index 8a37fa33fe..4e0f2e334c 100644 --- a/lib/megaco/test/megaco_test_megaco_generator.erl +++ b/lib/megaco/test/megaco_test_megaco_generator.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. @@ -118,7 +118,7 @@ init([]) -> %% ----- instruction parser ----- handle_parse({debug, Debug} = Instruction, State) - when (Debug == true) orelse (Debug == false) -> + when is_boolean(Debug) -> {ok, Instruction, State}; handle_parse({expect_nothing, To} = Instruction, State) @@ -126,9 +126,9 @@ handle_parse({expect_nothing, To} = Instruction, State) {ok, Instruction, State}; handle_parse({megaco_trace, Level} = Instruction, State) - when (Level == disable) orelse - (Level == max) orelse - (Level == min) orelse + when (Level =:= disable) orelse + (Level =:= max) orelse + (Level =:= min) orelse is_integer(Level) -> {ok, Instruction, State}; @@ -1096,11 +1096,10 @@ handle_megaco_callback_reply(_, _, _, _) -> %%---------------------------------------------------------------------- random_init() -> - {A,B,C} = now(), - random:seed(A,B,C). + ok. random(N) -> - random:uniform(N). + rand:uniform(N). get_config(Key, Opts) -> diff --git a/lib/megaco/test/megaco_test_mg.erl b/lib/megaco/test/megaco_test_mg.erl index d6a9a8c314..38883c94f0 100644 --- a/lib/megaco/test/megaco_test_mg.erl +++ b/lib/megaco/test/megaco_test_mg.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. @@ -79,7 +79,10 @@ reply_counter = 0, mload_info = undefined, parent = undefined, - dsi_timer}). + dsi_timer, + evs = []}). + +-define(EVS_MAX, 10). %%% -------------------------------------------------------------------- @@ -364,7 +367,7 @@ mg(Parent, Verbosity, Config) -> MG = #mg{parent = Parent, mid = Mid, dsi_timer = DSITimer}, i("mg -> started"), put(verbosity, Verbosity), - case (catch loop(MG)) of + case (catch loop(evs(MG, started))) of {'EXIT', normal} -> exit(normal); {'EXIT', Reason} -> @@ -438,12 +441,12 @@ loop(#mg{parent = Parent, mid = Mid} = S) -> {display_system_info, Time} -> display_system_info(S#mg.mid), NewTimer = create_timer(Time, display_system_info), - loop(S#mg{dsi_timer = NewTimer}); + loop(evs(S#mg{dsi_timer = NewTimer}, {dsi, Time})); {verbosity, V, Parent} -> i("loop -> received new verbosity: ~p", [V]), put(verbosity,V), - loop(S); + loop(evs(S, {verb, V})); {stop, Parent} -> @@ -453,7 +456,7 @@ loop(#mg{parent = Parent, mid = Mid} = S) -> Res = do_stop(Mid), d("loop -> stop result: ~p", [Res]), server_reply(Parent, stopped, {ok, Res}), - exit(normal); + done(evs(S, stop), normal); {{enable_test_code, Tag, Fun}, Parent} -> i("loop -> enable_test_code: ~p, ~p", [Tag, Fun]), @@ -463,52 +466,52 @@ loop(#mg{parent = Parent, mid = Mid} = S) -> "~n ets:tab2list(megaco_test_data): ~p", [Reply,ets:tab2list(megaco_test_data)]), server_reply(Parent, enable_test_code_reply, Reply), - loop(S); + loop(evs(S, {enable_test_code, Tag})); {{encode_ar_first, EAF}, Parent} -> i("loop -> encode_ar_first: ~p", [EAF]), {Reply, S1} = handle_encode_ar_first(S, EAF), server_reply(Parent, encode_ar_first_reply, Reply), - loop(S1#mg{encode_ar_first = EAF}); + loop(evs(S1#mg{encode_ar_first = EAF}, {enc_arf, EAF})); %% Give me statistics {statistics, Parent} -> i("loop -> got request for statistics", []), Stats = do_get_statistics(Mid), server_reply(Parent, statistics_reply, {ok, Stats}), - loop(S); + loop(evs(S, stats)); {reset_stats, Parent} -> i("loop -> got request to reset stats counters", []), do_reset_stats(Mid), server_reply(Parent, reset_stats_ack, ok), - loop(S); + loop(evs(S, rst_stats)); {{user_info, Tag}, Parent} -> i("loop -> got user_info request for ~w", [Tag]), Res = do_get_user_info(Mid, Tag), d("loop -> Res: ~p", [Res]), server_reply(Parent, user_info_ack, Res), - loop(S); + loop(evs(S, {ui, Tag})); {{update_user_info, Tag, Val}, Parent} -> i("loop -> got update_user_info: ~w -> ~p", [Tag, Val]), Res = do_update_user_info(Mid, Tag, Val), d("loop -> Res: ~p", [Res]), server_reply(Parent, update_user_info_ack, Res), - loop(S); + loop(evs(S, {uui, {Tag, Val}})); {{conn_info, Tag}, Parent} -> i("loop -> got conn_info request for ~w", [Tag]), Res = do_get_conn_info(Mid, Tag), server_reply(Parent, conn_info_ack, Res), - loop(S); + loop(evs(S, {ci, Tag})); {{update_conn_info, Tag, Val}, Parent} -> i("loop -> got update_conn_info: ~w -> ~p", [Tag, Val]), Res = do_update_conn_info(Mid, Tag, Val), server_reply(Parent, update_conn_info_ack, Res), - loop(S); + loop(evs(S, {uci, {Tag, Val}})); %% Do a service change @@ -526,28 +529,28 @@ loop(#mg{parent = Parent, mid = Mid} = S) -> server_reply(Parent, service_change_reply, Error), S end, - loop(S1); + loop(evs(S1, svc_ch)); {{group_requests, N}, Parent} when N > 0 -> i("loop -> received group_requests ~p", [N]), Reply = {ok, S#mg.group_size}, server_reply(Parent, group_requests_reply, Reply), - loop(S#mg{group_size = N}); + loop(evs(S#mg{group_size = N}, {grp_reqs, N})); {{ack_info, To}, Parent} -> i("loop -> received request to inform about received ack's ", []), - loop(S#mg{ack_info = To}); + loop(evs(S#mg{ack_info = To}, {acki, To})); {{rep_info, To}, Parent} -> i("loop -> received request to inform about received rep's ", []), - loop(S#mg{rep_info = To}); + loop(evs(S#mg{rep_info = To}, {repi, To})); %% Make a sync-call {notify_request, Parent} -> i("loop -> received request to send notify request ", []), {Res, S1} = do_handle_notify_request(S), d("loop -> notify request result: ~p", [Res]), - loop(S1); + loop(evs(S1, not_req)); %% sync-call complete {notify_request_complete, NotifyReply, Pid} -> @@ -556,7 +559,7 @@ loop(#mg{parent = Parent, mid = Mid} = S) -> "~n NotifyReply: ~p", [Pid, NotifyReply]), server_reply(Parent, notify_request_reply, NotifyReply), - loop(S#mg{req_handler = undefined}); + loop(evs(S#mg{req_handler = undefined}, {not_reqc, NotifyReply})); %% cancel requests @@ -564,14 +567,14 @@ loop(#mg{parent = Parent, mid = Mid} = S) -> i("loop -> received request to cancel (all) megaco requests ", []), Res = do_cancel_requests(Mid, Reason), server_reply(Parent, cancel_request_reply, Res), - loop(S); + loop(evs(S, {creq, Reason})); %% Apply multi-load {apply_multi_load, {NL, NR}, Parent} -> i("loop -> received apply_multi_load request: ~w, ~w", [NL, NR]), S1 = start_loaders(S, NL, NR), - loop(S1); + loop(evs(S1, {apply_mload, {NL, NR}})); %% Apply some load @@ -587,12 +590,12 @@ loop(#mg{parent = Parent, mid = Mid} = S) -> server_reply(Parent, apply_load_ack, Error), S end, - loop(S1); + loop(evs(S1, {apply_load, Times})); {apply_load_timeout, _} -> d("loop -> received apply_load timeout", []), S1 = do_apply_load(S), - loop(S1); + loop(evs(S1, apply_loadto)); %% Megaco callback messages @@ -604,22 +607,35 @@ loop(#mg{parent = Parent, mid = Mid} = S) -> {Reply, S1} = handle_megaco_request(S, Request), d("loop -> send (megaco callback) request reply: ~n~p", [Reply]), From ! {reply, Reply, self()}, - loop(S1); + loop(evs(S1, {req, {Request, Mid, From}})); {'EXIT', Pid, Reason} -> - i("loop -> received exit signal from ~p: ~n~p", [Pid, Reason]), + i("loop -> received exit signal from ~p: " + "~n ~p", [Pid, Reason]), S1 = handle_exit(S, Pid, Reason), - loop(S1); + loop(evs(S1, {exit, {Pid, Reason}})); Invalid -> error_msg("received invalid request: ~n~p", [Invalid]), - loop(S) + loop(evs(S, {invalid, Invalid})) end. +evs(#mg{evs = EVS} = S, Ev) when (length(EVS) < ?EVS_MAX) -> + S#mg{evs = [{?FTS(), Ev}|EVS]}; +evs(#mg{evs = EVS} = S, Ev) -> + S#mg{evs = [{?FTS(), Ev}|lists:droplast(EVS)]}. + +done(#mg{evs = EVS}, Reason) -> + info_msg("Exiting with latest event(s): " + "~n ~p" + "~n", [EVS]), + exit(Reason). + + handle_encode_ar_first(#mg{encode_ar_first = Old} = MG, New) when (New =:= true) orelse (New =:= false) -> {{ok, Old}, MG#mg{encode_ar_first = New}}; @@ -776,7 +792,7 @@ do_service_change(#mg{state = State} = MG) -> {{error, {invalid_state, State}}, MG}. do_service_change(ConnHandle, Method, EAF, Reason) -> - d("sending service change using:" + d("send service change using:" "~n ConnHandle: ~p" "~n Method: ~p" "~n EAF: ~p" @@ -844,10 +860,10 @@ loader_main(EAF, N, CH) -> -handle_exit(#mg{parent = Pid}, Pid, Reason) -> +handle_exit(#mg{parent = Pid} = S, Pid, Reason) -> error_msg("received exit from the parent:" "~n ~p", [Reason]), - exit({parent_terminated, Reason}); + done(S, {parent_terminated, Reason}); handle_exit(#mg{parent = Parent, req_handler = Pid} = MG, Pid, Reason) -> error_msg("received unexpected exit from the request handler:" @@ -1423,6 +1439,7 @@ sleep(X) -> receive after X -> ok end. +info_msg(F,A) -> error_logger:info_msg("MG: " ++ F ++ "~n",A). error_msg(F,A) -> error_logger:error_msg("MG: " ++ F ++ "~n",A). @@ -1536,37 +1553,28 @@ print(Severity, Verbosity, P, F, A) -> print(true, P, F, A) -> io:format("*** [~s] ~s ~p ~s ***" "~n " ++ F ++ "~n~n", - [format_timestamp(now()), P, self(), get(sname) | A]); + [?FTS(), P, self(), get(sname) | A]); 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). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% random_init() -> - {A,B,C} = now(), - random:seed(A,B,C). + ok. random() -> random(50). random(N) -> - random:uniform(N). + rand:uniform(N). display_system_info(Mid) -> display_system_info(Mid, ""). display_system_info(Mid, Pre) -> - TimeStr = format_timestamp(now()), + TimeStr = ?FTS(), MibStr = lists:flatten(io_lib:format("~p ", [Mid])), megaco_test_lib:display_system_info(MibStr ++ Pre ++ TimeStr). diff --git a/lib/megaco/test/megaco_test_mgc.erl b/lib/megaco/test/megaco_test_mgc.erl index 045bc7c9fd..a9027ca68e 100644 --- a/lib/megaco/test/megaco_test_mgc.erl +++ b/lib/megaco/test/megaco_test_mgc.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. @@ -75,7 +75,10 @@ abort_info = undefined, req_info = undefined, mg = [], - dsi_timer}). + dsi_timer, + evs = []}). + +-define(EVS_MAX, 10). %%% ------------------------------------------------------------------ @@ -297,7 +300,7 @@ mgc(Parent, Verbosity, Config) -> dsi_timer = DSITimer}, i("mgc -> started"), display_system_info("at start "), - loop(S) + loop(evs(S, started)) end. init(Config) -> @@ -359,7 +362,7 @@ loop(S) -> {display_system_info, Time} -> display_system_info(S#mgc.mid), NewTimer = create_timer(Time, display_system_info), - loop(S#mgc{dsi_timer = NewTimer}); + loop(evs(S#mgc{dsi_timer = NewTimer}, {dsi, Time})); {stop, Parent} when S#mgc.parent =:= Parent -> i("loop -> stopping", []), @@ -371,7 +374,7 @@ loop(S) -> application:stop(megaco), i("loop -> stopped", []), server_reply(Parent, stopped, ok), - exit(normal); + done(evs(S, stop), normal); {{disconnect, Reason}, Parent} when S#mgc.parent == Parent -> i("loop -> disconnecting", []), @@ -379,22 +382,22 @@ loop(S) -> [Conn|_] = megaco:user_info(Mid, connections), Res = megaco:disconnect(Conn, {self(), Reason}), server_reply(Parent, disconnected, Res), - loop(S); + loop(evs(S, {disconnect, Reason})); {{update_user_info, Tag, Val}, Parent} when S#mgc.parent == Parent -> i("loop -> got update_user_info: ~w -> ~p", [Tag, Val]), Res = (catch megaco:update_user_info(S#mgc.mid, Tag, Val)), d("loop -> Res: ~p", [Res]), server_reply(Parent, update_user_info_ack, Res), - loop(S); - - {{user_info, Tag}, Parent} when S#mgc.parent == Parent -> - i("loop -> got user_info request for ~w", [Tag]), - Res = (catch megaco:user_info(S#mgc.mid, Tag)), - d("loop -> Res: ~p", [Res]), - server_reply(Parent, user_info_ack, Res), - loop(S); - + loop(evs(S, {uui, {Tag, Val}})); + + {{user_info, Tag}, Parent} when S#mgc.parent == Parent -> + i("loop -> got user_info request for ~w", [Tag]), + Res = (catch megaco:user_info(S#mgc.mid, Tag)), + d("loop -> Res: ~p", [Res]), + server_reply(Parent, user_info_ack, Res), + loop(evs(S, {ui, Tag})); + {{update_conn_info, Tag, Val}, Parent} when S#mgc.parent == Parent -> i("loop -> got update_conn_info: ~w -> ~p", [Tag, Val]), Conns = megaco:user_info(S#mgc.mid, connections), @@ -404,7 +407,7 @@ loop(S) -> Res = lists:map(Fun, Conns), d("loop -> Res: ~p", [Res]), server_reply(Parent, update_conn_info_ack, Res), - loop(S); + loop(evs(S, {uci, {Tag, Val}})); {{conn_info, Tag}, Parent} when S#mgc.parent == Parent -> i("loop -> got conn_info request for ~w", [Tag]), @@ -415,11 +418,11 @@ loop(S) -> Res = lists:map(Fun, Conns), d("loop -> Res: ~p", [Res]), server_reply(Parent, conn_info_ack, Res), - loop(S); + loop(evs(S, {ci, Tag})); %% - {request_action, {Action, To}, Parent} when S#mgc.parent == Parent -> + {request_action, {Action, To}, Parent} when S#mgc.parent == Parent -> i("loop -> got new request_action: ~p:~w", [Action,To]), {Reply, S1} = case lists:member(Action, ?valid_actions) of @@ -432,7 +435,7 @@ loop(S) -> {{error, {invalid_action, Action}}, S} end, server_reply(Parent, request_action_ack, Reply), - loop(S1); + loop(evs(S1, {req_act, {Action, To}})); %% Reset stats @@ -440,7 +443,7 @@ loop(S) -> i("loop -> got request to reset stats counters"), do_reset_stats(S#mgc.mid), server_reply(Parent, reset_stats_ack, ok), - loop(S); + loop(evs(S, rst_stats)); %% Give me statistics @@ -466,7 +469,7 @@ loop(S) -> lists:map(GetTrans, megaco:user_info(Mid, connections)), Reply = {ok, [{gen, Gen}, {trans, Trans}]}, server_reply(Parent, {statistics_reply, 1}, Reply), - loop(S); + loop(evs(S, {stats, 1})); {{statistics, 2}, Parent} when S#mgc.parent == Parent -> @@ -477,7 +480,7 @@ loop(S) -> UdpStats = get_trans_stats(UdpSup, megaco_udp), Reply = {ok, [{gen, Gen}, {trans, [TcpStats, UdpStats]}]}, server_reply(Parent, {statistics_reply, 2}, Reply), - loop(S); + loop(evs(S, {stats, 2})); %% Megaco callback messages @@ -487,28 +490,28 @@ loop(S) -> {Reply, S1} = handle_megaco_request(Request, S), d("loop -> send request reply: ~n~p", [Reply]), reply(From, Reply), - loop(S1); + loop(evs(S1, {req, Request})); {ack_info, To, Parent} when S#mgc.parent == Parent -> i("loop -> received request to inform about received ack's ", []), - loop(S#mgc{ack_info = To}); + loop(evs(S#mgc{ack_info = To}, {acki, To})); {abort_info, To, Parent} when S#mgc.parent == Parent -> i("loop -> received request to inform about received aborts ", []), - loop(S#mgc{abort_info = To}); + loop(evs(S#mgc{abort_info = To}, {abi, To})); {req_info, To, Parent} when S#mgc.parent == Parent -> i("loop -> received request to inform about received req's ", []), - loop(S#mgc{req_info = To}); + loop(evs(S#mgc{req_info = To}, {reqi, To})); {verbosity, V, Parent} when S#mgc.parent == Parent -> i("loop -> received new verbosity: ~p", [V]), put(verbosity,V), - loop(S); + loop(evs(S, {verb, V})); {'EXIT', Pid, Reason} when S#mgc.tcp_sup =:= Pid -> @@ -525,7 +528,7 @@ loop(S) -> i("loop -> stopped", []), StopReason = {error, {tcp_terminated, Pid, Reason}}, server_reply(S#mgc.parent, stopped, StopReason), - exit(StopReason); + done(evs(S, {tcp_sup_exit, Reason}), StopReason); {'EXIT', Pid, Reason} when S#mgc.udp_sup =:= Pid -> @@ -542,15 +545,27 @@ loop(S) -> i("loop -> stopped", []), StopReason = {error, {udp_terminated, Pid, Reason}}, server_reply(S#mgc.parent, stopped, StopReason), - exit(StopReason); + done(evs(S, {udp_sup_exit, Reason}), StopReason); Invalid -> i("loop -> received invalid request: ~p", [Invalid]), - loop(S) + loop(evs(S, {invalid, Invalid})) end. +evs(#mgc{evs = EVS} = S, Ev) when (length(EVS) < ?EVS_MAX) -> + S#mgc{evs = [{?FTS(), Ev}|EVS]}; +evs(#mgc{evs = EVS} = S, Ev) -> + S#mgc{evs = [{?FTS(), Ev}|lists:droplast(EVS)]}. + +done(#mgc{evs = EVS}, Reason) -> + info_msg("Exiting with latest event(s): " + "~n ~p" + "~n", [EVS]), + exit(Reason). + + do_reset_stats(Mid) -> megaco:reset_stats(), do_reset_trans_stats(megaco:user_info(Mid, connections), []). @@ -825,10 +840,10 @@ handle_megaco_request({handle_trans_ack, CH, PV, AS, AD}, handle_megaco_request({handle_trans_ack, CH, PV, AS, AD}, S) -> d("handle_megaco_request(handle_trans_ack) -> entry with" - "~n CH: ~p" - "~n PV: ~p" - "~n AS: ~p" - "~n AD: ~p", [CH, PV, AS, AD]), + "~n Conn Handle: ~p" + "~n Prot Version: ~p" + "~n Ack Status: ~p" + "~n Ack Data: ~p", [CH, PV, AS, AD]), {ok, S}; handle_megaco_request({handle_unexpected_trans, CH, PV, TR}, S) -> @@ -1090,6 +1105,7 @@ sleep(X) -> receive after X -> ok end. +info_msg(F,A) -> error_logger:info_msg("MGC: " ++ F ++ "~n",A). error_msg(F,A) -> error_logger:error_msg("MGC: " ++ F ++ "~n",A). @@ -1153,18 +1169,17 @@ get_conf(Key, Config, Default) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% random_init() -> - {A,B,C} = now(), - random:seed(A,B,C). + ok. random(N) -> - random:uniform(N). + rand:uniform(N). display_system_info(Mid) -> display_system_info(Mid, ""). display_system_info(Mid, Pre) -> - TimeStr = format_timestamp(now()), + TimeStr = ?FTS(), MibStr = lists:flatten(io_lib:format("~p ", [Mid])), megaco_test_lib:display_system_info(MibStr ++ Pre ++ TimeStr). @@ -1209,14 +1224,6 @@ print(_, _, _, _) -> print(P, F, A) -> io:format("*** [~s] ~s ~p ~s ***" "~n " ++ F ++ "~n~n", - [format_timestamp(now()), P, self(), get(sname) | A]). - -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). + [?FTS(), P, self(), get(sname) | A]). + diff --git a/lib/megaco/test/megaco_timer_test.erl b/lib/megaco/test/megaco_timer_test.erl index 34479f7838..84c314d8ed 100644 --- a/lib/megaco/test/megaco_timer_test.erl +++ b/lib/megaco/test/megaco_timer_test.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. @@ -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,14 @@ 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; + {ok, _} -> + ok; + CancelRes -> + ?SKIP({cancel_failed, CancelRes}) + end end, %% Make sure it does not reach us after we attempted to stop it. @@ -438,21 +445,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..37bc134c8d 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), @@ -216,7 +295,7 @@ multi_ack_timeout(doc) -> []; multi_ack_timeout(Config) when is_list(Config) -> %% <CONDITIONAL-SKIP> - Skippable = [win32, {unix, [darwin, linux]}], + Skippable = [win32, {unix, [darwin, linux, sunos]}], % Is there any left? Condition = fun() -> ?OS_BASED_SKIP(Skippable) end, ?NON_PC_TC_MAYBE_SKIP(Config, Condition), %% </CONDITIONAL-SKIP> @@ -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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -9190,10 +9247,10 @@ await_ack(User, N, Timeout, Expected) when (N > 0) andalso is_integer(Timeout) - T = tim(), receive {ack_received, User, Expected} -> - d("await_ack -> received another ack"), + d("await_ack -> received another expected 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 -> received unexpected ack result: ~p", [UnExpected]), exit({unexpected_ack_result, UnExpected, Expected}) after Timeout -> exit({await_ack_timeout, N}) @@ -9205,72 +9262,13 @@ 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}). tim() -> - {A,B,C} = erlang:now(), + {A,B,C} = erlang:timestamp(), A*1000000000+B*1000+(C div 1000). @@ -9291,7 +9289,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 +9300,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 +9311,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). diff --git a/lib/megaco/test/megaco_udp_test.erl b/lib/megaco/test/megaco_udp_test.erl index cc03ec733a..39ff44709e 100644 --- a/lib/megaco/test/megaco_udp_test.erl +++ b/lib/megaco/test/megaco_udp_test.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. @@ -1211,23 +1211,14 @@ p(F, A) -> p(S, F, A) when is_list(S) -> io:format("*** [~s] ~p ~s ***" "~n " ++ F ++ "~n", - [format_timestamp(now()), self(), S | A]); + [?FTS(), self(), S | A]); p(_S, F, A) -> io:format("*** [~s] ~p ~s *** " "~n " ++ F ++ "~n", - [format_timestamp(now()), self(), "undefined" | A]). + [?FTS(), self(), "undefined" | A]). ms() -> - {A,B,C} = erlang:now(), - A*1000000000+B*1000+(C div 1000). + erlang:monotonic_time(milli_seconds). -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/vsn.mk b/lib/megaco/vsn.mk index 0d40f863b2..843a3dccc5 100644 --- a/lib/megaco/vsn.mk +++ b/lib/megaco/vsn.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2016. All Rights Reserved. +# Copyright Ericsson AB 1997-2017. 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. @@ -19,6 +19,6 @@ # %CopyrightEnd% APPLICATION = megaco -MEGACO_VSN = 3.18.1 +MEGACO_VSN = 3.18.5 PRE_VSN = APP_VSN = "$(APPLICATION)-$(MEGACO_VSN)$(PRE_VSN)" |