author | Pavel Boyko <boyko@iitp.ru> |
Tue, 16 Jun 2009 17:58:16 +0400 | |
changeset 5074 | 355de6af8ea9 |
parent 4509 | b2654e0f071d |
child 4598 | 9b07308116ed |
permissions | -rw-r--r-- |
2097 | 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:
2547
diff
changeset
|
2 |
/* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
3 |
* Copyright (c) 2005,2006 INRIA |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
4 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
7 |
* published by the Free Software Foundation; |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
8 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
9 |
* 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:
2547
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
12 |
* GNU General Public License for more details. |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
13 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
14 |
* 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:
2547
diff
changeset
|
15 |
* 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:
2547
diff
changeset
|
16 |
* 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:
2547
diff
changeset
|
17 |
* |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
acc6c801f785
bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2547
diff
changeset
|
19 |
*/ |
2097 | 20 |
#ifdef RUN_SELF_TESTS |
21 |
||
22 |
#include "ns3/test.h" |
|
23 |
#include "ns3/simulator.h" |
|
24 |
#include "dcf-manager.h" |
|
25 |
||
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
26 |
|
2097 | 27 |
namespace ns3 { |
28 |
||
29 |
class DcfManagerTest; |
|
30 |
||
31 |
class DcfStateTest : public DcfState |
|
32 |
{ |
|
33 |
public: |
|
34 |
DcfStateTest (DcfManagerTest *test, uint32_t i); |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
35 |
void QueueTx (uint64_t txTime, uint64_t expectedGrantTime); |
2097 | 36 |
private: |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
37 |
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
|
38 |
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
|
39 |
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
|
40 |
virtual void DoNotifyCollision (void); |
2097 | 41 |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
42 |
typedef std::pair<uint64_t,uint64_t> ExpectedGrant; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
43 |
typedef std::list<ExpectedGrant> ExpectedGrants; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
44 |
struct ExpectedCollision { |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
45 |
uint64_t at; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
46 |
uint32_t nSlots; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
47 |
}; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
48 |
typedef std::list<struct ExpectedCollision> ExpectedCollisions; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
49 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
50 |
ExpectedCollisions m_expectedInternalCollision; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
51 |
ExpectedCollisions m_expectedCollision; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
52 |
ExpectedGrants m_expectedGrants; |
2097 | 53 |
DcfManagerTest *m_test; |
54 |
uint32_t m_i; |
|
55 |
}; |
|
56 |
||
57 |
||
58 |
class DcfManagerTest : public Test |
|
59 |
{ |
|
60 |
public: |
|
61 |
DcfManagerTest (); |
|
62 |
virtual bool RunTests (void); |
|
63 |
||
64 |
||
65 |
void NotifyAccessGranted (uint32_t i); |
|
66 |
void NotifyInternalCollision (uint32_t i); |
|
67 |
void NotifyCollision (uint32_t i); |
|
68 |
||
69 |
||
70 |
private: |
|
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
71 |
void StartTest (uint64_t slotTime, uint64_t sifs, uint64_t eifsNoDifsNoSifs, uint32_t ackTimeoutValue = 20); |
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
|
72 |
void AddDcfState (uint32_t aifsn); |
2097 | 73 |
void EndTest (void); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
74 |
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
|
75 |
void ExpectCollision (uint64_t time, uint32_t from, uint32_t nSlots); |
2098 | 76 |
void AddRxOkEvt (uint64_t at, uint64_t duration); |
77 |
void AddRxErrorEvt (uint64_t at, uint64_t duration); |
|
78 |
void AddNavReset (uint64_t at, uint64_t duration); |
|
79 |
void AddNavStart (uint64_t at, uint64_t duration); |
|
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
80 |
void AddAckTimeoutReset (uint64_t at); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
81 |
void AddAccessRequest (uint64_t at, uint64_t txTime, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
82 |
uint64_t expectedGrantTime, uint32_t from); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
83 |
void AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime, |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
84 |
uint64_t expectedGrantTime, uint32_t from); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
85 |
///\param ackDelay is delay of the ack after txEnd |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
86 |
void AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime, |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
87 |
uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
88 |
void DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, DcfStateTest *state); |
2098 | 89 |
|
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
90 |
typedef std::vector<DcfStateTest *> DcfStates; |
2097 | 91 |
|
92 |
DcfManager *m_dcfManager; |
|
93 |
DcfStates m_dcfStates; |
|
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
94 |
uint32_t m_ackTimeoutValue; |
2097 | 95 |
bool m_result; |
96 |
}; |
|
97 |
||
98 |
||
99 |
||
100 |
DcfStateTest::DcfStateTest (DcfManagerTest *test, uint32_t i) |
|
101 |
: m_test (test), m_i(i) |
|
102 |
{} |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
103 |
void |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
104 |
DcfStateTest::QueueTx (uint64_t txTime, uint64_t expectedGrantTime) |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
105 |
{ |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
106 |
m_expectedGrants.push_back (std::make_pair (txTime, expectedGrantTime)); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
107 |
} |
2097 | 108 |
void |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
109 |
DcfStateTest::DoNotifyAccessGranted (void) |
2097 | 110 |
{ |
111 |
m_test->NotifyAccessGranted (m_i); |
|
112 |
} |
|
113 |
void |
|
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
114 |
DcfStateTest::DoNotifyInternalCollision (void) |
2097 | 115 |
{ |
116 |
m_test->NotifyInternalCollision (m_i); |
|
117 |
} |
|
118 |
void |
|
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
119 |
DcfStateTest::DoNotifyCollision (void) |
2097 | 120 |
{ |
121 |
m_test->NotifyCollision (m_i); |
|
122 |
} |
|
123 |
||
124 |
||
125 |
||
126 |
DcfManagerTest::DcfManagerTest () |
|
127 |
: Test ("DcfManager") |
|
128 |
{} |
|
129 |
||
130 |
void |
|
131 |
DcfManagerTest::NotifyAccessGranted (uint32_t i) |
|
132 |
{ |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
133 |
DcfStateTest *state = m_dcfStates[i]; |
2097 | 134 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
135 |
NS_TEST_ASSERT (!state->m_expectedGrants.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
136 |
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
|
137 |
state->m_expectedGrants.pop_front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
138 |
NS_TEST_ASSERT_EQUAL (Simulator::Now (), MicroSeconds (expected.second)); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
139 |
m_dcfManager->NotifyTxStartNow (MicroSeconds (expected.first)); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
140 |
m_dcfManager->NotifyAckTimeoutStartNow (MicroSeconds (m_ackTimeoutValue + expected.first)); |
2097 | 141 |
if (!result) |
142 |
{ |
|
143 |
m_result = result; |
|
144 |
} |
|
145 |
} |
|
146 |
void |
|
147 |
DcfManagerTest::NotifyInternalCollision (uint32_t i) |
|
2098 | 148 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
149 |
DcfStateTest *state = m_dcfStates[i]; |
2098 | 150 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
151 |
NS_TEST_ASSERT (!state->m_expectedInternalCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
152 |
struct DcfStateTest::ExpectedCollision expected = state->m_expectedInternalCollision.front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
153 |
state->m_expectedInternalCollision.pop_front (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
154 |
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
|
155 |
state->StartBackoffNow (expected.nSlots); |
2098 | 156 |
if (!result) |
157 |
{ |
|
158 |
m_result = result; |
|
159 |
} |
|
160 |
} |
|
2097 | 161 |
void |
162 |
DcfManagerTest::NotifyCollision (uint32_t i) |
|
2098 | 163 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
164 |
DcfStateTest *state = m_dcfStates[i]; |
2098 | 165 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
166 |
NS_TEST_ASSERT (!state->m_expectedCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
167 |
struct DcfStateTest::ExpectedCollision expected = state->m_expectedCollision.front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
168 |
state->m_expectedCollision.pop_front (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
169 |
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
|
170 |
state->StartBackoffNow (expected.nSlots); |
2098 | 171 |
if (!result) |
172 |
{ |
|
173 |
m_result = result; |
|
174 |
} |
|
175 |
} |
|
2097 | 176 |
|
177 |
||
178 |
void |
|
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
179 |
DcfManagerTest::ExpectInternalCollision (uint64_t time, uint32_t nSlots, uint32_t from) |
2098 | 180 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
181 |
DcfStateTest *state = m_dcfStates[from]; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
182 |
struct DcfStateTest::ExpectedCollision col; |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
183 |
col.at = time; |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
184 |
col.nSlots = nSlots; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
185 |
state->m_expectedInternalCollision.push_back (col); |
2098 | 186 |
} |
187 |
void |
|
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
188 |
DcfManagerTest::ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from) |
2098 | 189 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
190 |
DcfStateTest *state = m_dcfStates[from]; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
191 |
struct DcfStateTest::ExpectedCollision col; |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
192 |
col.at = time; |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
193 |
col.nSlots = nSlots; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
194 |
state->m_expectedCollision.push_back (col); |
2098 | 195 |
} |
2097 | 196 |
|
197 |
void |
|
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
198 |
DcfManagerTest::StartTest (uint64_t slotTime, uint64_t sifs, uint64_t eifsNoDifsNoSifs, uint32_t ackTimeoutValue) |
2097 | 199 |
{ |
200 |
m_dcfManager = new DcfManager (); |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
201 |
m_dcfManager->SetSlot (MicroSeconds (slotTime)); |
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
202 |
m_dcfManager->SetSifs (MicroSeconds (sifs)); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
203 |
m_dcfManager->SetEifsNoDifs (MicroSeconds (eifsNoDifsNoSifs+sifs)); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
204 |
m_ackTimeoutValue = ackTimeoutValue; |
2097 | 205 |
} |
206 |
||
207 |
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
|
208 |
DcfManagerTest::AddDcfState (uint32_t aifsn) |
2097 | 209 |
{ |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
210 |
DcfStateTest *state = new DcfStateTest (this, m_dcfStates.size ()); |
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
211 |
state->SetAifsn (aifsn); |
2097 | 212 |
m_dcfStates.push_back (state); |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
213 |
m_dcfManager->Add (state); |
2097 | 214 |
} |
215 |
||
216 |
void |
|
217 |
DcfManagerTest::EndTest (void) |
|
218 |
{ |
|
219 |
bool result = true; |
|
220 |
Simulator::Run (); |
|
221 |
Simulator::Destroy (); |
|
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
222 |
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
|
223 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
224 |
DcfStateTest *state = *i; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
225 |
NS_TEST_ASSERT (state->m_expectedGrants.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
226 |
NS_TEST_ASSERT (state->m_expectedInternalCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
227 |
NS_TEST_ASSERT (state->m_expectedCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
228 |
delete state; |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
229 |
} |
2097 | 230 |
m_dcfStates.clear (); |
231 |
delete m_dcfManager; |
|
232 |
if (!result) |
|
233 |
{ |
|
234 |
m_result = result; |
|
235 |
} |
|
236 |
} |
|
237 |
||
2098 | 238 |
void |
239 |
DcfManagerTest::AddRxOkEvt (uint64_t at, uint64_t duration) |
|
240 |
{ |
|
241 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
242 |
&DcfManager::NotifyRxStartNow, m_dcfManager, |
|
243 |
MicroSeconds (duration)); |
|
244 |
Simulator::Schedule (MicroSeconds (at+duration) - Now (), |
|
245 |
&DcfManager::NotifyRxEndOkNow, m_dcfManager); |
|
246 |
} |
|
247 |
void |
|
248 |
DcfManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration) |
|
249 |
{ |
|
250 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
251 |
&DcfManager::NotifyRxStartNow, m_dcfManager, |
|
252 |
MicroSeconds (duration)); |
|
253 |
Simulator::Schedule (MicroSeconds (at+duration) - Now (), |
|
254 |
&DcfManager::NotifyRxEndErrorNow, m_dcfManager); |
|
255 |
} |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
256 |
|
2098 | 257 |
void |
258 |
DcfManagerTest::AddNavReset (uint64_t at, uint64_t duration) |
|
259 |
{ |
|
260 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
261 |
&DcfManager::NotifyNavResetNow, m_dcfManager, |
|
262 |
MicroSeconds (duration)); |
|
263 |
} |
|
264 |
void |
|
265 |
DcfManagerTest::AddNavStart (uint64_t at, uint64_t duration) |
|
266 |
{ |
|
267 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
268 |
&DcfManager::NotifyNavStartNow, m_dcfManager, |
|
269 |
MicroSeconds (duration)); |
|
270 |
} |
|
271 |
void |
|
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
272 |
DcfManagerTest::AddAckTimeoutReset (uint64_t at) |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
273 |
{ |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
274 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
275 |
&DcfManager::NotifyAckTimeoutResetNow, m_dcfManager); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
276 |
} |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
277 |
void |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
278 |
DcfManagerTest::AddAccessRequest (uint64_t at, uint64_t txTime, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
279 |
uint64_t expectedGrantTime, uint32_t from) |
2098 | 280 |
{ |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
281 |
AddAccessRequestWithSuccessfullAck (at, txTime, expectedGrantTime, 0, from); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
282 |
} |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
283 |
void |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
284 |
DcfManagerTest::AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime, |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
285 |
uint64_t expectedGrantTime, uint32_t from) |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
286 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
287 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
288 |
&DcfManagerTest::DoAccessRequest, this, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
289 |
txTime, expectedGrantTime, m_dcfStates[from]); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
290 |
} |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
291 |
void |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
292 |
DcfManagerTest::AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime, |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
293 |
uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from) |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
294 |
{ |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
295 |
NS_ASSERT(ackDelay < m_ackTimeoutValue); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
296 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
297 |
&DcfManagerTest::DoAccessRequest, this, |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
298 |
txTime, expectedGrantTime, m_dcfStates[from]); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
299 |
AddAckTimeoutReset (expectedGrantTime + txTime + ackDelay); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
300 |
} |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
301 |
void |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
302 |
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
|
303 |
{ |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
304 |
state->QueueTx (txTime, expectedGrantTime); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
305 |
m_dcfManager->RequestAccess (state); |
2098 | 306 |
} |
307 |
||
308 |
||
309 |
||
310 |
||
311 |
bool |
|
312 |
DcfManagerTest::RunTests (void) |
|
313 |
{ |
|
314 |
m_result = true; |
|
315 |
||
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
316 |
// 0 3 4 5 8 9 10 12 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
317 |
// | sifs | aifsn | tx | sifs | aifsn | | tx | |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
318 |
// |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
319 |
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
|
320 |
AddDcfState (1); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
321 |
AddAccessRequest (1, 1, 4, 0); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
322 |
AddAccessRequest (10, 2, 10, 0); |
2098 | 323 |
EndTest (); |
324 |
||
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
325 |
// 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
|
326 |
// 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
|
327 |
// 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
|
328 |
// 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
|
329 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
330 |
// 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
|
331 |
// | 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
|
332 |
// | |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
333 |
// 30 request access. backoff slots: 4 |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
334 |
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
|
335 |
AddDcfState (1); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
336 |
AddRxOkEvt (20, 40); |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
337 |
AddRxOkEvt (80, 20); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
338 |
AddAccessRequest (30, 2, 118, 0); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
339 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
340 |
EndTest (); |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
341 |
|
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
342 |
// Test the case where the backoff slots is zero. |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
343 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
344 |
// 20 60 66 70 72 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
345 |
// | rx | sifs | aifsn | tx | |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
346 |
// | |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
347 |
// 30 request access. backoff slots: 0 |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
348 |
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
|
349 |
AddDcfState (1); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
350 |
AddRxOkEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
351 |
AddAccessRequest (30, 2, 70, 0); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
352 |
ExpectCollision (30, 0, 0); // backoff: 0 slots |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
353 |
EndTest (); |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
354 |
|
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
355 |
// 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
|
356 |
// 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
|
357 |
// 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
|
358 |
// 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
|
359 |
// 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
|
360 |
// 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
|
361 |
// 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
|
362 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
363 |
// 20 60 66 70 72 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
364 |
// | rx | sifs | aifsn | tx | |
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
365 |
// | |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
366 |
// 62 request access. |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
367 |
// |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
368 |
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
|
369 |
AddDcfState (1); |
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
370 |
AddRxOkEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
371 |
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
|
372 |
EndTest (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
373 |
|
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
374 |
|
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
375 |
// Test an EIFS |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
376 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
377 |
// 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
|
378 |
// | 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
|
379 |
// | | <---------eifs----------->| |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
380 |
// 30 request access. backoff slots: 4 |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
381 |
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
|
382 |
AddDcfState (1); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
383 |
AddRxErrorEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
384 |
AddAccessRequest (30, 2, 96, 0); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
385 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
386 |
EndTest (); |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
387 |
|
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
388 |
// 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
|
389 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
390 |
// 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
|
391 |
// | 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
|
392 |
// | | <--eifs-->| |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
393 |
// 30 request access. backoff slots: 4 |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
394 |
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
|
395 |
AddDcfState (1); |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
396 |
AddRxErrorEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
397 |
AddAccessRequest (30, 2, 101, 0); |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
398 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
399 |
AddRxOkEvt (69, 6); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
400 |
EndTest (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
401 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
402 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
403 |
// 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
|
404 |
// priority than the second DCF. |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
405 |
// |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
406 |
// 20 60 66 70 74 78 88 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
407 |
// DCF0 | rx | sifs | aifsn | bslot0 | bslot1 | tx | |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
408 |
// 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
|
409 |
// 94 98 102 106 110 112 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
410 |
StartTest (4, 6, 10); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
411 |
AddDcfState (1); // high priority DCF |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
412 |
AddDcfState (3); // low priority DCF |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
413 |
AddRxOkEvt (20, 40); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
414 |
AddAccessRequest (30, 10, 78, 0); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
415 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
416 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
417 |
AddAccessRequest (40, 2, 110, 1); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
418 |
ExpectCollision (40, 0, 1); // backoff: 0 slot |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
419 |
ExpectInternalCollision (78, 1, 1); // backoff: 1 slot |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
420 |
EndTest (); |
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
421 |
|
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
422 |
// Test of AckTimeout handling: First queue requests access and ack procedure fails, |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
423 |
// inside the ack timeout second queue with higher priority requests access. |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
424 |
// |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
425 |
// 20 40 50 60 66 76 |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
426 |
// DCF0 - low | tx | ack timeout |sifs| | |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
427 |
// DCF1 - high | | |sifs| tx | |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
428 |
// ^ request access |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
429 |
StartTest (4, 6, 10); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
430 |
AddDcfState (2); // high priority DCF |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
431 |
AddDcfState (0); // low priority DCF |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
432 |
AddAccessRequestWithAckTimeout (20, 20, 20, 0); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
433 |
AddAccessRequest (50, 10, 66, 1); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
434 |
EndTest (); |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
435 |
|
4509
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
436 |
// Test of AckTimeout handling: |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
437 |
// |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
438 |
// First queue requests access and ack is 2 us delayed (got ack interval at the picture), |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
439 |
// inside this interval second queue with higher priority requests access. |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
440 |
// |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
441 |
// 20 40 41 42 48 58 |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
442 |
// DCF0 - low | tx |got ack |sifs| | |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
443 |
// DCF1 - high | | |sifs| tx | |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
444 |
// ^ request access |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
445 |
StartTest (4, 6, 10); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
446 |
AddDcfState (2); // high priority DCF |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
447 |
AddDcfState (0); // low priority DCF |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
448 |
AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
449 |
AddAccessRequest (41, 10, 48, 1); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
450 |
EndTest (); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
451 |
|
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
452 |
//Repeat the same but with one queue: |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
453 |
// 20 40 41 42 48 58 |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
454 |
// DCF0 - low | tx |got ack |sifs| | |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
455 |
// ^ request access |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
456 |
StartTest (4, 6, 10); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
457 |
AddDcfState (2); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
458 |
AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
459 |
AddAccessRequest (41, 10, 56, 0); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
460 |
EndTest (); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
461 |
|
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
462 |
//Repeat the same when ack was delayed: |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
463 |
//and request the next access before previous tx end: |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
464 |
// 20 39 40 42 64 74 |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
465 |
// DCF0 - low | tx |got ack |sifs + 4 * slot| | |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
466 |
// ^ request access |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
467 |
StartTest (4, 6, 10); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
468 |
AddDcfState (2); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
469 |
AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
470 |
AddAccessRequest (39, 10, 64, 0); |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
471 |
ExpectCollision (39, 2, 0); // backoff: 2 slot |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
472 |
EndTest (); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
473 |
|
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
474 |
// |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
475 |
// 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
|
476 |
// 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
|
477 |
// 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
|
478 |
// |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
479 |
StartTest (4, 6, 10); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
480 |
AddDcfState (1); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
481 |
AddRxOkEvt (20, 40); |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
482 |
AddNavStart (60, 15); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
483 |
AddRxOkEvt (66, 5); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
484 |
AddNavStart (71, 0); |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
485 |
AddAccessRequest (30, 10, 93, 0); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
486 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
487 |
EndTest (); |
2135
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
488 |
|
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
489 |
// |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
490 |
// 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
|
491 |
// 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
|
492 |
// NAV counter. |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
493 |
// |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
494 |
StartTest (4, 6, 10); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
495 |
AddDcfState (1); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
496 |
AddRxOkEvt (20, 40); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
497 |
AddNavStart (60, 15); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
498 |
AddRxOkEvt (66, 5); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
499 |
AddNavReset (71, 2); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
500 |
AddAccessRequest (30, 10, 91, 0); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
501 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
502 |
EndTest (); |
2141
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
503 |
|
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
504 |
|
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
505 |
StartTest (4, 6, 10); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
506 |
AddDcfState (2); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
507 |
AddRxOkEvt (20, 40); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
508 |
AddAccessRequest (80, 10, 80, 0); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
509 |
EndTest (); |
2143
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
510 |
|
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
511 |
|
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
512 |
StartTest (4, 6, 10); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
513 |
AddDcfState (2); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
514 |
AddRxOkEvt (20, 40); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
515 |
AddRxOkEvt (78, 8); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
516 |
AddAccessRequest (30, 50, 108, 0); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
517 |
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
|
518 |
EndTest (); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
519 |
|
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
520 |
|
2098 | 521 |
return m_result; |
522 |
} |
|
523 |
||
524 |
||
2097 | 525 |
|
526 |
static DcfManagerTest g_dcf_manager_test; |
|
527 |
||
528 |
} // namespace ns3 |
|
529 |
||
530 |
#endif /* RUN_SELF_TESTS */ |