From 8ed3497bc80dfe026d0c1dfe7839286db43db872 Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Thu, 30 Mar 2023 16:22:35 +0200 Subject: [PATCH] e2sm_kpm: move struct types to e2sm_kpm_common.h --- srsgnb/hdr/stack/ric/e2sm_kpm.h | 56 +---------------- srsgnb/hdr/stack/ric/e2sm_kpm_common.h | 80 +++++++++++++++++++++++++ srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h | 2 +- 3 files changed, 82 insertions(+), 56 deletions(-) create mode 100644 srsgnb/hdr/stack/ric/e2sm_kpm_common.h diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm.h b/srsgnb/hdr/stack/ric/e2sm_kpm.h index 19a78e18a..86084fa1d 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm.h @@ -11,6 +11,7 @@ * */ #include "e2sm.h" +#include "e2sm_kpm_common.h" #include "srsran/asn1/e2ap.h" #include "srsran/asn1/e2sm.h" #include "srsran/asn1/e2sm_kpm_v2.h" @@ -22,61 +23,6 @@ using namespace asn1::e2ap; using namespace asn1::e2sm_kpm; -typedef struct { - uint16_t action_id; - e2_sm_kpm_action_definition_s action_definition; - e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types ind_msg_format; - e2_sm_kpm_ind_hdr_s ric_ind_header; - e2_sm_kpm_ind_msg_s ric_ind_message; -} E2SM_KPM_action_data_t; - -enum e2_metric_data_type_t { INTEGER, REAL }; - -typedef struct { - std::string name; - bool supported; - e2_metric_data_type_t data_type; - std::string units; - bool min_val_present; - double min_val; - bool max_val_present; - double max_val; - uint32_t supported_labels; - uint32_t supported_scopes; -} E2SM_KPM_metric_t; - -// TODO: define all labels and scopes - -/* Labels supported for a metric */ -enum e2sm_kpm_label_enum { - NO_LABEL = 0x0001, - MIN_LABEL = 0x0002, - MAX_LABEL = 0x0004, - AVG_LABEL = 0x0008, - SUM_LABEL = 0x0010, - UNKNOWN_LABEL = 0x8000 -}; - -e2sm_kpm_label_enum str2kpm_label(const std::string& label_str); - -/* Scopes supported for a metric */ -enum e2sm_kpm_metric_scope_enum { - ENB_LEVEL = 0x0001, - CELL_LEVEL = 0x0002, - UE_LEVEL = 0x0004, - BEARER_LEVEL = 0x0008, - UNKNOWN_LEVEL = 0xffff -}; - -typedef struct { - std::string name; - e2sm_kpm_label_enum label; - e2sm_kpm_metric_scope_enum scope; - meas_record_item_c::types data_type; - int32_t integer_value; - float real_value; -} E2SM_KPM_meas_value_t; - class e2sm_kpm : public e2sm { public: diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm_common.h b/srsgnb/hdr/stack/ric/e2sm_kpm_common.h new file mode 100644 index 000000000..b048f0510 --- /dev/null +++ b/srsgnb/hdr/stack/ric/e2sm_kpm_common.h @@ -0,0 +1,80 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2022 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + * + */ + +#include "srsran/asn1/e2ap.h" +#include "srsran/asn1/e2sm.h" +#include "srsran/asn1/e2sm_kpm_v2.h" +#include "srsran/srsran.h" + +#ifndef SRSRAN_E2SM_KPM_COMMON_H +#define SRSRAN_E2SM_KPM_COMMON_H + +using namespace asn1::e2ap; +using namespace asn1::e2sm_kpm; + +typedef struct { + uint16_t action_id; + e2_sm_kpm_action_definition_s action_definition; + e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types ind_msg_format; + e2_sm_kpm_ind_hdr_s ric_ind_header; + e2_sm_kpm_ind_msg_s ric_ind_message; +} E2SM_KPM_action_data_t; + +enum e2_metric_data_type_t { INTEGER, REAL }; + +typedef struct { + std::string name; + bool supported; + e2_metric_data_type_t data_type; + std::string units; + bool min_val_present; + double min_val; + bool max_val_present; + double max_val; + uint32_t supported_labels; + uint32_t supported_scopes; +} E2SM_KPM_metric_t; + +// TODO: define all labels and scopes + +/* Labels supported for a metric */ +enum e2sm_kpm_label_enum { + NO_LABEL = 0x0001, + MIN_LABEL = 0x0002, + MAX_LABEL = 0x0004, + AVG_LABEL = 0x0008, + SUM_LABEL = 0x0010, + UNKNOWN_LABEL = 0x8000 +}; + +e2sm_kpm_label_enum str2kpm_label(const std::string& label_str); + +/* Scopes supported for a metric */ +enum e2sm_kpm_metric_scope_enum { + ENB_LEVEL = 0x0001, + CELL_LEVEL = 0x0002, + UE_LEVEL = 0x0004, + BEARER_LEVEL = 0x0008, + UNKNOWN_LEVEL = 0xffff +}; + +typedef struct { + std::string name; + e2sm_kpm_label_enum label; + e2sm_kpm_metric_scope_enum scope; + meas_record_item_c::types data_type; + int32_t integer_value; + float real_value; +} E2SM_KPM_meas_value_t; + +#endif // SRSRAN_E2SM_KPM_COMMON_H diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h b/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h index dd9531871..160dfc84e 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h @@ -14,7 +14,7 @@ #ifndef SRSRAN_E2SM_KPM_METRICS_H #define SRSRAN_E2SM_KPM_METRICS_H -#include "e2sm_kpm.h" +#include "e2sm_kpm_common.h" #include "srsran/srsran.h" // clang-format off