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"
60 m_localCellIds {localCellIds},
61 m_remoteCellIds {remoteCellIds}
83 : m_x2cUdpPort (4444),
111 .SetGroupName(
"Lte");
133 uint16_t remoteCellId = remoteCellIds.at (0);
134 NS_LOG_FUNCTION (
this << localCellId << localX2Address << remoteCellId << remoteX2Address);
153 std::vector<uint16_t> localCellIds;
154 localCellIds.push_back (localCellId);
157 "Mapping for remoteCellId = " << remoteCellId <<
" is already known");
158 for (uint16_t remoteCellId: remoteCellIds)
160 m_x2InterfaceSockets [remoteCellId] = Create<X2IfaceInfo> (remoteX2Address, localX2cSocket, localX2uSocket);
164 "Mapping for control plane localSocket = " << localX2cSocket <<
" is already known");
168 "Mapping for data plane localSocket = " << localX2uSocket <<
" is already known");
183 "Missing infos of local and remote CellId");
203 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
208 params.
sourceCellId = cellsInfo->m_remoteCellIds.at (0);
220 NS_LOG_LOGIC (
"cellsInfo->m_localCellId = " << cellsInfo->m_localCellIds.at (0));
231 NS_LOG_INFO (
"X2 HandoverRequestAck header: " << x2HoReqAckHeader);
237 params.
targetCellId = cellsInfo->m_remoteCellIds.at (0);
251 NS_LOG_LOGIC (
"Recv X2 message: HANDOVER PREPARATION FAILURE");
256 NS_LOG_INFO (
"X2 HandoverPreparationFailure header: " << x2HoPrepFailHeader);
261 params.
targetCellId = cellsInfo->m_remoteCellIds.at (0);
283 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
302 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
307 params.
sourceCellId = cellsInfo->m_remoteCellIds.at (0);
329 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
345 NS_LOG_LOGIC (
"Recv X2 message: RESOURCE STATUS UPDATE");
350 NS_LOG_INFO (
"X2 ResourceStatusUpdate header: " << x2ResStatUpdHeader);
377 NS_LOG_LOGIC (
"Recv UE DATA through X2-U interface from Socket");
382 "Missing infos of local and remote CellId");
391 params.
sourceCellId = cellsInfo->m_remoteCellIds.at (0);
414 "Missing infos for targetCellId = " << params.
targetCellId);
416 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
417 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
441 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
465 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
473 NS_LOG_INFO (
"Send X2 message: HANDOVER REQUEST ACK");
489 NS_LOG_INFO (
"X2 HandoverAck header: " << x2HoAckHeader);
515 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
523 NS_LOG_INFO (
"Send X2 message: HANDOVER PREPARATION FAILURE");
538 NS_LOG_INFO (
"X2 HandoverPrepFail header: " << x2HoPrepFailHeader);
563 "Socket infos not defined for targetCellId = " << params.
targetCellId);
571 NS_LOG_INFO (
"Send X2 message: SN STATUS TRANSFER");
586 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
590 packet->
AddHeader (x2SnStatusXferHeader);
609 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
617 NS_LOG_INFO (
"Send X2 message: UE CONTEXT RELEASE");
631 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
635 packet->
AddHeader (x2UeCtxReleaseHeader);
653 "Missing infos for targetCellId = " << params.
targetCellId);
655 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
656 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
674 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
699 "Missing infos for targetCellId = " << params.
targetCellId);
701 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
702 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
707 NS_LOG_INFO (
"Send X2 message: RESOURCE STATUS UPDATE");
722 NS_LOG_INFO (
"X2 ResourceStatusUpdate header: " << x2ResourceStatUpdHeader);
726 packet->
AddHeader (x2ResourceStatUpdHeader);
746 "Missing infos for targetCellId = " << params.
targetCellId);
748 Ptr<Socket> sourceSocket = socketInfo->m_localUserPlaneSocket;
749 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
762 NS_LOG_INFO (
"Forward UE DATA through X2 interface");
EpcX2HandoverPreparationFailureHeader.
void SetCriticalityDiagnostics(uint16_t criticalityDiagnostics)
Set criticality diagnostics function.
void SetCause(uint16_t cause)
Set cause function.
uint16_t GetOldEnbUeX2apId() const
Get old ENB UE X2 AP ID function.
uint16_t GetCause() const
Get cause function.
uint32_t GetLengthOfIes() const
Get length of IEs function.
uint16_t GetCriticalityDiagnostics() const
Get criticality diagnostics function.
void SetOldEnbUeX2apId(uint16_t x2apId)
Set old ENB UE X2 AP ID function.
uint32_t GetNumberOfIes() const
Get number of IEs function.
EpcX2HandoverRequestAckHeader.
uint16_t GetNewEnbUeX2apId() const
Get new ENB UE X2 AP ID function.
uint32_t GetLengthOfIes() const
Get length of IEs function.
std::vector< EpcX2Sap::ErabNotAdmittedItem > GetNotAdmittedBearers() const
Get not admitted bearers function.
uint16_t GetOldEnbUeX2apId() const
Get old ENB UE X2 AP ID function.
std::vector< EpcX2Sap::ErabAdmittedItem > GetAdmittedBearers() const
Get admittied bearers function.
void SetNotAdmittedBearers(std::vector< EpcX2Sap::ErabNotAdmittedItem > bearers)
Set not admitted bearers function.
void SetNewEnbUeX2apId(uint16_t x2apId)
Set new ENB UE X2 AP ID function.
void SetOldEnbUeX2apId(uint16_t x2apId)
Set old ENB UE X2 AP ID function.
uint32_t GetNumberOfIes() const
Get number of IEs function.
void SetAdmittedBearers(std::vector< EpcX2Sap::ErabAdmittedItem > bearers)
Set admitted bearers function.
EpcX2HandoverRequestHeader.
uint16_t GetCause() const
Get cause function.
void SetCause(uint16_t cause)
Set cause function.
void SetMmeUeS1apId(uint32_t mmeUeS1apId)
Set MME UE S1 AP ID function.
uint32_t GetMmeUeS1apId() const
Get MME UE S1 AP ID function.
void SetTargetCellId(uint16_t targetCellId)
Set target cell id function.
void SetUeAggregateMaxBitRateUplink(uint64_t bitRate)
Set UE Aggregrate Max Bit Rate Uplik function.
uint64_t GetUeAggregateMaxBitRateUplink() const
Get UE Aggregrate Max Bit Rate Uplik function.
uint16_t GetTargetCellId() const
Get target cell id function.
void SetBearers(std::vector< EpcX2Sap::ErabToBeSetupItem > bearers)
Set bearers function.
uint64_t GetUeAggregateMaxBitRateDownlink() const
Get UE Aggregate Max Bit Rate Downlink function.
void SetUeAggregateMaxBitRateDownlink(uint64_t bitRate)
Set UE Aggregrate Max Bit Rate Downlink function.
void SetOldEnbUeX2apId(uint16_t x2apId)
Set old ENB X2 AP ID function.
uint32_t GetNumberOfIes() const
Get number of IEs.
uint16_t GetOldEnbUeX2apId() const
Get old ENB X2 AP ID function.
uint32_t GetLengthOfIes() const
Get length of IEs.
std::vector< EpcX2Sap::ErabToBeSetupItem > GetBearers() const
Get bearers function.
This entity is installed inside an eNB and provides the functionality for the X2 interface.
std::map< uint16_t, Ptr< X2IfaceInfo > > m_x2InterfaceSockets
Map the targetCellId to the corresponding (sourceSocket, remoteIpAddr) to be used to send the X2 mess...
EpcX2SapUser * m_x2SapUser
X2 SAP user.
virtual void DoSendHandoverRequestAck(EpcX2SapProvider::HandoverRequestAckParams params)
Send handover request ack function.
EpcX2SapProvider * m_x2SapProvider
X2 SAP provider.
virtual void DoSendUeContextRelease(EpcX2SapProvider::UeContextReleaseParams params)
Send UE context release function.
virtual ~EpcX2(void)
Destructor.
void AddX2Interface(uint16_t enb1CellId, Ipv4Address enb1X2Address, std::vector< uint16_t > enb2CellIds, Ipv4Address enb2X2Address)
Add an X2 interface to this EPC X2 entity.
static TypeId GetTypeId(void)
Get the type ID.
virtual void DoSendResourceStatusUpdate(EpcX2SapProvider::ResourceStatusUpdateParams params)
Send resource status update function.
friend class EpcX2SpecificEpcX2SapProvider< EpcX2 >
allow EpcX2SpecificEpcX2SapProvider<EpcX2> class friend access
virtual void DoSendHandoverPreparationFailure(EpcX2SapProvider::HandoverPreparationFailureParams params)
Send handover preparation failure function.
void RecvFromX2cSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the X2-C (X2 Control Plane) socket.
virtual void DoSendHandoverRequest(EpcX2SapProvider::HandoverRequestParams params)
Send handover request function.
virtual void DoSendUeData(EpcX2SapProvider::UeDataParams params)
Send UE data function.
EpcX2SapProvider * GetEpcX2SapProvider()
uint16_t m_x2uUdpPort
UDP ports to be used for the X2-U interface.
uint16_t m_x2cUdpPort
UDP ports to be used for the X2-C interface.
virtual void DoSendLoadInformation(EpcX2SapProvider::LoadInformationParams params)
Send load information function.
std::map< Ptr< Socket >, Ptr< X2CellInfo > > m_x2InterfaceCellIds
Map the localSocket (the one receiving the X2 message) to the corresponding (sourceCellId,...
virtual void DoDispose(void)
Destructor implementation.
virtual void DoSendSnStatusTransfer(EpcX2SapProvider::SnStatusTransferParams params)
Send SN status transfer function.
void SetEpcX2SapUser(EpcX2SapUser *s)
void RecvFromX2uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the X2-U (X2 User Plane) socket.
These service primitives of this part of the X2 SAP are provided by the X2 entity and issued by RRC e...
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
Receive UE data function.
virtual void RecvUeContextRelease(UeContextReleaseParams params)=0
Receive UE context release function.
virtual void RecvSnStatusTransfer(SnStatusTransferParams params)=0
Receive SN status transfer function.
virtual void RecvLoadInformation(LoadInformationParams params)=0
Receive load information function.
virtual void RecvHandoverRequestAck(HandoverRequestAckParams params)=0
Receive handover request ack function.
virtual void RecvResourceStatusUpdate(ResourceStatusUpdateParams params)=0
Receive resource status update function.
virtual void RecvHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
Receive handover preparation failure function.
virtual void RecvHandoverRequest(HandoverRequestParams params)=0
Receive handover request function.
Ipv4 addresses are stored in host order in this class.
A base class which provides memory management and object aggregation.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
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...
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
a unique identifier for an interface.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual ~X2CellInfo(void)
X2CellInfo & operator=(const X2CellInfo &value)
Assignment operator.
std::vector< uint16_t > m_remoteCellIds
remote cell IDs
X2CellInfo(std::vector< uint16_t > localCellIds, std::vector< uint16_t > remoteCellIds)
Constructor.
std::vector< uint16_t > m_localCellIds
local cell IDs
Ptr< Socket > m_localCtrlPlaneSocket
local control plane socket
Ipv4Address m_remoteIpAddr
remote IP address
X2IfaceInfo & operator=(const X2IfaceInfo &value)
Assignment operator.
virtual ~X2IfaceInfo(void)
X2IfaceInfo(Ipv4Address remoteIpAddr, Ptr< Socket > localCtrlPlaneSocket, Ptr< Socket > localUserPlaneSocket)
Constructor.
Ptr< Socket > m_localUserPlaneSocket
local user plane socket
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Parameters of the HANDOVER PREPARATION FAILURE message.
uint16_t criticalityDiagnostics
criticality diagnostics
uint16_t targetCellId
target cell ID
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
uint16_t sourceCellId
source cell ID
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
std::vector< ErabNotAdmittedItem > notAdmittedBearers
not admitted bearers
std::vector< ErabAdmittedItem > admittedBearers
admitted bearers
uint16_t sourceCellId
source cell ID
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
uint16_t targetCellId
target cell ID
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Ptr< Packet > rrcContext
RRC context.
Parameters of the HANDOVER REQUEST message.
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
uint64_t ueAggregateMaxBitRateDownlink
UE aggregrate max bit rate downlink.
uint16_t sourceCellId
source cell ID
uint64_t ueAggregateMaxBitRateUplink
UE aggregrate max bit rate uplink.
uint16_t targetCellId
target cell ID
Ptr< Packet > rrcContext
RRC context.
uint32_t mmeUeS1apId
MME UE S1 AP ID.
std::vector< ErabToBeSetupItem > bearers
bearers
Parameters of the RESOURCE STATUS UPDATE message.
uint16_t enb2MeasurementId
ENB2 measurement ID.
uint16_t enb1MeasurementId
ENB1 measurement ID.
std::vector< CellMeasurementResultItem > cellMeasurementResultList
cell measurement result list
uint16_t targetCellId
target cell ID
Parameters of the SN STATUS TRANSFER message.
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
ERABs subject to status transfer list.
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
uint16_t targetCellId
target cell ID
uint16_t sourceCellId
source cell ID
Parameters of the UE CONTEXT RELEASE message.
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
uint16_t sourceCellId
source cell ID
Parameters of the UE DATA primitive.
Ptr< Packet > ueData
UE data.
uint16_t sourceCellId
source cell ID
uint32_t gtpTeid
GTP TEID.
uint16_t targetCellId
target cell ID