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 ();
   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 ();
   442   uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
   443   uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
   444   uint8_t enbUlBandwidth = enbLteDevice->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 ())
   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 ();
   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"),
 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. 
void ConnectionTimeoutCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t connEstFailCount)
Connection timeout callback function. 
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. 
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. 
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. 
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC. 
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 
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. 
This class contains the specification of EPS Bearers. 
void SetPosition(const Vector &position)
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
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. 
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...
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.