Fix JIRA LENA-284, cellId was not being reported in some callbacks and in some situations cellId was being reported 0, now fixed and reporting always correct cellId
--- a/src/lte/helper/lte-helper.cc Wed Nov 14 14:12:48 2012 +0100
+++ b/src/lte/helper/lte-helper.cc Wed Nov 14 15:42:40 2012 +0100
@@ -794,6 +794,31 @@
}
+uint16_t
+FindCellIdFromUeRlcPath (std::string path)
+{
+ NS_LOG_FUNCTION (path);
+ // Sample path input:
+ // /NodeList/#NodeId/DeviceList/#DeviceId/LteUeRrc/RadioBearer/#LCID/RxPDU
+
+ // We retrieve the LteUeNetDevice path
+ std::string lteUeNetDevicePath = path.substr (0, path.find ("/LteUeRrc"));
+ Config::MatchContainer match = Config::LookupMatches (lteUeNetDevicePath);
+
+ if (match.GetN () != 0)
+ {
+ Ptr<Object> ueNetDevice = match.Get (0);
+ NS_LOG_LOGIC ("FindImsiFromUeRlcPath: " << path << ", " << ueNetDevice->GetObject<LteUeNetDevice> ()->GetImsi ());
+ return ueNetDevice->GetObject<LteUeNetDevice> ()->GetRrc ()->GetCellId ();
+ }
+ else
+ {
+ NS_FATAL_ERROR ("Lookup " << lteUeNetDevicePath << " got no matches");
+ }
+
+}
+
+
uint64_t
FindImsiFromEnbMac (std::string path, uint16_t rnti)
{
@@ -866,7 +891,18 @@
imsi = FindImsiFromUeRlcPath (path);
rlcStats->SetImsiPath (path, imsi);
}
- rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay);
+
+ uint16_t cellId = 0;
+ if (rlcStats->ExistsCellIdPath (path) == true)
+ {
+ cellId = rlcStats->GetCellIdPath (path);
+ }
+ else
+ {
+ cellId = FindCellIdFromUeRlcPath (path);
+ rlcStats->SetCellIdPath (path, cellId);
+ }
+ rlcStats->DlRxPdu (cellId, imsi, rnti, lcid, packetSize, delay);
}
void
@@ -894,7 +930,18 @@
imsi = FindImsiFromUeRlcPath (path);
rlcStats->SetImsiPath (path, imsi);
}
- rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize);
+
+ uint16_t cellId = 0;
+ if (rlcStats->ExistsCellIdPath (path) == true)
+ {
+ cellId = rlcStats->GetCellIdPath (path);
+ }
+ else
+ {
+ cellId = FindCellIdFromUeRlcPath (path);
+ rlcStats->SetCellIdPath (path, cellId);
+ }
+ rlcStats->UlTxPdu (cellId, imsi, rnti, lcid, packetSize);
}
void
--- a/src/lte/helper/radio-bearer-stats-calculator.cc Wed Nov 14 14:12:48 2012 +0100
+++ b/src/lte/helper/radio-bearer-stats-calculator.cc Wed Nov 14 15:42:40 2012 +0100
@@ -96,13 +96,14 @@
}
void
-RadioBearerStatsCalculator::UlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
+RadioBearerStatsCalculator::UlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
NS_LOG_FUNCTION (this << "UlTxPDU" << imsi << rnti << (uint32_t) lcid << packetSize);
CheckEpoch ();
ImsiLcidPair_t p (imsi, lcid);
if (Simulator::Now () > m_startTime)
{
+ m_ulCellId[p] = cellId;
m_flowId[p] = LteFlowId_t (rnti, lcid);
m_ulTxPackets[p]++;
m_ulTxData[p] += packetSize;
@@ -154,13 +155,14 @@
}
void
-RadioBearerStatsCalculator::DlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
+RadioBearerStatsCalculator::DlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
NS_LOG_FUNCTION (this << "DlRxPDU" << imsi << rnti << (uint32_t) lcid << packetSize << delay);
CheckEpoch ();
ImsiLcidPair_t p (imsi, lcid);
if (Simulator::Now () > m_startTime)
{
+ m_dlCellId[p] = cellId;
m_dlRxPackets[p]++;
m_dlRxData[p] += packetSize;
--- a/src/lte/helper/radio-bearer-stats-calculator.h Wed Nov 14 14:12:48 2012 +0100
+++ b/src/lte/helper/radio-bearer-stats-calculator.h Wed Nov 14 15:42:40 2012 +0100
@@ -113,13 +113,14 @@
/**
* Notifies the stats calculator that an uplink transmission has occurred.
+ * @param cellId CellId of the attached Enb
* @param imsi IMSI of the UE who transmitted the PDU
* @param rnti C-RNTI of the UE who transmitted the PDU
* @param lcid LCID through which the PDU has been transmitted
* @param packetSize size of the PDU in bytes
*/
void
- UlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize);
+ UlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize);
/**
* Notifies the stats calculator that an uplink reception has occurred.
@@ -146,6 +147,7 @@
/**
* Notifies the stats calculator that an downlink reception has occurred.
+ * @param cellId CellId of the attached Enb
* @param imsi IMSI of the UE who received the PDU
* @param rnti C-RNTI of the UE who received the PDU
* @param lcid LCID through which the PDU has been transmitted
@@ -153,7 +155,7 @@
* @param delay RLC to RLC delay in nanoseconds
*/
void
- DlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay);
+ DlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay);
/**
* Gets the number of transmitted uplink packets.
--- a/src/lte/test/lte-simple-helper.cc Wed Nov 14 14:12:48 2012 +0100
+++ b/src/lte/test/lte-simple-helper.cc Wed Nov 14 15:42:40 2012 +0100
@@ -261,7 +261,8 @@
{
NS_LOG_FUNCTION (rlcStats << path << rnti << (uint16_t)lcid << packetSize << delay);
uint64_t imsi = 333;
- rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay);
+ uint16_t cellId = 555;
+ rlcStats->DlRxPdu (cellId, imsi, rnti, lcid, packetSize, delay);
}
void
@@ -281,7 +282,8 @@
{
NS_LOG_FUNCTION (rlcStats << path << rnti << (uint16_t)lcid << packetSize);
uint64_t imsi = 1111;
- rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize);
+ uint16_t cellId = 555;
+ rlcStats->UlTxPdu (cellId, imsi, rnti, lcid, packetSize);
}
void