2 # NEPI, a framework to manage network experiments
3 # Copyright (C) 2014 INRIA
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation;
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 from nepi.execution.attribute import Attribute, Flags, Types
19 from nepi.execution.trace import Trace, TraceAttr
20 from nepi.execution.resource import ResourceManager, clsinit_copy, \
22 from nepi.resources.ns3.ns3wifiremotestationmanager import NS3BaseWifiRemoteStationManager
25 class NS3ConstantRateWifiManager(NS3BaseWifiRemoteStationManager):
26 _rtype = "ns3::ConstantRateWifiManager"
29 def _register_attributes(cls):
31 attr_datamode = Attribute("DataMode",
32 "The transmission mode to use for every data packet transmission",
34 default = "OfdmRate6Mbps",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_datamode)
41 attr_controlmode = Attribute("ControlMode",
42 "The transmission mode to use for every control packet transmission.",
44 default = "OfdmRate6Mbps",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_controlmode)
51 attr_islowlatency = Attribute("IsLowLatency",
52 "If true, we attempt to modelize a so-called low-latency device: a device where decisions about tx parameters can be made on a per-packet basis and feedback about the transmission of each packet is obtained before sending the next. Otherwise, we modelize a high-latency device, that is a device where we cannot update our decision about tx parameters after every packet transmission.",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_islowlatency)
61 attr_maxssrc = Attribute("MaxSsrc",
62 "The maximum number of retransmission attempts for an RTS. This value will not have any effect on some rate control algorithms.",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_maxssrc)
71 attr_maxslrc = Attribute("MaxSlrc",
72 "The maximum number of retransmission attempts for a DATA packet. This value will not have any effect on some rate control algorithms.",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_maxslrc)
81 attr_rtsctsthreshold = Attribute("RtsCtsThreshold",
82 "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2012, Section 9.3.5. This value will not have any effect on some rate control algorithms.",
87 flags = Flags.Reserved | Flags.Construct)
89 cls._register_attribute(attr_rtsctsthreshold)
91 attr_fragmentationthreshold = Attribute("FragmentationThreshold",
92 "If the size of the data packet + LLC header + MAC header + FCS trailer is biggerthan this value, we fragment it such that the size of the fragments are equal or smaller than this value, as per IEEE Std. 802.11-2012, Section 9.5. This value will not have any effect on some rate control algorithms.",
97 flags = Flags.Reserved | Flags.Construct)
99 cls._register_attribute(attr_fragmentationthreshold)
101 attr_nonunicastmode = Attribute("NonUnicastMode",
102 "Wifi mode used for non-unicast transmissions.",
104 default = "Invalid-WifiMode",
107 flags = Flags.Reserved | Flags.Construct)
109 cls._register_attribute(attr_nonunicastmode)
111 attr_defaulttxpowerlevel = Attribute("DefaultTxPowerLevel",
112 "Default power level to be used for transmissions. This is the power level that is used by all those WifiManagers that do notimplement TX power control.",
113 type = Types.Integer,
117 flags = Flags.Reserved | Flags.Construct)
119 cls._register_attribute(attr_defaulttxpowerlevel)
124 def _register_traces(cls):
126 mactxrtsfailed = Trace("MacTxRtsFailed", "The transmission of a RTS by the MAC layer has failed")
128 cls._register_trace(mactxrtsfailed)
130 mactxdatafailed = Trace("MacTxDataFailed", "The transmission of a data packet by the MAC layer has failed")
132 cls._register_trace(mactxdatafailed)
134 mactxfinalrtsfailed = Trace("MacTxFinalRtsFailed", "The transmission of a RTS has exceeded the maximum number of attempts")
136 cls._register_trace(mactxfinalrtsfailed)
138 mactxfinaldatafailed = Trace("MacTxFinalDataFailed", "The transmission of a data packet has exceeded the maximum number of attempts")
140 cls._register_trace(mactxfinaldatafailed)
144 def __init__(self, ec, guid):
145 super(NS3ConstantRateWifiManager, self).__init__(ec, guid)
146 self._home = "ns3-constant-rate-wifi-manager-%s" % self.guid