22 #include "ns3/inet-socket-address.h"
23 #include "ns3/packet.h"
25 #include "ns3/epc-gtpu-header.h"
27 #include "ns3/epc-x2-header.h"
28 #include "ns3/epc-x2.h"
85 : m_x2cUdpPort (4444),
134 NS_LOG_FUNCTION (
this << localCellId << localX2Address << remoteCellId << remoteX2Address);
155 "Mapping for remoteCellId = " << remoteCellId <<
" is already known");
156 m_x2InterfaceSockets [remoteCellId] = Create<X2IfaceInfo> (remoteX2Address, localX2cSocket, localX2uSocket);
159 "Mapping for control plane localSocket = " << localX2cSocket <<
" is already known");
162 NS_ASSERT_MSG (m_x2InterfaceCellIds.find (localX2uSocket) == m_x2InterfaceCellIds.end (),
163 "Mapping for data plane localSocket = " << localX2uSocket <<
" is already known");
164 m_x2InterfaceCellIds [localX2uSocket] = Create<X2CellInfo> (localCellId, remoteCellId);
178 "Missing infos of local and remote CellId");
198 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
215 NS_LOG_LOGIC (
"cellsInfo->m_localCellId = " << cellsInfo->m_localCellId);
217 "TargetCellId mismatches with localCellId");
228 NS_LOG_INFO (
"X2 HandoverRequestAck header: " << x2HoReqAckHeader);
248 NS_LOG_LOGIC (
"Recv X2 message: HANDOVER PREPARATION FAILURE");
253 NS_LOG_INFO (
"X2 HandoverPreparationFailure header: " << x2HoPrepFailHeader);
280 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
299 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
326 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
342 NS_LOG_LOGIC (
"Recv X2 message: RESOURCE STATUS UPDATE");
347 NS_LOG_INFO (
"X2 ResourceStatusUpdate header: " << x2ResStatUpdHeader);
373 NS_LOG_LOGIC (
"Recv UE DATA through X2-U interface from Socket");
378 "Missing infos of local and remote CellId");
410 "Missing infos for targetCellId = " << params.
targetCellId);
412 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
413 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
437 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
461 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
469 NS_LOG_INFO (
"Send X2 message: HANDOVER REQUEST ACK");
485 NS_LOG_INFO (
"X2 HandoverAck header: " << x2HoAckHeader);
511 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
519 NS_LOG_INFO (
"Send X2 message: HANDOVER PREPARATION FAILURE");
534 NS_LOG_INFO (
"X2 HandoverPrepFail header: " << x2HoPrepFailHeader);
559 "Socket infos not defined for targetCellId = " << params.
targetCellId);
567 NS_LOG_INFO (
"Send X2 message: SN STATUS TRANSFER");
582 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
586 packet->
AddHeader (x2SnStatusXferHeader);
605 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
613 NS_LOG_INFO (
"Send X2 message: UE CONTEXT RELEASE");
627 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
631 packet->
AddHeader (x2UeCtxReleaseHeader);
649 "Missing infos for targetCellId = " << params.
targetCellId);
651 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
652 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
670 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
695 "Missing infos for targetCellId = " << params.
targetCellId);
697 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
698 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
703 NS_LOG_INFO (
"Send X2 message: RESOURCE STATUS UPDATE");
718 NS_LOG_INFO (
"X2 ResourceStatusUpdate header: " << x2ResourceStatUpdHeader);
722 packet->
AddHeader (x2ResourceStatUpdHeader);
742 "Missing infos for targetCellId = " << params.
targetCellId);
744 Ptr<Socket> sourceSocket = socketInfo->m_localUserPlaneSocket;
745 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
758 NS_LOG_INFO (
"Forward UE DATA through X2 interface");
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
virtual ~EpcX2(void)
Destructor.
virtual void DoSendHandoverRequest(EpcX2SapProvider::HandoverRequestParams params)
virtual ~X2IfaceInfo(void)
These service primitives of this part of the X2 SAP are provided by the X2 entity and issued by RRC e...
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint16_t GetOldEnbUeX2apId() const
uint32_t GetLengthOfIes() const
Ptr< Socket > m_localUserPlaneSocket
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
X2CellInfo & operator=(const X2CellInfo &)
std::vector< EpcX2Sap::ErabNotAdmittedItem > GetNotAdmittedBearers() const
std::vector< CellMeasurementResultItem > cellMeasurementResultList
virtual void RecvUeContextRelease(UeContextReleaseParams params)=0
Parameters of the HANDOVER REQUEST message.
uint32_t GetLengthOfIes() const
void SetCause(uint16_t cause)
static TypeId GetTypeId(void)
virtual void RecvSnStatusTransfer(SnStatusTransferParams params)=0
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
virtual void RecvHandoverRequest(HandoverRequestParams params)=0
Service primitives.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void DoSendLoadInformation(EpcX2SapProvider::LoadInformationParams params)
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint16_t m_x2cUdpPort
UDP ports to be used for the X2 interfaces: X2-C and X2-U.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
void RecvFromX2uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the X2-U (X2 User Plane) socket.
virtual ~X2CellInfo(void)
virtual void DoSendUeData(EpcX2SapProvider::UeDataParams params)
virtual void DoSendUeContextRelease(EpcX2SapProvider::UeContextReleaseParams params)
uint16_t GetNewEnbUeX2apId() const
uint64_t ueAggregateMaxBitRateUplink
uint32_t GetMmeUeS1apId() const
virtual void DoSendSnStatusTransfer(EpcX2SapProvider::SnStatusTransferParams params)
Introspection did not find any typical Config paths.
uint16_t GetCriticalityDiagnostics() const
uint64_t GetUeAggregateMaxBitRateUplink() const
uint16_t GetTargetCellId() const
std::vector< EpcX2Sap::ErabToBeSetupItem > GetBearers() const
uint16_t GetOldEnbUeX2apId() const
Introspection did not find any typical Config paths.
virtual void DoSendResourceStatusUpdate(EpcX2SapProvider::ResourceStatusUpdateParams params)
void SetTargetCellId(uint16_t targetCellId)
X2IfaceInfo & operator=(const X2IfaceInfo &)
uint64_t ueAggregateMaxBitRateDownlink
void RecvFromX2cSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the X2-C (X2 Control Plane) socket. ...
void SetUeAggregateMaxBitRateUplink(uint64_t bitRate)
Parameters of the HANDOVER PREPARATION FAILURE message.
Ptr< Socket > m_localCtrlPlaneSocket
uint16_t enb2MeasurementId
uint32_t GetNumberOfIes() const
std::vector< ErabAdmittedItem > admittedBearers
Parameters of the SN STATUS TRANSFER message.
void SetOldEnbUeX2apId(uint16_t x2apId)
virtual void DoSendHandoverRequestAck(EpcX2SapProvider::HandoverRequestAckParams params)
uint32_t GetNumberOfIes() const
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Introspection did not find any typical Config paths.
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
std::map< uint16_t, Ptr< X2IfaceInfo > > m_x2InterfaceSockets
Map the targetCellId to the corresponding (sourceSocket, remoteIpAddr) to be used to send the X2 mess...
uint32_t GetNumberOfIes() const
X2IfaceInfo(Ipv4Address remoteIpAddr, Ptr< Socket > localCtrlPlaneSocket, Ptr< Socket > localUserPlaneSocket)
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
void SetUeAggregateMaxBitRateDownlink(uint64_t bitRate)
virtual void RecvHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
X2CellInfo(uint16_t localCellId, uint16_t remoteCellId)
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Parameters of the RESOURCE STATUS UPDATE message.
This entity is installed inside an eNB and provides the functionality for the X2 interface.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
Parameters of the UE CONTEXT RELEASE message.
void SetNotAdmittedBearers(std::vector< EpcX2Sap::ErabNotAdmittedItem > bearers)
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
These service primitives of this part of the X2 SAP are provided by the RRC entity and issued by the ...
virtual void RecvUeData(UeDataParams params)=0
std::vector< ErabToBeSetupItem > bearers
EpcX2SapUser * m_x2SapUser
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
virtual void DoSendHandoverPreparationFailure(EpcX2SapProvider::HandoverPreparationFailureParams params)
uint16_t GetCause() const
Ipv4 addresses are stored in host order in this class.
EpcX2SapProvider * GetEpcX2SapProvider()
uint16_t enb1MeasurementId
uint32_t GetLengthOfIes() const
void SetEpcX2SapUser(EpcX2SapUser *s)
std::vector< ErabNotAdmittedItem > notAdmittedBearers
void SetNewEnbUeX2apId(uint16_t x2apId)
uint16_t GetOldEnbUeX2apId() const
uint16_t criticalityDiagnostics
void SetAdmittedBearers(std::vector< EpcX2Sap::ErabAdmittedItem > bearers)
uint16_t GetCause() const
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
void SetBearers(std::vector< EpcX2Sap::ErabToBeSetupItem > bearers)
std::vector< EpcX2Sap::ErabAdmittedItem > GetAdmittedBearers() const
uint64_t GetUeAggregateMaxBitRateDownlink() const
EpcX2SapProvider * m_x2SapProvider
void SetOldEnbUeX2apId(uint16_t x2apId)
std::map< Ptr< Socket >, Ptr< X2CellInfo > > m_x2InterfaceCellIds
Map the localSocket (the one receiving the X2 message) to the corresponding (sourceCellId, targetCellId) associated with the X2 interface.
A base class which provides memory management and object aggregation.
virtual void RecvLoadInformation(LoadInformationParams params)=0
void AddX2Interface(uint16_t enb1CellId, Ipv4Address enb1X2Address, uint16_t enb2CellId, Ipv4Address enb2X2Address)
Add an X2 interface to this EPC X2 entity.
void SetOldEnbUeX2apId(uint16_t x2apId)
void SetCause(uint16_t cause)
virtual void DoDispose(void)
Destructor implementation.
virtual void RecvHandoverRequestAck(HandoverRequestAckParams params)=0
Parameters of the UE DATA primitive.
Ipv4Address m_remoteIpAddr
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
a unique identifier for an interface.
void SetCriticalityDiagnostics(uint16_t criticalityDiagnostics)
TypeId SetParent(TypeId tid)
void AddHeader(const Header &header)
Add header to this packet.
virtual void RecvResourceStatusUpdate(ResourceStatusUpdateParams params)=0
static TypeId LookupByName(std::string name)
void SetMmeUeS1apId(uint32_t mmeUeS1apId)