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

📄 megaco_codec_prev3c_test.erl

📁 OTP是开放电信平台的简称
💻 ERL
📖 第 1 页 / 共 5 页
字号:
      {transactions,       [{transactionReply,	 {'TransactionReply',67111298,asn1_NOVALUE,	  {actionReplies,[			  {'ActionReply',2699,asn1_NOVALUE,asn1_NOVALUE,			   [			    {addReply,			     {'AmmsReply',			      [			       {megaco_term_id,false,["mg5_ipeph","0x0f0001"]}			      ],			      [			       {emptyDescriptors,				{'AuditDescriptor',asn1_NOVALUE,asn1_NOVALUE}			       }			      ]			     }			    }			   ]			  }			 ]	  }	 }	}       ]      }     }    }.%% --------------------------------------------------------------compact_otp5793_msg01(suite) ->    [];compact_otp5793_msg01(Config) when list(Config) ->    %%     put(severity,trc),    %%     put(dbg,true),    d("compact_otp5793_msg01 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_encode_decode_ok(pretty_otp5793_msg1()),    %% erase(severity),    %% erase(dbg),    ok.    %% --------------------------------------------------------------compact_otp5836_msg01(suite) ->    [];compact_otp5836_msg01(Config) when list(Config) ->    %%     put(severity,trc),    %%     put(dbg,true),    d("compact_otp5836_msg01 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_encode_decode_ok(compact_otp5836_msg1()),    %% erase(severity),    %% erase(dbg),    ok.compact_otp5836_msg1() ->    {'MegacoMessage',     asn1_NOVALUE,     {'Message',      3,      {deviceName,"bs_sbg_4/34"},      {transactions,        [{transactionReply, 	 {'TransactionReply',	  12,	  asn1_NOVALUE,	  {actionReplies,	   [{'ActionReply',	     4294967295,	     asn1_NOVALUE,	     asn1_NOVALUE,	     [{auditValueReply,	       {error, {'ErrorDescriptor', 431, asn1_NOVALUE}}}	     ]	    }	   ]	  }	 }	}       ]      }     }    }.%% --------------------------------------------------------------compact_otp5993_msg01(suite) ->    [];compact_otp5993_msg01(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp5993_msg01 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_encode_decode_ok( compact_otp5993_msg01() ),    %% erase(severity),    %% erase(dbg),    ok.compact_otp5993_msg01() ->    MT = h221,    T  = #megaco_term_id{id = ?A4444},    TL = [T],    MD = #'MuxDescriptor'{muxType  = MT,                          termList = TL},    compact_otp5993_msg(MD).compact_otp5993_msg02(suite) ->    [];compact_otp5993_msg02(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp5993_msg02 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_encode_decode_ok( compact_otp5993_msg02() ),    %% erase(severity),    %% erase(dbg),    ok.compact_otp5993_msg02() ->    MT = h223,    T1 = #megaco_term_id{id = ?A4445},    T2 = #megaco_term_id{id = ?A5556},    TL = [T1, T2],    MD = #'MuxDescriptor'{muxType  = MT,                          termList = TL},    compact_otp5993_msg(MD).compact_otp5993_msg03(suite) ->    [];compact_otp5993_msg03(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp5993_msg03 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_encode_decode_ok( compact_otp5993_msg03() ),    %% erase(severity),    %% erase(dbg),    ok.compact_otp5993_msg03() ->    T1       = #megaco_term_id{id = ?A4445},    T2       = #megaco_term_id{id = ?A5556},    TIDs     = [T1, T2],    AudRep   = {contextAuditResult, TIDs},    CmdRep   = {auditValueReply, AudRep},    ActRep   = #'ActionReply'{contextId    = 5993,                              commandReply = [CmdRep]},    TransRes = {actionReplies, [ActRep]},    TransRep = #'TransactionReply'{transactionId     = 3995,                                   transactionResult = TransRes},    Trans    = {transactionReply, TransRep},    Body     = {transactions, [Trans]},    Msg      = #'Message'{version     = ?VERSION,                          mId         = ?MG1_MID,                          messageBody = Body},    #'MegacoMessage'{mess = Msg}.compact_otp5993_msg(MD) when is_record(MD, 'MuxDescriptor') ->    AmmDesc  = {muxDescriptor, MD},    AmmReq   = #'AmmRequest'{terminationID = [hd(MD#'MuxDescriptor'.termList)],                             descriptors   = [AmmDesc]},    Cmd      = {addReq, AmmReq},    CmdReq   = #'CommandRequest'{command = Cmd},    ActReq   = #'ActionRequest'{contextId       = 5993,                                commandRequests = [CmdReq]},    TransReq = #'TransactionRequest'{transactionId = 3995,                                     actions       = [ActReq]},    Trans    = {transactionRequest, TransReq},    Body     = {transactions, [Trans]},    Msg      = #'Message'{version = ?VERSION,                          mId     = ?MG1_MID,                          messageBody = Body},    #'MegacoMessage'{mess = Msg}.%% --------------------------------------------------------------compact_otp6017_msg01(suite) ->    [];compact_otp6017_msg01(Config) when list(Config) ->    d("compact_otp6017_msg01 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = compact_otp6017(0),    ok.compact_otp6017_msg02(suite) ->    [];compact_otp6017_msg02(Config) when list(Config) ->    d("compact_otp6017_msg02 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = compact_otp6017(16#FFFFFFFE),    ok.compact_otp6017_msg03(suite) ->    [];compact_otp6017_msg03(Config) when list(Config) ->    d("compact_otp6017_msg03 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = compact_otp6017(16#FFFFFFFF),    ok.compact_otp6017(BadCID) ->    Conf = ?EC,    M   = compact_otp6017_msg(BadCID),    Bin = list_to_binary(M),    case decode_message(megaco_compact_text_encoder, false, Conf, Bin) of        {ok, Msg} ->            exit({unexpected_decode_success, {Msg, M}});        {error, Reason} when is_list(Reason) -> % Expected result            case lists:keysearch(reason, 1, Reason) of                {value, {reason, {_Line, _Mod, {bad_ContextID, BadCID}}}} ->                    io:format(" ~w", [BadCID]),                    ok;                {value, {reason, ActualReason}} ->                    exit({unexpected_reason, ActualReason});                false ->                    exit({reason_not_found, Reason})            end;        Crap ->            exit({unexpected_decode_result, Crap})    end.compact_otp6017_msg(CID) when is_integer(CID) ->    "MEGACO/" ?VERSION_STR " MG1 T=12345678{C=" ++        integer_to_list(CID) ++        "{SC=root{SV{MT=RS,RE=901}}}}".%% ==============================================================%%%% F l e x   C o m p a c t   T e s t c a s e s%%flex_compact_otp4299_msg1(suite) ->    [];flex_compact_otp4299_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("flex_comppact_otp4299_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    Msg  = compact_otp4299_msg(),    Conf = flex_scanner_conf(Config),    ok = compact_otp4299(Msg, [?EC_V3,Conf]),    %% erase(severity),    %% erase(dbg),    ok.%% ==============================================================%%%% P r e t t y   T e s t c a s e s%%pretty_otp4632_msg1(suite) ->    [];pretty_otp4632_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("pretty_otp4632_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_pretty_encode_decode_ok( pretty_otp4632_msg1() ),    %% erase(severity),    %% erase(dbg),    ok.pretty_otp4632_msg1() ->    msg4(?MG1_MID_NO_PORT, "901 mg col boot").pretty_otp4632_msg2(suite) ->    [];pretty_otp4632_msg2(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("pretty_otp4632_msg2 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_pretty_encode_decode_ok( pretty_otp4632_msg2() ),    %% erase(severity),    %% erase(dbg),    ok.pretty_otp4632_msg2() ->    msg4(?MG1_MID_NO_PORT, "901").pretty_otp4632_msg3(suite) ->    [];pretty_otp4632_msg3(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("pretty_otp4632_msg3 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_pretty_decode_encode_ok( pretty_otp4632_msg3() ),    %% erase(severity),    %% erase(dbg),    ok.pretty_otp4632_msg3() ->    M = "MEGACO/" ?VERSION_STR " [124.124.124.222]\nTransaction = 9998 {\n\tContext = - {\n\t\tServiceChange = root {\n\t\t\tServices {\n\t\t\t\tMethod = Restart,\n\t\t\t\tServiceChangeAddress = 55555,\n\t\t\t\tProfile = resgw/1,\n\t\t\t\tReason = \"901\"\n\t\t\t}\n\t\t}\n\t}\n}",    M.pretty_otp4632_msg4(suite) ->    [];pretty_otp4632_msg4(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("pretty_otp4632_msg4 -> entry", []),    ?ACQUIRE_NODES(1, Config),    Check = fun(B2, B1) -> pretty_otp4632_msg4_chk(B1, B2) end,     ok = ticket_pretty_decode_encode_only(pretty_otp4632_msg4(), Check),     %% erase(severity),    %% erase(dbg),    ok.pretty_otp4632_msg4() ->    M = "MEGACO/" ?VERSION_STR " [124.124.124.222]\nTransaction = 9998 {\n\tContext = - {\n\t\tServiceChange = root {\n\t\t\tServices {\n\t\t\t\tMethod = Restart,\n\t\t\t\tServiceChangeAddress = 55555,\n\t\t\t\tProfile = resgw/1,\n\t\t\t\tReason = 901\n\t\t\t}\n\t\t}\n\t}\n}",    M.pretty_otp4632_msg4_chk(B1, B2) when is_binary(B1) and is_binary(B2) ->    S1 = binary_to_list(B1),    S2 = binary_to_list(B2),    %%     io:format("~n"    %% 		 "S1: ~s~n"    %% 		 "S2: ~s~n", [S1, S2]),    pretty_otp4632_msg4_chk(S1, S2); pretty_otp4632_msg4_chk([], []) ->    messages_not_eq; pretty_otp4632_msg4_chk([], Rest2) ->    {messages_not_eq2, Rest2}; pretty_otp4632_msg4_chk(Rest1, []) ->    {messages_not_eq1, Rest1}; pretty_otp4632_msg4_chk([$R,$e,$a,$s,$o,$n,$ ,$=,$ ,$",$9,$0,$1,$"|_Rest1],			[$R,$e,$a,$s,$o,$n,$ ,$=,$ ,$9,$0,$1|_Rest2]) ->    ok;pretty_otp4632_msg4_chk([_H1|Rest1], [_H2|Rest2]) ->    pretty_otp4632_msg4_chk(Rest1, Rest2).%% --------------------------------------------------------------%% pretty_otp4710_msg1(suite) ->    [];pretty_otp4710_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("pretty_otp4710_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_pretty_encode_decode_ok( pretty_otp4710_msg1() ),    %% erase(severity),    %% erase(dbg),    ok.pretty_otp4710_msg1() ->    msg40().pretty_otp4710_msg2(suite) ->    [];pretty_otp4710_msg2(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("pretty_otp4710_msg2 -> entry", []),    ?ACQUIRE_NODES(1, Config),    Check = fun(B1, B2) -> pretty_otp4710_msg2_chk(B1, B2) end,     ok = ticket_pretty_decode_encode_only(pretty_otp4710_msg2(), Check),     %% erase(severity),    %% erase(dbg),    ok.pretty_otp4710_msg2() ->    "Authentication = 0xEFCDAB89:0x12345678:0x1234567889ABCDEF76543210\nMEGACO/" ?VERSION_STR " [124.124.124.222]\nTransaction = 9998 {\n\tContext = - {\n\t\tServiceChange = root {\n\t\t\tServices {\n\t\t\t\tMethod = Restart,\n\t\t\t\tServiceChangeAddress = 55555,\n\t\t\t\tProfile = resgw/1,\n\t\t\t\tReason = \"901 mg col boot\"\n\t\t\t}\n\t\t}\n\t}\n}".pretty_otp4710_msg2_chk(B1, B2) when is_binary(B1) and is_binary(B2) ->    S1 = binary_to_list(B1),     S2 = binary_to_list(B2),     pretty_otp4710_msg2_chk(S1, S2);pretty_otp4710_msg2_chk(Msg, Msg) ->    ok;pretty_otp4710_msg2_chk(  [$A,$u,$t,$h,$e,$n,$t,$i,$c,$a,$t,$i,$o,$n,$=,$ |Msg0],  [$A,$u,$t,$h,$e,$n,$t,$i,$c,$a,$t,$i,$o,$n,$=,$ |Msg1]) ->    {AH0, Rest0} = pretty_otp4710_msg2_chk_ah(Msg0, []),    {AH1, Rest1} = pretty_otp4710_msg2_chk_ah(Msg1, []),    case AH0 == AH1 of	true ->	    exit({message_not_equal, Rest0, Rest1});	false ->	    exit({auth_header_not_equal, AH0, AH1})    end.pretty_otp4710_msg2_chk_ah([], _Acc) ->    exit(no_auth_header_found);pretty_otp4710_msg2_chk_ah([$M,$E,$G,$A,$C,$O,$/,_|Rest], Acc) ->    {lists:reverse(Acc), Rest};pretty_otp4710_msg2_chk_ah([C|R], Acc) ->    pretty_otp4710_msg2_chk_ah(R, [C|Acc]).%% --------------------------------------------------------------%% pretty_otp4945_msg1(suite) ->    [];pretty_otp4945_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("pretty_otp4945_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    Check = fun(R) -> pretty_otp4945_msg1_chk(R) end,    ok = ticket_pretty_decode_error(pretty_otp4945_msg1(), Check),    %% erase(severity),    %% erase(dbg),    ok.pretty_otp4945_msg1() ->"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {   Context = - {      ServiceChange = ROOT {         Services {            Method = Restart,            ServiceChangeAddress = 55555,             Profile = ResGW/1         }      }   } }".    pretty_otp4945_msg1_chk(R) when is_list(R) ->    ExpMissing = [serviceChangeReason],     Check = fun(Reason) ->		    pretty_otp4945_chk(Reason, ExpMissing)	    end,    ticket_check_decode_only_error_reason(R, Check).pretty_otp4945_msg2(suite) ->    [];pretty_otp4945_msg2(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("pretty_otp4945_msg2 -> entry", []),    ?ACQUIRE_NODES(1, Config),    Check = fun(R) -> pretty_otp4945_msg2_chk(R) end,    ok = ticket_pretty_decode_error(pretty_otp4945_msg2(), Check),    %% erase(severity),    %% erase(dbg),    ok.pretty_otp4945_msg2() ->"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {   Context = - {      ServiceChange = ROOT {         Services {            Reason = 901,            ServiceChangeAddress = 55555,             Profile = ResGW/1         }      }   } }".pretty_otp4945_msg2_chk(R) when is_list(R) ->    ExpMissing = [serviceChangeMethod],     Check = fun(Reason) ->		    pretty_otp4945_chk(Reason, ExpMissing)	    end,    ticket_check_decode_only_error_reason(R, Check).    pretty_otp4945_msg3(suite) ->    [];pretty_otp4945_msg3(Config) when list(C

⌨️ 快捷键说明

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