23 #include <ns3/core-module.h> 
   24 #include <ns3/network-module.h> 
   25 #include <ns3/mobility-module.h> 
   26 #include <ns3/lte-module.h> 
   52                                          uint32_t tConnIncrPerUe,
 
   53                                          uint32_t delayDiscStart,
 
   56                                          bool admitRrcConnectionRequest,
 
   57                                          std::string description = 
"");
 
   61   virtual void DoRun (
void);
 
   64   static std::string BuildNameString (uint32_t nUes,
 
   67                                       uint32_t tConnIncrPerUe,
 
   68                                       uint32_t delayDiscStart,
 
   70                                       bool admitRrcConnectionRequest,
 
   71                                       std::string description = 
"");
 
   75   void ConnectionEstablishedCallback (std::string context, uint64_t imsi,
 
   76                                       uint16_t cellId, uint16_t rnti);
 
   77   void ConnectionTimeoutCallback (std::string context, uint64_t imsi,
 
   78                                   uint16_t cellId, uint16_t rnti);
 
   99                                                         uint32_t tConnIncrPerUe,
 
  100                                                         uint32_t delayDiscStart,
 
  102                                                         bool admitRrcConnectionRequest,
 
  103                                                         std::string description)
 
  105   std::ostringstream oss;
 
  106   oss << 
"nUes=" << nUes
 
  107       << 
", nBearers=" << nBearers
 
  108       << 
", tConnBase=" << tConnBase
 
  109       << 
", tConnIncrPerUe=" << tConnIncrPerUe
 
  110       << 
", delayDiscStart=" << delayDiscStart;
 
  114       oss << 
", ideal RRC";
 
  121   if (admitRrcConnectionRequest)
 
  123       oss << 
", admitRrcConnectionRequest = true";
 
  127       oss << 
", admitRrcConnectionRequest = false";
 
  130   if (!description.empty ())
 
  132       oss << 
", " << description;
 
  139     uint32_t nUes, uint32_t nBearers,
 
  140     uint32_t tConnBase, uint32_t tConnIncrPerUe, uint32_t delayDiscStart,
 
  141     bool errorExpected, 
bool useIdealRrc, 
bool admitRrcConnectionRequest,
 
  142     std::string description)
 
  143   : 
TestCase (BuildNameString (nUes, nBearers,
 
  144                                tConnBase, tConnIncrPerUe, delayDiscStart,
 
  145                                useIdealRrc, admitRrcConnectionRequest,
 
  148     m_nBearers (nBearers),
 
  149     m_tConnBase (tConnBase),
 
  150     m_tConnIncrPerUe (tConnIncrPerUe),
 
  152     m_delayDiscStart (delayDiscStart),
 
  154     m_useIdealRrc (useIdealRrc),
 
  155     m_admitRrcConnectionRequest (admitRrcConnectionRequest)
 
  161   double nRaAttempts = 0;
 
  172   nRaAttempts += std::ceil (nUes / 4.0);
 
  173   double dra = nRaAttempts * 7;
 
  174   double dce = 10.0 + (2.0 * nUes) / 4.0;
 
  204   double dcr =  (10.0 + (2.0 * nUes) / 4.0) * (
m_nBearers + nCrs);
 
  264        it != enbDevs.
End ();
 
  285       tmax = std::max (tmax, tcd);
 
  296       uint64_t imsi = ueLteDevice->
GetImsi ();
 
  303   Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
 
  306   Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
 
  314   Simulator::Destroy ();
 
  337   const uint64_t imsi = ueLteDevice->
GetImsi ();
 
  338   const uint16_t rnti = ueRrc->GetRnti ();
 
  341                  "Invalid IMSI " << imsi);
 
  346                              "Connection with RNTI " << rnti << 
" should have been rejected");
 
  355                          "RNTI " << rnti << 
" fails to establish connection");
 
  357                          "RNTI " << rnti << 
" is not at CONNECTED_NORMALLY state");
 
  363   const bool hasContext = enbRrc->HasUeManager (rnti);
 
  370                              UeManager::CONNECTED_NORMALLY,
 
  371                              "The context of RNTI " << rnti << 
" is in invalid state");
 
  375        NS_LOG_WARN (
this << 
" RNTI " << rnti << 
" thinks that it has" 
  376                          << 
" established connection but the eNodeB thinks" 
  377                          << 
" that the UE has failed on connection setup.");
 
  387   uint16_t ueCellId = ueRrc->GetCellId ();
 
  388   uint16_t enbCellId = enbLteDevice->GetCellId ();
 
  389   uint16_t ueImsi = ueLteDevice->
GetImsi ();
 
  391   uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
 
  392   uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
 
  393   uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
 
  394   uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth ();
 
  395   uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
 
  396   uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn ();
 
  397   uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
 
  398   uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn ();
 
  411       uint16_t enbImsi = ueManager->
