⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 megaco_pending_limit_test.erl

📁 OTP是开放电信平台的简称
💻 ERL
📖 第 1 页 / 共 5 页
字号:
-ifdef(MEGACO_TEST_CODE).sent_resend_late_reply(suite) ->    [];sent_resend_late_reply(doc) ->    "...";sent_resend_late_reply(Config) when list(Config) ->    put(verbosity, ?TEST_VERBOSITY),    put(sname,     "TEST"),    put(tc,        sent_resend_late_reply),    i("starting"),    MgcNode = make_node_name(mgc),    MgNode  = make_node_name(mg),    d("start nodes: "      "~n   MgcNode: ~p"      "~n   MgNode:  ~p",       [MgcNode, MgNode]),    ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE),    %% Start the MGC and MGs    i("[MGC] start"),        ET = [{text,tcp}, {text,udp}, {binary,tcp}, {binary,udp}],    {ok, Mgc} = 	?MGC_START(MgcNode, {deviceName, "ctrl"}, ET, [], ?MGC_VERBOSITY),    i("[MG] start"),        MgMid = {deviceName, "mg"},    MgConfig = [],    {ok, Mg} = ?MG_START(MgNode, MgMid, text, tcp, MgConfig, ?MG_VERBOSITY),    d("MG user info: ~p", [?MG_USER_INFO(Mg, all)]),    i("[MG] connect to the MGC (service change)"),        ServChRes = ?MG_SERV_CHANGE(Mg),    d("service change result: ~p", [ServChRes]),    d("MG conn info: ~p", [?MG_CONN_INFO(Mg, all)]),    d("[MGC] update connection info pending timer"),    PendingTimer = infinity,    %%     PendingTimer = #megaco_incr_timer{wait_for = timer:seconds(5),    %% 				      factor    = 1},    ?MGC_UPDATE_CI(Mgc, pending_timer, PendingTimer),    d("[MGC] update connection info sent pending limit"),    PendingLimit = 5,    ?MGC_UPDATE_CI(Mgc, sent_pending_limit, PendingLimit),    d("[MG] update connection info request timer"),    RequestTimer = #megaco_incr_timer{wait_for = timer:seconds(5),				      factor   = 1},    ?MG_UPDATE_CI(Mg, request_timer, RequestTimer),    d("[MGC] no reply to requests "      "(simulate that the request takes a __long__ time)"),    ?MGC_REQ_IGNORE(Mgc),    d("[MG] set the 'init_request_timer' tag"),    EccRes = (catch ?MG_ECC(Mg, megaco_messenger, 			    init_request_timer, fun init_request_timer/1)),    d("[MG] EccRes: ~p", [EccRes]),    d("[MGC] late reply to requests "      "(simulate that the request takes a long time)"),    ?MGC_REQ_DISC(Mgc, 11000),    d("[MG] send the notify"),    {ok, Reply} = (catch ?MG_NOTIF_RAR(Mg)),    d("[MG] Reply: ~p", [Reply]),    {_Version, {ok, [_ActionReply]}} = Reply,    %% Tell MG to stop    i("[MG] stop"),    ?MG_STOP(Mg),    %% Tell Mgc to stop    i("[MGC] stop"),    ?MGC_STOP(Mgc),    i("done", []),    ok.-else.sent_resend_late_reply(suite) ->    [];sent_resend_late_reply(doc) ->    "...";sent_resend_late_reply(Config) when list(Config) ->    ?SKIP("included only if compiled with USE_MEGACO_TEST_CODE=true").-endif.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This test case can only be run with the stack compiled with%% the MEGACO_TEST_CODE flag. Therefor there is no point in %% including this test case in the usual test suite-ifdef(MEGACO_TEST_CODE).sent_resend_exceeded(suite) ->    [];sent_resend_exceeded(doc) ->    "...";sent_resend_exceeded(Config) when list(Config) ->    put(verbosity, ?TEST_VERBOSITY),    put(sname,     "TEST"),    put(tc,        sent_resend_exceeded),    i("starting"),    MgcNode = make_node_name(mgc),    MgNode  = make_node_name(mg),    d("start nodes: "      "~n   MgcNode: ~p"      "~n   MgNode:  ~p",       [MgcNode, MgNode]),    ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE),    %% Start the MGC and MGs    i("[MGC] start"),        ET = [{text,tcp}, {text,udp}, {binary,tcp}, {binary,udp}],    {ok, Mgc} = 	?MGC_START(MgcNode, {deviceName, "ctrl"}, ET, [], ?MGC_VERBOSITY),    i("[MG] start"),        MgMid = {deviceName, "mg"},    MgConfig = [],    {ok, Mg} = ?MG_START(MgNode, MgMid, text, tcp, MgConfig, ?MG_VERBOSITY),    d("MG user info: ~p", [?MG_USER_INFO(Mg, all)]),    i("[MG] connect to the MGC (service change)"),        ServChRes = ?MG_SERV_CHANGE(Mg),    d("service change result: ~p", [ServChRes]),    d("MG conn info: ~p", [?MG_CONN_INFO(Mg, all)]),    d("[MGC] update connection info pending timer"),    PendingTimer = infinity,    ?MGC_UPDATE_CI(Mgc, pending_timer, PendingTimer),    d("[MGC] update connection info sent pending limit"),    PendingLimit = 5,    ?MGC_UPDATE_CI(Mgc, sent_pending_limit, PendingLimit),    d("[MG] update connection info request timer"),    RequestTimer = #megaco_incr_timer{wait_for = timer:seconds(5),				      factor   = 1},    ?MG_UPDATE_CI(Mg, request_timer, RequestTimer),    d("[MGC] no reply to requests "      "(simulate that the request takes a __long__ time)"),    ?MGC_REQ_IGNORE(Mgc),    d("[MG] set the 'init_request_timer' tag"),    EccRes = (catch ?MG_ECC(Mg, megaco_messenger, 			    init_request_timer, fun init_request_timer/1)),    d("[MG] EccRes: ~p", [EccRes]),    d("[MG] send the notify"),    ED = (catch ?MG_NOTIF_RAR(Mg)),    d("[MG] ED: ~p", [ED]),    ErrorCode = ?megaco_number_of_transactionpending_exceeded,    #'ErrorDescriptor'{errorCode = ErrorCode} = ED,    %% Tell MG to stop    i("[MG] stop"),    ?MG_STOP(Mg),    %% Tell Mgc to stop    i("[MGC] stop"),    ?MGC_STOP(Mgc),    i("done", []),    ok.-else.sent_resend_exceeded(suite) ->    [];sent_resend_exceeded(doc) ->    "...";sent_resend_exceeded(Config) when list(Config) ->    ?SKIP("included only if compiled with USE_MEGACO_TEST_CODE=true").-endif.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This test case can only be run with the stack compiled with%% the MEGACO_TEST_CODE flag. Therefor there is no point in %% including this test case in the usual test suite-ifdef(MEGACO_TEST_CODE).sent_resend_exceeded_long(suite) ->    [];sent_resend_exceeded_long(doc) ->    "...";sent_resend_exceeded_long(Config) when list(Config) ->    put(verbosity, ?TEST_VERBOSITY),    put(sname,     "TEST"),    put(tc,        sent_resend_exceeded_long),    i("starting"),    MgcNode = make_node_name(mgc),    MgNode  = make_node_name(mg),    d("start nodes: "      "~n   MgcNode: ~p"      "~n   MgNode:  ~p",       [MgcNode, MgNode]),    ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE),    %% Start the MGC and MGs    i("[MGC] start"),        ET = [{text,tcp}, {text,udp}, {binary,tcp}, {binary,udp}],    {ok, Mgc} = 	?MGC_START(MgcNode, {deviceName, "ctrl"}, ET, [], ?MGC_VERBOSITY),    i("[MG] start"),        MgMid = {deviceName, "mg"},    MgConfig = [],    {ok, Mg} = ?MG_START(MgNode, MgMid, text, tcp, MgConfig, ?MG_VERBOSITY),    d("MG user info: ~p", [?MG_USER_INFO(Mg, all)]),    i("[MG] connect to the MGC (service change)"),        ServChRes = ?MG_SERV_CHANGE(Mg),    d("service change result: ~p", [ServChRes]),    d("MG conn info: ~p", [?MG_CONN_INFO(Mg, all)]),    d("[MGC] update connection info pending timer"),    PendingTimer = infinity,    ?MGC_UPDATE_CI(Mgc, pending_timer, PendingTimer),    d("[MGC] update connection info sent pending limit"),    PendingLimit = 5,    ?MGC_UPDATE_CI(Mgc, sent_pending_limit, PendingLimit),    d("[MG] update connection info request timer"),    RequestTimer = #megaco_incr_timer{wait_for = timer:seconds(5),				      factor   = 1},    ?MG_UPDATE_CI(Mg, request_timer, RequestTimer),    d("[MGC] long request with no reply ~n"      "   (simulate that we know that this will "      "take a while, but takes even longer...)"),    ?MGC_REQ_PIGNORE(Mgc),    d("[MG] set the 'init_request_timer' tag"),    EccRes = (catch ?MG_ECC(Mg, megaco_messenger, 			    init_request_timer, fun init_request_timer/1)),    d("[MG] EccRes: ~p", [EccRes]),    d("[MG] send the notify"),    ED = (catch ?MG_NOTIF_RAR(Mg)),    d("[MG] ED: ~p", [ED]),    ErrorCode = ?megaco_number_of_transactionpending_exceeded,    #'ErrorDescriptor'{errorCode = ErrorCode} = ED,    %% Tell MG to stop    i("[MG] stop"),    ?MG_STOP(Mg),    %% Tell Mgc to stop    i("[MGC] stop"),    ?MGC_STOP(Mgc),    i("done", []),    ok.-else.sent_resend_exceeded_long(suite) ->    [];sent_resend_exceeded_long(doc) ->    "...";sent_resend_exceeded_long(Config) when list(Config) ->    ?SKIP("included only if compiled with USE_MEGACO_TEST_CODE=true").-endif.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                   %%%%%%                 Received peinding test cases                      %%%%%%                                                                   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%recv_limit_exceeded1(suite) ->    [];recv_limit_exceeded1(doc) ->    "Received pending limit exceeded (exactly)";recv_limit_exceeded1(Config) when list(Config) ->    put(verbosity, ?TEST_VERBOSITY),    put(sname,     "TEST"),    put(tc,        rle1),    i("starting"),    MgcNode = make_node_name(mgc),    MgNode  = make_node_name(mg),    d("start nodes: "      "~n   MgcNode: ~p"      "~n   MgNode:  ~p",       [MgcNode, MgNode]),    ok = megaco_test_lib:start_nodes([MgcNode, MgNode], ?FILE, ?LINE),    d("[MGC] start the simulator "),    {ok, Mgc} = megaco_test_generator:start_link("MGC", MgcNode),    d("[MGC] create the event sequence"),    MgcEvSeq = rle1_mgc_event_sequence(text, tcp),    i("wait some time before starting the MGC simulation"),    sleep(1000),    d("[MGC] start the simulation"),    megaco_test_generator:tcp(Mgc, MgcEvSeq),    i("wait some time before starting the MG simulator"),    sleep(1000),    d("[MG] start the simulator (generator)"),    {ok, Mg} = megaco_test_generator:start_link("MG", MgNode),    d("[MG] create the event sequence"),    MgEvSeq = rle1_mg_event_sequence(text, tcp),    i("wait some time before starting the MG simulation"),    sleep(1000),    d("[MG] start the simulation"),    megaco_test_generator:megaco(Mg, MgEvSeq),    d("[MGC] await the generator reply"),    case megaco_test_generator:tcp_await_reply(Mgc) of        {ok, MgcReply} ->            d("[MGC] OK => MgcReply: ~n~p", [MgcReply]),            ok;        {error, MgcReply} ->            d("[MGC] ERROR => MgcReply: ~n~p", [MgcReply]),            ?ERROR(mgc_failed)    end,    d("[MG] await the generator reply"),    case megaco_test_generator:megaco_await_reply(Mg) of        {ok, MgReply} ->            d("[MG] OK => MgReply: ~n~p", [MgReply]),            ok;        {error, MgReply} ->            d("[MG] ERROR => MgReply: ~n~p", [MgReply]),            ?ERROR(mg_failed)    end,    %% Tell Mgc to stop    i("[MGC] stop generator"),    megaco_test_generator:stop(Mgc),    %% Tell Mg to stop    i("[MG] stop generator"),    megaco_test_generator:stop(Mg),    i("done", []),    ok.%%%% MGC generator stuff%% -ifdef(megaco_hipe_special).-define(rle1_mgc_decode_msg_fun(Mod, Conf),	{?MODULE, decode_msg, [Mod, Conf]}).-define(rle1_mgc_encode_msg_fun(Mod, Conf),	{?MODULE, encode_msg, [Mod, Conf]}).-define(rle1_mgc_verify_service_change_req_msg_fun(Mid),	{?MODULE, rle1_mgc_verify_service_change_req_msg, [Mid]}).-define(rle1_mgc_verify_notify_req_msg_fun(),	{?MODULE, rle1_mgc_verify_notify_req_msg, []}).-else.-define(rle1_mgc_decode_msg_fun(Mod, Conf),	rle1_mgc_decode_msg_fun(Mod, Conf)).-define(rle1_mgc_encode_msg_fun(Mod, Conf),	rle1_mgc_encode_msg_fun(Mod, Conf)).-define(rle1_mgc_verify_service_change_req_msg_fun(Mid),	rle1_mgc_verify_service_change_req_msg_fun(Mid)).-define(rle1_mgc_verify_notify_req_msg_fun(),	rle1_mgc_verify_notify_req_msg_fun()).-endif.rle1_mgc_event_sequence(text, tcp) ->    Mid = {deviceName,"ctrl"},    EM  = megaco_pretty_text_encoder,    EC  = [],    rle1_mgc_event_sequence2(Mid, EM, EC).rle1_mgc_event_sequence2(Mid, EM, EC) ->    DecodeFun = ?rle1_mgc_decode_msg_fun(EM, EC),    EncodeFun = ?rle1_mgc_encode_msg_fun(EM, EC),    ServiceChangeReply = 	rle1_mgc_service_change_reply_msg(Mid, 1, 0),    Pending = rle1_mgc_pending_msg(Mid,2),

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -