laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37226?usp=email )

 (

1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: s1ap: add {enc,dec}_S1AP_Global_ENB_ID() API
......................................................................

s1ap: add {enc,dec}_S1AP_Global_ENB_ID() API

Change-Id: I856fd426b92046dcae72149f46737da3e1b65219
---
M library/s1ap/S1AP_EncDec.cc
M library/s1ap/S1AP_Types.ttcn
M mme/MME_Tests.ttcn
3 files changed, 35 insertions(+), 29 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/library/s1ap/S1AP_EncDec.cc b/library/s1ap/S1AP_EncDec.cc
index a17f20e..919c9e9 100644
--- a/library/s1ap/S1AP_EncDec.cc
+++ b/library/s1ap/S1AP_EncDec.cc
@@ -61,4 +61,26 @@
        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 6730ff3..5d0ecbe 100644
--- a/library/s1ap/S1AP_Types.ttcn
+++ b/library/s1ap/S1AP_Types.ttcn
@@ -1,7 +1,11 @@
 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 76c9c7e..95b11aa 100644
--- a/mme/MME_Tests.ttcn
+++ b/mme/MME_Tests.ttcn
@@ -124,35 +124,6 @@
        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;

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37226?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I856fd426b92046dcae72149f46737da3e1b65219
Gerrit-Change-Number: 37226
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-MessageType: merged

Reply via email to