This commit is contained in:
Manuel Requena
2012-07-20 18:23:47 +02:00
4 changed files with 154 additions and 54 deletions

View File

@@ -23,6 +23,15 @@
namespace ns3 {
EpcX2Sap::~EpcX2Sap ()
{
}
EpcX2Sap::ErabToBeSetupItem::ErabToBeSetupItem () :
erabLevelQosParameters (EpsBearer (EpsBearer::GBR_CONV_VOICE))
{
}
EpcX2SapProvider::~EpcX2SapProvider ()
{
}

View File

@@ -22,43 +22,126 @@
#define EPC_X2_SAP_H
#include "ns3/packet.h"
#include "ns3/eps-bearer.h"
#include "ns3/ipv4-address.h"
namespace ns3 {
class Node;
class Packet;
/**
* The X2 SAP defines the service between the X2 entity and the RRC entity.
*
* The X2 SAP follows the specification 3GPP TS 36.423: "X2 application protocol (X2AP)"
*
* The service primitives corresponds to the X2AP procedures and messages and
* the service parameters corresponds to the Information Elements
*
* Note: Any reference in this file refers to the 3GPP TS 36.423 specification
*/
/**
* \brief Common structures for EpcX2SapProvider and EpcX2SapUser
*/
class EpcX2Sap
{
public:
virtual ~EpcX2Sap ();
/**
* E-RABs to be setup item as
* it is used in the HANDOVER REQUEST message.
* See section 9.1.1.1 for further info about the parameters
*/
struct ErabToBeSetupItem
{
uint16_t erabId;
EpsBearer erabLevelQosParameters;
bool dlForwarding;
Ipv4Address transportLayerAddress;
uint32_t gtpTeid;
ErabToBeSetupItem ();
};
/**
* E-RABs admitted item as
* it is used in the HANDOVER REQUEST ACKNOWLEDGE message.
* See section 9.1.1.2 for further info about the parameters
*/
struct ErabAdmittedItem
{
uint16_t erabId;
uint32_t ulGtpTeid;
uint32_t dlGtpTeid;
};
/**
* E-RABs not admitted item as
* it is used in the HANDOVER REQUEST ACKNOWLEDGE message.
* See section 9.1.1.2 for further info about the parameters
*/
struct ErabNotAdmittedItem
{
uint16_t erabId;
uint16_t cause;
};
enum IdCause
{
HandoverDesirableForRadioReason,
TimeCriticalHandover
};
/**
* \brief Parameters of the HANDOVER REQUEST message.
*
* See section 9.1.1.1 for further info about the parameters
*/
struct HandoverRequestParams
{
uint16_t oldEnbUeX2apId;
uint16_t cause;
uint16_t sourceCellId;
uint16_t targetCellId;
uint64_t ueAggregateMaxBitRateDownlink;
uint64_t ueAggregateMaxBitRateUplink;
std::vector <ErabToBeSetupItem> bearers;
Ptr<Packet> rrcContext;
};
/**
* \brief Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
*
* See section 9.1.1.2 for further info about the parameters
*/
struct HandoverRequestAckParams
{
uint16_t oldEnbUeX2apId;
uint16_t newEnbUeX2apId;
uint16_t sourceCellId;
uint16_t targetCellId;
std::vector <ErabAdmittedItem> admittedBearers;
std::vector <ErabNotAdmittedItem> notAdmittedBearers;
Ptr<Packet> rrcContext;
};
};
class EpcX2SapProvider
/**
* These service primitives of this part of the X2 SAP
* are provided by the X2 entity and issued by RRC entity
*/
class EpcX2SapProvider : public EpcX2Sap
{
public:
virtual ~EpcX2SapProvider ();
/**
* Parameters of the API primitives
*/
struct HandoverRequestParams
{
uint16_t cause;
uint16_t sourceCellId;
uint16_t targetCellId;
std::list<uint32_t> bearers;
Ptr<Packet> rrcContext;
};
struct HandoverRequestAckParams
{
uint16_t cause;
uint16_t sourceCellId;
uint16_t targetCellId;
std::list<uint32_t> bearers;
Ptr<Packet> rrcContext;
};
/**
* SAP primitives
* Service primitives
*/
virtual void SendHandoverRequest (HandoverRequestParams params) = 0;
@@ -72,35 +155,17 @@ public:
};
class EpcX2SapUser
/**
* These service primitives of this part of the X2 SAP
* are provided by the RRC entity and issued by the X2 entity
*/
class EpcX2SapUser : public EpcX2Sap
{
public:
virtual ~EpcX2SapUser ();
/**
* Parameters of the API primitives
*/
struct HandoverRequestParams
{
uint16_t cause;
uint16_t sourceCellId;
uint16_t targetCellId;
std::list<uint32_t> bearers;
Ptr<Packet> rrcContext;
};
struct HandoverRequestAckParams
{
uint16_t cause;
uint16_t sourceCellId;
uint16_t targetCellId;
std::list<uint32_t> bearers;
Ptr<Packet> rrcContext;
};
/**
* SAP primitives
* Service primitives
*/
virtual void RecvHandoverRequest (HandoverRequestParams params) = 0;

View File

@@ -46,8 +46,8 @@ struct GbrQosInformation
struct AllocationRetentionPriority
{
uint8_t priorityLevel; // /< 1-15; 1 = highest
bool preemprionCapability; // /< true if bearer can preempt others
bool preemprionVulnerability; // true if bearer can be preempted by others
bool preemptionCapability; // /< true if bearer can preempt others
bool preemptionVulnerability; // true if bearer can be preempted by others
};
/**

View File

@@ -458,13 +458,25 @@ LteEnbRrc::SendHandoverRequest (Ptr<Node> ueNode, Ptr<Node> sourceEnbNode, Ptr<N
{
NS_LOG_FUNCTION (this << ueNode << sourceEnbNode << targetEnbNode);
NS_LOG_LOGIC ("Request to send HANDOVER REQUEST");
Ptr<LteUeRrc> ueRrc = ueNode->GetDevice (0)->GetObject<LteUeNetDevice> ()->GetRrc ();
uint16_t rnti = ueRrc->GetRnti ();
EpcX2SapProvider::HandoverRequestParams params;
params.sourceCellId = sourceEnbNode->GetDevice (0)->GetObject<LteEnbNetDevice> ()->GetCellId ();
params.targetCellId = targetEnbNode->GetDevice (0)->GetObject<LteEnbNetDevice> ()->GetCellId ();
params.oldEnbUeX2apId = rnti;
params.cause = EpcX2SapProvider::HandoverDesirableForRadioReason;
params.sourceCellId = sourceEnbNode->GetDevice (0)->GetObject<LteEnbNetDevice> ()->GetCellId ();
params.targetCellId = targetEnbNode->GetDevice (0)->GetObject<LteEnbNetDevice> ()->GetCellId ();
params.ueAggregateMaxBitRateDownlink = 200 * 1000;
params.ueAggregateMaxBitRateUplink = 100 * 1000;
std::string rrcData ("abcdefghijklmnopqrstuvwxyz");
params.rrcContext = Create<Packet> ((uint8_t const *) rrcData.data (), rrcData.length ());
NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
NS_LOG_LOGIC ("sourceCellId = " << params.sourceCellId);
NS_LOG_LOGIC ("targetCellId = " << params.targetCellId);
NS_LOG_LOGIC ("rrcContext = " << params.rrcContext << " : " << rrcData);
m_x2SapProvider->SendHandoverRequest (params);
}
@@ -480,15 +492,27 @@ LteEnbRrc::DoRecvHandoverRequest (EpcX2SapUser::HandoverRequestParams params)
NS_LOG_LOGIC ("Recv X2 message: HANDOVER REQUEST");
NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
NS_LOG_LOGIC ("sourceCellId = " << params.sourceCellId);
NS_LOG_LOGIC ("targetCellId = " << params.targetCellId);
uint8_t rrcData [100];
params.rrcContext->CopyData (rrcData, params.rrcContext->GetSize ());
NS_LOG_LOGIC ("rrcContext = " << rrcData);
NS_LOG_LOGIC ("Send X2 message: HANDOVER REQUEST ACK");
EpcX2SapProvider::HandoverRequestAckParams ackParams;
ackParams.oldEnbUeX2apId = params.oldEnbUeX2apId;
ackParams.newEnbUeX2apId = params.oldEnbUeX2apId + 100;
ackParams.sourceCellId = params.sourceCellId;
ackParams.targetCellId = params.targetCellId;
NS_LOG_LOGIC ("oldEnbUeX2apId = " << ackParams.oldEnbUeX2apId);
NS_LOG_LOGIC ("newEnbUeX2apId = " << ackParams.newEnbUeX2apId);
NS_LOG_LOGIC ("sourceCellId = " << ackParams.sourceCellId);
NS_LOG_LOGIC ("targetCellId = " << ackParams.targetCellId);
m_x2SapProvider->SendHandoverRequestAck (ackParams);
}
@@ -499,6 +523,8 @@ LteEnbRrc::DoRecvHandoverRequestAck (EpcX2SapUser::HandoverRequestAckParams para
NS_LOG_LOGIC ("Recv X2 message: HANDOVER REQUEST ACK");
NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
NS_LOG_LOGIC ("newEnbUeX2apId = " << params.newEnbUeX2apId);
NS_LOG_LOGIC ("sourceCellId = " << params.sourceCellId);
NS_LOG_LOGIC ("targetCellId = " << params.targetCellId);
}