Skip to content

Commit

Permalink
Merge pull request #262 from aligungr/dev
Browse files Browse the repository at this point in the history
v3.1.2
  • Loading branch information
aligungr authored Feb 27, 2021
2 parents a39a01d + 724167d commit 34aca71
Show file tree
Hide file tree
Showing 51 changed files with 1,204 additions and 475 deletions.
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
<a href="https://github.com/aligungr/UERANSIM"><img src="/.github/logo.png" width="75" title="UERANSIM"></a>
</p>
<p align="center">
<img src="https://img.shields.io/badge/UERANSIM-v3.1.1-blue" />
<img src="https://img.shields.io/badge/UERANSIM-v3.1.2-blue" />
<img src="https://img.shields.io/badge/3GPP-R15-orange" />
<img src="https://img.shields.io/badge/License-GPL--3.0-green"/>
</p>

**UERANSIM** <small>(pronounced "ju-i ræn sɪm")</small>, is the open-source state-of-the-art 5G UE and RAN (gNodeB) implementation. It can be considered as a 5G mobile phone and a base station in basic terms. The project can be used for testing 5G Core Network and studying 5G System.
**UERANSIM** <small>(pronounced "ju-i ræn sɪm")</small>, is the open-source state-of-the-art 5G UE and RAN (gNodeB)
implementation. It can be considered as a 5G mobile phone and a base station in basic terms. The project can be used for
testing 5G Core Network and studying 5G System.

## Current Status
Our UE and gNodeB are functional and ready to use. You can connect them to your 5G core network right now and start using it.

Our UE and gNodeB are functional and ready to use. You can connect them to your 5G core network right now and start
using it.

In terms of 3GPP coverage, fundamental control plane features are done. However, some of them are in progress.

At the same time, 5G-NR radio interface is under development but not complete yet. Currently we utilize the radio interface over a simulated environment.
At the same time, 5G-NR radio interface is under development but not complete yet. Currently we utilize the radio
interface over a simulated environment.

<p align="center">
<img src="https://img.shields.io/badge/5G%20Radio%20Interface-in%20progress-orange" alt="OS Linux"/>
Expand All @@ -23,20 +28,28 @@ At the same time, 5G-NR radio interface is under development but not complete ye
</p>

## Documentation

