A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::FlentApplication Class Reference

Flent is a network benchmarking tool. More...

#include "flent-application.h"

Inheritance diagram for ns3::FlentApplication:
Collaboration diagram for ns3::FlentApplication:

Classes

struct  Output
 Flent output document, in JSON format. More...

Public Member Functions

 FlentApplication ()
 ~FlentApplication () override
Public Member Functions inherited from ns3::Application
 Application ()
 ~Application () override
virtual int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this Application object.
Ptr< Node > GetNode () const
void SetNode (Ptr< Node > node)
void SetStartTime (Time start)
 Specify application start time.
void SetStopTime (Time stop)
 Specify application stop time.
Public Member Functions inherited from ns3::Object
 Object ()
 Caller graph was not generated because of its size.
 ~Object () override
 Destructor.
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
void Dispose ()
 Dispose of this Object.
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
TypeId GetInstanceTypeId () const final
 Get the most derived TypeId for this Object.
template<>
Ptr< Object > GetObject () const
 Specialization of () for objects of type ns3::Object.
template<typename T>
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
template<>
Ptr< Object > GetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
template<typename T>
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
bool IsInitialized () const
 Check if the object has been initialized.
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
uint32_t GetReferenceCount () const
 Get the reference count of the object.
SimpleRefCount & operator= (const SimpleRefCount &o)
 Assignment operator.
void Ref () const
 Increment the reference count.
void Unref () const
 Decrement the reference count.
Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
Static Public Member Functions inherited from ns3::Application
static TypeId GetTypeId ()
 Get the type ID.
Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.

Protected Member Functions

void DoDispose () override
void DoInitialize () override
 In this method, the following tasks are performed: 1) set the host node, which is derived from the host address.
Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.

Private Member Functions

void AddMetadata ()
 Add Flent metadata to the output document.
void FillXValues ()
 Fill x_values parameter in Flent file.
Ptr< Node > GetHostNode (Ipv4Address hostAddress) const
 Iterates through the node list and finds the node pointer for the given hostAddress.
std::string GetUtcFormatTime () const
 Calculate the Time in UTC time format from the number of seconds.
void GoodputSamplingDownload (std::string name, int i)
 Goodput calculation for the i-th flow based on the bytes received.
void GoodputSamplingUpload (std::string name, int i)
 Goodput calculation for the i-th flow based on the bytes sent.
void ProcessRawValues ()
 Process raw values and add the processed result in the Flent file.
void StartApplication () override
 Application specific startup code.
void StopApplication () override
 Application specific shutdown code.
void TraceReceivedPacket (std::size_t idx, Ptr< const Packet > packet, const Address &address)
 sink for packet received.
void TraceReceivedPing (uint16_t seq, Time rtt)
 Ping RTT Trace function.
void TraceReceivedUdpPing (std::size_t idx, Ptr< const Packet > packet, const Address &address, const Address &localAddress, const SeqTsEchoHeader &header)
 UDP Ping RTT Trace function.
void TraceSentPacket (std::size_t idx, Ptr< const Packet > packet)
 sink for packet transmissions.

Private Attributes

std::array< Ptr< BulkSendApplication >, 4 > m_bulkSendDown
 BulkSend Applications for Download flows (tcp_download, rrul tests).
std::array< Ptr< BulkSendApplication >, 4 > m_bulkSendUp
 BulkSend Applications for Upload flows (tcp_upload, rrul tests).
std::array< uint32_t, 4 > m_bytesReceived {}
 receive data counters
std::array< uint32_t, 4 > m_bytesSent {}
 sent data counters
double m_currTime
 Derived epoch anchor in seconds.
Address m_hostAddress
 Host address.
std::string m_imageText
 Text to be included in plot.
Time m_length
 Test duration.
Address m_localBindAddress
 Local bind address.
std::unique_ptr< Output > m_output
 Opaque JSON output document (defined in the .cc file).
std::string m_outputFilename
 Output file path (see OutputFilename attribute).
std::array< Ptr< PacketSink >, 4 > m_packetSinkDown
 PacketSink Applications for Download flows (tcp_download, rrul tests).
std::array< Ptr< PacketSink >, 4 > m_packetSinkUp
 PacketSink Applications for Upload flows (tcp_upload, rrul tests).
Ptr< Ping > m_ping
 Ping Application for latency measurement (ping, rrul tests).
Time m_stepSize
 Measurement data point step size.
Time m_t0
 Epoch anchor for output timestamps (see T0 attribute).
std::string m_testName
 Flent test name.
std::array< Ptr< UdpEchoClient >, 3 > m_udpClient
 UdpEchoClient Applications.
