Added NGAP Metrics

This commit is contained in:
David Rupprecht 2021-07-15 15:43:24 +02:00 committed by David Rupprecht
parent 7842cedb75
commit 4f0f6169f5
3 changed files with 45 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#ifndef SRSENB_NGAP_H
#define SRSENB_NGAP_H
#include "ngap_metrics.h"
#include "srsenb/hdr/common/common_enb.h"
#include "srsran/adt/circular_map.h"
#include "srsran/adt/optional.h"
@ -66,6 +67,7 @@ public:
// Stack interface
bool
handle_amf_rx_msg(srsran::unique_byte_buffer_t pdu, const sockaddr_in& from, const sctp_sndrcvinfo& sri, int flags);
void get_metrics(ngap_metrics_t& m);
private:
static const int AMF_PORT = 38412;

View File

@ -0,0 +1,30 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2021 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.
*
*/
#ifndef SRSENB_NGAP_METRICS_H
#define SRSENB_NGAP_METRICS_H
namespace srsenb {
typedef enum {
ngap_attaching = 0, // Attempting to create NG connection
ngap_connected, // NG connected
ngap_error // Failure
} ngap_status_t;
struct ngap_metrics_t {
ngap_status_t status;
};
} // namespace srsenb
#endif // SRSENB_NGAP_METRICS_H

View File

@ -143,6 +143,19 @@ void ngap::stop()
amf_socket.close();
}
void ngap::get_metrics(ngap_metrics_t& m)
{
if (!running) {
m.status = ngap_error;
return;
}
if (amf_connected) {
m.status = ngap_connected;
} else {
m.status = ngap_attaching;
}
}
bool ngap::is_amf_connected()
{
return amf_connected;