First release
[sim/ns3-o-ran-e2.git] / helper / 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 #include <ns3/indication-message-helper.h>
26
27 namespace ns3 {
28
29 IndicationMessageHelper::IndicationMessageHelper (IndicationMessageType type, bool isOffline,
30                                                   bool reducedPmValues)
31     : m_type (type), m_offline (isOffline), m_reducedPmValues (reducedPmValues)
32 {
33
34   if (!m_offline)
35     {
36       switch (type)
37         {
38         case IndicationMessageType::CuUp:
39           m_cuUpValues = Create<OCuUpContainerValues> ();
40           break;
41
42         case IndicationMessageType::CuCp:
43           m_cuCpValues = Create<OCuCpContainerValues> ();
44           m_msgValues.m_cellObjectId = "NRCellCU";
45           break;
46
47         case IndicationMessageType::Du:
48           m_duValues = Create<ODuContainerValues> ();
49           break;
50
51         default:
52
53           break;
54         }
55     }
56 }
57
58 void
59 IndicationMessageHelper::FillBaseCuUpValues (std::string plmId)
60 {
61   NS_ABORT_MSG_IF (m_type != IndicationMessageType::CuUp, "Wrong function for this object");
62   m_cuUpValues->m_plmId = plmId;
63   m_msgValues.m_pmContainerValues = m_cuUpValues;
64 }
65
66 void
67 IndicationMessageHelper::FillBaseCuCpValues (uint16_t numActiveUes)
68 {
69   NS_ABORT_MSG_IF (m_type != IndicationMessageType::CuCp, "Wrong function for this object");
70   m_cuCpValues->m_numActiveUes = numActiveUes;
71   m_msgValues.m_pmContainerValues = m_cuCpValues;
72 }
73
74 IndicationMessageHelper::~IndicationMessageHelper ()
75 {
76 }
77
78 Ptr<KpmIndicationMessage>
79 IndicationMessageHelper::CreateIndicationMessage ()
80 {
81   return Create<KpmIndicationMessage> (m_msgValues);
82 }
83
84 } // namespace ns3