You can find the documentation on [UERANSIM Wiki](https://github.com/aligungr/UERANSIM/wiki).

And, since the project is rapidly developing, please make sure that you have always the [latest](https://github.com/aligungr/UERANSIM/releases) UERANSIM.
And, since the project is rapidly developing, please make sure that you have always
the [latest](https://github.com/aligungr/UERANSIM/releases) UERANSIM.

## Contributing

Implementing UE and RAN is not an easy task and is very time-consuming. We are always open to public contributions and pull requests.
Implementing UE and RAN is not an easy task and is very time-consuming. We are always open to public contributions and
pull requests.

## Supporting

UERANSIM is the first and currently only open source project that implements 5G-SA UE and RAN. Commercial alternatives of this software cost hundreds of thousands of dollars. You can support this free and open source software by:
UERANSIM is the first and currently only open source project that implements 5G-SA UE and RAN. Commercial alternatives
of this software cost hundreds of thousands of dollars. You can support this free and open source software by:

- Donating on [Open Collective](https://opencollective.com/UERANSIM)
- Starring our GitHub repository,
- Creating pull requests, submitting bugs, suggesting new features or documentation updates.

## License

Copyright (c) 2021 ALİ GÜNGÖR. All source code and related files including documentation and wiki pages are licensed under [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), see [LICENSE](https://github.com/aligungr/UERANSIM/blob/master/LICENSE) for more details.
Copyright (c) 2021 ALİ GÜNGÖR. All source code and related files including documentation and wiki pages are licensed
under [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.en.html),
see [LICENSE](https://github.com/aligungr/UERANSIM/blob/master/LICENSE) for more details.
17 changes: 12 additions & 5 deletions config/custom-ue.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 or 16 digits)
supi: 'imsi-286010000000001'
# Mobile Country Code value
# Mobile Country Code value of HPLMN
mcc: '286'
# Mobile Network Code value (2 or 3 digits)
# Mobile Network Code value of HPLMN (2 or 3 digits)
mnc: '93'

# Permanent subscription key
Expand Down Expand Up @@ -30,16 +30,23 @@ sessions:
sst: 1
sd: 1

# List of requested S-NSSAIs by this UE
slices:
# Configured NSSAI for this UE by HPLMN
configured-nssai:
- sst: 1
sd: 1

# Supported encryption and integrity algorithms by this UE
# Default Configured NSSAI for this UE
default-nssai:
- sst: 1
sd: 1

# Supported encryption algorithms by this UE
integrity:
IA1: true
IA2: true
IA3: true

# Supported integrity algorithms by this UE
ciphering:
EA1: true
EA2: true
Expand Down
19 changes: 13 additions & 6 deletions config/free5gc-ue.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 or 16 digits)
supi: 'imsi-208930000000003'
# Mobile Country Code value
# Mobile Country Code value of HPLMN
mcc: '208'
# Mobile Network Code value (2 or 3 digits)
# Mobile Network Code value of HPLMN (2 or 3 digits)
mnc: '93'

# Permanent subscription key
key: '8baf473f2f8fd09487cccbd7097c6862'
# Operator code (OP or OPC) of the UE
op: '8e27b6af0e692e750f32667a3b14605d'
# This value specifies the OP type and it can be either 'OP' or 'OPC'
opType: 'OP'
opType: 'OPC'
# Authentication Management Field (AMF) value
amf: '8000'
# IMEI number of the device. It is used if no SUPI is provided
Expand All @@ -30,16 +30,23 @@ sessions:
sst: 0x01
sd: 0x010203

# List of requested S-NSSAIs by this UE
slices:
# Configured NSSAI for this UE by HPLMN
configured-nssai:
- sst: 0x01
sd: 0x010203

# Supported encryption and integrity algorithms by this UE
# Default Configured NSSAI for this UE
default-nssai:
- sst: 1
sd: 1

# Supported encryption algorithms by this UE
integrity:
IA1: true
IA2: true
IA3: true

# Supported integrity algorithms by this UE
ciphering:
EA1: true
EA2: true
Expand Down
21 changes: 14 additions & 7 deletions config/open5gs-ue.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 or 16 digits)
supi: 'imsi-901700000000003'
# Mobile Country Code value
supi: 'imsi-901700000000001'
# Mobile Country Code value of HPLMN
mcc: '901'
# Mobile Network Code value (2 or 3 digits)
# Mobile Network Code value of HPLMN (2 or 3 digits)
mnc: '70'

# Permanent subscription key
key: '465B5CE8B199B49FAA5F0A2EE238A6BC'
# Operator code (OP or OPC) of the UE
op: 'E8ED289DEBA952E4283B54E88E6183CA'
# This value specifies the OP type and it can be either 'OP' or 'OPC'
opType: 'OP'
opType: 'OPC'
# Authentication Management Field (AMF) value
amf: '8000'
# IMEI number of the device. It is used if no SUPI is provided
Expand All @@ -30,16 +30,23 @@ sessions:
sst: 1
sd: 1

# List of requested S-NSSAIs by this UE
slices:
# Configured NSSAI for this UE by HPLMN
configured-nssai:
- sst: 1
sd: 1

# Supported encryption and integrity algorithms by this UE
# Default Configured NSSAI for this UE
default-nssai:
- sst: 1
sd: 1

# Supported encryption algorithms by this UE
integrity:
IA1: true
IA2: true
IA3: true

# Supported integrity algorithms by this UE
ciphering:
EA1: true
EA2: true
Expand Down
4 changes: 2 additions & 2 deletions src/gnb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ static nr::gnb::GnbConfig *ReadConfigYaml()

for (auto &nssai : yaml::GetSequence(config, "slices"))
{
SliceSupport s{};
SingleSlice s{};
s.sst = yaml::GetInt32(nssai, "sst", 1, 0xFF);
if (yaml::HasField(nssai, "sd"))
s.sd = octet3{yaml::GetInt32(nssai, "sd", 1, 0xFFFFFF)};
result->nssais.push_back(s);
result->nssai.slices.push_back(s);
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion src/gnb/mr/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void GnbMrTask::onLoop()
break;
}
case NwGnbRrcToMr::AN_RELEASE: {
m_rlsEntity->localReleaseConnection(w->ueId, rls::ECause::RRC_RELEASE);
m_rlsEntity->localReleaseConnection(w->ueId, rls::ECause::RRC_NORMAL_RELEASE);
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/gnb/ngap/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#include <asn/ngap/ASN_NGAP_InitiatingMessage.h>
#include <asn/ngap/ASN_NGAP_NGAP-PDU.h>
#include <asn/ngap/ASN_NGAP_NGSetupRequest.h>
#include <asn/ngap/ASN_NGAP_OverloadStartNSSAIItem.h>
#include <asn/ngap/ASN_NGAP_PLMNSupportItem.h>
#include <asn/ngap/ASN_NGAP_ProtocolIE-Field.h>
#include <asn/ngap/ASN_NGAP_ServedGUAMIItem.h>
#include <asn/ngap/ASN_NGAP_SliceSupportItem.h>
#include <asn/ngap/ASN_NGAP_SupportedTAItem.h>
#include <asn/ngap/ASN_NGAP_OverloadStartNSSAIItem.h>

namespace nr::gnb
{
Expand Down Expand Up @@ -67,7 +67,7 @@ static void AssignDefaultAmfConfigs(NgapAmfContext *amf, T *msg)
auto plmnSupport = new PlmnSupport();
ngap_utils::PlmnFromAsn_Ref(item.pLMNIdentity, plmnSupport->plmn);
asn::ForeachItem(item.sliceSupportList, [plmnSupport](ASN_NGAP_SliceSupportItem &ssItem) {
plmnSupport->sliceSupportList.push_back(ngap_utils::SliceSupportFromAsn_Unique(ssItem));
plmnSupport->sliceSupportList.slices.push_back(ngap_utils::SliceSupportFromAsn(ssItem));
});
amf->plmnSupportList.push_back(plmnSupport);
});
Expand Down Expand Up @@ -139,7 +139,7 @@ void NgapTask::sendNgSetupRequest(int amfId)

auto *broadcastPlmn = asn::New<ASN_NGAP_BroadcastPLMNItem>();
asn::SetOctetString3(broadcastPlmn->pLMNIdentity, ngap_utils::PlmnToOctet3(m_base->config->plmn));
for (auto &nssai : m_base->config->nssais)
for (auto &nssai : m_base->config->nssai.slices)
{
auto *item = asn::New<ASN_NGAP_SliceSupportItem>();
asn::SetOctetString1(item->s_NSSAI.sST, static_cast<uint8_t>(nssai.sst));
Expand Down
5 changes: 2 additions & 3 deletions src/gnb/ngap/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,9 @@ void NgapTask::receiveSessionResourceSetupRequest(int amfId, ASN_NGAP_PDUSession
sendNgapUeAssociated(ue->ctxId, respPdu);

if (failedList.empty())
m_logger->info("PDU session resource is established for UE[%d] count[%d]", ue->ctxId, successList.size());
m_logger->info("PDU session resource is setup for UE[%d] count[%d]", ue->ctxId, successList.size());
else if (successList.empty())
m_logger->err("PDU session resource establishment was failed for UE[%d] count[%d]", ue->ctxId,
failedList.size());
m_logger->err("PDU session resource setup was failed for UE[%d] count[%d]", ue->ctxId, failedList.size());
else
m_logger->err("PDU session establishment is partially successful for UE[%d], success[%d], failed[%d]",
successList.size(), failedList.size());
Expand Down
10 changes: 5 additions & 5 deletions src/gnb/ngap/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ void GuamiFromAsn_Ref(const ASN_NGAP_GUAMI_t &guami, Guami &target)
PlmnFromAsn_Ref(guami.pLMNIdentity, target.plmn);
}

std::unique_ptr<SliceSupport> SliceSupportFromAsn_Unique(ASN_NGAP_SliceSupportItem &supportItem)
SingleSlice SliceSupportFromAsn(ASN_NGAP_SliceSupportItem &supportItem)
{
auto s = std::make_unique<SliceSupport>();
s->sst = asn::GetOctet1(supportItem.s_NSSAI.sST);
s->sd = std::nullopt;
SingleSlice s{};
s.sst = asn::GetOctet1(supportItem.s_NSSAI.sST);
s.sd = std::nullopt;
if (supportItem.s_NSSAI.sD)
s->sd = asn::GetOctet3(*supportItem.s_NSSAI.sD);
s.sd = asn::GetOctet3(*supportItem.s_NSSAI.sD);
return s;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gnb/ngap/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void GuamiFromAsn_Ref(const ASN_NGAP_GUAMI_t &guami, Guami &target);
void ToCauseAsn_Ref(NgapCause source, ASN_NGAP_Cause_t &target);
void ToPlmnAsn_Ref(const Plmn &source, ASN_NGAP_PLMNIdentity_t &target);

std::unique_ptr<SliceSupport> SliceSupportFromAsn_Unique(ASN_NGAP_SliceSupportItem &supportItem);
SingleSlice SliceSupportFromAsn(ASN_NGAP_SliceSupportItem &supportItem);

NgapIdPair FindNgapIdPairFromAsnNgapIds(const ASN_NGAP_UE_NGAP_IDs &ngapIDs);

Expand Down
2 changes: 1 addition & 1 deletion src/gnb/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Json ToJson(const GnbConfig &v)
{"nci", v.nci},
{"plmn", ToJson(v.plmn)},
{"tac", v.tac},
{"nssai", ToJson(v.nssais)},
{"nssai", ToJson(v.nssai)},
{"ngap-ip", v.ngapIp},
{"gtp-ip", v.gtpIp},
{"paging-drx", ToJson(v.pagingDrx)},
Expand Down
2 changes: 1 addition & 1 deletion src/gnb/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ struct GnbConfig
int gnbIdLength{}; // 22..32 bit
Plmn plmn{};
int tac{};
std::vector<SliceSupport> nssais{};
NetworkSlice nssai{};
std::vector<GnbAmfConfig> amfConfigs{};
std::string portalIp{};
std::string ngapIp{};
Expand Down
4 changes: 2 additions & 2 deletions src/nas/ie1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ struct IENasKeySetIdentifier : InformationElement1

struct IENetworkSlicingIndication : InformationElement1
{
ENetworkSlicingSubscriptionChangeIndication nssci{};
EDefaultConfiguredNssaiIndication dcni{};
ENetworkSlicingSubscriptionChangeIndication nssci{}; // This is spare if dir is UE->NW
EDefaultConfiguredNssaiIndication dcni{}; // This is spare if dir is NW->UE

IENetworkSlicingIndication() = default;
IENetworkSlicingIndication(ENetworkSlicingSubscriptionChangeIndication nssci,
Expand Down
23 changes: 12 additions & 11 deletions src/nas/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "timer.hpp"

#include <sstream>
#include <utils/common.hpp>

namespace nas
Expand Down Expand Up @@ -96,16 +97,16 @@ bool NasTimer::performTick()
if (running)
{
long currentMs = utils::CurrentTimeMillis();
long deltaSec = (currentMs - startMillis) / 1000;
long deltaSec = (currentMs - startMillis) / 1000LL;
long remainingSec = interval - deltaSec;

if (currentMs - _lastDebugPrintMs > 10 * 1000)
if (currentMs - _lastDebugPrintMs > 10LL * 1000LL)
{
_lastDebugPrintMs = currentMs;
// Log.debug(Tag.TIMER, "NAS Timer %s int:%ss rem:%ss", timerCode, interval, remainingSec);
}

if (remainingSec < 0)
if (remainingSec <= 0LL)
{
stop(false);
expiryCount++;
Expand All @@ -125,8 +126,8 @@ int NasTimer::getRemaining() const
if (!running)
return 0;

long elapsed = utils::CurrentTimeMillis() - startMillis;
return static_cast<int>(std::max(interval - elapsed, 0L));
int elapsed = static_cast<int>((utils::CurrentTimeMillis() - startMillis) / 1000LL);
return std::max(interval - elapsed, 0);
}

void NasTimer::resetExpiryCount()
Expand All @@ -141,13 +142,13 @@ int NasTimer::getExpiryCount() const

Json ToJson(const NasTimer &v)
{
int interval = v.getInterval();
std::stringstream ss{};
if (v.isRunning())
ss << "rem[" << v.getRemaining() << "] int[" << v.getInterval() << "]";
else
ss << ".";

return Json::Obj({
{"interval", interval == INT32_MAX ? Json{"inf"} : interval},
{"remaining", v.getRemaining()},
{"running", v.isRunning()},
});
return ss.str();
}

} // namespace nas
Loading

0 comments on commit 34aca71

Please sign in to comment.