Skip to content

Commit

Permalink
Merge pull request #4 from prateekbhaisora/feature/intelligent-amf-se…
Browse files Browse the repository at this point in the history
…lection
  • Loading branch information
priyanshs authored Jan 6, 2025
2 parents 90c4026 + ef42482 commit 933bca2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/gnb/ngap/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void NgapTask::createAmfContext(const GnbAmfConfig &conf)
m_amfCtx[ctx->ctxId] = ctx;
}

void NgapTask::createUeContext(int ueId, const int32_t &requestedSliceType)
void NgapTask::createUeContext(int ueId, int32_t &requestedSliceType)
{
auto *ctx = new NgapUeContext(ueId);
ctx->amfUeNgapId = -1;
Expand Down
7 changes: 4 additions & 3 deletions src/gnb/ngap/nas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ namespace nr::gnb
int32_t extractSliceInfoAndModifyPdu(OctetString &nasPdu) {
nas::RegistrationRequest *regRequest = nullptr;
int32_t requestedSliceType = -1;
auto m_data = nasPdu.getData();
OctetView octetView(m_data.data(), m_data.size());
const uint8_t *m_data = nasPdu.data();
size_t m_dataLength = nasPdu.length();
OctetView octetView(m_data, m_dataLength);
auto nasMessage = nas::DecodeNasMessage(octetView);
if (nasMessage->epd == nas::EExtendedProtocolDiscriminator::MOBILITY_MANAGEMENT_MESSAGES)
{
Expand All @@ -46,7 +47,7 @@ int32_t extractSliceInfoAndModifyPdu(OctetString &nasPdu) {
{
auto sz = regRequest->requestedNSSAI->sNssais.size();
if (sz > 0) {
requestedSliceType = static_cast<int32_t>(regRequest->requestedNSSAI->sNssais[0].sst.getValue());
requestedSliceType = static_cast<uint8_t>(regRequest->requestedNSSAI->sNssais[0].sst);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/gnb/ngap/nnsf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
namespace nr::gnb
{

NgapAmfContext *NgapTask::selectAmf(int ueId, const int32_t &requestedSliceType)
NgapAmfContext *NgapTask::selectAmf(int ueId, int32_t &requestedSliceType)
{
for (auto &amf : m_amfCtx) {
for (const auto &PlmnSupport : amf.second->plmnSupportList) {
for (const auto &SingleSlice : PlmnSupport->sliceSupportList.slices) {
int32_t supportedSliceType = static_cast<int32_t>(SingleSlice.sst.getValue());
for (const auto &plmnSupport : amf.second->plmnSupportList) {
for (const auto &singleSlice : plmnSupport->sliceSupportList.slices) {
int32_t supportedSliceType = static_cast<int32_t>(singleSlice.sst);
if (supportedSliceType == requestedSliceType) {
return amf.second;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gnb/ngap/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class NgapTask : public NtsTask
/* Utility functions */
void createAmfContext(const GnbAmfConfig &config);
NgapAmfContext *findAmfContext(int ctxId);
void createUeContext(int ueId, const int32_t &requestedSliceType);
void createUeContext(int ueId, int32_t &requestedSliceType);
NgapUeContext *findUeContext(int ctxId);
NgapUeContext *findUeByRanId(int64_t ranUeNgapId);
NgapUeContext *findUeByAmfId(int64_t amfUeNgapId);
Expand Down Expand Up @@ -118,7 +118,7 @@ class NgapTask : public NtsTask
void sendContextRelease(int ueId, NgapCause cause);

/* NAS Node Selection */
NgapAmfContext *selectAmf(int ueId, const int32_t &requestedSliceType);
NgapAmfContext *selectAmf(int ueId, int32_t &requestedSliceType);
NgapAmfContext *selectNewAmfForReAllocation(int ueId, int initiatedAmfId, int amfSetId);

/* Radio resource control */
Expand Down
5 changes: 0 additions & 5 deletions src/utils/octet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ struct octet
{
}

inline uint8_t getValue() const
{
return value;
}

/* no explicit */ octet(int32_t value) noexcept : value(static_cast<uint8_t>(value & 0xFF))
{
}
Expand Down
5 changes: 0 additions & 5 deletions src/utils/octet_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ class OctetString
{
}

const std::vector<uint8_t>& getData() const
{
return m_data;
}

explicit OctetString(std::vector<uint8_t> &&data) : m_data(std::move(data))
{
}
Expand Down

0 comments on commit 933bca2

Please sign in to comment.