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"
87 : m_x2cUdpPort (4444),
136 NS_LOG_FUNCTION (
this << localCellId << localX2Address << remoteCellId << remoteX2Address);
157 "Mapping for remoteCellId = " << remoteCellId <<
" is already known");
158 m_x2InterfaceSockets [remoteCellId] = Create<X2IfaceInfo> (remoteX2Address, localX2cSocket, localX2uSocket);
161 "Mapping for control plane localSocket = " << localX2cSocket <<
" is already known");
164 NS_ASSERT_MSG (m_x2InterfaceCellIds.find (localX2uSocket) == m_x2InterfaceCellIds.end (),
165 "Mapping for data plane localSocket = " << localX2uSocket <<
" is already known");
166 m_x2InterfaceCellIds [localX2uSocket] = Create<X2CellInfo> (localCellId, remoteCellId);
180 "Missing infos of local and remote CellId");
200 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
217 NS_LOG_LOGIC (
"cellsInfo->m_localCellId = " << cellsInfo->m_localCellId);
219 "TargetCellId mismatches with localCellId");
230 NS_LOG_INFO (
"X2 HandoverRequestAck header: " << x2HoReqAckHeader);
250 NS_LOG_LOGIC (
"Recv X2 message: HANDOVER PREPARATION FAILURE");
255 NS_LOG_INFO (
"X2 HandoverPreparationFailure header: " << x2HoPrepFailHeader);
282 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
301 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
328 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
344 NS_LOG_LOGIC (
"Recv X2 message: RESOURCE STATUS UPDATE");
349 NS_LOG_INFO (
"X2 ResourceStatusUpdate header: " << x2ResStatUpdHeader);
375 NS_LOG_LOGIC (
"Recv UE DATA through X2-U interface from Socket");
380 "Missing infos of local and remote CellId");
412 "Missing infos for targetCellId = " << params.
targetCellId);
414 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
415 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
439 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
463 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
471 NS_LOG_INFO (
"Send X2 message: HANDOVER REQUEST ACK");
487 NS_LOG_INFO (
"X2 HandoverAck header: " << x2HoAckHeader);
513 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
521 NS_LOG_INFO (
"Send X2 message: HANDOVER PREPARATION FAILURE");
536 NS_LOG_INFO (
"X2 HandoverPrepFail header: " << x2HoPrepFailHeader);
561 "Socket infos not defined for targetCellId = " << params.
targetCellId);
569 NS_LOG_INFO (
"Send X2 message: SN STATUS TRANSFER");
584 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
588 packet->
AddHeader (x2SnStatusXferHeader);
607 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
615 NS_LOG_INFO (
"Send X2 message: UE CONTEXT RELEASE");
629 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
633 packet->
AddHeader (x2UeCtxReleaseHeader);
651 "Missing infos for targetCellId = " << params.
targetCellId);
653 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
654 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
672 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
697 "Missing infos for targetCellId = " << params.
targetCellId);
699 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
700 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
705 NS_LOG_INFO (
"Send X2 message: RESOURCE STATUS UPDATE");
720 NS_LOG_INFO (
"X2 ResourceStatusUpdate header: " << x2ResourceStatUpdHeader);
724 packet->
AddHeader (x2ResourceStatUpdHeader);
744 "Missing infos for targetCellId = " << params.
targetCellId);
746 Ptr<Socket> sourceSocket = socketInfo->m_localUserPlaneSocket;
747 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
760 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)
uint16_t GetOldEnbUeX2apId() const
uint32_t GetLengthOfIes() const
Ptr< Socket > m_localUserPlaneSocket
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)
virtual void RecvHandoverRequest(HandoverRequestParams params)=0
Service primitives.
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
virtual void DoSendLoadInformation(EpcX2SapProvider::LoadInformationParams params)
uint32_t GetSize(void) const
uint16_t m_x2cUdpPort
UDP ports to be used for the X2 interfaces: X2-C and X2-U.
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)
Doxygen 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
Doxygen 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)
Doxygen 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)
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.
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
NS_LOG_COMPONENT_DEFINE("EpcX2")
#define NS_ASSERT_MSG(condition, message)
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)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
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)