author | Kirill Andreev <andreev@iitp.ru> |
Thu, 16 Jul 2009 13:51:12 +0400 | |
changeset 4686 | f17f12944235 |
parent 4598 | 9b07308116ed |
child 5189 | 8fcdf87a790a |
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); |
|
4598
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
78 |
void AddRxInsideSifsEvt (uint64_t at, uint64_t duration); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
79 |
void AddTxEvt (uint64_t at, uint64_t duration); |
2098 | 80 |
void AddNavReset (uint64_t at, uint64_t duration); |
81 |
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
|
82 |
void AddAckTimeoutReset (uint64_t at); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
83 |
void AddAccessRequest (uint64_t at, uint64_t txTime, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
84 |
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
|
85 |
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
|
86 |
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
|
87 |
///\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
|
88 |
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
|
89 |
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
|
90 |
void DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, DcfStateTest *state); |
2098 | 91 |
|
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
92 |
typedef std::vector<DcfStateTest *> DcfStates; |
2097 | 93 |
|
94 |
DcfManager *m_dcfManager; |
|
95 |
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
|
96 |
uint32_t m_ackTimeoutValue; |
2097 | 97 |
bool m_result; |
98 |
}; |
|
99 |
||
100 |
||
101 |
||
102 |
DcfStateTest::DcfStateTest (DcfManagerTest *test, uint32_t i) |
|
103 |
: m_test (test), m_i(i) |
|
104 |
{} |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
105 |
void |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
106 |
DcfStateTest::QueueTx (uint64_t txTime, uint64_t expectedGrantTime) |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
107 |
{ |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
108 |
m_expectedGrants.push_back (std::make_pair (txTime, expectedGrantTime)); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
109 |
} |
2097 | 110 |
void |
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
111 |
DcfStateTest::DoNotifyAccessGranted (void) |
2097 | 112 |
{ |
113 |
m_test->NotifyAccessGranted (m_i); |
|
114 |
} |
|
115 |
void |
|
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
116 |
DcfStateTest::DoNotifyInternalCollision (void) |
2097 | 117 |
{ |
118 |
m_test->NotifyInternalCollision (m_i); |
|
119 |
} |
|
120 |
void |
|
2145
8f3c8ef34b0a
use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2143
diff
changeset
|
121 |
DcfStateTest::DoNotifyCollision (void) |
2097 | 122 |
{ |
123 |
m_test->NotifyCollision (m_i); |
|
124 |
} |
|
125 |
||
126 |
||
127 |
||
128 |
DcfManagerTest::DcfManagerTest () |
|
129 |
: Test ("DcfManager") |
|
130 |
{} |
|
131 |
||
132 |
void |
|
133 |
DcfManagerTest::NotifyAccessGranted (uint32_t i) |
|
134 |
{ |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
135 |
DcfStateTest *state = m_dcfStates[i]; |
2097 | 136 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
137 |
NS_TEST_ASSERT (!state->m_expectedGrants.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
138 |
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
|
139 |
state->m_expectedGrants.pop_front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
140 |
NS_TEST_ASSERT_EQUAL (Simulator::Now (), MicroSeconds (expected.second)); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
141 |
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
|
142 |
m_dcfManager->NotifyAckTimeoutStartNow (MicroSeconds (m_ackTimeoutValue + expected.first)); |
2097 | 143 |
if (!result) |
144 |
{ |
|
145 |
m_result = result; |
|
146 |
} |
|
147 |
} |
|
4598
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
148 |
void |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
149 |
DcfManagerTest::AddTxEvt (uint64_t at, uint64_t duration) |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
150 |
{ |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
151 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
152 |
&DcfManager::NotifyTxStartNow, m_dcfManager, |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
153 |
MicroSeconds (duration)); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
154 |
} |
2097 | 155 |
void |
156 |
DcfManagerTest::NotifyInternalCollision (uint32_t i) |
|
2098 | 157 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
158 |
DcfStateTest *state = m_dcfStates[i]; |
2098 | 159 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
160 |
NS_TEST_ASSERT (!state->m_expectedInternalCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
161 |
struct DcfStateTest::ExpectedCollision expected = state->m_expectedInternalCollision.front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
162 |
state->m_expectedInternalCollision.pop_front (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
163 |
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
|
164 |
state->StartBackoffNow (expected.nSlots); |
2098 | 165 |
if (!result) |
166 |
{ |
|
167 |
m_result = result; |
|
168 |
} |
|
169 |
} |
|
2097 | 170 |
void |
171 |
DcfManagerTest::NotifyCollision (uint32_t i) |
|
2098 | 172 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
173 |
DcfStateTest *state = m_dcfStates[i]; |
2098 | 174 |
bool result = true; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
175 |
NS_TEST_ASSERT (!state->m_expectedCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
176 |
struct DcfStateTest::ExpectedCollision expected = state->m_expectedCollision.front (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
177 |
state->m_expectedCollision.pop_front (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
178 |
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
|
179 |
state->StartBackoffNow (expected.nSlots); |
2098 | 180 |
if (!result) |
181 |
{ |
|
182 |
m_result = result; |
|
183 |
} |
|
184 |
} |
|
2097 | 185 |
|
186 |
||
187 |
void |
|
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
188 |
DcfManagerTest::ExpectInternalCollision (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_expectedInternalCollision.push_back (col); |
2098 | 195 |
} |
196 |
void |
|
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
197 |
DcfManagerTest::ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from) |
2098 | 198 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
199 |
DcfStateTest *state = m_dcfStates[from]; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
200 |
struct DcfStateTest::ExpectedCollision col; |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
201 |
col.at = time; |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
202 |
col.nSlots = nSlots; |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
203 |
state->m_expectedCollision.push_back (col); |
2098 | 204 |
} |
2097 | 205 |
|
206 |
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
|
207 |
DcfManagerTest::StartTest (uint64_t slotTime, uint64_t sifs, uint64_t eifsNoDifsNoSifs, uint32_t ackTimeoutValue) |
2097 | 208 |
{ |
209 |
m_dcfManager = new DcfManager (); |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
210 |
m_dcfManager->SetSlot (MicroSeconds (slotTime)); |
2105
e883a100109a
get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2104
diff
changeset
|
211 |
m_dcfManager->SetSifs (MicroSeconds (sifs)); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
212 |
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
|
213 |
m_ackTimeoutValue = ackTimeoutValue; |
2097 | 214 |
} |
215 |
||
216 |
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
|
217 |
DcfManagerTest::AddDcfState (uint32_t aifsn) |
2097 | 218 |
{ |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
219 |
DcfStateTest *state = new DcfStateTest (this, m_dcfStates.size ()); |
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
220 |
state->SetAifsn (aifsn); |
2097 | 221 |
m_dcfStates.push_back (state); |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
222 |
m_dcfManager->Add (state); |
2097 | 223 |
} |
224 |
||
225 |
void |
|
226 |
DcfManagerTest::EndTest (void) |
|
227 |
{ |
|
228 |
bool result = true; |
|
229 |
Simulator::Run (); |
|
230 |
Simulator::Destroy (); |
|
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
231 |
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
|
232 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
233 |
DcfStateTest *state = *i; |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
234 |
NS_TEST_ASSERT (state->m_expectedGrants.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
235 |
NS_TEST_ASSERT (state->m_expectedInternalCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
236 |
NS_TEST_ASSERT (state->m_expectedCollision.empty ()); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
237 |
delete state; |
2101
05c4a31c0a58
simplify memory management
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2098
diff
changeset
|
238 |
} |
2097 | 239 |
m_dcfStates.clear (); |
240 |
delete m_dcfManager; |
|
241 |
if (!result) |
|
242 |
{ |
|
243 |
m_result = result; |
|
244 |
} |
|
245 |
} |
|
246 |
||
2098 | 247 |
void |
248 |
DcfManagerTest::AddRxOkEvt (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::NotifyRxEndOkNow, m_dcfManager); |
|
255 |
} |
|
4598
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
256 |
void |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
257 |
DcfManagerTest::AddRxInsideSifsEvt (uint64_t at, uint64_t duration) |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
258 |
{ |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
259 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
260 |
&DcfManager::NotifyRxStartNow, m_dcfManager, |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
261 |
MicroSeconds (duration)); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
262 |
} |
2098 | 263 |
void |
264 |
DcfManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration) |
|
265 |
{ |
|
266 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
267 |
&DcfManager::NotifyRxStartNow, m_dcfManager, |
|
268 |
MicroSeconds (duration)); |
|
269 |
Simulator::Schedule (MicroSeconds (at+duration) - Now (), |
|
270 |
&DcfManager::NotifyRxEndErrorNow, m_dcfManager); |
|
271 |
} |
|
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
272 |
|
2098 | 273 |
void |
274 |
DcfManagerTest::AddNavReset (uint64_t at, uint64_t duration) |
|
275 |
{ |
|
276 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
277 |
&DcfManager::NotifyNavResetNow, m_dcfManager, |
|
278 |
MicroSeconds (duration)); |
|
279 |
} |
|
280 |
void |
|
281 |
DcfManagerTest::AddNavStart (uint64_t at, uint64_t duration) |
|
282 |
{ |
|
283 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
|
284 |
&DcfManager::NotifyNavStartNow, m_dcfManager, |
|
285 |
MicroSeconds (duration)); |
|
286 |
} |
|
287 |
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
|
288 |
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
|
289 |
{ |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
290 |
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
|
291 |
&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
|
292 |
} |
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 |
void |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
294 |
DcfManagerTest::AddAccessRequest (uint64_t at, uint64_t txTime, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
295 |
uint64_t expectedGrantTime, uint32_t from) |
2098 | 296 |
{ |
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
|
297 |
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
|
298 |
} |
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 |
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
|
300 |
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
|
301 |
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
|
302 |
{ |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
303 |
Simulator::Schedule (MicroSeconds (at) - Now (), |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
304 |
&DcfManagerTest::DoAccessRequest, this, |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
305 |
txTime, expectedGrantTime, m_dcfStates[from]); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
306 |
} |
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
|
307 |
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
|
308 |
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
|
309 |
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
|
310 |
{ |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
311 |
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
|
312 |
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
|
313 |
&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
|
314 |
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
|
315 |
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
|
316 |
} |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
317 |
void |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
318 |
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
|
319 |
{ |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
320 |
state->QueueTx (txTime, expectedGrantTime); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
321 |
m_dcfManager->RequestAccess (state); |
2098 | 322 |
} |
323 |
||
324 |
||
325 |
||
326 |
||
327 |
bool |
|
328 |
DcfManagerTest::RunTests (void) |
|
329 |
{ |
|
330 |
m_result = true; |
|
331 |
||
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
332 |
// 0 3 4 5 8 9 10 12 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
333 |
// | sifs | aifsn | tx | sifs | aifsn | | tx | |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
334 |
// |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
335 |
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
|
336 |
AddDcfState (1); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
337 |
AddAccessRequest (1, 1, 4, 0); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
338 |
AddAccessRequest (10, 2, 10, 0); |
2098 | 339 |
EndTest (); |
4598
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
340 |
// Check that receiving inside SIFS shall be cancelled properly: |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
341 |
// 0 3 4 5 8 9 12 13 14 |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
342 |
// | sifs | aifsn | tx | sifs | ack | sifs | aifsn | |tx | |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
343 |
// |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
344 |
StartTest (1, 3, 10); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
345 |
AddDcfState (1); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
346 |
AddAccessRequest (1, 1, 4, 0); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
347 |
AddRxInsideSifsEvt (6, 10); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
348 |
AddTxEvt(8, 1); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
349 |
AddAccessRequest (14, 2, 14, 0); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
350 |
EndTest (); |
9b07308116ed
bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4509
diff
changeset
|
351 |
|
2098 | 352 |
|
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
353 |
// 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
|
354 |
// 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
|
355 |
// 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
|
356 |
// 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
|
357 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
358 |
// 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
|
359 |
// | 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
|
360 |
// | |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
361 |
// 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
|
362 |
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
|
363 |
AddDcfState (1); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
364 |
AddRxOkEvt (20, 40); |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
365 |
AddRxOkEvt (80, 20); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
366 |
AddAccessRequest (30, 2, 118, 0); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
367 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
368 |
EndTest (); |
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
369 |
|
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
370 |
// Test the case where the backoff slots is zero. |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
371 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
372 |
// 20 60 66 70 72 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
373 |
// | rx | sifs | aifsn | tx | |
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 |
// 30 request access. backoff slots: 0 |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
376 |
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
|
377 |
AddDcfState (1); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
378 |
AddRxOkEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
379 |
AddAccessRequest (30, 2, 70, 0); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
380 |
ExpectCollision (30, 0, 0); // backoff: 0 slots |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
381 |
EndTest (); |
4686
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
382 |
// Test shows when two frames are received without interval between |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
383 |
// them: |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
384 |
// 20 60 100 106 110 112 |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
385 |
// | rx | rx |sifs | aifsn | tx | |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
386 |
// | |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
387 |
// 30 request access. backoff slots: 0 |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
388 |
|
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
389 |
StartTest (4, 6 , 10); |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
390 |
AddDcfState (1); |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
391 |
AddRxOkEvt (20, 40); |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
392 |
AddRxOkEvt (60, 40); |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
393 |
AddAccessRequest (30, 2, 110, 0); |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
394 |
ExpectCollision (30, 0, 0); // backoff: 0 slots |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
395 |
EndTest (); |
f17f12944235
Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager.
Kirill Andreev <andreev@iitp.ru>
parents:
4598
diff
changeset
|
396 |
|
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
397 |
|
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
398 |
// 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
|
399 |
// 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
|
400 |
// 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
|
401 |
// 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
|
402 |
// 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
|
403 |
// 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
|
404 |
// 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
|
405 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
406 |
// 20 60 66 70 72 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
407 |
// | rx | sifs | aifsn | tx | |
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
408 |
// | |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
409 |
// 62 request access. |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
410 |
// |
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
411 |
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
|
412 |
AddDcfState (1); |
2121
60c0176e2389
a new test-case with some comments
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2119
diff
changeset
|
413 |
AddRxOkEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
414 |
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
|
415 |
EndTest (); |
2118
864b31ff0c01
add a new test-case
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2113
diff
changeset
|
416 |
|
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
417 |
|
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
418 |
// Test an EIFS |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
419 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
420 |
// 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
|
421 |
// | 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
|
422 |
// | | <---------eifs----------->| |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
423 |
// 30 request access. backoff slots: 4 |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
424 |
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
|
425 |
AddDcfState (1); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
426 |
AddRxErrorEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
427 |
AddAccessRequest (30, 2, 96, 0); |
2124
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
428 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
429 |
EndTest (); |
d95795a9767f
more working tests.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2121
diff
changeset
|
430 |
|
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
431 |
// 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
|
432 |
// |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
433 |
// 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
|
434 |
// | 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
|
435 |
// | | <--eifs-->| |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
436 |
// 30 request access. backoff slots: 4 |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
437 |
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
|
438 |
AddDcfState (1); |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
439 |
AddRxErrorEvt (20, 40); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
440 |
AddAccessRequest (30, 2, 101, 0); |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
441 |
ExpectCollision (30, 4, 0); // backoff: 4 slots |
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
442 |
AddRxOkEvt (69, 6); |
2131
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
443 |
EndTest (); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
444 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
445 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
446 |
// 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
|
447 |
// priority than the second DCF. |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
448 |
// |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
449 |
// 20 60 66 70 74 78 88 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
450 |
// DCF0 | rx | sifs | aifsn | bslot0 | bslot1 | tx | |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
451 |
// 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
|
452 |
// 94 98 102 106 110 112 |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
453 |
StartTest (4, 6, 10); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
454 |
AddDcfState (1); // high priority DCF |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
455 |
AddDcfState (3); // low priority DCF |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
456 |
AddRxOkEvt (20, 40); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
457 |
AddAccessRequest (30, 10, 78, 0); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
458 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
459 |
|
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
460 |
AddAccessRequest (40, 2, 110, 1); |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
461 |
ExpectCollision (40, 0, 1); // backoff: 0 slot |
a43aabcfa388
test internal collisions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2126
diff
changeset
|
462 |
ExpectInternalCollision (78, 1, 1); // backoff: 1 slot |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
463 |
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
|
464 |
|
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 |
// 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
|
466 |
// 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
|
467 |
// |
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 |
// 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
|
469 |
// 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
|
470 |
// 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
|
471 |
// ^ 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
|
472 |
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
|
473 |
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
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
EndTest (); |
2125
15ba30b939d1
test interupted eifs
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2124
diff
changeset
|
478 |
|
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
|
479 |
// 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
|
480 |
// |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
481 |
// 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
|
482 |
// 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
|
483 |
// |
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
484 |
// 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
|
485 |
// 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
|
486 |
// 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
|
487 |
// ^ 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
|
488 |
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
|
489 |
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
|
490 |
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
|
491 |
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
|
492 |
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
|
493 |
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
|
494 |
|
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
495 |
//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
|
496 |
// 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
|
497 |
// 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
|
498 |
// ^ 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
|
499 |
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
|
500 |
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
|
501 |
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
|
502 |
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
|
503 |
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
|
504 |
|
b2654e0f071d
bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents:
4325
diff
changeset
|
505 |
//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
|
506 |
//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
|
507 |
// 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
|
508 |
// 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
|
509 |
// ^ 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
|
510 |
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
|
511 |
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
|
512 |
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
|
513 |
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
|
514 |
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
|
515 |
EndTest (); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
516 |
|
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
517 |
// |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
518 |
// 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
|
519 |
// 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
|
520 |
// 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
|
521 |
// |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
522 |
StartTest (4, 6, 10); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
523 |
AddDcfState (1); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
524 |
AddRxOkEvt (20, 40); |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
525 |
AddNavStart (60, 15); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
526 |
AddRxOkEvt (66, 5); |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
527 |
AddNavStart (71, 0); |
2134
cf59f463794a
more comment on the test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2133
diff
changeset
|
528 |
AddAccessRequest (30, 10, 93, 0); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
529 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
530 |
EndTest (); |
2135
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
531 |
|
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
532 |
// |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
533 |
// 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
|
534 |
// 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
|
535 |
// NAV counter. |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
536 |
// |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
537 |
StartTest (4, 6, 10); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
538 |
AddDcfState (1); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
539 |
AddRxOkEvt (20, 40); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
540 |
AddNavStart (60, 15); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
541 |
AddRxOkEvt (66, 5); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
542 |
AddNavReset (71, 2); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
543 |
AddAccessRequest (30, 10, 91, 0); |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
544 |
ExpectCollision (30, 2, 0); // backoff: 2 slot |
21354fae90b2
another more complex NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2134
diff
changeset
|
545 |
EndTest (); |
2141
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
546 |
|
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
547 |
|
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
548 |
StartTest (4, 6, 10); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
549 |
AddDcfState (2); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
550 |
AddRxOkEvt (20, 40); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
551 |
AddAccessRequest (80, 10, 80, 0); |
bb6670fc71cb
another DCF test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2135
diff
changeset
|
552 |
EndTest (); |
2143
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
553 |
|
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
554 |
|
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
555 |
StartTest (4, 6, 10); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
556 |
AddDcfState (2); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
557 |
AddRxOkEvt (20, 40); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
558 |
AddRxOkEvt (78, 8); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
559 |
AddAccessRequest (30, 50, 108, 0); |
c3c874d850a1
test a backoff with an AIFSN != 1
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2141
diff
changeset
|
560 |
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
|
561 |
EndTest (); |
2133
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
562 |
|
df077fb96353
simple NAV test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2131
diff
changeset
|
563 |
|
2098 | 564 |
return m_result; |
565 |
} |
|
566 |
||
567 |
||
2097 | 568 |
|
569 |
static DcfManagerTest g_dcf_manager_test; |
|
570 |
||
571 |
} // namespace ns3 |
|
572 |
||
573 |
#endif /* RUN_SELF_TESTS */ |