21#include "nlohmann/json.hpp"
23#include "ns3/application-container.h"
24#include "ns3/boolean.h"
25#include "ns3/config.h"
26#include "ns3/data-rate.h"
27#include "ns3/flent-helper.h"
28#include "ns3/internet-stack-helper.h"
29#include "ns3/ipv4-address-helper.h"
30#include "ns3/ipv4-global-routing-helper.h"
31#include "ns3/ipv4-interface-container.h"
32#include "ns3/net-device-container.h"
33#include "ns3/node-container.h"
34#include "ns3/nstime.h"
35#include "ns3/queue-disc-container.h"
36#include "ns3/queue-size.h"
37#include "ns3/simple-net-device-helper.h"
38#include "ns3/simulator.h"
39#include "ns3/string.h"
41#include "ns3/traffic-control-helper.h"
42#include "ns3/uinteger.h"
77 auto itr_name = root.begin();
80 "in file " + filename +
" metadata not available");
83 "in file " + filename +
" raw_values not available");
86 "in file " + filename +
" results not available");
89 "in file " + filename +
" version not available");
92 "in file " + filename +
" x_values not available");
94 for (
auto itrRawValues = root[
"raw_values"].begin(), itrResults = root[
"results"].begin();
95 itrRawValues != root[
"raw_values"].end();
96 itrRawValues++, itrResults++)
100 filename +
" number of results and raw values do not match");
102 root[
"x_values"].size(),
103 filename +
" number of results and raw values does not match");
118 void DoRun()
override;
133 std::string testName =
"rrul";
166 devices0 = deviceHelper.
Install(n0);
168 devices2 = deviceHelper.
Install(n2);
173 devices1 = deviceHelper.
Install(n1);
184 qdiscs = tch.
Install(devices0);
185 qdiscs = tch.
Install(devices1);
186 qdiscs = tch.
Install(devices2);
189 address.SetBase(
"10.1.1.0",
"255.255.255.0");
191 address.NewNetwork();
193 address.NewNetwork();
216 std::ifstream testFile(outputFile, std::ifstream::binary);
225 double pingLatency = 0.0;
227 for (
auto itrTcpDownload = root[
"results"][
"TCP download BE"].begin();
228 itrTcpDownload != root[
"results"][
"TCP download BE"].end();
231 if (itrTcpDownload->is_null() || itrTcpDownload->get<
double>() == 0.0)
240 "TCP Download BE throughput should be less than 12");
243 "TCP Download BE throughput should be greater than 11");
247 for (
auto itrTcpDownload = root[
"results"][
"TCP download BK"].begin();
248 itrTcpDownload != root[
"results"][
"TCP download BK"].end();
251 if (itrTcpDownload->is_null() || itrTcpDownload->get<
double>() == 0.0)
260 "TCP Download BK throughput should be less than 12");
263 "TCP Download BK throughput should be greater than 11");
266 for (
auto itrPing = root[
"results"][
"Ping (ms) ICMP"].begin();
267 itrPing != root[
"results"][
"Ping (ms) ICMP"].end();
270 if (itrPing->is_null() || itrPing->get<
double>() == 0.0)
275 pingLatency += itrPing->get<
double>();
280 "Ping latency throughput should be greater than 80");
294 void DoRun()
override;
309 std::string testName =
"tcp_upload";
342 devices0 = deviceHelper.
Install(n0);
344 devices2 = deviceHelper.
Install(n2);
349 devices1 = deviceHelper.
Install(n1);
360 qdiscs = tch.
Install(devices0);
361 qdiscs = tch.
Install(devices1);
362 qdiscs = tch.
Install(devices2);
365 address.SetBase(
"10.1.1.0",
"255.255.255.0");
367 address.NewNetwork();
369 address.NewNetwork();
392 std::ifstream testFile(outputFile, std::ifstream::binary);
401 double pingLatency = 0.0;
403 for (
auto itr = root[
"results"][
"TCP upload"].begin();
404 itr != root[
"results"][
"TCP upload"].end();
407 if (itr->is_null() || itr->get<
double>() == 0.0)
417 "TCP upload throughput should be greater than 43");
420 for (
auto itr = root[
"results"][
"Ping (ms) ICMP"].begin();
421 itr != root[
"results"][
"Ping (ms) ICMP"].end();
424 if (itr->is_null() || itr->get<
double>() == 0.0)
429 pingLatency += itr->get<
double>();
446 void DoRun()
override;
461 std::string testName =
"tcp_download";
494 devices0 = deviceHelper.
Install(n0);
496 devices2 = deviceHelper.
Install(n2);
501 devices1 = deviceHelper.
Install(n1);
512 qdiscs = tch.
Install(devices0);
513 qdiscs = tch.
Install(devices1);
514 qdiscs = tch.
Install(devices2);
517 address.SetBase(
"10.1.1.0",
"255.255.255.0");
519 address.NewNetwork();
521 address.NewNetwork();
544 std::ifstream testFile(outputFile, std::ifstream::binary);
547 "tcp_download.flent was not created in temp dir");
555 double pingLatency = 0.0;
557 for (
auto itr = root[
"results"][
"TCP download"].begin();
558 itr != root[
"results"][
"TCP download"].end();
561 if (itr->is_null() || itr->get<
double>() == 0.0)
571 "TCP Download throughput should be greater than 42");
574 for (
auto itr = root[
"results"][
"Ping (ms) ICMP"].begin();
575 itr != root[
"results"][
"Ping (ms) ICMP"].end();
578 if (itr->is_null() || itr->get<
double>() == 0.0)
583 pingLatency += itr->get<
double>();
600 void DoRun()
override;
615 std::string testName =
"ping";
648 devices0 = deviceHelper.
Install(n0);
650 devices2 = deviceHelper.
Install(n2);
655 devices1 = deviceHelper.
Install(n1);
666 qdiscs = tch.
Install(devices0);
667 qdiscs = tch.
Install(devices1);
668 qdiscs = tch.
Install(devices2);
671 address.SetBase(
"10.1.1.0",
"255.255.255.0");
673 address.NewNetwork();
675 address.NewNetwork();
698 std::ifstream testFile(outputFile, std::ifstream::binary);
706 double pingLatency = 0.0;
708 for (
auto itr = root[
"results"][
"Ping (ms) ICMP"].begin();
709 itr != root[
"results"][
"Ping (ms) ICMP"].end();
712 if (itr->is_null() || itr->get<
double>() == 0.0)
717 pingLatency += itr->get<
double>();
Flent ping test: verifies test execution, metadata integrity, throughput limits, and ICMP latency lim...
void DoRun() override
Implementation to actually run this TestCase.
~FlentApplicationPing() override
Flent rrul test: verifies test execution, metadata integrity, throughput limits, and ICMP latency lim...
void DoRun() override
Implementation to actually run this TestCase.
~FlentApplicationRrul() override
Flent tcp_download test: verifies test execution, metadata integrity, throughput limits,...
~FlentApplicationTcpDownload() override
void DoRun() override
Implementation to actually run this TestCase.
FlentApplicationTcpDownload()
Flent tcp_upload test: verifies test execution, metadata integrity, throughput limits,...
void DoRun() override
Implementation to actually run this TestCase.
~FlentApplicationTcpUpload() override
FlentApplicationTcpUpload()
Flent Application Test Suite.
FlentApplicationTestSuite()
Constructor.
void VerifyFlentFileIntegrity(const nlohmann::json &root, const std::string &filename)
Verifies the structural integrity of the generated JSON data.
FlentTestCase(std::string name)
Constructor.
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.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Class for representing data rates.
uint64_t GetBitRate() const
Get the underlying bitrate.
A helper to make it easier to instantiate an ns3::FlentApplication.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
ApplicationContainer Install(Ptr< Node > node) const
Install an ns3::FlentApplication on the node configured with all the attributes set with SetAttribute...
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
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.
Holds a vector of ns3::QueueDisc pointers.
Class for representing queue sizes.
build a set of SimpleNetDevice objects
void SetQueue(std::string type, Ts &&... args)
Each net device must have a queue to pass packets through.
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
@ EXTENSIVE
Medium length test.
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Simulation virtual time values and global simulation resolution.
Build a set of QueueDisc objects.
QueueDiscContainer Install(NetDeviceContainer c)
uint16_t SetRootQueueDisc(const std::string &type, Args &&... args)
Helper function used to set a root queue disc of the given type and with the given attributes.
void SetQueueLimits(std::string type, Args &&... args)
Helper function used to add a queue limits object to the transmission queues of the devices.
Hold an unsigned integer type.
static FlentApplicationTestSuite g_FlentApplicationTestSuite
Static variable for test initialization.
void SetDefault(std::string name, const AttributeValue &value)
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
#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.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
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.