10#include "ns3/boolean.h"
11#include "ns3/double.h"
12#include "ns3/inet-socket-address.h"
13#include "ns3/internet-stack-helper.h"
14#include "ns3/ipv4-address-helper.h"
15#include "ns3/ipv4-static-routing-helper.h"
16#include "ns3/ipv4-static-routing.h"
18#include "ns3/lte-helper.h"
19#include "ns3/mobility-helper.h"
20#include "ns3/packet-sink-helper.h"
21#include "ns3/packet-sink.h"
22#include "ns3/point-to-point-epc-helper.h"
23#include "ns3/point-to-point-helper.h"
24#include "ns3/simulator.h"
26#include "ns3/udp-client-server-helper.h"
27#include "ns3/udp-echo-helper.h"
28#include "ns3/uinteger.h"
77 std::vector<UeTestData>
ues;
100 void DoRun()
override;
132 lteHelper->SetEpcHelper(epcHelper);
134 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisPropagationLossModel"));
143 remoteHostContainer.
Create(1);
146 internet.Install(remoteHostContainer);
155 ipv4h.
SetBase(
"1.0.0.0",
"255.0.0.0");
165 remoteHostStaticRouting->AddNetworkRouteTo(
Ipv4Address(
"7.0.0.0"),
188 auto enbLteDevIt = enbLteDevs.
Begin();
190 uint16_t ulPort = 1000;
197 ues.
Create(enbit->ues.size());
198 Vector enbPosition = (*enbLteDevIt)->GetNode()->GetObject<
MobilityModel>()->GetPosition();
213 internet.Install(ues);
225 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
228 lteHelper->Attach(ueLteDevice, *enbLteDevIt);
230 uint16_t dlPort = 2000;
231 for (
uint32_t b = 0; b < enbit->ues.at(u).bearers.size(); ++b)
238 "ns3::UdpSocketFactory",
248 apps = client.Install(remoteHost);
256 "ns3::UdpSocketFactory",
266 apps = client.Install(ue);
284 lteHelper->ActivateDedicatedEpsBearer(ueLteDevice, epsBearer, tft);
290 "/NodeList/*/DeviceList/*/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/MaxTxBufferSize",
292 Config::Set(
"/NodeList/*/DeviceList/*/LteUeRrc/RadioBearerMap/*/LteRlc/MaxTxBufferSize",
295 double statsStartTime = 0.040;
296 double statsDuration = 2.0;
298 lteHelper->EnablePdcpTraces();
300 lteHelper->GetPdcpStats()->SetAttribute(
"StartTime",
TimeValue(
Seconds(statsStartTime)));
301 lteHelper->GetPdcpStats()->SetAttribute(
"EpochDuration",
TimeValue(
Seconds(statsDuration)));
306 uint64_t imsiCounter = 0;
310 for (
auto ueit = enbit->ues.begin(); ueit < enbit->ues.end(); ++ueit)
312 uint64_t imsi = ++imsiCounter;
313 for (
uint32_t b = 0; b < ueit->bearers.size(); ++b)
318 uint8_t lcid = b + 4;
319 uint32_t expectedPkts = ueit->bearers.at(b).numPkts;
321 (ueit->bearers.at(b).numPkts) * (ueit->bearers.at(b).pktSize);
322 uint32_t txPktsPdcpDl = lteHelper->GetPdcpStats()->GetDlTxPackets(imsi, lcid);
323 uint32_t rxPktsPdcpDl = lteHelper->GetPdcpStats()->GetDlRxPackets(imsi, lcid);
324 uint32_t txPktsPdcpUl = lteHelper->GetPdcpStats()->GetUlTxPackets(imsi, lcid);
325 uint32_t rxPktsPdcpUl = lteHelper->GetPdcpStats()->GetUlRxPackets(imsi, lcid);
326 uint32_t rxBytesDl = ueit->bearers.at(b).dlServerApp->GetTotalRx();
327 uint32_t rxBytesUl = ueit->bearers.at(b).ulServerApp->GetTotalRx();
331 "wrong TX PDCP packets in downlink for IMSI="
332 << imsi <<
" LCID=" << (uint16_t)lcid);
336 "wrong RX PDCP packets in downlink for IMSI="
337 << imsi <<
" LCID=" << (uint16_t)lcid);
340 "wrong TX PDCP packets in uplink for IMSI="
341 << imsi <<
" LCID=" << (uint16_t)lcid);
344 "wrong RX PDCP packets in uplink for IMSI="
345 << imsi <<
" LCID=" << (uint16_t)lcid);
349 "wrong total received bytes in downlink");
352 "wrong total received bytes in uplink");
375 std::vector<EnbTestData> v1;
380 e1.
ues.push_back(u1);
384 std::vector<EnbTestData> v2;
389 e2.
ues.push_back(u2_1);
393 e2.
ues.push_back(u2_2);
397 std::vector<EnbTestData> v3;
406 e4.
ues.push_back(u4_1);
410 e4.
ues.push_back(u4_2);
414 e4.
ues.push_back(u4_3);
415 std::vector<EnbTestData> v4;
425 e5.
ues.push_back(u5);
426 std::vector<EnbTestData> v5;
429 TestCase::Duration::EXTENSIVE);
435 e6.
ues.push_back(u6);
436 std::vector<EnbTestData> v6;
439 TestCase::Duration::EXTENSIVE);
447 e7.
ues.push_back(u7);
448 std::vector<EnbTestData> v7;
451 TestCase::Duration::EXTENSIVE);
457 e8.
ues.push_back(u8);
458 std::vector<EnbTestData> v8;
461 TestCase::Duration::EXTENSIVE);
467 e9.
ues.push_back(u9);
468 std::vector<EnbTestData> v9;
471 TestCase::Duration::EXTENSIVE);
Test that e2e packet flow is correct.
LteEpcE2eDataTestCase(std::string name, std::vector< EnbTestData > v)
Constructor.
~LteEpcE2eDataTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
std::vector< EnbTestData > m_enbTestData
the ENB test data
Test that the S1-U interface implementation works correctly.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
AttributeValue implementation for Boolean.
Class for representing data rates.
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
This class contains the specification of EPS Bearers.
@ NGBR_VOICE_VIDEO_GAMING
Non-GBR Voice, Video, Interactive Streaming.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
a class to represent an Ipv4 address mask
Helper class that adds ns3::Ipv4StaticRouting objects.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
Helper class used to assign positions and mobility models to nodes.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void SetMobilityModel(std::string type, Ts &&... args)
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the 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.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Receive and consume traffic generated to an IP address and port.
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
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.
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory.
void SetDataDir(std::string directory)
Set the data directory where reference trace files can be found.
std::string GetName() const
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
Create an application which sends a UDP packet and waits for an echo of this packet.
Hold an unsigned integer type.
void Reset()
Reset the initial value of every attribute as well as the value of every global to what they were bef...
void SetDefault(std::string name, const AttributeValue &value)
void Set(std::string path, const AttributeValue &value)
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
LteEpcE2eDataTestSuite g_lteEpcE2eDataTestSuite
the test suite
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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.
Time interPacketInterval
the inter packet interval time
uint32_t numPkts
the number of packets
uint32_t pktSize
the packet size
BearerTestData(uint32_t n, uint32_t s, double i)
Constructor.
Ptr< PacketSink > dlServerApp
the DL server app
Ptr< Application > ulClientApp
the UL client app
Ptr< PacketSink > ulServerApp
the UL server app
Ptr< Application > dlClientApp
the DL client app
std::vector< UeTestData > ues
the list of UEs
std::vector< BearerTestData > bearers
the bearer test data
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
uint16_t localPortEnd
end of the port number range of the UE
uint16_t remotePortEnd
end of the port number range of the remote host
uint16_t remotePortStart
start of the port number range of the remote host
uint16_t localPortStart
start of the port number range of the UE
uint32_t pktSize
packet size used for the simulation (in bytes)