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, \
23 from nepi.resources.ns3.ns3wifimac import NS3BaseWifiMac
26 class NS3OcbWifiMac(NS3BaseWifiMac):
27 _rtype = "ns3::OcbWifiMac"
30 def _register_attributes(cls):
32 attr_qossupported = Attribute("QosSupported",
33 "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA",
38 flags = Flags.Reserved | Flags.Construct)
40 cls._register_attribute(attr_qossupported)
42 attr_htsupported = Attribute("HtSupported",
43 "This Boolean attribute is set to enable 802.11n support at this STA",
48 flags = Flags.Reserved | Flags.Construct)
50 cls._register_attribute(attr_htsupported)
52 attr_ctstoselfsupported = Attribute("CtsToSelfSupported",
53 "Use CTS to Self when using a rate that is not in the basic set rate",
58 flags = Flags.Reserved | Flags.Construct)
60 cls._register_attribute(attr_ctstoselfsupported)
62 attr_ctstimeout = Attribute("CtsTimeout",
63 "When this timeout expires, the RTS/CTS handshake has failed.",
65 default = "+75000.0ns",
68 flags = Flags.Reserved | Flags.Construct)
70 cls._register_attribute(attr_ctstimeout)
72 attr_acktimeout = Attribute("AckTimeout",
73 "When this timeout expires, the DATA/ACK handshake has failed.",
75 default = "+75000.0ns",
78 flags = Flags.Reserved | Flags.Construct)
80 cls._register_attribute(attr_acktimeout)
82 attr_basicblockacktimeout = Attribute("BasicBlockAckTimeout",
83 "When this timeout expires, the BASIC_BLOCK_ACK_REQ/BASIC_BLOCK_ACK handshake has failed.",
85 default = "+281000.0ns",
88 flags = Flags.Reserved | Flags.Construct)
90 cls._register_attribute(attr_basicblockacktimeout)
92 attr_compressedblockacktimeout = Attribute("CompressedBlockAckTimeout",
93 "When this timeout expires, the COMPRESSED_BLOCK_ACK_REQ/COMPRESSED_BLOCK_ACK handshake has failed.",
95 default = "+107000.0ns",
98 flags = Flags.Reserved | Flags.Construct)
100 cls._register_attribute(attr_compressedblockacktimeout)
102 attr_sifs = Attribute("Sifs",
103 "The value of the SIFS constant.",
105 default = "+16000.0ns",
108 flags = Flags.Reserved | Flags.Construct)
110 cls._register_attribute(attr_sifs)
112 attr_eifsnodifs = Attribute("EifsNoDifs",
113 "The value of EIFS-DIFS",
115 default = "+60000.0ns",
118 flags = Flags.Reserved | Flags.Construct)
120 cls._register_attribute(attr_eifsnodifs)
122 attr_slot = Attribute("Slot",
123 "The duration of a Slot.",
125 default = "+9000.0ns",
128 flags = Flags.Reserved | Flags.Construct)
130 cls._register_attribute(attr_slot)
132 attr_pifs = Attribute("Pifs",
133 "The value of the PIFS constant.",
135 default = "+25000.0ns",
138 flags = Flags.Reserved | Flags.Construct)
140 cls._register_attribute(attr_pifs)
142 attr_rifs = Attribute("Rifs",
143 "The value of the RIFS constant.",
145 default = "+2000.0ns",
148 flags = Flags.Reserved | Flags.Construct)
150 cls._register_attribute(attr_rifs)
152 attr_maxpropagationdelay = Attribute("MaxPropagationDelay",
153 "The maximum propagation delay. Unused for now.",
155 default = "+3333.0ns",
158 flags = Flags.Reserved | Flags.Construct)
160 cls._register_attribute(attr_maxpropagationdelay)
162 attr_ssid = Attribute("Ssid",
163 "The ssid we want to belong to.",
168 flags = Flags.Reserved | Flags.Construct)
170 cls._register_attribute(attr_ssid)
175 def _register_traces(cls):
177 txokheader = Trace("TxOkHeader", "The header of successfully transmitted packet")
179 cls._register_trace(txokheader)
181 txerrheader = Trace("TxErrHeader", "The header of unsuccessfully transmitted packet")
183 cls._register_trace(txerrheader)
185 mactx = Trace("MacTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
187 cls._register_trace(mactx)
189 mactxdrop = Trace("MacTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
191 cls._register_trace(mactxdrop)
193 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,")
195 cls._register_trace(macpromiscrx)
197 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,")
199 cls._register_trace(macrx)
201 macrxdrop = Trace("MacRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
203 cls._register_trace(macrxdrop)
207 def __init__(self, ec, guid):
208 super(NS3OcbWifiMac, self).__init__(ec, guid)
209 self._home = "ns3-ocb-wifi-mac-%s" % self.guid