6#include "ns3/applications-module.h"
7#include "ns3/config-store-module.h"
8#include "ns3/core-module.h"
9#include "ns3/internet-module.h"
10#include "ns3/mobility-module.h"
11#include "ns3/network-module.h"
12#include "ns3/nr-module.h"
13#include "ns3/point-to-point-helper.h"
25class NrSystemTestConfigurationsTestCase1 :
public TestCase
28 NrSystemTestConfigurationsTestCase1(std::string name,
30 std::string scheduler);
31 ~NrSystemTestConfigurationsTestCase1()
override;
34 void DoRun()
override;
36 uint32_t m_numerology;
37 std::string m_scheduler;
40NrSystemTestConfigurationsTestCase1::NrSystemTestConfigurationsTestCase1(std::string name,
42 std::string scheduler)
45 m_numerology = numerology;
46 m_scheduler = scheduler;
49NrSystemTestConfigurationsTestCase1::~NrSystemTestConfigurationsTestCase1()
54NrSystemTestConfigurationsTestCase1::DoRun()
62 NodeContainer gnbNode;
68 Ptr<ListPositionAllocator> gnbPositionAlloc = CreateObject<ListPositionAllocator>();
69 gnbPositionAlloc->Add(Vector(0.0, 0.0, hBS));
71 MobilityHelper gnbMobility;
72 gnbMobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
73 gnbMobility.SetPositionAllocator(gnbPositionAlloc);
74 gnbMobility.Install(gnbNode);
77 MobilityHelper uemobility;
78 uemobility.SetMobilityModel(
"ns3::ConstantVelocityMobilityModel");
79 uemobility.Install(ueNode);
81 ueNode.Get(0)->GetObject<MobilityModel>()->SetPosition(Vector(0, 10, hUT));
83 Ptr<NrPointToPointEpcHelper> nrEpcHelper = CreateObject<NrPointToPointEpcHelper>();
84 Ptr<IdealBeamformingHelper> idealBeamformingHelper = CreateObject<IdealBeamformingHelper>();
85 Ptr<NrHelper> nrHelper = CreateObject<NrHelper>();
88 nrHelper->SetBeamformingHelper(idealBeamformingHelper);
89 nrHelper->SetEpcHelper(nrEpcHelper);
90 Ptr<NrChannelHelper> channelHelper = CreateObject<NrChannelHelper>();
92 channelHelper->ConfigureFactories(
"UMi");
94 Config::SetDefault(
"ns3::ThreeGppChannelModel::UpdatePeriod", TimeValue(MilliSeconds(100)));
96 channelHelper->SetChannelConditionModelAttribute(
"UpdatePeriod", TimeValue(MilliSeconds(100)));
97 channelHelper->SetPathlossAttribute(
"ShadowingEnabled", BooleanValue(
false));
100 const uint8_t numCcPerBand = 1;
109 channelHelper->AssignChannelsToBands({band1});
112 nrHelper->SetGnbPhyAttribute(
"Numerology", UintegerValue(m_numerology));
113 nrHelper->SetSchedulerTypeId(TypeId::LookupByName(m_scheduler));
116 NetDeviceContainer gnbNetDev = nrHelper->InstallGnbDevice(gnbNode, allBwps);
117 NetDeviceContainer ueNetDev = nrHelper->InstallUeDevice(ueNode, allBwps);
121 auto [remoteHost, remoteHostIpv4Address] =
122 nrEpcHelper->SetupRemoteHost(
"100Gb/s", 2500, Seconds(0.000));
124 InternetStackHelper internet;
125 internet.Install(ueNode);
126 Ipv4InterfaceContainer ueIpIface;
127 ueIpIface = nrEpcHelper->AssignUeIpv4Address(NetDeviceContainer(ueNetDev));
130 uint16_t dlPort = 1234;
131 ApplicationContainer clientApps;
132 ApplicationContainer serverApps;
134 UdpServerHelper dlPacketSinkHelper(dlPort);
135 serverApps.Add(dlPacketSinkHelper.Install(ueNode.Get(0)));
137 UdpClientHelper dlClient(ueIpIface.GetAddress(0), dlPort);
138 dlClient.SetAttribute(
"Interval", TimeValue(MicroSeconds(10000)));
139 dlClient.SetAttribute(
"MaxPackets", UintegerValue(0xFFFFFFFF));
140 clientApps.Add(dlClient.Install(remoteHost));
143 serverApps.Start(MilliSeconds(400));
144 clientApps.Start(MilliSeconds(400));
145 serverApps.Stop(MilliSeconds(800));
146 clientApps.Stop(MilliSeconds(800));
149 nrHelper->AttachToClosestGnb(ueNetDev, gnbNetDev);
151 Simulator::Stop(MilliSeconds(800));
153 Simulator::Destroy();
156 NS_TEST_ASSERT_MSG_EQ(
true,
true,
"true doesn't equal true for some reason");
158 NS_TEST_ASSERT_MSG_EQ_TOL(0.01, 0.01, 0.001,
"Numbers are not equal within tolerance");
161class NrSystemTestConfigurationsTestSuite :
public TestSuite
164 NrSystemTestConfigurationsTestSuite();
167NrSystemTestConfigurationsTestSuite::NrSystemTestConfigurationsTestSuite()
168 : TestSuite(
"nr-system-test-configurations", Type::SYSTEM)
170 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=0, scheduler=rr",
172 "ns3::NrMacSchedulerTdmaRR"),
174 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=2, scheduler=rr",
176 "ns3::NrMacSchedulerTdmaRR"),
178 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=4, scheduler=rr",
180 "ns3::NrMacSchedulerTdmaRR"),
183 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=0, scheduler=pf",
185 "ns3::NrMacSchedulerTdmaPF"),
187 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=2, scheduler=pf",
189 "ns3::NrMacSchedulerTdmaPF"),
191 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=4, scheduler=pf",
193 "ns3::NrMacSchedulerTdmaPF"),
196 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=0, scheduler=mr",
198 "ns3::NrMacSchedulerTdmaMR"),
200 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=2, scheduler=mr",
202 "ns3::NrMacSchedulerTdmaMR"),
204 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=4, scheduler=mr",
206 "ns3::NrMacSchedulerTdmaMR"),
211static NrSystemTestConfigurationsTestSuite nrTestSuite;
Manages the correct creation of operation bands, component carriers and bandwidth parts.
OperationBandInfo CreateOperationBandContiguousCc(const SimpleOperationBandConf &conf)
Create an operation band with the CC specified.
static BandwidthPartInfoPtrVector GetAllBwps(const std::vector< std::reference_wrapper< OperationBandInfo > > &operationBands)
Get all the BWP pointers from the specified vector of operation bands.
std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > BandwidthPartInfoPtrVector
vector of unique_ptr of BandwidthPartInfo
Minimum configuration requirements for a OperationBand.
Operation band information structure.