31 #include "../helper/satellite-helper.h"
32 #include "../utils/satellite-env-variables.h"
34 #include "ns3/cbr-application.h"
35 #include "ns3/cbr-helper.h"
36 #include "ns3/config.h"
39 #include "ns3/packet-sink-helper.h"
40 #include "ns3/packet-sink.h"
41 #include "ns3/simulator.h"
42 #include "ns3/singleton.h"
43 #include "ns3/string.h"
68 class Pm1 :
public TestCase
75 virtual void DoRun(
void);
80 : TestCase(
"'Performance and memory tracking' tests servers as follow-up test for performance "
98 Singleton<SatEnvVariables>::Get()->DoInitialize();
99 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-perf-mem",
"",
true);
105 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
106 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
109 Ptr<SatHelper> helper = CreateObject<SatHelper>();
110 helper->CreatePredefinedScenario(SatHelper::FULL);
112 NodeContainer gwUsers = helper->GetGwUsers();
113 NodeContainer utUsers = helper->GetUtUsers();
116 CbrHelper cbr(
"ns3::UdpSocketFactory",
117 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
118 cbr.SetAttribute(
"Interval", StringValue(
"0.8s"));
121 PacketSinkHelper sink(
"ns3::UdpSocketFactory",
122 Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port)));
124 ApplicationContainer utApps = sink.Install(utUsers.Get(0));
125 utApps.Add(cbr.Install(utUsers.Get(0)));
126 utApps.Start(Seconds(1.0));
127 utApps.Stop(Seconds(2.5));
132 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port))));
135 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port))));
137 ApplicationContainer gwApps = sink.Install(gwUsers.Get(0));
138 gwApps.Add(cbr.Install(gwUsers.Get(0)));
140 gwApps.Start(Seconds(1.0));
141 gwApps.Stop(Seconds(2.5));
143 Simulator::Stop(Seconds(2.5));
146 Simulator::Destroy();
148 Ptr<PacketSink> utReceiver = DynamicCast<PacketSink>(utApps.Get(0));
149 Ptr<CbrApplication> utSender = DynamicCast<CbrApplication>(utApps.Get(1));
151 Ptr<PacketSink> gwReceiver = DynamicCast<PacketSink>(gwApps.Get(0));
152 Ptr<CbrApplication> gwSender = DynamicCast<CbrApplication>(gwApps.Get(1));
157 NS_TEST_ASSERT_MSG_NE(utSender->GetSent(), (uint32_t)0,
"Nothing sent by UT user!");
158 NS_TEST_ASSERT_MSG_EQ(gwReceiver->GetTotalRx(),
160 "Packets were lost between UT and GW!");
162 NS_TEST_ASSERT_MSG_NE(gwSender->GetSent(), (uint32_t)0,
"Nothing sent by GW user!");
163 NS_TEST_ASSERT_MSG_EQ(utReceiver->GetTotalRx(),
165 "Packets were lost between GW and UT!");
167 Singleton<SatEnvVariables>::Get()->DoDispose();
182 : TestSuite(
"sat-perf-mem", SYSTEM)
185 AddTestCase(
new Pm1, TestCase::QUICK);
'Performance and memory tracking' test case implementation, id: pm-1 / TN4.
ErrorModel
Error model enum.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.