30 #include "../helper/satellite-helper.h"
31 #include "../utils/satellite-env-variables.h"
33 #include "ns3/cbr-application.h"
34 #include "ns3/cbr-helper.h"
35 #include "ns3/config.h"
38 #include "ns3/packet-sink-helper.h"
39 #include "ns3/packet-sink.h"
40 #include "ns3/simulator.h"
41 #include "ns3/singleton.h"
42 #include "ns3/string.h"
68 virtual void DoRun(
void);
73 : TestCase(
"'CRA, test 1' case tests successful transmission of UDP packets from UT connected "
74 "user to GW connected user in simple scenario with only CRA enabled.")
91 Singleton<SatEnvVariables>::Get()->DoInitialize();
92 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-cra",
"",
true);
98 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
99 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
102 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_OFF));
105 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
106 BooleanValue(
false));
107 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
108 BooleanValue(
false));
109 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
110 BooleanValue(
false));
111 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
113 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
114 BooleanValue(
false));
115 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
116 BooleanValue(
false));
117 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
118 BooleanValue(
false));
119 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
120 BooleanValue(
false));
121 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
122 BooleanValue(
false));
123 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
124 BooleanValue(
false));
125 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
126 BooleanValue(
false));
127 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
128 BooleanValue(
false));
131 Ptr<SatHelper> helper = CreateObject<SatHelper>();
132 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
136 NodeContainer gwUsers = helper->GetGwUsers();
141 CbrHelper cbr(
"ns3::UdpSocketFactory",
142 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
143 cbr.SetAttribute(
"Interval", StringValue(
"1s"));
145 ApplicationContainer utApps = cbr.Install(helper->GetUtUsers());
146 utApps.Start(Seconds(1.0));
147 utApps.Stop(Seconds(2.1));
150 PacketSinkHelper sink(
"ns3::UdpSocketFactory",
151 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
153 ApplicationContainer gwApps = sink.Install(gwUsers);
154 gwApps.Start(Seconds(1.0));
155 gwApps.Stop(Seconds(3.0));
157 Simulator::Stop(Seconds(11));
160 Simulator::Destroy();
162 Ptr<PacketSink> receiver = DynamicCast<PacketSink>(gwApps.Get(0));
163 Ptr<CbrApplication> sender = DynamicCast<CbrApplication>(utApps.Get(0));
168 NS_TEST_ASSERT_MSG_NE(sender->GetSent(), (uint32_t)0,
"Nothing sent !");
169 NS_TEST_ASSERT_MSG_EQ(receiver->GetTotalRx(), sender->GetSent(),
"Packets were lost !");
171 Singleton<SatEnvVariables>::Get()->DoDispose();
187 : TestSuite(
"sat-cra-test", SYSTEM)
'CRA, test 1' test case implementation.
ErrorModel
Error model enum.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static SatCraTestSuite satCraTestSuite