Commit af03dae0 authored by Yann Garcia's avatar Yann Garcia
Browse files

test suite AtsNGAP and AtsNAS are collocated within the same organizational repository

parent be03c0a7
Loading
Loading
Loading
Loading

Makefile

deleted100644 → 0
+0 −139
Original line number Diff line number Diff line
-include config.mk

ifeq (,$(ATS))
 $(error ATS shall be defined)
endif

ifeq (,$(TOPDIR))
 TOPDIR := .
endif

ifeq (,$(TTCN3_DIR))
 $(error TTCN3_DIR shall be defined in config.mk)
endif

first: all

define IncludeModule
undefine sources
undefine modules
undefine includes
include $(1)/module.mk
$$(foreach S, $$(sources),  $$(eval all_sources +=  $$(if $$(filter /%, $$(S)), $$(TOPDIR)$$(S), $(1)/$$(S))))
$$(foreach I, $$(includes), $$(eval all_includes += $$(if $$(filter /%, $$(I)), $$(TOPDIR)$$(I), $(1)/$$(I))))
$$(foreach M, $$(modules),  $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(TOPDIR)$$(M), $(1)/$$(M)))))
endef

all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src /usr/include/jsoncpp /usr/include/libxml2
defines  += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS)  AS_USE_SSL _GNU_SOURCE
libs     += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs

ifeq (Windows_NT,$(OS))
# Silence linker warnings.
LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc
defines += WIN32
libs += $(patsubst %, -L%/lib, $(OPENSSL_DIR))
all_includes += $(addsuffix /include, $(OPENSSL_DIR))
libs += $(WPCAP_DLL_PATH)
else
defines += LINUX
libs += -lpcap -lrt -lpthread
endif

libs += -lssl -lcrypto -lxml2 -ljsoncpp -L$(OSIP_LIB) -losipparser2 -lsctp

$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS)))

outdir := $(TOPDIR)/build/$(ATS)
bindir := $(TOPDIR)/bin

sources     := $(all_sources)
includes    := $(outdir) $(outdir)/.. $(outdir)/asn1 $(all_includes) $(NPCAP_INCLUDE) $(OSIP_INCLUDE) 

ifeq (Windows_NT,$(OS))
  EXE=.exe
endif

ttcn_sources  := $(filter %.ttcn , $(sources))
ttcn3_sources := $(filter %.ttcn3, $(sources))
asn_sources   := $(filter %.asn,   $(sources))
asn1_sources  := $(filter %.asn1,  $(sources))

tt_sources    := $(ttcn_sources) $(ttcn3_sources) $(asn_sources) $(asn1_sources)
cc_sources    := $(filter %.cc,    $(sources))

gen_ttcn_sources  := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn,  %.cc, $(ttcn_sources))))
gen_ttcn_headers  := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn,  %.hh, $(ttcn_sources))))
gen_ttcn3_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.cc, $(ttcn3_sources))))
gen_ttcn3_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.hh, $(ttcn3_sources))))
gen_asn_sources   := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn,   %.cc, $(asn_sources))))
gen_asn_headers   := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn,   %.hh, $(asn_sources))))
gen_asn1_sources  := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1,  %.cc, $(asn1_sources))))
gen_asn1_headers  := $(addprefix $(outdir)/, $(notdir $(patsubst %.asn1,  %.hh, $(asn1_sources))))

gen_sources := $(gen_ttcn_sources) $(gen_ttcn3_sources) $(gen_asn_sources) $(gen_asn1_sources)
gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers) $(gen_asn_headers) $(gen_asn1_headers)

gen_objects := $(patsubst %.cc, %.o, $(gen_sources))
cc_objects  := $(patsubst  %.cc, $(outdir)/%.o, $(cc_sources))

.PHONY: all FORCE echo

all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE)

echo_sources:
	@echo -e "$(addsuffix \n,$(all_sources))"

echo: echo_sources
	@echo -e "sources:\n $(addsuffix \n, $(sources))"
	@echo -e "gen_sources:\n $(addsuffix \n, $(gen_sources))"
	@echo -e "gen_objects:\n $(addsuffix \n, $(gen_objects))"
	@echo -e "cc_objects:\n $(addsuffix \n, $(cc_objects))"
	@echo -e "includes:\n $(addsuffix \n, $(includes))"
	@echo -e "defines: $(addsuffix \n, $(defines))"

clean:
	rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate

regen: force_regen $(outdir)/.generate
force_regen:
	rm -f $(outdir)/.generate

t3q: all
	@echo -e "Code checking in progress..."
	@java -Xmx3g -Xss512m -jar $(T3Q_PATH)/t3q.jar --config $(T3Q_PATH)/$(T3Q_CONFIG) $(tt_sources) > $(outdir)/t3q.out 2>&1 ; cd -
	@echo -e "Code checking in done..."
	@echo -e "Output file is located here: $(outdir)/t3q.out"

