author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 29 Nov 2007 16:28:16 +0100 | |
changeset 2172 | eb1adef495b6 |
parent 2145 | 8f3c8ef34b0a |
child 2508 | 18b690d1e74b |
permissions | -rw-r--r-- |
2097 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
#ifdef RUN_SELF_TESTS |
|
3 |
||
4 |
#include "ns3/test.h" |
|
5 |
#include "ns3/simulator.h" |
|
6 |
#include "dcf-manager.h" |
|
7 |
#include "mac-parameters.h" |
|
8 |
||
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
9 |
|
2097 | 10 |
namespace ns3 { |
11 |
||
12 |
class DcfManagerTest; |
|
13 |
||
14 |
class DcfStateTest : public DcfState |
|
15 |
{ |
|
16 |
public: |
|
17 |
DcfStateTest (DcfManagerTest *test, uint32_t i); |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
18 |
void QueueTx (uint64_t txTime, uint64_t expectedGrantTime); |
2097 | 19 |
private: |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
20 |
friend class DcfManagerTest; |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
21 |
virtual void DoNotifyAccessGranted (void); |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
22 |
virtual void DoNotifyInternalCollision (void); |
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
23 |
virtual void DoNotifyCollision (void); |
2097 | 24 |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
25 |
typedef std::pair<uint64_t,uint64_t> ExpectedGrant; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
26 |
typedef std::list<ExpectedGrant> ExpectedGrants; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
27 |
struct ExpectedCollision { |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
28 |
uint64_t at; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
29 |
uint32_t nSlots; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
30 |
}; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
31 |
typedef std::list<struct ExpectedCollision> ExpectedCollisions; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
32 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
33 |
ExpectedCollisions m_expectedInternalCollision; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
34 |
ExpectedCollisions m_expectedCollision; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
35 |
ExpectedGrants m_expectedGrants; |
2097 | 36 |
DcfManagerTest *m_test; |
37 |
uint32_t m_i; |
|
38 |
}; |
|
39 |
||
40 |
||
41 |
class DcfManagerTest : public Test |
|
42 |
{ |
|
43 |
public: |
|
44 |
DcfManagerTest (); |
|
45 |
virtual bool RunTests (void); |
|
46 |
||
47 |
||
48 |
void NotifyAccessGranted (uint32_t i); |
|
49 |
void NotifyInternalCollision (uint32_t i); |
|
50 |
void NotifyCollision (uint32_t i); |
|
51 |
||
52 |
||
53 |
private: |
|
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
54 |
void StartTest (uint64_t slotTime, uint64_t sifs, uint64_t ackTxDuration); |
2126
c2f1ec692e70
ignore cwmin/cwmax parameters since we set the backoff slots for every collision.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2125
diff
changeset
|
55 |
void AddDcfState (uint32_t aifsn); |
2097 | 56 |
void EndTest (void); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
57 |
void ExpectInternalCollision (uint64_t time, uint32_t from, uint32_t nSlots); |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
58 |
void ExpectCollision (uint64_t time, uint32_t from, uint32_t nSlots); |
2098 | 59 |
void AddRxOkEvt (uint64_t at, uint64_t duration); |
60 |
void AddRxErrorEvt (uint64_t at, uint64_t duration); |
|
61 |
void AddNavReset (uint64_t at, uint64_t duration); |
|
62 |
void AddNavStart (uint64_t at, uint64_t duration); |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
63 |
void AddAccessRequest (uint64_t at, uint64_t txTime, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
64 |
uint64_t expectedGrantTime, uint32_t from); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
65 |
void DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, DcfStateTest *state); |
2098 | 66 |
|
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
67 |
typedef std::vector<DcfStateTest *> DcfStates; |
2097 | 68 |
|
69 |
DcfManager *m_dcfManager; |
|
70 |
MacParameters *m_parameters; |
|
71 |
DcfStates m_dcfStates; |
|
72 |
bool m_result; |
|
73 |
}; |
|
74 |
||
75 |
||
76 |
||
77 |
DcfStateTest::DcfStateTest (DcfManagerTest *test, uint32_t i) |
|
78 |
: m_test (test), m_i(i) |
|
79 |
{} |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
80 |
void |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
81 |
DcfStateTest::QueueTx (uint64_t txTime, uint64_t expectedGrantTime) |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
82 |
{ |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
83 |
m_expectedGrants.push_back (std::make_pair (txTime, expectedGrantTime)); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
84 |
} |
2097 | 85 |
void |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
86 |
DcfStateTest::DoNotifyAccessGranted (void) |
2097 | 87 |
{ |
88 |
m_test->NotifyAccessGranted (m_i); |
|
89 |
} |
|
90 |
void |
|
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
91 |
DcfStateTest::DoNotifyInternalCollision (void) |
2097 | 92 |
{ |
93 |
m_test->NotifyInternalCollision (m_i); |
|
94 |
} |
|
95 |
void |
|
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
96 |
DcfStateTest::DoNotifyCollision (void) |
2097 | 97 |
{ |
98 |
m_test->NotifyCollision (m_i); |
|
99 |
} |
|
100 |
||
101 |
||
102 |
||
103 |
DcfManagerTest::DcfManagerTest () |
|
104 |
: Test ("DcfManager") |
|
105 |
{} |
|
106 |
||
107 |
void |
|
108 |
DcfManagerTest::NotifyAccessGranted (uint32_t i) |
|
109 |
{ |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
110 |
DcfStateTest *state = m_dcfStates[i]; |
2097 | 111 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
112 |
NS_TEST_ASSERT (!state->m_expectedGrants.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
113 |
std::pair<uint64_t, uint64_t> expected = state->m_expectedGrants.front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
114 |
state->m_expectedGrants.pop_front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
115 |
NS_TEST_ASSERT_EQUAL (Simulator::Now (), MicroSeconds (expected.second)); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
116 |
m_dcfManager->NotifyTxStartNow (MicroSeconds (expected.first)); |
2097 | 117 |
if (!result) |
118 |
{ |
|
119 |
m_result = result; |
|
120 |
} |
|
121 |
} |
|
122 |
void |
|
123 |
DcfManagerTest::NotifyInternalCollision (uint32_t i) |
|
2098 | 124 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
125 |
DcfStateTest *state = m_dcfStates[i]; |
2098 | 126 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
127 |
NS_TEST_ASSERT (!state->m_expectedInternalCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
128 |
struct DcfStateTest::ExpectedCollision expected = state->m_expectedInternalCollision.front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
129 |
state->m_expectedInternalCollision.pop_front (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
130 |
NS_TEST_ASSERT_EQUAL (Simulator::Now (), MicroSeconds (expected.at)); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
131 |
state->StartBackoffNow (expected.nSlots); |
2098 | 132 |
if (!result) |
133 |
{ |
|
134 |
m_result = result; |
|
135 |
} |
|
136 |
} |
|
2097 | 137 |
void |
138 |
DcfManagerTest::NotifyCollision (uint32_t i) |
|
2098 | 139 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
140 |
DcfStateTest *state = m_dcfStates[i]; |
2098 | 141 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
142 |
NS_TEST_ASSERT (!state->m_expectedCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
143 |
struct DcfStateTest::ExpectedCollision expected = state->m_expectedCollision.front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
144 |
state->m_expectedCollision.pop_front (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
145 |
NS_TEST_ASSERT_EQUAL (Simulator::Now (), MicroSeconds (expected.at)); |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
146 |
state->StartBackoffNow (expected.nSlots); |
2098 | 147 |
if (!result) |
148 |
{ |
|
149 |
m_result = result; |
|
150 |
} |
|
151 |
} |
|
2097 | 152 |
|
153 |
||
154 |
void |
|
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
155 |
DcfManagerTest::ExpectInternalCollision (uint64_t time, uint32_t nSlots, uint32_t from) |
2098 | 156 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
157 |
DcfStateTest *state = m_dcfStates[from]; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
158 |
struct DcfStateTest::ExpectedCollision col; |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
159 |
col.at = time; |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
160 |
col.nSlots = nSlots; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
161 |
state->m_expectedInternalCollision.push_back (col); |
2098 | 162 |
} |
163 |
void |
|
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
164 |
DcfManagerTest::ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from) |
2098 | 165 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
166 |
DcfStateTest *state = m_dcfStates[from]; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
167 |
struct DcfStateTest::ExpectedCollision col; |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
168 |
col.at = time; |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
169 |
col.nSlots = nSlots; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
170 |
state->m_expectedCollision.push_back (col); |
2098 | 171 |
} |
2097 | 172 |
|
173 |
void |
|
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
174 |
DcfManagerTest::StartTest (uint64_t slotTime, uint64_t sifs, uint64_t ackTxDuration) |
2097 | 175 |
{ |
176 |
m_dcfManager = new DcfManager (); |
|
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
177 |
m_dcfManager->SetSlotTime (MicroSeconds (slotTime)); |
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
178 |
m_dcfManager->SetSifs (MicroSeconds (sifs)); |
2104
1ba670fdde06
more debugging.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2103
diff
changeset
|
179 |
m_dcfManager->SetAckTxDuration (MicroSeconds (ackTxDuration)); |
2097 | 180 |
} |
181 |
||
182 |
void |
|
2126
c2f1ec692e70
ignore cwmin/cwmax parameters since we set the backoff slots for every collision.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2125
diff
changeset
|
183 |
DcfManagerTest::AddDcfState (uint32_t aifsn) |
2097 | 184 |
{ |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
185 |
DcfStateTest *state = new DcfStateTest (this, m_dcfStates.size ()); |
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
186 |
state->SetAifsn (aifsn); |
2097 | 187 |
m_dcfStates.push_back (state); |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
188 |
m_dcfManager->Add (state); |
2097 | 189 |
} |
190 |
||
191 |
void |
|
192 |
DcfManagerTest::EndTest (void) |
|
193 |
{ |
|
194 |
bool result = true; |
|
195 |
Simulator::Run (); |
|
196 |
Simulator::Destroy (); |
|
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
197 |
for (DcfStates::const_iterator i = m_dcfStates.begin (); i != m_dcfStates.end (); i++) |
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
198 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
199 |
DcfStateTest *state = *i; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
200 |
NS_TEST_ASSERT (state->m_expectedGrants.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
201 |
NS_TEST_ASSERT (state->m_expectedInternalCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
202 |
NS_TEST_ASSERT (state->m_expectedCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
203 |
delete state; |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
204 |
} |
2097 | 205 |
m_dcfStates.clear (); |
206 |
delete m_dcfManager; |
|
207 |
delete m_parameters; |
|
208 |
if (!result) |
|
209 |
{ |
|
210 |
m_result = result; |
|
211 |
} |
|
212 |
} |
|
213 |
||
2098 | 214 |
void |
215 |
DcfManagerTest::AddRxOkEvt (uint64_t at, uint64_t duration) |
|
216 |
{ |
|
217 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
218 |
&DcfManager::NotifyRxStartNow, m_dcfManager, |
|
219 |
MicroSeconds (duration)); |
|
220 |
Simulator::Schedule (MicroSeconds (at+duration) - Now (), |
|
221 |
&DcfManager::NotifyRxEndOkNow, m_dcfManager); |
|
222 |
} |
|
223 |
void |
|
224 |
DcfManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration) |
|
225 |
{ |
|
226 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
227 |
&DcfManager::NotifyRxStartNow, m_dcfManager, |
|
228 |
MicroSeconds (duration)); |
|
229 |
Simulator::Schedule (MicroSeconds (at+duration) - Now (), |
|
230 |
&DcfManager::NotifyRxEndErrorNow, m_dcfManager); |
|
231 |
} |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
232 |
|
2098 | 233 |
void |
234 |
DcfManagerTest::AddNavReset (uint64_t at, uint64_t duration) |
|
235 |
{ |
|
236 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
237 |
&DcfManager::NotifyNavResetNow, m_dcfManager, |
|
238 |
MicroSeconds (duration)); |
|
239 |
} |
|
240 |
void |
|
241 |
DcfManagerTest::AddNavStart (uint64_t at, uint64_t duration) |
|
242 |
{ |
|
243 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
244 |
&DcfManager::NotifyNavStartNow, m_dcfManager, |
|
245 |
MicroSeconds (duration)); |
|
246 |
} |
|
247 |
void |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
248 |
DcfManagerTest::AddAccessRequest (uint64_t at, uint64_t txTime, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
249 |
uint64_t expectedGrantTime, uint32_t from) |
2098 | 250 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
251 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
252 |
&DcfManagerTest::DoAccessRequest, this, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
253 |
txTime, expectedGrantTime, m_dcfStates[from]); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
254 |
} |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
255 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
256 |
void |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
257 |
DcfManagerTest::DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, DcfStateTest *state) |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
258 |
{ |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
259 |
state->QueueTx (txTime, expectedGrantTime); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
260 |
m_dcfManager->RequestAccess (state); |
2098 | 261 |
} |
262 |
||
263 |
||
264 |
||
265 |
||
266 |
bool |
|
267 |
DcfManagerTest::RunTests (void) |
|
268 |
{ |
|
269 |
m_result = true; |
|
270 |
||
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
271 |
// 0 3 4 5 8 9 10 12 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
272 |
// | sifs | aifsn | tx | sifs | aifsn | | tx | |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
273 |
// |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
274 |
StartTest (1, 3, 10); |
2126
c2f1ec692e70
ignore cwmin/cwmax parameters since we set the backoff slots for every collision.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2125
diff
changeset
|
275 |
AddDcfState (1); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
276 |
AddAccessRequest (1, 1, 4, 0); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
277 |
AddAccessRequest (10, 2, 10, 0); |
2098 | 278 |
EndTest (); |
279 |
||
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
280 |
// The test below mainly intends to test the case where the medium |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
281 |
// becomes busy in the middle of a backoff slot: the backoff counter |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
282 |
// must not be decremented for this backoff slot. This is the case |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
283 |
// below for the backoff slot starting at time 78us. |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
284 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
285 |
// 20 60 66 70 74 78 80 100 106 110 114 118 120 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
286 |
// | rx | sifs | aifsn | bslot0 | bslot1 | | rx | sifs | aifsn | bslot2 | bslot3 | tx | |
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
287 |
// | |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
288 |
// 30 request access. backoff slots: 4 |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
289 |
StartTest (4, 6 , 10); |
2126
c2f1ec692e70
ignore cwmin/cwmax parameters since we set the backoff slots for every collision.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2125
diff
changeset
|
290 |
AddDcfState (1); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
291 |
AddRxOkEvt (20, 40); |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
292 |
AddRxOkEvt (80, 20); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
293 |
AddAccessRequest (30, 2, 118, 0); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
294 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
295 |
EndTest (); |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
296 |
|
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
297 |
// Test the case where the backoff slots is zero. |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
298 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
299 |
// 20 60 66 70 72 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
300 |
// | rx | sifs | aifsn | tx | |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
301 |
// | |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
302 |
// 30 request access. backoff slots: 0 |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
303 |
StartTest (4, 6 , 10); |
2126
c2f1ec692e70
ignore cwmin/cwmax parameters since we set the backoff slots for every collision.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2125
diff
changeset
|
304 |
AddDcfState (1); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
305 |
AddRxOkEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
306 |
AddAccessRequest (30, 2, 70, 0); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
307 |
ExpectCollision (30, 0, 0); // backoff: 0 slots |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
308 |
EndTest (); |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
309 |
|
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
310 |
// The test below is subject to some discussion because I am |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
311 |
// not sure I understand the intent of the spec here. |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
312 |
// i.e., what happens if you make a request to get access |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
313 |
// to the medium during the difs idle time after a busy period ? |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
314 |
// do you need to start a backoff ? Or do you need to wait until |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
315 |
// the end of difs and access the medium ? |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
316 |
// Here, we wait until the end of difs and access the medium. |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
317 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
318 |
// 20 60 66 70 72 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
319 |
// | rx | sifs | aifsn | tx | |
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
320 |
// | |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
321 |
// 62 request access. |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
322 |
// |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
323 |
StartTest (4, 6 , 10); |
2126
c2f1ec692e70
ignore cwmin/cwmax parameters since we set the backoff slots for every collision.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2125
diff
changeset
|
324 |
AddDcfState (1); |
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
325 |
AddRxOkEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
326 |
AddAccessRequest (62, 2, 70, 0); |
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
327 |
EndTest (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
328 |
|
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
329 |
|
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
330 |
// Test an EIFS |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
331 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
332 |
// 20 60 66 76 80 84 88 92 96 98 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
333 |
// | rx | sifs | acktxttime | aifsn | bslot0 | bslot1 | bslot2 | bslot3 | tx | |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
334 |
// | | <---------eifs----------->| |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
335 |
// 30 request access. backoff slots: 4 |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
336 |
StartTest (4, 6, 10); |
2126
c2f1ec692e70
ignore cwmin/cwmax parameters since we set the backoff slots for every collision.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2125
diff
changeset
|
337 |
AddDcfState (1); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
338 |
AddRxErrorEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
339 |
AddAccessRequest (30, 2, 96, 0); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
340 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
341 |
EndTest (); |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
342 |
|
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
343 |
// Test an EIFS which is interupted by a successfull transmission. |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
344 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
345 |
// 20 60 66 69 75 81 85 89 93 97 101 103 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
346 |
// | rx | sifs | | rx | sifs | aifsn | bslot0 | bslot1 | bslot2 | bslot3 | tx | |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
347 |
// | | <--eifs-->| |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
348 |
// 30 request access. backoff slots: 4 |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
349 |
StartTest (4, 6, 10); |
2126
c2f1ec692e70
ignore cwmin/cwmax parameters since we set the backoff slots for every collision.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2125
diff
changeset
|
350 |
AddDcfState (1); |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
351 |
AddRxErrorEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
352 |
AddAccessRequest (30, 2, 101, 0); |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
353 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
354 |
AddRxOkEvt (69, 6); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
355 |
EndTest (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
356 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
357 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
358 |
// Test two DCFs which suffer an internal collision. the first DCF has a higher |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
359 |
// priority than the second DCF. |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
360 |
// |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
361 |
// 20 60 66 70 74 78 88 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
362 |
// DCF0 | rx | sifs | aifsn | bslot0 | bslot1 | tx | |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
363 |
// DCF1 | rx | sifs | aifsn | aifsn | aifsn | | sifs | aifsn | aifsn | aifsn | bslot | tx | |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
364 |
// 94 98 102 106 110 112 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
365 |
StartTest (4, 6, 10); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
366 |
AddDcfState (1); // high priority DCF |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
367 |
AddDcfState (3); // low priority DCF |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
368 |
AddRxOkEvt (20, 40); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
369 |
AddAccessRequest (30, 10, 78, 0); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
370 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
371 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
372 |
AddAccessRequest (40, 2, 110, 1); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
373 |
ExpectCollision (40, 0, 1); // backoff: 0 slot |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
374 |
ExpectInternalCollision (78, 1, 1); // backoff: 1 slot |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
375 |
EndTest (); |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
376 |
|
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
377 |
|
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
378 |
// |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
379 |
// test simple NAV count. This scenario modelizes a simple DATA+ACK handshake |
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
380 |
// where the data rate used for the ACK is higher than expected by the DATA source |
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
381 |
// so, the data exchange completes before the end of nav. |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
382 |
// |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
383 |
StartTest (4, 6, 10); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
384 |
AddDcfState (1); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
385 |
AddRxOkEvt (20, 40); |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
386 |
AddNavStart (60, 15); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
387 |
AddRxOkEvt (66, 5); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
388 |
AddNavStart (71, 0); |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
389 |
AddAccessRequest (30, 10, 93, 0); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
390 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
391 |
EndTest (); |
2135
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
392 |
|
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
393 |
|
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
394 |
// |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
395 |
// test more complex NAV handling by a CF-poll. This scenario modelizes a |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
396 |
// simple DATA+ACK handshake interrupted by a CF-poll which resets the |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
397 |
// NAV counter. |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
398 |
// |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
399 |
StartTest (4, 6, 10); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
400 |
AddDcfState (1); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
401 |
AddRxOkEvt (20, 40); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
402 |
AddNavStart (60, 15); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
403 |
AddRxOkEvt (66, 5); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
404 |
AddNavReset (71, 2); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
405 |
AddAccessRequest (30, 10, 91, 0); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
406 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
407 |
EndTest (); |
2141
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
408 |
|
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
409 |
|
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
410 |
StartTest (4, 6, 10); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
411 |
AddDcfState (2); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
412 |
AddRxOkEvt (20, 40); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
413 |
AddAccessRequest (80, 10, 80, 0); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
414 |
EndTest (); |
2143
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
415 |
|
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
416 |
|
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
417 |
StartTest (4, 6, 10); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
418 |
AddDcfState (2); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
419 |
AddRxOkEvt (20, 40); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
420 |
AddRxOkEvt (78, 8); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
421 |
AddAccessRequest (30, 50, 108, 0); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
422 |
ExpectCollision (30, 3, 0); // backoff: 3 slots |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
423 |
EndTest (); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
424 |
|
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
425 |
|
2098 | 426 |
return m_result; |
427 |
} |
|
428 |
||
429 |
||
2097 | 430 |
|
431 |
static DcfManagerTest g_dcf_manager_test; |
|
432 |
||
433 |
} // namespace ns3 |
|
434 |
||
435 |
#endif /* RUN_SELF_TESTS */ |