A Discrete-Event Network Simulator
API
LteHandoverTargetTestCase Class Reference

Testing a handover algorithm, verifying that it selects the right target cell when more than one options available. More...

+ Inheritance diagram for LteHandoverTargetTestCase:
+ Collaboration diagram for LteHandoverTargetTestCase:

Public Member Functions

 LteHandoverTargetTestCase (std::string name, Vector uePosition, uint8_t gridSizeX, uint8_t gridSizeY, uint16_t sourceCellId, uint16_t targetCellId, std::string handoverAlgorithmType)
 Construct a new test case and providing input parameters for the simulation. More...
 
 ~LteHandoverTargetTestCase () override
 
void CellShutdownCallback ()
 A trigger that can be scheduled to "shutdown" the cell pointed by m_sourceCellId by reducing its power to 1 dB. More...
 
void HandoverStartCallback (std::string context, uint64_t imsi, uint16_t sourceCellId, uint16_t rnti, uint16_t targetCellId)
 Triggers when an eNodeB starts a handover and then verifies that the handover has the right source and target cells. More...
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

void DoRun () override
 Run a simulation of a micro-cell network using the parameters provided to the constructor function. More...
 
void DoTeardown () override
 Called at the end of simulation and verifies that a handover has occurred in the simulation. More...
 

Private Attributes

uint8_t m_gridSizeX
 X grid size. More...
 
uint8_t m_gridSizeY
 Y grid size. More...
 
std::string m_handoverAlgorithmType
 handover algorithm type More...
 
bool m_hasHandoverOccurred
 has handover occurred? More...
 
uint16_t m_sourceCellId
 source cell ID More...
 
Ptr< LteEnbNetDevicem_sourceEnbDev
 source ENB device More...
 
uint16_t m_targetCellId
 target cell ID More...
 
Vector m_uePosition
 UE positions. More...
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor. More...
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite. More...
 
TestCaseGetParent () const
 Get the parent of this TestCase. More...
 
bool IsStatusFailure () const
 Check if any tests failed. More...
 
bool IsStatusSuccess () const
 Check if all tests passed. More...
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found. More...
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase. More...
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure. More...
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure. More...
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory. More...
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory. More...
 

Detailed Description

Testing a handover algorithm, verifying that it selects the right target cell when more than one options available.

Part of the lte-handover-target test suite.

The test case will run a 1-second LTE-EPC simulation using the parameters provided to the constructor function.

See also
ns3::LteHandoverTargetTestCase

Definition at line 63 of file test-lte-handover-target.cc.

Constructor & Destructor Documentation

◆ LteHandoverTargetTestCase()

LteHandoverTargetTestCase::LteHandoverTargetTestCase ( std::string  name,
Vector  uePosition,
uint8_t  gridSizeX,
uint8_t  gridSizeY,
uint16_t  sourceCellId,
uint16_t  targetCellId,
std::string  handoverAlgorithmType 
)

Construct a new test case and providing input parameters for the simulation.

Parameters
namethe name of the test case, to be displayed in the test result
uePositionthe point in (x, y, z) coordinate where the UE will be placed in the simulation
gridSizeXnumber of eNodeBs in a row
gridSizeYnumber of eNodeBs in a column
sourceCellIdthe cell ID of the eNodeB which the UE will be initially attached to in the beginning of simulation, and also the eNodeB which will "shutdown" in the middle of simulation
targetCellIdthe cell ID of the expected eNodeB where the UE will perform handover to after the "shutdown" of the source cell
handoverAlgorithmTypethe type of handover algorithm to be used in all eNodeBs

Definition at line 145 of file test-lte-handover-target.cc.

References NS_FATAL_ERROR, and NS_LOG_INFO.

◆ ~LteHandoverTargetTestCase()

LteHandoverTargetTestCase::~LteHandoverTargetTestCase ( )
override

Definition at line 179 of file test-lte-handover-target.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ CellShutdownCallback()

void LteHandoverTargetTestCase::CellShutdownCallback ( )

A trigger that can be scheduled to "shutdown" the cell pointed by m_sourceCellId by reducing its power to 1 dB.

Definition at line 205 of file test-lte-handover-target.cc.

References ns3::LteEnbNetDevice::GetCellId(), ns3::LteEnbNetDevice::GetPhy(), m_sourceCellId, m_sourceEnbDev, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, and third::phy.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRun()

void LteHandoverTargetTestCase::DoRun ( void  )
overrideprivatevirtual

Run a simulation of a micro-cell network using the parameters provided to the constructor function.

Implements ns3::TestCase.

Definition at line 220 of file test-lte-handover-target.cc.

