10#include "ns3/core-module.h" 
   11#include "ns3/lte-module.h" 
   12#include "ns3/mobility-module.h" 
   13#include "ns3/network-module.h" 
   51                                          bool admitRrcConnectionRequest,
 
   52                                          std::string description = 
"");
 
   55    void DoRun() 
override;
 
   78                                       bool admitRrcConnectionRequest,
 
   79                                       std::string description = 
"");
 
  121                                   uint8_t connEstFailCount);
 
 
  146                                                       bool admitRrcConnectionRequest,
 
  147                                                       std::string description)
 
  149    std::ostringstream oss;
 
  150    oss << 
"nUes=" << nUes << 
", nBearers=" << nBearers << 
", tConnBase=" << tConnBase
 
  151        << 
", tConnIncrPerUe=" << tConnIncrPerUe << 
", delayDiscStart=" << delayDiscStart;
 
  155        oss << 
", ideal RRC";
 
  162    if (admitRrcConnectionRequest)
 
  164        oss << 
", admitRrcConnectionRequest = true";
 
  168        oss << 
", admitRrcConnectionRequest = false";
 
  171    if (!description.empty())
 
  173        oss << 
", " << description;
 
 
  187    bool admitRrcConnectionRequest,
 
  188    std::string description)
 
  195                               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);
 
  257    NS_LOG_LOGIC(
this << 
" " << 
GetName() << 
" dsi=" << dsi << 
" dra=" << dra << 
" dce=" << dce
 
 
  296    mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
 
  297    mobility.Install(enbNodes);
 
  298    mobility.Install(ueNodes);
 
  303    stream += 
m_lteHelper->AssignStreams(enbDevs, stream);
 
  307    stream += 
m_lteHelper->AssignStreams(ueDevs, stream);
 
  313    for (
auto it = enbDevs.
Begin(); it != enbDevs.
End(); ++it)
 
  316        enbRrc->SetAttribute(
"AdmitRrcConnectionRequest",
 
  322    for (
auto it = ueDevs.
Begin(); it != ueDevs.
End(); ++it)
 
  332        tmax = std::max(tmax, tcd);
 
  352        uint64_t imsi = ueLteDevice->GetImsi();
 
  360        "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
 
  363        "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
 
 
  383        m_lteHelper->ActivateDataRadioBearer(ueDevice, bearer);
 
 
  393    const uint64_t imsi = ueLteDevice->GetImsi();
 
  394    const uint16_t rnti = ueRrc->GetRnti();
 
  397                  "Invalid IMSI " << imsi);
 
  403                              "Connection with RNTI " << rnti << 
" should have been rejected");
 
  413                          "RNTI " << rnti << 
" fails to establish connection");
 
  416                          "RNTI " << rnti << 
" is not at CONNECTED_NORMALLY state");
 
  422    const bool hasContext = enbRrc->HasUeManager(rnti);
 
  430                              "The context of RNTI " << rnti << 
" is in invalid state");
 
  434        NS_LOG_WARN(
this << 
" RNTI " << rnti << 
" thinks that it has" 
  435                         << 
" established connection but the eNodeB thinks" 
  436                         << 
" that the UE has failed on connection setup.");
 
  446    uint16_t ueCellId = ueRrc->GetCellId();
 
  447    uint16_t enbCellId = enbLteDevice->GetCellId();
 
  448    uint16_t ueImsi = ueLteDevice->GetImsi();
 
  450    uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
 
  451    uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth();
 
  452    uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
 
  453    uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth();
 
  454    uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
 
  455    uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn();
 
  456    uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
 
  457    uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn();
 
  470        uint16_t enbImsi = ueManager->GetImsi();
 
  476            ueManager->GetAttribute(
"DataRadioBearerMap", enbDataRadioBearerMapValue);
 
  479                                  "wrong num bearers at eNB");
 
  481            ueRrc->GetAttribute(
"DataRadioBearerMap", ueDataRadioBearerMapValue);
 
  484                                  "wrong num bearers at UE");
 
  486            auto enbBearerIt = enbDataRadioBearerMapValue.
Begin();
 
  487            auto ueBearerIt = ueDataRadioBearerMapValue.
