10#include <ns3/callback.h>
11#include <ns3/constant-position-mobility-model.h>
13#include <ns3/lte-helper.h>
14#include <ns3/lte-spectrum-value-helper.h>
15#include <ns3/lte-ue-rrc.h>
16#include <ns3/mobility-helper.h>
17#include <ns3/net-device-container.h>
18#include <ns3/node-container.h>
19#include <ns3/object.h>
21#include <ns3/simulator.h>
80 uint16_t numberOfComponentCarriers,
81 std::vector<ConfigToCheck> configToCheck,
82 Time simulationDuration)
84 numberOfComponentCarriers,
96 void DoRun()
override;
108 uint16_t numberOfComponentCarriers,
109 std::vector<ConfigToCheck> configToCheck,
110 Time simulationDuration);
120 std::list<LteRrcSap::SCellToAddMod> sCellToAddModList);
130 std::vector<ConfigToCheck>
134 std::vector<std::map<uint16_t, ConfigToCheck>>
141 uint16_t numberOfComponentCarriers,
142 std::vector<ConfigToCheck> configToCheck,
143 Time simulationDuration)
145 std::ostringstream oss;
146 oss <<
" nodes " << numberOfNodes <<
" carriers " << numberOfComponentCarriers
147 <<
" configurations " << configToCheck.size() <<
" duration " << simulationDuration;
151std::vector<std::map<uint16_t, ConfigToCheck>>
154 std::vector<std::map<uint16_t, ConfigToCheck>> configToCheckContainer;
158 std::map<uint16_t, ConfigToCheck> ccmap;
161 uint32_t maxBandwidthRb = std::max<uint32_t>(it.m_ulBandwidth, it.m_dlBandwidth);
185 ccmap.insert(std::pair<uint16_t, ConfigToCheck>(i, cc));
187 NS_LOG_INFO(
"UL BW: " << it.m_ulBandwidth <<
", DL BW: " << it.m_dlBandwidth
188 <<
", UL Earfcn: " << ulEarfcn <<
", DL Earfcn: " << dlEarfcn);
192 uint32_t frequencyShift = 300 * (1 + (maxBandwidthKhz - 1) / 300);
195 uint32_t earfcnShift = frequencyShift / 100;
196 ulEarfcn += earfcnShift;
197 dlEarfcn += earfcnShift;
200 configToCheckContainer.push_back(ccmap);
203 return configToCheckContainer;
209 std::list<LteRrcSap::SCellToAddMod> sCellToAddModList)
213 uint16_t cellId = ueRrc->GetCellId();
219 std::map<uint16_t, ConfigToCheck> configToCheckMap;
233 <<
static_cast<uint16_t
>(ueRrc->GetUlBandwidth())
234 <<
", DL BW: " <<
static_cast<uint16_t
>(ueRrc->GetDlBandwidth()) <<
", UL Earfcn: "
235 << ueRrc->GetUlEarfcn() <<
", DL Earfcn: " << ueRrc->GetDlEarfcn());
237 for (
auto scell : sCellToAddModList)
240 <<
static_cast<uint16_t
>(scell.radioResourceConfigCommonSCell.ulConfiguration
241 .ulFreqInfo.ulBandwidth)
243 <<
static_cast<uint16_t
>(
244 scell.radioResourceConfigCommonSCell.nonUlConfiguration.dlBandwidth)
246 << scell.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulCarrierFreq
247 <<
", DL Earfcn: " << scell.cellIdentification.dlCarrierFreq);
254 static_cast<uint16_t
>(ueRrc->GetDlBandwidth()),
255 "Primary Carrier DL bandwidth configuration failed");
257 static_cast<uint16_t
>(ueRrc->GetUlBandwidth()),
258 "Primary Carrier UL bandwidth configuration failed");
260 ueRrc->GetDlEarfcn(),
261 "Primary Carrier DL EARFCN configuration failed");
263 ueRrc->GetUlEarfcn(),
264 "Primary Carrier UL EARFCN configuration failed");
268 for (
auto scell : sCellToAddModList)
270 sCConfig = configToCheckMap[ConfigToCheckMapIndex];
274 static_cast<uint16_t
>(
275 scell.radioResourceConfigCommonSCell.nonUlConfiguration.dlBandwidth),
276 "Secondary Carrier DL bandwidth configuration failed");
279 static_cast<uint16_t
>(
280 scell.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulBandwidth),
281 "Secondary Carrier UL bandwidth configuration failed");
283 scell.cellIdentification.dlCarrierFreq,
284 "Secondary Carrier DL EARFCN configuration failed");
287 scell.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulCarrierFreq,
288 "Secondary Carrier UL EARFCN configuration failed");
289 ConfigToCheckMapIndex++;
316 for (
uint32_t i = 0; i < totalNumberOfNodes; i++)
318 positionAlloc->Add(Vector(2 * i, 0, 0));
322 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
323 mobility.SetPositionAllocator(positionAlloc);
327 mobility.Install(enbNodes.
Get(n));
328 mobility.Install(ueNodes.
Get(n));
345 enbDevs.
Add(lteHelper->InstallEnbDevice(enbNodes.
Get(i)));
346 lteHelper->AssignStreams(enbDevs, stream);
347 ueDevs.
Add(lteHelper->InstallUeDevice(ueNodes.
Get(i)));
348 lteHelper->AssignStreams(ueDevs, stream);
358 lteHelper->Attach(ueDevs.
Get(k), enbDevs.
Get(k));
364 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
366 Config::Connect(
"/NodeList/*/DeviceList/*/LteUeRrc/SCarrierConfigured",
389 :
TestSuite(
"lte-carrier-aggregation-configuration",
Type::SYSTEM)
391 std::vector<ConfigToCheck> configToCheck;
402 configToCheck.push_back(configToCheckTest1);
404 uint16_t numberOfComponentCarriers = 2;
408 numberOfComponentCarriers,
411 TestCase::Duration::QUICK);
414 configToCheck.clear();
423 configToCheck.push_back(configToCheckTest1);
430 configToCheck.push_back(configToCheckTest2);
432 simulationDuration =
Seconds(2);
435 numberOfComponentCarriers,
438 TestCase::Duration::QUICK);
Carrier aggregation configuration test case.
CarrierAggregationConfigTestCase(uint32_t numberOfNodes, uint16_t numberOfComponentCarriers, std::vector< ConfigToCheck > configToCheck, Time simulationDuration)
Constructor.
Time m_simulationDuration
Simulation duration.
uint32_t m_numberOfNodes
Number of nodes.
uint16_t m_numberOfComponentCarriers
Number of component carriers.
void Evaluate(std::string context, Ptr< LteUeRrc > ueRrc, std::list< LteRrcSap::SCellToAddMod > sCellToAddModList)
Evaluate function.
uint32_t m_connectionCounter
Connection counter.
std::vector< std::map< uint16_t, ConfigToCheck > > m_configToCheckContainer
Vector of maps containing the per component carrier configuration.
std::vector< ConfigToCheck > m_configToCheck
Vector containing all the configurations to check.
std::string BuildNameString(uint32_t numberOfNodes, uint16_t numberOfComponentCarriers, std::vector< ConfigToCheck > configToCheck, Time simulationDuration)
Build name string function.
void DoRun() override
Implementation to actually run this TestCase.
std::vector< std::map< uint16_t, ConfigToCheck > > EquallySpacedCcs()
Equally spaced component carriers function.
Carrier aggregation configuration test suite.
CarrierAggregationConfigTestSuite()
This class contains the specification of EPS Bearers.
@ GBR_CONV_VOICE
GBR Conversational Voice.
static uint16_t GetUplinkCarrierBand(uint32_t nUl)
Converts uplink EARFCN to corresponding LTE frequency band number.
static uint16_t GetDownlinkCarrierBand(uint32_t nDl)
Converts downlink EARFCN to corresponding LTE frequency band number.
static double GetChannelBandwidth(uint16_t txBandwidthConf)
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
static CarrierAggregationConfigTestSuite g_carrierAggregationConfigTestSuite
Static variable for test initialization.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
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...
This test suite verifies following two things:
uint16_t m_ulBandwidth
Uplink bandwidth.
uint32_t m_dlEarfcn
Downlink EARFCN.
uint32_t m_ulEarfcn
Uplink EARFCN.
uint16_t m_dlBandwidth
Downlink bandwidth.