t3d: all
	@echo -e "TTCN-3 doc generation in progress..."
	@java -Xmx3g -Xss512m -jar $(T3D_PATH)/t3d.jar --config $(T3D_PATH)/$(T3D_CONFIG) $(tt_sources) > $(outdir)/t3d.out 2>&1 ; cd -
	@echo -e "TTCN-3 doc generation done..."
	@echo -e "Output file is located here: $(outdir)/t3d.out"

$(outdir) $(outdir)/asn1 $(bindir):
	mkdir -p $@

$(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 $@ $<

$(cc_objects) : $(outdir)/%.o : %.cc
	mkdir -p $(dir $@)
	g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<

#$(gen_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/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)))

NGAP_ETSI.code-workspace

deleted100644 → 0
+0 −22
Original line number Diff line number Diff line
{
	"folders": [
		{
			"path": "."
		},
		{
			"path": "../pipeline-scripts"
		},
		{
			"path": "../../tmp/titan_5gngap_per_issue"
		},
		{
			"path": "../nas"
		}
	],
	"settings": {
		"files.associations": {
			"pdusessionresourcemodifyindication.h": "c",
			"random": "cpp"
		}
	}
}
 No newline at end of file
+1 −29
Original line number Diff line number Diff line
# ETSI 5GNGAP protocol project


## Introduction

This repositories contains the test specificationsfor ETSI 5GNGAP protocols testing, Release 16.
ETSI 5GNGAP protocols project supports:
- ETSI TS 123 501: "5G; System architecture for the 5G System (5GS) (3GPP TS 23.501 version 16.16.0 Release 16)"
- ETSI TS 123 502: "5G; Procedures for the 5G System (5GS) (3GPP TS 23.502 version 16.15.0 Release 16)"
- ETSI TS 124 501: "5G; Non-Access-Stratum (NAS) protocol for 5G System (5GS); Stage 3 (3GPP TS 24.501 version 16.12.0 Release 16)"
- ETSI TS 138 413: "5G; NG-RAN; NG Application Protocol (NGAP) (3GPP TS 38.413 version 16.12.0 Release 16)"


## Contact information

Email at `cti_support` at `etsi` dot `org`.

## License

Unless specified otherwise, the content of this repository and the files contained are released under the BSD-3-Clause license.
See the attached LICENSE file or visit https://forge.etsi.org/legal-matters.

## STFs/TTFs

The following STFs were or are currently involved in the evolutions of the ETSI 5GNGAP protocols project:
- TTF T033


# Installation

The ETSI 5GNGAP protocol project cannot be executed yet. Only the Test Purposes and the TTCN-3 code were developed.
The ETSI test suite AtsNGAP and AtsNAS are collocated within the same organizational repository space on the ETSI Forge platform, both residing under the int/5g-core group. AtsNGAP (available at forge.etsi.org/rep/int/5g-core/ngap) covers conformance testing of the Next Generation Application Protocol, while AtsNAS (forge.etsi.org/rep/int/5g-core/nas) addresses the Non-Access Stratum protocol layer. Their collocation under the shared 5g-core namespace reflects their complementary roles in 5G Core network testing — NGAP handling the interface between the RAN and the 5G Core (N2 interface), and NAS governing the signaling between the UE and the core network. This shared repository grouping facilitates coordinated development and version alignment between the two test suites, as both protocols are tightly coupled in end-to-end 5G call flows.
 No newline at end of file

ccsrc/Ports/LibNGAP/NGAPPort.cc

deleted100644 → 0
+0 −139
Original line number Diff line number Diff line
/*!
 * \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"
#include "NGAP_PDU_Descriptions.hh"
#include "ngap_layer_factory.hh"
#include "layer.hh"
#include "params.hh"

namespace NGAP__PDU__Descriptions{
  class NGAP__PDU;
}
namespace LibNGAP__Interface {

  NGAPPort::NGAPPort(const char *par_port_name): NGAPPort_BASE(par_port_name), _cfg_params(), _layer_params(), _layer(nullptr), _time_key("NGAPPort::") {
    // Nothing to do
  } // End of constructor

  NGAPPort::~NGAPPort() {
    loggers::get_instance().log(">>> NGAPPort::~NGAPPort");

    if (_layer != nullptr) {
      delete _layer;
    }
  } // End of destructor

  void NGAPPort::set_parameter(const char * parameter_name, const char * parameter_value)
  {
    loggers::get_instance().log("NGAPPort::set_parameter: %s=%s", parameter_name, parameter_value);
    _cfg_params.insert(std::pair<std::string, std::string>(std::string(parameter_name), std::string(parameter_value)));
  }

  /*void HttpPort::Handle_Fd_Event(int fd, boolean is_readable,
    boolean is_writable, boolean is_error) {}*/

  void NGAPPort::Handle_Fd_Event_Error(int /*fd*/)
  {

  }

  void NGAPPort::Handle_Fd_Event_Writable(int /*fd*/)
  {

  }

  void NGAPPort::Handle_Fd_Event_Readable(int /*fd*/)
  {

  }

  /*void HttpPort::Handle_Timeout(double time_since_last_call) {}*/

  void NGAPPort::user_map(const char * system_port)
  {
    loggers::get_instance().log(">>> NGAPPort::user_map: %s", system_port);
    // Build layer stack
    params::iterator it = _cfg_params.find(std::string("params"));
    if (it != _cfg_params.end()) {
      loggers::get_instance().log("NGAPPort::user_map: %s", it->second.c_str());
      // Setup parameters
      params::convert(_layer_params, it->second); // TODO This _layer_params seems to be useless
      // Create layer
      _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());

      if (static_cast<ngap_layer*>(_layer) == nullptr) {
        loggers::get_instance().error("NGAPPort::user_map: Invalid stack configurationi - NOT SCTP: %s", it->second.c_str());
      }
      static_cast<ngap_layer*>(_layer)->add_upper_port(this);

      // Create layer
      _layer = layer_stack_builder::get_instance()->create_layer_stack(it->second.c_str());
      if (static_cast<ngap_layer*>(_layer) == NULL) {
        loggers::get_instance().error("NGAPPort::user_map: Invalid stack configuration: %s", it->second.c_str());
      }
      static_cast<ngap_layer*>(_layer)->add_upper_port(this);
    } else {
      loggers::get_instance().error("NGAPPort::user_map: No layers defined in configuration file");
    }
  } // End of user_map method

  void NGAPPort::user_unmap(const char * system_port)
  {
    loggers::get_instance().log(">>> NGAPPort:user_unmap: %s", system_port);

    // Reset layers
    if (_layer != nullptr) {
      delete _layer;
      _layer = nullptr;
    }
  } // End of user_unmap method

  void NGAPPort::user_start()
  {
    loggers::get_instance().log(">>> NGAPPort::user_start");

  } // End of user_start method

  void NGAPPort::user_stop()
  {
    loggers::get_instance().log(">>> NGAPPort::user_stop");

  } // End of user_stop method

  void NGAPPort::outgoing_send(const NGAP__PDU__Descriptions::NGAP__PDU& send_par)
  {
    loggers::get_instance().log_msg(">>> NGAPPort::outgoing_send: payload=", send_par);
    
    float duration;
    loggers::get_instance().set_start_time(_time_key);
    params params;
    static_cast<ngap_layer*>(_layer)->sendMsg(send_par, params);
    loggers::get_instance().set_stop_time(_time_key, duration);
  }

  void NGAPPort::receiveMsg (const  NGAP__PDU__Descriptions::NGAP__PDU& p_ind, const params& p_params) {
    loggers::get_instance().log_msg(">>> NGAPPort::receive_msg: ", p_ind);
    float duration;
    loggers::get_instance().set_start_time(_time_key);
    // Sanity check
    if (!p_ind.is_bound()) {
      return;
    }

    incoming_message(p_ind);
    loggers::get_instance().set_stop_time(_time_key, duration);
  }
  
} // End of namespace LibNGAP__Interface

