23 #include "ns3/simulator.h"
26 #include "ns3/lte-helper.h"
27 #include "ns3/epc-helper.h"
28 #include "ns3/packet-sink-helper.h"
29 #include "ns3/udp-client-server-helper.h"
30 #include "ns3/udp-echo-helper.h"
31 #include "ns3/point-to-point-helper.h"
32 #include "ns3/internet-stack-helper.h"
33 #include "ns3/ipv4-address-helper.h"
34 #include "ns3/inet-socket-address.h"
35 #include "ns3/packet-sink.h"
36 #include <ns3/ipv4-static-routing-helper.h>
37 #include <ns3/ipv4-static-routing.h>
38 #include "ns3/boolean.h"
39 #include "ns3/uinteger.h"
40 #include "ns3/double.h"
41 #include "ns3/abort.h"
42 #include "ns3/mobility-helper.h"
60 Time interPacketInterval;
69 BearerTestData::BearerTestData (uint32_t n, uint32_t s,
double i)
72 interPacketInterval (
Seconds (i))
78 std::vector<BearerTestData> bearers;
83 std::vector<UeTestData> ues;
94 virtual void DoRun (
void);
95 std::vector<EnbTestData> m_enbTestData;
99 LteEpcE2eDataTestCase::LteEpcE2eDataTestCase (std::string name, std::vector<EnbTestData> v)
106 LteEpcE2eDataTestCase::~LteEpcE2eDataTestCase ()
120 lteHelper->SetEpcHelper (epcHelper);
122 lteHelper->SetAttribute(
"PathlossModel",
126 epcHelper->SetAttribute (
"S1uLinkMtu",
UintegerValue (30000));
128 Ptr<Node> pgw = epcHelper->GetPgwNode ();
132 remoteHostContainer.
Create (1);
135 internet.
Install (remoteHostContainer);
144 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
153 remoteHostStaticRouting->AddNetworkRouteTo (
Ipv4Address (
"7.0.0.0"),
Ipv4Mask (
"255.255.255.0"), 1);
157 enbs.
Create (m_enbTestData.size ());
169 NetDeviceContainer::Iterator enbLteDevIt = enbLteDevs.
Begin ();
171 uint16_t ulPort = 1000;
173 for (std::vector<EnbTestData>::iterator enbit = m_enbTestData.begin ();
174 enbit < m_enbTestData.end ();
175 ++enbit, ++enbLteDevIt)
182 ues.
Create (enbit->ues.size ());
183 Vector enbPosition = (*enbLteDevIt)->GetNode ()->GetObject<
MobilityModel> ()->GetPosition ();
198 for (uint32_t u = 0; u < ues.GetN (); ++u)
206 ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
210 lteHelper->Attach (ueLteDevice, *enbLteDevIt);
213 uint16_t dlPort = 2000;
214 for (uint32_t b = 0; b < enbit->ues.at (u).bearers.size (); ++b)
216 BearerTestData& bearerTestData = enbit->ues.at (u).bearers.at (b);
223 bearerTestData.dlServerApp = apps.
Get (0)->GetObject<
PacketSink> ();
227 client.SetAttribute (
"Interval",
TimeValue (bearerTestData.interPacketInterval));
228 client.SetAttribute (
"PacketSize",
UintegerValue (bearerTestData.pktSize));
229 apps = client.Install (remoteHost);
231 bearerTestData.dlClientApp = apps.
Get (0);
239 bearerTestData.ulServerApp = apps.
Get (0)->GetObject<
PacketSink> ();
242 client.SetAttribute (
"MaxPackets",
UintegerValue (bearerTestData.numPkts));
243 client.SetAttribute (
"Interval",
TimeValue (bearerTestData.interPacketInterval));
244 client.SetAttribute (
"PacketSize",
UintegerValue (bearerTestData.pktSize));
245 apps = client.Install (ue);
247 bearerTestData.ulClientApp = apps.
Get (0);
250 EpsBearer epsBearer (EpsBearer::NGBR_VOICE_VIDEO_GAMING);
255 dlpf.localPortEnd = dlPort;
263 lteHelper->ActivateDedicatedEpsBearer (ueLteDevice, epsBearer, tft);
269 Config::Set (
"/NodeList/*/DeviceList/*/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/MaxTxBufferSize",
271 Config::Set (
"/NodeList/*/DeviceList/*/LteUeRrc/RadioBearerMap/*/LteRlc/MaxTxBufferSize",
277 double statsStartTime = 0.040;
278 lteHelper->EnablePdcpTraces ();
280 lteHelper->GetPdcpStats ()->SetAttribute (
"StartTime",
TimeValue (
Seconds (statsStartTime)));
281 lteHelper->GetPdcpStats ()->SetAttribute (
"EpochDuration",
TimeValue (simulationTime));
287 uint64_t imsiCounter = 0;
289 for (std::vector<EnbTestData>::iterator enbit = m_enbTestData.begin ();
290 enbit < m_enbTestData.end ();
293 for (std::vector<UeTestData>::iterator ueit = enbit->ues.begin ();
294 ueit < enbit->ues.end ();
297 uint64_t imsi = ++imsiCounter;
298 for (uint32_t b = 0; b < ueit->bearers.size (); ++b)
303 uint32_t expectedPkts = ueit->bearers.at (b).numPkts;
304 uint32_t expectedBytes = (ueit->bearers.at (b).numPkts) * (ueit->bearers.at (b).pktSize);
305 uint32_t txPktsPdcpDl = lteHelper->GetPdcpStats ()->GetDlTxPackets (imsi, lcid);
306 uint32_t rxPktsPdcpDl = lteHelper->GetPdcpStats ()->GetDlRxPackets (imsi, lcid);
307 uint32_t txPktsPdcpUl = lteHelper->GetPdcpStats ()->GetUlTxPackets (imsi, lcid);
308 uint32_t rxPktsPdcpUl = lteHelper->GetPdcpStats ()->GetUlRxPackets (imsi, lcid);
309 uint32_t rxBytesDl = ueit->bearers.at (b).dlServerApp->GetTotalRx ();
310 uint32_t rxBytesUl = ueit->bearers.at (b).ulServerApp->GetTotalRx ();
313 NS_TEST_ASSERT_MSG_EQ (txPktsPdcpDl,
315 "wrong TX PDCP packets in downlink for IMSI=" << imsi <<
" LCID=" << (uint16_t) lcid);
317 NS_TEST_ASSERT_MSG_EQ (rxPktsPdcpDl,
319 "wrong RX PDCP packets in downlink for IMSI=" << imsi <<
" LCID=" << (uint16_t) lcid);
320 NS_TEST_ASSERT_MSG_EQ (txPktsPdcpUl,
322 "wrong TX PDCP packets in uplink for IMSI=" << imsi <<
" LCID=" << (uint16_t) lcid);
323 NS_TEST_ASSERT_MSG_EQ (rxPktsPdcpUl,
325 "wrong RX PDCP packets in uplink for IMSI=" << imsi <<
" LCID=" << (uint16_t) lcid);
327 NS_TEST_ASSERT_MSG_EQ (rxBytesDl,
329 "wrong total received bytes in downlink");
330 NS_TEST_ASSERT_MSG_EQ (rxBytesUl,
332 "wrong total received bytes in uplink");
352 } g_lteEpcE2eDataTestSuite;
354 LteEpcE2eDataTestSuite::LteEpcE2eDataTestSuite ()
357 std::vector<EnbTestData> v1;
361 u1.bearers.push_back (f1);
362 e1.ues.push_back (u1);
366 std::vector<EnbTestData> v2;
370 u2_1.bearers.push_back (f2_1);
371 e2.ues.push_back (u2_1);
374 u2_2.bearers.push_back (f2_2);
375 e2.ues.push_back (u2_2);
379 std::vector<EnbTestData> v3;
387 u4_1.bearers.push_back (f4_1);
388 e4.ues.push_back (u4_1);
391 u4_2.bearers.push_back (f4_2);
392 e4.ues.push_back (u4_2);
395 u4_3.bearers.push_back (f4_3);
396 e4.ues.push_back (u4_3);
397 std::vector<EnbTestData> v4;
406 u5.bearers.push_back (f5);
407 e5.ues.push_back (u5);
408 std::vector<EnbTestData> v5;
416 u6.bearers.push_back (f6);
417 e6.ues.push_back (u6);
418 std::vector<EnbTestData> v6;
425 u7.bearers.push_back (f7_1);
427 u7.bearers.push_back (f7_2);
428 e7.ues.push_back (u7);
429 std::vector<EnbTestData> v7;
436 u8.bearers.push_back (f8);
437 e8.ues.push_back (u8);
438 std::vector<EnbTestData> v8;
446 u9.bearers.push_back (f9);
447 e9.ues.push_back (u9);
448 std::vector<EnbTestData> v9;
holds a vector of ns3::Application pointers.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
static Ipv4Address GetAny(void)
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
holds a vector of std::pair of Ptr<Ipv4> and interface index.
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
create an application which sends a udp packet and waits for an echo of this packet ...
#define NS_LOG_COMPONENT_DEFINE(name)
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
void Set(std::string path, const AttributeValue &value)
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Class for representing data rates.
Keep track of the current position and velocity of an object.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
hold objects of type ns3::Time
virtual void DoRun(void)
Implementation to actually run this test case.
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
static void Destroy(void)
#define NS_ABORT_IF(cond)
Abnormal program termination if cond is true.
Access to the Ipv4 forwarding table, interfaces, and configuration.
void SetDefault(std::string name, const AttributeValue &value)
keep track of a set of node pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
void Install(std::string nodeName) const
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Helper class used to assign positions and mobility models to nodes.
Ipv4 addresses are stored in host order in this class.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Helper class that adds ns3::Ipv4StaticRouting objects.
hold objects of type ns3::DataRate
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
ApplicationContainer Install(NodeContainer c) const
std::string GetName(void) const
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetAttribute(std::string name, const AttributeValue &value)
Receive and consume traffic generated to an IP address and port.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Hold an floating point type.
Ptr< T > GetObject(void) const
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const