author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Mon, 03 Nov 2014 12:33:13 -0800 | |
changeset 11045 | 6024c150e4c8 |
parent 10553 | 8c347165bb56 |
child 11450 | 9f4ae69f12b7 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7141
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4325
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
2 |
/* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
3 |
* Copyright (c) 2005,2006 INRIA |
6665 | 4 |
* 2010 NICTA |
4325
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
5 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
4325
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
8 |
* published by the Free Software Foundation; |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
9 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
13 |
* GNU General Public License for more details. |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
14 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
18 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
19 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
6665 | 20 |
* Quincy Tse <quincy.tse@nicta.com.au> (Case for Bug 991) |
4325
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
21 |
*/ |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
|
6848
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
23 |
#include "ns3/wifi-net-device.h" |
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
24 |
#include "ns3/yans-wifi-channel.h" |
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
25 |
#include "ns3/adhoc-wifi-mac.h" |
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
26 |
#include "ns3/yans-wifi-phy.h" |
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
27 |
#include "ns3/arf-wifi-manager.h" |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
5919
diff
changeset
|
28 |
#include "ns3/propagation-delay-model.h" |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
5919
diff
changeset
|
29 |
#include "ns3/propagation-loss-model.h" |
6848
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
30 |
#include "ns3/error-rate-model.h" |
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
31 |
#include "ns3/yans-error-rate-model.h" |
4257
3e8f8052e155
StaticMobilityModel -> ConstantPositionMobilityModel, StaticSpeedMobilityModel -> ConstantVelocityMobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4038
diff
changeset
|
32 |
#include "ns3/constant-position-mobility-model.h" |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
#include "ns3/node.h" |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
#include "ns3/simulator.h" |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
#include "ns3/test.h" |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
#include "ns3/object-factory.h" |
6848
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
37 |
#include "ns3/dca-txop.h" |
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6803
diff
changeset
|
38 |
#include "ns3/mac-rx-middle.h" |
4406 | 39 |
#include "ns3/pointer.h" |
9176
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
40 |
#include "ns3/rng-seed-manager.h" |
10195
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
41 |
#include "ns3/edca-txop-n.h" |
10206
ecd136bcb899
Bug 1722 - beacons transmitted concurrently
Tom Henderson <tomh@tomh.org>
parents:
10195
diff
changeset
|
42 |
#include "ns3/config.h" |
ecd136bcb899
Bug 1722 - beacons transmitted concurrently
Tom Henderson <tomh@tomh.org>
parents:
10195
diff
changeset
|
43 |
#include "ns3/boolean.h" |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
|
10553
8c347165bb56
Move tests outside ns3 namespace
Vedran Miletić <rivanvx@gmail.com>
parents:
10206
diff
changeset
|
45 |
using namespace ns3; |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
|
10195
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
47 |
// helper function to assign streams to random variables, to control |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
48 |
// randomness in the tests |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
49 |
static void |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
50 |
AssignWifiRandomStreams (Ptr<WifiMac> mac, int64_t stream) |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
51 |
{ |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
52 |
int64_t currentStream = stream; |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
53 |
Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (mac); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
54 |
if (rmac) |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
55 |
{ |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
56 |
PointerValue ptr; |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
57 |
rmac->GetAttribute ("DcaTxop", ptr); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
58 |
Ptr<DcaTxop> dcaTxop = ptr.Get<DcaTxop> (); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
59 |
currentStream += dcaTxop->AssignStreams (currentStream); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
60 |
|
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
61 |
rmac->GetAttribute ("VO_EdcaTxopN", ptr); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
62 |
Ptr<EdcaTxopN> vo_edcaTxopN = ptr.Get<EdcaTxopN> (); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
63 |
currentStream += vo_edcaTxopN->AssignStreams (currentStream); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
64 |
|
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
65 |
rmac->GetAttribute ("VI_EdcaTxopN", ptr); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
66 |
Ptr<EdcaTxopN> vi_edcaTxopN = ptr.Get<EdcaTxopN> (); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
67 |
currentStream += vi_edcaTxopN->AssignStreams (currentStream); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
68 |
|
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
69 |
rmac->GetAttribute ("BE_EdcaTxopN", ptr); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
70 |
Ptr<EdcaTxopN> be_edcaTxopN = ptr.Get<EdcaTxopN> (); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
71 |
currentStream += be_edcaTxopN->AssignStreams (currentStream); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
72 |
|
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
73 |
rmac->GetAttribute ("BK_EdcaTxopN", ptr); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
74 |
Ptr<EdcaTxopN> bk_edcaTxopN = ptr.Get<EdcaTxopN> (); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
75 |
currentStream += bk_edcaTxopN->AssignStreams (currentStream); |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
76 |
} |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
77 |
} |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
78 |
|
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
79 |
class WifiTest : public TestCase |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
80 |
{ |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
81 |
public: |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
82 |
WifiTest (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
83 |
|
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
84 |
virtual void DoRun (void); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
85 |
private: |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
86 |
void RunOne (void); |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
87 |
void CreateOne (Vector pos, Ptr<YansWifiChannel> channel); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
void SendOnePacket (Ptr<WifiNetDevice> dev); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
89 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
90 |
ObjectFactory m_manager; |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
ObjectFactory m_mac; |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
ObjectFactory m_propDelay; |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
}; |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
94 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
WifiTest::WifiTest () |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
96 |
: TestCase ("Wifi") |
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
97 |
{ |
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
98 |
} |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
100 |
void |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
WifiTest::SendOnePacket (Ptr<WifiNetDevice> dev) |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
{ |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
103 |
Ptr<Packet> p = Create<Packet> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
104 |
dev->Send (p, dev->GetBroadcast (), 1); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
105 |
} |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
107 |
void |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
108 |
WifiTest::CreateOne (Vector pos, Ptr<YansWifiChannel> channel) |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
109 |
{ |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
110 |
Ptr<Node> node = CreateObject<Node> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
112 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
113 |
Ptr<WifiMac> mac = m_mac.Create<WifiMac> (); |
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4406
diff
changeset
|
114 |
mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
4257
3e8f8052e155
StaticMobilityModel -> ConstantPositionMobilityModel, StaticSpeedMobilityModel -> ConstantVelocityMobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4038
diff
changeset
|
115 |
Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> (); |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
116 |
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> (); |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
117 |
Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> (); |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
118 |
phy->SetErrorRateModel (error); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
119 |
phy->SetChannel (channel); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
120 |
phy->SetDevice (dev); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
121 |
phy->SetMobility (node); |
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4406
diff
changeset
|
122 |
phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
123 |
Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
124 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
125 |
mobility->SetPosition (pos); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
126 |
node->AggregateObject (mobility); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
127 |
mac->SetAddress (Mac48Address::Allocate ()); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
dev->SetMac (mac); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
129 |
dev->SetPhy (phy); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
dev->SetRemoteStationManager (manager); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
node->AddDevice (dev); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
132 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
133 |
Simulator::Schedule (Seconds (1.0), &WifiTest::SendOnePacket, this, dev); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
134 |
} |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
135 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
136 |
void |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
137 |
WifiTest::RunOne (void) |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
138 |
{ |
3893
94f771c1373a
split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3888
diff
changeset
|
139 |
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> (); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
140 |
Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
141 |
Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
142 |
channel->SetPropagationDelayModel (propDelay); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
143 |
channel->SetPropagationLossModel (propLoss); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
144 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
145 |
CreateOne (Vector (0.0, 0.0, 0.0), channel); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
146 |
CreateOne (Vector (5.0, 0.0, 0.0), channel); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
147 |
CreateOne (Vector (5.0, 0.0, 0.0), channel); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
148 |
|
9733
7eca59a61873
bug 1659: WifiTest call Stop() before Run() (bug fix due to linlinjavaer@gmail.com)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9266
diff
changeset
|
149 |
Simulator::Stop (Seconds (10.0)); |
7eca59a61873
bug 1659: WifiTest call Stop() before Run() (bug fix due to linlinjavaer@gmail.com)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9266
diff
changeset
|
150 |
|
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
151 |
Simulator::Run (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
152 |
Simulator::Destroy (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
153 |
} |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
154 |
|
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
155 |
void |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
156 |
WifiTest::DoRun (void) |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
157 |
{ |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
158 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
159 |
m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel"); |
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
160 |
|
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
161 |
m_manager.SetTypeId ("ns3::ArfWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
162 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
163 |
m_manager.SetTypeId ("ns3::AarfWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
164 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
165 |
m_manager.SetTypeId ("ns3::ConstantRateWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
166 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
167 |
m_manager.SetTypeId ("ns3::OnoeWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
168 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
169 |
m_manager.SetTypeId ("ns3::AmrrWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
170 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
171 |
m_manager.SetTypeId ("ns3::IdealWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
172 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
173 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
174 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
175 |
RunOne (); |
6673
ec22aa763e2d
Bug 978: Consolidate Wi-Fi MAC high functionality
Dean Armstrong <deanarm@gmail.com>
parents:
6665
diff
changeset
|
176 |
m_mac.SetTypeId ("ns3::ApWifiMac"); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
177 |
RunOne (); |
6673
ec22aa763e2d
Bug 978: Consolidate Wi-Fi MAC high functionality
Dean Armstrong <deanarm@gmail.com>
parents:
6665
diff
changeset
|
178 |
m_mac.SetTypeId ("ns3::StaWifiMac"); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
179 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
180 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
181 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
182 |
m_propDelay.SetTypeId ("ns3::RandomPropagationDelayModel"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
183 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
184 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
185 |
} |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
186 |
|
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
187 |
//----------------------------------------------------------------------------- |
6600
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
188 |
class QosUtilsIsOldPacketTest : public TestCase |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
189 |
{ |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
190 |
public: |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
191 |
QosUtilsIsOldPacketTest () : TestCase ("QosUtilsIsOldPacket") |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
192 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
193 |
} |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
194 |
virtual void DoRun (void) |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
195 |
{ |
6600
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
196 |
// startingSeq=0, seqNum=2047 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
197 |
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2047), false, "2047 is new in comparison to 0"); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
198 |
// startingSeq=0, seqNum=2048 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
199 |
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2048), true, "2048 is old in comparison to 0"); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
200 |
// startingSeq=2048, seqNum=0 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
201 |
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 0), true, "0 is old in comparison to 2048"); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
202 |
// startingSeq=4095, seqNum=0 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
203 |
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 0), false, "0 is new in comparison to 4095"); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
204 |
// startingSeq=0, seqNum=4095 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
205 |
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 4095), true, "4095 is old in comparison to 0"); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
206 |
// startingSeq=4095 seqNum=2047 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
207 |
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 2047), true, "2047 is old in comparison to 4095"); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
208 |
// startingSeq=2048 seqNum=4095 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
209 |
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 4095), false, "4095 is new in comparison to 2048"); |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
210 |
// startingSeq=2049 seqNum=0 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
211 |
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2049, 0), false, "0 is new in comparison to 2049"); |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
212 |
} |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
213 |
}; |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
214 |
|
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
215 |
//----------------------------------------------------------------------------- |
10157
02e3d2d7d7e1
Link to bug num in bug database with \bugid{num}
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10139
diff
changeset
|
216 |
/** |
02e3d2d7d7e1
Link to bug num in bug database with \bugid{num}
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10139
diff
changeset
|
217 |
* See \bugid{991} |
02e3d2d7d7e1
Link to bug num in bug database with \bugid{num}
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10139
diff
changeset
|
218 |
*/ |
6665 | 219 |
class InterferenceHelperSequenceTest : public TestCase |
220 |
{ |
|
221 |
public: |
|
222 |
InterferenceHelperSequenceTest (); |
|
223 |
||
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
224 |
virtual void DoRun (void); |
6665 | 225 |
private: |
226 |
Ptr<Node> CreateOne (Vector pos, Ptr<YansWifiChannel> channel); |
|
227 |
void SendOnePacket (Ptr<WifiNetDevice> dev); |
|
228 |
void SwitchCh (Ptr<WifiNetDevice> dev); |
|
229 |
||
230 |
ObjectFactory m_manager; |
|
231 |
ObjectFactory m_mac; |
|
232 |
ObjectFactory m_propDelay; |
|
233 |
}; |
|
234 |
||
235 |
InterferenceHelperSequenceTest::InterferenceHelperSequenceTest () |
|
236 |
: TestCase ("InterferenceHelperSequence") |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
237 |
{ |
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
238 |
} |
6665 | 239 |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
240 |
void |
6665 | 241 |
InterferenceHelperSequenceTest::SendOnePacket (Ptr<WifiNetDevice> dev) |
242 |
{ |
|
243 |
Ptr<Packet> p = Create<Packet> (9999); |
|
244 |
dev->Send (p, dev->GetBroadcast (), 1); |
|
245 |
} |
|
246 |
||
247 |
void |
|
248 |
InterferenceHelperSequenceTest::SwitchCh (Ptr<WifiNetDevice> dev) |
|
249 |
{ |
|
250 |
Ptr<WifiPhy> p = dev->GetPhy (); |
|
251 |
p->SetChannelNumber (1); |
|
252 |
} |
|
253 |
||
254 |
Ptr<Node> |
|
255 |
InterferenceHelperSequenceTest::CreateOne (Vector pos, Ptr<YansWifiChannel> channel) |
|
256 |
{ |
|
257 |
Ptr<Node> node = CreateObject<Node> (); |
|
258 |
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> (); |
|
259 |
||
260 |
Ptr<WifiMac> mac = m_mac.Create<WifiMac> (); |
|
261 |
mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
|
262 |
Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> (); |
|
263 |
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> (); |
|
264 |
Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> (); |
|
265 |
phy->SetErrorRateModel (error); |
|
266 |
phy->SetChannel (channel); |
|
267 |
phy->SetDevice (dev); |
|
268 |
phy->SetMobility (node); |
|
269 |
phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
|
270 |
Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> (); |
|
271 |
||
272 |
mobility->SetPosition (pos); |
|
273 |
node->AggregateObject (mobility); |
|
274 |
mac->SetAddress (Mac48Address::Allocate ()); |
|
275 |
dev->SetMac (mac); |
|
276 |
dev->SetPhy (phy); |
|
277 |
dev->SetRemoteStationManager (manager); |
|
278 |
node->AddDevice (dev); |
|
279 |
||
280 |
return node; |
|
281 |
} |
|
282 |
||
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
283 |
void |
6665 | 284 |
InterferenceHelperSequenceTest::DoRun (void) |
285 |
{ |
|
286 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
|
287 |
m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel"); |
|
288 |
m_manager.SetTypeId ("ns3::ConstantRateWifiManager"); |
|
289 |
||
290 |
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> (); |
|
291 |
Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> (); |
|
292 |
Ptr<MatrixPropagationLossModel> propLoss = CreateObject<MatrixPropagationLossModel> (); |
|
293 |
channel->SetPropagationDelayModel (propDelay); |
|
294 |
channel->SetPropagationLossModel (propLoss); |
|
295 |
||
296 |
Ptr<Node> rxOnly = CreateOne (Vector (0.0, 0.0, 0.0), channel); |
|
297 |
Ptr<Node> senderA = CreateOne (Vector (5.0, 0.0, 0.0), channel); |
|
298 |
Ptr<Node> senderB = CreateOne (Vector (-5.0, 0.0, 0.0), channel); |
|
299 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
300 |
propLoss->SetLoss (senderB->GetObject<MobilityModel> (), rxOnly->GetObject<MobilityModel> (), 0, true); |
6665 | 301 |
propLoss->SetDefaultLoss (999); |
302 |
||
303 |
Simulator::Schedule (Seconds (1.0), |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
304 |
&InterferenceHelperSequenceTest::SendOnePacket, this, |
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
305 |
DynamicCast<WifiNetDevice> (senderB->GetDevice (0))); |
6665 | 306 |
|
307 |
Simulator::Schedule (Seconds (1.0000001), |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
308 |
&InterferenceHelperSequenceTest::SwitchCh, this, |
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
309 |
DynamicCast<WifiNetDevice> (rxOnly->GetDevice (0))); |
6665 | 310 |
|
311 |
Simulator::Schedule (Seconds (5.0), |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
312 |
&InterferenceHelperSequenceTest::SendOnePacket, this, |
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
313 |
DynamicCast<WifiNetDevice> (senderA->GetDevice (0))); |
6665 | 314 |
|
315 |
Simulator::Schedule (Seconds (7.0), |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
316 |
&InterferenceHelperSequenceTest::SendOnePacket, this, |
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
317 |
DynamicCast<WifiNetDevice> (senderB->GetDevice (0))); |
6665 | 318 |
|
319 |
Simulator::Stop (Seconds (100.0)); |
|
320 |
Simulator::Run (); |
|
321 |
||
322 |
Simulator::Destroy (); |
|
323 |
} |
|
324 |
||
325 |
//----------------------------------------------------------------------------- |
|
9176
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
326 |
/** |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
327 |
* Make sure that when multiple broadcast packets are queued on the same |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
328 |
* device in a short succession no virtual collision occurs |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
329 |
* |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
330 |
* The observed behavior is that the first frame will be sent immediately, |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
331 |
* and the frames are spaced by (backoff + SIFS + AIFS) time intervals |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
332 |
* (where backoff is a random number of slot sizes up to maximum CW) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
333 |
* |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
334 |
* The following test case should _not_ generate virtual collision for the second frame. |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
335 |
* The seed and run numbers were pick such that the second frame gets backoff = 0. |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
336 |
* |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
337 |
* frame 1, frame 2 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
338 |
* arrive SIFS + AIFS |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
339 |
* V <-----------> |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
340 |
* time |--------------|-------------------|-------------|-----------> |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
341 |
* 0 1s 1.001408s 1.001442s |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
342 |
* ^ ^ ^ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
343 |
* start TX finish TX start TX |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
344 |
* frame 1 frame 1 frame 2 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
345 |
* ^ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
346 |
* frame 2 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
347 |
* backoff = 0 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
348 |
* |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
349 |
* The buggy behavior was that frame 2 experiences a virtual collision and re-selects the |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
350 |
* backoff again. As a result, the _actual_ backoff experience by frame 2 is less likely to be 0 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
351 |
* since that would require two successions of 0 backoff (one that generates the virtual collision and |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
352 |
* one after the virtual collision). |
10157
02e3d2d7d7e1
Link to bug num in bug database with \bugid{num}
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10139
diff
changeset
|
353 |
* |
02e3d2d7d7e1
Link to bug num in bug database with \bugid{num}
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10139
diff
changeset
|
354 |
* See \bugid{555} |
9176
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
355 |
*/ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
356 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
357 |
class Bug555TestCase : public TestCase |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
358 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
359 |
public: |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
360 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
361 |
Bug555TestCase (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
362 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
363 |
virtual void DoRun (void); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
364 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
365 |
private: |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
366 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
367 |
void SendOnePacket (Ptr<WifiNetDevice> dev); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
368 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
369 |
ObjectFactory m_manager; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
370 |
ObjectFactory m_mac; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
371 |
ObjectFactory m_propDelay; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
372 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
373 |
Time m_firstTransmissionTime; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
374 |
Time m_secondTransmissionTime; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
375 |
unsigned int m_numSentPackets; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
376 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
377 |
void NotifyPhyTxBegin (Ptr<const Packet> p); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
378 |
}; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
379 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
380 |
Bug555TestCase::Bug555TestCase () |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
381 |
: TestCase ("Test case for Bug 555") |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
382 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
383 |
} |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
384 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
385 |
void |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
386 |
Bug555TestCase::NotifyPhyTxBegin (Ptr<const Packet> p) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
387 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
388 |
if (m_numSentPackets == 0) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
389 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
390 |
NS_ASSERT_MSG (Simulator::Now() == Time (Seconds (1)), "Packet 0 not transmitted at 1 second"); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
391 |
m_numSentPackets++; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
392 |
m_firstTransmissionTime = Simulator::Now (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
393 |
} |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
394 |
else if (m_numSentPackets == 1) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
395 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
396 |
m_secondTransmissionTime = Simulator::Now (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
397 |
} |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
398 |
} |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
399 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
400 |
void |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
401 |
Bug555TestCase::SendOnePacket (Ptr<WifiNetDevice> dev) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
402 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
403 |
Ptr<Packet> p = Create<Packet> (1000); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
404 |
dev->Send (p, dev->GetBroadcast (), 1); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
405 |
} |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
406 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
407 |
void |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
408 |
Bug555TestCase::DoRun (void) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
409 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
410 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
411 |
m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel"); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
412 |
m_manager.SetTypeId ("ns3::ConstantRateWifiManager"); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
413 |
|
10195
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
414 |
// Assign a seed and run number, and later fix the assignment of streams to |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
415 |
// WiFi random variables, so that the first backoff used is zero slots |
9176
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
416 |
RngSeedManager::SetSeed (1); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
417 |
RngSeedManager::SetRun (17); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
418 |
|
10206
ecd136bcb899
Bug 1722 - beacons transmitted concurrently
Tom Henderson <tomh@tomh.org>
parents:
10195
diff
changeset
|
419 |
// Disable the initial jitter of AP beacons (test case was written before |
ecd136bcb899
Bug 1722 - beacons transmitted concurrently
Tom Henderson <tomh@tomh.org>
parents:
10195
diff
changeset
|
420 |
// beacon jitter was added) |
ecd136bcb899
Bug 1722 - beacons transmitted concurrently
Tom Henderson <tomh@tomh.org>
parents:
10195
diff
changeset
|
421 |
Config::SetDefault ("ns3::ApWifiMac::EnableBeaconJitter", BooleanValue (false)); |
ecd136bcb899
Bug 1722 - beacons transmitted concurrently
Tom Henderson <tomh@tomh.org>
parents:
10195
diff
changeset
|
422 |
|
9176
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
423 |
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
424 |
Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
425 |
Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
426 |
channel->SetPropagationDelayModel (propDelay); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
427 |
channel->SetPropagationLossModel (propLoss); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
428 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
429 |
Ptr<Node> txNode = CreateObject<Node> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
430 |
Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
431 |
Ptr<WifiMac> txMac = m_mac.Create<WifiMac> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
432 |
txMac->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
10195
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
433 |
// Fix the stream assignment to the Dcf Txop objects (backoffs) |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
434 |
// The below stream assignment will result in the DcaTxop object |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
435 |
// using a backoff value of zero for this test when the |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
436 |
// DcaTxop::EndTxNoAck() calls to StartBackoffNow() |
423dfabf60c1
make wifi tests more robust to random variable perturbations
Tom Henderson <tomh@tomh.org>
parents:
10157
diff
changeset
|
437 |
AssignWifiRandomStreams (txMac, 23); |
9176
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
438 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
439 |
Ptr<ConstantPositionMobilityModel> txMobility = CreateObject<ConstantPositionMobilityModel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
440 |
Ptr<YansWifiPhy> txPhy = CreateObject<YansWifiPhy> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
441 |
Ptr<ErrorRateModel> txError = CreateObject<YansErrorRateModel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
442 |
txPhy->SetErrorRateModel (txError); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
443 |
txPhy->SetChannel (channel); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
444 |
txPhy->SetDevice (txDev); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
445 |
txPhy->SetMobility (txNode); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
446 |
txPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
447 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
448 |
txPhy->TraceConnectWithoutContext ("PhyTxBegin", MakeCallback (&Bug555TestCase::NotifyPhyTxBegin, this)); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
449 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
450 |
txMobility->SetPosition (Vector (0.0, 0.0, 0.0)); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
451 |
txNode->AggregateObject (txMobility); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
452 |
txMac->SetAddress (Mac48Address::Allocate ()); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
453 |
txDev->SetMac (txMac); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
454 |
txDev->SetPhy (txPhy); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
455 |
txDev->SetRemoteStationManager (m_manager.Create<WifiRemoteStationManager> ()); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
456 |
txNode->AddDevice (txDev); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
457 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
458 |
m_firstTransmissionTime = Seconds (0.0); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
459 |
m_secondTransmissionTime = Seconds (0.0); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
460 |
m_numSentPackets = 0; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
461 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
462 |
Simulator::Schedule (Seconds (1.0), &Bug555TestCase::SendOnePacket, this, txDev); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
463 |
Simulator::Schedule (Seconds (1.0), &Bug555TestCase::SendOnePacket, this, txDev); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
464 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
465 |
Simulator::Stop (Seconds (2.0)); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
466 |
Simulator::Run (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
467 |
Simulator::Destroy (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
468 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
469 |
// First packet has 1408 us of transmit time. Slot time is 9 us. |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
470 |
// Backoff is 0 slots. SIFS is 16 us. AIFS is 2 slots = 18 us. |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
471 |
// Should send next packet at 1408 us + (0 * 9 us) + 16 us + 18 us |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
472 |
// 1442 us after the first one. |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
473 |
uint32_t expectedWait1 = 1408 + (0 * 9) + 16 + 18; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
474 |
Time expectedSecondTransmissionTime = MicroSeconds (expectedWait1) + Seconds (1.0); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
475 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
476 |
NS_TEST_ASSERT_MSG_EQ (m_secondTransmissionTime, expectedSecondTransmissionTime, "The second transmission time not correct!"); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
477 |
} |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
478 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
479 |
//----------------------------------------------------------------------------- |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
480 |
class WifiTestSuite : public TestSuite |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
481 |
{ |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
482 |
public: |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
483 |
WifiTestSuite (); |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
484 |
}; |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
485 |
|
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
486 |
WifiTestSuite::WifiTestSuite () |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
487 |
: TestSuite ("devices-wifi", UNIT) |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
488 |
{ |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9176
diff
changeset
|
489 |
AddTestCase (new WifiTest, TestCase::QUICK); |
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9176
diff
changeset
|
490 |
AddTestCase (new QosUtilsIsOldPacketTest, TestCase::QUICK); |
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9176
diff
changeset
|
491 |
AddTestCase (new InterferenceHelperSequenceTest, TestCase::QUICK); // Bug 991 |
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9176
diff
changeset
|
492 |
AddTestCase (new Bug555TestCase, TestCase::QUICK); // Bug 555 |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
493 |
} |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
494 |
|
6774
034f362af24d
Make all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6674
diff
changeset
|
495 |
static WifiTestSuite g_wifiTestSuite; |