From 7c0d6d125597bdedc74541def96ffbdcc5d8968d Mon Sep 17 00:00:00 2001 From: Budiarto Herman Date: Fri, 2 Aug 2013 14:38:56 +0300 Subject: [PATCH] Moved LteHelper::Connect functionality into LteHelper::Attach --- src/lte/doc/source/lte-design.rst | 6 +-- src/lte/helper/lte-helper.cc | 50 ++++++------------------ src/lte/helper/lte-helper.h | 52 +++++++++++++++++++------ src/lte/test/lte-test-cell-selection.cc | 2 +- 4 files changed, 56 insertions(+), 54 deletions(-) diff --git a/src/lte/doc/source/lte-design.rst b/src/lte/doc/source/lte-design.rst index e95ba796f..8bae40d96 100644 --- a/src/lte/doc/source/lte-design.rst +++ b/src/lte/doc/source/lte-design.rst @@ -2098,9 +2098,9 @@ Section :ref:`sec-network-attachment` of user documentation. When the cell passes all the above criteria, then the cell is deemed as *suitable*. Next, UE camps to it, switching its RRC state to `IDLE_WAIT_SYSTEM_INFO`, or to `IDLE_CAMPED_NORMALLY` if SIB2 has been received. -After this, the UE may request to enter CONNECTED mode, which can be done by -calling ``LteHelper::Connect`` function; please refer to section -:ref:`sec-rrc-connection-establishment` for details on this. + +After this, upper layer may request UE to enter CONNECTED mode. Please refer to +section :ref:`sec-rrc-connection-establishment` for details on this. On the other hand, when the cell does not pass the CSG criterion, then the cell is labeled as *acceptable* (Section 10.1.1.1 [TS36300]_). In this case, the RRC diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index 2a70a590a..6688b3347 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -611,8 +611,19 @@ LteHelper::Attach (Ptr ueDevice) NS_FATAL_ERROR ("The passed NetDevice must be an LteUeNetDevice"); } + // execute cell search Ptr uePhy = ueLteDevice->GetPhy (); uePhy->CellSearch (); + + // instruct UE to immediately enter CONNECTED mode after camping + Ptr ueNas = ueLteDevice->GetNas (); + NS_ASSERT (ueNas != 0); + ueNas->Connect (); + + // activate default EPS bearer + m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (), + EpcTft::Default (), + EpsBearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT)); } void @@ -682,43 +693,6 @@ LteHelper::AttachToClosestEnb (Ptr ueDevice, NetDeviceContainer enbDe Attach (ueDevice, closestEnbDevice); } -void -LteHelper::Connect (NetDeviceContainer ueDevices) -{ - NS_LOG_FUNCTION (this); - for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i) - { - Connect (*i); - } -} - -void -LteHelper::Connect (Ptr ueDevice) -{ - NS_LOG_FUNCTION (this); - - Ptr ueLteDevice = ueDevice->GetObject (); - if (ueLteDevice == 0) - { - NS_FATAL_ERROR ("The passed NetDevice must be an LteUeNetDevice"); - } - - Ptr ueNas = ueLteDevice->GetNas (); - NS_ASSERT (ueNas != 0); - ueNas->Connect (); - - if (m_epcHelper == 0) - { - // TODO activate bearer for without-EPC simulation - } - else - { - // activate default EPS bearer - m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (), EpcTft::Default (), - EpsBearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT)); - } -} - void LteHelper::ActivateDedicatedEpsBearer (NetDeviceContainer ueDevices, EpsBearer bearer, Ptr tft) { @@ -736,7 +710,7 @@ LteHelper::ActivateDedicatedEpsBearer (Ptr ueDevice, EpsBearer bearer NS_LOG_FUNCTION (this); NS_ASSERT_MSG (m_epcHelper != 0, "dedicated EPS bearers cannot be set up when EPC is not used"); - + uint64_t imsi = ueDevice->GetObject ()->GetImsi (); m_epcHelper->ActivateEpsBearer (ueDevice, imsi, tft, bearer); } diff --git a/src/lte/helper/lte-helper.h b/src/lte/helper/lte-helper.h index 697af5309..781ef6254 100644 --- a/src/lte/helper/lte-helper.h +++ b/src/lte/helper/lte-helper.h @@ -188,8 +188,16 @@ public: * \param ueDevices the set of UE devices to be attached * * By calling this, the UE will start the initial cell selection procedure at - * the beginning of simulation. Note that this function can only be used in - * EPC-enabled simulation. + * the beginning of simulation. In addition, the function also instructs each + * UE to immediately enter CONNECTED mode and activates the default EPS + * bearer. + * + * If this function is called when the UE is in a situation where entering + * CONNECTED mode is not possible (e.g. before the simulation begin), then the + * UE will attempt to connect at the earliest possible time (e.g. after it + * camps to a suitable cell). + * + * Note that this function can only be used in EPC-enabled simulation. */ void Attach (NetDeviceContainer ueDevices); @@ -199,8 +207,16 @@ public: * \param ueDevice the UE device to be attached * * By calling this, the UE will start the initial cell selection procedure at - * the beginning of simulation. Note that this function can only be used in - * EPC-enabled simulation. + * the beginning of simulation. In addition, the function also instructs the + * UE to immediately enter CONNECTED mode and activates the default EPS + * bearer. + * + * If this function is called when the UE is in a situation where entering + * CONNECTED mode is not possible (e.g. before the simulation begin), then the + * UE will attempt to connect at the earliest possible time (e.g. after it + * camps to a suitable cell). + * + * Note that this function can only be used in EPC-enabled simulation. */ void Attach (Ptr ueDevice); @@ -234,22 +250,34 @@ public: void Attach (Ptr ueDevice, Ptr enbDevice); /** - * Attach each UE in a set to the closest (w.r.t. distance) eNB among those in a set. + * \brief Manual attachment of a set of UE devices to the network via the + * closest eNodeB (with respect to distance) among those in the set. + * \param ueDevices the set of UE devices to be attached + * \param enbDevices the set of eNodeB devices to be considered * + * This function finds among the eNodeB set the closest eNodeB for each UE, + * and then invokes manual attachment between the pair. * + * Users are encouraged to use automatic attachment (Idle mode cell selection) + * instead of this function. * - * \param ueDevices the set of UEs - * \param enbDevices the set of eNBs + * \sa LteHelper::Attach(NetDeviceContainer ueDevices); */ void AttachToClosestEnb (NetDeviceContainer ueDevices, NetDeviceContainer enbDevices); /** - * Attach an UE ito the closest (w.r.t. distance) eNB among those in a set - * Will call LteHelper::Attach () passing to it the single eNB - * instance which resulted to be the closest to the UE + * \brief Manual attachment of a UE device to the network via the closest + * eNodeB (with respect to distance) among those in the set. + * \param ueDevices the set UE device to be attached + * \param enbDevices the set of eNodeB devices to be considered + * + * This function finds among the eNodeB set the closest eNodeB for the UE, + * and then invokes manual attachment between the pair. * - * \param ueDevice the UE - * \param enbDevices the set of eNBs + * Users are encouraged to use automatic attachment (Idle mode cell selection) + * instead of this function. + * + * \sa LteHelper::Attach(Ptr ueDevice); */ void AttachToClosestEnb (Ptr ueDevice, NetDeviceContainer enbDevices); diff --git a/src/lte/test/lte-test-cell-selection.cc b/src/lte/test/lte-test-cell-selection.cc index 718668cb8..97cfa7481 100644 --- a/src/lte/test/lte-test-cell-selection.cc +++ b/src/lte/test/lte-test-cell-selection.cc @@ -298,8 +298,8 @@ LteCellSelectionTestCase::DoRun () ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1); } + // Enable Idle mode cell selection lteHelper->Attach (ueDevs); - lteHelper->Connect (ueDevs); } // end of if (m_isEpcMode) else