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