23 #include <ns3/core-module.h> 24 #include <ns3/network-module.h> 25 #include <ns3/mobility-module.h> 26 #include <ns3/lte-module.h> 58 uint32_t tConnIncrPerUe,
59 uint32_t delayDiscStart,
62 bool admitRrcConnectionRequest,
63 std::string description =
"");
67 virtual void DoRun (
void);
83 static std::string BuildNameString (uint32_t nUes,
86 uint32_t tConnIncrPerUe,
87 uint32_t delayDiscStart,
89 bool admitRrcConnectionRequest,
90 std::string description =
"");
116 void ConnectionEstablishedCallback (std::string context, uint64_t imsi,
117 uint16_t cellId, uint16_t rnti);
125 void ConnectionTimeoutCallback (std::string context, uint64_t imsi,
126 uint16_t cellId, uint16_t rnti);
147 uint32_t tConnIncrPerUe,
148 uint32_t delayDiscStart,
150 bool admitRrcConnectionRequest,
151 std::string description)
153 std::ostringstream oss;
154 oss <<
"nUes=" << nUes
155 <<
", nBearers=" << nBearers
156 <<
", tConnBase=" << tConnBase
157 <<
", tConnIncrPerUe=" << tConnIncrPerUe
158 <<
", delayDiscStart=" << delayDiscStart;
162 oss <<
", ideal RRC";
169 if (admitRrcConnectionRequest)
171 oss <<
", admitRrcConnectionRequest = true";
175 oss <<
", admitRrcConnectionRequest = false";
178 if (!description.empty ())
180 oss <<
", " << description;
187 uint32_t nUes, uint32_t nBearers,
188 uint32_t tConnBase, uint32_t tConnIncrPerUe, uint32_t delayDiscStart,
189 bool errorExpected,
bool useIdealRrc,
bool admitRrcConnectionRequest,
190 std::string description)
191 :
TestCase (BuildNameString (nUes, nBearers,
192 tConnBase, tConnIncrPerUe, delayDiscStart,
193 useIdealRrc, admitRrcConnectionRequest,
196 m_nBearers (nBearers),
197 m_tConnBase (tConnBase),
198 m_tConnIncrPerUe (tConnIncrPerUe),
200 m_delayDiscStart (delayDiscStart),
202 m_useIdealRrc (useIdealRrc),
203 m_admitRrcConnectionRequest (admitRrcConnectionRequest)
209 double nRaAttempts = 0;
220 nRaAttempts += std::ceil (nUes / 4.0);
221 double dra = nRaAttempts * 7;
222 double dce = 10.0 + (2.0 * nUes) / 4.0;
252 double dcr = (10.0 + (2.0 * nUes) / 4.0) * (
m_nBearers + nCrs);
294 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
312 it != enbDevs.
End ();
344 uint64_t imsi = ueLteDevice->
GetImsi ();
351 Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
354 Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
362 Simulator::Destroy ();
385 const uint64_t imsi = ueLteDevice->
GetImsi ();
386 const uint16_t rnti = ueRrc->GetRnti ();
389 "Invalid IMSI " << imsi);
394 "Connection with RNTI " << rnti <<
" should have been rejected");
403 "RNTI " << rnti <<
" fails to establish connection");
405 "RNTI " << rnti <<
" is not at CONNECTED_NORMALLY state");
411 const bool hasContext = enbRrc->HasUeManager (rnti);
418 UeManager::CONNECTED_NORMALLY,
419 "The context of RNTI " << rnti <<
" is in invalid state");
423 NS_LOG_WARN (
this <<
" RNTI " << rnti <<
" thinks that it has" 424 <<
" established connection but the eNodeB thinks" 425 <<
" that the UE has failed on connection setup.");
435 uint16_t ueCellId = ueRrc->GetCellId ();
436 uint16_t enbCellId = enbLteDevice->GetCellId ();
437 uint16_t ueImsi = ueLteDevice->
GetImsi ();
439 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
440 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
441 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
442 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth ();
443 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
444 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn ();
445 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
446 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn ();
459 uint16_t enbImsi = ueManager->
GetImsi ();
462 if (state == UeManager::CONNECTED_NORMALLY)
465 ueManager->
GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
468 ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
473 while (enbBearerIt != enbDataRadioBearerMapValue.
End ()
474 && ueBearerIt != ueDataRadioBearerMapValue.End ())
489 NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (),
"too many bearers at eNB");
490 NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (),
"too many bearers at UE");
500 const uint64_t imsi = ueLteDevice->
GetImsi ();
501 const uint16_t rnti = ueRrc->GetRnti ();
504 "Invalid IMSI " << imsi);
506 bool ueStateIsConnectedNormally = (LteUeRrc::CONNECTED_NORMALLY == ueRrc->GetState ());
510 const bool hasContext = enbRrc->HasUeManager (rnti);
511 bool contextStateIsConnectedNormally =
false;
516 contextStateIsConnectedNormally = (UeManager::CONNECTED_NORMALLY == ueManager->
GetState ());
519 || !ueStateIsConnectedNormally
521 || !contextStateIsConnectedNormally),
523 "it should not happen that connection is completed both at the UE and at the eNB side");
528 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
537 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
562 std::string description =
"");
564 virtual void DoRun (
void);
578 Time jumpAwayTime, std::string description)
581 m_jumpAwayTime (jumpAwayTime)
626 enbPosition->Add (Vector (0, 0, 0));
627 enbPosition->Add (Vector (100.0, 0, 0));
628 enbPosition->Add (Vector (0, 100.0, 0));
629 enbPosition->Add (Vector (100.0, 100.0, 0));
630 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
631 mobility.SetPositionAllocator (enbPosition);
648 it != enbDevs.
End ();
680 uint64_t imsi = ueLteDevice->
GetImsi ();
687 Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
690 Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
700 this, ueDevs.
Get (0), enbDevs.
Get (0));
709 Simulator::Destroy ();
754 for (uint32_t useIdealRrc = 0; useIdealRrc <= 1; ++useIdealRrc)
794 "failure at RRC Connection Request"),
798 "failure at RRC Connection Setup"),
uint32_t m_delayConnEnd
expected duration to perform connection establishment in ms
LteRrcConnectionEstablishmentErrorTestCase(Time jumpAwayTime, std::string description="")
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
std::map< uint64_t, bool > m_isConnectionEstablished
key: IMSI
Simulation virtual time values and global simulation resolution.
uint32_t m_tConnIncrPerUe
additional connection time increment for each UE index (0...nUes-1) in ms
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void CheckConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Check connected function.
uint32_t m_delayDiscEnd
expected duration to complete disconnection in ms
State
The state of the UeManager at the eNB RRC.
AttributeValue implementation for Boolean.
uint32_t m_tConnBase
connection time base value for all UEs in ms
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
void ConnectionEstablishedCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection established callback function.
bool m_useIdealRrc
If set to false, real RRC protocol model will be used.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
LteRrcConnectionEstablishmentTestCase(uint32_t nUes, uint32_t nBearers, uint32_t tConnBase, uint32_t tConnIncrPerUe, uint32_t delayDiscStart, bool errorExpected, bool useIdealRrc, bool admitRrcConnectionRequest, std::string description="")
uint64_t GetImsi(void) const
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used.
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
uint32_t m_nBearers
number of bearers to be setup in each connection
void JumpBack()
Jump back function.
Time m_jumpAwayTime
jump away time
Keep track of the current position and velocity of an object.
uint64_t GetImsi() const
Get the IMSI.
Ptr< MobilityModel > m_ueMobility
UE mobility model.
This class contains the specification of EPS Bearers.
store information on active data radio bearer instance
uint8_t m_logicalChannelIdentity
logical channel identity
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Ptr< LteHelper > m_lteHelper
LTE helper.
Iterator Begin(void) const
Get an iterator to the first Object.
Hold an unsigned integer type.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
holds a vector of ns3::NetDevice pointers
Iterator End(void) const
Get an iterator to the past-the-end Object.
bool m_admitRrcConnectionRequest
If set to false, eNb will not allow UE connections.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
uint32_t m_delayDiscStart
delay between connection completed and disconnection request in ms
std::size_t GetN(void) const
Get the number of Objects.
void JumpAway()
Jump away function.
void Connect(std::string path, const CallbackBase &cb)
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
uint32_t m_nUes
number of UEs in the test
void ConnectionTimeoutCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection timeout callback function.
static std::string BuildNameString(uint32_t nUes, uint32_t nBearers, uint32_t tConnBase, uint32_t tConnIncrPerUe, uint32_t delayDiscStart, bool useIdealRrc, bool admitRrcConnectionRequest, std::string description="")
Build name string function.
void SetPosition(const Vector &position)
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Helper class used to assign positions and mobility models to nodes.
std::string GetName(void) const
static LteRrcTestSuite g_lteRrcTestSuiteInstance
uint8_t m_drbIdentity
DRB identity.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
void Connect(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Connect function.
Ptr< LteUeRrc > GetRrc() const
Get the RRC.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Lte Rrc Connection Establishment Error Test Case.
Container for a set of ns3::Object pointers.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
The eNodeB device implementation.
Ptr< LteEnbRrc > GetRrc() const
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void CheckNotConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Check not connected function.
Test rrc connection establishment.
uint8_t m_epsBearerIdentity
EPS bearer identity.
virtual void DoRun(void)
Implementation to actually run this TestCase.
The LteUeNetDevice class implements the UE net device.