wifi: Extend test to check reception aborted early

This commit is contained in:
Tom Henderson
2019-12-29 14:57:07 +01:00
committed by Stefano Avallone
parent 02db76a86c
commit 3c55c3e9bd

View File

@@ -170,6 +170,17 @@ private:
* \param from the expected from
*/
void ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from);
/**
* Schedule a check that the channel access manager is busy or idle
* \param time the expectedtime
* \param busy whether the manager is expected to be busy
*/
void ExpectBusy (uint64_t time, bool busy);
/**
* Perform check that channel access manager is busy or idle
* \param busy whether expected state is busy
*/
void DoCheckBusy (bool busy);
/**
* Add expect collision function
* \param at
@@ -177,11 +188,18 @@ private:
*/
void AddRxOkEvt (uint64_t at, uint64_t duration);
/**
* Add receive error event function
* Add receive error event function for error at end of frame
* \param at the event time
* \param duration the duration
*/
void AddRxErrorEvt (uint64_t at, uint64_t duration);
/**
* Add receive error event function for error during frame
* \param at the event time
* \param duration the duration
* \param duration the time after event time to force the error
*/
void AddRxErrorEvt (uint64_t at, uint64_t duration, uint64_t timeUntilError);
/**
* Add receive inside SIFS event function
* \param at the event time
@@ -429,6 +447,19 @@ ChannelAccessManagerTest::ExpectCollision (uint64_t time, uint32_t nSlots, uint3
state->m_expectedCollision.push_back (col);
}
void
ChannelAccessManagerTest::ExpectBusy (uint64_t time, bool busy)
{
Simulator::Schedule (MicroSeconds (time) - Now (),
&ChannelAccessManagerTest::DoCheckBusy, this, busy);
}
void
ChannelAccessManagerTest::DoCheckBusy (bool busy)
{
NS_TEST_EXPECT_MSG_EQ (m_ChannelAccessManager->IsBusy (), busy, "Incorrect busy/idle state");
}
void
ChannelAccessManagerTest::StartTest (uint64_t slotTime, uint64_t sifs, uint64_t eifsNoDifsNoSifs, uint32_t ackTimeoutValue)
{
@@ -506,6 +537,17 @@ ChannelAccessManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration)
&ChannelAccessManager::NotifyRxEndErrorNow, m_ChannelAccessManager);
}
void
ChannelAccessManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration, uint64_t timeUntilError)
{
Simulator::Schedule (MicroSeconds (at) - Now (),
&ChannelAccessManager::NotifyRxStartNow, m_ChannelAccessManager,
MicroSeconds (duration));
Simulator::Schedule (MicroSeconds (at + timeUntilError) - Now (),
&ChannelAccessManager::NotifyRxEndErrorNow, m_ChannelAccessManager);
}
void
ChannelAccessManagerTest::AddNavReset (uint64_t at, uint64_t duration)
{
@@ -710,6 +752,20 @@ ChannelAccessManagerTest::DoRun (void)
ExpectCollision (30, 4, 0); //backoff: 4 slots
EndTest ();
// Test that channel stays busy for first frame's duration after Rx error
//
// 20 60
// | rx |
// |
// 40 force Rx error
StartTest (4, 6, 10);
AddDcfState (1);
AddRxErrorEvt (20, 40, 20); // At time 20, start reception for 40, but force error 20 into frame
ExpectBusy (41, true); // channel should remain busy for remaining duration
ExpectBusy (59, true);
ExpectBusy (61, false);
EndTest ();
// Test an EIFS which is interrupted by a successful transmission.
//
// 20 60 66 69 75 81 85 89 93 97 101 103