diff --git a/library/GTP_Templates.ttcn b/library/GTP_Templates.ttcn index ef7e97bb9..44d9682ca 100644 --- a/library/GTP_Templates.ttcn +++ b/library/GTP_Templates.ttcn @@ -456,12 +456,10 @@ module GTP_Templates { ts_IPCP(LCP_Configure_Request, identifier, { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) }); - function f_teardown_ind_IE(in template BIT1 ind) return template TearDownInd { -/* - if (not isvalue(ind)) { + function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd { + if (istemplatekind(ind, "omit")) { return omit; } -*/ var TearDownInd ret := { type_gtpc := '13'O, tdInd := valueof(ind), @@ -470,7 +468,7 @@ module GTP_Templates { return ret; } - template GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template BIT1 teardown_ind) := { + template GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := { deletePDPContextRequest := { cause := omit, tearDownIndicator := f_teardown_ind_IE(teardown_ind), @@ -489,7 +487,7 @@ module GTP_Templates { } template Gtp1cUnitdata ts_GTPC_DeletePDP(GtpPeer peer, uint16_t seq, OCT4 teid, - BIT4 nsapi, template BIT1 teardown_ind) := { + BIT4 nsapi, template (omit) BIT1 teardown_ind) := { peer := peer, gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid, valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq) diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn index e1947b249..d3e021df0 100644 --- a/library/L3_Templates.ttcn +++ b/library/L3_Templates.ttcn @@ -1937,6 +1937,74 @@ template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause, boo } } +template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause, boolean tdown := false, + template (omit) ProtocolConfigOptionsV pco := omit + ) := { + discriminator := '0000'B, /* overwritten */ + tiOrSkip := { + transactionId := { + tio := tid, + tiFlag := '1'B, + tIExtension := omit + } + }, + msgs := { + gprs_sm := { + deactivatePDPContextRequest := { + messageType := '00000000'B, /* overwritten */ + smCause := cause, + tearDownIndicator := { + tearDownIndicatorV := { + tdi_flag := bool2bit(tdown), + spare := '000'B + }, + elementIdentifier := '1001'B + }, + protocolConfigOpts := ts_PcoTLV(pco), + mBMSprotocolConfigOptions := omit, + t3396 := omit, + wLANOffloadIndication := omit, + nBIFOM_Container := omit + } + } + } +} + +template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause, + template boolean tdown := false, + template (omit) ProtocolConfigOptionsV pco := omit + ) := { + discriminator := '0000'B, /* overwritten */ + tiOrSkip := { + transactionId := { + tio := tid, + tiFlag := '1'B, + tIExtension := omit + } + }, + msgs := { + gprs_sm := { + deactivatePDPContextRequest := { + messageType := '00000000'B, /* overwritten */ + smCause := cause, + tearDownIndicator := { + tearDownIndicatorV := { + tdi_flag := bool2bit_tmpl(tdown), + spare := '000'B + }, + elementIdentifier := '1001'B + }, + protocolConfigOpts := *, + mBMSprotocolConfigOptions := *, + t3396 := *, + wLANOffloadIndication := *, + nBIFOM_Container := * + } + } + } +} + + template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?) := { discriminator := '1010'B, @@ -1959,6 +2027,50 @@ template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?) } } +template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?) +:= { + discriminator := '1010'B, + tiOrSkip := { + transactionId := { + tio := tid, + tiFlag := '0'B, + tIExtension := omit + } + }, + msgs := { + gprs_sm := { + deactivatePDPContextAccept := { + messageType := '01000111'B, + protocolConfigOpts := *, + mBMSprotocolConfigOptions := *, + nBIFOM_Container := * + } + } + } +} + +template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid) +:= { + discriminator := '1010'B, + tiOrSkip := { + transactionId := { + tio := tid, + tiFlag := '0'B, + tIExtension := omit + } + }, + msgs := { + gprs_sm := { + deactivatePDPContextAccept := { + messageType := '01000111'B, + protocolConfigOpts := omit, + mBMSprotocolConfigOptions := omit, + nBIFOM_Container := omit + } + } + } +} + private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring { diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn index 06ed56bed..a853c6d68 100644 --- a/sgsn/SGSN_Tests.ttcn +++ b/sgsn/SGSN_Tests.ttcn @@ -842,6 +842,22 @@ function f_pdp_ctx_deact_mo(inout PdpActPars apars, OCT1 cause) runs on BSSGP_Co } } +function f_pdp_ctx_deact_mt(inout PdpActPars apars, OCT1 cause) runs on BSSGP_ConnHdlr { + var Gtp1cUnitdata g_ud; + var integer seq_nr := 23; + var GtpPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c)); + + BSSGP.clear; + GTP.send(ts_GTPC_DeletePDP(peer, seq_nr, apars.sgsn_tei_c, apars.nsapi, omit)); + + interleave { + [] BSSGP.receive(tr_BD_L3_MT(tr_SM_DEACT_PDP_REQ_MT(apars.tid, ?))) { + BSSGP.send(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid)); + } + [] GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, apars.ggsn_tei_c)) { } + } +} + /* Table 10.5.156/3GPP TS 24.008 */ template (value) QoSV t_QosDefault := { @@ -1095,6 +1111,28 @@ testcase TC_attach_pdp_act_user_deact_mo() runs on test_CT { vc_conn.done; } +/* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MT direction */ +private function f_TC_attach_pdp_act_user_deact_mt(charstring id) runs on BSSGP_ConnHdlr { + var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); + + /* first perform regular attach */ + f_TC_attach(id); + /* then activate PDP context */ + f_pdp_ctx_act(apars); + /* then transceive a downlink PDU */ + f_gtpu_xceive_mt(apars, f_rnd_octstring(100)); + f_gtpu_xceive_mo(apars, f_rnd_octstring(200)); + + f_pdp_ctx_deact_mt(apars, '00'O); +} +testcase TC_attach_pdp_act_user_deact_mt() runs on test_CT { + var BSSGP_ConnHdlr vc_conn; + f_init(); + vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mt), testcasename(), g_gb[0], 22); + vc_conn.done; +} + + control { execute( TC_attach() ); @@ -1117,6 +1155,7 @@ control { execute( TC_attach_pdp_act_user() ); execute( TC_attach_pdp_act_ggsn_reject() ); execute( TC_attach_pdp_act_user_deact_mo() ); + execute( TC_attach_pdp_act_user_deact_mt() ); }