diff --git a/library/GTPv1C_Templates.ttcn b/library/GTPv1C_Templates.ttcn index 0907c5e4f..2eb1d7eaf 100644 --- a/library/GTPv1C_Templates.ttcn +++ b/library/GTPv1C_Templates.ttcn @@ -341,7 +341,8 @@ module GTPv1C_Templates { /* 7.7.28 MM Context */ template (value) MM_Context ts_MM_ContextGSM(template (value) OCT8 kc, template (value) BIT3 cksn := '000'B, - template (value) BIT3 gea := '000'B) := { + template (value) BIT3 gea := '000'B, + template (value) octetstring triplet := ''O) := { type_gtpc := '81'O, context := { mmcontGSM := { @@ -352,7 +353,7 @@ module GTPv1C_Templates { noofVectors := 0, /* overwritten */ security := '01'B, /* GSM key and triplets */ kc := kc, - triplet := ''O, + triplet := triplet, drx_par := '0000'O, msNetW_cap_length := 0, /* overwritten */ msNetw_cap := omit, @@ -363,6 +364,32 @@ module GTPv1C_Templates { } } } + template (present) MM_Context tr_MM_ContextGSM(template (present) OCT8 kc := ?, + template (present) BIT3 cksn := ?, + template (present) BIT3 gea := ?, + template (present) octetstring triplet := ?) := { + type_gtpc := '81'O, + context := { + mmcontGSM := { + lengthf := ?, + cksn := cksn, + spare := ?, + usedCipher := gea, + noofVectors := ?, + security := '01'B, /* GSM key and triplets */ + kc := kc, + triplet := triplet, + drx_par := ?, + msNetW_cap_length := ?, + msNetw_cap := *, + containerLength := ?, + container := *, + access_restriction_data_length := ?, + access_restriction_data := * + } + } + } + template (value) MM_Context ts_MM_ContextUMTS(template (value) OCT16 ck, template (value) OCT16 ik) := { type_gtpc := '81'O, diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn index 9029a9ef5..67e815b78 100644 --- a/sgsn/SGSN_Tests.ttcn +++ b/sgsn/SGSN_Tests.ttcn @@ -3757,7 +3757,22 @@ private function f_TC_sgsn_context_req_in(charstring id) runs on BSSGP_ConnHdlr var template (present) GTPC_PDUs ctx_rsp; ctx_rsp := tr_SGSNContextRespPDU(cause := GTP_CAUSE_REQUEST_ACCEPTED, imsi := g_pars.imsi); - /* TODO: match MM/PDP Context, GSN Address */ + + /* SGSN Address for Control Plane */ + var octetstring sgsn_addr := f_inet_addr(mp_sgsn_gtp_ip); + ctx_rsp.sgsn_ContextResponse.sgsn_addr_controlPlane := tr_GsnAddr(sgsn_addr); + + /* Match MM Context */ + if (ispresent(g_pars.vec)) { + /* XXX: this is only valid for GERAN */ + var octetstring triplet := g_pars.vec.rand & g_pars.vec.sres & g_pars.vec.kc; + ctx_rsp.sgsn_ContextResponse.mm_Context := tr_MM_ContextGSM(kc := g_pars.vec.kc, + triplet := triplet); + /* TODO: 7.5.4 "The IMEISV shall, if available, be included in the MM Context". + * See also 3GPP TS 29.060, section 7.7.28 and Table 47A */ + } + + /* TODO: match PDP Context */ T.start(2.0); alt {