25 #include "ns3/inet-socket-address.h"
28 #include "ns3/packet.h"
63 : m_localCellIds{localCellIds},
64 m_remoteCellIds{remoteCellIds}
133 std::vector<uint16_t> remoteCellIds,
136 uint16_t remoteCellId = remoteCellIds.at(0);
137 NS_LOG_FUNCTION(
this << localCellId << localX2Address << remoteCellId << remoteX2Address);
158 std::vector<uint16_t> localCellIds;
159 localCellIds.push_back(localCellId);
162 "Mapping for remoteCellId = " << remoteCellId <<
" is already known");
163 for (uint16_t remoteCellId : remoteCellIds)
166 Create<X2IfaceInfo>(remoteX2Address, localX2cSocket, localX2uSocket);
170 "Mapping for control plane localSocket = " << localX2cSocket
171 <<
" is already known");
175 "Mapping for data plane localSocket = " << localX2uSocket <<
" is already known");
189 "Missing infos of local and remote CellId");
209 NS_LOG_INFO(
"X2 HandoverRequest header: " << x2HoReqHeader);
214 params.sourceCellId = cellsInfo->m_remoteCellIds.at(0);
220 params.rrcContext = packet;
226 NS_LOG_LOGIC(
"cellsInfo->m_localCellId = " << cellsInfo->m_localCellIds.at(0));
237 NS_LOG_INFO(
"X2 HandoverRequestAck header: " << x2HoReqAckHeader);
242 params.sourceCellId = cellsInfo->m_localCellIds.at(0);
243 params.targetCellId = cellsInfo->m_remoteCellIds.at(0);
246 params.rrcContext = packet;
257 NS_LOG_LOGIC(
"Recv X2 message: HANDOVER PREPARATION FAILURE");
262 NS_LOG_INFO(
"X2 HandoverPreparationFailure header: " << x2HoPrepFailHeader);
266 params.sourceCellId = cellsInfo->m_localCellIds.at(0);
267 params.targetCellId = cellsInfo->m_remoteCellIds.at(0);
289 NS_LOG_INFO(
"X2 LoadInformation header: " << x2LoadInfoHeader);
308 NS_LOG_INFO(
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
313 params.sourceCellId = cellsInfo->m_remoteCellIds.at(0);
314 params.targetCellId = cellsInfo->m_localCellIds.at(0);
315 params.erabsSubjectToStatusTransferList =
336 NS_LOG_INFO(
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
352 NS_LOG_LOGIC(
"Recv X2 message: RESOURCE STATUS UPDATE");
357 NS_LOG_INFO(
"X2 ResourceStatusUpdate header: " << x2ResStatUpdHeader);
368 "cellMeasurementResultList size = " <<
params.cellMeasurementResultList.size());
382 NS_LOG_INFO(
"X2 HandoverCancel header: " << x2HoCancelHeader);
387 params.sourceCellId = cellsInfo->m_localCellIds.at(0);
388 params.targetCellId = cellsInfo->m_remoteCellIds.at(0);
411 NS_LOG_LOGIC(
"Recv UE DATA through X2-U interface from Socket");
416 "Missing infos of local and remote CellId");
425 params.sourceCellId = cellsInfo->m_remoteCellIds.at(0);
426 params.targetCellId = cellsInfo->m_localCellIds.at(0);
447 "Missing infos for targetCellId = " <<
params.targetCellId);
449 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
450 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
474 NS_LOG_INFO(
"X2 HandoverRequest header: " << x2HoReqHeader);
497 "Socket infos not defined for sourceCellId = " <<
params.sourceCellId);
505 NS_LOG_INFO(
"Send X2 message: HANDOVER REQUEST ACK");
521 NS_LOG_INFO(
"X2 HandoverAck header: " << x2HoAckHeader);
546 "Socket infos not defined for sourceCellId = " <<
params.sourceCellId);
554 NS_LOG_INFO(
"Send X2 message: HANDOVER PREPARATION FAILURE");
569 NS_LOG_INFO(
"X2 HandoverPrepFail header: " << x2HoPrepFailHeader);
593 "Socket infos not defined for targetCellId = " <<
params.targetCellId);
601 NS_LOG_INFO(
"Send X2 message: SN STATUS TRANSFER");
608 params.erabsSubjectToStatusTransferList);
617 NS_LOG_INFO(
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
639 "Socket infos not defined for sourceCellId = " <<
params.sourceCellId);
647 NS_LOG_INFO(
"Send X2 message: UE CONTEXT RELEASE");
661 NS_LOG_INFO(
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
682 "Missing infos for targetCellId = " <<
params.targetCellId);
684 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
685 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
703 NS_LOG_INFO(
"X2 LoadInformation header: " << x2LoadInfoHeader);
723 NS_LOG_LOGIC(
"cellMeasurementResultList size = " <<
params.cellMeasurementResultList.size());
726 "Missing infos for targetCellId = " <<
params.targetCellId);
728 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
729 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
734 NS_LOG_INFO(
"Send X2 message: RESOURCE STATUS UPDATE");
749 NS_LOG_INFO(
"X2 ResourceStatusUpdate header: " << x2ResourceStatUpdHeader);
753 packet->
AddHeader(x2ResourceStatUpdHeader);
771 "Missing infos for targetCellId = " <<
params.targetCellId);
773 Ptr<Socket> sourceSocket = socketInfo->m_localUserPlaneSocket;
774 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
788 NS_LOG_INFO(
"Forward UE DATA through X2 interface");
803 "Socket infos not defined for targetCellId = " <<
params.targetCellId);
826 NS_LOG_INFO(
"X2 UeContextRelease header: " << x2HandoverCancelHeader);
830 packet->
AddHeader(x2HandoverCancelHeader);
EpcX2HandoverCancelHeader.
uint16_t GetNewEnbUeX2apId() const
Get new ENB UE X2 AP ID function.
void SetOldEnbUeX2apId(uint16_t x2apId)
Set old ENB UE X2 AP ID function.
uint32_t GetLengthOfIes() const
Get length of IEs function.
uint16_t GetOldEnbUeX2apId() const
Get old ENB UE X2 AP ID function.
void SetCause(uint16_t cause)
Set cause function.
uint16_t GetCause() const
Get cause function.
uint32_t GetNumberOfIes() const
Get number of IEs function.
void SetNewEnbUeX2apId(uint16_t x2apId)
Set new ENB UE X2 AP ID function.
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 Aggregate Max Bit Rate Uplik function.
uint64_t GetUeAggregateMaxBitRateUplink() const
Get UE Aggregate 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 Aggregate 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.
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.
void DoDispose() override
Destructor implementation.
void AddX2Interface(uint16_t enb1CellId, Ipv4Address enb1X2Address, std::vector< uint16_t > enb2CellIds, Ipv4Address enb2X2Address)
Add an X2 interface to this EPC X2 entity.
std::map< uint16_t, Ptr< X2IfaceInfo > > m_x2InterfaceSockets
Map the targetCellId to the corresponding (sourceSocket, remoteIpAddr) to be used to send the X2 mess...
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.
~EpcX2() override
Destructor.
virtual void DoSendHandoverRequest(EpcX2SapProvider::HandoverRequestParams params)
Send handover request function.
static TypeId GetTypeId()
Get the type ID.
std::map< Ptr< Socket >, Ptr< X2CellInfo > > m_x2InterfaceCellIds
Map the localSocket (the one receiving the X2 message) to the corresponding (sourceCellId,...
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.
virtual void DoSendSnStatusTransfer(EpcX2SapProvider::SnStatusTransferParams params)
Send SN status transfer function.
void SetEpcX2SapUser(EpcX2SapUser *s)
virtual void DoSendHandoverCancel(EpcX2SapProvider::HandoverCancelParams params)
Send Handover Cancel function.
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 RecvHandoverCancel(HandoverCancelParams params)=0
Receive handover cancel 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() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void SetRecvCallback(Callback< void, Ptr< Socket >> receivedData)
Notify application when new data is available to be read.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
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.
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.
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, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
Parameters of the HANDOVER CANCEL message.
Parameters of the HANDOVER PREPARATION FAILURE message.
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
Parameters of the HANDOVER REQUEST message.
Parameters of the RESOURCE STATUS UPDATE message.
Parameters of the SN STATUS TRANSFER message.
Parameters of the UE CONTEXT RELEASE message.
Parameters of the UE DATA primitive.