Commit f0c8eec6 authored by aligungr's avatar aligungr

UE context release request added to gNB CLI

parent d76d2453
......@@ -150,6 +150,7 @@ static OrderedMap<std::string, CmdEntry> g_gnbCmdEntries = {
{"amf-info", {"Show some status information about the given AMF", "<amf-id>", DefaultDesc, true}},
{"ue-list", {"List all UEs associated with the gNB", "", DefaultDesc, false}},
{"ue-count", {"Print the total number of UEs connected the this gNB", "", DefaultDesc, false}},
{"ue-release", {"Request a UE context release for the given UE", "<ue-id>", DefaultDesc, false}},
};
static OrderedMap<std::string, CmdEntry> g_ueCmdEntries = {
......@@ -200,6 +201,18 @@ static std::unique_ptr<GnbCliCommand> GnbCliParseImpl(const std::string &subCmd,
{
return std::make_unique<GnbCliCommand>(GnbCliCommand::UE_COUNT);
}
else if (subCmd == "ue-release")
{
auto cmd = std::make_unique<GnbCliCommand>(GnbCliCommand::UE_RELEASE_REQ);
if (options.positionalCount() == 0)
CMD_ERR("UE ID is expected")
if (options.positionalCount() > 1)
CMD_ERR("Only one UE ID is expected")
cmd->ueId = utils::ParseInt(options.getPositional(0));
if (cmd->ueId <= 0)
CMD_ERR("Invalid UE ID")
return cmd;
}
return nullptr;
}
......
......@@ -26,12 +26,16 @@ struct GnbCliCommand
AMF_LIST,
AMF_INFO,
UE_LIST,
UE_COUNT
UE_COUNT,
UE_RELEASE_REQ,
} present;
// AMF_INFO
int amfId{};
// UE_RELEASE_REQ
int ueId{};
explicit GnbCliCommand(PR present) : present(present)
{
}
......
......@@ -11,8 +11,8 @@
#include <gnb/app/task.hpp>
#include <gnb/gtp/task.hpp>
#include <gnb/ngap/task.hpp>
#include <gnb/rrc/task.hpp>
#include <gnb/rls/task.hpp>
#include <gnb/rrc/task.hpp>
#include <gnb/sctp/task.hpp>
#include <utils/common.hpp>
#include <utils/printer.hpp>
......@@ -131,6 +131,7 @@ void GnbCmdHandler::handleCmdImpl(NwGnbCliCommand &msg)
for (auto &ue : m_base->ngapTask->m_ueCtx)
{
json.push(Json::Obj({
{"ue-id", ue.first},
{"ran-ngap-id", ue.second->ranUeNgapId},
{"amf-ngap-id", ue.second->amfUeNgapId},
}));
......@@ -142,6 +143,17 @@ void GnbCmdHandler::handleCmdImpl(NwGnbCliCommand &msg)
sendResult(msg.address, std::to_string(m_base->ngapTask->m_ueCtx.size()));
break;
}
case app::GnbCliCommand::UE_RELEASE_REQ: {
if (m_base->ngapTask->m_ueCtx.count(msg.cmd->ueId) == 0)
sendError(msg.address, "UE not found with given ID");
else
{
auto ue = m_base->ngapTask->m_ueCtx[msg.cmd->ueId];
m_base->ngapTask->sendContextRelease(ue->ctxId, NgapCause::RadioNetwork_unspecified);
sendResult(msg.address, "UE Context Release Request is sending for specified UE");
}
break;
}
}
}
......
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