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);
126 void ConnectionTimeoutCallback (std::string context, uint64_t imsi,
127 uint16_t cellId, uint16_t rnti,
128 uint8_t connEstFailCount);
149 uint32_t tConnIncrPerUe,
150 uint32_t delayDiscStart,
152 bool admitRrcConnectionRequest,
153 std::string description)
155 std::ostringstream oss;
156 oss <<
"nUes=" << nUes
157 <<
", nBearers=" << nBearers
158 <<
", tConnBase=" << tConnBase
159 <<
", tConnIncrPerUe=" << tConnIncrPerUe
160 <<
", delayDiscStart=" << delayDiscStart;
164 oss <<
", ideal RRC";
171 if (admitRrcConnectionRequest)
173 oss <<
", admitRrcConnectionRequest = true";
177 oss <<
", admitRrcConnectionRequest = false";
180 if (!description.empty ())
182 oss <<
", " << description;
189 uint32_t nUes, uint32_t nBearers,
190 uint32_t tConnBase, uint32_t tConnIncrPerUe, uint32_t delayDiscStart,
191 bool errorExpected,
bool useIdealRrc,
bool admitRrcConnectionRequest,
192 std::string description)
193 :
TestCase (BuildNameString (nUes, nBearers,
194 tConnBase, tConnIncrPerUe, delayDiscStart,
195 useIdealRrc, admitRrcConnectionRequest,
198 m_nBearers (nBearers),
199 m_tConnBase (tConnBase),
200 m_tConnIncrPerUe (tConnIncrPerUe),
202 m_delayDiscStart (delayDiscStart),
204 m_useIdealRrc (useIdealRrc),
205 m_admitRrcConnectionRequest (admitRrcConnectionRequest)
211 double nRaAttempts = 0;
222 nRaAttempts += std::ceil (nUes / 4.0);
223 double dra = nRaAttempts * 7;
224 double dce = 10.0 + (2.0 * nUes) / 4.0;
254 double dcr = (10.0 + (2.0 * nUes) / 4.0) * (
m_nBearers + nCrs);
296 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
314 it != enbDevs.
End ();
318 enbRrc->SetAttribute (
"AdmitRrcConnectionRequest",
346 uint64_t imsi = ueLteDevice->GetImsi ();
353 Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
356 Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
364 Simulator::Destroy ();
387 const uint64_t imsi = ueLteDevice->GetImsi ();
388 const uint16_t rnti = ueRrc->GetRnti ();
391 "Invalid IMSI " << imsi);
396 "Connection with RNTI " << rnti <<
" should have been rejected");
405 "RNTI " << rnti <<
" fails to establish connection");
407 "RNTI " << rnti <<
" is not at CONNECTED_NORMALLY state");
413 const bool hasContext = enbRrc->HasUeManager (rnti);
420 UeManager::CONNECTED_NORMALLY,
421 "The context of RNTI " << rnti <<
" is in invalid state");
425 NS_LOG_WARN (
this <<
" RNTI " << rnti <<
" thinks that it has"
426 <<
" established connection but the eNodeB thinks"
427 <<
" that the UE has failed on connection setup.");
437 uint16_t ueCellId = ueRrc->GetCellId ();
438 uint16_t enbCellId = enbLteDevice->
GetCellId ();
439 uint16_t ueImsi = ueLteDevice->GetImsi ();
441 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
443 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
445 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
446 uint8_t enbDlEarfcn = enbLteDevice->
GetDlEarfcn ();
447 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
448 uint8_t enbUlEarfcn = enbLteDevice->
GetUlEarfcn ();
461 uint16_t enbImsi = ueManager->GetImsi ();
464 if (state == UeManager::CONNECTED_NORMALLY)
467 ueManager->GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
470 ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
475 while (enbBearerIt != enbDataRadioBearerMapValue.
End ()
476 && ueBearerIt != ueDataRadioBearerMapValue.
End ())
481 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_epsBearerIdentity, (uint32_t) ueDrbInfo->m_epsBearerIdentity,
"epsBearerIdentity differs");
482 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_drbIdentity, (uint32_t) ueDrbInfo->m_drbIdentity,
"drbIdentity differs");
484 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_logicalChannelIdentity, (uint32_t) ueDrbInfo->m_logicalChannelIdentity,
"logicalChannelIdentity differs");
491 NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (),
"too many bearers at eNB");
492 NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.
End (),
"too many bearers at UE");
502 const uint64_t imsi = ueLteDevice->GetImsi ();
503 const uint16_t rnti = ueRrc->GetRnti ();
506 "Invalid IMSI " << imsi);
508 bool ueStateIsConnectedNormally = (LteUeRrc::CONNECTED_NORMALLY == ueRrc->GetState ());
512 const bool hasContext = enbRrc->HasUeManager (rnti);
513 bool contextStateIsConnectedNormally =
false;
518 contextStateIsConnectedNormally = (UeManager::CONNECTED_NORMALLY == ueManager->GetState ());
521 || !ueStateIsConnectedNormally
523 || !contextStateIsConnectedNormally),
525 "it should not happen that connection is completed both at the UE and at the eNB side");
530 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
539 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti,
540 uint8_t connEstFailCount)
565 std::string description =
"");
567 virtual void DoRun (
void);
581 Time jumpAwayTime, std::string description)
584 m_jumpAwayTime (jumpAwayTime)
629 enbPosition->Add (Vector (0, 0, 0));
630 enbPosition->Add (Vector (100.0, 0, 0));
631 enbPosition->Add (Vector (0, 100.0, 0));
632 enbPosition->Add (Vector (100.0, 100.0, 0));
633 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
634 mobility.SetPositionAllocator (enbPosition);
651 it != enbDevs.
End ();
655 enbRrc->SetAttribute (
"AdmitRrcConnectionRequest",
681 uint64_t imsi = ueLteDevice->GetImsi ();
688 Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
691 Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
701 this, ueDevs.
Get (0), enbDevs.
Get (0));
710 Simulator::Destroy ();
755 for (uint32_t useIdealRrc = 0; useIdealRrc <= 1; ++useIdealRrc)
795 "failure at RRC Connection Request"),
799 "failure at RRC Connection Setup"),
807 "failure at RRC Connection Setup Complete"),
Lte Rrc Connection Establishment Error Test Case.
void JumpBack()
Jump back function.
void JumpAway()
Jump away function.
Time m_jumpAwayTime
jump away time
LteRrcConnectionEstablishmentErrorTestCase(Time jumpAwayTime, std::string description="")
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< MobilityModel > m_ueMobility
UE mobility model.
Test rrc connection establishment.
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.
std::map< uint64_t, bool > m_isConnectionEstablished
key: IMSI
void CheckNotConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Check not connected function.
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="")
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool m_admitRrcConnectionRequest
If set to false, eNb will not allow UE connections.
void ConnectionEstablishedCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection established callback function.
uint32_t m_nUes
number of UEs in the test
void CheckConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Check connected function.
bool m_useIdealRrc
If set to false, real RRC protocol model will be used.
uint32_t m_delayConnEnd
expected duration to perform connection establishment in ms
uint32_t m_tConnBase
connection time base value for all UEs in ms
Ptr< LteHelper > m_lteHelper
LTE helper.
void ConnectionTimeoutCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t connEstFailCount)
Connection timeout callback function.
uint32_t m_delayDiscStart
delay between connection completed and disconnection request in ms
uint32_t m_tConnIncrPerUe
additional connection time increment for each UE index (0...nUes-1) in ms
void Connect(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Connect function.
uint32_t m_delayDiscEnd
expected duration to complete disconnection in ms
uint32_t m_nBearers
number of bearers to be setup in each connection
AttributeValue implementation for Boolean.
This class contains the specification of EPS Bearers.
store information on active data radio bearer instance
The eNodeB device implementation.
uint16_t GetDlBandwidth() const
uint32_t GetUlEarfcn() const
uint32_t GetDlEarfcn() const
Ptr< LteEnbRrc > GetRrc() const
uint16_t GetUlBandwidth() const
uint16_t GetCellId() const
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used.
The LteUeNetDevice class implements the UE net device.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
void SetPosition(const Vector &position)
holds a vector of ns3::NetDevice pointers
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Container for a set of ns3::Object pointers.
std::size_t GetN(void) const
Get the number of Objects.
Iterator Begin(void) const
Get an iterator to the first Object.
std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
Iterator End(void) const
Get an iterator to the past-the-end Object.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
std::string GetName(void) const
Simulation virtual time values and global simulation resolution.
State
The state of the UeManager at the eNB RRC.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static LteRrcTestSuite g_lteRrcTestSuiteInstance