Commit 886d8eb5 authored by aligungr's avatar aligungr

UE SAS dev.

parent 8d211623
...@@ -162,6 +162,7 @@ static OrderedMap<std::string, CmdEntry> g_ueCmdEntries = { ...@@ -162,6 +162,7 @@ static OrderedMap<std::string, CmdEntry> g_ueCmdEntries = {
{"ps-release-all", {"Trigger PDU session release procedures for all active sessions", "", DefaultDesc, false}}, {"ps-release-all", {"Trigger PDU session release procedures for all active sessions", "", DefaultDesc, false}},
{"deregister", {"deregister",
{"Perform a de-registration by the UE", "<normal|disable-5g|switch-off|remove-sim>", DefaultDesc, true}}, {"Perform a de-registration by the UE", "<normal|disable-5g|switch-off|remove-sim>", DefaultDesc, true}},
{"coverage", {"Show gNodeB cell coverage information", "", DefaultDesc, false}},
}; };
static std::unique_ptr<GnbCliCommand> GnbCliParseImpl(const std::string &subCmd, const opt::OptionsResult &options, static std::unique_ptr<GnbCliCommand> GnbCliParseImpl(const std::string &subCmd, const opt::OptionsResult &options,
...@@ -301,6 +302,10 @@ static std::unique_ptr<UeCliCommand> UeCliParseImpl(const std::string &subCmd, c ...@@ -301,6 +302,10 @@ static std::unique_ptr<UeCliCommand> UeCliParseImpl(const std::string &subCmd, c
} }
return cmd; return cmd;
} }
else if (subCmd == "coverage")
{
return std::make_unique<UeCliCommand>(UeCliCommand::COVERAGE);
}
return nullptr; return nullptr;
} }
......
...@@ -48,6 +48,7 @@ struct UeCliCommand ...@@ -48,6 +48,7 @@ struct UeCliCommand
PS_RELEASE, PS_RELEASE,
PS_RELEASE_ALL, PS_RELEASE_ALL,
DE_REGISTER, DE_REGISTER,
COVERAGE,
} present; } present;
// DE_REGISTER // DE_REGISTER
......
...@@ -40,6 +40,7 @@ void GnbSasTask::handleCellInfoRequest(const InetAddress &addr, const sas::SasCe ...@@ -40,6 +40,7 @@ void GnbSasTask::handleCellInfoRequest(const InetAddress &addr, const sas::SasCe
resp.cellId.plmn = m_base->config->plmn; resp.cellId.plmn = m_base->config->plmn;
resp.tac = m_base->config->tac; resp.tac = m_base->config->tac;
resp.dbm = dbm; resp.dbm = dbm;
resp.gnbName = m_base->config->name;
sendSasMessage(addr, resp); sendSasMessage(addr, resp);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <ue/mr/task.hpp> #include <ue/mr/task.hpp>
#include <ue/nas/task.hpp> #include <ue/nas/task.hpp>
#include <ue/rrc/task.hpp> #include <ue/rrc/task.hpp>
#include <ue/sas/task.hpp>
#include <ue/tun/task.hpp> #include <ue/tun/task.hpp>
#include <utils/common.hpp> #include <utils/common.hpp>
#include <utils/printer.hpp> #include <utils/printer.hpp>
...@@ -19,6 +20,17 @@ ...@@ -19,6 +20,17 @@
#define PAUSE_CONFIRM_TIMEOUT 3000 #define PAUSE_CONFIRM_TIMEOUT 3000
#define PAUSE_POLLING 10 #define PAUSE_POLLING 10
static std::string SignalDescription(int dbm)
{
if (dbm > -90)
return "Excellent";
if (dbm > -105)
return "Good";
if (dbm > -120)
return "Fair";
return "Poor";
}
namespace nr::ue namespace nr::ue
{ {
...@@ -150,6 +162,30 @@ void UeCmdHandler::handleCmdImpl(NwUeCliCommand &msg) ...@@ -150,6 +162,30 @@ void UeCmdHandler::handleCmdImpl(NwUeCliCommand &msg)
sendResult(msg.address, "PDU session establishment procedure triggered"); sendResult(msg.address, "PDU session establishment procedure triggered");
break; break;
} }
case app::UeCliCommand::COVERAGE: {
auto &map = m_base->sasTask->m_activeMeasurements;
if (map.empty())
{
sendResult(msg.address, "No cell exists in the range");
break;
}
std::vector<Json> cellInfo{};
for (auto &entry : map)
{
auto &measurement = entry.second;
cellInfo.push_back(Json::Obj({
{"gnb", measurement.gnbName},
{"plmn", ToJson(measurement.cellId.plmn)},
{"nci", measurement.cellId.nci},
{"tac", measurement.tac},
{"signal", std::to_string(measurement.dbm) + "dBm [" + SignalDescription(measurement.dbm) + "]"},
}));
}
sendResult(msg.address, Json::Arr(cellInfo).dumpYaml());
break;
}
} }
} }
......
...@@ -52,6 +52,7 @@ void UeSasTask::receiveCellInfoResponse(const sas::SasCellInfoResponse &msg) ...@@ -52,6 +52,7 @@ void UeSasTask::receiveCellInfoResponse(const sas::SasCellInfoResponse &msg)
meas.cellId = msg.cellId; meas.cellId = msg.cellId;
meas.tac = msg.tac; meas.tac = msg.tac;
meas.dbm = msg.dbm; meas.dbm = msg.dbm;
meas.gnbName = msg.gnbName;
meas.time = utils::CurrentTimeMillis(); meas.time = utils::CurrentTimeMillis();
m_pendingMeasurements[meas.cellId] = meas; m_pendingMeasurements[meas.cellId] = meas;
......
...@@ -63,6 +63,8 @@ void EncodeSasMessage(const SasMessage &msg, OctetString &stream) ...@@ -63,6 +63,8 @@ void EncodeSasMessage(const SasMessage &msg, OctetString &stream)
AppendGlobalNci(m.cellId, stream); AppendGlobalNci(m.cellId, stream);
stream.appendOctet4(m.tac); stream.appendOctet4(m.tac);
stream.appendOctet4(m.dbm); stream.appendOctet4(m.dbm);
stream.appendOctet4(static_cast<int>(m.gnbName.size()));
stream.appendUtf8(m.gnbName);
} }
} }
...@@ -94,6 +96,7 @@ std::unique_ptr<SasMessage> DecodeSasMessage(const OctetView &stream) ...@@ -94,6 +96,7 @@ std::unique_ptr<SasMessage> DecodeSasMessage(const OctetView &stream)
res->cellId = DecodeGlobalNci(stream); res->cellId = DecodeGlobalNci(stream);
res->tac = stream.read4I(); res->tac = stream.read4I();
res->dbm = stream.read4I(); res->dbm = stream.read4I();
res->gnbName = stream.readUtf8String(stream.read4I());
return res; return res;
} }
......
...@@ -47,6 +47,7 @@ struct SasCellInfoResponse : SasMessage ...@@ -47,6 +47,7 @@ struct SasCellInfoResponse : SasMessage
GlobalNci cellId{}; GlobalNci cellId{};
int tac{}; int tac{};
int dbm{}; int dbm{};
std::string gnbName{};
SasCellInfoResponse() : SasMessage(SasMessageType::CELL_INFO_RESPONSE) SasCellInfoResponse() : SasMessage(SasMessageType::CELL_INFO_RESPONSE)
{ {
......
...@@ -136,6 +136,7 @@ struct UeCellMeasurement ...@@ -136,6 +136,7 @@ struct UeCellMeasurement
GlobalNci cellId{}; GlobalNci cellId{};
int tac{}; int tac{};
int dbm{}; int dbm{};
std::string gnbName{};
uint64_t time{}; uint64_t time{};
}; };
......
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