std::array< Ptr< UdpEchoServer >, 3 > m_udpServer
 UdpEchoServer Applications.
bool m_useWallClockT0
 Use the wall clock instead of m_t0 (see UseWallClockT0 attribute).

Additional Inherited Members

Public Types inherited from ns3::Application
typedef void(* DelayAddressCallback) (const Time &delay, const Address &from)
 Common callback signature for packet delay and address.
typedef void(* StateTransitionCallback) (const std::string &oldState, const std::string &newState)
 Common signature used by callbacks to application's state transition trace source.
Protected Attributes inherited from ns3::Application
Ptr< Node > m_node
 The node that this application is installed on.
EventId m_startEvent
 The event that will fire at m_startTime to start the application.
Time m_startTime
 The simulation time that the application will start.
EventId m_stopEvent
 The event that will fire at m_stopTime to end the application.
Time m_stopTime
 The simulation time that the application will end.

Detailed Description

Flent is a network benchmarking tool.

This application provides a basic model of the Flent traffic generator. In practice, Flent is a wrapper around three traffic generation tools: netperf (for TCP), iperf (for UDP) and ping (for ICMP). Flent also provides output in a JSON-formatted data file, and plotting support via matplotlib.

Warning
Note: Unlike standard ns-3 applications, FlentApplication automatically configures peer applications on the target host node during initialization.

Because FlentApplication binds these peer applications to specific, predefined socket ports (e.g., port 9020 for TCP uploads), you cannot target the same host node with multiple Flent applications at the same time. Doing so will cause the newly installed sinks to clash over the same ports, resulting in socket binding conflicts and simulation failures.

Definition at line 69 of file flent-application.h.

Constructor & Destructor Documentation

◆ FlentApplication()

ns3::FlentApplication::FlentApplication ( )

Definition at line 122 of file flent-application.cc.

References m_output.

Referenced by GetTypeId().

Here is the caller graph for this function:

◆ ~FlentApplication()

ns3::FlentApplication::~FlentApplication ( )
overridedefault

Member Function Documentation

◆ AddMetadata()

void ns3::FlentApplication::AddMetadata ( )
private

Add Flent metadata to the output document.

Definition at line 226 of file flent-application.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::Ipv4Address::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), GetUtcFormatTime(), ns3::InetSocketAddress::IsMatchingType(), ns3::Ipv4Address::IsMatchingType(), m_hostAddress, m_imageText, m_length, m_localBindAddress, m_output, m_outputFilename, m_stepSize, ns3::Application::m_stopTime, m_testName, and NS_FATAL_ERROR.

Referenced by StartApplication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoDispose()

void ns3::FlentApplication::DoDispose ( )
overrideprotectedvirtual
See also
Application::DoDispose

Reimplemented from ns3::Application.

Definition at line 167 of file flent-application.cc.

References ns3::Application::DoDispose(), m_bulkSendDown, m_bulkSendUp, m_packetSinkDown, m_packetSinkUp, m_ping, m_udpClient, m_udpServer, and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ DoInitialize()

void ns3::FlentApplication::DoInitialize ( )
overrideprotectedvirtual

In this method, the following tasks are performed: 1) set the host node, which is derived from the host address.

2) put the local bind address as the first address of the first non-loopback interface (if not set by the user explicitly), and 3) override the application stop time from the Length attribute set by the user.

See also
Application::DoInitialize

Reimplemented from ns3::Application.

Definition at line 130 of file flent-application.cc.

References ns3::Application::DoInitialize(), ns3::DynamicCast(), m_length, m_localBindAddress, ns3::Application::m_node, ns3::Application::m_startTime, ns3::Application::m_stopTime, NS_LOG_FUNCTION, and ns3::Seconds().

Here is the call graph for this function:

◆ FillXValues()

void ns3::FlentApplication::FillXValues ( )
private

Fill x_values parameter in Flent file.

Adds x parameter values with the difference of stepSize

Definition at line 434 of file flent-application.cc.

References m_output, m_stepSize, ns3::Application::m_stopTime, and NS_LOG_DEBUG.

Referenced by StopApplication().

Here is the caller graph for this function:

◆ GetHostNode()

Ptr< Node > ns3::FlentApplication::GetHostNode ( Ipv4Address hostAddress) const
private

Iterates through the node list and finds the node pointer for the given hostAddress.

Parameters
[in]hostAddresshost node IP
Returns
The node with the specified IP.

Definition at line 317 of file flent-application.cc.

References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::Ipv4InterfaceAddress::GetAddress(), and NS_LOG_FUNCTION.

Referenced by StartApplication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::FlentApplication::GetTypeId ( )
static

◆ GetUtcFormatTime()

