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.ns3wifimac import NS3BaseWifiMac
25 class NS3StaWifiMac(NS3BaseWifiMac):
26 _rtype = "ns3::StaWifiMac"
29 def _register_attributes(cls):
31 attr_proberequesttimeout = Attribute("ProbeRequestTimeout",
32 "The interval between two consecutive probe request attempts.",
34 default = "+50000000.0ns",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_proberequesttimeout)
41 attr_assocrequesttimeout = Attribute("AssocRequestTimeout",
42 "The interval between two consecutive assoc request attempts.",
44 default = "+500000000.0ns",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_assocrequesttimeout)
51 attr_maxmissedbeacons = Attribute("MaxMissedBeacons",
52 "Number of beacons which much be consecutively missed before we attempt to restart association.",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_maxmissedbeacons)
61 attr_activeprobing = Attribute("ActiveProbing",
62 "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.",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_activeprobing)
71 attr_qossupported = Attribute("QosSupported",
72 "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_qossupported)
81 attr_htsupported = Attribute("HtSupported",
82 "This Boolean attribute is set to enable 802.11n support at this STA",
87 flags = Flags.Reserved | Flags.Construct)
89 cls._register_attribute(attr_htsupported)
91 attr_ctstoselfsupported = Attribute("CtsToSelfSupported",
92 "Use CTS to Self when using a rate that is not in the basic set rate",
97 flags = Flags.Reserved | Flags.Construct)
99 cls._register_attribute(attr_ctstoselfsupported)
101 attr_ctstimeout = Attribute("CtsTimeout",
102 "When this timeout expires, the RTS/CTS handshake has failed.",
104 default = "+75000.0ns",
107 flags = Flags.Reserved | Flags.Construct)
109 cls._register_attribute(attr_ctstimeout)
111 attr_acktimeout = Attribute("AckTimeout",
112 "When this timeout expires, the DATA/ACK handshake has failed.",
114 default = "+75000.0ns",
117 flags = Flags.Reserved | Flags.Construct)
119 cls._register_attribute(attr_acktimeout)
121 attr_basicblockacktimeout = Attribute("BasicBlockAckTimeout",
122 "When this timeout expires, the BASIC_BLOCK_ACK_REQ/BASIC_BLOCK_ACK handshake has failed.",
124 default = "+281000.0ns",
127 flags = Flags.Reserved | Flags.Construct)
129 cls._register_attribute(attr_basicblockacktimeout)
131 attr_compressedblockacktimeout = Attribute("CompressedBlockAckTimeout",
132 "When this timeout expires, the COMPRESSED_BLOCK_ACK_REQ/COMPRESSED_BLOCK_ACK handshake has failed.",
134 default = "+107000.0ns",
137 flags = Flags.Reserved | Flags.Construct)
139 cls._register_attribute(attr_compressedblockacktimeout)
141 attr_sifs = Attribute("Sifs",
142 "The value of the SIFS constant.",
144 default = "+16000.0ns",
147 flags = Flags.Reserved | Flags.Construct)
149 cls._register_attribute(attr_sifs)
151 attr_eifsnodifs = Attribute("EifsNoDifs",
152 "The value of EIFS-DIFS",
154 default = "+60000.0ns",
157 flags = Flags.Reserved | Flags.Construct)
159 cls._register_attribute(attr_eifsnodifs)
161 attr_slot = Attribute("Slot",
162 "The duration of a Slot.",
164 default = "+9000.0ns",
167 flags = Flags.Reserved | Flags.Construct)
169 cls._register_attribute(attr_slot)
171 attr_pifs = Attribute("Pifs",
172 "The value of the PIFS constant.",
174 default = "+25000.0ns",
177 flags = Flags.Reserved | Flags.Construct)
179 cls._register_attribute(attr_pifs)
181 attr_rifs = Attribute("Rifs",
182 "The value of the RIFS constant.",
184 default = "+2000.0ns",
187 flags = Flags.Reserved | Flags.Construct)
189 cls._register_attribute(attr_rifs)
191 attr_maxpropagationdelay = Attribute("MaxPropagationDelay",
192 "The maximum propagation delay. Unused for now.",
194 default = "+3333.0ns",
197 flags = Flags.Reserved | Flags.Construct)
199 cls._register_attribute(attr_maxpropagationdelay)
201 attr_ssid = Attribute("Ssid",
202 "The ssid we want to belong to.",
207 flags = Flags.Reserved | Flags.Construct)
209 cls._register_attribute(attr_ssid)
214 def _register_traces(cls):
216 assoc = Trace("Assoc", "Associated with an access point.")
218 cls._register_trace(assoc)
220 deassoc = Trace("DeAssoc", "Association with an access point lost.")
222 cls._register_trace(deassoc)
224 txokheader = Trace("TxOkHeader", "The header of successfully transmitted packet")
226 cls._register_trace(txokheader)
228 txerrheader = Trace("TxErrHeader", "The header of unsuccessfully transmitted packet")
230 cls._register_trace(txerrheader)
232 mactx = Trace("MacTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
234 cls._register_trace(mactx)
236 mactxdrop = Trace("MacTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
238 cls._register_trace(mactxdrop)
240 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,")
242 cls._register_trace(macpromiscrx)
244 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,")
246 cls._register_trace(macrx)
248 macrxdrop = Trace("MacRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
250 cls._register_trace(macrxdrop)
254 def __init__(self, ec, guid):
255 super(NS3StaWifiMac, self).__init__(ec, guid)
256 self._home = "ns3-sta-wifi-mac-%s" % self.guid