@ -17,6 +17,7 @@ module GTP_Templates {
import from GTPU_Types all;
import from GTP_CodecPort all;
import from IPCP_Types all;
import from Osmocom_Gb_Types all; // BssgpCellId
/* Table 38 of 3GPP TS 29.060 */
type enumerated GTP_Cause {
@ -30,6 +31,28 @@ module GTP_Templates {
/* FIXME */
};
private function f_oct_or_wc(template integer inp, integer len) return template octetstring {
if (istemplatekind(inp, "omit")) {
return omit;
} else if (istemplatekind(inp, "*")) {
return *;
} else if (istemplatekind(inp, "?")) {
return ?;
}
return int2oct(valueof(inp), len);
}
private function f_hex_or_wc(template integer inp, integer len) return template hexstring {
if (istemplatekind(inp, "omit")) {
return omit;
} else if (istemplatekind(inp, "*")) {
return *;
} else if (istemplatekind(inp, "?")) {
return ?;
}
return int2hex(valueof(inp), len);
}
/* generalized GTP-C receive template */
template PDU_GTPC tr_GTP1C_PDU(template OCT1 msg_type, template OCT4 teid, template GTPC_PDUs pdu := ?) := {
/* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
@ -612,6 +635,408 @@ module GTP_Templates {
}
/* GTP-C RIM */
template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := {
iEI := '4B'O,
ext := '1'B,
lengthIndicator := {
length1 := 1
},
rIMApplicationIdentity := app_id
}
/* 3GPP TS 48.018 11.3.62 */
template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := {
iEI := '4C'O,
ext := '1'B,
lengthIndicator := {
length1 := 4
},
rIMSequenceNumber := int2oct(seq, 4)
}
template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
iEI := '4F'O,
ext := '1'B,
lengthIndicator := {
length1 := 1
},
ack := bool2bit(ack),
pDU_Type_Extension := type_ext,
reserved := '0000'B
}
/* 3GPP TS 48.018 11.3.67 */
template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := {
iEI := '55'O,
ext := '1'B,
lengthIndicator := {
length1 := 1
},
rIMProtocolVersionNumber := int2oct(ver, 1)
}
function tr_GTPC_Cell_Identifier_V(template BssgpCellId cid) return template Cell_Identifier_V_GTPC {
var template Cell_Identifier_V_GTPC ret := {
mccDigit1 := ?,
mccDigit2 := ?,
mccDigit3 := ?,
mncDigit3 := ?,
mncDigit1 := ?,
mncDigit2 := ?,
lac := ?,
rac := ?,
cI_value := ?
}
if (istemplatekind(cid, "omit")) {
return omit;
} else if (istemplatekind(cid, "*")) {
return *;
} else if (istemplatekind(cid, "?")) {
return ?;
}
if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
if (isvalue(cid.ra_id.lai.mcc_mnc)) {
ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
}
if (isvalue(cid.ra_id.lai.lac)) {
ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
}
}
if (isvalue(cid) and isvalue(cid.ra_id)) {
ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
}
if (isvalue(cid)) {
ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
}
return ret;
}
template (value) Cell_Identifier_V_GTPC ts_GTPC_Cell_Identifier_V(BssgpCellId cid) := {
mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
lac := int2oct(cid.ra_id.lai.lac, 2),
rac := int2oct(cid.ra_id.rac, 1),
cI_value := int2oct(cid.cell_id, 2)
}
template RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(BssgpCellId cid) := {
cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
}
function tr_GTPC_ENB_Identifier(template BssgpCellId cid, template integer tac, template octetstring gnbid) return template ENB_Identifier {
var template ENB_Identifier ret := {
mccDigit1 := ?,
mccDigit2 := ?,
mccDigit3 := ?,
mncDigit3 := ?,
mncDigit1 := ?,
mncDigit2 := ?,
tAC := ?,
globalENB_ID := ?
}
if (istemplatekind(cid, "omit") and istemplatekind(tac, "omit") and istemplatekind(gnbid, "omit")) {
return omit;
} else if (istemplatekind(cid, "*") and istemplatekind(tac, "*") and istemplatekind(gnbid, "*")) {
return *;
} else if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
return ?;
}
if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
if (isvalue(cid.ra_id.lai.mcc_mnc)) {
ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
}
}
if (isvalue(tac)) {
ret.tAC := int2oct(valueof(tac), 2);
}
if (isvalue(gnbid)) {
ret.globalENB_ID := gnbid;
}
return ret;
}
template (value) ENB_Identifier ts_GTPC_ENB_Identifier(BssgpCellId cid, integer tac, octetstring gnbid) := {
mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
tAC := int2oct(tac, 2),
globalENB_ID := gnbid
}
template RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(BssgpCellId cid, integer tac, octetstring gnbid) := {
eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid)
}
template RIM_Routing_Information_GTPC
tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template RIM_Routing_Address_GTPC addr) := {
iEI := '54'O,
ext := '1'B,
lengthIndicator := {
length1 := ?
},
rIMRoutingAddressDiscriminator := addr_discr,
spare := '0'H,
rIM_Routing_Address := addr
}
template (value) RIM_Routing_Information_GTPC
ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := {
iEI := '54'O,
ext := '1'B,
lengthIndicator := {
length1 := 0 /* overwritten */
},
rIMRoutingAddressDiscriminator := addr_discr,
spare := '0'H,
rIM_Routing_Address := addr
}
/* 3GPP TS 48.018 11.3.63.1.1 */
template RAN_Information_Request_Application_Container_NACC_GTPC
tr_GTPC_RAN_Information_Request_Application_Container_NACC(template BssgpCellId cid) := {
iEI := '4D'O,
ext := '1'B,
lengthIndicator := {
length1 := ?
},
reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid)
}
template (value) RAN_Information_Request_Application_Container_NACC_GTPC
ts_GTPC_RAN_Information_Request_Application_Container_NACC(BssgpCellId cid) := {
iEI := '4D'O,
ext := '1'B,
lengthIndicator := {
length1 := 0 /* overwritten */
},
reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
}
/* 3GPP TS 48.018 11.3.63.1 */
template RAN_Information_Request_Application_Container_GTPC
tru_GTPC_RAN_Information_Request_Application_Container_NACC(template BssgpCellId cid) := {
nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
}
template (value) RAN_Information_Request_Application_Container_GTPC
tsu_GTPC_RAN_Information_Request_Application_Container_NACC(BssgpCellId cid) := {
nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
}
/* 3GPP TS 48.018 11.3.63.2.1 */
template RAN_Information_Application_Container_NACC_GTPC
tr_GTPC_RAN_Information_Application_Container_NACC(template BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
iEI := '4E'O,
ext := '1'B,
lengthIndicator := {
length1 := ?
},
reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid),
typeBit := bool2bit(psi_type),
number_of_SI_PSI := int2bit(si_psi_num, 7),
sI_PSI := si_psi
}
template (value) RAN_Information_Application_Container_NACC_GTPC
ts_GTPC_RAN_Information_Application_Container_NACC(BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
iEI := '4E'O,
ext := '1'B,
lengthIndicator := {
length1 := 0 /* overwritten */
},
reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid),
typeBit := bool2bit(psi_type),
number_of_SI_PSI := int2bit(si_psi_num, 7),
sI_PSI := si_psi
}
/* RAN_Information_Request */
template (value) RAN_Information_Request_RIM_Container_GTPC
ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
template (value) RIM_Sequence_Number_GTPC seq,
template (value) RIM_PDU_Indications_GTPC ind,
template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit,
template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
iEI := '57'O,
ext := '1'B,
lengthIndicator := {
length1 := 0 /* overwritten */
},
rIM_Application_Identity := app_id,
rIM_Sequence_Number := seq,
rIM_PDU_Indications := ind,
rIM_Protocol_Version_Number := ver,
application_Container := app_cont,
sON_TransferApplicationIdentity := son_app_id
}
template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest,
template (value) RIM_Routing_Information_GTPC src,
template (value) RAN_Information_Request_RIM_Container_GTPC cont) := {
bssgpPduType := '71'O,
destination_Cell_Identifier := dest,
source_Cell_Identifier := src,
rIM_Container := cont
}
template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := {
type_gtpc := '90'O,
lengthf := 0, /* FIXME */
rANTransparentContainerField := {
pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
}
}
/* RAN_Information */
template ApplContainer_or_ApplErrContainer_NACC_GTPC
tru_GTPC_ApplContainer_NACC(BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
}
template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC
tsu_GTPC_ApplContainer_NACC(BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
}
template ApplContainer_or_ApplErrContainer_GTPC
tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
nacc := cont
}
template (value) ApplContainer_or_ApplErrContainer_GTPC
tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
nacc := cont
}
template RAN_Information_RIM_Container_GTPC
tr_GTPC_RAN_Information_RIM_Container(template RIM_Application_Identity_GTPC app_id,
template RIM_Sequence_Number_GTPC seq,
template RIM_PDU_Indications_GTPC ind,
template RIM_Protocol_Version_Number_GTPC ver := omit,
template ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
template SON_TransferApplicationIdentity son_app_id := omit) := {
iEI := '58'O,
ext := '1'B,
lengthIndicator := {
length1 := ?
},
rIM_Application_Identity := app_id,
rIM_Sequence_Number := seq,
rIM_PDU_Indications := ind,
rIM_Protocol_Version_Number := ver,
applContainer_or_ApplErrContainer := app_cont,
sON_TransferApplicationIdentity := son_app_id
}
template (value) RAN_Information_RIM_Container_GTPC
ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
template (value) RIM_Sequence_Number_GTPC seq,
template (value) RIM_PDU_Indications_GTPC ind,
template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
iEI := '58'O,
ext := '1'B,
lengthIndicator := {
length1 := 0 /* overwritten */
},
rIM_Application_Identity := app_id,
rIM_Sequence_Number := seq,
rIM_PDU_Indications := ind,
rIM_Protocol_Version_Number := ver,
applContainer_or_ApplErrContainer := app_cont,
sON_TransferApplicationIdentity := son_app_id
}
template PDU_BSSGP_RAN_INFORMATION_GTPC
tr_GTPC_RAN_Information(template RIM_Routing_Information_GTPC dest,
template RIM_Routing_Information_GTPC src,
template RAN_Information_RIM_Container_GTPC cont) := {
bssgpPduType := '70'O,
destination_Cell_Identifier := dest,
source_Cell_Identifier := src,
rIM_Container := cont
}
template (value) PDU_BSSGP_RAN_INFORMATION_GTPC
ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest,
template (value) RIM_Routing_Information_GTPC src,
template (value) RAN_Information_RIM_Container_GTPC cont) := {
bssgpPduType := '70'O,
destination_Cell_Identifier := dest,
source_Cell_Identifier := src,
rIM_Container := cont
}
template RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
type_gtpc := '90'O,
lengthf := ?,
rANTransparentContainerField := {
pDU_BSSGP_RAN_INFORMATION := pdu
}
}
template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
type_gtpc := '90'O,
lengthf := 0, /* overwritten */
rANTransparentContainerField := {
pDU_BSSGP_RAN_INFORMATION := pdu
}
}
template RANTransparentContainer tr_RANTransparentContainer(template RANTransparentContainerField rANTransparentContainerField) := {
type_gtpc := '90'O,
lengthf := ?,
rANTransparentContainerField := rANTransparentContainerField
}
template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := {
type_gtpc := '90'O,
lengthf := 0, /* overwritten */
rANTransparentContainerField := rANTransparentContainerField
}
template GTPC_PDUs tr_RANInfoRelay(template RANTransparentContainer transparentContainer) := {
ranInformationRelay := {
transparentContainer := transparentContainer,
rIM_RoutingAddress := *,
rIM_RoutingAddress_Discriminator := *,
private_extension_gtpc := *
}
}
template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer) := {
ranInformationRelay := {
transparentContainer := transparentContainer,
rIM_RoutingAddress := omit,
rIM_RoutingAddress_Discriminator := omit,
private_extension_gtpc := omit
}
}
template Gtp1cUnitdata
tr_GTPC_RANInfoRelay(template GtpPeer peer,
template RANTransparentContainer transparentContainer) := {
peer := peer,
gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer))
}
template (value) Gtp1cUnitdata
ts_GTPC_RANInfoRelay(template (value) GtpPeer peer,
template (value) RANTransparentContainer transparentContainer) := {
peer := peer,
gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer)), 0)
}
template RAN_Information_Request_RIM_Container_GTPC
tr_GTPC_RAN_Information_Request_RIM_Container(template RIM_Application_Identity_GTPC app_id := ?,
template RIM_Sequence_Number_GTPC seq := ?,
template RIM_PDU_Indications_GTPC ind := ?,
template RIM_Protocol_Version_Number_GTPC ver := *,
template RAN_Information_Request_Application_Container_GTPC app_cont := *,
template SON_TransferApplicationIdentity son_app_id := *) := {
iEI := '57'O,
ext := '1'B,
lengthIndicator := {
length1 := ?
},
rIM_Application_Identity := app_id,
rIM_Sequence_Number := seq,
rIM_PDU_Indications := ind,
rIM_Protocol_Version_Number := ver,
application_Container := app_cont,
sON_TransferApplicationIdentity := son_app_id
}
/* GTP-U */