Begin();
 
  488            while (enbBearerIt != enbDataRadioBearerMapValue.
End() &&
 
  489                   ueBearerIt != ueDataRadioBearerMapValue.
End())
 
  498                                      (
uint32_t)ueDrbInfo->m_epsBearerIdentity,
 
  499                                      "epsBearerIdentity differs");
 
  502                                      "drbIdentity differs");
 
  506                                      (
uint32_t)ueDrbInfo->m_logicalChannelIdentity,
 
  507                                      "logicalChannelIdentity differs");
 
  516                          "too many bearers at eNB");
 
  517            NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.
End(), 
"too many bearers at UE");
 
 
  528    const uint64_t imsi = ueLteDevice->GetImsi();
 
  529    const uint16_t rnti = ueRrc->GetRnti();
 
  532                  "Invalid IMSI " << imsi);
 
  538    const bool hasContext = enbRrc->HasUeManager(rnti);
 
  539    bool contextStateIsConnectedNormally = 
false;
 
  548         !contextStateIsConnectedNormally),
 
  550        "it should not happen that connection is completed both at the UE and at the eNB side");
 
 
  568                                                                 uint8_t connEstFailCount)
 
 
  591    void DoRun() 
override;
 
 
  605    std::string description)
 
  607      m_jumpAwayTime(jumpAwayTime)
 
 
  646    mobility.Install(ueNodes); 
 
  650    enbPosition->Add(Vector(0, 0, 0));
 
  651    enbPosition->Add(Vector(100.0, 0, 0));
 
  652    enbPosition->Add(Vector(0, 100.0, 0));
 
  653    enbPosition->Add(Vector(100.0, 100.0, 0));
 
  654    mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
 
  655    mobility.SetPositionAllocator(enbPosition);
 
  656    mobility.Install(enbNodes);
 
  661    stream += 
m_lteHelper->AssignStreams(enbDevs, stream);
 
  665    stream += 
m_lteHelper->AssignStreams(ueDevs, stream);
 
  671    for (
auto it = enbDevs.
Begin(); it != enbDevs.
End(); ++it)
 
  674        enbRrc->SetAttribute(
"AdmitRrcConnectionRequest",
 
  680    for (
auto it = ueDevs.
Begin(); it != ueDevs.
End(); ++it)
 
  690        tmax = std::max(tmax, tcd);
 
  704        uint64_t imsi = ueLteDevice->GetImsi();
 
  712        "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
 
  716        "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
 
 
  743    m_ueMobility->SetPosition(Vector(100000.0, 100000.0, 0.0));
 
 
  774    for (
auto useIdealRrc : {
false, 
true})
 
  782            TestCase::Duration::EXTENSIVE);
 
  785            TestCase::Duration::EXTENSIVE);
 
  788            TestCase::Duration::EXTENSIVE);
 
  791            TestCase::Duration::EXTENSIVE);
 
  794            TestCase::Duration::EXTENSIVE);
 
  797            TestCase::Duration::EXTENSIVE);
 
  800            TestCase::Duration::EXTENSIVE);
 
  803            TestCase::Duration::EXTENSIVE);
 
  806            TestCase::Duration::EXTENSIVE);
 
  809            TestCase::Duration::EXTENSIVE);
 
  812            TestCase::Duration::EXTENSIVE);
 
  815            TestCase::Duration::EXTENSIVE);
 
  818            TestCase::Duration::EXTENSIVE);
 
  821            TestCase::Duration::QUICK);
 
  824            TestCase::Duration::EXTENSIVE);
 
  827            TestCase::Duration::EXTENSIVE);
 
  830            TestCase::Duration::EXTENSIVE);
 
  833            TestCase::Duration::EXTENSIVE);
 
  836            TestCase::Duration::EXTENSIVE);
 
  839            TestCase::Duration::EXTENSIVE);
 
  849            TestCase::Duration::EXTENSIVE);
 
  852            TestCase::Duration::EXTENSIVE);
 
  855            TestCase::Duration::EXTENSIVE);
 
  858            TestCase::Duration::QUICK);
 
  861            TestCase::Duration::EXTENSIVE);
 
  866                                                               "failure at RRC Connection Request"),
 
  867                TestCase::Duration::QUICK);
 
  869                                                               "failure at RRC Connection Setup"),
 
  870                TestCase::Duration::QUICK);
 
  877                                                       "failure at RRC Connection Setup Complete"),
 
  878        TestCase::Duration::QUICK);
 
 
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.
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.
holds a vector of ns3::NetDevice pointers
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.
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.
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.
void AddTestCase(TestCase *testCase, Duration duration=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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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...