21#include <ns3/core-module.h>
22#include <ns3/lte-module.h>
23#include <ns3/mobility-module.h>
24#include <ns3/network-module.h>
62 bool admitRrcConnectionRequest,
63 std::string description =
"");
66 void DoRun()
override;
89 bool admitRrcConnectionRequest,
90 std::string description =
"");
132 uint8_t connEstFailCount);
157 bool admitRrcConnectionRequest,
158 std::string description)
160 std::ostringstream oss;
161 oss <<
"nUes=" << nUes <<
", nBearers=" << nBearers <<
", tConnBase=" << tConnBase
162 <<
", tConnIncrPerUe=" << tConnIncrPerUe <<
", delayDiscStart=" << delayDiscStart;
166 oss <<
", ideal RRC";
173 if (admitRrcConnectionRequest)
175 oss <<
", admitRrcConnectionRequest = true";
179 oss <<
", admitRrcConnectionRequest = false";
182 if (!description.empty())
184 oss <<
", " << description;
198 bool admitRrcConnectionRequest,
199 std::string description)
206 admitRrcConnectionRequest,
209 m_nBearers(nBearers),
210 m_tConnBase(tConnBase),
211 m_tConnIncrPerUe(tConnIncrPerUe),
213 m_delayDiscStart(delayDiscStart),
215 m_useIdealRrc(useIdealRrc),
216 m_admitRrcConnectionRequest(admitRrcConnectionRequest)
222 double nRaAttempts = 0;
233 nRaAttempts += std::ceil(nUes / 4.0);
234 double dra = nRaAttempts * 7;
235 double dce = 10.0 + (2.0 * nUes) / 4.0;
265 double dcr = (10.0 + (2.0 * nUes) / 4.0) * (
m_nBearers + nCrs);
268 NS_LOG_LOGIC(
this <<
" " <<
GetName() <<
" dsi=" << dsi <<
" dra=" << dra <<
" dce=" << dce
307 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
308 mobility.Install(enbNodes);
309 mobility.Install(ueNodes);
327 enbRrc->SetAttribute(
"AdmitRrcConnectionRequest",
343 tmax = std::max(tmax, tcd);
363 uint64_t imsi = ueLteDevice->GetImsi();
371 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
374 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
404 const uint64_t imsi = ueLteDevice->GetImsi();
405 const uint16_t rnti = ueRrc->GetRnti();
408 "Invalid IMSI " << imsi);
414 "Connection with RNTI " << rnti <<
" should have been rejected");
424 "RNTI " << rnti <<
" fails to establish connection");
427 "RNTI " << rnti <<
" is not at CONNECTED_NORMALLY state");
433 const bool hasContext = enbRrc->HasUeManager(rnti);
441 "The context of RNTI " << rnti <<
" is in invalid state");
445 NS_LOG_WARN(
this <<
" RNTI " << rnti <<
" thinks that it has"
446 <<
" established connection but the eNodeB thinks"
447 <<
" that the UE has failed on connection setup.");
457 uint16_t ueCellId = ueRrc->GetCellId();
458 uint16_t enbCellId = enbLteDevice->GetCellId();
459 uint16_t ueImsi = ueLteDevice->GetImsi();
461 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
462 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth();
463 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
464 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth();
465 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
466 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn();
467 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
468 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn();
481 uint16_t enbImsi = ueManager->GetImsi();
487 ueManager->GetAttribute(
"DataRadioBearerMap", enbDataRadioBearerMapValue);
490 "wrong num bearers at eNB");
492 ueRrc->GetAttribute(
"DataRadioBearerMap", ueDataRadioBearerMapValue);
495 "wrong num bearers at UE");
499 while (enbBearerIt != enbDataRadioBearerMapValue.
End() &&
500 ueBearerIt != ueDataRadioBearerMapValue.
End())
509 (
uint32_t)ueDrbInfo->m_epsBearerIdentity,
510 "epsBearerIdentity differs");
513 "drbIdentity differs");
517 (
uint32_t)ueDrbInfo->m_logicalChannelIdentity,
518 "logicalChannelIdentity differs");
527 "too many bearers at eNB");
528 NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.
End(),
"too many bearers at UE");
539 const uint64_t imsi = ueLteDevice->GetImsi();
540 const uint16_t rnti = ueRrc->GetRnti();
543 "Invalid IMSI " << imsi);
549 const bool hasContext = enbRrc->HasUeManager(rnti);
550 bool contextStateIsConnectedNormally =
false;
559 !contextStateIsConnectedNormally),
561 "it should not happen that connection is completed both at the UE and at the eNB side");
579 uint8_t connEstFailCount)
602 void DoRun()
override;
616 std::string description)
618 m_jumpAwayTime(jumpAwayTime)
657 mobility.Install(ueNodes);
661 enbPosition->Add(Vector(0, 0, 0));
662 enbPosition->Add(Vector(100.0, 0, 0));
663 enbPosition->Add(Vector(0, 100.0, 0));
664 enbPosition->Add(Vector(100.0, 100.0, 0));
665 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
666 mobility.SetPositionAllocator(enbPosition);
667 mobility.Install(enbNodes);
685 enbRrc->SetAttribute(
"AdmitRrcConnectionRequest",
701 tmax = std::max(tmax, tcd);
715 uint64_t imsi = ueLteDevice->GetImsi();
723 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
727 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
785 for (
uint32_t useIdealRrc = 0; useIdealRrc <= 1; ++useIdealRrc)
877 "failure at RRC Connection Request"),
880 "failure at RRC Connection Setup"),
888 "failure at RRC Connection Setup Complete"),
Lte Rrc Connection Establishment Error Test Case.
void DoRun() override
Implementation to actually run this TestCase.
void JumpBack()
Jump back function.
void JumpAway()
Jump away function.
Time m_jumpAwayTime
jump away time
LteRrcConnectionEstablishmentErrorTestCase(Time jumpAwayTime, std::string description="")
Ptr< MobilityModel > m_ueMobility
UE mobility model.
Test rrc connection establishment.
void DoRun() override
Implementation to actually run this TestCase.
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="")
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.
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
store information on active data radio bearer instance
The eNodeB device implementation.
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
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Iterator End() const
Get an iterator which indicates past-the-last 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() const
Get a pointer to the requested aggregated Object.
Container for a set of ns3::Object pointers.
std::size_t GetN() const
Get the number of Objects.
Iterator End() const
Get an iterator to the past-the-end Object.
Iterator Begin() const
Get an iterator to the first Object.
std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
@ EXTENSIVE
Medium length test.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
std::string GetName() 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()
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.
static LteRrcTestSuite g_lteRrcTestSuiteInstance
Static variable for test initialization.
#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, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...