15#include "ns3/arp-cache.h"
16#include "ns3/boolean.h"
17#include "ns3/config.h"
18#include "ns3/csma-helper.h"
19#include "ns3/epc-enb-application.h"
20#include "ns3/eps-bearer-tag.h"
21#include "ns3/inet-socket-address.h"
22#include "ns3/internet-stack-helper.h"
23#include "ns3/ipv4-address-helper.h"
25#include "ns3/packet-sink-helper.h"
26#include "ns3/packet-sink.h"
27#include "ns3/point-to-point-epc-helper.h"
28#include "ns3/point-to-point-helper.h"
29#include "ns3/seq-ts-header.h"
30#include "ns3/simulator.h"
32#include "ns3/uinteger.h"
33#include <ns3/ipv4-interface.h>
34#include <ns3/ipv4-static-routing-helper.h>
35#include <ns3/ipv4-static-routing.h>
36#include <ns3/mac48-address.h>
113 TypeId(
"ns3::EpsBearerTagUdpClient")
115 .AddConstructor<EpsBearerTagUdpClient>()
118 "The maximum number of packets the application will send (zero means infinite)",
122 .AddAttribute(
"Interval",
123 "The time to wait between packets",
127 .AddAttribute(
"RemoteAddress",
128 "The destination Ipv4Address of the outbound packets",
132 .AddAttribute(
"RemotePort",
133 "The destination port of the outbound packets",
137 .AddAttribute(
"PacketSize",
138 "Size of packets generated. The minimum packet size is 12 bytes which is "
139 "the size of the header carrying the sequence number and the time stamp.",
220 p->AddPacketTag(tag);
281 std::vector<UeUlTestData>
ues;
302 void DoRun()
override;
329 remoteHostContainer.
Create(1);
332 internet.Install(remoteHostContainer);
339 ipv4h.
SetBase(
"1.0.0.0",
"255.0.0.0");
348 remoteHostStaticRouting->AddNetworkRouteTo(
Ipv4Address(
"7.0.0.0"),
352 uint16_t udpSinkPort = 1234;
355 uint16_t cellIdCounter = 0;
356 uint64_t imsiCounter = 0;
367 uint16_t cellId = ++cellIdCounter;
370 ues.
Create(enbit->ues.size());
383 std::vector<uint16_t> cellIds;
384 cellIds.push_back(cellId);
385 epcHelper->AddEnb(enb, enbDevice, cellIds);
391 enb->AggregateObject(rrc);
392 rrc->SetS1SapProvider(enbApp->GetS1SapProvider());
393 enbApp->SetS1SapUser(rrc->GetS1SapUser());
397 internet.Install(ues);
416 Ipv4Address gwAddr = epcHelper->GetUeDefaultGatewayAddress();
418 ueStaticRouting->SetDefaultRoute(gwAddr, 1);
425 int32_t ueLteIpv4IfIndex = ueIpv4->GetInterfaceForDevice(ueLteDevice);
429 ueArpCache->SetAliveTimeout(
Seconds(1000));
435 "ns3::UdpSocketFactory",
440 enbit->ues[u].serverApp = sinkApp.
Get(0)->GetObject<
PacketSink>();
445 client->SetAttribute(
"RemoteAddress",
447 client->SetAttribute(
"RemotePort",
UintegerValue(udpSinkPort));
448 client->SetAttribute(
"MaxPackets",
UintegerValue(enbit->ues[u].numPkts));
449 client->SetAttribute(
"Interval",
TimeValue(interPacketInterval));
450 client->SetAttribute(
"PacketSize",
UintegerValue(enbit->ues[u].pktSize));
451 ue->AddApplication(client);
453 clientApp.
Add(client);
456 enbit->ues[u].clientApp = client;
458 uint64_t imsi = ++imsiCounter;
459 epcHelper->AddUe(ueLteDevice, imsi);
460 epcHelper->ActivateEpsBearer(ueLteDevice,
466 enbApp->GetS1SapProvider(),
478 for (
auto ueit = enbit->ues.begin(); ueit < enbit->ues.end(); ++ueit)
481 (ueit->numPkts) * (ueit->pktSize),
482 "wrong total received bytes");
502 std::vector<EnbUlTestData> v1;
505 e1.
ues.push_back(f1);
509 std::vector<EnbUlTestData> v2;
512 e2.
ues.push_back(f2_1);
514 e2.
ues.push_back(f2_2);
518 std::vector<EnbUlTestData> v3;
525 e3.
ues.push_back(f3_1);
527 e3.
ues.push_back(f3_2);
529 e3.
ues.push_back(f3_2);
530 std::vector<EnbUlTestData> v4;
536 std::vector<EnbUlTestData> v5;
539 e5.
ues.push_back(f5);
542 TestCase::Duration::QUICK);
544 std::vector<EnbUlTestData> v6;
547 e6.
ues.push_back(f6);
550 TestCase::Duration::QUICK);
552 std::vector<EnbUlTestData> v7;
555 e7.
ues.push_back(f7);
558 TestCase::Duration::QUICK);
560 std::vector<EnbUlTestData> v8;
563 e8.
ues.push_back(f8);
566 TestCase::Duration::QUICK);
EpcS1uUlTestCase(std::string name, std::vector< EnbUlTestData > v)
Constructor.
std::vector< EnbUlTestData > m_enbUlTestData
ENB UL test data.
~EpcS1uUlTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
Test that the S1-U interface implementation works correctly.
uint16_t m_peerPort
the destination port of the outbound packets
void SetRemote(Ipv4Address ip, uint16_t port)
set the remote address and port
uint32_t m_count
maximum number of packets to send
uint32_t m_sent
number of packets sent
~EpsBearerTagUdpClient() override
void ScheduleTransmit(Time dt)
Schedule transmit function.
Ptr< Socket > m_socket
the socket
uint32_t m_size
the size of packets generated
void StartApplication() override
Application specific startup code.
uint8_t m_bid
the bearer identificator
void StopApplication() override
Application specific shutdown code.
EventId m_sendEvent
the send event
void Send()
Send function.
Ipv4Address m_peerAddress
the peer address of the outbound packets
void DoDispose() override
Destructor implementation.
Time m_interval
the time between packets
static TypeId GetTypeId()
Get the type ID.
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.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
The base class for all ns3 applications.
void DoDispose() override
Destructor implementation.
Ptr< Node > GetNode() const
A record that that holds information about an ArpCache entry.
void MarkPermanent()
Changes the state of this entry to Permanent.
void SetMacAddress(Address macAddress)
build a set of CsmaNetDevice objects
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
Class for representing data rates.
This application is installed inside eNBs and provides the bridge functionality for user data plane p...
virtual void InitialUeMessage(uint64_t imsi, uint16_t rnti)=0
Initial UE message.
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
This class contains the specification of EPS Bearers.
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
An identifier for simulation events.
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
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
Implement the IPv4 layer.
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...
static Mac48Address GetBroadcast()
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in 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.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
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.
NetDeviceContainer Install(NodeContainer c)
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
EpcS1uUlTestSuite g_epcS1uUlTestSuiteInstance
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Callback< R, Args... > MakeNullCallback()
void SetDefault(std::string name, const AttributeValue &value)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
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.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeIpv4AddressAccessor(T1 a1)
Ptr< const AttributeChecker > MakeIpv4AddressChecker()
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Custom structure containing information about data sent in the uplink of eNodeB.
std::vector< UeUlTestData > ues
the list of UEs
Custom test structure to hold information of data transmitted in the uplink per UE.
uint32_t numPkts
the number of packets sent
uint32_t pktSize
the packet size
Ptr< PacketSink > serverApp
the server application
UeUlTestData(uint32_t n, uint32_t s, uint16_t r, uint8_t l)
Constructor.
Ptr< Application > clientApp
the client application
uint32_t pktSize
packet size used for the simulation (in bytes)