GetImsi ();
 
  414       if (state == UeManager::CONNECTED_NORMALLY)
 
  417           ueManager->
GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
 
  420           ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
 
  425           while (enbBearerIt != enbDataRadioBearerMapValue.
End ()
 
  426                  && ueBearerIt != ueDataRadioBearerMapValue.End ())
 
  441           NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (), 
"too many bearers at eNB");
 
  442           NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (), 
"too many bearers at UE");
 
  452   const uint64_t imsi = ueLteDevice->
GetImsi ();
 
  453   const uint16_t rnti = ueRrc->GetRnti ();
 
  456                  "Invalid IMSI " << imsi);
 
  458   bool ueStateIsConnectedNormally = (LteUeRrc::CONNECTED_NORMALLY == ueRrc->GetState ());
 
  462   const bool hasContext = enbRrc->HasUeManager (rnti);
 
  463   bool contextStateIsConnectedNormally = 
false;
 
  468       contextStateIsConnectedNormally = (UeManager::CONNECTED_NORMALLY == ueManager->
GetState ());
 
  471                           || !ueStateIsConnectedNormally
 
  473                           || !contextStateIsConnectedNormally),
 
  475                          "it should not happen that connection is completed both at the UE and at the eNB side");
 
  480     std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
 
  489     std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
 
  508                                               std::string description = 
"");
 
  510   virtual void DoRun (
void);
 
  522   Time jumpAwayTime, std::string description)
 
  525     m_jumpAwayTime (jumpAwayTime)
 
  570   enbPosition->Add (Vector (0, 0, 0));
 
  571   enbPosition->Add (Vector (100.0, 0, 0));
 
  572   enbPosition->Add (Vector (0, 100.0, 0));
 
  573   enbPosition->Add (Vector (100.0, 100.0, 0));
 
  592        it != enbDevs.
End ();
 
  613       tmax = std::max (tmax, tcd);
 
  624       uint64_t imsi = ueLteDevice->
GetImsi ();
 
  631   Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
 
  634   Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
 
  644                        this, ueDevs.
Get (0), enbDevs.
Get (0));
 
  653   Simulator::Destroy ();
 
  693   for (uint32_t useIdealRrc = 0; useIdealRrc <= 1; ++useIdealRrc)
 
  733                    "failure at RRC Connection Request"),
 
  737                    "failure at RRC Connection Setup"),
 
LteRrcConnectionEstablishmentErrorTestCase(Time jumpAwayTime, std::string description="")
 
Iterator Begin(void) const 
Get an iterator which refers to the first NetDevice in the container. 
 
std::map< uint64_t, bool > m_isConnectionEstablished
 
Simulation virtual time values and global simulation resolution. 
 
uint32_t m_tConnIncrPerUe
 
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)
 
AttributeValue implementation for Boolean. 
 
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices. 
 
Ptr< T > GetObject(void) const 
Get a pointer to the requested aggregated Object. 
 
Ptr< NetDevice > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
void ConnectionEstablishedCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
 
Ptr< LteUeRrc > GetRrc() const 
 
#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="")
 
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). 
 
std::map< uint32_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container. 
 
Keep track of the current position and velocity of an object. 
 
Ptr< MobilityModel > m_ueMobility
 
This class contains the specification of EPS Bearers. 
 
void Install(Ptr< Node > node) const 
"Layout" a single node according to the current position allocator type. 
 
store information on active data radio bearer instance 
 
uint8_t m_logicalChannelIdentity
 
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite. 
 
Ptr< LteHelper > m_lteHelper
 
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. 
 
holds a vector of ns3::NetDevice pointers 
 
bool m_admitRrcConnectionRequest
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
uint32_t m_delayDiscStart
 
#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< LteEnbRrc > GetRrc() const 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
keep track of a set of node pointers. 
 
State
The state of the UeManager at the eNB RRC. 
 
void ConnectionTimeoutCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
 
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
 
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="")
 
Iterator Begin(void) const 
Get an iterator to the first Object. 
 
void GetAttribute(std::string name, AttributeValue &value) const 
Get the value of an attribute, raising fatal errors if unsuccessful. 
 
void SetPosition(const Vector &position)
 
uint64_t GetImsi(void) const 
 
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. 
 
static LteRrcTestSuite g_lteRrcTestSuiteInstance
 
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN. 
 
Ptr< Node > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
Iterator End(void) const 
Get an iterator to the past-the-end Object. 
 
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)
 
std::string GetName(void) const 
 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
 
uint32_t GetN(void) const 
Get the number of Objects. 
 
Container for a set of ns3::Object pointers. 
 
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
 
Iterator End(void) const 
Get an iterator which indicates past-the-last NetDevice in the container. 
 
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful. 
 
The eNodeB device implementation. 
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
void CheckNotConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
 
uint8_t m_epsBearerIdentity
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
The LteUeNetDevice class implements the UE net device.