5#include "nr-stats-calculator.h"
9#include "ns3/nr-gnb-net-device.h"
10#include "ns3/nr-gnb-rrc.h"
11#include "ns3/nr-ue-net-device.h"
12#include "ns3/nr-ue-rrc.h"
17NS_LOG_COMPONENT_DEFINE(
"NrStatsCalculator");
19NS_OBJECT_ENSURE_REGISTERED(NrStatsCalculator);
22 : m_dlOutputFilename(
""),
23 m_ulOutputFilename(
"")
36 static TypeId tid = TypeId(
"ns3::NrStatsCalculator")
46 m_ulOutputFilename = outputFilename;
52 return m_ulOutputFilename;
58 m_dlOutputFilename = outputFilename;
64 return m_dlOutputFilename;
70 return m_pathImsiMap.find(path) != m_pathImsiMap.end();
76 NS_LOG_FUNCTION(
this << path << imsi);
77 m_pathImsiMap[path] = imsi;
83 return m_pathImsiMap.find(path)->second;
89 return m_pathCellIdMap.find(path) != m_pathCellIdMap.end();
95 NS_LOG_FUNCTION(
this << path << cellId);
96 m_pathCellIdMap[path] = cellId;
102 return m_pathCellIdMap.find(path)->second;
108 NS_LOG_FUNCTION(path);
113 std::string ueMapPath = path.substr(0, path.find(
"/DataRadioBearerMap"));
114 Config::MatchContainer match = Config::LookupMatches(ueMapPath);
116 if (match.GetN() != 0)
118 Ptr<Object> ueInfo = match.Get(0);
119 NS_LOG_LOGIC(
"FindImsiFromGnbRlcPath: " << path <<
", "
121 return ueInfo->GetObject<
NrUeManager>()->GetImsi();
125 NS_FATAL_ERROR(
"Lookup " << ueMapPath <<
" got no matches");
133 NS_LOG_FUNCTION(path);
138 Config::MatchContainer match = Config::LookupMatches(path);
140 if (match.GetN() != 0)
142 Ptr<Object> ueNetDevice = match.Get(0);
143 NS_LOG_LOGIC(
"FindImsiFromNrUeNetDevice: "
149 NS_FATAL_ERROR(
"Lookup " << path <<
" got no matches");
157 NS_LOG_FUNCTION(path);
162 std::string gnbNetDevicePath = path.substr(0, path.find(
"/NrGnbRrc"));
163 Config::MatchContainer match = Config::LookupMatches(gnbNetDevicePath);
164 if (match.GetN() != 0)
166 Ptr<Object> gnbNetDevice = match.Get(0);
167 NS_LOG_LOGIC(
"FindCellIdFromGnbRlcPath: "
173 NS_FATAL_ERROR(
"Lookup " << gnbNetDevicePath <<
" got no matches");
181 NS_LOG_FUNCTION(path << rnti);
184 std::ostringstream oss;
185 std::string p = path.substr(0, path.find(
"/BandwidthPartMap"));
187 p +=
"/NrGnbRrc/UeMap/" + oss.str();
189 NS_LOG_LOGIC(
"FindImsiFromGnbMac: " << path <<
", " << rnti <<
", " << imsi);
196 NS_LOG_FUNCTION(path << rnti);
198 std::ostringstream oss;
199 std::string p = path.substr(0, path.find(
"/BandwidthPartMap"));
201 p +=
"/NrGnbRrc/UeMap/" + oss.str();
203 NS_LOG_LOGIC(
"FindCellIdFromGnbMac: " << path <<
", " << rnti <<
", " << cellId);
The NrGnbNetDevice class.
uint16_t GetCellId() const
static TypeId GetTypeId()
std::string GetUlOutputFilename()
void SetCellIdPath(std::string path, uint16_t cellId)
static uint64_t FindImsiFromGnbRlcPath(std::string path)
static uint16_t FindCellIdFromGnbMac(std::string path, uint16_t rnti)
static uint16_t FindCellIdFromGnbRlcPath(std::string path)
static uint64_t FindImsiFromGnbMac(std::string path, uint16_t rnti)
uint16_t GetCellIdPath(std::string path)
uint64_t GetImsiPath(std::string path)
std::string GetDlOutputFilename()
bool ExistsImsiPath(std::string path)
bool ExistsCellIdPath(std::string path)
static uint64_t FindImsiFromNrUeNetDevice(std::string path)
void SetDlOutputFilename(std::string outputFilename)
~NrStatsCalculator() override
void SetUlOutputFilename(std::string outputFilename)
void SetImsiPath(std::string path, uint64_t imsi)
The User Equipment NetDevice.
uint64_t GetImsi() const
Get the Imsi.