lte: Extend EPC X2 interface to send handover cancel message

This commit is contained in:
ZorazeAli
2019-03-25 14:22:05 +01:00
committed by Tom Henderson
parent 84b4e82757
commit f69fda69e6
3 changed files with 86 additions and 0 deletions

View File

@@ -333,6 +333,21 @@ public:
Ptr<Packet> ueData; ///< UE data
};
/**
* \brief Parameters of the HANDOVER CANCEL message.
*
* See section 9.1.1.6 for further info about the parameters
*
*/
struct HandoverCancelParams
{
uint16_t oldEnbUeX2apId; ///< old ENB UE X2 AP ID
uint16_t newEnbUeX2apId; ///< new ENB UE X2 AP ID
uint16_t sourceCellId; ///< source cell ID
uint16_t targetCellId; ///< target cell ID
uint16_t cause; ///< cause
};
};
@@ -396,6 +411,12 @@ public:
* \param params the UE data parameters
*/
virtual void SendUeData (UeDataParams params) = 0;
/**
* \brief Send handover Cancel to the target eNB
* \param params the handover cancel parameters
*/
virtual void SendHandoverCancel (HandoverCancelParams params) = 0;
};
@@ -529,6 +550,12 @@ public:
*/
virtual void SendUeData (UeDataParams params);
/**
* \brief Send handover Cancel to the target eNB
* \param params the handover cancel parameters
*/
virtual void SendHandoverCancel (HandoverCancelParams params);
private:
EpcX2SpecificEpcX2SapProvider ();
C* m_x2; ///< owner class
@@ -601,6 +628,13 @@ EpcX2SpecificEpcX2SapProvider<C>::SendUeData (UeDataParams params)
m_x2->DoSendUeData (params);
}
template <class C>
void
EpcX2SpecificEpcX2SapProvider<C>::SendHandoverCancel (HandoverCancelParams params)
{
m_x2->DoSendHandoverCancel (params);
}
/**
* EpcX2SpecificEpcX2SapUser
*/

View File

@@ -763,4 +763,50 @@ EpcX2::DoSendUeData (EpcX2SapProvider::UeDataParams params)
sourceSocket->SendTo (packet, 0, InetSocketAddress (targetIpAddr, m_x2uUdpPort));
}
void
EpcX2::DoSendHandoverCancel (EpcX2SapProvider::HandoverCancelParams params)
{
NS_LOG_FUNCTION (this);
NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
NS_LOG_LOGIC ("newEnbUeX2apId = " << params.newEnbUeX2apId);
NS_LOG_LOGIC ("sourceCellId = " << params.sourceCellId);
NS_LOG_LOGIC ("targetCellId = " << params.targetCellId);
NS_ASSERT_MSG (m_x2InterfaceSockets.find (params.targetCellId) != m_x2InterfaceSockets.end (),
"Socket infos not defined for targetCellId = " << params.targetCellId);
Ptr<Socket> localSocket = m_x2InterfaceSockets [params.targetCellId]->m_localCtrlPlaneSocket;
Ipv4Address remoteIpAddr = m_x2InterfaceSockets [params.targetCellId]->m_remoteIpAddr;
NS_LOG_LOGIC ("localSocket = " << localSocket);
NS_LOG_LOGIC ("remoteIpAddr = " << remoteIpAddr);
NS_LOG_INFO ("Send X2 message: HANDOVER CANCEL");
// Build the X2 message
EpcX2HandoverCancelHeader x2HandoverCancelHeader;
x2HandoverCancelHeader.SetOldEnbUeX2apId (params.oldEnbUeX2apId);
x2HandoverCancelHeader.SetNewEnbUeX2apId (params.newEnbUeX2apId);
x2HandoverCancelHeader.SetCause (params.cause);
EpcX2Header x2Header;
x2Header.SetMessageType (EpcX2Header::SuccessfulOutcome);
x2Header.SetProcedureCode (EpcX2Header::HandoverCancel);
x2Header.SetLengthOfIes (x2HandoverCancelHeader.GetLengthOfIes ());
x2Header.SetNumberOfIes (x2HandoverCancelHeader.GetNumberOfIes ());
NS_LOG_INFO ("X2 header: " << x2Header);
NS_LOG_INFO ("X2 UeContextRelease header: " << x2HandoverCancelHeader);
// Build the X2 packet
Ptr<Packet> packet = Create <Packet> ();
packet->AddHeader (x2HandoverCancelHeader);
packet->AddHeader (x2Header);
NS_LOG_INFO ("packetLen = " << packet->GetSize ());
// Send the X2 message through the socket
localSocket->SendTo (packet, 0, InetSocketAddress (remoteIpAddr, m_x2cUdpPort));
}
} // namespace ns3

View File

@@ -202,6 +202,12 @@ protected:
* \param params EpcX2SapProvider::UeDataParams
*/
virtual void DoSendUeData (EpcX2SapProvider::UeDataParams params);
/**
* \brief Send Handover Cancel function
* \param params the handover cancel parameters
*
*/
virtual void DoSendHandoverCancel (EpcX2SapProvider::HandoverCancelParams params);
EpcX2SapUser* m_x2SapUser; ///< X2 SAP user
EpcX2SapProvider* m_x2SapProvider; ///< X2 SAP provider