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 Ptr<Node> pgw = nrEpcHelper->GetPgwNode();
122 NodeContainer remoteHostContainer;
123 remoteHostContainer.Create(1);
124 Ptr<Node> remoteHost = remoteHostContainer.Get(0);
125 InternetStackHelper internet;
126 internet.Install(remoteHostContainer);
129 PointToPointHelper p2ph;
130 p2ph.SetDeviceAttribute(
"DataRate", DataRateValue(DataRate(
"100Gb/s")));
131 p2ph.SetDeviceAttribute(
"Mtu", UintegerValue(2500));
132 p2ph.SetChannelAttribute(
"Delay", TimeValue(Seconds(0.010)));
133 NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
134 Ipv4AddressHelper ipv4h;
135 ipv4h.SetBase(
"1.0.0.0",
"255.0.0.0");
136 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
137 Ipv4StaticRoutingHelper ipv4RoutingHelper;
138 Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
139 ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
140 remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address(
"7.0.0.0"), Ipv4Mask(
"255.0.0.0"), 1);
141 internet.Install(ueNode);
142 Ipv4InterfaceContainer ueIpIface;
143 ueIpIface = nrEpcHelper->AssignUeIpv4Address(NetDeviceContainer(ueNetDev));
145 uint16_t dlPort = 1234;
146 ApplicationContainer clientApps;
147 ApplicationContainer serverApps;
149 Ptr<Node> ue = ueNode.Get(0);
151 Ptr<Ipv4StaticRouting> ueStaticRouting =
152 ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
153 ueStaticRouting->SetDefaultRoute(nrEpcHelper->GetUeDefaultGatewayAddress(), 1);
155 UdpServerHelper dlPacketSinkHelper(dlPort);
156 serverApps.Add(dlPacketSinkHelper.Install(ueNode.Get(0)));
158 UdpClientHelper dlClient(ueIpIface.GetAddress(0), dlPort);
159 dlClient.SetAttribute(
"Interval", TimeValue(MicroSeconds(10000)));
160 dlClient.SetAttribute(
"MaxPackets", UintegerValue(0xFFFFFFFF));
161 clientApps.Add(dlClient.Install(remoteHost));
164 serverApps.Start(MilliSeconds(400));
165 clientApps.Start(MilliSeconds(400));
166 serverApps.Stop(MilliSeconds(800));
167 clientApps.Stop(MilliSeconds(800));
170 nrHelper->AttachToClosestGnb(ueNetDev, gnbNetDev);
172 Simulator::Stop(MilliSeconds(800));
174 Simulator::Destroy();
177 NS_TEST_ASSERT_MSG_EQ(
true,
true,
"true doesn't equal true for some reason");
179 NS_TEST_ASSERT_MSG_EQ_TOL(0.01, 0.01, 0.001,
"Numbers are not equal within tolerance");
182class NrSystemTestConfigurationsTestSuite :
public TestSuite
185 NrSystemTestConfigurationsTestSuite();
188NrSystemTestConfigurationsTestSuite::NrSystemTestConfigurationsTestSuite()
189 : TestSuite(
"nr-system-test-configurations", Type::SYSTEM)
191 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=0, scheduler=rr",
193 "ns3::NrMacSchedulerTdmaRR"),
195 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=2, scheduler=rr",
197 "ns3::NrMacSchedulerTdmaRR"),
199 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=4, scheduler=rr",
201 "ns3::NrMacSchedulerTdmaRR"),
204 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=0, scheduler=pf",
206 "ns3::NrMacSchedulerTdmaPF"),
208 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=2, scheduler=pf",
210 "ns3::NrMacSchedulerTdmaPF"),
212 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=4, scheduler=pf",
214 "ns3::NrMacSchedulerTdmaPF"),
217 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=0, scheduler=mr",
219 "ns3::NrMacSchedulerTdmaMR"),
221 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=2, scheduler=mr",
223 "ns3::NrMacSchedulerTdmaMR"),
225 AddTestCase(
new NrSystemTestConfigurationsTestCase1(
"num=4, scheduler=mr",
227 "ns3::NrMacSchedulerTdmaMR"),
232static 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.