First release
[sim/ns3-o-ran-e2.git] / helper / lte-indication-message-helper.cc
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2022 Northeastern University
4  * Copyright (c) 2022 Sapienza, University of Rome
5  * Copyright (c) 2022 University of Padova
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation;
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  * Author: Andrea Lacava <thecave003@gmail.com>
21  *                 Tommaso Zugno <tommasozugno@gmail.com>
22  *                 Michele Polese <michele.polese@gmail.com>
23  */
24
25
26 #include <ns3/lte-indication-message-helper.h>
27
28 namespace ns3 {
29
30 LteIndicationMessageHelper::LteIndicationMessageHelper (IndicationMessageType type, bool isOffline,
31                                                         bool reducedPmValues)
32     : IndicationMessageHelper (type, isOffline, reducedPmValues)
33 {
34   NS_ABORT_MSG_IF (type == IndicationMessageType::Du,
35                    "Wrong type for LTE Indication Message, expected CuUp or CuCp");
36 }
37
38 void
39 LteIndicationMessageHelper::AddCuUpUePmItem (std::string ueImsiComplete, long txBytes,
40                                              long txDlPackets, double pdcpThroughput,
41                                              double pdcpLatency)
42 {
43   Ptr<MeasurementItemList> ueVal = Create<MeasurementItemList> (ueImsiComplete);
44
45   if (!m_reducedPmValues)
46     {
47       // UE-specific PDCP SDU volume from LTE eNB. Unit is Mbits
48       ueVal->AddItem<long> ("DRB.PdcpSduVolumeDl_Filter.UEID", txBytes);
49
50       // UE-specific number of PDCP SDUs from LTE eNB
51       ueVal->AddItem<long> ("Tot.PdcpSduNbrDl.UEID", txDlPackets);
52
53       // UE-specific Downlink IP combined EN-DC throughput from LTE eNB. Unit is kbps
54       ueVal->AddItem<double> ("DRB.PdcpSduBitRateDl.UEID", pdcpThroughput);
55
56       //UE-specific Downlink IP combined EN-DC throughput from LTE eNB
57       ueVal->AddItem<double> ("DRB.PdcpSduDelayDl.UEID", pdcpLatency);
58     }
59
60   m_msgValues.m_ueIndications.insert (ueVal);
61 }
62
63 void
64 LteIndicationMessageHelper::AddCuUpCellPmItem (double cellAverageLatency)
65 {
66   if (!m_reducedPmValues)
67     {
68       Ptr<MeasurementItemList> cellVal = Create<MeasurementItemList> ();
69       cellVal->AddItem<double> ("DRB.PdcpSduDelayDl", cellAverageLatency);
70       m_msgValues.m_cellMeasurementItems = cellVal;
71     }
72 }
73
74 void
75 LteIndicationMessageHelper::FillCuUpValues (std::string plmId, long pdcpBytesUl, long pdcpBytesDl)
76 {
77   m_cuUpValues->m_pDCPBytesUL = pdcpBytesUl;
78   m_cuUpValues->m_pDCPBytesDL = pdcpBytesDl;
79   FillBaseCuUpValues (plmId);
80 }
81
82 void
83 LteIndicationMessageHelper::FillCuCpValues (uint16_t numActiveUes)
84 {
85   FillBaseCuCpValues (numActiveUes);
86 }
87
88 void
89 LteIndicationMessageHelper::AddCuCpUePmItem (std::string ueImsiComplete, long numDrb,
90                                              long drbRelAct)
91 {
92
93   Ptr<MeasurementItemList> ueVal = Create<MeasurementItemList> (ueImsiComplete);
94   if (!m_reducedPmValues)
95     {
96       ueVal->AddItem<long> ("DRB.EstabSucc.5QI.UEID", numDrb);
97       ueVal->AddItem<long> ("DRB.RelActNbr.5QI.UEID", drbRelAct); // not modeled in the simulator
98     }
99   m_msgValues.m_ueIndications.insert (ueVal);
100 }
101
102 LteIndicationMessageHelper::~LteIndicationMessageHelper ()
103 {
104 }
105
106 } // namespace ns3