|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
23 #include "ns3/simulator.h"
26 #include "ns3/point-to-point-epc-helper.h"
27 #include "ns3/epc-enb-application.h"
28 #include "ns3/packet-sink-helper.h"
29 #include "ns3/udp-echo-helper.h"
30 #include "ns3/point-to-point-helper.h"
31 #include "ns3/csma-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/config.h"
41 #include "ns3/eps-bearer.h"
87 std::vector<UeDlTestData>
ues;
111 virtual void DoRun (
void);
138 remoteHostContainer.
Create (1);
141 internet.
Install (remoteHostContainer);
148 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
149 ipv4h.
Assign (internetDevices);
162 uint16_t cellIdCounter = 0;
163 uint64_t imsiCounter = 0;
165 for (std::vector<EnbDlTestData>::iterator enbit =
m_enbDlTestData.begin ();
176 uint16_t cellId = ++cellIdCounter;
179 ues.
Create (enbit->ues.size ());
192 epcHelper->
AddEnb (enb, enbDevice, cellId);
196 NS_ASSERT_MSG (enbApp != 0,
"cannot retrieve EpcEnbApplication");
207 for (uint32_t u = 0; u < ues.
GetN (); ++u)
219 uint16_t
port = 1234;
231 apps = client.
Install (remoteHost);
234 enbit->ues[u].clientApp = apps.
Get (0);
236 uint64_t imsi = ++imsiCounter;
237 epcHelper->
AddUe (ueLteDevice, imsi);
240 &EpcEnbS1SapProvider::InitialUeMessage,
248 for (std::vector<EnbDlTestData>::iterator enbit =
m_enbDlTestData.begin ();
252 for (std::vector<UeDlTestData>::iterator ueit = enbit->ues.begin ();
253 ueit < enbit->ues.end ();
256 NS_TEST_ASSERT_MSG_EQ (ueit->serverApp->GetTotalRx (), (ueit->numPkts) * (ueit->pktSize),
"wrong total received bytes");
260 Simulator::Destroy ();
280 std::vector<EnbDlTestData> v1;
283 e1.
ues.push_back (f1);
288 std::vector<EnbDlTestData> v2;
291 e2.
ues.push_back (f2_1);
293 e2.
ues.push_back (f2_2);
298 std::vector<EnbDlTestData> v3;
306 e3.
ues.push_back (f3_1);
308 e3.
ues.push_back (f3_2);
310 e3.
ues.push_back (f3_2);
311 std::vector<EnbDlTestData> v4;
317 std::vector<EnbDlTestData> v5;
320 e5.
ues.push_back (f5);
324 std::vector<EnbDlTestData> v6;
327 e6.
ues.push_back (f6);
331 std::vector<EnbDlTestData> v7;
334 e7.
ues.push_back (f7);
338 std::vector<EnbDlTestData> v8;
341 e8.
ues.push_back (f8);
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
AttributeValue implementation for DataRate.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ptr< Application > GetApplication(uint32_t index) const
Retrieve the index-th Application associated to this node.
AttributeValue implementation for Boolean.
This application is installed inside eNBs and provides the bridge functionality for user data plane p...
virtual Ptr< Node > GetPgwNode() const
Get the PGW node.
virtual void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, uint16_t cellId)
Add an eNB to the EPC.
void SetS1SapProvider(EpcEnbS1SapProvider *s)
Set the S1 SAP Provider.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
Create an application which sends a UDP packet and waits for an echo of this packet.
Test that the S1-U interface implementation works correctly.
void SetS1SapUser(EpcEnbS1SapUser *s)
Set the S1 SAP User.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Custom structure for testing eNodeB downlink data, contains the list of data structures for UEs.
NetDeviceContainer Install(NodeContainer c)
Ipv4 addresses are stored in host order in this class.
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
std::vector< EnbDlTestData > m_enbDlTestData
ENB DL test data.
uint32_t pktSize
packet size
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
build a set of CsmaNetDevice objects
virtual uint8_t ActivateEpsBearer(Ptr< NetDevice > ueLteDevice, uint64_t imsi, Ptr< EpcTft > tft, EpsBearer bearer)
Activate an EPS bearer, setting up the corresponding S1-U tunnel.
uint32_t numPkts
number of packets
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Access to the IPv4 forwarding table, interfaces, and configuration.
Helper class that adds ns3::Ipv4StaticRouting objects.
Class for representing data rates.
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...
Ptr< Application > clientApp
Client application.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
std::vector< UeDlTestData > ues
list of data structure for different UEs
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
ApplicationContainer Install(Ptr< Node > node) const
Create a udp echo client application on the specified node.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< PacketSink > serverApp
Server application.
Simulation virtual time values and global simulation resolution.
UeDlTestData(uint32_t n, uint32_t s)
Constructor.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
virtual void AddUe(Ptr< NetDevice > ueLteDevice, uint64_t imsi)
Notify the EPC of the existence of a new UE which might attach at a later time.
virtual void DoRun(void)
Implementation to actually run this TestCase.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
#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.
This class contains the specification of EPS Bearers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
holds a vector of ns3::Application pointers.
uint32_t pktSize
packet size used for the simulation (in bytes)
AttributeValue implementation for Time.
Build a set of PointToPointNetDevice objects.
keep track of a set of node pointers.
a class to represent an Ipv4 address mask
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a network route to the static routing table.
EpcEnbS1SapProvider * GetS1SapProvider()
virtual ~EpcS1uDlTestCase()
Receive and consume traffic generated to an IP address and port.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
EpcEnbS1SapUser * GetS1SapUser()
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
void SetDefault(std::string name, const AttributeValue &value)
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
EpcS1uDlTestCase(std::string name, std::vector< EnbDlTestData > v)
Constructor.
aggregate IP/TCP/UDP functionality to existing Nodes.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
EpcS1uDlTestSuite g_epcS1uDlTestSuiteInstance
Custom structure for testing UE downlink data.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...