A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-test-cell-selection.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 Budiarto Herman
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Budiarto Herman <budiarto.herman@magister.fi>
18 *
19 */
20
21#ifndef LTE_TEST_CELL_SELECTION_H
22#define LTE_TEST_CELL_SELECTION_H
23
24#include <ns3/lte-ue-rrc.h>
25#include <ns3/node-container.h>
26#include <ns3/nstime.h>
27#include <ns3/test.h>
28#include <ns3/vector.h>
29
30#include <vector>
31
32namespace ns3
33{
34
35class LteUeNetDevice;
36
37}
38
39using namespace ns3;
40
41/**
42 * \brief Test suite for executing the cell selection test cases in without-EPC
43 * and with-EPC scenarios.
44 *
45 * \sa ns3::LteCellSelectionTestCase
46 */
48{
49 public:
51};
52
53/**
54 * \ingroup lte
55 *
56 * \brief Testing the initial cell selection procedure by UE at IDLE state in
57 * the beginning of simulation.
58 */
60{
61 public:
62 /**
63 * \brief A set of input parameters for setting up a UE in the simulation.
64 */
65 struct UeSetup_t
66 {
67 Vector position; ///< The position, relative to the inter site distance, where the UE will
68 ///< be spawned in the simulation.
69 bool isCsgMember; ///< Whether UE is allowed access to CSG cell.
70 Time checkPoint; ///< The time in simulation when the UE is verified by the test script.
71 uint16_t expectedCellId1; ///< The cell ID that the UE is expected to attach to (0 means
72 ///< that the UE should not attach to any cell).
73 uint16_t expectedCellId2; ///< An alternative cell ID that the UE is expected to attach to
74 ///< (0 means that this no alternative cell is expected).
75 /**
76 * \brief UE test setup function.
77 * \param relPosX relative position to the inter site distance in X
78 * \param relPosY relative position to the inter site distance in Y
79 * \param isCsgMember if true, simulation is allowed access to CSG cell
80 * \param checkPoint the time in the simulation when the UE is verified
81 * \param expectedCellId1 the cell ID that the UE is expected to attach to
82 * (0 means that the UE should not attach to any cell).
83 * \param expectedCellId2 an alternative cell ID that the UE is expected to attach to
84 * (0 means that this no alternative cell is expected).
85 */
86 UeSetup_t(double relPosX,
87 double relPosY,
88 bool isCsgMember,
90 uint16_t expectedCellId1,
91 uint16_t expectedCellId2);
92 };
93
94 /**
95 * \brief Creates an instance of the initial cell selection test case.
96 * \param name name of this test
97 * \param isEpcMode set to true for setting up simulation with EPC enabled
98 * \param isIdealRrc if true, simulation uses Ideal RRC protocol, otherwise
99 * simulation uses Real RRC protocol
100 * \param interSiteDistance the distance between eNodeB in meters
101 * \param ueSetupList a list of UE configuration to be installed in the
102 * simulation
103 */
104 LteCellSelectionTestCase(std::string name,
105 bool isEpcMode,
106 bool isIdealRrc,
107 double interSiteDistance,
108 std::vector<UeSetup_t> ueSetupList);
109
110 ~LteCellSelectionTestCase() override;
111
112 private:
113 /**
114 * \brief Setup the simulation according to the configuration set by the
115 * class constructor, run it, and verify the result.
116 */
117 void DoRun() override;
118
119 /**
120 * \brief Verifies if the given UE is attached to either of the given two
121 * cells and in a CONNECTED_NORMALLY state.
122 * \param ueDev the UE device
123 * \param expectedCellId1 the first cell ID
124 * \param expectedCellId2 the second cell ID
125 */
126 void CheckPoint(Ptr<LteUeNetDevice> ueDev, uint16_t expectedCellId1, uint16_t expectedCellId2);
127
128 /**
129 * \brief State transition callback function
130 * \param context the context string
131 * \param imsi the IMSI
132 * \param cellId the cell ID
133 * \param rnti the RNTI
134 * \param oldState the old state
135 * \param newState the new state
136 */
137 void StateTransitionCallback(std::string context,
138 uint64_t imsi,
139 uint16_t cellId,
140 uint16_t rnti,
141 LteUeRrc::State oldState,
142 LteUeRrc::State newState);
143 /**
144 * \brief Initial cell selection end ok callback function
145 * \param context the context string
146 * \param imsi the IMSI
147 * \param cellId the cell ID
148 */
149 void InitialCellSelectionEndOkCallback(std::string context, uint64_t imsi, uint16_t cellId);
150 /**
151 * \brief Initial cell selection end error callback function
152 * \param context the context string
153 * \param imsi the IMSI
154 * \param cellId the cell ID
155 */
156 void InitialCellSelectionEndErrorCallback(std::string context, uint64_t imsi, uint16_t cellId);
157 /**
158 * \brief Connection established callback function
159 * \param context the context string
160 * \param imsi the IMSI
161 * \param cellId the cell ID
162 * \param rnti the RNTI
163 */
164 void ConnectionEstablishedCallback(std::string context,
165 uint64_t imsi,
166 uint16_t cellId,
167 uint16_t rnti);
168
169 bool m_isEpcMode; ///< whether the LTE configuration in test is using EPC
170 bool m_isIdealRrc; ///< whether the LTE is configured to use ideal RRC
171 double m_interSiteDistance; ///< inter site distance
172 std::vector<UeSetup_t> m_ueSetupList; ///< UE setup list
173
174 /// The current UE RRC state.
175 std::vector<LteUeRrc::State> m_lastState;
176
177}; // end of class LteCellSelectionTestCase
178
179#endif /* LTE_TEST_CELL_SELECTION_H */
Testing the initial cell selection procedure by UE at IDLE state in the beginning of simulation.
std::vector< UeSetup_t > m_ueSetupList
UE setup list.
void CheckPoint(Ptr< LteUeNetDevice > ueDev, uint16_t expectedCellId1, uint16_t expectedCellId2)
Verifies if the given UE is attached to either of the given two cells and in a CONNECTED_NORMALLY sta...
void InitialCellSelectionEndOkCallback(std::string context, uint64_t imsi, uint16_t cellId)
Initial cell selection end ok callback function.
std::vector< LteUeRrc::State > m_lastState
The current UE RRC state.
void DoRun() override
Setup the simulation according to the configuration set by the class constructor, run it,...
bool m_isEpcMode
whether the LTE configuration in test is using EPC
double m_interSiteDistance
inter site distance
void ConnectionEstablishedCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection established callback function.
void InitialCellSelectionEndErrorCallback(std::string context, uint64_t imsi, uint16_t cellId)
Initial cell selection end error callback function.
bool m_isIdealRrc
whether the LTE is configured to use ideal RRC
void StateTransitionCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, LteUeRrc::State oldState, LteUeRrc::State newState)
State transition callback function.
Test suite for executing the cell selection test cases in without-EPC and with-EPC scenarios.
The LteUeNetDevice class implements the UE net device.
State
The states of the UE RRC entity.
Definition: lte-ue-rrc.h:99
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
encapsulates test code
Definition: test.h:1061
A suite of tests to run.
Definition: test.h:1268
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A set of input parameters for setting up a UE in the simulation.
Vector position
The position, relative to the inter site distance, where the UE will be spawned in the simulation.
uint16_t expectedCellId2
An alternative cell ID that the UE is expected to attach to (0 means that this no alternative cell is...
uint16_t expectedCellId1
The cell ID that the UE is expected to attach to (0 means that the UE should not attach to any cell).
bool isCsgMember
Whether UE is allowed access to CSG cell.
Time checkPoint
The time in simulation when the UE is verified by the test script.