| /////////////////////////////////////////////////////////////////////////////// |
| // |
| // Copyright (c) 2000-2018 Ericsson Telecom AB |
| // |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // which accompanies this distribution, and is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| /////////////////////////////////////////////////////////////////////////////// |
| // |
| // File: MBT_SpecExpMBT_SpecExpl_Testcasesl_Demo.ttcn |
| // Rev: <RnXnn> |
| // Prodnr: CNL 113 659 |
| // Updated: 2009-10-01 |
| // Contact: http://ttcn.ericsson.se |
| /////////////////////////////////////////////////////////////////////////////// |
| module MBT_SpecExpl_Testcases |
| { |
| import from MBT_SpecExpl_Demo all; |
| import from EPTF_MBT_LGen_Definitions all; |
| type port netInPort message |
| { |
| inout SIPResp; |
| inout SIPReq; |
| } with { extension "internal" } |
| |
| type port userInPort message |
| { |
| inout UserInput; |
| } with { extension "internal" } |
| |
| type port netOutPort message |
| { |
| inout SIPResp; |
| inout SIPReq; |
| } with { extension "internal" } |
| |
| type port userOutPort message |
| { |
| inout TimeOutIndication; |
| } with { extension "internal" } |
| |
| type record SIPReq |
| { |
| charstring op, |
| charstring param_ |
| } |
| |
| type record SIPResp |
| { |
| integer status, |
| charstring cseq |
| } |
| |
| type record UserInput |
| { |
| charstring input1, |
| charstring input2 |
| } |
| |
| type record TimeOutIndication |
| { |
| |
| } |
| |
| type component SpecExpl_CT extends MBT_SpecExpl_Demo_Main_CT |
| { |
| port netInPort netIn; |
| port userInPort userIn; |
| port netOutPort netOut; |
| port userOutPort userOut; |
| timer harnessTimer := 0.0; |
| } |
| |
| altstep SpecExplDefaultAlt() runs on SpecExpl_CT |
| { |
| [] any port.receive |
| { |
| harnessTimer.stop; |
| setverdict(fail); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| stop; |
| } |
| [] harnessTimer.timeout |
| { |
| setverdict(fail); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| stop; |
| } |
| } |
| function specexpl_send_SIPResp_to_netIn(template SIPResp msgToSend) runs on SpecExpl_CT |
| { |
| netIn.send(msgToSend); |
| } |
| |
| function specexpl_send_SIPReq_to_netIn(template SIPReq msgToSend) runs on SpecExpl_CT |
| { |
| netIn.send(msgToSend); |
| } |
| |
| function specexpl_send_UserInput_to_userIn(template UserInput msgToSend) runs on SpecExpl_CT |
| { |
| userIn.send(msgToSend); |
| } |
| |
| function specexpl_receive_SIPResp_from_netOut(template SIPResp tmplToMatch) runs on SpecExpl_CT |
| { |
| netOut.receive(tmplToMatch); |
| } |
| |
| function specexpl_receive_SIPReq_from_netOut(template SIPReq tmplToMatch) runs on SpecExpl_CT |
| { |
| netOut.receive(tmplToMatch); |
| } |
| |
| function specexpl_receive_TimeOutIndication_from_userOut(template TimeOutIndication tmplToMatch) runs on SpecExpl_CT |
| { |
| userOut.receive(tmplToMatch); |
| } |
| |
| |
| testcase Testcase_1() runs on SpecExpl_CT |
| { |
| var float oldtimer := 0.0; |
| var float SLACK := 10.0; |
| var default default_behaviour_ref; |
| f_MBT_SpecExpl_Demo_beginTestCase(); |
| default_behaviour_ref := activate(SpecExplDefaultAlt()); |
| log("START TESTCASE: Testcase_1"); |
| //Init_Calling |
| log("Init_Calling"); |
| specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Calling_Ringing |
| log("Calling_Ringing"); |
| specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""}); |
| //Ringing_Ready |
| log("Ringing_Ready"); |
| specexpl_send_SIPResp_to_netIn({status := 200, cseq := "INVITE"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Ready_End |
| log("Ready_End"); |
| specexpl_send_SIPReq_to_netIn({op := "BYE", param_ := "sip:127.0.0.1"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPResp_from_netOut({status := 200, cseq := "BYE"}); |
| harnessTimer.stop; |
| log("THE END"); |
| setverdict(pass); |
| deactivate(default_behaviour_ref); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| } |
| |
| testcase Testcase_2() runs on SpecExpl_CT |
| { |
| var float oldtimer := 0.0; |
| var float SLACK := 10.0; |
| var default default_behaviour_ref; |
| f_MBT_SpecExpl_Demo_beginTestCase(); |
| default_behaviour_ref := activate(SpecExplDefaultAlt()); |
| log("START TESTCASE: Testcase_2"); |
| //Init_Calling |
| log("Init_Calling"); |
| specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Calling_Ringing |
| log("Calling_Ringing"); |
| specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""}); |
| //Ringing_Ready |
| log("Ringing_Ready"); |
| specexpl_send_SIPResp_to_netIn({status := 200, cseq := "INVITE"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Ready_Terminating |
| log("Ready_Terminating"); |
| specexpl_send_UserInput_to_userIn({input1 := "bye", input2 := ""}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Terminating_OK |
| log("Terminating_OK"); |
| specexpl_send_SIPResp_to_netIn({status := 200, cseq := ""}); |
| log("THE END"); |
| setverdict(pass); |
| deactivate(default_behaviour_ref); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| } |
| |
| testcase Testcase_3() runs on SpecExpl_CT |
| { |
| var float oldtimer := 0.0; |
| var float SLACK := 10.0; |
| var default default_behaviour_ref; |
| f_MBT_SpecExpl_Demo_beginTestCase(); |
| default_behaviour_ref := activate(SpecExplDefaultAlt()); |
| log("START TESTCASE: Testcase_3"); |
| //Init_Calling |
| log("Init_Calling"); |
| specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Calling_Ringing |
| log("Calling_Ringing"); |
| specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""}); |
| //Ringing_Reject |
| log("Ringing_Reject"); |
| specexpl_send_SIPResp_to_netIn({status := 486, cseq := "INVITE"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| log("THE END"); |
| setverdict(pass); |
| deactivate(default_behaviour_ref); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| } |
| |
| testcase Testcase_4() runs on SpecExpl_CT |
| { |
| var float oldtimer := 0.0; |
| var float SLACK := 10.0; |
| var default default_behaviour_ref; |
| f_MBT_SpecExpl_Demo_beginTestCase(); |
| default_behaviour_ref := activate(SpecExplDefaultAlt()); |
| log("START TESTCASE: Testcase_4"); |
| //Init_Calling |
| log("Init_Calling"); |
| specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Calling_Ringing |
| log("Calling_Ringing"); |
| specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""}); |
| //Ringing_Canceling |
| log("Ringing_Canceling"); |
| specexpl_send_UserInput_to_userIn({input1 := "cancel", input2 := ""}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Canceling_WaitingResponse |
| log("Canceling_WaitingResponse"); |
| specexpl_send_SIPResp_to_netIn({status := 200, cseq := "CANCEL"}); |
| //WaitingResponse_Terminate |
| log("WaitingResponse_Terminate"); |
| specexpl_send_SIPResp_to_netIn({status := 487, cseq := "INVITE"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| log("THE END"); |
| setverdict(pass); |
| deactivate(default_behaviour_ref); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| } |
| |
| testcase Testcase_5() runs on SpecExpl_CT |
| { |
| var float oldtimer := 0.0; |
| var float SLACK := 10.0; |
| var default default_behaviour_ref; |
| f_MBT_SpecExpl_Demo_beginTestCase(); |
| default_behaviour_ref := activate(SpecExplDefaultAlt()); |
| log("START TESTCASE: Testcase_5"); |
| //Init_Calling |
| log("Init_Calling"); |
| specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Calling_Ringing |
| log("Calling_Ringing"); |
| specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""}); |
| //Canceling_Timeout |
| log("Canceling_Timeout"); |
| specexpl_send_UserInput_to_userIn({input1 := "cancel", input2 := ""}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(0.50 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(1.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(2.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(4.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "CANCEL", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| log("THE END"); |
| setverdict(pass); |
| deactivate(default_behaviour_ref); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| } |
| |
| testcase Testcase_6() runs on SpecExpl_CT |
| { |
| var float oldtimer := 0.0; |
| var float SLACK := 10.0; |
| var default default_behaviour_ref; |
| f_MBT_SpecExpl_Demo_beginTestCase(); |
| default_behaviour_ref := activate(SpecExplDefaultAlt()); |
| log("START TESTCASE: Testcase_6"); |
| //Calling_Timeout |
| log("Calling_Timeout"); |
| specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(0.50 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(1.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(2.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(4.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| log("THE END"); |
| setverdict(pass); |
| deactivate(default_behaviour_ref); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| } |
| |
| testcase Testcase_7() runs on SpecExpl_CT |
| { |
| var float oldtimer := 0.0; |
| var float SLACK := 10.0; |
| var default default_behaviour_ref; |
| f_MBT_SpecExpl_Demo_beginTestCase(); |
| default_behaviour_ref := activate(SpecExplDefaultAlt()); |
| log("START TESTCASE: Testcase_7"); |
| //Init_Calling |
| log("Init_Calling"); |
| specexpl_send_UserInput_to_userIn({input1 := "invite", input2 := "sip:127.0.0.1:5061"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "INVITE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Calling_Ringing |
| log("Calling_Ringing"); |
| specexpl_send_SIPResp_to_netIn({status := 180, cseq := ""}); |
| //Ringing_Ready |
| log("Ringing_Ready"); |
| specexpl_send_SIPResp_to_netIn({status := 200, cseq := "INVITE"}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "ACK", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| //Terminating_Timeout |
| log("Terminating_Timeout"); |
| specexpl_send_UserInput_to_userIn({input1 := "bye", input2 := ""}); |
| harnessTimer.start(0.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(0.50 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(1.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(2.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| harnessTimer.start(4.00 + SLACK); |
| specexpl_receive_SIPReq_from_netOut({op := "BYE", param_ := "sip:127.0.0.1:5061"}); |
| harnessTimer.stop; |
| log("THE END"); |
| setverdict(pass); |
| deactivate(default_behaviour_ref); |
| f_MBT_SpecExpl_Demo_endTestCase(); |
| } |
| } |