ccsrc/Ports/LibNGAP/NGAPPort.hh

deleted100644 → 0
+0 −59
Original line number Diff line number Diff line
/*!
 * \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"
#include "NGAP_PDU_Descriptions.hh"

#include "layer.hh"
#include "params.hh"

namespace NGAP__PDU__Descriptions{
  class NGAP__PDU;
}
namespace LibNGAP__Interface {

  class  NGAPPort : public NGAPPort_BASE {
    params _cfg_params;
    params _layer_params;
    layer* _layer;
    std::string _time_key;
  public:
     NGAPPort(const char *par_port_name);
    ~ NGAPPort();
    
    //inline const char *get_name() const { return port_name; }
    void set_parameter(const char *parameter_name, const char *parameter_value);
    void receiveMsg (const NGAP__PDU__Descriptions::NGAP__PDU& p_ind, const params& p_params);
    
  private:
    /* void Handle_Fd_Event(int fd, boolean is_readable,
       boolean is_writable, boolean is_error); */
    void Handle_Fd_Event_Error(int fd);
    void Handle_Fd_Event_Writable(int fd);
    void Handle_Fd_Event_Readable(int fd);
    /* void Handle_Timeout(double time_since_last_call); */

  protected:
    const char *port_name;
    void user_map(const char *system_port);
    void user_unmap(const char *system_port);

    void user_start();
    void user_stop();

  protected:
    void outgoing_send(const NGAP__PDU__Descriptions::NGAP__PDU& send_par);
  }; // End of class  NGAPPort

} // End of namespace LibNGAP__Interface
Loading