forked from acouzens/open5gs
add HIDDEN configuration for developer.
... GTP: 1, OTHERS: 1, } HIDDEN: { DISABLE_HSS: 0, DISABLE_SGW: 0, DISABLE_PGW: 0, } HSS : { if epcd or testepc, DISABLE_HSS/SGW/PGW is applied.
This commit is contained in:
parent
fcc4a7bca0
commit
59999dcb4f
|
@ -163,6 +163,27 @@ status_t context_parse_config()
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (jsmntok_equal(json, t, "HIDDEN") == 0)
|
||||
{
|
||||
for (m = 1, n = 1; n > 0; m++, n--)
|
||||
{
|
||||
n += (t+m)->size;
|
||||
|
||||
char *v = jsmntok_to_string(json, t+m+1);
|
||||
if (jsmntok_equal(json, t+m, "DISABLE_HSS") == 0)
|
||||
{
|
||||
if (v) self.hidden.disable_hss = atoi(v);
|
||||
}
|
||||
else if (jsmntok_equal(json, t+m, "DISABLE_SGW") == 0)
|
||||
{
|
||||
if (v) self.hidden.disable_sgw = atoi(v);
|
||||
}
|
||||
else if (jsmntok_equal(json, t+m, "DISABLE_PGW") == 0)
|
||||
{
|
||||
if (v) self.hidden.disable_pgw = atoi(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state = SKIP;
|
||||
skip_tokens = t->size;
|
||||
|
|
|
@ -37,6 +37,13 @@ typedef struct _context_t {
|
|||
int s6a;
|
||||
int others;
|
||||
} trace_level;
|
||||
|
||||
struct {
|
||||
int disable_hss;
|
||||
int disable_sgw;
|
||||
int disable_pgw;
|
||||
} hidden;
|
||||
|
||||
} context_t;
|
||||
|
||||
CORE_DECLARE(status_t) context_init(void);
|
||||
|
|
21
src/epc.c
21
src/epc.c
|
@ -34,14 +34,23 @@ status_t app_initialize(char *config_path, char *log_path)
|
|||
d_trace_level(&_epc_main, others);
|
||||
}
|
||||
|
||||
rv = proc_create(&pgw_proc, pgw_start_func, pgw_stop_func, NULL);
|
||||
if (rv != CORE_OK) return rv;
|
||||
if (context_self()->hidden.disable_pgw == 0)
|
||||
{
|
||||
rv = proc_create(&pgw_proc, pgw_start_func, pgw_stop_func, NULL);
|
||||
if (rv != CORE_OK) return rv;
|
||||
}
|
||||
|
||||
rv = proc_create(&sgw_proc, sgw_start_func, sgw_stop_func, NULL);
|
||||
if (rv != CORE_OK) return rv;
|
||||
if (context_self()->hidden.disable_sgw == 0)
|
||||
{
|
||||
rv = proc_create(&sgw_proc, sgw_start_func, sgw_stop_func, NULL);
|
||||
if (rv != CORE_OK) return rv;
|
||||
}
|
||||
|
||||
rv = proc_create(&hss_proc, hss_start_func, hss_stop_func, NULL);
|
||||
if (rv != CORE_OK) return rv;
|
||||
if (context_self()->hidden.disable_hss == 0)
|
||||
{
|
||||
rv = proc_create(&hss_proc, hss_start_func, hss_stop_func, NULL);
|
||||
if (rv != CORE_OK) return rv;
|
||||
}
|
||||
|
||||
d_trace(1, "MME try to initialize\n");
|
||||
rv = mme_initialize();
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "s6a_lib.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "context.h"
|
||||
#include "mme_context.h"
|
||||
#include "abts.h"
|
||||
#include "testutil.h"
|
||||
|
@ -61,8 +62,11 @@ status_t test_initialize(void)
|
|||
{
|
||||
d_assert(semaphore_wait(test_sem) == CORE_OK, return CORE_ERROR,
|
||||
"semaphore_wait() failed");
|
||||
d_assert(semaphore_wait(test_sem) == CORE_OK, return CORE_ERROR,
|
||||
"semaphore_wait() failed");
|
||||
if (context_self()->hidden.disable_hss == 0)
|
||||
{
|
||||
d_assert(semaphore_wait(test_sem) == CORE_OK, return CORE_ERROR,
|
||||
"semaphore_wait() failed");
|
||||
}
|
||||
d_assert(semaphore_delete(test_sem) == CORE_OK, return CORE_ERROR,
|
||||
"semaphore_delete() failed");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue