Unverified Commit c4a43911 authored by Adrian Lita's avatar Adrian Lita Committed by Angelo Athanassopoulos

Added DRB.UEThpDl and DRB.UeThpUl

parent 352f995f
...@@ -19,12 +19,16 @@ xsi:schemaLocation="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measC ...@@ -19,12 +19,16 @@ xsi:schemaLocation="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measC
<measType p="4">DRB.MaxActiveUeUl</measType> <measType p="4">DRB.MaxActiveUeUl</measType>
<measType p="4">DRB.MaxActiveUeUl</measType> <measType p="4">DRB.MaxActiveUeUl</measType>
<measType p="5">RRU.PrbTotDl</measType> <measType p="5">RRU.PrbTotDl</measType>
<measType p="6">DRB.UEThpDl</measType>
<measType p="7">DRB.UEThpUl</measType>
<measValue measObjLdn="DuFunction=@du-id@,CellId=@cell-id@"> <measValue measObjLdn="DuFunction=@du-id@,CellId=@cell-id@">
<r p="1">@mean-active-ue@</r> <r p="1">@mean-active-ue@</r>
<r p="2">@max-active-ue@</r> <r p="2">@max-active-ue@</r>
<r p="3">@mean-active-ue@</r> <r p="3">@mean-active-ue@</r>
<r p="4">@max-active-ue@</r> <r p="4">@max-active-ue@</r>
<r p="5">@load-avg@</r> <r p="5">@load-avg@</r>
<r p="6">@ue-thp-dl@</r>
<r p="7">@ue-thp-ul@</r>
@suspect@ @suspect@
</measValue> </measValue>
</measInfo> </measInfo>
......
...@@ -68,12 +68,18 @@ o1_stats_template = """{ ...@@ -68,12 +68,18 @@ o1_stats_template = """{
"O1-Operational": { "O1-Operational": {
"frame-type": "tdd", "frame-type": "tdd",
"band-number": 78, "band-number": 78,
"num-ues": 2, "num-ues": 1,
"ues": [ "ues": [
1717, 6876
28734
], ],
"load": 12 "load": 9,
"ues-thp": [
{
"rnti": 6876,
"dl": 3279,
"ul": 2725
}
]
} }
} }
OK""" OK"""
......
...@@ -202,9 +202,18 @@ int oai_data_feed(const oai_data_t *data) { ...@@ -202,9 +202,18 @@ int oai_data_feed(const oai_data_t *data) {
goto failure; goto failure;
} }
long int ue_thp_dl = 0;
long int ue_thp_ul = 0;
for(int i = 0; i < data->additional_data.numUes; i++) {
ue_thp_dl += data->additional_data.ues_thp[i].dl;
ue_thp_ul += data->additional_data.ues_thp[i].ul;
}
pm_data_t pm_data = { pm_data_t pm_data = {
.numUes = data->additional_data.numUes, .numUes = data->additional_data.numUes,
.load = data->additional_data.load, .load = data->additional_data.load,
.ue_thp_dl = ue_thp_dl,
.ue_thp_ul = ue_thp_ul,
}; };
rc = pm_data_feed(&pm_data); rc = pm_data_feed(&pm_data);
......
...@@ -437,11 +437,11 @@ oai_data_t *oai_data_parse_json(const char *json) { ...@@ -437,11 +437,11 @@ oai_data_t *oai_data_parse_json(const char *json) {
for(int i = 0; i < data->additional_data.numUes; i++) { for(int i = 0; i < data->additional_data.numUes; i++) {
cJSON *ue = cJSON_GetArrayItem(object, i); cJSON *ue = cJSON_GetArrayItem(object, i);
if(ue == 0) { if(ue == 0) {
log_error("not found: bwp3gpp:numberOfRBs"); log_error("not found: ues[i]");
goto failed; goto failed;
} }
if(!cJSON_IsNumber(ue)) { if(!cJSON_IsNumber(ue)) {
log_error("failed type: bwp3gpp:numberOfRBs"); log_error("failed type: ues[i]");
goto failed; goto failed;
} }
data->additional_data.ues[i] = ue->valueint; data->additional_data.ues[i] = ue->valueint;
...@@ -458,6 +458,41 @@ oai_data_t *oai_data_parse_json(const char *json) { ...@@ -458,6 +458,41 @@ oai_data_t *oai_data_parse_json(const char *json) {
} }
data->additional_data.load = object->valueint; data->additional_data.load = object->valueint;
object = cJSON_GetObjectItem(additional, "ues-thp");
data->additional_data.ues_thp = (oai_ues_thp_t *)malloc(data->additional_data.numUes * sizeof(oai_ues_thp_t));
if(!data->additional_data.ues_thp) {
log_error("malloc failed: ues_thp");
goto failed;
}
for(int i = 0; i < data->additional_data.numUes; i++) {
cJSON *thpUe = cJSON_GetArrayItem(object, i);
if(thpUe == 0) {
log_error("not found: thpUe");
goto failed;
}
cJSON *objectItem = cJSON_GetObjectItem(thpUe, "rnti");
if(!cJSON_IsNumber(objectItem)) {
log_error("failed type: rnti");
goto failed;
}
data->additional_data.ues_thp[i].rnti = objectItem->valueint;
objectItem = cJSON_GetObjectItem(thpUe, "dl");
if(!cJSON_IsNumber(objectItem)) {
log_error("failed type: dl");
goto failed;
}
data->additional_data.ues_thp[i].dl = objectItem->valueint;
objectItem = cJSON_GetObjectItem(thpUe, "ul");
if(!cJSON_IsNumber(objectItem)) {
log_error("failed type: ul");
goto failed;
}
data->additional_data.ues_thp[i].ul = objectItem->valueint;
}
cJSON_Delete(cjson); cJSON_Delete(cjson);
return data; return data;
...@@ -505,6 +540,12 @@ void oai_data_print(const oai_data_t *data) { ...@@ -505,6 +540,12 @@ void oai_data_print(const oai_data_t *data) {
log(" - [%d]: %d\n", i, data->additional_data.ues[i]); log(" - [%d]: %d\n", i, data->additional_data.ues[i]);
} }
log("ADDITIONAL.load: %d\n", data->additional_data.load); log("ADDITIONAL.load: %d\n", data->additional_data.load);
log("ADDITIONAL.UEs-THP[%d]: \n", data->additional_data.numUes);
for(int i = 0; i < data->additional_data.numUes; i++) {
log(" - rnti[%d]: %d\n", i, data->additional_data.ues_thp[i].rnti);
log(" - dl[%d]: %d\n", i, data->additional_data.ues_thp[i].dl);
log(" - ul[%d]: %d\n", i, data->additional_data.ues_thp[i].ul);
}
log("\n"); log("\n");
} }
...@@ -528,5 +569,8 @@ void oai_data_free(oai_data_t *data) { ...@@ -528,5 +569,8 @@ void oai_data_free(oai_data_t *data) {
free(data->additional_data.ues); free(data->additional_data.ues);
data->additional_data.ues = 0; data->additional_data.ues = 0;
free(data->additional_data.ues_thp);
data->additional_data.ues_thp = 0;
free(data); free(data);
} }
...@@ -25,12 +25,19 @@ ...@@ -25,12 +25,19 @@
#include <stdint.h> #include <stdint.h>
typedef struct oai_ues_thp {
int rnti;
int dl;
int ul;
} oai_ues_thp_t;
typedef struct oai_additional_data { typedef struct oai_additional_data {
char *frameType; char *frameType;
int bandNumber; int bandNumber;
int numUes; int numUes;
int *ues; int *ues;
int load; int load;
oai_ues_thp_t *ues_thp;
} oai_additional_data_t; } oai_additional_data_t;
typedef struct oai_config_data { typedef struct oai_config_data {
......
...@@ -53,7 +53,18 @@ static time_t pm_data_start_time = 0; ...@@ -53,7 +53,18 @@ static time_t pm_data_start_time = 0;
static const config_t *pm_data_config = 0; static const config_t *pm_data_config = 0;
static int pm_data_notification_id = 1; static int pm_data_notification_id = 1;
static int pm_data_write(long int start_time, long int end_time, char *filename, int meanActiveUe, int maxActiveUe, int loadAvg); typedef struct pm_write_data {
long int start_time;
long int end_time;
char *filename;
int meanActiveUe;
int maxActiveUe;
int loadAvg;
long int ue_thp_dl;
long int ue_thp_ul;
} pm_write_data_t;
static int pm_data_write(pm_write_data_t *data);
int pm_data_init(const config_t *config) { int pm_data_init(const config_t *config) {
pm_data_feed_log_period = config->ves.pm_data_interval; pm_data_feed_log_period = config->ves.pm_data_interval;
...@@ -138,15 +149,25 @@ void pm_data_loop() { ...@@ -138,15 +149,25 @@ void pm_data_loop() {
long int meanActiveUeAccum = 0; long int meanActiveUeAccum = 0;
int maxActiveUe = 0; int maxActiveUe = 0;
int loadAvgAccum = 0; int loadAvgAccum = 0;
long int ue_thp_dl_accum = 0;
long int ue_thp_ul_accum = 0;
for(int i = 0; i < pm_data_accumulator_len; i++) { for(int i = 0; i < pm_data_accumulator_len; i++) {
meanActiveUeAccum += pm_data_accumulator[i].numUes; meanActiveUeAccum += pm_data_accumulator[i].numUes;
if(pm_data_accumulator[i].numUes > maxActiveUe) { if(pm_data_accumulator[i].numUes > maxActiveUe) {
maxActiveUe = pm_data_accumulator[i].numUes; maxActiveUe = pm_data_accumulator[i].numUes;
} }
loadAvgAccum += pm_data_accumulator[i].load; loadAvgAccum += pm_data_accumulator[i].load;
for(int j = 0; j < pm_data_accumulator[i].numUes; j++) {
ue_thp_dl_accum += pm_data_accumulator[i].ue_thp_dl;
ue_thp_ul_accum += pm_data_accumulator[i].ue_thp_ul;
}
} }
int meanActiveUe = meanActiveUeAccum / pm_data_accumulator_len; int meanActiveUe = meanActiveUeAccum / pm_data_accumulator_len;
int loadAvg = loadAvgAccum / pm_data_accumulator_len; int loadAvg = loadAvgAccum / pm_data_accumulator_len;
long int ue_thp_dl = ue_thp_dl_accum / pm_data_accumulator_len;
long int ue_thp_ul = ue_thp_ul_accum / pm_data_accumulator_len;
struct tm *ptm = gmtime(&pm_data_start_time); struct tm *ptm = gmtime(&pm_data_start_time);
if(ptm == 0) { if(ptm == 0) {
...@@ -179,7 +200,18 @@ void pm_data_loop() { ...@@ -179,7 +200,18 @@ void pm_data_loop() {
goto failure_loop; goto failure_loop;
} }
rc = pm_data_write(pm_data_start_time, timestamp, full_path, meanActiveUe, maxActiveUe, loadAvg); pm_write_data_t data = {
.start_time = pm_data_start_time,
.end_time = timestamp,
.filename = full_path,
.meanActiveUe = meanActiveUe,
.maxActiveUe = maxActiveUe,
.loadAvg = loadAvg,
.ue_thp_dl = ue_thp_dl,
.ue_thp_ul = ue_thp_ul,
};
rc = pm_data_write(&data);
if(rc != 0) { if(rc != 0) {
log_error("pm_data_write error"); log_error("pm_data_write error");
goto failure_loop; goto failure_loop;
...@@ -233,11 +265,11 @@ failure: ...@@ -233,11 +265,11 @@ failure:
return 1; return 1;
} }
static int pm_data_write(long int start_time, long int end_time, char *filename, int meanActiveUe, int maxActiveUe, int loadAvg) { static int pm_data_write(pm_write_data_t *data) {
char *content = 0; char *content = 0;
FILE *f = 0; FILE *f = 0;
f = fopen(filename, "w"); f = fopen(data->filename, "w");
if(f == 0) { if(f == 0) {
log_error("fopen failed"); log_error("fopen failed");
goto failure; goto failure;
...@@ -252,7 +284,7 @@ static int pm_data_write(long int start_time, long int end_time, char *filename, ...@@ -252,7 +284,7 @@ static int pm_data_write(long int start_time, long int end_time, char *filename,
char start_time_full[64]; char start_time_full[64];
char end_time_full[64]; char end_time_full[64];
time_t *timestamp = (time_t *)&start_time; time_t *timestamp = (time_t *)&(data->start_time);
struct tm *ptm = gmtime(timestamp); struct tm *ptm = gmtime(timestamp);
if(ptm == 0) { if(ptm == 0) {
log_error("gmtime error"); log_error("gmtime error");
...@@ -260,7 +292,7 @@ static int pm_data_write(long int start_time, long int end_time, char *filename, ...@@ -260,7 +292,7 @@ static int pm_data_write(long int start_time, long int end_time, char *filename,
} }
sprintf(start_time_full, "%04d-%02d-%02dT%02d:%02d:%02d+00:00", ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec); sprintf(start_time_full, "%04d-%02d-%02dT%02d:%02d:%02d+00:00", ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
timestamp = (time_t *)&end_time; timestamp = (time_t *)&(data->end_time);
ptm = gmtime(timestamp); ptm = gmtime(timestamp);
if(ptm == 0) { if(ptm == 0) {
log_error("gmtime error"); log_error("gmtime error");
...@@ -269,7 +301,7 @@ static int pm_data_write(long int start_time, long int end_time, char *filename, ...@@ -269,7 +301,7 @@ static int pm_data_write(long int start_time, long int end_time, char *filename,
sprintf(end_time_full, "%04d-%02d-%02dT%02d:%02d:%02d+00:00", ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec); sprintf(end_time_full, "%04d-%02d-%02dT%02d:%02d:%02d+00:00", ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
const char *suspect = ""; const char *suspect = "";
if((end_time - start_time) < pm_data_feed_log_period) { if((data->end_time - data->start_time) < pm_data_feed_log_period) {
suspect = "<suspect>true</suspect>"; suspect = "<suspect>true</suspect>";
} }
...@@ -314,10 +346,14 @@ static int pm_data_write(long int start_time, long int end_time, char *filename, ...@@ -314,10 +346,14 @@ static int pm_data_write(long int start_time, long int end_time, char *filename,
char mean_active_ue_str[32]; char mean_active_ue_str[32];
char max_active_ue_str[32]; char max_active_ue_str[32];
char load_avg_str[8]; char load_avg_str[8];
char ue_thp_dl_str[10];
char ue_thp_ul_str[10];
sprintf(mean_active_ue_str, "%d", meanActiveUe); sprintf(mean_active_ue_str, "%d", data->meanActiveUe);
sprintf(max_active_ue_str, "%d", maxActiveUe); sprintf(max_active_ue_str, "%d", data->maxActiveUe);
sprintf(load_avg_str, "%d", loadAvg); sprintf(load_avg_str, "%d", data->loadAvg);
sprintf(ue_thp_dl_str, "%ld", data->ue_thp_dl);
sprintf(ue_thp_ul_str, "%ld", data->ue_thp_ul);
content = str_replace_inplace(content, "@mean-active-ue@", mean_active_ue_str); content = str_replace_inplace(content, "@mean-active-ue@", mean_active_ue_str);
if(content == 0) { if(content == 0) {
...@@ -353,6 +389,24 @@ static int pm_data_write(long int start_time, long int end_time, char *filename, ...@@ -353,6 +389,24 @@ static int pm_data_write(long int start_time, long int end_time, char *filename,
goto failure; goto failure;
} }
content = str_replace_inplace(content, "@load-avg@", load_avg_str);
if(content == 0) {
log_error("str_replace_inplace() failed");
goto failure;
}
content = str_replace_inplace(content, "@ue-thp-dl@", ue_thp_dl_str);
if(content == 0) {
log_error("str_replace_inplace() failed");
goto failure;
}
content = str_replace_inplace(content, "@ue-thp-ul@", ue_thp_ul_str);
if(content == 0) {
log_error("str_replace_inplace() failed");
goto failure;
}
fprintf(f, "%s", content); fprintf(f, "%s", content);
fclose(f); fclose(f);
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
typedef struct pm_data { typedef struct pm_data {
int numUes; int numUes;
int load; int load;
long int ue_thp_dl;
long int ue_thp_ul;
} pm_data_t; } pm_data_t;
typedef struct pm_data_info { typedef struct pm_data_info {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment