Test association, disassociation and reassociation in various scenarios. More...
#include "wifi-association-test.h"
Classes | |
| struct | Params |
| Configuration parameters specific to this test. More... | |
Public Types | |
| using | SetupLinksInfo = std::pair<linkId_t , linkId_t > |
| Setup Links info for AP info objects. | |
| Public Types inherited from ns3::TestCase | |
| enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
| How long the test takes to execute. More... | |
Public Member Functions | |
| WifiDisassocAndReassocTest (const BaseParams &baseParams, const Params ¶ms) | |
| Constructor. | |
| Public Member Functions inherited from WifiAssociationTestBase | |
| WifiAssociationTestBase (const std::string &name, const BaseParams &baseParams) | |
| Constructor. | |
| ~WifiAssociationTestBase () override=default | |
| Public Member Functions inherited from ns3::TestCase | |
| TestCase (const TestCase &)=delete | |
| Caller graph was not generated because of its size. | |
| virtual | ~TestCase () |
| Destructor. | |
| std::string | GetName () const |
| TestCase & | operator= (const TestCase &)=delete |
Protected Member Functions | |
| void | AssocSeenByAp (ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress) override |
| Callback invoked when the given AP detects that the given STA has completed association. | |
| void | AssocSeenBySta (Mac48Address bssid) override |
| Callback invoked when a STA completes association with an AP. | |
| void | CheckAfterDisassoc (Ptr< WifiMac > local) |
| Check that the expected operations are performed by the local device after disassociation. | |
| void | CheckRemoteApInfo (bool firstAssoc) |
| Check that the STA stores the expected info about the AP it is expected to be associated with. | |
| void | CheckRemoteStaInfo (bool firstAssoc) |
| Check that the AP which the STA is expected to be associated with stores the expected info about the STA in its remote station managers. | |
| void | DisassocSeenByAp (ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress) override |
| Callback invoked when the given AP detects that the given STA has disassociated. | |
| void | InsertEvents () |
| Insert elements in the list of expected events (transmitted frames). | |
| void | StartRoaming () |
| Take actions connected to roaming. | |
| Protected Member Functions inherited from WifiAssociationTestBase | |
| virtual void | DisassocSeenBySta (Mac48Address bssid) |
| Callback invoked when a STA transitions to unassociated state. | |
| Ptr< PacketSocketClient > | GetApplication (WifiDirection dir, std::size_t apId, std::size_t count, std::size_t pktSize, uint8_t priority=0) const |
| virtual void | Transmit (Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) |
| Callback invoked when a FEM passes PSDUs to the PHY. | |
| Protected Member Functions inherited from ns3::TestCase | |
| TestCase (std::string name) | |
| Constructor. | |
| void | AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK) |
| Add an individual child TestCase to this test suite. | |
| TestCase * | GetParent () const |
| Get the parent of this TestCase. | |
| bool | IsStatusFailure () const |
| Check if any tests failed. | |
| bool | IsStatusSuccess () const |
| Check if all tests passed. | |
| void | SetDataDir (std::string directory) |
| Set the data directory where reference trace files can be found. | |
| void | ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line) |
| Log the failure of this TestCase. | |
| bool | MustAssertOnFailure () const |
| Check if this run should assert on failure. | |
| bool | MustContinueOnFailure () const |
| Check if this run should continue on failure. | |
| std::string | CreateDataDirFilename (std::string filename) |
| Construct the full path to a file in the data directory. | |
| std::string | CreateTempDirFilename (std::string filename) |
| Construct the full path to a file in a temporary directory. | |
Private Member Functions | |
| void | DoRun () override |
| Implementation to actually run this TestCase. | |
| void | DoSetup () override |
| Implementation to do any local setup required for this TestCase. | |
Private Attributes | |
| Ptr< ListErrorModel > | m_ap1ErrorModel |
| error rate model to install on the first AP | |
| std::size_t | m_assocSeenByAp1Count {0} |
| number of associations with AP 1 (seen by AP 1) | |
| std::size_t | m_assocSeenByAp2Count {0} |
| number of associations with AP 2 (seen by AP 2) | |
| Time | m_assocTime |
| time at which last association took place | |
| std::size_t | m_assocWithAp1Count {0} |
| number of associations with AP 1 (seen by STA) | |
| std::size_t | m_assocWithAp2Count {0} |
| number of associations with AP 2 (seen by STA) | |
| linkId_t | m_baLinkId |
| ID of the link on which the BA is sent before roaming. | |
| const std::size_t | m_firstApId {1} |
| the ID of the AP (possibly affiliated with an AP MLD) that is the recipient of the first Assoc Request | |
| const std::size_t | m_nPackets {5} |
| number of packets generated in a burst | |
| Params | m_params |
| parameters specific for this test | |
| Ptr< ListErrorModel > | m_staErrorModel |
| error rate model to install on the STA | |
Additional Inherited Members | |
| Protected Attributes inherited from WifiAssociationTestBase | |
| Ptr< ApWifiMac > | m_ap1Mac |
| AP 1 wifi MAC. | |
| std::map< WifiDirection, PacketSocketAddress > | m_ap1Sockets |
| packet socket addresses for DL/UL traffic from AP1 | |
| Ptr< ApWifiMac > | m_ap2Mac |
| AP 2 wifi MAC. | |
| std::map< WifiDirection, PacketSocketAddress > | m_ap2Sockets |
| packet socket addresses for DL/UL traffic from AP2 | |
| std::string | m_assocMgrTypeId {"ns3::WifiDefaultAssocManager"} |
| Association Manager type ID. | |
| BaseParams | m_baseParams |
| configuration parameters | |
| bool | m_checkTxPsdus {false} |
| whether TX PSDUs should be checked against the list of events | |
| Time | m_duration {Seconds(0.8)} |
| simulation duration | |
| std::list< Events > | m_events |
| list of events for a test run | |
| std::set< WifiMacType > | m_framesToSkip |
| frames that must not be checked against the list of events | |
| Ptr< StaWifiMac > | m_staMac |
| STA wifi MAC. | |
Test association, disassociation and reassociation in various scenarios.
Example scenario for uplink traffic (STA sends Disassociation frame before roaming to another AP)
request ┌───┬───┬───┐ disassociation ┌─────┐ ┌───┬───┬───┐ │QoS│ │QoS│ | ┌────────┐ │Assoc│ ┌───┐ │QoS│ │QoS│
STA │ 1 │...│ n │ | │Disassoc│ │ Req │ │Ack│ │ 1 │...│ n │ ─────┴───X───┴───┴─────v─┴────────┴───────┴─────┴───────────────┴───┴─^───────┴───┴───┴───┴───── |—optional–| | BA agreement ┌──┐ ┌───┐ establishment AP 1 │BA│ │Ack│ between STA and AP 2 ──────────────────┴──X─────────────┴───┴──────────────────────────────────────────────────────── ┌─────┐ ┌───┐ │Assoc│ ┌──┐ AP 2 │Ack│ │ Resp│ │BA│ ─────────────────────────────────────────────────┴───┴───┴─────┴───────────────────────────┴──┴─
After each association, it is checked that:
After the first association, a first set of (DL or UL) packets are generated, transmitted to/by the first AP. The first two MPDUs in the transmitted A-MPDU are corrupted; the receiver sends the acknowledgment, which however is corrupted and is not received. Disassociation is then requested (before BlockAck timeout, if a Disassociation frame is sent, or after BlockAckTimeout, otherwise) so that a BlockAckReq is queued when the STA actually disassociates (tested). On both the STA side (when disassociation is requested, if a Disassociation frame is not sent, or when the Disassociation frame is acked, otherwise) and the AP side (when the Disassociation frame is received, if the STA sends a Disassociation frame, or when the Reassociation frame is received, if the STA does not send a Disassociation frame and associates with the same AP again), it is checked that:
After the second association, it is checked that:
Definition at line 285 of file wifi-association-test.h.
| using WifiDisassocAndReassocTest::SetupLinksInfo = std::pair<linkId_t , linkId_t > |
Setup Links info for AP info objects.
Definition at line 289 of file wifi-association-test.h.
| WifiDisassocAndReassocTest::WifiDisassocAndReassocTest | ( | const BaseParams & | baseParams, |
| const Params & | params ) |
Constructor.
| baseParams | common configuration parameters |
| params | parameters specific for this test |
Definition at line 302 of file wifi-association-test.cc.
References WifiAssociationTestBase::WifiAssociationTestBase(), ns3::CreateObject(), ns3::DOWNLINK, m_ap1ErrorModel, WifiAssociationTestBase::m_assocMgrTypeId, WifiAssociationTestBase::m_framesToSkip, m_params, m_staErrorModel, NS_TEST_ASSERT_MSG_EQ, ns3::UPLINK, ns3::WIFI_MAC_CTL_END, ns3::WIFI_MAC_DATA_NULL, and ns3::WIFI_MAC_MGT_BEACON.
|
overrideprotectedvirtual |
Callback invoked when the given AP detects that the given STA has completed association.
| apMac | the MAC of the given AP |
| aid | the AID of the associated STA |
| staAddress | the address of the associated STA |
Reimplemented from WifiAssociationTestBase.
Definition at line 384 of file wifi-association-test.cc.
References CheckRemoteStaInfo(), ns3::WifiMac::GetAddress(), InsertEvents(), WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_assocSeenByAp1Count, m_assocSeenByAp2Count, m_assocTime, WifiAssociationTestBase::m_checkTxPsdus, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, and ns3::Simulator::Schedule().
|
overrideprotectedvirtual |
Callback invoked when a STA completes association with an AP.
| bssid | the AP address |
Reimplemented from WifiAssociationTestBase.
Definition at line 356 of file wifi-association-test.cc.
References CheckRemoteApInfo(), WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_assocWithAp1Count, m_assocWithAp2Count, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, and ns3::Simulator::Schedule().
Check that the expected operations are performed by the local device after disassociation.
| local | the MAC of the local device |
Definition at line 595 of file wifi-association-test.cc.
References ns3::AC_BE, ns3::DISASSOCIATION, ns3::DOWNLINK, WifiAssociationTestBase::m_ap1Mac, m_baLinkId, m_nPackets, m_params, WifiAssociationTestBase::m_staMac, ns3::MakeWifiUnicastQueueId(), ns3::ML_SETUP, NS_TEST_EXPECT_MSG_EQ, ns3::StaticCast(), ns3::UPLINK, ns3::WIFI_CTL_QUEUE, ns3::WIFI_QOSDATA_QUEUE, and ns3::wifiAcList.
Referenced by InsertEvents().
|
protected |
Check that the STA stores the expected info about the AP it is expected to be associated with.
| firstAssoc | true/false if the STA associated for the first/second time |
Definition at line 521 of file wifi-association-test.cc.
References WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_firstApId, m_params, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_TEST_ASSERT_MSG_EQ, and NS_TEST_EXPECT_MSG_EQ.
Referenced by AssocSeenBySta().
|
protected |
Check that the AP which the STA is expected to be associated with stores the expected info about the STA in its remote station managers.
| firstAssoc | true/false if the STA associated for the first/second time |
Definition at line 441 of file wifi-association-test.cc.
References WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_firstApId, m_params, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_TEST_ASSERT_MSG_EQ, and NS_TEST_EXPECT_MSG_EQ.
Referenced by AssocSeenByAp().
|
overrideprotectedvirtual |
Callback invoked when the given AP detects that the given STA has disassociated.
| apMac | the MAC of the given AP |
| aid | the AID of the STA that disassociated |
| staAddress | the address of the STA that disassociated |
Reimplemented from WifiAssociationTestBase.
Definition at line 422 of file wifi-association-test.cc.
References ns3::ApWifiMac::GetMldOrLinkAddressByAid(), NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, and ns3::Simulator::Schedule().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 950 of file wifi-association-test.cc.
References ns3::Simulator::Destroy(), m_assocSeenByAp1Count, m_assocSeenByAp2Count, m_assocWithAp1Count, m_assocWithAp2Count, WifiAssociationTestBase::m_duration, WifiAssociationTestBase::m_events, m_firstApId, m_params, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), and ns3::Simulator::Stop().
|
overrideprivatevirtual |
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test setup before DoRun is invoked.
Reimplemented from WifiAssociationTestBase.
Definition at line 320 of file wifi-association-test.cc.
References WifiAssociationTestBase::DoSetup(), ns3::DynamicCast(), m_ap1ErrorModel, WifiAssociationTestBase::m_ap1Mac, m_params, m_staErrorModel, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_TEST_ASSERT_MSG_NE, and ns3::Config::SetDefault().
|
protected |
Insert elements in the list of expected events (transmitted frames).
Definition at line 689 of file wifi-association-test.cc.
References ns3::AC_BE, ns3::WifiPhy::CalculateTxDuration(), CheckAfterDisassoc(), ns3::DOWNLINK, WifiAssociationTestBase::GetApplication(), ns3::LEGACY, m_ap1ErrorModel, WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap1Sockets, WifiAssociationTestBase::m_ap2Mac, m_baLinkId, WifiAssociationTestBase::m_events, m_firstApId, m_nPackets, m_params, m_staErrorModel, WifiAssociationTestBase::m_staMac, ns3::MakeWifiUnicastQueueId(), ns3::MAX_PROPAGATION_DELAY, ns3::ML_SETUP, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_GT_OR_EQ, NS_TEST_ASSERT_MSG_NE, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Schedule(), StartRoaming(), ns3::StaticCast(), ns3::UPLINK, ns3::WIFI_CTL_QUEUE, ns3::WIFI_MAC_CTL_ACK, ns3::WIFI_MAC_CTL_BACKREQ, ns3::WIFI_MAC_CTL_BACKRESP, ns3::WIFI_MAC_MGT_ACTION, ns3::WIFI_MAC_MGT_ASSOCIATION_REQUEST, ns3::WIFI_MAC_MGT_ASSOCIATION_RESPONSE, ns3::WIFI_MAC_MGT_DISASSOCIATION, and ns3::WIFI_MAC_QOSDATA.
Referenced by AssocSeenByAp().
|
protected |
Take actions connected to roaming.
Definition at line 567 of file wifi-association-test.cc.
References ns3::DynamicCast(), WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_params, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_NE.
Referenced by InsertEvents().
|
private |
error rate model to install on the first AP
Definition at line 365 of file wifi-association-test.h.
Referenced by WifiDisassocAndReassocTest(), DoSetup(), and InsertEvents().
|
private |
number of associations with AP 1 (seen by AP 1)
Definition at line 362 of file wifi-association-test.h.
Referenced by AssocSeenByAp(), and DoRun().
|
private |
number of associations with AP 2 (seen by AP 2)
Definition at line 363 of file wifi-association-test.h.
Referenced by AssocSeenByAp(), and DoRun().
|
private |
time at which last association took place
Definition at line 357 of file wifi-association-test.h.
Referenced by AssocSeenByAp().
|
private |
number of associations with AP 1 (seen by STA)
Definition at line 360 of file wifi-association-test.h.
Referenced by AssocSeenBySta(), and DoRun().
|
private |
number of associations with AP 2 (seen by STA)
Definition at line 361 of file wifi-association-test.h.
Referenced by AssocSeenBySta(), and DoRun().
|
private |
ID of the link on which the BA is sent before roaming.
Definition at line 358 of file wifi-association-test.h.
Referenced by CheckAfterDisassoc(), and InsertEvents().
|
private |
the ID of the AP (possibly affiliated with an AP MLD) that is the recipient of the first Assoc Request
Definition at line 353 of file wifi-association-test.h.
Referenced by CheckRemoteApInfo(), CheckRemoteStaInfo(), DoRun(), and InsertEvents().
|
private |
number of packets generated in a burst
Definition at line 356 of file wifi-association-test.h.
Referenced by CheckAfterDisassoc(), and InsertEvents().
|
private |
parameters specific for this test
Definition at line 355 of file wifi-association-test.h.
Referenced by WifiDisassocAndReassocTest(), CheckAfterDisassoc(), CheckRemoteApInfo(), CheckRemoteStaInfo(), DoRun(), DoSetup(), InsertEvents(), and StartRoaming().
|
private |
error rate model to install on the STA
Definition at line 364 of file wifi-association-test.h.
Referenced by WifiDisassocAndReassocTest(), DoSetup(), and InsertEvents().