References ns3::LteHelper::AddX2Interface(), ns3::Ipv4AddressHelper::Assign(), ns3::NoBackhaulEpcHelper::AssignUeIpv4Address(), ns3::LteHelper::Attach(), CellShutdownCallback(), ns3::Config::Connect(), ns3::NodeContainer::Create(), ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::LteEnbNetDevice::GetCellId(), ns3::NodeContainer::GetN(), ns3::TestCase::GetName(), ns3::Object::GetObject(), ns3::NoBackhaulEpcHelper::GetPgwNode(), ns3::Ipv4StaticRoutingHelper::GetStaticRouting(), ns3::NoBackhaulEpcHelper::GetUeDefaultGatewayAddress(), HandoverStartCallback(), ns3::PointToPointHelper::Install(), ns3::MobilityHelper::Install(), ns3::LteHelper::InstallEnbDevice(), ns3::LteHelper::InstallUeDevice(), nsclick-simple-lan::internet, m_gridSizeX, m_gridSizeY, m_handoverAlgorithmType, m_sourceCellId, m_sourceEnbDev, m_uePosition, ns3::MakeCallback(), ns3::MilliSeconds(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_INFO, ns3::Seconds(), ns3::ObjectBase::SetAttribute(), ns3::Ipv4AddressHelper::SetBase(), ns3::PointToPointHelper::SetChannelAttribute(), ns3::Config::SetDefault(), ns3::PointToPointHelper::SetDeviceAttribute(), ns3::LteHelper::SetEpcHelper(), ns3::LteHelper::SetHandoverAlgorithmAttribute(), ns3::LteHelper::SetHandoverAlgorithmType(), ns3::MobilityHelper::SetMobilityModel(), and ns3::MobilityHelper::SetPositionAllocator().

+ Here is the call graph for this function:

◆ DoTeardown()

void LteHandoverTargetTestCase::DoTeardown ( )
overrideprivatevirtual

Called at the end of simulation and verifies that a handover has occurred in the simulation.

Reimplemented from ns3::TestCase.

Definition at line 373 of file test-lte-handover-target.cc.

References m_hasHandoverOccurred, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_EQ.

◆ HandoverStartCallback()

void LteHandoverTargetTestCase::HandoverStartCallback ( std::string  context,
uint64_t  imsi,
uint16_t  sourceCellId,
uint16_t  rnti,
uint16_t  targetCellId 
)

Triggers when an eNodeB starts a handover and then verifies that the handover has the right source and target cells.

The trigger is set up beforehand by connecting to the LteEnbRrc::HandoverStart trace source.

Parameters
contextthe context string
imsithe IMSI
sourceCellIdthe source cell ID
rntithe RNTI
targetCellIdthe target cell ID

Definition at line 185 of file test-lte-handover-target.cc.

References ns3::Time::GetMilliSeconds(), m_hasHandoverOccurred, m_sourceCellId, m_targetCellId, ns3::Now(), NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, and NS_TEST_ASSERT_MSG_GT.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_gridSizeX

uint8_t LteHandoverTargetTestCase::m_gridSizeX
private

X grid size.

Definition at line 134 of file test-lte-handover-target.cc.

Referenced by DoRun().

◆ m_gridSizeY

uint8_t LteHandoverTargetTestCase::m_gridSizeY
private

Y grid size.

Definition at line 135 of file test-lte-handover-target.cc.

Referenced by DoRun().

◆ m_handoverAlgorithmType

std::string LteHandoverTargetTestCase::m_handoverAlgorithmType
private

handover algorithm type

Definition at line 138 of file test-lte-handover-target.cc.

Referenced by DoRun().

◆ m_hasHandoverOccurred

bool LteHandoverTargetTestCase::m_hasHandoverOccurred
private

has handover occurred?

Definition at line 141 of file test-lte-handover-target.cc.

Referenced by DoTeardown(), and HandoverStartCallback().

◆ m_sourceCellId

uint16_t LteHandoverTargetTestCase::m_sourceCellId
private

source cell ID

Definition at line 136 of file test-lte-handover-target.cc.

Referenced by CellShutdownCallback(), DoRun(), and HandoverStartCallback().

◆ m_sourceEnbDev

Ptr<LteEnbNetDevice> LteHandoverTargetTestCase::m_sourceEnbDev
private

source ENB device

Definition at line 140 of file test-lte-handover-target.cc.

Referenced by CellShutdownCallback(), and DoRun().

◆ m_targetCellId

uint16_t LteHandoverTargetTestCase::m_targetCellId
private

target cell ID

Definition at line 137 of file test-lte-handover-target.cc.

Referenced by HandoverStartCallback().

◆ m_uePosition

Vector LteHandoverTargetTestCase::m_uePosition
private

UE positions.

Definition at line 133 of file test-lte-handover-target.cc.

Referenced by DoRun().


The documentation for this class was generated from the following file: