blob: a67a0a2d964f4eb3f6b36f1ee3ed0d4577d536b8 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
//
// 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_Qtronic_Demo.ttcn
// Rev: <RnXnn>
// Prodnr: CNL 113 659
// Updated: 2009-10-01
// Contact: http://ttcn.ericsson.se
///////////////////////////////////////////////////////////////////////////////
module MBT_Qtronic_Demo
{
import from MBT_Qtronic_Testcases all;
import from MBT_Qtronic_Types all;
import from MBT_Qtronic_TestHarness all;
import from MBT_SUT_SIP_Phone all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_Base_Definitions all;
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_LGenBase_ConfigFunctions all;
import from EPTF_MBT_LGen_Definitions all;
import from EPTF_MBT_LGen_Functions all;
import from EPTF_SIP_LGen_Definitions all;
import from EPTF_SIP_LGen_Functions all;
import from EPTF_SIP_Common_Functions all;
import from EPTF_SIP_UserDatabase_Functions all;
import from EPTF_SIP_Transport_Definitions all;
import from EPTF_SIP_Transport_Functions all;
import from EPTF_SIP_MessageHandler_Functions all;
modulepar
{
charstring tsp_MBT_Tester_LocalIP := "159.107.193.33";
integer tsp_MBT_Tester_LocalPort := 15000;
charstring tsp_MBT_Tester_RemoteIP := "159.107.193.33";
integer tsp_MBT_Tester_RemotePort := 20000;
charstring tsp_MBT_SIP_Transport := "udp";
}
type component MBT_Qtronic_Demo_Main_CT
extends
EPTF_Base_CT,
EPTF_MBT_Tester_CT
{
var MBT_Qtronic_Demo_LGen_CT vc_lgen;
}
function f_MBT_Qtronic_Demo_beginTestCase() runs on Qtronic_CT
{
log(%definitionId, " started");
f_EPTF_Base_init_CT("mtc");
log(%definitionId, " Creating SUT");
var MBT_Qtronic_Demo_SUT_CT vc_sut := MBT_Qtronic_Demo_SUT_CT.create;
connect(self:userIn, vc_sut:userIn);
connect(self:userOut, vc_sut:userOut);
connect(self:EPTF_MBT_TESTER_PCO,vc_sut:EPTF_MBT_PCO);
vc_sut.start(f_MBT_Qtronic_Demo_SUT_behavior());
EPTF_MBT_TESTER_PCO.receive(EPTF_MBT_CommandResponse:?) from vc_sut;
EPTF_MBT_TESTER_PCO.send(EPTF_MBT_ConfigRequest:
{
entityGroupName := "SUT_EntityType",
noEntities := 1,
behaviors := {"MBT_behavior", "Behavior_SIP", "SUT_Behavior"},
fsmName := "MBT_Qtronic_Demo_SUT_FSM"
}
) to vc_sut;
EPTF_MBT_TESTER_PCO.receive(EPTF_MBT_ConfigResponse:?) from vc_sut;
log(%definitionId, " SUT ready");
log(%definitionId, " Creating LGen");
vc_lgen := MBT_Qtronic_Demo_LGen_CT.create;
connect(self:EPTF_MBT_TESTER_PCO,vc_lgen:EPTF_MBT_PCO);
vc_lgen.start(f_MBT_Qtronic_Demo_LGen_behavior());
EPTF_MBT_TESTER_PCO.receive(EPTF_MBT_CommandResponse:?) from vc_lgen;
EPTF_MBT_TESTER_PCO.send(EPTF_MBT_ConfigRequest:
{
entityGroupName := "MBT_EntityType",
noEntities := 1,
behaviors := {"MBT_behavior", "Behavior_SIP"},
fsmName := "FSM_MBT"
}
) to vc_lgen;
EPTF_MBT_TESTER_PCO.receive(EPTF_MBT_ConfigResponse:?) from vc_lgen;
log(%definitionId, " LGen ready");
log(%definitionId, " finished");
}
function f_MBT_Qtronic_Demo_endTestCase() runs on Qtronic_CT
{
log("### MAIN: END TESTCASE started");
f_EPTF_Base_stopAll(none, true);
log("### MAIN: END TESTCASE finished");
}
/////////////////////////////////////////////////////////////////////////
//
// M B T Applib
//
/////////////////////////////////////////////////////////////////////////
type component MBT_Qtronic_Demo_LGen_CT
extends
EPTF_MBT_LGen_CT,
EPTF_SIP_LGen_CT, EPTF_SIP_LocalTransport_CT
{
}
function f_MBT_Qtronic_Demo_LGen_behavior() runs on MBT_Qtronic_Demo_LGen_CT
{
//map(self:IPL4_PCO, system:IPL4_PCO);
f_SIP_applibInit("MBT_Demo_LGen");
f_EPTF_SIP_LocalTransport_init(tsp_MBT_SIP_Transport);
vf_EPTF_SIP_LocalTransport_receive := refers(f_EPTF_SIP_Message_MsgHandler); //receive callback function on LocalTransport
vf_EPTF_SIP_LGen_msgSender := refers(f_EPTF_SIP_LocalTransport_sendSIPMessage); //send callback function on LGen
v_removeUAS := refers(fcb_EPTF_SIP_LocalTransport_removeUAS);
f_EPTF_MBT_init("MBT_Demo_LGen",0, "MBT_");
f_EPTF_MBT_initLGenFsm
(
null,
refers(f_MBT_Qtronic_Demo_LGen_fillInDB)
);
EPTF_MBT_PCO.send(EPTF_MBT_CommandResponse:{ ready := {}}) to mtc;
f_EPTF_Base_wait4Shutdown();
}
function f_MBT_Qtronic_Demo_LGen_fillInDB(in EPTF_MBT_ConfigRequest p_req) runs on MBT_Qtronic_Demo_LGen_CT
{
var integer vl_grpIdx := f_EPTF_LGenBase_entityGrpNameIndex(p_req.entityGroupName);
var integer vl_entityIdx := f_EPTF_LGenBase_getEGrpBaseOffset(vl_grpIdx);
for (var integer i:=0; i<p_req.noEntities; i:=i+1)
{
var EPTF_IntegerList vl_bCtx := f_EPTF_LGenBase_getBehaviorCtx(i + vl_entityIdx, v_SIP_myBIdx);
f_EPTF_SIP_IPL4asp_SetUserData
(
vl_bCtx[0],
tsp_MBT_Tester_LocalIP, // local IP
{tsp_MBT_Tester_LocalPort, tsp_MBT_Tester_LocalPort+1},
tsp_MBT_SIP_Transport,
tsp_MBT_Tester_RemoteIP, // proxy ip
tsp_MBT_Tester_RemotePort // proxy port
);
f_EPTF_SIP_User_SetUserData(
vl_bCtx[0],
{
{
addr := {
nameAddr := {
displayName := "titansim_user_7465000",
addrSpec := {
scheme := "sip",
userInfo := {
userOrTelephoneSubscriber := "titansim_user_7465000",
password := omit
},
hostPort := {
host := "tcj.ics.se",
portField := tsp_MBT_Tester_LocalPort
},
urlParameters := omit,
headers := omit
}
}
},
password := "pass2ICS"
}
},
tsp_MBT_Tester_LocalIP,
{tsp_MBT_Tester_LocalPort, tsp_MBT_Tester_LocalPort+1},
i + vl_entityIdx //entity index
);
f_EPTF_SIP_Session_AddData(vl_bCtx[0], f_EPTF_SIP_getTransport(tsp_MBT_SIP_Transport),345600);
f_EPTF_SIP_IPL4asp_startListening(vl_bCtx[0], true); // Both UDP and TCP
}
}
}