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 as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 from nepi.execution.attribute import Attribute, Flags, Types
20 from nepi.execution.trace import Trace, TraceAttr
21 from nepi.execution.resource import ResourceManager, clsinit_copy, \
22 ResourceState, reschedule_delay
23 from nepi.resources.ns3.ns3wifimac import NS3BaseWifiMac
26 class NS3StaWifiMac(NS3BaseWifiMac):
27 _rtype = "ns3::StaWifiMac"
30 def _register_attributes(cls):
32 attr_proberequesttimeout = Attribute("ProbeRequestTimeout",
33 "The interval between two consecutive probe request attempts.",
35 default = "+50000000.0ns",
38 flags = Flags.Reserved | Flags.Construct)
40 cls._register_attribute(attr_proberequesttimeout)
42 attr_assocrequesttimeout = Attribute("AssocRequestTimeout",
43 "The interval between two consecutive assoc request attempts.",
45 default = "+500000000.0ns",
48 flags = Flags.Reserved | Flags.Construct)
50 cls._register_attribute(attr_assocrequesttimeout)
52 attr_maxmissedbeacons = Attribute("MaxMissedBeacons",
53 "Number of beacons which much be consecutively missed before we attempt to restart association.",
58 flags = Flags.Reserved | Flags.Construct)
60 cls._register_attribute(attr_maxmissedbeacons)
62 attr_activeprobing = Attribute("ActiveProbing",
63 "If true, we send probe requests. If false, we don\'t. NOTE: if more than one STA in your simulation is using active probing, you should enable it at a different simulation time for each STA, otherwise all the STAs will start sending probes at the same time resulting in collisions. See bug 1060 for more info.",
68 flags = Flags.Reserved | Flags.Construct)
70 cls._register_attribute(attr_activeprobing)
72 attr_qossupported = Attribute("QosSupported",
73 "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA",
78 flags = Flags.Reserved | Flags.Construct)
80 cls._register_attribute(attr_qossupported)
82 attr_htsupported = Attribute("HtSupported",
83 "This Boolean attribute is set to enable 802.11n support at this STA",
88 flags = Flags.Reserved | Flags.Construct)
90 cls._register_attribute(attr_htsupported)
92 attr_ctstoselfsupported = Attribute("CtsToSelfSupported",
93 "Use CTS to Self when using a rate that is not in the basic set rate",
98 flags = Flags.Reserved | Flags.Construct)
100 cls._register_attribute(attr_ctstoselfsupported)
102 attr_ctstimeout = Attribute("CtsTimeout",
103 "When this timeout expires, the RTS/CTS handshake has failed.",
105 default = "+75000.0ns",
108 flags = Flags.Reserved | Flags.Construct)
110 cls._register_attribute(attr_ctstimeout)
112 attr_acktimeout = Attribute("AckTimeout",
113 "When this timeout expires, the DATA/ACK handshake has failed.",
115 default = "+75000.0ns",
118 flags = Flags.Reserved | Flags.Construct)
120 cls._register_attribute(attr_acktimeout)
122 attr_basicblockacktimeout = Attribute("BasicBlockAckTimeout",
123 "When this timeout expires, the BASIC_BLOCK_ACK_REQ/BASIC_BLOCK_ACK handshake has failed.",
125 default = "+281000.0ns",
128 flags = Flags.Reserved | Flags.Construct)
130 cls._register_attribute(attr_basicblockacktimeout)
132 attr_compressedblockacktimeout = Attribute("CompressedBlockAckTimeout",
133 "When this timeout expires, the COMPRESSED_BLOCK_ACK_REQ/COMPRESSED_BLOCK_ACK handshake has failed.",
135 default = "+107000.0ns",
138 flags = Flags.Reserved | Flags.Construct)
140 cls._register_attribute(attr_compressedblockacktimeout)
142 attr_sifs = Attribute("Sifs",
143 "The value of the SIFS constant.",
145 default = "+16000.0ns",
148 flags = Flags.Reserved | Flags.Construct)
150 cls._register_attribute(attr_sifs)
152 attr_eifsnodifs = Attribute("EifsNoDifs",
153 "The value of EIFS-DIFS",
155 default = "+60000.0ns",
158 flags = Flags.Reserved | Flags.Construct)
160 cls._register_attribute(attr_eifsnodifs)
162 attr_slot = Attribute("Slot",
163 "The duration of a Slot.",
165 default = "+9000.0ns",
168 flags = Flags.Reserved | Flags.Construct)
170 cls._register_attribute(attr_slot)
172 attr_pifs = Attribute("Pifs",
173 "The value of the PIFS constant.",
175 default = "+25000.0ns",
178 flags = Flags.Reserved | Flags.Construct)
180 cls._register_attribute(attr_pifs)
182 attr_rifs = Attribute("Rifs",
183 "The value of the RIFS constant.",
185 default = "+2000.0ns",
188 flags = Flags.Reserved | Flags.Construct)
190 cls._register_attribute(attr_rifs)
192 attr_maxpropagationdelay = Attribute("MaxPropagationDelay",
193 "The maximum propagation delay. Unused for now.",
195 default = "+3333.0ns",
198 flags = Flags.Reserved | Flags.Construct)
200 cls._register_attribute(attr_maxpropagationdelay)
202 attr_ssid = Attribute("Ssid",
203 "The ssid we want to belong to.",
208 flags = Flags.Reserved | Flags.Construct)
210 cls._register_attribute(attr_ssid)
215 def _register_traces(cls):
217 assoc = Trace("Assoc", "Associated with an access point.")
219 cls._register_trace(assoc)
221 deassoc = Trace("DeAssoc", "Association with an access point lost.")
223 cls._register_trace(deassoc)
225 txokheader = Trace("TxOkHeader", "The header of successfully transmitted packet")
227 cls._register_trace(txokheader)
229 txerrheader = Trace("TxErrHeader", "The header of unsuccessfully transmitted packet")
231 cls._register_trace(txerrheader)
233 mactx = Trace("MacTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
235 cls._register_trace(mactx)
237 mactxdrop = Trace("MacTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
239 cls._register_trace(mactxdrop)
241 macpromiscrx = Trace("MacPromiscRx", "A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a promiscuous trace,")
243 cls._register_trace(macpromiscrx)
245 macrx = Trace("MacRx", "A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a non-promiscuous trace,")
247 cls._register_trace(macrx)
249 macrxdrop = Trace("MacRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
251 cls._register_trace(macrxdrop)
255 def __init__(self, ec, guid):
256 super(NS3StaWifiMac, self).__init__(ec, guid)
257 self._home = "ns3-sta-wifi-mac-%s" % self.guid