anchor.diff:  %%
   %% %CopyrightBegin%
   %%
  -%% Copyright Ericsson AB 2000-2019. All Rights Reserved.
  +%% Copyright Ericsson AB 2000-2021. 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.
  
positive.code:     i(F, []).
  
  i(F, A) ->
      print(info, get(verbosity), get(tc), "INF", F, A).
  
  printable(_, debug)   -> true;
  printable(info, info) -> true;
  
negative.code:      "transaction counter handling of the application "
       "in with several connections (MGC). "];
  transaction_id_counter_mgc(Config) when is_list(Config) ->
      Name = transaction_id_counter_mgc,
      Pre = fun() ->
                    i("starting config server"),
                    {ok, _ConfigPid} = megaco_config:start_link(),
  
                    %% Basic user data
                    UserMid = {deviceName, "mgc"},
                    UserConfig = [
                                  {min_trans_id, 1}
                                 ],
  
                    %% Basic connection data
                    RemoteMids = 
                        [
                         {deviceName, "mg01"},
                         {deviceName, "mg02"},
                         {deviceName, "mg03"},
                         {deviceName, "mg04"},
                         {deviceName, "mg05"},
                         {deviceName, "mg06"},
                         {deviceName, "mg07"},
                         {deviceName, "mg08"},
                         {deviceName, "mg09"},
                         {deviceName, "mg10"}
                        ], 
                    RecvHandles = 
                        [
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE},
                         #megaco_receive_handle{local_mid     = UserMid,
                                                encoding_mod    = ?MODULE,
                                                encoding_config = [],
                                                send_mod        = ?MODULE}
                        ],
                    SendHandle = dummy_send_handle,
                    ControlPid = self(),
      
                    %% Start user
                    i("start user"),
                    ok = megaco_config:start_user(UserMid, UserConfig),
  
                    %% Create connection
                    i("create connection(s)"),
                    CDs = create_connections(RecvHandles,
                                             RemoteMids,
                                             SendHandle,
                                             ControlPid),
  
                    %% Set counter limits
                    i("set counter max limit(s)"),
                    set_counter_max_limits(CDs, 1000),
  
                    {UserMid, CDs}
            end,
      Case = fun({_, CDs}) ->
                     %% Create the counter worker procs
                     i("create counter working procs"),
                     Pids = create_counter_working_procs(CDs, ?NUM_CNT_PROCS),
  
                     %% Start the counter worker procs
                     i("release the counter working procs"),
                     start_counter_working_procs(Pids),
  
                     %% Await the counter worker procs termination
                     i("await the counter working procs completion"),
                     ok = await_completion_counter_working_procs(Pids),
  
                     %% Verify result
                     i("verify counter result"),
                     verify_counter_results(CDs)
             end,
  
      Post = fun({UserMid, CDs}) ->
                     %% Stop test
                     i("disconnect"),
                     delete_connections(CDs), 
                     i("stop user"),
                     ok = megaco_config:stop_user(UserMid),
                     i("stop megaco_config"),
                     ok = megaco_config:stop()
             end,
      try_tc(Name, Pre, Case, Post).
  
  
  create_connections(RecvHandles, RemoteMids, SendHandle, ControlPid) ->
      create_connections(RecvHandles, RemoteMids, SendHandle, ControlPid, []).
  