Commit f460d829 authored by aligungr's avatar aligungr

NAS MM refactor

parent 74452fe7
...@@ -138,6 +138,21 @@ void NasMm::performMmCycle() ...@@ -138,6 +138,21 @@ void NasMm::performMmCycle()
void NasMm::switchMmState(EMmState state, EMmSubState subState) void NasMm::switchMmState(EMmState state, EMmSubState subState)
{ {
ERmState oldRmState = m_rmState;
if (state == EMmState::MM_DEREGISTERED || state == EMmState::MM_REGISTERED_INITIATED)
m_rmState = ERmState::RM_DEREGISTERED;
else if (state == EMmState::MM_REGISTERED || state == EMmState::MM_SERVICE_REQUEST_INITIATED ||
state == EMmState::MM_DEREGISTERED_INITIATED)
m_rmState = ERmState::RM_REGISTERED;
onSwitchRmState(oldRmState, m_rmState);
if (m_base->nodeListener)
{
m_base->nodeListener->onSwitch(app::NodeType::UE, m_base->config->getNodeName(), app::StateType::RM,
ToJson(oldRmState).str(), ToJson(m_rmState).str());
}
EMmState oldState = m_mmState; EMmState oldState = m_mmState;
EMmSubState oldSubState = m_mmSubState; EMmSubState oldSubState = m_mmSubState;
...@@ -160,25 +175,6 @@ void NasMm::switchMmState(EMmState state, EMmSubState subState) ...@@ -160,25 +175,6 @@ void NasMm::switchMmState(EMmState state, EMmSubState subState)
triggerMmCycle(); triggerMmCycle();
} }
void NasMm::switchRmState(ERmState state)
{
ERmState oldState = m_rmState;
m_rmState = state;
onSwitchRmState(oldState, m_rmState);
if (m_base->nodeListener)
{
m_base->nodeListener->onSwitch(app::NodeType::UE, m_base->config->getNodeName(), app::StateType::RM,
ToJson(oldState).str(), ToJson(m_rmState).str());
}
// No need to log it
// m_logger->info("UE switches to state [%s]", RmStateName(state));
triggerMmCycle();
}
void NasMm::switchCmState(ECmState state) void NasMm::switchCmState(ECmState state)
{ {
ECmState oldState = m_cmState; ECmState oldState = m_cmState;
...@@ -258,7 +254,6 @@ void NasMm::onSwitchCmState(ECmState oldState, ECmState newState) ...@@ -258,7 +254,6 @@ void NasMm::onSwitchCmState(ECmState oldState, ECmState newState)
if (regType == nas::ERegistrationType::INITIAL_REGISTRATION || if (regType == nas::ERegistrationType::INITIAL_REGISTRATION ||
regType == nas::ERegistrationType::EMERGENCY_REGISTRATION) regType == nas::ERegistrationType::EMERGENCY_REGISTRATION)
{ {
switchRmState(ERmState::RM_DEREGISTERED);
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA);
switchUState(E5UState::U2_NOT_UPDATED); switchUState(E5UState::U2_NOT_UPDATED);
...@@ -282,8 +277,6 @@ void NasMm::onSwitchCmState(ECmState oldState, ECmState newState) ...@@ -282,8 +277,6 @@ void NasMm::onSwitchCmState(ECmState oldState, ECmState newState)
else if (m_lastDeregistrationRequest->deRegistrationType.switchOff == else if (m_lastDeregistrationRequest->deRegistrationType.switchOff ==
nas::ESwitchOff::NORMAL_DE_REGISTRATION) nas::ESwitchOff::NORMAL_DE_REGISTRATION)
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA);
switchRmState(ERmState::RM_DEREGISTERED);
} }
} }
} }
......
...@@ -77,7 +77,6 @@ void NasMm::sendDeregistration(EDeregCause deregCause) ...@@ -77,7 +77,6 @@ void NasMm::sendDeregistration(EDeregCause deregCause)
switchMmState(EMmState::MM_DEREGISTERED_INITIATED, EMmSubState::MM_DEREGISTERED_INITIATED_NA); switchMmState(EMmState::MM_DEREGISTERED_INITIATED, EMmSubState::MM_DEREGISTERED_INITIATED_NA);
else else
{ {
switchRmState(ERmState::RM_DEREGISTERED);
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA);
} }
} }
...@@ -100,8 +99,6 @@ void NasMm::receiveDeregistrationAccept(const nas::DeRegistrationAcceptUeOrigina ...@@ -100,8 +99,6 @@ void NasMm::receiveDeregistrationAccept(const nas::DeRegistrationAcceptUeOrigina
m_sm->localReleaseAllSessions(); m_sm->localReleaseAllSessions();
switchRmState(ERmState::RM_DEREGISTERED);
if (m_lastDeregCause == EDeregCause::DISABLE_5G) if (m_lastDeregCause == EDeregCause::DISABLE_5G)
switchMmState(EMmState::MM_NULL, EMmSubState::MM_NULL_NA); switchMmState(EMmState::MM_NULL, EMmSubState::MM_NULL_NA);
else else
...@@ -181,7 +178,6 @@ void NasMm::receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTermi ...@@ -181,7 +178,6 @@ void NasMm::receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTermi
} }
sendNasMessage(nas::DeRegistrationAcceptUeTerminated{}); sendNasMessage(nas::DeRegistrationAcceptUeTerminated{});
switchRmState(ERmState::RM_DEREGISTERED);
// "Upon sending a DEREGISTRATION ACCEPT message, the UE shall delete the rejected NSSAI as specified in // "Upon sending a DEREGISTRATION ACCEPT message, the UE shall delete the rejected NSSAI as specified in
// subclause 4.6.2.2." // subclause 4.6.2.2."
......
...@@ -72,7 +72,6 @@ class NasMm ...@@ -72,7 +72,6 @@ class NasMm
void triggerMmCycle(); void triggerMmCycle();
void performMmCycle(); void performMmCycle();
void switchMmState(EMmState state, EMmSubState subState); void switchMmState(EMmState state, EMmSubState subState);
void switchRmState(ERmState state);
void switchCmState(ECmState state); void switchCmState(ECmState state);
void switchUState(E5UState state); void switchUState(E5UState state);
void onSwitchMmState(EMmState oldState, EMmState newState, EMmSubState oldSubState, EMmSubState newSubSate); void onSwitchMmState(EMmState oldState, EMmState newState, EMmSubState oldSubState, EMmSubState newSubSate);
......
...@@ -245,7 +245,6 @@ void NasMm::receiveInitialRegistrationAccept(const nas::RegistrationAccept &msg) ...@@ -245,7 +245,6 @@ void NasMm::receiveInitialRegistrationAccept(const nas::RegistrationAccept &msg)
// 5GMM-REGISTERED and set the 5GS update status to 5U1 UPDATED. // 5GMM-REGISTERED and set the 5GS update status to 5U1 UPDATED.
resetRegAttemptCounter(); resetRegAttemptCounter();
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NORMAL_SERVICE); switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NORMAL_SERVICE);
switchRmState(ERmState::RM_REGISTERED);
switchUState(E5UState::U1_UPDATED); switchUState(E5UState::U1_UPDATED);
// If the REGISTRATION ACCEPT message included a T3512 value IE, the UE shall use the value in the T3512 value IE as // If the REGISTRATION ACCEPT message included a T3512 value IE, the UE shall use the value in the T3512 value IE as
...@@ -356,7 +355,6 @@ void NasMm::receiveMobilityRegistrationAccept(const nas::RegistrationAccept &msg ...@@ -356,7 +355,6 @@ void NasMm::receiveMobilityRegistrationAccept(const nas::RegistrationAccept &msg
resetRegAttemptCounter(); resetRegAttemptCounter();
m_serCounter = 0; m_serCounter = 0;
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NORMAL_SERVICE); switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NORMAL_SERVICE);
switchRmState(ERmState::RM_REGISTERED);
switchUState(E5UState::U1_UPDATED); switchUState(E5UState::U1_UPDATED);
// "If the ACCEPT message included a T3512 value IE, the UE shall use the value in T3512 value IE as // "If the ACCEPT message included a T3512 value IE, the UE shall use the value in T3512 value IE as
...@@ -467,8 +465,6 @@ void NasMm::receiveInitialRegistrationReject(const nas::RegistrationReject &msg) ...@@ -467,8 +465,6 @@ void NasMm::receiveInitialRegistrationReject(const nas::RegistrationReject &msg)
nas::utils::EnumToString(msg.eapMessage->eap->code)); nas::utils::EnumToString(msg.eapMessage->eap->code));
} }
switchRmState(ERmState::RM_DEREGISTERED);
auto handleAbnormalCase = [this, regType, cause]() { auto handleAbnormalCase = [this, regType, cause]() {
m_logger->debug("Handling Registration Reject abnormal case"); m_logger->debug("Handling Registration Reject abnormal case");
...@@ -618,8 +614,6 @@ void NasMm::receiveMobilityRegistrationReject(const nas::RegistrationReject &msg ...@@ -618,8 +614,6 @@ void NasMm::receiveMobilityRegistrationReject(const nas::RegistrationReject &msg
nas::utils::EnumToString(msg.eapMessage->eap->code)); nas::utils::EnumToString(msg.eapMessage->eap->code));
} }
switchRmState(ERmState::RM_DEREGISTERED);
auto handleAbnormalCase = [this, regType, cause]() { auto handleAbnormalCase = [this, regType, cause]() {
m_logger->debug("Handling Registration Reject abnormal case"); m_logger->debug("Handling Registration Reject abnormal case");
......
...@@ -222,7 +222,6 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg) ...@@ -222,7 +222,6 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg)
m_logger->debug("Handling Service Reject abnormal case"); m_logger->debug("Handling Service Reject abnormal case");
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NA); switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NA);
switchRmState(ERmState::RM_REGISTERED);
m_timers->t3517.stop(); m_timers->t3517.stop();
}; };
...@@ -307,43 +306,36 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg) ...@@ -307,43 +306,36 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg)
cause == nas::EMmCause::UE_IDENTITY_CANNOT_BE_DERIVED_FROM_NETWORK) cause == nas::EMmCause::UE_IDENTITY_CANNOT_BE_DERIVED_FROM_NETWORK)
{ {
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA);
switchRmState(ERmState::RM_DEREGISTERED);
} }
if (cause == nas::EMmCause::IMPLICITY_DEREGISTERED) if (cause == nas::EMmCause::IMPLICITY_DEREGISTERED)
{ {
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NORMAL_SERVICE); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NORMAL_SERVICE);
switchRmState(ERmState::RM_DEREGISTERED);
} }
if (cause == nas::EMmCause::PLMN_NOT_ALLOWED || cause == nas::EMmCause::SERVING_NETWORK_NOT_AUTHORIZED) if (cause == nas::EMmCause::PLMN_NOT_ALLOWED || cause == nas::EMmCause::SERVING_NETWORK_NOT_AUTHORIZED)
{ {
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_PLMN_SEARCH); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_PLMN_SEARCH);
switchRmState(ERmState::RM_DEREGISTERED);
} }
if (cause == nas::EMmCause::TA_NOT_ALLOWED) if (cause == nas::EMmCause::TA_NOT_ALLOWED)
{ {
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_LIMITED_SERVICE); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_LIMITED_SERVICE);
switchRmState(ERmState::RM_DEREGISTERED);
} }
if (cause == nas::EMmCause::ROAMING_NOT_ALLOWED_IN_TA) if (cause == nas::EMmCause::ROAMING_NOT_ALLOWED_IN_TA)
{ {
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_PLMN_SEARCH); switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_PLMN_SEARCH);
switchRmState(ERmState::RM_REGISTERED);
} }
if (cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA) if (cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA)
{ {
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_LIMITED_SERVICE); switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_LIMITED_SERVICE);
switchRmState(ERmState::RM_REGISTERED);
} }
if (cause == nas::EMmCause::N1_MODE_NOT_ALLOWED) if (cause == nas::EMmCause::N1_MODE_NOT_ALLOWED)
{ {
switchMmState(EMmState::MM_NULL, EMmSubState::MM_NULL_NA); switchMmState(EMmState::MM_NULL, EMmSubState::MM_NULL_NA);
switchRmState(ERmState::RM_DEREGISTERED);
setN1Capability(false); setN1Capability(false);
} }
...@@ -372,7 +364,6 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg) ...@@ -372,7 +364,6 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg)
if (!hasEmergency()) if (!hasEmergency())
{ {
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NA); switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NA);
switchRmState(ERmState::RM_REGISTERED);
m_timers->t3517.stop(); m_timers->t3517.stop();
} }
...@@ -393,7 +384,6 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg) ...@@ -393,7 +384,6 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg)
if (cause == nas::EMmCause::RESTRICTED_SERVICE_AREA) if (cause == nas::EMmCause::RESTRICTED_SERVICE_AREA)
{ {
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NON_ALLOWED_SERVICE); switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NON_ALLOWED_SERVICE);
switchRmState(ERmState::RM_REGISTERED);
if (m_lastServiceRequest->serviceType.serviceType != nas::EServiceType::ELEVATED_SIGNALLING) if (m_lastServiceRequest->serviceType.serviceType != nas::EServiceType::ELEVATED_SIGNALLING)
sendMobilityRegistration(ERegUpdateCause::RESTRICTED_SERVICE_AREA); sendMobilityRegistration(ERegUpdateCause::RESTRICTED_SERVICE_AREA);
......
...@@ -54,7 +54,6 @@ void NasMm::onTimerExpire(nas::NasTimer &timer) ...@@ -54,7 +54,6 @@ void NasMm::onTimerExpire(nas::NasTimer &timer)
// The UE shall abort the registration procedure for initial registration and the NAS signalling // The UE shall abort the registration procedure for initial registration and the NAS signalling
// connection, if any, shall be released locally if the initial registration request is not for // connection, if any, shall be released locally if the initial registration request is not for
// emergency services.. // emergency services..
switchRmState(ERmState::RM_DEREGISTERED);
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA);
switchUState(E5UState::U2_NOT_UPDATED); switchUState(E5UState::U2_NOT_UPDATED);
...@@ -93,7 +92,6 @@ void NasMm::onTimerExpire(nas::NasTimer &timer) ...@@ -93,7 +92,6 @@ void NasMm::onTimerExpire(nas::NasTimer &timer)
logExpired(); logExpired();
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NA); switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_NA);
switchRmState(ERmState::RM_REGISTERED);
if (m_cmState == ECmState::CM_IDLE && m_lastServiceReqCause != EServiceReqCause::EMERGENCY_FALLBACK) if (m_cmState == ECmState::CM_IDLE && m_lastServiceReqCause != EServiceReqCause::EMERGENCY_FALLBACK)
{ {
...@@ -126,8 +124,6 @@ void NasMm::onTimerExpire(nas::NasTimer &timer) ...@@ -126,8 +124,6 @@ void NasMm::onTimerExpire(nas::NasTimer &timer)
else if (m_lastDeregistrationRequest->deRegistrationType.switchOff == else if (m_lastDeregistrationRequest->deRegistrationType.switchOff ==
nas::ESwitchOff::NORMAL_DE_REGISTRATION) nas::ESwitchOff::NORMAL_DE_REGISTRATION)
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA); switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_NA);
switchRmState(ERmState::RM_DEREGISTERED);
} }
} }
else else
......
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