laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37372?usp=email )
Change subject: Revert "s1ap: add {enc,dec}_S1AP_Global_ENB_ID() API" ......................................................................
Revert "s1ap: add {enc,dec}_S1AP_Global_ENB_ID() API"
This reverts commit c4944aaa0114bda268af12bfb58d9f12f1041c4b.
This commit broke ttcn3-mme-test:
TC_RIM_RAN_INF0(34)@79228701f472: Dynamic test case error: Unknown coding method requested to encode type '@S1AP-IEs.Global-ENB-ID' TC_RIM_RAN_INF0(34)@79228701f472: setverdict(error): none -> error TC_RIM_RAN_INF0(34)@79228701f472: Final verdict of PTC: error
Encoding/decoding IEs (not complete PDUs) is not supported by libfftranscode. This will only work with built-in TITAN's PER codec available in recent releases.
Change-Id: I4d73bca4ca1fded487d80e535d3050661b83dcea --- M library/s1ap/S1AP_EncDec.cc M library/s1ap/S1AP_Types.ttcn M mme/MME_Tests.ttcn 3 files changed, 48 insertions(+), 26 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/library/s1ap/S1AP_EncDec.cc b/library/s1ap/S1AP_EncDec.cc index 919c9e9..a17f20e 100644 --- a/library/s1ap/S1AP_EncDec.cc +++ b/library/s1ap/S1AP_EncDec.cc @@ -61,26 +61,4 @@ return ret_dcc; }
-OCTETSTRING enc__S1AP__Global__ENB__ID(const S1AP__IEs::Global__ENB__ID &ie) -{ - TTCN_Buffer buf; - - buf.clear(); - ie.encode(S1AP__IEs::Global__ENB__ID_descr_, buf, - TTCN_EncDec::CT_PER, PER_ALIGNED); - return OCTETSTRING(buf.get_len(), buf.get_data()); -} - -S1AP__IEs::Global__ENB__ID dec__S1AP__Global__ENB__ID(const OCTETSTRING &stream) -{ - S1AP__IEs::Global__ENB__ID ie; - TTCN_Buffer buf; - - buf.clear(); - buf.put_os(stream); - ie.decode(S1AP__IEs::Global__ENB__ID_descr_, buf, - TTCN_EncDec::CT_PER, PER_ALIGNED); - return ie; -} - } diff --git a/library/s1ap/S1AP_Types.ttcn b/library/s1ap/S1AP_Types.ttcn index 5d0ecbe..6730ff3 100644 --- a/library/s1ap/S1AP_Types.ttcn +++ b/library/s1ap/S1AP_Types.ttcn @@ -1,11 +1,7 @@ module S1AP_Types {
import from S1AP_PDU_Descriptions language "ASN.1:1997" all; - import from S1AP_IEs language "ASN.1:1997" all;
external function enc_S1AP_PDU(in S1AP_PDU pdu) return octetstring; external function dec_S1AP_PDU(in octetstring stream) return S1AP_PDU; - - external function enc_S1AP_Global_ENB_ID(in Global_ENB_ID ie) return octetstring; - external function dec_S1AP_Global_ENB_ID(in octetstring stream) return Global_ENB_ID; } diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn index 95b11aa..76c9c7e 100644 --- a/mme/MME_Tests.ttcn +++ b/mme/MME_Tests.ttcn @@ -124,6 +124,35 @@ var UeParams g_ue_pars[NUM_UE]; }
+/* Encode an S1AP Global-ENB-ID into an octetstring */ +private function enc_S1AP_Global_ENB_ID(Global_ENB_ID global_enb_id) return octetstring { + + /* Due to the limitations of libfftranscode, we can not define encoders (or decoders) for individual + * information elements (in S1AP_Types.cc). Unfortuantely Global-ENB-ID also appears in BSSGP in its + * encoded form. (see also: GTP-C 3GPP TS 48.018, section 11.3.70). To encode a given Global-ENB-ID + * we craft a full S1AP PDU and encode it. Then we can cut out the encoded Global-ENB-ID from the + * generated octetstring. */ + + var SupportedTAs supported_tas_dummy := {{ + tAC := '0000'O, + broadcastPLMNs := { '00f000'O }, + iE_Extensions := omit + }}; + var octetstring encoded; + var integer global_enb_id_len; + + if (ispresent(global_enb_id.eNB_ID.macroENB_ID)) { + global_enb_id_len := 8; + } else { + /* All other ENB ID types fit into 8 byte (homeENB_ID, short_macroENB_ID, long_macroENB_ID) */ + global_enb_id_len := 9; + } + + encoded := enc_S1AP_PDU(valueof(ts_S1AP_SetupReq(global_enb_id, supported_tas_dummy, v32))); + + return substr(encoded, 11, global_enb_id_len); +} + type component ConnHdlr extends S1AP_ConnHdlr, SGsAP_ConnHdlr, DIAMETER_ConnHdlr, GTP_ConnHdlr, GTP2_ConnHdlr { var ConnHdlrPars g_pars; timer g_Tguard := 30.0;