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),
113 .SetGroupName(
"Lte");
135 NS_LOG_FUNCTION (
this << localCellId << localX2Address << remoteCellId << remoteX2Address);
156 "Mapping for remoteCellId = " << remoteCellId <<
" is already known");
157 m_x2InterfaceSockets [remoteCellId] = Create<X2IfaceInfo> (remoteX2Address, localX2cSocket, localX2uSocket);
160 "Mapping for control plane localSocket = " << localX2cSocket <<
" is already known");
164 "Mapping for data plane localSocket = " << localX2uSocket <<
" is already known");
179 "Missing infos of local and remote CellId");
199 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
216 NS_LOG_LOGIC (
"cellsInfo->m_localCellId = " << cellsInfo->m_localCellId);
218 "TargetCellId mismatches with localCellId");
229 NS_LOG_INFO (
"X2 HandoverRequestAck header: " << x2HoReqAckHeader);
249 NS_LOG_LOGIC (
"Recv X2 message: HANDOVER PREPARATION FAILURE");
254 NS_LOG_INFO (
"X2 HandoverPreparationFailure header: " << x2HoPrepFailHeader);
281 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
300 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
327 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
343 NS_LOG_LOGIC (
"Recv X2 message: RESOURCE STATUS UPDATE");
348 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.
uint16_t sourceCellId
source cell ID
uint32_t GetNumberOfIes() const
Get number of IEs.
uint32_t mmeUeS1apId
MME UE S1 AP ID.
virtual void DoSendHandoverRequest(EpcX2SapProvider::HandoverRequestParams params)
Send handover request function.
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 m_remoteCellId
remote cell ID
Ptr< Socket > m_localUserPlaneSocket
local user plane socket
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
X2CellInfo & operator=(const X2CellInfo &)
Assignment operator.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint16_t sourceCellId
source cell ID
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
uint16_t targetCellId
target cell ID
std::vector< CellMeasurementResultItem > cellMeasurementResultList
cell measurement result list
uint16_t m_localCellId
local cell ID
virtual void RecvUeContextRelease(UeContextReleaseParams params)=0
Receive UE context release function.
Parameters of the HANDOVER REQUEST message.
void SetCause(uint16_t cause)
Set cause function.
static TypeId GetTypeId(void)
Get the type ID.
virtual void RecvSnStatusTransfer(SnStatusTransferParams params)=0
Receive SN status transfer function.
#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
Receive handover request function.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
virtual void DoSendLoadInformation(EpcX2SapProvider::LoadInformationParams params)
Send load information function.
uint16_t m_x2cUdpPort
UDP ports to be used for the X2-C interface.
uint16_t GetCriticalityDiagnostics() const
Get criticality diagnostics function.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
uint64_t GetUeAggregateMaxBitRateUplink() const
Get UE Aggregrate Max Bit Rate Uplik function.
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)
Send UE data function.
virtual void DoSendUeContextRelease(EpcX2SapProvider::UeContextReleaseParams params)
Send UE context release function.
std::vector< EpcX2Sap::ErabToBeSetupItem > GetBearers() const
Get bearers function.
uint64_t ueAggregateMaxBitRateUplink
UE aggregrate max bit rate uplink.
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
virtual void DoSendSnStatusTransfer(EpcX2SapProvider::SnStatusTransferParams params)
Send SN status transfer function.
uint32_t GetLengthOfIes() const
Get length of IEs function.
EpcX2HandoverRequestAckHeader.
Ptr< Packet > rrcContext
RRC context.
uint32_t GetLengthOfIes() const
Get length of IEs function.
uint16_t targetCellId
target cell ID
uint16_t m_x2uUdpPort
UDP ports to be used for the X2-U interface.
EpcX2HandoverRequestHeader.
virtual void DoSendResourceStatusUpdate(EpcX2SapProvider::ResourceStatusUpdateParams params)
Send resource status update function.
void SetTargetCellId(uint16_t targetCellId)
Set target cell id function.
X2IfaceInfo & operator=(const X2IfaceInfo &)
Assignment operator.
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
uint32_t GetNumberOfIes() const
Get number of IEs function.
uint64_t ueAggregateMaxBitRateDownlink
UE aggregrate max bit rate downlink.
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)
Set UE Aggregrate Max Bit Rate Uplik function.
Parameters of the HANDOVER PREPARATION FAILURE message.
Ptr< Socket > m_localCtrlPlaneSocket
local control plane socket
uint16_t enb2MeasurementId
ENB2 measurement ID.
std::vector< ErabAdmittedItem > admittedBearers
admitted bearers
Parameters of the SN STATUS TRANSFER message.
void SetOldEnbUeX2apId(uint16_t x2apId)
Set old ENB UE X2 AP ID function.
virtual void DoSendHandoverRequestAck(EpcX2SapProvider::HandoverRequestAckParams params)
Send handover request ack function.
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
EpcX2HandoverPreparationFailureHeader.
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...
X2IfaceInfo(Ipv4Address remoteIpAddr, Ptr< Socket > localCtrlPlaneSocket, Ptr< Socket > localUserPlaneSocket)
Constructor.
void SetUeAggregateMaxBitRateDownlink(uint64_t bitRate)
Set UE Aggregrate Max Bit Rate Downlink function.
virtual void RecvHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
Receive handover preparation failure function.
Ptr< Packet > rrcContext
RRC context.
uint16_t targetCellId
target cell ID
X2CellInfo(uint16_t localCellId, uint16_t remoteCellId)
Constructor.
uint32_t gtpTeid
GTP TEID.
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.
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
This entity is installed inside an eNB and provides the functionality for the X2 interface.
uint16_t targetCellId
target cell ID
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)
Set not admitted bearers function.
uint16_t sourceCellId
source cell ID
std::vector< EpcX2Sap::ErabNotAdmittedItem > GetNotAdmittedBearers() const
Get not admitted bearers function.
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
uint32_t GetNumberOfIes() const
Get number of IEs function.
These service primitives of this part of the X2 SAP are provided by the RRC entity and issued by the ...
uint32_t GetMmeUeS1apId() const
Get MME UE S1 AP ID function.
virtual void RecvUeData(UeDataParams params)=0
Receive UE data function.
std::vector< ErabToBeSetupItem > bearers
bearers
EpcX2SapUser * m_x2SapUser
X2 SAP user.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
uint16_t sourceCellId
source cell ID
virtual void DoSendHandoverPreparationFailure(EpcX2SapProvider::HandoverPreparationFailureParams params)
Send handover preparation failure function.
Ipv4 addresses are stored in host order in this class.
EpcX2SapProvider * GetEpcX2SapProvider()
uint16_t enb1MeasurementId
ENB1 measurement ID.
void SetEpcX2SapUser(EpcX2SapUser *s)
uint16_t GetCause() const
Get cause function.
std::vector< ErabNotAdmittedItem > notAdmittedBearers
not admitted bearers
EpcX2SpecificEpcX2SapProvider.
uint16_t GetOldEnbUeX2apId() const
Get old ENB X2 AP ID function.
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
uint16_t sourceCellId
source cell ID
uint16_t GetOldEnbUeX2apId() const
Get old ENB UE X2 AP ID function.
uint16_t GetTargetCellId() const
Get target cell id function.
std::vector< EpcX2Sap::ErabAdmittedItem > GetAdmittedBearers() const
Get admittied bearers function.
void SetNewEnbUeX2apId(uint16_t x2apId)
Set new ENB UE X2 AP ID function.
uint16_t criticalityDiagnostics
criticality diagnostics
void SetAdmittedBearers(std::vector< EpcX2Sap::ErabAdmittedItem > bearers)
Set admitted bearers function.
uint16_t GetCause() const
Get cause function.
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)
Set bearers function.
Ptr< Packet > ueData
UE data.
EpcX2SapProvider * m_x2SapProvider
X2 SAP provider.
void SetOldEnbUeX2apId(uint16_t x2apId)
Set old ENB UE X2 AP ID function.
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.
uint32_t GetLengthOfIes() const
Get length of IEs.
A base class which provides memory management and object aggregation.
uint64_t GetUeAggregateMaxBitRateDownlink() const
Get UE Aggregate Max Bit Rate Downlink function.
uint16_t targetCellId
target cell ID
virtual void RecvLoadInformation(LoadInformationParams params)=0
Receive load information function.
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)
Set old ENB X2 AP ID function.
uint16_t targetCellId
target cell ID
void SetCause(uint16_t cause)
Set cause function.
virtual void DoDispose(void)
Destructor implementation.
virtual void RecvHandoverRequestAck(HandoverRequestAckParams params)=0
Receive handover request ack function.
Parameters of the UE DATA primitive.
Ipv4Address m_remoteIpAddr
remote IP address
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
ERABs subject to status transfer list.
a unique identifier for an interface.
void SetCriticalityDiagnostics(uint16_t criticalityDiagnostics)
Set criticality diagnostics function.
uint16_t sourceCellId
source cell ID
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void AddHeader(const Header &header)
Add header to this packet.
virtual void RecvResourceStatusUpdate(ResourceStatusUpdateParams params)=0
Receive resource status update function.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
uint16_t GetNewEnbUeX2apId() const
Get new ENB UE X2 AP ID function.
void SetMmeUeS1apId(uint32_t mmeUeS1apId)
Set MME UE S1 AP ID function.
uint16_t GetOldEnbUeX2apId() const
Get old ENB UE X2 AP ID function.