21#include <ns3/callback.h>
22#include <ns3/constant-position-mobility-model.h>
24#include <ns3/lte-helper.h>
25#include <ns3/lte-spectrum-value-helper.h>
26#include <ns3/lte-ue-rrc.h>
27#include <ns3/mobility-helper.h>
28#include <ns3/net-device-container.h>
29#include <ns3/node-container.h>
30#include <ns3/object.h>
32#include <ns3/simulator.h>
92 uint16_t numberOfComponentCarriers,
93 std::vector<ConfigToCheck> configToCheck,
94 Time simulationDuration)
96 numberOfComponentCarriers,
108 void DoRun()
override;
120 uint16_t numberOfComponentCarriers,
121 std::vector<ConfigToCheck> configToCheck,
122 Time simulationDuration);
132 std::list<LteRrcSap::SCellToAddMod> sCellToAddModList);
142 std::vector<ConfigToCheck>
146 std::vector<std::map<uint16_t, ConfigToCheck>>
153 uint16_t numberOfComponentCarriers,
154 std::vector<ConfigToCheck> configToCheck,
155 Time simulationDuration)
157 std::ostringstream oss;
158 oss <<
" nodes " << numberOfNodes <<
" carriers " << numberOfComponentCarriers
159 <<
" configurations " << configToCheck.size() <<
" duration " << simulationDuration;
163std::vector<std::map<uint16_t, ConfigToCheck>>
166 std::vector<std::map<uint16_t, ConfigToCheck>> configToCheckContainer;
170 std::map<uint16_t, ConfigToCheck> ccmap;
173 uint32_t maxBandwidthRb = std::max<uint32_t>(it.m_ulBandwidth, it.m_dlBandwidth);
177 LteSpectrumValueHelper::GetChannelBandwidth(maxBandwidthRb) / 1e3;
182 if (LteSpectrumValueHelper::GetUplinkCarrierBand(ulEarfcn) !=
183 LteSpectrumValueHelper::GetUplinkCarrierBand(it.m_ulEarfcn) ||
184 LteSpectrumValueHelper::GetDownlinkCarrierBand(dlEarfcn) !=
185 LteSpectrumValueHelper::GetDownlinkCarrierBand(it.m_dlEarfcn))
197 ccmap.insert(std::pair<uint16_t, ConfigToCheck>(i, cc));
199 NS_LOG_INFO(
"UL BW: " << it.m_ulBandwidth <<
", DL BW: " << it.m_dlBandwidth
200 <<
", UL Earfcn: " << ulEarfcn <<
", DL Earfcn: " << dlEarfcn);
204 uint32_t frequencyShift = 300 * (1 + (maxBandwidthKhz - 1) / 300);
207 uint32_t earfcnShift = frequencyShift / 100;
208 ulEarfcn += earfcnShift;
209 dlEarfcn += earfcnShift;
212 configToCheckContainer.push_back(ccmap);
215 return configToCheckContainer;
221 std::list<LteRrcSap::SCellToAddMod> sCellToAddModList)
225 uint16_t cellId = ueRrc->GetCellId();
231 std::map<uint16_t, ConfigToCheck> configToCheckMap;
245 <<
static_cast<uint16_t
>(ueRrc->GetUlBandwidth())
246 <<
", DL BW: " <<
static_cast<uint16_t
>(ueRrc->GetDlBandwidth()) <<
", UL Earfcn: "
247 << ueRrc->GetUlEarfcn() <<
", DL Earfcn: " << ueRrc->GetDlEarfcn());
249 for (
auto scell : sCellToAddModList)
252 <<
static_cast<uint16_t
>(scell.radioResourceConfigCommonSCell.ulConfiguration
253 .ulFreqInfo.ulBandwidth)
255 <<
static_cast<uint16_t
>(
256 scell.radioResourceConfigCommonSCell.nonUlConfiguration.dlBandwidth)
258 << scell.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulCarrierFreq
259 <<
", DL Earfcn: " << scell.cellIdentification.dlCarrierFreq);
266 static_cast<uint16_t
>(ueRrc->GetDlBandwidth()),
267 "Primary Carrier DL bandwidth configuration failed");
269 static_cast<uint16_t
>(ueRrc->GetUlBandwidth()),
270 "Primary Carrier UL bandwidth configuration failed");
272 ueRrc->GetDlEarfcn(),
273 "Primary Carrier DL EARFCN configuration failed");
275 ueRrc->GetUlEarfcn(),
276 "Primary Carrier UL EARFCN configuration failed");
280 for (
auto scell : sCellToAddModList)
282 sCConfig = configToCheckMap[ConfigToCheckMapIndex];
286 static_cast<uint16_t
>(
287 scell.radioResourceConfigCommonSCell.nonUlConfiguration.dlBandwidth),
288 "Secondary Carrier DL bandwidth configuration failed");
291 static_cast<uint16_t
>(
292 scell.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulBandwidth),
293 "Secondary Carrier UL bandwidth configuration failed");
295 scell.cellIdentification.dlCarrierFreq,
296 "Secondary Carrier DL EARFCN configuration failed");
299 scell.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulCarrierFreq,
300 "Secondary Carrier UL EARFCN configuration failed");
301 ConfigToCheckMapIndex++;
328 for (
uint32_t i = 0; i < totalNumberOfNodes; i++)
330 positionAlloc->Add(Vector(2 * i, 0, 0));
334 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
335 mobility.SetPositionAllocator(positionAlloc);
378 Config::Connect(
"/NodeList/*/DeviceList/*/LteUeRrc/SCarrierConfigured",
386 Simulator::Destroy();
402 :
TestSuite(
"lte-carrier-aggregation-configuration", SYSTEM)
404 std::vector<ConfigToCheck> configToCheck;
415 configToCheck.push_back(configToCheckTest1);
417 uint16_t numberOfComponentCarriers = 2;
421 numberOfComponentCarriers,
427 configToCheck.clear();
436 configToCheck.push_back(configToCheckTest1);
443 configToCheck.push_back(configToCheckTest2);
445 simulationDuration =
Seconds(2);
448 numberOfComponentCarriers,
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
Numer 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()
AttributeValue implementation for Boolean.
This class contains the specification of EPS Bearers.
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
void SetUeDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the UE devices (LteUeNetDevice) to be created.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used.
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.
Hold variables of type string.
void AddTestCase(TestCase *testCase, TestDuration 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.
#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.
static CarrierAggregationConfigTestSuite g_carrierAggregationConfigTestSuite
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.