22 #include "ns3/string.h"
23 #include "ns3/double.h"
25 #include "ns3/boolean.h"
28 #include "ns3/packet.h"
30 #include "ns3/lte-rrc-header.h"
31 #include "ns3/lte-rrc-sap.h"
41 static std::string sprintPacketContentsHex (
Ptr<Packet> pkt)
43 uint32_t psize = pkt->
GetSize ();
44 uint8_t buffer[psize];
45 char sbuffer[psize * 3];
47 for (uint32_t i = 0; i < psize; i++)
49 sprintf (&sbuffer[i * 3],
"%02x ",buffer[i]);
51 return std::string (sbuffer);
55 static std::string sprintPacketContentsBin (
Ptr<Packet> pkt)
57 uint32_t psize = pkt->
GetSize ();
58 uint8_t buffer[psize];
59 std::ostringstream oss (std::ostringstream::out);
61 for (uint32_t i = 0; i < psize; i++)
63 oss << (std::bitset<8> (buffer[i]));
65 return std::string (oss.str () +
"\n");
71 NS_LOG_DEBUG (
"---- SERIALIZED PACKET CONTENTS (HEX): -------");
72 NS_LOG_DEBUG (
"Hex: " << TestUtils::sprintPacketContentsHex (pkt));
73 NS_LOG_DEBUG (
"Bin: " << TestUtils::sprintPacketContentsBin (pkt));
77 static void LogPacketInfo (T source,std::string s)
79 NS_LOG_DEBUG (
"--------- " << s.data () <<
" INFO: -------");
80 std::ostringstream oss (std::ostringstream::out);
95 virtual void DoRun (
void) = 0;
103 RrcHeaderTestCase :: RrcHeaderTestCase (std::string s) :
TestCase (s)
107 LteRrcSap::RadioResourceConfigDedicated
108 RrcHeaderTestCase :: CreateRadioResourceConfigDedicated ()
110 LteRrcSap::RadioResourceConfigDedicated rrd;
112 rrd.drbToReleaseList = std::list<uint8_t> (4,2);
114 LteRrcSap::SrbToAddMod srbToAddMod;
115 srbToAddMod.srbIdentity = 2;
117 LteRrcSap::LogicalChannelConfig logicalChannelConfig;
118 logicalChannelConfig.priority = 9;
119 logicalChannelConfig.prioritizedBitRateKbps = 128;
120 logicalChannelConfig.bucketSizeDurationMs = 100;
121 logicalChannelConfig.logicalChannelGroup = 3;
122 srbToAddMod.logicalChannelConfig = logicalChannelConfig;
124 rrd.srbToAddModList.insert (rrd.srbToAddModList.begin (),srbToAddMod);
126 LteRrcSap::DrbToAddMod drbToAddMod;
127 drbToAddMod.epsBearerIdentity = 1;
128 drbToAddMod.drbIdentity = 1;
129 drbToAddMod.logicalChannelIdentity = 5;
130 LteRrcSap::RlcConfig rlcConfig;
131 rlcConfig.choice = LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL;
132 drbToAddMod.rlcConfig = rlcConfig;
134 LteRrcSap::LogicalChannelConfig logicalChannelConfig2;
135 logicalChannelConfig2.priority = 7;
136 logicalChannelConfig2.prioritizedBitRateKbps = 256;
137 logicalChannelConfig2.bucketSizeDurationMs = 50;
138 logicalChannelConfig2.logicalChannelGroup = 2;
139 drbToAddMod.logicalChannelConfig = logicalChannelConfig2;
141 rrd.drbToAddModList.insert (rrd.drbToAddModList.begin (),drbToAddMod);
143 rrd.havePhysicalConfigDedicated =
true;
144 LteRrcSap::PhysicalConfigDedicated physicalConfigDedicated;
145 physicalConfigDedicated.haveSoundingRsUlConfigDedicated =
true;
146 physicalConfigDedicated.soundingRsUlConfigDedicated.type = LteRrcSap::SoundingRsUlConfigDedicated::SETUP;
147 physicalConfigDedicated.soundingRsUlConfigDedicated.srsBandwidth = 2;
148 physicalConfigDedicated.soundingRsUlConfigDedicated.srsConfigIndex = 12;
150 physicalConfigDedicated.haveAntennaInfoDedicated =
true;
151 physicalConfigDedicated.antennaInfo.transmissionMode = 2;
153 rrd.physicalConfigDedicated = physicalConfigDedicated;
159 RrcHeaderTestCase :: AssertEqualRadioResourceConfigDedicated (LteRrcSap::RadioResourceConfigDedicated rrcd1, LteRrcSap::RadioResourceConfigDedicated rrcd2)
161 NS_TEST_ASSERT_MSG_EQ (rrcd1.srbToAddModList.size (), rrcd2.srbToAddModList.size (),
"SrbToAddModList different sizes");
163 std::list<LteRrcSap::SrbToAddMod> srcSrbToAddModList = rrcd1.srbToAddModList;
164 std::list<LteRrcSap::SrbToAddMod>::iterator it1 = srcSrbToAddModList.begin ();
165 std::list<LteRrcSap::SrbToAddMod> dstSrbToAddModList = rrcd2.srbToAddModList;
166 std::list<LteRrcSap::SrbToAddMod>::iterator it2 = dstSrbToAddModList.begin ();
168 for (; it1 != srcSrbToAddModList.end (); it1++, it2++)
170 NS_TEST_ASSERT_MSG_EQ (it1->srbIdentity,it2->srbIdentity,
"srbIdentity");
171 NS_TEST_ASSERT_MSG_EQ (it1->logicalChannelConfig.priority,it2->logicalChannelConfig.priority,
"logicalChannelConfig.priority");
172 NS_TEST_ASSERT_MSG_EQ (it1->logicalChannelConfig.prioritizedBitRateKbps,it2->logicalChannelConfig.prioritizedBitRateKbps,
"logicalChannelConfig.prioritizedBitRateKbps");
173 NS_TEST_ASSERT_MSG_EQ (it1->logicalChannelConfig.bucketSizeDurationMs,it2->logicalChannelConfig.bucketSizeDurationMs,
"logicalChannelConfig.bucketSizeDurationMs");
174 NS_TEST_ASSERT_MSG_EQ (it1->logicalChannelConfig.logicalChannelGroup,it2->logicalChannelConfig.logicalChannelGroup,
"logicalChannelConfig.logicalChannelGroup");
177 NS_TEST_ASSERT_MSG_EQ (rrcd1.drbToAddModList.size (), rrcd2.drbToAddModList.size (),
"DrbToAddModList different sizes");
179 std::list<LteRrcSap::DrbToAddMod> srcDrbToAddModList = rrcd1.drbToAddModList;
180 std::list<LteRrcSap::DrbToAddMod>::iterator it3 = srcDrbToAddModList.begin ();
181 std::list<LteRrcSap::DrbToAddMod> dstDrbToAddModList = rrcd2.drbToAddModList;
182 std::list<LteRrcSap::DrbToAddMod>::iterator it4 = dstDrbToAddModList.begin ();
184 for (; it3 != srcDrbToAddModList.end (); it3++, it4++)
186 NS_TEST_ASSERT_MSG_EQ (it3->epsBearerIdentity,it4->epsBearerIdentity,
"epsBearerIdentity");
187 NS_TEST_ASSERT_MSG_EQ (it3->drbIdentity,it4->drbIdentity,
"drbIdentity");
188 NS_TEST_ASSERT_MSG_EQ (it3->rlcConfig.choice,it4->rlcConfig.choice,
"rlcConfig.choice");
189 NS_TEST_ASSERT_MSG_EQ (it3->logicalChannelIdentity,it4->logicalChannelIdentity,
"logicalChannelIdentity");
190 NS_TEST_ASSERT_MSG_EQ (it3->epsBearerIdentity,it4->epsBearerIdentity,
"epsBearerIdentity");
192 NS_TEST_ASSERT_MSG_EQ (it3->logicalChannelConfig.priority,it4->logicalChannelConfig.priority,
"logicalChannelConfig.priority");
193 NS_TEST_ASSERT_MSG_EQ (it3->logicalChannelConfig.prioritizedBitRateKbps,it4->logicalChannelConfig.prioritizedBitRateKbps,
"logicalChannelConfig.prioritizedBitRateKbps");
194 NS_TEST_ASSERT_MSG_EQ (it3->logicalChannelConfig.bucketSizeDurationMs,it4->logicalChannelConfig.bucketSizeDurationMs,
"logicalChannelConfig.bucketSizeDurationMs");
195 NS_TEST_ASSERT_MSG_EQ (it3->logicalChannelConfig.logicalChannelGroup,it4->logicalChannelConfig.logicalChannelGroup,
"logicalChannelConfig.logicalChannelGroup");
198 NS_TEST_ASSERT_MSG_EQ (rrcd1.drbToReleaseList.size (), rrcd2.drbToReleaseList.size (),
"DrbToReleaseList different sizes");
200 std::list<uint8_t> srcDrbToReleaseList = rrcd1.drbToReleaseList;
201 std::list<uint8_t> dstDrbToReleaseList = rrcd2.drbToReleaseList;
202 std::list<uint8_t>::iterator it5 = srcDrbToReleaseList.begin ();
203 std::list<uint8_t>::iterator it6 = dstDrbToReleaseList.begin ();
205 for (; it5 != srcDrbToReleaseList.end (); it5++, it6++)
207 NS_TEST_ASSERT_MSG_EQ (*it5, *it6,
"element != in DrbToReleaseList");
210 NS_TEST_ASSERT_MSG_EQ (rrcd1.havePhysicalConfigDedicated,rrcd2.havePhysicalConfigDedicated,
"HavePhysicalConfigDedicated");
212 if (rrcd1.havePhysicalConfigDedicated)
214 NS_TEST_ASSERT_MSG_EQ (rrcd1.physicalConfigDedicated.haveSoundingRsUlConfigDedicated,
215 rrcd2.physicalConfigDedicated.haveSoundingRsUlConfigDedicated,
216 "haveSoundingRsUlConfigDedicated");
218 NS_TEST_ASSERT_MSG_EQ (rrcd1.physicalConfigDedicated.soundingRsUlConfigDedicated.type,
219 rrcd2.physicalConfigDedicated.soundingRsUlConfigDedicated.type,
220 "soundingRsUlConfigDedicated.type");
221 NS_TEST_ASSERT_MSG_EQ (rrcd1.physicalConfigDedicated.soundingRsUlConfigDedicated.srsBandwidth,
222 rrcd2.physicalConfigDedicated.soundingRsUlConfigDedicated.srsBandwidth,
223 "soundingRsUlConfigDedicated.srsBandwidth");
225 NS_TEST_ASSERT_MSG_EQ (rrcd1.physicalConfigDedicated.soundingRsUlConfigDedicated.srsConfigIndex,
226 rrcd2.physicalConfigDedicated.soundingRsUlConfigDedicated.srsConfigIndex,
227 "soundingRsUlConfigDedicated.srsConfigIndex");
229 NS_TEST_ASSERT_MSG_EQ (rrcd1.physicalConfigDedicated.haveAntennaInfoDedicated,
230 rrcd2.physicalConfigDedicated.haveAntennaInfoDedicated,
231 "haveAntennaInfoDedicated");
233 if (rrcd1.physicalConfigDedicated.haveAntennaInfoDedicated)
235 NS_TEST_ASSERT_MSG_EQ (rrcd1.physicalConfigDedicated.antennaInfo.transmissionMode,
236 rrcd2.physicalConfigDedicated.antennaInfo.transmissionMode,
237 "antennaInfo.transmissionMode");
247 virtual void DoRun (
void);
250 RrcConnectionRequestTestCase::RrcConnectionRequestTestCase () :
RrcHeaderTestCase (
"Testing RrcConnectionRequest")
257 packet = Create<Packet> ();
258 NS_LOG_DEBUG (
"============= RrcConnectionRequestTestCase ===========");
261 msg.ueIdentity = 0x83fecafecaULL;
267 TestUtils::LogPacketInfo<RrcConnectionRequestHeader> (source,
"SOURCE");
273 TestUtils::LogPacketContents (packet);
280 TestUtils::LogPacketInfo<RrcConnectionRequestHeader> (destination,
"DESTINATION");
283 NS_TEST_ASSERT_MSG_EQ (source.GetMmec (),destination.GetMmec (),
"Different m_mmec!");
284 NS_TEST_ASSERT_MSG_EQ (source.GetMtmsi (),destination.GetMtmsi (),
"Different m_mTmsi!");
294 virtual void DoRun (
void);
297 RrcConnectionSetupTestCase::RrcConnectionSetupTestCase () :
RrcHeaderTestCase (
"Testing RrcConnectionSetupTestCase")
304 packet = Create<Packet> ();
305 NS_LOG_DEBUG (
"============= RrcConnectionSetupTestCase ===========");
308 msg.rrcTransactionIdentifier = 3;
309 msg.radioResourceConfigDedicated = CreateRadioResourceConfigDedicated ();
315 TestUtils::LogPacketInfo<RrcConnectionSetupHeader> (source,
"SOURCE");
321 TestUtils::LogPacketContents (packet);
328 TestUtils::LogPacketInfo<RrcConnectionSetupHeader> (destination,
"DESTINATION");
331 NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (),destination.GetRrcTransactionIdentifier (),
"RrcTransactionIdentifier");
333 AssertEqualRadioResourceConfigDedicated (source.GetRadioResourceConfigDedicated (),destination.GetRadioResourceConfigDedicated ());
343 virtual void DoRun (
void);
346 RrcConnectionSetupCompleteTestCase::RrcConnectionSetupCompleteTestCase () :
RrcHeaderTestCase (
"Testing RrcConnectionSetupCompleteTestCase")
353 packet = Create<Packet> ();
354 NS_LOG_DEBUG (
"============= RrcConnectionSetupCompleteTestCase ===========");
357 msg.rrcTransactionIdentifier = 3;
363 TestUtils::LogPacketInfo<RrcConnectionSetupCompleteHeader> (source,
"SOURCE");
369 TestUtils::LogPacketContents (packet);
376 TestUtils::LogPacketInfo<RrcConnectionSetupCompleteHeader> (destination,
"DESTINATION");
379 NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (),destination.GetRrcTransactionIdentifier (),
"RrcTransactionIdentifier");
389 virtual void DoRun (
void);
392 RrcConnectionReconfigurationCompleteTestCase::RrcConnectionReconfigurationCompleteTestCase ()
400 packet = Create<Packet> ();
401 NS_LOG_DEBUG (
"============= RrcConnectionReconfigurationCompleteTestCase ===========");
404 msg.rrcTransactionIdentifier = 2;
410 TestUtils::LogPacketInfo<RrcConnectionReconfigurationCompleteHeader> (source,
"SOURCE");
416 TestUtils::LogPacketContents (packet);
423 TestUtils::LogPacketInfo<RrcConnectionReconfigurationCompleteHeader> (destination,
"DESTINATION");
426 NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (),destination.GetRrcTransactionIdentifier (),
"RrcTransactionIdentifier");
436 virtual void DoRun (
void);
439 RrcConnectionReconfigurationTestCase::RrcConnectionReconfigurationTestCase ()
447 packet = Create<Packet> ();
448 NS_LOG_DEBUG (
"============= RrcConnectionReconfigurationTestCase ===========");
451 msg.rrcTransactionIdentifier = 2;
453 msg.haveMeasConfig =
true;
455 msg.measConfig.haveQuantityConfig =
true;
456 msg.measConfig.quantityConfig.filterCoefficientRSRP = 8;
457 msg.measConfig.quantityConfig.filterCoefficientRSRQ = 7;
459 msg.measConfig.haveMeasGapConfig =
true;
460 msg.measConfig.measGapConfig.type = LteRrcSap::MeasGapConfig::SETUP;
461 msg.measConfig.measGapConfig.gapOffsetChoice = LteRrcSap::MeasGapConfig::gp0;
462 msg.measConfig.measGapConfig.gapOffsetValue = 21;
464 msg.measConfig.haveSmeasure =
true;
465 msg.measConfig.sMeasure = 57;
467 msg.measConfig.haveSpeedStatePars =
true;
468 msg.measConfig.speedStatePars.type = LteRrcSap::SpeedStatePars::SETUP;
469 msg.measConfig.speedStatePars.mobilityStateParameters.tEvaluation = 240;
470 msg.measConfig.speedStatePars.mobilityStateParameters.tHystNormal = 60;
471 msg.measConfig.speedStatePars.mobilityStateParameters.nCellChangeMedium = 5;
472 msg.measConfig.speedStatePars.mobilityStateParameters.nCellChangeHigh = 13;
473 msg.measConfig.speedStatePars.timeToTriggerSf.sfMedium = 25;
474 msg.measConfig.speedStatePars.timeToTriggerSf.sfHigh = 75;
476 msg.measConfig.measObjectToRemoveList.push_back (23);
477 msg.measConfig.measObjectToRemoveList.push_back (13);
479 msg.measConfig.reportConfigToRemoveList.push_back (7);
480 msg.measConfig.reportConfigToRemoveList.push_back (16);
482 msg.measConfig.measIdToRemoveList.push_back (4);
483 msg.measConfig.measIdToRemoveList.push_back (18);
490 msg.haveMobilityControlInfo =
true;
491 msg.mobilityControlInfo.targetPhysCellId = 4;
492 msg.mobilityControlInfo.haveCarrierFreq =
true;
493 msg.mobilityControlInfo.carrierFreq.dlCarrierFreq = 3;
494 msg.mobilityControlInfo.carrierFreq.ulCarrierFreq = 5;
495 msg.mobilityControlInfo.haveCarrierBandwidth =
true;
496 msg.mobilityControlInfo.carrierBandwidth.dlBandwidth = 50;
497 msg.mobilityControlInfo.carrierBandwidth.ulBandwidth = 25;
498 msg.mobilityControlInfo.newUeIdentity = 11;
499 msg.mobilityControlInfo.haveRachConfigDedicated =
true;
500 msg.mobilityControlInfo.rachConfigDedicated.raPreambleIndex = 2;
501 msg.mobilityControlInfo.rachConfigDedicated.raPrachMaskIndex = 2;
502 msg.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.preambleInfo.numberOfRaPreambles = 4;
503 msg.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.preambleTransMax = 3;
504 msg.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.raResponseWindowSize = 6;
506 msg.haveRadioResourceConfigDedicated =
true;
508 msg.radioResourceConfigDedicated = CreateRadioResourceConfigDedicated ();
514 TestUtils::LogPacketInfo<RrcConnectionReconfigurationHeader> (source,
"SOURCE");
520 TestUtils::LogPacketContents (packet);
527 TestUtils::LogPacketInfo<RrcConnectionReconfigurationHeader> (destination,
"DESTINATION");
530 NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (),destination.GetRrcTransactionIdentifier (),
"RrcTransactionIdentifier");
531 NS_TEST_ASSERT_MSG_EQ (source.GetHaveMeasConfig (),destination.GetHaveMeasConfig (),
"GetHaveMeasConfig");
532 NS_TEST_ASSERT_MSG_EQ (source.GetHaveMobilityControlInfo (),destination.GetHaveMobilityControlInfo (),
"GetHaveMobilityControlInfo");
533 NS_TEST_ASSERT_MSG_EQ (source.GetHaveRadioResourceConfigDedicated (),destination.GetHaveRadioResourceConfigDedicated (),
"GetHaveRadioResourceConfigDedicated");
535 if ( source.GetHaveMobilityControlInfo () )
537 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().targetPhysCellId,destination.GetMobilityControlInfo ().targetPhysCellId,
"GetMobilityControlInfo().targetPhysCellId");
538 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().haveCarrierFreq,destination.GetMobilityControlInfo ().haveCarrierFreq,
"GetMobilityControlInfo().haveCarrierFreq");
539 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().haveCarrierBandwidth,destination.GetMobilityControlInfo ().haveCarrierBandwidth,
"GetMobilityControlInfo().haveCarrierBandwidth");
540 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().newUeIdentity,destination.GetMobilityControlInfo ().newUeIdentity,
"GetMobilityControlInfo().newUeIdentity");
541 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().haveRachConfigDedicated,destination.GetMobilityControlInfo ().haveRachConfigDedicated,
"GetMobilityControlInfo().haveRachConfigDedicated");
543 if (source.GetMobilityControlInfo ().haveCarrierFreq)
545 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().carrierFreq.dlCarrierFreq,
546 destination.GetMobilityControlInfo ().carrierFreq.dlCarrierFreq,
547 "GetMobilityControlInfo().carrierFreq.dlCarrierFreq");
548 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().carrierFreq.ulCarrierFreq,
549 destination.GetMobilityControlInfo ().carrierFreq.ulCarrierFreq,
550 "GetMobilityControlInfo().carrierFreq.ulCarrierFreq");
553 if (source.GetMobilityControlInfo ().haveCarrierBandwidth)
555 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().carrierBandwidth.dlBandwidth,
556 destination.GetMobilityControlInfo ().carrierBandwidth.dlBandwidth,
557 "GetMobilityControlInfo().carrierBandwidth.dlBandwidth");
558 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().carrierBandwidth.ulBandwidth,
559 destination.GetMobilityControlInfo ().carrierBandwidth.ulBandwidth,
560 "GetMobilityControlInfo().carrierBandwidth.ulBandwidth");
563 if (source.GetMobilityControlInfo ().haveRachConfigDedicated)
565 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().rachConfigDedicated.raPreambleIndex,
566 destination.GetMobilityControlInfo ().rachConfigDedicated.raPreambleIndex,
567 "GetMobilityControlInfo().rachConfigDedicated.raPreambleIndex");
568 NS_TEST_ASSERT_MSG_EQ (source.GetMobilityControlInfo ().rachConfigDedicated.raPrachMaskIndex,
569 destination.GetMobilityControlInfo ().rachConfigDedicated.raPrachMaskIndex,
570 "GetMobilityControlInfo().rachConfigDedicated.raPrachMaskIndex");
574 if (source.GetHaveRadioResourceConfigDedicated ())
576 AssertEqualRadioResourceConfigDedicated (source.GetRadioResourceConfigDedicated (), destination.GetRadioResourceConfigDedicated ());
587 virtual void DoRun (
void);
590 HandoverPreparationInfoTestCase::HandoverPreparationInfoTestCase () :
RrcHeaderTestCase (
"Testing HandoverPreparationInfoTestCase")
597 packet = Create<Packet> ();
598 NS_LOG_DEBUG (
"============= HandoverPreparationInfoTestCase ===========");
601 msg.asConfig.sourceDlCarrierFreq = 3;
602 msg.asConfig.sourceUeIdentity = 11;
603 msg.asConfig.sourceRadioResourceConfig = CreateRadioResourceConfigDedicated ();
604 msg.asConfig.sourceMasterInformationBlock.dlBandwidth = 3;
605 msg.asConfig.sourceMasterInformationBlock.systemFrameNumber = 1;
607 msg.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIndication =
true;
608 msg.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.cellIdentity = 5;
609 msg.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIdentity = 4;
610 msg.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity = 123;
612 msg.asConfig.sourceSystemInformationBlockType2.freqInfo.ulBandwidth = 100;
613 msg.asConfig.sourceSystemInformationBlockType2.freqInfo.ulCarrierFreq = 10;
614 msg.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.preambleInfo.numberOfRaPreambles = 4;
615 msg.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.preambleTransMax = 3;
616 msg.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.raResponseWindowSize = 6;
618 msg.asConfig.sourceMeasConfig.haveQuantityConfig =
false;
619 msg.asConfig.sourceMeasConfig.haveMeasGapConfig =
false;
620 msg.asConfig.sourceMeasConfig.haveSmeasure =
false;
621 msg.asConfig.sourceMeasConfig.haveSpeedStatePars =
false;
627 TestUtils::LogPacketInfo<HandoverPreparationInfoHeader> (source,
"SOURCE");
633 TestUtils::LogPacketContents (packet);
640 TestUtils::LogPacketInfo<HandoverPreparationInfoHeader> (destination,
"DESTINATION");
643 AssertEqualRadioResourceConfigDedicated (source.GetAsConfig ().sourceRadioResourceConfig, destination.GetAsConfig ().sourceRadioResourceConfig);
644 NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceUeIdentity, destination.GetAsConfig ().sourceUeIdentity,
"sourceUeIdentity");
645 NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceMasterInformationBlock.dlBandwidth,destination.GetAsConfig ().sourceMasterInformationBlock.dlBandwidth,
"dlBandwidth");
646 NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceMasterInformationBlock.systemFrameNumber, destination.GetAsConfig ().sourceMasterInformationBlock.systemFrameNumber,
"systemFrameNumber");
647 NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity, destination.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity,
"plmnIdentity");
648 NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIndication, destination.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIndication,
"csgIndication");
649 NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.cellIdentity, destination.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.cellIdentity,
"cellIdentity");
650 NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIdentity, destination.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIdentity,
"csgIdentity");
651 NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceDlCarrierFreq, destination.GetAsConfig ().sourceDlCarrierFreq,
"sourceDlCarrierFreq");
661 virtual void DoRun (
void);
664 RrcConnectionReestablishmentRequestTestCase::RrcConnectionReestablishmentRequestTestCase () :
RrcHeaderTestCase (
"Testing RrcConnectionReestablishmentRequestTestCase")
671 packet = Create<Packet> ();
672 NS_LOG_DEBUG (
"============= RrcConnectionReestablishmentRequestTestCase ===========");
675 msg.ueIdentity.cRnti = 12;
676 msg.ueIdentity.physCellId = 21;
677 msg.reestablishmentCause = LteRrcSap::HANDOVER_FAILURE;
683 TestUtils::LogPacketInfo<RrcConnectionReestablishmentRequestHeader> (source,
"SOURCE");
689 TestUtils::LogPacketContents (packet);
696 TestUtils::LogPacketInfo<RrcConnectionReestablishmentRequestHeader> (destination,
"DESTINATION");
699 NS_TEST_ASSERT_MSG_EQ (source.GetUeIdentity ().cRnti, destination.GetUeIdentity ().cRnti,
"cRnti");
700 NS_TEST_ASSERT_MSG_EQ (source.GetUeIdentity ().physCellId, destination.GetUeIdentity ().physCellId,
"physCellId");
701 NS_TEST_ASSERT_MSG_EQ (source.GetReestablishmentCause (),destination.GetReestablishmentCause (),
"ReestablishmentCause");
711 virtual void DoRun (
void);
714 RrcConnectionReestablishmentTestCase::RrcConnectionReestablishmentTestCase () :
RrcHeaderTestCase (
"Testing RrcConnectionReestablishmentTestCase")
721 packet = Create<Packet> ();
722 NS_LOG_DEBUG (
"============= RrcConnectionReestablishmentTestCase ===========");
725 msg.rrcTransactionIdentifier = 2;
726 msg.radioResourceConfigDedicated = CreateRadioResourceConfigDedicated ();
732 TestUtils::LogPacketInfo<RrcConnectionReestablishmentHeader> (source,
"SOURCE");
738 TestUtils::LogPacketContents (packet);
745 TestUtils::LogPacketInfo<RrcConnectionReestablishmentHeader> (destination,
"DESTINATION");
748 NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (), destination.GetRrcTransactionIdentifier (),
"rrcTransactionIdentifier");
749 AssertEqualRadioResourceConfigDedicated (source.GetRadioResourceConfigDedicated (),destination.GetRadioResourceConfigDedicated ());
759 virtual void DoRun (
void);
762 RrcConnectionReestablishmentCompleteTestCase::RrcConnectionReestablishmentCompleteTestCase () :
RrcHeaderTestCase (
"Testing RrcConnectionReestablishmentCompleteTestCase")
769 packet = Create<Packet> ();
770 NS_LOG_DEBUG (
"============= RrcConnectionReestablishmentCompleteTestCase ===========");
773 msg.rrcTransactionIdentifier = 3;
779 TestUtils::LogPacketInfo<RrcConnectionReestablishmentCompleteHeader> (source,
"SOURCE");
785 TestUtils::LogPacketContents (packet);
792 TestUtils::LogPacketInfo<RrcConnectionReestablishmentCompleteHeader> (destination,
"DESTINATION");
795 NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (), destination.GetRrcTransactionIdentifier (),
"rrcTransactionIdentifier");
805 virtual void DoRun (
void);
808 RrcConnectionRejectTestCase::RrcConnectionRejectTestCase () :
RrcHeaderTestCase (
"Testing RrcConnectionRejectTestCase")
815 packet = Create<Packet> ();
816 NS_LOG_DEBUG (
"============= RrcConnectionRejectTestCase ===========");
825 TestUtils::LogPacketInfo<RrcConnectionRejectHeader> (source,
"SOURCE");
831 TestUtils::LogPacketContents (packet);
838 TestUtils::LogPacketInfo<RrcConnectionRejectHeader> (destination,
"DESTINATION");
841 NS_TEST_ASSERT_MSG_EQ (source.GetMessage ().waitTime, destination.GetMessage ().waitTime,
"Different waitTime!");
851 virtual void DoRun (
void);
854 MeasurementReportTestCase::MeasurementReportTestCase () :
RrcHeaderTestCase (
"Testing MeasurementReportTestCase")
861 packet = Create<Packet> ();
862 NS_LOG_DEBUG (
"============= MeasurementReportTestCase ===========");
865 msg.measResults.measId = 5;
866 msg.measResults.rsrpResult = 18;
867 msg.measResults.rsrqResult = 21;
868 msg.measResults.haveMeasResultNeighCells =
true;
871 mResEutra.physCellId = 9;
872 mResEutra.haveRsrpResult =
true;
873 mResEutra.rsrpResult = 33;
874 mResEutra.haveRsrqResult =
true;
875 mResEutra.rsrqResult = 22;
876 mResEutra.haveCgiInfo =
true;
877 mResEutra.cgiInfo.plmnIdentity = 7;
878 mResEutra.cgiInfo.cellIdentity = 6;
879 mResEutra.cgiInfo.trackingAreaCode = 5;
880 msg.measResults.measResultListEutra.push_back (mResEutra);
887 TestUtils::LogPacketInfo<MeasurementReportHeader> (source,
"SOURCE");
893 TestUtils::LogPacketContents (packet);
900 TestUtils::LogPacketInfo<MeasurementReportHeader> (destination,
"DESTINATION");
906 NS_TEST_ASSERT_MSG_EQ (srcMeas.measId, dstMeas.measId,
"Different measId!");
907 NS_TEST_ASSERT_MSG_EQ (srcMeas.rsrpResult, dstMeas.rsrpResult,
"Different rsrpResult!");
908 NS_TEST_ASSERT_MSG_EQ (srcMeas.rsrqResult, dstMeas.rsrqResult,
"Different rsrqResult!");
909 NS_TEST_ASSERT_MSG_EQ (srcMeas.haveMeasResultNeighCells, dstMeas.haveMeasResultNeighCells,
"Different haveMeasResultNeighCells!");
911 if (srcMeas.haveMeasResultNeighCells)
913 std::list<LteRrcSap::MeasResultEutra>::iterator itsrc = srcMeas.measResultListEutra.begin ();
914 std::list<LteRrcSap::MeasResultEutra>::iterator itdst = dstMeas.measResultListEutra.begin ();
915 for (; itsrc != srcMeas.measResultListEutra.end (); itsrc++, itdst++)
917 NS_TEST_ASSERT_MSG_EQ (itsrc->physCellId, itdst->physCellId,
"Different physCellId!");
919 NS_TEST_ASSERT_MSG_EQ (itsrc->haveCgiInfo, itdst->haveCgiInfo,
"Different haveCgiInfo!");
920 if (itsrc->haveCgiInfo)
922 NS_TEST_ASSERT_MSG_EQ (itsrc->cgiInfo.plmnIdentity, itdst->cgiInfo.plmnIdentity,
"Different cgiInfo.plmnIdentity!");
923 NS_TEST_ASSERT_MSG_EQ (itsrc->cgiInfo.cellIdentity, itdst->cgiInfo.cellIdentity,
"Different cgiInfo.cellIdentity!");
924 NS_TEST_ASSERT_MSG_EQ (itsrc->cgiInfo.trackingAreaCode, itdst->cgiInfo.trackingAreaCode,
"Different cgiInfo.trackingAreaCode!");
925 NS_TEST_ASSERT_MSG_EQ (itsrc->cgiInfo.plmnIdentityList.size (), itdst->cgiInfo.plmnIdentityList.size (),
"Different cgiInfo.plmnIdentityList.size()!");
927 if (!itsrc->cgiInfo.plmnIdentityList.empty ())
929 std::list<uint32_t>::iterator itsrc2 = itsrc->cgiInfo.plmnIdentityList.begin ();
930 std::list<uint32_t>::iterator itdst2 = itdst->cgiInfo.plmnIdentityList.begin ();
931 for (; itsrc2 != itsrc->cgiInfo.plmnIdentityList.begin (); itsrc2++, itdst2++)
933 NS_TEST_ASSERT_MSG_EQ (*itsrc2, *itdst2,
"Different plmnId elements!");
938 NS_TEST_ASSERT_MSG_EQ (itsrc->haveRsrpResult, itdst->haveRsrpResult,
"Different haveRsrpResult!");
939 if (itsrc->haveRsrpResult)
941 NS_TEST_ASSERT_MSG_EQ (itsrc->rsrpResult, itdst->rsrpResult,
"Different rsrpResult!");
944 NS_TEST_ASSERT_MSG_EQ (itsrc->haveRsrqResult, itdst->haveRsrqResult,
"Different haveRsrqResult!");
945 if (itsrc->haveRsrqResult)
947 NS_TEST_ASSERT_MSG_EQ (itsrc->rsrqResult, itdst->rsrqResult,
"Different rsrqResult!");
963 Asn1EncodingSuite::Asn1EncodingSuite ()
980 Asn1EncodingSuite asn1EncodingSuite;
uint32_t RemoveHeader(Header &header)
#define NS_LOG_FUNCTION(parameters)
#define NS_LOG_COMPONENT_DEFINE(name)
uint32_t GetSize(void) const
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
void SetMessage(LteRrcSap::HandoverPreparationInfo msg)
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
#define NS_LOG_DEBUG(msg)
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
void AddHeader(const Header &header)