[tests] Upgrade tests for multiple NFs

The test scenario can now deploy multiple AMFs and other NFs.
This commit is contained in:
Bostjan Meglic
2024-08-07 14:12:12 +02:00
committed by Sukchan Lee
parent ed68d0b016
commit 5cf92c9851
24 changed files with 625 additions and 50 deletions

View File

@@ -189,6 +189,50 @@ amf:
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
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
sgwu:
pfcp:
server:

272
configs/transfer.yaml.in Normal file
View File

@@ -0,0 +1,272 @@
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

@@ -134,6 +134,30 @@ static int global_conf_validation(void)
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 ogs_app_parse_local_conf(const char *local)
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 @@ int ogs_app_parse_local_conf(const char *local)
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

@@ -52,6 +52,16 @@ typedef struct ogs_global_conf_s {
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 @@ void ogs_app_config_final(void);
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

@@ -85,6 +85,8 @@ typedef struct ogs_app_context_s {
uint64_t max_specs;
} metrics;
int config_section_id;
} ogs_app_context_t;
int ogs_app_context_init(void);

View File

@@ -35,6 +35,7 @@ int ogs_app_initialize(
char *log_file;
char *log_level;
char *domain_mask;
char *config_section_id;
} optarg;
ogs_core_initialize();
@@ -50,7 +51,7 @@ int ogs_app_initialize(
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 @@ int ogs_app_initialize(
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 @@ int ogs_app_initialize(
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 @@ int ogs_app_initialize(
}
/**************************************************************************
* 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 @@ static int parse_config(void)
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

@@ -513,6 +513,7 @@ static void show_help(const char *name)
" -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 @@ int abts_main(int argc, const char *const argv[], const char **argv_out)
ogs_getopt_t options;
struct {
char *config_file;
char *config_section;
char *log_level;
char *domain_mask;
@@ -533,7 +535,7 @@ int abts_main(int argc, const char *const argv[], const char **argv_out)
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(argv[0]);
@@ -565,6 +567,9 @@ int abts_main(int argc, const char *const argv[], const char **argv_out)
case 't':
optarg.enable_trace = true;
break;
case 'k':
optarg.config_section = options.optarg;
break;
case '?':
fprintf(stderr, "%s: %s\n", argv[0], options.errmsg);
show_help(argv[0]);
@@ -602,6 +607,10 @@ int abts_main(int argc, const char *const argv[], const char **argv_out)
argv_out[i++] = "-m";
argv_out[i++] = optarg.domain_mask;
}
if (optarg.config_section) {
argv_out[i++] = "-k";
argv_out[i++] = optarg.config_section;
}
argv_out[i] = NULL;

View File

@@ -77,6 +77,7 @@ int ogs_gtp_context_parse_config(const char *local, const char *remote)
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 @@ int ogs_gtp_context_parse_config(const char *local, const char *remote)
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

@@ -77,6 +77,7 @@ int ogs_metrics_context_parse_config(const char *local)
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 @@ int ogs_metrics_context_parse_config(const char *local)
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

@@ -219,6 +219,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
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 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
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

@@ -213,6 +213,7 @@ int ogs_sbi_context_parse_config(
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 @@ int ogs_sbi_context_parse_config(
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 @@ int ogs_sbi_context_parse_config(
}
}
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

@@ -206,6 +206,7 @@ int amf_context_parse_config(void)
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 @@ int amf_context_parse_config(void)
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)) {

View File

@@ -83,6 +83,7 @@ int ausf_context_parse_config(void)
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 @@ int ausf_context_parse_config(void)
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

@@ -82,6 +82,7 @@ int bsf_context_parse_config(void)
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 @@ int bsf_context_parse_config(void)
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

@@ -42,6 +42,7 @@ static void show_help(const char *name)
" -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 @@ int main(int argc, const char *const argv[])
ogs_getopt_t options;
struct {
char *config_file;
char *config_section;
char *log_file;
char *log_level;
char *domain_mask;
@@ -116,7 +118,7 @@ int main(int argc, const char *const argv[])
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 @@ int main(int argc, const char *const argv[])
case 't':
optarg.enable_trace = true;
break;
case 'k':
optarg.config_section = options.optarg;
break;
case '?':
fprintf(stderr, "%s: %s\n", argv[0], options.errmsg);
show_help(argv[0]);
@@ -196,6 +201,10 @@ int main(int argc, const char *const argv[])
argv_out[i++] = "-m";
argv_out[i++] = optarg.domain_mask;
}
if (optarg.config_section) {
argv_out[i++] = "-k";
argv_out[i++] = optarg.config_section;
}
argv_out[i] = NULL;

View File

@@ -77,6 +77,7 @@ int nssf_context_parse_config(void)
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 @@ int nssf_context_parse_config(void)
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

@@ -275,6 +275,7 @@ int pcf_context_parse_config(void)
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 @@ int pcf_context_parse_config(void)
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

@@ -294,6 +294,7 @@ int smf_context_parse_config(void)
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 @@ int smf_context_parse_config(void)
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

@@ -100,6 +100,7 @@ int udm_context_parse_config(void)
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 @@ int udm_context_parse_config(void)
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

@@ -65,6 +65,7 @@ int udr_context_parse_config(void)
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 @@ int udr_context_parse_config(void)
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

@@ -130,6 +130,7 @@ int upf_context_parse_config(void)
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 @@ int upf_context_parse_config(void)
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

@@ -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_threads[OGS_MAX_NF_INSTANCES] = { NULL };
static ogs_thread_t *smf_threads[OGS_MAX_NF_INSTANCES] = { NULL };
static ogs_thread_t *amf_threads[OGS_MAX_NF_INSTANCES] = { NULL };
static ogs_thread_t *ausf_threads[OGS_MAX_NF_INSTANCES] = { NULL };
static ogs_thread_t *udm_threads[OGS_MAX_NF_INSTANCES] = { NULL };
static ogs_thread_t *pcf_threads[OGS_MAX_NF_INSTANCES] = { NULL };
static ogs_thread_t *nssf_threads[OGS_MAX_NF_INSTANCES] = { NULL };
static ogs_thread_t *bsf_threads[OGS_MAX_NF_INSTANCES] = { NULL };
static ogs_thread_t *udr_threads[OGS_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;
threads[0] = 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_out[argv_out_idx + 0] = "-k";
argv_out[argv_out_idx + 1] = idx_string;
argv_out[argv_out_idx + 2] = NULL;
threads[i] = test_child_create(nf_name, argv_out);
}
// reset argv_out and remove the added "-k" parameter
argv_out[argv_out_idx] = NULL;
}
int app_initialize(const char *const argv[])
{
@@ -60,25 +97,32 @@ int app_initialize(const char *const argv[])
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
@@ -92,17 +136,28 @@ int app_initialize(const char *const argv[])
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_threads[i])
ogs_thread_destroy(amf_threads[i]);
if (smf_threads[i])
ogs_thread_destroy(smf_threads[i]);
if (upf_threads[i])
ogs_thread_destroy(upf_threads[i]);
if (udr_threads[i])
ogs_thread_destroy(udr_threads[i]);
if (nssf_threads[i])
ogs_thread_destroy(nssf_threads[i]);
if (bsf_threads[i])
ogs_thread_destroy(bsf_threads[i]);
if (pcf_threads[i])
ogs_thread_destroy(pcf_threads[i]);
if (udm_threads[i])
ogs_thread_destroy(udm_threads[i]);
if (ausf_threads[i])
ogs_thread_destroy(ausf_threads[i]);
}
if (sepp_thread) ogs_thread_destroy(sepp_thread);
if (scp_thread) ogs_thread_destroy(scp_thread);

View File

@@ -0,0 +1,74 @@
/*
* 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();
// matej uredi
ogs_error("MAtej pred boštjanovo funkcijo");
rv = app_initialize(argv);
// rv = app_initialize_transfer(argv);
ogs_assert(rv == OGS_OK);
}
int main(int argc, const char *const argv[])
{
int i;
abts_suite *suite = NULL;
atexit(terminate);
// matej uredi
//test_app_run_transfer(argc, argv, "transfer.yaml", initialize);
test_app_run(argc, argv, "transfer.yaml", initialize);
for (i = 0; alltests[i].func; i++)
suite = alltests[i].func(suite);
return abts_report(suite);
}

View File

@@ -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')