From 4ab655c7790049b4e9b5d1b467f7e24da7b2921f Mon Sep 17 00:00:00 2001 From: garciay Date: Fri, 6 Sep 2024 11:27:06 +0200 Subject: [PATCH 1/4] Add license file --- LICENSE | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7cae155 --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +Copyright 2019-2022 ETSI + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. -- GitLab From fc85ff60c6f496db7b9dac21480f6acd063252e3 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 22 Oct 2024 07:00:40 +0200 Subject: [PATCH 2/4] Remove dependencies to asn1c to use TITAN codecs --- Makefile | 38 +---- ccsrc/Asn1c/asn1_recoder.cc | 56 ------- ccsrc/Asn1c/asn1_recoder.hh | 29 ---- ccsrc/Asn1c/module.mk | 3 - ccsrc/Asn1c/per_codec.hh | 80 --------- ccsrc/EncDec/LibNGAP_Encdec.cc | 158 ------------------ ccsrc/EncDec/module.mk | 3 - ccsrc/Protocols/NGAP/module.mk | 2 +- ccsrc/Protocols/NGAP/ngap_codec.cc | 32 ++-- ccsrc/Protocols/NGAP/ngap_codec.hh | 6 +- ccsrc/Protocols/NGAP/ngap_pdu_codec.cc | 18 -- ccsrc/Protocols/NGAP/ngap_pdu_codec.hh | 19 --- config.mk | 7 +- etc/AtsNGAP/AtsNGAP_AMF.cfg_ | 14 +- install.sh | 5 + libNr5gcAsn1.mk | 120 ------------- titan-test-system-framework | 2 +- ttcn/AtsNGAP/NGAP_TestCases.ttcn | 41 +++++ ttcn/AtsNGAP/module.mk | 6 +- .../lib/LibNGAP_EncdecDeclarations.ttcn | 52 +++--- .../lib/asn1/NGAP_PDU_Descriptions.asn | 2 +- .../Abstract_Socket.cc.patch | 117 +++++++++++++ .../Abstract_Socket.hh.patch | 38 +++++ 23 files changed, 274 insertions(+), 574 deletions(-) delete mode 100644 ccsrc/Asn1c/asn1_recoder.cc delete mode 100644 ccsrc/Asn1c/asn1_recoder.hh delete mode 100644 ccsrc/Asn1c/module.mk delete mode 100644 ccsrc/Asn1c/per_codec.hh delete mode 100644 ccsrc/EncDec/LibNGAP_Encdec.cc delete mode 100644 ccsrc/EncDec/module.mk delete mode 100644 ccsrc/Protocols/NGAP/ngap_pdu_codec.cc delete mode 100644 ccsrc/Protocols/NGAP/ngap_pdu_codec.hh delete mode 100644 libNr5gcAsn1.mk create mode 100644 ttcn/patch_abstract_socket/Abstract_Socket.cc.patch create mode 100644 ttcn/patch_abstract_socket/Abstract_Socket.hh.patch diff --git a/Makefile b/Makefile index 477edd7..435b093 100644 --- a/Makefile +++ b/Makefile @@ -12,16 +12,6 @@ ifeq (,$(TTCN3_DIR)) $(error TTCN3_DIR shall be defined in config.mk) endif -ifeq (,$(ASN1C)) - ifneq (,$(ASN1C_PATH)) - ASN1C := $(ASN1C_PATH)/asn1c/.libs/asn1c -S $(ASN1C_PATH)/skeletons - else - ASN1C := asn1c - endif -endif - -export ASN1C_PATH - first: all define IncludeModule @@ -103,8 +93,7 @@ echo: echo_sources @echo -e "defines: $(addsuffix \n, $(defines))" clean: - rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate $(outdir)/../lib5GNGAPAsn.so -# rm -f $(outdir)/asn1/*.so $(outdir)/asn1/*.o $(outdir)/asn1/*.c $(outdir)/asn1/*.h $(outdir)/asn1/Makefile.am.libasncodec + rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate regen: force_regen $(outdir)/.generate force_regen: @@ -125,8 +114,8 @@ t3d: all $(outdir) $(outdir)/asn1 $(bindir): mkdir -p $@ -$(bindir)/$(ATS)$(EXE): $(outdir)/asn1/lib5GNGAPAsn.a $(gen_objects) $(cc_objects) - g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/asn1/lib5GNGAPAsn.a $(libs) +$(bindir)/$(ATS)$(EXE): $(gen_objects) $(cc_objects) + g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(libs) $(gen_objects) :%.o :%.cc g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< @@ -136,32 +125,15 @@ $(cc_objects) : $(outdir)/%.o : %.cc g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $< #$(gen_sources): -# $(TTCN3_DIR)/bin/compiler -n -e -L -R -U none -o $(outdir) $(tt_sources) +# $(TTCN3_DIR)/bin/asn1_compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources) $(gen_sources): $(outdir)/.generate $(outdir)/.generate: Makefile $(tt_sources) - $(TTCN3_DIR)/bin/compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources) - touch $@ - -$(bindir)/lib5GNGAPAsn.so: $(outdir)/asn1/lib5GNGAPAsn.so - cp -f $< $@ - -$(outdir)/asn1/lib5GNGAPAsn.a: $(asn_sources) $(asn1_sources) libNr5gcAsn1.mk Makefile - mkdir -p $(outdir)/asn1 - echo TOP_DIR := ../../.. >$(outdir)/asn1/Makefile - echo ASN_PDU := $(pdu) >>$(outdir)/asn1/Makefile - echo ASN_FILES := \\ >>$(outdir)/asn1/Makefile - for n in $(asn_sources) $(asn1_sources); do echo " $$n \\"; done >>$(outdir)/asn1/Makefile - echo >>$(outdir)/asn1/Makefile - cat libNr5gcAsn1.mk >>$(outdir)/asn1/Makefile - $(MAKE) -C $(outdir)/asn1 + $(TTCN3_DIR)/bin/asn1_compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources) touch $@ $(foreach S, $(ttcn_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc, $(S))): $(S))) $(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S))) $(foreach S, $(asn_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn, %.cc, $(S))): $(S))) $(foreach S, $(asn1_sources), $(eval $(outdir)/$(notdir $(patsubst %.asn1, %.cc, $(S))): $(S))) - -$(asn_sources) $(asn1_sources): - diff --git a/ccsrc/Asn1c/asn1_recoder.cc b/ccsrc/Asn1c/asn1_recoder.cc deleted file mode 100644 index df520ac..0000000 --- a/ccsrc/Asn1c/asn1_recoder.cc +++ /dev/null @@ -1,56 +0,0 @@ -#include - -#include "asn1_recoder.hh" - -#include - -extern "C" { -static int asn1c_collect_encoded_data(const void *buffer, size_t size, void *application_specific_key) { - TTCN_Buffer *tb = (TTCN_Buffer *)application_specific_key; - tb->put_s(size, (unsigned char *)buffer); - return 0; -} -} - -int asn1_recoder::recode(const asn_TYPE_descriptor_s &td, int from, int to, TTCN_Buffer &buf) { - int rc = -1; - void * ptr = NULL; - asn_dec_rval_t rc_d; - rc_d = asn_decode(NULL, (asn_transfer_syntax)from, (asn_TYPE_descriptor_s *)&td, &ptr, buf.get_data(), buf.get_len()); - if (rc_d.code == RC_OK) { - // Encode as PER - asn_enc_rval_t rc_e; - buf.clear(); - rc_e = asn_encode(NULL, (asn_transfer_syntax)to, (asn_TYPE_descriptor_s *)&td, ptr, asn1c_collect_encoded_data, &buf); - rc = rc_e.encoded; - } - if (ptr) { - ASN_STRUCT_FREE(td, ptr); - } - return rc; -} - -int asn1_recoder::ber2per(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf) -{ - //return recode(td, (int)ATS_BER, (int)ATS_UNALIGNED_CANONICAL_PER, buf); - //return recode(td, (int)ATS_BER, (int)ATS_ALIGNED_CANONICAL_PER, buf); - return recode(td, (int)ATS_BER, (int)ATS_ALIGNED_BASIC_PER, buf); - //return recode(td, (int)ATS_BER, (int)ATS_UNALIGNED_BASIC_PER, buf); -} - -int asn1_recoder::per2ber(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf) -{ - //return recode(td, (int)ATS_UNALIGNED_BASIC_PER, (int)ATS_DER, buf); - //return recode(td, (int)ATS_ALIGNED_CANONICAL_PER, (int)ATS_BER, buf); - return recode(td, (int)ATS_ALIGNED_BASIC_PER, (int)ATS_BER, buf); -} - -int asn1_recoder::ber2oer(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) -{ - return recode(td, (int)ATS_BER, (int)ATS_CANONICAL_OER, buf); -} - -int asn1_recoder::oer2ber(const asn_TYPE_descriptor_s & td, TTCN_Buffer & buf) -{ - return recode(td, (int)ATS_BASIC_OER, (int)ATS_BER, buf); -} diff --git a/ccsrc/Asn1c/asn1_recoder.hh b/ccsrc/Asn1c/asn1_recoder.hh deleted file mode 100644 index 7592e23..0000000 --- a/ccsrc/Asn1c/asn1_recoder.hh +++ /dev/null @@ -1,29 +0,0 @@ -/*! - * \file asn1_recode_per.hh - * \brief Header file ASN.1 PER codec based on asn1c external tool. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -class OCTETSTRING; //! Forward declaration of TITAN class -class CHARSTRING; //! Forward declaration of TITAN class -class BITSTRING; //! Forward declaration of TITAN class -class TTCN_Buffer; //! Forward declaration of TITAN class -class TTCN_EncDec; //! Forward declaration of TITAN class -class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class - -struct asn_TYPE_descriptor_s; //! Forward declaration of asn1c class - -class asn1_recoder { -protected: - int ber2per(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); - int per2ber(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); - int ber2oer(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); - int oer2ber(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); - int recode(const asn_TYPE_descriptor_s &td, int from, int to, TTCN_Buffer &buf); -}; // End of class asn1_recode_per diff --git a/ccsrc/Asn1c/module.mk b/ccsrc/Asn1c/module.mk deleted file mode 100644 index 226091a..0000000 --- a/ccsrc/Asn1c/module.mk +++ /dev/null @@ -1,3 +0,0 @@ -sources := asn1_recoder.cc -includes := . - diff --git a/ccsrc/Asn1c/per_codec.hh b/ccsrc/Asn1c/per_codec.hh deleted file mode 100644 index dfd960d..0000000 --- a/ccsrc/Asn1c/per_codec.hh +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * \file per_codec.hh - * \brief Header file for TITAN message to ASN.1 PER message codec. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "params.hh" -#include "asn1_recoder.hh" - -class BITSTRING; //! Forward declaration of TITAN class -class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class - -struct asn_TYPE_descriptor_s; //! Declare asn1c class - -/*! - * \class per_codec - * \brief This class provides the interface for all ASN.1 PER codecs. - * \remark This class uses asn1c external tool - */ -template -class per_codec : public asn1_recoder -{ -public: //! \publicsection - /*! - * \fn int encode(const TPDU& p_message, BITSTRING& p_bitstring); - * \brief Encode TITAN message into ASN.1 PER message - * \param[in] p_message The PDU message to encode - * \param[out] p_bitstring The encoded PDU message in bit string format - * \pure - */ - virtual int encode(const TPDU& p_message, BITSTRING& p_bitstring) = 0; - /*! - * \fn int decode(const BITSTRING& p_bitstring, TPDU& p_message); - * \brief Decode ASN.1 PER message into TITAN message - * \param[in] p_bitstring The network message in bit string format to decode - * \param[out] p_message The PDU message - * \pure - */ - virtual int decode(const BITSTRING& p_bitstring, TPDU& p_message) = 0; - -protected: //! \protectedsection - inline int _decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg); - inline int _encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data); -}; // End of class per_codec - -#include - -template -int per_codec::_decode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const BITSTRING& p_data, TPDU& msg) { - TTCN_Buffer buf(bit2oct(p_data)); - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - int rc = per2ber (td, buf); - if (rc > 0) { - msg.decode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ACCEPT_ALL); - rc = buf.get_len(); - } - return rc; -} - -template -int per_codec::_encode (const TTCN_Typedescriptor_t& ttcn, const asn_TYPE_descriptor_s & td, const TPDU& msg, BITSTRING& p_data) { - int rc = -1; - TTCN_Buffer buf; - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT/*WARNING*/); - msg.encode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ENCODE_DER); - if (buf.get_len() > 0) { - rc = ber2per (td, buf); - if (rc > 0) { - p_data = oct2bit(OCTETSTRING(buf.get_len(), buf.get_data())); - } - } - return rc; -} - diff --git a/ccsrc/EncDec/LibNGAP_Encdec.cc b/ccsrc/EncDec/LibNGAP_Encdec.cc deleted file mode 100644 index dff04bf..0000000 --- a/ccsrc/EncDec/LibNGAP_Encdec.cc +++ /dev/null @@ -1,158 +0,0 @@ -#include "loggers.hh" -#include "LibNGAP_EncdecDeclarations.hh" -//#include "ngap_codec.hh" - -namespace LibNGAP__EncdecDeclarations { - - BITSTRING fx__enc__PDUSessionResourceSetupRequestTransfer(const NGAP__IEs::PDUSessionResourceSetupRequestTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupRequestTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceSetupRequestTransfer(BITSTRING &b, NGAP__IEs::PDUSessionResourceSetupRequestTransfer &p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupRequestTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceReleaseCommandTransfer(const NGAP__IEs::PDUSessionResourceReleaseCommandTransfer &p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceReleaseCommandTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceReleaseCommandTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceReleaseCommandTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceReleaseCommandTransfer"); - return -1; - } - - BITSTRING fx__enc__UEContextSuspendRequestTransfer(const NGAP__IEs::UEContextSuspendRequestTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__UEContextSuspendRequestTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__UEContextSuspendRequestTransfer(BITSTRING& pdu, NGAP__IEs::UEContextSuspendRequestTransfer& p) { - loggers::get_instance().log(">>> fx__dec__UEContextSuspendRequestTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceSetupResponseTransfer(const NGAP__IEs::PDUSessionResourceSetupResponseTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupResponseTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceSetupResponseTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceSetupResponseTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupResponseTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceModifyIndicationTransfer(const NGAP__IEs::PDUSessionResourceModifyIndicationTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceModifyIndicationTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceModifyIndicationTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceModifyIndicationTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceModifyIndicationTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceSetupUnsuccessfulTransfer(const NGAP__IEs::PDUSessionResourceSetupUnsuccessfulTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupUnsuccessfulTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceSetupUnsuccessfulTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceSetupUnsuccessfulTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupUnsuccessfulTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceReleaseResponseTransfer(const NGAP__IEs::PDUSessionResourceReleaseResponseTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupUnsuccessfulTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceReleaseResponseTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceReleaseResponseTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupUnsuccessfulTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceModifyConfirmTransfer(const NGAP__IEs::PDUSessionResourceModifyConfirmTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupUnsuccessfulTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceModifyConfirmTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceModifyConfirmTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupUnsuccessfulTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceModifyIndicationUnsuccessfulTransfer(const NGAP__IEs::PDUSessionResourceModifyIndicationUnsuccessfulTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupUnsuccessfulTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceModifyIndicationUnsuccessfulTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceModifyIndicationUnsuccessfulTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupUnsuccessfulTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceModifyResponseTransfer(const NGAP__IEs::PDUSessionResourceModifyResponseTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupUnsuccessfulTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceModifyResponseTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceModifyResponseTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupUnsuccessfulTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceModifyUnsuccessfulTransfer(const NGAP__IEs::PDUSessionResourceModifyUnsuccessfulTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupUnsuccessfulTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceModifyUnsuccessfulTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceModifyUnsuccessfulTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupUnsuccessfulTransfer"); - return -1; - } - - BITSTRING fx__enc__PDUSessionResourceModifyRequestTransfer(const NGAP__IEs::PDUSessionResourceModifyRequestTransfer& p) { - loggers::get_instance().log_msg(">>> fx__enc__PDUSessionResourceSetupUnsuccessfulTransfer ", p); - return int2bit(0, 1); - } - - INTEGER fx__dec__PDUSessionResourceModifyRequestTransfer(BITSTRING& pdu, NGAP__IEs::PDUSessionResourceModifyRequestTransfer& p) { - loggers::get_instance().log(">>> fx__dec__PDUSessionResourceSetupUnsuccessfulTransfer"); - return -1; - } - - - /**************************************************** - * @desc External function to encode a .... type - * @param value to encode - * @return encoded value - ****************************************************/ - /*BITSTRING fx__enc__ProtocolIE(const LibNGAP__TypesAndValues::ProtocolIE &p) { - loggers::get_instance().log_msg(">>> fx__enc__ProtocolIE:: ", p); - ngap_codec codec; - OCTETSTRING os; - if (codec.encode(p.IE(), os) == -1) { - loggers::get_instance().warning("fx__enc__ProtocolIE -1 result code was returned"); - return int2bit(0, 1); - } - - return oct2bit(os); - - return int2bit(0, 8); - }*/ - - /**************************************************** - * @desc External function to decode a .... type - * @param value to encode - * @return encoded value - ****************************************************/ - - /*INTEGER fx__dec__ProtocolIE(BITSTRING &b, LibNGAP__TypesAndValues::ProtocolIE &p) { - loggers::get_instance().log(">>> fx__dec__ProtocolIE::"); - return -1; - }*/ - -} // namespace LibNGAP__EncdecDeclarations diff --git a/ccsrc/EncDec/module.mk b/ccsrc/EncDec/module.mk deleted file mode 100644 index 9151cd0..0000000 --- a/ccsrc/EncDec/module.mk +++ /dev/null @@ -1,3 +0,0 @@ -sources := LibNGAP_Encdec.cc -includes := . - diff --git a/ccsrc/Protocols/NGAP/module.mk b/ccsrc/Protocols/NGAP/module.mk index 31c42b6..74c21aa 100644 --- a/ccsrc/Protocols/NGAP/module.mk +++ b/ccsrc/Protocols/NGAP/module.mk @@ -1,2 +1,2 @@ -sources := ngap_codec.cc ngap_pdu_codec.cc +sources := ngap_codec.cc includes := . diff --git a/ccsrc/Protocols/NGAP/ngap_codec.cc b/ccsrc/Protocols/NGAP/ngap_codec.cc index aa8637b..7b0fdd7 100644 --- a/ccsrc/Protocols/NGAP/ngap_codec.cc +++ b/ccsrc/Protocols/NGAP/ngap_codec.cc @@ -1,28 +1,26 @@ #include "ngap_codec.hh" #include "LibNGAP_TypesAndValues.hh" -#include "asn1/asn_application.h" // from asn1c #include "loggers.hh" int ngap_codec::encode(const NGAP__PDU__Descriptions::NGAP__PDU& ngap, OCTETSTRING &data) { loggers::get_instance().log(">>> ngap_codec::encode"); - BITSTRING b; - int rc = asn_codec.encode(ngap, b); - loggers::get_instance().log("ngap_codec::encode: ASN.1 codec returned %d", rc); - if (rc) { - data = bit2oct(b); - loggers::get_instance().log_msg("ngap_codec::encode: ", data); - } - return rc; + // BITSTRING b; + // int rc = asn_codec.encode(ngap, b); + // loggers::get_instance().log("ngap_codec::encode: ASN.1 codec returned %d", rc); + // if (rc) { + // data = bit2oct(b); + // loggers::get_instance().log_msg("ngap_codec::encode: ", data); + // } + // return rc; + return -1; } -int ngap_codec::decode(const OCTETSTRING &data, NGAP__PDU__Descriptions::NGAP__PDU &ngap, params_ngap *params) { - loggers::get_instance().log_msg(">>> ngap_codec::decode: ", data); +int ngap_codec::decode(const OCTETSTRING &p_data, NGAP__PDU__Descriptions::NGAP__PDU &ngap, params_ngap *params) { + loggers::get_instance().log_msg(">>> ngap_codec::decode: ", p_data); - int rc = asn_codec.decode(oct2bit(data), ngap); - loggers::get_instance().log("ngap_codec::decode: ASN.1 codec returned %d", rc); - if (rc) { - loggers::get_instance().log_msg("ngap_codec::decode: ", ngap); - } - return rc; + TTCN_Buffer buf(p_data); + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); + ngap.PER_decode(NGAP__PDU__Descriptions::NGAP__PDU_descr_, buf, -1); + return 0; } diff --git a/ccsrc/Protocols/NGAP/ngap_codec.hh b/ccsrc/Protocols/NGAP/ngap_codec.hh index c4813aa..7c91452 100644 --- a/ccsrc/Protocols/NGAP/ngap_codec.hh +++ b/ccsrc/Protocols/NGAP/ngap_codec.hh @@ -1,6 +1,5 @@ #pragma once -#include "ngap_pdu_codec.hh" #include "codec.hh" class BITSTRING; //! Forward declaration of TITAN class @@ -10,11 +9,10 @@ namespace NGAP__PDU__Descriptions { //! Forward declaration of asn1c NGAP class class NGAP__PDU; } -class ngap_codec : public codec { - ngap_pdu_codec asn_codec; +class ngap_codec { public: - explicit ngap_codec() : codec(), asn_codec(){}; + explicit ngap_codec(){}; virtual ~ngap_codec(){}; virtual int encode(const NGAP__PDU__Descriptions::NGAP__PDU& ngap, OCTETSTRING &data); diff --git a/ccsrc/Protocols/NGAP/ngap_pdu_codec.cc b/ccsrc/Protocols/NGAP/ngap_pdu_codec.cc deleted file mode 100644 index b594a3d..0000000 --- a/ccsrc/Protocols/NGAP/ngap_pdu_codec.cc +++ /dev/null @@ -1,18 +0,0 @@ -#include "ngap_pdu_codec.hh" -#include "LibNGAP_TypesAndValues.hh" -#include "asn1/asn_application.h" // from asn1c -#include "loggers.hh" - -extern "C" { - extern asn_TYPE_descriptor_t asn_DEF_NGAP_PDU; -} - -int ngap_pdu_codec::encode(const NGAP__PDU__Descriptions::NGAP__PDU &p_ngap, BITSTRING &p_data) { - loggers::get_instance().log("ngap_pdu_codec::encode: "); - return _encode(NGAP__PDU__Descriptions::NGAP__PDU_descr_, asn_DEF_NGAP_PDU, p_ngap, p_data); -} - -int ngap_pdu_codec::decode(const BITSTRING &p_data, NGAP__PDU__Descriptions::NGAP__PDU &p_ngap) { - loggers::get_instance().log("ngap_pdu_codec::decode: "); - return _decode(NGAP__PDU__Descriptions::NGAP__PDU_descr_, asn_DEF_NGAP_PDU, p_data, p_ngap); -} \ No newline at end of file diff --git a/ccsrc/Protocols/NGAP/ngap_pdu_codec.hh b/ccsrc/Protocols/NGAP/ngap_pdu_codec.hh deleted file mode 100644 index 5ffe168..0000000 --- a/ccsrc/Protocols/NGAP/ngap_pdu_codec.hh +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "codec.hh" -#include "params.hh" -#include "per_codec.hh" - -class BITSTRING; //! Forward declaration of TITAN class -class OCTETSTRING; //! Forward declaration of TITAN class - -namespace NGAP__PDU__Descriptions { //! Forward declaration of asn1c NGAP class - class NGAP__PDU; -} - -class ngap_pdu_codec : public per_codec { -public: - explicit ngap_pdu_codec(){}; - virtual int encode(const NGAP__PDU__Descriptions::NGAP__PDU &ngap, BITSTRING &data); - virtual int decode(const BITSTRING &data, NGAP__PDU__Descriptions::NGAP__PDU &ngap); -}; diff --git a/config.mk b/config.mk index 1a1a7e1..9aeee3f 100644 --- a/config.mk +++ b/config.mk @@ -1,8 +1,9 @@ -TTCN3_COMPILER_OPTIONS := -d -e -f -g -j -H -l -L -R -U none -x -X -#TTCN3_COMPILER_OPTIONS := -d -e -f -g -j -l -L -R -U none -x -X +# Do not use -X if -H is not used +#TTCN3_COMPILER_OPTIONS := -d -e -f -g -j -H -l -L -R -U none -x -X +TTCN3_COMPILER_OPTIONS := -b -d -e -f -g -j -l -L -O -P NGAP-PDU-Descriptions.NGAP-PDU -R -U none -x TTCN3_DIR := $(HOME)/frameworks/titan/titan.core/Install #TTCN3_DIR := $(HOME)/tmp/ttcn3-9.0.0 -ASN1C_PATH := $(HOME)/frameworks/asn1c.denis +#ASN1C_PATH := $(HOME)/frameworks/asn1c.denis #ASN1C_PATH := /home/ubuntu/bin/asn1c.denis/ #WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll #NPCAP_INCLUDE := /cygdrive/c/PROGRA~1/Npcap/sdk/include diff --git a/etc/AtsNGAP/AtsNGAP_AMF.cfg_ b/etc/AtsNGAP/AtsNGAP_AMF.cfg_ index 6bc45b0..5a9636d 100644 --- a/etc/AtsNGAP/AtsNGAP_AMF.cfg_ +++ b/etc/AtsNGAP/AtsNGAP_AMF.cfg_ @@ -20,7 +20,11 @@ LogEventTypes:= Yes [TESTPORT_PARAMETERS] # In this section you can specify parameters that are passed to Test Ports. -aMFNGAPComponent.N2_gNBaMF_P.params := "NGAP/ETH/PCAP_FILE(file=../captures/free5gc.pcap)" +#system.NGAP_gNB_1.params := "NGAP/SCTP(server=192.168.1.21,port=4444,debug=1)" +#system.N2_gNBaMF_P.params := "NGAP/SCTP(server=192.168.1.21,port=4444,debug=1)" + +system.NGAP_gNB_1.params := "NGAP/SCTP_FILE/IP_OFFLINE/PCAP_FILE(file=../captures/5g_reg.pcapng)" +system.N2_gNBaMF_P.params := "NGAP/SCTP_FILE/IP_OFFLINE/PCAP_FILE(file=../captures/5g_reg.pcapng)" [DEFINE] # In this section you can create macro definitions, @@ -47,8 +51,14 @@ aMFNGAPComponent.N2_gNBaMF_P.params := "NGAP/ETH/PCAP_FILE(file=../captures/free # In this section you can specify what parts of your test suite you want to execute. #AtsImsIot_TestControl.control + + +NGAP_TestCases.TC_NGAP_TEST + + + # Verify that the IUT can send a PDU SESSION RESOURCE SETUP REQUEST with at least one PDU session resource list to established PDU session. -#NGAP_TestCases.TC_NGAP_AMF_PDU_01 +NGAP_TestCases.TC_NGAP_AMF_PDU_01 # Verify that the IUT can send a PDU_SESSION_RESOURCE_RELEASE_COMMAND to release PDU session. #NGAP_TestCases.TC_NGAP_AMF_PDU_02 # Verify that the IUT can send a PDU_SESSION_RESOURCE_MODIFY_REQUEST to modify PDU session. diff --git a/install.sh b/install.sh index aaa1b55..390b323 100755 --- a/install.sh +++ b/install.sh @@ -24,4 +24,9 @@ cd $BASE_PATH ln -f ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/ # TODO Add other patch +cd ./ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src +git apply ./ttcn/patch_abstract_socket/Abstract_Socket.hh.patch +git apply ./ttcn/patch_abstract_socket/Abstract_Socket.cc.patch +cd $BASE_PATH + exit 0 diff --git a/libNr5gcAsn1.mk b/libNr5gcAsn1.mk deleted file mode 100644 index 01dd2ff..0000000 --- a/libNr5gcAsn1.mk +++ /dev/null @@ -1,120 +0,0 @@ -########################################################## -# This Makefile is to build the ASN1 library to be used -# for external codec in Titan -# This Makefile is expected that asn1c compiler is -# installed in the PATHs -########################################################## - -# The name of the library -ASN_LIBRARY = lib5GNGAPAsn.a - -ifeq (,$(sort $(ASN_FILES))) - $(error ASN_FILES should be specified ) -endif - -#Override ASN1C instalation path -ifneq (, $(ASN1C_PATH)) - ASN1C:=$(ASN1C_PATH)/asn1c/asn1c -S $(ASN1C_PATH)/skeletons -else - ASN1C:=asn1c - #ASN1C:=asn1_compiler -endif - -LIB_MAKEFILE=Makefile.am.libasncodec -include $(LIB_MAKEFILE) -OBJS = ${ASN_MODULE_SRCS:.c=.o} -CONVERTER=converter -ASN_CONVERTER_SOURCES := \ - converter-example.c\ - pdu_collection.c -CONVERTER_OBJS=${ASN_CONVERTER_SOURCES:.c=.o} -ifneq ($(strip $(ASN_PDU)),$(firstword $(ASN_PDU))) - HAS_PDU_COLLECTION := -DASN_PDU_COLLECTION -endif - -CFLAGS += $(ASN_MODULE_CFLAGS) -DPDU=$(firstword $(ASN_PDU)) $(HAS_PDU_COLLECTION) -fPIC -I. -CC = gcc -std=c99 -ASN1C_OPTIONS += -fno-include-deps -findirect-choice -no-gen-example -fcompound-names -no-gen-XER -no-gen-JER -no-gen-APER -no-gen-print -no-gen-random-fill -ifeq (yes,$(DEBUG)) - CFLAGS += -g -O0 -DASN_EMIT_DEBUG=1 -endif -ASN_SRC_FILES := $(addprefix $(TOP_DIR)/, $(ASN_FILES)) - -all: $(ASN_LIBRARY) - -$(LIB_MAKEFILE): $(ASN_SRC_FILES) Makefile - $(ASN1C) $(ASN1C_OPTIONS) $(addprefix -pdu=,$(pdu)) $(ASN_SRC_FILES) -# -for n in $(PATCHES); do git apply "$(SCRIPT_DIR)/$$n"; done - -$(CONVERTER): $(ASN_LIBRARY) $(CONVERTER_OBJS) - $(CC) $(CFLAGS) -o $@ $(CONVERTER_OBJS) $(ASN_LIBRARY) $(LIBS) - -$(ASN_LIBRARY): ${ASN_MODULE_SRCS:.c=.o} - ar rcs $@ $^ -# $(CC) $(CFLAGS) -o $@ $^ -shared $(LDFLAGS) $(LIBS) - -.SUFFIXES: -.SUFFIXES: .c .o - -.c.o: - $(CC) $(CFLAGS) -o $@ -c $< - -clean: - rm -f $(CONVERTER) $(ASN_LIBRARY) - rm -f $(OBJS) $(CONVERTER_OBJS) - -regen: clear-asn1c $(LIB_MAKEFILE) -clear-asn1c: - rm -f $(LIB_MAKEFILE) - -########################################################## - -#$(TOP_DIR)/./build/asn1/ISO_TS_14816/AVIAEINumberingAndDataStructures.asn: -# mkdir -p "$(dir $@)" -# curl 'https://standards.iso.org/iso/14816/ISO14816%20ASN.1%20repository/ISO14816_AVIAEINumberingAndDataStructures.asn' | \ -# sed -e 's/IssuerIdentifier/AVIAEIIssuerIdentifier/g' > "$@" - -#$(TOP_DIR)/./build/asn1/ISO_TS_14906/EfcDsrcApplication.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcApplicationv6.asn' - -#$(TOP_DIR)/./build/asn1/ISO_TS_14906/EfcDsrcGeneric.asn: -# mkdir -p "$(dir $@) -# curl -o "$@" 'https://standards.iso.org/iso/14906/ed-3/en/ISO14906(2018)EfcDsrcGenericv7.asn' - -#$(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSapplMgmtIDs.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/ts/17419/TS%2017419%20ASN.1%20repository/TS17419_2014_CITSapplMgmtIDs.asn' - -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/ISO-TS-19091-addgrp-C-2018-patched.asn: -# mkdir -p "$(dir $@)" -# curl 'https://standards.iso.org/iso/ts/19091/ed-2/en/ISO-TS-19091-addgrp-C-2018.asn' | \ -# sed -e 's/\bHeadingConfidence\b/HeadingConfidenceDSRC/g' \ -# -e 's/\bSpeedConfidence\b/SpeedConfidenceDSRC/g' \ -# -e 's/\bHeading\b/HeadingDSRC/g' > "$@" - -#$(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSdataDictionary1.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.1.asn' - -#$(TOP_DIR)/./build/asn1/ISO_TS_17419/CITSdataDictionary2.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/17419/ed-1/en/17419.2.asn' - -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/AddGrpC.asn: -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/AddGrpC_noCircular.asn: -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/DSRC.asn: -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/DSRC_REGION_noCircular.asn -#$(TOP_DIR)/./build/asn1/ISO_TS_19091/REGION.asn - -#$(TOP_DIR)/./build/asn1/ISO_TS_19321/IVI.asn: -# mkdir -p "$(dir $@)" -# curl 'https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn' | \ -# sed -e 's/\bCITSdataDictionary1\b/CITSapplMgmtIDs/g' \ -# -e 's/,\s*\.\.\.\s*,\s*[0-9]\+/,.../g' \ -# > "$@" - -#$(TOP_DIR)/build/asn1/ISO_TS_24534-3/ElectronicRegistrationIdentificationVehicleDataModule.asn: -# mkdir -p "$(dir $@)" -# curl -o "$@" 'https://standards.iso.org/iso/24534/-3/ISO%2024534-3%20ASN.1%20repository/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule_ForBallot.asn' - diff --git a/titan-test-system-framework b/titan-test-system-framework index 6959b8b..ef63449 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit 6959b8be419f3755de6f888e24bfdc8de07383a7 +Subproject commit ef6344980b87f3971363ad9b971f16dd43d8d0ba diff --git a/ttcn/AtsNGAP/NGAP_TestCases.ttcn b/ttcn/AtsNGAP/NGAP_TestCases.ttcn index 26448d5..a318afe 100644 --- a/ttcn/AtsNGAP/NGAP_TestCases.ttcn +++ b/ttcn/AtsNGAP/NGAP_TestCases.ttcn @@ -33,6 +33,47 @@ module NGAP_TestCases { import from NGAP_TCFunctions all; import from NGAP_Pics all; + + + + + + + + + + + import from NGAP_Steps all; + import from LibNGAP_Steps all; + testcase TC_NGAP_TEST() runs on gNBNGAPComponent system TestAdapter { + // Local variables + var octetstring v_pdu := '00150041000004001b00080000f110000001380052401509004a656e6b696e732d4f70656e3567732d312d300066001000000000010000f110000010080000000015400100'O; + var bitstring bs := oct2bit(v_pdu); + var NGAP_PDU v_ngap_pdu; + var integer v_result := decvalue(bs, v_ngap_pdu, "", "PER:Aligned"); + + log("v_result: ", v_result); + log("v_ngap_pdu: ", v_ngap_pdu); + + if (v_result != 0) { + setverdict(fail); + } else { + setverdict(pass); + } + } // End of function TC_NGAP_TEST + + + + + + + + + + + + + group gNB_Role{ /** diff --git a/ttcn/AtsNGAP/module.mk b/ttcn/AtsNGAP/module.mk index fe9cc75..4c132fa 100644 --- a/ttcn/AtsNGAP/module.mk +++ b/ttcn/AtsNGAP/module.mk @@ -16,13 +16,13 @@ modules := \ ../LibCommon \ ../../titan-test-system-framework/ccsrc/Protocols/Pcap \ ../../titan-test-system-framework/ccsrc/Protocols/ETH \ + ../../titan-test-system-framework/ccsrc/Protocols/IP \ + ../../titan-test-system-framework/ccsrc/Protocols/Sctp \ ../../ccsrc/Ports/LibNGAP \ - ../../ccsrc/EncDec \ ../../titan-test-system-framework/ccsrc/Framework \ ../../titan-test-system-framework/ccsrc/loggers \ - ../../ccsrc/Protocols/NGAP_layer \ ../../ccsrc/Protocols/NGAP \ - ../../ccsrc/Asn1c \ + ../../ccsrc/Protocols/NGAP_layer \ ../../ccsrc/framework \ ../modules/titan.TestPorts.Common_Components.Abstract_Socket diff --git a/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn b/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn index 2f188ab..fa62746 100644 --- a/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn +++ b/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn @@ -12,7 +12,13 @@ module LibNGAP_EncdecDeclarations { import from LibNGAP_TypesAndValues all; - import from NGAP_IEs language "ASN.1:2002" all;// with {encode "ALIGNED_PER_OctetAligned"}; + import from NGAP_PDU_Descriptions language "ASN.1:2002" all; + import from NGAP_IEs language "ASN.1:2002" all; + + external function fx_enc_NGAP_PDU (NGAP_PDU p) return bitstring + with {extension "prototype(convert) encode(PER:Aligned)"} + external function fx_dec_NGAP_PDU (inout bitstring pdu, out NGAP_PDU p) return integer + with {extension "prototype(sliding) decode(PER:Aligned)"} //TODO: if no additional type in TypesAndvalues remove //external function fx_enc_ProtocolIE (ProtocolIE p) return bitstring @@ -27,88 +33,88 @@ module LibNGAP_EncdecDeclarations { //external function dec_PDUSessionResourceSetupResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupResponseTransfer p) return integer //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_dec_PDUSessionResourceSetupResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupResponseTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceSetupRequestTransfer(NGAP_IEs.PDUSessionResourceSetupRequestTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceSetupUnsuccessfulTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupUnsuccessfulTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} external function fx_enc_PDUSessionResourceSetupUnsuccessfulTransfer(NGAP_IEs.PDUSessionResourceSetupUnsuccessfulTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceReleaseCommandTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceReleaseCommandTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceReleaseCommandTransfer(NGAP_IEs.PDUSessionResourceReleaseCommandTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceReleaseResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceReleaseResponseTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceReleaseResponseTransfer(NGAP_IEs.PDUSessionResourceReleaseResponseTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceModifyConfirmTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyConfirmTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyConfirmTransfer(NGAP_IEs.PDUSessionResourceModifyConfirmTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceModifyIndicationTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyIndicationTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyIndicationTransfer(NGAP_IEs.PDUSessionResourceModifyIndicationTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceModifyIndicationUnsuccessfulTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyIndicationUnsuccessfulTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyIndicationUnsuccessfulTransfer(NGAP_IEs.PDUSessionResourceModifyIndicationUnsuccessfulTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceModifyResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyResponseTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyResponseTransfer(NGAP_IEs.PDUSessionResourceModifyResponseTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceModifyUnsuccessfulTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyUnsuccessfulTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyUnsuccessfulTransfer(NGAP_IEs.PDUSessionResourceModifyUnsuccessfulTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_UEContextSuspendRequestTransfer(inout bitstring pdu, out NGAP_IEs.UEContextSuspendRequestTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_UEContextSuspendRequestTransfer(NGAP_IEs.UEContextSuspendRequestTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} external function fx_dec_PDUSessionResourceModifyRequestTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyRequestTransfer p) return integer - with {extension "prototype(sliding) decode(PER)"} + with {extension "prototype(sliding) decode(PER:Aligned)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyRequestTransfer(NGAP_IEs.PDUSessionResourceModifyRequestTransfer p) return bitstring - with {extension "prototype(convert) encode(PER)"} + with {extension "prototype(convert) encode(PER:Aligned)"} } // End of module LibNGAP_EncdecDeclarations \ No newline at end of file diff --git a/ttcn/LibNGAP/lib/asn1/NGAP_PDU_Descriptions.asn b/ttcn/LibNGAP/lib/asn1/NGAP_PDU_Descriptions.asn index d8dbd98..dcf4704 100644 --- a/ttcn/LibNGAP/lib/asn1/NGAP_PDU_Descriptions.asn +++ b/ttcn/LibNGAP/lib/asn1/NGAP_PDU_Descriptions.asn @@ -266,7 +266,7 @@ NGAP-PDU ::= CHOICE { InitiatingMessage ::= SEQUENCE { procedureCode NGAP-ELEMENTARY-PROCEDURE.&procedureCode ({NGAP-ELEMENTARY-PROCEDURES}), criticality NGAP-ELEMENTARY-PROCEDURE.&criticality ({NGAP-ELEMENTARY-PROCEDURES}{@procedureCode}), - value NGAP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({NGAP-ELEMENTARY-PROCEDURES}{@procedureCode}) OPTIONAL + value NGAP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({NGAP-ELEMENTARY-PROCEDURES}{@procedureCode}) } SuccessfulOutcome ::= SEQUENCE { diff --git a/ttcn/patch_abstract_socket/Abstract_Socket.cc.patch b/ttcn/patch_abstract_socket/Abstract_Socket.cc.patch new file mode 100644 index 0000000..55f334a --- /dev/null +++ b/ttcn/patch_abstract_socket/Abstract_Socket.cc.patch @@ -0,0 +1,117 @@ +diff --git a/src/Abstract_Socket.cc b/src/Abstract_Socket.cc +index 8b7b753..5e4addf 100644 +--- a/src/Abstract_Socket.cc ++++ b/src/Abstract_Socket.cc +@@ -40,6 +40,7 @@ + # include + #endif + ++#include + + #define AS_TCP_CHUNCK_SIZE 4096 + #define AS_SSL_CHUNCK_SIZE 16384 +@@ -171,6 +172,7 @@ Abstract_Socket::Abstract_Socket() { + remote_host_name = NULL; + remote_port_number = 0; + ai_family = AF_UNSPEC; // default: Auto ++ ip_proto = IPPROTO_TCP; // default + test_port_type=NULL; + test_port_name=NULL; + ttcn_buffer_usercontrol=false; +@@ -199,6 +201,7 @@ Abstract_Socket::Abstract_Socket(const char *tp_type, const char *tp_name) { + remote_host_name = NULL; + remote_port_number = 0; + ai_family = AF_UNSPEC; // default: Auto ++ ip_proto = IPPROTO_TCP; // default + test_port_type=tp_type; + test_port_name=tp_name; + ttcn_buffer_usercontrol=false; +@@ -261,6 +264,10 @@ bool Abstract_Socket::parameter_set(const char *parameter_name, + else if (strcasecmp(parameter_value,"IPv4")==0 || strcasecmp(parameter_value,"AF_INET")==0) ai_family = AF_INET; + else if (strcasecmp(parameter_value,"UNSPEC")==0 || strcasecmp(parameter_value,"AF_UNSPEC")==0) ai_family = AF_UNSPEC; + else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ai_family_name()); ++ } else if(strcmp(parameter_name, ip_proto_name()) == 0){ ++ if (strcasecmp(parameter_value,"IPPROTO_TCP")==0) ip_proto = IPPROTO_TCP; ++ else if (strcasecmp(parameter_value,"IPPROTO_SCTP")==0) ip_proto = IPPROTO_SCTP; ++ else log_error("Parameter value '%s' not recognized for parameter '%s'", parameter_value, ip_proto_name()); + } else if(strcmp(parameter_name, local_port_name()) == 0){ + int a; + if (sscanf(parameter_value, "%d", &a)!=1) log_error("Invalid input as port number given: %s", parameter_value); +@@ -760,6 +767,7 @@ int Abstract_Socket::open_listen_port(const char* localHostname, const char* loc + hints.ai_flags = /*AI_ALL|*/AI_ADDRCONFIG|AI_PASSIVE; + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = ai_family; ++ hints.ai_protocol = ip_proto; + + error = getaddrinfo(localHostname, localServicename, &hints, &aip); + if (error != 0) { +@@ -1143,6 +1151,7 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch + } + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = ai_family; ++ hints.ai_protocol = ip_proto; + + error = getaddrinfo(remoteHostname, remoteServicename, &hints, &res); + if (error != 0) { +@@ -1191,9 +1200,11 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch + } + } + +- log_debug("Using address family for socket %d: %s",socket_fd, ++ log_debug("Using address family for socket %d: %s - %s",socket_fd, + ((aip->ai_family==AF_INET)?"IPv4": +- ((aip->ai_family==AF_INET6)?"IPv6":"unknown")) ++ ((aip->ai_family==AF_INET6)?"IPv6":"unknown")), ++ ((aip->ai_protocol==IPPROTO_TCP)?"IPPROTO_TCP": ++ ((aip->ai_protocol==IPPROTO_SCTP)?"IPPROTO_SCTP":"unknown")) + ); + + +@@ -1225,6 +1236,7 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch + hints.ai_flags = AI_PASSIVE; + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = ai_family;//aip->ai_family; // NOTE: On solaris 10 if is set to aip->ai_family, getaddrinfo will crash for IPv4-mapped addresses! ++ hints.ai_protocol = ip_proto; + + error = getaddrinfo(localHostname, localServicename, &hints, &localAddrinfo); + if (error != 0) { +@@ -1390,10 +1402,13 @@ int Abstract_Socket::open_client_connection(const char* remoteHostname, const ch + } + + log_debug( +- "connected to: host %s service %s via address family %s\n", ++ "connected to: host %s service %s via address family %s with ip_proto %s\n", + remoteHostname, remoteServicename, + ((aip->ai_family==AF_INET)?"IPv4": +- ((aip->ai_family==AF_INET6)?"IPv6":"unknown"))); ++ ((aip->ai_family==AF_INET6)?"IPv6":"unknown")), ++ ((aip->ai_protocol==IPPROTO_TCP)?"IPPROTO_TCP": ++ ((aip->ai_protocol==IPPROTO_SCTP)?"IPPROTO_SCTP":"unknown")) ++ ); + break; + } + if (aip==NULL) { +@@ -1774,18 +1789,19 @@ const char* Abstract_Socket::remote_address_name() { return "destIPAddr + const char* Abstract_Socket::local_address_name() { return "serverIPAddr";} + const char* Abstract_Socket::remote_port_name() { return "destPort";} + const char* Abstract_Socket::ai_family_name() { return "ai_family";} ++const char* Abstract_Socket::ip_proto_name() { return "ip_proto";} + const char* Abstract_Socket::use_connection_ASPs_name() { return "use_connection_ASPs";} + const char* Abstract_Socket::halt_on_connection_reset_name(){ return "halt_on_connection_reset";} +-const char* Abstract_Socket::client_TCP_reconnect_name() { return "client_TCP_reconnect";} ++const char* Abstract_Socket::client_TCP_reconnect_name() { return "client_TCP_reconnect";} + const char* Abstract_Socket::TCP_reconnect_attempts_name() { return "TCP_reconnect_attempts";} +-const char* Abstract_Socket::TCP_reconnect_delay_name() { return "TCP_reconnect_delay";} ++const char* Abstract_Socket::TCP_reconnect_delay_name() { return "TCP_reconnect_delay";} + const char* Abstract_Socket::server_mode_name() { return "server_mode";} + const char* Abstract_Socket::socket_debugging_name() { return "socket_debugging";} + const char* Abstract_Socket::nagling_name() { return "nagling";} + const char* Abstract_Socket::use_non_blocking_socket_name() { return "use_non_blocking_socket";} + const char* Abstract_Socket::server_backlog_name() { return "server_backlog";} +-bool Abstract_Socket::add_user_data(int) {return true;} +-bool Abstract_Socket::remove_user_data(int) {return true;} ++bool Abstract_Socket::add_user_data(int) {return true;} ++bool Abstract_Socket::remove_user_data(int) {return true;} + bool Abstract_Socket::user_all_mandatory_configparameters_present() { return true; } + + diff --git a/ttcn/patch_abstract_socket/Abstract_Socket.hh.patch b/ttcn/patch_abstract_socket/Abstract_Socket.hh.patch new file mode 100644 index 0000000..bce5667 --- /dev/null +++ b/ttcn/patch_abstract_socket/Abstract_Socket.hh.patch @@ -0,0 +1,38 @@ +diff --git a/src/Abstract_Socket.hh b/src/Abstract_Socket.hh +index 6d7bc3d..a068662 100644 +--- a/src/Abstract_Socket.hh ++++ b/src/Abstract_Socket.hh +@@ -134,7 +134,7 @@ protected: + bool get_handle_half_close() const {return handle_half_close;} + int get_socket_fd() const; + int get_listen_fd() const {return listen_fd;} +- ++ + //set non-blocking mode + int set_non_block_mode(int fd, bool enable_nonblock); + +@@ -149,6 +149,8 @@ protected: + const struct sockaddr_in & get_local_addr() {return localAddr; }; /* FIXME: This function is deprecated and should be removed! */ + const int& get_ai_family() const {return ai_family;} + void set_ai_family(int parameter_value) {ai_family=parameter_value;} ++ const int& get_ip_proto() const {return ip_proto;} ++ void set_ip_proto(int parameter_value) {ip_proto=parameter_value;} + bool get_ttcn_buffer_usercontrol() const {return ttcn_buffer_usercontrol; } + void set_nagling(bool parameter_value) {nagling=parameter_value;} + void set_server_mode(bool parameter_value) {server_mode=parameter_value;} +@@ -204,6 +206,7 @@ protected: + virtual const char* local_address_name(); + virtual const char* remote_port_name(); + virtual const char* ai_family_name(); ++ virtual const char* ip_proto_name(); + virtual const char* use_connection_ASPs_name(); + virtual const char* halt_on_connection_reset_name(); + virtual const char* client_TCP_reconnect_name(); +@@ -269,6 +272,7 @@ private: + char* remote_host_name; + unsigned int remote_port_number; + int ai_family; // address family to use ++ int ip_proto; // protocol to use (e.g. IPPROTO_TCP, IPPROTO_SCTP) + // remoteAddr and localAddr is filled when map_user is called + struct sockaddr_in remoteAddr; /* FIXME: not used! should be removed */ + struct sockaddr_in localAddr; /* FIXME: not used! should be removed */ -- GitLab From 0f103c1ec404a40393d489527fe8843bb0cc9898 Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 22 Oct 2024 07:37:27 +0200 Subject: [PATCH 3/4] Bug fixed in install.sh --- NGAP_ETSI.code-workspace | 6 +++++- install.sh | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NGAP_ETSI.code-workspace b/NGAP_ETSI.code-workspace index 4d05c85..6cfeb02 100644 --- a/NGAP_ETSI.code-workspace +++ b/NGAP_ETSI.code-workspace @@ -5,11 +5,15 @@ }, { "path": "../../../tmp/osmo-ttcn3-hacks" + }, + { + "path": "../pipeline-scripts" } ], "settings": { "files.associations": { - "pdusessionresourcemodifyindication.h": "c" + "pdusessionresourcemodifyindication.h": "c", + "random": "cpp" } } } \ No newline at end of file diff --git a/install.sh b/install.sh index 390b323..e05d3d5 100755 --- a/install.sh +++ b/install.sh @@ -25,8 +25,8 @@ ln -f ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/ # TODO Add other patch cd ./ttcn/modules/titan.TestPorts.Common_Components.Abstract_Socket/module/src -git apply ./ttcn/patch_abstract_socket/Abstract_Socket.hh.patch -git apply ./ttcn/patch_abstract_socket/Abstract_Socket.cc.patch +git apply ../../../../patch_abstract_socket/Abstract_Socket.hh.patch +git apply ../../../../patch_abstract_socket/Abstract_Socket.cc.patch cd $BASE_PATH exit 0 -- GitLab From bb576d00f0737b56ba0f3673f2322ae361222ba7 Mon Sep 17 00:00:00 2001 From: garciay Date: Mon, 7 Jul 2025 13:37:13 +0200 Subject: [PATCH 4/4] Setup basics of the Test Adapter --- NGAP_ETSI.code-workspace | 7 ++- ccsrc/Ports/LibNGAP/NGAPPort.cc | 11 ++++ ccsrc/Ports/LibNGAP/NGAPPort.hh | 12 +++- ccsrc/Protocols/NGAP_layer/ngap_layer.cc | 11 ++++ ccsrc/Protocols/NGAP_layer/ngap_layer.hh | 4 +- .../NGAP_layer/ngap_layer_factory.hh | 4 +- titan-test-system-framework | 2 +- .../lib/LibNGAP_EncdecDeclarations.ttcn | 48 ++++++++-------- ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn | 4 +- .../LibNGAP/lib_system/LibNGAP_Interface.ttcn | 1 + .../ttcn/LibCommon_Sync.ttcn | 57 ++++++++++--------- 11 files changed, 100 insertions(+), 61 deletions(-) diff --git a/NGAP_ETSI.code-workspace b/NGAP_ETSI.code-workspace index 6cfeb02..9cee084 100644 --- a/NGAP_ETSI.code-workspace +++ b/NGAP_ETSI.code-workspace @@ -4,10 +4,13 @@ "path": "." }, { - "path": "../../../tmp/osmo-ttcn3-hacks" + "path": "../pipeline-scripts" }, { - "path": "../pipeline-scripts" + "path": "../../tmp/titan_5gngap_per_issue" + }, + { + "path": "../nas" } ], "settings": { diff --git a/ccsrc/Ports/LibNGAP/NGAPPort.cc b/ccsrc/Ports/LibNGAP/NGAPPort.cc index a7b6155..461c4b3 100644 --- a/ccsrc/Ports/LibNGAP/NGAPPort.cc +++ b/ccsrc/Ports/LibNGAP/NGAPPort.cc @@ -1,3 +1,14 @@ +/*! + * \file NGAPPort.cc + * \brief CC file for NGAPPort. + * \author ETSI TTF041 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ + #include "loggers.hh" #include "LibNGAP_Interface.hh" diff --git a/ccsrc/Ports/LibNGAP/NGAPPort.hh b/ccsrc/Ports/LibNGAP/NGAPPort.hh index f346146..d51edbc 100644 --- a/ccsrc/Ports/LibNGAP/NGAPPort.hh +++ b/ccsrc/Ports/LibNGAP/NGAPPort.hh @@ -1,3 +1,14 @@ +/*! + * \file NGAPPort.hh + * \brief Header file for NGAPPort. + * \author ETSI TTF041 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ + #pragma once #include "LibNGAP_Interface.hh" @@ -11,7 +22,6 @@ namespace NGAP__PDU__Descriptions{ } namespace LibNGAP__Interface { - //class HttpPort : public HttpPort_BASE { class NGAPPort : public NGAPPort_BASE { params _cfg_params; params _layer_params; diff --git a/ccsrc/Protocols/NGAP_layer/ngap_layer.cc b/ccsrc/Protocols/NGAP_layer/ngap_layer.cc index 170c0a3..666f4a2 100644 --- a/ccsrc/Protocols/NGAP_layer/ngap_layer.cc +++ b/ccsrc/Protocols/NGAP_layer/ngap_layer.cc @@ -1,3 +1,14 @@ +/*! + * \file ngap_layer.cc + * \brief CC file for NGAP protocol layer. + * \author ETSI TTF041 + * \copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * \version 0.1 + */ + #include "ngap_types.hh" #include "NGAP_TestSystem.hh" diff --git a/ccsrc/Protocols/NGAP_layer/ngap_layer.hh b/ccsrc/Protocols/NGAP_layer/ngap_layer.hh index fe479c8..6054871 100644 --- a/ccsrc/Protocols/NGAP_layer/ngap_layer.hh +++ b/ccsrc/Protocols/NGAP_layer/ngap_layer.hh @@ -1,7 +1,7 @@ /*! * \file ngap_layer.hh - * \brief Header file for ITS NGAP protocol layer. - * \author ETSI TTF T033 + * \brief Header file for NGAP protocol layer. + * \author ETSI TTF041 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. diff --git a/ccsrc/Protocols/NGAP_layer/ngap_layer_factory.hh b/ccsrc/Protocols/NGAP_layer/ngap_layer_factory.hh index 01b3469..a165648 100644 --- a/ccsrc/Protocols/NGAP_layer/ngap_layer_factory.hh +++ b/ccsrc/Protocols/NGAP_layer/ngap_layer_factory.hh @@ -1,7 +1,7 @@ /*! * \file ngap_layer_factory.hh - * \brief Header file for ITS NGAP protocol layer factory. - * \author ETSI TTF T033 + * \brief Header file for NGAP protocol layer factory. + * \author ETSI TTF041 * \copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. diff --git a/titan-test-system-framework b/titan-test-system-framework index ef63449..a8db2ae 160000 --- a/titan-test-system-framework +++ b/titan-test-system-framework @@ -1 +1 @@ -Subproject commit ef6344980b87f3971363ad9b971f16dd43d8d0ba +Subproject commit a8db2aefc860cdfec0b76ae767f5c91fe7ec042f diff --git a/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn b/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn index fa62746..6a044f3 100644 --- a/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn +++ b/ttcn/LibNGAP/lib/LibNGAP_EncdecDeclarations.ttcn @@ -16,9 +16,9 @@ module LibNGAP_EncdecDeclarations { import from NGAP_IEs language "ASN.1:2002" all; external function fx_enc_NGAP_PDU (NGAP_PDU p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_NGAP_PDU (inout bitstring pdu, out NGAP_PDU p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //TODO: if no additional type in TypesAndvalues remove //external function fx_enc_ProtocolIE (ProtocolIE p) return bitstring @@ -33,88 +33,88 @@ module LibNGAP_EncdecDeclarations { //external function dec_PDUSessionResourceSetupResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupResponseTransfer p) return integer //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_dec_PDUSessionResourceSetupResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupResponseTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceSetupRequestTransfer(NGAP_IEs.PDUSessionResourceSetupRequestTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceSetupUnsuccessfulTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceSetupUnsuccessfulTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} external function fx_enc_PDUSessionResourceSetupUnsuccessfulTransfer(NGAP_IEs.PDUSessionResourceSetupUnsuccessfulTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceReleaseCommandTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceReleaseCommandTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceReleaseCommandTransfer(NGAP_IEs.PDUSessionResourceReleaseCommandTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceReleaseResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceReleaseResponseTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceReleaseResponseTransfer(NGAP_IEs.PDUSessionResourceReleaseResponseTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceModifyConfirmTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyConfirmTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyConfirmTransfer(NGAP_IEs.PDUSessionResourceModifyConfirmTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceModifyIndicationTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyIndicationTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyIndicationTransfer(NGAP_IEs.PDUSessionResourceModifyIndicationTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceModifyIndicationUnsuccessfulTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyIndicationUnsuccessfulTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyIndicationUnsuccessfulTransfer(NGAP_IEs.PDUSessionResourceModifyIndicationUnsuccessfulTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceModifyResponseTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyResponseTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyResponseTransfer(NGAP_IEs.PDUSessionResourceModifyResponseTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceModifyUnsuccessfulTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyUnsuccessfulTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyUnsuccessfulTransfer(NGAP_IEs.PDUSessionResourceModifyUnsuccessfulTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_UEContextSuspendRequestTransfer(inout bitstring pdu, out NGAP_IEs.UEContextSuspendRequestTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_UEContextSuspendRequestTransfer(NGAP_IEs.UEContextSuspendRequestTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} external function fx_dec_PDUSessionResourceModifyRequestTransfer(inout bitstring pdu, out NGAP_IEs.PDUSessionResourceModifyRequestTransfer p) return integer - with {extension "prototype(sliding) decode(PER:Aligned)"} + with {extension "prototype(sliding) decode(PER:ALIGNED)"} //with {extension "prototype(sliding) decode(LibNGAP_codec)"} external function fx_enc_PDUSessionResourceModifyRequestTransfer(NGAP_IEs.PDUSessionResourceModifyRequestTransfer p) return bitstring - with {extension "prototype(convert) encode(PER:Aligned)"} + with {extension "prototype(convert) encode(PER:ALIGNED)"} } // End of module LibNGAP_EncdecDeclarations \ No newline at end of file diff --git a/ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn b/ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn index 35a9da7..366aa23 100644 --- a/ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn +++ b/ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn @@ -5976,11 +5976,13 @@ module LibNGAP_Templates { value_ := { NGSetupFailure := { protocolIEs := { + *, { id := id_Cause, criticality := ignore, value_ := { Cause := p_cause } - } + }, + * } } } diff --git a/ttcn/LibNGAP/lib_system/LibNGAP_Interface.ttcn b/ttcn/LibNGAP/lib_system/LibNGAP_Interface.ttcn index 1dba94c..0f1a0cb 100644 --- a/ttcn/LibNGAP/lib_system/LibNGAP_Interface.ttcn +++ b/ttcn/LibNGAP/lib_system/LibNGAP_Interface.ttcn @@ -60,6 +60,7 @@ module LibNGAP_Interface { // General timers timer tc_wait := PX_NGAP_TWAIT; timer tc_delay := 0.3; // delay next Request + // FSCOM: TTCN-3 timer are in seconds (ETSI ES 201 873-1 V4.16.1 (2024-10) Clause 12 Declaring timers) // Variables for storing default references var default vc_default_ngap; diff --git a/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn b/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn index 6f39f56..eb11aef 100644 --- a/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn +++ b/ttcn/patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn @@ -148,8 +148,8 @@ module LibCommon_Sync { * @see LibCommon_Sync.ServerSyncComp * @see LibCommon_Sync.ClientSyncComp */ - type port SyncPort message { - inout SyncCmd + type port SyncPort message { + inout SyncCmd } with { extension "internal" } @@ -322,7 +322,7 @@ module LibCommon_Sync { * @param p_numClients number of synchronization clients * @param p_syncPointIds list of synchronization point name/ids */ - function f_serverSyncNClientsAndStop ( + function f_serverSyncNClientsAndStop ( in UInt p_numClients, in SyncPointList p_syncPointIds ) runs on ServerSyncComp { @@ -454,7 +454,7 @@ module LibCommon_Sync { /** * @desc Function kept for backward compatibility * @see f_selfOrClientSyncAndVerdictPreamble - * + * */ function f_selfOrClientSyncAndVerdictPR( in charstring p_syncPoint, in FncRetCode p_ret) @@ -620,16 +620,16 @@ module LibCommon_Sync { } // end altstep a_dummyShutDown /** - * @desc Shutdown alstep in case the sync server is requesting shutdown. - * - * @remark User shall stop the component + * @desc Shutdown alstep in case the sync server is requesting shutdown. + * + * @remark User shall stop the component */ - altstep a_shutdown() - runs on ClientSyncComp { + altstep a_shutdown() + runs on BaseSyncComp { [] syncPort.receive(m_syncServerStop){ tc_sync.stop ; log("**** a_shutdown: Test component received STOP signal from MTC **** "); - } + } } } // end group shutDownAltsteps @@ -663,7 +663,7 @@ module LibCommon_Sync { /** * @desc Implements synchronization of "n" clients from server - * side including intermediate synchronization. + * side including intermediate synchronization. * If a problem occurs, then server sends STOP to * all clients. Waits for PX_TSYNC_TIME_LIMIT to let * clients finish executing their behavior until this @@ -732,7 +732,7 @@ module LibCommon_Sync { } else if ( p_syncId == c_initDone ) { log("**** f_serverSyncClientsTimed: Sync server now starting UPPER TESTER synchronization ... ****") ; } else { - log("**** f_serverSyncClientsTimed: Sync server now starting handling of next synchronization point ... ****") ; + log("**** f_serverSyncClientsTimed: Sync server now starting handling of " & p_syncId & " synchronization point ... ****") ; } tc_sync.start(p_execTimeLimit) ; alt{ @@ -747,6 +747,7 @@ module LibCommon_Sync { repeat; } [] syncPort.receive(m_syncClientReady(p_syncId)) -> sender v_clientRef { + log("**** f_serverSyncClientsTimed: Sync server received READY signal from a client - server will wait for all clients to reach this synchronization point ****"); if(not f_isPresentInArray(v_clientRef, v_clientRefs)) { v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; v_noOfRecvdSyncMsgs := v_noOfRecvdSyncMsgs + 1; @@ -767,7 +768,7 @@ module LibCommon_Sync { log("**** f_serverSyncClientsTimed: Sync server received client sync message with incorrect synchronization point id which is currently not handled - server will stop all clients! ****") ; v_stopClients := true; if(not f_isPresentInArray(v_clientRef, v_clientRefs)) { - v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; + v_clientRefs[v_noOfRecvdSyncMsgs] := v_clientRef; } } [] syncPort.receive(SyncCmd :? ) { @@ -1317,29 +1318,29 @@ module LibCommon_Sync { alt { [] syncPort.receive { // clients may still try to send some sync message - } + } [] all component.done { tc_shutDown.stop; log("**** f_serverWaitForAllClientsToShutDown: All components have properly shut down. Sync server will now terminate the test case. ****") ; - } + } [] tc_shutDown.timeout { log("**** f_serverWaitForAllClientsToShutDown: Not all clients have properly shutdown within the shut down time limit. Sync server will now terminate test case! ****") ; - } + } } // end alt // cover case that shut down default is NOT activated setverdict(inconc); - //mtc.stop; - syncPort.send(m_syncServerStop) to self; // this MUST be _server_ for the default to catch! - tc_sync.start(PX_TSYNC_TIME_LIMIT); - alt{ - [] tc_sync.timeout{ - log("**** f_selfSyncStop: Stopping MTC without shutdown - either no shutdown default active or missing syncPort connection ****") ; - setverdict(inconc); - stop ; - } - }//end alt - tc_sync.stop; - stop; // if shutdown default is not activated or if it does not stop + //mtc.stop; + syncPort.send(m_syncServerStop) to self; // this MUST be _server_ for the default to catch! + tc_sync.start(PX_TSYNC_TIME_LIMIT); + alt{ + [] tc_sync.timeout{ + log("**** f_selfSyncStop: Stopping MTC without shutdown - either no shutdown default active or missing syncPort connection ****") ; + setverdict(inconc); + stop ; + } + }//end alt + tc_sync.stop; + stop; // if shutdown default is not activated or if it does not stop } // end function f_serverWaitForAllClientsToShutDown function f_isPresentInArray(in ClientSyncComp p_clientRef, in ClientSyncCompList p_clientRefs) -- GitLab