Projects
osmocom:nightly
open5gs
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 805
View file
open5gs_2.7.2.4491.deef.202409022026.dsc -> open5gs_2.7.2.4505.4308.202409032026.dsc
Changed
@@ -2,7 +2,7 @@ Source: open5gs Binary: open5gs-common, open5gs-mme, open5gs-sgwc, open5gs-smf, open5gs-amf, open5gs-sgwu, open5gs-upf, open5gs-hss, open5gs-pcrf, open5gs-nrf, open5gs-scp, open5gs-sepp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg Architecture: any -Version: 2.7.2.4491.deef.202409022026 +Version: 2.7.2.4505.4308.202409032026 Maintainer: Harald Welte <laforge@gnumonks.org> Uploaders: Sukchan Lee <acetcom@gmail.com> Homepage: https://open5gs.org @@ -32,8 +32,8 @@ open5gs-udr deb net optional arch=any open5gs-upf deb net optional arch=any Checksums-Sha1: - f7e29a3c393098c9187348d14699295925f687b5 14503860 open5gs_2.7.2.4491.deef.202409022026.tar.xz + 3449733df8b6ddaa731a283126f2237787a09d9f 14505556 open5gs_2.7.2.4505.4308.202409032026.tar.xz Checksums-Sha256: - da0f9955d8100e31b5c67eca6f63fd6be956a066d3fc5ed28184be28917ffe37 14503860 open5gs_2.7.2.4491.deef.202409022026.tar.xz + b8efe4c950f7b141ebaafd8306d4b2f0d317d42c1543194014c0326389a03606 14505556 open5gs_2.7.2.4505.4308.202409032026.tar.xz Files: - 64d58a15d8c186b9335bec2bef4b9a3d 14503860 open5gs_2.7.2.4491.deef.202409022026.tar.xz + 0c764f0215037dbcec58ca54251a9371 14505556 open5gs_2.7.2.4505.4308.202409032026.tar.xz
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/.tarball-version -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -2.7.2.4491-deef.202409022026 +2.7.2.4505-4308.202409032026
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/configs/meson.build -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/configs/meson.build
Changed
@@ -39,6 +39,7 @@ slice.yaml srsenb.yaml non3gpp.yaml + transfer.yaml '''.split() foreach file : example_conf
View file
open5gs_2.7.2.4505.4308.202409032026.tar.xz/configs/transfer.yaml.in
Added
@@ -0,0 +1,271 @@ +db_uri: mongodb://localhost/open5gs + +logger: + +test: + serving: + - plmn_id: + mcc: 999 + mnc: 70 + +global: + parameter: +# no_nrf: true +# no_scp: true + no_sepp: true +# no_amf: true +# no_smf: true +# no_upf: true +# no_ausf: true +# no_udm: true +# no_pcf: true +# no_nssf: true +# no_bsf: true +# no_udr: true + no_mme: true + no_sgwc: true + no_sgwu: true + no_pcrf: true + no_hss: true + +smf: + sbi: + server: + - address: 127.0.0.4 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777 + pfcp: + server: + - address: 127.0.0.4 + client: + upf: + - address: 127.0.0.7 + gtpc: + server: + - address: 127.0.0.4 + gtpu: + server: + - address: 127.0.0.4 + metrics: + server: + - address: 127.0.0.4 + port: 9090 + session: + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 + gateway: 2001:db8:cafe::1 + dns: + - 8.8.8.8 + - 8.8.4.4 + - 2001:4860:4860::8888 + - 2001:4860:4860::8844 + mtu: 1400 + freeDiameter: + identity: smf.localdomain + realm: localdomain + listen_on: 127.0.0.4 + no_fwd: true + load_extension: + - module: @build_subprojects_freeDiameter_extensions_dir@/dbg_msg_dumps.fdx + conf: 0x8888 + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_rfc5777.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_mip6i.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_nasreq.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_nas_mipv6.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_dcca.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_dcca_3gpp/dict_dcca_3gpp.fdx + connect: + - identity: pcrf.localdomain + address: 127.0.0.9 + +amf: + sbi: + server: + - address: 127.0.0.5 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777 + ngap: + server: + - address: 127.0.0.5 + metrics: + server: + - address: 127.0.0.5 + port: 9090 + guami: + - plmn_id: + mcc: 999 + mnc: 70 + amf_id: + region: 2 + set: 1 + pointer: 31 + tai: + - plmn_id: + mcc: 999 + mnc: 70 + tac: 1 + plmn_support: + - plmn_id: + mcc: 999 + mnc: 70 + s_nssai: + - sst: 1 + security: + integrity_order : NIA2, NIA1, NIA0 + ciphering_order : NEA0, NEA1, NEA2 + network_name: + full: Open5GS + amf_name: open5gs-amf0 + time: + t3512: + value: 540 # 9 mintues * 60 = 540 seconds + +# amf #2 +amf: + sbi: + server: + - address: 127.0.0.50 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777 + ngap: + server: + - address: 127.0.0.50 + metrics: + server: + - address: 127.0.0.50 + port: 9090 + guami: + - plmn_id: + mcc: 999 + mnc: 70 + amf_id: + region: 2 + set: 1 + pointer: 30 + tai: + - plmn_id: + mcc: 999 + mnc: 70 + tac: 1 + plmn_support: + - plmn_id: + mcc: 999 + mnc: 70 + s_nssai: + - sst: 1 + security: + integrity_order : NIA2, NIA1, NIA0 + ciphering_order : NEA0, NEA1, NEA2 + network_name: + full: Open5GS + amf_name: open5gs-amf1 + time: + t3512: + value: 540 # 9 mintues * 60 = 540 seconds + +upf: + pfcp: + server: + - address: 127.0.0.7 + gtpu: + server: + - address: 127.0.0.7 + session: + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 + gateway: 2001:db8:cafe::1 + metrics: + server: + - address: 127.0.0.7 + port: 9090 + +nrf: + sbi: + server: + - address: 127.0.0.10 + port: 7777 + +scp: + sbi: + server: + - address: 127.0.0.200 + port: 7777 + client: + nrf: + - uri: http://127.0.0.10:7777 + +ausf: + sbi: + server: + - address: 127.0.0.11 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777 + +udm: + hnet: + - id: 1 + scheme: 1 + key: @build_configs_dir@/open5gs/hnet/curve25519-1.key + - id: 2 + scheme: 2 + key: @build_configs_dir@/open5gs/hnet/secp256r1-2.key + sbi: + server: + - address: 127.0.0.12 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777 + +pcf: + sbi: + server: + - address: 127.0.0.13 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777 + metrics: + server: + - address: 127.0.0.13 + port: 9090 + +nssf: + sbi: + server: + - address: 127.0.0.14 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777 + nsi: + - uri: http://127.0.0.10:7777 + s_nssai: + sst: 1 +bsf: + sbi: + server: + - address: 127.0.0.15 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777 + +udr: + sbi: + server: + - address: 127.0.0.20 + port: 7777 + client: + scp: + - uri: http://127.0.0.200:7777
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/debian/changelog -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -open5gs (2.7.2.4491.deef.202409022026) unstable; urgency=medium +open5gs (2.7.2.4505.4308.202409032026) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom nightly feed - -- Osmocom OBS scripts <info@osmocom.org> Mon, 02 Sep 2024 20:27:54 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Tue, 03 Sep 2024 20:27:52 +0000 open5gs (2.7.2) unstable; urgency=medium
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/app/ogs-config.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/app/ogs-config.c
Changed
@@ -134,6 +134,30 @@ return OGS_OK; } +int ogs_app_count_nf_conf_sections(const char *conf_section) +{ + if (!strcmp(conf_section, "amf")) + global_conf.parameter.amf_count++; + else if (!strcmp(conf_section, "smf")) + global_conf.parameter.smf_count++; + else if (!strcmp(conf_section, "upf")) + global_conf.parameter.upf_count++; + else if (!strcmp(conf_section, "ausf")) + global_conf.parameter.ausf_count++; + else if (!strcmp(conf_section, "udm")) + global_conf.parameter.udm_count++; + else if (!strcmp(conf_section, "pcf")) + global_conf.parameter.pcf_count++; + else if (!strcmp(conf_section, "nssf")) + global_conf.parameter.nssf_count++; + else if (!strcmp(conf_section, "bsf")) + global_conf.parameter.bsf_count++; + else if (!strcmp(conf_section, "udr")) + global_conf.parameter.udr_count++; + + return OGS_OK; +} + int ogs_app_parse_global_conf(ogs_yaml_iter_t *parent) { int rv; @@ -459,6 +483,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -470,7 +495,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, local)) { + if (!strcmp(root_key, local) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t local_iter; ogs_yaml_iter_recurse(&root_iter, &local_iter); while (ogs_yaml_iter_next(&local_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/app/ogs-config.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/app/ogs-config.h
Changed
@@ -52,6 +52,16 @@ int no_scp; int no_nrf; + int amf_count; + int smf_count; + int upf_count; + int ausf_count; + int udm_count; + int pcf_count; + int nssf_count; + int bsf_count; + int udr_count; + /* Network */ int no_ipv4; int no_ipv6; @@ -163,6 +173,7 @@ ogs_app_global_conf_t *ogs_global_conf(void); ogs_app_local_conf_t *ogs_local_conf(void); +int ogs_app_count_nf_conf_sections(const char *conf_section); int ogs_app_parse_global_conf(ogs_yaml_iter_t *parent); int ogs_app_parse_local_conf(const char *local);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/app/ogs-context.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/app/ogs-context.h
Changed
@@ -85,6 +85,8 @@ uint64_t max_specs; } metrics; + int config_section_id; + } ogs_app_context_t; int ogs_app_context_init(void);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/app/ogs-init.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/app/ogs-init.c
Changed
@@ -35,6 +35,7 @@ char *log_file; char *log_level; char *domain_mask; + char *config_section_id; } optarg; ogs_core_initialize(); @@ -50,7 +51,7 @@ memset(&optarg, 0, sizeof(optarg)); ogs_getopt_init(&options, (char**)argv); - while ((opt = ogs_getopt(&options, "c:l:e:m:")) != -1) { + while ((opt = ogs_getopt(&options, "c:l:e:m:k:")) != -1) { switch (opt) { case 'c': optarg.config_file = options.optarg; @@ -64,6 +65,9 @@ case 'm': optarg.domain_mask = options.optarg; break; + case 'k': + optarg.config_section_id = options.optarg; + break; case '?': default: ogs_assert_if_reached(); @@ -124,7 +128,14 @@ ogs_app()->db_uri = ogs_env_get("DB_URI"); /************************************************************************** - * Stage 6 : Print Banner + * Stage 6 : Setup configuration section ID for running multiple NF from + * same config file + */ + if (optarg.config_section_id) + ogs_app()->config_section_id = atoi(optarg.config_section_id); + + /************************************************************************** + * Stage 7 : Print Banner */ if (ogs_app()->version) { ogs_log_print(OGS_LOG_INFO, @@ -144,7 +155,7 @@ } /************************************************************************** - * Stage 7 : Queue, Timer and Poll + * Stage 8 : Queue, Timer and Poll */ ogs_app()->queue = ogs_queue_create(ogs_app()->pool.event); ogs_assert(ogs_app()->queue); @@ -347,6 +358,12 @@ ogs_error("ogs_global_conf_parse_config() failed"); return rv; } + } else { + rv = ogs_app_count_nf_conf_sections(root_key); + if (rv != OGS_OK) { + ogs_error("ogs_app_count_nf_conf_sections() failed"); + return rv; + } } }
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/core/abts.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/core/abts.c
Changed
@@ -513,6 +513,7 @@ " -q : turn off status in test\n" " -x : exclute test-unit (e.g. -x sctp-test)\n" " -l : list test-unit\n" + " -k : use <id> config section\n" "\n", name); } @@ -523,6 +524,7 @@ ogs_getopt_t options; struct { char *config_file; + char *config_section; char *log_level; char *domain_mask; @@ -533,7 +535,7 @@ memset(&optarg, 0, sizeof(optarg)); ogs_getopt_init(&options, (char**)argv); - while ((opt = ogs_getopt(&options, "hvxlqc:e:m:dt")) != -1) { + while ((opt = ogs_getopt(&options, "hvxlqc:e:m:dtk:")) != -1) { switch (opt) { case 'h': show_help(argv0); @@ -565,6 +567,9 @@ case 't': optarg.enable_trace = true; break; + case 'k': + optarg.config_section = options.optarg; + break; case '?': fprintf(stderr, "%s: %s\n", argv0, options.errmsg); show_help(argv0); @@ -602,6 +607,10 @@ argv_outi++ = "-m"; argv_outi++ = optarg.domain_mask; } + if (optarg.config_section) { + argv_outi++ = "-k"; + argv_outi++ = optarg.config_section; + } argv_outi = NULL;
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/diameter/common/config.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/diameter/common/config.c
Changed
@@ -105,7 +105,7 @@ fd_config->conni.addr, errno, strerror(errno)); return OGS_ERROR; } - + CHECK_FCT_DO( fd_ep_add_merge( &fddpi.pi_endpoints, ai->ai_addr, ai->ai_addrlen, EP_FL_CONF | (disc ?: EP_ACCEPTALL) ), return OGS_ERROR); @@ -197,7 +197,7 @@ /* Display configuration */ b = fd_conf_dump(&buf, &len, NULL); - LOG_SPLIT(FD_LOG_NOTICE, NULL, + LOG_SPLIT(FD_LOG_NOTICE, NULL, b ?: (char*)"<Error during configuration dump...>", NULL); free(buf);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/diameter/common/init.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/diameter/common/init.c
Changed
@@ -36,14 +36,14 @@ if (ret != 0) { ogs_error("fd_log_handler_register() failed"); return ret; - } + } ret = fd_core_initialize(); if (ret != 0) { ogs_error("fd_core_initialize() failed"); return ret; - } - + } + /* Parse the configuration file */ if (conffile) { CHECK_FCT_DO( fd_core_parseconf(conffile), goto error ); @@ -55,7 +55,10 @@ CHECK_FCT( ogs_diam_message_init() ); /* Initialize FD logger */ - CHECK_FCT_DO( ogs_diam_logger_init(mode), goto error ); + CHECK_FCT_DO( ogs_diam_logger_init(), goto error ); + + /* Initialize FD stats */ + CHECK_FCT_DO( ogs_diam_stats_init(mode), goto error ); return 0; error: @@ -72,7 +75,7 @@ CHECK_FCT_DO( fd_core_waitstartcomplete(), goto error ); - CHECK_FCT( ogs_diam_logger_stats_start() ); + CHECK_FCT( ogs_diam_stats_start() ); return 0; error: @@ -84,6 +87,7 @@ void ogs_diam_final() { + ogs_diam_stats_final(); ogs_diam_logger_final(); CHECK_FCT_DO( fd_core_shutdown(), ogs_error("fd_core_shutdown() failed") ); @@ -118,12 +122,12 @@ ogs_log_printf(level, OGS_LOG_DOMAIN, 0, NULL, 0, NULL, 0, __VA_ARGS__) switch(printlevel) { - case FD_LOG_ANNOYING: + case FD_LOG_ANNOYING: diam_log_printf(OGS_LOG_TRACE, "%d %s\n", printlevel, buffer); - break; + break; case FD_LOG_DEBUG: diam_log_printf(OGS_LOG_TRACE, "%d %s\n", printlevel, buffer); - break; + break; case FD_LOG_INFO: diam_log_printf(OGS_LOG_TRACE, "%d %s\n", printlevel, buffer); break;
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/diameter/common/logger.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/diameter/common/logger.c
Changed
@@ -19,57 +19,30 @@ #include "ogs-diameter-common.h" -static struct ogs_diam_logger_t self; - static struct fd_hook_hdl *logger_hdl = NULL; static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; -static pthread_t fd_stats_th = (pthread_t)NULL; static ogs_diam_logger_user_handler user_handler = NULL; static void ogs_diam_logger_cb(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata); -static void * diam_stats_worker(void * arg); -int ogs_diam_logger_init(int mode) +int ogs_diam_logger_init() { uint32_t mask_peers = HOOK_MASK( HOOK_PEER_CONNECT_SUCCESS ); - memset(&self, 0, sizeof(struct ogs_diam_logger_t)); - - self.mode = mode; - self.duration = 60; /* 60 seconds */ - CHECK_FCT( fd_hook_register( mask_peers, ogs_diam_logger_cb, NULL, NULL, &logger_hdl) ); - CHECK_POSIX( pthread_mutex_init(&self.stats_lock, NULL) ); - return 0; } void ogs_diam_logger_final() { - CHECK_FCT_DO( fd_thr_term(&fd_stats_th), ); - CHECK_POSIX_DO( pthread_mutex_destroy(&self.stats_lock), ); - if (logger_hdl) { CHECK_FCT_DO( fd_hook_unregister( logger_hdl ), ); } } -struct ogs_diam_logger_t* ogs_diam_logger_self() -{ - return &self; -} - -int ogs_diam_logger_stats_start() -{ - /* Start the statistics thread */ - CHECK_POSIX( pthread_create(&fd_stats_th, NULL, diam_stats_worker, NULL) ); - - return 0; -} - void ogs_diam_logger_register(ogs_diam_logger_user_handler instance) { user_handler = instance; @@ -116,62 +89,3 @@ CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), ); } -/* Function to display statistics periodically */ -static void * diam_stats_worker(void * arg) -{ - struct timespec start, now; - struct fd_stats copy; - - /* Get the start time */ - CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &start), ); - - /* Now, loop until canceled */ - while (1) { - /* Display statistics every XX seconds */ - sleep(self.duration); - - /* Now, get the current stats */ - CHECK_POSIX_DO( pthread_mutex_lock(&self.stats_lock), ); - memcpy(©, &self.stats, sizeof(struct fd_stats)); - CHECK_POSIX_DO( pthread_mutex_unlock(&self.stats_lock), ); - - /* Get the current execution time */ - CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &now), ); - - /* Now, display everything */ - ogs_trace("------- fd statistics ---------"); - if (now.tv_nsec >= start.tv_nsec) - { - ogs_trace(" Executing for: %d.%06ld sec", - (int)(now.tv_sec - start.tv_sec), - (long)(now.tv_nsec - start.tv_nsec) / 1000); - } - else - { - ogs_trace(" Executing for: %d.%06ld sec", - (int)(now.tv_sec - 1 - start.tv_sec), - (long)(now.tv_nsec + 1000000000 - start.tv_nsec) / 1000); - } - - if (self.mode & FD_MODE_SERVER) { - ogs_trace(" Server: %llu message(s) echoed", - copy.nb_echoed); - } - if (self.mode & FD_MODE_CLIENT) { - ogs_trace(" Client:"); - ogs_trace(" %llu message(s) sent", copy.nb_sent); - ogs_trace(" %llu error(s) received", copy.nb_errs); - ogs_trace(" %llu answer(s) received", copy.nb_recv); - ogs_trace(" fastest: %ld.%06ld sec.", - copy.shortest / 1000000, copy.shortest % 1000000); - ogs_trace(" slowest: %ld.%06ld sec.", - copy.longest / 1000000, copy.longest % 1000000); - ogs_trace(" Average: %ld.%06ld sec.", - copy.avg / 1000000, copy.avg % 1000000); - } - ogs_trace("-------------------------------------"); - } - - return NULL; /* never called */ -} -
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/diameter/common/logger.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/diameter/common/logger.h
Changed
@@ -28,33 +28,9 @@ extern "C" { #endif -struct ogs_diam_logger_t { - -#define FD_MODE_SERVER 0x1 -#define FD_MODE_CLIENT 0x2 - int mode; /* default FD_MODE_SERVER | FD_MODE_CLIENT */ - - int duration; /* default 10 */ - struct fd_stats { - unsigned long long nb_echoed; /* server */ - unsigned long long nb_sent; /* client */ - unsigned long long nb_recv; /* client */ - unsigned long long nb_errs; /* client */ - unsigned long shortest; /* fastest answer, in microseconds */ - unsigned long longest; /* slowest answer, in microseconds */ - unsigned long avg; /* average answer time, in microseconds */ - } stats; - - pthread_mutex_t stats_lock; -}; - -int ogs_diam_logger_init(int mode); +int ogs_diam_logger_init(void); void ogs_diam_logger_final(void); -struct ogs_diam_logger_t* ogs_diam_logger_self(void); - -int ogs_diam_logger_stats_start(void); - typedef void (*ogs_diam_logger_user_handler)( enum fd_hook_type type, struct msg *msg, struct peer_hdr *peer, void *other, struct fd_hook_permsgdata *pmd, void *regdata);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/diameter/common/meson.build -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/diameter/common/meson.build
Changed
@@ -20,12 +20,14 @@ message.h logger.h + stats.h base.h libapp_sip.c dict.c message.c logger.c + stats.c config.c util.c init.c @@ -51,10 +53,10 @@ version : libogslib_version, c_args : libdiameter_common_cc_flags, include_directories : libdiameter_common_inc, libinc, - dependencies : libcore_dep, libfdcore_dep, + dependencies : libcore_dep, libfdcore_dep, libapp_dep, install : true) libdiameter_common_dep = declare_dependency( link_with : libdiameter_common, include_directories : libdiameter_common_inc, libinc, - dependencies : libcore_dep, libfdcore_dep) + dependencies : libcore_dep, libfdcore_dep, libapp_dep)
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/diameter/common/ogs-diameter-common.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/diameter/common/ogs-diameter-common.h
Changed
@@ -43,6 +43,7 @@ #include "diameter/common/message.h" #include "diameter/common/logger.h" +#include "diameter/common/stats.h" #include "diameter/common/base.h" #undef OGS_DIAMETER_INSIDE
View file
open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/diameter/common/stats.c
Added
@@ -0,0 +1,123 @@ +/* + * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "ogs-diameter-common.h" +#include "ogs-app.h" + +static ogs_diam_stats_ctx_t self; + +static void diam_stats_timer_cb(void *data); + +int ogs_diam_stats_init(int mode) +{ + memset(&self, 0, sizeof(ogs_diam_stats_ctx_t)); + + self.mode = mode; + self.poll.t_interval = ogs_time_from_sec(60); /* 60 seconds */ + self.poll.timer = ogs_timer_add(ogs_app()->timer_mgr, + diam_stats_timer_cb, 0); + ogs_assert(self.poll.timer); + + CHECK_POSIX( pthread_mutex_init(&self.stats_lock, NULL) ); + + return 0; +} + +void ogs_diam_stats_final() +{ + if (self.poll.timer) + ogs_timer_delete(self.poll.timer); + self.poll.timer = NULL; +} + +ogs_diam_stats_ctx_t* ogs_diam_stats_self() +{ + return &self; +} + +int ogs_diam_stats_start() +{ + /* Get the start time */ + self.poll.t_start = ogs_get_monotonic_time(); + /* Start the statistics timer */ + self.poll.t_prev = self.poll.t_start; + ogs_timer_start(self.poll.timer, self.poll.t_interval); + + return 0; +} + +static void ogs_diam_stats_log(const ogs_diam_stats_t *stats, ogs_time_t elapsed) +{ + ogs_trace("------- fd statistics ---------"); + ogs_trace(" Executing for: %llu.%06llu sec", + (unsigned long long)ogs_time_sec(elapsed), + (unsigned long long)ogs_time_usec(elapsed)); + + if (self.mode & FD_MODE_SERVER) { + ogs_trace(" Server: %llu message(s) echoed", + stats->nb_echoed); + } + if (self.mode & FD_MODE_CLIENT) { + ogs_trace(" Client:"); + ogs_trace(" %llu message(s) sent", stats->nb_sent); + ogs_trace(" %llu error(s) received", stats->nb_errs); + ogs_trace(" %llu answer(s) received", stats->nb_recv); + ogs_trace(" fastest: %ld.%06ld sec.", + stats->shortest / 1000000, stats->shortest % 1000000); + ogs_trace(" slowest: %ld.%06ld sec.", + stats->longest / 1000000, stats->longest % 1000000); + ogs_trace(" Average: %ld.%06ld sec.", + stats->avg / 1000000, stats->avg % 1000000); + } + ogs_trace("-------------------------------------"); +} + +/* Function to display statistics periodically */ +static void diam_stats_timer_cb(void *data) +{ + ogs_time_t now, since_start, since_prev, next_run; + ogs_diam_stats_t copy; + + /* Now, get the current stats */ + CHECK_POSIX_DO( pthread_mutex_lock(&self.stats_lock), ); + memcpy(©, &self.stats, sizeof(ogs_diam_stats_t)); + CHECK_POSIX_DO( pthread_mutex_unlock(&self.stats_lock), ); + + /* Get the current execution time */ + now = ogs_get_monotonic_time(); + since_start = now - self.poll.t_start; + + /* Now, display everything */ + ogs_diam_stats_log(©, since_start); + + /* Re-schedule timer: */ + since_prev = now - self.poll.t_prev; + /* Avoid increasing drift: */ + if (since_prev > self.poll.t_interval) { + if (since_prev - self.poll.t_interval >= self.poll.t_interval) + next_run = 1; /* 0 not accepted by ogs_timer_start() */ + else + next_run = self.poll.t_interval - (since_prev - self.poll.t_interval); + } else { + next_run = self.poll.t_interval; + } + self.poll.t_prev = now; + ogs_timer_start(self.poll.timer, next_run); +} +
View file
open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/diameter/common/stats.h
Added
@@ -0,0 +1,71 @@ +/* + * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#if !defined(OGS_DIAMETER_INSIDE) && !defined(OGS_DIAMETER_COMPILATION) +#error "This header cannot be included directly." +#endif + +#ifndef OGS_DIAM_STATS_H +#define OGS_DIAM_STATS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/time.h> + +typedef struct ogs_diam_stats_s { + unsigned long long nb_echoed; /* server */ + unsigned long long nb_sent; /* client */ + unsigned long long nb_recv; /* client */ + unsigned long long nb_errs; /* client */ + unsigned long shortest; /* fastest answer, in microseconds */ + unsigned long longest; /* slowest answer, in microseconds */ + unsigned long avg; /* average answer time, in microseconds */ +} ogs_diam_stats_t; + +typedef struct ogs_diam_stats_ctx_s { + +#define FD_MODE_SERVER 0x1 +#define FD_MODE_CLIENT 0x2 + int mode; /* default FD_MODE_SERVER | FD_MODE_CLIENT */ + + struct poll { + ogs_timer_t *timer; + ogs_time_t t_start; /* in usecs */ + ogs_time_t t_prev; /* in usecs */ + ogs_time_t t_interval; /* in usecs */ + } poll; + ogs_diam_stats_t stats; + + pthread_mutex_t stats_lock; +} ogs_diam_stats_ctx_t; + +int ogs_diam_stats_init(int mode); +void ogs_diam_stats_final(void); + +ogs_diam_stats_ctx_t* ogs_diam_stats_self(void); + +int ogs_diam_stats_start(void); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_DIAM_STATS_H */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/gtp/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/gtp/context.c
Changed
@@ -77,6 +77,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -88,7 +89,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, local)) { + if ((!strcmp(root_key, local)) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t local_iter; ogs_yaml_iter_recurse(&root_iter, &local_iter); while (ogs_yaml_iter_next(&local_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/metrics/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/metrics/context.c
Changed
@@ -77,6 +77,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -88,7 +89,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (local && !strcmp(root_key, local)) { + if (local && !strcmp(root_key, local) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t local_iter; ogs_yaml_iter_recurse(&root_iter, &local_iter); while (ogs_yaml_iter_next(&local_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/pfcp/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/pfcp/context.c
Changed
@@ -219,6 +219,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -230,7 +231,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, local)) { + if ((!strcmp(root_key, local)) && + idx++ == ogs_app()->config_section_id) { ogs_yaml_iter_t local_iter; ogs_yaml_iter_recurse(&root_iter, &local_iter); while (ogs_yaml_iter_next(&local_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/sbi/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/sbi/context.c
Changed
@@ -213,6 +213,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -224,7 +225,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (local && !strcmp(root_key, local)) { + if (local && !strcmp(root_key, local) && + idx++ == ogs_app()->config_section_id) { ogs_yaml_iter_t local_iter; ogs_yaml_iter_recurse(&root_iter, &local_iter); while (ogs_yaml_iter_next(&local_iter)) { @@ -349,11 +351,13 @@ } } + idx = 0; ogs_yaml_iter_init(&root_iter, document); while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (local && !strcmp(root_key, local)) { + if (local && !strcmp(root_key, local) && + idx++ == ogs_app()->config_section_id) { ogs_yaml_iter_t local_iter; ogs_yaml_iter_recurse(&root_iter, &local_iter); while (ogs_yaml_iter_next(&local_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/sbi/message.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/sbi/message.c
Changed
@@ -193,6 +193,10 @@ OpenAPI_ue_context_transfer_req_data_free(message->UeContextTransferReqData); if (message->UeContextTransferRspData) OpenAPI_ue_context_transfer_rsp_data_free(message->UeContextTransferRspData); + if (message->UeRegStatusUpdateReqData) + OpenAPI_ue_reg_status_update_req_data_free(message->UeRegStatusUpdateReqData); + if (message->UeRegStatusUpdateRspData) + OpenAPI_ue_reg_status_update_rsp_data_free(message->UeRegStatusUpdateRspData); /* HTTP Part */ for (i = 0; i < message->num_of_part; i++) { @@ -1372,6 +1376,14 @@ item = OpenAPI_ue_context_transfer_rsp_data_convertToJSON( message->UeContextTransferRspData); ogs_assert(item); + } else if (message->UeRegStatusUpdateReqData) { + item = OpenAPI_ue_reg_status_update_req_data_convertToJSON( + message->UeRegStatusUpdateReqData); + ogs_assert(item); + } else if (message->UeRegStatusUpdateRspData) { + item = OpenAPI_ue_reg_status_update_rsp_data_convertToJSON( + message->UeRegStatusUpdateRspData); + ogs_assert(item); } if (item) { @@ -2129,6 +2141,27 @@ rv = OGS_ERROR; ogs_error("JSON parse error"); } + } else { + ogs_error("HTTP ERROR Status : %d", + message->res_status); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_TRANSFER_UPDATE) + if (message->res_status == 0) { + message->UeRegStatusUpdateReqData = + OpenAPI_ue_reg_status_update_req_data_parseFromJSON(item); + if (!message->UeRegStatusUpdateReqData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + } else if (message->res_status == OGS_SBI_HTTP_STATUS_OK) { + message->UeRegStatusUpdateRspData = + OpenAPI_ue_reg_status_update_rsp_data_parseFromJSON(item); + if (!message->UeRegStatusUpdateRspData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } } else { ogs_error("HTTP ERROR Status : %d", message->res_status);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/sbi/message.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/sbi/message.h
Changed
@@ -125,6 +125,7 @@ #define OGS_SBI_RESOURCE_NAME_UE_CONTEXTS "ue-contexts" #define OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES "n1-n2-messages" #define OGS_SBI_RESOURCE_NAME_TRANSFER "transfer" +#define OGS_SBI_RESOURCE_NAME_TRANSFER_UPDATE "transfer-update" #define OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS "sm-context-status" #define OGS_SBI_RESOURCE_NAME_AM_POLICY_NOTIFY "am-policy-notify" @@ -558,6 +559,8 @@ OpenAPI_sec_negotiate_rsp_data_t *SecNegotiateRspData; OpenAPI_ue_context_transfer_req_data_t *UeContextTransferReqData; OpenAPI_ue_context_transfer_rsp_data_t *UeContextTransferRspData; + OpenAPI_ue_reg_status_update_req_data_t *UeRegStatusUpdateReqData; + OpenAPI_ue_reg_status_update_rsp_data_t *UeRegStatusUpdateRspData; ogs_sbi_links_t *links;
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/lib/sbi/ogs-sbi.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/lib/sbi/ogs-sbi.h
Changed
@@ -86,6 +86,8 @@ #include "model/ue_authentication_ctx.h" #include "model/ue_context_transfer_req_data.h" #include "model/ue_context_transfer_rsp_data.h" +#include "model/ue_reg_status_update_req_data.h" +#include "model/ue_reg_status_update_rsp_data.h" #include "custom/links.h"
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/amf/amf-sm.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/amf/amf-sm.c
Changed
@@ -209,6 +209,23 @@ END break; + CASE(OGS_SBI_RESOURCE_NAME_TRANSFER_UPDATE) + SWITCH(sbi_message.h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + amf_namf_comm_handle_registration_status_update_request( + stream, &sbi_message); + break; + DEFAULT + ogs_error("Invalid HTTP method %s", + sbi_message.h.method); + ogs_assert(true == + ogs_sbi_server_send_error(stream, + OGS_SBI_HTTP_STATUS_FORBIDDEN, &sbi_message, + "Invalid HTTP method", sbi_message.h.method, + NULL)); + END + break; + DEFAULT ogs_error("Invalid resource name %s", sbi_message.h.resource.component2);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/amf/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/amf/context.c
Changed
@@ -206,6 +206,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -217,7 +218,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "amf")) { + if ((!strcmp(root_key, "amf")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t amf_iter; ogs_yaml_iter_recurse(&root_iter, &amf_iter); while (ogs_yaml_iter_next(&amf_iter)) { @@ -1509,7 +1511,7 @@ * by performing the generic UE configuration update procedure. */ - /* Copying from Current to Next Guti */ + /* Copying from Next to Current Guti */ amf_ue->current.m_tmsi = amf_ue->next.m_tmsi; memcpy(&amf_ue->current.guti, &amf_ue->next.guti, sizeof(ogs_nas_5gs_guti_t)); @@ -1622,6 +1624,7 @@ OGS_SBI_NPCF_AM_POLICY_CONTROL_UE_AMBR_AUTHORIZATION); amf_ue->rat_restrictions = OpenAPI_list_create(); + amf_ue->to_release_session_list = OpenAPI_list_create(); ogs_list_init(&amf_ue->sess_list); @@ -1661,6 +1664,7 @@ AMF_UE_CLEAR_5GSM_MESSAGE(amf_ue); OpenAPI_list_free(amf_ue->rat_restrictions); + OpenAPI_list_free(amf_ue->to_release_session_list); /* Remove all session context */ amf_sess_remove_all(amf_ue); @@ -3022,3 +3026,34 @@ } return false; } + +void amf_ue_save_to_release_session_list(amf_ue_t *amf_ue) +{ + amf_sess_t *sess = NULL; + + OpenAPI_list_clear(amf_ue->to_release_session_list); + + ogs_list_for_each(&amf_ue->sess_list, sess) { + bool supported_s_nssai = false; + int i; + for (i = 0; i < amf_self()->num_of_plmn_support; i++) { + int j; + for (j = 0; j < amf_self()->plmn_supporti.num_of_s_nssai; j++) { + if (memcmp(&sess->s_nssai, + &amf_self()->plmn_supporti.s_nssaij, + sizeof(ogs_s_nssai_t)) == 0) { + supported_s_nssai = true; + break; + } + } + if (supported_s_nssai) + break; + } + if (!supported_s_nssai) { + double *psi = ogs_calloc(1, sizeof(*psi)); + ogs_assert(psi); + *psi = (double)sess->psi; + OpenAPI_list_add(amf_ue->to_release_session_list, psi); + } + } +}
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/amf/context.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/amf/context.h
Changed
@@ -45,6 +45,14 @@ typedef uint32_t amf_m_tmsi_t; +typedef enum { + UE_CONTEXT_INITIAL_STATE = 0, + UE_CONTEXT_TRANSFER_OLD_AMF_STATE, + UE_CONTEXT_TRANSFER_NEW_AMF_STATE, + REGISTRATION_STATUS_UPDATE_OLD_AMF_STATE, + REGISTRATION_STATUS_UPDATE_NEW_AMF_STATE, +} amf_ue_context_transfer_state_t; + typedef struct amf_context_s { /* Served GUAMI */ int num_of_served_guami; @@ -259,6 +267,8 @@ /* UE identity */ #define AMF_UE_HAVE_SUCI(__aMF) \ ((__aMF) && ((__aMF)->suci)) +#define AMF_UE_HAVE_SUPI(__aMF) \ + ((__aMF) && ((__aMF)->supi)) char *suci; /* TS33.501 : SUCI */ char *supi; /* TS33.501 : SUPI */ ogs_nas_5gs_mobile_identity_suci_t nas_mobile_identity_suci; @@ -280,7 +290,10 @@ ogs_nas_5gs_guti_t guti; } current, next; + /* UE context transfer and Registration status update */ ogs_nas_5gs_guti_t old_guti; + amf_ue_context_transfer_state_t amf_ue_context_transfer_state; + OpenAPI_list_t *to_release_session_list; /* UE Info */ ogs_guami_t *guami; @@ -996,6 +1009,7 @@ bool amf_update_allowed_nssai(amf_ue_t *amf_ue); bool amf_ue_is_rat_restricted(amf_ue_t *amf_ue); int amf_instance_get_load(void); +void amf_ue_save_to_release_session_list(amf_ue_t *amf_ue); #ifdef __cplusplus }
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/amf/gmm-sm.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/amf/gmm-sm.c
Changed
@@ -552,19 +552,23 @@ r = OGS_ERROR; if (sbi_message->res_status == OGS_SBI_HTTP_STATUS_OK) { + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_TRANSFER_NEW_AMF_STATE; r = amf_namf_comm_handle_ue_context_transfer_response( sbi_message, amf_ue); if (r != OGS_OK) { ogs_error("failed to handle " "UE_CONTEXT_TRANSFER response"); + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_INITIAL_STATE; } } else { ogs_error("%s HTTP response error %d", amf_ue->suci, sbi_message->res_status); + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_INITIAL_STATE; } if (r != OGS_OK) { - if (!AMF_UE_HAVE_SUCI(amf_ue)) { + if (!(AMF_UE_HAVE_SUCI(amf_ue) || + AMF_UE_HAVE_SUPI(amf_ue))) { CLEAR_AMF_UE_TIMER(amf_ue->t3570); r = nas_5gs_send_identity_request(amf_ue); ogs_expect(r == OGS_OK); @@ -1251,9 +1255,12 @@ if (gmm_registration_request_from_old_amf(amf_ue, &nas_message->gmm.registration_request) == true) { + /* Send UE context transfer to old AMF */ ogs_sbi_discovery_option_t *discovery_option = NULL; ogs_guami_t guami; + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_INITIAL_STATE; + discovery_option = ogs_sbi_discovery_option_new(); ogs_assert(discovery_option); @@ -1918,6 +1925,7 @@ ran_ue_t *ran_ue = NULL; ogs_nas_5gs_message_t *nas_message = NULL; ogs_nas_security_header_type_t h; + ogs_sbi_message_t *sbi_message = NULL; ogs_assert(s); ogs_assert(e); @@ -1998,6 +2006,38 @@ break; } + if (amf_ue->amf_ue_context_transfer_state == UE_CONTEXT_TRANSFER_NEW_AMF_STATE) { + /* + * UE context transfer message has been sent + * to old AMF after Registration request. + * Now Registrations status update needs to be sent. + */ + ogs_sbi_discovery_option_t *discovery_option = NULL; + ogs_guami_t guami; + int state = e->h.sbi.state; + + discovery_option = ogs_sbi_discovery_option_new(); + ogs_assert(discovery_option); + + memcpy(&guami.plmn_id, &amf_ue->home_plmn_id, + sizeof(ogs_plmn_id_t)); + memcpy(&guami.amf_id, &amf_ue->old_guti.amf_id, + sizeof(ogs_amf_id_t)); + + ogs_sbi_discovery_option_set_guami(discovery_option, &guami); + + r = amf_ue_sbi_discover_and_send( + OGS_SBI_SERVICE_TYPE_NAMF_COMM, discovery_option, + amf_namf_comm_build_registration_status_update, + amf_ue, state, + (void *)OpenAPI_ue_context_transfer_status_TRANSFERRED); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + + amf_ue->amf_ue_context_transfer_state = REGISTRATION_STATUS_UPDATE_NEW_AMF_STATE; + break; + } + ogs_kdf_kgnb_and_kn3iwf( amf_ue->kamf, amf_ue->ul_count.i32, amf_ue->nas.access_type, amf_ue->kgnb); @@ -2078,6 +2118,73 @@ break; } break; + case OGS_EVENT_SBI_CLIENT: + sbi_message = e->h.sbi.message; + ogs_assert(sbi_message); + + SWITCH(sbi_message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM) + SWITCH(sbi_message->h.resource.component0) + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXTS) + SWITCH(sbi_message->h.resource.component2) + CASE(OGS_SBI_RESOURCE_NAME_TRANSFER_UPDATE) + if (amf_ue->amf_ue_context_transfer_state != REGISTRATION_STATUS_UPDATE_NEW_AMF_STATE) { + ogs_error("UE context transfer state not correct"); + } + if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) { + ogs_error("%s HTTP response error %d", + amf_ue->supi, sbi_message->res_status); + } + r = amf_namf_comm_handle_registration_status_update_response(sbi_message, amf_ue); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_INITIAL_STATE; + + /* Continue with registration */ + ogs_kdf_kgnb_and_kn3iwf( + amf_ue->kamf, amf_ue->ul_count.i32, + amf_ue->nas.access_type, amf_ue->kgnb); + ogs_kdf_nh_gnb(amf_ue->kamf, amf_ue->kgnb, amf_ue->nh); + amf_ue->nhcc = 1; + + r = amf_ue_sbi_discover_and_send( + OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL, + amf_nudm_uecm_build_registration, amf_ue, 0, NULL); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + + if (amf_ue->nas.message_type == OGS_NAS_5GS_REGISTRATION_REQUEST) { + OGS_FSM_TRAN(s, &gmm_state_initial_context_setup); + } else if (amf_ue->nas.message_type == + OGS_NAS_5GS_SERVICE_REQUEST) { + OGS_FSM_TRAN(s, &gmm_state_registered); + } else { + ogs_fatal("Invalid OGS_NAS_5GS%d", amf_ue->nas.message_type); + ogs_assert_if_reached(); + } + break; + + DEFAULT + ogs_error("Invalid resource name %s", + sbi_message->h.resource.component2); + ogs_assert_if_reached(); + END + break; + + DEFAULT + ogs_error("Invalid resource name %s", + sbi_message->h.resource.component0); + ogs_assert_if_reached(); + END + break; + + DEFAULT + ogs_error("Invalid service name %s", sbi_message->h.service.name); + ogs_assert_if_reached(); + END + break; + case AMF_EVENT_5GMM_TIMER: switch (e->h.timer_id) { case AMF_TIMER_T3560: @@ -2508,6 +2615,7 @@ ran_ue_t *ran_ue = NULL; ogs_nas_5gs_message_t *nas_message = NULL; ogs_nas_security_header_type_t h; + ogs_sbi_message_t *sbi_message = NULL; ogs_assert(s); ogs_assert(e); @@ -2530,6 +2638,38 @@ AMF_UE_CLEAR_5GSM_MESSAGE(amf_ue); CLEAR_AMF_UE_ALL_TIMERS(amf_ue); + if (amf_ue->amf_ue_context_transfer_state == UE_CONTEXT_TRANSFER_NEW_AMF_STATE) { + /* + * UE context transfer message has been sent + * to old AMF after Registration request. + * Now Registrations status update needs to be sent. + */ + ogs_sbi_discovery_option_t *discovery_option = NULL; + ogs_guami_t guami; + int state = e->h.sbi.state; + + discovery_option = ogs_sbi_discovery_option_new(); + ogs_assert(discovery_option); + + memcpy(&guami.plmn_id, &amf_ue->home_plmn_id, + sizeof(ogs_plmn_id_t)); + memcpy(&guami.amf_id, &amf_ue->old_guti.amf_id, + sizeof(ogs_amf_id_t)); + + ogs_sbi_discovery_option_set_guami(discovery_option, &guami); + + r = amf_ue_sbi_discover_and_send( + OGS_SBI_SERVICE_TYPE_NAMF_COMM, discovery_option, + amf_namf_comm_build_registration_status_update, + amf_ue, state, + (void *)OpenAPI_ue_context_transfer_status_NOT_TRANSFERRED); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + + amf_ue->amf_ue_context_transfer_state = REGISTRATION_STATUS_UPDATE_NEW_AMF_STATE; + break; + } + xact_count = amf_sess_xact_count(amf_ue); amf_sbi_send_release_all_sessions( @@ -2667,6 +2807,68 @@ ogs_error("Unknown message %d", nas_message->gmm.h.message_type); } break; + case OGS_EVENT_SBI_CLIENT: + sbi_message = e->h.sbi.message; + ogs_assert(sbi_message); + + ran_ue_t *ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id); + ogs_assert(ran_ue); + + SWITCH(sbi_message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM) + SWITCH(sbi_message->h.resource.component0) + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXTS) + SWITCH(sbi_message->h.resource.component2) + CASE(OGS_SBI_RESOURCE_NAME_TRANSFER_UPDATE) + if (amf_ue->amf_ue_context_transfer_state != REGISTRATION_STATUS_UPDATE_NEW_AMF_STATE) { + ogs_error("UE context transfer state not correct"); + } + if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) { + ogs_error("%s HTTP response error %d", + amf_ue->supi, sbi_message->res_status); + } + r = amf_namf_comm_handle_registration_status_update_response(sbi_message, amf_ue); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_INITIAL_STATE; + + /* Continue with release command */ + xact_count = amf_sess_xact_count(amf_ue); + amf_sbi_send_release_all_sessions( + ran_ue, amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE); + + if (!AMF_SESSION_RELEASE_PENDING(amf_ue) && + amf_sess_xact_count(amf_ue) == xact_count) { + r = ngap_send_ran_ue_context_release_command( + ran_ue_find_by_id(amf_ue->ran_ue_id), + NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release, + NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + } + break; + + DEFAULT + ogs_error("Invalid resource name %s", + sbi_message->h.resource.component2); + ogs_assert_if_reached(); + END + break; + + DEFAULT + ogs_error("Invalid resource name %s", + sbi_message->h.resource.component0); + ogs_assert_if_reached(); + END + break; + + DEFAULT + ogs_error("Invalid service name %s", sbi_message->h.service.name); + ogs_assert_if_reached(); + + END + break; default: ogs_error("Unknown event%s", amf_event_get_name(e));
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/amf/namf-build.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/amf/namf-build.c
Changed
@@ -31,7 +31,6 @@ memset(&plmn_id, 0, sizeof(plmn_id)); ogs_nas_to_plmn_id(&plmn_id, &nas_guti->nas_plmn_id); - amf_id = ogs_amf_id_to_string(&nas_guti->amf_id); tmsi = ogs_uint32_to_0string(nas_guti->m_tmsi); @@ -92,6 +91,61 @@ request = ogs_sbi_build_request(&message); ogs_expect(request); + + if (ue_context_id) + ogs_free(ue_context_id); + + return request; +} + +ogs_sbi_request_t *amf_namf_comm_build_registration_status_update( + amf_ue_t *amf_ue, void *data) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + OpenAPI_ue_reg_status_update_req_data_t UeRegStatusUpdateReqData; + char *ue_context_id = NULL; + + ogs_assert(amf_ue); + ogs_assert(data); + + ue_context_id = ogs_guti_to_string(&amf_ue->old_guti); + ogs_assert(ue_context_id); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NAMF_COMM; + message.h.api.version = (char *)OGS_SBI_API_V1; + message.h.resource.component0 = + (char *)OGS_SBI_RESOURCE_NAME_UE_CONTEXTS; + message.h.resource.component1 = ue_context_id; + message.h.resource.component2 = + (char *)OGS_SBI_RESOURCE_NAME_TRANSFER_UPDATE; + message.UeRegStatusUpdateReqData = &UeRegStatusUpdateReqData; + + memset(&UeRegStatusUpdateReqData, 0, sizeof(UeRegStatusUpdateReqData)); + + UeRegStatusUpdateReqData.transfer_status = + (OpenAPI_ue_context_transfer_status_e)data; + /* + * TS 29.518 + * 5.2.2.2.2 Registration Status Update + * If any network slice(s) become no longer available and there are PDU + * Session(s) associated with them, the target AMF shall include these + * PDU session(s) in the toReleaseSessionList attribute in the payload. + */ + if (UeRegStatusUpdateReqData.transfer_status == + OpenAPI_ue_context_transfer_status_TRANSFERRED) { + ogs_assert(amf_ue->to_release_session_list); /* For safety */ + if (amf_ue->to_release_session_list->count) { + UeRegStatusUpdateReqData.to_release_session_list = + amf_ue->to_release_session_list; + } + } + + request = ogs_sbi_build_request(&message); + ogs_expect(request); if (ue_context_id) ogs_free(ue_context_id);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/amf/namf-build.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/amf/namf-build.h
Changed
@@ -28,6 +28,8 @@ ogs_sbi_request_t *amf_namf_comm_build_ue_context_transfer( amf_ue_t *amf_ue, void *data); +ogs_sbi_request_t *amf_namf_comm_build_registration_status_update( + amf_ue_t *amf_ue, void *data); #ifdef __cplusplus }
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/amf/namf-handler.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/amf/namf-handler.c
Changed
@@ -1093,7 +1093,6 @@ ogs_sbi_response_t *response = NULL; ogs_sbi_message_t sendmsg; amf_ue_t *amf_ue = NULL; - ran_ue_t *ran_ue = NULL; OpenAPI_ambr_t *UeAmbr = NULL; OpenAPI_list_t *MmContextList = NULL; @@ -1111,7 +1110,6 @@ ogs_sbi_nf_instance_t *pcf_nf_instance = NULL; - char *ue_context_id = NULL; char *encoded_gmm_capability = NULL; int status = OGS_SBI_HTTP_STATUS_OK; char hxkamf_stringOGS_KEYSTRLEN(OGS_SHA256_DIGEST_SIZE); @@ -1127,20 +1125,24 @@ memset(&sendmsg, 0, sizeof(sendmsg)); sendmsg.UeContextTransferRspData = &UeContextTransferRspData; - ue_context_id = recvmsg->h.resource.component1; - if (!ue_context_id) { + if (!recvmsg->h.resource.component1) { status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; strerror = ogs_msprintf("No UE context ID"); goto cleanup; } - amf_ue = amf_ue_find_by_ue_context_id(ue_context_id); + amf_ue = amf_ue_find_by_ue_context_id(recvmsg->h.resource.component1); if (!amf_ue) { status = OGS_SBI_HTTP_STATUS_NOT_FOUND; - strerror = ogs_msprintf("CONTEXT_NOT_FOUND"); + strerror = ogs_msprintf("Cannot find Context ID %s", + recvmsg->h.resource.component1); goto cleanup; } + if (amf_ue->amf_ue_context_transfer_state != UE_CONTEXT_INITIAL_STATE) { + ogs_warn("Incorrect UE context transfer state"); + } + if (amf_ue->supi) { UeContext.supi = amf_ue->supi; if (amf_ue->auth_result != @@ -1212,7 +1214,11 @@ if (recvmsg->UeContextTransferReqData->reason == OpenAPI_transfer_reason_MOBI_REG) { SessionContextList = - amf_namf_comm_encode_ue_session_context_list(amf_ue); + amf_namf_comm_encode_ue_session_context_list(amf_ue); + if (SessionContextList->count == 0) { + OpenAPI_list_free(SessionContextList); + SessionContextList = NULL; + } UeContext.session_context_list = SessionContextList; } @@ -1222,6 +1228,8 @@ ogs_assert(response); ogs_assert(true == ogs_sbi_server_send_response(stream, response)); + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_TRANSFER_OLD_AMF_STATE; + if (encoded_gmm_capability) ogs_free(encoded_gmm_capability); @@ -1245,13 +1253,19 @@ } /* - * Context TRANSFERRED !!! - * So, we removed UE context. + * Ue context is transfered, but we must keep the UE context until the + * registartion status update is received. + * + * TS 23.502 + * 4.2.2.2.2 General Registration + * + * 10. Conditional new AMF to old AMF: Namf_Communication_RegistrationStatusUpdate + * (PDU Session ID(s) to be released due to slice not supported). + * If the authentication/security procedure fails, then the Registration shall be + * rejected and the new AMF invokes the Namf_Communication_RegistrationStatusUpdate + * service operation with a reject indication towards the old AMF. The old AMF continues + * as if the UE context transfer service operation was never received. */ - ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id); - if (ran_ue) - ran_ue_remove(ran_ue); - amf_ue_remove(amf_ue); return OGS_OK; @@ -1352,10 +1366,13 @@ amf_namf_comm_decode_ue_mm_context_list( amf_ue, UeContext->mm_context_list); - if (UeContext->session_context_list) + if (UeContext->session_context_list) { amf_namf_comm_decode_ue_session_context_list( amf_ue, UeContext->session_context_list); - + /* Save a list of sessions to be released on old AMF */ + if (UeContext->mm_context_list) + amf_ue_save_to_release_session_list(amf_ue); + } /* TODO ueRadioCapability */ return OGS_OK; @@ -1802,3 +1819,134 @@ ogs_sbi_header_free(&header); } } + +int amf_namf_comm_handle_registration_status_update_request( + ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg) { + + ogs_sbi_response_t *response = NULL; + ogs_sbi_message_t sendmsg; + amf_ue_t *amf_ue = NULL; + ran_ue_t *ran_ue = NULL; + amf_sess_t *sess = NULL; + + OpenAPI_ue_reg_status_update_req_data_t *UeRegStatusUpdateReqData = + recvmsg->UeRegStatusUpdateReqData; + OpenAPI_ue_reg_status_update_rsp_data_t UeRegStatusUpdateRspData; + + int status = 0; + char *strerror = NULL; + + ogs_assert(stream); + ogs_assert(recvmsg); + + if (!recvmsg->h.resource.component1) { + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + strerror = ogs_msprintf("No UE context ID"); + goto cleanup; + } + amf_ue = amf_ue_find_by_ue_context_id(recvmsg->h.resource.component1); + if (!amf_ue) { + status = OGS_SBI_HTTP_STATUS_NOT_FOUND; + strerror = ogs_msprintf("Cannot find Context ID %s", + recvmsg->h.resource.component1); + goto cleanup; + } + + if (amf_ue->amf_ue_context_transfer_state != UE_CONTEXT_TRANSFER_OLD_AMF_STATE) { + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + strerror = ogs_msprintf("Incorrect UE context transfer state"); + goto cleanup; + } + + memset(&UeRegStatusUpdateRspData, 0, sizeof(UeRegStatusUpdateRspData)); + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.UeRegStatusUpdateRspData = &UeRegStatusUpdateRspData; + + if (UeRegStatusUpdateReqData->transfer_status == + OpenAPI_ue_context_transfer_status_TRANSFERRED) { + /* + * TS 29.518 + * 5.2.2.2.2 Registration Status Update + * Once the update is received, the source AMF shall: + * - remove the individual ueContext resource and release any PDU session(s) in the + * toReleaseSessionList attribute, if the transferStatus attribute included in the + * POST request body is set to "TRANSFERRED" and if the source AMF transferred the + * complete UE Context including all MM contexts and PDU Session Contexts. + */ + UeRegStatusUpdateRspData.reg_status_transfer_complete = 1; + + ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id); + + if (ran_ue) { + if (UeRegStatusUpdateReqData->to_release_session_list) { + OpenAPI_lnode_t *node = NULL; + OpenAPI_list_for_each(UeRegStatusUpdateReqData->to_release_session_list, node) { + /* A double must be read */ + uint8_t psi = *(double *)node->data; + sess = amf_sess_find_by_psi(amf_ue, psi); + if (SESSION_CONTEXT_IN_SMF(sess)) { + amf_sbi_send_release_session(ran_ue, sess, AMF_RELEASE_SM_CONTEXT_NO_STATE); + } else { + ogs_error("%s No Session Context PSI%d", + amf_ue->supi, psi); + UeRegStatusUpdateRspData.reg_status_transfer_complete = 0; + } + } + } + } + + /* Clear UE context */ + CLEAR_NG_CONTEXT(amf_ue); + AMF_UE_CLEAR_PAGING_INFO(amf_ue); + AMF_UE_CLEAR_N2_TRANSFER(amf_ue, pdu_session_resource_setup_request); + AMF_UE_CLEAR_5GSM_MESSAGE(amf_ue); + CLEAR_AMF_UE_ALL_TIMERS(amf_ue); + OGS_ASN_CLEAR_DATA(&amf_ue->ueRadioCapability); + + } else if (UeRegStatusUpdateReqData->transfer_status == + OpenAPI_ue_context_transfer_status_NOT_TRANSFERRED) { + /* + * TS 23.502 + * 4.2.2.2.2 + * If the authentication/security procedure fails, then the Registration shall be rejected and + * the new AMF invokes the Namf_Communication_RegistrationStatusUpdate service operation with + * a reject indication towards the old AMF. The old AMF continues as if the UE context transfer + * service operation was never received. + */ + UeRegStatusUpdateRspData.reg_status_transfer_complete = 0; + + } else { + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + strerror = ogs_msprintf("Transfer status not supported: %d", + UeRegStatusUpdateReqData->transfer_status); + goto cleanup; + } + + status = OGS_SBI_HTTP_STATUS_OK; + response = ogs_sbi_build_response(&sendmsg, status); + ogs_assert(response); + ogs_assert(true == ogs_sbi_server_send_response(stream, response)); + + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_INITIAL_STATE; + + return OGS_OK; + +cleanup: + ogs_assert(strerror); + ogs_error("%s", strerror); + + ogs_assert(true == ogs_sbi_server_send_error(stream, status, NULL, strerror, NULL, NULL)); + ogs_free(strerror); + + amf_ue->amf_ue_context_transfer_state = UE_CONTEXT_INITIAL_STATE; + + return OGS_ERROR; +} + +int amf_namf_comm_handle_registration_status_update_response( + ogs_sbi_message_t *recvmsg, amf_ue_t *amf_ue) { + + /* Nothing to do */ + + return OGS_OK; +}
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/amf/namf-handler.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/amf/namf-handler.h
Changed
@@ -38,6 +38,10 @@ ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg); int amf_namf_comm_handle_ue_context_transfer_response( ogs_sbi_message_t *recvmsg, amf_ue_t *amf_ue); +int amf_namf_comm_handle_registration_status_update_request( + ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg); +int amf_namf_comm_handle_registration_status_update_response( + ogs_sbi_message_t *recvmsg, amf_ue_t *amf_ue); #ifdef __cplusplus }
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/ausf/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/ausf/context.c
Changed
@@ -83,6 +83,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -94,7 +95,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "ausf")) { + if ((!strcmp(root_key, "ausf")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t ausf_iter; ogs_yaml_iter_recurse(&root_iter, &ausf_iter); while (ogs_yaml_iter_next(&ausf_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/bsf/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/bsf/context.c
Changed
@@ -82,6 +82,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -93,7 +94,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "bsf")) { + if ((!strcmp(root_key, "bsf")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t bsf_iter; ogs_yaml_iter_recurse(&root_iter, &bsf_iter); while (ogs_yaml_iter_next(&bsf_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/hss/hss-cx-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/hss/hss-cx-path.c
Changed
@@ -66,7 +66,7 @@ ogs_assert(msg); - ogs_debug("User-Authorization-Request"); + ogs_debug("Rx User-Authorization-Request"); /* Create answer header */ qry = *msg; @@ -163,12 +163,12 @@ ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); - ogs_debug("User-Authorization-Answer"); + ogs_debug("Tx User-Authorization-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_free(user_name); ogs_free(public_identity); @@ -250,7 +250,7 @@ ogs_assert(msg); - ogs_debug("Multimedia-Auth-Request"); + ogs_debug("Rx Multimedia-Auth-Request"); /* Create answer header */ qry = *msg; @@ -552,12 +552,12 @@ ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); - ogs_debug("Multimedia-Auth-Answer"); + ogs_debug("Tx Multimedia-Auth-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); if (authentication_scheme) ogs_free(authentication_scheme); @@ -627,7 +627,7 @@ ogs_assert(msg); - ogs_debug("Server-Assignment-Request"); + ogs_debug("Rx Server-Assignment-Request"); /* Create answer header */ qry = *msg; @@ -812,12 +812,12 @@ ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); - ogs_debug("Server-Assignment-Answer"); + ogs_debug("Tx Server-Assignment-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); if (user_data) ogs_free(user_data); @@ -875,7 +875,7 @@ ogs_assert(msg); - ogs_debug("Location-Info-Request"); + ogs_debug("Rx Location-Info-Request"); /* Create answer header */ qry = *msg; @@ -933,12 +933,12 @@ ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); - ogs_debug("Location-Info-Answer"); + ogs_debug("Tx Location-Info-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_free(public_identity);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/hss/hss-s6a-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/hss/hss-s6a-path.c
Changed
@@ -101,7 +101,7 @@ ogs_assert(msg); - ogs_debug("Authentication-Information-Request"); + ogs_debug("Rx Authentication-Information-Request"); /* Create answer header */ qry = *msg; @@ -262,12 +262,12 @@ ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); - ogs_debug("Authentication-Information-Answer"); + ogs_debug("Tx Authentication-Information-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); return 0; @@ -771,7 +771,7 @@ ogs_assert(msg); - ogs_debug("Update-Location-Request"); + ogs_debug("Rx Update-Location-Request"); memset(&subscription_data, 0, sizeof(ogs_subscription_data_t)); @@ -968,12 +968,12 @@ ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); - ogs_debug("Update-Location-Answer"); + ogs_debug("Tx Update-Location-Answer"); /* Add this value to the stats */ - ogs_assert( pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert( pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert( pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert( pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_subscription_data_free(&subscription_data); @@ -1039,7 +1039,7 @@ ogs_assert(msg); - ogs_debug("Purge-UE-Request"); + ogs_debug("Rx Purge-UE-Request"); memset(&subscription_data, 0, sizeof(ogs_subscription_data_t)); @@ -1125,12 +1125,12 @@ ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); - ogs_debug("Purge-UE-Answer"); + ogs_debug("Tx Purge-UE-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_subscription_data_free(&subscription_data); @@ -1174,7 +1174,7 @@ struct sess_state *sess_data = NULL, *svg; struct session *session = NULL; - ogs_debug("HSS Cancel-Location-Request"); + ogs_debug("HSS Tx Cancel-Location-Request"); /* Create the random value to store with the session */ sess_data = ogs_calloc(1, sizeof(*sess_data)); @@ -1284,9 +1284,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } @@ -1299,7 +1299,7 @@ struct session *session; int new; - ogs_debug("HSS Cancel-Location-Answer"); + ogs_debug("HSS Rx Cancel-Location-Answer"); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); @@ -1348,7 +1348,7 @@ ogs_subscription_data_t subscription_data; - ogs_debug("HSS Insert-Subscriber-Data-Request"); + ogs_debug("HSS Tx Insert-Subscriber-Data-Request"); memset(&subscription_data, 0, sizeof(ogs_subscription_data_t)); @@ -1485,9 +1485,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_subscription_data_free(&subscription_data); @@ -1503,7 +1503,7 @@ struct session *session; int new; - ogs_debug("HSS Insert-Subscriber-Data-Answer"); + ogs_debug("HSS Rx Insert-Subscriber-Data-Answer"); /* Search the session, retrieve its data */ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/hss/hss-swx-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/hss/hss-swx-path.c
Changed
@@ -334,9 +334,9 @@ ogs_debug("Multimedia-Auth-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); if (authentication_scheme) ogs_free(authentication_scheme); @@ -857,9 +857,9 @@ ogs_debug("Server-Assignment-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_subscription_data_free(&subscription_data); ogs_free(user_name);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/main.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/main.c
Changed
@@ -42,6 +42,7 @@ " -D : start as a daemon\n" " -v : show version number and exit\n" " -h : show this message and exit\n" + " -k : use <id> config section\n" "\n", name); } @@ -104,6 +105,7 @@ ogs_getopt_t options; struct { char *config_file; + char *config_section; char *log_file; char *log_level; char *domain_mask; @@ -116,7 +118,7 @@ memset(&optarg, 0, sizeof(optarg)); ogs_getopt_init(&options, (char**)argv); - while ((opt = ogs_getopt(&options, "vhDc:l:e:m:dt")) != -1) { + while ((opt = ogs_getopt(&options, "vhDc:l:e:m:dtk:")) != -1) { switch (opt) { case 'v': show_version(); @@ -164,6 +166,9 @@ case 't': optarg.enable_trace = true; break; + case 'k': + optarg.config_section = options.optarg; + break; case '?': fprintf(stderr, "%s: %s\n", argv0, options.errmsg); show_help(argv0); @@ -196,6 +201,10 @@ argv_outi++ = "-m"; argv_outi++ = optarg.domain_mask; } + if (optarg.config_section) { + argv_outi++ = "-k"; + argv_outi++ = optarg.config_section; + } argv_outi = NULL;
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/mme/mme-context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/mme/mme-context.c
Changed
@@ -158,6 +158,7 @@ mme_csmap_remove_all(); mme_vlr_remove_all(); mme_sgsn_remove_all(); + mme_hssmap_remove_all(); ogs_assert(self.enb_addr_hash); ogs_hash_destroy(self.enb_addr_hash); @@ -190,6 +191,7 @@ ogs_pool_final(&mme_pgw_pool); ogs_pool_final(&mme_csmap_pool); ogs_pool_final(&mme_vlr_pool); + ogs_pool_final(&mme_hssmap_pool); context_initialized = 0; }
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/mme/mme-fd-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/mme/mme-fd-path.c
Changed
@@ -858,9 +858,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } void mme_s6a_send_air(enb_ue_t *enb_ue, mme_ue_t *mme_ue, @@ -1118,30 +1118,30 @@ } /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; - } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; + } else { + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -1315,9 +1315,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } /* MME received Update Location Answer from HSS */ @@ -1543,31 +1543,31 @@ } /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = - (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = + (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; - } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; + } else { + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -1676,9 +1676,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } /* MME received Purge UE Answer from HSS */ @@ -1855,31 +1855,31 @@ } /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = - (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = + (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; - } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; + } else { + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -1991,9 +1991,9 @@ ogs_debug("Cancel-Location-Answer"); /* Add this value to the stats */ - ogs_assert( pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert( pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert( pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert( pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); e = mme_event_new(MME_EVENT_S6A_MESSAGE); ogs_assert(e); @@ -2284,9 +2284,9 @@ ogs_debug("Insert-Subscriber-Data-Answer"); /* Add this value to the stats */ - ogs_assert( pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert( pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert( pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert( pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); int rv; e = mme_event_new(MME_EVENT_S6A_MESSAGE);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/nssf/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/nssf/context.c
Changed
@@ -77,6 +77,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -88,7 +89,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "nssf")) { + if ((!strcmp(root_key, "nssf")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t nssf_iter; ogs_yaml_iter_recurse(&root_iter, &nssf_iter); while (ogs_yaml_iter_next(&nssf_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/pcf/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/pcf/context.c
Changed
@@ -275,6 +275,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -286,7 +287,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "pcf")) { + if ((!strcmp(root_key, "pcf")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t pcf_iter; ogs_yaml_iter_recurse(&root_iter, &pcf_iter); while (ogs_yaml_iter_next(&pcf_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/pcrf/pcrf-gx-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/pcrf/pcrf-gx-path.c
Changed
@@ -621,9 +621,9 @@ ogs_debug("Credit-Control-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) ==0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) ==0); OGS_SESSION_DATA_FREE(&gx_message.session_data); @@ -1013,9 +1013,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Set no error */ rx_message->result_code = ER_DIAMETER_SUCCESS; @@ -1121,30 +1121,30 @@ } /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec)
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/pcrf/pcrf-rx-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/pcrf/pcrf-rx-path.c
Changed
@@ -413,9 +413,9 @@ ogs_debug("PCRF AA-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_ims_data_free(&rx_message.ims_data); @@ -561,9 +561,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); return OGS_OK; } @@ -746,9 +746,9 @@ ogs_debug("PCRF Session-Termination-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); state_cleanup(sess_data, NULL, NULL); ogs_ims_data_free(&rx_message.ims_data);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/smf/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/smf/context.c
Changed
@@ -294,6 +294,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -305,7 +306,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "smf")) { + if ((!strcmp(root_key, "smf")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t smf_iter; ogs_yaml_iter_recurse(&root_iter, &smf_iter); while (ogs_yaml_iter_next(&smf_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/smf/gx-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/smf/gx-path.c
Changed
@@ -728,9 +728,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } /* 3GPP TS 29.212 5b.6.5 Credit-Control-Answer */ @@ -1089,30 +1089,30 @@ } /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -1355,9 +1355,9 @@ ogs_debug("Re-Auth-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); return 0;
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/smf/gy-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/smf/gy-path.c
Changed
@@ -959,9 +959,9 @@ /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } static void smf_gy_cca_cb(void *data, struct msg **msg) @@ -1217,30 +1217,30 @@ } /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -1367,9 +1367,9 @@ ogs_debug("Re-Auth-Answer"); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); return 0;
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/smf/s6b-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/smf/s6b-path.c
Changed
@@ -329,9 +329,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_free(user_name); ogs_free(visited_network_identifier); @@ -460,30 +460,30 @@ } /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -628,9 +628,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_free(user_name); } @@ -762,30 +762,30 @@ } /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec)
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/udm/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/udm/context.c
Changed
@@ -100,6 +100,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -111,7 +112,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "udm")) { + if ((!strcmp(root_key, "udm")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t udm_iter; ogs_yaml_iter_recurse(&root_iter, &udm_iter); while (ogs_yaml_iter_next(&udm_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/udr/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/udr/context.c
Changed
@@ -65,6 +65,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -76,7 +77,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "udr")) { + if ((!strcmp(root_key, "udr")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t udr_iter; ogs_yaml_iter_recurse(&root_iter, &udr_iter); while (ogs_yaml_iter_next(&udr_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/src/upf/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/src/upf/context.c
Changed
@@ -130,6 +130,7 @@ int rv; yaml_document_t *document = NULL; ogs_yaml_iter_t root_iter; + int idx = 0; document = ogs_app()->document; ogs_assert(document); @@ -141,7 +142,8 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "upf")) { + if ((!strcmp(root_key, "upf")) && + (idx++ == ogs_app()->config_section_id)) { ogs_yaml_iter_t upf_iter; ogs_yaml_iter_recurse(&root_iter, &upf_iter); while (ogs_yaml_iter_next(&upf_iter)) {
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/app/5gc-init.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/app/5gc-init.c
Changed
@@ -19,18 +19,55 @@ #include "test-app.h" +/* If want to increase this number, check and modify run_threads() function + * for static integer to string conversion */ +#define OGS_MAX_NF_INSTANCES 4 + static ogs_thread_t *nrf_thread = NULL; static ogs_thread_t *scp_thread = NULL; static ogs_thread_t *sepp_thread = NULL; -static ogs_thread_t *upf_thread = NULL; -static ogs_thread_t *smf_thread = NULL; -static ogs_thread_t *amf_thread = NULL; -static ogs_thread_t *ausf_thread = NULL; -static ogs_thread_t *udm_thread = NULL; -static ogs_thread_t *pcf_thread = NULL; -static ogs_thread_t *nssf_thread = NULL; -static ogs_thread_t *bsf_thread = NULL; -static ogs_thread_t *udr_thread = NULL; +static ogs_thread_t *upf_threadsOGS_MAX_NF_INSTANCES = { NULL }; +static ogs_thread_t *smf_threadsOGS_MAX_NF_INSTANCES = { NULL }; +static ogs_thread_t *amf_threadsOGS_MAX_NF_INSTANCES = { NULL }; +static ogs_thread_t *ausf_threadsOGS_MAX_NF_INSTANCES = { NULL }; +static ogs_thread_t *udm_threadsOGS_MAX_NF_INSTANCES = { NULL }; +static ogs_thread_t *pcf_threadsOGS_MAX_NF_INSTANCES = { NULL }; +static ogs_thread_t *nssf_threadsOGS_MAX_NF_INSTANCES = { NULL }; +static ogs_thread_t *bsf_threadsOGS_MAX_NF_INSTANCES = { NULL }; +static ogs_thread_t *udr_threadsOGS_MAX_NF_INSTANCES = { NULL }; + + +static void run_threads(const char *nf_name, int count, + const char *argv_out, int argv_out_idx, ogs_thread_t *threads) +{ + int i; + + threads0 = test_child_create(nf_name, argv_out); + + for (i = 1; i < count; i++) { + const char *idx_string = NULL;; + + switch (i) { + case 1: idx_string = "1"; break; + case 2: idx_string = "2"; break; + case 3: idx_string = "3"; break; + default: + idx_string = ogs_msprintf("%d", i); + ogs_warn("Missing static conversion of integer to string"); + break; + } + ogs_assert(idx_string); + + argv_outargv_out_idx + 0 = "-k"; + argv_outargv_out_idx + 1 = idx_string; + argv_outargv_out_idx + 2 = NULL; + + threadsi = test_child_create(nf_name, argv_out); + } + + // reset argv_out and remove the added "-k" parameter + argv_outargv_out_idx = NULL; +} int app_initialize(const char *const argv) { @@ -60,25 +97,32 @@ sepp_thread = test_child_create("sepp", argv_out); if (ogs_global_conf()->parameter.no_upf == 0) - upf_thread = test_child_create("upf", argv_out); + run_threads("upf", ogs_global_conf()->parameter.upf_count, + argv_out, i, upf_threads); if (ogs_global_conf()->parameter.no_smf == 0) - smf_thread = test_child_create("smf", argv_out); - + run_threads("smf", ogs_global_conf()->parameter.smf_count, + argv_out, i, smf_threads); if (ogs_global_conf()->parameter.no_amf == 0) - amf_thread = test_child_create("amf", argv_out); - + run_threads("amf", ogs_global_conf()->parameter.amf_count, + argv_out, i, amf_threads); if (ogs_global_conf()->parameter.no_ausf == 0) - ausf_thread = test_child_create("ausf", argv_out); + run_threads("ausf", ogs_global_conf()->parameter.ausf_count, + argv_out, i, ausf_threads); if (ogs_global_conf()->parameter.no_udm == 0) - udm_thread = test_child_create("udm", argv_out); + run_threads("udm", ogs_global_conf()->parameter.udm_count, + argv_out, i, udm_threads); if (ogs_global_conf()->parameter.no_pcf == 0) - pcf_thread = test_child_create("pcf", argv_out); + run_threads("pcf", ogs_global_conf()->parameter.pcf_count, + argv_out, i, pcf_threads); if (ogs_global_conf()->parameter.no_nssf == 0) - nssf_thread = test_child_create("nssf", argv_out); + run_threads("nssf", ogs_global_conf()->parameter.nssf_count, + argv_out, i, nssf_threads); if (ogs_global_conf()->parameter.no_bsf == 0) - bsf_thread = test_child_create("bsf", argv_out); + run_threads("bsf", ogs_global_conf()->parameter.bsf_count, + argv_out, i, bsf_threads); if (ogs_global_conf()->parameter.no_udr == 0) - udr_thread = test_child_create("udr", argv_out); + run_threads("udr", ogs_global_conf()->parameter.udr_count, + argv_out, i, udr_threads); /* * Wait for all sockets listening @@ -87,22 +131,33 @@ */ ogs_msleep(1000); - return OGS_OK;; + return OGS_OK; } void app_terminate(void) { - if (amf_thread) ogs_thread_destroy(amf_thread); + int i; - if (smf_thread) ogs_thread_destroy(smf_thread); - if (upf_thread) ogs_thread_destroy(upf_thread); - - if (udr_thread) ogs_thread_destroy(udr_thread); - if (nssf_thread) ogs_thread_destroy(nssf_thread); - if (bsf_thread) ogs_thread_destroy(bsf_thread); - if (pcf_thread) ogs_thread_destroy(pcf_thread); - if (udm_thread) ogs_thread_destroy(udm_thread); - if (ausf_thread) ogs_thread_destroy(ausf_thread); + for (i = 0; i < OGS_MAX_NF_INSTANCES; i++) { + if (amf_threadsi) + ogs_thread_destroy(amf_threadsi); + if (smf_threadsi) + ogs_thread_destroy(smf_threadsi); + if (upf_threadsi) + ogs_thread_destroy(upf_threadsi); + if (udr_threadsi) + ogs_thread_destroy(udr_threadsi); + if (nssf_threadsi) + ogs_thread_destroy(nssf_threadsi); + if (bsf_threadsi) + ogs_thread_destroy(bsf_threadsi); + if (pcf_threadsi) + ogs_thread_destroy(pcf_threadsi); + if (udm_threadsi) + ogs_thread_destroy(udm_threadsi); + if (ausf_threadsi) + ogs_thread_destroy(ausf_threadsi); + } if (sepp_thread) ogs_thread_destroy(sepp_thread); if (scp_thread) ogs_thread_destroy(scp_thread);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/app/app-init.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/app/app-init.c
Changed
@@ -103,7 +103,7 @@ */ ogs_msleep(5000); - return OGS_OK;; + return OGS_OK; } void app_terminate(void)
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/common/application.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/common/application.c
Changed
@@ -77,7 +77,7 @@ ogs_assert(rv == OGS_OK); } -#define MAX_CHILD_PROCESS 16 +#define MAX_CHILD_PROCESS 32 #define OGS_ARG_MAX 256 static ogs_proc_t processMAX_CHILD_PROCESS; @@ -92,6 +92,12 @@ int ret = 0, out_return_code = 0; current = &processprocess_num++; + + if (process_num > MAX_CHILD_PROCESS) { + ogs_fatal("Process limit reached"); + ogs_assert_if_reached(); + } + ret = ogs_proc_create(commandLine, ogs_proc_option_combined_stdout_stderr| ogs_proc_option_inherit_environment, @@ -132,6 +138,7 @@ commandLine0 = command; child = ogs_thread_create(child_main, commandLine); + ogs_msleep(50); return child;
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/common/context.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/common/context.c
Changed
@@ -104,9 +104,19 @@ if (snode) test_self()->s1ap_addr6 = snode->addr; snode = ogs_list_first(&test_self()->ngap_list); - if (snode) test_self()->ngap_addr = snode->addr; + + if (snode) { + test_self()->ngap_addr = snode->addr; + snode = ogs_list_next(snode); + } + if (snode) test_self()->ngap2_addr = snode->addr; + snode = ogs_list_first(&test_self()->ngap_list6); - if (snode) test_self()->ngap_addr6 = snode->addr; + if (snode) { + test_self()->ngap_addr6 = snode->addr; + snode = ogs_list_next(snode); + } + if (snode) test_self()->ngap2_addr6 = snode->addr; if (test_self()->e_served_taiindex.list2.num) { memcpy(&test_self()->e_tai, @@ -175,6 +185,7 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); + if (!strcmp(root_key, "amf")) { ogs_yaml_iter_t amf_iter; ogs_yaml_iter_recurse(&root_iter, &amf_iter);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/common/context.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/common/context.h
Changed
@@ -48,7 +48,9 @@ ogs_list_t ngap_list; /* AMF NGAP IPv4 Server List */ ogs_list_t ngap_list6; /* AMF NGAP IPv6 Server List */ ogs_sockaddr_t *ngap_addr; /* AMF NGAP IPv4 Address */ + ogs_sockaddr_t *ngap2_addr; /* OLD AMF NGAP IPv4 Address */ ogs_sockaddr_t *ngap_addr6; /* AMF NGAP IPv6 Address */ + ogs_sockaddr_t *ngap2_addr6; /* OLD AMF NGAP IPv6 Address */ uint16_t s1ap_port; /* Default S1AP Port */ ogs_list_t s1ap_list; /* MME S1AP IPv4 Server List */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/common/sctp.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/common/sctp.c
Changed
@@ -91,19 +91,30 @@ return node; } -ogs_socknode_t *testngap_client(int family) +ogs_socknode_t *testngap_client(int index, int family) { int rv; ogs_sockaddr_t *addr = NULL; ogs_socknode_t *node = NULL; ogs_sock_t *sock = NULL; - if (family == AF_INET6) - ogs_assert(OGS_OK == - ogs_copyaddrinfo(&addr, test_self()->ngap_addr6)); - else - ogs_assert(OGS_OK == - ogs_copyaddrinfo(&addr, test_self()->ngap_addr)); + if (index == 1) { + if (family == AF_INET6) + ogs_assert(OGS_OK == + ogs_copyaddrinfo(&addr, test_self()->ngap_addr6)); + else + ogs_assert(OGS_OK == + ogs_copyaddrinfo(&addr, test_self()->ngap_addr)); + + } else if (index == 2) { + if (family == AF_INET6) + ogs_assert(OGS_OK == + ogs_copyaddrinfo(&addr, test_self()->ngap2_addr6)); + else + ogs_assert(OGS_OK == + ogs_copyaddrinfo(&addr, test_self()->ngap2_addr)); + } else + ogs_assert_if_reached(); ogs_assert(addr);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/common/sctp.h -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/common/sctp.h
Changed
@@ -29,7 +29,7 @@ ogs_socknode_t *testsctp_server(const char *ipstr, int port); ogs_socknode_t *testsctp_client(const char *ipstr, int port); ogs_socknode_t *tests1ap_client(int family); -ogs_socknode_t *testngap_client(int family); +ogs_socknode_t *testngap_client(int index, int family); int testsctp_send(ogs_socknode_t *node, ogs_pkbuf_t *pkbuf, int ppid, uint16_t stream_no, int type);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/handover/5gc-n2-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/handover/5gc-n2-test.c
Changed
@@ -70,10 +70,10 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ - ngap1 = testngap_client(AF_INET); + ngap1 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap1); - ngap2 = testngap_client(AF_INET); + ngap2 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap2); /* Two gNB connects to UPF */ @@ -501,10 +501,10 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ - ngap1 = testngap_client(AF_INET); + ngap1 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap1); - ngap2 = testngap_client(AF_INET); + ngap2 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap2); /* Two gNB connects to UPF */ @@ -1115,10 +1115,10 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ - ngap1 = testngap_client(AF_INET); + ngap1 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap1); - ngap2 = testngap_client(AF_INET); + ngap2 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap2); /* Two gNB connects to UPF */ @@ -1529,10 +1529,10 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ - ngap1 = testngap_client(AF_INET); + ngap1 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap1); - ngap2 = testngap_client(AF_INET); + ngap2 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap2); /* Two gNB connects to UPF */ @@ -2182,10 +2182,10 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ - ngap1 = testngap_client(AF_INET); + ngap1 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap1); - ngap2 = testngap_client(AF_INET); + ngap2 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap2); /* Two gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/handover/5gc-xn-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/handover/5gc-xn-test.c
Changed
@@ -70,10 +70,10 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ - ngap1 = testngap_client(AF_INET); + ngap1 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap1); - ngap2 = testngap_client(AF_INET); + ngap2 = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap2); /* Two gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/meson.build -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/meson.build
Changed
@@ -33,3 +33,4 @@ subdir('310014') subdir('handover') subdir('non3gpp') +subdir('transfer')
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/non3gpp/diameter-s6b-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/non3gpp/diameter-s6b-path.c
Changed
@@ -178,9 +178,9 @@ ogs_assert(ret == 0); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) ==0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) ==0); return 0; @@ -278,9 +278,9 @@ ogs_assert(ret == 0); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) ==0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) ==0); return 0;
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/non3gpp/diameter-swx-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/non3gpp/diameter-swx-path.c
Changed
@@ -273,9 +273,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } /* Callback for incoming Multimedia-Auth-Answer messages */ @@ -358,30 +358,30 @@ ogs_assert(err && !exp_err && result_code == ER_DIAMETER_SUCCESS); /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -525,9 +525,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } /* Callback for incoming Server-Assignment-Answer messages */ @@ -618,30 +618,30 @@ ogs_assert(err && !exp_err && result_code == ER_DIAMETER_SUCCESS); /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec)
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/auth-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/auth-test.c
Changed
@@ -64,7 +64,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -254,7 +254,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/crash-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/crash-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -426,7 +426,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -787,7 +787,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1045,7 +1045,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1409,7 +1409,7 @@ ogs_pkbuf_t *recvbuf; ogs_ngap_message_t message; - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); sendbuf = testngap_build_ng_setup_request(0x4000, 22);
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/dereg-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/dereg-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -306,7 +306,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -513,7 +513,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -963,7 +963,7 @@ ogs_assert(sess); /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1254,7 +1254,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1630,7 +1630,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/ecc-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/ecc-test.c
Changed
@@ -71,7 +71,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -276,7 +276,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -496,7 +496,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -702,7 +702,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/gmm-status-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/gmm-status-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/guti-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/guti-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -539,8 +539,8 @@ test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; - /* gNB connects to AMF(default configuration) */ - ngap = testngap_client(AF_INET); + /* gNB connects to AMF */ + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -997,7 +997,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1269,7 +1269,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/identity-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/identity-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -401,7 +401,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/idle-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/idle-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -456,7 +456,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -699,7 +699,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1052,7 +1052,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1503,7 +1503,7 @@ ogs_assert(sess); /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1857,7 +1857,7 @@ ogs_assert(sess); /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/multi-ue-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/multi-ue-test.c
Changed
@@ -42,7 +42,7 @@ bson_t *doc = NULL; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/reset-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/reset-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -372,7 +372,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -632,7 +632,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/simple-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/simple-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/registration/ue-context-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/registration/ue-context-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -221,7 +221,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -534,7 +534,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -977,7 +977,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1347,7 +1347,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/slice/different-dnn-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/slice/different-dnn-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/slice/paging-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/slice/paging-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -626,7 +626,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -980,7 +980,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1322,7 +1322,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1596,7 +1596,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1953,7 +1953,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -2350,7 +2350,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -2841,7 +2841,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -3234,7 +3234,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/slice/same-dnn-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/slice/same-dnn-test.c
Changed
@@ -65,7 +65,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -366,7 +366,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/transfer
Added
+(directory)
View file
open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/transfer/abts-main.c
Added
@@ -0,0 +1,66 @@ +/* + * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "test-app.h" + +abts_suite * test_ue_context_transfer(abts_suite *suite); + +const struct testlist { + abts_suite *(*func)(abts_suite *suite); +} alltests = { + {test_ue_context_transfer}, + {NULL}, +}; + +static void terminate(void) +{ + ogs_msleep(50); + + test_child_terminate(); + app_terminate(); + + test_5gc_final(); + ogs_app_terminate(); +} + +static void initialize(const char *const argv) +{ + int rv; + + rv = ogs_app_initialize(NULL, NULL, argv); + ogs_assert(rv == OGS_OK); + test_5gc_init(); + + rv = app_initialize(argv); + ogs_assert(rv == OGS_OK); +} + +int main(int argc, const char *const argv) +{ + int i; + abts_suite *suite = NULL; + + atexit(terminate); + test_app_run(argc, argv, "transfer.yaml", initialize); + + for (i = 0; alltestsi.func; i++) + suite = alltestsi.func(suite); + + return abts_report(suite); +}
View file
open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/transfer/meson.build
Added
@@ -0,0 +1,28 @@ +# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +testapp_transfer_sources = files(''' + abts-main.c + ue-context-transfer-test.c +'''.split()) + +testapp_transfer_exe = executable('transfer', + sources : testapp_transfer_sources, + c_args : testunit_core_cc_flags, + dependencies : libtest5gc_dep) + +test('transfer', testapp_transfer_exe, is_parallel : false, suite: '5gc')
View file
open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/transfer/ue-context-transfer-test.c
Added
@@ -0,0 +1,3117 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "test-common.h" + +static void test1_func(abts_case *tc, void *data) +{ + int rv; + ogs_socknode_t *ngap1, *ngap2; /* ngap1 - Old AMF ; ngap2 - Target AMF */ + ogs_socknode_t *gtpu1, *gtpu2; + ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; + ogs_pkbuf_t *nasbuf; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + ogs_pkbuf_t *recvbuf_target; + ogs_ngap_message_t message; + int i; + + uint8_t tmpOGS_HUGE_LEN; + char *_gtp_payload = "34ff0024" + "0000000100000085 010002004500001c 0c0b000040015a7a 0a2d00010a2d0002" + "00000964cd7c291f"; + + /* Test: 1 UE, Old AMF, Target AMF, + * register to Old AMF, PDU session establishment, session release, deregister, + * register to Target AMF with empty 5G GUTI, identity request and response, + * NO UE context transfer, NO Registration status update, + * PDU session establishment, session release, deregister */ + + #define NUM_OF_TEST_UE_1 1 + + ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci; + test_ue_t *test_ueNUM_OF_TEST_UE_1; + test_ue_t *test_ue_targetNUM_OF_TEST_UE_1; + test_sess_t *sess = NULL; + test_bearer_t *qos_flow = NULL; + + bson_t *doc = NULL; + + /* First gNB connects to Target AMF */ + ngap2 = testngap_client(2, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap2); + + /* Second gNB connects to Old AMF */ + ngap1 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap1); + + /* Two gNB connects to UPF */ + gtpu1 = test_gtpu_server(1, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu1); + + gtpu2 = test_gtpu_server(2, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu2); + + /* NG-Setup Reqeust/Response for Source gNB */ + sendbuf = testngap_build_ng_setup_request(0x4000, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* NG-Setup Reqeust/Response for Target gNB */ + sendbuf = testngap_build_ng_setup_request(0x4001, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf_target = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_target, recvbuf_target); + + /* Register to Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_uei = test_ue_add_by_suci( + &mobile_identity_suci, scheme_outputi); + ogs_assert(test_uei); + + test_uei->nr_cgi.cell_id = 0x40001; + + test_uei->nas.registration.tsc = 0; + test_uei->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_uei->nas.registration.follow_on_request = 1; + test_uei->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_uei->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_uei->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_uei->ran_ue_ngap_id = test_uei-1->ran_ue_ngap_id; + else + test_uei->ran_ue_ngap_id = 0; + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_uei, "internet", 5); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_uei); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_uei, doc)); + + /* Send Registration request */ + test_uei->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_uei->registration_request_param.gmm_capability = 1; + test_uei->registration_request_param.s1_ue_network_capability = 1; + test_uei->registration_request_param.requested_nssai = 1; + test_uei->registration_request_param.last_visited_registered_tai = 1; + test_uei->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_uei, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Identity request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_uei, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_uei->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_uei, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_uei, 5); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + /* Stay registered on Old AMF */ +#if 0 + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_uei, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_uei->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_uei)); + } + + /* Clear Test UE Context */ + test_ue_remove_all(); +#endif + + ogs_msleep(100); + + /* Register to Target AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output_target = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_ue_targeti = test_ue_add_by_suci( + &mobile_identity_suci, scheme_output_targeti); + ogs_assert(test_ue_targeti); + + test_ue_targeti->nr_cgi.cell_id = 0x40000; + + test_ue_targeti->nas.registration.tsc = 0; + test_ue_targeti->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_ue_targeti->nas.registration.follow_on_request = 1; + test_ue_targeti->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_ue_targeti->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue_targeti->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_ue_targeti->ran_ue_ngap_id = test_ue_targeti-1->ran_ue_ngap_id; + else + test_ue_targeti->ran_ue_ngap_id = 0; + + /* Send PDU session establishment request */ + // sess = test_sess_add_by_dnn_and_psi(test_uei, "internet", 5); + sess = test_sess_add_by_dnn_and_psi(test_ue_targeti, "internet", 6); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue_targeti, doc)); + + /* Send Registration request */ + test_ue_targeti->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_ue_targeti->registration_request_param.gmm_capability = 1; + test_ue_targeti->registration_request_param.s1_ue_network_capability = 1; + test_ue_targeti->registration_request_param.requested_nssai = 1; + test_ue_targeti->registration_request_param.last_visited_registered_tai = 1; + test_ue_targeti->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_ue_targeti, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Identity request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Authentication request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_ue_targeti, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_ue_targeti->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_ue_targeti, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_ue_targeti->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_ue_targeti, 6); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_ue_targeti, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue_targeti)); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_uei)); + } + + /* Clear Test UE Context */ + test_ue_remove_all(); + + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu2); + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu1); + + /* gNB disonncect from Target AMF */ + testgnb_ngap_close(ngap2); + /* gNB disonncect from Old AMF */ + testgnb_ngap_close(ngap1); + +} + +static void test2_func(abts_case *tc, void *data) +{ + int rv; + ogs_socknode_t *ngap1, *ngap2; + ogs_socknode_t *gtpu1, *gtpu2; + ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; + ogs_pkbuf_t *nasbuf; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + ogs_pkbuf_t *recvbuf_target; + ogs_ngap_message_t message; + int i; + + uint8_t tmpOGS_HUGE_LEN; + char *_gtp_payload = "34ff0024" + "0000000100000085 010002004500001c 0c0b000040015a7a 0a2d00010a2d0002" + "00000964cd7c291f"; + + #define NUM_OF_TEST_UE_1 1 + + /* Test: 1 UE, Old AMF, Target AMF, + * register to Old AMF, PDU session establishment, session release, deregister, + * register to Target AMF with Old AMF's 5G GUTI, + * UE context transfer, Registration status update + * PDU session establishment, session release, deregister */ + + ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci; + test_ue_t *test_ueNUM_OF_TEST_UE_1; + test_ue_t *test_ue_targetNUM_OF_TEST_UE_1; + test_sess_t *sess = NULL; + test_bearer_t *qos_flow = NULL; + + bson_t *doc = NULL; + + /* First gNB connects to Target AMF */ + ngap2 = testngap_client(2, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap2); + + /* Second gNB connects to Old AMF */ + ngap1 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap1); + + /* Two gNB connects to UPF */ + gtpu1 = test_gtpu_server(1, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu1); + + gtpu2 = test_gtpu_server(2, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu2); + + /* NG-Setup Reqeust/Response for Target gNB - with Target AMF */ + sendbuf = testngap_build_ng_setup_request(0x4000, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* NG-Setup Reqeust/Response for Source gNB - with Old AMF */ + sendbuf = testngap_build_ng_setup_request(0x4001, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf_target = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue, recvbuf_target); + + /* Register to Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_uei = test_ue_add_by_suci( + &mobile_identity_suci, scheme_outputi); + ogs_assert(test_uei); + + test_uei->nr_cgi.cell_id = 0x40001; + + test_uei->nas.registration.tsc = 0; + test_uei->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_uei->nas.registration.follow_on_request = 1; + test_uei->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_uei->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_uei->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_uei->ran_ue_ngap_id = test_uei-1->ran_ue_ngap_id; + else + test_uei->ran_ue_ngap_id = 0; + + /* pdu_id == 5 */ + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_uei, "internet", 5); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_uei); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_uei, doc)); + + /* Send Registration request - with SUCI */ + // test_uei->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_uei->registration_request_param.gmm_capability = 1; + test_uei->registration_request_param.s1_ue_network_capability = 1; + test_uei->registration_request_param.requested_nssai = 1; + test_uei->registration_request_param.last_visited_registered_tai = 1; + test_uei->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_uei, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + +#if 0 + /* Receive Identity request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_uei, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_uei->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_uei, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_uei, 5); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_uei, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_uei->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + /* Register to Target AMF */ + + /* Make the same UE from scratch and give it the 5G GUTI from Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output_target = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_ue_targeti = test_ue_add_by_suci( + &mobile_identity_suci, scheme_output_targeti); + ogs_assert(test_ue_targeti); + + test_ue_targeti->nr_cgi.cell_id = 0x40000; + + test_ue_targeti->nas.registration.tsc = 0; + test_ue_targeti->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_ue_targeti->nas.registration.follow_on_request = 1; + test_ue_targeti->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_ue_targeti->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue_targeti->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_ue_targeti->ran_ue_ngap_id = test_ue_targeti-1->ran_ue_ngap_id; + else + test_ue_targeti->ran_ue_ngap_id = 0; + + /* pdu_id == 6 */ + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_ue_targeti, "internet", 6); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue_targeti, doc)); + + /* Set the 5G GUTI to Old AMF's 5G GUTI */ + test_ue_targeti->nas_5gs_guti = test_uei->nas_5gs_guti; + + /* Send Registration request */ + test_ue_targeti->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_ue_targeti->registration_request_param.gmm_capability = 1; + test_ue_targeti->registration_request_param.s1_ue_network_capability = 1; + test_ue_targeti->registration_request_param.requested_nssai = 1; + test_ue_targeti->registration_request_param.last_visited_registered_tai = 1; + test_ue_targeti->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_ue_targeti, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + +#if 0 + /* Receive Identity request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif + + /* Receive Authentication request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_ue_targeti, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_ue_targeti->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_ue_targeti, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_ue_targeti->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_ue_targeti, 6); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_ue_targeti, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue_targeti)); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_uei)); + } + + /* Clear Test UE Context */ + test_ue_remove_all(); + + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu2); + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu1); + + /* gNB disonncect from Target AMF */ + testgnb_ngap_close(ngap2); + /* gNB disonncect from Old AMF */ + testgnb_ngap_close(ngap1); +} + +static void test23_func(abts_case *tc, void *data) +{ + int rv; + ogs_socknode_t *ngap1, *ngap2; + ogs_socknode_t *gtpu1, *gtpu2; + ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; + ogs_pkbuf_t *nasbuf; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + ogs_pkbuf_t *recvbuf_target; + ogs_ngap_message_t message; + int i,j; + + uint8_t tmpOGS_HUGE_LEN; + char *_gtp_payload = "34ff0024" + "0000000100000085 010002004500001c 0c0b000040015a7a 0a2d00010a2d0002" + "00000964cd7c291f"; + + #define NUM_OF_TEST_UE_3 3 + + /* Test: same test as the previous one, now 3 UEs are registered, one after another */ + + ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci; + test_ue_t *test_ueNUM_OF_TEST_UE_3; + test_ue_t *test_ue_targetNUM_OF_TEST_UE_3; + test_sess_t *sess = NULL; + test_bearer_t *qos_flow = NULL; + + bson_t *doc = NULL; + + /* First gNB connects to Target AMF */ + ngap2 = testngap_client(2, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap2); + + /* Second gNB connects to Old AMF */ + ngap1 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap1); + + /* Two gNB connects to UPF */ + gtpu1 = test_gtpu_server(1, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu1); + + gtpu2 = test_gtpu_server(2, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu2); + + /* NG-Setup Reqeust/Response for Target gNB - with Target AMF */ + sendbuf = testngap_build_ng_setup_request(0x4000, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* NG-Setup Reqeust/Response for Source gNB - with Old AMF */ + sendbuf = testngap_build_ng_setup_request(0x4001, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf_target = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue, recvbuf_target); + + for (j = 0; j < 3; j++) { + + /* Register to Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + const char *scheme_output = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_uei = test_ue_add_by_suci( + &mobile_identity_suci, scheme_outputi); + ogs_assert(test_uei); + + test_uei->nr_cgi.cell_id = 0x40001; + + test_uei->nas.registration.tsc = 0; + test_uei->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_uei->nas.registration.follow_on_request = 1; + test_uei->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_uei->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_uei->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + if (i > 0) + test_uei->ran_ue_ngap_id = test_uei-1->ran_ue_ngap_id; + else + test_uei->ran_ue_ngap_id = 0; + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_uei, "internet", 5); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_uei); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_uei, doc)); + + /* Send Registration request - with SUCI */ + // test_uei->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_uei->registration_request_param.gmm_capability = 1; + test_uei->registration_request_param.s1_ue_network_capability = 1; + test_uei->registration_request_param.requested_nssai = 1; + test_uei->registration_request_param.last_visited_registered_tai = 1; + test_uei->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_uei, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + +#if 0 + /* Receive Identity request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_uei, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_uei->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_uei, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_uei, 5); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_uei, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_uei->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + /* Register to Target AMF */ + + /* Make the same UE from scratch and give it the 5G GUTI from Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + const char *scheme_output_target = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_ue_targeti = test_ue_add_by_suci( + &mobile_identity_suci, scheme_output_targeti); + ogs_assert(test_ue_targeti); + + test_ue_targeti->nr_cgi.cell_id = 0x40000; + + test_ue_targeti->nas.registration.tsc = 0; + test_ue_targeti->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_ue_targeti->nas.registration.follow_on_request = 1; + test_ue_targeti->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_ue_targeti->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue_targeti->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + if (i > 0) + test_ue_targeti->ran_ue_ngap_id = test_ue_targeti-1->ran_ue_ngap_id; + else + test_ue_targeti->ran_ue_ngap_id = 0; + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_ue_targeti, "internet", 6); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue_targeti, doc)); + + /* Set the 5G GUTI to Old AMF's 5G GUTI */ + test_ue_targeti->nas_5gs_guti = test_uei->nas_5gs_guti; + + /* Send Registration request */ + test_ue_targeti->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_ue_targeti->registration_request_param.gmm_capability = 1; + test_ue_targeti->registration_request_param.s1_ue_network_capability = 1; + test_ue_targeti->registration_request_param.requested_nssai = 1; + test_ue_targeti->registration_request_param.last_visited_registered_tai = 1; + test_ue_targeti->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_ue_targeti, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + +#if 0 + /* Receive Identity request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif + + /* Receive Authentication request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_ue_targeti, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_ue_targeti->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_ue_targeti, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_ue_targeti->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_ue_targeti, 6); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_ue_targeti, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue_targeti)); + } + + for (i = 0; i < NUM_OF_TEST_UE_3; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_uei)); + } + } + + /* Clear Test UE Context */ + test_ue_remove_all(); + + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu2); + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu1); + + /* gNB disonncect from Target AMF */ + testgnb_ngap_close(ngap2); + /* gNB disonncect from Old AMF */ + testgnb_ngap_close(ngap1); +} + +static void test3_func(abts_case *tc, void *data) +{ + int rv; + ogs_socknode_t *ngap1, *ngap2; + ogs_socknode_t *gtpu1, *gtpu2; + ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; + ogs_pkbuf_t *nasbuf; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + ogs_pkbuf_t *recvbuf_target; + ogs_ngap_message_t message; + int i; + + uint8_t tmpOGS_HUGE_LEN; + char *_gtp_payload = "34ff0024" + "0000000100000085 010002004500001c 0c0b000040015a7a 0a2d00010a2d0002" + "00000964cd7c291f"; + + /* Test: 1 UE, Old AMF, Target AMF, + * register to Old AMF, PDU session establishment, session release, (stay registered) + * register to Target AMF with Old AMF's 5G GUTI, + * UE context transfer, Registration status update + * PDU session establishment, session release, deregister */ + + #define NUM_OF_TEST_UE_1 1 + + ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci; + test_ue_t *test_ueNUM_OF_TEST_UE_1; + test_ue_t *test_ue_targetNUM_OF_TEST_UE_1; + test_sess_t *sess = NULL; + test_bearer_t *qos_flow = NULL; + + bson_t *doc = NULL; + + /* First gNB connects to Target AMF */ + ngap2 = testngap_client(2, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap2); + + /* Second gNB connects to Old AMF */ + ngap1 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap1); + + /* Two gNB connects to UPF */ + gtpu1 = test_gtpu_server(1, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu1); + + gtpu2 = test_gtpu_server(2, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu2); + + /* NG-Setup Reqeust/Response for Target gNB - with Target AMF */ + sendbuf = testngap_build_ng_setup_request(0x4000, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* NG-Setup Reqeust/Response for Source gNB - with Old AMF */ + sendbuf = testngap_build_ng_setup_request(0x4001, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf_target = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue, recvbuf_target); + + /* Register to Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_uei = test_ue_add_by_suci( + &mobile_identity_suci, scheme_outputi); + ogs_assert(test_uei); + + test_uei->nr_cgi.cell_id = 0x40001; + + test_uei->nas.registration.tsc = 0; + test_uei->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_uei->nas.registration.follow_on_request = 1; + test_uei->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_uei->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_uei->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_uei->ran_ue_ngap_id = test_uei-1->ran_ue_ngap_id; + else + test_uei->ran_ue_ngap_id = 0; + + /* pdu_id == 5 */ + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_uei, "internet", 5); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_uei); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_uei, doc)); + + /* Send Registration request - with SUCI */ + // test_uei->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_uei->registration_request_param.gmm_capability = 1; + test_uei->registration_request_param.s1_ue_network_capability = 1; + test_uei->registration_request_param.requested_nssai = 1; + test_uei->registration_request_param.last_visited_registered_tai = 1; + test_uei->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_uei, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + +#if 0 + /* Receive Identity request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_uei, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_uei->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_uei, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + /* Stay registered on Old AMF, with active session ? + * - This scenario should be made with "Inter NG-RAN node N2 based handover" beforehand, + * but then the UE context transfer is skipped during the registartion + * TS 23.502, 4.9.1.3.3, step 12 + */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_uei, 5); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + +#if 0 + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_uei, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_uei->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_uei)); + } + + /* Clear Test UE Context */ + test_ue_remove_all(); +#endif + + ogs_msleep(100); + + /* Register to Target AMF */ + + /* Make the same subscriber from scratch and give him the 5G GUTI from Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output_target = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_ue_targeti = test_ue_add_by_suci( + &mobile_identity_suci, scheme_output_targeti); + ogs_assert(test_ue_targeti); + + /* Different cell id */ + test_ue_targeti->nr_cgi.cell_id = 0x40000; + + test_ue_targeti->nas.registration.tsc = 0; + test_ue_targeti->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_ue_targeti->nas.registration.follow_on_request = 1; + /* Mobility registration update */ + test_ue_targeti->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_MOBILITY_UPDATING; + + test_ue_targeti->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue_targeti->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_ue_targeti->ran_ue_ngap_id = test_ue_targeti-1->ran_ue_ngap_id; + else + test_ue_targeti->ran_ue_ngap_id = 0; + + /* pdu_id == 5 */ + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_ue_targeti, "internet", 5); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue_targeti, doc)); + + /* Set the 5G GUTI to Old AMF's 5G GUTI */ + test_ue_targeti->nas_5gs_guti = test_uei->nas_5gs_guti; + + /* Send Registration request */ + test_ue_targeti->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_ue_targeti->registration_request_param.gmm_capability = 1; + test_ue_targeti->registration_request_param.s1_ue_network_capability = 1; + test_ue_targeti->registration_request_param.requested_nssai = 1; + test_ue_targeti->registration_request_param.last_visited_registered_tai = 1; + test_ue_targeti->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_ue_targeti, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + +#if 0 + /* Receive Identity request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif + + /* Receive Authentication request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_ue_targeti, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_ue_targeti->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_ue_targeti, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_ue_targeti->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_ue_targeti, 5); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_ue_targeti, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue_targeti)); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_uei)); + } + + /* Clear Test UE Context */ + test_ue_remove_all(); + + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu2); + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu1); + + /* gNB disonncect from Target AMF */ + testgnb_ngap_close(ngap2); + /* gNB disonncect from Old AMF */ + testgnb_ngap_close(ngap1); +} + +static void test4_func(abts_case *tc, void *data) +{ + int rv; + ogs_socknode_t *ngap1, *ngap2; + ogs_socknode_t *gtpu1, *gtpu2; + ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; + ogs_pkbuf_t *nasbuf; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + ogs_pkbuf_t *recvbuf_target; + ogs_ngap_message_t message; + int i; + + uint8_t tmpOGS_HUGE_LEN; + char *_gtp_payload = "34ff0024" + "0000000100000085 010002004500001c 0c0b000040015a7a 0a2d00010a2d0002" + "00000964cd7c291f"; + + #define NUM_OF_TEST_UE_1 1 + + /* Test: 1 UE, Old AMF, Target AMF, register to Old AMF, register to Target AMF + * with Old AMF's 5G GUTI - AUTH FAIL, + * UE context transfer, Registration status update - NOT TRANSFERRED + * The old AMF continues + * as if the UE context transfer service operation was never received */ + + ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci; + test_ue_t *test_ueNUM_OF_TEST_UE_1; + test_ue_t *test_ue_targetNUM_OF_TEST_UE_1; + test_sess_t *sess = NULL; + test_bearer_t *qos_flow = NULL; + + bson_t *doc = NULL; + + /* First gNB connects to Target AMF */ + ngap2 = testngap_client(2, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap2); + + /* Second gNB connects to Old AMF */ + ngap1 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap1); + + /* Two gNB connects to UPF */ + gtpu1 = test_gtpu_server(1, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu1); + + gtpu2 = test_gtpu_server(2, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu2); + + /* NG-Setup Reqeust/Response for Target gNB - with Target AMF */ + sendbuf = testngap_build_ng_setup_request(0x4000, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* NG-Setup Reqeust/Response for Source gNB - with Old AMF */ + sendbuf = testngap_build_ng_setup_request(0x4001, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf_target = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue, recvbuf_target); + + + /* Register to Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_uei = test_ue_add_by_suci( + &mobile_identity_suci, scheme_outputi); + ogs_assert(test_uei); + + test_uei->nr_cgi.cell_id = 0x40001; + + test_uei->nas.registration.tsc = 0; + test_uei->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_uei->nas.registration.follow_on_request = 1; + test_uei->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_uei->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_uei->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_uei->ran_ue_ngap_id = test_uei-1->ran_ue_ngap_id; + else + test_uei->ran_ue_ngap_id = 0; + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_uei, "internet", 5); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_uei); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_uei, doc)); + + /* Send Registration request - with SUCI */ + // test_uei->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_uei->registration_request_param.gmm_capability = 1; + test_uei->registration_request_param.s1_ue_network_capability = 1; + test_uei->registration_request_param.requested_nssai = 1; + test_uei->registration_request_param.last_visited_registered_tai = 1; + test_uei->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_uei, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + +#if 0 + /* Receive Identity request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_uei, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_uei->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_uei, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1; + + gsmbuf = testgsm_build_pdu_session_establishment_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceSetupRequest + + * DL NAS transport + + * PDU session establishment accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceSetup, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceSetupResponse */ + sendbuf = testngap_sess_build_pdu_session_resource_setup_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send PDU session release request */ + sess = test_sess_find_by_psi(test_uei, 5); + ogs_assert(sess); + + /* Send PDU Session release request */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_request(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive PDUSessionResourceReleaseCommand + + * DL NAS transport + + * PDU session release command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_PDUSessionResourceRelease, + test_uei->ngap_procedure_code); + + /* Send PDUSessionResourceReleaseResponse */ + sendbuf = testngap_build_pdu_session_resource_release_response(sess); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send UplinkNASTransport + + * UL NAS trasnport + + * PDU session resource release complete */ + sess->ul_nas_transport_param.request_type = 0; + sess->ul_nas_transport_param.dnn = 0; + sess->ul_nas_transport_param.s_nssai = 0; + + sess->pdu_session_establishment_param.ssc_mode = 0; + sess->pdu_session_establishment_param.epco = 0; + + gsmbuf = testgsm_build_pdu_session_release_complete(sess); + ABTS_PTR_NOTNULL(tc, gsmbuf); + gmmbuf = testgmm_build_ul_nas_transport(sess, + OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /* Send De-registration request */ + gmmbuf = testgmm_build_de_registration_request(test_uei, 1, true, true); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive UEContextReleaseCommand */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_uei->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_uei); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + /* Register to Target AMF */ + + /* Make the same UE from scratch and give it the 5G GUTI from Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output_target = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_ue_targeti = test_ue_add_by_suci( + &mobile_identity_suci, scheme_output_targeti); + ogs_assert(test_ue_targeti); + + test_ue_targeti->nr_cgi.cell_id = 0x40000; + + test_ue_targeti->nas.registration.tsc = 0; + test_ue_targeti->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_ue_targeti->nas.registration.follow_on_request = 1; + test_ue_targeti->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_ue_targeti->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue_targeti->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_ue_targeti->ran_ue_ngap_id = test_ue_targeti-1->ran_ue_ngap_id; + else + test_ue_targeti->ran_ue_ngap_id = 0; + + /* pdu_id == 6 */ + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_ue_targeti, "internet", 6); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue_targeti, doc)); + + /* Set the 5G GUTI to Old AMF's 5G GUTI */ + test_ue_targeti->nas_5gs_guti = test_uei->nas_5gs_guti; + + /* Send Registration request */ + test_ue_targeti->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_ue_targeti->registration_request_param.gmm_capability = 1; + test_ue_targeti->registration_request_param.s1_ue_network_capability = 1; + test_ue_targeti->registration_request_param.requested_nssai = 1; + test_ue_targeti->registration_request_param.last_visited_registered_tai = 1; + test_ue_targeti->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_ue_targeti, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_ue_targeti, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + +#if 0 + /* Receive Identity request */ + recvbuf_target = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue_targeti, recvbuf_target); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); +#endif + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue_targeti, recvbuf); + + /* Send Authentication failure - SYNCH failure */ + gmmbuf = testgmm_build_authentication_failure( + test_ue_targeti, OGS_5GMM_CAUSE_SYNCH_FAILURE, 0x11223344); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue_targeti, recvbuf); + + /* Send Authentication failure - MAC failure */ + gmmbuf = testgmm_build_authentication_failure( + test_ue_targeti, OGS_5GMM_CAUSE_MAC_FAILURE, 0); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue_targeti, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Authentication reject */ + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue_targeti, recvbuf); + + /* Receive UEContextReleaseCommand */ + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue_targeti, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_UEContextRelease, + test_ue_targeti->ngap_procedure_code); + + /* Send UEContextReleaseComplete */ + sendbuf = testngap_build_ue_context_release_complete(test_ue_targeti); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + } + + ogs_msleep(300); + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue_targeti)); + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + /********** Remove Subscriber in Database */ + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_uei)); + } + + /* Clear Test UE Context */ + test_ue_remove_all(); + + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu2); + /* gNB disonncect from UPF */ + testgnb_gtpu_close(gtpu1); + + /* gNB disonncect from Target AMF */ + testgnb_ngap_close(ngap2); + /* gNB disonncect from Old AMF */ + testgnb_ngap_close(ngap1); +} + +abts_suite *test_ue_context_transfer(abts_suite *suite) +{ + suite = ADD_SUITE(suite) + + abts_run_test(suite, test1_func, NULL); + abts_run_test(suite, test2_func, NULL); + abts_run_test(suite, test23_func, NULL); + abts_run_test(suite, test3_func, NULL); + abts_run_test(suite, test4_func, NULL); + + return suite; +}
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/volte/diameter-cx-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/volte/diameter-cx-path.c
Changed
@@ -210,9 +210,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } /* Callback for incoming User-Authorization-Answer messages */ @@ -300,30 +300,30 @@ ogs_assert(!err && exp_err); /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -531,9 +531,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } /* Callback for incoming Multimedia-Auth-Answer messages */ @@ -621,30 +621,30 @@ ogs_assert(err && !exp_err && result_code == ER_DIAMETER_SUCCESS); /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -814,9 +814,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } /* Callback for incoming Server-Assignment-Answer messages */ @@ -904,30 +904,30 @@ ogs_assert(err && !exp_err && result_code == ER_DIAMETER_SUCCESS); /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -1056,9 +1056,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); ogs_free(public_identity); } @@ -1148,30 +1148,30 @@ ogs_assert(err && !exp_err && result_code == ER_DIAMETER_SUCCESS); /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec)
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/volte/diameter-rx-path.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/volte/diameter-rx-path.c
Changed
@@ -561,9 +561,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Free string memory */ ogs_free(sip_uri); @@ -1239,9 +1239,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Free string memory */ ogs_free(sip_uri); @@ -1646,9 +1646,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Free string memory */ ogs_free(sip_uri); @@ -1745,30 +1745,30 @@ out: /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) @@ -1866,9 +1866,9 @@ ogs_assert(ret == 0); /* Add this value to the stats */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_echoed++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_echoed++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); test_rx_send_str(sid); @@ -1977,9 +1977,9 @@ ogs_assert(ret == 0); /* Increment the counter */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - ogs_diam_logger_self()->stats.nb_sent++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); + ogs_diam_stats_self()->stats.nb_sent++; + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); } static void pcscf_rx_sta_cb(void *data, struct msg **msg) @@ -2073,30 +2073,30 @@ out: /* Free the message */ - ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_lock(&ogs_diam_stats_self()->stats_lock) == 0); dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - if (ogs_diam_logger_self()->stats.nb_recv) { + if (ogs_diam_stats_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * - ogs_diam_logger_self()->stats.nb_recv + dur) / - (ogs_diam_logger_self()->stats.nb_recv + 1); + ogs_diam_stats_self()->stats.avg = (ogs_diam_stats_self()->stats.avg * + ogs_diam_stats_self()->stats.nb_recv + dur) / + (ogs_diam_stats_self()->stats.nb_recv + 1); /* Min, max */ - if (dur < ogs_diam_logger_self()->stats.shortest) - ogs_diam_logger_self()->stats.shortest = dur; - if (dur > ogs_diam_logger_self()->stats.longest) - ogs_diam_logger_self()->stats.longest = dur; + if (dur < ogs_diam_stats_self()->stats.shortest) + ogs_diam_stats_self()->stats.shortest = dur; + if (dur > ogs_diam_stats_self()->stats.longest) + ogs_diam_stats_self()->stats.longest = dur; } else { - ogs_diam_logger_self()->stats.shortest = dur; - ogs_diam_logger_self()->stats.longest = dur; - ogs_diam_logger_self()->stats.avg = dur; + ogs_diam_stats_self()->stats.shortest = dur; + ogs_diam_stats_self()->stats.longest = dur; + ogs_diam_stats_self()->stats.avg = dur; } if (error) - ogs_diam_logger_self()->stats.nb_errs++; + ogs_diam_stats_self()->stats.nb_errs++; else - ogs_diam_logger_self()->stats.nb_recv++; + ogs_diam_stats_self()->stats.nb_recv++; - ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_assert(pthread_mutex_unlock(&ogs_diam_stats_self()->stats_lock) == 0); /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec)
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/vonr/af-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/vonr/af-test.c
Changed
@@ -74,7 +74,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -754,7 +754,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1229,7 +1229,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1684,7 +1684,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -2310,7 +2310,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -3027,7 +3027,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -3564,7 +3564,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -4017,7 +4017,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/vonr/qos-flow-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/vonr/qos-flow-test.c
Changed
@@ -70,7 +70,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -462,7 +462,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/vonr/session-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/vonr/session-test.c
Changed
@@ -70,7 +70,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -549,7 +549,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -978,7 +978,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1393,7 +1393,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -1736,7 +1736,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -2014,7 +2014,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */ @@ -2352,7 +2352,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/vonr/simple-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/vonr/simple-test.c
Changed
@@ -74,7 +74,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
View file
open5gs_2.7.2.4491.deef.202409022026.tar.xz/tests/vonr/video-test.c -> open5gs_2.7.2.4505.4308.202409032026.tar.xz/tests/vonr/video-test.c
Changed
@@ -74,7 +74,7 @@ test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ - ngap = testngap_client(AF_INET); + ngap = testngap_client(1, AF_INET); ABTS_PTR_NOTNULL(tc, ngap); /* gNB connects to UPF */
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.