std::string ns3::FlentApplication::GetUtcFormatTime ( ) const
private

Calculate the Time in UTC time format from the number of seconds.

Returns
The time in UTC format

Definition at line 208 of file flent-application.cc.

References m_currTime.

Referenced by AddMetadata().

Here is the caller graph for this function:

◆ GoodputSamplingDownload()

void ns3::FlentApplication::GoodputSamplingDownload ( std::string name,
int i )
private

Goodput calculation for the i-th flow based on the bytes received.

Index i can have various values from 0 to 3 for the four download flows in case of RRUL test.

Parameters
[in]nameName of the flow
[in]iindex of the flow

Definition at line 418 of file flent-application.cc.

References data, ns3::Time::GetSeconds(), GoodputSamplingDownload(), m_bytesReceived, m_currTime, m_output, m_stepSize, ns3::Application::m_stopTime, ns3::Simulator::Now(), and ns3::Simulator::Schedule().

Referenced by GoodputSamplingDownload(), and StartApplication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GoodputSamplingUpload()

void ns3::FlentApplication::GoodputSamplingUpload ( std::string name,
int i )
private

Goodput calculation for the i-th flow based on the bytes sent.

Index i can have various values from 0 to 3 for the four upload flows in case of RRUL test.

Parameters
[in]nameName of the flow
[in]iindex of the flow

Definition at line 402 of file flent-application.cc.

References data, ns3::Time::GetSeconds(), GoodputSamplingUpload(), m_bytesSent, m_currTime, m_output, m_stepSize, ns3::Application::m_stopTime, ns3::Simulator::Now(), and ns3::Simulator::Schedule().

Referenced by GoodputSamplingUpload(), and StartApplication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessRawValues()

void ns3::FlentApplication::ProcessRawValues ( )
private

Process raw values and add the processed result in the Flent file.

Definition at line 450 of file flent-application.cc.

References m_currTime, m_output, m_stepSize, ns3::Application::m_stopTime, NS_LOG_DEBUG, and prev.

Referenced by StopApplication().

Here is the caller graph for this function:

◆ StartApplication()

void ns3::FlentApplication::StartApplication ( )
overrideprivatevirtual

◆ StopApplication()

void ns3::FlentApplication::StopApplication ( )
overrideprivatevirtual

Application specific shutdown code.

The StopApplication method is called at the stop time specified by Stop This method should be overridden by all or most application subclasses.

Reimplemented from ns3::Application.

Definition at line 1061 of file flent-application.cc.

References FillXValues(), m_output, m_outputFilename, m_testName, NS_FATAL_ERROR, NS_LOG_FUNCTION, and ProcessRawValues().

Here is the call graph for this function:

◆ TraceReceivedPacket()

void ns3::FlentApplication::TraceReceivedPacket ( std::size_t idx,
Ptr< const Packet > packet,
const Address & address )
private

sink for packet received.

Parameters
idxIndex of the flow
PacketPointer to packet received
AddressAddress of the sender

Definition at line 364 of file flent-application.cc.

References m_bytesReceived.

Referenced by StartApplication().

Here is the caller graph for this function:

◆ TraceReceivedPing()

void ns3::FlentApplication::TraceReceivedPing ( uint16_t seq,
Time rtt )
private

Ping RTT Trace function.

Parameters
seqEcho sequence number
rttRound Trip Time delta from the sent time

Definition at line 372 of file flent-application.cc.

References data, ns3::Time::GetSeconds(), m_currTime, m_output, and ns3::Simulator::Now().

Referenced by StartApplication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TraceReceivedUdpPing()

void ns3::FlentApplication::TraceReceivedUdpPing ( std::size_t idx,
Ptr< const Packet > packet,
const Address & address,
const Address & localAddress,
const SeqTsEchoHeader & header )
private

UDP Ping RTT Trace function.

Parameters
idxIndex of the QoS flow (0=BE, 1=BK, 2=EF)
PacketUDP Ping Packet
AddressAddress of the destination
localAddressLocal address of the sender
headerSeqTsEchoHeader header

Definition at line 382 of file flent-application.cc.

References data, ns3::Time::GetSeconds(), ns3::SeqTsEchoHeader::GetTsValue(), m_currTime, m_output, m_stepSize, and ns3::Simulator::Now().

Referenced by StartApplication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TraceSentPacket()

void ns3::FlentApplication::TraceSentPacket ( std::size_t idx,
Ptr< const Packet > packet )
private

sink for packet transmissions.

Parameters
idxIndex of the flow
PacketPointer to packet sent

Definition at line 358 of file flent-application.cc.

References m_bytesSent.

Referenced by StartApplication().

Here is the caller graph for this function:

