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" 96 virtual void DoDispose (
void);
100 virtual void StartApplication (
void);
101 virtual void StopApplication (
void);
107 void ScheduleTransmit (
Time dt);
131 static TypeId tid =
TypeId (
"ns3::EpsBearerTagUdpClient")
133 .AddConstructor<EpsBearerTagUdpClient> ()
134 .AddAttribute (
"MaxPackets",
135 "The maximum number of packets the application will send",
138 MakeUintegerChecker<uint32_t> ())
139 .AddAttribute (
"Interval",
145 "The destination Ipv4Address of the outbound packets",
149 .AddAttribute (
"RemotePort",
"The destination port of the outbound packets",
152 MakeUintegerChecker<uint16_t> ())
153 .AddAttribute (
"PacketSize",
154 "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.",
157 MakeUintegerChecker<uint32_t> ())
198 Application::DoDispose ();
208 TypeId tid = TypeId::LookupByName (
"ns3::UdpSocketFactory");
276 UeUlTestData (uint32_t
n, uint32_t s, uint16_t r, uint8_t l);
304 std::vector<UeUlTestData>
ues;
327 virtual void DoRun (
void);
355 remoteHostContainer.
Create (1);
358 internet.
Install (remoteHostContainer);
365 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
377 uint16_t udpSinkPort = 1234;
380 uint16_t cellIdCounter = 0;
382 for (std::vector<EnbUlTestData>::iterator enbit =
m_enbUlTestData.begin ();
393 uint16_t cellId = ++cellIdCounter;
396 ues.
Create (enbit->ues.size ());
409 epcHelper->
AddEnb (enb, enbDevice, cellId);
413 NS_ASSERT_MSG (enbApp != 0,
"cannot retrieve EpcEnbApplication");
423 for (uint32_t u = 0; u < ues.
GetN (); ++u)
453 arpCacheEntry->
SetMacAddress (Mac48Address::GetBroadcast ());
473 clientApp.
Add (client);
476 enbit->ues[u].clientApp = client;
479 epcHelper->
AddUe (ueLteDevice, imsi);
491 for (std::vector<EnbUlTestData>::iterator enbit =
m_enbUlTestData.begin ();
495 for (std::vector<UeUlTestData>::iterator ueit = enbit->ues.begin ();
496 ueit < enbit->ues.end ();
499 NS_TEST_ASSERT_MSG_EQ (ueit->serverApp->GetTotalRx (), (ueit->numPkts) * (ueit->pktSize),
"wrong total received bytes");
503 Simulator::Destroy ();
523 std::vector<EnbUlTestData> v1;
526 e1.
ues.push_back (f1);
531 std::vector<EnbUlTestData> v2;
534 e2.
ues.push_back (f2_1);
536 e2.
ues.push_back (f2_2);
541 std::vector<EnbUlTestData> v3;
549 e3.
ues.push_back (f3_1);
551 e3.
ues.push_back (f3_2);
553 e3.
ues.push_back (f3_2);
554 std::vector<EnbUlTestData> v4;
560 std::vector<EnbUlTestData> v5;
563 e5.
ues.push_back (f5);
567 std::vector<EnbUlTestData> v6;
570 e6.
ues.push_back (f6);
574 std::vector<EnbUlTestData> v7;
577 e7.
ues.push_back (f7);
581 std::vector<EnbUlTestData> v8;
584 e8.
ues.push_back (f8);
virtual ~EpsBearerTagUdpClient()
virtual void DoRun(void)
Implementation to actually run this TestCase.
holds a vector of ns3::Application pointers.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
void MarkPermanent(void)
Changes the state of this entry to Permanent.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
uint64_t GetUid(void) const
Returns the packet's Uid.
Simulation virtual time values and global simulation resolution.
Test that the S1-U interface implementation works correctly.
AttributeValue implementation for Boolean.
void SetMacAddress(Address macAddress)
ArpCache::Entry * Add(Ipv4Address to)
Add an Ipv4Address to this ARP cache.
uint32_t m_count
maximum number of packets to send
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
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. ...
EpcS1uUlTestCase(std::string name, std::vector< EnbUlTestData > v)
Constructor.
Ptr< Application > clientApp
the client application
virtual Ptr< Node > GetPgwNode()
virtual ~EpcS1uUlTestCase()
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint8_t m_bid
the bearer identificator
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
aggregate IP/TCP/UDP functionality to existing Nodes.
uint32_t m_sent
number of packets sent
EventId m_sendEvent
the send event
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Callback< R > MakeNullCallback(void)
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 Send(void)
Send function.
uint16_t m_peerPort
the destination port of the outbound packets
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
virtual void DoDispose(void)
Destructor implementation.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Class for representing data rates.
virtual void StartApplication(void)
Application specific startup code.
void SetS1SapUser(EpcEnbS1SapUser *s)
Set the S1 SAP User.
This class contains the specification of EPS Bearers.
uint32_t m_size
the size of packets generated
Time m_interval
the time between packets
The base class for all ns3 applications.
AttributeValue implementation for Time.
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.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
std::vector< EnbUlTestData > m_enbUlTestData
ENB UL test data.
Ptr< const AttributeChecker > MakeIpv4AddressChecker(void)
Hold an unsigned integer type.
#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.
Ptr< Ipv4Interface > GetInterface(uint32_t i) const
Get an interface.
Ptr< Application > GetApplication(uint32_t index) const
Retrieve the index-th Application associated to this node.
holds a vector of ns3::NetDevice pointers
void SetRemote(Ipv4Address ip, uint16_t port)
set the remote address and port
Ptr< Socket > m_socket
the socket
static TypeId GetTypeId(void)
Get the type ID.
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
Custom structure containing information about data sent in the uplink of eNodeB.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
void SetS1SapProvider(EpcEnbS1SapProvider *s)
Set the S1 SAP Provider.
EpcEnbS1SapUser * GetS1SapUser()
Ptr< Node > GetNode() const
virtual void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, uint16_t cellId)
Add an eNB to the EPC.
std::vector< UeUlTestData > ues
the list of UEs
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
Access to the IPv4 forwarding table, interfaces, and configuration.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void SetAliveTimeout(Time aliveTimeout)
Set the time the entry will be in ALIVE state (unless refreshed)
Implement the IPv4 layer.
virtual Ipv4Address GetUeDefaultGatewayAddress()
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
EpcEnbS1SapProvider * GetS1SapProvider()
A record that that holds information about an ArpCache entry.
AttributeValue implementation for Ipv4Address.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
UeUlTestData(uint32_t n, uint32_t s, uint16_t r, uint8_t l)
Constructor.
build a set of CsmaNetDevice objects
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
virtual void InitialUeMessage(uint64_t imsi, uint16_t rnti)=0
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a network route to the static routing table.
Ipv4 addresses are stored in host order in this class.
uint32_t pktSize
the packet size
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...
Ptr< PacketSink > serverApp
the server application
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
An identifier for simulation events.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Helper class that adds ns3::Ipv4StaticRouting objects.
AttributeValue implementation for DataRate.
Time Seconds(double value)
Construct a Time in the indicated unit.
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
void SetDefault(std::string name, const AttributeValue &value)
virtual void StopApplication(void)
Application specific shutdown code.
virtual int32_t GetInterfaceForDevice(Ptr< const NetDevice > device) const =0
uint32_t numPkts
the number of packets sent
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Ipv4Address m_peerAddress
the peer address of the outbound packets
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< const AttributeAccessor > MakeIpv4AddressAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
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.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
Custom test structure to hold information of data transmitted in the uplink per UE.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void AddHeader(const Header &header)
Add header to this packet.
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...
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
EpcS1uUlTestSuite g_epcS1uUlTestSuiteInstance