713 |
713 |
714 |
714 |
715 /** |
715 /** |
716 * \brief Testing a handover algorithm, verifying that it selects the right |
716 * \brief Testing a handover algorithm, verifying that it selects the right |
717 * target cell when more than one options available. |
717 * target cell when more than one options available. |
|
718 * |
|
719 * Part of the `lte-handover-target` test suite. |
|
720 * |
|
721 * The test case will run a 1-second LTE-EPC simulation using the parameters |
|
722 * provided to the constructor function. |
|
723 * |
|
724 * \sa ns3::LteX2HandoverTargetTestSuite |
718 */ |
725 */ |
719 class LteX2HandoverTargetTestCase : public TestCase |
726 class LteX2HandoverTargetTestCase : public TestCase |
720 { |
727 { |
721 public: |
728 public: |
|
729 /** |
|
730 * \brief Construct a new test case and providing input parameters for the |
|
731 * simulation. |
|
732 * \param name the name of the test case, to be displayed in the test result |
|
733 * \param uePosition the point in (x, y, z) coordinate where the UE will be |
|
734 * placed in the simulation |
|
735 * \param gridSizeX number of eNodeBs in a row |
|
736 * \param gridSizeY number of eNodeBs in a column |
|
737 * \param sourceCellId the cell ID of the eNodeB which the UE will be |
|
738 * initially attached to in the beginning of simulation, |
|
739 * and also the eNodeB which will "shutdown" in the |
|
740 * middle of simulation |
|
741 * \param targetCellId the cell ID of the expected eNodeB where the UE will |
|
742 * perform handover to after the "shutdown" of the source |
|
743 * cell |
|
744 * \param handoverAlgorithmType the type of handover algorithm to be used in |
|
745 * all eNodeBs |
|
746 */ |
722 LteX2HandoverTargetTestCase (std::string name, Vector uePosition, |
747 LteX2HandoverTargetTestCase (std::string name, Vector uePosition, |
723 uint8_t gridSizeX, uint8_t gridSizeY, |
748 uint8_t gridSizeX, uint8_t gridSizeY, |
724 uint16_t sourceCellId, uint16_t targetCellId, |
749 uint16_t sourceCellId, uint16_t targetCellId, |
725 std::string handoverAlgorithmType); |
750 std::string handoverAlgorithmType); |
726 |
751 |
727 virtual ~LteX2HandoverTargetTestCase (); |
752 virtual ~LteX2HandoverTargetTestCase (); |
728 |
753 |
729 /** |
754 /** |
730 * \brief Triggers when eNodeB starts a handover. |
755 * \brief Triggers when an eNodeB starts a handover and then verifies that |
|
756 * the handover has the right source and target cells. |
731 * |
757 * |
732 * The trigger is set up beforehand by connecting to the |
758 * The trigger is set up beforehand by connecting to the |
733 * `LteEnbRrc::HandoverStart` trace source. |
759 * `LteEnbRrc::HandoverStart` trace source. |
734 */ |
760 */ |
735 void HandoverStartCallback (std::string context, uint64_t imsi, |
761 void HandoverStartCallback (std::string context, uint64_t imsi, |
736 uint16_t sourceCellId, uint16_t rnti, |
762 uint16_t sourceCellId, uint16_t rnti, |
737 uint16_t targetCellId); |
763 uint16_t targetCellId); |
738 |
764 |
|
765 /** |
|
766 * \brief A trigger that can be scheduled to "shutdown" the cell pointed by |
|
767 * `m_sourceCellId` by reducing its power to 1 dB. |
|
768 */ |
739 void CellShutdownCallback (); |
769 void CellShutdownCallback (); |
740 |
770 |
741 private: |
771 private: |
742 /** |
772 /** |
743 * \brief Simulate a micro-cell network in a rectangular grid. |
773 * \brief Run a simulation of a micro-cell network using the parameters |
|
774 * provided to the constructor function. |
744 */ |
775 */ |
745 virtual void DoRun (); |
776 virtual void DoRun (); |
746 |
777 |
|
778 /** |
|
779 * \brief Called at the end of simulation and verifies that a handover has |
|
780 * occurred in the simulation. |
|
781 */ |
747 virtual void DoTeardown (); |
782 virtual void DoTeardown (); |
748 |
783 |
749 // simulation parameters |
784 // simulation parameters |
750 Vector m_uePosition; |
785 Vector m_uePosition; |
751 uint8_t m_gridSizeX; |
786 uint8_t m_gridSizeX; |
769 m_sourceCellId (sourceCellId), m_targetCellId (targetCellId), |
804 m_sourceCellId (sourceCellId), m_targetCellId (targetCellId), |
770 m_handoverAlgorithmType (handoverAlgorithmType), m_sourceEnbDev (0), |
805 m_handoverAlgorithmType (handoverAlgorithmType), m_sourceEnbDev (0), |
771 m_hasHandoverOccurred (false) |
806 m_hasHandoverOccurred (false) |
772 { |
807 { |
773 NS_LOG_INFO (this << " name=" << name); |
808 NS_LOG_INFO (this << " name=" << name); |
|
809 |
|
810 // SANITY CHECK |
|
811 |
|
812 uint16_t nEnb = gridSizeX * gridSizeY; |
|
813 |
|
814 if ((sourceCellId < 0) && (sourceCellId > nEnb)) |
|
815 { |
|
816 NS_FATAL_ERROR ("Invalid source cell ID " << sourceCellId); |
|
817 } |
|
818 |
|
819 if ((targetCellId < 0) && (targetCellId > nEnb)) |
|
820 { |
|
821 NS_FATAL_ERROR ("Invalid target cell ID " << targetCellId); |
|
822 } |
774 } |
823 } |
775 |
824 |
776 |
825 |
777 LteX2HandoverTargetTestCase::~LteX2HandoverTargetTestCase () |
826 LteX2HandoverTargetTestCase::~LteX2HandoverTargetTestCase () |
778 { |
827 { |
982 LteX2HandoverTargetTestSuite (); |
1031 LteX2HandoverTargetTestSuite (); |
983 }; |
1032 }; |
984 |
1033 |
985 |
1034 |
986 LteX2HandoverTargetTestSuite::LteX2HandoverTargetTestSuite () |
1035 LteX2HandoverTargetTestSuite::LteX2HandoverTargetTestSuite () |
987 : TestSuite ("lte-x2-handover-target", SYSTEM) |
1036 : TestSuite ("lte-handover-target", SYSTEM) |
988 { |
1037 { |
989 // LogComponentEnable ("LteX2HandoverMeasuresTest", LOG_PREFIX_ALL); |
1038 // LogComponentEnable ("LteX2HandoverMeasuresTest", LOG_PREFIX_ALL); |
990 // LogComponentEnable ("LteX2HandoverMeasuresTest", LOG_LEVEL_ALL); |
1039 // LogComponentEnable ("LteX2HandoverMeasuresTest", LOG_LEVEL_ALL); |
991 // LogComponentEnable ("A2A4RsrqHandoverAlgorithm", LOG_PREFIX_ALL); |
1040 // LogComponentEnable ("A2A4RsrqHandoverAlgorithm", LOG_PREFIX_ALL); |
992 // LogComponentEnable ("A2A4RsrqHandoverAlgorithm", LOG_LEVEL_ALL); |
1041 // LogComponentEnable ("A2A4RsrqHandoverAlgorithm", LOG_LEVEL_ALL); |