Commit 96073581 authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent ade2494e
......@@ -160,6 +160,7 @@ static OrderedMap<std::string, CmdEntry> g_ueCmdEntries = {
{"timers", {"Dump current status of the timers in the UE", "", DefaultDesc, false}},
{"ps-establish",
{"Trigger a PDU session establishment procedure", "<session-type> [options]", DescForPsEstablish, true}},
{"ps-list", {"List all PDU sessions", "", DefaultDesc, false}},
{"ps-release", {"Trigger a PDU session release procedure", "<pdu-session-id>...", DefaultDesc, true}},
{"ps-release-all", {"Trigger PDU session release procedures for all active sessions", "", DefaultDesc, false}},
{"deregister",
......@@ -316,6 +317,10 @@ static std::unique_ptr<UeCliCommand> UeCliParseImpl(const std::string &subCmd, c
}
return cmd;
}
else if (subCmd == "ps-list")
{
return std::make_unique<UeCliCommand>(UeCliCommand::PS_LIST);
}
return nullptr;
}
......
......@@ -52,6 +52,7 @@ struct UeCliCommand
PS_ESTABLISH,
PS_RELEASE,
PS_RELEASE_ALL,
PS_LIST,
DE_REGISTER,
} present;
......
......@@ -7,3 +7,27 @@
//
#include "enums.hpp"
namespace nas
{
Json ToJson(const EPduSessionType &v)
{
switch (v)
{
case EPduSessionType::IPV4:
return "IPv4";
case EPduSessionType::IPV6:
return "IPv6";
case EPduSessionType::IPV4V6:
return "IPv4v6";
case EPduSessionType::UNSTRUCTURED:
return "unstructured";
case EPduSessionType::ETHERNET:
return "ethernet";
default:
return "?";
}
}
} // namespace nas
......@@ -8,6 +8,8 @@
#pragma once
#include <utils/json.hpp>
namespace nas
{
......@@ -750,4 +752,6 @@ enum class EQoSOperationCode
MODIFY_EXISTING = 0b011,
};
Json ToJson(const EPduSessionType &v);
} // namespace nas
\ No newline at end of file
......@@ -8,6 +8,8 @@
#include "ie4.hpp"
#include <utils/common.hpp>
namespace nas
{
......@@ -1075,4 +1077,20 @@ void IE5gsTrackingAreaIdentityList::Encode(const IE5gsTrackingAreaIdentityList &
VPartialTrackingAreaIdentityList::Encode(x, stream);
}
Json ToJson(const IEPduAddress &v)
{
switch (v.sessionType)
{
case EPduSessionType::IPV4:
case EPduSessionType::IPV6:
case EPduSessionType::IPV4V6:
return utils::OctetStringToIp(v.pduAddressInformation);
case EPduSessionType::UNSTRUCTURED:
case EPduSessionType::ETHERNET:
return v.pduAddressInformation.toHexString();
default:
return "?";
}
}
} // namespace nas
\ No newline at end of file
......@@ -14,6 +14,8 @@
#include <optional>
#include <utility>
#include <utils/json.hpp>
namespace nas
{
......@@ -570,4 +572,6 @@ struct IE5gsTrackingAreaIdentityList : InformationElement4
static void Encode(const IE5gsTrackingAreaIdentityList &ie, OctetString &stream);
};
Json ToJson(const IEPduAddress &v);
} // namespace nas
......@@ -105,13 +105,6 @@ void UeCmdHandler::handleCmdImpl(NmUeCliCommand &msg)
switch (msg.cmd->present)
{
case app::UeCliCommand::STATUS: {
// TODO
// std::vector<Json> pduSessions{};
// for (auto &pduSession : m_base->appTask->m_pduSessions)
// if (pduSession.has_value())
// pduSessions.push_back(ToJson(*pduSession));
// TODO: include SST, SD, DNN as well..
Json json = Json::Obj({
{"cm-state", ToJson(m_base->nasTask->mm->m_cmState)},
{"rm-state", ToJson(m_base->nasTask->mm->m_rmState)},
......@@ -121,7 +114,6 @@ void UeCmdHandler::handleCmdImpl(NmUeCliCommand &msg)
{"stored-suci", ToJson(m_base->nasTask->mm->m_storage->storedSuci->get())},
{"stored-guti", ToJson(m_base->nasTask->mm->m_storage->storedGuti->get())},
{"has-emergency", ::ToJson(m_base->nasTask->mm->hasEmergency())},
// TODO {"pdu-sessions", Json::Arr(std::move(pduSessions))},
});
sendResult(msg.address, json.dumpYaml());
break;
......@@ -164,6 +156,25 @@ void UeCmdHandler::handleCmdImpl(NmUeCliCommand &msg)
sendResult(msg.address, "PDU session establishment procedure triggered");
break;
}
case app::UeCliCommand::PS_LIST: {
std::vector<Json> arr{};
for (auto *pduSession : m_base->nasTask->sm->m_pduSessions)
{
arr.push_back(Json::Obj({
{"ID", pduSession->psi},
{"state", ToJson(pduSession->psState)},
{"session-type", ToJson(pduSession->sessionType)},
{"apn", ::ToJson(pduSession->apn)},
{"s-nssai", ToJson(pduSession->sNssai)},
{"emergency", pduSession->isEmergency},
{"address", ::ToJson(pduSession->pduAddress)},
{"ambr", ""}, // TODO
{"data-pending", pduSession->uplinkPending},
}));
}
sendResult(msg.address, Json::Arr(arr).dumpYaml());
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