author | Nicola Baldo <nbaldo@cttc.es> |
Fri, 22 Mar 2013 13:14:38 +0100 | |
changeset 9266 | d26408b17360 |
parent 9176 | 41ab1e874804 |
child 9733 | 7eca59a61873 |
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" |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
namespace ns3 { |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
43 |
|
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
44 |
class WifiTest : public TestCase |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
{ |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
public: |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
WifiTest (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
|
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
49 |
virtual void DoRun (void); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
private: |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
void RunOne (void); |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
52 |
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
|
53 |
void SendOnePacket (Ptr<WifiNetDevice> dev); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
ObjectFactory m_manager; |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
ObjectFactory m_mac; |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
57 |
ObjectFactory m_propDelay; |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
}; |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
60 |
WifiTest::WifiTest () |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
61 |
: 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
|
62 |
{ |
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
63 |
} |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
65 |
void |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
66 |
WifiTest::SendOnePacket (Ptr<WifiNetDevice> dev) |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
67 |
{ |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
Ptr<Packet> p = Create<Packet> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
69 |
dev->Send (p, dev->GetBroadcast (), 1); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
} |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
71 |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
72 |
void |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
73 |
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
|
74 |
{ |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
Ptr<Node> node = CreateObject<Node> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
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
|
79 |
mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
4257
3e8f8052e155
StaticMobilityModel -> ConstantPositionMobilityModel, StaticSpeedMobilityModel -> ConstantVelocityMobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4038
diff
changeset
|
80 |
Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> (); |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
81 |
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> (); |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
82 |
Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> (); |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
83 |
phy->SetErrorRateModel (error); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
84 |
phy->SetChannel (channel); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
85 |
phy->SetDevice (dev); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
86 |
phy->SetMobility (node); |
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4406
diff
changeset
|
87 |
phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> (); |
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 |
mobility->SetPosition (pos); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
node->AggregateObject (mobility); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
mac->SetAddress (Mac48Address::Allocate ()); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
dev->SetMac (mac); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
94 |
dev->SetPhy (phy); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
dev->SetRemoteStationManager (manager); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
node->AddDevice (dev); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
97 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
98 |
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
|
99 |
} |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
void |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
WifiTest::RunOne (void) |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
103 |
{ |
3893
94f771c1373a
split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3888
diff
changeset
|
104 |
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> (); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
105 |
Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
107 |
channel->SetPropagationDelayModel (propDelay); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
108 |
channel->SetPropagationLossModel (propLoss); |
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 |
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
|
111 |
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
|
112 |
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
|
113 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
114 |
Simulator::Run (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
115 |
Simulator::Destroy (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
116 |
|
3174
efeb6e5c276d
Make Application::Start/Stop times relative, Simulator::StopAt(time) renamed to Simulator::Stop(time) and time also made relative, to improve consistency of the API which uses relative times everywhere else. Closes bug #191.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2627
diff
changeset
|
117 |
Simulator::Stop (Seconds (10.0)); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
118 |
} |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
119 |
|
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
120 |
void |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
121 |
WifiTest::DoRun (void) |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
122 |
{ |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
123 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
124 |
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
|
125 |
|
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
126 |
m_manager.SetTypeId ("ns3::ArfWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
127 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
m_manager.SetTypeId ("ns3::AarfWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
129 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
m_manager.SetTypeId ("ns3::ConstantRateWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
132 |
m_manager.SetTypeId ("ns3::OnoeWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
133 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
134 |
m_manager.SetTypeId ("ns3::AmrrWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
135 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
136 |
m_manager.SetTypeId ("ns3::IdealWifiManager"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
137 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
138 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
139 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
140 |
RunOne (); |
6673
ec22aa763e2d
Bug 978: Consolidate Wi-Fi MAC high functionality
Dean Armstrong <deanarm@gmail.com>
parents:
6665
diff
changeset
|
141 |
m_mac.SetTypeId ("ns3::ApWifiMac"); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
142 |
RunOne (); |
6673
ec22aa763e2d
Bug 978: Consolidate Wi-Fi MAC high functionality
Dean Armstrong <deanarm@gmail.com>
parents:
6665
diff
changeset
|
143 |
m_mac.SetTypeId ("ns3::StaWifiMac"); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
144 |
RunOne (); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
145 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
146 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
147 |
m_propDelay.SetTypeId ("ns3::RandomPropagationDelayModel"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
148 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
149 |
RunOne (); |
5919
b89ce2e9eed5
Bug 793: remove remaining memory leaks due to not cleaned Simulator
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
5320
diff
changeset
|
150 |
Simulator::Destroy (); |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
151 |
} |
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
152 |
|
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
153 |
//----------------------------------------------------------------------------- |
6600
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
154 |
class QosUtilsIsOldPacketTest : public TestCase |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
155 |
{ |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
156 |
public: |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
157 |
QosUtilsIsOldPacketTest () : TestCase ("QosUtilsIsOldPacket") |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
158 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
159 |
} |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
160 |
virtual void DoRun (void) |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
161 |
{ |
6600
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
162 |
// startingSeq=0, seqNum=2047 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
163 |
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
|
164 |
// startingSeq=0, seqNum=2048 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
165 |
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
|
166 |
// startingSeq=2048, seqNum=0 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
167 |
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
|
168 |
// startingSeq=4095, seqNum=0 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
169 |
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
|
170 |
// startingSeq=0, seqNum=4095 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
171 |
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
|
172 |
// startingSeq=4095 seqNum=2047 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
173 |
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
|
174 |
// startingSeq=2048 seqNum=4095 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
175 |
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
|
176 |
// startingSeq=2049 seqNum=0 |
e438f9b17c66
Replace MacRxMiddle::SequenceControlSmaller with QosUtilsIsOldPacket method
Mirko Banchi <mk.banchi@gmail.com>
parents:
5944
diff
changeset
|
177 |
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
|
178 |
} |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
179 |
}; |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
180 |
|
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
181 |
//----------------------------------------------------------------------------- |
6665 | 182 |
class InterferenceHelperSequenceTest : public TestCase |
183 |
{ |
|
184 |
public: |
|
185 |
InterferenceHelperSequenceTest (); |
|
186 |
||
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
187 |
virtual void DoRun (void); |
6665 | 188 |
private: |
189 |
Ptr<Node> CreateOne (Vector pos, Ptr<YansWifiChannel> channel); |
|
190 |
void SendOnePacket (Ptr<WifiNetDevice> dev); |
|
191 |
void SwitchCh (Ptr<WifiNetDevice> dev); |
|
192 |
||
193 |
ObjectFactory m_manager; |
|
194 |
ObjectFactory m_mac; |
|
195 |
ObjectFactory m_propDelay; |
|
196 |
}; |
|
197 |
||
198 |
InterferenceHelperSequenceTest::InterferenceHelperSequenceTest () |
|
199 |
: 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
|
200 |
{ |
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
201 |
} |
6665 | 202 |
|
6674
52f8688d6d01
Bug 978: Run check-style.py on files touched in the reorganisation
Dean Armstrong <deanarm@gmail.com>
parents:
6673
diff
changeset
|
203 |
void |
6665 | 204 |
InterferenceHelperSequenceTest::SendOnePacket (Ptr<WifiNetDevice> dev) |
205 |
{ |
|
206 |
Ptr<Packet> p = Create<Packet> (9999); |
|
207 |
dev->Send (p, dev->GetBroadcast (), 1); |
|
208 |
} |
|
209 |
||
210 |
void |
|
211 |
InterferenceHelperSequenceTest::SwitchCh (Ptr<WifiNetDevice> dev) |
|
212 |
{ |
|
213 |
Ptr<WifiPhy> p = dev->GetPhy (); |
|
214 |
p->SetChannelNumber (1); |
|
215 |
} |
|
216 |
||
217 |
Ptr<Node> |
|
218 |
InterferenceHelperSequenceTest::CreateOne (Vector pos, Ptr<YansWifiChannel> channel) |
|
219 |
{ |
|
220 |
Ptr<Node> node = CreateObject<Node> (); |
|
221 |
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> (); |
|
222 |
||
223 |
Ptr<WifiMac> mac = m_mac.Create<WifiMac> (); |
|
224 |
mac->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
|
225 |
Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> (); |
|
226 |
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> (); |
|
227 |
Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> (); |
|
228 |
phy->SetErrorRateModel (error); |
|
229 |
phy->SetChannel (channel); |
|
230 |
phy->SetDevice (dev); |
|
231 |
phy->SetMobility (node); |
|
232 |
phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
|
233 |
Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> (); |
|
234 |
||
235 |
mobility->SetPosition (pos); |
|
236 |
node->AggregateObject (mobility); |
|
237 |
mac->SetAddress (Mac48Address::Allocate ()); |
|
238 |
dev->SetMac (mac); |
|
239 |
dev->SetPhy (phy); |
|
240 |
dev->SetRemoteStationManager (manager); |
|
241 |
node->AddDevice (dev); |
|
242 |
||
243 |
return node; |
|
244 |
} |
|
245 |
||
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
246 |
void |
6665 | 247 |
InterferenceHelperSequenceTest::DoRun (void) |
248 |
{ |
|
249 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
|
250 |
m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel"); |
|
251 |
m_manager.SetTypeId ("ns3::ConstantRateWifiManager"); |
|
252 |
||
253 |
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> (); |
|
254 |
Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> (); |
|
255 |
Ptr<MatrixPropagationLossModel> propLoss = CreateObject<MatrixPropagationLossModel> (); |
|
256 |
channel->SetPropagationDelayModel (propDelay); |
|
257 |
channel->SetPropagationLossModel (propLoss); |
|
258 |
||
259 |
Ptr<Node> rxOnly = CreateOne (Vector (0.0, 0.0, 0.0), channel); |
|
260 |
Ptr<Node> senderA = CreateOne (Vector (5.0, 0.0, 0.0), channel); |
|
261 |
Ptr<Node> senderB = CreateOne (Vector (-5.0, 0.0, 0.0), channel); |
|
262 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
263 |
propLoss->SetLoss (senderB->GetObject<MobilityModel> (), rxOnly->GetObject<MobilityModel> (), 0, true); |
6665 | 264 |
propLoss->SetDefaultLoss (999); |
265 |
||
266 |
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
|
267 |
&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
|
268 |
DynamicCast<WifiNetDevice> (senderB->GetDevice (0))); |
6665 | 269 |
|
270 |
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
|
271 |
&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
|
272 |
DynamicCast<WifiNetDevice> (rxOnly->GetDevice (0))); |
6665 | 273 |
|
274 |
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
|
275 |
&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
|
276 |
DynamicCast<WifiNetDevice> (senderA->GetDevice (0))); |
6665 | 277 |
|
278 |
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
|
279 |
&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
|
280 |
DynamicCast<WifiNetDevice> (senderB->GetDevice (0))); |
6665 | 281 |
|
282 |
Simulator::Stop (Seconds (100.0)); |
|
283 |
Simulator::Run (); |
|
284 |
||
285 |
Simulator::Destroy (); |
|
286 |
} |
|
287 |
||
288 |
//----------------------------------------------------------------------------- |
|
9176
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
289 |
/** |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
290 |
* 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
|
291 |
* 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
|
292 |
* |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
293 |
* 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
|
294 |
* 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
|
295 |
* (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
|
296 |
* |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
297 |
* 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
|
298 |
* 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
|
299 |
* |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
300 |
* frame 1, frame 2 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
301 |
* arrive SIFS + AIFS |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
302 |
* V <-----------> |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
303 |
* time |--------------|-------------------|-------------|-----------> |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
304 |
* 0 1s 1.001408s 1.001442s |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
305 |
* ^ ^ ^ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
306 |
* start TX finish TX start TX |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
307 |
* frame 1 frame 1 frame 2 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
308 |
* ^ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
309 |
* frame 2 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
310 |
* backoff = 0 |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
311 |
* |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
312 |
* 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
|
313 |
* 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
|
314 |
* 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
|
315 |
* one after the virtual collision). |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
316 |
*/ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
317 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
318 |
class Bug555TestCase : public TestCase |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
319 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
320 |
public: |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
321 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
322 |
Bug555TestCase (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
323 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
324 |
virtual void DoRun (void); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
325 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
326 |
private: |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
327 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
328 |
void SendOnePacket (Ptr<WifiNetDevice> dev); |
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 |
ObjectFactory m_manager; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
331 |
ObjectFactory m_mac; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
332 |
ObjectFactory m_propDelay; |
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 |
Time m_firstTransmissionTime; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
335 |
Time m_secondTransmissionTime; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
336 |
unsigned int m_numSentPackets; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
337 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
338 |
void NotifyPhyTxBegin (Ptr<const Packet> p); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
339 |
}; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
340 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
341 |
Bug555TestCase::Bug555TestCase () |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
342 |
: TestCase ("Test case for Bug 555") |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
343 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
344 |
} |
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 |
void |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
347 |
Bug555TestCase::NotifyPhyTxBegin (Ptr<const Packet> p) |
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 |
if (m_numSentPackets == 0) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
350 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
351 |
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
|
352 |
m_numSentPackets++; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
353 |
m_firstTransmissionTime = Simulator::Now (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
354 |
} |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
355 |
else if (m_numSentPackets == 1) |
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 |
m_secondTransmissionTime = Simulator::Now (); |
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 |
} |
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 |
void |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
362 |
Bug555TestCase::SendOnePacket (Ptr<WifiNetDevice> dev) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
363 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
364 |
Ptr<Packet> p = Create<Packet> (1000); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
365 |
dev->Send (p, dev->GetBroadcast (), 1); |
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 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
368 |
void |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
369 |
Bug555TestCase::DoRun (void) |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
370 |
{ |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
371 |
m_mac.SetTypeId ("ns3::AdhocWifiMac"); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
372 |
m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel"); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
373 |
m_manager.SetTypeId ("ns3::ConstantRateWifiManager"); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
374 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
375 |
//The simulation with the following seed and run numbers expe |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
376 |
RngSeedManager::SetSeed (1); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
377 |
RngSeedManager::SetRun (17); |
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 |
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
380 |
Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
381 |
Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
382 |
channel->SetPropagationDelayModel (propDelay); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
383 |
channel->SetPropagationLossModel (propLoss); |
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 |
Ptr<Node> txNode = CreateObject<Node> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
386 |
Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
387 |
Ptr<WifiMac> txMac = m_mac.Create<WifiMac> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
388 |
txMac->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
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 |
Ptr<ConstantPositionMobilityModel> txMobility = CreateObject<ConstantPositionMobilityModel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
391 |
Ptr<YansWifiPhy> txPhy = CreateObject<YansWifiPhy> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
392 |
Ptr<ErrorRateModel> txError = CreateObject<YansErrorRateModel> (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
393 |
txPhy->SetErrorRateModel (txError); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
394 |
txPhy->SetChannel (channel); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
395 |
txPhy->SetDevice (txDev); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
396 |
txPhy->SetMobility (txNode); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
397 |
txPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211a); |
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 |
txPhy->TraceConnectWithoutContext ("PhyTxBegin", MakeCallback (&Bug555TestCase::NotifyPhyTxBegin, this)); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
400 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
401 |
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
|
402 |
txNode->AggregateObject (txMobility); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
403 |
txMac->SetAddress (Mac48Address::Allocate ()); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
404 |
txDev->SetMac (txMac); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
405 |
txDev->SetPhy (txPhy); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
406 |
txDev->SetRemoteStationManager (m_manager.Create<WifiRemoteStationManager> ()); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
407 |
txNode->AddDevice (txDev); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
408 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
409 |
m_firstTransmissionTime = Seconds (0.0); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
410 |
m_secondTransmissionTime = Seconds (0.0); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
411 |
m_numSentPackets = 0; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
412 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
413 |
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
|
414 |
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
|
415 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
416 |
Simulator::Stop (Seconds (2.0)); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
417 |
Simulator::Run (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
418 |
Simulator::Destroy (); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
419 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
420 |
// 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
|
421 |
// 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
|
422 |
// 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
|
423 |
// 1442 us after the first one. |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
424 |
uint32_t expectedWait1 = 1408 + (0 * 9) + 16 + 18; |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
425 |
Time expectedSecondTransmissionTime = MicroSeconds (expectedWait1) + Seconds (1.0); |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
426 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
427 |
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
|
428 |
} |
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
429 |
|
41ab1e874804
Bug 555 - DCF immediate access fix
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7385
diff
changeset
|
430 |
//----------------------------------------------------------------------------- |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
431 |
|
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
432 |
class WifiTestSuite : public TestSuite |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
433 |
{ |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
434 |
public: |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
435 |
WifiTestSuite (); |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
436 |
}; |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
437 |
|
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
438 |
WifiTestSuite::WifiTestSuite () |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
439 |
: TestSuite ("devices-wifi", UNIT) |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
440 |
{ |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9176
diff
changeset
|
441 |
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
|
442 |
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
|
443 |
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
|
444 |
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
|
445 |
} |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4720
diff
changeset
|
446 |
|
6774
034f362af24d
Make all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6674
diff
changeset
|
447 |
static WifiTestSuite g_wifiTestSuite; |
2626
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
448 |
|
bc07dd340992
A bunch of wifi smoke tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
449 |
} // namespace ns3 |