Member Data Documentation

◆ m_bulkSendDown

std::array<Ptr<BulkSendApplication>, 4> ns3::FlentApplication::m_bulkSendDown
private

BulkSend Applications for Download flows (tcp_download, rrul tests).

Definition at line 225 of file flent-application.h.

Referenced by DoDispose(), and StartApplication().

◆ m_bulkSendUp

std::array<Ptr<BulkSendApplication>, 4> ns3::FlentApplication::m_bulkSendUp
private

BulkSend Applications for Upload flows (tcp_upload, rrul tests).

Definition at line 223 of file flent-application.h.

Referenced by DoDispose(), and StartApplication().

◆ m_bytesReceived

std::array<uint32_t, 4> ns3::FlentApplication::m_bytesReceived {}
private

receive data counters

Definition at line 209 of file flent-application.h.

Referenced by GoodputSamplingDownload(), and TraceReceivedPacket().

◆ m_bytesSent

std::array<uint32_t, 4> ns3::FlentApplication::m_bytesSent {}
private

sent data counters

Definition at line 208 of file flent-application.h.

Referenced by GoodputSamplingUpload(), and TraceSentPacket().

◆ m_currTime

double ns3::FlentApplication::m_currTime
private

◆ m_hostAddress

Address ns3::FlentApplication::m_hostAddress
private

Host address.

Definition at line 204 of file flent-application.h.

Referenced by AddMetadata(), GetTypeId(), and StartApplication().

◆ m_imageText

std::string ns3::FlentApplication::m_imageText
private

Text to be included in plot.

Definition at line 206 of file flent-application.h.

Referenced by AddMetadata(), and GetTypeId().

◆ m_length

Time ns3::FlentApplication::m_length
private

Test duration.

Definition at line 199 of file flent-application.h.

Referenced by AddMetadata(), DoInitialize(), and GetTypeId().

◆ m_localBindAddress

Address ns3::FlentApplication::m_localBindAddress
private

Local bind address.

Definition at line 205 of file flent-application.h.

Referenced by AddMetadata(), DoInitialize(), GetTypeId(), and StartApplication().

◆ m_output

std::unique_ptr<Output> ns3::FlentApplication::m_output
private

◆ m_outputFilename

std::string ns3::FlentApplication::m_outputFilename
private

Output file path (see OutputFilename attribute).

Definition at line 200 of file flent-application.h.

Referenced by AddMetadata(), GetTypeId(), and StopApplication().

◆ m_packetSinkDown

std::array<Ptr<PacketSink>, 4> ns3::FlentApplication::m_packetSinkDown
private

PacketSink Applications for Download flows (tcp_download, rrul tests).

Definition at line 221 of file flent-application.h.

Referenced by DoDispose(), and StartApplication().

◆ m_packetSinkUp

std::array<Ptr<PacketSink>, 4> ns3::FlentApplication::m_packetSinkUp
private

PacketSink Applications for Upload flows (tcp_upload, rrul tests).

Definition at line 219 of file flent-application.h.

Referenced by DoDispose(), and StartApplication().

◆ m_ping

Ptr<Ping> ns3::FlentApplication::m_ping
private

Ping Application for latency measurement (ping, rrul tests).

Definition at line 212 of file flent-application.h.

Referenced by DoDispose(), and StartApplication().

◆ m_stepSize

Time ns3::FlentApplication::m_stepSize
private

◆ m_t0

Time ns3::FlentApplication::m_t0
private

Epoch anchor for output timestamps (see T0 attribute).

Definition at line 202 of file flent-application.h.

Referenced by GetTypeId(), and StartApplication().

◆ m_testName

std::string ns3::FlentApplication::m_testName
private

Flent test name.

Definition at line 201 of file flent-application.h.

Referenced by AddMetadata(), GetTypeId(), StartApplication(), and StopApplication().

◆ m_udpClient

std::array<Ptr<UdpEchoClient>, 3> ns3::FlentApplication::m_udpClient
private

UdpEchoClient Applications.

Definition at line 231 of file flent-application.h.

Referenced by DoDispose(), and StartApplication().

◆ m_udpServer

std::array<Ptr<UdpEchoServer>, 3> ns3::FlentApplication::m_udpServer
private

UdpEchoServer Applications.

Definition at line 230 of file flent-application.h.

Referenced by DoDispose(), and StartApplication().

◆ m_useWallClockT0

bool ns3::FlentApplication::m_useWallClockT0
private

Use the wall clock instead of m_t0 (see UseWallClockT0 attribute).

Definition at line 203 of file flent-application.h.

Referenced by GetTypeId(), and StartApplication().


The documentation for this class was generated from the following files: