31 #include "ns3/cbr-application.h"
32 #include "ns3/cbr-helper.h"
33 #include "ns3/config.h"
36 #include "ns3/packet-sink-helper.h"
37 #include "ns3/packet-sink.h"
38 #include "ns3/satellite-env-variables.h"
39 #include "ns3/satellite-helper.h"
40 #include "ns3/satellite-topology.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 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E");
111 helper->CreatePredefinedScenario(SatHelper::FULL);
113 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
114 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
117 CbrHelper cbr(
"ns3::UdpSocketFactory",
118 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
119 cbr.SetAttribute(
"Interval", StringValue(
"0.8s"));
122 PacketSinkHelper sink(
"ns3::UdpSocketFactory",
123 Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port)));
125 ApplicationContainer utApps = sink.Install(utUsers.Get(0));
126 utApps.Add(cbr.Install(utUsers.Get(0)));
127 utApps.Start(Seconds(1.0));
128 utApps.Stop(Seconds(2.5));
133 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port))));
136 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port))));
138 ApplicationContainer gwApps = sink.Install(gwUsers.Get(0));
139 gwApps.Add(cbr.Install(gwUsers.Get(0)));
141 gwApps.Start(Seconds(1.0));
142 gwApps.Stop(Seconds(2.5));
144 Simulator::Stop(Seconds(2.5));
147 Simulator::Destroy();
149 Ptr<PacketSink> utReceiver = DynamicCast<PacketSink>(utApps.Get(0));
150 Ptr<CbrApplication> utSender = DynamicCast<CbrApplication>(utApps.Get(1));
152 Ptr<PacketSink> gwReceiver = DynamicCast<PacketSink>(gwApps.Get(0));
153 Ptr<CbrApplication> gwSender = DynamicCast<CbrApplication>(gwApps.Get(1));
158 NS_TEST_ASSERT_MSG_NE(utSender->GetSent(), (uint32_t)0,
"Nothing sent by UT user!");
159 NS_TEST_ASSERT_MSG_EQ(gwReceiver->GetTotalRx(),
161 "Packets were lost between UT and GW!");
163 NS_TEST_ASSERT_MSG_NE(gwSender->GetSent(), (uint32_t)0,
"Nothing sent by GW user!");
164 NS_TEST_ASSERT_MSG_EQ(utReceiver->GetTotalRx(),
166 "Packets were lost between GW and UT!");
168 Singleton<SatEnvVariables>::Get()->DoDispose();
183 : TestSuite(
"sat-perf-mem", Type::SYSTEM)
186 AddTestCase(
new Pm1, TestCase::Duration::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.