OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
4 * 2010 NICTA | 4 * 2010 NICTA |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License version 2 as | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 { | 583 { |
584 } | 584 } |
585 | 585 |
586 Bug730TestCase::~Bug730TestCase () | 586 Bug730TestCase::~Bug730TestCase () |
587 { | 587 { |
588 } | 588 } |
589 | 589 |
590 void | 590 void |
591 Bug730TestCase::Receive (std::string context, Ptr<const Packet> p, const Address
&adr) | 591 Bug730TestCase::Receive (std::string context, Ptr<const Packet> p, const Address
&adr) |
592 { | 592 { |
| 593 NS_UNUSED(adr); |
593 if ((p->GetSize () == 1460) && (Simulator::Now () > Seconds (20))) | 594 if ((p->GetSize () == 1460) && (Simulator::Now () > Seconds (20))) |
594 { | 595 { |
595 m_received++; | 596 m_received++; |
596 } | 597 } |
597 } | 598 } |
598 | 599 |
599 | 600 |
600 void | 601 void |
601 Bug730TestCase::DoRun (void) | 602 Bug730TestCase::DoRun (void) |
602 { | 603 { |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 { | 1064 { |
1064 } | 1065 } |
1065 | 1066 |
1066 Bug2222TestCase::~Bug2222TestCase () | 1067 Bug2222TestCase::~Bug2222TestCase () |
1067 { | 1068 { |
1068 } | 1069 } |
1069 | 1070 |
1070 void | 1071 void |
1071 Bug2222TestCase::TxDataFailedTrace (std::string context, Mac48Address adr) | 1072 Bug2222TestCase::TxDataFailedTrace (std::string context, Mac48Address adr) |
1072 { | 1073 { |
| 1074 NS_UNUSED(adr); |
1073 //Indicate the long retry counter has been increased in the wifi remote statio
n manager | 1075 //Indicate the long retry counter has been increased in the wifi remote statio
n manager |
1074 m_countInternalCollisions++; | 1076 m_countInternalCollisions++; |
1075 } | 1077 } |
1076 | 1078 |
1077 void | 1079 void |
1078 Bug2222TestCase::DoRun (void) | 1080 Bug2222TestCase::DoRun (void) |
1079 { | 1081 { |
1080 m_countInternalCollisions = 0; | 1082 m_countInternalCollisions = 0; |
1081 | 1083 |
1082 //Generate same backoff for AC_VI and AC_VO | 1084 //Generate same backoff for AC_VI and AC_VO |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 { | 1180 { |
1179 public: | 1181 public: |
1180 Bug2483TestCase (); | 1182 Bug2483TestCase (); |
1181 virtual ~Bug2483TestCase (); | 1183 virtual ~Bug2483TestCase (); |
1182 virtual void DoRun (void); | 1184 virtual void DoRun (void); |
1183 | 1185 |
1184 private: | 1186 private: |
1185 /** | 1187 /** |
1186 * A tuple of {starting frequency, channelWidth, Number of subbands in Spectru
mModel, modulation type} | 1188 * A tuple of {starting frequency, channelWidth, Number of subbands in Spectru
mModel, modulation type} |
1187 */ | 1189 */ |
1188 typedef std::tuple<double, uint8_t, uint32_t, WifiModulationClass> FreqWidthSu
bbandModulationTuple; | 1190 typedef std::tuple<double, uint8_t, size_t, WifiModulationClass> FreqWidthSubb
andModulationTuple; |
1189 std::vector<FreqWidthSubbandModulationTuple> m_distinctTuples; ///< vector of
distinct {starting frequency, channelWidth, Number of subbands in SpectrumModel,
modulation type} tuples | 1191 std::vector<FreqWidthSubbandModulationTuple> m_distinctTuples; ///< vector of
distinct {starting frequency, channelWidth, Number of subbands in SpectrumModel,
modulation type} tuples |
1190 | 1192 |
1191 /** | 1193 /** |
1192 * Stores the distinct {starting frequency, channelWidth, Number of subbands i
n SpectrumModel, modulation type} tuples | 1194 * Stores the distinct {starting frequency, channelWidth, Number of subbands i
n SpectrumModel, modulation type} tuples |
1193 * that have been used during the testcase run. | 1195 * that have been used during the testcase run. |
1194 * \param context the context | 1196 * \param context the context |
1195 * \param txParams spectrum signal parameters set by transmitter | 1197 * \param txParams spectrum signal parameters set by transmitter |
1196 */ | 1198 */ |
1197 void StoreDistinctTuple (std::string context, Ptr<SpectrumSignalParameters> tx
Params); | 1199 void StoreDistinctTuple (std::string context, Ptr<SpectrumSignalParameters> tx
Params); |
1198 /** | 1200 /** |
1199 * Triggers the arrival of a burst of 1000 Byte-long packets in the source dev
ice | 1201 * Triggers the arrival of a burst of 1000 Byte-long packets in the source dev
ice |
1200 * \param numPackets number of packets in burst (maximum: 255) | 1202 * \param numPackets number of packets in burst (maximum: 255) |
1201 * \param sourceDevice pointer to the source NetDevice | 1203 * \param sourceDevice pointer to the source NetDevice |
1202 * \param destination address of the destination device | 1204 * \param destination address of the destination device |
1203 */ | 1205 */ |
1204 void SendPacketBurst (uint8_t numPackets, Ptr<NetDevice> sourceDevice, Address
& destination) const; | 1206 void SendPacketBurst (unsigned int numPackets, Ptr<NetDevice> sourceDevice, Ad
dress& destination) const; |
1205 }; | 1207 }; |
1206 | 1208 |
1207 Bug2483TestCase::Bug2483TestCase () | 1209 Bug2483TestCase::Bug2483TestCase () |
1208 : TestCase ("Test case for Bug 2483") | 1210 : TestCase ("Test case for Bug 2483") |
1209 { | 1211 { |
1210 } | 1212 } |
1211 | 1213 |
1212 Bug2483TestCase::~Bug2483TestCase () | 1214 Bug2483TestCase::~Bug2483TestCase () |
1213 { | 1215 { |
1214 } | 1216 } |
1215 | 1217 |
1216 void | 1218 void |
1217 Bug2483TestCase::StoreDistinctTuple (std::string context, Ptr<SpectrumSignalPar
ameters> txParams) | 1219 Bug2483TestCase::StoreDistinctTuple (std::string context, Ptr<SpectrumSignalPar
ameters> txParams) |
1218 { | 1220 { |
1219 // Extract starting frequency and number of subbands | 1221 // Extract starting frequency and number of subbands |
1220 Ptr<const SpectrumModel> c = txParams->psd->GetSpectrumModel (); | 1222 Ptr<const SpectrumModel> c = txParams->psd->GetSpectrumModel (); |
1221 uint32_t numBands = c->GetNumBands (); | 1223 std::size_t numBands = c->GetNumBands (); |
1222 double startingFreq = c->Begin ()->fl; | 1224 double startingFreq = c->Begin ()->fl; |
1223 | 1225 |
1224 // Get channel bandwidth and modulation class | 1226 // Get channel bandwidth and modulation class |
1225 Ptr<const WifiSpectrumSignalParameters> wifiTxParams = DynamicCast<WifiSpectru
mSignalParameters> (txParams); | 1227 Ptr<const WifiSpectrumSignalParameters> wifiTxParams = DynamicCast<WifiSpectru
mSignalParameters> (txParams); |
1226 Ptr<Packet> packet = wifiTxParams->packet->Copy (); | 1228 Ptr<Packet> packet = wifiTxParams->packet->Copy (); |
1227 WifiPhyTag tag; | 1229 WifiPhyTag tag; |
1228 if (!packet->RemovePacketTag (tag)) | 1230 if (!packet->RemovePacketTag (tag)) |
1229 { | 1231 { |
1230 NS_FATAL_ERROR ("Received Wi-Fi Signal with no WifiPhyTag"); | 1232 NS_FATAL_ERROR ("Received Wi-Fi Signal with no WifiPhyTag"); |
1231 return; | 1233 return; |
(...skipping 13 matching lines...) Expand all Loading... |
1245 found = true; | 1247 found = true; |
1246 } | 1248 } |
1247 } | 1249 } |
1248 if (!found) | 1250 if (!found) |
1249 { | 1251 { |
1250 m_distinctTuples.push_back (tupleForCurrentTx); | 1252 m_distinctTuples.push_back (tupleForCurrentTx); |
1251 } | 1253 } |
1252 } | 1254 } |
1253 | 1255 |
1254 void | 1256 void |
1255 Bug2483TestCase::SendPacketBurst (uint8_t numPackets, Ptr<NetDevice> sourceDevic
e, | 1257 Bug2483TestCase::SendPacketBurst (unsigned int numPackets, Ptr<NetDevice> source
Device, |
1256 Address& destination) const | 1258 Address& destination) const |
1257 { | 1259 { |
1258 for (uint8_t i = 0; i < numPackets; i++) | 1260 for (uint16_t i = 0; i < numPackets; i++) |
1259 { | 1261 { |
1260 Ptr<Packet> pkt = Create<Packet> (1000); // 1000 dummy bytes of data | 1262 Ptr<Packet> pkt = Create<Packet> (1000); // 1000 dummy bytes of data |
1261 sourceDevice->Send (pkt, destination, 0); | 1263 sourceDevice->Send (pkt, destination, 0); |
1262 } | 1264 } |
1263 } | 1265 } |
1264 | 1266 |
1265 void | 1267 void |
1266 Bug2483TestCase::DoRun (void) | 1268 Bug2483TestCase::DoRun (void) |
1267 { | 1269 { |
1268 Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringVa
lue ("500")); // so as to force RTS/CTS for data frames | 1270 Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringVa
lue ("500")); // so as to force RTS/CTS for data frames |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>
(); | 1314 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>
(); |
1313 positionAlloc->Add (Vector (0.0, 0.0, 0.0)); | 1315 positionAlloc->Add (Vector (0.0, 0.0, 0.0)); |
1314 positionAlloc->Add (Vector (1.0, 0.0, 0.0)); // put close enough in order to u
se MCS | 1316 positionAlloc->Add (Vector (1.0, 0.0, 0.0)); // put close enough in order to u
se MCS |
1315 mobility.SetPositionAllocator (positionAlloc); | 1317 mobility.SetPositionAllocator (positionAlloc); |
1316 | 1318 |
1317 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); | 1319 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
1318 mobility.Install (wifiApNode); | 1320 mobility.Install (wifiApNode); |
1319 mobility.Install (wifiStaNode); | 1321 mobility.Install (wifiStaNode); |
1320 | 1322 |
1321 // Send two 5 packet-bursts | 1323 // Send two 5 packet-bursts |
1322 Simulator::Schedule (Seconds (0.5), &Bug2483TestCase::SendPacketBurst, this, 5
, apDevice.Get (0), staDevice.Get (0)->GetAddress ()); | 1324 Simulator::Schedule (Seconds (0.5), &Bug2483TestCase::SendPacketBurst, this, 5
U, apDevice.Get (0), staDevice.Get (0)->GetAddress ()); |
1323 Simulator::Schedule (Seconds (0.6), &Bug2483TestCase::SendPacketBurst, this, 5
, apDevice.Get (0), staDevice.Get (0)->GetAddress ()); | 1325 Simulator::Schedule (Seconds (0.6), &Bug2483TestCase::SendPacketBurst, this, 5
U, apDevice.Get (0), staDevice.Get (0)->GetAddress ()); |
1324 | 1326 |
1325 Config::Connect ("/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
MakeCallback (&Bug2483TestCase::StoreDistinctTuple, this)); | 1327 Config::Connect ("/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
MakeCallback (&Bug2483TestCase::StoreDistinctTuple, this)); |
1326 | 1328 |
1327 Simulator::Stop (Seconds (0.8)); | 1329 Simulator::Stop (Seconds (0.8)); |
1328 Simulator::Run (); | 1330 Simulator::Run (); |
1329 | 1331 |
1330 Simulator::Destroy (); | 1332 Simulator::Destroy (); |
1331 | 1333 |
1332 // {starting frequency, channelWidth, Number of subbands in SpectrumModel, mod
ulation type} tuples | 1334 // {starting frequency, channelWidth, Number of subbands in SpectrumModel, mod
ulation type} tuples |
1333 uint8_t numberTuples = m_distinctTuples.size (); | 1335 std::size_t numberTuples = m_distinctTuples.size (); |
1334 NS_TEST_ASSERT_MSG_EQ (numberTuples, 2, "Only two distinct tuples expected"); | 1336 NS_TEST_ASSERT_MSG_EQ (numberTuples, 2, "Only two distinct tuples expected"); |
1335 NS_TEST_ASSERT_MSG_EQ (std::get<0> (m_distinctTuples[0]), std::get<0> (m_disti
nctTuples[1]), "Both tuples should have same starting frequency"); | 1337 NS_TEST_ASSERT_MSG_EQ (std::get<0> (m_distinctTuples[0]), std::get<0> (m_disti
nctTuples[1]), "Both tuples should have same starting frequency"); |
1336 // Note that the first tuple should the one initiated by the beacon, i.e. lega
cy OFDM (20 MHz) | 1338 // Note that the first tuple should the one initiated by the beacon, i.e. lega
cy OFDM (20 MHz) |
1337 NS_TEST_ASSERT_MSG_EQ (std::get<1> (m_distinctTuples[0]), 20, "First tuple's c
hannel width should be 20 MHz"); | 1339 NS_TEST_ASSERT_MSG_EQ (std::get<1> (m_distinctTuples[0]), 20, "First tuple's c
hannel width should be 20 MHz"); |
1338 NS_TEST_ASSERT_MSG_EQ (std::get<2> (m_distinctTuples[0]), 129, "First tuple sh
ould have 129 subbands (64+DC, 20MHz+DC, inband and 32*2 out-of-band, 10MHz on e
ach side)"); | 1340 NS_TEST_ASSERT_MSG_EQ (std::get<2> (m_distinctTuples[0]), 129, "First tuple sh
ould have 129 subbands (64+DC, 20MHz+DC, inband and 32*2 out-of-band, 10MHz on e
ach side)"); |
1339 NS_TEST_ASSERT_MSG_EQ (std::get<3> (m_distinctTuples[0]), WifiModulationClass:
:WIFI_MOD_CLASS_OFDM, "First tuple should be OFDM"); | 1341 NS_TEST_ASSERT_MSG_EQ (std::get<3> (m_distinctTuples[0]), WifiModulationClass:
:WIFI_MOD_CLASS_OFDM, "First tuple should be OFDM"); |
1340 // Second tuple | 1342 // Second tuple |
1341 NS_TEST_ASSERT_MSG_EQ (std::get<1> (m_distinctTuples[1]), channelWidth, "Secon
d tuple's channel width should be 40 MHz"); | 1343 NS_TEST_ASSERT_MSG_EQ (std::get<1> (m_distinctTuples[1]), channelWidth, "Secon
d tuple's channel width should be 40 MHz"); |
1342 NS_TEST_ASSERT_MSG_EQ (std::get<2> (m_distinctTuples[1]), 193, "Second tuple s
hould have 193 subbands (128+DC, 40MHz+DC, inband and 32*2 out-of-band, 10MHz on
each side)"); | 1344 NS_TEST_ASSERT_MSG_EQ (std::get<2> (m_distinctTuples[1]), 193, "Second tuple s
hould have 193 subbands (128+DC, 40MHz+DC, inband and 32*2 out-of-band, 10MHz on
each side)"); |
1343 NS_TEST_ASSERT_MSG_EQ (std::get<3> (m_distinctTuples[1]), WifiModulationClass:
:WIFI_MOD_CLASS_VHT, "Second tuple should be VHT_OFDM"); | 1345 NS_TEST_ASSERT_MSG_EQ (std::get<3> (m_distinctTuples[1]), WifiModulationClass:
:WIFI_MOD_CLASS_VHT, "Second tuple should be VHT_OFDM"); |
(...skipping 18 matching lines...) Expand all Loading... |
1362 AddTestCase (new QosUtilsIsOldPacketTest, TestCase::QUICK); | 1364 AddTestCase (new QosUtilsIsOldPacketTest, TestCase::QUICK); |
1363 AddTestCase (new InterferenceHelperSequenceTest, TestCase::QUICK); //Bug 991 | 1365 AddTestCase (new InterferenceHelperSequenceTest, TestCase::QUICK); //Bug 991 |
1364 AddTestCase (new DcfImmediateAccessBroadcastTestCase, TestCase::QUICK); | 1366 AddTestCase (new DcfImmediateAccessBroadcastTestCase, TestCase::QUICK); |
1365 AddTestCase (new Bug730TestCase, TestCase::QUICK); //Bug 730 | 1367 AddTestCase (new Bug730TestCase, TestCase::QUICK); //Bug 730 |
1366 AddTestCase (new SetChannelFrequencyTest, TestCase::QUICK); | 1368 AddTestCase (new SetChannelFrequencyTest, TestCase::QUICK); |
1367 AddTestCase (new Bug2222TestCase, TestCase::QUICK); //Bug 2222 | 1369 AddTestCase (new Bug2222TestCase, TestCase::QUICK); //Bug 2222 |
1368 AddTestCase (new Bug2483TestCase, TestCase::QUICK); //Bug 2483 | 1370 AddTestCase (new Bug2483TestCase, TestCase::QUICK); //Bug 2483 |
1369 } | 1371 } |
1370 | 1372 |
1371 static WifiTestSuite g_wifiTestSuite; ///< the test suite | 1373 static WifiTestSuite g_wifiTestSuite; ///< the test suite |
OLD | NEW |