Commit d7d372bf authored by aligungr's avatar aligungr

CLI improvements

parent e8a6df12
...@@ -443,4 +443,50 @@ void IEEapMessage::Encode(const IEEapMessage &ie, OctetString &stream) ...@@ -443,4 +443,50 @@ void IEEapMessage::Encode(const IEEapMessage &ie, OctetString &stream)
eap::EncodeEapPdu(stream, *ie.eap); eap::EncodeEapPdu(stream, *ie.eap);
} }
Json ToJson(const IE5gsMobileIdentity &v)
{
switch (v.type)
{
case EIdentityType::NO_IDENTITY:
return "no-identitiy";
case EIdentityType::SUCI: {
switch (v.supiFormat)
{
case ESupiFormat::IMSI:
return Json::Obj({
{"plmn", ToJson(v.imsi.plmn)},
{"routing-indicator", v.imsi.routingIndicator},
{"protection-schema", v.imsi.protectionSchemaId},
{"hnp-key-id", ToJson(v.imsi.homeNetworkPublicKeyIdentifier)},
{"scheme-output", v.imsi.schemeOutput},
});
case ESupiFormat::NETWORK_SPECIFIC_IDENTIFIER:
return "nai-" + v.value;
default:
return "?";
}
}
case EIdentityType::GUTI:
return Json::Obj({
{"plmn", ToJson(v.gutiOrTmsi.plmn)},
{"amf-region-id", ToJson(v.gutiOrTmsi.amfRegionId)},
{"amf-set-id", v.gutiOrTmsi.amfSetId},
{"amf-pointer", v.gutiOrTmsi.amfPointer},
{"tmsi", ToJson(v.gutiOrTmsi.tmsi)},
});
case EIdentityType::IMEI:
return "imei-" + v.value;
case EIdentityType::TMSI:
return Json::Obj({
{"amf-set-id", v.gutiOrTmsi.amfSetId},
{"amf-pointer", v.gutiOrTmsi.amfPointer},
{"tmsi", ToJson(v.gutiOrTmsi.tmsi)},
});
case EIdentityType::IMEISV:
return "imeisv-" + v.value;
default:
return "?";
}
}
} // namespace nas } // namespace nas
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "values.hpp" #include "values.hpp"
#include <utils/common_types.hpp> #include <utils/common_types.hpp>
#include <utils/json.hpp>
namespace nas namespace nas
{ {
...@@ -187,7 +188,7 @@ struct IE5gsMobileIdentity : InformationElement6 ...@@ -187,7 +188,7 @@ struct IE5gsMobileIdentity : InformationElement6
ESupiFormat supiFormat; // meaningful if identityType is SUCI ESupiFormat supiFormat; // meaningful if identityType is SUCI
// using at most one of the following 3 members: // using at most one of the following 3 members:
GutiMobileIdentity gutiOrTmsi{}; // used for TMSI and GUTI (first two member not exist in TMSI) GutiMobileIdentity gutiOrTmsi{}; // used for TMSI and GUTI (some members not exist in TMSI)
std::string value{}; // used for IMEI, IMEI-SV, NSI, std::string value{}; // used for IMEI, IMEI-SV, NSI,
ImsiMobileIdentity imsi{}; // used for IMSI ImsiMobileIdentity imsi{}; // used for IMSI
...@@ -203,4 +204,6 @@ struct IEEapMessage : InformationElement6 ...@@ -203,4 +204,6 @@ struct IEEapMessage : InformationElement6
static void Encode(const IEEapMessage &ie, OctetString &stream); static void Encode(const IEEapMessage &ie, OctetString &stream);
}; };
Json ToJson(const IE5gsMobileIdentity &v);
} // namespace nas } // namespace nas
...@@ -88,6 +88,8 @@ void UeCmdHandler::HandleCmdImpl(TaskBase &base, NwUeCliCommand &msg) ...@@ -88,6 +88,8 @@ void UeCmdHandler::HandleCmdImpl(TaskBase &base, NwUeCliCommand &msg)
{"rm-state", ToJson(base.nasTask->mm->m_rmState)}, {"rm-state", ToJson(base.nasTask->mm->m_rmState)},
{"mm-state", ToJson(base.nasTask->mm->m_mmSubState)}, {"mm-state", ToJson(base.nasTask->mm->m_mmSubState)},
{"sim-inserted", base.nasTask->mm->m_validSim}, {"sim-inserted", base.nasTask->mm->m_validSim},
{"stored-suci", ToJson(base.nasTask->mm->m_storedSuci)},
{"stored-guti", ToJson(base.nasTask->mm->m_storedGuti)},
}); });
msg.sendResult(json.dumpYaml()); msg.sendResult(json.dumpYaml());
break; break;
......
...@@ -69,8 +69,8 @@ struct TmsiMobileIdentity ...@@ -69,8 +69,8 @@ struct TmsiMobileIdentity
struct GutiMobileIdentity struct GutiMobileIdentity
{ {
Plmn plmn; Plmn plmn; // Not used in TMSI
octet amfRegionId; octet amfRegionId; // Not used in TMSI
int amfSetId : 10; int amfSetId : 10;
int amfPointer : 6; int amfPointer : 6;
octet4 tmsi; octet4 tmsi;
......
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