21#include <ns3/core-module.h>
22#include <ns3/lte-module.h>
23#include <ns3/mobility-module.h>
24#include <ns3/network-module.h>
63 bool admitRrcConnectionRequest,
64 std::string description =
"");
67 void DoRun()
override;
90 bool admitRrcConnectionRequest,
91 std::string description =
"");
133 uint8_t connEstFailCount);
158 bool admitRrcConnectionRequest,
159 std::string description)
161 std::ostringstream oss;
162 oss <<
"nUes=" << nUes <<
", nBearers=" << nBearers <<
", tConnBase=" << tConnBase
163 <<
", tConnIncrPerUe=" << tConnIncrPerUe <<
", delayDiscStart=" << delayDiscStart;
167 oss <<
", ideal RRC";
174 if (admitRrcConnectionRequest)
176 oss <<
", admitRrcConnectionRequest = true";
180 oss <<
", admitRrcConnectionRequest = false";
183 if (!description.empty())
185 oss <<
", " << description;
199 bool admitRrcConnectionRequest,
200 std::string description)
207 admitRrcConnectionRequest,
210 m_nBearers(nBearers),
211 m_tConnBase(tConnBase),
212 m_tConnIncrPerUe(tConnIncrPerUe),
214 m_delayDiscStart(delayDiscStart),
216 m_useIdealRrc(useIdealRrc),
217 m_admitRrcConnectionRequest(admitRrcConnectionRequest)
223 double nRaAttempts = 0;
234 nRaAttempts += std::ceil(nUes / 4.0);
235 double dra = nRaAttempts * 7;
236 double dce = 10.0 + (2.0 * nUes) / 4.0;
266 double dcr = (10.0 + (2.0 * nUes) / 4.0) * (
m_nBearers + nCrs);
269 NS_LOG_LOGIC(
this <<
" " <<
GetName() <<
" dsi=" << dsi <<
" dra=" << dra <<
" dce=" << dce
308 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
328 enbRrc->SetAttribute(
"AdmitRrcConnectionRequest",
364 uint64_t imsi = ueLteDevice->GetImsi();
372 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
375 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
382 Simulator::Destroy();
405 const uint64_t imsi = ueLteDevice->GetImsi();
406 const uint16_t rnti = ueRrc->GetRnti();
409 "Invalid IMSI " << imsi);
415 "Connection with RNTI " << rnti <<
" should have been rejected");
425 "RNTI " << rnti <<
" fails to establish connection");
427 LteUeRrc::CONNECTED_NORMALLY,
428 "RNTI " << rnti <<
" is not at CONNECTED_NORMALLY state");
434 const bool hasContext = enbRrc->HasUeManager(rnti);
441 UeManager::CONNECTED_NORMALLY,
442 "The context of RNTI " << rnti <<
" is in invalid state");
446 NS_LOG_WARN(
this <<
" RNTI " << rnti <<
" thinks that it has"
447 <<
" established connection but the eNodeB thinks"
448 <<
" that the UE has failed on connection setup.");
458 uint16_t ueCellId = ueRrc->GetCellId();
459 uint16_t enbCellId = enbLteDevice->
GetCellId();
460 uint16_t ueImsi = ueLteDevice->GetImsi();
462 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
464 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
466 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
468 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
482 uint16_t enbImsi = ueManager->GetImsi();
485 if (state == UeManager::CONNECTED_NORMALLY)
488 ueManager->GetAttribute(
"DataRadioBearerMap", enbDataRadioBearerMapValue);
491 "wrong num bearers at eNB");
493 ueRrc->GetAttribute(
"DataRadioBearerMap", ueDataRadioBearerMapValue);
496 "wrong num bearers at UE");
500 while (enbBearerIt != enbDataRadioBearerMapValue.
End() &&
501 ueBearerIt != ueDataRadioBearerMapValue.
End())
510 (
uint32_t)ueDrbInfo->m_epsBearerIdentity,
511 "epsBearerIdentity differs");
514 "drbIdentity differs");
518 (
uint32_t)ueDrbInfo->m_logicalChannelIdentity,
519 "logicalChannelIdentity differs");
528 "too many bearers at eNB");
529 NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.
End(),
"too many bearers at UE");
540 const uint64_t imsi = ueLteDevice->GetImsi();
541 const uint16_t rnti = ueRrc->GetRnti();
544 "Invalid IMSI " << imsi);
546 bool ueStateIsConnectedNormally = (LteUeRrc::CONNECTED_NORMALLY == ueRrc->GetState());
550 const bool hasContext = enbRrc->HasUeManager(rnti);
551 bool contextStateIsConnectedNormally =
false;
556 contextStateIsConnectedNormally = (UeManager::CONNECTED_NORMALLY == ueManager->GetState());
560 !contextStateIsConnectedNormally),
562 "it should not happen that connection is completed both at the UE and at the eNB side");
580 uint8_t connEstFailCount)
604 void DoRun()
override;
618 std::string description)
620 m_jumpAwayTime(jumpAwayTime)
663 enbPosition->Add(Vector(0, 0, 0));
664 enbPosition->Add(Vector(100.0, 0, 0));
665 enbPosition->Add(Vector(0, 100.0, 0));
666 enbPosition->Add(Vector(100.0, 100.0, 0));
667 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
668 mobility.SetPositionAllocator(enbPosition);
687 enbRrc->SetAttribute(
"AdmitRrcConnectionRequest",
717 uint64_t imsi = ueLteDevice->GetImsi();
725 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
729 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
748 Simulator::Destroy();
788 for (
uint32_t useIdealRrc = 0; useIdealRrc <= 1; ++useIdealRrc)
799 TestCase::EXTENSIVE);
802 TestCase::EXTENSIVE);
805 TestCase::EXTENSIVE);
808 TestCase::EXTENSIVE);
811 TestCase::EXTENSIVE);
814 TestCase::EXTENSIVE);
817 TestCase::EXTENSIVE);
820 TestCase::EXTENSIVE);
823 TestCase::EXTENSIVE);
826 TestCase::EXTENSIVE);
829 TestCase::EXTENSIVE);
832 TestCase::EXTENSIVE);
835 TestCase::EXTENSIVE);
841 TestCase::EXTENSIVE);
844 TestCase::EXTENSIVE);
847 TestCase::EXTENSIVE);
850 TestCase::EXTENSIVE);
853 TestCase::EXTENSIVE);
856 TestCase::EXTENSIVE);
866 TestCase::EXTENSIVE);
869 TestCase::EXTENSIVE);
872 TestCase::EXTENSIVE);
878 TestCase::EXTENSIVE);
883 "failure at RRC Connection Request"),
886 "failure at RRC Connection Setup"),
894 "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.
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
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.
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.
#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...
static LteRrcTestSuite g_lteRrcTestSuiteInstance