Skip to content

Commit f031a75

Browse files
committed
Binder: added getUeNodeId() for easy access of the LTE/NR nodeId of a UE
1 parent ca38e6c commit f031a75

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/simu5g/common/binder/Binder.cc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,30 @@ MacNodeId Binder::getSecondaryNode(MacNodeId masterEnbId)
432432
return NODEID_NONE;
433433
}
434434

435+
MacNodeId Binder::getUeNodeId(MacNodeId ue, bool isNr)
436+
{
437+
//TODO better impl! mapping via IP address is not ideal.
438+
if (!isValidNodeId(ue) || getNodeTypeById(ue) != UE)
439+
throw cRuntimeError("Binder::getUeNodeId(): bad ueId %hu", num(ue));
440+
441+
inet::Ipv4Address ueIpAddr = getIPv4Address(ue);
442+
if (ueIpAddr == inet::Ipv4Address::UNSPECIFIED_ADDRESS)
443+
throw cRuntimeError("Binder::getUeNodeId(): no IP address for UE %hu", num(ue));
444+
445+
if (isNr) {
446+
// Request for NR nodeId
447+
if (ipAddressToNrMacNodeId_.find(ueIpAddr) != ipAddressToNrMacNodeId_.end())
448+
return ipAddressToNrMacNodeId_[ueIpAddr];
449+
}
450+
else {
451+
// Request for LTE nodeId
452+
if (ipAddressToMacNodeId_.find(ueIpAddr) != ipAddressToMacNodeId_.end())
453+
return ipAddressToMacNodeId_[ueIpAddr];
454+
}
455+
456+
return NODEID_NONE;
457+
}
458+
435459
void Binder::registerMecHost(const inet::L3Address& mecHostAddress)
436460
{
437461
mecHostAddress_.insert(mecHostAddress);

src/simu5g/common/binder/Binder.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,15 @@ class Binder : public cSimpleModule
351351
return ipAddressToNrMacNodeId_[address];
352352
}
353353

354+
/**
355+
* Returns the selected nodeId (LTE/NR) for the given UE.
356+
*
357+
* @param ue The UE's current MacNodeId (can be either LTE or NR)
358+
* @param isNr If true, returns the NR nodeId; if false, returns the LTE nodeId
359+
* @return The requested nodeId, or NODEID_NONE if not found/available
360+
*/
361+
MacNodeId getUeNodeId(MacNodeId ue, bool isNr);
362+
354363
/**
355364
* author Alessandro Noferi
356365
*

0 commit comments

Comments
 (0)