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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Budiarto Herman <budiarto.herman@magister.fi>
7 *
8 */
9
10#ifndef LTE_TEST_CELL_SELECTION_H
11#define LTE_TEST_CELL_SELECTION_H
12
13#include <ns3/lte-ue-rrc.h>
14#include <ns3/node-container.h>
15#include <ns3/nstime.h>
16#include <ns3/test.h>
17#include <ns3/vector.h>
18
19#include <vector>
20
21namespace ns3
22{
23
24class LteUeNetDevice;
25
26}
27
28using namespace ns3;
29
30/**
31 * \brief Test suite for executing the cell selection test cases in without-EPC
32 * and with-EPC scenarios.
33 *
34 * \sa ns3::LteCellSelectionTestCase
35 */
37{
38 public:
40};
41
42/**
43 * \ingroup lte
44 *
45 * \brief Testing the initial cell selection procedure by UE at IDLE state in
46 * the beginning of simulation.
47 */
49{
50 public:
51 /**
52 * \brief A set of input parameters for setting up a UE in the simulation.
53 */
54 struct UeSetup_t
55 {
56 Vector position; ///< The position, relative to the inter site distance, where the UE will
57 ///< be spawned in the simulation.
58 bool isCsgMember; ///< Whether UE is allowed access to CSG cell.
59 Time checkPoint; ///< The time in simulation when the UE is verified by the test script.
60 uint16_t expectedCellId1; ///< The cell ID that the UE is expected to attach to (0 means
61 ///< that the UE should not attach to any cell).
62 uint16_t expectedCellId2; ///< An alternative cell ID that the UE is expected to attach to
63 ///< (0 means that this no alternative cell is expected).
64 /**
65 * \brief UE test setup function.
66 * \param relPosX relative position to the inter site distance in X
67 * \param relPosY relative position to the inter site distance in Y
68 * \param isCsgMember if true, simulation is allowed access to CSG cell
69 * \param checkPoint the time in the simulation when the UE is verified
70 * \param expectedCellId1 the cell ID that the UE is expected to attach to
71 * (0 means that the UE should not attach to any cell).
72 * \param expectedCellId2 an alternative cell ID that the UE is expected to attach to
73 * (0 means that this no alternative cell is expected).
74 */
75 UeSetup_t(double relPosX,
76 double relPosY,
77 bool isCsgMember,
79 uint16_t expectedCellId1,
80 uint16_t expectedCellId2);
81 };
82
83 /**
84 * \brief Creates an instance of the initial cell selection test case.
85 * \param name name of this test
86 * \param isEpcMode set to true for setting up simulation with EPC enabled
87 * \param isIdealRrc if true, simulation uses Ideal RRC protocol, otherwise
88 * simulation uses Real RRC protocol
89 * \param interSiteDistance the distance between eNodeB in meters
90 * \param ueSetupList a list of UE configuration to be installed in the
91 * simulation
92 */
93 LteCellSelectionTestCase(std::string name,
94 bool isEpcMode,
95 bool isIdealRrc,
96 double interSiteDistance,
97 std::vector<UeSetup_t> ueSetupList);
98
100
101 private:
102 /**
103 * \brief Setup the simulation according to the configuration set by the
104 * class constructor, run it, and verify the result.
105 */
106 void DoRun() override;
107
108 /**
109 * \brief Verifies if the given UE is attached to either of the given two
110 * cells and in a CONNECTED_NORMALLY state.
111 * \param ueDev the UE device
112 * \param expectedCellId1 the first cell ID
113 * \param expectedCellId2 the second cell ID
114 */
115 void CheckPoint(Ptr<LteUeNetDevice> ueDev, uint16_t expectedCellId1, uint16_t expectedCellId2);
116
117 /**
118 * \brief State transition callback function
119 * \param context the context string
120 * \param imsi the IMSI
121 * \param cellId the cell ID
122 * \param rnti the RNTI
123 * \param oldState the old state
124 * \param newState the new state
125 */
126 void StateTransitionCallback(std::string context,
127 uint64_t imsi,
128 uint16_t cellId,
129 uint16_t rnti,
130 LteUeRrc::State oldState,
131 LteUeRrc::State newState);
132 /**
133 * \brief Initial cell selection end ok callback function
134 * \param context the context string
135 * \param imsi the IMSI
136 * \param cellId the cell ID
137 */
138 void InitialCellSelectionEndOkCallback(std::string context, uint64_t imsi, uint16_t cellId);
139 /**
140 * \brief Initial cell selection end error callback function
141 * \param context the context string
142 * \param imsi the IMSI
143 * \param cellId the cell ID
144 */
145 void InitialCellSelectionEndErrorCallback(std::string context, uint64_t imsi, uint16_t cellId);
146 /**
147 * \brief Connection established callback function
148 * \param context the context string
149 * \param imsi the IMSI
150 * \param cellId the cell ID
151 * \param rnti the RNTI
152 */
153 void ConnectionEstablishedCallback(std::string context,
154 uint64_t imsi,
155 uint16_t cellId,
156 uint16_t rnti);
157
158 bool m_isEpcMode; ///< whether the LTE configuration in test is using EPC
159 bool m_isIdealRrc; ///< whether the LTE is configured to use ideal RRC
160 double m_interSiteDistance; ///< inter site distance
161 std::vector<UeSetup_t> m_ueSetupList; ///< UE setup list
162
163 /// The current UE RRC state.
164 std::vector<LteUeRrc::State> m_lastState;
165
166}; // end of class LteCellSelectionTestCase
167
168#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.
LteCellSelectionTestCase(std::string name, bool isEpcMode, bool isIdealRrc, double interSiteDistance, std::vector< UeSetup_t > ueSetupList)
Creates an instance of the initial cell selection test case.
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:88
Smart pointer class similar to boost::intrusive_ptr.
encapsulates test code
Definition test.h:1050
A suite of tests to run.
Definition test.h:1267
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
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.
UeSetup_t(double relPosX, double relPosY, bool isCsgMember, Time checkPoint, uint16_t expectedCellId1, uint16_t expectedCellId2)
UE test setup function.