Source code for wlan_exp.node_ibss
# -*- coding: utf-8 -*-
"""
------------------------------------------------------------------------------
Mango 802.11 Reference Design Experiments Framework - Ad hoc (IBSS) Node
------------------------------------------------------------------------------
License: Copyright 2019 Mango Communications, Inc. All rights reserved.
Use and distribution subject to terms in LICENSE.txt
------------------------------------------------------------------------------
"""
import wlan_exp.node as node
import wlan_exp.cmds as cmds
__all__ = ['WlanExpNodeIBSS']
class WlanExpNodeIBSS(node.WlanExpNode):
"""wlan_exp Node class for the 802.11 Reference Design IBSS MAC project
Args:
network_config (transport.NetworkConfiguration) : Network configuration of the node
"""
#-------------------------------------------------------------------------
# Node Commands
#-------------------------------------------------------------------------
[docs] def get_txrx_counts(self, device_list=None):
"""Get the counts from the node.
.. note:: This function has the same implementation as WlanExpNode but
different default values.
Args:
device_list (list of WlanExpNode, WlanExpNode, WlanDevice, optional): List of devices
for which to get counts. See note below for more information.
return_zeroed_counts_if_none(bool, optional): If no counts exist on the node for
the specified device(s), return a zeroed counts dictionary with proper timestamps
instead of None.
Returns:
counts_dictionary (list of dictionaries, dictionary): Counts for the device(s) specified.
The dictionaries returned by this method have the following fields:
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| Field | Description |
+=============================+=====================================================================================================+
| retrieval_timestamp | Value of System Time in microseconds when structure retrieved from the node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| mac_addr | MAC address of remote node whose statics are recorded here |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| associated | Boolean indicating whether remote node is currently associated with this node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| data_num_rx_bytes | Total number of bytes received in DATA packets from remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| data_num_tx_bytes_success | Total number of bytes successfully transmitted in DATA packets to remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| data_num_tx_bytes_total | Total number of bytes transmitted (successfully or not) in DATA packets to remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| data_num_rx_packets | Total number of DATA packets received from remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| data_num_tx_packets_success | Total number of DATA packets successfully transmitted to remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| data_num_tx_packets_total | Total number of DATA packets transmitted (successfully or not) to remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| data_num_tx_attempts | Total number of low-level attempts of DATA packets to remote node (includes re-transmissions) |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| mgmt_num_rx_bytes | Total number of bytes received in management packets from remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| mgmt_num_tx_bytes_success | Total number of bytes successfully transmitted in management packets to remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| mgmt_num_tx_bytes_total | Total number of bytes transmitted (successfully or not) in management packets to remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| mgmt_num_rx_packets | Total number of management packets received from remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| mgmt_num_tx_packets_success | Total number of management packets successfully transmitted to remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| mgmt_num_tx_packets_total | Total number of management packets transmitted (successfully or not) to remote node |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| mgmt_num_tx_attempts | Total number of low-level attempts of management packets to remote node (includes re-transmissions)|
+-----------------------------+-----------------------------------------------------------------------------------------------------+
| latest_txrx_timestamp | System Time value of last transmission / reception |
+-----------------------------+-----------------------------------------------------------------------------------------------------+
If the device_list is a single device, then a single dictionary or
None is returned. If the device_list is a list of devices, then a
list of dictionaries will be returned in the same order as the devices
in the list. If any of the staistics are not there, None will be
inserted in the list. If the device_list is not specified, then all
the counts on the node will be returned.
"""
return super(WlanExpNodeIBSS, self).get_txrx_counts(device_list)
#-------------------------------------------------------------------------
# Internal Node methods
#-------------------------------------------------------------------------
def _check_allowed_rate(self, mcs, phy_mode, verbose=False):
"""Check that rate parameters are allowed
Args:
mcs (int): Modulation and coding scheme (MCS) index
phy_mode (str, int): PHY mode (from util.phy_modes)
Returns:
valid (bool): Are all parameters valid?
"""
# TODO: implement IBSS-specific rate checking here
# Allow all supported rates for now
return self._check_supported_rate(mcs, phy_mode, verbose)
# End class