9#include "ns3/boolean.h"
10#include "ns3/double.h"
13#include "ns3/lte-rrc-header.h"
14#include "ns3/lte-rrc-sap.h"
15#include "ns3/packet.h"
17#include "ns3/string.h"
42 std::vector<uint8_t> buffer(pkt->GetSize());
43 std::ostringstream oss(std::ostringstream::out);
44 pkt->CopyData(buffer.data(), buffer.size());
47 oss << std::setfill(
'0') << std::setw(2) << std::hex << +b <<
" ";
49 return std::string(oss.str() +
"\n");
59 std::vector<uint8_t> buffer(pkt->GetSize());
60 std::ostringstream oss(std::ostringstream::out);
61 pkt->CopyData(buffer.data(), buffer.size());
64 oss << (std::bitset<8>(b));
66 return std::string(oss.str() +
"\n");
75 NS_LOG_DEBUG(
"---- SERIALIZED PACKET CONTENTS (HEX): -------");
88 NS_LOG_DEBUG(
"--------- " << s.data() <<
" INFO: -------");
89 std::ostringstream oss(std::ostringstream::out);
195 "SrbToAddModList different sizes");
197 std::list<LteRrcSap::SrbToAddMod> srcSrbToAddModList = rrcd1.
srbToAddModList;
198 auto it1 = srcSrbToAddModList.begin();
199 std::list<LteRrcSap::SrbToAddMod> dstSrbToAddModList = rrcd2.
srbToAddModList;
200 auto it2 = dstSrbToAddModList.begin();
202 for (; it1 != srcSrbToAddModList.end(); it1++, it2++)
206 it2->logicalChannelConfig.priority,
207 "logicalChannelConfig.priority");
209 it2->logicalChannelConfig.prioritizedBitRateKbps,
210 "logicalChannelConfig.prioritizedBitRateKbps");
212 it2->logicalChannelConfig.bucketSizeDurationMs,
213 "logicalChannelConfig.bucketSizeDurationMs");
215 it2->logicalChannelConfig.logicalChannelGroup,
216 "logicalChannelConfig.logicalChannelGroup");
221 "DrbToAddModList different sizes");
223 std::list<LteRrcSap::DrbToAddMod> srcDrbToAddModList = rrcd1.
drbToAddModList;
224 auto it3 = srcDrbToAddModList.begin();
225 std::list<LteRrcSap::DrbToAddMod> dstDrbToAddModList = rrcd2.
drbToAddModList;
226 auto it4 = dstDrbToAddModList.begin();
228 for (; it3 != srcDrbToAddModList.end(); it3++, it4++)
234 it4->logicalChannelIdentity,
235 "logicalChannelIdentity");
239 it4->logicalChannelConfig.priority,
240 "logicalChannelConfig.priority");
242 it4->logicalChannelConfig.prioritizedBitRateKbps,
243 "logicalChannelConfig.prioritizedBitRateKbps");
245 it4->logicalChannelConfig.bucketSizeDurationMs,
246 "logicalChannelConfig.bucketSizeDurationMs");
248 it4->logicalChannelConfig.logicalChannelGroup,
249 "logicalChannelConfig.logicalChannelGroup");
254 "DrbToReleaseList different sizes");
258 auto it5 = srcDrbToReleaseList.begin();
259 auto it6 = dstDrbToReleaseList.begin();
261 for (; it5 != srcDrbToReleaseList.end(); it5++, it6++)
268 "HavePhysicalConfigDedicated");
274 "haveSoundingRsUlConfigDedicated");
278 "soundingRsUlConfigDedicated.type");
282 "soundingRsUlConfigDedicated.srsBandwidth");
287 "soundingRsUlConfigDedicated.srsConfigIndex");
291 "haveAntennaInfoDedicated");
297 "antennaInfo.transmissionMode");
302 "havePdschConfigDedicated");
308 "pdschConfigDedicated.pa");
322 void DoRun()
override;
334 NS_LOG_DEBUG(
"============= RrcConnectionRequestTestCase ===========");
374 void DoRun()
override;
386 NS_LOG_DEBUG(
"============= RrcConnectionSetupTestCase ===========");
414 "RrcTransactionIdentifier");
431 void DoRun()
override;
443 NS_LOG_DEBUG(
"============= RrcConnectionSetupCompleteTestCase ===========");
470 "RrcTransactionIdentifier");
484 void DoRun()
override;
496 NS_LOG_DEBUG(
"============= RrcConnectionReconfigurationCompleteTestCase ===========");
524 "RrcTransactionIdentifier");
538 void DoRun()
override;
550 NS_LOG_DEBUG(
"============= RrcConnectionReconfigurationTestCase ===========");
555 msg.haveMeasConfig =
true;
557 msg.measConfig.haveQuantityConfig =
true;
558 msg.measConfig.quantityConfig.filterCoefficientRSRP = 8;
559 msg.measConfig.quantityConfig.filterCoefficientRSRQ = 7;
561 msg.measConfig.haveMeasGapConfig =
true;
564 msg.measConfig.measGapConfig.gapOffsetValue = 21;
566 msg.measConfig.haveSmeasure =
true;
567 msg.measConfig.sMeasure = 57;
569 msg.measConfig.haveSpeedStatePars =
true;
571 msg.measConfig.speedStatePars.mobilityStateParameters.tEvaluation = 240;
572 msg.measConfig.speedStatePars.mobilityStateParameters.tHystNormal = 60;
573 msg.measConfig.speedStatePars.mobilityStateParameters.nCellChangeMedium = 5;
574 msg.measConfig.speedStatePars.mobilityStateParameters.nCellChangeHigh = 13;
575 msg.measConfig.speedStatePars.timeToTriggerSf.sfMedium = 25;
576 msg.measConfig.speedStatePars.timeToTriggerSf.sfHigh = 75;
578 msg.measConfig.measObjectToRemoveList.push_back(23);
579 msg.measConfig.measObjectToRemoveList.push_back(13);
581 msg.measConfig.reportConfigToRemoveList.push_back(7);
582 msg.measConfig.reportConfigToRemoveList.push_back(16);
584 msg.measConfig.measIdToRemoveList.push_back(4);
585 msg.measConfig.measIdToRemoveList.push_back(18);
611 msg.measConfig.measObjectToAddModList.push_back(measObjectToAddMod);
636 msg.measConfig.reportConfigToAddModList.push_back(reportConfigToAddMod);
641 measIdToAddMod.
measId = 7;
644 measIdToAddMod2.
measId = 4;
647 msg.measConfig.measIdToAddModList.push_back(measIdToAddMod);
648 msg.measConfig.measIdToAddModList.push_back(measIdToAddMod2);
650 msg.haveMobilityControlInfo =
true;
651 msg.mobilityControlInfo.targetPhysCellId = 4;
652 msg.mobilityControlInfo.haveCarrierFreq =
true;
653 msg.mobilityControlInfo.carrierFreq.dlCarrierFreq = 3;
654 msg.mobilityControlInfo.carrierFreq.ulCarrierFreq = 5;
655 msg.mobilityControlInfo.haveCarrierBandwidth =
true;
656 msg.mobilityControlInfo.carrierBandwidth.dlBandwidth = 50;
657 msg.mobilityControlInfo.carrierBandwidth.ulBandwidth = 25;
658 msg.mobilityControlInfo.newUeIdentity = 11;
659 msg.mobilityControlInfo.haveRachConfigDedicated =
true;
660 msg.mobilityControlInfo.rachConfigDedicated.raPreambleIndex = 2;
661 msg.mobilityControlInfo.rachConfigDedicated.raPrachMaskIndex = 2;
662 msg.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.preambleInfo
663 .numberOfRaPreambles = 4;
664 msg.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo
665 .preambleTransMax = 3;
666 msg.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo
667 .raResponseWindowSize = 6;
669 msg.haveRadioResourceConfigDedicated =
true;
673 msg.haveNonCriticalExtension =
false;
696 "RrcTransactionIdentifier");
699 "GetHaveMeasConfig");
702 "GetHaveMobilityControlInfo");
705 "GetHaveRadioResourceConfigDedicated");
711 "GetMobilityControlInfo().targetPhysCellId");
714 "GetMobilityControlInfo().haveCarrierFreq");
717 "GetMobilityControlInfo().haveCarrierBandwidth");
720 "GetMobilityControlInfo().newUeIdentity");
723 "GetMobilityControlInfo().haveRachConfigDedicated");
729 "GetMobilityControlInfo().carrierFreq.dlCarrierFreq");
732 "GetMobilityControlInfo().carrierFreq.ulCarrierFreq");
739 "GetMobilityControlInfo().carrierBandwidth.dlBandwidth");
742 "GetMobilityControlInfo().carrierBandwidth.ulBandwidth");
750 "GetMobilityControlInfo().rachConfigDedicated.raPreambleIndex");
754 "GetMobilityControlInfo().rachConfigDedicated.raPrachMaskIndex");
776 void DoRun()
override;
788 NS_LOG_DEBUG(
"============= HandoverPreparationInfoTestCase ===========");
847 "systemFrameNumber");
871 "sourceDlCarrierFreq");
885 void DoRun()
override;
897 NS_LOG_DEBUG(
"============= RrcConnectionReestablishmentRequestTestCase ===========");
930 "ReestablishmentCause");
944 void DoRun()
override;
956 NS_LOG_DEBUG(
"============= RrcConnectionReestablishmentTestCase ===========");
984 "rrcTransactionIdentifier");
1000 void DoRun()
override;
1012 NS_LOG_DEBUG(
"============= RrcConnectionReestablishmentCompleteTestCase ===========");
1040 "rrcTransactionIdentifier");
1054 void DoRun()
override;
1066 NS_LOG_DEBUG(
"============= RrcConnectionRejectTestCase ===========");
1093 "Different waitTime!");
1107 void DoRun()
override;
1119 NS_LOG_DEBUG(
"============= MeasurementReportTestCase ===========");
1167 "Different rsrpResult!");
1170 "Different rsrqResult!");
1173 "Different haveMeasResultNeighCells!");
1184 if (itsrc->haveCgiInfo)
1187 itdst->cgiInfo.plmnIdentity,
1188 "Different cgiInfo.plmnIdentity!");
1190 itdst->cgiInfo.cellIdentity,
1191 "Different cgiInfo.cellIdentity!");
1193 itdst->cgiInfo.trackingAreaCode,
1194 "Different cgiInfo.trackingAreaCode!");
1196 itdst->cgiInfo.plmnIdentityList.size(),
1197 "Different cgiInfo.plmnIdentityList.size()!");
1199 if (!itsrc->cgiInfo.plmnIdentityList.empty())
1201 auto itsrc2 = itsrc->cgiInfo.plmnIdentityList.begin();
1202 auto itdst2 = itdst->cgiInfo.plmnIdentityList.begin();
1203 for (; itsrc2 != itsrc->cgiInfo.plmnIdentityList.begin(); itsrc2++, itdst2++)
1211 itdst->haveRsrpResult,
1212 "Different haveRsrpResult!");
1213 if (itsrc->haveRsrpResult)
1217 "Different rsrpResult!");
1221 itdst->haveRsrqResult,
1222 "Different haveRsrqResult!");
1223 if (itsrc->haveRsrqResult)
1227 "Different rsrqResult!");
Handover Preparation Info Test Case.
HandoverPreparationInfoTestCase()
void DoRun() override
Implementation to actually run this TestCase.
Measurement Report Test Case.
void DoRun() override
Implementation to actually run this TestCase.
MeasurementReportTestCase()
Rrc Connection Reconfiguration Complete Test Case.
void DoRun() override
Implementation to actually run this TestCase.
RrcConnectionReconfigurationCompleteTestCase()
Rrc Connection Reconfiguration Test Case.
RrcConnectionReconfigurationTestCase()
void DoRun() override
Implementation to actually run this TestCase.
Rrc Connection Reestablishment Complete Test Case.
void DoRun() override
Implementation to actually run this TestCase.
RrcConnectionReestablishmentCompleteTestCase()
Rrc Connection Reestablishment Request Test Case.
void DoRun() override
Implementation to actually run this TestCase.
RrcConnectionReestablishmentRequestTestCase()
Rrc Connection Reestablishment Test Case.
RrcConnectionReestablishmentTestCase()
void DoRun() override
Implementation to actually run this TestCase.
Rrc Connection Reject Test Case.
void DoRun() override
Implementation to actually run this TestCase.
RrcConnectionRejectTestCase()
Rrc Connection Request Test Case.
void DoRun() override
Implementation to actually run this TestCase.
RrcConnectionRequestTestCase()
Rrc Connection Setup Complete Test Case.
void DoRun() override
Implementation to actually run this TestCase.
RrcConnectionSetupCompleteTestCase()
Rrc Connection Setup Test Case.
void DoRun() override
Implementation to actually run this TestCase.
RrcConnectionSetupTestCase()
static void LogPacketContents(Ptr< Packet > pkt)
Function to log packet contents.
static void LogPacketInfo(T source, std::string s)
Function to log packet info.
static std::string sprintPacketContentsHex(Ptr< Packet > pkt)
Function to convert packet contents in hex format.
static std::string sprintPacketContentsBin(Ptr< Packet > pkt)
Function to convert packet contents in binary format.
This class manages the serialization/deserialization of HandoverPreparationInfo IE.
void SetMessage(LteRrcSap::HandoverPreparationInfo msg)
Receives a HandoverPreparationInfo IE and stores the contents into the class attributes.
LteRrcSap::AsConfig GetAsConfig() const
Getter for m_asConfig.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Asn1EncodingSuite g_asn1EncodingSuite
Static variable for test initialization.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t transmissionMode
transmission mode
RadioResourceConfigDedicated sourceRadioResourceConfig
source radio resource config
MasterInformationBlock sourceMasterInformationBlock
source master information block
uint16_t sourceUeIdentity
source UE identity
MeasConfig sourceMeasConfig
source measure config
uint32_t sourceDlCarrierFreq
source DL carrier frequency
SystemInformationBlockType1 sourceSystemInformationBlockType1
source system information block type 1
SystemInformationBlockType2 sourceSystemInformationBlockType2
source system information block type 2
BlackCellsToAddMod structure.
uint8_t cellIndex
cell index
PhysCellIdRange physCellIdRange
Phy cell ID range.
uint16_t dlBandwidth
DL bandwidth.
uint16_t ulBandwidth
UL bandwidth.
uint32_t dlCarrierFreq
DL carrier frequency.
uint32_t ulCarrierFreq
UL carrier frequency.
int8_t cellIndividualOffset
cell individual offset
uint8_t cellIndex
cell index
uint16_t physCellId
Phy cell ID.
uint32_t cellIdentity
cell identity
uint32_t plmnIdentity
PLMN identity.
uint16_t trackingAreaCode
tracking area code
uint8_t epsBearerIdentity
EPS bearer identity.
RlcConfig rlcConfig
RLC config.
uint8_t logicalChannelIdentity
logical channel identify
uint8_t drbIdentity
DRB identity.
LogicalChannelConfig logicalChannelConfig
logical channel config
uint32_t ulCarrierFreq
UL carrier frequency.
uint16_t ulBandwidth
UL bandwidth.
HandoverPreparationInfo structure.
AsConfig asConfig
AS config.
LogicalChannelConfig structure.
uint16_t bucketSizeDurationMs
bucket size duration ms
uint16_t prioritizedBitRateKbps
prioritized bit rate Kbps
uint8_t logicalChannelGroup
logical channel group
bool haveMeasGapConfig
have measure gap config?
bool haveSmeasure
have S measure?
bool haveSpeedStatePars
have speed state parameters?
bool haveQuantityConfig
have quantity config?
MeasIdToAddMod structure.
uint8_t measObjectId
measure object ID
uint8_t reportConfigId
report config ID
std::list< uint8_t > cellsToRemoveList
cells to remove list
bool haveCellForWhichToReportCGI
have cell for which to report CGI?
std::list< CellsToAddMod > cellsToAddModList
cells to add mod list
uint16_t allowedMeasBandwidth
allowed measure bandwidth
int8_t offsetFreq
offset frequency
uint8_t neighCellConfig
neighbor cell config
uint16_t cellForWhichToReportCGI
cell for which to report CGI
bool presenceAntennaPort1
antenna port 1 present?
std::list< uint8_t > blackCellsToRemoveList
black cells to remove list
std::list< BlackCellsToAddMod > blackCellsToAddModList
black cells to add mod list
uint32_t carrierFreq
carrier frequency
MeasObjectToAddMod structure.
uint8_t measObjectId
measure object ID
MeasObjectEutra measObjectEutra
measure object eutra
MeasResultEutra structure.
uint8_t rsrqResult
RSRQ result.
uint8_t rsrpResult
RSRP result.
bool haveRsrpResult
have RSRP result
bool haveRsrqResult
have RSRQ result?
uint16_t physCellId
Phy cell ID.
bool haveCgiInfo
have CGI info?
uint8_t rsrqResult
the RSRQ result
uint8_t rsrpResult
the RSRP result
bool haveMeasResultNeighCells
have measure result neighbor cells
std::list< MeasResultEutra > measResultListEutra
measure result list eutra
bool haveMeasResultServFreqList
has measResultServFreqList-r10
MeasResultPCell measResultPCell
measurement result primary cell
MeasurementReport structure.
MeasResults measResults
measure results
RachConfigDedicated rachConfigDedicated
RACH config dedicated.
bool haveRachConfigDedicated
Have RACH config dedicated?
uint16_t newUeIdentity
new UE identity
bool haveCarrierBandwidth
have carrier bandwidth?
bool haveCarrierFreq
have carrier frequency?
CarrierBandwidthEutra carrierBandwidth
carrier bandwidth
CarrierFreqEutra carrierFreq
carrier frequency
uint16_t targetPhysCellId
target Phy cell ID
bool haveRange
has a range?
uint16_t start
starting cell ID
PhysicalConfigDedicated structure.
PdschConfigDedicated pdschConfigDedicated
PDSCH config dedicated.
bool haveAntennaInfoDedicated
have antenna info dedicated?
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
sounding RS UL config dedicated
bool haveSoundingRsUlConfigDedicated
have sounding RS UL config dedicated?
bool havePdschConfigDedicated
have PDSCH config dedicated?
AntennaInfoDedicated antennaInfo
antenna info
uint32_t plmnIdentity
PLMN identity.
uint8_t numberOfRaPreambles
number of RA preambles
uint8_t raResponseWindowSize
RA response window size.
uint8_t preambleTransMax
preamble transmit maximum
PreambleInfo preambleInfo
preamble info
RaSupervisionInfo raSupervisionInfo
RA supervision info.
uint8_t raPreambleIndex
RA preamble index.
uint8_t raPrachMaskIndex
RA PRACH mask index.
RachConfigCommon rachConfigCommon
RACH config common.
RadioResourceConfigDedicated structure.
PhysicalConfigDedicated physicalConfigDedicated
physical config dedicated
std::list< uint8_t > drbToReleaseList
DRB to release list.
bool havePhysicalConfigDedicated
have physical config dedicated?
std::list< DrbToAddMod > drbToAddModList
DRB to add mod list.
std::list< SrbToAddMod > srbToAddModList
SRB to add mod list.
uint16_t physCellId
Phy cell ID.
bool reportOnLeave
Indicates whether or not the UE shall initiate the measurement reporting procedure when the leaving c...
uint8_t maxReportCells
Maximum number of cells, excluding the serving cell, to be included in the measurement report.
enum ns3::LteRrcSap::ReportConfigEutra::@62 eventId
Event enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@61 triggerType
Trigger enumeration.
uint8_t hysteresis
Parameter used within the entry and leave condition of an event triggered reporting condition.
@ RSRQ
Reference Signal Received Quality.
@ EVENT_A2
Event A2: Serving becomes worse than absolute threshold.
uint8_t reportAmount
Number of measurement reports applicable, always assumed to be infinite.
enum ns3::LteRrcSap::ReportConfigEutra::@65 reportInterval
Report interval enumeration.
ThresholdEutra threshold2
Threshold for event A5.
enum ns3::LteRrcSap::ReportConfigEutra::@63 triggerQuantity
Trigger type enumeration.
@ SAME_AS_TRIGGER_QUANTITY
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
enum ns3::LteRrcSap::ReportConfigEutra::@64 reportQuantity
Report type enumeration.
int8_t a3Offset
Offset value for Event A3.
uint16_t timeToTrigger
Time during which specific criteria for the event needs to be met in order to trigger a measurement r...
ReportConfigToAddMod structure.
uint8_t reportConfigId
report config ID
ReportConfigEutra reportConfigEutra
report config eutra
Direction choice
direction choice
RrcConnectionReconfigurationCompleted structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionReconfiguration structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionReestablishmentComplete structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionReestablishment structure.
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionReestablishmentRequest structure.
ReestablishmentCause reestablishmentCause
reestablishment cause
ReestabUeIdentity ueIdentity
UE identity.
RrcConnectionReject structure.
uint8_t waitTime
wait time
RrcConnectionRequest structure.
uint64_t ueIdentity
UE identity.
RrcConnectionSetupCompleted structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionSetup structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
uint16_t srsConfigIndex
SRS config index.
uint16_t srsBandwidth
SRS bandwidth.
LogicalChannelConfig logicalChannelConfig
logical channel config
uint8_t srbIdentity
SB identity.
@ THRESHOLD_RSRP
RSRP is used for the threshold.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
enum ns3::LteRrcSap::ThresholdEutra::@60 choice
Threshold enumeration.
uint8_t range
Value range used in RSRP/RSRQ threshold.