Commit e73b1cec authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent 455524d6
...@@ -201,7 +201,7 @@ static nr::ue::UeConfig *ReadConfigYaml() ...@@ -201,7 +201,7 @@ static nr::ue::UeConfig *ReadConfigYaml()
s.isEmergency = yaml::GetBool(sess, "emergency"); s.isEmergency = yaml::GetBool(sess, "emergency");
result->initSessions.push_back(s); result->defaultSessions.push_back(s);
} }
} }
...@@ -317,7 +317,7 @@ static nr::ue::UeConfig *GetConfigByUe(int ueIndex) ...@@ -317,7 +317,7 @@ static nr::ue::UeConfig *GetConfigByUe(int ueIndex)
c->initials = g_refConfig->initials; c->initials = g_refConfig->initials;
c->supportedAlgs = g_refConfig->supportedAlgs; c->supportedAlgs = g_refConfig->supportedAlgs;
c->gnbSearchList = g_refConfig->gnbSearchList; c->gnbSearchList = g_refConfig->gnbSearchList;
c->initSessions = g_refConfig->initSessions; c->defaultSessions = g_refConfig->defaultSessions;
c->configureRouting = g_refConfig->configureRouting; c->configureRouting = g_refConfig->configureRouting;
c->prefixLogger = g_refConfig->prefixLogger; c->prefixLogger = g_refConfig->prefixLogger;
c->integrityMaxRate = g_refConfig->integrityMaxRate; c->integrityMaxRate = g_refConfig->integrityMaxRate;
......
...@@ -108,16 +108,49 @@ std::bitset<16> NasSm::getPduSessionStatus() ...@@ -108,16 +108,49 @@ std::bitset<16> NasSm::getPduSessionStatus()
void NasSm::establishRequiredSessions() void NasSm::establishRequiredSessions()
{ {
if (m_base->config->initSessions.empty()) if (m_mm->hasEmergency())
{ {
m_logger->warn("No initial PDU sessions are configured"); if (!anyEmergencySession())
{
SessionConfig config;
config.type = nas::EPduSessionType::IPV4;
config.apn = std::nullopt;
config.sNssai = std::nullopt;
config.isEmergency = true;
sendEstablishmentRequest(config);
}
return; return;
} }
//m_logger->debug("Initial PDU sessions are establishing [%d#]", m_base->config->initSessions.size()); for (auto &config : m_base->config->defaultSessions)
{
if (!anySessionMatches(config))
sendEstablishmentRequest(config);
}
}
bool NasSm::anySessionMatches(const SessionConfig &config)
{
// ACTIVE_PENDING etc. are also included
return std::any_of(m_pduSessions.begin(), m_pduSessions.end(), [&config](auto &ps) {
if (ps->psState == EPsState::INACTIVE)
return false;
if (config.isEmergency)
return ps->isEmergency;
if (config.isEmergency != ps->isEmergency)
return false;
if (config.type != ps->sessionType)
return false;
if (config.apn != ps->apn)
return false;
if (config.sNssai != ps->sNssai)
return false;
for (auto &sess : m_base->config->initSessions) return true;
sendEstablishmentRequest(sess); });
} }
} // namespace nr::ue } // namespace nr::ue
\ No newline at end of file
...@@ -52,6 +52,7 @@ class NasSm ...@@ -52,6 +52,7 @@ class NasSm
std::bitset<16> getUplinkDataStatus(); std::bitset<16> getUplinkDataStatus();
std::bitset<16> getPduSessionStatus(); std::bitset<16> getPduSessionStatus();
void establishRequiredSessions(); void establishRequiredSessions();
bool anySessionMatches(const SessionConfig &config);
private: /* Transport */ private: /* Transport */
void receiveSmMessage(const nas::SmMessage &msg); void receiveSmMessage(const nas::SmMessage &msg);
......
...@@ -100,7 +100,7 @@ struct UeConfig ...@@ -100,7 +100,7 @@ struct UeConfig
std::optional<std::string> imeiSv{}; std::optional<std::string> imeiSv{};
SupportedAlgs supportedAlgs{}; SupportedAlgs supportedAlgs{};
std::vector<std::string> gnbSearchList{}; std::vector<std::string> gnbSearchList{};
std::vector<SessionConfig> initSessions{}; std::vector<SessionConfig> defaultSessions{};
IntegrityMaxDataRateConfig integrityMaxRate{}; IntegrityMaxDataRateConfig integrityMaxRate{};
/* Read from config file as well, but should be stored in non-volatile /* Read from config file as well, but should be stored in non-volatile
......
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