27 #include "ns3/simulator.h"
30 #include "ns3/point-to-point-epc-helper.h"
31 #include "ns3/epc-enb-application.h"
32 #include "ns3/packet-sink-helper.h"
33 #include "ns3/point-to-point-helper.h"
34 #include "ns3/csma-helper.h"
35 #include "ns3/internet-stack-helper.h"
36 #include "ns3/ipv4-address-helper.h"
37 #include "ns3/inet-socket-address.h"
38 #include "ns3/packet-sink.h"
39 #include <ns3/ipv4-static-routing-helper.h>
40 #include <ns3/ipv4-static-routing.h>
41 #include <ns3/ipv4-interface.h>
42 #include <ns3/mac48-address.h>
43 #include "ns3/seq-ts-header.h"
44 #include "ns3/eps-bearer-tag.h"
45 #include "ns3/arp-cache.h"
46 #include "ns3/boolean.h"
47 #include "ns3/uinteger.h"
48 #include "ns3/config.h"
116 static TypeId tid =
TypeId (
"ns3::EpsBearerTagUdpClient")
118 .AddConstructor<EpsBearerTagUdpClient> ()
119 .AddAttribute (
"MaxPackets",
120 "The maximum number of packets the application will send",
123 MakeUintegerChecker<uint32_t> ())
124 .AddAttribute (
"Interval",
125 "The time to wait between packets",
TimeValue (Seconds (1.0)),
130 "The destination Ipv4Address of the outbound packets",
133 MakeIpv4AddressChecker ())
134 .AddAttribute (
"RemotePort",
"The destination port of the outbound packets",
137 MakeUintegerChecker<uint16_t> ())
138 .AddAttribute (
"PacketSize",
139 "Size of packets generated. The minimum packet size is 12 bytes which is the size of the header carrying the sequence number and the time stamp.",
142 MakeUintegerChecker<uint32_t> ())
247 UeUlTestData (uint32_t n, uint32_t
s, uint16_t r, uint8_t l);
268 std::vector<UeUlTestData>
ues;
279 virtual void DoRun (
void);
298 Ptr<Node> pgw = epcHelper->GetPgwNode ();
303 epcHelper->SetAttribute (
"S1uLinkMtu",
UintegerValue (30000));
307 remoteHostContainer.
Create (1);
310 internet.
Install (remoteHostContainer);
317 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
325 remoteHostStaticRouting->AddNetworkRouteTo (
Ipv4Address (
"7.0.0.0"),
Ipv4Mask (
"255.255.255.0"), 1);
329 uint16_t udpSinkPort = 1234;
332 uint16_t cellIdCounter = 0;
334 for (std::vector<EnbUlTestData>::iterator enbit =
m_enbUlTestData.begin ();
345 uint16_t cellId = ++cellIdCounter;
348 ues.
Create (enbit->ues.size ());
361 epcHelper->AddEnb (enb, enbDevice, cellId);
365 NS_ASSERT_MSG (enbApp != 0,
"cannot retrieve EpcEnbApplication");
367 rrc->SetS1SapProvider (enbApp->GetS1SapProvider ());
368 enbApp->SetS1SapUser (rrc->GetS1SapUser ());
375 for (uint32_t u = 0; u < ues.
GetN (); ++u)
386 ueIpv4->SetAttribute (
"IpForward",
BooleanValue (
false));
390 Ipv4Address gwAddr = epcHelper->GetUeDefaultGatewayAddress ();
392 ueStaticRouting->SetDefaultRoute (gwAddr, 1);
399 int32_t ueLteIpv4IfIndex = ueIpv4->GetInterfaceForDevice (ueLteDevice);
401 Ptr<Ipv4Interface> ueLteIpv4Iface = ueIpv4L3Protocol->GetInterface (ueLteIpv4IfIndex);
412 sinkApp.
Start (Seconds (1.0));
413 sinkApp.
Stop (Seconds (10.0));
414 enbit->ues[u].serverApp = sinkApp.
Get (0)->GetObject<
PacketSink> ();
416 Time interPacketInterval = Seconds (0.01);
419 client->SetAttribute (
"RemotePort",
UintegerValue (udpSinkPort));
420 client->SetAttribute (
"MaxPackets",
UintegerValue (enbit->ues[u].numPkts));
421 client->SetAttribute (
"Interval",
TimeValue (interPacketInterval));
422 client->SetAttribute (
"PacketSize",
UintegerValue (enbit->ues[u].pktSize));
425 clientApp.
Add (client);
426 clientApp.
Start (Seconds (2.0));
427 clientApp.
Stop (Seconds (10.0));
428 enbit->ues[u].clientApp = client;
431 epcHelper->AddUe (ueLteDevice, imsi);
433 enbApp->GetS1SapProvider ()->InitialUeMessage (imsi, (uint16_t) imsi);
443 for (std::vector<EnbUlTestData>::iterator enbit =
m_enbUlTestData.begin ();
447 for (std::vector<UeUlTestData>::iterator ueit = enbit->ues.begin ();
448 ueit < enbit->ues.end ();
451 NS_TEST_ASSERT_MSG_EQ (ueit->serverApp->GetTotalRx (), (ueit->numPkts) * (ueit->pktSize),
"wrong total received bytes");
475 std::vector<EnbUlTestData> v1;
478 e1.
ues.push_back (f1);
483 std::vector<EnbUlTestData> v2;
486 e2.
ues.push_back (f2_1);
488 e2.
ues.push_back (f2_2);
493 std::vector<EnbUlTestData> v3;
501 e3.
ues.push_back (f3_1);
503 e3.
ues.push_back (f3_2);
505 e3.
ues.push_back (f3_2);
506 std::vector<EnbUlTestData> v4;
512 std::vector<EnbUlTestData> v5;
515 e5.
ues.push_back (f5);
519 std::vector<EnbUlTestData> v6;
522 e6.
ues.push_back (f6);
526 std::vector<EnbUlTestData> v7;
529 e7.
ues.push_back (f7);
533 std::vector<EnbUlTestData> v8;
536 e8.
ues.push_back (f8);
std::vector< EnbUlTestData > m_enbUlTestData
holds a vector of ns3::Application pointers.
uint32_t AddApplication(Ptr< Application > application)
keep track of time values and allow control of global simulation resolution
static Ipv4Address GetAny(void)
ArpCache::Entry * Add(Ipv4Address to)
Add an Ipv4Address to this ARP cache.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
holds a vector of std::pair of Ptr and interface index.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
void ScheduleTransmit(Time dt)
void AddPacketTag(const Tag &tag) const
Add a packet tag.
ns3::EpcS1uUlTestSuite g_epcS1uUlTestSuiteInstance
uint64_t GetUid(void) const
A packet is allocated a new uid when it is created empty or with zero-filled payload.
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
Ptr< PacketSink > serverApp
#define NS_ASSERT(condition)
static void Run(void)
Run the simulation until one of:
aggregate IP/TCP/UDP functionality to existing Nodes.
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
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...
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Callback< R > MakeNullCallback(void)
Build a set of PointToPointNetDevice objects.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
virtual void StopApplication(void)
Application specific shutdown code.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
Class for representing data rates.
virtual void DoRun(void)
Implementation to actually run this TestCase.
This class contains the specification of EPS Bearers.
Ptr< Application > GetApplication(uint32_t index) const
void SetRemote(Ipv4Address ip, uint16_t port)
set the remote address and port
The base class for all ns3 applications.
hold objects of type ns3::Time
void MarkWaitReply(Ptr< Packet > waiting)
Hold an unsigned integer type.
std::vector< UeUlTestData > ues
holds a vector of ns3::NetDevice pointers
Ptr< Node > GetNode() const
static Mac48Address GetBroadcast(void)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
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...
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)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
Access to the Ipv4 forwarding table, interfaces, and configuration.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
void SetAliveTimeout(Time aliveTimeout)
Set the time the entry will be in ALIVE state (unless refreshed)
void SetDefault(std::string name, const AttributeValue &value)
Implement the Ipv4 layer.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
keep track of a set of node pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr
stored in this container at a given index.
EpcS1uUlTestCase(std::string name, std::vector< EnbUlTestData > v)
void MarkAlive(Address macAddress)
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A record that that holds information about an ArpCache entry.
hold objects of type ns3::Ipv4Address
Test that the S1-U interface implementation works correctly.
static Time Now(void)
Return the "current simulation time".
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
build a set of CsmaNetDevice objects
#define NS_ASSERT_MSG(condition, message)
Ipv4 addresses are stored in host order in this class.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
This application is installed inside eNBs and provides the bridge functionality for user data plane p...
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
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...
virtual ~EpsBearerTagUdpClient()
an identifier for simulation events.
Helper class that adds ns3::Ipv4StaticRouting objects.
hold objects of type ns3::DataRate
static TypeId GetTypeId(void)
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
virtual ~EpcS1uUlTestCase()
Ptr< Application > clientApp
Ipv4Address m_peerAddress
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
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.
Receive and consume traffic generated to an IP address and port.
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
Ptr< T > GetObject(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
UeUlTestData(uint32_t n, uint32_t s, uint16_t r, uint8_t l)
void AddHeader(const Header &header)
Add header to this packet.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
virtual void StartApplication(void)
Application specific startup code.
#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.
static TypeId LookupByName(std::string name)
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...